From b40c713e7d1a29ff4435ceda24a87ef287cd6fa5 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 16 Jun 2023 12:50:27 +0100 Subject: [PATCH 01/30] Factor out parts of NavigationManager.ts that will be reused --- .../Web.JS/src/Services/NavigationManager.ts | 89 +----------------- .../Web.JS/src/Services/NavigationUtils.ts | 91 +++++++++++++++++++ 2 files changed, 96 insertions(+), 84 deletions(-) create mode 100644 src/Components/Web.JS/src/Services/NavigationUtils.ts diff --git a/src/Components/Web.JS/src/Services/NavigationManager.ts b/src/Components/Web.JS/src/Services/NavigationManager.ts index 9dcfd34cb8e1..a2ce3db67bbb 100644 --- a/src/Components/Web.JS/src/Services/NavigationManager.ts +++ b/src/Components/Web.JS/src/Services/NavigationManager.ts @@ -4,6 +4,7 @@ import '@microsoft/dotnet-js-interop'; import { resetScrollAfterNextBatch } from '../Rendering/Renderer'; import { EventDelegator } from '../Rendering/Events/EventDelegator'; +import { handleClickForNavigationInterception, isWithinBaseUriSpace, toAbsoluteUri } from './NavigationUtils'; let hasEnabledNavigationInterception = false; let hasRegisteredNavigationEventListeners = false; @@ -74,29 +75,10 @@ export function attachToEventDelegator(eventDelegator: EventDelegator): void { return; } - if (event.button !== 0 || eventHasSpecialKey(event)) { - // Don't stop ctrl/meta-click (etc) from opening links in new tabs/windows - return; - } - - if (event.defaultPrevented) { - return; - } - - // Intercept clicks on all elements where the href is within the URI space - // We must explicitly check if it has an 'href' attribute, because if it doesn't, the result might be null or an empty string depending on the browser - const anchorTarget = findAnchorTarget(event); - - if (anchorTarget && canProcessAnchor(anchorTarget)) { - const anchorHref = anchorTarget.getAttribute('href')!; - - const absoluteHref = toAbsoluteUri(anchorHref); - - if (isWithinBaseUriSpace(absoluteHref)) { - event.preventDefault(); - performInternalNavigation(absoluteHref, /* interceptedLink */ true, /* replace */ false); - } - } + handleClickForNavigationInterception(event, absoluteInternalHref => { + event.preventDefault(); + performInternalNavigation(absoluteInternalHref, /* interceptedLink */ true, /* replace */ false); + }); }); } @@ -286,67 +268,6 @@ async function onPopState(state: PopStateEvent) { currentHistoryIndex = history.state?._index ?? 0; } -let testAnchor: HTMLAnchorElement; -export function toAbsoluteUri(relativeUri: string): string { - testAnchor = testAnchor || document.createElement('a'); - testAnchor.href = relativeUri; - return testAnchor.href; -} - -function findAnchorTarget(event: MouseEvent): HTMLAnchorElement | null { - // _blazorDisableComposedPath is a temporary escape hatch in case any problems are discovered - // in this logic. It can be removed in a later release, and should not be considered supported API. - const path = !window['_blazorDisableComposedPath'] && event.composedPath && event.composedPath(); - if (path) { - // This logic works with events that target elements within a shadow root, - // as long as the shadow mode is 'open'. For closed shadows, we can't possibly - // know what internal element was clicked. - for (let i = 0; i < path.length; i++) { - const candidate = path[i]; - if (candidate instanceof Element && candidate.tagName === 'A') { - return candidate as HTMLAnchorElement; - } - } - return null; - } else { - // Since we're adding use of composedPath in a patch, retain compatibility with any - // legacy browsers that don't support it by falling back on the older logic, even - // though it won't work properly with ShadowDOM. This can be removed in the next - // major release. - return findClosestAnchorAncestorLegacy(event.target as Element | null, 'A'); - } -} - -function findClosestAnchorAncestorLegacy(element: Element | null, tagName: string) { - return !element - ? null - : element.tagName === tagName - ? element - : findClosestAnchorAncestorLegacy(element.parentElement, tagName); -} - -function isWithinBaseUriSpace(href: string) { - const baseUriWithoutTrailingSlash = toBaseUriWithoutTrailingSlash(document.baseURI!); - const nextChar = href.charAt(baseUriWithoutTrailingSlash.length); - - return href.startsWith(baseUriWithoutTrailingSlash) - && (nextChar === '' || nextChar === '/' || nextChar === '?' || nextChar === '#'); -} - -function toBaseUriWithoutTrailingSlash(baseUri: string) { - return baseUri.substring(0, baseUri.lastIndexOf('/')); -} - -function eventHasSpecialKey(event: MouseEvent) { - return event.ctrlKey || event.shiftKey || event.altKey || event.metaKey; -} - -function canProcessAnchor(anchorTarget: HTMLAnchorElement) { - const targetAttributeValue = anchorTarget.getAttribute('target'); - const opensInSameFrame = !targetAttributeValue || targetAttributeValue === '_self'; - return opensInSameFrame && anchorTarget.hasAttribute('href') && !anchorTarget.hasAttribute('download'); -} - // Keep in sync with Components/src/NavigationOptions.cs export interface NavigationOptions { forceLoad: boolean; diff --git a/src/Components/Web.JS/src/Services/NavigationUtils.ts b/src/Components/Web.JS/src/Services/NavigationUtils.ts new file mode 100644 index 000000000000..84c7ff4e14a4 --- /dev/null +++ b/src/Components/Web.JS/src/Services/NavigationUtils.ts @@ -0,0 +1,91 @@ +/** + * Checks if a click event corresponds to an tag referencing a URL within the base href, and that interception + * isn't bypassed (e.g., by a 'download' attribute or the user holding a meta key while clicking). + * @param event The event that occurred + * @param callbackIfIntercepted A callback that will be invoked if the event corresponds to a click on an that can be intercepted. + */ +export function handleClickForNavigationInterception(event: MouseEvent, callbackIfIntercepted: (absoluteInternalHref: string) => void): void { + if (event.button !== 0 || eventHasSpecialKey(event)) { + // Don't stop ctrl/meta-click (etc) from opening links in new tabs/windows + return; + } + + if (event.defaultPrevented) { + return; + } + + // Intercept clicks on all elements where the href is within the URI space + // We must explicitly check if it has an 'href' attribute, because if it doesn't, the result might be null or an empty string depending on the browser + const anchorTarget = findAnchorTarget(event); + + if (anchorTarget && canProcessAnchor(anchorTarget)) { + const anchorHref = anchorTarget.getAttribute('href')!; + + const absoluteHref = toAbsoluteUri(anchorHref); + + if (isWithinBaseUriSpace(absoluteHref)) { + callbackIfIntercepted(absoluteHref); + } + } +} + +export function isWithinBaseUriSpace(href: string) { + const baseUriWithoutTrailingSlash = toBaseUriWithoutTrailingSlash(document.baseURI!); + const nextChar = href.charAt(baseUriWithoutTrailingSlash.length); + + return href.startsWith(baseUriWithoutTrailingSlash) + && (nextChar === '' || nextChar === '/' || nextChar === '?' || nextChar === '#'); +} + +function toBaseUriWithoutTrailingSlash(baseUri: string) { + return baseUri.substring(0, baseUri.lastIndexOf('/')); +} + +let testAnchor: HTMLAnchorElement; +export function toAbsoluteUri(relativeUri: string): string { + testAnchor = testAnchor || document.createElement('a'); + testAnchor.href = relativeUri; + return testAnchor.href; +} + +function eventHasSpecialKey(event: MouseEvent) { + return event.ctrlKey || event.shiftKey || event.altKey || event.metaKey; +} + +function canProcessAnchor(anchorTarget: HTMLAnchorElement) { + const targetAttributeValue = anchorTarget.getAttribute('target'); + const opensInSameFrame = !targetAttributeValue || targetAttributeValue === '_self'; + return opensInSameFrame && anchorTarget.hasAttribute('href') && !anchorTarget.hasAttribute('download'); +} + +function findAnchorTarget(event: MouseEvent): HTMLAnchorElement | null { + // _blazorDisableComposedPath is a temporary escape hatch in case any problems are discovered + // in this logic. It can be removed in a later release, and should not be considered supported API. + const path = !window['_blazorDisableComposedPath'] && event.composedPath && event.composedPath(); + if (path) { + // This logic works with events that target elements within a shadow root, + // as long as the shadow mode is 'open'. For closed shadows, we can't possibly + // know what internal element was clicked. + for (let i = 0; i < path.length; i++) { + const candidate = path[i]; + if (candidate instanceof Element && candidate.tagName === 'A') { + return candidate as HTMLAnchorElement; + } + } + return null; + } else { + // Since we're adding use of composedPath in a patch, retain compatibility with any + // legacy browsers that don't support it by falling back on the older logic, even + // though it won't work properly with ShadowDOM. This can be removed in the next + // major release. + return findClosestAnchorAncestorLegacy(event.target as Element | null, 'A'); + } +} + +function findClosestAnchorAncestorLegacy(element: Element | null, tagName: string) { + return !element + ? null + : element.tagName === tagName + ? element + : findClosestAnchorAncestorLegacy(element.parentElement, tagName); +} From b4d0d0ad1f29d6c23dd7a864e25a973e3c9a9358 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 16 Jun 2023 13:27:31 +0100 Subject: [PATCH 02/30] Update DomSync logic to handle entire documents including doctype nodes --- .../src/Rendering/DomMerging/DomSync.ts | 13 +++++++--- src/Components/Web.JS/test/DomSync.test.ts | 24 +++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/Components/Web.JS/src/Rendering/DomMerging/DomSync.ts b/src/Components/Web.JS/src/Rendering/DomMerging/DomSync.ts index 6e5ae2f6243a..720d127545c1 100644 --- a/src/Components/Web.JS/src/Rendering/DomMerging/DomSync.ts +++ b/src/Components/Web.JS/src/Rendering/DomMerging/DomSync.ts @@ -5,13 +5,13 @@ import { applyAnyDeferredValue } from '../DomSpecialPropertyUtil'; import { synchronizeAttributes } from './AttributeSync'; import { UpdateCost, ItemList, Operation, computeEditScript } from './EditScript'; -export function synchronizeDomContent(destination: CommentBoundedRange | Element, newContent: DocumentFragment | Element) { +export function synchronizeDomContent(destination: CommentBoundedRange | Node, newContent: Node) { let destinationParent: Node; let nextDestinationNode: Node | null; let originalNodesForDiff: ItemList; // Figure out how to interpret the 'destination' parameter, since it can come in two very different forms - if (destination instanceof Element) { + if (destination instanceof Node) { destinationParent = destination; nextDestinationNode = destination.firstChild; originalNodesForDiff = destination.childNodes; @@ -70,7 +70,7 @@ export function synchronizeDomContent(destination: CommentBoundedRange | Element // Handle any common trailing items // These can only exist if there were some edits, otherwise everything would be in the set of common leading items - const endAtNodeExclOrNull = destination instanceof Element ? null : destination.endExclusive; + const endAtNodeExclOrNull = destination instanceof Node ? null : destination.endExclusive; while (nextDestinationNode !== endAtNodeExclOrNull) { treatAsMatch(nextDestinationNode!, nextNewContentNode!); nextDestinationNode = nextDestinationNode!.nextSibling; @@ -94,6 +94,9 @@ function treatAsMatch(destination: Node, source: Node) { applyAnyDeferredValue(destination as Element); synchronizeDomContent(destination as Element, source as Element); break; + case Node.DOCUMENT_TYPE_NODE: + // See comment below about doctype nodes. We leave them alone. + break; default: throw new Error(`Not implemented: matching nodes of type ${destination.nodeType}`); } @@ -130,6 +133,10 @@ function domNodeComparer(a: Node, b: Node): UpdateCost { // For the converse (forcing retention, even if that means reordering), we could post-process the list of // inserts/deletes to find matches based on key to treat those pairs as 'move' operations. return (a as Element).tagName === (b as Element).tagName ? UpdateCost.None : UpdateCost.Infinite; + case Node.DOCUMENT_TYPE_NODE: + // It's invalid to insert or delete doctype, and we have no use case for doing that. So just skip such + // nodes by saying they are always unchanged. + return UpdateCost.None; default: // For anything else we know nothing, so the risk-averse choice is to say we can't retain or update the old value return UpdateCost.Infinite; diff --git a/src/Components/Web.JS/test/DomSync.test.ts b/src/Components/Web.JS/test/DomSync.test.ts index 233538702a33..c994d991a365 100644 --- a/src/Components/Web.JS/test/DomSync.test.ts +++ b/src/Components/Web.JS/test/DomSync.test.ts @@ -407,6 +407,30 @@ describe('DomSync', () => { expect(inputRange.min).toBe('950'); expect(inputRange.max).toBe('1050'); }); + + test('should treat doctype nodes as unchanged', () => { + // Can't update a doctype after the document is created, nor is there a use case for doing so + // We just have to skip them, as it would be an error to try removing or inserting them + + // Arrange + const destination = new DOMParser().parseFromString( + `` + + `Hello`, 'text/html'); + const newContent = new DOMParser().parseFromString( + `` + + `Goodbye`, 'text/html'); + const origDocTypeNode = destination.firstChild!; + expect(origDocTypeNode.nodeType).toBe(Node.DOCUMENT_TYPE_NODE); + expect(destination.body.textContent).toBe('Hello'); + + // Act + synchronizeDomContent(destination, newContent); + + // Assert + const newDocTypeNode = destination.firstChild; + expect(newDocTypeNode).toBe(origDocTypeNode); + expect(destination.body.textContent).toBe('Goodbye'); + }); }); function makeExistingContent(html: string): CommentBoundedRange { From f1ec76f3b133fe20f0b75bcc2e582272ccddd2fc Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 16 Jun 2023 13:36:06 +0100 Subject: [PATCH 03/30] Fix an obvious bug in DomSync.ts --- src/Components/Web.JS/src/Rendering/DomMerging/AttributeSync.ts | 2 +- src/Components/Web.JS/src/Rendering/DomMerging/DomSync.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Components/Web.JS/src/Rendering/DomMerging/AttributeSync.ts b/src/Components/Web.JS/src/Rendering/DomMerging/AttributeSync.ts index 89a072a166b0..ad3d4578c9f0 100644 --- a/src/Components/Web.JS/src/Rendering/DomMerging/AttributeSync.ts +++ b/src/Components/Web.JS/src/Rendering/DomMerging/AttributeSync.ts @@ -9,7 +9,7 @@ export function synchronizeAttributes(destination: Element, source: Element) { // Optimize for the common case where all attributes are unchanged and are even still in the same order const destAttrsLength = destAttrs.length; - if (destAttrsLength === destAttrs.length) { + if (destAttrsLength === sourceAttrs.length) { let hasDifference = false; for (let i = 0; i < destAttrsLength; i++) { const sourceAttr = sourceAttrs.item(i)!; diff --git a/src/Components/Web.JS/src/Rendering/DomMerging/DomSync.ts b/src/Components/Web.JS/src/Rendering/DomMerging/DomSync.ts index 720d127545c1..a28c85a1db5f 100644 --- a/src/Components/Web.JS/src/Rendering/DomMerging/DomSync.ts +++ b/src/Components/Web.JS/src/Rendering/DomMerging/DomSync.ts @@ -176,4 +176,3 @@ class SiblingSubsetNodeList implements ItemList { this.length = this.endIndexExcl - this.startIndex; } } - From 87ca0fa6c9f391c41c7d39e418b30a02b72adc38 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 16 Jun 2023 13:36:32 +0100 Subject: [PATCH 04/30] Most basic case of progressively-enhanced nav --- src/Components/Web.JS/src/Boot.Web.ts | 2 + .../src/Services/NavigationEnhancement.ts | 50 +++++++++++++++++++ .../Web.JS/src/Services/NavigationManager.ts | 1 - .../Web.JS/src/Services/NavigationUtils.ts | 1 + 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 src/Components/Web.JS/src/Services/NavigationEnhancement.ts diff --git a/src/Components/Web.JS/src/Boot.Web.ts b/src/Components/Web.JS/src/Boot.Web.ts index d3a438bff051..d1335fa8bdc5 100644 --- a/src/Components/Web.JS/src/Boot.Web.ts +++ b/src/Components/Web.JS/src/Boot.Web.ts @@ -15,6 +15,7 @@ import { shouldAutoStart } from './BootCommon'; import { Blazor } from './GlobalExports'; import { WebStartOptions } from './Platform/WebStartOptions'; import { attachStreamingRenderingListener } from './Rendering/StreamingRendering'; +import { attachProgressivelyEnhancedNavigationListener } from './Services/NavigationEnhancement'; import { WebAssemblyComponentDescriptor } from './Services/ComponentDescriptorDiscovery'; import { ServerComponentDescriptor, discoverComponents } from './Services/ComponentDescriptorDiscovery'; @@ -28,6 +29,7 @@ async function boot(options?: Partial): Promise { await activateInteractiveComponents(options); attachStreamingRenderingListener(options?.ssr); + attachProgressivelyEnhancedNavigationListener(); } async function activateInteractiveComponents(options?: Partial) { diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts new file mode 100644 index 000000000000..1509882891a8 --- /dev/null +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -0,0 +1,50 @@ +import { synchronizeDomContent } from '../Rendering/DomMerging/DomSync'; +import { handleClickForNavigationInterception } from './NavigationUtils'; + +/* +We want this to work independently from all the existing logic for NavigationManager and EventDelegator, since +this feature should be available in minimal .js bundles that don't include support for any interactive mode. +So, this file should not import those modules. + +However, when NavigationManager/EventDelegator are being used, we do have to defer to them since SPA-style +interactive navigation needs to take precedence. The approach is: +- When blazor.web.js starts up, it will enable progressively-enhanced (PE) nav +- If an interactive is added, it will call enableNavigationInterception and that will disable PE nav's event listener. +- When NavigationManager.ts sees a navigation occur, it goes through a complex flow (respecting @preventDefault, + triggering OnLocationChanging, evaluating the URL against the .NET route table, etc). Normally this will conclude + by picking a component page and rendering it without notifying the PE nav logic at all. + - But if no component page is matched, it then explicitly calls back into the PE nav logic to fall back on the logic + that would have happened if there was no interactive . As such, PE nav isn't *really* disabled; it just only + runs as a fallback if nav doesn't match the URL. + - If an interactive is removed, we don't currently handle that. No notification goes back from .NET + to JS about that. But if the scenario becomes important, we could add some disableNavigationInterception and resume PE nav. +*/ + +export function attachProgressivelyEnhancedNavigationListener() { + document.body.addEventListener('click', onBodyClicked); + window.addEventListener('popstate', onPopState); +} + +function onBodyClicked(event: MouseEvent) { + handleClickForNavigationInterception(event, absoluteInternalHref => { + history.pushState(null, /* ignored title */ '', absoluteInternalHref); + performEnhancedPageLoad(absoluteInternalHref); + }); +} + +function onPopState(state: PopStateEvent) { + performEnhancedPageLoad(location.href); +} + +async function performEnhancedPageLoad(internalDestinationHref: string) { + // While this function is async, any exceptions will be treated as unhandled, because + // the caller is not in an async context and disregards the returned Promise + // TODO: Ensure that if we get back an HTTP failure result, we still display the + // returned content. If there isn't any, display the status code. + // TODO: If a second navigation occurs while the first is in flight, discard the first. + // TODO: Deal with streaming SSR. The returned result may be left hanging for a while. + const response = await fetch(internalDestinationHref); + const responseHtml = await response.text(); + const parsedHtml = new DOMParser().parseFromString(responseHtml, 'text/html'); + synchronizeDomContent(document, parsedHtml); +} diff --git a/src/Components/Web.JS/src/Services/NavigationManager.ts b/src/Components/Web.JS/src/Services/NavigationManager.ts index a2ce3db67bbb..8c899e20ded2 100644 --- a/src/Components/Web.JS/src/Services/NavigationManager.ts +++ b/src/Components/Web.JS/src/Services/NavigationManager.ts @@ -76,7 +76,6 @@ export function attachToEventDelegator(eventDelegator: EventDelegator): void { } handleClickForNavigationInterception(event, absoluteInternalHref => { - event.preventDefault(); performInternalNavigation(absoluteInternalHref, /* interceptedLink */ true, /* replace */ false); }); }); diff --git a/src/Components/Web.JS/src/Services/NavigationUtils.ts b/src/Components/Web.JS/src/Services/NavigationUtils.ts index 84c7ff4e14a4..bf6022e15fae 100644 --- a/src/Components/Web.JS/src/Services/NavigationUtils.ts +++ b/src/Components/Web.JS/src/Services/NavigationUtils.ts @@ -24,6 +24,7 @@ export function handleClickForNavigationInterception(event: MouseEvent, callback const absoluteHref = toAbsoluteUri(anchorHref); if (isWithinBaseUriSpace(absoluteHref)) { + event.preventDefault(); callbackIfIntercepted(absoluteHref); } } From 2bce56141b8290e0d5970485ae39b06838ad7c3e Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 16 Jun 2023 13:58:28 +0100 Subject: [PATCH 05/30] Cancel enhanced nav if a second navigation starts --- .../src/Services/NavigationEnhancement.ts | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index 1509882891a8..99f491811610 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -1,3 +1,4 @@ +import { AbortError } from '@microsoft/signalr'; import { synchronizeDomContent } from '../Rendering/DomMerging/DomSync'; import { handleClickForNavigationInterception } from './NavigationUtils'; @@ -20,6 +21,8 @@ interactive navigation needs to take precedence. The approach is: to JS about that. But if the scenario becomes important, we could add some disableNavigationInterception and resume PE nav. */ +let currentEnhancedNavigationAbortController: AbortController | null; + export function attachProgressivelyEnhancedNavigationListener() { document.body.addEventListener('click', onBodyClicked); window.addEventListener('popstate', onPopState); @@ -37,14 +40,29 @@ function onPopState(state: PopStateEvent) { } async function performEnhancedPageLoad(internalDestinationHref: string) { - // While this function is async, any exceptions will be treated as unhandled, because - // the caller is not in an async context and disregards the returned Promise + // First, stop any preceding enhanced page load + currentEnhancedNavigationAbortController?.abort(); + // TODO: Ensure that if we get back an HTTP failure result, we still display the // returned content. If there isn't any, display the status code. - // TODO: If a second navigation occurs while the first is in flight, discard the first. // TODO: Deal with streaming SSR. The returned result may be left hanging for a while. - const response = await fetch(internalDestinationHref); - const responseHtml = await response.text(); + // TODO: If the URL has a hash, scroll to it after updating the DOM (unless this just + // works anyway) + currentEnhancedNavigationAbortController = new AbortController(); + const abortSignal = currentEnhancedNavigationAbortController.signal; + let responseHtml: string; + try { + const response = await fetch(internalDestinationHref, { signal: abortSignal }); + responseHtml = await response.text(); + } catch (ex) { + if ((ex as AbortError)?.name === 'AbortError' && abortSignal.aborted) { + // Not an error + return; + } else { + throw ex; + } + } + const parsedHtml = new DOMParser().parseFromString(responseHtml, 'text/html'); synchronizeDomContent(document, parsedHtml); } From c082517f76ef5f19c46c1df6fff1e7f64edfe3dd Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 16 Jun 2023 14:09:10 +0100 Subject: [PATCH 06/30] Error handling --- .../src/Services/NavigationEnhancement.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index 99f491811610..a7a50830ee0f 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -43,17 +43,16 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { // First, stop any preceding enhanced page load currentEnhancedNavigationAbortController?.abort(); - // TODO: Ensure that if we get back an HTTP failure result, we still display the - // returned content. If there isn't any, display the status code. // TODO: Deal with streaming SSR. The returned result may be left hanging for a while. // TODO: If the URL has a hash, scroll to it after updating the DOM (unless this just // works anyway) currentEnhancedNavigationAbortController = new AbortController(); const abortSignal = currentEnhancedNavigationAbortController.signal; - let responseHtml: string; + let response: Response; + let responseText: string; try { - const response = await fetch(internalDestinationHref, { signal: abortSignal }); - responseHtml = await response.text(); + response = await fetch(internalDestinationHref, { signal: abortSignal }); + responseText = await response.text(); } catch (ex) { if ((ex as AbortError)?.name === 'AbortError' && abortSignal.aborted) { // Not an error @@ -63,6 +62,10 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { } } - const parsedHtml = new DOMParser().parseFromString(responseHtml, 'text/html'); - synchronizeDomContent(document, parsedHtml); + if (response.headers.get('content-type')?.startsWith('text/html')) { + const parsedHtml = new DOMParser().parseFromString(responseText, 'text/html'); + synchronizeDomContent(document, parsedHtml); + } else { + document.documentElement.innerHTML = responseText || `Error: ${response.status} ${responseText}`; + } } From 9a25a40a16836698dd89c386d5f8ef50ecb26ad5 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 16 Jun 2023 14:23:04 +0100 Subject: [PATCH 07/30] Scroll to hash --- .../src/Services/NavigationEnhancement.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index a7a50830ee0f..5f7663e9e761 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -44,8 +44,6 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { currentEnhancedNavigationAbortController?.abort(); // TODO: Deal with streaming SSR. The returned result may be left hanging for a while. - // TODO: If the URL has a hash, scroll to it after updating the DOM (unless this just - // works anyway) currentEnhancedNavigationAbortController = new AbortController(); const abortSignal = currentEnhancedNavigationAbortController.signal; let response: Response; @@ -65,7 +63,20 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { if (response.headers.get('content-type')?.startsWith('text/html')) { const parsedHtml = new DOMParser().parseFromString(responseText, 'text/html'); synchronizeDomContent(document, parsedHtml); + + // Also if there's a hash in the URL, recreate the behavior of scrolling to the corresponding element by ID + const hashPosition = internalDestinationHref.indexOf('#'); + if (hashPosition >= 0) { + const hash = internalDestinationHref.substring(hashPosition + 1); + const targetElem = document.getElementById(hash); + targetElem?.scrollIntoView(); + } } else { - document.documentElement.innerHTML = responseText || `Error: ${response.status} ${responseText}`; + // The response isn't HTML so don't try to parse it that way. If they gave any response text use that, + // and only generate our own error message if it's definitely an error with no text. + const isSuccessStatus = response.status >= 200 && response.status < 300; + document.documentElement.innerHTML = (responseText || isSuccessStatus) + ? responseText + : `Error: ${response.status} ${responseText}`; } } From d3c828463b89c3697b2fd84db9f11ba2bc471ace Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 16 Jun 2023 14:42:58 +0100 Subject: [PATCH 08/30] Refactor towards streaming SSR support --- .../src/Services/NavigationEnhancement.ts | 50 +++++++++++-------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index 5f7663e9e761..3b40c4fadc3f 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -46,37 +46,45 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { // TODO: Deal with streaming SSR. The returned result may be left hanging for a while. currentEnhancedNavigationAbortController = new AbortController(); const abortSignal = currentEnhancedNavigationAbortController.signal; + const responsePromise = fetch(internalDestinationHref, { signal: abortSignal }); + await getResponsePartsWithFraming(responsePromise, abortSignal, + (response, responseText) => { + if (response.headers.get('content-type')?.startsWith('text/html')) { + const parsedHtml = new DOMParser().parseFromString(responseText, 'text/html'); + synchronizeDomContent(document, parsedHtml); + } else { + // The response isn't HTML so don't try to parse it that way. If they gave any response text use that, + // and only generate our own error message if it's definitely an error with no text. + const isSuccessStatus = response.status >= 200 && response.status < 300; + document.documentElement.innerHTML = (responseText || isSuccessStatus) + ? responseText + : `Error: ${response.status} ${responseText}`; + } + }); + + // Finally, if there's a hash in the URL, recreate the behavior of scrolling to the corresponding element by ID + const hashPosition = internalDestinationHref.indexOf('#'); + if (hashPosition >= 0) { + const hash = internalDestinationHref.substring(hashPosition + 1); + const targetElem = document.getElementById(hash); + targetElem?.scrollIntoView(); + } +} + +async function getResponsePartsWithFraming(responsePromise: Promise, abortSignal: AbortSignal, onAllNonStreamingContentReceived: (response: Response, nonStreamingResponseText: string) => void) { let response: Response; let responseText: string; try { - response = await fetch(internalDestinationHref, { signal: abortSignal }); + response = await responsePromise; responseText = await response.text(); } catch (ex) { if ((ex as AbortError)?.name === 'AbortError' && abortSignal.aborted) { - // Not an error + // Not an error; we're just finished return; } else { throw ex; } } - if (response.headers.get('content-type')?.startsWith('text/html')) { - const parsedHtml = new DOMParser().parseFromString(responseText, 'text/html'); - synchronizeDomContent(document, parsedHtml); - - // Also if there's a hash in the URL, recreate the behavior of scrolling to the corresponding element by ID - const hashPosition = internalDestinationHref.indexOf('#'); - if (hashPosition >= 0) { - const hash = internalDestinationHref.substring(hashPosition + 1); - const targetElem = document.getElementById(hash); - targetElem?.scrollIntoView(); - } - } else { - // The response isn't HTML so don't try to parse it that way. If they gave any response text use that, - // and only generate our own error message if it's definitely an error with no text. - const isSuccessStatus = response.status >= 200 && response.status < 300; - document.documentElement.innerHTML = (responseText || isSuccessStatus) - ? responseText - : `Error: ${response.status} ${responseText}`; - } + onAllNonStreamingContentReceived(response, responseText); } From 8aa36986b9434a29d12191c071daa604e675f8f5 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 16 Jun 2023 18:16:58 +0100 Subject: [PATCH 09/30] Integrate with streaming SSR --- .../src/RazorComponentEndpointInvoker.cs | 1 + .../EndpointHtmlRenderer.Streaming.cs | 24 ++++++ .../Results/RazorComponentResultExecutor.cs | 2 + .../src/Services/NavigationEnhancement.ts | 85 ++++++++++++++++--- 4 files changed, 100 insertions(+), 12 deletions(-) diff --git a/src/Components/Endpoints/src/RazorComponentEndpointInvoker.cs b/src/Components/Endpoints/src/RazorComponentEndpointInvoker.cs index 3dba4acecea6..5b5244aa23a1 100644 --- a/src/Components/Endpoints/src/RazorComponentEndpointInvoker.cs +++ b/src/Components/Endpoints/src/RazorComponentEndpointInvoker.cs @@ -34,6 +34,7 @@ public Task RenderComponent() private async Task RenderComponentCore() { _context.Response.ContentType = RazorComponentResultExecutor.DefaultContentType; + _renderer.InitializeStreamingRenderingFraming(_context); if (!await TryValidateRequestAsync(out var isPost, out var handler)) { diff --git a/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs b/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs index 90fabc379eb0..c1714cc60151 100644 --- a/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs +++ b/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs @@ -13,8 +13,25 @@ namespace Microsoft.AspNetCore.Components.Endpoints; internal partial class EndpointHtmlRenderer { + private static readonly string _progressivelyEnhancedNavRequestHeaderName = "blazor-enhanced-nav"; + private static readonly string _streamingRenderingFramingHeaderName = "ssr-framing"; private TextWriter? _streamingUpdatesWriter; private HashSet? _visitedComponentIdsInCurrentStreamingBatch; + private string? _ssrFramingCommentMarkup; + + public void InitializeStreamingRenderingFraming(HttpContext httpContext) + { + if (httpContext.Request.Headers.ContainsKey(_progressivelyEnhancedNavRequestHeaderName)) + { + var id = Guid.NewGuid().ToString(); + httpContext.Response.Headers.Add(_streamingRenderingFramingHeaderName, id); + _ssrFramingCommentMarkup = $""; + } + else + { + _ssrFramingCommentMarkup = string.Empty; + } + } public async Task SendStreamingUpdatesAsync(HttpContext httpContext, Task untilTaskCompleted, TextWriter writer) { @@ -26,10 +43,16 @@ public async Task SendStreamingUpdatesAsync(HttpContext httpContext, Task untilT throw new InvalidOperationException($"{nameof(SendStreamingUpdatesAsync)} can only be called once."); } + if (_ssrFramingCommentMarkup is null) + { + throw new InvalidOperationException("Cannot begin streaming rendering because no framing header was set."); + } + _streamingUpdatesWriter = writer; try { + await writer.WriteAsync(_ssrFramingCommentMarkup); await writer.FlushAsync(); // Make sure the initial HTML was sent await untilTaskCompleted; } @@ -115,6 +138,7 @@ private void SendBatchAsStreamingUpdate(in RenderBatch renderBatch, TextWriter w } writer.Write(""); + writer.Write(_ssrFramingCommentMarkup); } } diff --git a/src/Components/Endpoints/src/Results/RazorComponentResultExecutor.cs b/src/Components/Endpoints/src/Results/RazorComponentResultExecutor.cs index 9d61e92544a9..764ecdbe8d5f 100644 --- a/src/Components/Endpoints/src/Results/RazorComponentResultExecutor.cs +++ b/src/Components/Endpoints/src/Results/RazorComponentResultExecutor.cs @@ -51,6 +51,8 @@ internal static Task RenderComponentToResponse( var endpointHtmlRenderer = httpContext.RequestServices.GetRequiredService(); return endpointHtmlRenderer.Dispatcher.InvokeAsync(async () => { + endpointHtmlRenderer.InitializeStreamingRenderingFraming(httpContext); + // We could pool these dictionary instances if we wanted, and possibly even the ParameterView // backing buffers could come from a pool like they do during rendering. var hostParameters = ParameterView.FromDictionary(new Dictionary diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index 3b40c4fadc3f..ff9b6f67f064 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -43,22 +43,32 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { // First, stop any preceding enhanced page load currentEnhancedNavigationAbortController?.abort(); - // TODO: Deal with streaming SSR. The returned result may be left hanging for a while. + // Now request the new page via fetch, and a special header that tells the server we want it to inject + // framing boundaries to distinguish the initial document and each subsequent streaming SSR update. currentEnhancedNavigationAbortController = new AbortController(); const abortSignal = currentEnhancedNavigationAbortController.signal; - const responsePromise = fetch(internalDestinationHref, { signal: abortSignal }); + const responsePromise = fetch(internalDestinationHref, { + signal: abortSignal, + headers: { 'blazor-enhanced-nav': 'on' }, + }); await getResponsePartsWithFraming(responsePromise, abortSignal, - (response, responseText) => { + (response, initialContent) => { if (response.headers.get('content-type')?.startsWith('text/html')) { - const parsedHtml = new DOMParser().parseFromString(responseText, 'text/html'); + const parsedHtml = new DOMParser().parseFromString(initialContent, 'text/html'); synchronizeDomContent(document, parsedHtml); } else { // The response isn't HTML so don't try to parse it that way. If they gave any response text use that, // and only generate our own error message if it's definitely an error with no text. const isSuccessStatus = response.status >= 200 && response.status < 300; - document.documentElement.innerHTML = (responseText || isSuccessStatus) - ? responseText - : `Error: ${response.status} ${responseText}`; + document.documentElement.innerHTML = (initialContent || isSuccessStatus) + ? initialContent + : `Error: ${response.status} ${initialContent}`; + } + }, + (streamingElementMarkup) => { + const fragment = document.createRange().createContextualFragment(streamingElementMarkup); + while (fragment.firstChild) { + document.body.appendChild(fragment.firstChild); } }); @@ -71,20 +81,71 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { } } -async function getResponsePartsWithFraming(responsePromise: Promise, abortSignal: AbortSignal, onAllNonStreamingContentReceived: (response: Response, nonStreamingResponseText: string) => void) { +async function getResponsePartsWithFraming(responsePromise: Promise, abortSignal: AbortSignal, onInitialDocument: (response: Response, initialDocumentText: string) => void, onStreamingElement: (streamingElementMarkup) => void) { let response: Response; - let responseText: string; + try { response = await responsePromise; - responseText = await response.text(); + if (!response.body) { // Not sure how this can happen, but the TypeScript annotations suggest it can + onInitialDocument(response, ''); + return; + } + + const frameBoundary = response.headers.get('ssr-framing'); + if (!frameBoundary) { + // Shouldn't happen, but perhaps some proxy stripped the headers. In that case we just won't respect streaming and will + // wait for the whole response. + const allResponseText = await response.text(); + onInitialDocument(response, allResponseText); + return; + } + + // This is going to be a framed response, so split it into chunks based on our framing boundaries + let isFirstFramedChunk = true; + await response.body + .pipeThrough(new TextDecoderStream()) + .pipeThrough(splitStream(``)) + .pipeTo(new WritableStream({ + write(chunk) { + // Inside here, we know the chunks correspond precisely to frames within our message framing mechanism. + // The first one is always the initial document that we will merge into the existing DOM. All subsequent ones + // are blocks of ... markup whose insertion would trigger a streaming SSR DOM update. + if (isFirstFramedChunk) { + isFirstFramedChunk = false; + onInitialDocument(response, chunk); + } else { + onStreamingElement(chunk); + } + } + })); } catch (ex) { if ((ex as AbortError)?.name === 'AbortError' && abortSignal.aborted) { - // Not an error; we're just finished + // Not an error. This happens if a different navigation started before this one completed. return; } else { throw ex; } } +} + +function splitStream(frameBoundaryMarker: string) { + let buffer = ''; + + return new TransformStream({ + transform(chunk, controller) { + buffer += chunk; - onAllNonStreamingContentReceived(response, responseText); + // Only call 'split' if we can see at least one marker, and only look for it within the new content (allowing for it to split over chunks) + if (buffer.indexOf(frameBoundaryMarker, buffer.length - chunk.length - frameBoundaryMarker.length) >= 0) { + const frames = buffer.split(frameBoundaryMarker); + frames.slice(0, -1).forEach(part => controller.enqueue(part)); + buffer = frames[frames.length - 1]; + } + }, + flush(controller) { + if (buffer) { + controller.enqueue(buffer); + } + } + }); } From 464ae894806041c776218e2d94714c1b141c1acf Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 16 Jun 2023 18:22:07 +0100 Subject: [PATCH 10/30] Clean up hash handling --- .../Web.JS/src/Services/NavigationEnhancement.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index ff9b6f67f064..db62fd21abf8 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -72,12 +72,15 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { } }); - // Finally, if there's a hash in the URL, recreate the behavior of scrolling to the corresponding element by ID - const hashPosition = internalDestinationHref.indexOf('#'); - if (hashPosition >= 0) { - const hash = internalDestinationHref.substring(hashPosition + 1); - const targetElem = document.getElementById(hash); - targetElem?.scrollIntoView(); + if (!abortSignal.aborted) { + // The whole response including any streaming SSR is now finished, and it was not aborted (no other navigation + // has since started). So finally, recreate the native "scroll to hash" behavior. + const hashPosition = internalDestinationHref.indexOf('#'); + if (hashPosition >= 0) { + const hash = internalDestinationHref.substring(hashPosition + 1); + const targetElem = document.getElementById(hash); + targetElem?.scrollIntoView(); + } } } From 2b09179d827ffee9e35e67557c1dba96f8578702 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 16 Jun 2023 18:39:41 +0100 Subject: [PATCH 11/30] Minor cleanup --- src/Components/Web.JS/src/Services/NavigationEnhancement.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index db62fd21abf8..61cdb394cef7 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -1,4 +1,3 @@ -import { AbortError } from '@microsoft/signalr'; import { synchronizeDomContent } from '../Rendering/DomMerging/DomSync'; import { handleClickForNavigationInterception } from './NavigationUtils'; @@ -122,7 +121,7 @@ async function getResponsePartsWithFraming(responsePromise: Promise, a } })); } catch (ex) { - if ((ex as AbortError)?.name === 'AbortError' && abortSignal.aborted) { + if ((ex as Error).name === 'AbortError' && abortSignal.aborted) { // Not an error. This happens if a different navigation started before this one completed. return; } else { From 165459348170f42813ca916635b012420ba3e819 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 19 Jun 2023 11:50:15 +0100 Subject: [PATCH 12/30] Auto-bypass PE nav when there's an interactive router --- .../Web.JS/src/Services/NavigationEnhancement.ts | 12 +++++++++++- .../Web.JS/src/Services/NavigationManager.ts | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index 61cdb394cef7..2e8f8683cdb4 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -1,10 +1,12 @@ import { synchronizeDomContent } from '../Rendering/DomMerging/DomSync'; +import { isNavigationInterceptionEnabled } from './NavigationManager'; import { handleClickForNavigationInterception } from './NavigationUtils'; /* We want this to work independently from all the existing logic for NavigationManager and EventDelegator, since this feature should be available in minimal .js bundles that don't include support for any interactive mode. -So, this file should not import those modules. +So, this file should not import those modules. Likewise, we don't want NavigationManager.ts to import this module, +since then it would have to bundle all the DOM-diffing logic in blazor.server|webassembly|webview.js. However, when NavigationManager/EventDelegator are being used, we do have to defer to them since SPA-style interactive navigation needs to take precedence. The approach is: @@ -28,6 +30,10 @@ export function attachProgressivelyEnhancedNavigationListener() { } function onBodyClicked(event: MouseEvent) { + if (isNavigationInterceptionEnabled()) { + return; + } + handleClickForNavigationInterception(event, absoluteInternalHref => { history.pushState(null, /* ignored title */ '', absoluteInternalHref); performEnhancedPageLoad(absoluteInternalHref); @@ -35,6 +41,10 @@ function onBodyClicked(event: MouseEvent) { } function onPopState(state: PopStateEvent) { + if (isNavigationInterceptionEnabled()) { + return; + } + performEnhancedPageLoad(location.href); } diff --git a/src/Components/Web.JS/src/Services/NavigationManager.ts b/src/Components/Web.JS/src/Services/NavigationManager.ts index 8c899e20ded2..5e07b98e0749 100644 --- a/src/Components/Web.JS/src/Services/NavigationManager.ts +++ b/src/Components/Web.JS/src/Services/NavigationManager.ts @@ -51,6 +51,10 @@ function enableNavigationInterception(): void { hasEnabledNavigationInterception = true; } +export function isNavigationInterceptionEnabled(): boolean { + return hasEnabledNavigationInterception; +} + function setHasLocationChangingListeners(hasListeners: boolean) { hasLocationChangingEventListeners = hasListeners; } From 2e91fff1c96681687986cf95119657b74fc6e2bf Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 19 Jun 2023 13:02:32 +0100 Subject: [PATCH 13/30] Clean up notes about interaction --- .../src/Services/NavigationEnhancement.ts | 48 +++++++++++-------- .../Web.JS/src/Services/NavigationManager.ts | 15 ++---- .../Web.JS/src/Services/NavigationUtils.ts | 10 ++++ 3 files changed, 40 insertions(+), 33 deletions(-) diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index 2e8f8683cdb4..f625704f039f 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -1,25 +1,31 @@ import { synchronizeDomContent } from '../Rendering/DomMerging/DomSync'; -import { isNavigationInterceptionEnabled } from './NavigationManager'; -import { handleClickForNavigationInterception } from './NavigationUtils'; +import { handleClickForNavigationInterception, hasInteractiveRouter } from './NavigationUtils'; /* -We want this to work independently from all the existing logic for NavigationManager and EventDelegator, since -this feature should be available in minimal .js bundles that don't include support for any interactive mode. -So, this file should not import those modules. Likewise, we don't want NavigationManager.ts to import this module, -since then it would have to bundle all the DOM-diffing logic in blazor.server|webassembly|webview.js. - -However, when NavigationManager/EventDelegator are being used, we do have to defer to them since SPA-style -interactive navigation needs to take precedence. The approach is: -- When blazor.web.js starts up, it will enable progressively-enhanced (PE) nav -- If an interactive is added, it will call enableNavigationInterception and that will disable PE nav's event listener. -- When NavigationManager.ts sees a navigation occur, it goes through a complex flow (respecting @preventDefault, - triggering OnLocationChanging, evaluating the URL against the .NET route table, etc). Normally this will conclude - by picking a component page and rendering it without notifying the PE nav logic at all. - - But if no component page is matched, it then explicitly calls back into the PE nav logic to fall back on the logic - that would have happened if there was no interactive . As such, PE nav isn't *really* disabled; it just only - runs as a fallback if nav doesn't match the URL. - - If an interactive is removed, we don't currently handle that. No notification goes back from .NET - to JS about that. But if the scenario becomes important, we could add some disableNavigationInterception and resume PE nav. +In effect, we have two separate client-side navigation mechanisms: + +[1] Interactive client-side routing. This is the traditional Blazor Server/WebAssembly navigation mechanism for SPAs. + It is enabled whenever you have a rendering as interactive. This intercepts all navigation within the + base href URI space and tries to display a corresponding [Route] component or the NotFoundContent. +[2] Progressively-enhanced navigation. This is a new mechanism in .NET 8 and is only relevant for multi-page apps. + It is enabled when you load blazor.web.js and don't have an interactive . This intercepts navigation within + the base href URI space and tries to load it via a `fetch` request and DOM syncing. + +Only one of these can be enabled at a time, otherwise both would be trying to intercept click/popstate and act on them. +In fact even if we made the event handlers able to coexist, the two together would still not produce useful behaviors because +[1] implies you have a , and that will try to supply UI content for all pages or NotFoundContent if the URL doesn't +match a [Route] component, so there would be nothing left for [2] to handle. + +So, whenever [1] is enabled, we automatically disable [2]. + +However, a single site can use both [1] and [2] on different URLs. + - You can navigate from [1] to [2] by setting up the interactive not to know about any [Route] components in your MPA, + and so it will fall back on a full-page load to get from the SPA URLs to the MPA URLs. + - You can navigate from [2] to [1] in that it just works by default. A can be added dynamically and will then take + over and disable [2]. + +Note that we don't reference NavigationManager.ts from NavigationEnhancement.ts or vice-versa. This is to ensure we could produce +different bundles that only contain minimal content. */ let currentEnhancedNavigationAbortController: AbortController | null; @@ -30,7 +36,7 @@ export function attachProgressivelyEnhancedNavigationListener() { } function onBodyClicked(event: MouseEvent) { - if (isNavigationInterceptionEnabled()) { + if (hasInteractiveRouter()) { return; } @@ -41,7 +47,7 @@ function onBodyClicked(event: MouseEvent) { } function onPopState(state: PopStateEvent) { - if (isNavigationInterceptionEnabled()) { + if (hasInteractiveRouter()) { return; } diff --git a/src/Components/Web.JS/src/Services/NavigationManager.ts b/src/Components/Web.JS/src/Services/NavigationManager.ts index 5e07b98e0749..b69e4446ba56 100644 --- a/src/Components/Web.JS/src/Services/NavigationManager.ts +++ b/src/Components/Web.JS/src/Services/NavigationManager.ts @@ -4,9 +4,8 @@ import '@microsoft/dotnet-js-interop'; import { resetScrollAfterNextBatch } from '../Rendering/Renderer'; import { EventDelegator } from '../Rendering/Events/EventDelegator'; -import { handleClickForNavigationInterception, isWithinBaseUriSpace, toAbsoluteUri } from './NavigationUtils'; +import { handleClickForNavigationInterception, hasInteractiveRouter, isWithinBaseUriSpace, setHasInteractiveRouter, toAbsoluteUri } from './NavigationUtils'; -let hasEnabledNavigationInterception = false; let hasRegisteredNavigationEventListeners = false; let hasLocationChangingEventListeners = false; let currentHistoryIndex = 0; @@ -22,7 +21,7 @@ let resolveCurrentNavigation: ((shouldContinueNavigation: boolean) => void) | nu // These are the functions we're making available for invocation from .NET export const internalFunctions = { listenForNavigationEvents, - enableNavigationInterception, + enableNavigationInterception: setHasInteractiveRouter, setHasLocationChangingListeners, endLocationChanging, navigateTo: navigateToFromDotNet, @@ -47,14 +46,6 @@ function listenForNavigationEvents( currentHistoryIndex = history.state?._index ?? 0; } -function enableNavigationInterception(): void { - hasEnabledNavigationInterception = true; -} - -export function isNavigationInterceptionEnabled(): boolean { - return hasEnabledNavigationInterception; -} - function setHasLocationChangingListeners(hasListeners: boolean) { hasLocationChangingEventListeners = hasListeners; } @@ -75,7 +66,7 @@ export function attachToEventDelegator(eventDelegator: EventDelegator): void { // running its simulated bubbling process so that we can respect any preventDefault requests. // So instead of registering our own native event, register using the EventDelegator. eventDelegator.notifyAfterClick(event => { - if (!hasEnabledNavigationInterception) { + if (!hasInteractiveRouter()) { return; } diff --git a/src/Components/Web.JS/src/Services/NavigationUtils.ts b/src/Components/Web.JS/src/Services/NavigationUtils.ts index bf6022e15fae..d736ae434d70 100644 --- a/src/Components/Web.JS/src/Services/NavigationUtils.ts +++ b/src/Components/Web.JS/src/Services/NavigationUtils.ts @@ -1,3 +1,5 @@ +let hasInteractiveRouterValue = false; + /** * Checks if a click event corresponds to an tag referencing a URL within the base href, and that interception * isn't bypassed (e.g., by a 'download' attribute or the user holding a meta key while clicking). @@ -90,3 +92,11 @@ function findClosestAnchorAncestorLegacy(element: Element | null, tagName: strin ? element : findClosestAnchorAncestorLegacy(element.parentElement, tagName); } + +export function hasInteractiveRouter(): boolean { + return hasInteractiveRouterValue; +} + +export function setHasInteractiveRouter() { + hasInteractiveRouterValue = true; +} From c78e62b038db3d4c041f1ba6bc4ef9339f801550 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 19 Jun 2023 14:38:31 +0100 Subject: [PATCH 14/30] Start up interactive components after enhanced nav. This is not a complete implementation of #48763 but will be OK for preview 6. --- src/Components/Web.JS/src/Boot.Web.ts | 24 ++++++++++++++----- .../src/Services/NavigationEnhancement.ts | 16 ++++++++++++- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/Components/Web.JS/src/Boot.Web.ts b/src/Components/Web.JS/src/Boot.Web.ts index d1335fa8bdc5..e0af6ac20cfc 100644 --- a/src/Components/Web.JS/src/Boot.Web.ts +++ b/src/Components/Web.JS/src/Boot.Web.ts @@ -15,33 +15,45 @@ import { shouldAutoStart } from './BootCommon'; import { Blazor } from './GlobalExports'; import { WebStartOptions } from './Platform/WebStartOptions'; import { attachStreamingRenderingListener } from './Rendering/StreamingRendering'; -import { attachProgressivelyEnhancedNavigationListener } from './Services/NavigationEnhancement'; +import { attachProgressivelyEnhancedNavigationListener, detachProgressivelyEnhancedNavigationListener } from './Services/NavigationEnhancement'; import { WebAssemblyComponentDescriptor } from './Services/ComponentDescriptorDiscovery'; import { ServerComponentDescriptor, discoverComponents } from './Services/ComponentDescriptorDiscovery'; let started = false; +let webStartOptions: Partial | undefined; async function boot(options?: Partial): Promise { if (started) { throw new Error('Blazor has already started.'); } started = true; - await activateInteractiveComponents(options); + webStartOptions = options; attachStreamingRenderingListener(options?.ssr); - attachProgressivelyEnhancedNavigationListener(); + attachProgressivelyEnhancedNavigationListener(activateInteractiveComponents); + await activateInteractiveComponents(); } -async function activateInteractiveComponents(options?: Partial) { +async function activateInteractiveComponents() { const serverComponents = discoverComponents(document, 'server') as ServerComponentDescriptor[]; const webAssemblyComponents = discoverComponents(document, 'webassembly') as WebAssemblyComponentDescriptor[]; if (serverComponents.length) { - await startCircuit(options?.circuit, serverComponents); + // TEMPORARY until https://github.com/dotnet/aspnetcore/issues/48763 is implemented + // As soon we we see you have interactive components, we'll stop doing enhanced nav even if you don't have an interactive router + // This is because, otherwise, we would need a way to add new interactive root components to an existing circuit and that's #48763 + detachProgressivelyEnhancedNavigationListener(); + + await startCircuit(webStartOptions?.circuit, serverComponents); } if (webAssemblyComponents.length) { - await startWebAssembly(options?.webAssembly, webAssemblyComponents); + // TEMPORARY until https://github.com/dotnet/aspnetcore/issues/48763 is implemented + // As soon we we see you have interactive components, we'll stop doing enhanced nav even if you don't have an interactive router + // This is because, otherwise, we would need a way to add new interactive root components to an existing WebAssembly runtime and that's #48763 + detachProgressivelyEnhancedNavigationListener(); + + await startWebAssembly(webStartOptions?.webAssembly, webAssemblyComponents); } } diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index f625704f039f..e6015219c3c3 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -29,12 +29,19 @@ different bundles that only contain minimal content. */ let currentEnhancedNavigationAbortController: AbortController | null; +let onDocumentUpdatedCallback: Function = () => {}; -export function attachProgressivelyEnhancedNavigationListener() { +export function attachProgressivelyEnhancedNavigationListener(onDocumentUpdated: Function) { + onDocumentUpdatedCallback = onDocumentUpdated; document.body.addEventListener('click', onBodyClicked); window.addEventListener('popstate', onPopState); } +export function detachProgressivelyEnhancedNavigationListener() { + document.body.removeEventListener('click', onBodyClicked); + window.removeEventListener('popstate', onPopState); +} + function onBodyClicked(event: MouseEvent) { if (hasInteractiveRouter()) { return; @@ -88,6 +95,13 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { }); if (!abortSignal.aborted) { + // TEMPORARY until https://github.com/dotnet/aspnetcore/issues/48763 is implemented + // We should really be doing this on the `onInitialDocument` callback *and* inside the custom element logic + // so we can add interactive components immediately on each update. Until #48763 is implemented, the stopgap implementation + // is just to do it when the enhanced nav process completes entirely, and then if we do add any interactive components, we + // disable enhanced nav completely. + onDocumentUpdatedCallback(); + // The whole response including any streaming SSR is now finished, and it was not aborted (no other navigation // has since started). So finally, recreate the native "scroll to hash" behavior. const hashPosition = internalDestinationHref.indexOf('#'); From a1da413be0650e3bce837039c4655038dfb386de Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 19 Jun 2023 16:09:25 +0100 Subject: [PATCH 15/30] Initial E2E test --- .../EnhancedNavigationTest.cs | 38 +++++++++++++++++++ .../RazorComponents/App.razor | 2 +- .../RazorComponents/Shared/MainLayout.razor | 7 ++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs create mode 100644 src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor diff --git a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs new file mode 100644 index 000000000000..c5a913058bbd --- /dev/null +++ b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures; +using Microsoft.AspNetCore.Components.E2ETest.Infrastructure; +using Microsoft.AspNetCore.E2ETesting; +using TestServer; +using Xunit.Abstractions; +using Components.TestServer.RazorComponents; +using OpenQA.Selenium; + +namespace Microsoft.AspNetCore.Components.E2ETests.ServerRenderingTests; + +public class EnhancedNavigationTest : ServerTestBase>> +{ + public EnhancedNavigationTest( + BrowserFixture browserFixture, + BasicTestAppServerSiteFixture> serverFixture, + ITestOutputHelper output) + : base(browserFixture, serverFixture, output) + { + } + + [Fact] + public void CanNavigateToAnotherPageWhilePreservingCommonDOMElements() + { + Navigate(ServerPathBase); + + var h1Elem = Browser.Exists(By.TagName("h1")); + Browser.Equal("Hello", () => h1Elem.Text); + + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Streaming")).Click(); + + // Important: we're checking the *same*

element as earlier, showing that we got to the + // destination, and it's done so without a page load, and it preserved the element + Browser.Equal("Streaming Rendering", () => h1Elem.Text); + } +} diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/App.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/App.razor index bbef6b531009..0dead9f2a484 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/App.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/App.razor @@ -10,7 +10,7 @@ - + diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor new file mode 100644 index 000000000000..82dcca0751b8 --- /dev/null +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor @@ -0,0 +1,7 @@ +@inherits LayoutComponentBase + +
+@Body From 500af8980da3f7277e6290bb32b067cf36493858 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 19 Jun 2023 16:16:29 +0100 Subject: [PATCH 16/30] E2E tests for streaming SSR + enhanced nav --- .../StreamingRenderingTest.cs | 45 +++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/src/Components/test/E2ETest/ServerRenderingTests/StreamingRenderingTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/StreamingRenderingTest.cs index 9fad0a29a14f..c0783e662156 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/StreamingRenderingTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/StreamingRenderingTest.cs @@ -34,13 +34,28 @@ public void CanRenderNonstreamingPageWithoutInjectingStreamingMarkers() Assert.DoesNotContain(" originalH1Elem.Text); + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Streaming")).Click(); + } + else + { + Navigate($"{ServerPathBase}/streaming"); + originalH1Elem = Browser.Exists(By.TagName("h1")); + } // Initial "waiting" state - Browser.Equal("Streaming Rendering", () => Browser.Exists(By.TagName("h1")).Text); + Browser.Equal("Streaming Rendering", () => originalH1Elem.Text); var getStatusText = () => Browser.Exists(By.Id("status")); var getDisplayedItems = () => Browser.FindElements(By.TagName("li")); Assert.Equal("Waiting for more...", getStatusText().Text); @@ -66,13 +81,27 @@ public void CanPerformStreamingRendering() Browser.Equal("Finished", () => getStatusText().Text); } - [Fact] - public void RetainsDomNodesDuringStreamingRenderingUpdates() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void RetainsDomNodesDuringStreamingRenderingUpdates(bool duringEnhancedNavigation) { - Navigate($"{ServerPathBase}/streaming"); + IWebElement originalH1Elem; + + if (duringEnhancedNavigation) + { + Navigate(ServerPathBase); + originalH1Elem = Browser.Exists(By.TagName("h1")); + Browser.Equal("Hello", () => originalH1Elem.Text); + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Streaming")).Click(); + } + else + { + Navigate($"{ServerPathBase}/streaming"); + originalH1Elem = Browser.Exists(By.TagName("h1")); + } // Initial "waiting" state - var originalH1Elem = Browser.Exists(By.TagName("h1")); var originalStatusElem = Browser.Exists(By.Id("status")); Assert.Equal("Streaming Rendering", originalH1Elem.Text); Assert.Equal("Waiting for more...", originalStatusElem.Text); From 683e8708c5804d8a3054b0138c0dc67fee06752b Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 19 Jun 2023 16:59:50 +0100 Subject: [PATCH 17/30] More E2E cases --- .../src/Services/NavigationEnhancement.ts | 17 ++++++++----- .../EnhancedNavigationTest.cs | 24 +++++++++++++++++++ .../RazorComponentEndpointsStartup.cs | 16 +++++++++++++ .../RazorComponents/Shared/MainLayout.razor | 5 +++- 4 files changed, 55 insertions(+), 7 deletions(-) diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index e6015219c3c3..67433782e402 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -76,15 +76,20 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { await getResponsePartsWithFraming(responsePromise, abortSignal, (response, initialContent) => { if (response.headers.get('content-type')?.startsWith('text/html')) { + // For HTML responses, regardless of the status code, display it const parsedHtml = new DOMParser().parseFromString(initialContent, 'text/html'); synchronizeDomContent(document, parsedHtml); + } else if ((response.status < 200 || response.status >= 300) && !initialContent) { + // For any non-success response that has no content at all, make up our own error UI + document.documentElement.innerHTML = `Error: ${response.status} ${initialContent}`; } else { - // The response isn't HTML so don't try to parse it that way. If they gave any response text use that, - // and only generate our own error message if it's definitely an error with no text. - const isSuccessStatus = response.status >= 200 && response.status < 300; - document.documentElement.innerHTML = (initialContent || isSuccessStatus) - ? initialContent - : `Error: ${response.status} ${initialContent}`; + // For any other response, it's success but not HTML. It might be plain text, or an image, + // or something else. Since we can't know what to do with it, fall back on a full reload, + // even though that means we have to request the content a second time. + // The ? trick here is the same workaround as described in #10839, and without it, the user + // would not be able to use the back button afterwards. + history.replaceState(null, '', internalDestinationHref + '?'); + location.replace(internalDestinationHref); } }, (streamingElementMarkup) => { diff --git a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs index c5a913058bbd..d0c4648df482 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs @@ -35,4 +35,28 @@ public void CanNavigateToAnotherPageWhilePreservingCommonDOMElements() // destination, and it's done so without a page load, and it preserved the element Browser.Equal("Streaming Rendering", () => h1Elem.Text); } + + [Fact] + public void CanNavigateToAnHtmlPageWithAnErrorStatus() + { + Navigate(ServerPathBase); + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Error page with 404 content")).Click(); + Browser.Equal("404", () => Browser.Exists(By.TagName("h1")).Text); + } + + [Fact] + public void DisplaysStatusCodeIfResponseIsErrorWithNoContent() + { + Navigate(ServerPathBase); + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Error page with no content")).Click(); + Browser.Equal("Error: 404", () => Browser.Exists(By.TagName("body")).Text); + } + + [Fact] + public void CanNavigateToNonHtmlResponse() + { + Navigate(ServerPathBase); + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Non-HTML page")).Click(); + Browser.Equal("Hello, this is plain text", () => Browser.Exists(By.TagName("body")).Text); + } } diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs b/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs index 0da1eb13c0cd..db87006b3205 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs +++ b/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs @@ -56,7 +56,23 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) StreamingRendering.MapEndpoints(endpoints); StreamingRenderingForm.MapEndpoints(endpoints); + + MapEnhancedNavigationEndpoints(endpoints); }); }); } + + private static void MapEnhancedNavigationEndpoints(IEndpointRouteBuilder endpoints) + { + // Used when testing that enhanced nav can show non-HTML responses (which it does by doing a full navigation) + endpoints.Map("/non-html-response", () => "Hello, this is plain text"); + + // Used when testing that enhanced nav displays content even if the response is an error status code + endpoints.Map("/give-404-with-content", async (HttpResponse response) => + { + response.StatusCode = 404; + response.ContentType = "text/html"; + await response.WriteAsync("

404

Sorry, there's nothing here! This is a custom server-generated 404 message.

"); + }); + } } diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor index 82dcca0751b8..cbfac2be6d7e 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor @@ -1,7 +1,10 @@ @inherits LayoutComponentBase
@Body From 1b070e7ee9da95de2d2ec470ece269e8a07a4901 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 19 Jun 2023 17:26:48 +0100 Subject: [PATCH 18/30] E2E test for scrolling to hash --- .../EnhancedNavigationTest.cs | 19 +++++++++++++ .../Pages/PageForScrollingToHash.razor | 27 +++++++++++++++++++ .../RazorComponents/Shared/MainLayout.razor | 3 ++- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageForScrollingToHash.razor diff --git a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs index d0c4648df482..9bbca5b5a44d 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs @@ -8,6 +8,7 @@ using Xunit.Abstractions; using Components.TestServer.RazorComponents; using OpenQA.Selenium; +using System.Globalization; namespace Microsoft.AspNetCore.Components.E2ETests.ServerRenderingTests; @@ -59,4 +60,22 @@ public void CanNavigateToNonHtmlResponse() Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Non-HTML page")).Click(); Browser.Equal("Hello, this is plain text", () => Browser.Exists(By.TagName("body")).Text); } + + [Fact] + public void ScrollsToHashWithContentAddedAsynchronously() + { + Navigate(ServerPathBase); + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Scroll to hash")).Click(); + Assert.Equal(0, BrowserScrollY); + + var asyncContentHeader = Browser.Exists(By.Id("some-content")); + Browser.Equal("Some content", () => asyncContentHeader.Text); + Browser.True(() => BrowserScrollY > 500); + } + + private long BrowserScrollY + { + get => Convert.ToInt64(((IJavaScriptExecutor)Browser).ExecuteScript("return window.scrollY"), CultureInfo.CurrentCulture); + set => ((IJavaScriptExecutor)Browser).ExecuteScript($"window.scrollTo(0, {value})"); + } } diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageForScrollingToHash.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageForScrollingToHash.razor new file mode 100644 index 000000000000..83b81f9073ca --- /dev/null +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageForScrollingToHash.razor @@ -0,0 +1,27 @@ +@page "/scroll-to-hash" +@attribute [StreamRendering(true)] + +Page for scrolling to hash + +

Hello

+ +

If you scroll down a long way, you'll find more content. We add it asynchronously via streaming rendering.

+ +
spacer
+ +@if (showContent) +{ +

Some content

+ +

This is the content.

+} + +@code { + bool showContent; + + protected override async Task OnInitializedAsync() + { + await Task.Delay(1000); + showContent = true; + } +} diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor index cbfac2be6d7e..bd89feea49ce 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor @@ -4,7 +4,8 @@ Streaming | Error page with 404 content | Error page with no content | - Non-HTML page + Non-HTML page | + Scroll to hash
@Body From b1b1b2a391057b109aecf2e96ac11f418c6f62be Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 19 Jun 2023 17:45:46 +0100 Subject: [PATCH 19/30] Fix typo --- src/Components/Web.JS/src/Services/NavigationEnhancement.ts | 2 +- .../test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index 67433782e402..74ae846a543b 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -81,7 +81,7 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { synchronizeDomContent(document, parsedHtml); } else if ((response.status < 200 || response.status >= 300) && !initialContent) { // For any non-success response that has no content at all, make up our own error UI - document.documentElement.innerHTML = `Error: ${response.status} ${initialContent}`; + document.documentElement.innerHTML = `Error: ${response.status} ${response.statusText}`; } else { // For any other response, it's success but not HTML. It might be plain text, or an image, // or something else. Since we can't know what to do with it, fall back on a full reload, diff --git a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs index 9bbca5b5a44d..3256a762dd2d 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs @@ -50,7 +50,7 @@ public void DisplaysStatusCodeIfResponseIsErrorWithNoContent() { Navigate(ServerPathBase); Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Error page with no content")).Click(); - Browser.Equal("Error: 404", () => Browser.Exists(By.TagName("body")).Text); + Browser.Equal("Error: 404 Not Found", () => Browser.Exists(By.TagName("body")).Text); } [Fact] From 8b039c611c66615bfe2fabfe88c092a8bc09a51e Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 19 Jun 2023 17:52:11 +0100 Subject: [PATCH 20/30] Another comment fix --- src/Components/Web.JS/src/Services/NavigationEnhancement.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index 74ae846a543b..7a6497d2e22b 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -83,9 +83,9 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { // For any non-success response that has no content at all, make up our own error UI document.documentElement.innerHTML = `Error: ${response.status} ${response.statusText}`; } else { - // For any other response, it's success but not HTML. It might be plain text, or an image, - // or something else. Since we can't know what to do with it, fall back on a full reload, - // even though that means we have to request the content a second time. + // For any other response, it's not HTML and we don't know what to do. It might be plain text, + // or an image, or something else. So fall back on a full reload, even though that means we + // have to request the content a second time. // The ? trick here is the same workaround as described in #10839, and without it, the user // would not be able to use the back button afterwards. history.replaceState(null, '', internalDestinationHref + '?'); From a9791edbb61b5fcd1f3dd57d43491f783687aa73 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 20 Jun 2023 14:29:55 +0100 Subject: [PATCH 21/30] Respect the disableDomPreservation flag --- src/Components/Web.JS/src/Boot.Web.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Components/Web.JS/src/Boot.Web.ts b/src/Components/Web.JS/src/Boot.Web.ts index e0af6ac20cfc..072ff0bfac89 100644 --- a/src/Components/Web.JS/src/Boot.Web.ts +++ b/src/Components/Web.JS/src/Boot.Web.ts @@ -30,7 +30,11 @@ async function boot(options?: Partial): Promise { webStartOptions = options; attachStreamingRenderingListener(options?.ssr); - attachProgressivelyEnhancedNavigationListener(activateInteractiveComponents); + + if (!options?.ssr?.disableDomPreservation) { + attachProgressivelyEnhancedNavigationListener(activateInteractiveComponents); + } + await activateInteractiveComponents(); } From 22a772a0df528ca0307617aab8b2d1cbb489286e Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 20 Jun 2023 14:36:23 +0100 Subject: [PATCH 22/30] Fix build --- .../Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs b/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs index c1714cc60151..ffc3a60679d7 100644 --- a/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs +++ b/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs @@ -13,8 +13,8 @@ namespace Microsoft.AspNetCore.Components.Endpoints; internal partial class EndpointHtmlRenderer { - private static readonly string _progressivelyEnhancedNavRequestHeaderName = "blazor-enhanced-nav"; - private static readonly string _streamingRenderingFramingHeaderName = "ssr-framing"; + private const string _progressivelyEnhancedNavRequestHeaderName = "blazor-enhanced-nav"; + private const string _streamingRenderingFramingHeaderName = "ssr-framing"; private TextWriter? _streamingUpdatesWriter; private HashSet? _visitedComponentIdsInCurrentStreamingBatch; private string? _ssrFramingCommentMarkup; From bd15759902d729c451742e531ccec81c1f4e7619 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 20 Jun 2023 15:09:49 +0100 Subject: [PATCH 23/30] Fix E2E test disposal issue --- .../ServerRenderingTests/EnhancedNavigationTest.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs index 3256a762dd2d..c80ca407fd0d 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs @@ -22,6 +22,11 @@ public EnhancedNavigationTest( { } + // One of the tests here makes use of the streaming rendering page, which uses global state + // so we can't run at the same time as other such tests + public override Task InitializeAsync() + => InitializeAsync(BrowserFixture.StreamingContext); + [Fact] public void CanNavigateToAnotherPageWhilePreservingCommonDOMElements() { @@ -35,6 +40,9 @@ public void CanNavigateToAnotherPageWhilePreservingCommonDOMElements() // Important: we're checking the *same*

element as earlier, showing that we got to the // destination, and it's done so without a page load, and it preserved the element Browser.Equal("Streaming Rendering", () => h1Elem.Text); + + // We have to make the response finish otherwise the test will fail when it tries to dispose the server + Browser.FindElement(By.Id("end-response-link")).Click(); } [Fact] From 8191949b4c3723ef26e654d072ac8c89b2fdc5b0 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 20 Jun 2023 16:31:20 +0100 Subject: [PATCH 24/30] Support navigations, plus further test case for errors --- .../EndpointHtmlRenderer.Streaming.cs | 17 ++++----- .../src/Rendering/StreamingRendering.ts | 24 ++++++++++++ .../src/Services/NavigationEnhancement.ts | 7 +++- .../EnhancedNavigationTest.cs | 38 +++++++++++++++++++ .../StreamingRenderingTest.cs | 18 +++++++++ .../Pages/PageForScrollingToHash.razor | 2 +- .../Pages/PageThatRedirects.razor | 8 ++++ .../PageThatRedirectsWhileStreaming.razor | 11 ++++++ .../Pages/PageThatThrowsWhileStreaming.razor | 10 +++++ .../RazorComponents/Shared/MainLayout.razor | 5 ++- 10 files changed, 128 insertions(+), 12 deletions(-) create mode 100644 src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirects.razor create mode 100644 src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirectsWhileStreaming.razor create mode 100644 src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatThrowsWhileStreaming.razor diff --git a/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs b/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs index ffc3a60679d7..4e15c1f8f977 100644 --- a/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs +++ b/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Runtime.InteropServices; +using System.Text.Encodings.Web; using Microsoft.AspNetCore.Components.RenderTree; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; @@ -63,9 +64,7 @@ public async Task SendStreamingUpdatesAsync(HttpContext httpContext, Task untilT catch (Exception ex) { HandleExceptionAfterResponseStarted(_httpContext, writer, ex); - - // The rest of the pipeline can treat this as a regular unhandled exception - // TODO: Is this really right? I think we'll terminate the response in an invalid way. + await writer.FlushAsync(); // Important otherwise the client won't receive the error message, as we're about to fail the pipeline throw; } } @@ -167,16 +166,16 @@ private static void HandleExceptionAfterResponseStarted(HttpContext httpContext, ? exception.ToString() : "There was an unhandled exception on the current request. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSettings.Development.json'"; - writer.Write(""); + writer.Write(""); } private static void HandleNavigationAfterResponseStarted(TextWriter writer, string destinationUrl) { - writer.Write(""); + writer.Write(""); } protected override void WriteComponentHtml(int componentId, TextWriter output) diff --git a/src/Components/Web.JS/src/Rendering/StreamingRendering.ts b/src/Components/Web.JS/src/Rendering/StreamingRendering.ts index ea612d37d6d2..50dc20186222 100644 --- a/src/Components/Web.JS/src/Rendering/StreamingRendering.ts +++ b/src/Components/Web.JS/src/Rendering/StreamingRendering.ts @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. import { SsrStartOptions } from "../Platform/SsrStartOptions"; +import { performEnhancedPageLoad } from "../Services/NavigationEnhancement"; +import { isWithinBaseUriSpace } from "../Services/NavigationUtils"; import { synchronizeDomContent } from "./DomMerging/DomSync"; let enableDomPreservation = true; @@ -34,6 +36,28 @@ class BlazorStreamingUpdate extends HTMLElement { const componentId = node.getAttribute('blazor-component-id'); if (componentId) { insertStreamingContentIntoDocument(componentId, node.content); + } else { + switch (node.getAttribute('type')) { + case 'redirection': + // We use 'replace' here because it's closest to the non-progressively-enhanced behavior, and will make the most sense + // if the async delay was very short, as the user would not perceive having been on the intermediate page. + const destinationUrl = node.content.textContent!; + if (isWithinBaseUriSpace(destinationUrl)) { + history.replaceState(null, '', destinationUrl); + performEnhancedPageLoad(destinationUrl); + } else { + location.replace(destinationUrl); + } + break; + case 'error': + // This is kind of brutal but matches what happens without progressive enhancement + document.documentElement.textContent = node.content.textContent; + const docStyle = document.documentElement.style; + docStyle.fontFamily = 'consolas, monospace'; + docStyle.whiteSpace = 'pre-wrap'; + docStyle.padding = '1rem'; + break; + } } } }); diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index 7a6497d2e22b..d11452ed6dd6 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -61,7 +61,7 @@ function onPopState(state: PopStateEvent) { performEnhancedPageLoad(location.href); } -async function performEnhancedPageLoad(internalDestinationHref: string) { +export async function performEnhancedPageLoad(internalDestinationHref: string) { // First, stop any preceding enhanced page load currentEnhancedNavigationAbortController?.abort(); @@ -75,6 +75,11 @@ async function performEnhancedPageLoad(internalDestinationHref: string) { }); await getResponsePartsWithFraming(responsePromise, abortSignal, (response, initialContent) => { + if (response.redirected) { + // Update the current URL to match the redirected destination, just like for normal navigation redirections + history.replaceState(null, '', response.url); + } + if (response.headers.get('content-type')?.startsWith('text/html')) { // For HTML responses, regardless of the status code, display it const parsedHtml = new DOMParser().parseFromString(initialContent, 'text/html'); diff --git a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs index c80ca407fd0d..ddbf75f4138b 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs @@ -81,6 +81,44 @@ public void ScrollsToHashWithContentAddedAsynchronously() Browser.True(() => BrowserScrollY > 500); } + [Fact] + public void CanFollowSynchronousRedirection() + { + Navigate(ServerPathBase); + + var h1Elem = Browser.Exists(By.TagName("h1")); + Browser.Equal("Hello", () => h1Elem.Text); + + // Click a link and show we redirected, preserving elements, and updating the URL + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Redirect")).Click(); + Browser.Equal("Scroll to hash", () => h1Elem.Text); + Assert.EndsWith("/subdir/scroll-to-hash", Browser.Url); + + // See that 'back' takes you to the place from before the redirection + Browser.Navigate().Back(); + Browser.Equal("Hello", () => h1Elem.Text); + Assert.EndsWith("/subdir", Browser.Url); + } + + [Fact] + public void CanFollowAsynchronousRedirectionWhileStreaming() + { + Navigate(ServerPathBase); + + var h1Elem = Browser.Exists(By.TagName("h1")); + Browser.Equal("Hello", () => h1Elem.Text); + + // Click a link and show we redirected, preserving elements, and updating the URL + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Redirect while streaming")).Click(); + Browser.Equal("Scroll to hash", () => h1Elem.Text); + Assert.EndsWith("/subdir/scroll-to-hash", Browser.Url); + + // See that 'back' takes you to the place from before the redirection + Browser.Navigate().Back(); + Browser.Equal("Hello", () => h1Elem.Text); + Assert.EndsWith("/subdir", Browser.Url); + } + private long BrowserScrollY { get => Convert.ToInt64(((IJavaScriptExecutor)Browser).ExecuteScript("return window.scrollY"), CultureInfo.CurrentCulture); diff --git a/src/Components/test/E2ETest/ServerRenderingTests/StreamingRenderingTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/StreamingRenderingTest.cs index c0783e662156..1a8103432408 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/StreamingRenderingTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/StreamingRenderingTest.cs @@ -118,4 +118,22 @@ public void RetainsDomNodesDuringStreamingRenderingUpdates(bool duringEnhancedNa Browser.Equal("Finished", () => originalStatusElem.Text); Assert.Equal(originalLi.Location, Browser.Exists(By.TagName("li")).Location); } + + [Fact] + public async Task DisplaysErrorThatOccursWhileStreaming() + { + Navigate(ServerPathBase); + Browser.Equal("Hello", () => Browser.Exists(By.TagName("h1")).Text); + + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Error while streaming")).Click(); + await Task.Delay(3000); // Doesn't matter if this duration is too short or too long. It's just so the assertions don't start unnecessarily early. + + // Note that the tests always run with detailed errors off, so we only see this generic message + Browser.Contains("There was an unhandled exception on the current request.", () => Browser.Exists(By.TagName("html")).Text); + + // See that 'back' still works + Browser.Navigate().Back(); + Browser.Equal("Hello", () => Browser.Exists(By.TagName("h1")).Text); + Assert.EndsWith("/subdir", Browser.Url); + } } diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageForScrollingToHash.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageForScrollingToHash.razor index 83b81f9073ca..d246be3517ca 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageForScrollingToHash.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageForScrollingToHash.razor @@ -3,7 +3,7 @@ Page for scrolling to hash -

Hello

+

Scroll to hash

If you scroll down a long way, you'll find more content. We add it asynchronously via streaming rendering.

diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirects.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirects.razor new file mode 100644 index 000000000000..34a77829a12c --- /dev/null +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirects.razor @@ -0,0 +1,8 @@ +@page "/do-redirection" +@inject NavigationManager Nav +@code { + protected override void OnInitialized() + { + Nav.NavigateTo("scroll-to-hash"); + } +} diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirectsWhileStreaming.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirectsWhileStreaming.razor new file mode 100644 index 000000000000..be1ae801b433 --- /dev/null +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirectsWhileStreaming.razor @@ -0,0 +1,11 @@ +@page "/do-redirection-while-streaming" +@attribute [StreamRendering(true)] +@inject NavigationManager Nav +

Please wait...

+@code { + protected override async Task OnInitializedAsync() + { + await Task.Delay(2000); + Nav.NavigateTo("scroll-to-hash"); + } +} diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatThrowsWhileStreaming.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatThrowsWhileStreaming.razor new file mode 100644 index 000000000000..11a8480717ef --- /dev/null +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatThrowsWhileStreaming.razor @@ -0,0 +1,10 @@ +@page "/throw-while-streaming" +@attribute [StreamRendering(true)] +

Please wait...

+@code { + protected override async Task OnInitializedAsync() + { + await Task.Delay(2000); + throw new InvalidTimeZoneException("This is an exception while streaming"); + } +} diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor index bd89feea49ce..65a622abd90f 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor @@ -5,7 +5,10 @@ Error page with 404 content | Error page with no content | Non-HTML page | - Scroll to hash + Scroll to hash | + Redirect | + Redirect while streaming| + Error while streaming
@Body From 75323b1c2ee95bab457e671a3c6f631cabf1119c Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 20 Jun 2023 16:35:39 +0100 Subject: [PATCH 25/30] Update .js --- src/Components/Web.JS/dist/Release/blazor.server.js | 2 +- src/Components/Web.JS/dist/Release/blazor.web.js | 2 +- src/Components/Web.JS/dist/Release/blazor.webview.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Components/Web.JS/dist/Release/blazor.server.js b/src/Components/Web.JS/dist/Release/blazor.server.js index 6aa36d54e5d7..a3d53dc79f58 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,o={};o.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){const t=[],n="__jsObjectId",o="__dotNetObject",r="__byte[]",i="__dotNetStream",s="__jsStreamReferenceLength";let a,c;class l{constructor(e){this._jsObject=e,this._cachedFunctions=new Map}findFunction(e){const t=this._cachedFunctions.get(e);if(t)return t;let n,o=this._jsObject;if(e.split(".").forEach((t=>{if(!(t in o))throw new Error(`Could not find '${e}' ('${t}' was undefined).`);n=o,o=o[t]})),o instanceof Function)return o=o.bind(n),this._cachedFunctions.set(e,o),o;throw new Error(`The value '${e}' is not a function.`)}getWrappedObject(){return this._jsObject}}const h={0:new l(window)};h[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let d,u=1;function p(e){t.push(e)}function f(e){if(e&&"object"==typeof e){h[u]=new l(e);const t={[n]: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 o={[s]:t};try{const t=f(e);o[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return o}function m(e,n){c=e;const o=n?JSON.parse(n,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null;return c=void 0,o}function y(){if(void 0===a)throw new Error("No call dispatcher has been set.");if(null===a)throw new Error("There are multiple .NET runtimes present, so a default dispatcher could not be resolved. Use DotNetObject to invoke .NET instance methods.");return a}e.attachDispatcher=function(e){const t=new v(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=p,e.invokeMethod=function(e,t,...n){return y().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return y().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=f,e.createJSStreamReference=g,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&_(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(d=e.JSCallResultType||(e.JSCallResultType={}));class v{constructor(e){this._dotNetCallDispatcher=e,this._byteArraysToBeRevived=new Map,this._pendingDotNetToJSStreams=new Map,this._pendingAsyncCalls={},this._nextAsyncCallId=1}getDotNetCallDispatcher(){return this._dotNetCallDispatcher}invokeJSFromDotNet(e,t,n,o){const r=m(this,t),i=I(b(e,o)(...r||[]),n);return null==i?null:T(this,i)}beginInvokeJSFromDotNet(e,t,n,o,r){const i=new Promise((e=>{const o=m(this,n);e(b(t,r)(...o||[]))}));e&&i.then((t=>T(this,[e,!0,I(t,o)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,w(t)]))))}endInvokeDotNetFromJS(e,t,n){const o=t?m(this,n):new Error(n);this.completePendingCall(parseInt(e,10),t,o)}invokeDotNetStaticMethod(e,t,...n){return this.invokeDotNetMethod(e,t,null,n)}invokeDotNetStaticMethodAsync(e,t,...n){return this.invokeDotNetMethodAsync(e,t,null,n)}invokeDotNetMethod(e,t,n,o){if(this._dotNetCallDispatcher.invokeDotNetFromJS){const r=T(this,o),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,r);return i?m(this,i):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeDotNetMethodAsync instead.")}invokeDotNetMethodAsync(e,t,n,o){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const r=this._nextAsyncCallId++,i=new Promise(((e,t)=>{this._pendingAsyncCalls[r]={resolve:e,reject:t}}));try{const i=T(this,o);this._dotNetCallDispatcher.beginInvokeDotNetFromJS(r,e,t,n,i)}catch(e){this.completePendingCall(r,!1,e)}return i}receiveByteArray(e,t){this._byteArraysToBeRevived.set(e,t)}processByteArray(e){const t=this._byteArraysToBeRevived.get(e);return t?(this._byteArraysToBeRevived.delete(e),t):null}supplyDotNetStream(e,t){if(this._pendingDotNetToJSStreams.has(e)){const n=this._pendingDotNetToJSStreams.get(e);this._pendingDotNetToJSStreams.delete(e),n.resolve(t)}else{const n=new C;n.resolve(t),this._pendingDotNetToJSStreams.set(e,n)}}getDotNetStreamPromise(e){let t;if(this._pendingDotNetToJSStreams.has(e))t=this._pendingDotNetToJSStreams.get(e).streamPromise,this._pendingDotNetToJSStreams.delete(e);else{const n=new C;this._pendingDotNetToJSStreams.set(e,n),t=n.streamPromise}return t}completePendingCall(e,t,n){if(!this._pendingAsyncCalls.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const o=this._pendingAsyncCalls[e];delete this._pendingAsyncCalls[e],t?o.resolve(n):o.reject(n)}}function w(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function b(e,t){const n=h[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function _(e){delete h[e]}e.findJSFunction=b,e.disposeJSObjectReferenceById=_;class E{constructor(e,t){this._id=e,this._callDispatcher=t}invokeMethod(e,...t){return this._callDispatcher.invokeDotNetMethod(null,e,this._id,t)}invokeMethodAsync(e,...t){return this._callDispatcher.invokeDotNetMethodAsync(null,e,this._id,t)}dispose(){this._callDispatcher.invokeDotNetMethodAsync(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{[o]:this._id}}}e.DotNetObject=E,p((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(o))return new E(t[o],c);if(t.hasOwnProperty(n)){const e=t[n],o=h[e];if(o)return o.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(r)){const e=t[r],n=c.processByteArray(e);if(void 0===n)throw new Error(`Byte array index '${e}' does not exist.`);return n}if(t.hasOwnProperty(i)){const e=t[i],n=c.getDotNetStreamPromise(e);return new S(n)}}return t}));class S{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class C{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function I(e,t){switch(t){case d.Default:return e;case d.JSObjectReference:return f(e);case d.JSStreamReference:return g(e);case d.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let k=0;function T(e,t){k=0,c=e;const n=JSON.stringify(t,D);return c=void 0,n}function D(e,t){if(t instanceof E)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(k,t);const e={[r]:k};return k++,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 i=new Map,s=new Map,a=[];function c(e){return i.get(e)}function l(e){const t=i.get(e);return(null==t?void 0:t.browserEventName)||e}function h(e,t){e.forEach((e=>i.set(e,t)))}function d(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}{const e=function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t);return{value:e?!!t.checked:t.value}}}}),h(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),h(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...u(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),h(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),h(["keydown","keyup","keypress"],{createEventArgs:e=>{return{key:(t=e).key,code:t.code,location:t.location,repeat:t.repeat,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),h(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>u(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: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}}),h(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...u(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{...u(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 v={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const o="__bl-dynamic-root:"+(++y).toString();f.set(o,e);const r=await _().invokeMethodAsync("AddRootComponent",t,o),i=new b(r,m[t]);return await i.setParameters(n),i}};class w{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 w)}setParameters(e){const t={},n=Object.entries(e||{}),o=n.length;for(const[e,o]of n){const n=this._jsEventCallbackWrappers.get(e.toLowerCase());n&&o?(n.setCallback(o),t[e]=n.getJSObjectReference()):t[e]=o}return _().invokeMethodAsync("SetRootComponentParameters",this._componentId,o,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=[];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[e];if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let T=(e,t,n)=>n();const D=U(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),x={submit:!0},R=U(["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 N(this.onGlobalEvent.bind(this))}setListener(e,t,n,o){const r=this.getEventHandlerInfosForElement(e,!0),i=r.getHandler(t);if(i)this.eventInfoStore.update(i.eventHandlerId,n);else{const i={element:e,eventName:t,eventHandlerId:n,renderingComponentId:o};this.eventInfoStore.add(i),r.setHandler(t,i)}}getHandler(e){return this.eventInfoStore.get(e)}removeListener(e){const t=this.eventInfoStore.remove(e);if(t){const e=t.element,n=this.getEventHandlerInfosForElement(e,!1);n&&n.removeHandler(t.eventName)}}notifyAfterClick(e){this.afterClickCallbacks.push(e),this.eventInfoStore.addGlobalListener("click")}setStopPropagation(e,t,n){this.getEventHandlerInfosForElement(e,!0).stopPropagation(t,n)}setPreventDefault(e,t,n){this.getEventHandlerInfosForElement(e,!0).preventDefault(t,n)}onGlobalEvent(e){if(!(e.target instanceof Element))return;this.dispatchGlobalEventToAllElements(e.type,e);const t=(n=e.type,s.get(n));var n;t&&t.forEach((t=>this.dispatchGlobalEventToAllElements(t,e))),"click"===e.type&&this.afterClickCallbacks.forEach((t=>t(e)))}dispatchGlobalEventToAllElements(e,t){const n=t.composedPath();let o=n.shift(),i=null,s=!1;const a=Object.prototype.hasOwnProperty.call(D,e);let l=!1;for(;o;){const u=o,p=this.getEventHandlerInfosForElement(u,!1);if(p){const n=p.getHandler(e);if(n&&(h=u,d=t.type,!((h instanceof HTMLButtonElement||h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(R,d)&&h.disabled))){if(!s){const n=c(e);i=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(x,t.type)&&t.preventDefault(),I(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:r.fromEvent(n.renderingComponentId,t)},i)}p.stopPropagation(e)&&(l=!0),p.preventDefault(e)&&t.preventDefault()}o=a||l?void 0:n.shift()}var h,d}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new A:null}}P.nextEventDelegatorId=0;class N{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},a.push(this.handleEventNameAliasAdded.bind(this))}add(e){if(this.infosByEventHandlerId[e.eventHandlerId])throw new Error(`Event ${e.eventHandlerId} is already tracked`);this.infosByEventHandlerId[e.eventHandlerId]=e,this.addGlobalListener(e.eventName)}get(e){return this.infosByEventHandlerId[e]}addGlobalListener(e){if(e=l(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(D,e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(Object.prototype.hasOwnProperty.call(this.infosByEventHandlerId,t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=l(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(Object.prototype.hasOwnProperty.call(this.countByEventName,e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class A{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return Object.prototype.hasOwnProperty.call(this.handlers,e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function U(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const L=G("_blazorLogicalChildren"),M=G("_blazorLogicalParent"),B=G("_blazorLogicalEnd");function $(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return L in e||(e[L]=[]),e}function O(e,t){const n=document.createComment("!");return F(n,e,t),n}function F(e,t,n){const o=e;if(e instanceof Comment&&J(o)&&J(o).length>0)throw new Error("Not implemented: inserting non-empty logical container");if(j(o))throw new Error("Not implemented: moving existing logical children");const r=J(t);if(n0;)H(n,0)}const o=n;o.parentNode.removeChild(o)}function j(e){return e[M]||null}function W(e,t){return J(e)[t]}function z(e){const t=K(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function J(e){return e[L]}function q(e,t){const n=J(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=Y(e.moveRangeStart)})),t.forEach((t=>{const o=document.createComment("marker");t.moveToBeforeMarker=o;const r=n[t.toSiblingIndex+1];r?r.parentNode.insertBefore(o,r):X(o,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,o=e.moveRangeStart,r=e.moveRangeEnd;let i=o;for(;i;){const e=i.nextSibling;if(n.insertBefore(i,t),i===r)break;i=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 V(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=V(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=V(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}`}const Z="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,Z)&&"string"==typeof t[Z]?function(e){const t=`[${Q(e)}]`;return document.querySelector(t)}(t[Z]):t));const ee="_blazorDeferredValue";function te(e){return"select-multiple"===e.type}function ne(e,t){e.value=t||""}function oe(e,t){e instanceof HTMLSelectElement?te(e)?function(e,t){t||(t=[]);for(let n=0;n{if(!pe)return;if(0!==e.button||function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e))return;if(e.defaultPrevented)return;const t=function(e){const t=!window._blazorDisableComposedPath&&e.composedPath&&e.composedPath();if(t){for(let e=0;edocument.baseURI,getLocationHref:()=>location.href,scrollToElement:Se};function Se(e){const t=document.getElementById(e);return!!t&&(t.scrollIntoView(),!0)}function Ce(e,t,n=!1){const o=Ae(e);!t.forceLoad&&Le(o)?Ie(o,!1,t.replaceHistoryEntry,t.historyEntryState,n):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Ie(e,t,n,o=void 0,r=!1){if(De(),function(e){const t=e.indexOf("#");return t>-1&&location.href.replace(location.hash,"")===e.substring(0,t)}(e))!function(e,t,n){ke(e,t,n);const o=e.indexOf("#");o!==e.length-1&&Se(e.substring(o+1))}(e,n,o);else{if(!r&&ge&&!await xe(e,o,t))return;ue=!0,ke(e,n,o),await Re(t)}}function ke(e,t,n=void 0){t?history.replaceState({userState:n,_index:me},"",e):(me++,history.pushState({userState:n,_index:me},"",e))}function Te(e){return new Promise((t=>{const n=be;be=()=>{be=n,t()},history.go(e)}))}function De(){_e&&(_e(!1),_e=null)}function xe(e,t,n){return new Promise((o=>{De(),we?(ye++,_e=o,we(ye,e,t,n)):o(!1)}))}async function Re(e){var t;ve&&await ve(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function Pe(e){var t,n;be&&await be(e),me=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}let Ne;function Ae(e){return Ne=Ne||document.createElement("a"),Ne.href=e,Ne.href}function Ue(e,t){return e?e.tagName===t?e:Ue(e.parentElement,t):null}function Le(e){const t=(n=document.baseURI).substring(0,n.lastIndexOf("/"));var n;const o=e.charAt(t.length);return e.startsWith(t)&&(""===o||"/"===o||"?"===o||"#"===o)}const Me={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,t){const n=document.querySelector(e);n&&(n.hasAttribute("tabindex")||(n.tabIndex=-1),n.focus({preventScroll:!0}))}},Be={init:function(e,t,n,o=50){const r=Oe(t);(r||document.documentElement).style.overflowAnchor="none";const i=document.createRange();h(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(o){o.forEach((o=>{var r;if(!o.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const s=i.getBoundingClientRect().height,a=null===(r=o.rootBounds)||void 0===r?void 0:r.height;o.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",o.intersectionRect.top-o.boundingClientRect.top,s,a):o.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",o.boundingClientRect.bottom-o.intersectionRect.bottom,s,a)}))}),{root:r,rootMargin:`${o}px`});s.observe(t),s.observe(n);const a=l(t),c=l(n);function l(e){const t={attributes:!0},n=new MutationObserver(((n,o)=>{h(e.parentElement)&&(o.disconnect(),e.style.display="table-row",o.observe(e,t)),s.unobserve(e),s.observe(e)}));return n.observe(e,t),n}function h(e){return null!==e&&(e instanceof HTMLTableElement&&""===e.style.display||"table"===e.style.display||e instanceof HTMLTableSectionElement&&""===e.style.display||"table-row-group"===e.style.display)}$e[e._id]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const t=$e[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete $e[e._id])}},$e={};function Oe(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:Oe(e.parentElement):null}const Fe={getAndRemoveExistingTitle:function(){var e;const t=document.head?document.head.getElementsByTagName("title"):[];if(0===t.length)return null;let n=null;for(let o=t.length-1;o>=0;o--){const r=t[o],i=r.previousSibling;i instanceof Comment&&null!==j(i)||(null===n&&(n=r.textContent),null===(e=r.parentNode)||void 0===e||e.removeChild(r))}return n}},He={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,o,r){const i=je(e,t),s=await new Promise((function(e){const t=new Image;t.onload=function(){URL.revokeObjectURL(t.src),e(t)},t.onerror=function(){t.onerror=null,URL.revokeObjectURL(t.src)},t.src=URL.createObjectURL(i.blob)})),a=await new Promise((function(e){var t;const i=Math.min(1,o/s.width),a=Math.min(1,r/s.height),c=Math.min(i,a),l=document.createElement("canvas");l.width=Math.round(s.width*c),l.height=Math.round(s.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(s,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return je(e,t).blob}};function je(e,t){const n=e._blazorFilesById[t];if(!n)throw new Error(`There is no file with ID ${t}. The file list may have changed. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.`);return n}const We=new Set,ze={enableNavigationPrompt:function(e){0===We.size&&window.addEventListener("beforeunload",Je),We.add(e)},disableNavigationPrompt:function(e){We.delete(e),0===We.size&&window.removeEventListener("beforeunload",Je)}};function Je(e){e.preventDefault(),e.returnValue=!0}async function qe(e,t,n){return e instanceof Blob?await async function(e,t,n){const o=e.slice(t,t+n),r=await o.arrayBuffer();return new Uint8Array(r)}(e,t,n):function(e,t,n){return new Uint8Array(e.buffer,e.byteOffset+t,n)}(e,t,n)}new Map;const Ke={navigateTo:function(e,t,n=!1){Ce(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(i.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=s.get(t.browserEventName);n?n.push(e):s.set(t.browserEventName,[e]),a.forEach((n=>n(e,t.browserEventName)))}i.set(e,t)},rootComponents:v,_internal:{navigationManager:Ee,domWrapper:Me,Virtualize:Be,PageTitle:Fe,InputFile:He,NavigationLock:ze,getJSDataStreamChunk:qe,attachWebRendererInterop:function(t,n,o){const r=E.length;return E.push(t),Object.keys(n).length>0&&function(t,n,o){if(g)throw new Error("Dynamic root components have already been enabled.");g=t,m=n;for(const[t,r]of Object.entries(o)){const o=e.findJSFunction(t,0);for(const e of r)o(e,n[e])}}(k(r),n,o),S(),r}}};window.Blazor=Ke;const Ve=[0,2e3,1e4,3e4,null];class Xe{constructor(e){this._retryDelays=void 0!==e?[...e,null]:Ve}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class Ye{}Ye.Authorization="Authorization",Ye.Cookie="Cookie";class Ge{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class Qe{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}class Ze extends Qe{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&401===n.statusCode&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[Ye.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[Ye.Authorization]&&delete e.headers[Ye.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}class et extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class tt extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class nt extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class ot extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class rt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class it extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class st extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class at extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}var ct;!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(ct||(ct={}));class lt{constructor(){}log(e,t){}}lt.instance=new lt;const ht="0.0.0-DEV_BUILD";class dt{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 ut{static get isBrowser(){return"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isReactNative(){return"object"==typeof window&&void 0===window.document}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}}function pt(e,t){let n="";return ft(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 ft(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function gt(e,t,n,o,r,i){const s={},[a,c]=vt();s[a]=c,e.log(ct.Trace,`(${t} transport) sending data. ${pt(r,i.logMessageContent)}.`);const l=ft(r)?"arraybuffer":"text",h=await n.post(o,{content:r,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(ct.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class mt{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 yt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${ct[e]}: ${t}`;switch(e){case ct.Critical:case ct.Error:this.out.error(n);break;case ct.Warning:this.out.warn(n);break;case ct.Information:this.out.info(n);break;default:this.out.log(n)}}}}function vt(){let e="X-SignalR-User-Agent";return ut.isNode&&(e="User-Agent"),[e,wt(ht,bt(),ut.isNode?"NodeJS":"Browser",_t())]}function wt(e,t,n,o){let r="Microsoft SignalR/";const i=e.split(".");return r+=`${i[0]}.${i[1]}`,r+=` (${e}; `,r+=t&&""!==t?`${t}; `:"Unknown OS; ",r+=`${n}`,r+=o?`; ${o}`:"; Unknown Runtime Version",r+=")",r}function bt(){if(!ut.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function _t(){if(ut.isNode)return process.versions.node}function Et(e){return e.stack?e.stack:e.message?e.message:`${e}`}class St extends Qe{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e=require;this._jar=new(e("tough-cookie").CookieJar),"undefined"==typeof fetch?this._fetchType=e("node-fetch"):this._fetchType=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!==o.g)return o.g;throw new Error("could not find global")}());if("undefined"==typeof AbortController){const e=require;this._abortControllerType=e("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new nt;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const t=new this._abortControllerType;let n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new nt});let o,r=null;if(e.timeout){const o=e.timeout;r=setTimeout((()=>{t.abort(),this._logger.log(ct.Warning,"Timeout from HTTP request."),n=new tt}),o)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},ft(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");try{o=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:!0===e.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(e){if(n)throw n;throw this._logger.log(ct.Warning,`Error from HTTP request. ${e}.`),e}finally{r&&clearTimeout(r),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const e=await Ct(o,"text");throw new et(e||o.statusText,o.status)}const i=Ct(o,e.responseType),s=await i;return new Ge(o.status,o.statusText,s)}getCookieString(e){return""}}function Ct(e,t){let n;switch(t){case"arraybuffer":n=e.arrayBuffer();break;case"text":default:n=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`)}return n}class It extends Qe{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new nt):e.method?e.url?new Promise(((t,n)=>{const o=new XMLHttpRequest;o.open(e.method,e.url,!0),o.withCredentials=void 0===e.withCredentials||e.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===e.content&&(e.content=void 0),e.content&&(ft(e.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const r=e.headers;r&&Object.keys(r).forEach((e=>{o.setRequestHeader(e,r[e])})),e.responseType&&(o.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{o.abort(),n(new nt)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new Ge(o.status,o.statusText,o.response||o.responseText)):n(new et(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(ct.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new et(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(ct.Warning,"Timeout from HTTP request."),n(new tt)},o.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class kt extends Qe{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new St(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new It(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new nt):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}var Tt,Dt,xt,Rt;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(Tt||(Tt={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Dt||(Dt={}));class Pt{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 Nt{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new Pt,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(dt.isRequired(e,"url"),dt.isRequired(t,"transferFormat"),dt.isIn(t,Dt,"transferFormat"),this._url=e,this._logger.log(ct.Trace,"(LongPolling transport) Connecting."),t===Dt.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,o]=vt(),r={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===Dt.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(ct.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(ct.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new et(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(ct.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,t);204===o.statusCode?(this._logger.log(ct.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==o.statusCode?(this._logger.log(ct.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new et(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(ct.Trace,`(LongPolling transport) data received. ${pt(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(ct.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof tt?this._logger.log(ct.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(ct.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(ct.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?gt(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(ct.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(ct.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=vt();e[t]=n;const o={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};await this._httpClient.delete(this._url,o),this._logger.log(ct.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(ct.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(ct.Trace,e),this.onclose(this._closeError)}}}class At{constructor(e,t,n,o){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}async connect(e,t){return dt.isRequired(e,"url"),dt.isRequired(t,"transferFormat"),dt.isIn(t,Dt,"transferFormat"),this._logger.log(ct.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,o)=>{let r,i=!1;if(t===Dt.Text){if(ut.isBrowser||ut.isWebWorker)r=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const t=this._httpClient.getCookieString(e),n={};n.Cookie=t;const[o,i]=vt();n[o]=i,r=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...n,...this._options.headers}})}try{r.onmessage=e=>{if(this.onreceive)try{this._logger.log(ct.Trace,`(SSE transport) data received. ${pt(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},r.onerror=e=>{i?this._close():o(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."))},r.onopen=()=>{this._logger.log(ct.Information,`SSE connected to ${this._url}`),this._eventSource=r,i=!0,n()}}catch(e){return void o(e)}}else o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(e){return this._eventSource?gt(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class Ut{constructor(e,t,n,o,r,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=o,this._webSocketConstructor=r,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){let n;return dt.isRequired(e,"url"),dt.isRequired(t,"transferFormat"),dt.isIn(t,Dt,"transferFormat"),this._logger.log(ct.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((o,r)=>{let i;e=e.replace(/^http/,"ws");const s=this._httpClient.getCookieString(e);let a=!1;if(ut.isReactNative){const t={},[o,r]=vt();t[o]=r,n&&(t[Ye.Authorization]=`Bearer ${n}`),s&&(t[Ye.Cookie]=s),i=new this._webSocketConstructor(e,void 0,{headers:{...t,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===Dt.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(ct.Information,`WebSocket connected to ${e}.`),this._webSocket=i,a=!0,o()},i.onerror=e=>{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"There was an error with the transport",this._logger.log(ct.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(ct.Trace,`(WebSockets transport) data received. ${pt(e.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(e.data)}catch(e){return void this._close(e)}},i.onclose=e=>{if(a)this._close(e);else{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",r(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(ct.Trace,`(WebSockets transport) sending data. ${pt(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(ct.Trace,"(WebSockets transport) socket closed."),this.onclose&&(!this._isCloseEvent(e)||!1!==e.wasClean&&1e3===e.code?e instanceof Error?this.onclose(e):this.onclose():this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)))}_isCloseEvent(e){return e&&"boolean"==typeof e.wasClean&&"number"==typeof e.code}}class Lt{constructor(e,t={}){var n;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,dt.isRequired(e,"url"),this._logger=void 0===(n=t.logger)?new yt(ct.Information):null===n?lt.instance:void 0!==n.log?n:new yt(n),this.baseUrl=this._resolveUrl(e),(t=t||{}).logMessageContent=void 0!==t.logMessageContent&&t.logMessageContent,"boolean"!=typeof t.withCredentials&&void 0!==t.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.withCredentials=void 0===t.withCredentials||t.withCredentials,t.timeout=void 0===t.timeout?1e5:t.timeout,"undefined"==typeof WebSocket||t.WebSocket||(t.WebSocket=WebSocket),"undefined"==typeof EventSource||t.EventSource||(t.EventSource=EventSource),this._httpClient=new Ze(t.httpClient||new kt(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Dt.Binary,dt.isIn(e,Dt,"transferFormat"),this._logger.log(ct.Debug,`Starting connection with transfer format '${Dt[e]}'.`),"Disconnected"!==this._connectionState)return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,"Disconnecting"===this._connectionState){const e="Failed to start the HttpConnection before stop() was called.";return this._logger.log(ct.Error,e),await this._stopPromise,Promise.reject(new nt(e))}if("Connected"!==this._connectionState){const e="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(ct.Error,e),Promise.reject(new nt(e))}this._connectionStarted=!0}send(e){return"Connected"!==this._connectionState?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Mt(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(ct.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(ct.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState="Disconnecting",this._stopPromise=new Promise((e=>{this._stopPromiseResolver=e})),await this._stopInternal(e),void await this._stopPromise)}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch(e){}if(this.transport){try{await this.transport.stop()}catch(e){this._logger.log(ct.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(ct.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport!==Tt.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(Tt.WebSockets),await this._startTransport(t,e)}else{let n=null,o=0;do{if(n=await this._getNegotiationResponse(t),"Disconnecting"===this._connectionState||"Disconnected"===this._connectionState)throw new nt("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const e=n.accessToken;this._accessTokenFactory=()=>e,this._httpClient._accessToken=e,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<100);if(100===o&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof Nt&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(ct.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(ct.Error,"Failed to start the connection: "+e),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(e)}}async _getNegotiationResponse(e){const t={},[n,o]=vt();t[n]=o;const r=this._resolveNegotiateUrl(e);this._logger.log(ct.Debug,`Sending negotiation request: ${r}.`);try{const e=await this._httpClient.post(r,{content:"",headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(200!==e.statusCode)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${e.statusCode}'`));const n=JSON.parse(e.content);return(!n.negotiateVersion||n.negotiateVersion<1)&&(n.connectionToken=n.connectionId),n}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof et&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(ct.Error,t),Promise.reject(new st(t))}}_createConnectUrl(e,t){return t?e+(-1===e.indexOf("?")?"?":"&")+`id=${t}`:e}async _createTransport(e,t,n,o){let r=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t))return this._logger.log(ct.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(r,o),void(this.connectionId=n.connectionId);const i=[],s=n.availableTransports||[];let a=n;for(const n of s){const s=this._resolveTransportOrError(n,t,o);if(s instanceof Error)i.push(`${n.transport} failed:`),i.push(s);else if(this._isITransport(s)){if(this.transport=s,!a){try{a=await this._getNegotiationResponse(e)}catch(e){return Promise.reject(e)}r=this._createConnectUrl(e,a.connectionToken)}try{return await this._startTransport(r,o),void(this.connectionId=a.connectionId)}catch(e){if(this._logger.log(ct.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new it(`${n.transport} failed: ${e}`,Tt[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(ct.Debug,e),Promise.reject(new nt(e))}}}}return i.length>0?Promise.reject(new at(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case Tt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Ut(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Tt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new At(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Tt.LongPolling:return new Nt(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n){const o=Tt[e.transport];if(null==o)return this._logger.log(ct.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(!function(e,t){return!e||0!=(t&e)}(t,o))return this._logger.log(ct.Debug,`Skipping transport '${Tt[o]}' because it was disabled by the client.`),new rt(`'${Tt[o]}' is disabled by the client.`,o);if(!(e.transferFormats.map((e=>Dt[e])).indexOf(n)>=0))return this._logger.log(ct.Debug,`Skipping transport '${Tt[o]}' because it does not support the requested transfer format '${Dt[n]}'.`),new Error(`'${Tt[o]}' does not support ${Dt[n]}.`);if(o===Tt.WebSockets&&!this._options.WebSocket||o===Tt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(ct.Debug,`Skipping transport '${Tt[o]}' because it is not supported in your environment.'`),new ot(`'${Tt[o]}' is not supported in your environment.`,o);this._logger.log(ct.Debug,`Selecting transport '${Tt[o]}'.`);try{return this._constructTransport(o)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(ct.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,"Disconnected"!==this._connectionState){if("Connecting"===this._connectionState)throw this._logger.log(ct.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if("Disconnecting"===this._connectionState&&this._stopPromiseResolver(),e?this._logger.log(ct.Error,`Connection disconnected with error '${e}'.`):this._logger.log(ct.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(ct.Error,`TransportSendQueue.stop() threw error '${e}'.`)})),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(ct.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(ct.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`)}_resolveUrl(e){if(0===e.lastIndexOf("https://",0)||0===e.lastIndexOf("http://",0))return e;if(!ut.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(ct.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=e.indexOf("?");let n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",n+=-1===t?"":e.substring(t),-1===n.indexOf("negotiateVersion")&&(n+=-1===t?"?":"&",n+="negotiateVersion="+this._negotiateVersion),n}}class Mt{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Bt,this._transportResult=new Bt,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Bt),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 Bt;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):Mt._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 o=0;for(const t of e)n.set(new Uint8Array(t),o),o+=t.byteLength;return n.buffer}}class Bt{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class $t{static write(e){return`${e}${$t.RecordSeparator}`}static parse(e){if(e[e.length-1]!==$t.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split($t.RecordSeparator);return t.pop(),t}}$t.RecordSeparatorCode=30,$t.RecordSeparator=String.fromCharCode($t.RecordSeparatorCode);class Ot{writeHandshakeRequest(e){return $t.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(ft(e)){const o=new Uint8Array(e),r=o.indexOf($t.RecordSeparatorCode);if(-1===r)throw new Error("Message is incomplete.");const i=r+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(o.slice(0,i))),n=o.byteLength>i?o.slice(i).buffer:null}else{const o=e,r=o.indexOf($t.RecordSeparator);if(-1===r)throw new Error("Message is incomplete.");const i=r+1;t=o.substring(0,i),n=o.length>i?o.substring(i):null}const o=$t.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}}!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"}(xt||(xt={}));class Ft{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 mt(this,e)}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(Rt||(Rt={}));class Ht{static create(e,t,n,o,r,i){return new Ht(e,t,n,o,r,i)}constructor(e,t,n,o,r,i){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(ct.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},dt.isRequired(e,"connection"),dt.isRequired(t,"logger"),dt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=r?r:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new Ot,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=Rt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:xt.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==Rt.Disconnected&&this._connectionState!==Rt.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!==Rt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Rt.Connecting,this._logger.log(ct.Debug,"Starting HubConnection.");try{await this._startInternal(),ut.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Rt.Connected,this._connectionStarted=!0,this._logger.log(ct.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=Rt.Disconnected,this._logger.log(ct.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise(((e,t)=>{this._handshakeResolver=e,this._handshakeRejecter=t}));await this.connection.start(this._protocol.transferFormat);try{const t={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(ct.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(ct.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(ct.Debug,`Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(e),e}}async stop(){const e=this._startPromise;this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){return this._connectionState===Rt.Disconnected?(this._logger.log(ct.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===Rt.Disconnecting?(this._logger.log(ct.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=Rt.Disconnecting,this._logger.log(ct.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(ct.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new nt("The connection was stopped before the hub handshake could complete."),this.connection.stop(e)))}stream(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._createStreamInvocation(e,t,o);let i;const s=new Ft;return s.cancelCallback=()=>{const e=this._createCancelInvocation(r.invocationId);return delete this._callbacks[r.invocationId],i.then((()=>this._sendWithProtocol(e)))},this._callbacks[r.invocationId]=(e,t)=>{t?s.error(t):e&&(e.type===xt.Completion?e.error?s.error(new Error(e.error)):s.complete():s.next(e.item))},i=this._sendWithProtocol(r).catch((e=>{s.error(e),delete this._callbacks[r.invocationId]})),this._launchStreams(n,i),s}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._sendWithProtocol(this._createInvocation(e,t,!0,o));return this._launchStreams(n,r),r}invoke(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._createInvocation(e,t,!1,o);return new Promise(((e,t)=>{this._callbacks[r.invocationId]=(n,o)=>{o?t(o):n&&(n.type===xt.Completion?n.error?t(new Error(n.error)):e(n.result):t(new Error(`Unexpected message type: ${n.type}`)))};const o=this._sendWithProtocol(r).catch((e=>{t(e),delete this._callbacks[r.invocationId]}));this._launchStreams(n,o)}))}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 o=n.indexOf(t);-1!==o&&(n.splice(o,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 xt.Invocation:this._invokeClientMethod(e);break;case xt.StreamItem:case xt.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===xt.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(ct.Error,`Stream callback threw error: ${Et(e)}`)}}break}case xt.Ping:break;case xt.Close:{this._logger.log(ct.Information,"Close message received from server.");const t=e.error?new Error("Server returned an error on close: "+e.error):void 0;!0===e.allowReconnect?this.connection.stop(t):this._stopPromise=this._stopInternal(t);break}default:this._logger.log(ct.Warning,`Invalid message type: ${e.type}.`)}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(e){const t="Error parsing handshake response: "+e;this._logger.log(ct.Error,t);const n=new Error(t);throw this._handshakeRejecter(n),n}if(t.error){const e="Server returned handshake error: "+t.error;this._logger.log(ct.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(ct.Debug,"Server handshake complete."),this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=(new Date).getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!(this.connection.features&&this.connection.features.inherentKeepAlive||(this._timeoutHandle=setTimeout((()=>this.serverTimeout()),this.serverTimeoutInMilliseconds),void 0!==this._pingServerHandle))){let e=this._nextKeepAlive-(new Date).getTime();e<0&&(e=0),this._pingServerHandle=setTimeout((async()=>{if(this._connectionState===Rt.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n)return this._logger.log(ct.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(ct.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null))));const o=n.slice(),r=!!e.invocationId;let i,s,a;for(const n of o)try{const o=i;i=await n.apply(this,e.arguments),r&&i&&o&&(this._logger.log(ct.Error,`Multiple results provided for '${t}'. Sending error to server.`),a=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),s=void 0}catch(e){s=e,this._logger.log(ct.Error,`A callback for the method '${t}' threw error '${e}'.`)}a?await this._sendWithProtocol(a):r?(s?a=this._createCompletionMessage(e.invocationId,`${s}`,null):void 0!==i?a=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(ct.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),a=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(a)):i&&this._logger.log(ct.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(ct.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new nt("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===Rt.Disconnecting?this._completeClose(e):this._connectionState===Rt.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===Rt.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=Rt.Disconnected,this._connectionStarted=!1,ut.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(ct.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}async _reconnect(e){const t=Date.now();let n=0,o=void 0!==e?e:new Error("Attempting to reconnect due to a unknown error."),r=this._getNextRetryDelay(n++,0,o);if(null===r)return this._logger.log(ct.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=Rt.Reconnecting,e?this._logger.log(ct.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(ct.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(ct.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==Rt.Reconnecting)return void this._logger.log(ct.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this._logger.log(ct.Information,`Reconnect attempt number ${n} will start in ${r} ms.`),await new Promise((e=>{this._reconnectDelayHandle=setTimeout(e,r)})),this._reconnectDelayHandle=void 0,this._connectionState!==Rt.Reconnecting)return void this._logger.log(ct.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=Rt.Connected,this._logger.log(ct.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(ct.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(ct.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==Rt.Reconnecting)return this._logger.log(ct.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===Rt.Disconnecting&&this._completeClose());o=e instanceof Error?e:new Error(e.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(ct.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(n){return this._logger.log(ct.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach((n=>{const o=t[n];try{o(null,e)}catch(t){this._logger.log(ct.Error,`Stream 'error' callback called with '${e}' threw error: ${Et(t)}`)}}))}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,o){if(n)return 0!==o.length?{arguments:t,streamIds:o,target:e,type:xt.Invocation}:{arguments:t,target:e,type:xt.Invocation};{const n=this._invocationId;return this._invocationId++,0!==o.length?{arguments:t,invocationId:n.toString(),streamIds:o,target:e,type:xt.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:xt.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 o;o=e instanceof Error?e.message:e&&e.toString?e.toString():"Unknown error",t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n,o))))},next:e=>{t=t.then((()=>this._sendWithProtocol(this._createStreamItemMessage(n,e))))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let o=0;o=55296&&r<=56319&&o65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h)}else i.push(a);i.length>=4096&&(s+=String.fromCharCode.apply(String,i),i.length=0)}return i.length>0&&(s+=String.fromCharCode.apply(String,i)),s}var on,rn=Gt?new TextDecoder:null,sn=Gt?"undefined"!=typeof process&&"force"!==(null===(Kt=null===process||void 0===process?void 0:process.env)||void 0===Kt?void 0:Kt.TEXT_DECODER)?200:0:Vt,an=function(e,t){this.type=e,this.data=t},cn=(on=function(e,t){return on=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])},on(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}on(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),ln=function(e){function t(n){var o=e.call(this,n)||this,r=Object.create(t.prototype);return Object.setPrototypeOf(o,r),Object.defineProperty(o,"name",{configurable:!0,enumerable:!1,value:t.name}),o}return cn(t,e),t}(Error),hn={type:-1,encode:function(e){var t,n,o,r;return e instanceof Date?function(e){var t,n=e.sec,o=e.nsec;if(n>=0&&o>=0&&n<=17179869183){if(0===o&&n<=4294967295){var r=new Uint8Array(4);return(t=new DataView(r.buffer)).setUint32(0,n),r}var i=n/4294967296,s=4294967295&n;return r=new Uint8Array(8),(t=new DataView(r.buffer)).setUint32(0,o<<2|3&i),t.setUint32(4,s),r}return r=new Uint8Array(12),(t=new DataView(r.buffer)).setUint32(0,o),Xt(t,4,n),r}((o=1e6*((t=e.getTime())-1e3*(n=Math.floor(t/1e3))),{sec:n+(r=Math.floor(o/1e9)),nsec:o-1e9*r})):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:Yt(t,4),nsec:t.getUint32(0)};default:throw new ln("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},dn=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(hn)}return e.prototype.register=function(e){var t=e.type,n=e.encode,o=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=o;else{var r=1+t;this.builtInEncoders[r]=n,this.builtInDecoders[r]=o}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>en){var t=Qt(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),tn(e,this.bytes,this.pos),this.pos+=t}else t=Qt(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var o=e.length,r=n,i=0;i>6&31|192;else{if(s>=55296&&s<=56319&&i>12&15|224,t[r++]=s>>6&63|128):(t[r++]=s>>18&7|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128)}t[r++]=63&s|128}else t[r++]=s}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=un(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var o=0,r=e;o0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var o=0,r=this.caches[n-1];o=this.maxLengthPerKey?n[Math.random()*n.length|0]=o:n.push(o)},e.prototype.decode=function(e,t,n){var o=this.find(e,t,n);if(null!=o)return this.hit++,o;this.miss++;var r=nn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,r),r},e}(),bn=function(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return bn(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,o,r,i,s,a;return i=this,void 0,a=function(){var i,s,a,c,l,h,d,u;return bn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=_n(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),i=!0}catch(e){if(!(e instanceof In))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(),o={error:c},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(r=t.return)?[4,r.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(o)throw o.error;return[7];case 11:return[7];case 12:if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,s]}throw h=(l=this).headByte,d=l.pos,u=l.totalPos,new RangeError("Insufficient data in parsing ".concat(fn(h)," at ").concat(u," (").concat(d," in the current buffer)"))}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{r(a.next(e))}catch(e){t(e)}}function o(e){try{r(a.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof s?r:new s((function(e){e(r)}))).then(n,o)}r((a=a.apply(i,[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return function(n,o,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,s=function(){var n,o,r,i,s,a,c,l,h;return bn(this,(function(d){switch(d.label){case 0:n=t,o=-1,d.label=1;case 1:d.trys.push([1,13,14,19]),r=_n(e),d.label=2;case 2:return[4,En(r.next())];case 3:if((i=d.sent()).done)return[3,12];if(s=i.value,t&&0===o)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(o=this.readArraySize(),n=!1,this.complete()),d.label=4;case 4:d.trys.push([4,9,,10]),d.label=5;case 5:return[4,En(this.doDecodeSync())];case 6:return[4,d.sent()];case 7:return d.sent(),0==--o?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=d.sent())instanceof In))throw a;return[3,10];case 10:this.totalPos+=this.pos,d.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=d.sent(),l={error:c},[3,19];case 14:return d.trys.push([14,,17,18]),i&&!i.done&&(h=r.return)?[4,En(h.call(r))]:[3,16];case 15:d.sent(),d.label=16;case 16:return[3,18];case 17:if(l)throw l.error;return[7];case 18:return[7];case 19:return[2]}}))}.apply(n,o||[]),a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(e){s[e]&&(i[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||l(e,t)}))})}function l(e,t){try{(n=s[e](t)).value instanceof En?Promise.resolve(n.value.v).then(h,d):u(a[0][2],n)}catch(e){u(a[0][3],e)}var n}function h(e){l("next",e)}function d(e){l("throw",e)}function u(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}(this,arguments)},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!=(o=e-128)){this.pushMapState(o),this.complete();continue e}t={}}else if(e<160){if(0!=(o=e-144)){this.pushArrayState(o),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!==(o=this.readU16())){this.pushArrayState(o),this.complete();continue e}t=[]}else if(221===e){if(0!==(o=this.readU32())){this.pushArrayState(o),this.complete();continue e}t=[]}else if(222===e){if(0!==(o=this.readU16())){this.pushMapState(o),this.complete();continue e}t={}}else if(223===e){if(0!==(o=this.readU32())){this.pushMapState(o),this.complete();continue e}t={}}else if(196===e){var o=this.lookU8();t=this.decodeBinary(o,1)}else if(197===e)o=this.lookU16(),t=this.decodeBinary(o,2);else if(198===e)o=this.lookU32(),t=this.decodeBinary(o,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)o=this.lookU8(),t=this.decodeExtension(o,1);else if(200===e)o=this.lookU16(),t=this.decodeExtension(o,2);else{if(201!==e)throw new ln("Unrecognized type byte: ".concat(fn(e)));o=this.lookU32(),t=this.decodeExtension(o,4)}this.complete();for(var r=this.stack;r.length>0;){var i=r[r.length-1];if(0===i.type){if(i.array[i.position]=t,i.position++,i.position!==i.size)continue e;r.pop(),t=i.array}else{if(1===i.type){if("string"!=(s=typeof t)&&"number"!==s)throw new ln("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new ln("The key __proto__ is not allowed");i.key=t,i.type=2;continue e}if(i.map[i.key]=t,i.readCount++,i.readCount!==i.size){i.key=null,i.type=1;continue e}r.pop(),t=i.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new ln("Unrecognized array type byte: ".concat(fn(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new ln("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new ln("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new ln("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthsn?function(e,t,n){var o=e.subarray(t,t+n);return rn.decode(o)}(this.bytes,r,e):nn(this.bytes,r,e),this.pos+=t+e,o},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 ln("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw kn;var n=this.pos+t,o=this.bytes.subarray(n,n+e);return this.pos+=t+e,o},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new ln("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),o=this.decodeBinary(e,t+1);return this.extensionCodec.decode(o,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=Yt(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}();!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"}(gn||(gn={})),function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(mn||(mn={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(yn||(yn={}));class xn{constructor(){}log(e,t){}}xn.instance=new xn,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"}(vn||(vn={}));class Rn{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 o=new Uint8Array(n.length+t);return o.set(n,0),o.set(e,n.length),o.buffer}static parse(e){const t=[],n=new Uint8Array(e),o=[0,7,14,21,28];for(let r=0;r7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=r+s+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(r+s,r+s+a):n.subarray(r+s,r+s+a)),r=r+s+a}return t}}const Pn=new Uint8Array([145,gn.Ping]);class Nn{constructor(e){this.name="messagepack",this.version=1,this.transferFormat=yn.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new pn(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new Dn(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=xn.instance);const o=Rn.parse(e),r=[];for(const e of o){const n=this._parseMessage(e,t);n&&r.push(n)}return r}writeMessage(e){switch(e.type){case gn.Invocation:return this._writeInvocation(e);case gn.StreamInvocation:return this._writeStreamInvocation(e);case gn.StreamItem:return this._writeStreamItem(e);case gn.Completion:return this._writeCompletion(e);case gn.Ping:return Rn.write(Pn);case gn.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 o=n[0];switch(o){case gn.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case gn.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case gn.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case gn.Ping:return this._createPingMessage(n);case gn.Close:return this._createCloseMessage(n);default:return t.log(vn.Information,"Unknown message type '"+o+"' 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:gn.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:gn.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:gn.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:gn.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:gn.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 o,r;switch(n){case this._errorResult:o=t[4];break;case this._nonVoidResult:r=t[4]}return{error:o,headers:e,invocationId:t[2],result:r,type:gn.Completion}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([gn.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([gn.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),Rn.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([gn.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([gn.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),Rn.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([gn.StreamItem,e.headers||{},e.invocationId,e.item]);return Rn.write(t.slice())}_writeCompletion(e){const t=e.error?this._errorResult:void 0!==e.result?this._nonVoidResult:this._voidResult;let n;switch(t){case this._errorResult:n=this._encoder.encode([gn.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([gn.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([gn.Completion,e.headers||{},e.invocationId,t,e.result])}return Rn.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([gn.CancelInvocation,e.headers||{},e.invocationId]);return Rn.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}let An=!1;function Un(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),An||(An=!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 Ln="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Mn=Ln?Ln.decode.bind(Ln):function(e){let t=0;const n=e.length,o=[],r=[];for(;t65535&&(r-=65536,o.push(r>>>10&1023|55296),r=56320|1023&r),o.push(r)}o.length>1024&&(r.push(String.fromCharCode.apply(null,o)),o.length=0)}return r.push(String.fromCharCode.apply(null,o)),r.join("")},Bn=Math.pow(2,32),$n=Math.pow(2,21)-1;function On(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Fn(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function Hn(e,t){const n=Fn(e,t+4);if(n>$n)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Bn+Fn(e,t)}class jn{constructor(e){this.batchData=e;const t=new qn(e);this.arrayRangeReader=new Kn(e),this.arrayBuilderSegmentReader=new Vn(e),this.diffReader=new Wn(e),this.editReader=new zn(e,t),this.frameReader=new Jn(e,t)}updatedComponents(){return On(this.batchData,this.batchData.length-20)}referenceFrames(){return On(this.batchData,this.batchData.length-16)}disposedComponentIds(){return On(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return On(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return On(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return On(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return Hn(this.batchData,n)}}class Wn{constructor(e){this.batchDataUint8=e}componentId(e){return On(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class zn{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return On(this.batchDataUint8,e)}siblingIndex(e){return On(this.batchDataUint8,e+4)}newTreeIndex(e){return On(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return On(this.batchDataUint8,e+8)}removedAttributeName(e){const t=On(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class Jn{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return On(this.batchDataUint8,e)}subtreeLength(e){return On(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=On(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return On(this.batchDataUint8,e+8)}elementName(e){const t=On(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=On(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=On(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=On(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=On(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return Hn(this.batchDataUint8,e+12)}}class qn{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=On(e,e.length-4)}readString(e){if(-1===e)return null;{const n=On(this.batchDataUint8,this.stringTableStartIndex+4*e),o=function(e,t){let n=0,o=0;for(let r=0;r<4;r++){const i=e[t+r];if(n|=(127&i)<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=de[e];if(!n)throw new Error(`There is no browser renderer with ID ${e}.`);const o=t.arrayRangeReader,r=t.updatedComponents(),i=o.values(r),s=o.count(r),a=t.referenceFrames(),c=o.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 Zn{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!==Rt.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!==Rt.Connected)return!1;const t=await e.invoke("StartCircuit",Ee.getBaseURI(),Ee.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 $(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,o=$(n,!0),r=J(o);return Array.from(n.childNodes).forEach((e=>r.push(e))),e[M]=o,t&&(e[B]=t,$(t)),$(e)}(this.components[n].start,this.components[n].end);throw new Error(`Invalid sequence number or identifier '${e}'.`)}}const eo={configureSignalR:e=>{},logLevel:Xn.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class to{constructor(e,t,n,o){this.maxRetries=t,this.document=n,this.logger=o,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 r=this.document.createElement("a");r.addEventListener("click",(()=>location.reload())),r.textContent="reload",this.reloadParagraph=this.document.createElement("p"),this.reloadParagraph.textContent="Alternatively, ",this.reloadParagraph.appendChild(r),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 Ke.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 no{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const o=this.document.getElementById(no.MaxRetriesId);o&&(o.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(no.ShowClassName)}update(e){const t=this.document.getElementById(no.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(no.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(no.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(no.RejectedClassName)}removeClasses(){this.dialog.classList.remove(no.ShowClassName,no.HideClassName,no.FailedClassName,no.RejectedClassName)}}no.ShowClassName="components-reconnect-show",no.HideClassName="components-reconnect-hide",no.FailedClassName="components-reconnect-failed",no.RejectedClassName="components-reconnect-rejected",no.MaxRetriesId="components-reconnect-max-retries",no.CurrentAttemptId="components-reconnect-current-attempt";class oo{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||Ke.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new no(t,e.maxRetries,document):new to(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new ro(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class ro{constructor(e,t,n,o){this.logger=t,this.reconnectCallback=n,this.isDisposed=!1,this.reconnectDisplay=o,this.reconnectDisplay.show(),this.attemptPeriodicReconnection(e)}dispose(){this.isDisposed=!0,this.reconnectDisplay.hide()}async attemptPeriodicReconnection(e){for(let t=0;tro.MaximumFirstRetryInterval?ro.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)))}}ro.MaximumFirstRetryInterval=3e3;const io=/^\s*Blazor-Component-State:(?[a-zA-Z0-9+/=]+)$/;function so(e){var t;if(e.nodeType===Node.COMMENT_NODE){const n=e.textContent||"",o=io.exec(n),r=o&&o.groups&&o.groups.state;return r&&(null===(t=e.parentNode)||void 0===t||t.removeChild(e)),r}if(!e.hasChildNodes())return;const n=e.childNodes;for(let e=0;e.*)$/);function lo(e,t){const n=e.currentElement;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const o=co.exec(n.textContent),r=o&&o.groups&&o.groups.descriptor;if(!r)return;try{const o=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(r);switch(t){case"webassembly":return function(e,t,n){const{type:o,assembly:r,typeName:i,parameterDefinitions:s,parameterValues:a,prerenderId:c}=e,l=c?ho(c,n):void 0;if(c&&!l)throw new Error(`Could not find an end component comment for '${t}'.`);if("webassembly"===o){if(!r)throw new Error("assembly must be defined when using a descriptor.");if(!i)throw new Error("typeName must be defined when using a descriptor.");return{type:o,assembly:r,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:a&&atob(a),start:t,prerenderId:c,end:l}}}(o,n,e);case"server":return function(e,t,n){const{type:o,descriptor:r,sequence:i,prerenderId:s}=e,a=s?ho(s,n):void 0;if(s&&!a)throw new Error(`Could not find an end component comment for '${t}'.`);if("server"===o){if(!r)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===i)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(i))throw new Error(`Error parsing the sequence '${i}' for component '${JSON.stringify(e)}'`);return{type:o,sequence:i,descriptor:r,start:t,prerenderId:s,end:a}}}(o,n,e)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}function ho(e,t){for(;t.next()&&t.currentElement;){const n=t.currentElement;if(n.nodeType!==Node.COMMENT_NODE)continue;if(!n.textContent)continue;const o=co.exec(n.textContent),r=o&&o[1];if(r)return uo(r,e),n}}function uo(e,t){const n=JSON.parse(e);if(1!==Object.keys(n).length)throw new Error(`Invalid end of component comment: '${e}'`);const o=n.prerenderId;if(!o)throw new Error(`End of component comment must have a value for the prerendered property: '${e}'`);if(o!==t)throw new Error(`End of component comment prerendered property must match the start comment prerender id: '${t}', '${o}'`)}class po{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndexasync function(e,n){const o=function(e){const t=document.baseURI;return t.endsWith("/")?`${t}${e}`:`${t}/${e}`}(n),r=await import(o);if(void 0===r)return;const{beforeStart:i,afterStarted:s}=r;return s&&e.afterStartedCallbacks.push(s),i?i(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await C,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let yo,vo,wo,bo=!1;async function _o(t,n){const o=function(e){const t={...eo,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...eo.reconnectionOptions,...e.reconnectionOptions}),t}(t),r=await async function(e){const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),o=new mo;return await o.importInitializersAsync(n,[e]),o}(o),i=new Qn(o.logLevel);Ke.reconnect=async e=>{if(bo)return!1;const t=e||await Eo(o,i,vo);return await vo.reconnect(t)?(o.reconnectionHandler.onConnectionUp(),!0):(i.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)},Ke.defaultReconnectionHandler=new oo(i),o.reconnectionHandler=o.reconnectionHandler||Ke.defaultReconnectionHandler,i.log(Xn.Information,"Starting up Blazor server-side application.");const s=so(document);vo=new Zn(n||[],s||""),Ke._internal.navigationManager.listenForNavigationEvents(((e,t,n)=>yo.send("OnLocationChanged",e,t,n)),((e,t,n,o)=>yo.send("OnLocationChanging",e,t,n,o))),Ke._internal.forceCloseConnection=()=>yo.stop(),Ke._internal.sendJSDataStream=(e,t,n)=>function(e,t,n,o){setTimeout((async()=>{let r=5,i=(new Date).valueOf();try{const s=t instanceof Blob?t.size:t.byteLength;let a=0,c=0;for(;a1)await e.send("ReceiveJSDataChunk",n,c,h,null);else{if(!await e.invoke("ReceiveJSDataChunk",n,c,h,null))break;const t=(new Date).valueOf(),o=t-i;i=t,r=Math.max(1,Math.round(500/Math.max(1,o)))}a+=l,c++}}catch(t){await e.send("ReceiveJSDataChunk",n,-1,null,t.toString())}}),0)}(yo,e,t,n),wo=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,o,r)=>{yo.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,o||0,r)},endInvokeJSFromDotNet:(e,t,n)=>{yo.send("EndInvokeJSFromDotNet",e,t,n)},sendByteArray:(e,t)=>{yo.send("ReceiveByteArray",e,t)}});const a=await Eo(o,i,vo);if(!await vo.startCircuit(a))return void i.log(Xn.Error,"Failed to start the circuit.");let c=!1;const l=()=>{if(!c){const e=new FormData,t=vo.circuitId;e.append("circuitId",t),c=navigator.sendBeacon("_blazor/disconnect",e)}};Ke.disconnect=l,window.addEventListener("unload",l,{capture:!1,once:!0}),i.log(Xn.Information,"Blazor server-side application started."),r.invokeAfterStartedCallbacks(Ke)}async function Eo(e,t,n){var o,r;const i=new Nn;i.name="blazorpack";const s=(new zt).withUrl("_blazor").withHubProtocol(i);e.configureSignalR(s);const a=s.build();a.on("JS.AttachComponent",((e,t)=>function(e,t,n,o){let r=de[0];r||(r=new ce(0),de[0]=r),r.attachRootComponentToLogicalElement(n,t,!1)}(0,n.resolveElement(t),e))),a.on("JS.BeginInvokeJS",wo.beginInvokeJSFromDotNet.bind(wo)),a.on("JS.EndInvokeDotNet",wo.endInvokeDotNetFromJS.bind(wo)),a.on("JS.ReceiveByteArray",wo.receiveByteArray.bind(wo)),a.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start(t){a.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});wo.supplyDotNetStream(e,t)}));const c=Yn.getOrCreate(t);a.on("JS.RenderBatch",((e,n)=>{t.log(Xn.Debug,`Received render batch with id ${e} and ${n.byteLength} bytes.`),c.processBatch(e,n,a)})),a.on("JS.EndLocationChanging",Ke._internal.navigationManager.endLocationChanging),a.onclose((t=>!bo&&e.reconnectionHandler.onConnectionDown(e.reconnectionOptions,t))),a.on("JS.Error",(e=>{bo=!0,So(a,e,t),Un()}));try{await a.start(),yo=a}catch(e){if(So(a,e,t),"FailedToNegotiateWithServerError"===e.errorType)throw e;Un(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===Tt.WebSockets))?t.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===Tt.WebSockets))?t.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===Tt.LongPolling))&&t.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===(r=null===(o=a.connection)||void 0===o?void 0:o.features)||void 0===r?void 0:r.inherentKeepAlive)&&t.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."),a}function So(e,t,n){n.log(Xn.Error,t),e&&e.stop()}let Co=!1;function Io(e){if(Co)throw new Error("Blazor has already started.");return Co=!0,_o(e,function(e,t){return function(e){const t=ao(e,"server"),n=[];for(let e=0;ee.sequence-t.sequence))}(e)}(document))}Ke.start=Io,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&Io()})(); \ No newline at end of file +(()=>{"use strict";var e,t,n,o={};o.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){const t=[],n="__jsObjectId",o="__dotNetObject",r="__byte[]",i="__dotNetStream",s="__jsStreamReferenceLength";let a,c;class l{constructor(e){this._jsObject=e,this._cachedFunctions=new Map}findFunction(e){const t=this._cachedFunctions.get(e);if(t)return t;let n,o=this._jsObject;if(e.split(".").forEach((t=>{if(!(t in o))throw new Error(`Could not find '${e}' ('${t}' was undefined).`);n=o,o=o[t]})),o instanceof Function)return o=o.bind(n),this._cachedFunctions.set(e,o),o;throw new Error(`The value '${e}' is not a function.`)}getWrappedObject(){return this._jsObject}}const h={0:new l(window)};h[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let d,u=1;function p(e){t.push(e)}function f(e){if(e&&"object"==typeof e){h[u]=new l(e);const t={[n]: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 o={[s]:t};try{const t=f(e);o[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return o}function m(e,n){c=e;const o=n?JSON.parse(n,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null;return c=void 0,o}function y(){if(void 0===a)throw new Error("No call dispatcher has been set.");if(null===a)throw new Error("There are multiple .NET runtimes present, so a default dispatcher could not be resolved. Use DotNetObject to invoke .NET instance methods.");return a}e.attachDispatcher=function(e){const t=new v(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=p,e.invokeMethod=function(e,t,...n){return y().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return y().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=f,e.createJSStreamReference=g,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&_(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(d=e.JSCallResultType||(e.JSCallResultType={}));class v{constructor(e){this._dotNetCallDispatcher=e,this._byteArraysToBeRevived=new Map,this._pendingDotNetToJSStreams=new Map,this._pendingAsyncCalls={},this._nextAsyncCallId=1}getDotNetCallDispatcher(){return this._dotNetCallDispatcher}invokeJSFromDotNet(e,t,n,o){const r=m(this,t),i=I(b(e,o)(...r||[]),n);return null==i?null:T(this,i)}beginInvokeJSFromDotNet(e,t,n,o,r){const i=new Promise((e=>{const o=m(this,n);e(b(t,r)(...o||[]))}));e&&i.then((t=>T(this,[e,!0,I(t,o)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,w(t)]))))}endInvokeDotNetFromJS(e,t,n){const o=t?m(this,n):new Error(n);this.completePendingCall(parseInt(e,10),t,o)}invokeDotNetStaticMethod(e,t,...n){return this.invokeDotNetMethod(e,t,null,n)}invokeDotNetStaticMethodAsync(e,t,...n){return this.invokeDotNetMethodAsync(e,t,null,n)}invokeDotNetMethod(e,t,n,o){if(this._dotNetCallDispatcher.invokeDotNetFromJS){const r=T(this,o),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,r);return i?m(this,i):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeDotNetMethodAsync instead.")}invokeDotNetMethodAsync(e,t,n,o){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const r=this._nextAsyncCallId++,i=new Promise(((e,t)=>{this._pendingAsyncCalls[r]={resolve:e,reject:t}}));try{const i=T(this,o);this._dotNetCallDispatcher.beginInvokeDotNetFromJS(r,e,t,n,i)}catch(e){this.completePendingCall(r,!1,e)}return i}receiveByteArray(e,t){this._byteArraysToBeRevived.set(e,t)}processByteArray(e){const t=this._byteArraysToBeRevived.get(e);return t?(this._byteArraysToBeRevived.delete(e),t):null}supplyDotNetStream(e,t){if(this._pendingDotNetToJSStreams.has(e)){const n=this._pendingDotNetToJSStreams.get(e);this._pendingDotNetToJSStreams.delete(e),n.resolve(t)}else{const n=new C;n.resolve(t),this._pendingDotNetToJSStreams.set(e,n)}}getDotNetStreamPromise(e){let t;if(this._pendingDotNetToJSStreams.has(e))t=this._pendingDotNetToJSStreams.get(e).streamPromise,this._pendingDotNetToJSStreams.delete(e);else{const n=new C;this._pendingDotNetToJSStreams.set(e,n),t=n.streamPromise}return t}completePendingCall(e,t,n){if(!this._pendingAsyncCalls.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const o=this._pendingAsyncCalls[e];delete this._pendingAsyncCalls[e],t?o.resolve(n):o.reject(n)}}function w(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function b(e,t){const n=h[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function _(e){delete h[e]}e.findJSFunction=b,e.disposeJSObjectReferenceById=_;class E{constructor(e,t){this._id=e,this._callDispatcher=t}invokeMethod(e,...t){return this._callDispatcher.invokeDotNetMethod(null,e,this._id,t)}invokeMethodAsync(e,...t){return this._callDispatcher.invokeDotNetMethodAsync(null,e,this._id,t)}dispose(){this._callDispatcher.invokeDotNetMethodAsync(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{[o]:this._id}}}e.DotNetObject=E,p((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(o))return new E(t[o],c);if(t.hasOwnProperty(n)){const e=t[n],o=h[e];if(o)return o.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(r)){const e=t[r],n=c.processByteArray(e);if(void 0===n)throw new Error(`Byte array index '${e}' does not exist.`);return n}if(t.hasOwnProperty(i)){const e=t[i],n=c.getDotNetStreamPromise(e);return new S(n)}}return t}));class S{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class C{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function I(e,t){switch(t){case d.Default:return e;case d.JSObjectReference:return f(e);case d.JSStreamReference:return g(e);case d.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let k=0;function T(e,t){k=0,c=e;const n=JSON.stringify(t,D);return c=void 0,n}function D(e,t){if(t instanceof E)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(k,t);const e={[r]:k};return k++,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 i=new Map,s=new Map,a=[];function c(e){return i.get(e)}function l(e){const t=i.get(e);return(null==t?void 0:t.browserEventName)||e}function h(e,t){e.forEach((e=>i.set(e,t)))}function d(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}{const e=function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t);return{value:e?!!t.checked:t.value}}}}),h(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),h(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...u(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),h(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),h(["keydown","keyup","keypress"],{createEventArgs:e=>{return{key:(t=e).key,code:t.code,location:t.location,repeat:t.repeat,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),h(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>u(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: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}}),h(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...u(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{...u(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 v={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const o="__bl-dynamic-root:"+(++y).toString();f.set(o,e);const r=await _().invokeMethodAsync("AddRootComponent",t,o),i=new b(r,m[t]);return await i.setParameters(n),i}};class w{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 w)}setParameters(e){const t={},n=Object.entries(e||{}),o=n.length;for(const[e,o]of n){const n=this._jsEventCallbackWrappers.get(e.toLowerCase());n&&o?(n.setCallback(o),t[e]=n.getJSObjectReference()):t[e]=o}return _().invokeMethodAsync("SetRootComponentParameters",this._componentId,o,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=[];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[e];if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let T=(e,t,n)=>n();const D=U(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),x={submit:!0},R=U(["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 N(this.onGlobalEvent.bind(this))}setListener(e,t,n,o){const r=this.getEventHandlerInfosForElement(e,!0),i=r.getHandler(t);if(i)this.eventInfoStore.update(i.eventHandlerId,n);else{const i={element:e,eventName:t,eventHandlerId:n,renderingComponentId:o};this.eventInfoStore.add(i),r.setHandler(t,i)}}getHandler(e){return this.eventInfoStore.get(e)}removeListener(e){const t=this.eventInfoStore.remove(e);if(t){const e=t.element,n=this.getEventHandlerInfosForElement(e,!1);n&&n.removeHandler(t.eventName)}}notifyAfterClick(e){this.afterClickCallbacks.push(e),this.eventInfoStore.addGlobalListener("click")}setStopPropagation(e,t,n){this.getEventHandlerInfosForElement(e,!0).stopPropagation(t,n)}setPreventDefault(e,t,n){this.getEventHandlerInfosForElement(e,!0).preventDefault(t,n)}onGlobalEvent(e){if(!(e.target instanceof Element))return;this.dispatchGlobalEventToAllElements(e.type,e);const t=(n=e.type,s.get(n));var n;t&&t.forEach((t=>this.dispatchGlobalEventToAllElements(t,e))),"click"===e.type&&this.afterClickCallbacks.forEach((t=>t(e)))}dispatchGlobalEventToAllElements(e,t){const n=t.composedPath();let o=n.shift(),i=null,s=!1;const a=Object.prototype.hasOwnProperty.call(D,e);let l=!1;for(;o;){const u=o,p=this.getEventHandlerInfosForElement(u,!1);if(p){const n=p.getHandler(e);if(n&&(h=u,d=t.type,!((h instanceof HTMLButtonElement||h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(R,d)&&h.disabled))){if(!s){const n=c(e);i=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(x,t.type)&&t.preventDefault(),I(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:r.fromEvent(n.renderingComponentId,t)},i)}p.stopPropagation(e)&&(l=!0),p.preventDefault(e)&&t.preventDefault()}o=a||l?void 0:n.shift()}var h,d}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new A:null}}P.nextEventDelegatorId=0;class N{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},a.push(this.handleEventNameAliasAdded.bind(this))}add(e){if(this.infosByEventHandlerId[e.eventHandlerId])throw new Error(`Event ${e.eventHandlerId} is already tracked`);this.infosByEventHandlerId[e.eventHandlerId]=e,this.addGlobalListener(e.eventName)}get(e){return this.infosByEventHandlerId[e]}addGlobalListener(e){if(e=l(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(D,e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(Object.prototype.hasOwnProperty.call(this.infosByEventHandlerId,t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=l(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(Object.prototype.hasOwnProperty.call(this.countByEventName,e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class A{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return Object.prototype.hasOwnProperty.call(this.handlers,e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function U(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const L=G("_blazorLogicalChildren"),M=G("_blazorLogicalParent"),B=G("_blazorLogicalEnd");function $(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return L in e||(e[L]=[]),e}function O(e,t){const n=document.createComment("!");return F(n,e,t),n}function F(e,t,n){const o=e;if(e instanceof Comment&&J(o)&&J(o).length>0)throw new Error("Not implemented: inserting non-empty logical container");if(j(o))throw new Error("Not implemented: moving existing logical children");const r=J(t);if(n0;)H(n,0)}const o=n;o.parentNode.removeChild(o)}function j(e){return e[M]||null}function W(e,t){return J(e)[t]}function z(e){const t=K(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function J(e){return e[L]}function q(e,t){const n=J(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=Y(e.moveRangeStart)})),t.forEach((t=>{const o=document.createComment("marker");t.moveToBeforeMarker=o;const r=n[t.toSiblingIndex+1];r?r.parentNode.insertBefore(o,r):X(o,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,o=e.moveRangeStart,r=e.moveRangeEnd;let i=o;for(;i;){const e=i.nextSibling;if(n.insertBefore(i,t),i===r)break;i=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 V(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=V(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=V(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}`}const Z="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,Z)&&"string"==typeof t[Z]?function(e){const t=`[${Q(e)}]`;return document.querySelector(t)}(t[Z]):t));const ee="_blazorDeferredValue";function te(e){return"select-multiple"===e.type}function ne(e,t){e.value=t||""}function oe(e,t){e instanceof HTMLSelectElement?te(e)?function(e,t){t||(t=[]);for(let n=0;n{fe&&function(e,t){if(0!==e.button||function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e))return;if(e.defaultPrevented)return;const n=function(e){const t=!window._blazorDisableComposedPath&&e.composedPath&&e.composedPath();if(t){for(let e=0;edocument.baseURI,getLocationHref:()=>location.href,scrollToElement:Te};function Te(e){const t=document.getElementById(e);return!!t&&(t.scrollIntoView(),!0)}function De(e,t,n=!1){const o=me(e);!t.forceLoad&&ge(o)?xe(o,!1,t.replaceHistoryEntry,t.historyEntryState,n):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function xe(e,t,n,o=void 0,r=!1){if(Ne(),function(e){const t=e.indexOf("#");return t>-1&&location.href.replace(location.hash,"")===e.substring(0,t)}(e))!function(e,t,n){Re(e,t,n);const o=e.indexOf("#");o!==e.length-1&&Te(e.substring(o+1))}(e,n,o);else{if(!r&&we&&!await Ae(e,o,t))return;pe=!0,Re(e,n,o),await Ue(t)}}function Re(e,t,n=void 0){t?history.replaceState({userState:n,_index:be},"",e):(be++,history.pushState({userState:n,_index:be},"",e))}function Pe(e){return new Promise((t=>{const n=Ce;Ce=()=>{Ce=n,t()},history.go(e)}))}function Ne(){Ie&&(Ie(!1),Ie=null)}function Ae(e,t,n){return new Promise((o=>{Ne(),Se?(_e++,Ie=o,Se(_e,e,t,n)):o(!1)}))}async function Ue(e){var t;Ee&&await Ee(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function Le(e){var t,n;Ce&&await Ce(e),be=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}const Me={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,t){const n=document.querySelector(e);n&&(n.hasAttribute("tabindex")||(n.tabIndex=-1),n.focus({preventScroll:!0}))}},Be={init:function(e,t,n,o=50){const r=Oe(t);(r||document.documentElement).style.overflowAnchor="none";const i=document.createRange();h(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(o){o.forEach((o=>{var r;if(!o.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const s=i.getBoundingClientRect().height,a=null===(r=o.rootBounds)||void 0===r?void 0:r.height;o.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",o.intersectionRect.top-o.boundingClientRect.top,s,a):o.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",o.boundingClientRect.bottom-o.intersectionRect.bottom,s,a)}))}),{root:r,rootMargin:`${o}px`});s.observe(t),s.observe(n);const a=l(t),c=l(n);function l(e){const t={attributes:!0},n=new MutationObserver(((n,o)=>{h(e.parentElement)&&(o.disconnect(),e.style.display="table-row",o.observe(e,t)),s.unobserve(e),s.observe(e)}));return n.observe(e,t),n}function h(e){return null!==e&&(e instanceof HTMLTableElement&&""===e.style.display||"table"===e.style.display||e instanceof HTMLTableSectionElement&&""===e.style.display||"table-row-group"===e.style.display)}$e[e._id]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const t=$e[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete $e[e._id])}},$e={};function Oe(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:Oe(e.parentElement):null}const Fe={getAndRemoveExistingTitle:function(){var e;const t=document.head?document.head.getElementsByTagName("title"):[];if(0===t.length)return null;let n=null;for(let o=t.length-1;o>=0;o--){const r=t[o],i=r.previousSibling;i instanceof Comment&&null!==j(i)||(null===n&&(n=r.textContent),null===(e=r.parentNode)||void 0===e||e.removeChild(r))}return n}},He={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,o,r){const i=je(e,t),s=await new Promise((function(e){const t=new Image;t.onload=function(){URL.revokeObjectURL(t.src),e(t)},t.onerror=function(){t.onerror=null,URL.revokeObjectURL(t.src)},t.src=URL.createObjectURL(i.blob)})),a=await new Promise((function(e){var t;const i=Math.min(1,o/s.width),a=Math.min(1,r/s.height),c=Math.min(i,a),l=document.createElement("canvas");l.width=Math.round(s.width*c),l.height=Math.round(s.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(s,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return je(e,t).blob}};function je(e,t){const n=e._blazorFilesById[t];if(!n)throw new Error(`There is no file with ID ${t}. The file list may have changed. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.`);return n}const We=new Set,ze={enableNavigationPrompt:function(e){0===We.size&&window.addEventListener("beforeunload",Je),We.add(e)},disableNavigationPrompt:function(e){We.delete(e),0===We.size&&window.removeEventListener("beforeunload",Je)}};function Je(e){e.preventDefault(),e.returnValue=!0}async function qe(e,t,n){return e instanceof Blob?await async function(e,t,n){const o=e.slice(t,t+n),r=await o.arrayBuffer();return new Uint8Array(r)}(e,t,n):function(e,t,n){return new Uint8Array(e.buffer,e.byteOffset+t,n)}(e,t,n)}new Map;const Ke={navigateTo:function(e,t,n=!1){De(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(i.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=s.get(t.browserEventName);n?n.push(e):s.set(t.browserEventName,[e]),a.forEach((n=>n(e,t.browserEventName)))}i.set(e,t)},rootComponents:v,_internal:{navigationManager:ke,domWrapper:Me,Virtualize:Be,PageTitle:Fe,InputFile:He,NavigationLock:ze,getJSDataStreamChunk:qe,attachWebRendererInterop:function(t,n,o){const r=E.length;return E.push(t),Object.keys(n).length>0&&function(t,n,o){if(g)throw new Error("Dynamic root components have already been enabled.");g=t,m=n;for(const[t,r]of Object.entries(o)){const o=e.findJSFunction(t,0);for(const e of r)o(e,n[e])}}(k(r),n,o),S(),r}}};window.Blazor=Ke;const Ve=[0,2e3,1e4,3e4,null];class Xe{constructor(e){this._retryDelays=void 0!==e?[...e,null]:Ve}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class Ye{}Ye.Authorization="Authorization",Ye.Cookie="Cookie";class Ge{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class Qe{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}class Ze extends Qe{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&401===n.statusCode&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[Ye.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[Ye.Authorization]&&delete e.headers[Ye.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}class et extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class tt extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class nt extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class ot extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class rt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class it extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class st extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class at extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}var ct;!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(ct||(ct={}));class lt{constructor(){}log(e,t){}}lt.instance=new lt;const ht="0.0.0-DEV_BUILD";class dt{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 ut{static get isBrowser(){return"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isReactNative(){return"object"==typeof window&&void 0===window.document}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}}function pt(e,t){let n="";return ft(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 ft(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function gt(e,t,n,o,r,i){const s={},[a,c]=vt();s[a]=c,e.log(ct.Trace,`(${t} transport) sending data. ${pt(r,i.logMessageContent)}.`);const l=ft(r)?"arraybuffer":"text",h=await n.post(o,{content:r,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(ct.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class mt{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 yt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${ct[e]}: ${t}`;switch(e){case ct.Critical:case ct.Error:this.out.error(n);break;case ct.Warning:this.out.warn(n);break;case ct.Information:this.out.info(n);break;default:this.out.log(n)}}}}function vt(){let e="X-SignalR-User-Agent";return ut.isNode&&(e="User-Agent"),[e,wt(ht,bt(),ut.isNode?"NodeJS":"Browser",_t())]}function wt(e,t,n,o){let r="Microsoft SignalR/";const i=e.split(".");return r+=`${i[0]}.${i[1]}`,r+=` (${e}; `,r+=t&&""!==t?`${t}; `:"Unknown OS; ",r+=`${n}`,r+=o?`; ${o}`:"; Unknown Runtime Version",r+=")",r}function bt(){if(!ut.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function _t(){if(ut.isNode)return process.versions.node}function Et(e){return e.stack?e.stack:e.message?e.message:`${e}`}class St extends Qe{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e=require;this._jar=new(e("tough-cookie").CookieJar),"undefined"==typeof fetch?this._fetchType=e("node-fetch"):this._fetchType=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!==o.g)return o.g;throw new Error("could not find global")}());if("undefined"==typeof AbortController){const e=require;this._abortControllerType=e("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new nt;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const t=new this._abortControllerType;let n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new nt});let o,r=null;if(e.timeout){const o=e.timeout;r=setTimeout((()=>{t.abort(),this._logger.log(ct.Warning,"Timeout from HTTP request."),n=new tt}),o)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},ft(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");try{o=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:!0===e.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(e){if(n)throw n;throw this._logger.log(ct.Warning,`Error from HTTP request. ${e}.`),e}finally{r&&clearTimeout(r),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const e=await Ct(o,"text");throw new et(e||o.statusText,o.status)}const i=Ct(o,e.responseType),s=await i;return new Ge(o.status,o.statusText,s)}getCookieString(e){return""}}function Ct(e,t){let n;switch(t){case"arraybuffer":n=e.arrayBuffer();break;case"text":default:n=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`)}return n}class It extends Qe{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new nt):e.method?e.url?new Promise(((t,n)=>{const o=new XMLHttpRequest;o.open(e.method,e.url,!0),o.withCredentials=void 0===e.withCredentials||e.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===e.content&&(e.content=void 0),e.content&&(ft(e.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const r=e.headers;r&&Object.keys(r).forEach((e=>{o.setRequestHeader(e,r[e])})),e.responseType&&(o.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{o.abort(),n(new nt)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new Ge(o.status,o.statusText,o.response||o.responseText)):n(new et(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(ct.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new et(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(ct.Warning,"Timeout from HTTP request."),n(new tt)},o.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class kt extends Qe{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new St(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new It(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new nt):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}var Tt,Dt,xt,Rt;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(Tt||(Tt={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Dt||(Dt={}));class Pt{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 Nt{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new Pt,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(dt.isRequired(e,"url"),dt.isRequired(t,"transferFormat"),dt.isIn(t,Dt,"transferFormat"),this._url=e,this._logger.log(ct.Trace,"(LongPolling transport) Connecting."),t===Dt.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,o]=vt(),r={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===Dt.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(ct.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(ct.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new et(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(ct.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,t);204===o.statusCode?(this._logger.log(ct.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==o.statusCode?(this._logger.log(ct.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new et(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(ct.Trace,`(LongPolling transport) data received. ${pt(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(ct.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof tt?this._logger.log(ct.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(ct.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(ct.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?gt(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(ct.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(ct.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=vt();e[t]=n;const o={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};await this._httpClient.delete(this._url,o),this._logger.log(ct.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(ct.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(ct.Trace,e),this.onclose(this._closeError)}}}class At{constructor(e,t,n,o){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}async connect(e,t){return dt.isRequired(e,"url"),dt.isRequired(t,"transferFormat"),dt.isIn(t,Dt,"transferFormat"),this._logger.log(ct.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,o)=>{let r,i=!1;if(t===Dt.Text){if(ut.isBrowser||ut.isWebWorker)r=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const t=this._httpClient.getCookieString(e),n={};n.Cookie=t;const[o,i]=vt();n[o]=i,r=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...n,...this._options.headers}})}try{r.onmessage=e=>{if(this.onreceive)try{this._logger.log(ct.Trace,`(SSE transport) data received. ${pt(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},r.onerror=e=>{i?this._close():o(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."))},r.onopen=()=>{this._logger.log(ct.Information,`SSE connected to ${this._url}`),this._eventSource=r,i=!0,n()}}catch(e){return void o(e)}}else o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(e){return this._eventSource?gt(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class Ut{constructor(e,t,n,o,r,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=o,this._webSocketConstructor=r,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){let n;return dt.isRequired(e,"url"),dt.isRequired(t,"transferFormat"),dt.isIn(t,Dt,"transferFormat"),this._logger.log(ct.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((o,r)=>{let i;e=e.replace(/^http/,"ws");const s=this._httpClient.getCookieString(e);let a=!1;if(ut.isReactNative){const t={},[o,r]=vt();t[o]=r,n&&(t[Ye.Authorization]=`Bearer ${n}`),s&&(t[Ye.Cookie]=s),i=new this._webSocketConstructor(e,void 0,{headers:{...t,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===Dt.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(ct.Information,`WebSocket connected to ${e}.`),this._webSocket=i,a=!0,o()},i.onerror=e=>{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"There was an error with the transport",this._logger.log(ct.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(ct.Trace,`(WebSockets transport) data received. ${pt(e.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(e.data)}catch(e){return void this._close(e)}},i.onclose=e=>{if(a)this._close(e);else{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",r(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(ct.Trace,`(WebSockets transport) sending data. ${pt(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(ct.Trace,"(WebSockets transport) socket closed."),this.onclose&&(!this._isCloseEvent(e)||!1!==e.wasClean&&1e3===e.code?e instanceof Error?this.onclose(e):this.onclose():this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)))}_isCloseEvent(e){return e&&"boolean"==typeof e.wasClean&&"number"==typeof e.code}}class Lt{constructor(e,t={}){var n;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,dt.isRequired(e,"url"),this._logger=void 0===(n=t.logger)?new yt(ct.Information):null===n?lt.instance:void 0!==n.log?n:new yt(n),this.baseUrl=this._resolveUrl(e),(t=t||{}).logMessageContent=void 0!==t.logMessageContent&&t.logMessageContent,"boolean"!=typeof t.withCredentials&&void 0!==t.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.withCredentials=void 0===t.withCredentials||t.withCredentials,t.timeout=void 0===t.timeout?1e5:t.timeout,"undefined"==typeof WebSocket||t.WebSocket||(t.WebSocket=WebSocket),"undefined"==typeof EventSource||t.EventSource||(t.EventSource=EventSource),this._httpClient=new Ze(t.httpClient||new kt(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Dt.Binary,dt.isIn(e,Dt,"transferFormat"),this._logger.log(ct.Debug,`Starting connection with transfer format '${Dt[e]}'.`),"Disconnected"!==this._connectionState)return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,"Disconnecting"===this._connectionState){const e="Failed to start the HttpConnection before stop() was called.";return this._logger.log(ct.Error,e),await this._stopPromise,Promise.reject(new nt(e))}if("Connected"!==this._connectionState){const e="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(ct.Error,e),Promise.reject(new nt(e))}this._connectionStarted=!0}send(e){return"Connected"!==this._connectionState?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Mt(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(ct.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(ct.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState="Disconnecting",this._stopPromise=new Promise((e=>{this._stopPromiseResolver=e})),await this._stopInternal(e),void await this._stopPromise)}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch(e){}if(this.transport){try{await this.transport.stop()}catch(e){this._logger.log(ct.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(ct.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport!==Tt.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(Tt.WebSockets),await this._startTransport(t,e)}else{let n=null,o=0;do{if(n=await this._getNegotiationResponse(t),"Disconnecting"===this._connectionState||"Disconnected"===this._connectionState)throw new nt("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const e=n.accessToken;this._accessTokenFactory=()=>e,this._httpClient._accessToken=e,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<100);if(100===o&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof Nt&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(ct.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(ct.Error,"Failed to start the connection: "+e),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(e)}}async _getNegotiationResponse(e){const t={},[n,o]=vt();t[n]=o;const r=this._resolveNegotiateUrl(e);this._logger.log(ct.Debug,`Sending negotiation request: ${r}.`);try{const e=await this._httpClient.post(r,{content:"",headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(200!==e.statusCode)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${e.statusCode}'`));const n=JSON.parse(e.content);return(!n.negotiateVersion||n.negotiateVersion<1)&&(n.connectionToken=n.connectionId),n}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof et&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(ct.Error,t),Promise.reject(new st(t))}}_createConnectUrl(e,t){return t?e+(-1===e.indexOf("?")?"?":"&")+`id=${t}`:e}async _createTransport(e,t,n,o){let r=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t))return this._logger.log(ct.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(r,o),void(this.connectionId=n.connectionId);const i=[],s=n.availableTransports||[];let a=n;for(const n of s){const s=this._resolveTransportOrError(n,t,o);if(s instanceof Error)i.push(`${n.transport} failed:`),i.push(s);else if(this._isITransport(s)){if(this.transport=s,!a){try{a=await this._getNegotiationResponse(e)}catch(e){return Promise.reject(e)}r=this._createConnectUrl(e,a.connectionToken)}try{return await this._startTransport(r,o),void(this.connectionId=a.connectionId)}catch(e){if(this._logger.log(ct.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new it(`${n.transport} failed: ${e}`,Tt[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(ct.Debug,e),Promise.reject(new nt(e))}}}}return i.length>0?Promise.reject(new at(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case Tt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Ut(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Tt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new At(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Tt.LongPolling:return new Nt(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n){const o=Tt[e.transport];if(null==o)return this._logger.log(ct.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(!function(e,t){return!e||0!=(t&e)}(t,o))return this._logger.log(ct.Debug,`Skipping transport '${Tt[o]}' because it was disabled by the client.`),new rt(`'${Tt[o]}' is disabled by the client.`,o);if(!(e.transferFormats.map((e=>Dt[e])).indexOf(n)>=0))return this._logger.log(ct.Debug,`Skipping transport '${Tt[o]}' because it does not support the requested transfer format '${Dt[n]}'.`),new Error(`'${Tt[o]}' does not support ${Dt[n]}.`);if(o===Tt.WebSockets&&!this._options.WebSocket||o===Tt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(ct.Debug,`Skipping transport '${Tt[o]}' because it is not supported in your environment.'`),new ot(`'${Tt[o]}' is not supported in your environment.`,o);this._logger.log(ct.Debug,`Selecting transport '${Tt[o]}'.`);try{return this._constructTransport(o)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(ct.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,"Disconnected"!==this._connectionState){if("Connecting"===this._connectionState)throw this._logger.log(ct.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if("Disconnecting"===this._connectionState&&this._stopPromiseResolver(),e?this._logger.log(ct.Error,`Connection disconnected with error '${e}'.`):this._logger.log(ct.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(ct.Error,`TransportSendQueue.stop() threw error '${e}'.`)})),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(ct.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(ct.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`)}_resolveUrl(e){if(0===e.lastIndexOf("https://",0)||0===e.lastIndexOf("http://",0))return e;if(!ut.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(ct.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=e.indexOf("?");let n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",n+=-1===t?"":e.substring(t),-1===n.indexOf("negotiateVersion")&&(n+=-1===t?"?":"&",n+="negotiateVersion="+this._negotiateVersion),n}}class Mt{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Bt,this._transportResult=new Bt,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Bt),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 Bt;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):Mt._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 o=0;for(const t of e)n.set(new Uint8Array(t),o),o+=t.byteLength;return n.buffer}}class Bt{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class $t{static write(e){return`${e}${$t.RecordSeparator}`}static parse(e){if(e[e.length-1]!==$t.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split($t.RecordSeparator);return t.pop(),t}}$t.RecordSeparatorCode=30,$t.RecordSeparator=String.fromCharCode($t.RecordSeparatorCode);class Ot{writeHandshakeRequest(e){return $t.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(ft(e)){const o=new Uint8Array(e),r=o.indexOf($t.RecordSeparatorCode);if(-1===r)throw new Error("Message is incomplete.");const i=r+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(o.slice(0,i))),n=o.byteLength>i?o.slice(i).buffer:null}else{const o=e,r=o.indexOf($t.RecordSeparator);if(-1===r)throw new Error("Message is incomplete.");const i=r+1;t=o.substring(0,i),n=o.length>i?o.substring(i):null}const o=$t.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}}!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"}(xt||(xt={}));class Ft{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 mt(this,e)}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(Rt||(Rt={}));class Ht{static create(e,t,n,o,r,i){return new Ht(e,t,n,o,r,i)}constructor(e,t,n,o,r,i){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(ct.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},dt.isRequired(e,"connection"),dt.isRequired(t,"logger"),dt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=r?r:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new Ot,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=Rt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:xt.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==Rt.Disconnected&&this._connectionState!==Rt.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!==Rt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Rt.Connecting,this._logger.log(ct.Debug,"Starting HubConnection.");try{await this._startInternal(),ut.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Rt.Connected,this._connectionStarted=!0,this._logger.log(ct.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=Rt.Disconnected,this._logger.log(ct.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise(((e,t)=>{this._handshakeResolver=e,this._handshakeRejecter=t}));await this.connection.start(this._protocol.transferFormat);try{const t={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(ct.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(ct.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(ct.Debug,`Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(e),e}}async stop(){const e=this._startPromise;this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){return this._connectionState===Rt.Disconnected?(this._logger.log(ct.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===Rt.Disconnecting?(this._logger.log(ct.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=Rt.Disconnecting,this._logger.log(ct.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(ct.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new nt("The connection was stopped before the hub handshake could complete."),this.connection.stop(e)))}stream(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._createStreamInvocation(e,t,o);let i;const s=new Ft;return s.cancelCallback=()=>{const e=this._createCancelInvocation(r.invocationId);return delete this._callbacks[r.invocationId],i.then((()=>this._sendWithProtocol(e)))},this._callbacks[r.invocationId]=(e,t)=>{t?s.error(t):e&&(e.type===xt.Completion?e.error?s.error(new Error(e.error)):s.complete():s.next(e.item))},i=this._sendWithProtocol(r).catch((e=>{s.error(e),delete this._callbacks[r.invocationId]})),this._launchStreams(n,i),s}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._sendWithProtocol(this._createInvocation(e,t,!0,o));return this._launchStreams(n,r),r}invoke(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._createInvocation(e,t,!1,o);return new Promise(((e,t)=>{this._callbacks[r.invocationId]=(n,o)=>{o?t(o):n&&(n.type===xt.Completion?n.error?t(new Error(n.error)):e(n.result):t(new Error(`Unexpected message type: ${n.type}`)))};const o=this._sendWithProtocol(r).catch((e=>{t(e),delete this._callbacks[r.invocationId]}));this._launchStreams(n,o)}))}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 o=n.indexOf(t);-1!==o&&(n.splice(o,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 xt.Invocation:this._invokeClientMethod(e);break;case xt.StreamItem:case xt.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===xt.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(ct.Error,`Stream callback threw error: ${Et(e)}`)}}break}case xt.Ping:break;case xt.Close:{this._logger.log(ct.Information,"Close message received from server.");const t=e.error?new Error("Server returned an error on close: "+e.error):void 0;!0===e.allowReconnect?this.connection.stop(t):this._stopPromise=this._stopInternal(t);break}default:this._logger.log(ct.Warning,`Invalid message type: ${e.type}.`)}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(e){const t="Error parsing handshake response: "+e;this._logger.log(ct.Error,t);const n=new Error(t);throw this._handshakeRejecter(n),n}if(t.error){const e="Server returned handshake error: "+t.error;this._logger.log(ct.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(ct.Debug,"Server handshake complete."),this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=(new Date).getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!(this.connection.features&&this.connection.features.inherentKeepAlive||(this._timeoutHandle=setTimeout((()=>this.serverTimeout()),this.serverTimeoutInMilliseconds),void 0!==this._pingServerHandle))){let e=this._nextKeepAlive-(new Date).getTime();e<0&&(e=0),this._pingServerHandle=setTimeout((async()=>{if(this._connectionState===Rt.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n)return this._logger.log(ct.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(ct.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null))));const o=n.slice(),r=!!e.invocationId;let i,s,a;for(const n of o)try{const o=i;i=await n.apply(this,e.arguments),r&&i&&o&&(this._logger.log(ct.Error,`Multiple results provided for '${t}'. Sending error to server.`),a=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),s=void 0}catch(e){s=e,this._logger.log(ct.Error,`A callback for the method '${t}' threw error '${e}'.`)}a?await this._sendWithProtocol(a):r?(s?a=this._createCompletionMessage(e.invocationId,`${s}`,null):void 0!==i?a=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(ct.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),a=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(a)):i&&this._logger.log(ct.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(ct.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new nt("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===Rt.Disconnecting?this._completeClose(e):this._connectionState===Rt.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===Rt.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=Rt.Disconnected,this._connectionStarted=!1,ut.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(ct.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}async _reconnect(e){const t=Date.now();let n=0,o=void 0!==e?e:new Error("Attempting to reconnect due to a unknown error."),r=this._getNextRetryDelay(n++,0,o);if(null===r)return this._logger.log(ct.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=Rt.Reconnecting,e?this._logger.log(ct.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(ct.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(ct.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==Rt.Reconnecting)return void this._logger.log(ct.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this._logger.log(ct.Information,`Reconnect attempt number ${n} will start in ${r} ms.`),await new Promise((e=>{this._reconnectDelayHandle=setTimeout(e,r)})),this._reconnectDelayHandle=void 0,this._connectionState!==Rt.Reconnecting)return void this._logger.log(ct.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=Rt.Connected,this._logger.log(ct.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(ct.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(ct.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==Rt.Reconnecting)return this._logger.log(ct.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===Rt.Disconnecting&&this._completeClose());o=e instanceof Error?e:new Error(e.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(ct.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(n){return this._logger.log(ct.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach((n=>{const o=t[n];try{o(null,e)}catch(t){this._logger.log(ct.Error,`Stream 'error' callback called with '${e}' threw error: ${Et(t)}`)}}))}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,o){if(n)return 0!==o.length?{arguments:t,streamIds:o,target:e,type:xt.Invocation}:{arguments:t,target:e,type:xt.Invocation};{const n=this._invocationId;return this._invocationId++,0!==o.length?{arguments:t,invocationId:n.toString(),streamIds:o,target:e,type:xt.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:xt.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 o;o=e instanceof Error?e.message:e&&e.toString?e.toString():"Unknown error",t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n,o))))},next:e=>{t=t.then((()=>this._sendWithProtocol(this._createStreamItemMessage(n,e))))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let o=0;o=55296&&r<=56319&&o65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h)}else i.push(a);i.length>=4096&&(s+=String.fromCharCode.apply(String,i),i.length=0)}return i.length>0&&(s+=String.fromCharCode.apply(String,i)),s}var on,rn=Gt?new TextDecoder:null,sn=Gt?"undefined"!=typeof process&&"force"!==(null===(Kt=null===process||void 0===process?void 0:process.env)||void 0===Kt?void 0:Kt.TEXT_DECODER)?200:0:Vt,an=function(e,t){this.type=e,this.data=t},cn=(on=function(e,t){return on=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])},on(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}on(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),ln=function(e){function t(n){var o=e.call(this,n)||this,r=Object.create(t.prototype);return Object.setPrototypeOf(o,r),Object.defineProperty(o,"name",{configurable:!0,enumerable:!1,value:t.name}),o}return cn(t,e),t}(Error),hn={type:-1,encode:function(e){var t,n,o,r;return e instanceof Date?function(e){var t,n=e.sec,o=e.nsec;if(n>=0&&o>=0&&n<=17179869183){if(0===o&&n<=4294967295){var r=new Uint8Array(4);return(t=new DataView(r.buffer)).setUint32(0,n),r}var i=n/4294967296,s=4294967295&n;return r=new Uint8Array(8),(t=new DataView(r.buffer)).setUint32(0,o<<2|3&i),t.setUint32(4,s),r}return r=new Uint8Array(12),(t=new DataView(r.buffer)).setUint32(0,o),Xt(t,4,n),r}((o=1e6*((t=e.getTime())-1e3*(n=Math.floor(t/1e3))),{sec:n+(r=Math.floor(o/1e9)),nsec:o-1e9*r})):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:Yt(t,4),nsec:t.getUint32(0)};default:throw new ln("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},dn=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(hn)}return e.prototype.register=function(e){var t=e.type,n=e.encode,o=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=o;else{var r=1+t;this.builtInEncoders[r]=n,this.builtInDecoders[r]=o}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>en){var t=Qt(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),tn(e,this.bytes,this.pos),this.pos+=t}else t=Qt(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var o=e.length,r=n,i=0;i>6&31|192;else{if(s>=55296&&s<=56319&&i>12&15|224,t[r++]=s>>6&63|128):(t[r++]=s>>18&7|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128)}t[r++]=63&s|128}else t[r++]=s}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=un(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var o=0,r=e;o0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var o=0,r=this.caches[n-1];o=this.maxLengthPerKey?n[Math.random()*n.length|0]=o:n.push(o)},e.prototype.decode=function(e,t,n){var o=this.find(e,t,n);if(null!=o)return this.hit++,o;this.miss++;var r=nn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,r),r},e}(),bn=function(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return bn(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,o,r,i,s,a;return i=this,void 0,a=function(){var i,s,a,c,l,h,d,u;return bn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=_n(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),i=!0}catch(e){if(!(e instanceof In))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(),o={error:c},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(r=t.return)?[4,r.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(o)throw o.error;return[7];case 11:return[7];case 12:if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,s]}throw h=(l=this).headByte,d=l.pos,u=l.totalPos,new RangeError("Insufficient data in parsing ".concat(fn(h)," at ").concat(u," (").concat(d," in the current buffer)"))}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{r(a.next(e))}catch(e){t(e)}}function o(e){try{r(a.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof s?r:new s((function(e){e(r)}))).then(n,o)}r((a=a.apply(i,[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return function(n,o,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,s=function(){var n,o,r,i,s,a,c,l,h;return bn(this,(function(d){switch(d.label){case 0:n=t,o=-1,d.label=1;case 1:d.trys.push([1,13,14,19]),r=_n(e),d.label=2;case 2:return[4,En(r.next())];case 3:if((i=d.sent()).done)return[3,12];if(s=i.value,t&&0===o)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(o=this.readArraySize(),n=!1,this.complete()),d.label=4;case 4:d.trys.push([4,9,,10]),d.label=5;case 5:return[4,En(this.doDecodeSync())];case 6:return[4,d.sent()];case 7:return d.sent(),0==--o?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=d.sent())instanceof In))throw a;return[3,10];case 10:this.totalPos+=this.pos,d.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=d.sent(),l={error:c},[3,19];case 14:return d.trys.push([14,,17,18]),i&&!i.done&&(h=r.return)?[4,En(h.call(r))]:[3,16];case 15:d.sent(),d.label=16;case 16:return[3,18];case 17:if(l)throw l.error;return[7];case 18:return[7];case 19:return[2]}}))}.apply(n,o||[]),a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(e){s[e]&&(i[e]=function(t){return new Promise((function(n,o){a.push([e,t,n,o])>1||l(e,t)}))})}function l(e,t){try{(n=s[e](t)).value instanceof En?Promise.resolve(n.value.v).then(h,d):u(a[0][2],n)}catch(e){u(a[0][3],e)}var n}function h(e){l("next",e)}function d(e){l("throw",e)}function u(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}(this,arguments)},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!=(o=e-128)){this.pushMapState(o),this.complete();continue e}t={}}else if(e<160){if(0!=(o=e-144)){this.pushArrayState(o),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!==(o=this.readU16())){this.pushArrayState(o),this.complete();continue e}t=[]}else if(221===e){if(0!==(o=this.readU32())){this.pushArrayState(o),this.complete();continue e}t=[]}else if(222===e){if(0!==(o=this.readU16())){this.pushMapState(o),this.complete();continue e}t={}}else if(223===e){if(0!==(o=this.readU32())){this.pushMapState(o),this.complete();continue e}t={}}else if(196===e){var o=this.lookU8();t=this.decodeBinary(o,1)}else if(197===e)o=this.lookU16(),t=this.decodeBinary(o,2);else if(198===e)o=this.lookU32(),t=this.decodeBinary(o,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)o=this.lookU8(),t=this.decodeExtension(o,1);else if(200===e)o=this.lookU16(),t=this.decodeExtension(o,2);else{if(201!==e)throw new ln("Unrecognized type byte: ".concat(fn(e)));o=this.lookU32(),t=this.decodeExtension(o,4)}this.complete();for(var r=this.stack;r.length>0;){var i=r[r.length-1];if(0===i.type){if(i.array[i.position]=t,i.position++,i.position!==i.size)continue e;r.pop(),t=i.array}else{if(1===i.type){if("string"!=(s=typeof t)&&"number"!==s)throw new ln("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new ln("The key __proto__ is not allowed");i.key=t,i.type=2;continue e}if(i.map[i.key]=t,i.readCount++,i.readCount!==i.size){i.key=null,i.type=1;continue e}r.pop(),t=i.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new ln("Unrecognized array type byte: ".concat(fn(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new ln("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new ln("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new ln("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthsn?function(e,t,n){var o=e.subarray(t,t+n);return rn.decode(o)}(this.bytes,r,e):nn(this.bytes,r,e),this.pos+=t+e,o},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 ln("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw kn;var n=this.pos+t,o=this.bytes.subarray(n,n+e);return this.pos+=t+e,o},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new ln("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),o=this.decodeBinary(e,t+1);return this.extensionCodec.decode(o,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=Yt(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}();!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"}(gn||(gn={})),function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(mn||(mn={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(yn||(yn={}));class xn{constructor(){}log(e,t){}}xn.instance=new xn,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"}(vn||(vn={}));class Rn{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 o=new Uint8Array(n.length+t);return o.set(n,0),o.set(e,n.length),o.buffer}static parse(e){const t=[],n=new Uint8Array(e),o=[0,7,14,21,28];for(let r=0;r7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=r+s+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(r+s,r+s+a):n.subarray(r+s,r+s+a)),r=r+s+a}return t}}const Pn=new Uint8Array([145,gn.Ping]);class Nn{constructor(e){this.name="messagepack",this.version=1,this.transferFormat=yn.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new pn(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new Dn(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=xn.instance);const o=Rn.parse(e),r=[];for(const e of o){const n=this._parseMessage(e,t);n&&r.push(n)}return r}writeMessage(e){switch(e.type){case gn.Invocation:return this._writeInvocation(e);case gn.StreamInvocation:return this._writeStreamInvocation(e);case gn.StreamItem:return this._writeStreamItem(e);case gn.Completion:return this._writeCompletion(e);case gn.Ping:return Rn.write(Pn);case gn.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 o=n[0];switch(o){case gn.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case gn.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case gn.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case gn.Ping:return this._createPingMessage(n);case gn.Close:return this._createCloseMessage(n);default:return t.log(vn.Information,"Unknown message type '"+o+"' 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:gn.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:gn.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:gn.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:gn.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:gn.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 o,r;switch(n){case this._errorResult:o=t[4];break;case this._nonVoidResult:r=t[4]}return{error:o,headers:e,invocationId:t[2],result:r,type:gn.Completion}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([gn.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([gn.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),Rn.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([gn.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([gn.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),Rn.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([gn.StreamItem,e.headers||{},e.invocationId,e.item]);return Rn.write(t.slice())}_writeCompletion(e){const t=e.error?this._errorResult:void 0!==e.result?this._nonVoidResult:this._voidResult;let n;switch(t){case this._errorResult:n=this._encoder.encode([gn.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([gn.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([gn.Completion,e.headers||{},e.invocationId,t,e.result])}return Rn.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([gn.CancelInvocation,e.headers||{},e.invocationId]);return Rn.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}let An=!1;function Un(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),An||(An=!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 Ln="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Mn=Ln?Ln.decode.bind(Ln):function(e){let t=0;const n=e.length,o=[],r=[];for(;t65535&&(r-=65536,o.push(r>>>10&1023|55296),r=56320|1023&r),o.push(r)}o.length>1024&&(r.push(String.fromCharCode.apply(null,o)),o.length=0)}return r.push(String.fromCharCode.apply(null,o)),r.join("")},Bn=Math.pow(2,32),$n=Math.pow(2,21)-1;function On(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Fn(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function Hn(e,t){const n=Fn(e,t+4);if(n>$n)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Bn+Fn(e,t)}class jn{constructor(e){this.batchData=e;const t=new qn(e);this.arrayRangeReader=new Kn(e),this.arrayBuilderSegmentReader=new Vn(e),this.diffReader=new Wn(e),this.editReader=new zn(e,t),this.frameReader=new Jn(e,t)}updatedComponents(){return On(this.batchData,this.batchData.length-20)}referenceFrames(){return On(this.batchData,this.batchData.length-16)}disposedComponentIds(){return On(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return On(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return On(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return On(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return Hn(this.batchData,n)}}class Wn{constructor(e){this.batchDataUint8=e}componentId(e){return On(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class zn{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return On(this.batchDataUint8,e)}siblingIndex(e){return On(this.batchDataUint8,e+4)}newTreeIndex(e){return On(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return On(this.batchDataUint8,e+8)}removedAttributeName(e){const t=On(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class Jn{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return On(this.batchDataUint8,e)}subtreeLength(e){return On(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=On(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return On(this.batchDataUint8,e+8)}elementName(e){const t=On(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=On(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=On(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=On(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=On(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return Hn(this.batchDataUint8,e+12)}}class qn{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=On(e,e.length-4)}readString(e){if(-1===e)return null;{const n=On(this.batchDataUint8,this.stringTableStartIndex+4*e),o=function(e,t){let n=0,o=0;for(let r=0;r<4;r++){const i=e[t+r];if(n|=(127&i)<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=de[e];if(!n)throw new Error(`There is no browser renderer with ID ${e}.`);const o=t.arrayRangeReader,r=t.updatedComponents(),i=o.values(r),s=o.count(r),a=t.referenceFrames(),c=o.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 Zn{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!==Rt.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!==Rt.Connected)return!1;const t=await e.invoke("StartCircuit",ke.getBaseURI(),ke.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 $(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,o=$(n,!0),r=J(o);return Array.from(n.childNodes).forEach((e=>r.push(e))),e[M]=o,t&&(e[B]=t,$(t)),$(e)}(this.components[n].start,this.components[n].end);throw new Error(`Invalid sequence number or identifier '${e}'.`)}}const eo={configureSignalR:e=>{},logLevel:Xn.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class to{constructor(e,t,n,o){this.maxRetries=t,this.document=n,this.logger=o,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 r=this.document.createElement("a");r.addEventListener("click",(()=>location.reload())),r.textContent="reload",this.reloadParagraph=this.document.createElement("p"),this.reloadParagraph.textContent="Alternatively, ",this.reloadParagraph.appendChild(r),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 Ke.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 no{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const o=this.document.getElementById(no.MaxRetriesId);o&&(o.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(no.ShowClassName)}update(e){const t=this.document.getElementById(no.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(no.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(no.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(no.RejectedClassName)}removeClasses(){this.dialog.classList.remove(no.ShowClassName,no.HideClassName,no.FailedClassName,no.RejectedClassName)}}no.ShowClassName="components-reconnect-show",no.HideClassName="components-reconnect-hide",no.FailedClassName="components-reconnect-failed",no.RejectedClassName="components-reconnect-rejected",no.MaxRetriesId="components-reconnect-max-retries",no.CurrentAttemptId="components-reconnect-current-attempt";class oo{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||Ke.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new no(t,e.maxRetries,document):new to(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new ro(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class ro{constructor(e,t,n,o){this.logger=t,this.reconnectCallback=n,this.isDisposed=!1,this.reconnectDisplay=o,this.reconnectDisplay.show(),this.attemptPeriodicReconnection(e)}dispose(){this.isDisposed=!0,this.reconnectDisplay.hide()}async attemptPeriodicReconnection(e){for(let t=0;tro.MaximumFirstRetryInterval?ro.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)))}}ro.MaximumFirstRetryInterval=3e3;const io=/^\s*Blazor-Component-State:(?[a-zA-Z0-9+/=]+)$/;function so(e){var t;if(e.nodeType===Node.COMMENT_NODE){const n=e.textContent||"",o=io.exec(n),r=o&&o.groups&&o.groups.state;return r&&(null===(t=e.parentNode)||void 0===t||t.removeChild(e)),r}if(!e.hasChildNodes())return;const n=e.childNodes;for(let e=0;e.*)$/);function lo(e,t){const n=e.currentElement;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const o=co.exec(n.textContent),r=o&&o.groups&&o.groups.descriptor;if(!r)return;try{const o=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(r);switch(t){case"webassembly":return function(e,t,n){const{type:o,assembly:r,typeName:i,parameterDefinitions:s,parameterValues:a,prerenderId:c}=e,l=c?ho(c,n):void 0;if(c&&!l)throw new Error(`Could not find an end component comment for '${t}'.`);if("webassembly"===o){if(!r)throw new Error("assembly must be defined when using a descriptor.");if(!i)throw new Error("typeName must be defined when using a descriptor.");return{type:o,assembly:r,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:a&&atob(a),start:t,prerenderId:c,end:l}}}(o,n,e);case"server":return function(e,t,n){const{type:o,descriptor:r,sequence:i,prerenderId:s}=e,a=s?ho(s,n):void 0;if(s&&!a)throw new Error(`Could not find an end component comment for '${t}'.`);if("server"===o){if(!r)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===i)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(i))throw new Error(`Error parsing the sequence '${i}' for component '${JSON.stringify(e)}'`);return{type:o,sequence:i,descriptor:r,start:t,prerenderId:s,end:a}}}(o,n,e)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}function ho(e,t){for(;t.next()&&t.currentElement;){const n=t.currentElement;if(n.nodeType!==Node.COMMENT_NODE)continue;if(!n.textContent)continue;const o=co.exec(n.textContent),r=o&&o[1];if(r)return uo(r,e),n}}function uo(e,t){const n=JSON.parse(e);if(1!==Object.keys(n).length)throw new Error(`Invalid end of component comment: '${e}'`);const o=n.prerenderId;if(!o)throw new Error(`End of component comment must have a value for the prerendered property: '${e}'`);if(o!==t)throw new Error(`End of component comment prerendered property must match the start comment prerender id: '${t}', '${o}'`)}class po{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndexasync function(e,n){const o=function(e){const t=document.baseURI;return t.endsWith("/")?`${t}${e}`:`${t}/${e}`}(n),r=await import(o);if(void 0===r)return;const{beforeStart:i,afterStarted:s}=r;return s&&e.afterStartedCallbacks.push(s),i?i(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await C,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let yo,vo,wo,bo=!1;async function _o(t,n){const o=function(e){const t={...eo,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...eo.reconnectionOptions,...e.reconnectionOptions}),t}(t),r=await async function(e){const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),o=new mo;return await o.importInitializersAsync(n,[e]),o}(o),i=new Qn(o.logLevel);Ke.reconnect=async e=>{if(bo)return!1;const t=e||await Eo(o,i,vo);return await vo.reconnect(t)?(o.reconnectionHandler.onConnectionUp(),!0):(i.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)},Ke.defaultReconnectionHandler=new oo(i),o.reconnectionHandler=o.reconnectionHandler||Ke.defaultReconnectionHandler,i.log(Xn.Information,"Starting up Blazor server-side application.");const s=so(document);vo=new Zn(n||[],s||""),Ke._internal.navigationManager.listenForNavigationEvents(((e,t,n)=>yo.send("OnLocationChanged",e,t,n)),((e,t,n,o)=>yo.send("OnLocationChanging",e,t,n,o))),Ke._internal.forceCloseConnection=()=>yo.stop(),Ke._internal.sendJSDataStream=(e,t,n)=>function(e,t,n,o){setTimeout((async()=>{let r=5,i=(new Date).valueOf();try{const s=t instanceof Blob?t.size:t.byteLength;let a=0,c=0;for(;a1)await e.send("ReceiveJSDataChunk",n,c,h,null);else{if(!await e.invoke("ReceiveJSDataChunk",n,c,h,null))break;const t=(new Date).valueOf(),o=t-i;i=t,r=Math.max(1,Math.round(500/Math.max(1,o)))}a+=l,c++}}catch(t){await e.send("ReceiveJSDataChunk",n,-1,null,t.toString())}}),0)}(yo,e,t,n),wo=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,o,r)=>{yo.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,o||0,r)},endInvokeJSFromDotNet:(e,t,n)=>{yo.send("EndInvokeJSFromDotNet",e,t,n)},sendByteArray:(e,t)=>{yo.send("ReceiveByteArray",e,t)}});const a=await Eo(o,i,vo);if(!await vo.startCircuit(a))return void i.log(Xn.Error,"Failed to start the circuit.");let c=!1;const l=()=>{if(!c){const e=new FormData,t=vo.circuitId;e.append("circuitId",t),c=navigator.sendBeacon("_blazor/disconnect",e)}};Ke.disconnect=l,window.addEventListener("unload",l,{capture:!1,once:!0}),i.log(Xn.Information,"Blazor server-side application started."),r.invokeAfterStartedCallbacks(Ke)}async function Eo(e,t,n){var o,r;const i=new Nn;i.name="blazorpack";const s=(new zt).withUrl("_blazor").withHubProtocol(i);e.configureSignalR(s);const a=s.build();a.on("JS.AttachComponent",((e,t)=>function(e,t,n,o){let r=de[0];r||(r=new ce(0),de[0]=r),r.attachRootComponentToLogicalElement(n,t,!1)}(0,n.resolveElement(t),e))),a.on("JS.BeginInvokeJS",wo.beginInvokeJSFromDotNet.bind(wo)),a.on("JS.EndInvokeDotNet",wo.endInvokeDotNetFromJS.bind(wo)),a.on("JS.ReceiveByteArray",wo.receiveByteArray.bind(wo)),a.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start(t){a.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});wo.supplyDotNetStream(e,t)}));const c=Yn.getOrCreate(t);a.on("JS.RenderBatch",((e,n)=>{t.log(Xn.Debug,`Received render batch with id ${e} and ${n.byteLength} bytes.`),c.processBatch(e,n,a)})),a.on("JS.EndLocationChanging",Ke._internal.navigationManager.endLocationChanging),a.onclose((t=>!bo&&e.reconnectionHandler.onConnectionDown(e.reconnectionOptions,t))),a.on("JS.Error",(e=>{bo=!0,So(a,e,t),Un()}));try{await a.start(),yo=a}catch(e){if(So(a,e,t),"FailedToNegotiateWithServerError"===e.errorType)throw e;Un(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===Tt.WebSockets))?t.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===Tt.WebSockets))?t.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===Tt.LongPolling))&&t.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===(r=null===(o=a.connection)||void 0===o?void 0:o.features)||void 0===r?void 0:r.inherentKeepAlive)&&t.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."),a}function So(e,t,n){n.log(Xn.Error,t),e&&e.stop()}let Co=!1;function Io(e){if(Co)throw new Error("Blazor has already started.");return Co=!0,_o(e,function(e,t){return function(e){const t=ao(e,"server"),n=[];for(let e=0;ee.sequence-t.sequence))}(e)}(document))}Ke.start=Io,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&Io()})(); \ No newline at end of file diff --git a/src/Components/Web.JS/dist/Release/blazor.web.js b/src/Components/Web.JS/dist/Release/blazor.web.js index 43989d1f6034..5d0421325ee3 100644 --- a/src/Components/Web.JS/dist/Release/blazor.web.js +++ b/src/Components/Web.JS/dist/Release/blazor.web.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){const t=[],n="__jsObjectId",r="__dotNetObject",o="__byte[]",i="__dotNetStream",s="__jsStreamReferenceLength";let a,c;class l{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 h={0:new l(window)};h[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let d,u=1;function p(e){t.push(e)}function f(e){if(e&&"object"==typeof e){h[u]=new l(e);const t={[n]: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 r={[s]:t};try{const t=f(e);r[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return r}function m(e,n){c=e;const r=n?JSON.parse(n,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null;return c=void 0,r}function y(){if(void 0===a)throw new Error("No call dispatcher has been set.");if(null===a)throw new Error("There are multiple .NET runtimes present, so a default dispatcher could not be resolved. Use DotNetObject to invoke .NET instance methods.");return a}e.attachDispatcher=function(e){const t=new w(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=p,e.invokeMethod=function(e,t,...n){return y().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return y().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=f,e.createJSStreamReference=g,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&_(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(d=e.JSCallResultType||(e.JSCallResultType={}));class w{constructor(e){this._dotNetCallDispatcher=e,this._byteArraysToBeRevived=new Map,this._pendingDotNetToJSStreams=new Map,this._pendingAsyncCalls={},this._nextAsyncCallId=1}getDotNetCallDispatcher(){return this._dotNetCallDispatcher}invokeJSFromDotNet(e,t,n,r){const o=m(this,t),i=I(b(e,r)(...o||[]),n);return null==i?null:T(this,i)}beginInvokeJSFromDotNet(e,t,n,r,o){const i=new Promise((e=>{const r=m(this,n);e(b(t,o)(...r||[]))}));e&&i.then((t=>T(this,[e,!0,I(t,r)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,v(t)]))))}endInvokeDotNetFromJS(e,t,n){const r=t?m(this,n):new Error(n);this.completePendingCall(parseInt(e,10),t,r)}invokeDotNetStaticMethod(e,t,...n){return this.invokeDotNetMethod(e,t,null,n)}invokeDotNetStaticMethodAsync(e,t,...n){return this.invokeDotNetMethodAsync(e,t,null,n)}invokeDotNetMethod(e,t,n,r){if(this._dotNetCallDispatcher.invokeDotNetFromJS){const o=T(this,r),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,o);return i?m(this,i):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeDotNetMethodAsync instead.")}invokeDotNetMethodAsync(e,t,n,r){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const o=this._nextAsyncCallId++,i=new Promise(((e,t)=>{this._pendingAsyncCalls[o]={resolve:e,reject:t}}));try{const i=T(this,r);this._dotNetCallDispatcher.beginInvokeDotNetFromJS(o,e,t,n,i)}catch(e){this.completePendingCall(o,!1,e)}return i}receiveByteArray(e,t){this._byteArraysToBeRevived.set(e,t)}processByteArray(e){const t=this._byteArraysToBeRevived.get(e);return t?(this._byteArraysToBeRevived.delete(e),t):null}supplyDotNetStream(e,t){if(this._pendingDotNetToJSStreams.has(e)){const n=this._pendingDotNetToJSStreams.get(e);this._pendingDotNetToJSStreams.delete(e),n.resolve(t)}else{const n=new C;n.resolve(t),this._pendingDotNetToJSStreams.set(e,n)}}getDotNetStreamPromise(e){let t;if(this._pendingDotNetToJSStreams.has(e))t=this._pendingDotNetToJSStreams.get(e).streamPromise,this._pendingDotNetToJSStreams.delete(e);else{const n=new C;this._pendingDotNetToJSStreams.set(e,n),t=n.streamPromise}return t}completePendingCall(e,t,n){if(!this._pendingAsyncCalls.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const r=this._pendingAsyncCalls[e];delete this._pendingAsyncCalls[e],t?r.resolve(n):r.reject(n)}}function v(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function b(e,t){const n=h[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function _(e){delete h[e]}e.findJSFunction=b,e.disposeJSObjectReferenceById=_;class E{constructor(e,t){this._id=e,this._callDispatcher=t}invokeMethod(e,...t){return this._callDispatcher.invokeDotNetMethod(null,e,this._id,t)}invokeMethodAsync(e,...t){return this._callDispatcher.invokeDotNetMethodAsync(null,e,this._id,t)}dispose(){this._callDispatcher.invokeDotNetMethodAsync(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{[r]:this._id}}}e.DotNetObject=E,p((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(r))return new E(t[r],c);if(t.hasOwnProperty(n)){const e=t[n],r=h[e];if(r)return r.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(o)){const e=t[o],n=c.processByteArray(e);if(void 0===n)throw new Error(`Byte array index '${e}' does not exist.`);return n}if(t.hasOwnProperty(i)){const e=t[i],n=c.getDotNetStreamPromise(e);return new S(n)}}return t}));class S{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class C{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function I(e,t){switch(t){case d.Default:return e;case d.JSObjectReference:return f(e);case d.JSStreamReference:return g(e);case d.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let k=0;function T(e,t){k=0,c=e;const n=JSON.stringify(t,D);return c=void 0,n}function D(e,t){if(t instanceof E)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(k,t);const e={[o]:k};return k++,e}return t}}(e||(e={})),function(e){e[e.prependFrame=1]="prependFrame",e[e.removeFrame=2]="removeFrame",e[e.setAttribute=3]="setAttribute",e[e.removeAttribute=4]="removeAttribute",e[e.updateText=5]="updateText",e[e.stepIn=6]="stepIn",e[e.stepOut=7]="stepOut",e[e.updateMarkup=8]="updateMarkup",e[e.permutationListEntry=9]="permutationListEntry",e[e.permutationListEnd=10]="permutationListEnd"}(t||(t={})),function(e){e[e.element=1]="element",e[e.text=2]="text",e[e.attribute=3]="attribute",e[e.component=4]="component",e[e.region=5]="region",e[e.elementReferenceCapture=6]="elementReferenceCapture",e[e.markup=8]="markup"}(n||(n={}));class o{constructor(e,t){this.componentId=e,this.fieldValue=t}static fromEvent(e,t){const n=t.target;if(n instanceof Element){const t=function(e){return e instanceof HTMLInputElement?e.type&&"checkbox"===e.type.toLowerCase()?{value:e.checked}:{value:e.value}:e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement?{value:e.value}:null}(n);if(t)return new o(e,t.value)}return null}}const i=new Map,s=new Map,a=[];function c(e){return i.get(e)}function l(e){const t=i.get(e);return(null==t?void 0:t.browserEventName)||e}function h(e,t){e.forEach((e=>i.set(e,t)))}function d(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}{const e=function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t);return{value:e?!!t.checked:t.value}}}}),h(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),h(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...u(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),h(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),h(["keydown","keyup","keypress"],{createEventArgs:e=>{return{key:(t=e).key,code:t.code,location:t.location,repeat:t.repeat,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),h(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>u(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: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}}),h(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...u(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{...u(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 E().invokeMethodAsync("AddRootComponent",t,r),i=new _(o,m[t]);return await i.setParameters(n),i}};function v(e){const t=f.get(e);if(t)return f.delete(e),t}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(!g)throw new Error("Dynamic root components have not been enabled in this application.");return g}const S=[];let C;const I=new Promise((e=>{C=e}));function k(e,t,n){return D(e,t.eventHandlerId,(()=>T(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function T(e){const t=S[e];if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let D=(e,t,n)=>n();const x=M(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),N={submit:!0},A=M(["click","dblclick","mousedown","mousemove","mouseup"]);class R{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++R.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new P(this.onGlobalEvent.bind(this))}setListener(e,t,n,r){const o=this.getEventHandlerInfosForElement(e,!0),i=o.getHandler(t);if(i)this.eventInfoStore.update(i.eventHandlerId,n);else{const i={element:e,eventName:t,eventHandlerId:n,renderingComponentId:r};this.eventInfoStore.add(i),o.setHandler(t,i)}}getHandler(e){return this.eventInfoStore.get(e)}removeListener(e){const t=this.eventInfoStore.remove(e);if(t){const e=t.element,n=this.getEventHandlerInfosForElement(e,!1);n&&n.removeHandler(t.eventName)}}notifyAfterClick(e){this.afterClickCallbacks.push(e),this.eventInfoStore.addGlobalListener("click")}setStopPropagation(e,t,n){this.getEventHandlerInfosForElement(e,!0).stopPropagation(t,n)}setPreventDefault(e,t,n){this.getEventHandlerInfosForElement(e,!0).preventDefault(t,n)}onGlobalEvent(e){if(!(e.target instanceof Element))return;this.dispatchGlobalEventToAllElements(e.type,e);const t=(n=e.type,s.get(n));var n;t&&t.forEach((t=>this.dispatchGlobalEventToAllElements(t,e))),"click"===e.type&&this.afterClickCallbacks.forEach((t=>t(e)))}dispatchGlobalEventToAllElements(e,t){const n=t.composedPath();let r=n.shift(),i=null,s=!1;const a=Object.prototype.hasOwnProperty.call(x,e);let l=!1;for(;r;){const u=r,p=this.getEventHandlerInfosForElement(u,!1);if(p){const n=p.getHandler(e);if(n&&(h=u,d=t.type,!((h instanceof HTMLButtonElement||h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(A,d)&&h.disabled))){if(!s){const n=c(e);i=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(N,t.type)&&t.preventDefault(),k(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},i)}p.stopPropagation(e)&&(l=!0),p.preventDefault(e)&&t.preventDefault()}r=a||l?void 0:n.shift()}var h,d}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new U:null}}R.nextEventDelegatorId=0;class P{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},a.push(this.handleEventNameAliasAdded.bind(this))}add(e){if(this.infosByEventHandlerId[e.eventHandlerId])throw new Error(`Event ${e.eventHandlerId} is already tracked`);this.infosByEventHandlerId[e.eventHandlerId]=e,this.addGlobalListener(e.eventName)}get(e){return this.infosByEventHandlerId[e]}addGlobalListener(e){if(e=l(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(x,e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(Object.prototype.hasOwnProperty.call(this.infosByEventHandlerId,t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=l(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(Object.prototype.hasOwnProperty.call(this.countByEventName,e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class U{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return Object.prototype.hasOwnProperty.call(this.handlers,e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function M(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const L=Z("_blazorLogicalChildren"),B=Z("_blazorLogicalParent"),O=Z("_blazorLogicalEnd");function F(e,t){if(!e.parentNode)throw new Error(`Comment not connected to the DOM ${e.textContent}`);const n=e.parentNode,r=$(n,!0),o=K(r);return Array.from(n.childNodes).forEach((e=>o.push(e))),e[B]=r,t&&(e[O]=t,$(t)),$(e)}function $(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 j(n,e,t),n}function j(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(z(r))throw new Error("Not implemented: moving existing logical children");const o=K(t);if(n0;)W(n,0)}const r=n;r.parentNode.removeChild(r)}function z(e){return e[B]||null}function J(e,t){return K(e)[t]}function q(e){const t=X(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=Q(e.moveRangeStart)})),t.forEach((t=>{const r=document.createComment("marker");t.moveToBeforeMarker=r;const o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):Y(r,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd;let i=r;for(;i;){const e=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=e}n.removeChild(t)})),t.forEach((e=>{n[e.toSiblingIndex]=e.moveRangeStart}))}function X(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 G(e){const t=K(z(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=G(t);n?n.parentNode.insertBefore(e,n):Y(e,z(t))}}}function Q(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=G(e);if(t)return t.previousSibling;{const t=z(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:Q(t)}}function Z(e){return"function"==typeof Symbol?Symbol():e}function ee(e){return`_bl_${e}`}const te="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,te)&&"string"==typeof t[te]?function(e){const t=`[${ee(e)}]`;return document.querySelector(t)}(t[te]):t));const ne="_blazorDeferredValue";function re(e,t,n){switch(t){case"value":return function(e,t){switch(t&&"INPUT"===e.tagName&&(t=function(e,t){switch(t.getAttribute("type")){case"time":return 8!==e.length||!e.endsWith("00")&&t.hasAttribute("step")?e:e.substring(0,5);case"datetime-local":return 19!==e.length||!e.endsWith("00")&&t.hasAttribute("step")?e:e.substring(0,16);default:return e}}(t,e)),e.tagName){case"INPUT":case"SELECT":case"TEXTAREA":return t&&e instanceof HTMLSelectElement&&se(e)&&(t=JSON.parse(t)),ce(e,t),e[ne]=t,!0;case"OPTION":return t||""===t?e.setAttribute("value",t):e.removeAttribute("value"),le(e),!0;default:return!1}}(e,n);case"checked":return function(e,t){return"INPUT"===e.tagName&&(e.checked=null!==t,!0)}(e,n);default:return!1}}function oe(e){switch(e.name){case"value":{const t=e.ownerElement;switch(t.tagName){case"INPUT":case"SELECT":case"TEXTAREA":return t.value}break}case"checked":{const t=e.ownerElement;if("INPUT"===t.tagName){const e=t;return e.checked?e.value:""}break}}return e.value}function ie(e){e instanceof HTMLOptionElement?le(e):ne in e&&ce(e,e[ne])}function se(e){return"select-multiple"===e.type}function ae(e,t){e.value=t||""}function ce(e,t){e instanceof HTMLSelectElement?se(e)?function(e,t){t||(t=[]);for(let n=0;n{if(!be)return;if(0!==e.button||function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e))return;if(e.defaultPrevented)return;const t=function(e){const t=!window._blazorDisableComposedPath&&e.composedPath&&e.composedPath();if(t){for(let e=0;edocument.baseURI,getLocationHref:()=>location.href,scrollToElement:Ne};function Ne(e){const t=document.getElementById(e);return!!t&&(t.scrollIntoView(),!0)}function Ae(e,t,n=!1){const r=$e(e);!t.forceLoad&&je(r)?Re(r,!1,t.replaceHistoryEntry,t.historyEntryState,n):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Re(e,t,n,r=void 0,o=!1){if(Me(),function(e){const t=e.indexOf("#");return t>-1&&location.href.replace(location.hash,"")===e.substring(0,t)}(e))!function(e,t,n){Pe(e,t,n);const r=e.indexOf("#");r!==e.length-1&&Ne(e.substring(r+1))}(e,n,r);else{if(!o&&Ee&&!await Le(e,r,t))return;ye=!0,Pe(e,n,r),await Be(t)}}function Pe(e,t,n=void 0){t?history.replaceState({userState:n,_index:Se},"",e):(Se++,history.pushState({userState:n,_index:Se},"",e))}function Ue(e){return new Promise((t=>{const n=Te;Te=()=>{Te=n,t()},history.go(e)}))}function Me(){De&&(De(!1),De=null)}function Le(e,t,n){return new Promise((r=>{Me(),ke?(Ce++,De=r,ke(Ce,e,t,n)):r(!1)}))}async function Be(e){var t;Ie&&await Ie(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function Oe(e){var t,n;Te&&await Te(e),Se=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}let Fe;function $e(e){return Fe=Fe||document.createElement("a"),Fe.href=e,Fe.href}function He(e,t){return e?e.tagName===t?e:He(e.parentElement,t):null}function je(e){const t=(n=document.baseURI).substring(0,n.lastIndexOf("/"));var n;const r=e.charAt(t.length);return e.startsWith(t)&&(""===r||"/"===r||"?"===r||"#"===r)}const We={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,t){const n=document.querySelector(e);n&&(n.hasAttribute("tabindex")||(n.tabIndex=-1),n.focus({preventScroll:!0}))}},ze={init:function(e,t,n,r=50){const o=qe(t);(o||document.documentElement).style.overflowAnchor="none";const i=document.createRange();h(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(r){r.forEach((r=>{var o;if(!r.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const s=i.getBoundingClientRect().height,a=null===(o=r.rootBounds)||void 0===o?void 0:o.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,s,a):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,s,a)}))}),{root:o,rootMargin:`${r}px`});s.observe(t),s.observe(n);const a=l(t),c=l(n);function l(e){const t={attributes:!0},n=new MutationObserver(((n,r)=>{h(e.parentElement)&&(r.disconnect(),e.style.display="table-row",r.observe(e,t)),s.unobserve(e),s.observe(e)}));return n.observe(e,t),n}function h(e){return null!==e&&(e instanceof HTMLTableElement&&""===e.style.display||"table"===e.style.display||e instanceof HTMLTableSectionElement&&""===e.style.display||"table-row-group"===e.style.display)}Je[e._id]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const t=Je[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete Je[e._id])}},Je={};function qe(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:qe(e.parentElement):null}const Ke={getAndRemoveExistingTitle:function(){var e;const t=document.head?document.head.getElementsByTagName("title"):[];if(0===t.length)return null;let n=null;for(let r=t.length-1;r>=0;r--){const o=t[r],i=o.previousSibling;i instanceof Comment&&null!==z(i)||(null===n&&(n=o.textContent),null===(e=o.parentNode)||void 0===e||e.removeChild(o))}return n}},Ve={init:function(e,t){t._blazorInputFileNextFileId=0,t.addEventListener("click",(function(){t.value=""})),t.addEventListener("change",(function(){t._blazorFilesById={};const n=Array.prototype.map.call(t.files,(function(e){const n={id:++t._blazorInputFileNextFileId,lastModified:new Date(e.lastModified).toISOString(),name:e.name,size:e.size,contentType:e.type,readPromise:void 0,arrayBuffer:void 0,blob:e};return t._blazorFilesById[n.id]=n,n}));e.invokeMethodAsync("NotifyChange",n)}))},toImageFile:async function(e,t,n,r,o){const i=Xe(e,t),s=await new Promise((function(e){const t=new Image;t.onload=function(){URL.revokeObjectURL(t.src),e(t)},t.onerror=function(){t.onerror=null,URL.revokeObjectURL(t.src)},t.src=URL.createObjectURL(i.blob)})),a=await new Promise((function(e){var t;const i=Math.min(1,r/s.width),a=Math.min(1,o/s.height),c=Math.min(i,a),l=document.createElement("canvas");l.width=Math.round(s.width*c),l.height=Math.round(s.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(s,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return Xe(e,t).blob}};function Xe(e,t){const n=e._blazorFilesById[t];if(!n)throw new Error(`There is no file with ID ${t}. The file list may have changed. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.`);return n}const Ge=new Set,Ye={enableNavigationPrompt:function(e){0===Ge.size&&window.addEventListener("beforeunload",Qe),Ge.add(e)},disableNavigationPrompt:function(e){Ge.delete(e),0===Ge.size&&window.removeEventListener("beforeunload",Qe)}};function Qe(e){e.preventDefault(),e.returnValue=!0}async function Ze(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 et=new Map,tt={navigateTo:function(e,t,n=!1){Ae(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(i.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=s.get(t.browserEventName);n?n.push(e):s.set(t.browserEventName,[e]),a.forEach((n=>n(e,t.browserEventName)))}i.set(e,t)},rootComponents:w,_internal:{navigationManager:xe,domWrapper:We,Virtualize:ze,PageTitle:Ke,InputFile:Ve,NavigationLock:Ye,getJSDataStreamChunk:Ze,attachWebRendererInterop:function(t,n,r){const o=S.length;return S.push(t),Object.keys(n).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.findJSFunction(t,0);for(const e of o)r(e,n[e])}}(T(o),n,r),C(),o}}};window.Blazor=tt;const nt=[0,2e3,1e4,3e4,null];class rt{constructor(e){this._retryDelays=void 0!==e?[...e,null]:nt}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class ot{}ot.Authorization="Authorization",ot.Cookie="Cookie";class it{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class st{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}class at extends st{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&401===n.statusCode&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[ot.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[ot.Authorization]&&delete e.headers[ot.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}class ct extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class lt extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class ht extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class dt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class ut extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class pt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class ft extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class gt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}var mt;!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"}(mt||(mt={}));class yt{constructor(){}log(e,t){}}yt.instance=new yt;const wt="0.0.0-DEV_BUILD";class vt{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 bt{static get isBrowser(){return"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isReactNative(){return"object"==typeof window&&void 0===window.document}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}}function _t(e,t){let n="";return Et(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 Et(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function St(e,t,n,r,o,i){const s={},[a,c]=kt();s[a]=c,e.log(mt.Trace,`(${t} transport) sending data. ${_t(o,i.logMessageContent)}.`);const l=Et(o)?"arraybuffer":"text",h=await n.post(r,{content:o,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(mt.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class Ct{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()}] ${mt[e]}: ${t}`;switch(e){case mt.Critical:case mt.Error:this.out.error(n);break;case mt.Warning:this.out.warn(n);break;case mt.Information:this.out.info(n);break;default:this.out.log(n)}}}}function kt(){let e="X-SignalR-User-Agent";return bt.isNode&&(e="User-Agent"),[e,Tt(wt,Dt(),bt.isNode?"NodeJS":"Browser",xt())]}function Tt(e,t,n,r){let o="Microsoft SignalR/";const i=e.split(".");return o+=`${i[0]}.${i[1]}`,o+=` (${e}; `,o+=t&&""!==t?`${t}; `:"Unknown OS; ",o+=`${n}`,o+=r?`; ${r}`:"; Unknown Runtime Version",o+=")",o}function Dt(){if(!bt.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function xt(){if(bt.isNode)return process.versions.node}function Nt(e){return e.stack?e.stack:e.message?e.message:`${e}`}class At extends st{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e=require;this._jar=new(e("tough-cookie").CookieJar),"undefined"==typeof fetch?this._fetchType=e("node-fetch"):this._fetchType=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 ht;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 ht});let r,o=null;if(e.timeout){const r=e.timeout;o=setTimeout((()=>{t.abort(),this._logger.log(mt.Warning,"Timeout from HTTP request."),n=new lt}),r)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Et(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");try{r=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:!0===e.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(e){if(n)throw n;throw this._logger.log(mt.Warning,`Error from HTTP request. ${e}.`),e}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!r.ok){const e=await Rt(r,"text");throw new ct(e||r.statusText,r.status)}const i=Rt(r,e.responseType),s=await i;return new it(r.status,r.statusText,s)}getCookieString(e){return""}}function Rt(e,t){let n;switch(t){case"arraybuffer":n=e.arrayBuffer();break;case"text":default:n=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`)}return n}class Pt extends st{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ht):e.method?e.url?new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),r.withCredentials=void 0===e.withCredentials||e.withCredentials,r.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===e.content&&(e.content=void 0),e.content&&(Et(e.content)?r.setRequestHeader("Content-Type","application/octet-stream"):r.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach((e=>{r.setRequestHeader(e,o[e])})),e.responseType&&(r.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{r.abort(),n(new ht)}),e.timeout&&(r.timeout=e.timeout),r.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),r.status>=200&&r.status<300?t(new it(r.status,r.statusText,r.response||r.responseText)):n(new ct(r.response||r.responseText||r.statusText,r.status))},r.onerror=()=>{this._logger.log(mt.Warning,`Error from HTTP request. ${r.status}: ${r.statusText}.`),n(new ct(r.statusText,r.status))},r.ontimeout=()=>{this._logger.log(mt.Warning,"Timeout from HTTP request."),n(new lt)},r.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Ut extends st{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new At(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 ht):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)}}var Mt,Lt,Bt,Ot;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(Mt||(Mt={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Lt||(Lt={}));class Ft{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 $t{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new Ft,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(vt.isRequired(e,"url"),vt.isRequired(t,"transferFormat"),vt.isIn(t,Lt,"transferFormat"),this._url=e,this._logger.log(mt.Trace,"(LongPolling transport) Connecting."),t===Lt.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]=kt(),o={[n]:r,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===Lt.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(mt.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(mt.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new ct(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(mt.Trace,`(LongPolling transport) polling: ${n}.`);const r=await this._httpClient.get(n,t);204===r.statusCode?(this._logger.log(mt.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==r.statusCode?(this._logger.log(mt.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this._closeError=new ct(r.statusText||"",r.statusCode),this._running=!1):r.content?(this._logger.log(mt.Trace,`(LongPolling transport) data received. ${_t(r.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this._logger.log(mt.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof lt?this._logger.log(mt.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(mt.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(mt.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?St(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(mt.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(mt.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=kt();e[t]=n;const r={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};await this._httpClient.delete(this._url,r),this._logger.log(mt.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(mt.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(mt.Trace,e),this.onclose(this._closeError)}}}class Ht{constructor(e,t,n,r){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=r,this.onreceive=null,this.onclose=null}async connect(e,t){return vt.isRequired(e,"url"),vt.isRequired(t,"transferFormat"),vt.isIn(t,Lt,"transferFormat"),this._logger.log(mt.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,r)=>{let o,i=!1;if(t===Lt.Text){if(bt.isBrowser||bt.isWebWorker)o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const t=this._httpClient.getCookieString(e),n={};n.Cookie=t;const[r,i]=kt();n[r]=i,o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...n,...this._options.headers}})}try{o.onmessage=e=>{if(this.onreceive)try{this._logger.log(mt.Trace,`(SSE transport) data received. ${_t(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},o.onerror=e=>{i?this._close():r(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},o.onopen=()=>{this._logger.log(mt.Information,`SSE connected to ${this._url}`),this._eventSource=o,i=!0,n()}}catch(e){return void r(e)}}else r(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(e){return this._eventSource?St(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class jt{constructor(e,t,n,r,o,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=r,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){let n;return vt.isRequired(e,"url"),vt.isRequired(t,"transferFormat"),vt.isIn(t,Lt,"transferFormat"),this._logger.log(mt.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((r,o)=>{let i;e=e.replace(/^http/,"ws");const s=this._httpClient.getCookieString(e);let a=!1;if(bt.isReactNative){const t={},[r,o]=kt();t[r]=o,n&&(t[ot.Authorization]=`Bearer ${n}`),s&&(t[ot.Cookie]=s),i=new this._webSocketConstructor(e,void 0,{headers:{...t,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===Lt.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(mt.Information,`WebSocket connected to ${e}.`),this._webSocket=i,a=!0,r()},i.onerror=e=>{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"There was an error with the transport",this._logger.log(mt.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(mt.Trace,`(WebSockets transport) data received. ${_t(e.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(e.data)}catch(e){return void this._close(e)}},i.onclose=e=>{if(a)this._close(e);else{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(mt.Trace,`(WebSockets transport) sending data. ${_t(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(mt.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 Wt{constructor(e,t={}){var n;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,vt.isRequired(e,"url"),this._logger=void 0===(n=t.logger)?new It(mt.Information):null===n?yt.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=new at(t.httpClient||new Ut(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Lt.Binary,vt.isIn(e,Lt,"transferFormat"),this._logger.log(mt.Debug,`Starting connection with transfer format '${Lt[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(mt.Error,e),await this._stopPromise,Promise.reject(new ht(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(mt.Error,e),Promise.reject(new ht(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 zt(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(mt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(mt.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(mt.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(mt.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport!==Mt.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(Mt.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 ht("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const e=n.accessToken;this._accessTokenFactory=()=>e,this._httpClient._accessToken=e,this._httpClient._accessTokenFactory=void 0}r++}while(n.url&&r<100);if(100===r&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof $t&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(mt.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(mt.Error,"Failed to start the connection: "+e),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(e)}}async _getNegotiationResponse(e){const t={},[n,r]=kt();t[n]=r;const o=this._resolveNegotiateUrl(e);this._logger.log(mt.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 ct&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(mt.Error,t),Promise.reject(new ft(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(mt.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(o,r),void(this.connectionId=n.connectionId);const i=[],s=n.availableTransports||[];let a=n;for(const n of s){const s=this._resolveTransportOrError(n,t,r);if(s instanceof Error)i.push(`${n.transport} failed:`),i.push(s);else if(this._isITransport(s)){if(this.transport=s,!a){try{a=await this._getNegotiationResponse(e)}catch(e){return Promise.reject(e)}o=this._createConnectUrl(e,a.connectionToken)}try{return await this._startTransport(o,r),void(this.connectionId=a.connectionId)}catch(e){if(this._logger.log(mt.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new pt(`${n.transport} failed: ${e}`,Mt[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(mt.Debug,e),Promise.reject(new ht(e))}}}}return i.length>0?Promise.reject(new gt(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case Mt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new jt(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Mt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Ht(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Mt.LongPolling:return new $t(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n){const r=Mt[e.transport];if(null==r)return this._logger.log(mt.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(mt.Debug,`Skipping transport '${Mt[r]}' because it was disabled by the client.`),new ut(`'${Mt[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>Lt[e])).indexOf(n)>=0))return this._logger.log(mt.Debug,`Skipping transport '${Mt[r]}' because it does not support the requested transfer format '${Lt[n]}'.`),new Error(`'${Mt[r]}' does not support ${Lt[n]}.`);if(r===Mt.WebSockets&&!this._options.WebSocket||r===Mt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(mt.Debug,`Skipping transport '${Mt[r]}' because it is not supported in your environment.'`),new dt(`'${Mt[r]}' is not supported in your environment.`,r);this._logger.log(mt.Debug,`Selecting transport '${Mt[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(mt.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(mt.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(mt.Error,`Connection disconnected with error '${e}'.`):this._logger.log(mt.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(mt.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(mt.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(mt.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(!bt.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(mt.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 zt{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Jt,this._transportResult=new Jt,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Jt),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 Jt;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):zt._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 Jt{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class qt{static write(e){return`${e}${qt.RecordSeparator}`}static parse(e){if(e[e.length-1]!==qt.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(qt.RecordSeparator);return t.pop(),t}}qt.RecordSeparatorCode=30,qt.RecordSeparator=String.fromCharCode(qt.RecordSeparatorCode);class Kt{writeHandshakeRequest(e){return qt.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Et(e)){const r=new Uint8Array(e),o=r.indexOf(qt.RecordSeparatorCode);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(r.slice(0,i))),n=r.byteLength>i?r.slice(i).buffer:null}else{const r=e,o=r.indexOf(qt.RecordSeparator);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=r.substring(0,i),n=r.length>i?r.substring(i):null}const r=qt.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"}(Bt||(Bt={}));class Vt{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 Ct(this,e)}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(Ot||(Ot={}));class Xt{static create(e,t,n,r,o,i){return new Xt(e,t,n,r,o,i)}constructor(e,t,n,r,o,i){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(mt.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},vt.isRequired(e,"connection"),vt.isRequired(t,"logger"),vt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=o?o:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=r,this._handshakeProtocol=new Kt,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=Ot.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Bt.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==Ot.Disconnected&&this._connectionState!==Ot.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!==Ot.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Ot.Connecting,this._logger.log(mt.Debug,"Starting HubConnection.");try{await this._startInternal(),bt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Ot.Connected,this._connectionStarted=!0,this._logger.log(mt.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=Ot.Disconnected,this._logger.log(mt.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(mt.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(mt.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(mt.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===Ot.Disconnected?(this._logger.log(mt.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===Ot.Disconnecting?(this._logger.log(mt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=Ot.Disconnecting,this._logger.log(mt.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(mt.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 ht("The connection was stopped before the hub handshake could complete."),this.connection.stop(e)))}stream(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createStreamInvocation(e,t,r);let i;const s=new Vt;return s.cancelCallback=()=>{const e=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then((()=>this._sendWithProtocol(e)))},this._callbacks[o.invocationId]=(e,t)=>{t?s.error(t):e&&(e.type===Bt.Completion?e.error?s.error(new Error(e.error)):s.complete():s.next(e.item))},i=this._sendWithProtocol(o).catch((e=>{s.error(e),delete this._callbacks[o.invocationId]})),this._launchStreams(n,i),s}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._sendWithProtocol(this._createInvocation(e,t,!0,r));return this._launchStreams(n,o),o}invoke(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createInvocation(e,t,!1,r);return new Promise(((e,t)=>{this._callbacks[o.invocationId]=(n,r)=>{r?t(r):n&&(n.type===Bt.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 Bt.Invocation:this._invokeClientMethod(e);break;case Bt.StreamItem:case Bt.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===Bt.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(mt.Error,`Stream callback threw error: ${Nt(e)}`)}}break}case Bt.Ping:break;case Bt.Close:{this._logger.log(mt.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(mt.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(mt.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(mt.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(mt.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===Ot.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n)return this._logger.log(mt.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(mt.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null))));const r=n.slice(),o=!!e.invocationId;let i,s,a;for(const n of r)try{const r=i;i=await n.apply(this,e.arguments),o&&i&&r&&(this._logger.log(mt.Error,`Multiple results provided for '${t}'. Sending error to server.`),a=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),s=void 0}catch(e){s=e,this._logger.log(mt.Error,`A callback for the method '${t}' threw error '${e}'.`)}a?await this._sendWithProtocol(a):o?(s?a=this._createCompletionMessage(e.invocationId,`${s}`,null):void 0!==i?a=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(mt.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),a=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(a)):i&&this._logger.log(mt.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(mt.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new ht("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===Ot.Disconnecting?this._completeClose(e):this._connectionState===Ot.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===Ot.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=Ot.Disconnected,this._connectionStarted=!1,bt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(mt.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(mt.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=Ot.Reconnecting,e?this._logger.log(mt.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(mt.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(mt.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==Ot.Reconnecting)return void this._logger.log(mt.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==o;){if(this._logger.log(mt.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!==Ot.Reconnecting)return void this._logger.log(mt.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=Ot.Connected,this._logger.log(mt.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(mt.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(mt.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==Ot.Reconnecting)return this._logger.log(mt.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===Ot.Disconnecting&&this._completeClose());r=e instanceof Error?e:new Error(e.toString()),o=this._getNextRetryDelay(n++,Date.now()-t,r)}}this._logger.log(mt.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(mt.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(mt.Error,`Stream 'error' callback called with '${e}' threw error: ${Nt(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:Bt.Invocation}:{arguments:t,target:e,type:Bt.Invocation};{const n=this._invocationId;return this._invocationId++,0!==r.length?{arguments:t,invocationId:n.toString(),streamIds:r,target:e,type:Bt.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:Bt.Invocation}}}_launchStreams(e,t){if(0!==e.length){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n))))},error:e=>{let r;r=e instanceof Error?e.message:e&&e.toString?e.toString():"Unknown error",t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n,r))))},next:e=>{t=t.then((()=>this._sendWithProtocol(this._createStreamItemMessage(n,e))))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let r=0;r=55296&&o<=56319&&r65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h)}else i.push(a);i.length>=4096&&(s+=String.fromCharCode.apply(String,i),i.length=0)}return i.length>0&&(s+=String.fromCharCode.apply(String,i)),s}var un,pn=sn?new TextDecoder:null,fn=sn?"undefined"!=typeof process&&"force"!==(null===(tn=null===process||void 0===process?void 0:process.env)||void 0===tn?void 0:tn.TEXT_DECODER)?200:0:nn,gn=function(e,t){this.type=e,this.data=t},mn=(un=function(e,t){return un=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])},un(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}un(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),yn=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 mn(t,e),t}(Error),wn={type:-1,encode:function(e){var t,n,r,o;return e instanceof Date?function(e){var t,n=e.sec,r=e.nsec;if(n>=0&&r>=0&&n<=17179869183){if(0===r&&n<=4294967295){var o=new Uint8Array(4);return(t=new DataView(o.buffer)).setUint32(0,n),o}var i=n/4294967296,s=4294967295&n;return o=new Uint8Array(8),(t=new DataView(o.buffer)).setUint32(0,r<<2|3&i),t.setUint32(4,s),o}return o=new Uint8Array(12),(t=new DataView(o.buffer)).setUint32(0,r),rn(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:on(t,4),nsec:t.getUint32(0)};default:throw new yn("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},vn=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(wn)}return e.prototype.register=function(e){var t=e.type,n=e.encode,r=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=r;else{var o=1+t;this.builtInEncoders[o]=n,this.builtInDecoders[o]=r}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>ln){var t=an(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),hn(e,this.bytes,this.pos),this.pos+=t}else t=an(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var r=e.length,o=n,i=0;i>6&31|192;else{if(s>=55296&&s<=56319&&i>12&15|224,t[o++]=s>>6&63|128):(t[o++]=s>>18&7|240,t[o++]=s>>12&63|128,t[o++]=s>>6&63|128)}t[o++]=63&s|128}else t[o++]=s}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=bn(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var r=0,o=e;r0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var r=0,o=this.caches[n-1];r=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)},e.prototype.decode=function(e,t,n){var r=this.find(e,t,n);if(null!=r)return this.hit++,r;this.miss++;var o=dn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,o),o},e}(),Dn=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return Dn(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,n,r,o,i,s,a;return i=this,void 0,a=function(){var i,s,a,c,l,h,d,u;return Dn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=xn(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),i=!0}catch(e){if(!(e instanceof Pn))throw e}this.totalPos+=this.pos,p.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return c=p.sent(),r={error:c},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,s]}throw h=(l=this).headByte,d=l.pos,u=l.totalPos,new RangeError("Insufficient data in parsing ".concat(En(h)," at ").concat(u," (").concat(d," in the current buffer)"))}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{o(a.next(e))}catch(e){t(e)}}function r(e){try{o(a.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}o((a=a.apply(i,[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return function(n,r,o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,s=function(){var n,r,o,i,s,a,c,l,h;return Dn(this,(function(d){switch(d.label){case 0:n=t,r=-1,d.label=1;case 1:d.trys.push([1,13,14,19]),o=xn(e),d.label=2;case 2:return[4,Nn(o.next())];case 3:if((i=d.sent()).done)return[3,12];if(s=i.value,t&&0===r)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(r=this.readArraySize(),n=!1,this.complete()),d.label=4;case 4:d.trys.push([4,9,,10]),d.label=5;case 5:return[4,Nn(this.doDecodeSync())];case 6:return[4,d.sent()];case 7:return d.sent(),0==--r?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=d.sent())instanceof Pn))throw a;return[3,10];case 10:this.totalPos+=this.pos,d.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=d.sent(),l={error:c},[3,19];case 14:return d.trys.push([14,,17,18]),i&&!i.done&&(h=o.return)?[4,Nn(h.call(o))]:[3,16];case 15:d.sent(),d.label=16;case 16:return[3,18];case 17:if(l)throw l.error;return[7];case 18:return[7];case 19:return[2]}}))}.apply(n,r||[]),a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(e){s[e]&&(i[e]=function(t){return new Promise((function(n,r){a.push([e,t,n,r])>1||l(e,t)}))})}function l(e,t){try{(n=s[e](t)).value instanceof Nn?Promise.resolve(n.value.v).then(h,d):u(a[0][2],n)}catch(e){u(a[0][3],e)}var n}function h(e){l("next",e)}function d(e){l("throw",e)}function u(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}(this,arguments)},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 yn("Unrecognized type byte: ".concat(En(e)));r=this.lookU32(),t=this.decodeExtension(r,4)}this.complete();for(var o=this.stack;o.length>0;){var i=o[o.length-1];if(0===i.type){if(i.array[i.position]=t,i.position++,i.position!==i.size)continue e;o.pop(),t=i.array}else{if(1===i.type){if("string"!=(s=typeof t)&&"number"!==s)throw new yn("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new yn("The key __proto__ is not allowed");i.key=t,i.type=2;continue e}if(i.map[i.key]=t,i.readCount++,i.readCount!==i.size){i.key=null,i.type=1;continue e}o.pop(),t=i.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new yn("Unrecognized array type byte: ".concat(En(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new yn("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new yn("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new yn("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthfn?function(e,t,n){var r=e.subarray(t,t+n);return pn.decode(r)}(this.bytes,o,e):dn(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 yn("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw Un;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 yn("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,n,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,n},e.prototype.readI64=function(){var e=on(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}();!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"}(Sn||(Sn={})),function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(Cn||(Cn={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(In||(In={}));class Bn{constructor(){}log(e,t){}}Bn.instance=new Bn,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"}(kn||(kn={}));class On{static write(e){let t=e.byteLength||e.length;const n=[];do{let e=127&t;t>>=7,t>0&&(e|=128),n.push(e)}while(t>0);t=e.byteLength||e.length;const r=new Uint8Array(n.length+t);return r.set(n,0),r.set(e,n.length),r.buffer}static parse(e){const t=[],n=new Uint8Array(e),r=[0,7,14,21,28];for(let o=0;o7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+s+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+s,o+s+a):n.subarray(o+s,o+s+a)),o=o+s+a}return t}}const Fn=new Uint8Array([145,Sn.Ping]);class $n{constructor(e){this.name="messagepack",this.version=1,this.transferFormat=In.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new _n(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new Ln(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=Bn.instance);const r=On.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 Sn.Invocation:return this._writeInvocation(e);case Sn.StreamInvocation:return this._writeStreamInvocation(e);case Sn.StreamItem:return this._writeStreamItem(e);case Sn.Completion:return this._writeCompletion(e);case Sn.Ping:return On.write(Fn);case Sn.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 Sn.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case Sn.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case Sn.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case Sn.Ping:return this._createPingMessage(n);case Sn.Close:return this._createCloseMessage(n);default:return t.log(kn.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:Sn.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:Sn.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:Sn.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:Sn.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:Sn.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:Sn.Completion}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([Sn.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([Sn.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),On.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([Sn.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([Sn.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),On.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([Sn.StreamItem,e.headers||{},e.invocationId,e.item]);return On.write(t.slice())}_writeCompletion(e){const t=e.error?this._errorResult:void 0!==e.result?this._nonVoidResult:this._voidResult;let n;switch(t){case this._errorResult:n=this._encoder.encode([Sn.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([Sn.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([Sn.Completion,e.headers||{},e.invocationId,t,e.result])}return On.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([Sn.CancelInvocation,e.headers||{},e.invocationId]);return On.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}let Hn=!1;function jn(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),Hn||(Hn=!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 Wn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,zn=Wn?Wn.decode.bind(Wn):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("")},Jn=Math.pow(2,32),qn=Math.pow(2,21)-1;function Kn(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 Xn(e,t){const n=Vn(e,t+4);if(n>qn)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Jn+Vn(e,t)}class Gn{constructor(e){this.batchData=e;const t=new er(e);this.arrayRangeReader=new tr(e),this.arrayBuilderSegmentReader=new nr(e),this.diffReader=new Yn(e),this.editReader=new Qn(e,t),this.frameReader=new Zn(e,t)}updatedComponents(){return Kn(this.batchData,this.batchData.length-20)}referenceFrames(){return Kn(this.batchData,this.batchData.length-16)}disposedComponentIds(){return Kn(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return Kn(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return Kn(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return Kn(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return Xn(this.batchData,n)}}class Yn{constructor(e){this.batchDataUint8=e}componentId(e){return Kn(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class Qn{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return Kn(this.batchDataUint8,e)}siblingIndex(e){return Kn(this.batchDataUint8,e+4)}newTreeIndex(e){return Kn(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return Kn(this.batchDataUint8,e+8)}removedAttributeName(e){const t=Kn(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class Zn{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return Kn(this.batchDataUint8,e)}subtreeLength(e){return Kn(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=Kn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return Kn(this.batchDataUint8,e+8)}elementName(e){const t=Kn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=Kn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=Kn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=Kn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=Kn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return Xn(this.batchDataUint8,e+12)}}class er{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=Kn(e,e.length-4)}readString(e){if(-1===e)return null;{const n=Kn(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const i=e[t+o];if(n|=(127&i)<this.nextBatchId)return this.fatalError?(this.logger.log(rr.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(rr.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(rr.Debug,`Applying batch ${e}.`),ve(this.browserRendererId,new Gn(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(rr.Error,`There was an error applying batch ${e}.`),n.send("OnRenderCompleted",e,t.toString()),t}}getLastBatchid(){return this.nextBatchId-1}async completeBatch(e,t){try{await e.send("OnRenderCompleted",t,null)}catch{this.logger.log(rr.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}class ir{log(e,t){}}ir.instance=new ir;class sr{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${rr[e]}: ${t}`;switch(e){case rr.Critical:case rr.Error:console.error(n);break;case rr.Warning:console.warn(n);break;case rr.Information:console.info(n);break;default:console.log(n)}}}}class ar{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!==Ot.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!==Ot.Connected)return!1;const t=await e.invoke("StartCircuit",xe.getBaseURI(),xe.getLocationHref(),JSON.stringify(this.components.map((e=>e.toRecord()))),this.applicationState||"");return!!t&&(this.initialize(t),!0)}resolveElement(e){const t=v(e);if(t)return $(t,!0);const n=Number.parseInt(e);if(!Number.isNaN(n))return F(this.components[n].start,this.components[n].end);throw new Error(`Invalid sequence number or identifier '${e}'.`)}}const cr={configureSignalR:e=>{},logLevel:rr.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class lr{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 tt.reconnect()||this.rejected()}catch(e){this.logger.log(rr.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 hr{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const r=this.document.getElementById(hr.MaxRetriesId);r&&(r.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(hr.ShowClassName)}update(e){const t=this.document.getElementById(hr.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(hr.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(hr.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(hr.RejectedClassName)}removeClasses(){this.dialog.classList.remove(hr.ShowClassName,hr.HideClassName,hr.FailedClassName,hr.RejectedClassName)}}hr.ShowClassName="components-reconnect-show",hr.HideClassName="components-reconnect-hide",hr.FailedClassName="components-reconnect-failed",hr.RejectedClassName="components-reconnect-rejected",hr.MaxRetriesId="components-reconnect-max-retries",hr.CurrentAttemptId="components-reconnect-current-attempt";class dr{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||tt.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new hr(t,e.maxRetries,document):new lr(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new ur(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class ur{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;tur.MaximumFirstRetryInterval?ur.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(rr.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise((t=>setTimeout(t,e)))}}function pr(e,t){switch(t){case"webassembly":return function(e){const t=mr(e,"webassembly"),n=[];for(let e=0;ee.id-t.id))}(e);case"server":return function(e){const t=mr(e,"server"),n=[];for(let e=0;ee.sequence-t.sequence))}(e)}}ur.MaximumFirstRetryInterval=3e3;const fr=/^\s*Blazor-Component-State:(?[a-zA-Z0-9+/=]+)$/;function gr(e){var t;if(e.nodeType===Node.COMMENT_NODE){const n=e.textContent||"",r=fr.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 wr(e,t){const n=e.currentElement;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const r=yr.exec(n.textContent),o=r&&r.groups&&r.groups.descriptor;if(!o)return;try{const r=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(o);switch(t){case"webassembly":return function(e,t,n){const{type:r,assembly:o,typeName:i,parameterDefinitions:s,parameterValues:a,prerenderId:c}=e,l=c?vr(c,n):void 0;if(c&&!l)throw new Error(`Could not find an end component comment for '${t}'.`);if("webassembly"===r){if(!o)throw new Error("assembly must be defined when using a descriptor.");if(!i)throw new Error("typeName must be defined when using a descriptor.");return{type:r,assembly:o,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:a&&atob(a),start:t,prerenderId:c,end:l}}}(r,n,e);case"server":return function(e,t,n){const{type:r,descriptor:o,sequence:i,prerenderId:s}=e,a=s?vr(s,n):void 0;if(s&&!a)throw new Error(`Could not find an end component comment for '${t}'.`);if("server"===r){if(!o)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===i)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(i))throw new Error(`Error parsing the sequence '${i}' for component '${JSON.stringify(e)}'`);return{type:r,sequence:i,descriptor:o,start:t,prerenderId:s,end:a}}}(r,n,e)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}function vr(e,t){for(;t.next()&&t.currentElement;){const n=t.currentElement;if(n.nodeType!==Node.COMMENT_NODE)continue;if(!n.textContent)continue;const r=yr.exec(n.textContent),o=r&&r[1];if(o)return br(o,e),n}}function br(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 _r{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndexasync function(e,n){const r=function(e){const t=document.baseURI;return t.endsWith("/")?`${t}${e}`:`${t}/${e}`}(n),o=await import(r);if(void 0===o)return;const{beforeStart:i,afterStarted:s}=o;return s&&e.afterStartedCallbacks.push(s),i?i(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await I,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let Ir,kr,Tr,Dr,xr=!1;async function Nr(e,t,n){var r,o;const i=new $n;i.name="blazorpack";const s=(new Qt).withUrl("_blazor").withHubProtocol(i);e.configureSignalR(s);const a=s.build();a.on("JS.AttachComponent",((e,t)=>we(0,n.resolveElement(t),e,!1))),a.on("JS.BeginInvokeJS",Tr.beginInvokeJSFromDotNet.bind(Tr)),a.on("JS.EndInvokeDotNet",Tr.endInvokeDotNetFromJS.bind(Tr)),a.on("JS.ReceiveByteArray",Tr.receiveByteArray.bind(Tr)),a.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start(t){a.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});Tr.supplyDotNetStream(e,t)}));const c=or.getOrCreate(t);a.on("JS.RenderBatch",((e,n)=>{t.log(rr.Debug,`Received render batch with id ${e} and ${n.byteLength} bytes.`),c.processBatch(e,n,a)})),a.on("JS.EndLocationChanging",tt._internal.navigationManager.endLocationChanging),a.onclose((t=>!xr&&e.reconnectionHandler.onConnectionDown(e.reconnectionOptions,t))),a.on("JS.Error",(e=>{xr=!0,Ar(a,e,t),jn()}));try{await a.start(),Ir=a}catch(e){if(Ar(a,e,t),"FailedToNegotiateWithServerError"===e.errorType)throw e;jn(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===Mt.WebSockets))?t.log(rr.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===Mt.WebSockets))?t.log(rr.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===Mt.LongPolling))&&t.log(rr.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===(o=null===(r=a.connection)||void 0===r?void 0:r.features)||void 0===o?void 0:o.inherentKeepAlive)&&t.log(rr.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."),a}function Ar(e,t,n){n.log(rr.Error,t),e&&e.stop()}function Rr(e){return Dr=e,Dr}var Pr,Ur;const Mr=navigator,Lr=Mr.userAgentData&&Mr.userAgentData.brands,Br=Lr?Lr.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):window.chrome,Or=null!==(Ur=null===(Pr=Mr.userAgentData)||void 0===Pr?void 0:Pr.platform)&&void 0!==Ur?Ur:navigator.platform;let Fr,$r,Hr,jr,Wr,zr,Jr=!1,qr=!1;function Kr(){return(Jr||qr)&&(Br||navigator.userAgent.includes("Firefox"))}const Vr=Math.pow(2,32),Xr=Math.pow(2,21)-1;let Gr=null,Yr="Production";function Qr(e){return $r.getI32(e)}const Zr={start:function(t){return async function(t){const n={},{dotnet:r}=await async function(e){if("undefined"==typeof WebAssembly||!WebAssembly.validate)throw new Error("This browser does not support WebAssembly.");const t=await async function(e,t){const n=void 0!==e?e("manifest","blazor.boot.json","_framework/blazor.boot.json",""):i("_framework/blazor.boot.json");let r;r=n?"string"==typeof n?await i(n):await n:await i("_framework/blazor.boot.json"),Yr=t||r.headers.get("Blazor-Environment")||"Production";const o=await r.json();return o.modifiableAssemblies=r.headers.get("DOTNET-MODIFIABLE-ASSEMBLIES"),o.aspnetCoreBrowserTools=r.headers.get("ASPNETCORE-BROWSER-TOOLS"),o;function i(e){return fetch(e,{method:"GET",credentials:"include",cache:"no-cache"})}}(e.loadBootResource,e.environment),n=Object.keys(t.resources.runtime).filter((e=>e.startsWith("dotnet.")&&e.endsWith(".js")))[0],r=t.resources.runtime[n];let o=`_framework/${n}`;if(e.loadBootResource){const t="dotnetjs",i=e.loadBootResource(t,n,o,r);if("string"==typeof i)o=i;else if(i)throw new Error(`For a ${t} resource, custom loaders must supply a URI string.`)}if(t.cacheBootResources){const e=document.createElement("link");e.rel="modulepreload",e.href=o,e.crossOrigin="anonymous",e.integrity=r,document.head.appendChild(e)}const i=new URL(o,document.baseURI).toString();return await import(i)}(t),o=function(e,t){const n={maxParallelDownloads:1e6,enableDownloadRetry:!1,applicationEnvironment:Yr},r={...window.Module||{},onConfigLoaded:async n=>{n.environmentVariables||(n.environmentVariables={}),0===n.icuDataMode&&(n.environmentVariables.__BLAZOR_SHARDED_ICU="1"),n.aspnetCoreBrowserTools&&(n.environmentVariables.__ASPNETCORE_BROWSER_TOOLS=n.aspnetCoreBrowserTools),tt._internal.getApplicationEnvironment=()=>n.applicationEnvironment,t.jsInitializer=await async function(e,t){const n=e.resources.libraryInitializers,r=new Cr;return n&&await r.importInitializersAsync(Object.keys(n),[t,e.resources.extensions]),r}(n,e)},onDownloadResourceProgress:eo,config:n,disableDotnet6Compatibility:!1,print:no,printErr:ro};return r}(t,n);r.withStartupOptions(t).withModuleConfig(o),zr=await r.create();const{MONO:i,BINDING:s,Module:a,setModuleImports:c,INTERNAL:l}=zr;Hr=a,Fr=s,$r=i,Wr=l;const h=Wr.resourceLoader;n.resourceLoader=h,function(e){Jr=!!e.bootConfig.resources.pdb,qr=e.bootConfig.debugBuild;const t=Or.match(/^Mac/i)?"Cmd":"Alt";Kr()&&console.info(`Debugging hotkey: Shift+${t}+D (when application has focus)`),document.addEventListener("keydown",(e=>{e.shiftKey&&(e.metaKey||e.altKey)&&"KeyD"===e.code&&(qr||Jr?navigator.userAgent.includes("Firefox")?async function(){const e=await fetch(`_framework/debug?url=${encodeURIComponent(location.href)}&isFirefox=true`);200!==e.status&&console.warn(await e.text())}():Br?function(){const e=document.createElement("a");e.href=`_framework/debug?url=${encodeURIComponent(location.href)}`,e.target="_blank",e.rel="noopener noreferrer",e.click()}():console.error("Currently, only Microsoft Edge (80+), Google Chrome, or Chromium, are supported for debugging."):console.error("Cannot start debugging, because the application was not compiled with debugging enabled."))}))}(h),tt._internal.dotNetCriticalError=ro,tt._internal.loadLazyAssembly=e=>async function(e,t){const n=e.bootConfig.resources,r=n.lazyAssembly;if(!r)throw new Error("No assemblies have been marked as lazy-loadable. Use the 'BlazorWebAssemblyLazyLoad' item group in your project file to enable lazy loading an assembly.");if(!r.hasOwnProperty(t))throw new Error(`${t} must be marked with 'BlazorWebAssemblyLazyLoad' item group in your project file to allow lazy-loading.`);const o=t,i=function(e,t){const n=e.lastIndexOf(".");if(n<0)throw new Error(`No extension to replace in '${e}'`);return e.substr(0,n)+".pdb"}(t),s=Kr()&&n.pdb&&r.hasOwnProperty(i),a=e.loadResource(o,`_framework/${o}`,r[o],"assembly").response.then((e=>e.arrayBuffer()));if(s){const t=await e.loadResource(i,`_framework/${i}`,r[i],"pdb").response.then((e=>e.arrayBuffer())),[n,o]=await Promise.all([a,t]);return{dll:new Uint8Array(n),pdb:new Uint8Array(o)}}{const e=await a;return{dll:new Uint8Array(e),pdb:null}}}(Wr.resourceLoader,e),tt._internal.loadSatelliteAssemblies=(e,t)=>async function(e,t,n){const r=e.bootConfig.resources.satelliteResources;r&&await Promise.all(t.filter((e=>r.hasOwnProperty(e))).map((t=>e.loadResources(r[t],(e=>`_framework/${e}`),"assembly"))).reduce(((e,t)=>e.concat(t)),new Array).map((async e=>{const t=await e.response,r=await t.arrayBuffer(),o={dll:new Uint8Array(r)};n(o)})))}(h,e,t),c("blazor-internal",{Blazor:{_internal:tt._internal}});const d=await zr.getAssemblyExports("Microsoft.AspNetCore.Components.WebAssembly");return Object.assign(tt._internal,{dotNetExports:{...d.Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime}}),jr=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{if(io(),!r&&!t)throw new Error("Either assemblyName or dotNetObjectId must have a non null value.");const i=r?r.toString():t;tt._internal.dotNetExports.BeginInvokeDotNet(e?e.toString():null,i,n,o)},endInvokeJSFromDotNet:(e,t,n)=>{tt._internal.dotNetExports.EndInvokeJS(n)},sendByteArray:(e,t)=>{tt._internal.dotNetExports.ReceiveByteArrayFromJS(e,t)},invokeDotNetFromJS:(e,t,n,r)=>(io(),tt._internal.dotNetExports.InvokeDotNet(e||null,t,null!=n?n:0,r))}),n}(t)},callEntryPoint:async function(e){try{await zr.runMain(e,[])}catch(e){console.error(e),jn()}},toUint8Array:function(e){const t=oo(e),n=Qr(t),r=new Uint8Array(n);return r.set(Hr.HEAPU8.subarray(t+4,t+4+n)),r},getArrayLength:function(e){return Qr(oo(e))},getArrayEntryPtr:function(e,t,n){return oo(e)+4+t*n},getObjectFieldsBaseAddress:function(e){return e+8},readInt16Field:function(e,t){return n=e+(t||0),$r.getI16(n);var n},readInt32Field:function(e,t){return Qr(e+(t||0))},readUint64Field:function(e,t){return function(e){const t=e>>2,n=Hr.HEAPU32[t+1];if(n>Xr)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Vr+Hr.HEAPU32[t]}(e+(t||0))},readFloatField:function(e,t){return n=e+(t||0),$r.getF32(n);var n},readObjectField:function(e,t){return Qr(e+(t||0))},readStringField:function(e,t,n){const r=Qr(e+(t||0));if(0===r)return null;if(n){const e=Fr.unbox_mono_obj(r);return"boolean"==typeof e?e?"":null:e}return Fr.conv_string(r)},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return io(),Gr=so.create(),Gr},invokeWhenHeapUnlocked:function(e){Gr?Gr.enqueuePostReleaseAction(e):e()}};function eo(e,t){const n=e/t*100;document.documentElement.style.setProperty("--blazor-load-percentage",`${n}%`),document.documentElement.style.setProperty("--blazor-load-percentage-text",`"${Math.floor(n)}%"`)}const to=["DEBUGGING ENABLED"],no=e=>to.indexOf(e)<0&&console.log(e),ro=e=>{console.error(e||"(null)"),jn()};function oo(e){return e+12}function io(){if(Gr)throw new Error("Assertion failed - heap is currently locked")}class so{enqueuePostReleaseAction(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)}release(){var e;if(Gr!==this)throw new Error("Trying to release a lock which isn't current");for(Wr.mono_wasm_gc_unlock(),Gr=null;null===(e=this.postReleaseActions)||void 0===e?void 0:e.length;)this.postReleaseActions.shift()(),io()}static create(){return Wr.mono_wasm_gc_lock(),new so}}class ao{constructor(e){this.batchAddress=e,this.arrayRangeReader=co,this.arrayBuilderSegmentReader=lo,this.diffReader=ho,this.editReader=uo,this.frameReader=po}updatedComponents(){return Dr.readStructField(this.batchAddress,0)}referenceFrames(){return Dr.readStructField(this.batchAddress,co.structLength)}disposedComponentIds(){return Dr.readStructField(this.batchAddress,2*co.structLength)}disposedEventHandlerIds(){return Dr.readStructField(this.batchAddress,3*co.structLength)}updatedComponentsEntry(e,t){return fo(e,t,ho.structLength)}referenceFramesEntry(e,t){return fo(e,t,po.structLength)}disposedComponentIdsEntry(e,t){const n=fo(e,t,4);return Dr.readInt32Field(n)}disposedEventHandlerIdsEntry(e,t){const n=fo(e,t,8);return Dr.readUint64Field(n)}}const co={structLength:8,values:e=>Dr.readObjectField(e,0),count:e=>Dr.readInt32Field(e,4)},lo={structLength:12,values:e=>{const t=Dr.readObjectField(e,0),n=Dr.getObjectFieldsBaseAddress(t);return Dr.readObjectField(n,0)},offset:e=>Dr.readInt32Field(e,4),count:e=>Dr.readInt32Field(e,8)},ho={structLength:4+lo.structLength,componentId:e=>Dr.readInt32Field(e,0),edits:e=>Dr.readStructField(e,4),editsEntry:(e,t)=>fo(e,t,uo.structLength)},uo={structLength:20,editType:e=>Dr.readInt32Field(e,0),siblingIndex:e=>Dr.readInt32Field(e,4),newTreeIndex:e=>Dr.readInt32Field(e,8),moveToSiblingIndex:e=>Dr.readInt32Field(e,8),removedAttributeName:e=>Dr.readStringField(e,16)},po={structLength:36,frameType:e=>Dr.readInt16Field(e,4),subtreeLength:e=>Dr.readInt32Field(e,8),elementReferenceCaptureId:e=>Dr.readStringField(e,16),componentId:e=>Dr.readInt32Field(e,12),elementName:e=>Dr.readStringField(e,16),textContent:e=>Dr.readStringField(e,16),markupContent:e=>Dr.readStringField(e,16),attributeName:e=>Dr.readStringField(e,16),attributeValue:e=>Dr.readStringField(e,24,!0),attributeEventHandlerId:e=>Dr.readUint64Field(e,8)};function fo(e,t,n){return Dr.getArrayEntryPtr(e,t,n)}class go{constructor(e){this.preregisteredComponents=e;const t={};for(let n=0;n=n&&s>=r&&o(e.item(i),t.item(s))===Eo.None;)i--,s--,a++;return a}(e,t,r,r,n),i=function(e){var t;const n=[];let r=e.length-1,o=(null===(t=e[r])||void 0===t?void 0:t.length)-1;for(;r>0||o>0;){const t=0===r?So.Insert:0===o?So.Delete:e[r][o];switch(n.unshift(t),t){case So.Keep:case So.Update:r--,o--;break;case So.Insert:o--;break;case So.Delete:r--}}return n}(function(e,t,n){const r=[],o=[],i=e.length,s=t.length;if(0===i&&0===s)return[];for(let e=0;e<=i;e++)(r[e]=Array(s+1))[0]=e,o[e]=Array(s+1);const a=r[0];for(let e=1;e<=s;e++)a[e]=e;for(let a=1;a<=i;a++)for(let i=1;i<=s;i++){const s=n(e.item(a-1),t.item(i-1)),c=r[a-1][i]+1,l=r[a][i-1]+1;let h;switch(s){case Eo.None:h=r[a-1][i-1];break;case Eo.Some:h=r[a-1][i-1]+1;break;case Eo.Infinite:h=Number.MAX_VALUE}h{this.childNodes.forEach((e=>{if(e instanceof HTMLTemplateElement){const t=e.getAttribute("blazor-component-id");t&&function(e,t){const n=function(e){const t=`bl:${e}`,n=document.createNodeIterator(document,NodeFilter.SHOW_COMMENT);let r=null;for(;(r=n.nextNode())&&r.textContent!==t;);if(!r)return null;const o=`/bl:${e}`;let i=null;for(;(i=n.nextNode())&&i.textContent!==o;);return i?{startMarker:r,endMarker:i}:null}(e);if(n)if(No)Io({startExclusive:n.startMarker,endExclusive:n.endMarker},t);else{const{startMarker:e,endMarker:r}=n,o=new Range;for(o.setStart(e,e.textContent.length),o.setEnd(r,0),o.deleteContents();t.childNodes[0];)r.parentNode.insertBefore(t.childNodes[0],r)}}(t,e.content)}}))}))}}let Ro=!1;async function Po(t){if(Ro)throw new Error("Blazor has already started.");Ro=!0,await async function(t){const n=pr(document,"server"),r=pr(document,"webassembly");n.length&&await async function(t,n){const r=function(e){const t={...cr,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...cr.reconnectionOptions,...e.reconnectionOptions}),t}(t),o=await async function(e){const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),r=new Cr;return await r.importInitializersAsync(n,[e]),r}(r),i=new sr(r.logLevel);tt.reconnect=async e=>{if(xr)return!1;const t=e||await Nr(r,i,kr);return await kr.reconnect(t)?(r.reconnectionHandler.onConnectionUp(),!0):(i.log(rr.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)},tt.defaultReconnectionHandler=new dr(i),r.reconnectionHandler=r.reconnectionHandler||tt.defaultReconnectionHandler,i.log(rr.Information,"Starting up Blazor server-side application.");const s=gr(document);kr=new ar(n||[],s||""),tt._internal.navigationManager.listenForNavigationEvents(((e,t,n)=>Ir.send("OnLocationChanged",e,t,n)),((e,t,n,r)=>Ir.send("OnLocationChanging",e,t,n,r))),tt._internal.forceCloseConnection=()=>Ir.stop(),tt._internal.sendJSDataStream=(e,t,n)=>function(e,t,n,r){setTimeout((async()=>{let o=5,i=(new Date).valueOf();try{const s=t instanceof Blob?t.size:t.byteLength;let a=0,c=0;for(;a1)await e.send("ReceiveJSDataChunk",n,c,h,null);else{if(!await e.invoke("ReceiveJSDataChunk",n,c,h,null))break;const t=(new Date).valueOf(),r=t-i;i=t,o=Math.max(1,Math.round(500/Math.max(1,r)))}a+=l,c++}}catch(t){await e.send("ReceiveJSDataChunk",n,-1,null,t.toString())}}),0)}(Ir,e,t,n),Tr=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{Ir.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,r||0,o)},endInvokeJSFromDotNet:(e,t,n)=>{Ir.send("EndInvokeJSFromDotNet",e,t,n)},sendByteArray:(e,t)=>{Ir.send("ReceiveByteArray",e,t)}});const a=await Nr(r,i,kr);if(!await kr.startCircuit(a))return void i.log(rr.Error,"Failed to start the circuit.");let c=!1;const l=()=>{if(!c){const e=new FormData,t=kr.circuitId;e.append("circuitId",t),c=navigator.sendBeacon("_blazor/disconnect",e)}};tt.disconnect=l,window.addEventListener("unload",l,{capture:!1,once:!0}),i.log(rr.Information,"Blazor server-side application started."),o.invokeAfterStartedCallbacks(tt)}(null==t?void 0:t.circuit,n),r.length&&await async function(e,t){(function(){if(window.parent!==window&&!window.opener&&window.frameElement){const e=window.sessionStorage&&window.sessionStorage["Microsoft.AspNetCore.Components.WebAssembly.Authentication.CachedAuthSettings"],t=e&&JSON.parse(e);return t&&t.redirect_uri&&location.href.startsWith(t.redirect_uri)}return!1})()&&await new Promise((()=>{})),function(e){const t=D;D=(e,n,r)=>{((e,t,n)=>{const r=function(e){return me[e]}(e);r.eventDelegator.getHandler(t)&&Zr.invokeWhenHeapUnlocked(n)})(e,n,(()=>t(e,n,r)))}}(),tt._internal.applyHotReload=(e,t,n,r)=>{jr.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDelta",e,t,n,r)},tt._internal.getApplyUpdateCapabilities=()=>jr.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","GetApplyUpdateCapabilities"),tt._internal.invokeJSFromDotNet=mo,tt._internal.invokeJSJson=yo,tt._internal.endInvokeDotNetFromJS=wo,tt._internal.receiveWebAssemblyDotNetDataStream=vo,tt._internal.receiveByteArray=bo;const n=Rr(Zr);tt.platform=n,tt._internal.renderBatch=(e,t)=>{const n=Zr.beginHeapLock();try{ve(e,new ao(t))}finally{n.release()}},tt._internal.navigationManager.listenForNavigationEvents((async(e,t,n)=>{await jr.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t,n)}),(async(e,t,n,r)=>{const o=await jr.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChangingAsync",t,n,r);tt._internal.navigationManager.endLocationChanging(e,o)}));const r=new go(t||[]);let o,i;tt._internal.registeredComponents={getRegisteredComponentsCount:()=>r.getCount(),getId:e=>r.getId(e),getAssembly:e=>r.getAssembly(e),getTypeName:e=>r.getTypeName(e),getParameterDefinitions:e=>r.getParameterDefinitions(e)||"",getParameterValues:e=>r.getParameterValues(e)||""},tt._internal.getPersistedState=()=>gr(document)||"",tt._internal.attachRootComponentToElement=(e,t,n)=>{const o=r.resolveRegisteredElement(e);o?we(n,o,t,!1):function(e,t,n){const r="::before";let o=!1;if(e.endsWith("::after"))e=e.slice(0,-7),o=!0;else if(e.endsWith(r))throw new Error(`The '${r}' selector is not supported.`);const i=v(e)||document.querySelector(e);if(!i)throw new Error(`Could not find any element matching selector '${e}'.`);we(n||0,$(i,!0),t,o)}(e,t,n)};try{const t=await n.start(null!=e?e:{});o=t.resourceLoader,i=t.jsInitializer}catch(e){throw new Error(`Failed to start platform. Reason: ${e}`)}n.callEntryPoint(o.bootConfig.entryAssembly),i.invokeAfterStartedCallbacks(tt)}(null==t?void 0:t.webAssembly,r)}(t),function(e){(null==e?void 0:e.disableDomPreservation)&&(No=!1),customElements.define("blazor-ssr",Ao)}(null==t?void 0:t.ssr)}tt.start=Po,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&Po()})(); \ 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){const t=[],n="__jsObjectId",r="__dotNetObject",o="__byte[]",i="__dotNetStream",s="__jsStreamReferenceLength";let a,c;class l{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 h={0:new l(window)};h[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let d,u=1;function p(e){t.push(e)}function f(e){if(e&&"object"==typeof e){h[u]=new l(e);const t={[n]: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 r={[s]:t};try{const t=f(e);r[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return r}function m(e,n){c=e;const r=n?JSON.parse(n,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null;return c=void 0,r}function y(){if(void 0===a)throw new Error("No call dispatcher has been set.");if(null===a)throw new Error("There are multiple .NET runtimes present, so a default dispatcher could not be resolved. Use DotNetObject to invoke .NET instance methods.");return a}e.attachDispatcher=function(e){const t=new w(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=p,e.invokeMethod=function(e,t,...n){return y().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return y().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=f,e.createJSStreamReference=g,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&_(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(d=e.JSCallResultType||(e.JSCallResultType={}));class w{constructor(e){this._dotNetCallDispatcher=e,this._byteArraysToBeRevived=new Map,this._pendingDotNetToJSStreams=new Map,this._pendingAsyncCalls={},this._nextAsyncCallId=1}getDotNetCallDispatcher(){return this._dotNetCallDispatcher}invokeJSFromDotNet(e,t,n,r){const o=m(this,t),i=I(b(e,r)(...o||[]),n);return null==i?null:T(this,i)}beginInvokeJSFromDotNet(e,t,n,r,o){const i=new Promise((e=>{const r=m(this,n);e(b(t,o)(...r||[]))}));e&&i.then((t=>T(this,[e,!0,I(t,r)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,v(t)]))))}endInvokeDotNetFromJS(e,t,n){const r=t?m(this,n):new Error(n);this.completePendingCall(parseInt(e,10),t,r)}invokeDotNetStaticMethod(e,t,...n){return this.invokeDotNetMethod(e,t,null,n)}invokeDotNetStaticMethodAsync(e,t,...n){return this.invokeDotNetMethodAsync(e,t,null,n)}invokeDotNetMethod(e,t,n,r){if(this._dotNetCallDispatcher.invokeDotNetFromJS){const o=T(this,r),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,o);return i?m(this,i):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeDotNetMethodAsync instead.")}invokeDotNetMethodAsync(e,t,n,r){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const o=this._nextAsyncCallId++,i=new Promise(((e,t)=>{this._pendingAsyncCalls[o]={resolve:e,reject:t}}));try{const i=T(this,r);this._dotNetCallDispatcher.beginInvokeDotNetFromJS(o,e,t,n,i)}catch(e){this.completePendingCall(o,!1,e)}return i}receiveByteArray(e,t){this._byteArraysToBeRevived.set(e,t)}processByteArray(e){const t=this._byteArraysToBeRevived.get(e);return t?(this._byteArraysToBeRevived.delete(e),t):null}supplyDotNetStream(e,t){if(this._pendingDotNetToJSStreams.has(e)){const n=this._pendingDotNetToJSStreams.get(e);this._pendingDotNetToJSStreams.delete(e),n.resolve(t)}else{const n=new C;n.resolve(t),this._pendingDotNetToJSStreams.set(e,n)}}getDotNetStreamPromise(e){let t;if(this._pendingDotNetToJSStreams.has(e))t=this._pendingDotNetToJSStreams.get(e).streamPromise,this._pendingDotNetToJSStreams.delete(e);else{const n=new C;this._pendingDotNetToJSStreams.set(e,n),t=n.streamPromise}return t}completePendingCall(e,t,n){if(!this._pendingAsyncCalls.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const r=this._pendingAsyncCalls[e];delete this._pendingAsyncCalls[e],t?r.resolve(n):r.reject(n)}}function v(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function b(e,t){const n=h[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function _(e){delete h[e]}e.findJSFunction=b,e.disposeJSObjectReferenceById=_;class E{constructor(e,t){this._id=e,this._callDispatcher=t}invokeMethod(e,...t){return this._callDispatcher.invokeDotNetMethod(null,e,this._id,t)}invokeMethodAsync(e,...t){return this._callDispatcher.invokeDotNetMethodAsync(null,e,this._id,t)}dispose(){this._callDispatcher.invokeDotNetMethodAsync(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{[r]:this._id}}}e.DotNetObject=E,p((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(r))return new E(t[r],c);if(t.hasOwnProperty(n)){const e=t[n],r=h[e];if(r)return r.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(o)){const e=t[o],n=c.processByteArray(e);if(void 0===n)throw new Error(`Byte array index '${e}' does not exist.`);return n}if(t.hasOwnProperty(i)){const e=t[i],n=c.getDotNetStreamPromise(e);return new S(n)}}return t}));class S{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class C{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function I(e,t){switch(t){case d.Default:return e;case d.JSObjectReference:return f(e);case d.JSStreamReference:return g(e);case d.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let k=0;function T(e,t){k=0,c=e;const n=JSON.stringify(t,x);return c=void 0,n}function x(e,t){if(t instanceof E)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(k,t);const e={[o]:k};return k++,e}return t}}(e||(e={})),function(e){e[e.prependFrame=1]="prependFrame",e[e.removeFrame=2]="removeFrame",e[e.setAttribute=3]="setAttribute",e[e.removeAttribute=4]="removeAttribute",e[e.updateText=5]="updateText",e[e.stepIn=6]="stepIn",e[e.stepOut=7]="stepOut",e[e.updateMarkup=8]="updateMarkup",e[e.permutationListEntry=9]="permutationListEntry",e[e.permutationListEnd=10]="permutationListEnd"}(t||(t={})),function(e){e[e.element=1]="element",e[e.text=2]="text",e[e.attribute=3]="attribute",e[e.component=4]="component",e[e.region=5]="region",e[e.elementReferenceCapture=6]="elementReferenceCapture",e[e.markup=8]="markup"}(n||(n={}));class o{constructor(e,t){this.componentId=e,this.fieldValue=t}static fromEvent(e,t){const n=t.target;if(n instanceof Element){const t=function(e){return e instanceof HTMLInputElement?e.type&&"checkbox"===e.type.toLowerCase()?{value:e.checked}:{value:e.value}:e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement?{value:e.value}:null}(n);if(t)return new o(e,t.value)}return null}}const i=new Map,s=new Map,a=[];function c(e){return i.get(e)}function l(e){const t=i.get(e);return(null==t?void 0:t.browserEventName)||e}function h(e,t){e.forEach((e=>i.set(e,t)))}function d(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}{const e=function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t);return{value:e?!!t.checked:t.value}}}}),h(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),h(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...u(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),h(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),h(["keydown","keyup","keypress"],{createEventArgs:e=>{return{key:(t=e).key,code:t.code,location:t.location,repeat:t.repeat,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),h(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>u(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: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}}),h(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...u(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{...u(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 E().invokeMethodAsync("AddRootComponent",t,r),i=new _(o,m[t]);return await i.setParameters(n),i}};function v(e){const t=f.get(e);if(t)return f.delete(e),t}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(!g)throw new Error("Dynamic root components have not been enabled in this application.");return g}const S=[];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[e];if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let x=(e,t,n)=>n();const D=M(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),N={submit:!0},A=M(["click","dblclick","mousedown","mousemove","mouseup"]);class R{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++R.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new P(this.onGlobalEvent.bind(this))}setListener(e,t,n,r){const o=this.getEventHandlerInfosForElement(e,!0),i=o.getHandler(t);if(i)this.eventInfoStore.update(i.eventHandlerId,n);else{const i={element:e,eventName:t,eventHandlerId:n,renderingComponentId:r};this.eventInfoStore.add(i),o.setHandler(t,i)}}getHandler(e){return this.eventInfoStore.get(e)}removeListener(e){const t=this.eventInfoStore.remove(e);if(t){const e=t.element,n=this.getEventHandlerInfosForElement(e,!1);n&&n.removeHandler(t.eventName)}}notifyAfterClick(e){this.afterClickCallbacks.push(e),this.eventInfoStore.addGlobalListener("click")}setStopPropagation(e,t,n){this.getEventHandlerInfosForElement(e,!0).stopPropagation(t,n)}setPreventDefault(e,t,n){this.getEventHandlerInfosForElement(e,!0).preventDefault(t,n)}onGlobalEvent(e){if(!(e.target instanceof Element))return;this.dispatchGlobalEventToAllElements(e.type,e);const t=(n=e.type,s.get(n));var n;t&&t.forEach((t=>this.dispatchGlobalEventToAllElements(t,e))),"click"===e.type&&this.afterClickCallbacks.forEach((t=>t(e)))}dispatchGlobalEventToAllElements(e,t){const n=t.composedPath();let r=n.shift(),i=null,s=!1;const a=Object.prototype.hasOwnProperty.call(D,e);let l=!1;for(;r;){const u=r,p=this.getEventHandlerInfosForElement(u,!1);if(p){const n=p.getHandler(e);if(n&&(h=u,d=t.type,!((h instanceof HTMLButtonElement||h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(A,d)&&h.disabled))){if(!s){const n=c(e);i=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(N,t.type)&&t.preventDefault(),k(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},i)}p.stopPropagation(e)&&(l=!0),p.preventDefault(e)&&t.preventDefault()}r=a||l?void 0:n.shift()}var h,d}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new U:null}}R.nextEventDelegatorId=0;class P{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},a.push(this.handleEventNameAliasAdded.bind(this))}add(e){if(this.infosByEventHandlerId[e.eventHandlerId])throw new Error(`Event ${e.eventHandlerId} is already tracked`);this.infosByEventHandlerId[e.eventHandlerId]=e,this.addGlobalListener(e.eventName)}get(e){return this.infosByEventHandlerId[e]}addGlobalListener(e){if(e=l(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(D,e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(Object.prototype.hasOwnProperty.call(this.infosByEventHandlerId,t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=l(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(Object.prototype.hasOwnProperty.call(this.countByEventName,e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class U{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return Object.prototype.hasOwnProperty.call(this.handlers,e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function M(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const L=Z("_blazorLogicalChildren"),B=Z("_blazorLogicalParent"),O=Z("_blazorLogicalEnd");function F(e,t){if(!e.parentNode)throw new Error(`Comment not connected to the DOM ${e.textContent}`);const n=e.parentNode,r=$(n,!0),o=K(r);return Array.from(n.childNodes).forEach((e=>o.push(e))),e[B]=r,t&&(e[O]=t,$(t)),$(e)}function $(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 j(n,e,t),n}function j(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(z(r))throw new Error("Not implemented: moving existing logical children");const o=K(t);if(n0;)W(n,0)}const r=n;r.parentNode.removeChild(r)}function z(e){return e[B]||null}function J(e,t){return K(e)[t]}function q(e){const t=X(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=Q(e.moveRangeStart)})),t.forEach((t=>{const r=document.createComment("marker");t.moveToBeforeMarker=r;const o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):Y(r,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd;let i=r;for(;i;){const e=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=e}n.removeChild(t)})),t.forEach((e=>{n[e.toSiblingIndex]=e.moveRangeStart}))}function X(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 G(e){const t=K(z(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=G(t);n?n.parentNode.insertBefore(e,n):Y(e,z(t))}}}function Q(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=G(e);if(t)return t.previousSibling;{const t=z(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:Q(t)}}function Z(e){return"function"==typeof Symbol?Symbol():e}function ee(e){return`_bl_${e}`}const te="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,te)&&"string"==typeof t[te]?function(e){const t=`[${ee(e)}]`;return document.querySelector(t)}(t[te]):t));const ne="_blazorDeferredValue";function re(e,t,n){switch(t){case"value":return function(e,t){switch(t&&"INPUT"===e.tagName&&(t=function(e,t){switch(t.getAttribute("type")){case"time":return 8!==e.length||!e.endsWith("00")&&t.hasAttribute("step")?e:e.substring(0,5);case"datetime-local":return 19!==e.length||!e.endsWith("00")&&t.hasAttribute("step")?e:e.substring(0,16);default:return e}}(t,e)),e.tagName){case"INPUT":case"SELECT":case"TEXTAREA":return t&&e instanceof HTMLSelectElement&&se(e)&&(t=JSON.parse(t)),ce(e,t),e[ne]=t,!0;case"OPTION":return t||""===t?e.setAttribute("value",t):e.removeAttribute("value"),le(e),!0;default:return!1}}(e,n);case"checked":return function(e,t){return"INPUT"===e.tagName&&(e.checked=null!==t,!0)}(e,n);default:return!1}}function oe(e){switch(e.name){case"value":{const t=e.ownerElement;switch(t.tagName){case"INPUT":case"SELECT":case"TEXTAREA":return t.value}break}case"checked":{const t=e.ownerElement;if("INPUT"===t.tagName){const e=t;return e.checked?e.value:""}break}}return e.value}function ie(e){e instanceof HTMLOptionElement?le(e):ne in e&&ce(e,e[ne])}function se(e){return"select-multiple"===e.type}function ae(e,t){e.value=t||""}function ce(e,t){e instanceof HTMLSelectElement?se(e)?function(e,t){t||(t=[]);for(let n=0;n{ke()&&Ee(e,(e=>{Oe(e,!0,!1)}))}))}attachRootComponentToLogicalElement(e,t,n){this.attachComponentToElement(e,t),this.rootComponentIds.add(e),n||(ue[e]=t)}updateComponent(e,t,n,r){var o;const i=this.childComponentLocations[t];if(!i)throw new Error(`No element is currently associated with component ${t}`);const s=ue[t];if(s){const e=function(e){return e[O]||null}(s);delete ue[t],e?function(e,t){const n=z(e);if(!n)throw new Error("Can't clear between nodes. The start node does not have a logical parent.");const r=K(n),o=r.indexOf(e)+1,i=r.indexOf(t);for(let e=o;e<=i;e++)W(n,o);e.textContent="!"}(s,e):function(e){let t;for(;t=e.firstChild;)e.removeChild(t)}(s)}const a=null===(o=X(i))||void 0===o?void 0:o.getRootNode(),c=a&&a.activeElement;this.applyEdits(e,t,i,0,n,r),c instanceof HTMLElement&&a&&a.activeElement!==c&&c.focus()}disposeComponent(e){this.rootComponentIds.delete(e)&&function(e){const t=K(e);for(;t.length;)W(e,0)}(this.childComponentLocations[e]),delete this.childComponentLocations[e]}disposeEventHandler(e){this.eventDelegator.removeListener(e)}attachComponentToElement(e,t){this.childComponentLocations[e]=t}applyEdits(e,n,r,o,i,s){let a,c=0,l=o;const h=e.arrayBuilderSegmentReader,d=e.editReader,u=e.frameReader,p=h.values(i),f=h.offset(i),g=f+h.count(i);for(let i=f;idocument.baseURI,getLocationHref:()=>location.href,scrollToElement:Le};function Le(e){const t=document.getElementById(e);return!!t&&(t.scrollIntoView(),!0)}function Be(e,t,n=!1){const r=Ce(e);!t.forceLoad&&Se(r)?Oe(r,!1,t.replaceHistoryEntry,t.historyEntryState,n):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Oe(e,t,n,r=void 0,o=!1){if(He(),function(e){const t=e.indexOf("#");return t>-1&&location.href.replace(location.hash,"")===e.substring(0,t)}(e))!function(e,t,n){Fe(e,t,n);const r=e.indexOf("#");r!==e.length-1&&Le(e.substring(r+1))}(e,n,r);else{if(!o&&xe&&!await je(e,r,t))return;ye=!0,Fe(e,n,r),await We(t)}}function Fe(e,t,n=void 0){t?history.replaceState({userState:n,_index:De},"",e):(De++,history.pushState({userState:n,_index:De},"",e))}function $e(e){return new Promise((t=>{const n=Pe;Pe=()=>{Pe=n,t()},history.go(e)}))}function He(){Ue&&(Ue(!1),Ue=null)}function je(e,t,n){return new Promise((r=>{He(),Re?(Ne++,Ue=r,Re(Ne,e,t,n)):r(!1)}))}async function We(e){var t;Ae&&await Ae(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function ze(e){var t,n;Pe&&await Pe(e),De=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}const Je={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,t){const n=document.querySelector(e);n&&(n.hasAttribute("tabindex")||(n.tabIndex=-1),n.focus({preventScroll:!0}))}},qe={init:function(e,t,n,r=50){const o=Ve(t);(o||document.documentElement).style.overflowAnchor="none";const i=document.createRange();h(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(r){r.forEach((r=>{var o;if(!r.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const s=i.getBoundingClientRect().height,a=null===(o=r.rootBounds)||void 0===o?void 0:o.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,s,a):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,s,a)}))}),{root:o,rootMargin:`${r}px`});s.observe(t),s.observe(n);const a=l(t),c=l(n);function l(e){const t={attributes:!0},n=new MutationObserver(((n,r)=>{h(e.parentElement)&&(r.disconnect(),e.style.display="table-row",r.observe(e,t)),s.unobserve(e),s.observe(e)}));return n.observe(e,t),n}function h(e){return null!==e&&(e instanceof HTMLTableElement&&""===e.style.display||"table"===e.style.display||e instanceof HTMLTableSectionElement&&""===e.style.display||"table-row-group"===e.style.display)}Ke[e._id]={intersectionObserver:s,mutationObserverBefore:a,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 Ve(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:Ve(e.parentElement):null}const Xe={getAndRemoveExistingTitle:function(){var e;const t=document.head?document.head.getElementsByTagName("title"):[];if(0===t.length)return null;let n=null;for(let r=t.length-1;r>=0;r--){const o=t[r],i=o.previousSibling;i instanceof Comment&&null!==z(i)||(null===n&&(n=o.textContent),null===(e=o.parentNode)||void 0===e||e.removeChild(o))}return n}},Ge={init:function(e,t){t._blazorInputFileNextFileId=0,t.addEventListener("click",(function(){t.value=""})),t.addEventListener("change",(function(){t._blazorFilesById={};const n=Array.prototype.map.call(t.files,(function(e){const n={id:++t._blazorInputFileNextFileId,lastModified:new Date(e.lastModified).toISOString(),name:e.name,size:e.size,contentType:e.type,readPromise:void 0,arrayBuffer:void 0,blob:e};return t._blazorFilesById[n.id]=n,n}));e.invokeMethodAsync("NotifyChange",n)}))},toImageFile:async function(e,t,n,r,o){const i=Ye(e,t),s=await new Promise((function(e){const t=new Image;t.onload=function(){URL.revokeObjectURL(t.src),e(t)},t.onerror=function(){t.onerror=null,URL.revokeObjectURL(t.src)},t.src=URL.createObjectURL(i.blob)})),a=await new Promise((function(e){var t;const i=Math.min(1,r/s.width),a=Math.min(1,o/s.height),c=Math.min(i,a),l=document.createElement("canvas");l.width=Math.round(s.width*c),l.height=Math.round(s.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(s,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return Ye(e,t).blob}};function Ye(e,t){const n=e._blazorFilesById[t];if(!n)throw new Error(`There is no file with ID ${t}. The file list may have changed. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.`);return n}const Qe=new Set,Ze={enableNavigationPrompt:function(e){0===Qe.size&&window.addEventListener("beforeunload",et),Qe.add(e)},disableNavigationPrompt:function(e){Qe.delete(e),0===Qe.size&&window.removeEventListener("beforeunload",et)}};function et(e){e.preventDefault(),e.returnValue=!0}async function tt(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 nt=new Map,rt={navigateTo:function(e,t,n=!1){Be(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(i.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=s.get(t.browserEventName);n?n.push(e):s.set(t.browserEventName,[e]),a.forEach((n=>n(e,t.browserEventName)))}i.set(e,t)},rootComponents:w,_internal:{navigationManager:Me,domWrapper:Je,Virtualize:qe,PageTitle:Xe,InputFile:Ge,NavigationLock:Ze,getJSDataStreamChunk:tt,attachWebRendererInterop:function(t,n,r){const o=S.length;return S.push(t),Object.keys(n).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.findJSFunction(t,0);for(const e of o)r(e,n[e])}}(T(o),n,r),C(),o}}};window.Blazor=rt;const ot=[0,2e3,1e4,3e4,null];class it{constructor(e){this._retryDelays=void 0!==e?[...e,null]:ot}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class st{}st.Authorization="Authorization",st.Cookie="Cookie";class at{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class ct{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}class lt extends ct{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&401===n.statusCode&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[st.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[st.Authorization]&&delete e.headers[st.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}class ht extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class dt extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class ut extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class pt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class ft extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class gt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class mt extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class yt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}var wt;!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"}(wt||(wt={}));class vt{constructor(){}log(e,t){}}vt.instance=new vt;const bt="0.0.0-DEV_BUILD";class _t{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&&"object"==typeof window.document}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isReactNative(){return"object"==typeof window&&void 0===window.document}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}}function St(e,t){let n="";return Ct(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 Ct(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function It(e,t,n,r,o,i){const s={},[a,c]=xt();s[a]=c,e.log(wt.Trace,`(${t} transport) sending data. ${St(o,i.logMessageContent)}.`);const l=Ct(o)?"arraybuffer":"text",h=await n.post(r,{content:o,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(wt.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class kt{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 Tt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${wt[e]}: ${t}`;switch(e){case wt.Critical:case wt.Error:this.out.error(n);break;case wt.Warning:this.out.warn(n);break;case wt.Information:this.out.info(n);break;default:this.out.log(n)}}}}function xt(){let e="X-SignalR-User-Agent";return Et.isNode&&(e="User-Agent"),[e,Dt(bt,Nt(),Et.isNode?"NodeJS":"Browser",At())]}function Dt(e,t,n,r){let o="Microsoft SignalR/";const i=e.split(".");return o+=`${i[0]}.${i[1]}`,o+=` (${e}; `,o+=t&&""!==t?`${t}; `:"Unknown OS; ",o+=`${n}`,o+=r?`; ${r}`:"; Unknown Runtime Version",o+=")",o}function Nt(){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 At(){if(Et.isNode)return process.versions.node}function Rt(e){return e.stack?e.stack:e.message?e.message:`${e}`}class Pt extends ct{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e=require;this._jar=new(e("tough-cookie").CookieJar),"undefined"==typeof fetch?this._fetchType=e("node-fetch"):this._fetchType=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 ut;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 ut});let r,o=null;if(e.timeout){const r=e.timeout;o=setTimeout((()=>{t.abort(),this._logger.log(wt.Warning,"Timeout from HTTP request."),n=new dt}),r)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Ct(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");try{r=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:!0===e.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(e){if(n)throw n;throw this._logger.log(wt.Warning,`Error from HTTP request. ${e}.`),e}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!r.ok){const e=await Ut(r,"text");throw new ht(e||r.statusText,r.status)}const i=Ut(r,e.responseType),s=await i;return new at(r.status,r.statusText,s)}getCookieString(e){return""}}function Ut(e,t){let n;switch(t){case"arraybuffer":n=e.arrayBuffer();break;case"text":default:n=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`)}return n}class Mt extends ct{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ut):e.method?e.url?new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),r.withCredentials=void 0===e.withCredentials||e.withCredentials,r.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===e.content&&(e.content=void 0),e.content&&(Ct(e.content)?r.setRequestHeader("Content-Type","application/octet-stream"):r.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach((e=>{r.setRequestHeader(e,o[e])})),e.responseType&&(r.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{r.abort(),n(new ut)}),e.timeout&&(r.timeout=e.timeout),r.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),r.status>=200&&r.status<300?t(new at(r.status,r.statusText,r.response||r.responseText)):n(new ht(r.response||r.responseText||r.statusText,r.status))},r.onerror=()=>{this._logger.log(wt.Warning,`Error from HTTP request. ${r.status}: ${r.statusText}.`),n(new ht(r.statusText,r.status))},r.ontimeout=()=>{this._logger.log(wt.Warning,"Timeout from HTTP request."),n(new dt)},r.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Lt extends ct{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new Pt(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new Mt(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ut):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)}}var Bt,Ot,Ft,$t;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(Bt||(Bt={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Ot||(Ot={}));class Ht{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 jt{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new Ht,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(_t.isRequired(e,"url"),_t.isRequired(t,"transferFormat"),_t.isIn(t,Ot,"transferFormat"),this._url=e,this._logger.log(wt.Trace,"(LongPolling transport) Connecting."),t===Ot.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]=xt(),o={[n]:r,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===Ot.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(wt.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(wt.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new ht(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(wt.Trace,`(LongPolling transport) polling: ${n}.`);const r=await this._httpClient.get(n,t);204===r.statusCode?(this._logger.log(wt.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==r.statusCode?(this._logger.log(wt.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this._closeError=new ht(r.statusText||"",r.statusCode),this._running=!1):r.content?(this._logger.log(wt.Trace,`(LongPolling transport) data received. ${St(r.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this._logger.log(wt.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof dt?this._logger.log(wt.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(wt.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(wt.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?It(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(wt.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(wt.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=xt();e[t]=n;const r={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};await this._httpClient.delete(this._url,r),this._logger.log(wt.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(wt.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(wt.Trace,e),this.onclose(this._closeError)}}}class Wt{constructor(e,t,n,r){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=r,this.onreceive=null,this.onclose=null}async connect(e,t){return _t.isRequired(e,"url"),_t.isRequired(t,"transferFormat"),_t.isIn(t,Ot,"transferFormat"),this._logger.log(wt.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,r)=>{let o,i=!1;if(t===Ot.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,i]=xt();n[r]=i,o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...n,...this._options.headers}})}try{o.onmessage=e=>{if(this.onreceive)try{this._logger.log(wt.Trace,`(SSE transport) data received. ${St(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},o.onerror=e=>{i?this._close():r(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},o.onopen=()=>{this._logger.log(wt.Information,`SSE connected to ${this._url}`),this._eventSource=o,i=!0,n()}}catch(e){return void r(e)}}else r(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(e){return this._eventSource?It(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class zt{constructor(e,t,n,r,o,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=r,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){let n;return _t.isRequired(e,"url"),_t.isRequired(t,"transferFormat"),_t.isIn(t,Ot,"transferFormat"),this._logger.log(wt.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((r,o)=>{let i;e=e.replace(/^http/,"ws");const s=this._httpClient.getCookieString(e);let a=!1;if(Et.isReactNative){const t={},[r,o]=xt();t[r]=o,n&&(t[st.Authorization]=`Bearer ${n}`),s&&(t[st.Cookie]=s),i=new this._webSocketConstructor(e,void 0,{headers:{...t,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===Ot.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(wt.Information,`WebSocket connected to ${e}.`),this._webSocket=i,a=!0,r()},i.onerror=e=>{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"There was an error with the transport",this._logger.log(wt.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(wt.Trace,`(WebSockets transport) data received. ${St(e.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(e.data)}catch(e){return void this._close(e)}},i.onclose=e=>{if(a)this._close(e);else{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(wt.Trace,`(WebSockets transport) sending data. ${St(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(wt.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 Jt{constructor(e,t={}){var n;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,_t.isRequired(e,"url"),this._logger=void 0===(n=t.logger)?new Tt(wt.Information):null===n?vt.instance:void 0!==n.log?n:new Tt(n),this.baseUrl=this._resolveUrl(e),(t=t||{}).logMessageContent=void 0!==t.logMessageContent&&t.logMessageContent,"boolean"!=typeof t.withCredentials&&void 0!==t.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.withCredentials=void 0===t.withCredentials||t.withCredentials,t.timeout=void 0===t.timeout?1e5:t.timeout,"undefined"==typeof WebSocket||t.WebSocket||(t.WebSocket=WebSocket),"undefined"==typeof EventSource||t.EventSource||(t.EventSource=EventSource),this._httpClient=new lt(t.httpClient||new Lt(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Ot.Binary,_t.isIn(e,Ot,"transferFormat"),this._logger.log(wt.Debug,`Starting connection with transfer format '${Ot[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(wt.Error,e),await this._stopPromise,Promise.reject(new ut(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(wt.Error,e),Promise.reject(new ut(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 qt(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(wt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(wt.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(wt.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(wt.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport!==Bt.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(Bt.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 ut("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const e=n.accessToken;this._accessTokenFactory=()=>e,this._httpClient._accessToken=e,this._httpClient._accessTokenFactory=void 0}r++}while(n.url&&r<100);if(100===r&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof jt&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(wt.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(wt.Error,"Failed to start the connection: "+e),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(e)}}async _getNegotiationResponse(e){const t={},[n,r]=xt();t[n]=r;const o=this._resolveNegotiateUrl(e);this._logger.log(wt.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 ht&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(wt.Error,t),Promise.reject(new mt(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(wt.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(o,r),void(this.connectionId=n.connectionId);const i=[],s=n.availableTransports||[];let a=n;for(const n of s){const s=this._resolveTransportOrError(n,t,r);if(s instanceof Error)i.push(`${n.transport} failed:`),i.push(s);else if(this._isITransport(s)){if(this.transport=s,!a){try{a=await this._getNegotiationResponse(e)}catch(e){return Promise.reject(e)}o=this._createConnectUrl(e,a.connectionToken)}try{return await this._startTransport(o,r),void(this.connectionId=a.connectionId)}catch(e){if(this._logger.log(wt.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new gt(`${n.transport} failed: ${e}`,Bt[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(wt.Debug,e),Promise.reject(new ut(e))}}}}return i.length>0?Promise.reject(new yt(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case Bt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new zt(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Bt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Wt(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Bt.LongPolling:return new jt(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n){const r=Bt[e.transport];if(null==r)return this._logger.log(wt.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(wt.Debug,`Skipping transport '${Bt[r]}' because it was disabled by the client.`),new ft(`'${Bt[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>Ot[e])).indexOf(n)>=0))return this._logger.log(wt.Debug,`Skipping transport '${Bt[r]}' because it does not support the requested transfer format '${Ot[n]}'.`),new Error(`'${Bt[r]}' does not support ${Ot[n]}.`);if(r===Bt.WebSockets&&!this._options.WebSocket||r===Bt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(wt.Debug,`Skipping transport '${Bt[r]}' because it is not supported in your environment.'`),new pt(`'${Bt[r]}' is not supported in your environment.`,r);this._logger.log(wt.Debug,`Selecting transport '${Bt[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(wt.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(wt.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(wt.Error,`Connection disconnected with error '${e}'.`):this._logger.log(wt.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(wt.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(wt.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(wt.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)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(wt.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 qt{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Kt,this._transportResult=new Kt,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Kt),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 Kt;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):qt._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 Kt{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class Vt{static write(e){return`${e}${Vt.RecordSeparator}`}static parse(e){if(e[e.length-1]!==Vt.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(Vt.RecordSeparator);return t.pop(),t}}Vt.RecordSeparatorCode=30,Vt.RecordSeparator=String.fromCharCode(Vt.RecordSeparatorCode);class Xt{writeHandshakeRequest(e){return Vt.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Ct(e)){const r=new Uint8Array(e),o=r.indexOf(Vt.RecordSeparatorCode);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(r.slice(0,i))),n=r.byteLength>i?r.slice(i).buffer:null}else{const r=e,o=r.indexOf(Vt.RecordSeparator);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=r.substring(0,i),n=r.length>i?r.substring(i):null}const r=Vt.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"}(Ft||(Ft={}));class Gt{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 kt(this,e)}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}($t||($t={}));class Yt{static create(e,t,n,r,o,i){return new Yt(e,t,n,r,o,i)}constructor(e,t,n,r,o,i){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(wt.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},_t.isRequired(e,"connection"),_t.isRequired(t,"logger"),_t.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=o?o:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=r,this._handshakeProtocol=new Xt,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=$t.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Ft.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==$t.Disconnected&&this._connectionState!==$t.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!==$t.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=$t.Connecting,this._logger.log(wt.Debug,"Starting HubConnection.");try{await this._startInternal(),Et.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=$t.Connected,this._connectionStarted=!0,this._logger.log(wt.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=$t.Disconnected,this._logger.log(wt.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(wt.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(wt.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(wt.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===$t.Disconnected?(this._logger.log(wt.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===$t.Disconnecting?(this._logger.log(wt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=$t.Disconnecting,this._logger.log(wt.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(wt.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 ut("The connection was stopped before the hub handshake could complete."),this.connection.stop(e)))}stream(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createStreamInvocation(e,t,r);let i;const s=new Gt;return s.cancelCallback=()=>{const e=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then((()=>this._sendWithProtocol(e)))},this._callbacks[o.invocationId]=(e,t)=>{t?s.error(t):e&&(e.type===Ft.Completion?e.error?s.error(new Error(e.error)):s.complete():s.next(e.item))},i=this._sendWithProtocol(o).catch((e=>{s.error(e),delete this._callbacks[o.invocationId]})),this._launchStreams(n,i),s}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._sendWithProtocol(this._createInvocation(e,t,!0,r));return this._launchStreams(n,o),o}invoke(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createInvocation(e,t,!1,r);return new Promise(((e,t)=>{this._callbacks[o.invocationId]=(n,r)=>{r?t(r):n&&(n.type===Ft.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 Ft.Invocation:this._invokeClientMethod(e);break;case Ft.StreamItem:case Ft.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===Ft.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(wt.Error,`Stream callback threw error: ${Rt(e)}`)}}break}case Ft.Ping:break;case Ft.Close:{this._logger.log(wt.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(wt.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(wt.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(wt.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(wt.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===$t.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n)return this._logger.log(wt.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(wt.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null))));const r=n.slice(),o=!!e.invocationId;let i,s,a;for(const n of r)try{const r=i;i=await n.apply(this,e.arguments),o&&i&&r&&(this._logger.log(wt.Error,`Multiple results provided for '${t}'. Sending error to server.`),a=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),s=void 0}catch(e){s=e,this._logger.log(wt.Error,`A callback for the method '${t}' threw error '${e}'.`)}a?await this._sendWithProtocol(a):o?(s?a=this._createCompletionMessage(e.invocationId,`${s}`,null):void 0!==i?a=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(wt.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),a=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(a)):i&&this._logger.log(wt.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(wt.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new ut("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===$t.Disconnecting?this._completeClose(e):this._connectionState===$t.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===$t.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=$t.Disconnected,this._connectionStarted=!1,Et.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(wt.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(wt.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=$t.Reconnecting,e?this._logger.log(wt.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(wt.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(wt.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==$t.Reconnecting)return void this._logger.log(wt.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==o;){if(this._logger.log(wt.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!==$t.Reconnecting)return void this._logger.log(wt.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=$t.Connected,this._logger.log(wt.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(wt.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(wt.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==$t.Reconnecting)return this._logger.log(wt.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===$t.Disconnecting&&this._completeClose());r=e instanceof Error?e:new Error(e.toString()),o=this._getNextRetryDelay(n++,Date.now()-t,r)}}this._logger.log(wt.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(wt.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(wt.Error,`Stream 'error' callback called with '${e}' threw error: ${Rt(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:Ft.Invocation}:{arguments:t,target:e,type:Ft.Invocation};{const n=this._invocationId;return this._invocationId++,0!==r.length?{arguments:t,invocationId:n.toString(),streamIds:r,target:e,type:Ft.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:Ft.Invocation}}}_launchStreams(e,t){if(0!==e.length){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n))))},error:e=>{let r;r=e instanceof Error?e.message:e&&e.toString?e.toString():"Unknown error",t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n,r))))},next:e=>{t=t.then((()=>this._sendWithProtocol(this._createStreamItemMessage(n,e))))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let r=0;r=55296&&o<=56319&&r65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h)}else i.push(a);i.length>=4096&&(s+=String.fromCharCode.apply(String,i),i.length=0)}return i.length>0&&(s+=String.fromCharCode.apply(String,i)),s}var fn,gn=cn?new TextDecoder:null,mn=cn?"undefined"!=typeof process&&"force"!==(null===(rn=null===process||void 0===process?void 0:process.env)||void 0===rn?void 0:rn.TEXT_DECODER)?200:0:on,yn=function(e,t){this.type=e,this.data=t},wn=(fn=function(e,t){return fn=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])},fn(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}fn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),vn=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 wn(t,e),t}(Error),bn={type:-1,encode:function(e){var t,n,r,o;return e instanceof Date?function(e){var t,n=e.sec,r=e.nsec;if(n>=0&&r>=0&&n<=17179869183){if(0===r&&n<=4294967295){var o=new Uint8Array(4);return(t=new DataView(o.buffer)).setUint32(0,n),o}var i=n/4294967296,s=4294967295&n;return o=new Uint8Array(8),(t=new DataView(o.buffer)).setUint32(0,r<<2|3&i),t.setUint32(4,s),o}return o=new Uint8Array(12),(t=new DataView(o.buffer)).setUint32(0,r),sn(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:an(t,4),nsec:t.getUint32(0)};default:throw new vn("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},_n=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(bn)}return e.prototype.register=function(e){var t=e.type,n=e.encode,r=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=r;else{var o=1+t;this.builtInEncoders[o]=n,this.builtInDecoders[o]=r}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>dn){var t=ln(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),un(e,this.bytes,this.pos),this.pos+=t}else t=ln(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var r=e.length,o=n,i=0;i>6&31|192;else{if(s>=55296&&s<=56319&&i>12&15|224,t[o++]=s>>6&63|128):(t[o++]=s>>18&7|240,t[o++]=s>>12&63|128,t[o++]=s>>6&63|128)}t[o++]=63&s|128}else t[o++]=s}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=En(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var r=0,o=e;r0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var r=0,o=this.caches[n-1];r=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)},e.prototype.decode=function(e,t,n){var r=this.find(e,t,n);if(null!=r)return this.hit++,r;this.miss++;var o=pn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,o),o},e}(),Nn=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return Nn(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,n,r,o,i,s,a;return i=this,void 0,a=function(){var i,s,a,c,l,h,d,u;return Nn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=An(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),i=!0}catch(e){if(!(e instanceof Mn))throw e}this.totalPos+=this.pos,p.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return c=p.sent(),r={error:c},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,s]}throw h=(l=this).headByte,d=l.pos,u=l.totalPos,new RangeError("Insufficient data in parsing ".concat(Cn(h)," at ").concat(u," (").concat(d," in the current buffer)"))}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{o(a.next(e))}catch(e){t(e)}}function r(e){try{o(a.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}o((a=a.apply(i,[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return function(n,r,o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,s=function(){var n,r,o,i,s,a,c,l,h;return Nn(this,(function(d){switch(d.label){case 0:n=t,r=-1,d.label=1;case 1:d.trys.push([1,13,14,19]),o=An(e),d.label=2;case 2:return[4,Rn(o.next())];case 3:if((i=d.sent()).done)return[3,12];if(s=i.value,t&&0===r)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(r=this.readArraySize(),n=!1,this.complete()),d.label=4;case 4:d.trys.push([4,9,,10]),d.label=5;case 5:return[4,Rn(this.doDecodeSync())];case 6:return[4,d.sent()];case 7:return d.sent(),0==--r?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=d.sent())instanceof Mn))throw a;return[3,10];case 10:this.totalPos+=this.pos,d.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=d.sent(),l={error:c},[3,19];case 14:return d.trys.push([14,,17,18]),i&&!i.done&&(h=o.return)?[4,Rn(h.call(o))]:[3,16];case 15:d.sent(),d.label=16;case 16:return[3,18];case 17:if(l)throw l.error;return[7];case 18:return[7];case 19:return[2]}}))}.apply(n,r||[]),a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(e){s[e]&&(i[e]=function(t){return new Promise((function(n,r){a.push([e,t,n,r])>1||l(e,t)}))})}function l(e,t){try{(n=s[e](t)).value instanceof Rn?Promise.resolve(n.value.v).then(h,d):u(a[0][2],n)}catch(e){u(a[0][3],e)}var n}function h(e){l("next",e)}function d(e){l("throw",e)}function u(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}(this,arguments)},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 vn("Unrecognized type byte: ".concat(Cn(e)));r=this.lookU32(),t=this.decodeExtension(r,4)}this.complete();for(var o=this.stack;o.length>0;){var i=o[o.length-1];if(0===i.type){if(i.array[i.position]=t,i.position++,i.position!==i.size)continue e;o.pop(),t=i.array}else{if(1===i.type){if("string"!=(s=typeof t)&&"number"!==s)throw new vn("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new vn("The key __proto__ is not allowed");i.key=t,i.type=2;continue e}if(i.map[i.key]=t,i.readCount++,i.readCount!==i.size){i.key=null,i.type=1;continue e}o.pop(),t=i.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new vn("Unrecognized array type byte: ".concat(Cn(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new vn("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new vn("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new vn("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthmn?function(e,t,n){var r=e.subarray(t,t+n);return gn.decode(r)}(this.bytes,o,e):pn(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 vn("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw Ln;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 vn("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,n,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,n},e.prototype.readI64=function(){var e=an(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}();!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"}(In||(In={})),function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(kn||(kn={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Tn||(Tn={}));class Fn{constructor(){}log(e,t){}}Fn.instance=new Fn,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"}(xn||(xn={}));class $n{static write(e){let t=e.byteLength||e.length;const n=[];do{let e=127&t;t>>=7,t>0&&(e|=128),n.push(e)}while(t>0);t=e.byteLength||e.length;const r=new Uint8Array(n.length+t);return r.set(n,0),r.set(e,n.length),r.buffer}static parse(e){const t=[],n=new Uint8Array(e),r=[0,7,14,21,28];for(let o=0;o7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+s+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+s,o+s+a):n.subarray(o+s,o+s+a)),o=o+s+a}return t}}const Hn=new Uint8Array([145,In.Ping]);class jn{constructor(e){this.name="messagepack",this.version=1,this.transferFormat=Tn.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new Sn(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new On(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=Fn.instance);const r=$n.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 In.Invocation:return this._writeInvocation(e);case In.StreamInvocation:return this._writeStreamInvocation(e);case In.StreamItem:return this._writeStreamItem(e);case In.Completion:return this._writeCompletion(e);case In.Ping:return $n.write(Hn);case In.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 In.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case In.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case In.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case In.Ping:return this._createPingMessage(n);case In.Close:return this._createCloseMessage(n);default:return t.log(xn.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:In.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:In.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:In.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:In.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:In.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:In.Completion}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([In.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([In.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),$n.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([In.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([In.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),$n.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([In.StreamItem,e.headers||{},e.invocationId,e.item]);return $n.write(t.slice())}_writeCompletion(e){const t=e.error?this._errorResult:void 0!==e.result?this._nonVoidResult:this._voidResult;let n;switch(t){case this._errorResult:n=this._encoder.encode([In.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([In.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([In.Completion,e.headers||{},e.invocationId,t,e.result])}return $n.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([In.CancelInvocation,e.headers||{},e.invocationId]);return $n.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}let Wn=!1;function zn(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),Wn||(Wn=!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 Jn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,qn=Jn?Jn.decode.bind(Jn):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("")},Kn=Math.pow(2,32),Vn=Math.pow(2,21)-1;function Xn(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Gn(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function Yn(e,t){const n=Gn(e,t+4);if(n>Vn)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Kn+Gn(e,t)}class Qn{constructor(e){this.batchData=e;const t=new nr(e);this.arrayRangeReader=new rr(e),this.arrayBuilderSegmentReader=new or(e),this.diffReader=new Zn(e),this.editReader=new er(e,t),this.frameReader=new tr(e,t)}updatedComponents(){return Xn(this.batchData,this.batchData.length-20)}referenceFrames(){return Xn(this.batchData,this.batchData.length-16)}disposedComponentIds(){return Xn(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return Xn(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return Xn(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return Xn(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return Yn(this.batchData,n)}}class Zn{constructor(e){this.batchDataUint8=e}componentId(e){return Xn(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class er{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return Xn(this.batchDataUint8,e)}siblingIndex(e){return Xn(this.batchDataUint8,e+4)}newTreeIndex(e){return Xn(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return Xn(this.batchDataUint8,e+8)}removedAttributeName(e){const t=Xn(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class tr{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return Xn(this.batchDataUint8,e)}subtreeLength(e){return Xn(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=Xn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return Xn(this.batchDataUint8,e+8)}elementName(e){const t=Xn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=Xn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=Xn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=Xn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=Xn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return Yn(this.batchDataUint8,e+12)}}class nr{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=Xn(e,e.length-4)}readString(e){if(-1===e)return null;{const n=Xn(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const i=e[t+o];if(n|=(127&i)<this.nextBatchId)return this.fatalError?(this.logger.log(ir.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(ir.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(ir.Debug,`Applying batch ${e}.`),ve(this.browserRendererId,new Qn(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(ir.Error,`There was an error applying batch ${e}.`),n.send("OnRenderCompleted",e,t.toString()),t}}getLastBatchid(){return this.nextBatchId-1}async completeBatch(e,t){try{await e.send("OnRenderCompleted",t,null)}catch{this.logger.log(ir.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}class ar{log(e,t){}}ar.instance=new ar;class cr{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${ir[e]}: ${t}`;switch(e){case ir.Critical:case ir.Error:console.error(n);break;case ir.Warning:console.warn(n);break;case ir.Information:console.info(n);break;default:console.log(n)}}}}class lr{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!==$t.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!==$t.Connected)return!1;const t=await e.invoke("StartCircuit",Me.getBaseURI(),Me.getLocationHref(),JSON.stringify(this.components.map((e=>e.toRecord()))),this.applicationState||"");return!!t&&(this.initialize(t),!0)}resolveElement(e){const t=v(e);if(t)return $(t,!0);const n=Number.parseInt(e);if(!Number.isNaN(n))return F(this.components[n].start,this.components[n].end);throw new Error(`Invalid sequence number or identifier '${e}'.`)}}const hr={configureSignalR:e=>{},logLevel:ir.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class dr{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 rt.reconnect()||this.rejected()}catch(e){this.logger.log(ir.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 ur{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const r=this.document.getElementById(ur.MaxRetriesId);r&&(r.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(ur.ShowClassName)}update(e){const t=this.document.getElementById(ur.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(ur.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(ur.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(ur.RejectedClassName)}removeClasses(){this.dialog.classList.remove(ur.ShowClassName,ur.HideClassName,ur.FailedClassName,ur.RejectedClassName)}}ur.ShowClassName="components-reconnect-show",ur.HideClassName="components-reconnect-hide",ur.FailedClassName="components-reconnect-failed",ur.RejectedClassName="components-reconnect-rejected",ur.MaxRetriesId="components-reconnect-max-retries",ur.CurrentAttemptId="components-reconnect-current-attempt";class pr{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||rt.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new ur(t,e.maxRetries,document):new dr(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new fr(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class fr{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;tfr.MaximumFirstRetryInterval?fr.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(ir.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise((t=>setTimeout(t,e)))}}function gr(e,t){switch(t){case"webassembly":return function(e){const t=wr(e,"webassembly"),n=[];for(let e=0;ee.id-t.id))}(e);case"server":return function(e){const t=wr(e,"server"),n=[];for(let e=0;ee.sequence-t.sequence))}(e)}}fr.MaximumFirstRetryInterval=3e3;const mr=/^\s*Blazor-Component-State:(?[a-zA-Z0-9+/=]+)$/;function yr(e){var t;if(e.nodeType===Node.COMMENT_NODE){const n=e.textContent||"",r=mr.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 br(e,t){const n=e.currentElement;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const r=vr.exec(n.textContent),o=r&&r.groups&&r.groups.descriptor;if(!o)return;try{const r=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(o);switch(t){case"webassembly":return function(e,t,n){const{type:r,assembly:o,typeName:i,parameterDefinitions:s,parameterValues:a,prerenderId:c}=e,l=c?_r(c,n):void 0;if(c&&!l)throw new Error(`Could not find an end component comment for '${t}'.`);if("webassembly"===r){if(!o)throw new Error("assembly must be defined when using a descriptor.");if(!i)throw new Error("typeName must be defined when using a descriptor.");return{type:r,assembly:o,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:a&&atob(a),start:t,prerenderId:c,end:l}}}(r,n,e);case"server":return function(e,t,n){const{type:r,descriptor:o,sequence:i,prerenderId:s}=e,a=s?_r(s,n):void 0;if(s&&!a)throw new Error(`Could not find an end component comment for '${t}'.`);if("server"===r){if(!o)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===i)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(i))throw new Error(`Error parsing the sequence '${i}' for component '${JSON.stringify(e)}'`);return{type:r,sequence:i,descriptor:o,start:t,prerenderId:s,end:a}}}(r,n,e)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}function _r(e,t){for(;t.next()&&t.currentElement;){const n=t.currentElement;if(n.nodeType!==Node.COMMENT_NODE)continue;if(!n.textContent)continue;const r=vr.exec(n.textContent),o=r&&r[1];if(o)return Er(o,e),n}}function Er(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 Sr{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndexasync function(e,n){const r=function(e){const t=document.baseURI;return t.endsWith("/")?`${t}${e}`:`${t}/${e}`}(n),o=await import(r);if(void 0===o)return;const{beforeStart:i,afterStarted:s}=o;return s&&e.afterStartedCallbacks.push(s),i?i(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await I,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let Tr,xr,Dr,Nr,Ar=!1;async function Rr(e,t,n){var r,o;const i=new jn;i.name="blazorpack";const s=(new en).withUrl("_blazor").withHubProtocol(i);e.configureSignalR(s);const a=s.build();a.on("JS.AttachComponent",((e,t)=>we(0,n.resolveElement(t),e,!1))),a.on("JS.BeginInvokeJS",Dr.beginInvokeJSFromDotNet.bind(Dr)),a.on("JS.EndInvokeDotNet",Dr.endInvokeDotNetFromJS.bind(Dr)),a.on("JS.ReceiveByteArray",Dr.receiveByteArray.bind(Dr)),a.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start(t){a.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});Dr.supplyDotNetStream(e,t)}));const c=sr.getOrCreate(t);a.on("JS.RenderBatch",((e,n)=>{t.log(ir.Debug,`Received render batch with id ${e} and ${n.byteLength} bytes.`),c.processBatch(e,n,a)})),a.on("JS.EndLocationChanging",rt._internal.navigationManager.endLocationChanging),a.onclose((t=>!Ar&&e.reconnectionHandler.onConnectionDown(e.reconnectionOptions,t))),a.on("JS.Error",(e=>{Ar=!0,Pr(a,e,t),zn()}));try{await a.start(),Tr=a}catch(e){if(Pr(a,e,t),"FailedToNegotiateWithServerError"===e.errorType)throw e;zn(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===Bt.WebSockets))?t.log(ir.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===Bt.WebSockets))?t.log(ir.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===Bt.LongPolling))&&t.log(ir.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===(o=null===(r=a.connection)||void 0===r?void 0:r.features)||void 0===o?void 0:o.inherentKeepAlive)&&t.log(ir.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."),a}function Pr(e,t,n){n.log(ir.Error,t),e&&e.stop()}function Ur(e){return Nr=e,Nr}var Mr,Lr;const Br=navigator,Or=Br.userAgentData&&Br.userAgentData.brands,Fr=Or?Or.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):window.chrome,$r=null!==(Lr=null===(Mr=Br.userAgentData)||void 0===Mr?void 0:Mr.platform)&&void 0!==Lr?Lr:navigator.platform;let Hr,jr,Wr,zr,Jr,qr,Kr=!1,Vr=!1;function Xr(){return(Kr||Vr)&&(Fr||navigator.userAgent.includes("Firefox"))}const Gr=Math.pow(2,32),Yr=Math.pow(2,21)-1;let Qr=null,Zr="Production";function eo(e){return jr.getI32(e)}const to={start:function(t){return async function(t){const n={},{dotnet:r}=await async function(e){if("undefined"==typeof WebAssembly||!WebAssembly.validate)throw new Error("This browser does not support WebAssembly.");const t=await async function(e,t){const n=void 0!==e?e("manifest","blazor.boot.json","_framework/blazor.boot.json",""):i("_framework/blazor.boot.json");let r;r=n?"string"==typeof n?await i(n):await n:await i("_framework/blazor.boot.json"),Zr=t||r.headers.get("Blazor-Environment")||"Production";const o=await r.json();return o.modifiableAssemblies=r.headers.get("DOTNET-MODIFIABLE-ASSEMBLIES"),o.aspnetCoreBrowserTools=r.headers.get("ASPNETCORE-BROWSER-TOOLS"),o;function i(e){return fetch(e,{method:"GET",credentials:"include",cache:"no-cache"})}}(e.loadBootResource,e.environment),n=Object.keys(t.resources.runtime).filter((e=>e.startsWith("dotnet.")&&e.endsWith(".js")))[0],r=t.resources.runtime[n];let o=`_framework/${n}`;if(e.loadBootResource){const t="dotnetjs",i=e.loadBootResource(t,n,o,r);if("string"==typeof i)o=i;else if(i)throw new Error(`For a ${t} resource, custom loaders must supply a URI string.`)}if(t.cacheBootResources){const e=document.createElement("link");e.rel="modulepreload",e.href=o,e.crossOrigin="anonymous",e.integrity=r,document.head.appendChild(e)}const i=new URL(o,document.baseURI).toString();return await import(i)}(t),o=function(e,t){const n={maxParallelDownloads:1e6,enableDownloadRetry:!1,applicationEnvironment:Zr},r={...window.Module||{},onConfigLoaded:async n=>{n.environmentVariables||(n.environmentVariables={}),0===n.icuDataMode&&(n.environmentVariables.__BLAZOR_SHARDED_ICU="1"),n.aspnetCoreBrowserTools&&(n.environmentVariables.__ASPNETCORE_BROWSER_TOOLS=n.aspnetCoreBrowserTools),rt._internal.getApplicationEnvironment=()=>n.applicationEnvironment,t.jsInitializer=await async function(e,t){const n=e.resources.libraryInitializers,r=new kr;return n&&await r.importInitializersAsync(Object.keys(n),[t,e.resources.extensions]),r}(n,e)},onDownloadResourceProgress:no,config:n,disableDotnet6Compatibility:!1,print:oo,printErr:io};return r}(t,n);r.withStartupOptions(t).withModuleConfig(o),qr=await r.create();const{MONO:i,BINDING:s,Module:a,setModuleImports:c,INTERNAL:l}=qr;Wr=a,Hr=s,jr=i,Jr=l;const h=Jr.resourceLoader;n.resourceLoader=h,function(e){Kr=!!e.bootConfig.resources.pdb,Vr=e.bootConfig.debugBuild;const t=$r.match(/^Mac/i)?"Cmd":"Alt";Xr()&&console.info(`Debugging hotkey: Shift+${t}+D (when application has focus)`),document.addEventListener("keydown",(e=>{e.shiftKey&&(e.metaKey||e.altKey)&&"KeyD"===e.code&&(Vr||Kr?navigator.userAgent.includes("Firefox")?async function(){const e=await fetch(`_framework/debug?url=${encodeURIComponent(location.href)}&isFirefox=true`);200!==e.status&&console.warn(await e.text())}():Fr?function(){const e=document.createElement("a");e.href=`_framework/debug?url=${encodeURIComponent(location.href)}`,e.target="_blank",e.rel="noopener noreferrer",e.click()}():console.error("Currently, only Microsoft Edge (80+), Google Chrome, or Chromium, are supported for debugging."):console.error("Cannot start debugging, because the application was not compiled with debugging enabled."))}))}(h),rt._internal.dotNetCriticalError=io,rt._internal.loadLazyAssembly=e=>async function(e,t){const n=e.bootConfig.resources,r=n.lazyAssembly;if(!r)throw new Error("No assemblies have been marked as lazy-loadable. Use the 'BlazorWebAssemblyLazyLoad' item group in your project file to enable lazy loading an assembly.");if(!r.hasOwnProperty(t))throw new Error(`${t} must be marked with 'BlazorWebAssemblyLazyLoad' item group in your project file to allow lazy-loading.`);const o=t,i=function(e,t){const n=e.lastIndexOf(".");if(n<0)throw new Error(`No extension to replace in '${e}'`);return e.substr(0,n)+".pdb"}(t),s=Xr()&&n.pdb&&r.hasOwnProperty(i),a=e.loadResource(o,`_framework/${o}`,r[o],"assembly").response.then((e=>e.arrayBuffer()));if(s){const t=await e.loadResource(i,`_framework/${i}`,r[i],"pdb").response.then((e=>e.arrayBuffer())),[n,o]=await Promise.all([a,t]);return{dll:new Uint8Array(n),pdb:new Uint8Array(o)}}{const e=await a;return{dll:new Uint8Array(e),pdb:null}}}(Jr.resourceLoader,e),rt._internal.loadSatelliteAssemblies=(e,t)=>async function(e,t,n){const r=e.bootConfig.resources.satelliteResources;r&&await Promise.all(t.filter((e=>r.hasOwnProperty(e))).map((t=>e.loadResources(r[t],(e=>`_framework/${e}`),"assembly"))).reduce(((e,t)=>e.concat(t)),new Array).map((async e=>{const t=await e.response,r=await t.arrayBuffer(),o={dll:new Uint8Array(r)};n(o)})))}(h,e,t),c("blazor-internal",{Blazor:{_internal:rt._internal}});const d=await qr.getAssemblyExports("Microsoft.AspNetCore.Components.WebAssembly");return Object.assign(rt._internal,{dotNetExports:{...d.Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime}}),zr=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{if(ao(),!r&&!t)throw new Error("Either assemblyName or dotNetObjectId must have a non null value.");const i=r?r.toString():t;rt._internal.dotNetExports.BeginInvokeDotNet(e?e.toString():null,i,n,o)},endInvokeJSFromDotNet:(e,t,n)=>{rt._internal.dotNetExports.EndInvokeJS(n)},sendByteArray:(e,t)=>{rt._internal.dotNetExports.ReceiveByteArrayFromJS(e,t)},invokeDotNetFromJS:(e,t,n,r)=>(ao(),rt._internal.dotNetExports.InvokeDotNet(e||null,t,null!=n?n:0,r))}),n}(t)},callEntryPoint:async function(e){try{await qr.runMain(e,[])}catch(e){console.error(e),zn()}},toUint8Array:function(e){const t=so(e),n=eo(t),r=new Uint8Array(n);return r.set(Wr.HEAPU8.subarray(t+4,t+4+n)),r},getArrayLength:function(e){return eo(so(e))},getArrayEntryPtr:function(e,t,n){return so(e)+4+t*n},getObjectFieldsBaseAddress:function(e){return e+8},readInt16Field:function(e,t){return n=e+(t||0),jr.getI16(n);var n},readInt32Field:function(e,t){return eo(e+(t||0))},readUint64Field:function(e,t){return function(e){const t=e>>2,n=Wr.HEAPU32[t+1];if(n>Yr)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Gr+Wr.HEAPU32[t]}(e+(t||0))},readFloatField:function(e,t){return n=e+(t||0),jr.getF32(n);var n},readObjectField:function(e,t){return eo(e+(t||0))},readStringField:function(e,t,n){const r=eo(e+(t||0));if(0===r)return null;if(n){const e=Hr.unbox_mono_obj(r);return"boolean"==typeof e?e?"":null:e}return Hr.conv_string(r)},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return ao(),Qr=co.create(),Qr},invokeWhenHeapUnlocked:function(e){Qr?Qr.enqueuePostReleaseAction(e):e()}};function no(e,t){const n=e/t*100;document.documentElement.style.setProperty("--blazor-load-percentage",`${n}%`),document.documentElement.style.setProperty("--blazor-load-percentage-text",`"${Math.floor(n)}%"`)}const ro=["DEBUGGING ENABLED"],oo=e=>ro.indexOf(e)<0&&console.log(e),io=e=>{console.error(e||"(null)"),zn()};function so(e){return e+12}function ao(){if(Qr)throw new Error("Assertion failed - heap is currently locked")}class co{enqueuePostReleaseAction(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)}release(){var e;if(Qr!==this)throw new Error("Trying to release a lock which isn't current");for(Jr.mono_wasm_gc_unlock(),Qr=null;null===(e=this.postReleaseActions)||void 0===e?void 0:e.length;)this.postReleaseActions.shift()(),ao()}static create(){return Jr.mono_wasm_gc_lock(),new co}}class lo{constructor(e){this.batchAddress=e,this.arrayRangeReader=ho,this.arrayBuilderSegmentReader=uo,this.diffReader=po,this.editReader=fo,this.frameReader=go}updatedComponents(){return Nr.readStructField(this.batchAddress,0)}referenceFrames(){return Nr.readStructField(this.batchAddress,ho.structLength)}disposedComponentIds(){return Nr.readStructField(this.batchAddress,2*ho.structLength)}disposedEventHandlerIds(){return Nr.readStructField(this.batchAddress,3*ho.structLength)}updatedComponentsEntry(e,t){return mo(e,t,po.structLength)}referenceFramesEntry(e,t){return mo(e,t,go.structLength)}disposedComponentIdsEntry(e,t){const n=mo(e,t,4);return Nr.readInt32Field(n)}disposedEventHandlerIdsEntry(e,t){const n=mo(e,t,8);return Nr.readUint64Field(n)}}const ho={structLength:8,values:e=>Nr.readObjectField(e,0),count:e=>Nr.readInt32Field(e,4)},uo={structLength:12,values:e=>{const t=Nr.readObjectField(e,0),n=Nr.getObjectFieldsBaseAddress(t);return Nr.readObjectField(n,0)},offset:e=>Nr.readInt32Field(e,4),count:e=>Nr.readInt32Field(e,8)},po={structLength:4+uo.structLength,componentId:e=>Nr.readInt32Field(e,0),edits:e=>Nr.readStructField(e,4),editsEntry:(e,t)=>mo(e,t,fo.structLength)},fo={structLength:20,editType:e=>Nr.readInt32Field(e,0),siblingIndex:e=>Nr.readInt32Field(e,4),newTreeIndex:e=>Nr.readInt32Field(e,8),moveToSiblingIndex:e=>Nr.readInt32Field(e,8),removedAttributeName:e=>Nr.readStringField(e,16)},go={structLength:36,frameType:e=>Nr.readInt16Field(e,4),subtreeLength:e=>Nr.readInt32Field(e,8),elementReferenceCaptureId:e=>Nr.readStringField(e,16),componentId:e=>Nr.readInt32Field(e,12),elementName:e=>Nr.readStringField(e,16),textContent:e=>Nr.readStringField(e,16),markupContent:e=>Nr.readStringField(e,16),attributeName:e=>Nr.readStringField(e,16),attributeValue:e=>Nr.readStringField(e,24,!0),attributeEventHandlerId:e=>Nr.readUint64Field(e,8)};function mo(e,t,n){return Nr.getArrayEntryPtr(e,t,n)}class yo{constructor(e){this.preregisteredComponents=e;const t={};for(let n=0;n=n&&s>=r&&o(e.item(i),t.item(s))===Co.None;)i--,s--,a++;return a}(e,t,r,r,n),i=function(e){var t;const n=[];let r=e.length-1,o=(null===(t=e[r])||void 0===t?void 0:t.length)-1;for(;r>0||o>0;){const t=0===r?Io.Insert:0===o?Io.Delete:e[r][o];switch(n.unshift(t),t){case Io.Keep:case Io.Update:r--,o--;break;case Io.Insert:o--;break;case Io.Delete:r--}}return n}(function(e,t,n){const r=[],o=[],i=e.length,s=t.length;if(0===i&&0===s)return[];for(let e=0;e<=i;e++)(r[e]=Array(s+1))[0]=e,o[e]=Array(s+1);const a=r[0];for(let e=1;e<=s;e++)a[e]=e;for(let a=1;a<=i;a++)for(let i=1;i<=s;i++){const s=n(e.item(a-1),t.item(i-1)),c=r[a-1][i]+1,l=r[a][i-1]+1;let h;switch(s){case Co.None:h=r[a-1][i-1];break;case Co.Some:h=r[a-1][i-1]+1;break;case Co.Infinite:h=Number.MAX_VALUE}h{};function Uo(){document.body.removeEventListener("click",Mo),window.removeEventListener("popstate",Lo)}function Mo(e){ke()||Ee(e,(e=>{history.pushState(null,"",e),Bo(e)}))}function Lo(e){ke()||Bo(location.href)}async function Bo(e){null==Ro||Ro.abort(),Ro=new AbortController;const t=Ro.signal,n=fetch(e,{signal:t,headers:{"blazor-enhanced-nav":"on"}});if(await async function(e,t,n,r){let o;try{if(o=await e,!o.body)return void n(o,"");const t=o.headers.get("ssr-framing");if(!t){const e=await o.text();return void n(o,e)}let r=!0;await o.body.pipeThrough(new TextDecoderStream).pipeThrough(function(e){let t="";return new TransformStream({transform(n,r){if(t+=n,t.indexOf(e,t.length-n.length-e.length)>=0){const n=t.split(e);n.slice(0,-1).forEach((e=>r.enqueue(e))),t=n[n.length-1]}},flush(e){t&&e.enqueue(t)}})}(`\x3c!--${t}--\x3e`)).pipeTo(new WritableStream({write(e){r?(r=!1,n(o,e)):(e=>{const t=document.createRange().createContextualFragment(e);for(;t.firstChild;)document.body.appendChild(t.firstChild)})(e)}}))}catch(e){if("AbortError"===e.name&&t.aborted)return;throw e}}(n,t,((t,n)=>{var r;if(t.redirected&&history.replaceState(null,"",t.url),null===(r=t.headers.get("content-type"))||void 0===r?void 0:r.startsWith("text/html")){const e=(new DOMParser).parseFromString(n,"text/html");To(document,e)}else(t.status<200||t.status>=300)&&!n?document.documentElement.innerHTML=`Error: ${t.status} ${t.statusText}`:(history.replaceState(null,"",e+"?"),location.replace(e))})),!t.aborted){Po();const t=e.indexOf("#");if(t>=0){const n=e.substring(t+1),r=document.getElementById(n);null==r||r.scrollIntoView()}}}let Oo=!0;class Fo extends HTMLElement{connectedCallback(){var e;null===(e=this.parentNode)||void 0===e||e.removeChild(this);const t=this.attachShadow({mode:"open"}),n=document.createElement("slot");t.appendChild(n),n.addEventListener("slotchange",(e=>{this.childNodes.forEach((e=>{if(e instanceof HTMLTemplateElement){const t=e.getAttribute("blazor-component-id");if(t)!function(e,t){const n=function(e){const t=`bl:${e}`,n=document.createNodeIterator(document,NodeFilter.SHOW_COMMENT);let r=null;for(;(r=n.nextNode())&&r.textContent!==t;);if(!r)return null;const o=`/bl:${e}`;let i=null;for(;(i=n.nextNode())&&i.textContent!==o;);return i?{startMarker:r,endMarker:i}:null}(e);if(n)if(Oo)To({startExclusive:n.startMarker,endExclusive:n.endMarker},t);else{const{startMarker:e,endMarker:r}=n,o=new Range;for(o.setStart(e,e.textContent.length),o.setEnd(r,0),o.deleteContents();t.childNodes[0];)r.parentNode.insertBefore(t.childNodes[0],r)}}(t,e.content);else switch(e.getAttribute("type")){case"redirection":const t=e.content.textContent;Se(t)?(history.replaceState(null,"",t),Bo(t)):location.replace(t);break;case"error":document.documentElement.textContent=e.content.textContent;const n=document.documentElement.style;n.fontFamily="consolas, monospace",n.whiteSpace="pre-wrap",n.padding="1rem"}}}))}))}}let $o,Ho=!1;async function jo(e){var t;if(Ho)throw new Error("Blazor has already started.");Ho=!0,$o=e,function(e){(null==e?void 0:e.disableDomPreservation)&&(Oo=!1),customElements.define("blazor-ssr",Fo)}(null==e?void 0:e.ssr),(null===(t=null==e?void 0:e.ssr)||void 0===t?void 0:t.disableDomPreservation)||(Po=Wo,document.body.addEventListener("click",Mo),window.addEventListener("popstate",Lo)),await Wo()}async function Wo(){const t=gr(document,"server"),n=gr(document,"webassembly");t.length&&(Uo(),await async function(t,n){const r=function(e){const t={...hr,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...hr.reconnectionOptions,...e.reconnectionOptions}),t}(t),o=await async function(e){const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),r=new kr;return await r.importInitializersAsync(n,[e]),r}(r),i=new cr(r.logLevel);rt.reconnect=async e=>{if(Ar)return!1;const t=e||await Rr(r,i,xr);return await xr.reconnect(t)?(r.reconnectionHandler.onConnectionUp(),!0):(i.log(ir.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)},rt.defaultReconnectionHandler=new pr(i),r.reconnectionHandler=r.reconnectionHandler||rt.defaultReconnectionHandler,i.log(ir.Information,"Starting up Blazor server-side application.");const s=yr(document);xr=new lr(n||[],s||""),rt._internal.navigationManager.listenForNavigationEvents(((e,t,n)=>Tr.send("OnLocationChanged",e,t,n)),((e,t,n,r)=>Tr.send("OnLocationChanging",e,t,n,r))),rt._internal.forceCloseConnection=()=>Tr.stop(),rt._internal.sendJSDataStream=(e,t,n)=>function(e,t,n,r){setTimeout((async()=>{let o=5,i=(new Date).valueOf();try{const s=t instanceof Blob?t.size:t.byteLength;let a=0,c=0;for(;a1)await e.send("ReceiveJSDataChunk",n,c,h,null);else{if(!await e.invoke("ReceiveJSDataChunk",n,c,h,null))break;const t=(new Date).valueOf(),r=t-i;i=t,o=Math.max(1,Math.round(500/Math.max(1,r)))}a+=l,c++}}catch(t){await e.send("ReceiveJSDataChunk",n,-1,null,t.toString())}}),0)}(Tr,e,t,n),Dr=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{Tr.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,r||0,o)},endInvokeJSFromDotNet:(e,t,n)=>{Tr.send("EndInvokeJSFromDotNet",e,t,n)},sendByteArray:(e,t)=>{Tr.send("ReceiveByteArray",e,t)}});const a=await Rr(r,i,xr);if(!await xr.startCircuit(a))return void i.log(ir.Error,"Failed to start the circuit.");let c=!1;const l=()=>{if(!c){const e=new FormData,t=xr.circuitId;e.append("circuitId",t),c=navigator.sendBeacon("_blazor/disconnect",e)}};rt.disconnect=l,window.addEventListener("unload",l,{capture:!1,once:!0}),i.log(ir.Information,"Blazor server-side application started."),o.invokeAfterStartedCallbacks(rt)}(null==$o?void 0:$o.circuit,t)),n.length&&(Uo(),await async function(e,t){(function(){if(window.parent!==window&&!window.opener&&window.frameElement){const e=window.sessionStorage&&window.sessionStorage["Microsoft.AspNetCore.Components.WebAssembly.Authentication.CachedAuthSettings"],t=e&&JSON.parse(e);return t&&t.redirect_uri&&location.href.startsWith(t.redirect_uri)}return!1})()&&await new Promise((()=>{})),function(e){const t=x;x=(e,n,r)=>{((e,t,n)=>{const r=function(e){return me[e]}(e);r.eventDelegator.getHandler(t)&&to.invokeWhenHeapUnlocked(n)})(e,n,(()=>t(e,n,r)))}}(),rt._internal.applyHotReload=(e,t,n,r)=>{zr.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDelta",e,t,n,r)},rt._internal.getApplyUpdateCapabilities=()=>zr.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","GetApplyUpdateCapabilities"),rt._internal.invokeJSFromDotNet=wo,rt._internal.invokeJSJson=vo,rt._internal.endInvokeDotNetFromJS=bo,rt._internal.receiveWebAssemblyDotNetDataStream=_o,rt._internal.receiveByteArray=Eo;const n=Ur(to);rt.platform=n,rt._internal.renderBatch=(e,t)=>{const n=to.beginHeapLock();try{ve(e,new lo(t))}finally{n.release()}},rt._internal.navigationManager.listenForNavigationEvents((async(e,t,n)=>{await zr.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t,n)}),(async(e,t,n,r)=>{const o=await zr.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChangingAsync",t,n,r);rt._internal.navigationManager.endLocationChanging(e,o)}));const r=new yo(t||[]);let o,i;rt._internal.registeredComponents={getRegisteredComponentsCount:()=>r.getCount(),getId:e=>r.getId(e),getAssembly:e=>r.getAssembly(e),getTypeName:e=>r.getTypeName(e),getParameterDefinitions:e=>r.getParameterDefinitions(e)||"",getParameterValues:e=>r.getParameterValues(e)||""},rt._internal.getPersistedState=()=>yr(document)||"",rt._internal.attachRootComponentToElement=(e,t,n)=>{const o=r.resolveRegisteredElement(e);o?we(n,o,t,!1):function(e,t,n){const r="::before";let o=!1;if(e.endsWith("::after"))e=e.slice(0,-7),o=!0;else if(e.endsWith(r))throw new Error(`The '${r}' selector is not supported.`);const i=v(e)||document.querySelector(e);if(!i)throw new Error(`Could not find any element matching selector '${e}'.`);we(n||0,$(i,!0),t,o)}(e,t,n)};try{const t=await n.start(null!=e?e:{});o=t.resourceLoader,i=t.jsInitializer}catch(e){throw new Error(`Failed to start platform. Reason: ${e}`)}n.callEntryPoint(o.bootConfig.entryAssembly),i.invokeAfterStartedCallbacks(rt)}(null==$o?void 0:$o.webAssembly,n))}rt.start=jo,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&jo()})(); \ 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 86eabc07bb9d..517f232730d1 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,r={d:(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};r.d({},{e:()=>Et}),function(e){const t=[],n="__jsObjectId",r="__dotNetObject",o="__byte[]",a="__dotNetStream",i="__jsStreamReferenceLength";let s,c;class l{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 u={0:new l(window)};u[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let d,h=1;function f(e){t.push(e)}function p(e){if(e&&"object"==typeof e){u[h]=new l(e);const t={[n]:h};return h++,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 r={[i]:t};try{const t=p(e);r[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return r}function v(e,n){c=e;const r=n?JSON.parse(n,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null;return c=void 0,r}function g(){if(void 0===s)throw new Error("No call dispatcher has been set.");if(null===s)throw new Error("There are multiple .NET runtimes present, so a default dispatcher could not be resolved. Use DotNetObject to invoke .NET instance methods.");return s}e.attachDispatcher=function(e){const t=new b(e);return void 0===s?s=t:s&&(s=null),t},e.attachReviver=f,e.invokeMethod=function(e,t,...n){return g().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return g().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=p,e.createJSStreamReference=m,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&E(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(d=e.JSCallResultType||(e.JSCallResultType={}));class b{constructor(e){this._dotNetCallDispatcher=e,this._byteArraysToBeRevived=new Map,this._pendingDotNetToJSStreams=new Map,this._pendingAsyncCalls={},this._nextAsyncCallId=1}getDotNetCallDispatcher(){return this._dotNetCallDispatcher}invokeJSFromDotNet(e,t,n,r){const o=v(this,t),a=C(w(e,r)(...o||[]),n);return null==a?null:A(this,a)}beginInvokeJSFromDotNet(e,t,n,r,o){const a=new Promise((e=>{const r=v(this,n);e(w(t,o)(...r||[]))}));e&&a.then((t=>A(this,[e,!0,C(t,r)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,y(t)]))))}endInvokeDotNetFromJS(e,t,n){const r=t?v(this,n):new Error(n);this.completePendingCall(parseInt(e,10),t,r)}invokeDotNetStaticMethod(e,t,...n){return this.invokeDotNetMethod(e,t,null,n)}invokeDotNetStaticMethodAsync(e,t,...n){return this.invokeDotNetMethodAsync(e,t,null,n)}invokeDotNetMethod(e,t,n,r){if(this._dotNetCallDispatcher.invokeDotNetFromJS){const o=A(this,r),a=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,o);return a?v(this,a):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeDotNetMethodAsync instead.")}invokeDotNetMethodAsync(e,t,n,r){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const o=this._nextAsyncCallId++,a=new Promise(((e,t)=>{this._pendingAsyncCalls[o]={resolve:e,reject:t}}));try{const a=A(this,r);this._dotNetCallDispatcher.beginInvokeDotNetFromJS(o,e,t,n,a)}catch(e){this.completePendingCall(o,!1,e)}return a}receiveByteArray(e,t){this._byteArraysToBeRevived.set(e,t)}processByteArray(e){const t=this._byteArraysToBeRevived.get(e);return t?(this._byteArraysToBeRevived.delete(e),t):null}supplyDotNetStream(e,t){if(this._pendingDotNetToJSStreams.has(e)){const n=this._pendingDotNetToJSStreams.get(e);this._pendingDotNetToJSStreams.delete(e),n.resolve(t)}else{const n=new D;n.resolve(t),this._pendingDotNetToJSStreams.set(e,n)}}getDotNetStreamPromise(e){let t;if(this._pendingDotNetToJSStreams.has(e))t=this._pendingDotNetToJSStreams.get(e).streamPromise,this._pendingDotNetToJSStreams.delete(e);else{const n=new D;this._pendingDotNetToJSStreams.set(e,n),t=n.streamPromise}return t}completePendingCall(e,t,n){if(!this._pendingAsyncCalls.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const r=this._pendingAsyncCalls[e];delete this._pendingAsyncCalls[e],t?r.resolve(n):r.reject(n)}}function y(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function w(e,t){const n=u[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function E(e){delete u[e]}e.findJSFunction=w,e.disposeJSObjectReferenceById=E;class S{constructor(e,t){this._id=e,this._callDispatcher=t}invokeMethod(e,...t){return this._callDispatcher.invokeDotNetMethod(null,e,this._id,t)}invokeMethodAsync(e,...t){return this._callDispatcher.invokeDotNetMethodAsync(null,e,this._id,t)}dispose(){this._callDispatcher.invokeDotNetMethodAsync(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{[r]:this._id}}}e.DotNetObject=S,f((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(r))return new S(t[r],c);if(t.hasOwnProperty(n)){const e=t[n],r=u[e];if(r)return r.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(o)){const e=t[o],n=c.processByteArray(e);if(void 0===n)throw new Error(`Byte array index '${e}' does not exist.`);return n}if(t.hasOwnProperty(a)){const e=t[a],n=c.getDotNetStreamPromise(e);return new I(n)}}return t}));class I{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class D{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function C(e,t){switch(t){case d.Default:return e;case d.JSObjectReference:return p(e);case d.JSStreamReference:return m(e);case d.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let N=0;function A(e,t){N=0,c=e;const n=JSON.stringify(t,k);return c=void 0,n}function k(e,t){if(t instanceof S)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(N,t);const e={[o]:N};return N++,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 a=new Map,i=new Map,s=[];function c(e){return a.get(e)}function l(e){const t=a.get(e);return(null==t?void 0:t.browserEventName)||e}function u(e,t){e.forEach((e=>a.set(e,t)))}function d(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}{const e=function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t);return{value:e?!!t.checked:t.value}}}}),u(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),u(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...h(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"],{createEventArgs:e=>({type:e.type})}),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,type:t.type};var t}}),u(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>h(e)}),u(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno,type:t.type};var t}}),u(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total,type:t.type};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{...h(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{...h(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),u(["toggle"],{createEventArgs:()=>({})});const f=["date","datetime-local","month","time","week"],p=new Map;let m,v,g=0;const b={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const r="__bl-dynamic-root:"+(++g).toString();p.set(r,e);const o=await E().invokeMethodAsync("AddRootComponent",t,r),a=new w(o,v[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(!m)throw new Error("Dynamic root components have not been enabled in this application.");return m}const S=[];let I;const D=new Promise((e=>{I=e}));function C(e,t,n){return A(e,t.eventHandlerId,(()=>N(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function N(e){const t=S[e];if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let A=(e,t,n)=>n();const k=x(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),T={submit:!0},R=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,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(),a=null,i=!1;const s=Object.prototype.hasOwnProperty.call(k,e);let l=!1;for(;r;){const h=r,f=this.getEventHandlerInfosForElement(h,!1);if(f){const n=f.getHandler(e);if(n&&(u=h,d=t.type,!((u instanceof HTMLButtonElement||u instanceof HTMLInputElement||u instanceof HTMLTextAreaElement||u instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(R,d)&&u.disabled))){if(!i){const n=c(e);a=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},i=!0}Object.prototype.hasOwnProperty.call(T,t.type)&&t.preventDefault(),C(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},a)}f.stopPropagation(e)&&(l=!0),f.preventDefault(e)&&t.preventDefault()}r=s||l?void 0:n.shift()}var u,d}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new L:null}}_.nextEventDelegatorId=0;class O{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=l(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(k,e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(Object.prototype.hasOwnProperty.call(this.infosByEventHandlerId,t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=l(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(Object.prototype.hasOwnProperty.call(this.countByEventName,e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class L{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return Object.prototype.hasOwnProperty.call(this.handlers,e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function x(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const F=q("_blazorLogicalChildren"),P=q("_blazorLogicalParent"),M=q("_blazorLogicalEnd");function B(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return F in e||(e[F]=[]),e}function j(e,t){const n=document.createComment("!");return H(n,e,t),n}function H(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(U(r))throw new Error("Not implemented: moving existing logical children");const o=K(t);if(n0;)J(n,0)}const r=n;r.parentNode.removeChild(r)}function U(e){return e[P]||null}function $(e,t){return K(e)[t]}function z(e){const t=W(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function K(e){return e[F]}function X(e,t){const n=K(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=G(e.moveRangeStart)})),t.forEach((t=>{const r=document.createComment("marker");t.moveToBeforeMarker=r;const o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):V(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 Y(e){const t=K(U(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function V(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=Y(t);n?n.parentNode.insertBefore(e,n):V(e,U(t))}}}function G(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=Y(e);if(t)return t.previousSibling;{const t=U(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}`}const Q="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,Q)&&"string"==typeof t[Q]?function(e){const t=`[${Z(e)}]`;return document.querySelector(t)}(t[Q]):t));const ee="_blazorDeferredValue";function te(e){return"select-multiple"===e.type}function ne(e,t){e.value=t||""}function re(e,t){e instanceof HTMLSelectElement?te(e)?function(e,t){t||(t=[]);for(let n=0;n{if(!fe)return;if(0!==e.button||function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e))return;if(e.defaultPrevented)return;const t=function(e){const t=!window._blazorDisableComposedPath&&e.composedPath&&e.composedPath();if(t){for(let e=0;edocument.baseURI,getLocationHref:()=>location.href,scrollToElement:Ie};function Ie(e){const t=document.getElementById(e);return!!t&&(t.scrollIntoView(),!0)}function De(e,t,n=!1){const r=Le(e);!t.forceLoad&&Fe(r)?Ce(r,!1,t.replaceHistoryEntry,t.historyEntryState,n):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Ce(e,t,n,r=void 0,o=!1){if(ke(),function(e){const t=e.indexOf("#");return t>-1&&location.href.replace(location.hash,"")===e.substring(0,t)}(e))!function(e,t,n){Ne(e,t,n);const r=e.indexOf("#");r!==e.length-1&&Ie(e.substring(r+1))}(e,n,r);else{if(!o&&me&&!await Te(e,r,t))return;he=!0,Ne(e,n,r),await Re(t)}}function Ne(e,t,n=void 0){t?history.replaceState({userState:n,_index:ve},"",e):(ve++,history.pushState({userState:n,_index:ve},"",e))}function Ae(e){return new Promise((t=>{const n=we;we=()=>{we=n,t()},history.go(e)}))}function ke(){Ee&&(Ee(!1),Ee=null)}function Te(e,t,n){return new Promise((r=>{ke(),ye?(ge++,Ee=r,ye(ge,e,t,n)):r(!1)}))}async function Re(e){var t;be&&await be(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function _e(e){var t,n;we&&await we(e),ve=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}let Oe;function Le(e){return Oe=Oe||document.createElement("a"),Oe.href=e,Oe.href}function xe(e,t){return e?e.tagName===t?e:xe(e.parentElement,t):null}function Fe(e){const t=(n=document.baseURI).substring(0,n.lastIndexOf("/"));var n;const r=e.charAt(t.length);return e.startsWith(t)&&(""===r||"/"===r||"?"===r||"#"===r)}const Pe={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,t){const n=document.querySelector(e);n&&(n.hasAttribute("tabindex")||(n.tabIndex=-1),n.focus({preventScroll:!0}))}},Me={init:function(e,t,n,r=50){const o=je(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 i=new IntersectionObserver((function(r){r.forEach((r=>{var o;if(!r.isIntersecting)return;a.setStartAfter(t),a.setEndBefore(n);const i=a.getBoundingClientRect().height,s=null===(o=r.rootBounds)||void 0===o?void 0:o.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,i,s):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,i,s)}))}),{root:o,rootMargin:`${r}px`});i.observe(t),i.observe(n);const s=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)),i.unobserve(e),i.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)}Be[e._id]={intersectionObserver:i,mutationObserverBefore:s,mutationObserverAfter:c}},dispose:function(e){const t=Be[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete Be[e._id])}},Be={};function je(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:je(e.parentElement):null}const He={getAndRemoveExistingTitle:function(){var e;const t=document.head?document.head.getElementsByTagName("title"):[];if(0===t.length)return null;let n=null;for(let r=t.length-1;r>=0;r--){const o=t[r],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}},Je={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=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(a.blob)})),s=await new Promise((function(e){var t;const a=Math.min(1,r/i.width),s=Math.min(1,o/i.height),c=Math.min(a,s),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:a.lastModified,name:a.name,size:(null==s?void 0:s.size)||0,contentType:n,blob:s||a.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. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.`);return n}const $e=new Set,ze={enableNavigationPrompt:function(e){0===$e.size&&window.addEventListener("beforeunload",Ke),$e.add(e)},disableNavigationPrompt:function(e){$e.delete(e),0===$e.size&&window.removeEventListener("beforeunload",Ke)}};function Ke(e){e.preventDefault(),e.returnValue=!0}const Xe=new Map,We={navigateTo:function(e,t,n=!1){De(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(a.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]),s.forEach((n=>n(e,t.browserEventName)))}a.set(e,t)},rootComponents:b,_internal:{navigationManager:Se,domWrapper:Pe,Virtualize:Me,PageTitle:He,InputFile:Je,NavigationLock:ze,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)},attachWebRendererInterop:function(t,n,r){const o=S.length;return S.push(t),Object.keys(n).length>0&&function(t,n,r){if(m)throw new Error("Dynamic root components have already been enabled.");m=t,v=n;for(const[t,o]of Object.entries(r)){const r=e.findJSFunction(t,0);for(const e of o)r(e,n[e])}}(N(o),n,r),I(),o}}};window.Blazor=We;let Ye=!1;const Ve="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Ge=Ve?Ve.decode.bind(Ve):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("")},qe=Math.pow(2,32),Ze=Math.pow(2,21)-1;function Qe(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function et(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function tt(e,t){const n=et(e,t+4);if(n>Ze)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*qe+et(e,t)}class nt{constructor(e){this.batchData=e;const t=new it(e);this.arrayRangeReader=new st(e),this.arrayBuilderSegmentReader=new ct(e),this.diffReader=new rt(e),this.editReader=new ot(e,t),this.frameReader=new at(e,t)}updatedComponents(){return Qe(this.batchData,this.batchData.length-20)}referenceFrames(){return Qe(this.batchData,this.batchData.length-16)}disposedComponentIds(){return Qe(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return Qe(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return Qe(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return Qe(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return tt(this.batchData,n)}}class rt{constructor(e){this.batchDataUint8=e}componentId(e){return Qe(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class ot{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return Qe(this.batchDataUint8,e)}siblingIndex(e){return Qe(this.batchDataUint8,e+4)}newTreeIndex(e){return Qe(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return Qe(this.batchDataUint8,e+8)}removedAttributeName(e){const t=Qe(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class at{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return Qe(this.batchDataUint8,e)}subtreeLength(e){return Qe(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=Qe(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return Qe(this.batchDataUint8,e+8)}elementName(e){const t=Qe(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=Qe(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=Qe(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=Qe(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=Qe(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return tt(this.batchDataUint8,e+12)}}class it{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=Qe(e,e.length-4)}readString(e){if(-1===e)return null;{const n=Qe(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:i}=o;return i&&e.afterStartedCallbacks.push(i),a?a(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await D,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let Et,St=!1;async function It(){if(St)throw new Error("Blazor has already started.");St=!0,Et=e.attachDispatcher({beginInvokeDotNetFromJS:ht,endInvokeJSFromDotNet:ft,sendByteArray:pt});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 wt;return await n.importInitializersAsync(t,[]),n}();(function(){const e={AttachToDocument:(e,t)=>{!function(e,t,n){const r="::before";let o=!1;if(e.endsWith("::after"))e=e.slice(0,-7),o=!0;else if(e.endsWith(r))throw new Error(`The '${r}' selector is not supported.`);const a=function(e){const t=p.get(e);if(t)return p.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=new ce(0),de[0]=o),o.attachRootComponentToLogicalElement(n,t,r)}(0,B(a,!0),t,o)}(t,e)},RenderBatch:(e,t)=>{try{const n=yt(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),i=r.count(o),s=t.referenceFrames(),c=r.values(s),l=t.diffReader;for(let e=0;e{ut=!0,console.error(`${e}\n${t}`),function(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),Ye||(Ye=!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:Et.beginInvokeJSFromDotNet.bind(Et),EndInvokeDotNet:Et.endInvokeDotNetFromJS.bind(Et),SendByteArrayToJS:bt,Navigate:Se.navigateTo,SetHasLocationChangingListeners:Se.setHasLocationChangingListeners,EndLocationChanging:Se.endLocationChanging};window.external.receiveMessage((t=>{const n=function(e){if(ut||!e||!e.startsWith(lt))return null;const t=e.substring(lt.length),[n,...r]=JSON.parse(t);return{messageType:n,args:r}}(t);if(n){if(!Object.prototype.hasOwnProperty.call(e,n.messageType))throw new Error(`Unsupported IPC message type '${n.messageType}'`);e[n.messageType].apply(null,n.args)}}))})(),We._internal.receiveWebViewDotNetDataStream=Dt,Se.enableNavigationInterception(),Se.listenForNavigationEvents(mt,vt),gt("AttachPage",Se.getBaseURI(),Se.getLocationHref()),await t.invokeAfterStartedCallbacks(We)}function Dt(e,t,n,r){!function(e,t,n,r,o){let a=Xe.get(t);if(!a){const n=new ReadableStream({start(e){Xe.set(t,e),a=e}});e.supplyDotNetStream(t,n)}o?(a.error(o),Xe.delete(t)):0===r?(a.close(),Xe.delete(t)):a.enqueue(n.length===r?n:n.subarray(0,r))}(Et,e,t,n,r)}We.start=It,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&It()})(); \ No newline at end of file +(()=>{"use strict";var e,t,n,r={d:(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};r.d({},{e:()=>Et}),function(e){const t=[],n="__jsObjectId",r="__dotNetObject",o="__byte[]",a="__dotNetStream",i="__jsStreamReferenceLength";let s,c;class l{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 u={0:new l(window)};u[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let d,h=1;function f(e){t.push(e)}function p(e){if(e&&"object"==typeof e){u[h]=new l(e);const t={[n]:h};return h++,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 r={[i]:t};try{const t=p(e);r[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return r}function v(e,n){c=e;const r=n?JSON.parse(n,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null;return c=void 0,r}function g(){if(void 0===s)throw new Error("No call dispatcher has been set.");if(null===s)throw new Error("There are multiple .NET runtimes present, so a default dispatcher could not be resolved. Use DotNetObject to invoke .NET instance methods.");return s}e.attachDispatcher=function(e){const t=new b(e);return void 0===s?s=t:s&&(s=null),t},e.attachReviver=f,e.invokeMethod=function(e,t,...n){return g().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return g().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=p,e.createJSStreamReference=m,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&E(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(d=e.JSCallResultType||(e.JSCallResultType={}));class b{constructor(e){this._dotNetCallDispatcher=e,this._byteArraysToBeRevived=new Map,this._pendingDotNetToJSStreams=new Map,this._pendingAsyncCalls={},this._nextAsyncCallId=1}getDotNetCallDispatcher(){return this._dotNetCallDispatcher}invokeJSFromDotNet(e,t,n,r){const o=v(this,t),a=C(w(e,r)(...o||[]),n);return null==a?null:A(this,a)}beginInvokeJSFromDotNet(e,t,n,r,o){const a=new Promise((e=>{const r=v(this,n);e(w(t,o)(...r||[]))}));e&&a.then((t=>A(this,[e,!0,C(t,r)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,y(t)]))))}endInvokeDotNetFromJS(e,t,n){const r=t?v(this,n):new Error(n);this.completePendingCall(parseInt(e,10),t,r)}invokeDotNetStaticMethod(e,t,...n){return this.invokeDotNetMethod(e,t,null,n)}invokeDotNetStaticMethodAsync(e,t,...n){return this.invokeDotNetMethodAsync(e,t,null,n)}invokeDotNetMethod(e,t,n,r){if(this._dotNetCallDispatcher.invokeDotNetFromJS){const o=A(this,r),a=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,o);return a?v(this,a):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeDotNetMethodAsync instead.")}invokeDotNetMethodAsync(e,t,n,r){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const o=this._nextAsyncCallId++,a=new Promise(((e,t)=>{this._pendingAsyncCalls[o]={resolve:e,reject:t}}));try{const a=A(this,r);this._dotNetCallDispatcher.beginInvokeDotNetFromJS(o,e,t,n,a)}catch(e){this.completePendingCall(o,!1,e)}return a}receiveByteArray(e,t){this._byteArraysToBeRevived.set(e,t)}processByteArray(e){const t=this._byteArraysToBeRevived.get(e);return t?(this._byteArraysToBeRevived.delete(e),t):null}supplyDotNetStream(e,t){if(this._pendingDotNetToJSStreams.has(e)){const n=this._pendingDotNetToJSStreams.get(e);this._pendingDotNetToJSStreams.delete(e),n.resolve(t)}else{const n=new D;n.resolve(t),this._pendingDotNetToJSStreams.set(e,n)}}getDotNetStreamPromise(e){let t;if(this._pendingDotNetToJSStreams.has(e))t=this._pendingDotNetToJSStreams.get(e).streamPromise,this._pendingDotNetToJSStreams.delete(e);else{const n=new D;this._pendingDotNetToJSStreams.set(e,n),t=n.streamPromise}return t}completePendingCall(e,t,n){if(!this._pendingAsyncCalls.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const r=this._pendingAsyncCalls[e];delete this._pendingAsyncCalls[e],t?r.resolve(n):r.reject(n)}}function y(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function w(e,t){const n=u[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function E(e){delete u[e]}e.findJSFunction=w,e.disposeJSObjectReferenceById=E;class S{constructor(e,t){this._id=e,this._callDispatcher=t}invokeMethod(e,...t){return this._callDispatcher.invokeDotNetMethod(null,e,this._id,t)}invokeMethodAsync(e,...t){return this._callDispatcher.invokeDotNetMethodAsync(null,e,this._id,t)}dispose(){this._callDispatcher.invokeDotNetMethodAsync(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{[r]:this._id}}}e.DotNetObject=S,f((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(r))return new S(t[r],c);if(t.hasOwnProperty(n)){const e=t[n],r=u[e];if(r)return r.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(o)){const e=t[o],n=c.processByteArray(e);if(void 0===n)throw new Error(`Byte array index '${e}' does not exist.`);return n}if(t.hasOwnProperty(a)){const e=t[a],n=c.getDotNetStreamPromise(e);return new I(n)}}return t}));class I{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class D{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function C(e,t){switch(t){case d.Default:return e;case d.JSObjectReference:return p(e);case d.JSStreamReference:return m(e);case d.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let N=0;function A(e,t){N=0,c=e;const n=JSON.stringify(t,k);return c=void 0,n}function k(e,t){if(t instanceof S)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(N,t);const e={[o]:N};return N++,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 a=new Map,i=new Map,s=[];function c(e){return a.get(e)}function l(e){const t=a.get(e);return(null==t?void 0:t.browserEventName)||e}function u(e,t){e.forEach((e=>a.set(e,t)))}function d(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}{const e=function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t);return{value:e?!!t.checked:t.value}}}}),u(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),u(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...h(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"],{createEventArgs:e=>({type:e.type})}),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,type:t.type};var t}}),u(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>h(e)}),u(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno,type:t.type};var t}}),u(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total,type:t.type};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{...h(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{...h(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),u(["toggle"],{createEventArgs:()=>({})});const f=["date","datetime-local","month","time","week"],p=new Map;let m,v,g=0;const b={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const r="__bl-dynamic-root:"+(++g).toString();p.set(r,e);const o=await E().invokeMethodAsync("AddRootComponent",t,r),a=new w(o,v[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(!m)throw new Error("Dynamic root components have not been enabled in this application.");return m}const S=[];let I;const D=new Promise((e=>{I=e}));function C(e,t,n){return A(e,t.eventHandlerId,(()=>N(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function N(e){const t=S[e];if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let A=(e,t,n)=>n();const k=x(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),T={submit:!0},R=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,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(),a=null,i=!1;const s=Object.prototype.hasOwnProperty.call(k,e);let l=!1;for(;r;){const h=r,f=this.getEventHandlerInfosForElement(h,!1);if(f){const n=f.getHandler(e);if(n&&(u=h,d=t.type,!((u instanceof HTMLButtonElement||u instanceof HTMLInputElement||u instanceof HTMLTextAreaElement||u instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(R,d)&&u.disabled))){if(!i){const n=c(e);a=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},i=!0}Object.prototype.hasOwnProperty.call(T,t.type)&&t.preventDefault(),C(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},a)}f.stopPropagation(e)&&(l=!0),f.preventDefault(e)&&t.preventDefault()}r=s||l?void 0:n.shift()}var u,d}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new L:null}}_.nextEventDelegatorId=0;class O{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=l(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(k,e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(Object.prototype.hasOwnProperty.call(this.infosByEventHandlerId,t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=l(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(Object.prototype.hasOwnProperty.call(this.countByEventName,e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class L{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return Object.prototype.hasOwnProperty.call(this.handlers,e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function x(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const F=q("_blazorLogicalChildren"),P=q("_blazorLogicalParent"),M=q("_blazorLogicalEnd");function B(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return F in e||(e[F]=[]),e}function j(e,t){const n=document.createComment("!");return H(n,e,t),n}function H(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(U(r))throw new Error("Not implemented: moving existing logical children");const o=K(t);if(n0;)J(n,0)}const r=n;r.parentNode.removeChild(r)}function U(e){return e[P]||null}function $(e,t){return K(e)[t]}function z(e){const t=W(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function K(e){return e[F]}function X(e,t){const n=K(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=G(e.moveRangeStart)})),t.forEach((t=>{const r=document.createComment("marker");t.moveToBeforeMarker=r;const o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):V(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 Y(e){const t=K(U(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function V(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=Y(t);n?n.parentNode.insertBefore(e,n):V(e,U(t))}}}function G(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=Y(e);if(t)return t.previousSibling;{const t=U(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}`}const Q="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,Q)&&"string"==typeof t[Q]?function(e){const t=`[${Z(e)}]`;return document.querySelector(t)}(t[Q]):t));const ee="_blazorDeferredValue";function te(e){return"select-multiple"===e.type}function ne(e,t){e.value=t||""}function re(e,t){e instanceof HTMLSelectElement?te(e)?function(e,t){t||(t=[]);for(let n=0;n{pe&&function(e,t){if(0!==e.button||function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e))return;if(e.defaultPrevented)return;const n=function(e){const t=!window._blazorDisableComposedPath&&e.composedPath&&e.composedPath();if(t){for(let e=0;edocument.baseURI,getLocationHref:()=>location.href,scrollToElement:Ae};function Ae(e){const t=document.getElementById(e);return!!t&&(t.scrollIntoView(),!0)}function ke(e,t,n=!1){const r=ve(e);!t.forceLoad&&me(r)?Te(r,!1,t.replaceHistoryEntry,t.historyEntryState,n):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Te(e,t,n,r=void 0,o=!1){if(Oe(),function(e){const t=e.indexOf("#");return t>-1&&location.href.replace(location.hash,"")===e.substring(0,t)}(e))!function(e,t,n){Re(e,t,n);const r=e.indexOf("#");r!==e.length-1&&Ae(e.substring(r+1))}(e,n,r);else{if(!o&&ye&&!await Le(e,r,t))return;fe=!0,Re(e,n,r),await xe(t)}}function Re(e,t,n=void 0){t?history.replaceState({userState:n,_index:we},"",e):(we++,history.pushState({userState:n,_index:we},"",e))}function _e(e){return new Promise((t=>{const n=De;De=()=>{De=n,t()},history.go(e)}))}function Oe(){Ce&&(Ce(!1),Ce=null)}function Le(e,t,n){return new Promise((r=>{Oe(),Ie?(Ee++,Ce=r,Ie(Ee,e,t,n)):r(!1)}))}async function xe(e){var t;Se&&await Se(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function Fe(e){var t,n;De&&await De(e),we=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}const Pe={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,t){const n=document.querySelector(e);n&&(n.hasAttribute("tabindex")||(n.tabIndex=-1),n.focus({preventScroll:!0}))}},Me={init:function(e,t,n,r=50){const o=je(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 i=new IntersectionObserver((function(r){r.forEach((r=>{var o;if(!r.isIntersecting)return;a.setStartAfter(t),a.setEndBefore(n);const i=a.getBoundingClientRect().height,s=null===(o=r.rootBounds)||void 0===o?void 0:o.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,i,s):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,i,s)}))}),{root:o,rootMargin:`${r}px`});i.observe(t),i.observe(n);const s=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)),i.unobserve(e),i.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)}Be[e._id]={intersectionObserver:i,mutationObserverBefore:s,mutationObserverAfter:c}},dispose:function(e){const t=Be[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete Be[e._id])}},Be={};function je(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:je(e.parentElement):null}const He={getAndRemoveExistingTitle:function(){var e;const t=document.head?document.head.getElementsByTagName("title"):[];if(0===t.length)return null;let n=null;for(let r=t.length-1;r>=0;r--){const o=t[r],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}},Je={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=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(a.blob)})),s=await new Promise((function(e){var t;const a=Math.min(1,r/i.width),s=Math.min(1,o/i.height),c=Math.min(a,s),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:a.lastModified,name:a.name,size:(null==s?void 0:s.size)||0,contentType:n,blob:s||a.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. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.`);return n}const $e=new Set,ze={enableNavigationPrompt:function(e){0===$e.size&&window.addEventListener("beforeunload",Ke),$e.add(e)},disableNavigationPrompt:function(e){$e.delete(e),0===$e.size&&window.removeEventListener("beforeunload",Ke)}};function Ke(e){e.preventDefault(),e.returnValue=!0}const Xe=new Map,We={navigateTo:function(e,t,n=!1){ke(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(a.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]),s.forEach((n=>n(e,t.browserEventName)))}a.set(e,t)},rootComponents:b,_internal:{navigationManager:Ne,domWrapper:Pe,Virtualize:Me,PageTitle:He,InputFile:Je,NavigationLock:ze,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)},attachWebRendererInterop:function(t,n,r){const o=S.length;return S.push(t),Object.keys(n).length>0&&function(t,n,r){if(m)throw new Error("Dynamic root components have already been enabled.");m=t,v=n;for(const[t,o]of Object.entries(r)){const r=e.findJSFunction(t,0);for(const e of o)r(e,n[e])}}(N(o),n,r),I(),o}}};window.Blazor=We;let Ye=!1;const Ve="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Ge=Ve?Ve.decode.bind(Ve):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("")},qe=Math.pow(2,32),Ze=Math.pow(2,21)-1;function Qe(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function et(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function tt(e,t){const n=et(e,t+4);if(n>Ze)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*qe+et(e,t)}class nt{constructor(e){this.batchData=e;const t=new it(e);this.arrayRangeReader=new st(e),this.arrayBuilderSegmentReader=new ct(e),this.diffReader=new rt(e),this.editReader=new ot(e,t),this.frameReader=new at(e,t)}updatedComponents(){return Qe(this.batchData,this.batchData.length-20)}referenceFrames(){return Qe(this.batchData,this.batchData.length-16)}disposedComponentIds(){return Qe(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return Qe(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return Qe(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return Qe(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return tt(this.batchData,n)}}class rt{constructor(e){this.batchDataUint8=e}componentId(e){return Qe(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class ot{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return Qe(this.batchDataUint8,e)}siblingIndex(e){return Qe(this.batchDataUint8,e+4)}newTreeIndex(e){return Qe(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return Qe(this.batchDataUint8,e+8)}removedAttributeName(e){const t=Qe(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class at{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return Qe(this.batchDataUint8,e)}subtreeLength(e){return Qe(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=Qe(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return Qe(this.batchDataUint8,e+8)}elementName(e){const t=Qe(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=Qe(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=Qe(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=Qe(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=Qe(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return tt(this.batchDataUint8,e+12)}}class it{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=Qe(e,e.length-4)}readString(e){if(-1===e)return null;{const n=Qe(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:i}=o;return i&&e.afterStartedCallbacks.push(i),a?a(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await D,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let Et,St=!1;async function It(){if(St)throw new Error("Blazor has already started.");St=!0,Et=e.attachDispatcher({beginInvokeDotNetFromJS:ht,endInvokeJSFromDotNet:ft,sendByteArray:pt});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 wt;return await n.importInitializersAsync(t,[]),n}();(function(){const e={AttachToDocument:(e,t)=>{!function(e,t,n){const r="::before";let o=!1;if(e.endsWith("::after"))e=e.slice(0,-7),o=!0;else if(e.endsWith(r))throw new Error(`The '${r}' selector is not supported.`);const a=function(e){const t=p.get(e);if(t)return p.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=new ce(0),de[0]=o),o.attachRootComponentToLogicalElement(n,t,r)}(0,B(a,!0),t,o)}(t,e)},RenderBatch:(e,t)=>{try{const n=yt(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),i=r.count(o),s=t.referenceFrames(),c=r.values(s),l=t.diffReader;for(let e=0;e{ut=!0,console.error(`${e}\n${t}`),function(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),Ye||(Ye=!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:Et.beginInvokeJSFromDotNet.bind(Et),EndInvokeDotNet:Et.endInvokeDotNetFromJS.bind(Et),SendByteArrayToJS:bt,Navigate:Ne.navigateTo,SetHasLocationChangingListeners:Ne.setHasLocationChangingListeners,EndLocationChanging:Ne.endLocationChanging};window.external.receiveMessage((t=>{const n=function(e){if(ut||!e||!e.startsWith(lt))return null;const t=e.substring(lt.length),[n,...r]=JSON.parse(t);return{messageType:n,args:r}}(t);if(n){if(!Object.prototype.hasOwnProperty.call(e,n.messageType))throw new Error(`Unsupported IPC message type '${n.messageType}'`);e[n.messageType].apply(null,n.args)}}))})(),We._internal.receiveWebViewDotNetDataStream=Dt,Ne.enableNavigationInterception(),Ne.listenForNavigationEvents(mt,vt),gt("AttachPage",Ne.getBaseURI(),Ne.getLocationHref()),await t.invokeAfterStartedCallbacks(We)}function Dt(e,t,n,r){!function(e,t,n,r,o){let a=Xe.get(t);if(!a){const n=new ReadableStream({start(e){Xe.set(t,e),a=e}});e.supplyDotNetStream(t,n)}o?(a.error(o),Xe.delete(t)):0===r?(a.close(),Xe.delete(t)):a.enqueue(n.length===r?n:n.subarray(0,r))}(Et,e,t,n,r)}We.start=It,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&It()})(); \ No newline at end of file From faf48ba9c1b94743d9c3f664f06e5ae6a9215654 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 20 Jun 2023 16:42:48 +0100 Subject: [PATCH 26/30] Fix error handling E2E test --- .../Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs b/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs index 4e15c1f8f977..6301b123cdc4 100644 --- a/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs +++ b/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs @@ -63,8 +63,12 @@ public async Task SendStreamingUpdatesAsync(HttpContext httpContext, Task untilT } catch (Exception ex) { + // Theoretically it might be possible to let the error middleware run, capture the output, + // then emit it in a special format so the JS code can display the error page. However + // for now we're not going to support that and will simply emit a message. HandleExceptionAfterResponseStarted(_httpContext, writer, ex); await writer.FlushAsync(); // Important otherwise the client won't receive the error message, as we're about to fail the pipeline + await _httpContext.Response.CompleteAsync(); throw; } } From d447d5a0c9fcae93327da03321931aa30c2ebb38 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 20 Jun 2023 17:47:37 +0100 Subject: [PATCH 27/30] Support external redirections too --- .../EndpointHtmlRenderer.Prerendering.cs | 20 +++++++++++++ .../src/Services/NavigationEnhancement.ts | 10 ++++++- .../EnhancedNavigationTest.cs | 29 +++++++++++++++++-- .../Pages/PageThatRedirects.razor | 4 ++- .../PageThatRedirectsWhileStreaming.razor | 4 ++- .../RazorComponents/Shared/MainLayout.razor | 4 ++- 6 files changed, 65 insertions(+), 6 deletions(-) diff --git a/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Prerendering.cs b/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Prerendering.cs index 7337adb65e1b..eb0c205cbea1 100644 --- a/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Prerendering.cs +++ b/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Prerendering.cs @@ -147,6 +147,15 @@ private static ValueTask HandleNavigationExcept "Navigation commands can not be issued during server-side prerendering after the response from the server has started. Applications must buffer the" + "response and avoid using features like FlushAsync() before all components on the page have been rendered to prevent failed navigation commands."); } + else if (IsPossibleExternalDestination(httpContext.Request, navigationException.Location) && httpContext.Request.Headers.ContainsKey("blazor-enhanced-nav")) + { + // It's unsafe to do a 301/302/etc to an external destination when this was requested via fetch, because + // assuming it doesn't expose CORS headers, we won't be allowed to follow the redirection nor will + // we even find out what the destination URL would have been. But since it's our own JS code making this + // fetch request, we can have a custom protocol for describing the URL we wanted to redirect to. + httpContext.Response.Headers.Add("blazor-enhanced-nav-redirect-location", navigationException.Location); + return new ValueTask(PrerenderedComponentHtmlContent.Empty); + } else { httpContext.Response.Redirect(navigationException.Location); @@ -154,6 +163,17 @@ private static ValueTask HandleNavigationExcept } } + private static bool IsPossibleExternalDestination(HttpRequest request, string destinationUrl) + { + if (!Uri.TryCreate(destinationUrl, UriKind.Absolute, out var absoluteUri)) + { + return false; + } + + return absoluteUri.Scheme != request.Scheme + || absoluteUri.Authority != request.Host.Value; + } + internal static ServerComponentInvocationSequence GetOrCreateInvocationId(HttpContext httpContext) { if (!httpContext.Items.TryGetValue(ComponentSequenceKey, out var result)) diff --git a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts index d11452ed6dd6..ced2051c9dea 100644 --- a/src/Components/Web.JS/src/Services/NavigationEnhancement.ts +++ b/src/Components/Web.JS/src/Services/NavigationEnhancement.ts @@ -76,8 +76,9 @@ export async function performEnhancedPageLoad(internalDestinationHref: string) { await getResponsePartsWithFraming(responsePromise, abortSignal, (response, initialContent) => { if (response.redirected) { - // Update the current URL to match the redirected destination, just like for normal navigation redirections + // We already followed a redirection, so update the current URL to match the redirected destination, just like for normal navigation redirections history.replaceState(null, '', response.url); + internalDestinationHref = response.url; } if (response.headers.get('content-type')?.startsWith('text/html')) { @@ -128,6 +129,13 @@ async function getResponsePartsWithFraming(responsePromise: Promise, a try { response = await responsePromise; + + const externalRedirectionUrl = response.headers.get('blazor-enhanced-nav-redirect-location'); + if (externalRedirectionUrl) { + location.replace(externalRedirectionUrl); + return; + } + if (!response.body) { // Not sure how this can happen, but the TypeScript annotations suggest it can onInitialDocument(response, ''); return; diff --git a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs index ddbf75f4138b..60e20195e31d 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs @@ -90,6 +90,10 @@ public void CanFollowSynchronousRedirection() Browser.Equal("Hello", () => h1Elem.Text); // Click a link and show we redirected, preserving elements, and updating the URL + // Note that in this specific case we can't preserve the hash part of the URL, as it + // gets lost when the browser follows a 'fetch' redirection. If we decide it's important + // to support this later, we'd have to change the server not to do a real redirection + // here and instead use the same protocol it uses for external redirections. Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Redirect")).Click(); Browser.Equal("Scroll to hash", () => h1Elem.Text); Assert.EndsWith("/subdir/scroll-to-hash", Browser.Url); @@ -108,10 +112,11 @@ public void CanFollowAsynchronousRedirectionWhileStreaming() var h1Elem = Browser.Exists(By.TagName("h1")); Browser.Equal("Hello", () => h1Elem.Text); - // Click a link and show we redirected, preserving elements, and updating the URL + // Click a link and show we redirected, preserving elements, scrolling to hash, and updating the URL Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Redirect while streaming")).Click(); Browser.Equal("Scroll to hash", () => h1Elem.Text); - Assert.EndsWith("/subdir/scroll-to-hash", Browser.Url); + Browser.True(() => BrowserScrollY > 500); + Assert.EndsWith("/subdir/scroll-to-hash#some-content", Browser.Url); // See that 'back' takes you to the place from before the redirection Browser.Navigate().Back(); @@ -119,6 +124,26 @@ public void CanFollowAsynchronousRedirectionWhileStreaming() Assert.EndsWith("/subdir", Browser.Url); } + [Fact] + public void CanFollowSynchronousExternalRedirection() + { + Navigate(ServerPathBase); + Browser.Equal("Hello", () => Browser.Exists(By.TagName("h1")).Text); + + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Redirect external")).Click(); + Browser.Contains("microsoft.com", () => Browser.Url); + } + + [Fact] + public void CanFollowAsynchronousExternalRedirectionWhileStreaming() + { + Navigate(ServerPathBase); + Browser.Equal("Hello", () => Browser.Exists(By.TagName("h1")).Text); + + Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Redirect external while streaming")).Click(); + Browser.Contains("microsoft.com", () => Browser.Url); + } + private long BrowserScrollY { get => Convert.ToInt64(((IJavaScriptExecutor)Browser).ExecuteScript("return window.scrollY"), CultureInfo.CurrentCulture); diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirects.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirects.razor index 34a77829a12c..c4e7565d4e8b 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirects.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirects.razor @@ -1,8 +1,10 @@ @page "/do-redirection" @inject NavigationManager Nav @code { + [Parameter, SupplyParameterFromQuery] public string Destination { get; set; } + protected override void OnInitialized() { - Nav.NavigateTo("scroll-to-hash"); + Nav.NavigateTo(Destination ?? "scroll-to-hash#some-content"); } } diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirectsWhileStreaming.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirectsWhileStreaming.razor index be1ae801b433..d4ab14922df8 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirectsWhileStreaming.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PageThatRedirectsWhileStreaming.razor @@ -3,9 +3,11 @@ @inject NavigationManager Nav

Please wait...

@code { + [Parameter, SupplyParameterFromQuery] public string Destination { get; set; } + protected override async Task OnInitializedAsync() { await Task.Delay(2000); - Nav.NavigateTo("scroll-to-hash"); + Nav.NavigateTo(Destination ?? "scroll-to-hash#some-content"); } } diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor index 65a622abd90f..6c7b9ce00e1c 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Shared/MainLayout.razor @@ -7,7 +7,9 @@ Non-HTML page | Scroll to hash | Redirect | - Redirect while streaming| + Redirect external | + Redirect while streaming | + Redirect external while streaming | Error while streaming
From e9fe08e2c361ef4f8357664d3753e531b3ccf085 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 20 Jun 2023 17:49:46 +0100 Subject: [PATCH 28/30] Update .js --- src/Components/Web.JS/dist/Release/blazor.web.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Web.JS/dist/Release/blazor.web.js b/src/Components/Web.JS/dist/Release/blazor.web.js index 5d0421325ee3..13a77fc22d78 100644 --- a/src/Components/Web.JS/dist/Release/blazor.web.js +++ b/src/Components/Web.JS/dist/Release/blazor.web.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){const t=[],n="__jsObjectId",r="__dotNetObject",o="__byte[]",i="__dotNetStream",s="__jsStreamReferenceLength";let a,c;class l{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 h={0:new l(window)};h[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let d,u=1;function p(e){t.push(e)}function f(e){if(e&&"object"==typeof e){h[u]=new l(e);const t={[n]: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 r={[s]:t};try{const t=f(e);r[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return r}function m(e,n){c=e;const r=n?JSON.parse(n,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null;return c=void 0,r}function y(){if(void 0===a)throw new Error("No call dispatcher has been set.");if(null===a)throw new Error("There are multiple .NET runtimes present, so a default dispatcher could not be resolved. Use DotNetObject to invoke .NET instance methods.");return a}e.attachDispatcher=function(e){const t=new w(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=p,e.invokeMethod=function(e,t,...n){return y().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return y().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=f,e.createJSStreamReference=g,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&_(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(d=e.JSCallResultType||(e.JSCallResultType={}));class w{constructor(e){this._dotNetCallDispatcher=e,this._byteArraysToBeRevived=new Map,this._pendingDotNetToJSStreams=new Map,this._pendingAsyncCalls={},this._nextAsyncCallId=1}getDotNetCallDispatcher(){return this._dotNetCallDispatcher}invokeJSFromDotNet(e,t,n,r){const o=m(this,t),i=I(b(e,r)(...o||[]),n);return null==i?null:T(this,i)}beginInvokeJSFromDotNet(e,t,n,r,o){const i=new Promise((e=>{const r=m(this,n);e(b(t,o)(...r||[]))}));e&&i.then((t=>T(this,[e,!0,I(t,r)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,v(t)]))))}endInvokeDotNetFromJS(e,t,n){const r=t?m(this,n):new Error(n);this.completePendingCall(parseInt(e,10),t,r)}invokeDotNetStaticMethod(e,t,...n){return this.invokeDotNetMethod(e,t,null,n)}invokeDotNetStaticMethodAsync(e,t,...n){return this.invokeDotNetMethodAsync(e,t,null,n)}invokeDotNetMethod(e,t,n,r){if(this._dotNetCallDispatcher.invokeDotNetFromJS){const o=T(this,r),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,o);return i?m(this,i):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeDotNetMethodAsync instead.")}invokeDotNetMethodAsync(e,t,n,r){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const o=this._nextAsyncCallId++,i=new Promise(((e,t)=>{this._pendingAsyncCalls[o]={resolve:e,reject:t}}));try{const i=T(this,r);this._dotNetCallDispatcher.beginInvokeDotNetFromJS(o,e,t,n,i)}catch(e){this.completePendingCall(o,!1,e)}return i}receiveByteArray(e,t){this._byteArraysToBeRevived.set(e,t)}processByteArray(e){const t=this._byteArraysToBeRevived.get(e);return t?(this._byteArraysToBeRevived.delete(e),t):null}supplyDotNetStream(e,t){if(this._pendingDotNetToJSStreams.has(e)){const n=this._pendingDotNetToJSStreams.get(e);this._pendingDotNetToJSStreams.delete(e),n.resolve(t)}else{const n=new C;n.resolve(t),this._pendingDotNetToJSStreams.set(e,n)}}getDotNetStreamPromise(e){let t;if(this._pendingDotNetToJSStreams.has(e))t=this._pendingDotNetToJSStreams.get(e).streamPromise,this._pendingDotNetToJSStreams.delete(e);else{const n=new C;this._pendingDotNetToJSStreams.set(e,n),t=n.streamPromise}return t}completePendingCall(e,t,n){if(!this._pendingAsyncCalls.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const r=this._pendingAsyncCalls[e];delete this._pendingAsyncCalls[e],t?r.resolve(n):r.reject(n)}}function v(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function b(e,t){const n=h[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function _(e){delete h[e]}e.findJSFunction=b,e.disposeJSObjectReferenceById=_;class E{constructor(e,t){this._id=e,this._callDispatcher=t}invokeMethod(e,...t){return this._callDispatcher.invokeDotNetMethod(null,e,this._id,t)}invokeMethodAsync(e,...t){return this._callDispatcher.invokeDotNetMethodAsync(null,e,this._id,t)}dispose(){this._callDispatcher.invokeDotNetMethodAsync(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{[r]:this._id}}}e.DotNetObject=E,p((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(r))return new E(t[r],c);if(t.hasOwnProperty(n)){const e=t[n],r=h[e];if(r)return r.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(o)){const e=t[o],n=c.processByteArray(e);if(void 0===n)throw new Error(`Byte array index '${e}' does not exist.`);return n}if(t.hasOwnProperty(i)){const e=t[i],n=c.getDotNetStreamPromise(e);return new S(n)}}return t}));class S{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class C{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function I(e,t){switch(t){case d.Default:return e;case d.JSObjectReference:return f(e);case d.JSStreamReference:return g(e);case d.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let k=0;function T(e,t){k=0,c=e;const n=JSON.stringify(t,x);return c=void 0,n}function x(e,t){if(t instanceof E)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(k,t);const e={[o]:k};return k++,e}return t}}(e||(e={})),function(e){e[e.prependFrame=1]="prependFrame",e[e.removeFrame=2]="removeFrame",e[e.setAttribute=3]="setAttribute",e[e.removeAttribute=4]="removeAttribute",e[e.updateText=5]="updateText",e[e.stepIn=6]="stepIn",e[e.stepOut=7]="stepOut",e[e.updateMarkup=8]="updateMarkup",e[e.permutationListEntry=9]="permutationListEntry",e[e.permutationListEnd=10]="permutationListEnd"}(t||(t={})),function(e){e[e.element=1]="element",e[e.text=2]="text",e[e.attribute=3]="attribute",e[e.component=4]="component",e[e.region=5]="region",e[e.elementReferenceCapture=6]="elementReferenceCapture",e[e.markup=8]="markup"}(n||(n={}));class o{constructor(e,t){this.componentId=e,this.fieldValue=t}static fromEvent(e,t){const n=t.target;if(n instanceof Element){const t=function(e){return e instanceof HTMLInputElement?e.type&&"checkbox"===e.type.toLowerCase()?{value:e.checked}:{value:e.value}:e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement?{value:e.value}:null}(n);if(t)return new o(e,t.value)}return null}}const i=new Map,s=new Map,a=[];function c(e){return i.get(e)}function l(e){const t=i.get(e);return(null==t?void 0:t.browserEventName)||e}function h(e,t){e.forEach((e=>i.set(e,t)))}function d(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}{const e=function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t);return{value:e?!!t.checked:t.value}}}}),h(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),h(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...u(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),h(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),h(["keydown","keyup","keypress"],{createEventArgs:e=>{return{key:(t=e).key,code:t.code,location:t.location,repeat:t.repeat,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),h(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>u(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: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}}),h(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...u(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{...u(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 E().invokeMethodAsync("AddRootComponent",t,r),i=new _(o,m[t]);return await i.setParameters(n),i}};function v(e){const t=f.get(e);if(t)return f.delete(e),t}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(!g)throw new Error("Dynamic root components have not been enabled in this application.");return g}const S=[];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[e];if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let x=(e,t,n)=>n();const D=M(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),N={submit:!0},A=M(["click","dblclick","mousedown","mousemove","mouseup"]);class R{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++R.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new P(this.onGlobalEvent.bind(this))}setListener(e,t,n,r){const o=this.getEventHandlerInfosForElement(e,!0),i=o.getHandler(t);if(i)this.eventInfoStore.update(i.eventHandlerId,n);else{const i={element:e,eventName:t,eventHandlerId:n,renderingComponentId:r};this.eventInfoStore.add(i),o.setHandler(t,i)}}getHandler(e){return this.eventInfoStore.get(e)}removeListener(e){const t=this.eventInfoStore.remove(e);if(t){const e=t.element,n=this.getEventHandlerInfosForElement(e,!1);n&&n.removeHandler(t.eventName)}}notifyAfterClick(e){this.afterClickCallbacks.push(e),this.eventInfoStore.addGlobalListener("click")}setStopPropagation(e,t,n){this.getEventHandlerInfosForElement(e,!0).stopPropagation(t,n)}setPreventDefault(e,t,n){this.getEventHandlerInfosForElement(e,!0).preventDefault(t,n)}onGlobalEvent(e){if(!(e.target instanceof Element))return;this.dispatchGlobalEventToAllElements(e.type,e);const t=(n=e.type,s.get(n));var n;t&&t.forEach((t=>this.dispatchGlobalEventToAllElements(t,e))),"click"===e.type&&this.afterClickCallbacks.forEach((t=>t(e)))}dispatchGlobalEventToAllElements(e,t){const n=t.composedPath();let r=n.shift(),i=null,s=!1;const a=Object.prototype.hasOwnProperty.call(D,e);let l=!1;for(;r;){const u=r,p=this.getEventHandlerInfosForElement(u,!1);if(p){const n=p.getHandler(e);if(n&&(h=u,d=t.type,!((h instanceof HTMLButtonElement||h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(A,d)&&h.disabled))){if(!s){const n=c(e);i=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(N,t.type)&&t.preventDefault(),k(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},i)}p.stopPropagation(e)&&(l=!0),p.preventDefault(e)&&t.preventDefault()}r=a||l?void 0:n.shift()}var h,d}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new U:null}}R.nextEventDelegatorId=0;class P{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},a.push(this.handleEventNameAliasAdded.bind(this))}add(e){if(this.infosByEventHandlerId[e.eventHandlerId])throw new Error(`Event ${e.eventHandlerId} is already tracked`);this.infosByEventHandlerId[e.eventHandlerId]=e,this.addGlobalListener(e.eventName)}get(e){return this.infosByEventHandlerId[e]}addGlobalListener(e){if(e=l(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(D,e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(Object.prototype.hasOwnProperty.call(this.infosByEventHandlerId,t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=l(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(Object.prototype.hasOwnProperty.call(this.countByEventName,e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class U{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return Object.prototype.hasOwnProperty.call(this.handlers,e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function M(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const L=Z("_blazorLogicalChildren"),B=Z("_blazorLogicalParent"),O=Z("_blazorLogicalEnd");function F(e,t){if(!e.parentNode)throw new Error(`Comment not connected to the DOM ${e.textContent}`);const n=e.parentNode,r=$(n,!0),o=K(r);return Array.from(n.childNodes).forEach((e=>o.push(e))),e[B]=r,t&&(e[O]=t,$(t)),$(e)}function $(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 j(n,e,t),n}function j(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(z(r))throw new Error("Not implemented: moving existing logical children");const o=K(t);if(n0;)W(n,0)}const r=n;r.parentNode.removeChild(r)}function z(e){return e[B]||null}function J(e,t){return K(e)[t]}function q(e){const t=X(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=Q(e.moveRangeStart)})),t.forEach((t=>{const r=document.createComment("marker");t.moveToBeforeMarker=r;const o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):Y(r,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd;let i=r;for(;i;){const e=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=e}n.removeChild(t)})),t.forEach((e=>{n[e.toSiblingIndex]=e.moveRangeStart}))}function X(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 G(e){const t=K(z(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=G(t);n?n.parentNode.insertBefore(e,n):Y(e,z(t))}}}function Q(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=G(e);if(t)return t.previousSibling;{const t=z(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:Q(t)}}function Z(e){return"function"==typeof Symbol?Symbol():e}function ee(e){return`_bl_${e}`}const te="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,te)&&"string"==typeof t[te]?function(e){const t=`[${ee(e)}]`;return document.querySelector(t)}(t[te]):t));const ne="_blazorDeferredValue";function re(e,t,n){switch(t){case"value":return function(e,t){switch(t&&"INPUT"===e.tagName&&(t=function(e,t){switch(t.getAttribute("type")){case"time":return 8!==e.length||!e.endsWith("00")&&t.hasAttribute("step")?e:e.substring(0,5);case"datetime-local":return 19!==e.length||!e.endsWith("00")&&t.hasAttribute("step")?e:e.substring(0,16);default:return e}}(t,e)),e.tagName){case"INPUT":case"SELECT":case"TEXTAREA":return t&&e instanceof HTMLSelectElement&&se(e)&&(t=JSON.parse(t)),ce(e,t),e[ne]=t,!0;case"OPTION":return t||""===t?e.setAttribute("value",t):e.removeAttribute("value"),le(e),!0;default:return!1}}(e,n);case"checked":return function(e,t){return"INPUT"===e.tagName&&(e.checked=null!==t,!0)}(e,n);default:return!1}}function oe(e){switch(e.name){case"value":{const t=e.ownerElement;switch(t.tagName){case"INPUT":case"SELECT":case"TEXTAREA":return t.value}break}case"checked":{const t=e.ownerElement;if("INPUT"===t.tagName){const e=t;return e.checked?e.value:""}break}}return e.value}function ie(e){e instanceof HTMLOptionElement?le(e):ne in e&&ce(e,e[ne])}function se(e){return"select-multiple"===e.type}function ae(e,t){e.value=t||""}function ce(e,t){e instanceof HTMLSelectElement?se(e)?function(e,t){t||(t=[]);for(let n=0;n{ke()&&Ee(e,(e=>{Oe(e,!0,!1)}))}))}attachRootComponentToLogicalElement(e,t,n){this.attachComponentToElement(e,t),this.rootComponentIds.add(e),n||(ue[e]=t)}updateComponent(e,t,n,r){var o;const i=this.childComponentLocations[t];if(!i)throw new Error(`No element is currently associated with component ${t}`);const s=ue[t];if(s){const e=function(e){return e[O]||null}(s);delete ue[t],e?function(e,t){const n=z(e);if(!n)throw new Error("Can't clear between nodes. The start node does not have a logical parent.");const r=K(n),o=r.indexOf(e)+1,i=r.indexOf(t);for(let e=o;e<=i;e++)W(n,o);e.textContent="!"}(s,e):function(e){let t;for(;t=e.firstChild;)e.removeChild(t)}(s)}const a=null===(o=X(i))||void 0===o?void 0:o.getRootNode(),c=a&&a.activeElement;this.applyEdits(e,t,i,0,n,r),c instanceof HTMLElement&&a&&a.activeElement!==c&&c.focus()}disposeComponent(e){this.rootComponentIds.delete(e)&&function(e){const t=K(e);for(;t.length;)W(e,0)}(this.childComponentLocations[e]),delete this.childComponentLocations[e]}disposeEventHandler(e){this.eventDelegator.removeListener(e)}attachComponentToElement(e,t){this.childComponentLocations[e]=t}applyEdits(e,n,r,o,i,s){let a,c=0,l=o;const h=e.arrayBuilderSegmentReader,d=e.editReader,u=e.frameReader,p=h.values(i),f=h.offset(i),g=f+h.count(i);for(let i=f;idocument.baseURI,getLocationHref:()=>location.href,scrollToElement:Le};function Le(e){const t=document.getElementById(e);return!!t&&(t.scrollIntoView(),!0)}function Be(e,t,n=!1){const r=Ce(e);!t.forceLoad&&Se(r)?Oe(r,!1,t.replaceHistoryEntry,t.historyEntryState,n):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Oe(e,t,n,r=void 0,o=!1){if(He(),function(e){const t=e.indexOf("#");return t>-1&&location.href.replace(location.hash,"")===e.substring(0,t)}(e))!function(e,t,n){Fe(e,t,n);const r=e.indexOf("#");r!==e.length-1&&Le(e.substring(r+1))}(e,n,r);else{if(!o&&xe&&!await je(e,r,t))return;ye=!0,Fe(e,n,r),await We(t)}}function Fe(e,t,n=void 0){t?history.replaceState({userState:n,_index:De},"",e):(De++,history.pushState({userState:n,_index:De},"",e))}function $e(e){return new Promise((t=>{const n=Pe;Pe=()=>{Pe=n,t()},history.go(e)}))}function He(){Ue&&(Ue(!1),Ue=null)}function je(e,t,n){return new Promise((r=>{He(),Re?(Ne++,Ue=r,Re(Ne,e,t,n)):r(!1)}))}async function We(e){var t;Ae&&await Ae(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function ze(e){var t,n;Pe&&await Pe(e),De=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}const Je={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,t){const n=document.querySelector(e);n&&(n.hasAttribute("tabindex")||(n.tabIndex=-1),n.focus({preventScroll:!0}))}},qe={init:function(e,t,n,r=50){const o=Ve(t);(o||document.documentElement).style.overflowAnchor="none";const i=document.createRange();h(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(r){r.forEach((r=>{var o;if(!r.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const s=i.getBoundingClientRect().height,a=null===(o=r.rootBounds)||void 0===o?void 0:o.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,s,a):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,s,a)}))}),{root:o,rootMargin:`${r}px`});s.observe(t),s.observe(n);const a=l(t),c=l(n);function l(e){const t={attributes:!0},n=new MutationObserver(((n,r)=>{h(e.parentElement)&&(r.disconnect(),e.style.display="table-row",r.observe(e,t)),s.unobserve(e),s.observe(e)}));return n.observe(e,t),n}function h(e){return null!==e&&(e instanceof HTMLTableElement&&""===e.style.display||"table"===e.style.display||e instanceof HTMLTableSectionElement&&""===e.style.display||"table-row-group"===e.style.display)}Ke[e._id]={intersectionObserver:s,mutationObserverBefore:a,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 Ve(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:Ve(e.parentElement):null}const Xe={getAndRemoveExistingTitle:function(){var e;const t=document.head?document.head.getElementsByTagName("title"):[];if(0===t.length)return null;let n=null;for(let r=t.length-1;r>=0;r--){const o=t[r],i=o.previousSibling;i instanceof Comment&&null!==z(i)||(null===n&&(n=o.textContent),null===(e=o.parentNode)||void 0===e||e.removeChild(o))}return n}},Ge={init:function(e,t){t._blazorInputFileNextFileId=0,t.addEventListener("click",(function(){t.value=""})),t.addEventListener("change",(function(){t._blazorFilesById={};const n=Array.prototype.map.call(t.files,(function(e){const n={id:++t._blazorInputFileNextFileId,lastModified:new Date(e.lastModified).toISOString(),name:e.name,size:e.size,contentType:e.type,readPromise:void 0,arrayBuffer:void 0,blob:e};return t._blazorFilesById[n.id]=n,n}));e.invokeMethodAsync("NotifyChange",n)}))},toImageFile:async function(e,t,n,r,o){const i=Ye(e,t),s=await new Promise((function(e){const t=new Image;t.onload=function(){URL.revokeObjectURL(t.src),e(t)},t.onerror=function(){t.onerror=null,URL.revokeObjectURL(t.src)},t.src=URL.createObjectURL(i.blob)})),a=await new Promise((function(e){var t;const i=Math.min(1,r/s.width),a=Math.min(1,o/s.height),c=Math.min(i,a),l=document.createElement("canvas");l.width=Math.round(s.width*c),l.height=Math.round(s.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(s,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return Ye(e,t).blob}};function Ye(e,t){const n=e._blazorFilesById[t];if(!n)throw new Error(`There is no file with ID ${t}. The file list may have changed. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.`);return n}const Qe=new Set,Ze={enableNavigationPrompt:function(e){0===Qe.size&&window.addEventListener("beforeunload",et),Qe.add(e)},disableNavigationPrompt:function(e){Qe.delete(e),0===Qe.size&&window.removeEventListener("beforeunload",et)}};function et(e){e.preventDefault(),e.returnValue=!0}async function tt(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 nt=new Map,rt={navigateTo:function(e,t,n=!1){Be(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(i.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=s.get(t.browserEventName);n?n.push(e):s.set(t.browserEventName,[e]),a.forEach((n=>n(e,t.browserEventName)))}i.set(e,t)},rootComponents:w,_internal:{navigationManager:Me,domWrapper:Je,Virtualize:qe,PageTitle:Xe,InputFile:Ge,NavigationLock:Ze,getJSDataStreamChunk:tt,attachWebRendererInterop:function(t,n,r){const o=S.length;return S.push(t),Object.keys(n).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.findJSFunction(t,0);for(const e of o)r(e,n[e])}}(T(o),n,r),C(),o}}};window.Blazor=rt;const ot=[0,2e3,1e4,3e4,null];class it{constructor(e){this._retryDelays=void 0!==e?[...e,null]:ot}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class st{}st.Authorization="Authorization",st.Cookie="Cookie";class at{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class ct{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}class lt extends ct{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&401===n.statusCode&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[st.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[st.Authorization]&&delete e.headers[st.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}class ht extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class dt extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class ut extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class pt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class ft extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class gt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class mt extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class yt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}var wt;!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"}(wt||(wt={}));class vt{constructor(){}log(e,t){}}vt.instance=new vt;const bt="0.0.0-DEV_BUILD";class _t{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&&"object"==typeof window.document}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isReactNative(){return"object"==typeof window&&void 0===window.document}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}}function St(e,t){let n="";return Ct(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 Ct(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function It(e,t,n,r,o,i){const s={},[a,c]=xt();s[a]=c,e.log(wt.Trace,`(${t} transport) sending data. ${St(o,i.logMessageContent)}.`);const l=Ct(o)?"arraybuffer":"text",h=await n.post(r,{content:o,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(wt.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class kt{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 Tt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${wt[e]}: ${t}`;switch(e){case wt.Critical:case wt.Error:this.out.error(n);break;case wt.Warning:this.out.warn(n);break;case wt.Information:this.out.info(n);break;default:this.out.log(n)}}}}function xt(){let e="X-SignalR-User-Agent";return Et.isNode&&(e="User-Agent"),[e,Dt(bt,Nt(),Et.isNode?"NodeJS":"Browser",At())]}function Dt(e,t,n,r){let o="Microsoft SignalR/";const i=e.split(".");return o+=`${i[0]}.${i[1]}`,o+=` (${e}; `,o+=t&&""!==t?`${t}; `:"Unknown OS; ",o+=`${n}`,o+=r?`; ${r}`:"; Unknown Runtime Version",o+=")",o}function Nt(){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 At(){if(Et.isNode)return process.versions.node}function Rt(e){return e.stack?e.stack:e.message?e.message:`${e}`}class Pt extends ct{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e=require;this._jar=new(e("tough-cookie").CookieJar),"undefined"==typeof fetch?this._fetchType=e("node-fetch"):this._fetchType=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 ut;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 ut});let r,o=null;if(e.timeout){const r=e.timeout;o=setTimeout((()=>{t.abort(),this._logger.log(wt.Warning,"Timeout from HTTP request."),n=new dt}),r)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Ct(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");try{r=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:!0===e.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(e){if(n)throw n;throw this._logger.log(wt.Warning,`Error from HTTP request. ${e}.`),e}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!r.ok){const e=await Ut(r,"text");throw new ht(e||r.statusText,r.status)}const i=Ut(r,e.responseType),s=await i;return new at(r.status,r.statusText,s)}getCookieString(e){return""}}function Ut(e,t){let n;switch(t){case"arraybuffer":n=e.arrayBuffer();break;case"text":default:n=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`)}return n}class Mt extends ct{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ut):e.method?e.url?new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),r.withCredentials=void 0===e.withCredentials||e.withCredentials,r.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===e.content&&(e.content=void 0),e.content&&(Ct(e.content)?r.setRequestHeader("Content-Type","application/octet-stream"):r.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach((e=>{r.setRequestHeader(e,o[e])})),e.responseType&&(r.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{r.abort(),n(new ut)}),e.timeout&&(r.timeout=e.timeout),r.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),r.status>=200&&r.status<300?t(new at(r.status,r.statusText,r.response||r.responseText)):n(new ht(r.response||r.responseText||r.statusText,r.status))},r.onerror=()=>{this._logger.log(wt.Warning,`Error from HTTP request. ${r.status}: ${r.statusText}.`),n(new ht(r.statusText,r.status))},r.ontimeout=()=>{this._logger.log(wt.Warning,"Timeout from HTTP request."),n(new dt)},r.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Lt extends ct{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new Pt(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new Mt(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ut):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)}}var Bt,Ot,Ft,$t;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(Bt||(Bt={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Ot||(Ot={}));class Ht{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 jt{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new Ht,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(_t.isRequired(e,"url"),_t.isRequired(t,"transferFormat"),_t.isIn(t,Ot,"transferFormat"),this._url=e,this._logger.log(wt.Trace,"(LongPolling transport) Connecting."),t===Ot.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]=xt(),o={[n]:r,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===Ot.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(wt.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(wt.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new ht(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(wt.Trace,`(LongPolling transport) polling: ${n}.`);const r=await this._httpClient.get(n,t);204===r.statusCode?(this._logger.log(wt.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==r.statusCode?(this._logger.log(wt.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this._closeError=new ht(r.statusText||"",r.statusCode),this._running=!1):r.content?(this._logger.log(wt.Trace,`(LongPolling transport) data received. ${St(r.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this._logger.log(wt.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof dt?this._logger.log(wt.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(wt.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(wt.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?It(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(wt.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(wt.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=xt();e[t]=n;const r={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};await this._httpClient.delete(this._url,r),this._logger.log(wt.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(wt.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(wt.Trace,e),this.onclose(this._closeError)}}}class Wt{constructor(e,t,n,r){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=r,this.onreceive=null,this.onclose=null}async connect(e,t){return _t.isRequired(e,"url"),_t.isRequired(t,"transferFormat"),_t.isIn(t,Ot,"transferFormat"),this._logger.log(wt.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,r)=>{let o,i=!1;if(t===Ot.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,i]=xt();n[r]=i,o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...n,...this._options.headers}})}try{o.onmessage=e=>{if(this.onreceive)try{this._logger.log(wt.Trace,`(SSE transport) data received. ${St(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},o.onerror=e=>{i?this._close():r(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},o.onopen=()=>{this._logger.log(wt.Information,`SSE connected to ${this._url}`),this._eventSource=o,i=!0,n()}}catch(e){return void r(e)}}else r(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(e){return this._eventSource?It(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class zt{constructor(e,t,n,r,o,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=r,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){let n;return _t.isRequired(e,"url"),_t.isRequired(t,"transferFormat"),_t.isIn(t,Ot,"transferFormat"),this._logger.log(wt.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((r,o)=>{let i;e=e.replace(/^http/,"ws");const s=this._httpClient.getCookieString(e);let a=!1;if(Et.isReactNative){const t={},[r,o]=xt();t[r]=o,n&&(t[st.Authorization]=`Bearer ${n}`),s&&(t[st.Cookie]=s),i=new this._webSocketConstructor(e,void 0,{headers:{...t,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===Ot.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(wt.Information,`WebSocket connected to ${e}.`),this._webSocket=i,a=!0,r()},i.onerror=e=>{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"There was an error with the transport",this._logger.log(wt.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(wt.Trace,`(WebSockets transport) data received. ${St(e.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(e.data)}catch(e){return void this._close(e)}},i.onclose=e=>{if(a)this._close(e);else{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(wt.Trace,`(WebSockets transport) sending data. ${St(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(wt.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 Jt{constructor(e,t={}){var n;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,_t.isRequired(e,"url"),this._logger=void 0===(n=t.logger)?new Tt(wt.Information):null===n?vt.instance:void 0!==n.log?n:new Tt(n),this.baseUrl=this._resolveUrl(e),(t=t||{}).logMessageContent=void 0!==t.logMessageContent&&t.logMessageContent,"boolean"!=typeof t.withCredentials&&void 0!==t.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.withCredentials=void 0===t.withCredentials||t.withCredentials,t.timeout=void 0===t.timeout?1e5:t.timeout,"undefined"==typeof WebSocket||t.WebSocket||(t.WebSocket=WebSocket),"undefined"==typeof EventSource||t.EventSource||(t.EventSource=EventSource),this._httpClient=new lt(t.httpClient||new Lt(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Ot.Binary,_t.isIn(e,Ot,"transferFormat"),this._logger.log(wt.Debug,`Starting connection with transfer format '${Ot[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(wt.Error,e),await this._stopPromise,Promise.reject(new ut(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(wt.Error,e),Promise.reject(new ut(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 qt(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(wt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(wt.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(wt.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(wt.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport!==Bt.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(Bt.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 ut("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const e=n.accessToken;this._accessTokenFactory=()=>e,this._httpClient._accessToken=e,this._httpClient._accessTokenFactory=void 0}r++}while(n.url&&r<100);if(100===r&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof jt&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(wt.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(wt.Error,"Failed to start the connection: "+e),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(e)}}async _getNegotiationResponse(e){const t={},[n,r]=xt();t[n]=r;const o=this._resolveNegotiateUrl(e);this._logger.log(wt.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 ht&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(wt.Error,t),Promise.reject(new mt(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(wt.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(o,r),void(this.connectionId=n.connectionId);const i=[],s=n.availableTransports||[];let a=n;for(const n of s){const s=this._resolveTransportOrError(n,t,r);if(s instanceof Error)i.push(`${n.transport} failed:`),i.push(s);else if(this._isITransport(s)){if(this.transport=s,!a){try{a=await this._getNegotiationResponse(e)}catch(e){return Promise.reject(e)}o=this._createConnectUrl(e,a.connectionToken)}try{return await this._startTransport(o,r),void(this.connectionId=a.connectionId)}catch(e){if(this._logger.log(wt.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new gt(`${n.transport} failed: ${e}`,Bt[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(wt.Debug,e),Promise.reject(new ut(e))}}}}return i.length>0?Promise.reject(new yt(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case Bt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new zt(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Bt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Wt(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Bt.LongPolling:return new jt(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n){const r=Bt[e.transport];if(null==r)return this._logger.log(wt.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(wt.Debug,`Skipping transport '${Bt[r]}' because it was disabled by the client.`),new ft(`'${Bt[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>Ot[e])).indexOf(n)>=0))return this._logger.log(wt.Debug,`Skipping transport '${Bt[r]}' because it does not support the requested transfer format '${Ot[n]}'.`),new Error(`'${Bt[r]}' does not support ${Ot[n]}.`);if(r===Bt.WebSockets&&!this._options.WebSocket||r===Bt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(wt.Debug,`Skipping transport '${Bt[r]}' because it is not supported in your environment.'`),new pt(`'${Bt[r]}' is not supported in your environment.`,r);this._logger.log(wt.Debug,`Selecting transport '${Bt[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(wt.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(wt.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(wt.Error,`Connection disconnected with error '${e}'.`):this._logger.log(wt.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(wt.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(wt.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(wt.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)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(wt.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 qt{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Kt,this._transportResult=new Kt,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Kt),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 Kt;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):qt._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 Kt{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class Vt{static write(e){return`${e}${Vt.RecordSeparator}`}static parse(e){if(e[e.length-1]!==Vt.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(Vt.RecordSeparator);return t.pop(),t}}Vt.RecordSeparatorCode=30,Vt.RecordSeparator=String.fromCharCode(Vt.RecordSeparatorCode);class Xt{writeHandshakeRequest(e){return Vt.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Ct(e)){const r=new Uint8Array(e),o=r.indexOf(Vt.RecordSeparatorCode);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(r.slice(0,i))),n=r.byteLength>i?r.slice(i).buffer:null}else{const r=e,o=r.indexOf(Vt.RecordSeparator);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=r.substring(0,i),n=r.length>i?r.substring(i):null}const r=Vt.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"}(Ft||(Ft={}));class Gt{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 kt(this,e)}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}($t||($t={}));class Yt{static create(e,t,n,r,o,i){return new Yt(e,t,n,r,o,i)}constructor(e,t,n,r,o,i){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(wt.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},_t.isRequired(e,"connection"),_t.isRequired(t,"logger"),_t.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=o?o:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=r,this._handshakeProtocol=new Xt,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=$t.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Ft.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==$t.Disconnected&&this._connectionState!==$t.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!==$t.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=$t.Connecting,this._logger.log(wt.Debug,"Starting HubConnection.");try{await this._startInternal(),Et.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=$t.Connected,this._connectionStarted=!0,this._logger.log(wt.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=$t.Disconnected,this._logger.log(wt.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(wt.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(wt.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(wt.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===$t.Disconnected?(this._logger.log(wt.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===$t.Disconnecting?(this._logger.log(wt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=$t.Disconnecting,this._logger.log(wt.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(wt.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 ut("The connection was stopped before the hub handshake could complete."),this.connection.stop(e)))}stream(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createStreamInvocation(e,t,r);let i;const s=new Gt;return s.cancelCallback=()=>{const e=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then((()=>this._sendWithProtocol(e)))},this._callbacks[o.invocationId]=(e,t)=>{t?s.error(t):e&&(e.type===Ft.Completion?e.error?s.error(new Error(e.error)):s.complete():s.next(e.item))},i=this._sendWithProtocol(o).catch((e=>{s.error(e),delete this._callbacks[o.invocationId]})),this._launchStreams(n,i),s}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._sendWithProtocol(this._createInvocation(e,t,!0,r));return this._launchStreams(n,o),o}invoke(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createInvocation(e,t,!1,r);return new Promise(((e,t)=>{this._callbacks[o.invocationId]=(n,r)=>{r?t(r):n&&(n.type===Ft.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 Ft.Invocation:this._invokeClientMethod(e);break;case Ft.StreamItem:case Ft.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===Ft.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(wt.Error,`Stream callback threw error: ${Rt(e)}`)}}break}case Ft.Ping:break;case Ft.Close:{this._logger.log(wt.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(wt.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(wt.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(wt.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(wt.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===$t.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n)return this._logger.log(wt.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(wt.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null))));const r=n.slice(),o=!!e.invocationId;let i,s,a;for(const n of r)try{const r=i;i=await n.apply(this,e.arguments),o&&i&&r&&(this._logger.log(wt.Error,`Multiple results provided for '${t}'. Sending error to server.`),a=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),s=void 0}catch(e){s=e,this._logger.log(wt.Error,`A callback for the method '${t}' threw error '${e}'.`)}a?await this._sendWithProtocol(a):o?(s?a=this._createCompletionMessage(e.invocationId,`${s}`,null):void 0!==i?a=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(wt.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),a=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(a)):i&&this._logger.log(wt.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(wt.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new ut("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===$t.Disconnecting?this._completeClose(e):this._connectionState===$t.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===$t.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=$t.Disconnected,this._connectionStarted=!1,Et.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(wt.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(wt.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=$t.Reconnecting,e?this._logger.log(wt.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(wt.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(wt.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==$t.Reconnecting)return void this._logger.log(wt.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==o;){if(this._logger.log(wt.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!==$t.Reconnecting)return void this._logger.log(wt.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=$t.Connected,this._logger.log(wt.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(wt.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(wt.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==$t.Reconnecting)return this._logger.log(wt.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===$t.Disconnecting&&this._completeClose());r=e instanceof Error?e:new Error(e.toString()),o=this._getNextRetryDelay(n++,Date.now()-t,r)}}this._logger.log(wt.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(wt.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(wt.Error,`Stream 'error' callback called with '${e}' threw error: ${Rt(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:Ft.Invocation}:{arguments:t,target:e,type:Ft.Invocation};{const n=this._invocationId;return this._invocationId++,0!==r.length?{arguments:t,invocationId:n.toString(),streamIds:r,target:e,type:Ft.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:Ft.Invocation}}}_launchStreams(e,t){if(0!==e.length){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n))))},error:e=>{let r;r=e instanceof Error?e.message:e&&e.toString?e.toString():"Unknown error",t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n,r))))},next:e=>{t=t.then((()=>this._sendWithProtocol(this._createStreamItemMessage(n,e))))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let r=0;r=55296&&o<=56319&&r65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h)}else i.push(a);i.length>=4096&&(s+=String.fromCharCode.apply(String,i),i.length=0)}return i.length>0&&(s+=String.fromCharCode.apply(String,i)),s}var fn,gn=cn?new TextDecoder:null,mn=cn?"undefined"!=typeof process&&"force"!==(null===(rn=null===process||void 0===process?void 0:process.env)||void 0===rn?void 0:rn.TEXT_DECODER)?200:0:on,yn=function(e,t){this.type=e,this.data=t},wn=(fn=function(e,t){return fn=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])},fn(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}fn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),vn=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 wn(t,e),t}(Error),bn={type:-1,encode:function(e){var t,n,r,o;return e instanceof Date?function(e){var t,n=e.sec,r=e.nsec;if(n>=0&&r>=0&&n<=17179869183){if(0===r&&n<=4294967295){var o=new Uint8Array(4);return(t=new DataView(o.buffer)).setUint32(0,n),o}var i=n/4294967296,s=4294967295&n;return o=new Uint8Array(8),(t=new DataView(o.buffer)).setUint32(0,r<<2|3&i),t.setUint32(4,s),o}return o=new Uint8Array(12),(t=new DataView(o.buffer)).setUint32(0,r),sn(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:an(t,4),nsec:t.getUint32(0)};default:throw new vn("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},_n=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(bn)}return e.prototype.register=function(e){var t=e.type,n=e.encode,r=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=r;else{var o=1+t;this.builtInEncoders[o]=n,this.builtInDecoders[o]=r}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>dn){var t=ln(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),un(e,this.bytes,this.pos),this.pos+=t}else t=ln(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var r=e.length,o=n,i=0;i>6&31|192;else{if(s>=55296&&s<=56319&&i>12&15|224,t[o++]=s>>6&63|128):(t[o++]=s>>18&7|240,t[o++]=s>>12&63|128,t[o++]=s>>6&63|128)}t[o++]=63&s|128}else t[o++]=s}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=En(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var r=0,o=e;r0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var r=0,o=this.caches[n-1];r=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)},e.prototype.decode=function(e,t,n){var r=this.find(e,t,n);if(null!=r)return this.hit++,r;this.miss++;var o=pn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,o),o},e}(),Nn=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return Nn(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,n,r,o,i,s,a;return i=this,void 0,a=function(){var i,s,a,c,l,h,d,u;return Nn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=An(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),i=!0}catch(e){if(!(e instanceof Mn))throw e}this.totalPos+=this.pos,p.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return c=p.sent(),r={error:c},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,s]}throw h=(l=this).headByte,d=l.pos,u=l.totalPos,new RangeError("Insufficient data in parsing ".concat(Cn(h)," at ").concat(u," (").concat(d," in the current buffer)"))}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{o(a.next(e))}catch(e){t(e)}}function r(e){try{o(a.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}o((a=a.apply(i,[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return function(n,r,o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,s=function(){var n,r,o,i,s,a,c,l,h;return Nn(this,(function(d){switch(d.label){case 0:n=t,r=-1,d.label=1;case 1:d.trys.push([1,13,14,19]),o=An(e),d.label=2;case 2:return[4,Rn(o.next())];case 3:if((i=d.sent()).done)return[3,12];if(s=i.value,t&&0===r)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(r=this.readArraySize(),n=!1,this.complete()),d.label=4;case 4:d.trys.push([4,9,,10]),d.label=5;case 5:return[4,Rn(this.doDecodeSync())];case 6:return[4,d.sent()];case 7:return d.sent(),0==--r?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=d.sent())instanceof Mn))throw a;return[3,10];case 10:this.totalPos+=this.pos,d.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=d.sent(),l={error:c},[3,19];case 14:return d.trys.push([14,,17,18]),i&&!i.done&&(h=o.return)?[4,Rn(h.call(o))]:[3,16];case 15:d.sent(),d.label=16;case 16:return[3,18];case 17:if(l)throw l.error;return[7];case 18:return[7];case 19:return[2]}}))}.apply(n,r||[]),a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(e){s[e]&&(i[e]=function(t){return new Promise((function(n,r){a.push([e,t,n,r])>1||l(e,t)}))})}function l(e,t){try{(n=s[e](t)).value instanceof Rn?Promise.resolve(n.value.v).then(h,d):u(a[0][2],n)}catch(e){u(a[0][3],e)}var n}function h(e){l("next",e)}function d(e){l("throw",e)}function u(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}(this,arguments)},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 vn("Unrecognized type byte: ".concat(Cn(e)));r=this.lookU32(),t=this.decodeExtension(r,4)}this.complete();for(var o=this.stack;o.length>0;){var i=o[o.length-1];if(0===i.type){if(i.array[i.position]=t,i.position++,i.position!==i.size)continue e;o.pop(),t=i.array}else{if(1===i.type){if("string"!=(s=typeof t)&&"number"!==s)throw new vn("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new vn("The key __proto__ is not allowed");i.key=t,i.type=2;continue e}if(i.map[i.key]=t,i.readCount++,i.readCount!==i.size){i.key=null,i.type=1;continue e}o.pop(),t=i.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new vn("Unrecognized array type byte: ".concat(Cn(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new vn("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new vn("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new vn("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthmn?function(e,t,n){var r=e.subarray(t,t+n);return gn.decode(r)}(this.bytes,o,e):pn(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 vn("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw Ln;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 vn("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,n,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,n},e.prototype.readI64=function(){var e=an(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}();!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"}(In||(In={})),function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(kn||(kn={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Tn||(Tn={}));class Fn{constructor(){}log(e,t){}}Fn.instance=new Fn,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"}(xn||(xn={}));class $n{static write(e){let t=e.byteLength||e.length;const n=[];do{let e=127&t;t>>=7,t>0&&(e|=128),n.push(e)}while(t>0);t=e.byteLength||e.length;const r=new Uint8Array(n.length+t);return r.set(n,0),r.set(e,n.length),r.buffer}static parse(e){const t=[],n=new Uint8Array(e),r=[0,7,14,21,28];for(let o=0;o7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+s+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+s,o+s+a):n.subarray(o+s,o+s+a)),o=o+s+a}return t}}const Hn=new Uint8Array([145,In.Ping]);class jn{constructor(e){this.name="messagepack",this.version=1,this.transferFormat=Tn.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new Sn(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new On(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=Fn.instance);const r=$n.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 In.Invocation:return this._writeInvocation(e);case In.StreamInvocation:return this._writeStreamInvocation(e);case In.StreamItem:return this._writeStreamItem(e);case In.Completion:return this._writeCompletion(e);case In.Ping:return $n.write(Hn);case In.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 In.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case In.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case In.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case In.Ping:return this._createPingMessage(n);case In.Close:return this._createCloseMessage(n);default:return t.log(xn.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:In.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:In.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:In.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:In.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:In.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:In.Completion}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([In.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([In.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),$n.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([In.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([In.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),$n.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([In.StreamItem,e.headers||{},e.invocationId,e.item]);return $n.write(t.slice())}_writeCompletion(e){const t=e.error?this._errorResult:void 0!==e.result?this._nonVoidResult:this._voidResult;let n;switch(t){case this._errorResult:n=this._encoder.encode([In.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([In.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([In.Completion,e.headers||{},e.invocationId,t,e.result])}return $n.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([In.CancelInvocation,e.headers||{},e.invocationId]);return $n.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}let Wn=!1;function zn(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),Wn||(Wn=!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 Jn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,qn=Jn?Jn.decode.bind(Jn):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("")},Kn=Math.pow(2,32),Vn=Math.pow(2,21)-1;function Xn(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Gn(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function Yn(e,t){const n=Gn(e,t+4);if(n>Vn)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Kn+Gn(e,t)}class Qn{constructor(e){this.batchData=e;const t=new nr(e);this.arrayRangeReader=new rr(e),this.arrayBuilderSegmentReader=new or(e),this.diffReader=new Zn(e),this.editReader=new er(e,t),this.frameReader=new tr(e,t)}updatedComponents(){return Xn(this.batchData,this.batchData.length-20)}referenceFrames(){return Xn(this.batchData,this.batchData.length-16)}disposedComponentIds(){return Xn(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return Xn(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return Xn(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return Xn(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return Yn(this.batchData,n)}}class Zn{constructor(e){this.batchDataUint8=e}componentId(e){return Xn(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class er{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return Xn(this.batchDataUint8,e)}siblingIndex(e){return Xn(this.batchDataUint8,e+4)}newTreeIndex(e){return Xn(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return Xn(this.batchDataUint8,e+8)}removedAttributeName(e){const t=Xn(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class tr{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return Xn(this.batchDataUint8,e)}subtreeLength(e){return Xn(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=Xn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return Xn(this.batchDataUint8,e+8)}elementName(e){const t=Xn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=Xn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=Xn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=Xn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=Xn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return Yn(this.batchDataUint8,e+12)}}class nr{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=Xn(e,e.length-4)}readString(e){if(-1===e)return null;{const n=Xn(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const i=e[t+o];if(n|=(127&i)<this.nextBatchId)return this.fatalError?(this.logger.log(ir.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(ir.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(ir.Debug,`Applying batch ${e}.`),ve(this.browserRendererId,new Qn(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(ir.Error,`There was an error applying batch ${e}.`),n.send("OnRenderCompleted",e,t.toString()),t}}getLastBatchid(){return this.nextBatchId-1}async completeBatch(e,t){try{await e.send("OnRenderCompleted",t,null)}catch{this.logger.log(ir.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}class ar{log(e,t){}}ar.instance=new ar;class cr{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${ir[e]}: ${t}`;switch(e){case ir.Critical:case ir.Error:console.error(n);break;case ir.Warning:console.warn(n);break;case ir.Information:console.info(n);break;default:console.log(n)}}}}class lr{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!==$t.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!==$t.Connected)return!1;const t=await e.invoke("StartCircuit",Me.getBaseURI(),Me.getLocationHref(),JSON.stringify(this.components.map((e=>e.toRecord()))),this.applicationState||"");return!!t&&(this.initialize(t),!0)}resolveElement(e){const t=v(e);if(t)return $(t,!0);const n=Number.parseInt(e);if(!Number.isNaN(n))return F(this.components[n].start,this.components[n].end);throw new Error(`Invalid sequence number or identifier '${e}'.`)}}const hr={configureSignalR:e=>{},logLevel:ir.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class dr{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 rt.reconnect()||this.rejected()}catch(e){this.logger.log(ir.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 ur{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const r=this.document.getElementById(ur.MaxRetriesId);r&&(r.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(ur.ShowClassName)}update(e){const t=this.document.getElementById(ur.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(ur.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(ur.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(ur.RejectedClassName)}removeClasses(){this.dialog.classList.remove(ur.ShowClassName,ur.HideClassName,ur.FailedClassName,ur.RejectedClassName)}}ur.ShowClassName="components-reconnect-show",ur.HideClassName="components-reconnect-hide",ur.FailedClassName="components-reconnect-failed",ur.RejectedClassName="components-reconnect-rejected",ur.MaxRetriesId="components-reconnect-max-retries",ur.CurrentAttemptId="components-reconnect-current-attempt";class pr{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||rt.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new ur(t,e.maxRetries,document):new dr(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new fr(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class fr{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;tfr.MaximumFirstRetryInterval?fr.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(ir.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise((t=>setTimeout(t,e)))}}function gr(e,t){switch(t){case"webassembly":return function(e){const t=wr(e,"webassembly"),n=[];for(let e=0;ee.id-t.id))}(e);case"server":return function(e){const t=wr(e,"server"),n=[];for(let e=0;ee.sequence-t.sequence))}(e)}}fr.MaximumFirstRetryInterval=3e3;const mr=/^\s*Blazor-Component-State:(?[a-zA-Z0-9+/=]+)$/;function yr(e){var t;if(e.nodeType===Node.COMMENT_NODE){const n=e.textContent||"",r=mr.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 br(e,t){const n=e.currentElement;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const r=vr.exec(n.textContent),o=r&&r.groups&&r.groups.descriptor;if(!o)return;try{const r=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(o);switch(t){case"webassembly":return function(e,t,n){const{type:r,assembly:o,typeName:i,parameterDefinitions:s,parameterValues:a,prerenderId:c}=e,l=c?_r(c,n):void 0;if(c&&!l)throw new Error(`Could not find an end component comment for '${t}'.`);if("webassembly"===r){if(!o)throw new Error("assembly must be defined when using a descriptor.");if(!i)throw new Error("typeName must be defined when using a descriptor.");return{type:r,assembly:o,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:a&&atob(a),start:t,prerenderId:c,end:l}}}(r,n,e);case"server":return function(e,t,n){const{type:r,descriptor:o,sequence:i,prerenderId:s}=e,a=s?_r(s,n):void 0;if(s&&!a)throw new Error(`Could not find an end component comment for '${t}'.`);if("server"===r){if(!o)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===i)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(i))throw new Error(`Error parsing the sequence '${i}' for component '${JSON.stringify(e)}'`);return{type:r,sequence:i,descriptor:o,start:t,prerenderId:s,end:a}}}(r,n,e)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}function _r(e,t){for(;t.next()&&t.currentElement;){const n=t.currentElement;if(n.nodeType!==Node.COMMENT_NODE)continue;if(!n.textContent)continue;const r=vr.exec(n.textContent),o=r&&r[1];if(o)return Er(o,e),n}}function Er(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 Sr{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndexasync function(e,n){const r=function(e){const t=document.baseURI;return t.endsWith("/")?`${t}${e}`:`${t}/${e}`}(n),o=await import(r);if(void 0===o)return;const{beforeStart:i,afterStarted:s}=o;return s&&e.afterStartedCallbacks.push(s),i?i(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await I,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let Tr,xr,Dr,Nr,Ar=!1;async function Rr(e,t,n){var r,o;const i=new jn;i.name="blazorpack";const s=(new en).withUrl("_blazor").withHubProtocol(i);e.configureSignalR(s);const a=s.build();a.on("JS.AttachComponent",((e,t)=>we(0,n.resolveElement(t),e,!1))),a.on("JS.BeginInvokeJS",Dr.beginInvokeJSFromDotNet.bind(Dr)),a.on("JS.EndInvokeDotNet",Dr.endInvokeDotNetFromJS.bind(Dr)),a.on("JS.ReceiveByteArray",Dr.receiveByteArray.bind(Dr)),a.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start(t){a.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});Dr.supplyDotNetStream(e,t)}));const c=sr.getOrCreate(t);a.on("JS.RenderBatch",((e,n)=>{t.log(ir.Debug,`Received render batch with id ${e} and ${n.byteLength} bytes.`),c.processBatch(e,n,a)})),a.on("JS.EndLocationChanging",rt._internal.navigationManager.endLocationChanging),a.onclose((t=>!Ar&&e.reconnectionHandler.onConnectionDown(e.reconnectionOptions,t))),a.on("JS.Error",(e=>{Ar=!0,Pr(a,e,t),zn()}));try{await a.start(),Tr=a}catch(e){if(Pr(a,e,t),"FailedToNegotiateWithServerError"===e.errorType)throw e;zn(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===Bt.WebSockets))?t.log(ir.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===Bt.WebSockets))?t.log(ir.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===Bt.LongPolling))&&t.log(ir.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===(o=null===(r=a.connection)||void 0===r?void 0:r.features)||void 0===o?void 0:o.inherentKeepAlive)&&t.log(ir.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."),a}function Pr(e,t,n){n.log(ir.Error,t),e&&e.stop()}function Ur(e){return Nr=e,Nr}var Mr,Lr;const Br=navigator,Or=Br.userAgentData&&Br.userAgentData.brands,Fr=Or?Or.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):window.chrome,$r=null!==(Lr=null===(Mr=Br.userAgentData)||void 0===Mr?void 0:Mr.platform)&&void 0!==Lr?Lr:navigator.platform;let Hr,jr,Wr,zr,Jr,qr,Kr=!1,Vr=!1;function Xr(){return(Kr||Vr)&&(Fr||navigator.userAgent.includes("Firefox"))}const Gr=Math.pow(2,32),Yr=Math.pow(2,21)-1;let Qr=null,Zr="Production";function eo(e){return jr.getI32(e)}const to={start:function(t){return async function(t){const n={},{dotnet:r}=await async function(e){if("undefined"==typeof WebAssembly||!WebAssembly.validate)throw new Error("This browser does not support WebAssembly.");const t=await async function(e,t){const n=void 0!==e?e("manifest","blazor.boot.json","_framework/blazor.boot.json",""):i("_framework/blazor.boot.json");let r;r=n?"string"==typeof n?await i(n):await n:await i("_framework/blazor.boot.json"),Zr=t||r.headers.get("Blazor-Environment")||"Production";const o=await r.json();return o.modifiableAssemblies=r.headers.get("DOTNET-MODIFIABLE-ASSEMBLIES"),o.aspnetCoreBrowserTools=r.headers.get("ASPNETCORE-BROWSER-TOOLS"),o;function i(e){return fetch(e,{method:"GET",credentials:"include",cache:"no-cache"})}}(e.loadBootResource,e.environment),n=Object.keys(t.resources.runtime).filter((e=>e.startsWith("dotnet.")&&e.endsWith(".js")))[0],r=t.resources.runtime[n];let o=`_framework/${n}`;if(e.loadBootResource){const t="dotnetjs",i=e.loadBootResource(t,n,o,r);if("string"==typeof i)o=i;else if(i)throw new Error(`For a ${t} resource, custom loaders must supply a URI string.`)}if(t.cacheBootResources){const e=document.createElement("link");e.rel="modulepreload",e.href=o,e.crossOrigin="anonymous",e.integrity=r,document.head.appendChild(e)}const i=new URL(o,document.baseURI).toString();return await import(i)}(t),o=function(e,t){const n={maxParallelDownloads:1e6,enableDownloadRetry:!1,applicationEnvironment:Zr},r={...window.Module||{},onConfigLoaded:async n=>{n.environmentVariables||(n.environmentVariables={}),0===n.icuDataMode&&(n.environmentVariables.__BLAZOR_SHARDED_ICU="1"),n.aspnetCoreBrowserTools&&(n.environmentVariables.__ASPNETCORE_BROWSER_TOOLS=n.aspnetCoreBrowserTools),rt._internal.getApplicationEnvironment=()=>n.applicationEnvironment,t.jsInitializer=await async function(e,t){const n=e.resources.libraryInitializers,r=new kr;return n&&await r.importInitializersAsync(Object.keys(n),[t,e.resources.extensions]),r}(n,e)},onDownloadResourceProgress:no,config:n,disableDotnet6Compatibility:!1,print:oo,printErr:io};return r}(t,n);r.withStartupOptions(t).withModuleConfig(o),qr=await r.create();const{MONO:i,BINDING:s,Module:a,setModuleImports:c,INTERNAL:l}=qr;Wr=a,Hr=s,jr=i,Jr=l;const h=Jr.resourceLoader;n.resourceLoader=h,function(e){Kr=!!e.bootConfig.resources.pdb,Vr=e.bootConfig.debugBuild;const t=$r.match(/^Mac/i)?"Cmd":"Alt";Xr()&&console.info(`Debugging hotkey: Shift+${t}+D (when application has focus)`),document.addEventListener("keydown",(e=>{e.shiftKey&&(e.metaKey||e.altKey)&&"KeyD"===e.code&&(Vr||Kr?navigator.userAgent.includes("Firefox")?async function(){const e=await fetch(`_framework/debug?url=${encodeURIComponent(location.href)}&isFirefox=true`);200!==e.status&&console.warn(await e.text())}():Fr?function(){const e=document.createElement("a");e.href=`_framework/debug?url=${encodeURIComponent(location.href)}`,e.target="_blank",e.rel="noopener noreferrer",e.click()}():console.error("Currently, only Microsoft Edge (80+), Google Chrome, or Chromium, are supported for debugging."):console.error("Cannot start debugging, because the application was not compiled with debugging enabled."))}))}(h),rt._internal.dotNetCriticalError=io,rt._internal.loadLazyAssembly=e=>async function(e,t){const n=e.bootConfig.resources,r=n.lazyAssembly;if(!r)throw new Error("No assemblies have been marked as lazy-loadable. Use the 'BlazorWebAssemblyLazyLoad' item group in your project file to enable lazy loading an assembly.");if(!r.hasOwnProperty(t))throw new Error(`${t} must be marked with 'BlazorWebAssemblyLazyLoad' item group in your project file to allow lazy-loading.`);const o=t,i=function(e,t){const n=e.lastIndexOf(".");if(n<0)throw new Error(`No extension to replace in '${e}'`);return e.substr(0,n)+".pdb"}(t),s=Xr()&&n.pdb&&r.hasOwnProperty(i),a=e.loadResource(o,`_framework/${o}`,r[o],"assembly").response.then((e=>e.arrayBuffer()));if(s){const t=await e.loadResource(i,`_framework/${i}`,r[i],"pdb").response.then((e=>e.arrayBuffer())),[n,o]=await Promise.all([a,t]);return{dll:new Uint8Array(n),pdb:new Uint8Array(o)}}{const e=await a;return{dll:new Uint8Array(e),pdb:null}}}(Jr.resourceLoader,e),rt._internal.loadSatelliteAssemblies=(e,t)=>async function(e,t,n){const r=e.bootConfig.resources.satelliteResources;r&&await Promise.all(t.filter((e=>r.hasOwnProperty(e))).map((t=>e.loadResources(r[t],(e=>`_framework/${e}`),"assembly"))).reduce(((e,t)=>e.concat(t)),new Array).map((async e=>{const t=await e.response,r=await t.arrayBuffer(),o={dll:new Uint8Array(r)};n(o)})))}(h,e,t),c("blazor-internal",{Blazor:{_internal:rt._internal}});const d=await qr.getAssemblyExports("Microsoft.AspNetCore.Components.WebAssembly");return Object.assign(rt._internal,{dotNetExports:{...d.Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime}}),zr=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{if(ao(),!r&&!t)throw new Error("Either assemblyName or dotNetObjectId must have a non null value.");const i=r?r.toString():t;rt._internal.dotNetExports.BeginInvokeDotNet(e?e.toString():null,i,n,o)},endInvokeJSFromDotNet:(e,t,n)=>{rt._internal.dotNetExports.EndInvokeJS(n)},sendByteArray:(e,t)=>{rt._internal.dotNetExports.ReceiveByteArrayFromJS(e,t)},invokeDotNetFromJS:(e,t,n,r)=>(ao(),rt._internal.dotNetExports.InvokeDotNet(e||null,t,null!=n?n:0,r))}),n}(t)},callEntryPoint:async function(e){try{await qr.runMain(e,[])}catch(e){console.error(e),zn()}},toUint8Array:function(e){const t=so(e),n=eo(t),r=new Uint8Array(n);return r.set(Wr.HEAPU8.subarray(t+4,t+4+n)),r},getArrayLength:function(e){return eo(so(e))},getArrayEntryPtr:function(e,t,n){return so(e)+4+t*n},getObjectFieldsBaseAddress:function(e){return e+8},readInt16Field:function(e,t){return n=e+(t||0),jr.getI16(n);var n},readInt32Field:function(e,t){return eo(e+(t||0))},readUint64Field:function(e,t){return function(e){const t=e>>2,n=Wr.HEAPU32[t+1];if(n>Yr)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Gr+Wr.HEAPU32[t]}(e+(t||0))},readFloatField:function(e,t){return n=e+(t||0),jr.getF32(n);var n},readObjectField:function(e,t){return eo(e+(t||0))},readStringField:function(e,t,n){const r=eo(e+(t||0));if(0===r)return null;if(n){const e=Hr.unbox_mono_obj(r);return"boolean"==typeof e?e?"":null:e}return Hr.conv_string(r)},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return ao(),Qr=co.create(),Qr},invokeWhenHeapUnlocked:function(e){Qr?Qr.enqueuePostReleaseAction(e):e()}};function no(e,t){const n=e/t*100;document.documentElement.style.setProperty("--blazor-load-percentage",`${n}%`),document.documentElement.style.setProperty("--blazor-load-percentage-text",`"${Math.floor(n)}%"`)}const ro=["DEBUGGING ENABLED"],oo=e=>ro.indexOf(e)<0&&console.log(e),io=e=>{console.error(e||"(null)"),zn()};function so(e){return e+12}function ao(){if(Qr)throw new Error("Assertion failed - heap is currently locked")}class co{enqueuePostReleaseAction(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)}release(){var e;if(Qr!==this)throw new Error("Trying to release a lock which isn't current");for(Jr.mono_wasm_gc_unlock(),Qr=null;null===(e=this.postReleaseActions)||void 0===e?void 0:e.length;)this.postReleaseActions.shift()(),ao()}static create(){return Jr.mono_wasm_gc_lock(),new co}}class lo{constructor(e){this.batchAddress=e,this.arrayRangeReader=ho,this.arrayBuilderSegmentReader=uo,this.diffReader=po,this.editReader=fo,this.frameReader=go}updatedComponents(){return Nr.readStructField(this.batchAddress,0)}referenceFrames(){return Nr.readStructField(this.batchAddress,ho.structLength)}disposedComponentIds(){return Nr.readStructField(this.batchAddress,2*ho.structLength)}disposedEventHandlerIds(){return Nr.readStructField(this.batchAddress,3*ho.structLength)}updatedComponentsEntry(e,t){return mo(e,t,po.structLength)}referenceFramesEntry(e,t){return mo(e,t,go.structLength)}disposedComponentIdsEntry(e,t){const n=mo(e,t,4);return Nr.readInt32Field(n)}disposedEventHandlerIdsEntry(e,t){const n=mo(e,t,8);return Nr.readUint64Field(n)}}const ho={structLength:8,values:e=>Nr.readObjectField(e,0),count:e=>Nr.readInt32Field(e,4)},uo={structLength:12,values:e=>{const t=Nr.readObjectField(e,0),n=Nr.getObjectFieldsBaseAddress(t);return Nr.readObjectField(n,0)},offset:e=>Nr.readInt32Field(e,4),count:e=>Nr.readInt32Field(e,8)},po={structLength:4+uo.structLength,componentId:e=>Nr.readInt32Field(e,0),edits:e=>Nr.readStructField(e,4),editsEntry:(e,t)=>mo(e,t,fo.structLength)},fo={structLength:20,editType:e=>Nr.readInt32Field(e,0),siblingIndex:e=>Nr.readInt32Field(e,4),newTreeIndex:e=>Nr.readInt32Field(e,8),moveToSiblingIndex:e=>Nr.readInt32Field(e,8),removedAttributeName:e=>Nr.readStringField(e,16)},go={structLength:36,frameType:e=>Nr.readInt16Field(e,4),subtreeLength:e=>Nr.readInt32Field(e,8),elementReferenceCaptureId:e=>Nr.readStringField(e,16),componentId:e=>Nr.readInt32Field(e,12),elementName:e=>Nr.readStringField(e,16),textContent:e=>Nr.readStringField(e,16),markupContent:e=>Nr.readStringField(e,16),attributeName:e=>Nr.readStringField(e,16),attributeValue:e=>Nr.readStringField(e,24,!0),attributeEventHandlerId:e=>Nr.readUint64Field(e,8)};function mo(e,t,n){return Nr.getArrayEntryPtr(e,t,n)}class yo{constructor(e){this.preregisteredComponents=e;const t={};for(let n=0;n=n&&s>=r&&o(e.item(i),t.item(s))===Co.None;)i--,s--,a++;return a}(e,t,r,r,n),i=function(e){var t;const n=[];let r=e.length-1,o=(null===(t=e[r])||void 0===t?void 0:t.length)-1;for(;r>0||o>0;){const t=0===r?Io.Insert:0===o?Io.Delete:e[r][o];switch(n.unshift(t),t){case Io.Keep:case Io.Update:r--,o--;break;case Io.Insert:o--;break;case Io.Delete:r--}}return n}(function(e,t,n){const r=[],o=[],i=e.length,s=t.length;if(0===i&&0===s)return[];for(let e=0;e<=i;e++)(r[e]=Array(s+1))[0]=e,o[e]=Array(s+1);const a=r[0];for(let e=1;e<=s;e++)a[e]=e;for(let a=1;a<=i;a++)for(let i=1;i<=s;i++){const s=n(e.item(a-1),t.item(i-1)),c=r[a-1][i]+1,l=r[a][i-1]+1;let h;switch(s){case Co.None:h=r[a-1][i-1];break;case Co.Some:h=r[a-1][i-1]+1;break;case Co.Infinite:h=Number.MAX_VALUE}h{};function Uo(){document.body.removeEventListener("click",Mo),window.removeEventListener("popstate",Lo)}function Mo(e){ke()||Ee(e,(e=>{history.pushState(null,"",e),Bo(e)}))}function Lo(e){ke()||Bo(location.href)}async function Bo(e){null==Ro||Ro.abort(),Ro=new AbortController;const t=Ro.signal,n=fetch(e,{signal:t,headers:{"blazor-enhanced-nav":"on"}});if(await async function(e,t,n,r){let o;try{if(o=await e,!o.body)return void n(o,"");const t=o.headers.get("ssr-framing");if(!t){const e=await o.text();return void n(o,e)}let r=!0;await o.body.pipeThrough(new TextDecoderStream).pipeThrough(function(e){let t="";return new TransformStream({transform(n,r){if(t+=n,t.indexOf(e,t.length-n.length-e.length)>=0){const n=t.split(e);n.slice(0,-1).forEach((e=>r.enqueue(e))),t=n[n.length-1]}},flush(e){t&&e.enqueue(t)}})}(`\x3c!--${t}--\x3e`)).pipeTo(new WritableStream({write(e){r?(r=!1,n(o,e)):(e=>{const t=document.createRange().createContextualFragment(e);for(;t.firstChild;)document.body.appendChild(t.firstChild)})(e)}}))}catch(e){if("AbortError"===e.name&&t.aborted)return;throw e}}(n,t,((t,n)=>{var r;if(t.redirected&&history.replaceState(null,"",t.url),null===(r=t.headers.get("content-type"))||void 0===r?void 0:r.startsWith("text/html")){const e=(new DOMParser).parseFromString(n,"text/html");To(document,e)}else(t.status<200||t.status>=300)&&!n?document.documentElement.innerHTML=`Error: ${t.status} ${t.statusText}`:(history.replaceState(null,"",e+"?"),location.replace(e))})),!t.aborted){Po();const t=e.indexOf("#");if(t>=0){const n=e.substring(t+1),r=document.getElementById(n);null==r||r.scrollIntoView()}}}let Oo=!0;class Fo extends HTMLElement{connectedCallback(){var e;null===(e=this.parentNode)||void 0===e||e.removeChild(this);const t=this.attachShadow({mode:"open"}),n=document.createElement("slot");t.appendChild(n),n.addEventListener("slotchange",(e=>{this.childNodes.forEach((e=>{if(e instanceof HTMLTemplateElement){const t=e.getAttribute("blazor-component-id");if(t)!function(e,t){const n=function(e){const t=`bl:${e}`,n=document.createNodeIterator(document,NodeFilter.SHOW_COMMENT);let r=null;for(;(r=n.nextNode())&&r.textContent!==t;);if(!r)return null;const o=`/bl:${e}`;let i=null;for(;(i=n.nextNode())&&i.textContent!==o;);return i?{startMarker:r,endMarker:i}:null}(e);if(n)if(Oo)To({startExclusive:n.startMarker,endExclusive:n.endMarker},t);else{const{startMarker:e,endMarker:r}=n,o=new Range;for(o.setStart(e,e.textContent.length),o.setEnd(r,0),o.deleteContents();t.childNodes[0];)r.parentNode.insertBefore(t.childNodes[0],r)}}(t,e.content);else switch(e.getAttribute("type")){case"redirection":const t=e.content.textContent;Se(t)?(history.replaceState(null,"",t),Bo(t)):location.replace(t);break;case"error":document.documentElement.textContent=e.content.textContent;const n=document.documentElement.style;n.fontFamily="consolas, monospace",n.whiteSpace="pre-wrap",n.padding="1rem"}}}))}))}}let $o,Ho=!1;async function jo(e){var t;if(Ho)throw new Error("Blazor has already started.");Ho=!0,$o=e,function(e){(null==e?void 0:e.disableDomPreservation)&&(Oo=!1),customElements.define("blazor-ssr",Fo)}(null==e?void 0:e.ssr),(null===(t=null==e?void 0:e.ssr)||void 0===t?void 0:t.disableDomPreservation)||(Po=Wo,document.body.addEventListener("click",Mo),window.addEventListener("popstate",Lo)),await Wo()}async function Wo(){const t=gr(document,"server"),n=gr(document,"webassembly");t.length&&(Uo(),await async function(t,n){const r=function(e){const t={...hr,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...hr.reconnectionOptions,...e.reconnectionOptions}),t}(t),o=await async function(e){const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),r=new kr;return await r.importInitializersAsync(n,[e]),r}(r),i=new cr(r.logLevel);rt.reconnect=async e=>{if(Ar)return!1;const t=e||await Rr(r,i,xr);return await xr.reconnect(t)?(r.reconnectionHandler.onConnectionUp(),!0):(i.log(ir.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)},rt.defaultReconnectionHandler=new pr(i),r.reconnectionHandler=r.reconnectionHandler||rt.defaultReconnectionHandler,i.log(ir.Information,"Starting up Blazor server-side application.");const s=yr(document);xr=new lr(n||[],s||""),rt._internal.navigationManager.listenForNavigationEvents(((e,t,n)=>Tr.send("OnLocationChanged",e,t,n)),((e,t,n,r)=>Tr.send("OnLocationChanging",e,t,n,r))),rt._internal.forceCloseConnection=()=>Tr.stop(),rt._internal.sendJSDataStream=(e,t,n)=>function(e,t,n,r){setTimeout((async()=>{let o=5,i=(new Date).valueOf();try{const s=t instanceof Blob?t.size:t.byteLength;let a=0,c=0;for(;a1)await e.send("ReceiveJSDataChunk",n,c,h,null);else{if(!await e.invoke("ReceiveJSDataChunk",n,c,h,null))break;const t=(new Date).valueOf(),r=t-i;i=t,o=Math.max(1,Math.round(500/Math.max(1,r)))}a+=l,c++}}catch(t){await e.send("ReceiveJSDataChunk",n,-1,null,t.toString())}}),0)}(Tr,e,t,n),Dr=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{Tr.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,r||0,o)},endInvokeJSFromDotNet:(e,t,n)=>{Tr.send("EndInvokeJSFromDotNet",e,t,n)},sendByteArray:(e,t)=>{Tr.send("ReceiveByteArray",e,t)}});const a=await Rr(r,i,xr);if(!await xr.startCircuit(a))return void i.log(ir.Error,"Failed to start the circuit.");let c=!1;const l=()=>{if(!c){const e=new FormData,t=xr.circuitId;e.append("circuitId",t),c=navigator.sendBeacon("_blazor/disconnect",e)}};rt.disconnect=l,window.addEventListener("unload",l,{capture:!1,once:!0}),i.log(ir.Information,"Blazor server-side application started."),o.invokeAfterStartedCallbacks(rt)}(null==$o?void 0:$o.circuit,t)),n.length&&(Uo(),await async function(e,t){(function(){if(window.parent!==window&&!window.opener&&window.frameElement){const e=window.sessionStorage&&window.sessionStorage["Microsoft.AspNetCore.Components.WebAssembly.Authentication.CachedAuthSettings"],t=e&&JSON.parse(e);return t&&t.redirect_uri&&location.href.startsWith(t.redirect_uri)}return!1})()&&await new Promise((()=>{})),function(e){const t=x;x=(e,n,r)=>{((e,t,n)=>{const r=function(e){return me[e]}(e);r.eventDelegator.getHandler(t)&&to.invokeWhenHeapUnlocked(n)})(e,n,(()=>t(e,n,r)))}}(),rt._internal.applyHotReload=(e,t,n,r)=>{zr.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDelta",e,t,n,r)},rt._internal.getApplyUpdateCapabilities=()=>zr.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","GetApplyUpdateCapabilities"),rt._internal.invokeJSFromDotNet=wo,rt._internal.invokeJSJson=vo,rt._internal.endInvokeDotNetFromJS=bo,rt._internal.receiveWebAssemblyDotNetDataStream=_o,rt._internal.receiveByteArray=Eo;const n=Ur(to);rt.platform=n,rt._internal.renderBatch=(e,t)=>{const n=to.beginHeapLock();try{ve(e,new lo(t))}finally{n.release()}},rt._internal.navigationManager.listenForNavigationEvents((async(e,t,n)=>{await zr.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t,n)}),(async(e,t,n,r)=>{const o=await zr.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChangingAsync",t,n,r);rt._internal.navigationManager.endLocationChanging(e,o)}));const r=new yo(t||[]);let o,i;rt._internal.registeredComponents={getRegisteredComponentsCount:()=>r.getCount(),getId:e=>r.getId(e),getAssembly:e=>r.getAssembly(e),getTypeName:e=>r.getTypeName(e),getParameterDefinitions:e=>r.getParameterDefinitions(e)||"",getParameterValues:e=>r.getParameterValues(e)||""},rt._internal.getPersistedState=()=>yr(document)||"",rt._internal.attachRootComponentToElement=(e,t,n)=>{const o=r.resolveRegisteredElement(e);o?we(n,o,t,!1):function(e,t,n){const r="::before";let o=!1;if(e.endsWith("::after"))e=e.slice(0,-7),o=!0;else if(e.endsWith(r))throw new Error(`The '${r}' selector is not supported.`);const i=v(e)||document.querySelector(e);if(!i)throw new Error(`Could not find any element matching selector '${e}'.`);we(n||0,$(i,!0),t,o)}(e,t,n)};try{const t=await n.start(null!=e?e:{});o=t.resourceLoader,i=t.jsInitializer}catch(e){throw new Error(`Failed to start platform. Reason: ${e}`)}n.callEntryPoint(o.bootConfig.entryAssembly),i.invokeAfterStartedCallbacks(rt)}(null==$o?void 0:$o.webAssembly,n))}rt.start=jo,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&jo()})(); \ 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){const t=[],n="__jsObjectId",r="__dotNetObject",o="__byte[]",i="__dotNetStream",s="__jsStreamReferenceLength";let a,c;class l{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 h={0:new l(window)};h[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let d,u=1;function p(e){t.push(e)}function f(e){if(e&&"object"==typeof e){h[u]=new l(e);const t={[n]: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 r={[s]:t};try{const t=f(e);r[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return r}function m(e,n){c=e;const r=n?JSON.parse(n,((e,n)=>t.reduce(((t,n)=>n(e,t)),n))):null;return c=void 0,r}function y(){if(void 0===a)throw new Error("No call dispatcher has been set.");if(null===a)throw new Error("There are multiple .NET runtimes present, so a default dispatcher could not be resolved. Use DotNetObject to invoke .NET instance methods.");return a}e.attachDispatcher=function(e){const t=new w(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=p,e.invokeMethod=function(e,t,...n){return y().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return y().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=f,e.createJSStreamReference=g,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&_(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(d=e.JSCallResultType||(e.JSCallResultType={}));class w{constructor(e){this._dotNetCallDispatcher=e,this._byteArraysToBeRevived=new Map,this._pendingDotNetToJSStreams=new Map,this._pendingAsyncCalls={},this._nextAsyncCallId=1}getDotNetCallDispatcher(){return this._dotNetCallDispatcher}invokeJSFromDotNet(e,t,n,r){const o=m(this,t),i=I(b(e,r)(...o||[]),n);return null==i?null:T(this,i)}beginInvokeJSFromDotNet(e,t,n,r,o){const i=new Promise((e=>{const r=m(this,n);e(b(t,o)(...r||[]))}));e&&i.then((t=>T(this,[e,!0,I(t,r)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,v(t)]))))}endInvokeDotNetFromJS(e,t,n){const r=t?m(this,n):new Error(n);this.completePendingCall(parseInt(e,10),t,r)}invokeDotNetStaticMethod(e,t,...n){return this.invokeDotNetMethod(e,t,null,n)}invokeDotNetStaticMethodAsync(e,t,...n){return this.invokeDotNetMethodAsync(e,t,null,n)}invokeDotNetMethod(e,t,n,r){if(this._dotNetCallDispatcher.invokeDotNetFromJS){const o=T(this,r),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,o);return i?m(this,i):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeDotNetMethodAsync instead.")}invokeDotNetMethodAsync(e,t,n,r){if(e&&n)throw new Error(`For instance method calls, assemblyName should be null. Received '${e}'.`);const o=this._nextAsyncCallId++,i=new Promise(((e,t)=>{this._pendingAsyncCalls[o]={resolve:e,reject:t}}));try{const i=T(this,r);this._dotNetCallDispatcher.beginInvokeDotNetFromJS(o,e,t,n,i)}catch(e){this.completePendingCall(o,!1,e)}return i}receiveByteArray(e,t){this._byteArraysToBeRevived.set(e,t)}processByteArray(e){const t=this._byteArraysToBeRevived.get(e);return t?(this._byteArraysToBeRevived.delete(e),t):null}supplyDotNetStream(e,t){if(this._pendingDotNetToJSStreams.has(e)){const n=this._pendingDotNetToJSStreams.get(e);this._pendingDotNetToJSStreams.delete(e),n.resolve(t)}else{const n=new C;n.resolve(t),this._pendingDotNetToJSStreams.set(e,n)}}getDotNetStreamPromise(e){let t;if(this._pendingDotNetToJSStreams.has(e))t=this._pendingDotNetToJSStreams.get(e).streamPromise,this._pendingDotNetToJSStreams.delete(e);else{const n=new C;this._pendingDotNetToJSStreams.set(e,n),t=n.streamPromise}return t}completePendingCall(e,t,n){if(!this._pendingAsyncCalls.hasOwnProperty(e))throw new Error(`There is no pending async call with ID ${e}.`);const r=this._pendingAsyncCalls[e];delete this._pendingAsyncCalls[e],t?r.resolve(n):r.reject(n)}}function v(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function b(e,t){const n=h[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function _(e){delete h[e]}e.findJSFunction=b,e.disposeJSObjectReferenceById=_;class E{constructor(e,t){this._id=e,this._callDispatcher=t}invokeMethod(e,...t){return this._callDispatcher.invokeDotNetMethod(null,e,this._id,t)}invokeMethodAsync(e,...t){return this._callDispatcher.invokeDotNetMethodAsync(null,e,this._id,t)}dispose(){this._callDispatcher.invokeDotNetMethodAsync(null,"__Dispose",this._id,null).catch((e=>console.error(e)))}serializeAsArg(){return{[r]:this._id}}}e.DotNetObject=E,p((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(r))return new E(t[r],c);if(t.hasOwnProperty(n)){const e=t[n],r=h[e];if(r)return r.getWrappedObject();throw new Error(`JS object instance with Id '${e}' does not exist. It may have been disposed.`)}if(t.hasOwnProperty(o)){const e=t[o],n=c.processByteArray(e);if(void 0===n)throw new Error(`Byte array index '${e}' does not exist.`);return n}if(t.hasOwnProperty(i)){const e=t[i],n=c.getDotNetStreamPromise(e);return new S(n)}}return t}));class S{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class C{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function I(e,t){switch(t){case d.Default:return e;case d.JSObjectReference:return f(e);case d.JSStreamReference:return g(e);case d.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let k=0;function T(e,t){k=0,c=e;const n=JSON.stringify(t,x);return c=void 0,n}function x(e,t){if(t instanceof E)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(k,t);const e={[o]:k};return k++,e}return t}}(e||(e={})),function(e){e[e.prependFrame=1]="prependFrame",e[e.removeFrame=2]="removeFrame",e[e.setAttribute=3]="setAttribute",e[e.removeAttribute=4]="removeAttribute",e[e.updateText=5]="updateText",e[e.stepIn=6]="stepIn",e[e.stepOut=7]="stepOut",e[e.updateMarkup=8]="updateMarkup",e[e.permutationListEntry=9]="permutationListEntry",e[e.permutationListEnd=10]="permutationListEnd"}(t||(t={})),function(e){e[e.element=1]="element",e[e.text=2]="text",e[e.attribute=3]="attribute",e[e.component=4]="component",e[e.region=5]="region",e[e.elementReferenceCapture=6]="elementReferenceCapture",e[e.markup=8]="markup"}(n||(n={}));class o{constructor(e,t){this.componentId=e,this.fieldValue=t}static fromEvent(e,t){const n=t.target;if(n instanceof Element){const t=function(e){return e instanceof HTMLInputElement?e.type&&"checkbox"===e.type.toLowerCase()?{value:e.checked}:{value:e.value}:e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement?{value:e.value}:null}(n);if(t)return new o(e,t.value)}return null}}const i=new Map,s=new Map,a=[];function c(e){return i.get(e)}function l(e){const t=i.get(e);return(null==t?void 0:t.browserEventName)||e}function h(e,t){e.forEach((e=>i.set(e,t)))}function d(e){const t=[];for(let n=0;ne.selected)).map((e=>e.value))}}{const e=function(e){return!!e&&"INPUT"===e.tagName&&"checkbox"===e.getAttribute("type")}(t);return{value:e?!!t.checked:t.value}}}}),h(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),h(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...u(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),h(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),h(["keydown","keyup","keypress"],{createEventArgs:e=>{return{key:(t=e).key,code:t.code,location:t.location,repeat:t.repeat,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),h(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>u(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: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}}),h(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...u(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{...u(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 E().invokeMethodAsync("AddRootComponent",t,r),i=new _(o,m[t]);return await i.setParameters(n),i}};function v(e){const t=f.get(e);if(t)return f.delete(e),t}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(!g)throw new Error("Dynamic root components have not been enabled in this application.");return g}const S=[];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[e];if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let x=(e,t,n)=>n();const D=M(["abort","blur","canplay","canplaythrough","change","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),N={submit:!0},A=M(["click","dblclick","mousedown","mousemove","mouseup"]);class R{constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++R.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new P(this.onGlobalEvent.bind(this))}setListener(e,t,n,r){const o=this.getEventHandlerInfosForElement(e,!0),i=o.getHandler(t);if(i)this.eventInfoStore.update(i.eventHandlerId,n);else{const i={element:e,eventName:t,eventHandlerId:n,renderingComponentId:r};this.eventInfoStore.add(i),o.setHandler(t,i)}}getHandler(e){return this.eventInfoStore.get(e)}removeListener(e){const t=this.eventInfoStore.remove(e);if(t){const e=t.element,n=this.getEventHandlerInfosForElement(e,!1);n&&n.removeHandler(t.eventName)}}notifyAfterClick(e){this.afterClickCallbacks.push(e),this.eventInfoStore.addGlobalListener("click")}setStopPropagation(e,t,n){this.getEventHandlerInfosForElement(e,!0).stopPropagation(t,n)}setPreventDefault(e,t,n){this.getEventHandlerInfosForElement(e,!0).preventDefault(t,n)}onGlobalEvent(e){if(!(e.target instanceof Element))return;this.dispatchGlobalEventToAllElements(e.type,e);const t=(n=e.type,s.get(n));var n;t&&t.forEach((t=>this.dispatchGlobalEventToAllElements(t,e))),"click"===e.type&&this.afterClickCallbacks.forEach((t=>t(e)))}dispatchGlobalEventToAllElements(e,t){const n=t.composedPath();let r=n.shift(),i=null,s=!1;const a=Object.prototype.hasOwnProperty.call(D,e);let l=!1;for(;r;){const u=r,p=this.getEventHandlerInfosForElement(u,!1);if(p){const n=p.getHandler(e);if(n&&(h=u,d=t.type,!((h instanceof HTMLButtonElement||h instanceof HTMLInputElement||h instanceof HTMLTextAreaElement||h instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(A,d)&&h.disabled))){if(!s){const n=c(e);i=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(N,t.type)&&t.preventDefault(),k(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},i)}p.stopPropagation(e)&&(l=!0),p.preventDefault(e)&&t.preventDefault()}r=a||l?void 0:n.shift()}var h,d}getEventHandlerInfosForElement(e,t){return Object.prototype.hasOwnProperty.call(e,this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new U:null}}R.nextEventDelegatorId=0;class P{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},a.push(this.handleEventNameAliasAdded.bind(this))}add(e){if(this.infosByEventHandlerId[e.eventHandlerId])throw new Error(`Event ${e.eventHandlerId} is already tracked`);this.infosByEventHandlerId[e.eventHandlerId]=e,this.addGlobalListener(e.eventName)}get(e){return this.infosByEventHandlerId[e]}addGlobalListener(e){if(e=l(e),Object.prototype.hasOwnProperty.call(this.countByEventName,e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=Object.prototype.hasOwnProperty.call(D,e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(Object.prototype.hasOwnProperty.call(this.infosByEventHandlerId,t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=l(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(Object.prototype.hasOwnProperty.call(this.countByEventName,e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class U{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return Object.prototype.hasOwnProperty.call(this.handlers,e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function M(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const L=Z("_blazorLogicalChildren"),B=Z("_blazorLogicalParent"),O=Z("_blazorLogicalEnd");function F(e,t){if(!e.parentNode)throw new Error(`Comment not connected to the DOM ${e.textContent}`);const n=e.parentNode,r=$(n,!0),o=K(r);return Array.from(n.childNodes).forEach((e=>o.push(e))),e[B]=r,t&&(e[O]=t,$(t)),$(e)}function $(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 j(n,e,t),n}function j(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(z(r))throw new Error("Not implemented: moving existing logical children");const o=K(t);if(n0;)W(n,0)}const r=n;r.parentNode.removeChild(r)}function z(e){return e[B]||null}function J(e,t){return K(e)[t]}function q(e){const t=X(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=Q(e.moveRangeStart)})),t.forEach((t=>{const r=document.createComment("marker");t.moveToBeforeMarker=r;const o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):Y(r,e)})),t.forEach((e=>{const t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd;let i=r;for(;i;){const e=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=e}n.removeChild(t)})),t.forEach((e=>{n[e.toSiblingIndex]=e.moveRangeStart}))}function X(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 G(e){const t=K(z(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=G(t);n?n.parentNode.insertBefore(e,n):Y(e,z(t))}}}function Q(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=G(e);if(t)return t.previousSibling;{const t=z(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:Q(t)}}function Z(e){return"function"==typeof Symbol?Symbol():e}function ee(e){return`_bl_${e}`}const te="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,te)&&"string"==typeof t[te]?function(e){const t=`[${ee(e)}]`;return document.querySelector(t)}(t[te]):t));const ne="_blazorDeferredValue";function re(e,t,n){switch(t){case"value":return function(e,t){switch(t&&"INPUT"===e.tagName&&(t=function(e,t){switch(t.getAttribute("type")){case"time":return 8!==e.length||!e.endsWith("00")&&t.hasAttribute("step")?e:e.substring(0,5);case"datetime-local":return 19!==e.length||!e.endsWith("00")&&t.hasAttribute("step")?e:e.substring(0,16);default:return e}}(t,e)),e.tagName){case"INPUT":case"SELECT":case"TEXTAREA":return t&&e instanceof HTMLSelectElement&&se(e)&&(t=JSON.parse(t)),ce(e,t),e[ne]=t,!0;case"OPTION":return t||""===t?e.setAttribute("value",t):e.removeAttribute("value"),le(e),!0;default:return!1}}(e,n);case"checked":return function(e,t){return"INPUT"===e.tagName&&(e.checked=null!==t,!0)}(e,n);default:return!1}}function oe(e){switch(e.name){case"value":{const t=e.ownerElement;switch(t.tagName){case"INPUT":case"SELECT":case"TEXTAREA":return t.value}break}case"checked":{const t=e.ownerElement;if("INPUT"===t.tagName){const e=t;return e.checked?e.value:""}break}}return e.value}function ie(e){e instanceof HTMLOptionElement?le(e):ne in e&&ce(e,e[ne])}function se(e){return"select-multiple"===e.type}function ae(e,t){e.value=t||""}function ce(e,t){e instanceof HTMLSelectElement?se(e)?function(e,t){t||(t=[]);for(let n=0;n{ke()&&Ee(e,(e=>{Oe(e,!0,!1)}))}))}attachRootComponentToLogicalElement(e,t,n){this.attachComponentToElement(e,t),this.rootComponentIds.add(e),n||(ue[e]=t)}updateComponent(e,t,n,r){var o;const i=this.childComponentLocations[t];if(!i)throw new Error(`No element is currently associated with component ${t}`);const s=ue[t];if(s){const e=function(e){return e[O]||null}(s);delete ue[t],e?function(e,t){const n=z(e);if(!n)throw new Error("Can't clear between nodes. The start node does not have a logical parent.");const r=K(n),o=r.indexOf(e)+1,i=r.indexOf(t);for(let e=o;e<=i;e++)W(n,o);e.textContent="!"}(s,e):function(e){let t;for(;t=e.firstChild;)e.removeChild(t)}(s)}const a=null===(o=X(i))||void 0===o?void 0:o.getRootNode(),c=a&&a.activeElement;this.applyEdits(e,t,i,0,n,r),c instanceof HTMLElement&&a&&a.activeElement!==c&&c.focus()}disposeComponent(e){this.rootComponentIds.delete(e)&&function(e){const t=K(e);for(;t.length;)W(e,0)}(this.childComponentLocations[e]),delete this.childComponentLocations[e]}disposeEventHandler(e){this.eventDelegator.removeListener(e)}attachComponentToElement(e,t){this.childComponentLocations[e]=t}applyEdits(e,n,r,o,i,s){let a,c=0,l=o;const h=e.arrayBuilderSegmentReader,d=e.editReader,u=e.frameReader,p=h.values(i),f=h.offset(i),g=f+h.count(i);for(let i=f;idocument.baseURI,getLocationHref:()=>location.href,scrollToElement:Le};function Le(e){const t=document.getElementById(e);return!!t&&(t.scrollIntoView(),!0)}function Be(e,t,n=!1){const r=Ce(e);!t.forceLoad&&Se(r)?Oe(r,!1,t.replaceHistoryEntry,t.historyEntryState,n):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Oe(e,t,n,r=void 0,o=!1){if(He(),function(e){const t=e.indexOf("#");return t>-1&&location.href.replace(location.hash,"")===e.substring(0,t)}(e))!function(e,t,n){Fe(e,t,n);const r=e.indexOf("#");r!==e.length-1&&Le(e.substring(r+1))}(e,n,r);else{if(!o&&xe&&!await je(e,r,t))return;ye=!0,Fe(e,n,r),await We(t)}}function Fe(e,t,n=void 0){t?history.replaceState({userState:n,_index:De},"",e):(De++,history.pushState({userState:n,_index:De},"",e))}function $e(e){return new Promise((t=>{const n=Pe;Pe=()=>{Pe=n,t()},history.go(e)}))}function He(){Ue&&(Ue(!1),Ue=null)}function je(e,t,n){return new Promise((r=>{He(),Re?(Ne++,Ue=r,Re(Ne,e,t,n)):r(!1)}))}async function We(e){var t;Ae&&await Ae(location.href,null===(t=history.state)||void 0===t?void 0:t.userState,e)}async function ze(e){var t,n;Pe&&await Pe(e),De=null!==(n=null===(t=history.state)||void 0===t?void 0:t._index)&&void 0!==n?n:0}const Je={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,t){const n=document.querySelector(e);n&&(n.hasAttribute("tabindex")||(n.tabIndex=-1),n.focus({preventScroll:!0}))}},qe={init:function(e,t,n,r=50){const o=Ve(t);(o||document.documentElement).style.overflowAnchor="none";const i=document.createRange();h(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(r){r.forEach((r=>{var o;if(!r.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const s=i.getBoundingClientRect().height,a=null===(o=r.rootBounds)||void 0===o?void 0:o.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,s,a):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,s,a)}))}),{root:o,rootMargin:`${r}px`});s.observe(t),s.observe(n);const a=l(t),c=l(n);function l(e){const t={attributes:!0},n=new MutationObserver(((n,r)=>{h(e.parentElement)&&(r.disconnect(),e.style.display="table-row",r.observe(e,t)),s.unobserve(e),s.observe(e)}));return n.observe(e,t),n}function h(e){return null!==e&&(e instanceof HTMLTableElement&&""===e.style.display||"table"===e.style.display||e instanceof HTMLTableSectionElement&&""===e.style.display||"table-row-group"===e.style.display)}Ke[e._id]={intersectionObserver:s,mutationObserverBefore:a,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 Ve(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:Ve(e.parentElement):null}const Xe={getAndRemoveExistingTitle:function(){var e;const t=document.head?document.head.getElementsByTagName("title"):[];if(0===t.length)return null;let n=null;for(let r=t.length-1;r>=0;r--){const o=t[r],i=o.previousSibling;i instanceof Comment&&null!==z(i)||(null===n&&(n=o.textContent),null===(e=o.parentNode)||void 0===e||e.removeChild(o))}return n}},Ge={init:function(e,t){t._blazorInputFileNextFileId=0,t.addEventListener("click",(function(){t.value=""})),t.addEventListener("change",(function(){t._blazorFilesById={};const n=Array.prototype.map.call(t.files,(function(e){const n={id:++t._blazorInputFileNextFileId,lastModified:new Date(e.lastModified).toISOString(),name:e.name,size:e.size,contentType:e.type,readPromise:void 0,arrayBuffer:void 0,blob:e};return t._blazorFilesById[n.id]=n,n}));e.invokeMethodAsync("NotifyChange",n)}))},toImageFile:async function(e,t,n,r,o){const i=Ye(e,t),s=await new Promise((function(e){const t=new Image;t.onload=function(){URL.revokeObjectURL(t.src),e(t)},t.onerror=function(){t.onerror=null,URL.revokeObjectURL(t.src)},t.src=URL.createObjectURL(i.blob)})),a=await new Promise((function(e){var t;const i=Math.min(1,r/s.width),a=Math.min(1,o/s.height),c=Math.min(i,a),l=document.createElement("canvas");l.width=Math.round(s.width*c),l.height=Math.round(s.height*c),null===(t=l.getContext("2d"))||void 0===t||t.drawImage(s,0,0,l.width,l.height),l.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:(null==a?void 0:a.size)||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return Ye(e,t).blob}};function Ye(e,t){const n=e._blazorFilesById[t];if(!n)throw new Error(`There is no file with ID ${t}. The file list may have changed. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.`);return n}const Qe=new Set,Ze={enableNavigationPrompt:function(e){0===Qe.size&&window.addEventListener("beforeunload",et),Qe.add(e)},disableNavigationPrompt:function(e){Qe.delete(e),0===Qe.size&&window.removeEventListener("beforeunload",et)}};function et(e){e.preventDefault(),e.returnValue=!0}async function tt(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 nt=new Map,rt={navigateTo:function(e,t,n=!1){Be(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(i.has(e))throw new Error(`The event '${e}' is already registered.`);if(t.browserEventName){const n=s.get(t.browserEventName);n?n.push(e):s.set(t.browserEventName,[e]),a.forEach((n=>n(e,t.browserEventName)))}i.set(e,t)},rootComponents:w,_internal:{navigationManager:Me,domWrapper:Je,Virtualize:qe,PageTitle:Xe,InputFile:Ge,NavigationLock:Ze,getJSDataStreamChunk:tt,attachWebRendererInterop:function(t,n,r){const o=S.length;return S.push(t),Object.keys(n).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.findJSFunction(t,0);for(const e of o)r(e,n[e])}}(T(o),n,r),C(),o}}};window.Blazor=rt;const ot=[0,2e3,1e4,3e4,null];class it{constructor(e){this._retryDelays=void 0!==e?[...e,null]:ot}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class st{}st.Authorization="Authorization",st.Cookie="Cookie";class at{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class ct{get(e,t){return this.send({...t,method:"GET",url:e})}post(e,t){return this.send({...t,method:"POST",url:e})}delete(e,t){return this.send({...t,method:"DELETE",url:e})}getCookieString(e){return""}}class lt extends ct{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}async send(e){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=await this._innerClient.send(e);return t&&401===n.statusCode&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):n}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[st.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[st.Authorization]&&delete e.headers[st.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}class ht extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class dt extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class ut extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class pt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class ft extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class gt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class mt extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class yt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}var wt;!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"}(wt||(wt={}));class vt{constructor(){}log(e,t){}}vt.instance=new vt;const bt="0.0.0-DEV_BUILD";class _t{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&&"object"==typeof window.document}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isReactNative(){return"object"==typeof window&&void 0===window.document}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}}function St(e,t){let n="";return Ct(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 Ct(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function It(e,t,n,r,o,i){const s={},[a,c]=xt();s[a]=c,e.log(wt.Trace,`(${t} transport) sending data. ${St(o,i.logMessageContent)}.`);const l=Ct(o)?"arraybuffer":"text",h=await n.post(r,{content:o,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(wt.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class kt{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 Tt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${wt[e]}: ${t}`;switch(e){case wt.Critical:case wt.Error:this.out.error(n);break;case wt.Warning:this.out.warn(n);break;case wt.Information:this.out.info(n);break;default:this.out.log(n)}}}}function xt(){let e="X-SignalR-User-Agent";return Et.isNode&&(e="User-Agent"),[e,Dt(bt,Nt(),Et.isNode?"NodeJS":"Browser",At())]}function Dt(e,t,n,r){let o="Microsoft SignalR/";const i=e.split(".");return o+=`${i[0]}.${i[1]}`,o+=` (${e}; `,o+=t&&""!==t?`${t}; `:"Unknown OS; ",o+=`${n}`,o+=r?`; ${r}`:"; Unknown Runtime Version",o+=")",o}function Nt(){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 At(){if(Et.isNode)return process.versions.node}function Rt(e){return e.stack?e.stack:e.message?e.message:`${e}`}class Pt extends ct{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e=require;this._jar=new(e("tough-cookie").CookieJar),"undefined"==typeof fetch?this._fetchType=e("node-fetch"):this._fetchType=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 ut;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 ut});let r,o=null;if(e.timeout){const r=e.timeout;o=setTimeout((()=>{t.abort(),this._logger.log(wt.Warning,"Timeout from HTTP request."),n=new dt}),r)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Ct(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");try{r=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:!0===e.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(e){if(n)throw n;throw this._logger.log(wt.Warning,`Error from HTTP request. ${e}.`),e}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!r.ok){const e=await Ut(r,"text");throw new ht(e||r.statusText,r.status)}const i=Ut(r,e.responseType),s=await i;return new at(r.status,r.statusText,s)}getCookieString(e){return""}}function Ut(e,t){let n;switch(t){case"arraybuffer":n=e.arrayBuffer();break;case"text":default:n=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`)}return n}class Mt extends ct{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ut):e.method?e.url?new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),r.withCredentials=void 0===e.withCredentials||e.withCredentials,r.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===e.content&&(e.content=void 0),e.content&&(Ct(e.content)?r.setRequestHeader("Content-Type","application/octet-stream"):r.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach((e=>{r.setRequestHeader(e,o[e])})),e.responseType&&(r.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{r.abort(),n(new ut)}),e.timeout&&(r.timeout=e.timeout),r.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),r.status>=200&&r.status<300?t(new at(r.status,r.statusText,r.response||r.responseText)):n(new ht(r.response||r.responseText||r.statusText,r.status))},r.onerror=()=>{this._logger.log(wt.Warning,`Error from HTTP request. ${r.status}: ${r.statusText}.`),n(new ht(r.statusText,r.status))},r.ontimeout=()=>{this._logger.log(wt.Warning,"Timeout from HTTP request."),n(new dt)},r.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Lt extends ct{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new Pt(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new Mt(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new ut):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)}}var Bt,Ot,Ft,$t;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(Bt||(Bt={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Ot||(Ot={}));class Ht{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 jt{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new Ht,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(_t.isRequired(e,"url"),_t.isRequired(t,"transferFormat"),_t.isIn(t,Ot,"transferFormat"),this._url=e,this._logger.log(wt.Trace,"(LongPolling transport) Connecting."),t===Ot.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]=xt(),o={[n]:r,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};t===Ot.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(wt.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(wt.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new ht(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(e,t){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(wt.Trace,`(LongPolling transport) polling: ${n}.`);const r=await this._httpClient.get(n,t);204===r.statusCode?(this._logger.log(wt.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==r.statusCode?(this._logger.log(wt.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this._closeError=new ht(r.statusText||"",r.statusCode),this._running=!1):r.content?(this._logger.log(wt.Trace,`(LongPolling transport) data received. ${St(r.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this._logger.log(wt.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof dt?this._logger.log(wt.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(wt.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(wt.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?It(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(wt.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(wt.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=xt();e[t]=n;const r={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};await this._httpClient.delete(this._url,r),this._logger.log(wt.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(wt.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(wt.Trace,e),this.onclose(this._closeError)}}}class Wt{constructor(e,t,n,r){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=r,this.onreceive=null,this.onclose=null}async connect(e,t){return _t.isRequired(e,"url"),_t.isRequired(t,"transferFormat"),_t.isIn(t,Ot,"transferFormat"),this._logger.log(wt.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise(((n,r)=>{let o,i=!1;if(t===Ot.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,i]=xt();n[r]=i,o=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...n,...this._options.headers}})}try{o.onmessage=e=>{if(this.onreceive)try{this._logger.log(wt.Trace,`(SSE transport) data received. ${St(e.data,this._options.logMessageContent)}.`),this.onreceive(e.data)}catch(e){return void this._close(e)}},o.onerror=e=>{i?this._close():r(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},o.onopen=()=>{this._logger.log(wt.Information,`SSE connected to ${this._url}`),this._eventSource=o,i=!0,n()}}catch(e){return void r(e)}}else r(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(e){return this._eventSource?It(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class zt{constructor(e,t,n,r,o,i){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=r,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=i}async connect(e,t){let n;return _t.isRequired(e,"url"),_t.isRequired(t,"transferFormat"),_t.isIn(t,Ot,"transferFormat"),this._logger.log(wt.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise(((r,o)=>{let i;e=e.replace(/^http/,"ws");const s=this._httpClient.getCookieString(e);let a=!1;if(Et.isReactNative){const t={},[r,o]=xt();t[r]=o,n&&(t[st.Authorization]=`Bearer ${n}`),s&&(t[st.Cookie]=s),i=new this._webSocketConstructor(e,void 0,{headers:{...t,...this._headers}})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(e)),t===Ot.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(wt.Information,`WebSocket connected to ${e}.`),this._webSocket=i,a=!0,r()},i.onerror=e=>{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"There was an error with the transport",this._logger.log(wt.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(wt.Trace,`(WebSockets transport) data received. ${St(e.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(e.data)}catch(e){return void this._close(e)}},i.onclose=e=>{if(a)this._close(e);else{let t=null;t="undefined"!=typeof ErrorEvent&&e instanceof ErrorEvent?e.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(t))}}}))}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(wt.Trace,`(WebSockets transport) sending data. ${St(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(wt.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 Jt{constructor(e,t={}){var n;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,_t.isRequired(e,"url"),this._logger=void 0===(n=t.logger)?new Tt(wt.Information):null===n?vt.instance:void 0!==n.log?n:new Tt(n),this.baseUrl=this._resolveUrl(e),(t=t||{}).logMessageContent=void 0!==t.logMessageContent&&t.logMessageContent,"boolean"!=typeof t.withCredentials&&void 0!==t.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.withCredentials=void 0===t.withCredentials||t.withCredentials,t.timeout=void 0===t.timeout?1e5:t.timeout,"undefined"==typeof WebSocket||t.WebSocket||(t.WebSocket=WebSocket),"undefined"==typeof EventSource||t.EventSource||(t.EventSource=EventSource),this._httpClient=new lt(t.httpClient||new Lt(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Ot.Binary,_t.isIn(e,Ot,"transferFormat"),this._logger.log(wt.Debug,`Starting connection with transfer format '${Ot[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(wt.Error,e),await this._stopPromise,Promise.reject(new ut(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(wt.Error,e),Promise.reject(new ut(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 qt(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(wt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(wt.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(wt.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(wt.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport!==Bt.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(Bt.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 ut("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){const e=n.accessToken;this._accessTokenFactory=()=>e,this._httpClient._accessToken=e,this._httpClient._accessTokenFactory=void 0}r++}while(n.url&&r<100);if(100===r&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(t,this._options.transport,n,e)}this.transport instanceof jt&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(wt.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(wt.Error,"Failed to start the connection: "+e),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(e)}}async _getNegotiationResponse(e){const t={},[n,r]=xt();t[n]=r;const o=this._resolveNegotiateUrl(e);this._logger.log(wt.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 ht&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(wt.Error,t),Promise.reject(new mt(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(wt.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,await this._startTransport(o,r),void(this.connectionId=n.connectionId);const i=[],s=n.availableTransports||[];let a=n;for(const n of s){const s=this._resolveTransportOrError(n,t,r);if(s instanceof Error)i.push(`${n.transport} failed:`),i.push(s);else if(this._isITransport(s)){if(this.transport=s,!a){try{a=await this._getNegotiationResponse(e)}catch(e){return Promise.reject(e)}o=this._createConnectUrl(e,a.connectionToken)}try{return await this._startTransport(o,r),void(this.connectionId=a.connectionId)}catch(e){if(this._logger.log(wt.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new gt(`${n.transport} failed: ${e}`,Bt[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(wt.Debug,e),Promise.reject(new ut(e))}}}}return i.length>0?Promise.reject(new yt(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case Bt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new zt(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Bt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Wt(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Bt.LongPolling:return new jt(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n){const r=Bt[e.transport];if(null==r)return this._logger.log(wt.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(wt.Debug,`Skipping transport '${Bt[r]}' because it was disabled by the client.`),new ft(`'${Bt[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>Ot[e])).indexOf(n)>=0))return this._logger.log(wt.Debug,`Skipping transport '${Bt[r]}' because it does not support the requested transfer format '${Ot[n]}'.`),new Error(`'${Bt[r]}' does not support ${Ot[n]}.`);if(r===Bt.WebSockets&&!this._options.WebSocket||r===Bt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(wt.Debug,`Skipping transport '${Bt[r]}' because it is not supported in your environment.'`),new pt(`'${Bt[r]}' is not supported in your environment.`,r);this._logger.log(wt.Debug,`Selecting transport '${Bt[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(wt.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(wt.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(wt.Error,`Connection disconnected with error '${e}'.`):this._logger.log(wt.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(wt.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(wt.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(wt.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)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(wt.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 qt{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Kt,this._transportResult=new Kt,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Kt),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 Kt;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):qt._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 Kt{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class Vt{static write(e){return`${e}${Vt.RecordSeparator}`}static parse(e){if(e[e.length-1]!==Vt.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(Vt.RecordSeparator);return t.pop(),t}}Vt.RecordSeparatorCode=30,Vt.RecordSeparator=String.fromCharCode(Vt.RecordSeparatorCode);class Xt{writeHandshakeRequest(e){return Vt.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Ct(e)){const r=new Uint8Array(e),o=r.indexOf(Vt.RecordSeparatorCode);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(r.slice(0,i))),n=r.byteLength>i?r.slice(i).buffer:null}else{const r=e,o=r.indexOf(Vt.RecordSeparator);if(-1===o)throw new Error("Message is incomplete.");const i=o+1;t=r.substring(0,i),n=r.length>i?r.substring(i):null}const r=Vt.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"}(Ft||(Ft={}));class Gt{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 kt(this,e)}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}($t||($t={}));class Yt{static create(e,t,n,r,o,i){return new Yt(e,t,n,r,o,i)}constructor(e,t,n,r,o,i){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(wt.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},_t.isRequired(e,"connection"),_t.isRequired(t,"logger"),_t.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=o?o:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=r,this._handshakeProtocol=new Xt,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=$t.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Ft.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==$t.Disconnected&&this._connectionState!==$t.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!==$t.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=$t.Connecting,this._logger.log(wt.Debug,"Starting HubConnection.");try{await this._startInternal(),Et.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=$t.Connected,this._connectionStarted=!0,this._logger.log(wt.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=$t.Disconnected,this._logger.log(wt.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(wt.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(wt.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(wt.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===$t.Disconnected?(this._logger.log(wt.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===$t.Disconnecting?(this._logger.log(wt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=$t.Disconnecting,this._logger.log(wt.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(wt.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 ut("The connection was stopped before the hub handshake could complete."),this.connection.stop(e)))}stream(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createStreamInvocation(e,t,r);let i;const s=new Gt;return s.cancelCallback=()=>{const e=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],i.then((()=>this._sendWithProtocol(e)))},this._callbacks[o.invocationId]=(e,t)=>{t?s.error(t):e&&(e.type===Ft.Completion?e.error?s.error(new Error(e.error)):s.complete():s.next(e.item))},i=this._sendWithProtocol(o).catch((e=>{s.error(e),delete this._callbacks[o.invocationId]})),this._launchStreams(n,i),s}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._sendWithProtocol(this._createInvocation(e,t,!0,r));return this._launchStreams(n,o),o}invoke(e,...t){const[n,r]=this._replaceStreamingParams(t),o=this._createInvocation(e,t,!1,r);return new Promise(((e,t)=>{this._callbacks[o.invocationId]=(n,r)=>{r?t(r):n&&(n.type===Ft.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 Ft.Invocation:this._invokeClientMethod(e);break;case Ft.StreamItem:case Ft.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===Ft.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(wt.Error,`Stream callback threw error: ${Rt(e)}`)}}break}case Ft.Ping:break;case Ft.Close:{this._logger.log(wt.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(wt.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(wt.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(wt.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(wt.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===$t.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const t=e.target.toLowerCase(),n=this._methods[t];if(!n)return this._logger.log(wt.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(wt.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null))));const r=n.slice(),o=!!e.invocationId;let i,s,a;for(const n of r)try{const r=i;i=await n.apply(this,e.arguments),o&&i&&r&&(this._logger.log(wt.Error,`Multiple results provided for '${t}'. Sending error to server.`),a=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),s=void 0}catch(e){s=e,this._logger.log(wt.Error,`A callback for the method '${t}' threw error '${e}'.`)}a?await this._sendWithProtocol(a):o?(s?a=this._createCompletionMessage(e.invocationId,`${s}`,null):void 0!==i?a=this._createCompletionMessage(e.invocationId,null,i):(this._logger.log(wt.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),a=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(a)):i&&this._logger.log(wt.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(wt.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new ut("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===$t.Disconnecting?this._completeClose(e):this._connectionState===$t.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===$t.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=$t.Disconnected,this._connectionStarted=!1,Et.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(wt.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(wt.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=$t.Reconnecting,e?this._logger.log(wt.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(wt.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(wt.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==$t.Reconnecting)return void this._logger.log(wt.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==o;){if(this._logger.log(wt.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!==$t.Reconnecting)return void this._logger.log(wt.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=$t.Connected,this._logger.log(wt.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(wt.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(wt.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==$t.Reconnecting)return this._logger.log(wt.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===$t.Disconnecting&&this._completeClose());r=e instanceof Error?e:new Error(e.toString()),o=this._getNextRetryDelay(n++,Date.now()-t,r)}}this._logger.log(wt.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(wt.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(wt.Error,`Stream 'error' callback called with '${e}' threw error: ${Rt(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:Ft.Invocation}:{arguments:t,target:e,type:Ft.Invocation};{const n=this._invocationId;return this._invocationId++,0!==r.length?{arguments:t,invocationId:n.toString(),streamIds:r,target:e,type:Ft.Invocation}:{arguments:t,invocationId:n.toString(),target:e,type:Ft.Invocation}}}_launchStreams(e,t){if(0!==e.length){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n))))},error:e=>{let r;r=e instanceof Error?e.message:e&&e.toString?e.toString():"Unknown error",t=t.then((()=>this._sendWithProtocol(this._createCompletionMessage(n,r))))},next:e=>{t=t.then((()=>this._sendWithProtocol(this._createStreamItemMessage(n,e))))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let r=0;r=55296&&o<=56319&&r65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h)}else i.push(a);i.length>=4096&&(s+=String.fromCharCode.apply(String,i),i.length=0)}return i.length>0&&(s+=String.fromCharCode.apply(String,i)),s}var fn,gn=cn?new TextDecoder:null,mn=cn?"undefined"!=typeof process&&"force"!==(null===(rn=null===process||void 0===process?void 0:process.env)||void 0===rn?void 0:rn.TEXT_DECODER)?200:0:on,yn=function(e,t){this.type=e,this.data=t},wn=(fn=function(e,t){return fn=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])},fn(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}fn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),vn=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 wn(t,e),t}(Error),bn={type:-1,encode:function(e){var t,n,r,o;return e instanceof Date?function(e){var t,n=e.sec,r=e.nsec;if(n>=0&&r>=0&&n<=17179869183){if(0===r&&n<=4294967295){var o=new Uint8Array(4);return(t=new DataView(o.buffer)).setUint32(0,n),o}var i=n/4294967296,s=4294967295&n;return o=new Uint8Array(8),(t=new DataView(o.buffer)).setUint32(0,r<<2|3&i),t.setUint32(4,s),o}return o=new Uint8Array(12),(t=new DataView(o.buffer)).setUint32(0,r),sn(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:an(t,4),nsec:t.getUint32(0)};default:throw new vn("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},_n=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(bn)}return e.prototype.register=function(e){var t=e.type,n=e.encode,r=e.decode;if(t>=0)this.encoders[t]=n,this.decoders[t]=r;else{var o=1+t;this.builtInEncoders[o]=n,this.builtInDecoders[o]=r}},e.prototype.tryToEncode=function(e,t){for(var n=0;nthis.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>dn){var t=ln(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),un(e,this.bytes,this.pos),this.pos+=t}else t=ln(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var r=e.length,o=n,i=0;i>6&31|192;else{if(s>=55296&&s<=56319&&i>12&15|224,t[o++]=s>>6&63|128):(t[o++]=s>>18&7|240,t[o++]=s>>12&63|128,t[o++]=s>>6&63|128)}t[o++]=63&s|128}else t[o++]=s}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}var n=En(e);this.writeU8a(n)},e.prototype.encodeArray=function(e,t){var n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(var r=0,o=e;r0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,n){e:for(var r=0,o=this.caches[n-1];r=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)},e.prototype.decode=function(e,t,n){var r=this.find(e,t,n);if(null!=r)return this.hit++,r;this.miss++;var o=pn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,o),o},e}(),Nn=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e},e.prototype.createExtraByteError=function(e){var t=this.view,n=this.pos;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return Nn(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,n,r,o,i,s,a;return i=this,void 0,a=function(){var i,s,a,c,l,h,d,u;return Nn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=An(e),p.label=2;case 2:return[4,t.next()];case 3:if((n=p.sent()).done)return[3,5];if(a=n.value,i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),i=!0}catch(e){if(!(e instanceof Mn))throw e}this.totalPos+=this.pos,p.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return c=p.sent(),r={error:c},[3,12];case 7:return p.trys.push([7,,10,11]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,9];case 8:p.sent(),p.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,s]}throw h=(l=this).headByte,d=l.pos,u=l.totalPos,new RangeError("Insufficient data in parsing ".concat(Cn(h)," at ").concat(u," (").concat(d," in the current buffer)"))}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{o(a.next(e))}catch(e){t(e)}}function r(e){try{o(a.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}o((a=a.apply(i,[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return function(n,r,o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,s=function(){var n,r,o,i,s,a,c,l,h;return Nn(this,(function(d){switch(d.label){case 0:n=t,r=-1,d.label=1;case 1:d.trys.push([1,13,14,19]),o=An(e),d.label=2;case 2:return[4,Rn(o.next())];case 3:if((i=d.sent()).done)return[3,12];if(s=i.value,t&&0===r)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(r=this.readArraySize(),n=!1,this.complete()),d.label=4;case 4:d.trys.push([4,9,,10]),d.label=5;case 5:return[4,Rn(this.doDecodeSync())];case 6:return[4,d.sent()];case 7:return d.sent(),0==--r?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=d.sent())instanceof Mn))throw a;return[3,10];case 10:this.totalPos+=this.pos,d.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=d.sent(),l={error:c},[3,19];case 14:return d.trys.push([14,,17,18]),i&&!i.done&&(h=o.return)?[4,Rn(h.call(o))]:[3,16];case 15:d.sent(),d.label=16;case 16:return[3,18];case 17:if(l)throw l.error;return[7];case 18:return[7];case 19:return[2]}}))}.apply(n,r||[]),a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(e){s[e]&&(i[e]=function(t){return new Promise((function(n,r){a.push([e,t,n,r])>1||l(e,t)}))})}function l(e,t){try{(n=s[e](t)).value instanceof Rn?Promise.resolve(n.value.v).then(h,d):u(a[0][2],n)}catch(e){u(a[0][3],e)}var n}function h(e){l("next",e)}function d(e){l("throw",e)}function u(e,t){e(t),a.shift(),a.length&&l(a[0][0],a[0][1])}}(this,arguments)},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 vn("Unrecognized type byte: ".concat(Cn(e)));r=this.lookU32(),t=this.decodeExtension(r,4)}this.complete();for(var o=this.stack;o.length>0;){var i=o[o.length-1];if(0===i.type){if(i.array[i.position]=t,i.position++,i.position!==i.size)continue e;o.pop(),t=i.array}else{if(1===i.type){if("string"!=(s=typeof t)&&"number"!==s)throw new vn("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new vn("The key __proto__ is not allowed");i.key=t,i.type=2;continue e}if(i.map[i.key]=t,i.readCount++,i.readCount!==i.size){i.key=null,i.type=1;continue e}o.pop(),t=i.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new vn("Unrecognized array type byte: ".concat(Cn(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new vn("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new vn("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var n;if(e>this.maxStrLength)throw new vn("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthmn?function(e,t,n){var r=e.subarray(t,t+n);return gn.decode(r)}(this.bytes,o,e):pn(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 vn("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw Ln;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 vn("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));var n=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,n,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,n=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,n},e.prototype.readI64=function(){var e=an(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}();!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"}(In||(In={})),function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(kn||(kn={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(Tn||(Tn={}));class Fn{constructor(){}log(e,t){}}Fn.instance=new Fn,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"}(xn||(xn={}));class $n{static write(e){let t=e.byteLength||e.length;const n=[];do{let e=127&t;t>>=7,t>0&&(e|=128),n.push(e)}while(t>0);t=e.byteLength||e.length;const r=new Uint8Array(n.length+t);return r.set(n,0),r.set(e,n.length),r.buffer}static parse(e){const t=[],n=new Uint8Array(e),r=[0,7,14,21,28];for(let o=0;o7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+s+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+s,o+s+a):n.subarray(o+s,o+s+a)),o=o+s+a}return t}}const Hn=new Uint8Array([145,In.Ping]);class jn{constructor(e){this.name="messagepack",this.version=1,this.transferFormat=Tn.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new Sn(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new On(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=Fn.instance);const r=$n.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 In.Invocation:return this._writeInvocation(e);case In.StreamInvocation:return this._writeStreamInvocation(e);case In.StreamItem:return this._writeStreamItem(e);case In.Completion:return this._writeCompletion(e);case In.Ping:return $n.write(Hn);case In.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 In.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case In.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case In.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case In.Ping:return this._createPingMessage(n);case In.Close:return this._createCloseMessage(n);default:return t.log(xn.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:In.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:In.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:In.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:In.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:In.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:In.Completion}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([In.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([In.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),$n.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([In.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([In.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),$n.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([In.StreamItem,e.headers||{},e.invocationId,e.item]);return $n.write(t.slice())}_writeCompletion(e){const t=e.error?this._errorResult:void 0!==e.result?this._nonVoidResult:this._voidResult;let n;switch(t){case this._errorResult:n=this._encoder.encode([In.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([In.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([In.Completion,e.headers||{},e.invocationId,t,e.result])}return $n.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([In.CancelInvocation,e.headers||{},e.invocationId]);return $n.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}let Wn=!1;function zn(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),Wn||(Wn=!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 Jn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,qn=Jn?Jn.decode.bind(Jn):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("")},Kn=Math.pow(2,32),Vn=Math.pow(2,21)-1;function Xn(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Gn(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function Yn(e,t){const n=Gn(e,t+4);if(n>Vn)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Kn+Gn(e,t)}class Qn{constructor(e){this.batchData=e;const t=new nr(e);this.arrayRangeReader=new rr(e),this.arrayBuilderSegmentReader=new or(e),this.diffReader=new Zn(e),this.editReader=new er(e,t),this.frameReader=new tr(e,t)}updatedComponents(){return Xn(this.batchData,this.batchData.length-20)}referenceFrames(){return Xn(this.batchData,this.batchData.length-16)}disposedComponentIds(){return Xn(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return Xn(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return Xn(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return Xn(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return Yn(this.batchData,n)}}class Zn{constructor(e){this.batchDataUint8=e}componentId(e){return Xn(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class er{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return Xn(this.batchDataUint8,e)}siblingIndex(e){return Xn(this.batchDataUint8,e+4)}newTreeIndex(e){return Xn(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return Xn(this.batchDataUint8,e+8)}removedAttributeName(e){const t=Xn(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class tr{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return Xn(this.batchDataUint8,e)}subtreeLength(e){return Xn(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=Xn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return Xn(this.batchDataUint8,e+8)}elementName(e){const t=Xn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=Xn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=Xn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=Xn(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=Xn(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return Yn(this.batchDataUint8,e+12)}}class nr{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=Xn(e,e.length-4)}readString(e){if(-1===e)return null;{const n=Xn(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const i=e[t+o];if(n|=(127&i)<this.nextBatchId)return this.fatalError?(this.logger.log(ir.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(ir.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(ir.Debug,`Applying batch ${e}.`),ve(this.browserRendererId,new Qn(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(ir.Error,`There was an error applying batch ${e}.`),n.send("OnRenderCompleted",e,t.toString()),t}}getLastBatchid(){return this.nextBatchId-1}async completeBatch(e,t){try{await e.send("OnRenderCompleted",t,null)}catch{this.logger.log(ir.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}class ar{log(e,t){}}ar.instance=new ar;class cr{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${ir[e]}: ${t}`;switch(e){case ir.Critical:case ir.Error:console.error(n);break;case ir.Warning:console.warn(n);break;case ir.Information:console.info(n);break;default:console.log(n)}}}}class lr{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!==$t.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!==$t.Connected)return!1;const t=await e.invoke("StartCircuit",Me.getBaseURI(),Me.getLocationHref(),JSON.stringify(this.components.map((e=>e.toRecord()))),this.applicationState||"");return!!t&&(this.initialize(t),!0)}resolveElement(e){const t=v(e);if(t)return $(t,!0);const n=Number.parseInt(e);if(!Number.isNaN(n))return F(this.components[n].start,this.components[n].end);throw new Error(`Invalid sequence number or identifier '${e}'.`)}}const hr={configureSignalR:e=>{},logLevel:ir.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class dr{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 rt.reconnect()||this.rejected()}catch(e){this.logger.log(ir.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 ur{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const r=this.document.getElementById(ur.MaxRetriesId);r&&(r.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(ur.ShowClassName)}update(e){const t=this.document.getElementById(ur.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(ur.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(ur.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(ur.RejectedClassName)}removeClasses(){this.dialog.classList.remove(ur.ShowClassName,ur.HideClassName,ur.FailedClassName,ur.RejectedClassName)}}ur.ShowClassName="components-reconnect-show",ur.HideClassName="components-reconnect-hide",ur.FailedClassName="components-reconnect-failed",ur.RejectedClassName="components-reconnect-rejected",ur.MaxRetriesId="components-reconnect-max-retries",ur.CurrentAttemptId="components-reconnect-current-attempt";class pr{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||rt.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new ur(t,e.maxRetries,document):new dr(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new fr(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class fr{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;tfr.MaximumFirstRetryInterval?fr.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(ir.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise((t=>setTimeout(t,e)))}}function gr(e,t){switch(t){case"webassembly":return function(e){const t=wr(e,"webassembly"),n=[];for(let e=0;ee.id-t.id))}(e);case"server":return function(e){const t=wr(e,"server"),n=[];for(let e=0;ee.sequence-t.sequence))}(e)}}fr.MaximumFirstRetryInterval=3e3;const mr=/^\s*Blazor-Component-State:(?[a-zA-Z0-9+/=]+)$/;function yr(e){var t;if(e.nodeType===Node.COMMENT_NODE){const n=e.textContent||"",r=mr.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 br(e,t){const n=e.currentElement;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const r=vr.exec(n.textContent),o=r&&r.groups&&r.groups.descriptor;if(!o)return;try{const r=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(o);switch(t){case"webassembly":return function(e,t,n){const{type:r,assembly:o,typeName:i,parameterDefinitions:s,parameterValues:a,prerenderId:c}=e,l=c?_r(c,n):void 0;if(c&&!l)throw new Error(`Could not find an end component comment for '${t}'.`);if("webassembly"===r){if(!o)throw new Error("assembly must be defined when using a descriptor.");if(!i)throw new Error("typeName must be defined when using a descriptor.");return{type:r,assembly:o,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:a&&atob(a),start:t,prerenderId:c,end:l}}}(r,n,e);case"server":return function(e,t,n){const{type:r,descriptor:o,sequence:i,prerenderId:s}=e,a=s?_r(s,n):void 0;if(s&&!a)throw new Error(`Could not find an end component comment for '${t}'.`);if("server"===r){if(!o)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===i)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(i))throw new Error(`Error parsing the sequence '${i}' for component '${JSON.stringify(e)}'`);return{type:r,sequence:i,descriptor:o,start:t,prerenderId:s,end:a}}}(r,n,e)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}function _r(e,t){for(;t.next()&&t.currentElement;){const n=t.currentElement;if(n.nodeType!==Node.COMMENT_NODE)continue;if(!n.textContent)continue;const r=vr.exec(n.textContent),o=r&&r[1];if(o)return Er(o,e),n}}function Er(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 Sr{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndexasync function(e,n){const r=function(e){const t=document.baseURI;return t.endsWith("/")?`${t}${e}`:`${t}/${e}`}(n),o=await import(r);if(void 0===o)return;const{beforeStart:i,afterStarted:s}=o;return s&&e.afterStartedCallbacks.push(s),i?i(...t):void 0}(this,e))))}async invokeAfterStartedCallbacks(e){await I,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let Tr,xr,Dr,Nr,Ar=!1;async function Rr(e,t,n){var r,o;const i=new jn;i.name="blazorpack";const s=(new en).withUrl("_blazor").withHubProtocol(i);e.configureSignalR(s);const a=s.build();a.on("JS.AttachComponent",((e,t)=>we(0,n.resolveElement(t),e,!1))),a.on("JS.BeginInvokeJS",Dr.beginInvokeJSFromDotNet.bind(Dr)),a.on("JS.EndInvokeDotNet",Dr.endInvokeDotNetFromJS.bind(Dr)),a.on("JS.ReceiveByteArray",Dr.receiveByteArray.bind(Dr)),a.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start(t){a.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});Dr.supplyDotNetStream(e,t)}));const c=sr.getOrCreate(t);a.on("JS.RenderBatch",((e,n)=>{t.log(ir.Debug,`Received render batch with id ${e} and ${n.byteLength} bytes.`),c.processBatch(e,n,a)})),a.on("JS.EndLocationChanging",rt._internal.navigationManager.endLocationChanging),a.onclose((t=>!Ar&&e.reconnectionHandler.onConnectionDown(e.reconnectionOptions,t))),a.on("JS.Error",(e=>{Ar=!0,Pr(a,e,t),zn()}));try{await a.start(),Tr=a}catch(e){if(Pr(a,e,t),"FailedToNegotiateWithServerError"===e.errorType)throw e;zn(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===Bt.WebSockets))?t.log(ir.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===Bt.WebSockets))?t.log(ir.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===Bt.LongPolling))&&t.log(ir.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===(o=null===(r=a.connection)||void 0===r?void 0:r.features)||void 0===o?void 0:o.inherentKeepAlive)&&t.log(ir.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."),a}function Pr(e,t,n){n.log(ir.Error,t),e&&e.stop()}function Ur(e){return Nr=e,Nr}var Mr,Lr;const Br=navigator,Or=Br.userAgentData&&Br.userAgentData.brands,Fr=Or?Or.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):window.chrome,$r=null!==(Lr=null===(Mr=Br.userAgentData)||void 0===Mr?void 0:Mr.platform)&&void 0!==Lr?Lr:navigator.platform;let Hr,jr,Wr,zr,Jr,qr,Kr=!1,Vr=!1;function Xr(){return(Kr||Vr)&&(Fr||navigator.userAgent.includes("Firefox"))}const Gr=Math.pow(2,32),Yr=Math.pow(2,21)-1;let Qr=null,Zr="Production";function eo(e){return jr.getI32(e)}const to={start:function(t){return async function(t){const n={},{dotnet:r}=await async function(e){if("undefined"==typeof WebAssembly||!WebAssembly.validate)throw new Error("This browser does not support WebAssembly.");const t=await async function(e,t){const n=void 0!==e?e("manifest","blazor.boot.json","_framework/blazor.boot.json",""):i("_framework/blazor.boot.json");let r;r=n?"string"==typeof n?await i(n):await n:await i("_framework/blazor.boot.json"),Zr=t||r.headers.get("Blazor-Environment")||"Production";const o=await r.json();return o.modifiableAssemblies=r.headers.get("DOTNET-MODIFIABLE-ASSEMBLIES"),o.aspnetCoreBrowserTools=r.headers.get("ASPNETCORE-BROWSER-TOOLS"),o;function i(e){return fetch(e,{method:"GET",credentials:"include",cache:"no-cache"})}}(e.loadBootResource,e.environment),n=Object.keys(t.resources.runtime).filter((e=>e.startsWith("dotnet.")&&e.endsWith(".js")))[0],r=t.resources.runtime[n];let o=`_framework/${n}`;if(e.loadBootResource){const t="dotnetjs",i=e.loadBootResource(t,n,o,r);if("string"==typeof i)o=i;else if(i)throw new Error(`For a ${t} resource, custom loaders must supply a URI string.`)}if(t.cacheBootResources){const e=document.createElement("link");e.rel="modulepreload",e.href=o,e.crossOrigin="anonymous",e.integrity=r,document.head.appendChild(e)}const i=new URL(o,document.baseURI).toString();return await import(i)}(t),o=function(e,t){const n={maxParallelDownloads:1e6,enableDownloadRetry:!1,applicationEnvironment:Zr},r={...window.Module||{},onConfigLoaded:async n=>{n.environmentVariables||(n.environmentVariables={}),0===n.icuDataMode&&(n.environmentVariables.__BLAZOR_SHARDED_ICU="1"),n.aspnetCoreBrowserTools&&(n.environmentVariables.__ASPNETCORE_BROWSER_TOOLS=n.aspnetCoreBrowserTools),rt._internal.getApplicationEnvironment=()=>n.applicationEnvironment,t.jsInitializer=await async function(e,t){const n=e.resources.libraryInitializers,r=new kr;return n&&await r.importInitializersAsync(Object.keys(n),[t,e.resources.extensions]),r}(n,e)},onDownloadResourceProgress:no,config:n,disableDotnet6Compatibility:!1,print:oo,printErr:io};return r}(t,n);r.withStartupOptions(t).withModuleConfig(o),qr=await r.create();const{MONO:i,BINDING:s,Module:a,setModuleImports:c,INTERNAL:l}=qr;Wr=a,Hr=s,jr=i,Jr=l;const h=Jr.resourceLoader;n.resourceLoader=h,function(e){Kr=!!e.bootConfig.resources.pdb,Vr=e.bootConfig.debugBuild;const t=$r.match(/^Mac/i)?"Cmd":"Alt";Xr()&&console.info(`Debugging hotkey: Shift+${t}+D (when application has focus)`),document.addEventListener("keydown",(e=>{e.shiftKey&&(e.metaKey||e.altKey)&&"KeyD"===e.code&&(Vr||Kr?navigator.userAgent.includes("Firefox")?async function(){const e=await fetch(`_framework/debug?url=${encodeURIComponent(location.href)}&isFirefox=true`);200!==e.status&&console.warn(await e.text())}():Fr?function(){const e=document.createElement("a");e.href=`_framework/debug?url=${encodeURIComponent(location.href)}`,e.target="_blank",e.rel="noopener noreferrer",e.click()}():console.error("Currently, only Microsoft Edge (80+), Google Chrome, or Chromium, are supported for debugging."):console.error("Cannot start debugging, because the application was not compiled with debugging enabled."))}))}(h),rt._internal.dotNetCriticalError=io,rt._internal.loadLazyAssembly=e=>async function(e,t){const n=e.bootConfig.resources,r=n.lazyAssembly;if(!r)throw new Error("No assemblies have been marked as lazy-loadable. Use the 'BlazorWebAssemblyLazyLoad' item group in your project file to enable lazy loading an assembly.");if(!r.hasOwnProperty(t))throw new Error(`${t} must be marked with 'BlazorWebAssemblyLazyLoad' item group in your project file to allow lazy-loading.`);const o=t,i=function(e,t){const n=e.lastIndexOf(".");if(n<0)throw new Error(`No extension to replace in '${e}'`);return e.substr(0,n)+".pdb"}(t),s=Xr()&&n.pdb&&r.hasOwnProperty(i),a=e.loadResource(o,`_framework/${o}`,r[o],"assembly").response.then((e=>e.arrayBuffer()));if(s){const t=await e.loadResource(i,`_framework/${i}`,r[i],"pdb").response.then((e=>e.arrayBuffer())),[n,o]=await Promise.all([a,t]);return{dll:new Uint8Array(n),pdb:new Uint8Array(o)}}{const e=await a;return{dll:new Uint8Array(e),pdb:null}}}(Jr.resourceLoader,e),rt._internal.loadSatelliteAssemblies=(e,t)=>async function(e,t,n){const r=e.bootConfig.resources.satelliteResources;r&&await Promise.all(t.filter((e=>r.hasOwnProperty(e))).map((t=>e.loadResources(r[t],(e=>`_framework/${e}`),"assembly"))).reduce(((e,t)=>e.concat(t)),new Array).map((async e=>{const t=await e.response,r=await t.arrayBuffer(),o={dll:new Uint8Array(r)};n(o)})))}(h,e,t),c("blazor-internal",{Blazor:{_internal:rt._internal}});const d=await qr.getAssemblyExports("Microsoft.AspNetCore.Components.WebAssembly");return Object.assign(rt._internal,{dotNetExports:{...d.Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime}}),zr=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{if(ao(),!r&&!t)throw new Error("Either assemblyName or dotNetObjectId must have a non null value.");const i=r?r.toString():t;rt._internal.dotNetExports.BeginInvokeDotNet(e?e.toString():null,i,n,o)},endInvokeJSFromDotNet:(e,t,n)=>{rt._internal.dotNetExports.EndInvokeJS(n)},sendByteArray:(e,t)=>{rt._internal.dotNetExports.ReceiveByteArrayFromJS(e,t)},invokeDotNetFromJS:(e,t,n,r)=>(ao(),rt._internal.dotNetExports.InvokeDotNet(e||null,t,null!=n?n:0,r))}),n}(t)},callEntryPoint:async function(e){try{await qr.runMain(e,[])}catch(e){console.error(e),zn()}},toUint8Array:function(e){const t=so(e),n=eo(t),r=new Uint8Array(n);return r.set(Wr.HEAPU8.subarray(t+4,t+4+n)),r},getArrayLength:function(e){return eo(so(e))},getArrayEntryPtr:function(e,t,n){return so(e)+4+t*n},getObjectFieldsBaseAddress:function(e){return e+8},readInt16Field:function(e,t){return n=e+(t||0),jr.getI16(n);var n},readInt32Field:function(e,t){return eo(e+(t||0))},readUint64Field:function(e,t){return function(e){const t=e>>2,n=Wr.HEAPU32[t+1];if(n>Yr)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*Gr+Wr.HEAPU32[t]}(e+(t||0))},readFloatField:function(e,t){return n=e+(t||0),jr.getF32(n);var n},readObjectField:function(e,t){return eo(e+(t||0))},readStringField:function(e,t,n){const r=eo(e+(t||0));if(0===r)return null;if(n){const e=Hr.unbox_mono_obj(r);return"boolean"==typeof e?e?"":null:e}return Hr.conv_string(r)},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return ao(),Qr=co.create(),Qr},invokeWhenHeapUnlocked:function(e){Qr?Qr.enqueuePostReleaseAction(e):e()}};function no(e,t){const n=e/t*100;document.documentElement.style.setProperty("--blazor-load-percentage",`${n}%`),document.documentElement.style.setProperty("--blazor-load-percentage-text",`"${Math.floor(n)}%"`)}const ro=["DEBUGGING ENABLED"],oo=e=>ro.indexOf(e)<0&&console.log(e),io=e=>{console.error(e||"(null)"),zn()};function so(e){return e+12}function ao(){if(Qr)throw new Error("Assertion failed - heap is currently locked")}class co{enqueuePostReleaseAction(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)}release(){var e;if(Qr!==this)throw new Error("Trying to release a lock which isn't current");for(Jr.mono_wasm_gc_unlock(),Qr=null;null===(e=this.postReleaseActions)||void 0===e?void 0:e.length;)this.postReleaseActions.shift()(),ao()}static create(){return Jr.mono_wasm_gc_lock(),new co}}class lo{constructor(e){this.batchAddress=e,this.arrayRangeReader=ho,this.arrayBuilderSegmentReader=uo,this.diffReader=po,this.editReader=fo,this.frameReader=go}updatedComponents(){return Nr.readStructField(this.batchAddress,0)}referenceFrames(){return Nr.readStructField(this.batchAddress,ho.structLength)}disposedComponentIds(){return Nr.readStructField(this.batchAddress,2*ho.structLength)}disposedEventHandlerIds(){return Nr.readStructField(this.batchAddress,3*ho.structLength)}updatedComponentsEntry(e,t){return mo(e,t,po.structLength)}referenceFramesEntry(e,t){return mo(e,t,go.structLength)}disposedComponentIdsEntry(e,t){const n=mo(e,t,4);return Nr.readInt32Field(n)}disposedEventHandlerIdsEntry(e,t){const n=mo(e,t,8);return Nr.readUint64Field(n)}}const ho={structLength:8,values:e=>Nr.readObjectField(e,0),count:e=>Nr.readInt32Field(e,4)},uo={structLength:12,values:e=>{const t=Nr.readObjectField(e,0),n=Nr.getObjectFieldsBaseAddress(t);return Nr.readObjectField(n,0)},offset:e=>Nr.readInt32Field(e,4),count:e=>Nr.readInt32Field(e,8)},po={structLength:4+uo.structLength,componentId:e=>Nr.readInt32Field(e,0),edits:e=>Nr.readStructField(e,4),editsEntry:(e,t)=>mo(e,t,fo.structLength)},fo={structLength:20,editType:e=>Nr.readInt32Field(e,0),siblingIndex:e=>Nr.readInt32Field(e,4),newTreeIndex:e=>Nr.readInt32Field(e,8),moveToSiblingIndex:e=>Nr.readInt32Field(e,8),removedAttributeName:e=>Nr.readStringField(e,16)},go={structLength:36,frameType:e=>Nr.readInt16Field(e,4),subtreeLength:e=>Nr.readInt32Field(e,8),elementReferenceCaptureId:e=>Nr.readStringField(e,16),componentId:e=>Nr.readInt32Field(e,12),elementName:e=>Nr.readStringField(e,16),textContent:e=>Nr.readStringField(e,16),markupContent:e=>Nr.readStringField(e,16),attributeName:e=>Nr.readStringField(e,16),attributeValue:e=>Nr.readStringField(e,24,!0),attributeEventHandlerId:e=>Nr.readUint64Field(e,8)};function mo(e,t,n){return Nr.getArrayEntryPtr(e,t,n)}class yo{constructor(e){this.preregisteredComponents=e;const t={};for(let n=0;n=n&&s>=r&&o(e.item(i),t.item(s))===Co.None;)i--,s--,a++;return a}(e,t,r,r,n),i=function(e){var t;const n=[];let r=e.length-1,o=(null===(t=e[r])||void 0===t?void 0:t.length)-1;for(;r>0||o>0;){const t=0===r?Io.Insert:0===o?Io.Delete:e[r][o];switch(n.unshift(t),t){case Io.Keep:case Io.Update:r--,o--;break;case Io.Insert:o--;break;case Io.Delete:r--}}return n}(function(e,t,n){const r=[],o=[],i=e.length,s=t.length;if(0===i&&0===s)return[];for(let e=0;e<=i;e++)(r[e]=Array(s+1))[0]=e,o[e]=Array(s+1);const a=r[0];for(let e=1;e<=s;e++)a[e]=e;for(let a=1;a<=i;a++)for(let i=1;i<=s;i++){const s=n(e.item(a-1),t.item(i-1)),c=r[a-1][i]+1,l=r[a][i-1]+1;let h;switch(s){case Co.None:h=r[a-1][i-1];break;case Co.Some:h=r[a-1][i-1]+1;break;case Co.Infinite:h=Number.MAX_VALUE}h{};function Uo(){document.body.removeEventListener("click",Mo),window.removeEventListener("popstate",Lo)}function Mo(e){ke()||Ee(e,(e=>{history.pushState(null,"",e),Bo(e)}))}function Lo(e){ke()||Bo(location.href)}async function Bo(e){null==Ro||Ro.abort(),Ro=new AbortController;const t=Ro.signal,n=fetch(e,{signal:t,headers:{"blazor-enhanced-nav":"on"}});if(await async function(e,t,n,r){let o;try{o=await e;const t=o.headers.get("blazor-enhanced-nav-redirect-location");if(t)return void location.replace(t);if(!o.body)return void n(o,"");const r=o.headers.get("ssr-framing");if(!r){const e=await o.text();return void n(o,e)}let i=!0;await o.body.pipeThrough(new TextDecoderStream).pipeThrough(function(e){let t="";return new TransformStream({transform(n,r){if(t+=n,t.indexOf(e,t.length-n.length-e.length)>=0){const n=t.split(e);n.slice(0,-1).forEach((e=>r.enqueue(e))),t=n[n.length-1]}},flush(e){t&&e.enqueue(t)}})}(`\x3c!--${r}--\x3e`)).pipeTo(new WritableStream({write(e){i?(i=!1,n(o,e)):(e=>{const t=document.createRange().createContextualFragment(e);for(;t.firstChild;)document.body.appendChild(t.firstChild)})(e)}}))}catch(e){if("AbortError"===e.name&&t.aborted)return;throw e}}(n,t,((t,n)=>{var r;if(t.redirected&&(history.replaceState(null,"",t.url),e=t.url),null===(r=t.headers.get("content-type"))||void 0===r?void 0:r.startsWith("text/html")){const e=(new DOMParser).parseFromString(n,"text/html");To(document,e)}else(t.status<200||t.status>=300)&&!n?document.documentElement.innerHTML=`Error: ${t.status} ${t.statusText}`:(history.replaceState(null,"",e+"?"),location.replace(e))})),!t.aborted){Po();const t=e.indexOf("#");if(t>=0){const n=e.substring(t+1),r=document.getElementById(n);null==r||r.scrollIntoView()}}}let Oo=!0;class Fo extends HTMLElement{connectedCallback(){var e;null===(e=this.parentNode)||void 0===e||e.removeChild(this);const t=this.attachShadow({mode:"open"}),n=document.createElement("slot");t.appendChild(n),n.addEventListener("slotchange",(e=>{this.childNodes.forEach((e=>{if(e instanceof HTMLTemplateElement){const t=e.getAttribute("blazor-component-id");if(t)!function(e,t){const n=function(e){const t=`bl:${e}`,n=document.createNodeIterator(document,NodeFilter.SHOW_COMMENT);let r=null;for(;(r=n.nextNode())&&r.textContent!==t;);if(!r)return null;const o=`/bl:${e}`;let i=null;for(;(i=n.nextNode())&&i.textContent!==o;);return i?{startMarker:r,endMarker:i}:null}(e);if(n)if(Oo)To({startExclusive:n.startMarker,endExclusive:n.endMarker},t);else{const{startMarker:e,endMarker:r}=n,o=new Range;for(o.setStart(e,e.textContent.length),o.setEnd(r,0),o.deleteContents();t.childNodes[0];)r.parentNode.insertBefore(t.childNodes[0],r)}}(t,e.content);else switch(e.getAttribute("type")){case"redirection":const t=e.content.textContent;Se(t)?(history.replaceState(null,"",t),Bo(t)):location.replace(t);break;case"error":document.documentElement.textContent=e.content.textContent;const n=document.documentElement.style;n.fontFamily="consolas, monospace",n.whiteSpace="pre-wrap",n.padding="1rem"}}}))}))}}let $o,Ho=!1;async function jo(e){var t;if(Ho)throw new Error("Blazor has already started.");Ho=!0,$o=e,function(e){(null==e?void 0:e.disableDomPreservation)&&(Oo=!1),customElements.define("blazor-ssr",Fo)}(null==e?void 0:e.ssr),(null===(t=null==e?void 0:e.ssr)||void 0===t?void 0:t.disableDomPreservation)||(Po=Wo,document.body.addEventListener("click",Mo),window.addEventListener("popstate",Lo)),await Wo()}async function Wo(){const t=gr(document,"server"),n=gr(document,"webassembly");t.length&&(Uo(),await async function(t,n){const r=function(e){const t={...hr,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...hr.reconnectionOptions,...e.reconnectionOptions}),t}(t),o=await async function(e){const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),r=new kr;return await r.importInitializersAsync(n,[e]),r}(r),i=new cr(r.logLevel);rt.reconnect=async e=>{if(Ar)return!1;const t=e||await Rr(r,i,xr);return await xr.reconnect(t)?(r.reconnectionHandler.onConnectionUp(),!0):(i.log(ir.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)},rt.defaultReconnectionHandler=new pr(i),r.reconnectionHandler=r.reconnectionHandler||rt.defaultReconnectionHandler,i.log(ir.Information,"Starting up Blazor server-side application.");const s=yr(document);xr=new lr(n||[],s||""),rt._internal.navigationManager.listenForNavigationEvents(((e,t,n)=>Tr.send("OnLocationChanged",e,t,n)),((e,t,n,r)=>Tr.send("OnLocationChanging",e,t,n,r))),rt._internal.forceCloseConnection=()=>Tr.stop(),rt._internal.sendJSDataStream=(e,t,n)=>function(e,t,n,r){setTimeout((async()=>{let o=5,i=(new Date).valueOf();try{const s=t instanceof Blob?t.size:t.byteLength;let a=0,c=0;for(;a1)await e.send("ReceiveJSDataChunk",n,c,h,null);else{if(!await e.invoke("ReceiveJSDataChunk",n,c,h,null))break;const t=(new Date).valueOf(),r=t-i;i=t,o=Math.max(1,Math.round(500/Math.max(1,r)))}a+=l,c++}}catch(t){await e.send("ReceiveJSDataChunk",n,-1,null,t.toString())}}),0)}(Tr,e,t,n),Dr=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{Tr.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,r||0,o)},endInvokeJSFromDotNet:(e,t,n)=>{Tr.send("EndInvokeJSFromDotNet",e,t,n)},sendByteArray:(e,t)=>{Tr.send("ReceiveByteArray",e,t)}});const a=await Rr(r,i,xr);if(!await xr.startCircuit(a))return void i.log(ir.Error,"Failed to start the circuit.");let c=!1;const l=()=>{if(!c){const e=new FormData,t=xr.circuitId;e.append("circuitId",t),c=navigator.sendBeacon("_blazor/disconnect",e)}};rt.disconnect=l,window.addEventListener("unload",l,{capture:!1,once:!0}),i.log(ir.Information,"Blazor server-side application started."),o.invokeAfterStartedCallbacks(rt)}(null==$o?void 0:$o.circuit,t)),n.length&&(Uo(),await async function(e,t){(function(){if(window.parent!==window&&!window.opener&&window.frameElement){const e=window.sessionStorage&&window.sessionStorage["Microsoft.AspNetCore.Components.WebAssembly.Authentication.CachedAuthSettings"],t=e&&JSON.parse(e);return t&&t.redirect_uri&&location.href.startsWith(t.redirect_uri)}return!1})()&&await new Promise((()=>{})),function(e){const t=x;x=(e,n,r)=>{((e,t,n)=>{const r=function(e){return me[e]}(e);r.eventDelegator.getHandler(t)&&to.invokeWhenHeapUnlocked(n)})(e,n,(()=>t(e,n,r)))}}(),rt._internal.applyHotReload=(e,t,n,r)=>{zr.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDelta",e,t,n,r)},rt._internal.getApplyUpdateCapabilities=()=>zr.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","GetApplyUpdateCapabilities"),rt._internal.invokeJSFromDotNet=wo,rt._internal.invokeJSJson=vo,rt._internal.endInvokeDotNetFromJS=bo,rt._internal.receiveWebAssemblyDotNetDataStream=_o,rt._internal.receiveByteArray=Eo;const n=Ur(to);rt.platform=n,rt._internal.renderBatch=(e,t)=>{const n=to.beginHeapLock();try{ve(e,new lo(t))}finally{n.release()}},rt._internal.navigationManager.listenForNavigationEvents((async(e,t,n)=>{await zr.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t,n)}),(async(e,t,n,r)=>{const o=await zr.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChangingAsync",t,n,r);rt._internal.navigationManager.endLocationChanging(e,o)}));const r=new yo(t||[]);let o,i;rt._internal.registeredComponents={getRegisteredComponentsCount:()=>r.getCount(),getId:e=>r.getId(e),getAssembly:e=>r.getAssembly(e),getTypeName:e=>r.getTypeName(e),getParameterDefinitions:e=>r.getParameterDefinitions(e)||"",getParameterValues:e=>r.getParameterValues(e)||""},rt._internal.getPersistedState=()=>yr(document)||"",rt._internal.attachRootComponentToElement=(e,t,n)=>{const o=r.resolveRegisteredElement(e);o?we(n,o,t,!1):function(e,t,n){const r="::before";let o=!1;if(e.endsWith("::after"))e=e.slice(0,-7),o=!0;else if(e.endsWith(r))throw new Error(`The '${r}' selector is not supported.`);const i=v(e)||document.querySelector(e);if(!i)throw new Error(`Could not find any element matching selector '${e}'.`);we(n||0,$(i,!0),t,o)}(e,t,n)};try{const t=await n.start(null!=e?e:{});o=t.resourceLoader,i=t.jsInitializer}catch(e){throw new Error(`Failed to start platform. Reason: ${e}`)}n.callEntryPoint(o.bootConfig.entryAssembly),i.invokeAfterStartedCallbacks(rt)}(null==$o?void 0:$o.webAssembly,n))}rt.start=jo,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&jo()})(); \ No newline at end of file From 0c936070b17855ccda620cdb34c55dbb4bc42698 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 20 Jun 2023 18:47:11 +0100 Subject: [PATCH 29/30] Trigger CI From af827ac7eae90b0d6574a592ab4b9b0946b5f726 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 20 Jun 2023 21:51:04 +0100 Subject: [PATCH 30/30] Update unit tests --- .../Endpoints/test/RazorComponentResultExecutorTest.cs | 10 +++++----- .../StreamingComponentThatThrowsAsynchronously.razor | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Components/Endpoints/test/RazorComponentResultExecutorTest.cs b/src/Components/Endpoints/test/RazorComponentResultExecutorTest.cs index 8a62f594a33b..7effacb7070e 100644 --- a/src/Components/Endpoints/test/RazorComponentResultExecutorTest.cs +++ b/src/Components/Endpoints/test/RazorComponentResultExecutorTest.cs @@ -224,7 +224,7 @@ await RazorComponentResultExecutor.RenderComponentToResponse( // Assert Assert.Equal( - $"Some output\n", + $"Some output\n", MaskComponentIds(GetStringContent(responseBody))); } @@ -269,8 +269,8 @@ public async Task OnUnhandledExceptionAfterResponseStarted_WithStreamingOn_Emits httpContext.Response.Body = responseBody; var expectedResponseExceptionInfo = isDevelopmentEnvironment - ? "System.InvalidTimeZoneException: Test message" - : "There was an unhandled exception on the current request. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSettings.Development.json'"; + ? "System.InvalidTimeZoneException: Test message with <b>markup</b>" + : "There was an unhandled exception on the current request. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSettings.Development.json'"; // Act var ex = await Assert.ThrowsAsync(() => RazorComponentResultExecutor.RenderComponentToResponse( @@ -278,9 +278,9 @@ public async Task OnUnhandledExceptionAfterResponseStarted_WithStreamingOn_Emits null, preventStreamingRendering: false)); // Assert - Assert.Contains("Test message", ex.Message); + Assert.Contains("Test message with markup", ex.Message); Assert.Contains( - $"Some output\n