From 0a5f4deafc371a78e89eea7bfaa615404c52cd6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Tue, 19 Nov 2024 13:52:48 -0800 Subject: [PATCH] Hot Reload agent improvements (#58333) * Hot Reload agent improvements Refactor agent code so that it can be shared with dotnet-watch implementation via a shared project. Add new API applyHotReloadDeltas to apply updates. * Feedback and cleanup --- .../Web.JS/dist/Release/blazor.server.js | 2 +- .../Web.JS/dist/Release/blazor.web.js | 2 +- .../Web.JS/dist/Release/blazor.webassembly.js | 2 +- .../Web.JS/src/Boot.WebAssembly.Common.ts | 5 + src/Components/Web.JS/src/GlobalExports.ts | 4 + .../src/HotReload/AgentMessageSeverity.cs | 11 + .../src/HotReload/AgentReporter.cs | 30 ++ .../src/HotReload/HotReloadAgent.cs | 297 +++++++----------- .../HotReload/MetadataUpdateHandlerInvoker.cs | 244 ++++++++++++++ .../src/HotReload/ResponseLoggingLevel.cs | 10 + .../WebAssembly/src/HotReload/UpdateDelta.cs | 18 +- .../src/HotReload/WebAssemblyHotReload.cs | 168 +++++++--- .../WebAssembly/src/PublicAPI.Shipped.txt | 19 ++ .../test/WebAssemblyHotReloadTest.cs | 29 -- 14 files changed, 566 insertions(+), 275 deletions(-) create mode 100644 src/Components/WebAssembly/WebAssembly/src/HotReload/AgentMessageSeverity.cs create mode 100644 src/Components/WebAssembly/WebAssembly/src/HotReload/AgentReporter.cs create mode 100644 src/Components/WebAssembly/WebAssembly/src/HotReload/MetadataUpdateHandlerInvoker.cs create mode 100644 src/Components/WebAssembly/WebAssembly/src/HotReload/ResponseLoggingLevel.cs delete mode 100644 src/Components/WebAssembly/WebAssembly/test/WebAssemblyHotReloadTest.cs diff --git a/src/Components/Web.JS/dist/Release/blazor.server.js b/src/Components/Web.JS/dist/Release/blazor.server.js index 24e89e80d28..68e717bed14 100644 --- a/src/Components/Web.JS/dist/Release/blazor.server.js +++ b/src/Components/Web.JS/dist/Release/blazor.server.js @@ -1 +1 @@ -!function(){"use strict";var e,t,n;!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,d={[h]:new l(window)};d[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let u,p=1;function f(e){t.push(e)}function g(e){if(e&&"object"==typeof e){d[p]=new l(e);const t={[n]:p};return p++,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 o={[s]:t};try{const t=g(e);o[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return o}function y(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 v(){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=f,e.invokeMethod=function(e,t,...n){return v().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return v().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=g,e.createJSStreamReference=m,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&S(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(u=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,o){const r=y(this,t),i=k(b(e,o)(...r||[]),n);return null==i?null:D(this,i)}beginInvokeJSFromDotNet(e,t,n,o,r){const i=new Promise((e=>{const o=y(this,n);e(b(t,r)(...o||[]))}));e&&i.then((t=>D(this,[e,!0,k(t,o)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,_(t)]))))}endInvokeDotNetFromJS(e,t,n){const o=t?y(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=D(this,o),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,r);return i?y(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=D(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 I;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 I;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 _(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function b(e,t){const n=d[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function S(e){delete d[e]}e.findJSFunction=b,e.disposeJSObjectReferenceById=S;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,f((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=d[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 C(n)}}return t}));class C{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class I{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function k(e,t){switch(t){case u.Default:return e;case u.JSObjectReference:return g(e);case u.JSStreamReference:return m(e);case u.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let T=0;function D(e,t){T=0,c=e;const n=JSON.stringify(t,R);return c=void 0,n}function R(e,t){if(t instanceof E)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(T,t);const e={[r]:T};return T++,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",e[e.namedEvent=10]="namedEvent"}(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 r=new Map,i=new Map,s=[];function a(e){return r.get(e)}function c(e){const t=r.get(e);return t?.browserEventName||e}function l(e,t){e.forEach((e=>r.set(e,t)))}function h(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}}}}),l(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),l(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...d(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),l(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),l(["keydown","keyup","keypress"],{createEventArgs:e=>{return{key:(t=e).key,code:t.code,location:t.location,repeat:t.repeat,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type,isComposing:t.isComposing};var t}}),l(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>d(e)}),l(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno,type:t.type};var t}}),l(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total,type:t.type};var t}}),l(["touchcancel","touchend","touchmove","touchenter","touchleave","touchstart"],{createEventArgs:e=>{return{detail:(t=e).detail,touches:h(t.touches),targetTouches:h(t.targetTouches),changedTouches:h(t.changedTouches),ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),l(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...d(t=e),pointerId:t.pointerId,width:t.width,height:t.height,pressure:t.pressure,tiltX:t.tiltX,tiltY:t.tiltY,pointerType:t.pointerType,isPrimary:t.isPrimary};var t}}),l(["wheel","mousewheel"],{createEventArgs:e=>{return{...d(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),l(["cancel","close","toggle"],{createEventArgs:()=>({})});const u=["date","datetime-local","month","time","week"],p=new Map;let f,g,m=0;const y={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const o="__bl-dynamic-root:"+(++m).toString();p.set(o,e);const r=await _().invokeMethodAsync("AddRootComponent",t,o),i=new w(r,g[t]);return await i.setParameters(n),i}};class v{invoke(e){return this._callback(e)}setCallback(t){this._selfJSObjectReference||(this._selfJSObjectReference=e.createJSObjectReference(this)),this._callback=t}getJSObjectReference(){return this._selfJSObjectReference}dispose(){this._selfJSObjectReference&&e.disposeJSObjectReference(this._selfJSObjectReference)}}class 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 v)}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(!f)throw new Error("Dynamic root components have not been enabled in this application.");return f}const b=new Map,S=[],E=new Map;function C(t,n,o,r){if(b.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);b.set(t,n),o&&r&&Object.keys(o).length>0&&function(t,n,o){if(f)throw new Error("Dynamic root components have already been enabled.");f=t,g=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(t),o,r),E.get(t)?.[0]?.(),function(e){for(const t of S)t(e)}(t)}function I(e,t,n){return T(e,t.eventHandlerId,(()=>k(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function k(e){const t=b.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let T=(e,t,n)=>n();const D=M(["abort","blur","cancel","canplay","canplaythrough","change","close","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"]),R={submit:!0},x=M(["click","dblclick","mousedown","mousemove","mouseup"]);class A{static{this.nextEventDelegatorId=0}constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++A.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new P(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,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(),i=null,s=!1;const c=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(x,d)&&h.disabled))){if(!s){const n=a(e);i=n?.createEventArgs?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(R,t.type)&&t.preventDefault(),I(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},i)}p.stopPropagation(e)&&(l=!0),p.preventDefault(e)&&t.preventDefault()}r=c||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 N:null}}class P{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},s.push(this.handleEventNameAliasAdded.bind(this))}add(e){if(this.infosByEventHandlerId[e.eventHandlerId])throw new Error(`Event ${e.eventHandlerId} is already tracked`);this.infosByEventHandlerId[e.eventHandlerId]=e,this.addGlobalListener(e.eventName)}get(e){return this.infosByEventHandlerId[e]}addGlobalListener(e){if(e=c(e),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=c(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 N{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 U=Symbol(),B=Symbol(),L=Symbol();function $(e,t){if(U in e)return e;const n=[];if(e.childNodes.length>0){if(!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");e.childNodes.forEach((t=>{const o=$(t,!0);o[B]=e,n.push(o)}))}return e[U]=n,e}function O(e){const t=J(e);for(;t.length;)j(e,0)}function F(e,t){const n=document.createComment("!");return H(n,e,t),n}function H(e,t,n){const o=e;let r=e;if(e instanceof Comment){const t=J(o);if(t?.length>0){const t=G(o),n=new Range;n.setStartBefore(e),n.setEndAfter(t),r=n.extractContents()}}const i=W(o);if(i){const e=J(i),t=Array.prototype.indexOf.call(e,o);e.splice(t,1),delete o[B]}const s=J(t);if(n0;)j(n,0)}const o=n;o.parentNode.removeChild(o)}function W(e){return e[B]||null}function z(e,t){return J(e)[t]}function q(e){const t=X(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function J(e){return e[U]}function V(e){const t=J(W(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function K(e,t){const n=J(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=G(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):Y(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 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 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=V(t);n?n.parentNode.insertBefore(e,n):Y(e,W(t))}}}function G(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=V(e);if(t)return t.previousSibling;{const t=W(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:G(t)}}function Q(e){return`_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||=[];for(let n=0;n{Ie()&&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=e.composedPath&&e.composedPath();if(t)for(let e=0;e{const t=document.createElement("script");t.textContent=e.textContent,e.getAttributeNames().forEach((n=>{t.setAttribute(n,e.getAttribute(n))})),e.parentNode.replaceChild(t,e)})),ie.content));var s;let a=0;for(;i.firstChild;)H(i.firstChild,r,a++)}applyAttribute(e,t,n,o){const r=e.frameReader,i=r.attributeName(o),s=r.attributeEventHandlerId(o);if(s){const e=pe(i);return void this.eventDelegator.setListener(n,e,s,t)}const a=r.attributeValue(o);this.setOrRemoveAttributeOrProperty(n,i,a)}insertFrameRange(e,t,n,o,r,i,s){const a=o;for(let a=i;a{Fe(t,e)})},enableNavigationInterception:function(e){if(void 0!==ge&&ge!==e)throw new Error("Only one interactive runtime may enable navigation interception at a time.");ge=e},setHasLocationChangingListeners:function(e,t){const n=xe.get(e);if(!n)throw new Error(`Renderer with ID '${e}' is not listening for navigation events`);n.hasLocationChangingEventListeners=t},endLocationChanging:function(e,t){Pe&&e===Re&&(Pe(t),Pe=null)},navigateTo:function(e,t){Me(e,t,!0)},refresh:function(e){!e&&Se()?Ee(location.href,!0):location.reload()},getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href,scrollToElement:be};function Me(e,t,n=!1){const o=Ce(e);!t.forceLoad&&_e(o)?We()?Ue(o,!1,t.replaceHistoryEntry,t.historyEntryState,n):Ee(o,t.replaceHistoryEntry):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Ue(e,t,n,o=void 0,r=!1){if($e(),function(e){const t=new URL(e);return""!==t.hash&&location.origin===t.origin&&location.pathname===t.pathname&&location.search===t.search}(e))return Be(e,n,o),void function(e){const t=e.indexOf("#");t!==e.length-1&&be(e.substring(t+1))}(e);const i=je();(r||!i?.hasLocationChangingEventListeners||await Oe(e,o,t,i))&&(we=!0,Be(e,n,o),await Fe(t))}function Be(e,t,n=void 0){t?history.replaceState({userState:n,_index:De},"",e):(De++,history.pushState({userState:n,_index:De},"",e))}function Le(e){return new Promise((t=>{const n=Ae;Ae=()=>{Ae=n,t()},history.go(e)}))}function $e(){Pe&&(Pe(!1),Pe=null)}function Oe(e,t,n,o){return new Promise((r=>{$e(),Re++,Pe=r,o.locationChanging(Re,e,t,n)}))}async function Fe(e,t){const n=t??location.href;await Promise.all(Array.from(xe,(async([t,o])=>{var r;r=t,b.has(r)&&await o.locationChanged(n,history.state?.userState,e)})))}async function He(e){Ae&&We()&&await Ae(e),De=history.state?._index??0}function je(){const e=ke();if(void 0!==e)return xe.get(e)}function We(){return Ie()||!Se()}const ze={focus:function(e,t){if(e instanceof HTMLElement)e.focus({preventScroll:t});else{if(!(e instanceof SVGElement))throw new Error("Unable to focus an invalid element.");if(!e.hasAttribute("tabindex"))throw new Error("Unable to focus an SVG element that does not have a tabindex.");e.focus({preventScroll:t})}},focusBySelector:function(e){const t=document.querySelector(e);t&&(t.hasAttribute("tabindex")||(t.tabIndex=-1),t.focus({preventScroll:!0}))}},qe={init:function(e,t,n,o=50){const r=Ve(t);(r||document.documentElement).style.overflowAnchor="none";const i=document.createRange();u(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(o){o.forEach((o=>{if(!o.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const r=i.getBoundingClientRect().height,s=o.rootBounds?.height;o.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",o.intersectionRect.top-o.boundingClientRect.top,r,s):o.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",o.boundingClientRect.bottom-o.intersectionRect.bottom,r,s)}))}),{root:r,rootMargin:`${o}px`});s.observe(t),s.observe(n);const a=d(t),c=d(n),{observersByDotNetObjectId:l,id:h}=Ke(e);function d(e){const t={attributes:!0},n=new MutationObserver(((n,o)=>{u(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 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)}l[h]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const{observersByDotNetObjectId:t,id:n}=Ke(e),o=t[n];o&&(o.intersectionObserver.disconnect(),o.mutationObserverBefore.disconnect(),o.mutationObserverAfter.disconnect(),e.dispose(),delete t[n])}},Je=Symbol();function Ve(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:Ve(e.parentElement):null}function Ke(e){const t=e._callDispatcher,n=e._id;return t[Je]??={},{observersByDotNetObjectId:t[Je],id:n}}const Xe={getAndRemoveExistingTitle:function(){const e=document.head?document.head.getElementsByTagName("title"):[];if(0===e.length)return null;let t=null;for(let n=e.length-1;n>=0;n--){const o=e[n],r=o.previousSibling;r instanceof Comment&&null!==W(r)||(null===t&&(t=o.textContent),o.parentNode?.removeChild(o))}return t}},Ye={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=Ge(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){const t=Math.min(1,o/s.width),i=Math.min(1,r/s.height),a=Math.min(t,i),c=document.createElement("canvas");c.width=Math.round(s.width*a),c.height=Math.round(s.height*a),c.getContext("2d")?.drawImage(s,0,0,c.width,c.height),c.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:a?.size||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return Ge(e,t).blob}};function Ge(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;function Ze(e){e.preventDefault(),e.returnValue=!0}async function et(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)}const tt={navigateTo:function(e,t,n=!1){Me(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(r.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)))}r.set(e,t)},rootComponents:y,runtime:{},_internal:{navigationManager:Ne,domWrapper:ze,Virtualize:qe,PageTitle:Xe,InputFile:Ye,NavigationLock:{enableNavigationPrompt:function(e){0===Qe.size&&window.addEventListener("beforeunload",Ze),Qe.add(e)},disableNavigationPrompt:function(e){Qe.delete(e),0===Qe.size&&window.removeEventListener("beforeunload",Ze)}},getJSDataStreamChunk:et,attachWebRendererInterop:C}};var nt;function ot(e){const t={...rt,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...rt.reconnectionOptions,...e.reconnectionOptions}),t}window.Blazor=tt,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"}(nt||(nt={}));const rt={configureSignalR:e=>{},logLevel:nt.Warning,initializers:void 0,circuitHandlers:[],reconnectionOptions:{maxRetries:30,retryIntervalMilliseconds:function(e,t){return t&&e>=t?null:e<10?0:e<20?5e3:3e4},dialogId:"components-reconnect-modal"}};(class e{static{this.instance=new e}log(e,t){}});let it=class{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${nt[e]}: ${t}`;switch(e){case nt.Critical:case nt.Error:console.error(n);break;case nt.Warning:console.warn(n);break;case nt.Information:console.info(n);break;default:console.log(n)}}}};const st=/^\s*Blazor-Server-Component-State:(?[a-zA-Z0-9+/=]+)$/;function at(e){return ct(e,st)}function ct(e,t,n="state"){if(e.nodeType===Node.COMMENT_NODE){const o=e.textContent||"",r=t.exec(o),i=r&&r.groups&&r.groups[n];return i&&e.parentNode?.removeChild(e),i}if(!e.hasChildNodes())return;const o=e.childNodes;for(let e=0;e.*)$/);function dt(e,t){const n=e.currentElement;var o,r,i;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const s=ht.exec(n.textContent),a=s&&s.groups&&s.groups.descriptor;if(!a)return;!function(e){if(e.parentNode instanceof Document)throw new Error("Root components cannot be marked as interactive. The element must be rendered statically so that scripts are not evaluated multiple times.")}(n);try{const s=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n&&"auto"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(a),c=function(e,t,n){const{prerenderId:o}=e;if(o){for(;n.next()&&n.currentElement;){const e=n.currentElement;if(e.nodeType!==Node.COMMENT_NODE)continue;if(!e.textContent)continue;const t=ht.exec(e.textContent),r=t&&t[1];if(r)return gt(r,o),e}throw new Error(`Could not find an end component comment for '${t}'.`)}}(s,n,e);if(t!==s.type)return;switch(s.type){case"webassembly":return r=n,i=c,ft(o=s),{...o,uniqueId:ut++,start:r,end:i};case"server":return function(e,t,n){return pt(e),{...e,uniqueId:ut++,start:t,end:n}}(s,n,c);case"auto":return function(e,t,n){return pt(e),ft(e),{...e,uniqueId:ut++,start:t,end:n}}(s,n,c)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}let ut=0;function pt(e){const{descriptor:t,sequence:n}=e;if(!t)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===n)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(n))throw new Error(`Error parsing the sequence '${n}' for component '${JSON.stringify(e)}'`)}function ft(e){const{assembly:t,typeName:n}=e;if(!t)throw new Error("assembly must be defined when using a descriptor.");if(!n)throw new Error("typeName must be defined when using a descriptor.");e.parameterDefinitions=e.parameterDefinitions&&atob(e.parameterDefinitions),e.parameterValues=e.parameterValues&&atob(e.parameterValues)}function gt(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 mt{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndex{n+=`0x${e<16?"0":""}${e.toString(16)} `})),n.substr(0,n.length-1)}(e)}'`)):"string"==typeof e&&(n=`String data of length ${e.length}`,t&&(n+=`. Content: '${e}'`)),n}function Nt(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function Mt(e,t,n,o,r,i){const s={},[a,c]=Lt();s[a]=c,e.log(Tt.Trace,`(${t} transport) sending data. ${Pt(r,i.logMessageContent)}.`);const l=Nt(r)?"arraybuffer":"text",h=await n.post(o,{content:r,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(Tt.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class Ut{constructor(e,t){this._subject=e,this._observer=t}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),0===this._subject.observers.length&&this._subject.cancelCallback&&this._subject.cancelCallback().catch((e=>{}))}}class Bt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${Tt[e]}: ${t}`;switch(e){case Tt.Critical:case Tt.Error:this.out.error(n);break;case Tt.Warning:this.out.warn(n);break;case Tt.Information:this.out.info(n);break;default:this.out.log(n)}}}}function Lt(){return["X-SignalR-User-Agent",$t(Rt,"","Browser",void 0)]}function $t(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 Ot(e){return e.stack?e.stack:e.message?e.message:`${e}`}class Ft extends kt{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e="function"==typeof __webpack_require__?__non_webpack_require__: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("undefined"!=typeof global)return global;throw new Error("could not find global")}());if("undefined"==typeof AbortController){const e="function"==typeof __webpack_require__?__non_webpack_require__:require;this._abortControllerType=e("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new wt;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 wt});let o,r=null;if(e.timeout){const o=e.timeout;r=setTimeout((()=>{t.abort(),this._logger.log(Tt.Warning,"Timeout from HTTP request."),n=new vt}),o)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Nt(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(Tt.Warning,`Error from HTTP request. ${e}.`),e}finally{r&&clearTimeout(r),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const e=await Ht(o,"text");throw new yt(e||o.statusText,o.status)}const i=Ht(o,e.responseType),s=await i;return new It(o.status,o.statusText,s)}getCookieString(e){return""}}function Ht(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 jt extends kt{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new wt):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&&(Nt(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 wt)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new It(o.status,o.statusText,o.response||o.responseText)):n(new yt(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(Tt.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new yt(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(Tt.Warning,"Timeout from HTTP request."),n(new vt)},o.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Wt extends kt{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new Ft(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new jt(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new wt):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class zt{static write(e){return`${e}${zt.RecordSeparator}`}static parse(e){if(e[e.length-1]!==zt.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(zt.RecordSeparator);return t.pop(),t}}zt.RecordSeparatorCode=30,zt.RecordSeparator=String.fromCharCode(zt.RecordSeparatorCode);class qt{writeHandshakeRequest(e){return zt.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Nt(e)){const o=new Uint8Array(e),r=o.indexOf(zt.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(zt.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=zt.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}}var Jt,Vt;!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",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"}(Jt||(Jt={}));class Kt{constructor(){this.observers=[]}next(e){for(const t of this.observers)t.next(e)}error(e){for(const t of this.observers)t.error&&t.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new Ut(this,e)}}class Xt{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}async _send(e){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let e=()=>{},o=()=>{};Nt(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise(((t,n)=>{e=t,o=n}))),this._messages.push(new Yt(t,this._totalMessageCount,e,o))}try{this._reconnectInProgress||await this._connection.send(t)}catch{this._disconnected()}await n}_ack(e){let t=-1;for(let n=0;nthis._nextReceivingSequenceId?this._connection.stop(new Error("Sequence ID greater than amount of messages we've received.")):this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=0!==this._messages.length?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:Jt.Sequence,sequenceId:e}));const t=this._messages;for(const e of t)await this._connection.send(e._message);this._reconnectInProgress=!1}_dispose(e){null!=e||(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case Jt.Invocation:case Jt.StreamItem:case Jt.Completion:case Jt.StreamInvocation:case Jt.CancelInvocation:return!0;case Jt.Close:case Jt.Sequence:case Jt.Ping:case Jt.Ack:return!1}}_ackTimer(){void 0===this._ackTimerHandle&&(this._ackTimerHandle=setTimeout((async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:Jt.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}}class Yt{constructor(e,t,n,o){this._message=e,this._id=t,this._resolver=n,this._rejector=o}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(Vt||(Vt={}));class Gt{static create(e,t,n,o,r,i,s){return new Gt(e,t,n,o,r,i,s)}constructor(e,t,n,o,r,i,s){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(Tt.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")},xt.isRequired(e,"connection"),xt.isRequired(t,"logger"),xt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=r?r:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._statefulReconnectBufferSize=null!=s?s:1e5,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new qt,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=Vt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Jt.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!==Vt.Disconnected&&this._connectionState!==Vt.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!==Vt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Vt.Connecting,this._logger.log(Tt.Debug,"Starting HubConnection.");try{await this._startInternal(),At.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Vt.Connected,this._connectionStarted=!0,this._logger.log(Tt.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=Vt.Disconnected,this._logger.log(Tt.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{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(Tt.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(Tt.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;!!this.connection.features.reconnect&&(this._messageBuffer=new Xt(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(Tt.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.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){if(this._connectionState===Vt.Disconnected)return this._logger.log(Tt.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===Vt.Disconnecting)return this._logger.log(Tt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const t=this._connectionState;return this._connectionState=Vt.Disconnecting,this._logger.log(Tt.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(Tt.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===Vt.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new wt("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._createStreamInvocation(e,t,o);let i;const s=new Kt;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===Jt.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._messageBuffer?this._messageBuffer._send(e):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===Jt.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)if(!this._messageBuffer||this._messageBuffer._shouldProcessMessage(e))switch(e.type){case Jt.Invocation:this._invokeClientMethod(e).catch((e=>{this._logger.log(Tt.Error,`Invoke client method threw error: ${Ot(e)}`)}));break;case Jt.StreamItem:case Jt.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===Jt.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(Tt.Error,`Stream callback threw error: ${Ot(e)}`)}}break}case Jt.Ping:break;case Jt.Close:{this._logger.log(Tt.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}case Jt.Ack:this._messageBuffer&&this._messageBuffer._ack(e);break;case Jt.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(e);break;default:this._logger.log(Tt.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(Tt.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(Tt.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(Tt.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===Vt.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(Tt.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(Tt.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(Tt.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(Tt.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(Tt.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(Tt.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(Tt.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new wt("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===Vt.Disconnecting?this._completeClose(e):this._connectionState===Vt.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===Vt.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=Vt.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(null!=e?e:new Error("Connection closed.")),this._messageBuffer=void 0),At.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Tt.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(Tt.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=Vt.Reconnecting,e?this._logger.log(Tt.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(Tt.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Tt.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==Vt.Reconnecting)return void this._logger.log(Tt.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this._logger.log(Tt.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!==Vt.Reconnecting)return void this._logger.log(Tt.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=Vt.Connected,this._logger.log(Tt.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(Tt.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(Tt.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==Vt.Reconnecting)return this._logger.log(Tt.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===Vt.Disconnecting&&this._completeClose());o=e instanceof Error?e:new Error(e.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(Tt.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(Tt.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(Tt.Error,`Stream 'error' callback called with '${e}' threw error: ${Ot(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?{target:e,arguments:t,streamIds:o,type:Jt.Invocation}:{target:e,arguments:t,type:Jt.Invocation};{const n=this._invocationId;return this._invocationId++,0!==o.length?{target:e,arguments:t,invocationId:n.toString(),streamIds:o,type:Jt.Invocation}:{target:e,arguments:t,invocationId:n.toString(),type:Jt.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;o0)&&(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[en.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[en.Authorization]&&delete e.headers[en.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var nn,on;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(nn||(nn={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(on||(on={}));let rn=class{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 sn{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new rn,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(xt.isRequired(e,"url"),xt.isRequired(t,"transferFormat"),xt.isIn(t,on,"transferFormat"),this._url=e,this._logger.log(Tt.Trace,"(LongPolling transport) Connecting."),t===on.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]=Lt(),r={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===on.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(Tt.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(Tt.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new yt(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(Tt.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,t);204===o.statusCode?(this._logger.log(Tt.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==o.statusCode?(this._logger.log(Tt.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new yt(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(Tt.Trace,`(LongPolling transport) data received. ${Pt(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(Tt.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof vt?this._logger.log(Tt.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(Tt.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(Tt.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?Mt(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(Tt.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(Tt.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=Lt();e[t]=n;const o={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let r;try{await this._httpClient.delete(this._url,o)}catch(e){r=e}r?r instanceof yt&&(404===r.statusCode?this._logger.log(Tt.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(Tt.Trace,`(LongPolling transport) Error sending a DELETE request: ${r}`)):this._logger.log(Tt.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(Tt.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(Tt.Trace,e),this.onclose(this._closeError)}}}class an{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 xt.isRequired(e,"url"),xt.isRequired(t,"transferFormat"),xt.isIn(t,on,"transferFormat"),this._logger.log(Tt.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===on.Text){if(At.isBrowser||At.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]=Lt();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(Tt.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(Tt.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?Mt(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 cn{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 xt.isRequired(e,"url"),xt.isRequired(t,"transferFormat"),xt.isIn(t,on,"transferFormat"),this._logger.log(Tt.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(At.isReactNative){const t={},[o,r]=Lt();t[o]=r,n&&(t[en.Authorization]=`Bearer ${n}`),s&&(t[en.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===on.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(Tt.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(Tt.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(Tt.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(Tt.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(Tt.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 ln{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,xt.isRequired(e,"url"),this._logger=function(e){return void 0===e?new Bt(Tt.Information):null===e?Dt.instance:void 0!==e.log?e:new Bt(e)}(t.logger),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 tn(t.httpClient||new Wt(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||on.Binary,xt.isIn(e,on,"transferFormat"),this._logger.log(Tt.Debug,`Starting connection with transfer format '${on[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(Tt.Error,e),await this._stopPromise,Promise.reject(new wt(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(Tt.Error,e),Promise.reject(new wt(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 hn(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(Tt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(Tt.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(Tt.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(Tt.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!==nn.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(nn.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 wt("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 sn&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(Tt.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(Tt.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]=Lt();t[n]=o;const r=this._resolveNegotiateUrl(e);this._logger.log(Tt.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.useStatefulReconnect&&!0!==this._options._useStatefulReconnect?Promise.reject(new Et("Client didn't negotiate Stateful Reconnect but the server did.")):n}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof yt&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(Tt.Error,t),Promise.reject(new Et(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(Tt.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,!0===(null==a?void 0:a.useStatefulReconnect));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(Tt.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new St(`${n.transport} failed: ${e}`,nn[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(Tt.Debug,e),Promise.reject(new wt(e))}}}}return i.length>0?Promise.reject(new Ct(`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 nn.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new cn(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case nn.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new an(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case nn.LongPolling:return new sn(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let o=!1;if(this.features.reconnect){try{this.features.disconnected(),await this.transport.connect(e,t),await this.features.resend()}catch{o=!0}o&&this._stopConnection(n)}else this._stopConnection(n)}:this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,o){const r=nn[e.transport];if(null==r)return this._logger.log(Tt.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||!!(t&e)}(t,r))return this._logger.log(Tt.Debug,`Skipping transport '${nn[r]}' because it was disabled by the client.`),new bt(`'${nn[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>on[e])).indexOf(n)>=0))return this._logger.log(Tt.Debug,`Skipping transport '${nn[r]}' because it does not support the requested transfer format '${on[n]}'.`),new Error(`'${nn[r]}' does not support ${on[n]}.`);if(r===nn.WebSockets&&!this._options.WebSocket||r===nn.ServerSentEvents&&!this._options.EventSource)return this._logger.log(Tt.Debug,`Skipping transport '${nn[r]}' because it is not supported in your environment.'`),new _t(`'${nn[r]}' is not supported in your environment.`,r);this._logger.log(Tt.Debug,`Selecting transport '${nn[r]}'.`);try{return this.features.reconnect=r===nn.WebSockets?o:void 0,this._constructTransport(r)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(Tt.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(Tt.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(Tt.Error,`Connection disconnected with error '${e}'.`):this._logger.log(Tt.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(Tt.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(Tt.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(Tt.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(!At.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(Tt.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?"true"===n.get("useStatefulReconnect")&&(this._options._useStatefulReconnect=!0):!0===this._options._useStatefulReconnect&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}}class hn{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new dn,this._transportResult=new dn,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new dn),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 dn;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):hn._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 dn{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class un{constructor(){this.name="json",this.version=2,this.transferFormat=on.Text}parseMessages(e,t){if("string"!=typeof e)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];null===t&&(t=Dt.instance);const n=zt.parse(e),o=[];for(const e of n){const n=JSON.parse(e);if("number"!=typeof n.type)throw new Error("Invalid payload.");switch(n.type){case Jt.Invocation:this._isInvocationMessage(n);break;case Jt.StreamItem:this._isStreamItemMessage(n);break;case Jt.Completion:this._isCompletionMessage(n);break;case Jt.Ping:case Jt.Close:break;case Jt.Ack:this._isAckMessage(n);break;case Jt.Sequence:this._isSequenceMessage(n);break;default:t.log(Tt.Information,"Unknown message type '"+n.type+"' ignored.");continue}o.push(n)}return o}writeMessage(e){return zt.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),void 0!==e.invocationId&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),void 0===e.item)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if("string"!=typeof e||""===e)throw new Error(t)}}const pn={trace:Tt.Trace,debug:Tt.Debug,info:Tt.Information,information:Tt.Information,warn:Tt.Warning,warning:Tt.Warning,error:Tt.Error,critical:Tt.Critical,none:Tt.None};class fn{configureLogging(e){if(xt.isRequired(e,"logging"),function(e){return void 0!==e.log}(e))this.logger=e;else if("string"==typeof e){const t=function(e){const t=pn[e.toLowerCase()];if(void 0!==t)return t;throw new Error(`Unknown log level: ${e}`)}(e);this.logger=new Bt(t)}else this.logger=new Bt(e);return this}withUrl(e,t){return xt.isRequired(e,"url"),xt.isNotEmpty(e,"url"),this.url=e,this.httpConnectionOptions="object"==typeof t?{...this.httpConnectionOptions,...t}:{...this.httpConnectionOptions,transport:t},this}withHubProtocol(e){return xt.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new Zt(e):this.reconnectPolicy=e:this.reconnectPolicy=new Zt,this}withServerTimeout(e){return xt.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return xt.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return void 0===this.httpConnectionOptions&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=null==e?void 0:e.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(void 0===e.logger&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new ln(this.url,e);return Gt.create(t,this.logger||Dt.instance,this.protocol||new un,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}var gn;!function(e){e[e.Default=0]="Default",e[e.Server=1]="Server",e[e.WebAssembly=2]="WebAssembly",e[e.WebView=3]="WebView"}(gn||(gn={}));var mn,yn,vn,wn=4294967295;function _n(e,t,n){var o=Math.floor(n/4294967296),r=n;e.setUint32(t,o),e.setUint32(t+4,r)}function bn(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var Sn=("undefined"==typeof process||"never"!==(null===(mn=null===process||void 0===process?void 0:process.env)||void 0===mn?void 0:mn.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function En(e){for(var t=e.length,n=0,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);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 Dn,Rn=Sn?new TextDecoder:null,xn=Sn?"undefined"!=typeof process&&"force"!==(null===(vn=null===process||void 0===process?void 0:process.env)||void 0===vn?void 0:vn.TEXT_DECODER)?200:0:wn,An=function(e,t){this.type=e,this.data=t},Pn=(Dn=function(e,t){return Dn=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])},Dn(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}Dn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Nn=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 Pn(t,e),t}(Error),Mn={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),_n(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:bn(t,4),nsec:t.getUint32(0)};default:throw new Nn("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},Un=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Mn)}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>In){var t=En(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),kn(e,this.bytes,this.pos),this.pos+=t}else t=En(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var o=e.length,r=n,i=0;i=55296&&s<=56319&&i>18&7|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128):(t[r++]=s>>12&15|224,t[r++]=s>>6&63|128)}else t[r++]=s>>6&31|192;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=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 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=Tn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,r),r},e}(),Fn=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 Fn(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,a=function(){var i,s,a,c,l,h,d,u;return Fn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=Hn(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 qn))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($n(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 Fn(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=Hn(e),d.label=2;case 2:return[4,jn(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,jn(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 qn))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,jn(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 jn?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 Nn("Unrecognized type byte: ".concat($n(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 Nn("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new Nn("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 Nn("Unrecognized array type byte: ".concat($n(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new Nn("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 Nn("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 Nn("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthxn?function(e,t,n){var o=e.subarray(t,t+n);return Rn.decode(o)}(this.bytes,r,e):Tn(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 Nn("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw Jn;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 Nn("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=bn(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}();class Xn{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 Yn=new Uint8Array([145,Jt.Ping]);class Gn{constructor(e){this.name="messagepack",this.version=2,this.transferFormat=on.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new Ln(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new Kn(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=Dt.instance);const o=Xn.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 Jt.Invocation:return this._writeInvocation(e);case Jt.StreamInvocation:return this._writeStreamInvocation(e);case Jt.StreamItem:return this._writeStreamItem(e);case Jt.Completion:return this._writeCompletion(e);case Jt.Ping:return Xn.write(Yn);case Jt.CancelInvocation:return this._writeCancelInvocation(e);case Jt.Close:return this._writeClose();case Jt.Ack:return this._writeAck(e);case Jt.Sequence:return this._writeSequence(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 Jt.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case Jt.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case Jt.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case Jt.Ping:return this._createPingMessage(n);case Jt.Close:return this._createCloseMessage(n);case Jt.Ack:return this._createAckMessage(n);case Jt.Sequence:return this._createSequenceMessage(n);default:return t.log(Tt.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:Jt.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:Jt.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:Jt.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:Jt.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:Jt.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:Jt.Completion}}_createAckMessage(e){if(e.length<1)throw new Error("Invalid payload for Ack message.");return{sequenceId:e[1],type:Jt.Ack}}_createSequenceMessage(e){if(e.length<1)throw new Error("Invalid payload for Sequence message.");return{sequenceId:e[1],type:Jt.Sequence}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([Jt.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([Jt.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),Xn.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([Jt.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([Jt.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),Xn.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([Jt.StreamItem,e.headers||{},e.invocationId,e.item]);return Xn.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([Jt.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([Jt.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([Jt.Completion,e.headers||{},e.invocationId,t,e.result])}return Xn.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([Jt.CancelInvocation,e.headers||{},e.invocationId]);return Xn.write(t.slice())}_writeClose(){const e=this._encoder.encode([Jt.Close,null]);return Xn.write(e.slice())}_writeAck(e){const t=this._encoder.encode([Jt.Ack,e.sequenceId]);return Xn.write(t.slice())}_writeSequence(e){const t=this._encoder.encode([Jt.Sequence,e.sequenceId]);return Xn.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}const Qn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Zn=Qn?Qn.decode.bind(Qn):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)}}else o.push(n);o.length>1024&&(r.push(String.fromCharCode.apply(null,o)),o.length=0)}return r.push(String.fromCharCode.apply(null,o)),r.join("")},eo=Math.pow(2,32),to=Math.pow(2,21)-1;function no(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function oo(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function ro(e,t){const n=oo(e,t+4);if(n>to)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*eo+oo(e,t)}class io{constructor(e){this.batchData=e;const t=new lo(e);this.arrayRangeReader=new ho(e),this.arrayBuilderSegmentReader=new uo(e),this.diffReader=new so(e),this.editReader=new ao(e,t),this.frameReader=new co(e,t)}updatedComponents(){return no(this.batchData,this.batchData.length-20)}referenceFrames(){return no(this.batchData,this.batchData.length-16)}disposedComponentIds(){return no(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return no(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return no(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return no(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return ro(this.batchData,n)}}class so{constructor(e){this.batchDataUint8=e}componentId(e){return no(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class ao{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return no(this.batchDataUint8,e)}siblingIndex(e){return no(this.batchDataUint8,e+4)}newTreeIndex(e){return no(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return no(this.batchDataUint8,e+8)}removedAttributeName(e){const t=no(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class co{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return no(this.batchDataUint8,e)}subtreeLength(e){return no(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=no(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return no(this.batchDataUint8,e+8)}elementName(e){const t=no(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=no(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=no(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=no(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=no(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return ro(this.batchDataUint8,e+12)}}class lo{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=no(e,e.length-4)}readString(e){if(-1===e)return null;{const n=no(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(nt.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(nt.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(nt.Debug,`Applying batch ${e}.`),function(e,t){const n=fe[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{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()}})))}class So{constructor(t,n,o,r){this._firstUpdate=!0,this._renderingFailed=!1,this._disposed=!1,this._circuitId=void 0,this._applicationState=n,this._componentManager=t,this._options=o,this._logger=r,this._renderQueue=new po(this._logger),this._dispatcher=e.attachDispatcher(this)}start(){if(this.isDisposedOrDisposing())throw new Error("Cannot start a disposed circuit.");return this._startPromise||(this._startPromise=this.startCore()),this._startPromise}updateRootComponents(e){return this._firstUpdate?(this._firstUpdate=!1,this._connection?.send("UpdateRootComponents",e,this._applicationState)):this._connection?.send("UpdateRootComponents",e,"")}async startCore(){if(this._connection=await this.startConnection(),this._connection.state!==Vt.Connected)return!1;const e=JSON.stringify(this._componentManager.initialComponents.map((e=>{return t=e,{...t,start:void 0,end:void 0};var t})));if(this._circuitId=await this._connection.invoke("StartCircuit",Ne.getBaseURI(),Ne.getLocationHref(),e,this._applicationState||""),!this._circuitId)return!1;for(const e of this._options.circuitHandlers)e.onCircuitOpened&&e.onCircuitOpened();return!0}async startConnection(){const e=new Gn;e.name="blazorpack";const t=(new fn).withUrl("_blazor").withHubProtocol(e);this._options.configureSignalR(t);const n=t.build();n.on("JS.AttachComponent",((e,t)=>function(e,t,n,o){let r=fe[e];r||(r=new he(e),fe[e]=r),r.attachRootComponentToLogicalElement(n,t,!1)}(gn.Server,this.resolveElement(t),e))),n.on("JS.BeginInvokeJS",this._dispatcher.beginInvokeJSFromDotNet.bind(this._dispatcher)),n.on("JS.EndInvokeDotNet",this._dispatcher.endInvokeDotNetFromJS.bind(this._dispatcher)),n.on("JS.ReceiveByteArray",this._dispatcher.receiveByteArray.bind(this._dispatcher)),n.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start:t=>{n.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});this._dispatcher.supplyDotNetStream(e,t)})),n.on("JS.RenderBatch",(async(e,t)=>{this._logger.log(Tt.Debug,`Received render batch with id ${e} and ${t.byteLength} bytes.`),await this._renderQueue.processBatch(e,t,this._connection),this._componentManager.onAfterRenderBatch?.(gn.Server)})),n.on("JS.EndUpdateRootComponents",(e=>{this._componentManager.onAfterUpdateRootComponents?.(e)})),n.on("JS.EndLocationChanging",tt._internal.navigationManager.endLocationChanging),n.onclose((e=>{this._interopMethodsForReconnection=function(e){const t=b.get(e);if(!t)throw new Error(`Interop methods are not registered for renderer ${e}`);return b.delete(e),t}(gn.Server),this._disposed||this._renderingFailed||this._options.reconnectionHandler.onConnectionDown(this._options.reconnectionOptions,e)})),n.on("JS.Error",(e=>{this._renderingFailed=!0,this.unhandledError(e),bo()}));try{await n.start()}catch(e){if(this.unhandledError(e),"FailedToNegotiateWithServerError"===e.errorType)throw e;bo(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===nn.WebSockets))?this._logger.log(Tt.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===nn.WebSockets))?this._logger.log(Tt.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===nn.LongPolling))&&this._logger.log(Tt.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 n.connection?.features?.inherentKeepAlive&&this._logger.log(Tt.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."),n}async disconnect(){await(this._connection?.stop())}async reconnect(){if(!this._circuitId)throw new Error("Circuit host not initialized.");return this._connection.state===Vt.Connected||(this._connection=await this.startConnection(),this._interopMethodsForReconnection&&(C(gn.Server,this._interopMethodsForReconnection),this._interopMethodsForReconnection=void 0),!!await this._connection.invoke("ConnectCircuit",this._circuitId)&&(this._options.reconnectionHandler.onConnectionUp(),!0))}beginInvokeDotNetFromJS(e,t,n,o,r){this.throwIfDispatchingWhenDisposed(),this._connection.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,o||0,r)}endInvokeJSFromDotNet(e,t,n){this.throwIfDispatchingWhenDisposed(),this._connection.send("EndInvokeJSFromDotNet",e,t,n)}sendByteArray(e,t){this.throwIfDispatchingWhenDisposed(),this._connection.send("ReceiveByteArray",e,t)}throwIfDispatchingWhenDisposed(){if(this._disposed)throw new Error("The circuit associated with this dispatcher is no longer available.")}sendLocationChanged(e,t,n){return this._connection.send("OnLocationChanged",e,t,n)}sendLocationChanging(e,t,n,o){return this._connection.send("OnLocationChanging",e,t,n,o)}sendJsDataStream(e,t,n){return 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)}(this._connection,e,t,n)}resolveElement(e){const t=function(e){const t=p.get(e);if(t)return p.delete(e),t}(e);if(t)return $(t,!0);const n=Number.parseInt(e);if(!Number.isNaN(n))return function(e){const{start:t,end:n}=e,o=t[L];if(o){if(o!==e)throw new Error("The start component comment was already associated with another component descriptor.");return t}const r=t.parentNode;if(!r)throw new Error(`Comment not connected to the DOM ${t.textContent}`);const i=$(r,!0),s=J(i);t[B]=i,t[L]=e;const a=$(t);if(n){const e=J(a),o=Array.prototype.indexOf.call(s,a)+1;let r=null;for(;r!==n;){const n=s.splice(o,1)[0];if(!n)throw new Error("Could not find the end component comment in the parent logical node list");n[B]=t,e.push(n),r=n}}return a}(this._componentManager.resolveRootComponent(n));throw new Error(`Invalid sequence number or identifier '${e}'.`)}getRootComponentManager(){return this._componentManager}unhandledError(e){this._logger.log(Tt.Error,e),this.disconnect()}getDisconnectFormData(){const e=new FormData,t=this._circuitId;return e.append("circuitId",t),e}didRenderingFail(){return this._renderingFailed}isDisposedOrDisposing(){return void 0!==this._disposePromise}sendDisconnectBeacon(){if(this._disposed)return;const e=this.getDisconnectFormData();this._disposed=navigator.sendBeacon("_blazor/disconnect",e)}dispose(){return this._disposePromise||(this._disposePromise=this.disposeCore()),this._disposePromise}async disposeCore(){if(!this._startPromise)return void(this._disposed=!0);await this._startPromise,this._disposed=!0,this._connection?.stop();const e=this.getDisconnectFormData();fetch("_blazor/disconnect",{method:"POST",body:e});for(const e of this._options.circuitHandlers)e.onCircuitClosed&&e.onCircuitClosed()}}class Eo{static{this.ReconnectOverlayClassName="components-reconnect-overlay"}static{this.ReconnectDialogClassName="components-reconnect-dialog"}static{this.ReconnectVisibleClassName="components-reconnect-visible"}static{this.RejoiningAnimationClassName="components-rejoining-animation"}static{this.AnimationRippleCount=2}constructor(e,t,n){this.document=t,this.logger=n,this.style=this.document.createElement("style"),this.style.innerHTML=Eo.Css,this.overlay=this.document.createElement("div"),this.overlay.className=Eo.ReconnectOverlayClassName,this.host=this.document.createElement("div"),this.host.id=e;const o=this.host.attachShadow({mode:"open"});this.dialog=t.createElement("div"),this.dialog.className=Eo.ReconnectDialogClassName,o.appendChild(this.style),o.appendChild(this.overlay),this.rejoiningAnimation=t.createElement("div"),this.rejoiningAnimation.className=Eo.RejoiningAnimationClassName;for(let e=0;e{"visible"===this.document.visibilityState&&this.retry()}}show(){this.document.contains(this.host)||this.document.body.appendChild(this.host),this.reloadButton.style.display="none",this.rejoiningAnimation.style.display="block",this.status.innerHTML="Rejoining the server...",this.host.style.display="block",this.overlay.classList.add(Eo.ReconnectVisibleClassName)}update(e,t){if(1===e||0===t)this.status.innerHTML="Rejoining the server...";else{const e=1===t?"second":"seconds";this.status.innerHTML=`Rejoin failed... trying again in ${t} ${e}`}}hide(){this.host.style.display="none",this.overlay.classList.remove(Eo.ReconnectVisibleClassName)}failed(){this.reloadButton.style.display="block",this.rejoiningAnimation.style.display="none",this.status.innerHTML="Failed to rejoin.
Please retry or reload the page.",this.document.addEventListener("visibilitychange",this.retryWhenDocumentBecomesVisible)}rejected(){location.reload()}async retry(){this.document.removeEventListener("visibilitychange",this.retryWhenDocumentBecomesVisible),this.show();try{await tt.reconnect()||this.rejected()}catch(e){this.logger.log(nt.Error,e),this.failed()}}static{this.Css=`\n .${this.ReconnectOverlayClassName} {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 10000;\n display: none;\n overflow: hidden;\n animation: components-reconnect-fade-in;\n }\n\n .${this.ReconnectOverlayClassName}.${this.ReconnectVisibleClassName} {\n display: block;\n }\n\n .${this.ReconnectOverlayClassName}::before {\n content: '';\n background-color: rgba(0, 0, 0, 0.4);\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n animation: components-reconnect-fadeInOpacity 0.5s ease-in-out;\n opacity: 1;\n }\n\n .${this.ReconnectOverlayClassName} p {\n margin: 0;\n text-align: center;\n }\n\n .${this.ReconnectOverlayClassName} button {\n border: 0;\n background-color: #6b9ed2;\n color: white;\n padding: 4px 24px;\n border-radius: 4px;\n }\n\n .${this.ReconnectOverlayClassName} button:hover {\n background-color: #3b6ea2;\n }\n\n .${this.ReconnectOverlayClassName} button:active {\n background-color: #6b9ed2;\n }\n\n .${this.ReconnectDialogClassName} {\n position: relative;\n background-color: white;\n width: 20rem;\n margin: 20vh auto;\n padding: 2rem;\n border-radius: 0.5rem;\n box-shadow: 0 3px 6px 2px rgba(0, 0, 0, 0.3);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 1rem;\n opacity: 0;\n animation: components-reconnect-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s, components-reconnect-fadeInOpacity 0.5s ease-out 0.3s;\n animation-fill-mode: forwards;\n z-index: 10001;\n }\n\n .${this.RejoiningAnimationClassName} {\n display: block;\n position: relative;\n width: 80px;\n height: 80px;\n }\n\n .${this.RejoiningAnimationClassName} div {\n position: absolute;\n border: 3px solid #0087ff;\n opacity: 1;\n border-radius: 50%;\n animation: ${this.RejoiningAnimationClassName} 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;\n }\n\n .${this.RejoiningAnimationClassName} div:nth-child(2) {\n animation-delay: -0.5s;\n }\n\n @keyframes ${this.RejoiningAnimationClassName} {\n 0% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 0;\n }\n\n 4.9% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 0;\n }\n\n 5% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 1;\n }\n\n 100% {\n top: 0px;\n left: 0px;\n width: 80px;\n height: 80px;\n opacity: 0;\n }\n }\n\n @keyframes components-reconnect-fadeInOpacity {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n }\n\n @keyframes components-reconnect-slideUp {\n 0% {\n transform: translateY(30px) scale(0.95);\n }\n\n 100% {\n transform: translateY(0);\n }\n }\n `}}class Co{static{this.ShowClassName="components-reconnect-show"}static{this.HideClassName="components-reconnect-hide"}static{this.FailedClassName="components-reconnect-failed"}static{this.RejectedClassName="components-reconnect-rejected"}static{this.MaxRetriesId="components-reconnect-max-retries"}static{this.CurrentAttemptId="components-reconnect-current-attempt"}static{this.SecondsToNextAttemptId="components-seconds-to-next-attempt"}constructor(e,t,n){if(this.dialog=e,this.document=t,this.document=t,void 0!==n){const e=this.document.getElementById(Co.MaxRetriesId);e&&(e.innerText=n.toString())}}show(){this.removeClasses(),this.dialog.classList.add(Co.ShowClassName)}update(e,t){const n=this.document.getElementById(Co.CurrentAttemptId);n&&(n.innerText=e.toString());const o=this.document.getElementById(Co.SecondsToNextAttemptId);o&&(o.innerText=t.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Co.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Co.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Co.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Co.ShowClassName,Co.HideClassName,Co.FailedClassName,Co.RejectedClassName)}}class Io{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 Co(t,document,e.maxRetries):new Eo(e.dialogId,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new ko(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class ko{static{this.MaximumFirstRetryInterval=3e3}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;void 0===e.maxRetries||tko.MaximumFirstRetryInterval?ko.MaximumFirstRetryInterval:e.retryIntervalMilliseconds;if(await this.runTimer(n,1e3,(e=>{this.reconnectDisplay.update(t+1,Math.round(e/1e3))})),this.isDisposed)break;try{return await this.reconnectCallback()?void 0:void this.reconnectDisplay.rejected()}catch(e){this.logger.log(nt.Error,e)}}this.reconnectDisplay.failed()}async runTimer(e,t,n){if(e<=0)return void n(0);let o,r,i=Date.now();n(e);const s=()=>{if(this.isDisposed)return void r();const a=Date.now(),c=a-i;i=a;const l=Math.max(1,Math.floor(c/t)),h=t*l;if((e-=h){"visible"===document.visibilityState&&(clearTimeout(o),n(0),r())};o=setTimeout(s,t),document.addEventListener("visibilitychange",a),await new Promise((e=>r=e)),document.removeEventListener("visibilitychange",a)}}class To{constructor(e=!0,t,n,o=0){this.singleRuntime=e,this.logger=t,this.webRendererId=o,this.afterStartedCallbacks=[],n&&this.afterStartedCallbacks.push(...n)}async importInitializersAsync(e,t){await Promise.all(e.map((e=>async 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){if(e.singleRuntime){const{beforeStart:n,afterStarted:o,beforeWebAssemblyStart:s,afterWebAssemblyStarted:a,beforeServerStart:c,afterServerStarted:l}=r;let h=n;e.webRendererId===gn.Server&&c&&(h=c),e.webRendererId===gn.WebAssembly&&s&&(h=s);let d=o;return e.webRendererId===gn.Server&&l&&(d=l),e.webRendererId===gn.WebAssembly&&a&&(d=a),i(e,h,d,t)}return function(e,t,n){const r=n[0],{beforeStart:s,afterStarted:a,beforeWebStart:c,afterWebStarted:l,beforeWebAssemblyStart:h,afterWebAssemblyStarted:d,beforeServerStart:u,afterServerStarted:p}=t,f=!(c||l||h||d||u||p||!s&&!a),g=f&&r.enableClassicInitializers;if(f&&!r.enableClassicInitializers)e.logger?.log(nt.Warning,`Initializer '${o}' will be ignored because multiple runtimes are available. Use 'before(Web|WebAssembly|Server)Start' and 'after(Web|WebAssembly|Server)Started' instead.`);else if(g)return i(e,s,a,n);if(function(e){e.webAssembly?e.webAssembly.initializers||(e.webAssembly.initializers={beforeStart:[],afterStarted:[]}):e.webAssembly={initializers:{beforeStart:[],afterStarted:[]}},e.circuit?e.circuit.initializers||(e.circuit.initializers={beforeStart:[],afterStarted:[]}):e.circuit={initializers:{beforeStart:[],afterStarted:[]}}}(r),h&&r.webAssembly.initializers.beforeStart.push(h),d&&r.webAssembly.initializers.afterStarted.push(d),u&&r.circuit.initializers.beforeStart.push(u),p&&r.circuit.initializers.afterStarted.push(p),l&&e.afterStartedCallbacks.push(l),c)return c(r)}(e,r,t)}function i(e,t,n,o){if(n&&e.afterStartedCallbacks.push(n),t)return t(...o)}}(this,e))))}async invokeAfterStartedCallbacks(e){const t=(n=this.webRendererId,E.get(n)?.[1]);var n;t&&await t,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}function Do(e){if(void 0!==wo)throw new Error("Blazor Server has already started.");return wo=new Promise(Ro.bind(null,e)),wo}async function Ro(e,t,n){await fo;const o=await async function(e){if(e.initializers)return await Promise.all(e.initializers.beforeStart.map((t=>t(e)))),new To(!1,void 0,e.initializers.afterStarted,gn.Server);const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),o=new To(!0,void 0,void 0,gn.Server);return await o.importInitializersAsync(n,[e]),o}(yo);if(go=at(document)||"",vo=new it(yo.logLevel),mo=new So(e,go,yo,vo),vo.log(nt.Information,"Starting up Blazor server-side application."),tt.reconnect=async()=>!(mo.didRenderingFail()||!await mo.reconnect()&&(vo.log(nt.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 Io(vo),yo.reconnectionHandler=yo.reconnectionHandler||tt.defaultReconnectionHandler,tt._internal.navigationManager.listenForNavigationEvents(gn.Server,((e,t,n)=>mo.sendLocationChanged(e,t,n)),((e,t,n,o)=>mo.sendLocationChanging(e,t,n,o))),tt._internal.forceCloseConnection=()=>mo.disconnect(),tt._internal.sendJSDataStream=(e,t,n)=>mo.sendJsDataStream(e,t,n),!await mo.start())return vo.log(nt.Error,"Failed to start the circuit."),void t();const r=()=>{mo.sendDisconnectBeacon()};tt.disconnect=r,window.addEventListener("unload",r,{capture:!1,once:!0}),vo.log(nt.Information,"Blazor server-side application started."),o.invokeAfterStartedCallbacks(tt),t()}class xo{constructor(e){this.initialComponents=e}resolveRootComponent(e){return this.initialComponents[e]}}class Ao{constructor(){this._eventListeners=new Map}static create(e){const t=new Ao;return e.addEventListener=t.addEventListener.bind(t),e.removeEventListener=t.removeEventListener.bind(t),t}addEventListener(e,t){let n=this._eventListeners.get(e);n||(n=new Set,this._eventListeners.set(e,n)),n.add(t)}removeEventListener(e,t){this._eventListeners.get(e)?.delete(t)}dispatchEvent(e,t){const n=this._eventListeners.get(e);if(!n)return;const o={...t,type:e};for(const e of n)e(o)}}let Po=!1;function No(e){if(Po)throw new Error("Blazor has already started.");Po=!0;const t=ot(e);!function(e){if(yo)throw new Error("Circuit options have already been configured.");fo=async function(e){const t=await e;yo=ot(t)}(e)}(Promise.resolve(t||{})),Ao.create(tt);const n=function(e){return lt(e,"server").sort(((e,t)=>e.sequence-t.sequence))}(document);return Do(new xo(n))}tt.start=No,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&No()}(); +!function(){"use strict";var e,t,n;!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,d={[h]:new l(window)};d[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let u,p=1;function f(e){t.push(e)}function g(e){if(e&&"object"==typeof e){d[p]=new l(e);const t={[n]:p};return p++,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 o={[s]:t};try{const t=g(e);o[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return o}function y(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 v(){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=f,e.invokeMethod=function(e,t,...n){return v().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return v().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=g,e.createJSStreamReference=m,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&S(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(u=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,o){const r=y(this,t),i=k(b(e,o)(...r||[]),n);return null==i?null:D(this,i)}beginInvokeJSFromDotNet(e,t,n,o,r){const i=new Promise((e=>{const o=y(this,n);e(b(t,r)(...o||[]))}));e&&i.then((t=>D(this,[e,!0,k(t,o)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,_(t)]))))}endInvokeDotNetFromJS(e,t,n){const o=t?y(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=D(this,o),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,r);return i?y(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=D(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 I;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 I;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 _(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function b(e,t){const n=d[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function S(e){delete d[e]}e.findJSFunction=b,e.disposeJSObjectReferenceById=S;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,f((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=d[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 C(n)}}return t}));class C{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class I{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function k(e,t){switch(t){case u.Default:return e;case u.JSObjectReference:return g(e);case u.JSStreamReference:return m(e);case u.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let T=0;function D(e,t){T=0,c=e;const n=JSON.stringify(t,R);return c=void 0,n}function R(e,t){if(t instanceof E)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(T,t);const e={[r]:T};return T++,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",e[e.namedEvent=10]="namedEvent"}(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 r=new Map,i=new Map,s=[];function a(e){return r.get(e)}function c(e){const t=r.get(e);return t?.browserEventName||e}function l(e,t){e.forEach((e=>r.set(e,t)))}function h(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}}}}),l(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),l(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...d(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),l(["focus","blur","focusin","focusout"],{createEventArgs:e=>({type:e.type})}),l(["keydown","keyup","keypress"],{createEventArgs:e=>{return{key:(t=e).key,code:t.code,location:t.location,repeat:t.repeat,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type,isComposing:t.isComposing};var t}}),l(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>d(e)}),l(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno,type:t.type};var t}}),l(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total,type:t.type};var t}}),l(["touchcancel","touchend","touchmove","touchenter","touchleave","touchstart"],{createEventArgs:e=>{return{detail:(t=e).detail,touches:h(t.touches),targetTouches:h(t.targetTouches),changedTouches:h(t.changedTouches),ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,type:t.type};var t}}),l(["gotpointercapture","lostpointercapture","pointercancel","pointerdown","pointerenter","pointerleave","pointermove","pointerout","pointerover","pointerup"],{createEventArgs:e=>{return{...d(t=e),pointerId:t.pointerId,width:t.width,height:t.height,pressure:t.pressure,tiltX:t.tiltX,tiltY:t.tiltY,pointerType:t.pointerType,isPrimary:t.isPrimary};var t}}),l(["wheel","mousewheel"],{createEventArgs:e=>{return{...d(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),l(["cancel","close","toggle"],{createEventArgs:()=>({})});const u=["date","datetime-local","month","time","week"],p=new Map;let f,g,m=0;const y={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const o="__bl-dynamic-root:"+(++m).toString();p.set(o,e);const r=await _().invokeMethodAsync("AddRootComponent",t,o),i=new w(r,g[t]);return await i.setParameters(n),i}};class v{invoke(e){return this._callback(e)}setCallback(t){this._selfJSObjectReference||(this._selfJSObjectReference=e.createJSObjectReference(this)),this._callback=t}getJSObjectReference(){return this._selfJSObjectReference}dispose(){this._selfJSObjectReference&&e.disposeJSObjectReference(this._selfJSObjectReference)}}class 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 v)}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(!f)throw new Error("Dynamic root components have not been enabled in this application.");return f}const b=new Map,S=[],E=new Map;function C(t,n,o,r){if(b.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);b.set(t,n),o&&r&&Object.keys(o).length>0&&function(t,n,o){if(f)throw new Error("Dynamic root components have already been enabled.");f=t,g=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(t),o,r),E.get(t)?.[0]?.(),function(e){for(const t of S)t(e)}(t)}function I(e,t,n){return T(e,t.eventHandlerId,(()=>k(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function k(e){const t=b.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let T=(e,t,n)=>n();const D=M(["abort","blur","cancel","canplay","canplaythrough","change","close","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"]),R={submit:!0},x=M(["click","dblclick","mousedown","mousemove","mouseup"]);class A{static{this.nextEventDelegatorId=0}constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++A.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new P(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,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(),i=null,s=!1;const c=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(x,d)&&h.disabled))){if(!s){const n=a(e);i=n?.createEventArgs?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(R,t.type)&&t.preventDefault(),I(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},i)}p.stopPropagation(e)&&(l=!0),p.preventDefault(e)&&t.preventDefault()}r=c||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 N:null}}class P{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},s.push(this.handleEventNameAliasAdded.bind(this))}add(e){if(this.infosByEventHandlerId[e.eventHandlerId])throw new Error(`Event ${e.eventHandlerId} is already tracked`);this.infosByEventHandlerId[e.eventHandlerId]=e,this.addGlobalListener(e.eventName)}get(e){return this.infosByEventHandlerId[e]}addGlobalListener(e){if(e=c(e),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=c(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 N{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 U=Symbol(),B=Symbol(),L=Symbol();function $(e,t){if(U in e)return e;const n=[];if(e.childNodes.length>0){if(!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");e.childNodes.forEach((t=>{const o=$(t,!0);o[B]=e,n.push(o)}))}return e[U]=n,e}function O(e){const t=J(e);for(;t.length;)j(e,0)}function F(e,t){const n=document.createComment("!");return H(n,e,t),n}function H(e,t,n){const o=e;let r=e;if(e instanceof Comment){const t=J(o);if(t?.length>0){const t=G(o),n=new Range;n.setStartBefore(e),n.setEndAfter(t),r=n.extractContents()}}const i=W(o);if(i){const e=J(i),t=Array.prototype.indexOf.call(e,o);e.splice(t,1),delete o[B]}const s=J(t);if(n0;)j(n,0)}const o=n;o.parentNode.removeChild(o)}function W(e){return e[B]||null}function z(e,t){return J(e)[t]}function q(e){const t=X(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function J(e){return e[U]}function V(e){const t=J(W(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function K(e,t){const n=J(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=G(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):Y(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 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 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=V(t);n?n.parentNode.insertBefore(e,n):Y(e,W(t))}}}function G(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=V(e);if(t)return t.previousSibling;{const t=W(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:G(t)}}function Q(e){return`_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||=[];for(let n=0;n{Ie()&&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=e.composedPath&&e.composedPath();if(t)for(let e=0;e{const t=document.createElement("script");t.textContent=e.textContent,e.getAttributeNames().forEach((n=>{t.setAttribute(n,e.getAttribute(n))})),e.parentNode.replaceChild(t,e)})),ie.content));var s;let a=0;for(;i.firstChild;)H(i.firstChild,r,a++)}applyAttribute(e,t,n,o){const r=e.frameReader,i=r.attributeName(o),s=r.attributeEventHandlerId(o);if(s){const e=pe(i);return void this.eventDelegator.setListener(n,e,s,t)}const a=r.attributeValue(o);this.setOrRemoveAttributeOrProperty(n,i,a)}insertFrameRange(e,t,n,o,r,i,s){const a=o;for(let a=i;a{Fe(t,e)})},enableNavigationInterception:function(e){if(void 0!==ge&&ge!==e)throw new Error("Only one interactive runtime may enable navigation interception at a time.");ge=e},setHasLocationChangingListeners:function(e,t){const n=xe.get(e);if(!n)throw new Error(`Renderer with ID '${e}' is not listening for navigation events`);n.hasLocationChangingEventListeners=t},endLocationChanging:function(e,t){Pe&&e===Re&&(Pe(t),Pe=null)},navigateTo:function(e,t){Me(e,t,!0)},refresh:function(e){!e&&Se()?Ee(location.href,!0):location.reload()},getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href,scrollToElement:be};function Me(e,t,n=!1){const o=Ce(e);!t.forceLoad&&_e(o)?We()?Ue(o,!1,t.replaceHistoryEntry,t.historyEntryState,n):Ee(o,t.replaceHistoryEntry):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Ue(e,t,n,o=void 0,r=!1){if($e(),function(e){const t=new URL(e);return""!==t.hash&&location.origin===t.origin&&location.pathname===t.pathname&&location.search===t.search}(e))return Be(e,n,o),void function(e){const t=e.indexOf("#");t!==e.length-1&&be(e.substring(t+1))}(e);const i=je();(r||!i?.hasLocationChangingEventListeners||await Oe(e,o,t,i))&&(we=!0,Be(e,n,o),await Fe(t))}function Be(e,t,n=void 0){t?history.replaceState({userState:n,_index:De},"",e):(De++,history.pushState({userState:n,_index:De},"",e))}function Le(e){return new Promise((t=>{const n=Ae;Ae=()=>{Ae=n,t()},history.go(e)}))}function $e(){Pe&&(Pe(!1),Pe=null)}function Oe(e,t,n,o){return new Promise((r=>{$e(),Re++,Pe=r,o.locationChanging(Re,e,t,n)}))}async function Fe(e,t){const n=t??location.href;await Promise.all(Array.from(xe,(async([t,o])=>{var r;r=t,b.has(r)&&await o.locationChanged(n,history.state?.userState,e)})))}async function He(e){Ae&&We()&&await Ae(e),De=history.state?._index??0}function je(){const e=ke();if(void 0!==e)return xe.get(e)}function We(){return Ie()||!Se()}const ze={focus:function(e,t){if(e instanceof HTMLElement)e.focus({preventScroll:t});else{if(!(e instanceof SVGElement))throw new Error("Unable to focus an invalid element.");if(!e.hasAttribute("tabindex"))throw new Error("Unable to focus an SVG element that does not have a tabindex.");e.focus({preventScroll:t})}},focusBySelector:function(e){const t=document.querySelector(e);t&&(t.hasAttribute("tabindex")||(t.tabIndex=-1),t.focus({preventScroll:!0}))}},qe={init:function(e,t,n,o=50){const r=Ve(t);(r||document.documentElement).style.overflowAnchor="none";const i=document.createRange();u(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(o){o.forEach((o=>{if(!o.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const r=i.getBoundingClientRect().height,s=o.rootBounds?.height;o.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",o.intersectionRect.top-o.boundingClientRect.top,r,s):o.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",o.boundingClientRect.bottom-o.intersectionRect.bottom,r,s)}))}),{root:r,rootMargin:`${o}px`});s.observe(t),s.observe(n);const a=d(t),c=d(n),{observersByDotNetObjectId:l,id:h}=Ke(e);function d(e){const t={attributes:!0},n=new MutationObserver(((n,o)=>{u(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 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)}l[h]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const{observersByDotNetObjectId:t,id:n}=Ke(e),o=t[n];o&&(o.intersectionObserver.disconnect(),o.mutationObserverBefore.disconnect(),o.mutationObserverAfter.disconnect(),e.dispose(),delete t[n])}},Je=Symbol();function Ve(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:Ve(e.parentElement):null}function Ke(e){const t=e._callDispatcher,n=e._id;return t[Je]??={},{observersByDotNetObjectId:t[Je],id:n}}const Xe={getAndRemoveExistingTitle:function(){const e=document.head?document.head.getElementsByTagName("title"):[];if(0===e.length)return null;let t=null;for(let n=e.length-1;n>=0;n--){const o=e[n],r=o.previousSibling;r instanceof Comment&&null!==W(r)||(null===t&&(t=o.textContent),o.parentNode?.removeChild(o))}return t}},Ye={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=Ge(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){const t=Math.min(1,o/s.width),i=Math.min(1,r/s.height),a=Math.min(t,i),c=document.createElement("canvas");c.width=Math.round(s.width*a),c.height=Math.round(s.height*a),c.getContext("2d")?.drawImage(s,0,0,c.width,c.height),c.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:a?.size||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return Ge(e,t).blob}};function Ge(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;function Ze(e){e.preventDefault(),e.returnValue=!0}async function et(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)}const tt={navigateTo:function(e,t,n=!1){Me(e,t instanceof Object?t:{forceLoad:t,replaceHistoryEntry:n})},registerCustomEventType:function(e,t){if(!t)throw new Error("The options parameter is required.");if(r.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)))}r.set(e,t)},rootComponents:y,runtime:{},_internal:{navigationManager:Ne,domWrapper:ze,Virtualize:qe,PageTitle:Xe,InputFile:Ye,NavigationLock:{enableNavigationPrompt:function(e){0===Qe.size&&window.addEventListener("beforeunload",Ze),Qe.add(e)},disableNavigationPrompt:function(e){Qe.delete(e),0===Qe.size&&window.removeEventListener("beforeunload",Ze)}},getJSDataStreamChunk:et,attachWebRendererInterop:C}};var nt;function ot(e){const t={...rt,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...rt.reconnectionOptions,...e.reconnectionOptions}),t}window.Blazor=tt,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"}(nt||(nt={}));const rt={configureSignalR:e=>{},logLevel:nt.Warning,initializers:void 0,circuitHandlers:[],reconnectionOptions:{maxRetries:30,retryIntervalMilliseconds:function(e,t){return t&&e>=t?null:e<10?0:e<20?5e3:3e4},dialogId:"components-reconnect-modal"}};(class e{static{this.instance=new e}log(e,t){}});let it=class{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${nt[e]}: ${t}`;switch(e){case nt.Critical:case nt.Error:console.error(n);break;case nt.Warning:console.warn(n);break;case nt.Information:console.info(n);break;default:console.log(n)}}}};const st=/^\s*Blazor-Server-Component-State:(?[a-zA-Z0-9+/=]+)$/;function at(e){return ct(e,st)}function ct(e,t,n="state"){if(e.nodeType===Node.COMMENT_NODE){const o=e.textContent||"",r=t.exec(o),i=r&&r.groups&&r.groups[n];return i&&e.parentNode?.removeChild(e),i}if(!e.hasChildNodes())return;const o=e.childNodes;for(let e=0;e.*)$/);function dt(e,t){const n=e.currentElement;var o,r,i;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const s=ht.exec(n.textContent),a=s&&s.groups&&s.groups.descriptor;if(!a)return;!function(e){if(e.parentNode instanceof Document)throw new Error("Root components cannot be marked as interactive. The element must be rendered statically so that scripts are not evaluated multiple times.")}(n);try{const s=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n&&"auto"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(a),c=function(e,t,n){const{prerenderId:o}=e;if(o){for(;n.next()&&n.currentElement;){const e=n.currentElement;if(e.nodeType!==Node.COMMENT_NODE)continue;if(!e.textContent)continue;const t=ht.exec(e.textContent),r=t&&t[1];if(r)return gt(r,o),e}throw new Error(`Could not find an end component comment for '${t}'.`)}}(s,n,e);if(t!==s.type)return;switch(s.type){case"webassembly":return r=n,i=c,ft(o=s),{...o,uniqueId:ut++,start:r,end:i};case"server":return function(e,t,n){return pt(e),{...e,uniqueId:ut++,start:t,end:n}}(s,n,c);case"auto":return function(e,t,n){return pt(e),ft(e),{...e,uniqueId:ut++,start:t,end:n}}(s,n,c)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}let ut=0;function pt(e){const{descriptor:t,sequence:n}=e;if(!t)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===n)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(n))throw new Error(`Error parsing the sequence '${n}' for component '${JSON.stringify(e)}'`)}function ft(e){const{assembly:t,typeName:n}=e;if(!t)throw new Error("assembly must be defined when using a descriptor.");if(!n)throw new Error("typeName must be defined when using a descriptor.");e.parameterDefinitions=e.parameterDefinitions&&atob(e.parameterDefinitions),e.parameterValues=e.parameterValues&&atob(e.parameterValues)}function gt(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 mt{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndex{n+=`0x${e<16?"0":""}${e.toString(16)} `})),n.substr(0,n.length-1)}(e)}'`)):"string"==typeof e&&(n=`String data of length ${e.length}`,t&&(n+=`. Content: '${e}'`)),n}function Nt(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function Mt(e,t,n,o,r,i){const s={},[a,c]=Lt();s[a]=c,e.log(Tt.Trace,`(${t} transport) sending data. ${Pt(r,i.logMessageContent)}.`);const l=Nt(r)?"arraybuffer":"text",h=await n.post(o,{content:r,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(Tt.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class Ut{constructor(e,t){this._subject=e,this._observer=t}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),0===this._subject.observers.length&&this._subject.cancelCallback&&this._subject.cancelCallback().catch((e=>{}))}}class Bt{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${Tt[e]}: ${t}`;switch(e){case Tt.Critical:case Tt.Error:this.out.error(n);break;case Tt.Warning:this.out.warn(n);break;case Tt.Information:this.out.info(n);break;default:this.out.log(n)}}}}function Lt(){return["X-SignalR-User-Agent",$t(Rt,"","Browser",void 0)]}function $t(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 Ot(e){return e.stack?e.stack:e.message?e.message:`${e}`}class Ft extends kt{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e="function"==typeof __webpack_require__?__non_webpack_require__: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("undefined"!=typeof global)return global;throw new Error("could not find global")}());if("undefined"==typeof AbortController){const e="function"==typeof __webpack_require__?__non_webpack_require__:require;this._abortControllerType=e("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new wt;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 wt});let o,r=null;if(e.timeout){const o=e.timeout;r=setTimeout((()=>{t.abort(),this._logger.log(Tt.Warning,"Timeout from HTTP request."),n=new vt}),o)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},Nt(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(Tt.Warning,`Error from HTTP request. ${e}.`),e}finally{r&&clearTimeout(r),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const e=await Ht(o,"text");throw new yt(e||o.statusText,o.status)}const i=Ht(o,e.responseType),s=await i;return new It(o.status,o.statusText,s)}getCookieString(e){return""}}function Ht(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 jt extends kt{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new wt):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&&(Nt(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 wt)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new It(o.status,o.statusText,o.response||o.responseText)):n(new yt(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(Tt.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new yt(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(Tt.Warning,"Timeout from HTTP request."),n(new vt)},o.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class Wt extends kt{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new Ft(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new jt(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new wt):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class zt{static write(e){return`${e}${zt.RecordSeparator}`}static parse(e){if(e[e.length-1]!==zt.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(zt.RecordSeparator);return t.pop(),t}}zt.RecordSeparatorCode=30,zt.RecordSeparator=String.fromCharCode(zt.RecordSeparatorCode);class qt{writeHandshakeRequest(e){return zt.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(Nt(e)){const o=new Uint8Array(e),r=o.indexOf(zt.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(zt.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=zt.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}}var Jt,Vt;!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",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"}(Jt||(Jt={}));class Kt{constructor(){this.observers=[]}next(e){for(const t of this.observers)t.next(e)}error(e){for(const t of this.observers)t.error&&t.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new Ut(this,e)}}class Xt{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}async _send(e){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let e=()=>{},o=()=>{};Nt(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise(((t,n)=>{e=t,o=n}))),this._messages.push(new Yt(t,this._totalMessageCount,e,o))}try{this._reconnectInProgress||await this._connection.send(t)}catch{this._disconnected()}await n}_ack(e){let t=-1;for(let n=0;nthis._nextReceivingSequenceId?this._connection.stop(new Error("Sequence ID greater than amount of messages we've received.")):this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=0!==this._messages.length?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:Jt.Sequence,sequenceId:e}));const t=this._messages;for(const e of t)await this._connection.send(e._message);this._reconnectInProgress=!1}_dispose(e){null!=e||(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case Jt.Invocation:case Jt.StreamItem:case Jt.Completion:case Jt.StreamInvocation:case Jt.CancelInvocation:return!0;case Jt.Close:case Jt.Sequence:case Jt.Ping:case Jt.Ack:return!1}}_ackTimer(){void 0===this._ackTimerHandle&&(this._ackTimerHandle=setTimeout((async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:Jt.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}}class Yt{constructor(e,t,n,o){this._message=e,this._id=t,this._resolver=n,this._rejector=o}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(Vt||(Vt={}));class Gt{static create(e,t,n,o,r,i,s){return new Gt(e,t,n,o,r,i,s)}constructor(e,t,n,o,r,i,s){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(Tt.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")},xt.isRequired(e,"connection"),xt.isRequired(t,"logger"),xt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=r?r:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._statefulReconnectBufferSize=null!=s?s:1e5,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new qt,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=Vt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Jt.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!==Vt.Disconnected&&this._connectionState!==Vt.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!==Vt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Vt.Connecting,this._logger.log(Tt.Debug,"Starting HubConnection.");try{await this._startInternal(),At.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Vt.Connected,this._connectionStarted=!0,this._logger.log(Tt.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=Vt.Disconnected,this._logger.log(Tt.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{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(Tt.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(Tt.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;!!this.connection.features.reconnect&&(this._messageBuffer=new Xt(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(Tt.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.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){if(this._connectionState===Vt.Disconnected)return this._logger.log(Tt.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===Vt.Disconnecting)return this._logger.log(Tt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const t=this._connectionState;return this._connectionState=Vt.Disconnecting,this._logger.log(Tt.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(Tt.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===Vt.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new wt("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._createStreamInvocation(e,t,o);let i;const s=new Kt;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===Jt.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._messageBuffer?this._messageBuffer._send(e):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===Jt.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)if(!this._messageBuffer||this._messageBuffer._shouldProcessMessage(e))switch(e.type){case Jt.Invocation:this._invokeClientMethod(e).catch((e=>{this._logger.log(Tt.Error,`Invoke client method threw error: ${Ot(e)}`)}));break;case Jt.StreamItem:case Jt.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===Jt.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(Tt.Error,`Stream callback threw error: ${Ot(e)}`)}}break}case Jt.Ping:break;case Jt.Close:{this._logger.log(Tt.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}case Jt.Ack:this._messageBuffer&&this._messageBuffer._ack(e);break;case Jt.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(e);break;default:this._logger.log(Tt.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(Tt.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(Tt.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(Tt.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===Vt.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(Tt.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(Tt.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(Tt.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(Tt.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(Tt.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(Tt.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(Tt.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new wt("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===Vt.Disconnecting?this._completeClose(e):this._connectionState===Vt.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===Vt.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=Vt.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(null!=e?e:new Error("Connection closed.")),this._messageBuffer=void 0),At.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Tt.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(Tt.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=Vt.Reconnecting,e?this._logger.log(Tt.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(Tt.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Tt.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==Vt.Reconnecting)return void this._logger.log(Tt.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this._logger.log(Tt.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!==Vt.Reconnecting)return void this._logger.log(Tt.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=Vt.Connected,this._logger.log(Tt.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(Tt.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(Tt.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==Vt.Reconnecting)return this._logger.log(Tt.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===Vt.Disconnecting&&this._completeClose());o=e instanceof Error?e:new Error(e.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(Tt.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(Tt.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(Tt.Error,`Stream 'error' callback called with '${e}' threw error: ${Ot(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?{target:e,arguments:t,streamIds:o,type:Jt.Invocation}:{target:e,arguments:t,type:Jt.Invocation};{const n=this._invocationId;return this._invocationId++,0!==o.length?{target:e,arguments:t,invocationId:n.toString(),streamIds:o,type:Jt.Invocation}:{target:e,arguments:t,invocationId:n.toString(),type:Jt.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;o0)&&(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[en.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[en.Authorization]&&delete e.headers[en.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var nn,on;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(nn||(nn={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(on||(on={}));let rn=class{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 sn{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new rn,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(xt.isRequired(e,"url"),xt.isRequired(t,"transferFormat"),xt.isIn(t,on,"transferFormat"),this._url=e,this._logger.log(Tt.Trace,"(LongPolling transport) Connecting."),t===on.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]=Lt(),r={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===on.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(Tt.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(Tt.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new yt(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(Tt.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,t);204===o.statusCode?(this._logger.log(Tt.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==o.statusCode?(this._logger.log(Tt.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new yt(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(Tt.Trace,`(LongPolling transport) data received. ${Pt(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(Tt.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof vt?this._logger.log(Tt.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(Tt.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(Tt.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?Mt(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(Tt.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(Tt.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=Lt();e[t]=n;const o={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let r;try{await this._httpClient.delete(this._url,o)}catch(e){r=e}r?r instanceof yt&&(404===r.statusCode?this._logger.log(Tt.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(Tt.Trace,`(LongPolling transport) Error sending a DELETE request: ${r}`)):this._logger.log(Tt.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(Tt.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(Tt.Trace,e),this.onclose(this._closeError)}}}class an{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 xt.isRequired(e,"url"),xt.isRequired(t,"transferFormat"),xt.isIn(t,on,"transferFormat"),this._logger.log(Tt.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===on.Text){if(At.isBrowser||At.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]=Lt();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(Tt.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(Tt.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?Mt(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 cn{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 xt.isRequired(e,"url"),xt.isRequired(t,"transferFormat"),xt.isIn(t,on,"transferFormat"),this._logger.log(Tt.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(At.isReactNative){const t={},[o,r]=Lt();t[o]=r,n&&(t[en.Authorization]=`Bearer ${n}`),s&&(t[en.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===on.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(Tt.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(Tt.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(Tt.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(Tt.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(Tt.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 ln{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,xt.isRequired(e,"url"),this._logger=function(e){return void 0===e?new Bt(Tt.Information):null===e?Dt.instance:void 0!==e.log?e:new Bt(e)}(t.logger),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 tn(t.httpClient||new Wt(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||on.Binary,xt.isIn(e,on,"transferFormat"),this._logger.log(Tt.Debug,`Starting connection with transfer format '${on[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(Tt.Error,e),await this._stopPromise,Promise.reject(new wt(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(Tt.Error,e),Promise.reject(new wt(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 hn(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(Tt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(Tt.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(Tt.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(Tt.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!==nn.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(nn.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 wt("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 sn&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(Tt.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(Tt.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]=Lt();t[n]=o;const r=this._resolveNegotiateUrl(e);this._logger.log(Tt.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.useStatefulReconnect&&!0!==this._options._useStatefulReconnect?Promise.reject(new Et("Client didn't negotiate Stateful Reconnect but the server did.")):n}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof yt&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(Tt.Error,t),Promise.reject(new Et(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(Tt.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,!0===(null==a?void 0:a.useStatefulReconnect));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(Tt.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new St(`${n.transport} failed: ${e}`,nn[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(Tt.Debug,e),Promise.reject(new wt(e))}}}}return i.length>0?Promise.reject(new Ct(`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 nn.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new cn(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case nn.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new an(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case nn.LongPolling:return new sn(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let o=!1;if(this.features.reconnect){try{this.features.disconnected(),await this.transport.connect(e,t),await this.features.resend()}catch{o=!0}o&&this._stopConnection(n)}else this._stopConnection(n)}:this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,o){const r=nn[e.transport];if(null==r)return this._logger.log(Tt.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||!!(t&e)}(t,r))return this._logger.log(Tt.Debug,`Skipping transport '${nn[r]}' because it was disabled by the client.`),new bt(`'${nn[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>on[e])).indexOf(n)>=0))return this._logger.log(Tt.Debug,`Skipping transport '${nn[r]}' because it does not support the requested transfer format '${on[n]}'.`),new Error(`'${nn[r]}' does not support ${on[n]}.`);if(r===nn.WebSockets&&!this._options.WebSocket||r===nn.ServerSentEvents&&!this._options.EventSource)return this._logger.log(Tt.Debug,`Skipping transport '${nn[r]}' because it is not supported in your environment.'`),new _t(`'${nn[r]}' is not supported in your environment.`,r);this._logger.log(Tt.Debug,`Selecting transport '${nn[r]}'.`);try{return this.features.reconnect=r===nn.WebSockets?o:void 0,this._constructTransport(r)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(Tt.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(Tt.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(Tt.Error,`Connection disconnected with error '${e}'.`):this._logger.log(Tt.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(Tt.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(Tt.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(Tt.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(!At.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(Tt.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?"true"===n.get("useStatefulReconnect")&&(this._options._useStatefulReconnect=!0):!0===this._options._useStatefulReconnect&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}}class hn{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new dn,this._transportResult=new dn,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new dn),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 dn;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):hn._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 dn{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class un{constructor(){this.name="json",this.version=2,this.transferFormat=on.Text}parseMessages(e,t){if("string"!=typeof e)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];null===t&&(t=Dt.instance);const n=zt.parse(e),o=[];for(const e of n){const n=JSON.parse(e);if("number"!=typeof n.type)throw new Error("Invalid payload.");switch(n.type){case Jt.Invocation:this._isInvocationMessage(n);break;case Jt.StreamItem:this._isStreamItemMessage(n);break;case Jt.Completion:this._isCompletionMessage(n);break;case Jt.Ping:case Jt.Close:break;case Jt.Ack:this._isAckMessage(n);break;case Jt.Sequence:this._isSequenceMessage(n);break;default:t.log(Tt.Information,"Unknown message type '"+n.type+"' ignored.");continue}o.push(n)}return o}writeMessage(e){return zt.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),void 0!==e.invocationId&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),void 0===e.item)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if("string"!=typeof e||""===e)throw new Error(t)}}const pn={trace:Tt.Trace,debug:Tt.Debug,info:Tt.Information,information:Tt.Information,warn:Tt.Warning,warning:Tt.Warning,error:Tt.Error,critical:Tt.Critical,none:Tt.None};class fn{configureLogging(e){if(xt.isRequired(e,"logging"),function(e){return void 0!==e.log}(e))this.logger=e;else if("string"==typeof e){const t=function(e){const t=pn[e.toLowerCase()];if(void 0!==t)return t;throw new Error(`Unknown log level: ${e}`)}(e);this.logger=new Bt(t)}else this.logger=new Bt(e);return this}withUrl(e,t){return xt.isRequired(e,"url"),xt.isNotEmpty(e,"url"),this.url=e,this.httpConnectionOptions="object"==typeof t?{...this.httpConnectionOptions,...t}:{...this.httpConnectionOptions,transport:t},this}withHubProtocol(e){return xt.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new Zt(e):this.reconnectPolicy=e:this.reconnectPolicy=new Zt,this}withServerTimeout(e){return xt.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return xt.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return void 0===this.httpConnectionOptions&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=null==e?void 0:e.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(void 0===e.logger&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new ln(this.url,e);return Gt.create(t,this.logger||Dt.instance,this.protocol||new un,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}var gn;!function(e){e[e.Default=0]="Default",e[e.Server=1]="Server",e[e.WebAssembly=2]="WebAssembly",e[e.WebView=3]="WebView"}(gn||(gn={}));var mn,yn,vn,wn=4294967295;function _n(e,t,n){var o=Math.floor(n/4294967296),r=n;e.setUint32(t,o),e.setUint32(t+4,r)}function bn(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var Sn=("undefined"==typeof process||"never"!==(null===(mn=null===process||void 0===process?void 0:process.env)||void 0===mn?void 0:mn.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function En(e){for(var t=e.length,n=0,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);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 Dn,Rn=Sn?new TextDecoder:null,xn=Sn?"undefined"!=typeof process&&"force"!==(null===(vn=null===process||void 0===process?void 0:process.env)||void 0===vn?void 0:vn.TEXT_DECODER)?200:0:wn,An=function(e,t){this.type=e,this.data=t},Pn=(Dn=function(e,t){return Dn=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])},Dn(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}Dn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Nn=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 Pn(t,e),t}(Error),Mn={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),_n(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:bn(t,4),nsec:t.getUint32(0)};default:throw new Nn("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},Un=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Mn)}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>In){var t=En(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),kn(e,this.bytes,this.pos),this.pos+=t}else t=En(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var o=e.length,r=n,i=0;i=55296&&s<=56319&&i>18&7|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128):(t[r++]=s>>12&15|224,t[r++]=s>>6&63|128)}else t[r++]=s>>6&31|192;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=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 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=Tn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,r),r},e}(),Fn=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 Fn(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,a=function(){var i,s,a,c,l,h,d,u;return Fn(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=Hn(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 qn))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($n(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 Fn(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=Hn(e),d.label=2;case 2:return[4,jn(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,jn(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 qn))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,jn(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 jn?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 Nn("Unrecognized type byte: ".concat($n(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 Nn("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new Nn("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 Nn("Unrecognized array type byte: ".concat($n(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new Nn("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 Nn("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 Nn("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthxn?function(e,t,n){var o=e.subarray(t,t+n);return Rn.decode(o)}(this.bytes,r,e):Tn(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 Nn("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw Jn;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 Nn("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=bn(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}();class Xn{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 Yn=new Uint8Array([145,Jt.Ping]);class Gn{constructor(e){this.name="messagepack",this.version=2,this.transferFormat=on.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new Ln(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new Kn(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=Dt.instance);const o=Xn.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 Jt.Invocation:return this._writeInvocation(e);case Jt.StreamInvocation:return this._writeStreamInvocation(e);case Jt.StreamItem:return this._writeStreamItem(e);case Jt.Completion:return this._writeCompletion(e);case Jt.Ping:return Xn.write(Yn);case Jt.CancelInvocation:return this._writeCancelInvocation(e);case Jt.Close:return this._writeClose();case Jt.Ack:return this._writeAck(e);case Jt.Sequence:return this._writeSequence(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 Jt.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case Jt.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case Jt.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case Jt.Ping:return this._createPingMessage(n);case Jt.Close:return this._createCloseMessage(n);case Jt.Ack:return this._createAckMessage(n);case Jt.Sequence:return this._createSequenceMessage(n);default:return t.log(Tt.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:Jt.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:Jt.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:Jt.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:Jt.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:Jt.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:Jt.Completion}}_createAckMessage(e){if(e.length<1)throw new Error("Invalid payload for Ack message.");return{sequenceId:e[1],type:Jt.Ack}}_createSequenceMessage(e){if(e.length<1)throw new Error("Invalid payload for Sequence message.");return{sequenceId:e[1],type:Jt.Sequence}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([Jt.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([Jt.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),Xn.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([Jt.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([Jt.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),Xn.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([Jt.StreamItem,e.headers||{},e.invocationId,e.item]);return Xn.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([Jt.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([Jt.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([Jt.Completion,e.headers||{},e.invocationId,t,e.result])}return Xn.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([Jt.CancelInvocation,e.headers||{},e.invocationId]);return Xn.write(t.slice())}_writeClose(){const e=this._encoder.encode([Jt.Close,null]);return Xn.write(e.slice())}_writeAck(e){const t=this._encoder.encode([Jt.Ack,e.sequenceId]);return Xn.write(t.slice())}_writeSequence(e){const t=this._encoder.encode([Jt.Sequence,e.sequenceId]);return Xn.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}const Qn="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,Zn=Qn?Qn.decode.bind(Qn):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)}}else o.push(n);o.length>1024&&(r.push(String.fromCharCode.apply(null,o)),o.length=0)}return r.push(String.fromCharCode.apply(null,o)),r.join("")},eo=Math.pow(2,32),to=Math.pow(2,21)-1;function no(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function oo(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function ro(e,t){const n=oo(e,t+4);if(n>to)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*eo+oo(e,t)}class io{constructor(e){this.batchData=e;const t=new lo(e);this.arrayRangeReader=new ho(e),this.arrayBuilderSegmentReader=new uo(e),this.diffReader=new so(e),this.editReader=new ao(e,t),this.frameReader=new co(e,t)}updatedComponents(){return no(this.batchData,this.batchData.length-20)}referenceFrames(){return no(this.batchData,this.batchData.length-16)}disposedComponentIds(){return no(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return no(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return no(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return no(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return ro(this.batchData,n)}}class so{constructor(e){this.batchDataUint8=e}componentId(e){return no(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class ao{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return no(this.batchDataUint8,e)}siblingIndex(e){return no(this.batchDataUint8,e+4)}newTreeIndex(e){return no(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return no(this.batchDataUint8,e+8)}removedAttributeName(e){const t=no(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class co{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return no(this.batchDataUint8,e)}subtreeLength(e){return no(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=no(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return no(this.batchDataUint8,e+8)}elementName(e){const t=no(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=no(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=no(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=no(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=no(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return ro(this.batchDataUint8,e+12)}}class lo{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=no(e,e.length-4)}readString(e){if(-1===e)return null;{const n=no(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(nt.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(nt.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(nt.Debug,`Applying batch ${e}.`),function(e,t){const n=fe[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{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()}})))}class So{constructor(t,n,o,r){this._firstUpdate=!0,this._renderingFailed=!1,this._disposed=!1,this._circuitId=void 0,this._applicationState=n,this._componentManager=t,this._options=o,this._logger=r,this._renderQueue=new po(this._logger),this._dispatcher=e.attachDispatcher(this)}start(){if(this.isDisposedOrDisposing())throw new Error("Cannot start a disposed circuit.");return this._startPromise||(this._startPromise=this.startCore()),this._startPromise}updateRootComponents(e){return this._firstUpdate?(this._firstUpdate=!1,this._connection?.send("UpdateRootComponents",e,this._applicationState)):this._connection?.send("UpdateRootComponents",e,"")}async startCore(){if(this._connection=await this.startConnection(),this._connection.state!==Vt.Connected)return!1;const e=JSON.stringify(this._componentManager.initialComponents.map((e=>{return t=e,{...t,start:void 0,end:void 0};var t})));if(this._circuitId=await this._connection.invoke("StartCircuit",Ne.getBaseURI(),Ne.getLocationHref(),e,this._applicationState||""),!this._circuitId)return!1;for(const e of this._options.circuitHandlers)e.onCircuitOpened&&e.onCircuitOpened();return!0}async startConnection(){const e=new Gn;e.name="blazorpack";const t=(new fn).withUrl("_blazor").withHubProtocol(e);this._options.configureSignalR(t);const n=t.build();n.on("JS.AttachComponent",((e,t)=>function(e,t,n,o){let r=fe[e];r||(r=new he(e),fe[e]=r),r.attachRootComponentToLogicalElement(n,t,!1)}(gn.Server,this.resolveElement(t),e))),n.on("JS.BeginInvokeJS",this._dispatcher.beginInvokeJSFromDotNet.bind(this._dispatcher)),n.on("JS.EndInvokeDotNet",this._dispatcher.endInvokeDotNetFromJS.bind(this._dispatcher)),n.on("JS.ReceiveByteArray",this._dispatcher.receiveByteArray.bind(this._dispatcher)),n.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start:t=>{n.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});this._dispatcher.supplyDotNetStream(e,t)})),n.on("JS.RenderBatch",(async(e,t)=>{this._logger.log(Tt.Debug,`Received render batch with id ${e} and ${t.byteLength} bytes.`),await this._renderQueue.processBatch(e,t,this._connection),this._componentManager.onAfterRenderBatch?.(gn.Server)})),n.on("JS.EndUpdateRootComponents",(e=>{this._componentManager.onAfterUpdateRootComponents?.(e)})),n.on("JS.EndLocationChanging",tt._internal.navigationManager.endLocationChanging),n.onclose((e=>{this._interopMethodsForReconnection=function(e){const t=b.get(e);if(!t)throw new Error(`Interop methods are not registered for renderer ${e}`);return b.delete(e),t}(gn.Server),this._disposed||this._renderingFailed||this._options.reconnectionHandler.onConnectionDown(this._options.reconnectionOptions,e)})),n.on("JS.Error",(e=>{this._renderingFailed=!0,this.unhandledError(e),bo()}));try{await n.start()}catch(e){if(this.unhandledError(e),"FailedToNegotiateWithServerError"===e.errorType)throw e;bo(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===nn.WebSockets))?this._logger.log(Tt.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===nn.WebSockets))?this._logger.log(Tt.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===nn.LongPolling))&&this._logger.log(Tt.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 n.connection?.features?.inherentKeepAlive&&this._logger.log(Tt.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."),n}async disconnect(){await(this._connection?.stop())}async reconnect(){if(!this._circuitId)throw new Error("Circuit host not initialized.");return this._connection.state===Vt.Connected||(this._connection=await this.startConnection(),this._interopMethodsForReconnection&&(C(gn.Server,this._interopMethodsForReconnection),this._interopMethodsForReconnection=void 0),!!await this._connection.invoke("ConnectCircuit",this._circuitId)&&(this._options.reconnectionHandler.onConnectionUp(),!0))}beginInvokeDotNetFromJS(e,t,n,o,r){this.throwIfDispatchingWhenDisposed(),this._connection.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,o||0,r)}endInvokeJSFromDotNet(e,t,n){this.throwIfDispatchingWhenDisposed(),this._connection.send("EndInvokeJSFromDotNet",e,t,n)}sendByteArray(e,t){this.throwIfDispatchingWhenDisposed(),this._connection.send("ReceiveByteArray",e,t)}throwIfDispatchingWhenDisposed(){if(this._disposed)throw new Error("The circuit associated with this dispatcher is no longer available.")}sendLocationChanged(e,t,n){return this._connection.send("OnLocationChanged",e,t,n)}sendLocationChanging(e,t,n,o){return this._connection.send("OnLocationChanging",e,t,n,o)}sendJsDataStream(e,t,n){return 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)}(this._connection,e,t,n)}resolveElement(e){const t=function(e){const t=p.get(e);if(t)return p.delete(e),t}(e);if(t)return $(t,!0);const n=Number.parseInt(e);if(!Number.isNaN(n))return function(e){const{start:t,end:n}=e,o=t[L];if(o){if(o!==e)throw new Error("The start component comment was already associated with another component descriptor.");return t}const r=t.parentNode;if(!r)throw new Error(`Comment not connected to the DOM ${t.textContent}`);const i=$(r,!0),s=J(i);t[B]=i,t[L]=e;const a=$(t);if(n){const e=J(a),o=Array.prototype.indexOf.call(s,a)+1;let r=null;for(;r!==n;){const n=s.splice(o,1)[0];if(!n)throw new Error("Could not find the end component comment in the parent logical node list");n[B]=t,e.push(n),r=n}}return a}(this._componentManager.resolveRootComponent(n));throw new Error(`Invalid sequence number or identifier '${e}'.`)}getRootComponentManager(){return this._componentManager}unhandledError(e){this._logger.log(Tt.Error,e),this.disconnect()}getDisconnectFormData(){const e=new FormData,t=this._circuitId;return e.append("circuitId",t),e}didRenderingFail(){return this._renderingFailed}isDisposedOrDisposing(){return void 0!==this._disposePromise}sendDisconnectBeacon(){if(this._disposed)return;const e=this.getDisconnectFormData();this._disposed=navigator.sendBeacon("_blazor/disconnect",e)}dispose(){return this._disposePromise||(this._disposePromise=this.disposeCore()),this._disposePromise}async disposeCore(){if(!this._startPromise)return void(this._disposed=!0);await this._startPromise,this._disposed=!0,this._connection?.stop();const e=this.getDisconnectFormData();fetch("_blazor/disconnect",{method:"POST",body:e});for(const e of this._options.circuitHandlers)e.onCircuitClosed&&e.onCircuitClosed()}}class Eo{static{this.ReconnectOverlayClassName="components-reconnect-overlay"}static{this.ReconnectDialogClassName="components-reconnect-dialog"}static{this.ReconnectVisibleClassName="components-reconnect-visible"}static{this.RejoiningAnimationClassName="components-rejoining-animation"}static{this.AnimationRippleCount=2}constructor(e,t,n){this.document=t,this.logger=n,this.style=this.document.createElement("style"),this.style.innerHTML=Eo.Css,this.overlay=this.document.createElement("div"),this.overlay.className=Eo.ReconnectOverlayClassName,this.host=this.document.createElement("div"),this.host.id=e;const o=this.host.attachShadow({mode:"open"});this.dialog=t.createElement("div"),this.dialog.className=Eo.ReconnectDialogClassName,o.appendChild(this.style),o.appendChild(this.overlay),this.rejoiningAnimation=t.createElement("div"),this.rejoiningAnimation.className=Eo.RejoiningAnimationClassName;for(let e=0;e{"visible"===this.document.visibilityState&&this.retry()}}show(){this.document.contains(this.host)||this.document.body.appendChild(this.host),this.reloadButton.style.display="none",this.rejoiningAnimation.style.display="block",this.status.innerHTML="Rejoining the server...",this.host.style.display="block",this.overlay.classList.add(Eo.ReconnectVisibleClassName)}update(e,t){if(1===e||0===t)this.status.innerHTML="Rejoining the server...";else{const e=1===t?"second":"seconds";this.status.innerHTML=`Rejoin failed... trying again in ${t} ${e}`}}hide(){this.host.style.display="none",this.overlay.classList.remove(Eo.ReconnectVisibleClassName)}failed(){this.reloadButton.style.display="block",this.rejoiningAnimation.style.display="none",this.status.innerHTML="Failed to rejoin.
Please retry or reload the page.",this.document.addEventListener("visibilitychange",this.retryWhenDocumentBecomesVisible)}rejected(){location.reload()}async retry(){this.document.removeEventListener("visibilitychange",this.retryWhenDocumentBecomesVisible),this.show();try{await tt.reconnect()||this.rejected()}catch(e){this.logger.log(nt.Error,e),this.failed()}}static{this.Css=`\n .${this.ReconnectOverlayClassName} {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 10000;\n display: none;\n overflow: hidden;\n animation: components-reconnect-fade-in;\n }\n\n .${this.ReconnectOverlayClassName}.${this.ReconnectVisibleClassName} {\n display: block;\n }\n\n .${this.ReconnectOverlayClassName}::before {\n content: '';\n background-color: rgba(0, 0, 0, 0.4);\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n animation: components-reconnect-fadeInOpacity 0.5s ease-in-out;\n opacity: 1;\n }\n\n .${this.ReconnectOverlayClassName} p {\n margin: 0;\n text-align: center;\n }\n\n .${this.ReconnectOverlayClassName} button {\n border: 0;\n background-color: #6b9ed2;\n color: white;\n padding: 4px 24px;\n border-radius: 4px;\n }\n\n .${this.ReconnectOverlayClassName} button:hover {\n background-color: #3b6ea2;\n }\n\n .${this.ReconnectOverlayClassName} button:active {\n background-color: #6b9ed2;\n }\n\n .${this.ReconnectDialogClassName} {\n position: relative;\n background-color: white;\n width: 20rem;\n margin: 20vh auto;\n padding: 2rem;\n border-radius: 0.5rem;\n box-shadow: 0 3px 6px 2px rgba(0, 0, 0, 0.3);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 1rem;\n opacity: 0;\n animation: components-reconnect-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s, components-reconnect-fadeInOpacity 0.5s ease-out 0.3s;\n animation-fill-mode: forwards;\n z-index: 10001;\n }\n\n .${this.RejoiningAnimationClassName} {\n display: block;\n position: relative;\n width: 80px;\n height: 80px;\n }\n\n .${this.RejoiningAnimationClassName} div {\n position: absolute;\n border: 3px solid #0087ff;\n opacity: 1;\n border-radius: 50%;\n animation: ${this.RejoiningAnimationClassName} 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;\n }\n\n .${this.RejoiningAnimationClassName} div:nth-child(2) {\n animation-delay: -0.5s;\n }\n\n @keyframes ${this.RejoiningAnimationClassName} {\n 0% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 0;\n }\n\n 4.9% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 0;\n }\n\n 5% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 1;\n }\n\n 100% {\n top: 0px;\n left: 0px;\n width: 80px;\n height: 80px;\n opacity: 0;\n }\n }\n\n @keyframes components-reconnect-fadeInOpacity {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n }\n\n @keyframes components-reconnect-slideUp {\n 0% {\n transform: translateY(30px) scale(0.95);\n }\n\n 100% {\n transform: translateY(0);\n }\n }\n `}}class Co{static{this.ShowClassName="components-reconnect-show"}static{this.HideClassName="components-reconnect-hide"}static{this.FailedClassName="components-reconnect-failed"}static{this.RejectedClassName="components-reconnect-rejected"}static{this.MaxRetriesId="components-reconnect-max-retries"}static{this.CurrentAttemptId="components-reconnect-current-attempt"}static{this.SecondsToNextAttemptId="components-seconds-to-next-attempt"}constructor(e,t,n){if(this.dialog=e,this.document=t,this.document=t,void 0!==n){const e=this.document.getElementById(Co.MaxRetriesId);e&&(e.innerText=n.toString())}}show(){this.removeClasses(),this.dialog.classList.add(Co.ShowClassName)}update(e,t){const n=this.document.getElementById(Co.CurrentAttemptId);n&&(n.innerText=e.toString());const o=this.document.getElementById(Co.SecondsToNextAttemptId);o&&(o.innerText=t.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Co.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Co.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Co.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Co.ShowClassName,Co.HideClassName,Co.FailedClassName,Co.RejectedClassName)}}class Io{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 Co(t,document,e.maxRetries):new Eo(e.dialogId,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new ko(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class ko{static{this.MaximumFirstRetryInterval=3e3}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;void 0===e.maxRetries||tko.MaximumFirstRetryInterval?ko.MaximumFirstRetryInterval:e.retryIntervalMilliseconds;if(await this.runTimer(n,1e3,(e=>{this.reconnectDisplay.update(t+1,Math.round(e/1e3))})),this.isDisposed)break;try{return await this.reconnectCallback()?void 0:void this.reconnectDisplay.rejected()}catch(e){this.logger.log(nt.Error,e)}}this.reconnectDisplay.failed()}async runTimer(e,t,n){if(e<=0)return void n(0);let o,r,i=Date.now();n(e);const s=()=>{if(this.isDisposed)return void r();const a=Date.now(),c=a-i;i=a;const l=Math.max(1,Math.floor(c/t)),h=t*l;if((e-=h){"visible"===document.visibilityState&&(clearTimeout(o),n(0),r())};o=setTimeout(s,t),document.addEventListener("visibilitychange",a),await new Promise((e=>r=e)),document.removeEventListener("visibilitychange",a)}}class To{constructor(e=!0,t,n,o=0){this.singleRuntime=e,this.logger=t,this.webRendererId=o,this.afterStartedCallbacks=[],n&&this.afterStartedCallbacks.push(...n)}async importInitializersAsync(e,t){await Promise.all(e.map((e=>async 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){if(e.singleRuntime){const{beforeStart:n,afterStarted:o,beforeWebAssemblyStart:s,afterWebAssemblyStarted:a,beforeServerStart:c,afterServerStarted:l}=r;let h=n;e.webRendererId===gn.Server&&c&&(h=c),e.webRendererId===gn.WebAssembly&&s&&(h=s);let d=o;return e.webRendererId===gn.Server&&l&&(d=l),e.webRendererId===gn.WebAssembly&&a&&(d=a),i(e,h,d,t)}return function(e,t,n){const r=n[0],{beforeStart:s,afterStarted:a,beforeWebStart:c,afterWebStarted:l,beforeWebAssemblyStart:h,afterWebAssemblyStarted:d,beforeServerStart:u,afterServerStarted:p}=t,f=!(c||l||h||d||u||p||!s&&!a),g=f&&r.enableClassicInitializers;if(f&&!r.enableClassicInitializers)e.logger?.log(nt.Warning,`Initializer '${o}' will be ignored because multiple runtimes are available. Use 'before(Web|WebAssembly|Server)Start' and 'after(Web|WebAssembly|Server)Started' instead.`);else if(g)return i(e,s,a,n);if(function(e){e.webAssembly?e.webAssembly.initializers||(e.webAssembly.initializers={beforeStart:[],afterStarted:[]}):e.webAssembly={initializers:{beforeStart:[],afterStarted:[]}},e.circuit?e.circuit.initializers||(e.circuit.initializers={beforeStart:[],afterStarted:[]}):e.circuit={initializers:{beforeStart:[],afterStarted:[]}}}(r),h&&r.webAssembly.initializers.beforeStart.push(h),d&&r.webAssembly.initializers.afterStarted.push(d),u&&r.circuit.initializers.beforeStart.push(u),p&&r.circuit.initializers.afterStarted.push(p),l&&e.afterStartedCallbacks.push(l),c)return c(r)}(e,r,t)}function i(e,t,n,o){if(n&&e.afterStartedCallbacks.push(n),t)return t(...o)}}(this,e))))}async invokeAfterStartedCallbacks(e){const t=(n=this.webRendererId,E.get(n)?.[1]);var n;t&&await t,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}function Do(e){if(void 0!==wo)throw new Error("Blazor Server has already started.");return wo=new Promise(Ro.bind(null,e)),wo}async function Ro(e,t,n){await fo;const o=await async function(e){if(e.initializers)return await Promise.all(e.initializers.beforeStart.map((t=>t(e)))),new To(!1,void 0,e.initializers.afterStarted,gn.Server);const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),o=new To(!0,void 0,void 0,gn.Server);return await o.importInitializersAsync(n,[e]),o}(yo);if(go=at(document)||"",vo=new it(yo.logLevel),mo=new So(e,go,yo,vo),vo.log(nt.Information,"Starting up Blazor server-side application."),tt.reconnect=async()=>!(mo.didRenderingFail()||!await mo.reconnect()&&(vo.log(nt.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 Io(vo),yo.reconnectionHandler=yo.reconnectionHandler||tt.defaultReconnectionHandler,tt._internal.navigationManager.listenForNavigationEvents(gn.Server,((e,t,n)=>mo.sendLocationChanged(e,t,n)),((e,t,n,o)=>mo.sendLocationChanging(e,t,n,o))),tt._internal.forceCloseConnection=()=>mo.disconnect(),tt._internal.sendJSDataStream=(e,t,n)=>mo.sendJsDataStream(e,t,n),!await mo.start())return vo.log(nt.Error,"Failed to start the circuit."),void t();const r=()=>{mo.sendDisconnectBeacon()};tt.disconnect=r,window.addEventListener("unload",r,{capture:!1,once:!0}),vo.log(nt.Information,"Blazor server-side application started."),o.invokeAfterStartedCallbacks(tt),t()}class xo{constructor(e){this.initialComponents=e}resolveRootComponent(e){return this.initialComponents[e]}}class Ao{constructor(){this._eventListeners=new Map}static create(e){const t=new Ao;return e.addEventListener=t.addEventListener.bind(t),e.removeEventListener=t.removeEventListener.bind(t),t}addEventListener(e,t){let n=this._eventListeners.get(e);n||(n=new Set,this._eventListeners.set(e,n)),n.add(t)}removeEventListener(e,t){this._eventListeners.get(e)?.delete(t)}dispatchEvent(e,t){const n=this._eventListeners.get(e);if(!n)return;const o={...t,type:e};for(const e of n)e(o)}}let Po=!1;function No(e){if(Po)throw new Error("Blazor has already started.");Po=!0;const t=ot(e);!function(e){if(yo)throw new Error("Circuit options have already been configured.");fo=async function(e){const t=await e;yo=ot(t)}(e)}(Promise.resolve(t||{})),Ao.create(tt);const n=function(e){return lt(e,"server").sort(((e,t)=>e.sequence-t.sequence))}(document);return Do(new xo(n))}tt.start=No,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&No()}(); diff --git a/src/Components/Web.JS/dist/Release/blazor.web.js b/src/Components/Web.JS/dist/Release/blazor.web.js index 472cff74a6a..d2bd92f15c0 100644 --- a/src/Components/Web.JS/dist/Release/blazor.web.js +++ b/src/Components/Web.JS/dist/Release/blazor.web.js @@ -1 +1 @@ -!function(){"use strict";var e;let t;var n,o;!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,d={[h]:new l(window)};d[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let u,p=1;function f(e){t.push(e)}function g(e){if(e&&"object"==typeof e){d[p]=new l(e);const t={[n]:p};return p++,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 o={[s]:t};try{const t=g(e);o[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return o}function y(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 v(){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=f,e.invokeMethod=function(e,t,...n){return v().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return v().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=g,e.createJSStreamReference=m,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&S(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(u=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,o){const r=y(this,t),i=k(_(e,o)(...r||[]),n);return null==i?null:R(this,i)}beginInvokeJSFromDotNet(e,t,n,o,r){const i=new Promise((e=>{const o=y(this,n);e(_(t,r)(...o||[]))}));e&&i.then((t=>R(this,[e,!0,k(t,o)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,b(t)]))))}endInvokeDotNetFromJS(e,t,n){const o=t?y(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=R(this,o),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,r);return i?y(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=R(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 I;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 I;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 b(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function _(e,t){const n=d[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function S(e){delete d[e]}e.findJSFunction=_,e.disposeJSObjectReferenceById=S;class C{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=C,f((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(o))return new C(t[o],c);if(t.hasOwnProperty(n)){const e=t[n],o=d[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 E(n)}}return t}));class E{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class I{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function k(e,t){switch(t){case u.Default:return e;case u.JSObjectReference:return g(e);case u.JSStreamReference:return m(e);case u.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let T=0;function R(e,t){T=0,c=e;const n=JSON.stringify(t,A);return c=void 0,n}function A(e,t){if(t instanceof C)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(T,t);const e={[r]:T};return T++,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"}(n||(n={})),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",e[e.namedEvent=10]="namedEvent"}(o||(o={}));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 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,isComposing:t.isComposing};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(["cancel","close","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 S().invokeMethodAsync("AddRootComponent",t,o),i=new _(r,m[t]);return await i.setParameters(n),i}};function w(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||{}),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 S().invokeMethodAsync("SetRootComponentParameters",this._componentId,o,t)}async dispose(){if(null!==this._componentId){await S().invokeMethodAsync("RemoveRootComponent",this._componentId),this._componentId=null;for(const e of this._jsEventCallbackWrappers.values())e.dispose()}}}function S(){if(!g)throw new Error("Dynamic root components have not been enabled in this application.");return g}const C=new Map,E=[],I=new Map;function k(t,n,o,r){if(C.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);C.set(t,n),o&&r&&Object.keys(o).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])}}(A(t),o,r),I.get(t)?.[0]?.(),function(e){for(const t of E)t(e)}(t)}function T(e){return C.has(e)}function R(e,t,n){return D(e,t.eventHandlerId,(()=>A(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function A(e){const t=C.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let D=(e,t,n)=>n();const x=B(["abort","blur","cancel","canplay","canplaythrough","change","close","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},M=B(["click","dblclick","mousedown","mousemove","mouseup"]);class P{static{this.nextEventDelegatorId=0}constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++P.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new L(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(x,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(M,d)&&h.disabled))){if(!s){const n=c(e);i=n?.createEventArgs?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(N,t.type)&&t.preventDefault(),R(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 U:null}}class L{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 B(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const O=Symbol(),$=Symbol(),F=Symbol();function H(e){const{start:t,end:n}=e,o=t[F];if(o){if(o!==e)throw new Error("The start component comment was already associated with another component descriptor.");return t}const r=t.parentNode;if(!r)throw new Error(`Comment not connected to the DOM ${t.textContent}`);const i=W(r,!0),s=Y(i);t[$]=i,t[F]=e;const a=W(t);if(n){const e=Y(a),o=Array.prototype.indexOf.call(s,a)+1;let r=null;for(;r!==n;){const n=s.splice(o,1)[0];if(!n)throw new Error("Could not find the end component comment in the parent logical node list");n[$]=t,e.push(n),r=n}}return a}function W(e,t){if(O in e)return e;const n=[];if(e.childNodes.length>0){if(!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");e.childNodes.forEach((t=>{const o=W(t,!0);o[$]=e,n.push(o)}))}return e[O]=n,e}function j(e){const t=Y(e);for(;t.length;)J(e,0)}function z(e,t){const n=document.createComment("!");return q(n,e,t),n}function q(e,t,n){const o=e;let r=e;if(e instanceof Comment){const t=Y(o);if(t?.length>0){const t=oe(o),n=new Range;n.setStartBefore(e),n.setEndAfter(t),r=n.extractContents()}}const i=V(o);if(i){const e=Y(i),t=Array.prototype.indexOf.call(e,o);e.splice(t,1),delete o[$]}const s=Y(t);if(n0;)J(n,0)}const o=n;o.parentNode.removeChild(o)}function V(e){return e[$]||null}function K(e,t){return Y(e)[t]}function X(e){return e[F]||null}function G(e){const t=te(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function Y(e){return e[O]}function Q(e){const t=Y(V(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function Z(e){return O in e}function ee(e,t){const n=Y(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=oe(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):ne(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 te(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 ne(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=Q(t);n?n.parentNode.insertBefore(e,n):ne(e,V(t))}}}function oe(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=Q(e);if(t)return t.previousSibling;{const t=V(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:oe(t)}}function re(e){return`_bl_${e}`}const ie="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,ie)&&"string"==typeof t[ie]?function(e){const t=`[${re(e)}]`;return document.querySelector(t)}(t[ie]):t));const se="_blazorDeferredValue";function ae(e){e instanceof HTMLOptionElement?de(e):se in e&&he(e,e[se])}function ce(e){return"select-multiple"===e.type}function le(e,t){e.value=t||""}function he(e,t){e instanceof HTMLSelectElement?ce(e)?function(e,t){t||=[];for(let n=0;n{He()&&Ne(e,(e=>{Ye(e,!0,!1)}))}))}getRootComponentCount(){return this.rootComponentIds.size}attachRootComponentToLogicalElement(e,t,n){if(we(t))throw new Error(`Root component '${e}' could not be attached because its target element is already associated with a root component`);n&&(t=z(t,Y(t).length)),ve(t,!0),this.attachComponentToElement(e,t),this.rootComponentIds.add(e),fe.add(t)}updateComponent(e,t,n,o){const r=this.childComponentLocations[t];if(!r)throw new Error(`No element is currently associated with component ${t}`);fe.delete(r)&&(j(r),r instanceof Comment&&(r.textContent="!"));const i=te(r)?.getRootNode(),s=i&&i.activeElement;this.applyEdits(e,t,r,0,n,o),s instanceof HTMLElement&&i&&i.activeElement!==s&&s.focus()}disposeComponent(e){if(this.rootComponentIds.delete(e)){const t=this.childComponentLocations[e];ve(t,!1),!0===t[me]?fe.add(t):j(t)}delete this.childComponentLocations[e]}disposeEventHandler(e){this.eventDelegator.removeListener(e)}attachComponentToElement(e,t){this.childComponentLocations[e]=t}applyEdits(e,t,o,r,i,s){let a,c=0,l=r;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;i{const t=document.createElement("script");t.textContent=e.textContent,e.getAttributeNames().forEach((n=>{t.setAttribute(n,e.getAttribute(n))})),e.parentNode.replaceChild(t,e)})),ue.content));var s;let a=0;for(;i.firstChild;)q(i.firstChild,r,a++)}applyAttribute(e,t,n,o){const r=e.frameReader,i=r.attributeName(o),s=r.attributeEventHandlerId(o);if(s){const e=Se(i);return void this.eventDelegator.setListener(n,e,s,t)}const a=r.attributeValue(o);this.setOrRemoveAttributeOrProperty(n,i,a)}insertFrameRange(e,t,n,o,r,i,s){const a=o;for(let a=i;a{nt(t,e)})},enableNavigationInterception:function(e){if(void 0!==Ee&&Ee!==e)throw new Error("Only one interactive runtime may enable navigation interception at a time.");Ee=e},setHasLocationChangingListeners:function(e,t){const n=Je.get(e);if(!n)throw new Error(`Renderer with ID '${e}' is not listening for navigation events`);n.hasLocationChangingEventListeners=t},endLocationChanging:function(e,t){Ke&&e===qe&&(Ke(t),Ke=null)},navigateTo:function(e,t){Ge(e,t,!0)},refresh:function(e){!e&&Oe()?$e(location.href,!0):location.reload()},getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href,scrollToElement:Be};function Ge(e,t,n=!1){const o=Fe(e);!t.forceLoad&&Me(o)?it()?Ye(o,!1,t.replaceHistoryEntry,t.historyEntryState,n):$e(o,t.replaceHistoryEntry):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Ye(e,t,n,o=void 0,r=!1){if(et(),Pe(e))return Qe(e,n,o),void Ue(e);const i=rt();(r||!i?.hasLocationChangingEventListeners||await tt(e,o,t,i))&&(Re=!0,Qe(e,n,o),await nt(t))}function Qe(e,t,n=void 0){t?history.replaceState({userState:n,_index:ze},"",e):(ze++,history.pushState({userState:n,_index:ze},"",e))}function Ze(e){return new Promise((t=>{const n=Ve;Ve=()=>{Ve=n,t()},history.go(e)}))}function et(){Ke&&(Ke(!1),Ke=null)}function tt(e,t,n,o){return new Promise((r=>{et(),qe++,Ke=r,o.locationChanging(qe,e,t,n)}))}async function nt(e,t){const n=t??location.href;await Promise.all(Array.from(Je,(async([t,o])=>{T(t)&&await o.locationChanged(n,history.state?.userState,e)})))}async function ot(e){Ve&&it()&&await Ve(e),ze=history.state?._index??0}function rt(){const e=We();if(void 0!==e)return Je.get(e)}function it(){return He()||!Oe()}const st={focus:function(e,t){if(e instanceof HTMLElement)e.focus({preventScroll:t});else{if(!(e instanceof SVGElement))throw new Error("Unable to focus an invalid element.");if(!e.hasAttribute("tabindex"))throw new Error("Unable to focus an SVG element that does not have a tabindex.");e.focus({preventScroll:t})}},focusBySelector:function(e){const t=document.querySelector(e);t&&(t.hasAttribute("tabindex")||(t.tabIndex=-1),t.focus({preventScroll:!0}))}},at={init:function(e,t,n,o=50){const r=lt(t);(r||document.documentElement).style.overflowAnchor="none";const i=document.createRange();u(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(o){o.forEach((o=>{if(!o.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const r=i.getBoundingClientRect().height,s=o.rootBounds?.height;o.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",o.intersectionRect.top-o.boundingClientRect.top,r,s):o.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",o.boundingClientRect.bottom-o.intersectionRect.bottom,r,s)}))}),{root:r,rootMargin:`${o}px`});s.observe(t),s.observe(n);const a=d(t),c=d(n),{observersByDotNetObjectId:l,id:h}=ht(e);function d(e){const t={attributes:!0},n=new MutationObserver(((n,o)=>{u(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 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)}l[h]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const{observersByDotNetObjectId:t,id:n}=ht(e),o=t[n];o&&(o.intersectionObserver.disconnect(),o.mutationObserverBefore.disconnect(),o.mutationObserverAfter.disconnect(),e.dispose(),delete t[n])}},ct=Symbol();function lt(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:lt(e.parentElement):null}function ht(e){const t=e._callDispatcher,n=e._id;return t[ct]??={},{observersByDotNetObjectId:t[ct],id:n}}const dt={getAndRemoveExistingTitle:function(){const e=document.head?document.head.getElementsByTagName("title"):[];if(0===e.length)return null;let t=null;for(let n=e.length-1;n>=0;n--){const o=e[n],r=o.previousSibling;r instanceof Comment&&null!==V(r)||(null===t&&(t=o.textContent),o.parentNode?.removeChild(o))}return t}},ut={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=pt(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){const t=Math.min(1,o/s.width),i=Math.min(1,r/s.height),a=Math.min(t,i),c=document.createElement("canvas");c.width=Math.round(s.width*a),c.height=Math.round(s.height*a),c.getContext("2d")?.drawImage(s,0,0,c.width,c.height),c.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:a?.size||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return pt(e,t).blob}};function pt(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 ft=new Set,gt={enableNavigationPrompt:function(e){0===ft.size&&window.addEventListener("beforeunload",mt),ft.add(e)},disableNavigationPrompt:function(e){ft.delete(e),0===ft.size&&window.removeEventListener("beforeunload",mt)}};function mt(e){e.preventDefault(),e.returnValue=!0}async function yt(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)}const vt=new Map,wt={navigateTo:function(e,t,n=!1){Ge(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,runtime:{},_internal:{navigationManager:Xe,domWrapper:st,Virtualize:at,PageTitle:dt,InputFile:ut,NavigationLock:gt,getJSDataStreamChunk:yt,attachWebRendererInterop:k}};var bt;window.Blazor=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"}(bt||(bt={})),class e{static{this.instance=new e}log(e,t){}};let _t=class{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${bt[e]}: ${t}`;switch(e){case bt.Critical:case bt.Error:console.error(n);break;case bt.Warning:console.warn(n);break;case bt.Information:console.info(n);break;default:console.log(n)}}}};function St(e,t){switch(t){case"webassembly":return Rt(e,"webassembly");case"server":return function(e){return Rt(e,"server").sort(((e,t)=>e.sequence-t.sequence))}(e);case"auto":return Rt(e,"auto")}}const Ct=/^\s*Blazor-Server-Component-State:(?[a-zA-Z0-9+/=]+)$/,Et=/^\s*Blazor-WebAssembly-Component-State:(?[a-zA-Z0-9+/=]+)$/,It=/^\s*Blazor-Web-Initializers:(?[a-zA-Z0-9+/=]+)$/;function kt(e){return Tt(e,Ct)}function Tt(e,t,n="state"){if(e.nodeType===Node.COMMENT_NODE){const o=e.textContent||"",r=t.exec(o),i=r&&r.groups&&r.groups[n];return i&&e.parentNode?.removeChild(e),i}if(!e.hasChildNodes())return;const o=e.childNodes;for(let e=0;e.*)$/);function Dt(e,t){const n=e.currentElement;var o,r,i;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const s=At.exec(n.textContent),a=s&&s.groups&&s.groups.descriptor;if(!a)return;!function(e){if(e.parentNode instanceof Document)throw new Error("Root components cannot be marked as interactive. The element must be rendered statically so that scripts are not evaluated multiple times.")}(n);try{const s=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n&&"auto"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(a),c=function(e,t,n){const{prerenderId:o}=e;if(o){for(;n.next()&&n.currentElement;){const e=n.currentElement;if(e.nodeType!==Node.COMMENT_NODE)continue;if(!e.textContent)continue;const t=At.exec(e.textContent),r=t&&t[1];if(r)return Pt(r,o),e}throw new Error(`Could not find an end component comment for '${t}'.`)}}(s,n,e);if(t!==s.type)return;switch(s.type){case"webassembly":return r=n,i=c,Mt(o=s),{...o,uniqueId:xt++,start:r,end:i};case"server":return function(e,t,n){return Nt(e),{...e,uniqueId:xt++,start:t,end:n}}(s,n,c);case"auto":return function(e,t,n){return Nt(e),Mt(e),{...e,uniqueId:xt++,start:t,end:n}}(s,n,c)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}let xt=0;function Nt(e){const{descriptor:t,sequence:n}=e;if(!t)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===n)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(n))throw new Error(`Error parsing the sequence '${n}' for component '${JSON.stringify(e)}'`)}function Mt(e){const{assembly:t,typeName:n}=e;if(!t)throw new Error("assembly must be defined when using a descriptor.");if(!n)throw new Error("typeName must be defined when using a descriptor.");e.parameterDefinitions=e.parameterDefinitions&&atob(e.parameterDefinitions),e.parameterValues=e.parameterValues&&atob(e.parameterValues)}function Pt(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 Lt{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndex{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 en(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function tn(e,t,n,o,r,i){const s={},[a,c]=rn();s[a]=c,e.log(Kt.Trace,`(${t} transport) sending data. ${Zt(r,i.logMessageContent)}.`);const l=en(r)?"arraybuffer":"text",h=await n.post(o,{content:r,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(Kt.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class nn{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 on{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${Kt[e]}: ${t}`;switch(e){case Kt.Critical:case Kt.Error:this.out.error(n);break;case Kt.Warning:this.out.warn(n);break;case Kt.Information:this.out.info(n);break;default:this.out.log(n)}}}}function rn(){return["X-SignalR-User-Agent",sn(Gt,"","Browser",void 0)]}function sn(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 an(e){return e.stack?e.stack:e.message?e.message:`${e}`}class cn extends Vt{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e="function"==typeof __webpack_require__?__non_webpack_require__: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("undefined"!=typeof global)return global;throw new Error("could not find global")}());if("undefined"==typeof AbortController){const e="function"==typeof __webpack_require__?__non_webpack_require__:require;this._abortControllerType=e("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new Ft;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 Ft});let o,r=null;if(e.timeout){const o=e.timeout;r=setTimeout((()=>{t.abort(),this._logger.log(Kt.Warning,"Timeout from HTTP request."),n=new $t}),o)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},en(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(Kt.Warning,`Error from HTTP request. ${e}.`),e}finally{r&&clearTimeout(r),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const e=await ln(o,"text");throw new Ot(e||o.statusText,o.status)}const i=ln(o,e.responseType),s=await i;return new Jt(o.status,o.statusText,s)}getCookieString(e){return""}}function ln(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 hn extends Vt{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Ft):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&&(en(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 Ft)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new Jt(o.status,o.statusText,o.response||o.responseText)):n(new Ot(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(Kt.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new Ot(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(Kt.Warning,"Timeout from HTTP request."),n(new $t)},o.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class dn extends Vt{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new cn(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new hn(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Ft):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class un{static write(e){return`${e}${un.RecordSeparator}`}static parse(e){if(e[e.length-1]!==un.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(un.RecordSeparator);return t.pop(),t}}un.RecordSeparatorCode=30,un.RecordSeparator=String.fromCharCode(un.RecordSeparatorCode);class pn{writeHandshakeRequest(e){return un.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(en(e)){const o=new Uint8Array(e),r=o.indexOf(un.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(un.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=un.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}}var fn,gn;!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",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"}(fn||(fn={}));class mn{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 nn(this,e)}}class yn{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}async _send(e){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let e=()=>{},o=()=>{};en(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise(((t,n)=>{e=t,o=n}))),this._messages.push(new vn(t,this._totalMessageCount,e,o))}try{this._reconnectInProgress||await this._connection.send(t)}catch{this._disconnected()}await n}_ack(e){let t=-1;for(let n=0;nthis._nextReceivingSequenceId?this._connection.stop(new Error("Sequence ID greater than amount of messages we've received.")):this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=0!==this._messages.length?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:fn.Sequence,sequenceId:e}));const t=this._messages;for(const e of t)await this._connection.send(e._message);this._reconnectInProgress=!1}_dispose(e){null!=e||(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case fn.Invocation:case fn.StreamItem:case fn.Completion:case fn.StreamInvocation:case fn.CancelInvocation:return!0;case fn.Close:case fn.Sequence:case fn.Ping:case fn.Ack:return!1}}_ackTimer(){void 0===this._ackTimerHandle&&(this._ackTimerHandle=setTimeout((async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:fn.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}}class vn{constructor(e,t,n,o){this._message=e,this._id=t,this._resolver=n,this._rejector=o}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(gn||(gn={}));class wn{static create(e,t,n,o,r,i,s){return new wn(e,t,n,o,r,i,s)}constructor(e,t,n,o,r,i,s){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(Kt.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")},Yt.isRequired(e,"connection"),Yt.isRequired(t,"logger"),Yt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=r?r:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._statefulReconnectBufferSize=null!=s?s:1e5,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new pn,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=gn.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:fn.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!==gn.Disconnected&&this._connectionState!==gn.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!==gn.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=gn.Connecting,this._logger.log(Kt.Debug,"Starting HubConnection.");try{await this._startInternal(),Qt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=gn.Connected,this._connectionStarted=!0,this._logger.log(Kt.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=gn.Disconnected,this._logger.log(Kt.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{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(Kt.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(Kt.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;!!this.connection.features.reconnect&&(this._messageBuffer=new yn(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(Kt.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.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){if(this._connectionState===gn.Disconnected)return this._logger.log(Kt.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===gn.Disconnecting)return this._logger.log(Kt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const t=this._connectionState;return this._connectionState=gn.Disconnecting,this._logger.log(Kt.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(Kt.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===gn.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new Ft("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._createStreamInvocation(e,t,o);let i;const s=new mn;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===fn.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._messageBuffer?this._messageBuffer._send(e):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===fn.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)if(!this._messageBuffer||this._messageBuffer._shouldProcessMessage(e))switch(e.type){case fn.Invocation:this._invokeClientMethod(e).catch((e=>{this._logger.log(Kt.Error,`Invoke client method threw error: ${an(e)}`)}));break;case fn.StreamItem:case fn.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===fn.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(Kt.Error,`Stream callback threw error: ${an(e)}`)}}break}case fn.Ping:break;case fn.Close:{this._logger.log(Kt.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}case fn.Ack:this._messageBuffer&&this._messageBuffer._ack(e);break;case fn.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(e);break;default:this._logger.log(Kt.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(Kt.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(Kt.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(Kt.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===gn.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(Kt.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(Kt.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(Kt.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(Kt.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(Kt.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(Kt.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(Kt.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new Ft("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===gn.Disconnecting?this._completeClose(e):this._connectionState===gn.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===gn.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=gn.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(null!=e?e:new Error("Connection closed.")),this._messageBuffer=void 0),Qt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Kt.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(Kt.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=gn.Reconnecting,e?this._logger.log(Kt.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(Kt.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Kt.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==gn.Reconnecting)return void this._logger.log(Kt.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this._logger.log(Kt.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!==gn.Reconnecting)return void this._logger.log(Kt.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=gn.Connected,this._logger.log(Kt.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(Kt.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(Kt.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==gn.Reconnecting)return this._logger.log(Kt.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===gn.Disconnecting&&this._completeClose());o=e instanceof Error?e:new Error(e.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(Kt.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(Kt.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(Kt.Error,`Stream 'error' callback called with '${e}' threw error: ${an(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?{target:e,arguments:t,streamIds:o,type:fn.Invocation}:{target:e,arguments:t,type:fn.Invocation};{const n=this._invocationId;return this._invocationId++,0!==o.length?{target:e,arguments:t,invocationId:n.toString(),streamIds:o,type:fn.Invocation}:{target:e,arguments:t,invocationId:n.toString(),type:fn.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;o0)&&(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[Sn.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[Sn.Authorization]&&delete e.headers[Sn.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var En,In;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(En||(En={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(In||(In={}));let kn=class{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 Tn{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new kn,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(Yt.isRequired(e,"url"),Yt.isRequired(t,"transferFormat"),Yt.isIn(t,In,"transferFormat"),this._url=e,this._logger.log(Kt.Trace,"(LongPolling transport) Connecting."),t===In.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]=rn(),r={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===In.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(Kt.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(Kt.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new Ot(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(Kt.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,t);204===o.statusCode?(this._logger.log(Kt.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==o.statusCode?(this._logger.log(Kt.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new Ot(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(Kt.Trace,`(LongPolling transport) data received. ${Zt(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(Kt.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof $t?this._logger.log(Kt.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(Kt.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(Kt.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?tn(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(Kt.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(Kt.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=rn();e[t]=n;const o={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let r;try{await this._httpClient.delete(this._url,o)}catch(e){r=e}r?r instanceof Ot&&(404===r.statusCode?this._logger.log(Kt.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(Kt.Trace,`(LongPolling transport) Error sending a DELETE request: ${r}`)):this._logger.log(Kt.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(Kt.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(Kt.Trace,e),this.onclose(this._closeError)}}}class Rn{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 Yt.isRequired(e,"url"),Yt.isRequired(t,"transferFormat"),Yt.isIn(t,In,"transferFormat"),this._logger.log(Kt.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===In.Text){if(Qt.isBrowser||Qt.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]=rn();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(Kt.Trace,`(SSE transport) data received. ${Zt(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(Kt.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?tn(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 An{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 Yt.isRequired(e,"url"),Yt.isRequired(t,"transferFormat"),Yt.isIn(t,In,"transferFormat"),this._logger.log(Kt.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(Qt.isReactNative){const t={},[o,r]=rn();t[o]=r,n&&(t[Sn.Authorization]=`Bearer ${n}`),s&&(t[Sn.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===In.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(Kt.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(Kt.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(Kt.Trace,`(WebSockets transport) data received. ${Zt(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(Kt.Trace,`(WebSockets transport) sending data. ${Zt(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(Kt.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 Dn{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Yt.isRequired(e,"url"),this._logger=function(e){return void 0===e?new on(Kt.Information):null===e?Xt.instance:void 0!==e.log?e:new on(e)}(t.logger),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 Cn(t.httpClient||new dn(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||In.Binary,Yt.isIn(e,In,"transferFormat"),this._logger.log(Kt.Debug,`Starting connection with transfer format '${In[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(Kt.Error,e),await this._stopPromise,Promise.reject(new Ft(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(Kt.Error,e),Promise.reject(new Ft(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 xn(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(Kt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(Kt.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(Kt.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(Kt.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!==En.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(En.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 Ft("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 Tn&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(Kt.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(Kt.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]=rn();t[n]=o;const r=this._resolveNegotiateUrl(e);this._logger.log(Kt.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.useStatefulReconnect&&!0!==this._options._useStatefulReconnect?Promise.reject(new zt("Client didn't negotiate Stateful Reconnect but the server did.")):n}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof Ot&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(Kt.Error,t),Promise.reject(new zt(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(Kt.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,!0===(null==a?void 0:a.useStatefulReconnect));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(Kt.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new jt(`${n.transport} failed: ${e}`,En[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(Kt.Debug,e),Promise.reject(new Ft(e))}}}}return i.length>0?Promise.reject(new qt(`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 En.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new An(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case En.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Rn(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case En.LongPolling:return new Tn(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let o=!1;if(this.features.reconnect){try{this.features.disconnected(),await this.transport.connect(e,t),await this.features.resend()}catch{o=!0}o&&this._stopConnection(n)}else this._stopConnection(n)}:this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,o){const r=En[e.transport];if(null==r)return this._logger.log(Kt.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||!!(t&e)}(t,r))return this._logger.log(Kt.Debug,`Skipping transport '${En[r]}' because it was disabled by the client.`),new Wt(`'${En[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>In[e])).indexOf(n)>=0))return this._logger.log(Kt.Debug,`Skipping transport '${En[r]}' because it does not support the requested transfer format '${In[n]}'.`),new Error(`'${En[r]}' does not support ${In[n]}.`);if(r===En.WebSockets&&!this._options.WebSocket||r===En.ServerSentEvents&&!this._options.EventSource)return this._logger.log(Kt.Debug,`Skipping transport '${En[r]}' because it is not supported in your environment.'`),new Ht(`'${En[r]}' is not supported in your environment.`,r);this._logger.log(Kt.Debug,`Selecting transport '${En[r]}'.`);try{return this.features.reconnect=r===En.WebSockets?o:void 0,this._constructTransport(r)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(Kt.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(Kt.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(Kt.Error,`Connection disconnected with error '${e}'.`):this._logger.log(Kt.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(Kt.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(Kt.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(Kt.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(!Qt.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(Kt.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?"true"===n.get("useStatefulReconnect")&&(this._options._useStatefulReconnect=!0):!0===this._options._useStatefulReconnect&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}}class xn{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Nn,this._transportResult=new Nn,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Nn),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 Nn;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):xn._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 Nn{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class Mn{constructor(){this.name="json",this.version=2,this.transferFormat=In.Text}parseMessages(e,t){if("string"!=typeof e)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];null===t&&(t=Xt.instance);const n=un.parse(e),o=[];for(const e of n){const n=JSON.parse(e);if("number"!=typeof n.type)throw new Error("Invalid payload.");switch(n.type){case fn.Invocation:this._isInvocationMessage(n);break;case fn.StreamItem:this._isStreamItemMessage(n);break;case fn.Completion:this._isCompletionMessage(n);break;case fn.Ping:case fn.Close:break;case fn.Ack:this._isAckMessage(n);break;case fn.Sequence:this._isSequenceMessage(n);break;default:t.log(Kt.Information,"Unknown message type '"+n.type+"' ignored.");continue}o.push(n)}return o}writeMessage(e){return un.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),void 0!==e.invocationId&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),void 0===e.item)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if("string"!=typeof e||""===e)throw new Error(t)}}const Pn={trace:Kt.Trace,debug:Kt.Debug,info:Kt.Information,information:Kt.Information,warn:Kt.Warning,warning:Kt.Warning,error:Kt.Error,critical:Kt.Critical,none:Kt.None};class Ln{configureLogging(e){if(Yt.isRequired(e,"logging"),function(e){return void 0!==e.log}(e))this.logger=e;else if("string"==typeof e){const t=function(e){const t=Pn[e.toLowerCase()];if(void 0!==t)return t;throw new Error(`Unknown log level: ${e}`)}(e);this.logger=new on(t)}else this.logger=new on(e);return this}withUrl(e,t){return Yt.isRequired(e,"url"),Yt.isNotEmpty(e,"url"),this.url=e,this.httpConnectionOptions="object"==typeof t?{...this.httpConnectionOptions,...t}:{...this.httpConnectionOptions,transport:t},this}withHubProtocol(e){return Yt.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new _n(e):this.reconnectPolicy=e:this.reconnectPolicy=new _n,this}withServerTimeout(e){return Yt.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return Yt.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return void 0===this.httpConnectionOptions&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=null==e?void 0:e.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(void 0===e.logger&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new Dn(this.url,e);return wn.create(t,this.logger||Xt.instance,this.protocol||new Mn,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}var Un;!function(e){e[e.Default=0]="Default",e[e.Server=1]="Server",e[e.WebAssembly=2]="WebAssembly",e[e.WebView=3]="WebView"}(Un||(Un={}));var Bn,On,$n,Fn=4294967295;function Hn(e,t,n){var o=Math.floor(n/4294967296),r=n;e.setUint32(t,o),e.setUint32(t+4,r)}function Wn(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var jn=("undefined"==typeof process||"never"!==(null===(Bn=null===process||void 0===process?void 0:process.env)||void 0===Bn?void 0:Bn.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function zn(e){for(var t=e.length,n=0,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);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 Xn,Gn=jn?new TextDecoder:null,Yn=jn?"undefined"!=typeof process&&"force"!==(null===($n=null===process||void 0===process?void 0:process.env)||void 0===$n?void 0:$n.TEXT_DECODER)?200:0:Fn,Qn=function(e,t){this.type=e,this.data=t},Zn=(Xn=function(e,t){return Xn=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])},Xn(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}Xn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),eo=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 Zn(t,e),t}(Error),to={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),Hn(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:Wn(t,4),nsec:t.getUint32(0)};default:throw new eo("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},no=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(to)}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>Jn){var t=zn(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),Vn(e,this.bytes,this.pos),this.pos+=t}else t=zn(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var o=e.length,r=n,i=0;i=55296&&s<=56319&&i>18&7|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128):(t[r++]=s>>12&15|224,t[r++]=s>>6&63|128)}else t[r++]=s>>6&31|192;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=oo(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=Kn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,r),r},e}(),ao=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 ao(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,a=function(){var i,s,a,c,l,h,d,u;return ao(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=co(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 po))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(io(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 ao(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=co(e),d.label=2;case 2:return[4,lo(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,lo(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 po))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,lo(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 lo?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 eo("Unrecognized type byte: ".concat(io(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 eo("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new eo("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 eo("Unrecognized array type byte: ".concat(io(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new eo("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 eo("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 eo("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthYn?function(e,t,n){var o=e.subarray(t,t+n);return Gn.decode(o)}(this.bytes,r,e):Kn(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 eo("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw fo;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 eo("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=Wn(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}();class yo{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 vo=new Uint8Array([145,fn.Ping]);class wo{constructor(e){this.name="messagepack",this.version=2,this.transferFormat=In.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new ro(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new mo(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=Xt.instance);const o=yo.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 fn.Invocation:return this._writeInvocation(e);case fn.StreamInvocation:return this._writeStreamInvocation(e);case fn.StreamItem:return this._writeStreamItem(e);case fn.Completion:return this._writeCompletion(e);case fn.Ping:return yo.write(vo);case fn.CancelInvocation:return this._writeCancelInvocation(e);case fn.Close:return this._writeClose();case fn.Ack:return this._writeAck(e);case fn.Sequence:return this._writeSequence(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 fn.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case fn.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case fn.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case fn.Ping:return this._createPingMessage(n);case fn.Close:return this._createCloseMessage(n);case fn.Ack:return this._createAckMessage(n);case fn.Sequence:return this._createSequenceMessage(n);default:return t.log(Kt.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:fn.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:fn.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:fn.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:fn.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:fn.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:fn.Completion}}_createAckMessage(e){if(e.length<1)throw new Error("Invalid payload for Ack message.");return{sequenceId:e[1],type:fn.Ack}}_createSequenceMessage(e){if(e.length<1)throw new Error("Invalid payload for Sequence message.");return{sequenceId:e[1],type:fn.Sequence}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([fn.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([fn.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),yo.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([fn.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([fn.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),yo.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([fn.StreamItem,e.headers||{},e.invocationId,e.item]);return yo.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([fn.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([fn.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([fn.Completion,e.headers||{},e.invocationId,t,e.result])}return yo.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([fn.CancelInvocation,e.headers||{},e.invocationId]);return yo.write(t.slice())}_writeClose(){const e=this._encoder.encode([fn.Close,null]);return yo.write(e.slice())}_writeAck(e){const t=this._encoder.encode([fn.Ack,e.sequenceId]);return yo.write(t.slice())}_writeSequence(e){const t=this._encoder.encode([fn.Sequence,e.sequenceId]);return yo.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}const bo="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,_o=bo?bo.decode.bind(bo):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)}}else o.push(n);o.length>1024&&(r.push(String.fromCharCode.apply(null,o)),o.length=0)}return r.push(String.fromCharCode.apply(null,o)),r.join("")},So=Math.pow(2,32),Co=Math.pow(2,21)-1;function Eo(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Io(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function ko(e,t){const n=Io(e,t+4);if(n>Co)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*So+Io(e,t)}class To{constructor(e){this.batchData=e;const t=new xo(e);this.arrayRangeReader=new No(e),this.arrayBuilderSegmentReader=new Mo(e),this.diffReader=new Ro(e),this.editReader=new Ao(e,t),this.frameReader=new Do(e,t)}updatedComponents(){return Eo(this.batchData,this.batchData.length-20)}referenceFrames(){return Eo(this.batchData,this.batchData.length-16)}disposedComponentIds(){return Eo(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return Eo(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return Eo(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return Eo(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return ko(this.batchData,n)}}class Ro{constructor(e){this.batchDataUint8=e}componentId(e){return Eo(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class Ao{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return Eo(this.batchDataUint8,e)}siblingIndex(e){return Eo(this.batchDataUint8,e+4)}newTreeIndex(e){return Eo(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return Eo(this.batchDataUint8,e+8)}removedAttributeName(e){const t=Eo(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class Do{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return Eo(this.batchDataUint8,e)}subtreeLength(e){return Eo(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=Eo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return Eo(this.batchDataUint8,e+8)}elementName(e){const t=Eo(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=Eo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=Eo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=Eo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=Eo(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return ko(this.batchDataUint8,e+12)}}class xo{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=Eo(e,e.length-4)}readString(e){if(-1===e)return null;{const n=Eo(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(bt.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(bt.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(bt.Debug,`Applying batch ${e}.`),xe(Un.Server,new To(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(bt.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(bt.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}let Lo=!1;function Uo(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),Lo||(Lo=!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()}})))}class Bo{constructor(t,n,o,r){this._firstUpdate=!0,this._renderingFailed=!1,this._disposed=!1,this._circuitId=void 0,this._applicationState=n,this._componentManager=t,this._options=o,this._logger=r,this._renderQueue=new Po(this._logger),this._dispatcher=e.attachDispatcher(this)}start(){if(this.isDisposedOrDisposing())throw new Error("Cannot start a disposed circuit.");return this._startPromise||(this._startPromise=this.startCore()),this._startPromise}updateRootComponents(e){return this._firstUpdate?(this._firstUpdate=!1,this._connection?.send("UpdateRootComponents",e,this._applicationState)):this._connection?.send("UpdateRootComponents",e,"")}async startCore(){if(this._connection=await this.startConnection(),this._connection.state!==gn.Connected)return!1;const e=JSON.stringify(this._componentManager.initialComponents.map((e=>Ut(e))));if(this._circuitId=await this._connection.invoke("StartCircuit",Xe.getBaseURI(),Xe.getLocationHref(),e,this._applicationState||""),!this._circuitId)return!1;for(const e of this._options.circuitHandlers)e.onCircuitOpened&&e.onCircuitOpened();return!0}async startConnection(){const e=new wo;e.name="blazorpack";const t=(new Ln).withUrl("_blazor").withHubProtocol(e);this._options.configureSignalR(t);const n=t.build();n.on("JS.AttachComponent",((e,t)=>Ae(Un.Server,this.resolveElement(t),e,!1))),n.on("JS.BeginInvokeJS",this._dispatcher.beginInvokeJSFromDotNet.bind(this._dispatcher)),n.on("JS.EndInvokeDotNet",this._dispatcher.endInvokeDotNetFromJS.bind(this._dispatcher)),n.on("JS.ReceiveByteArray",this._dispatcher.receiveByteArray.bind(this._dispatcher)),n.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start:t=>{n.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});this._dispatcher.supplyDotNetStream(e,t)})),n.on("JS.RenderBatch",(async(e,t)=>{this._logger.log(Kt.Debug,`Received render batch with id ${e} and ${t.byteLength} bytes.`),await this._renderQueue.processBatch(e,t,this._connection),this._componentManager.onAfterRenderBatch?.(Un.Server)})),n.on("JS.EndUpdateRootComponents",(e=>{this._componentManager.onAfterUpdateRootComponents?.(e)})),n.on("JS.EndLocationChanging",wt._internal.navigationManager.endLocationChanging),n.onclose((e=>{this._interopMethodsForReconnection=function(e){const t=C.get(e);if(!t)throw new Error(`Interop methods are not registered for renderer ${e}`);return C.delete(e),t}(Un.Server),this._disposed||this._renderingFailed||this._options.reconnectionHandler.onConnectionDown(this._options.reconnectionOptions,e)})),n.on("JS.Error",(e=>{this._renderingFailed=!0,this.unhandledError(e),Uo()}));try{await n.start()}catch(e){if(this.unhandledError(e),"FailedToNegotiateWithServerError"===e.errorType)throw e;Uo(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===En.WebSockets))?this._logger.log(Kt.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===En.WebSockets))?this._logger.log(Kt.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===En.LongPolling))&&this._logger.log(Kt.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 n.connection?.features?.inherentKeepAlive&&this._logger.log(Kt.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."),n}async disconnect(){await(this._connection?.stop())}async reconnect(){if(!this._circuitId)throw new Error("Circuit host not initialized.");return this._connection.state===gn.Connected||(this._connection=await this.startConnection(),this._interopMethodsForReconnection&&(k(Un.Server,this._interopMethodsForReconnection),this._interopMethodsForReconnection=void 0),!!await this._connection.invoke("ConnectCircuit",this._circuitId)&&(this._options.reconnectionHandler.onConnectionUp(),!0))}beginInvokeDotNetFromJS(e,t,n,o,r){this.throwIfDispatchingWhenDisposed(),this._connection.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,o||0,r)}endInvokeJSFromDotNet(e,t,n){this.throwIfDispatchingWhenDisposed(),this._connection.send("EndInvokeJSFromDotNet",e,t,n)}sendByteArray(e,t){this.throwIfDispatchingWhenDisposed(),this._connection.send("ReceiveByteArray",e,t)}throwIfDispatchingWhenDisposed(){if(this._disposed)throw new Error("The circuit associated with this dispatcher is no longer available.")}sendLocationChanged(e,t,n){return this._connection.send("OnLocationChanged",e,t,n)}sendLocationChanging(e,t,n,o){return this._connection.send("OnLocationChanging",e,t,n,o)}sendJsDataStream(e,t,n){return 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)}(this._connection,e,t,n)}resolveElement(e){const t=w(e);if(t)return W(t,!0);const n=Number.parseInt(e);if(!Number.isNaN(n))return H(this._componentManager.resolveRootComponent(n));throw new Error(`Invalid sequence number or identifier '${e}'.`)}getRootComponentManager(){return this._componentManager}unhandledError(e){this._logger.log(Kt.Error,e),this.disconnect()}getDisconnectFormData(){const e=new FormData,t=this._circuitId;return e.append("circuitId",t),e}didRenderingFail(){return this._renderingFailed}isDisposedOrDisposing(){return void 0!==this._disposePromise}sendDisconnectBeacon(){if(this._disposed)return;const e=this.getDisconnectFormData();this._disposed=navigator.sendBeacon("_blazor/disconnect",e)}dispose(){return this._disposePromise||(this._disposePromise=this.disposeCore()),this._disposePromise}async disposeCore(){if(!this._startPromise)return void(this._disposed=!0);await this._startPromise,this._disposed=!0,this._connection?.stop();const e=this.getDisconnectFormData();fetch("_blazor/disconnect",{method:"POST",body:e});for(const e of this._options.circuitHandlers)e.onCircuitClosed&&e.onCircuitClosed()}}function Oo(e){const t={...$o,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...$o.reconnectionOptions,...e.reconnectionOptions}),t}const $o={configureSignalR:e=>{},logLevel:bt.Warning,initializers:void 0,circuitHandlers:[],reconnectionOptions:{maxRetries:30,retryIntervalMilliseconds:function(e,t){return t&&e>=t?null:e<10?0:e<20?5e3:3e4},dialogId:"components-reconnect-modal"}};class Fo{static{this.ReconnectOverlayClassName="components-reconnect-overlay"}static{this.ReconnectDialogClassName="components-reconnect-dialog"}static{this.ReconnectVisibleClassName="components-reconnect-visible"}static{this.RejoiningAnimationClassName="components-rejoining-animation"}static{this.AnimationRippleCount=2}constructor(e,t,n){this.document=t,this.logger=n,this.style=this.document.createElement("style"),this.style.innerHTML=Fo.Css,this.overlay=this.document.createElement("div"),this.overlay.className=Fo.ReconnectOverlayClassName,this.host=this.document.createElement("div"),this.host.id=e;const o=this.host.attachShadow({mode:"open"});this.dialog=t.createElement("div"),this.dialog.className=Fo.ReconnectDialogClassName,o.appendChild(this.style),o.appendChild(this.overlay),this.rejoiningAnimation=t.createElement("div"),this.rejoiningAnimation.className=Fo.RejoiningAnimationClassName;for(let e=0;e{"visible"===this.document.visibilityState&&this.retry()}}show(){this.document.contains(this.host)||this.document.body.appendChild(this.host),this.reloadButton.style.display="none",this.rejoiningAnimation.style.display="block",this.status.innerHTML="Rejoining the server...",this.host.style.display="block",this.overlay.classList.add(Fo.ReconnectVisibleClassName)}update(e,t){if(1===e||0===t)this.status.innerHTML="Rejoining the server...";else{const e=1===t?"second":"seconds";this.status.innerHTML=`Rejoin failed... trying again in ${t} ${e}`}}hide(){this.host.style.display="none",this.overlay.classList.remove(Fo.ReconnectVisibleClassName)}failed(){this.reloadButton.style.display="block",this.rejoiningAnimation.style.display="none",this.status.innerHTML="Failed to rejoin.
Please retry or reload the page.",this.document.addEventListener("visibilitychange",this.retryWhenDocumentBecomesVisible)}rejected(){location.reload()}async retry(){this.document.removeEventListener("visibilitychange",this.retryWhenDocumentBecomesVisible),this.show();try{await wt.reconnect()||this.rejected()}catch(e){this.logger.log(bt.Error,e),this.failed()}}static{this.Css=`\n .${this.ReconnectOverlayClassName} {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 10000;\n display: none;\n overflow: hidden;\n animation: components-reconnect-fade-in;\n }\n\n .${this.ReconnectOverlayClassName}.${this.ReconnectVisibleClassName} {\n display: block;\n }\n\n .${this.ReconnectOverlayClassName}::before {\n content: '';\n background-color: rgba(0, 0, 0, 0.4);\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n animation: components-reconnect-fadeInOpacity 0.5s ease-in-out;\n opacity: 1;\n }\n\n .${this.ReconnectOverlayClassName} p {\n margin: 0;\n text-align: center;\n }\n\n .${this.ReconnectOverlayClassName} button {\n border: 0;\n background-color: #6b9ed2;\n color: white;\n padding: 4px 24px;\n border-radius: 4px;\n }\n\n .${this.ReconnectOverlayClassName} button:hover {\n background-color: #3b6ea2;\n }\n\n .${this.ReconnectOverlayClassName} button:active {\n background-color: #6b9ed2;\n }\n\n .${this.ReconnectDialogClassName} {\n position: relative;\n background-color: white;\n width: 20rem;\n margin: 20vh auto;\n padding: 2rem;\n border-radius: 0.5rem;\n box-shadow: 0 3px 6px 2px rgba(0, 0, 0, 0.3);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 1rem;\n opacity: 0;\n animation: components-reconnect-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s, components-reconnect-fadeInOpacity 0.5s ease-out 0.3s;\n animation-fill-mode: forwards;\n z-index: 10001;\n }\n\n .${this.RejoiningAnimationClassName} {\n display: block;\n position: relative;\n width: 80px;\n height: 80px;\n }\n\n .${this.RejoiningAnimationClassName} div {\n position: absolute;\n border: 3px solid #0087ff;\n opacity: 1;\n border-radius: 50%;\n animation: ${this.RejoiningAnimationClassName} 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;\n }\n\n .${this.RejoiningAnimationClassName} div:nth-child(2) {\n animation-delay: -0.5s;\n }\n\n @keyframes ${this.RejoiningAnimationClassName} {\n 0% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 0;\n }\n\n 4.9% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 0;\n }\n\n 5% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 1;\n }\n\n 100% {\n top: 0px;\n left: 0px;\n width: 80px;\n height: 80px;\n opacity: 0;\n }\n }\n\n @keyframes components-reconnect-fadeInOpacity {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n }\n\n @keyframes components-reconnect-slideUp {\n 0% {\n transform: translateY(30px) scale(0.95);\n }\n\n 100% {\n transform: translateY(0);\n }\n }\n `}}class Ho{static{this.ShowClassName="components-reconnect-show"}static{this.HideClassName="components-reconnect-hide"}static{this.FailedClassName="components-reconnect-failed"}static{this.RejectedClassName="components-reconnect-rejected"}static{this.MaxRetriesId="components-reconnect-max-retries"}static{this.CurrentAttemptId="components-reconnect-current-attempt"}static{this.SecondsToNextAttemptId="components-seconds-to-next-attempt"}constructor(e,t,n){if(this.dialog=e,this.document=t,this.document=t,void 0!==n){const e=this.document.getElementById(Ho.MaxRetriesId);e&&(e.innerText=n.toString())}}show(){this.removeClasses(),this.dialog.classList.add(Ho.ShowClassName)}update(e,t){const n=this.document.getElementById(Ho.CurrentAttemptId);n&&(n.innerText=e.toString());const o=this.document.getElementById(Ho.SecondsToNextAttemptId);o&&(o.innerText=t.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Ho.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Ho.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Ho.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Ho.ShowClassName,Ho.HideClassName,Ho.FailedClassName,Ho.RejectedClassName)}}class Wo{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||wt.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new Ho(t,document,e.maxRetries):new Fo(e.dialogId,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new jo(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class jo{static{this.MaximumFirstRetryInterval=3e3}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;void 0===e.maxRetries||tjo.MaximumFirstRetryInterval?jo.MaximumFirstRetryInterval:e.retryIntervalMilliseconds;if(await this.runTimer(n,1e3,(e=>{this.reconnectDisplay.update(t+1,Math.round(e/1e3))})),this.isDisposed)break;try{return await this.reconnectCallback()?void 0:void this.reconnectDisplay.rejected()}catch(e){this.logger.log(bt.Error,e)}}this.reconnectDisplay.failed()}async runTimer(e,t,n){if(e<=0)return void n(0);let o,r,i=Date.now();n(e);const s=()=>{if(this.isDisposed)return void r();const a=Date.now(),c=a-i;i=a;const l=Math.max(1,Math.floor(c/t)),h=t*l;if((e-=h){"visible"===document.visibilityState&&(clearTimeout(o),n(0),r())};o=setTimeout(s,t),document.addEventListener("visibilitychange",a),await new Promise((e=>r=e)),document.removeEventListener("visibilitychange",a)}}class zo{constructor(e=!0,t,n,o=0){this.singleRuntime=e,this.logger=t,this.webRendererId=o,this.afterStartedCallbacks=[],n&&this.afterStartedCallbacks.push(...n)}async importInitializersAsync(e,t){await Promise.all(e.map((e=>async 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){if(e.singleRuntime){const{beforeStart:n,afterStarted:o,beforeWebAssemblyStart:s,afterWebAssemblyStarted:a,beforeServerStart:c,afterServerStarted:l}=r;let h=n;e.webRendererId===Un.Server&&c&&(h=c),e.webRendererId===Un.WebAssembly&&s&&(h=s);let d=o;return e.webRendererId===Un.Server&&l&&(d=l),e.webRendererId===Un.WebAssembly&&a&&(d=a),i(e,h,d,t)}return function(e,t,n){const r=n[0],{beforeStart:s,afterStarted:a,beforeWebStart:c,afterWebStarted:l,beforeWebAssemblyStart:h,afterWebAssemblyStarted:d,beforeServerStart:u,afterServerStarted:p}=t,f=!(c||l||h||d||u||p||!s&&!a),g=f&&r.enableClassicInitializers;if(f&&!r.enableClassicInitializers)e.logger?.log(bt.Warning,`Initializer '${o}' will be ignored because multiple runtimes are available. Use 'before(Web|WebAssembly|Server)Start' and 'after(Web|WebAssembly|Server)Started' instead.`);else if(g)return i(e,s,a,n);if(function(e){e.webAssembly?e.webAssembly.initializers||(e.webAssembly.initializers={beforeStart:[],afterStarted:[]}):e.webAssembly={initializers:{beforeStart:[],afterStarted:[]}},e.circuit?e.circuit.initializers||(e.circuit.initializers={beforeStart:[],afterStarted:[]}):e.circuit={initializers:{beforeStart:[],afterStarted:[]}}}(r),h&&r.webAssembly.initializers.beforeStart.push(h),d&&r.webAssembly.initializers.afterStarted.push(d),u&&r.circuit.initializers.beforeStart.push(u),p&&r.circuit.initializers.afterStarted.push(p),l&&e.afterStartedCallbacks.push(l),c)return c(r)}(e,r,t)}function i(e,t,n,o){if(n&&e.afterStartedCallbacks.push(n),t)return t(...o)}}(this,e))))}async invokeAfterStartedCallbacks(e){const t=(n=this.webRendererId,I.get(n)?.[1]);var n;t&&await t,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let qo,Jo,Vo,Ko,Xo,Go,Yo;function Qo(e){if(void 0!==Go)throw new Error("Blazor Server has already started.");return Go=new Promise(Zo.bind(null,e)),Go}async function Zo(e,t,n){await qo;const o=await async function(e){if(e.initializers)return await Promise.all(e.initializers.beforeStart.map((t=>t(e)))),new zo(!1,void 0,e.initializers.afterStarted,Un.Server);const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),o=new zo(!0,void 0,void 0,Un.Server);return await o.importInitializersAsync(n,[e]),o}(Ko);if(Jo=kt(document)||"",Xo=new _t(Ko.logLevel),Vo=new Bo(e,Jo,Ko,Xo),Xo.log(bt.Information,"Starting up Blazor server-side application."),wt.reconnect=async()=>!(Vo.didRenderingFail()||!await Vo.reconnect()&&(Xo.log(bt.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)),wt.defaultReconnectionHandler=new Wo(Xo),Ko.reconnectionHandler=Ko.reconnectionHandler||wt.defaultReconnectionHandler,wt._internal.navigationManager.listenForNavigationEvents(Un.Server,((e,t,n)=>Vo.sendLocationChanged(e,t,n)),((e,t,n,o)=>Vo.sendLocationChanging(e,t,n,o))),wt._internal.forceCloseConnection=()=>Vo.disconnect(),wt._internal.sendJSDataStream=(e,t,n)=>Vo.sendJsDataStream(e,t,n),!await Vo.start())return Xo.log(bt.Error,"Failed to start the circuit."),void t();const r=()=>{Vo.sendDisconnectBeacon()};wt.disconnect=r,window.addEventListener("unload",r,{capture:!1,once:!0}),Xo.log(bt.Information,"Blazor server-side application started."),o.invokeAfterStartedCallbacks(wt),t()}async function er(){if(!Go)throw new Error("Cannot start the circuit until Blazor Server has started.");return!(!Vo||Vo.isDisposedOrDisposing())||(Yo?await Yo:(await Go,(!Vo||!Vo.didRenderingFail())&&(Vo&&Vo.isDisposedOrDisposing()&&(Jo=kt(document)||"",Vo=new Bo(Vo.getRootComponentManager(),Jo,Ko,Xo)),Yo=Vo.start(),async function(e){await e,Yo===e&&(Yo=void 0)}(Yo),Yo)))}function tr(e){if(Vo&&!Vo.isDisposedOrDisposing())return Vo.updateRootComponents(e);!async function(e){await Go,await er()&&Vo.updateRootComponents(e)}(e)}const nr=navigator,or=nr.userAgentData&&nr.userAgentData.brands,rr=or&&or.length>0?or.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):window.chrome,ir=nr.userAgentData?.platform??navigator.platform;function sr(e){return 0!==e.debugLevel&&(rr||navigator.userAgent.includes("Firefox"))}let ar,cr,lr,hr,dr=null;const ur={load:function(e,t){return async function(e,t){const{dotnet:n}=await async function(e){if("undefined"==typeof WebAssembly||!WebAssembly.validate)throw new Error("This browser does not support WebAssembly.");let t="_framework/dotnet.js";if(e.loadBootResource){const n="dotnetjs",o=e.loadBootResource(n,"dotnet.js",t,"","js-module-dotnet");if("string"==typeof o)t=o;else if(o)throw new Error(`For a ${n} resource, custom loaders must supply a URI string.`)}const n=new URL(t,document.baseURI).toString();return await import(n)}(e),o=function(e,t){const n={maxParallelDownloads:1e6,enableDownloadRetry:!1,applicationEnvironment:e.environment},o={...window.Module||{},onConfigLoaded:async n=>{n.environmentVariables||(n.environmentVariables={}),"sharded"===n.globalizationMode&&(n.environmentVariables.__BLAZOR_SHARDED_ICU="1"),wt._internal.getApplicationEnvironment=()=>n.applicationEnvironment,t?.(n),hr=await async function(e,t){if(e.initializers)return await Promise.all(e.initializers.beforeStart.map((t=>t(e)))),new zo(!1,void 0,e.initializers.afterStarted,Un.WebAssembly);{const n=[e,t.resources?.extensions??{}],o=new zo(!0,void 0,void 0,Un.WebAssembly),r=Object.keys(t?.resources?.libraryInitializers||{});return await o.importInitializersAsync(r,n),o}}(e,n)},onDownloadResourceProgress:pr,config:n,out:gr,err:mr};return o}(e,t);e.applicationCulture&&n.withApplicationCulture(e.applicationCulture),e.environment&&n.withApplicationEnvironment(e.environment),e.loadBootResource&&n.withResourceLoader(e.loadBootResource),n.withModuleConfig(o),e.configureRuntime&&e.configureRuntime(n),lr=await n.create()}(e,t)},start:function(){return async function(){if(!lr)throw new Error("The runtime must be loaded it gets configured.");const{setModuleImports:t,INTERNAL:n,getConfig:o,invokeLibraryInitializers:r}=lr;cr=n,function(e){const t=ir.match(/^Mac/i)?"Cmd":"Alt";sr(e)&&console.info(`Debugging hotkey: Shift+${t}+D (when application has focus)`),document.addEventListener("keydown",(t=>{t.shiftKey&&(t.metaKey||t.altKey)&&"KeyD"===t.code&&(sr(e)?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())}():rr?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."))}))}(o()),wt.runtime=lr,wt._internal.dotNetCriticalError=mr,t("blazor-internal",{Blazor:{_internal:wt._internal}});const i=await lr.getAssemblyExports("Microsoft.AspNetCore.Components.WebAssembly");return Object.assign(wt._internal,{dotNetExports:{...i.Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime}}),ar=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,o,r)=>{if(yr(),!o&&!t)throw new Error("Either assemblyName or dotNetObjectId must have a non null value.");const i=o?o.toString():t;wt._internal.dotNetExports.BeginInvokeDotNet(e?e.toString():null,i,n,r)},endInvokeJSFromDotNet:(e,t,n)=>{wt._internal.dotNetExports.EndInvokeJS(n)},sendByteArray:(e,t)=>{wt._internal.dotNetExports.ReceiveByteArrayFromJS(e,t)},invokeDotNetFromJS:(e,t,n,o)=>(yr(),wt._internal.dotNetExports.InvokeDotNet(e||null,t,n??0,o))}),{invokeLibraryInitializers:r}}()},callEntryPoint:async function(){try{await lr.runMain(lr.getConfig().mainAssemblyName,[])}catch(e){console.error(e),Uo()}},getArrayEntryPtr:function(e,t,n){const o=function(e){return e+12}(e)+4+t*n;return o},getObjectFieldsBaseAddress:function(e){return e+8},readInt16Field:function(e,t){return lr.getHeapI16(e+(t||0))},readInt32Field:function(e,t){return lr.getHeapI32(e+(t||0))},readUint64Field:function(e,t){return lr.getHeapU52(e+(t||0))},readObjectField:function(e,t){return lr.getHeapU32(e+(t||0))},readStringField:function(e,t,n){const o=lr.getHeapU32(e+(t||0));if(0===o)return null;if(n){const e=cr.monoObjectAsBoolOrNullUnsafe(o);if("boolean"==typeof e)return e?"":null}return cr.monoStringToStringUnsafe(o)},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return yr(),dr=vr.create(),dr},invokeWhenHeapUnlocked:function(e){dr?dr.enqueuePostReleaseAction(e):e()}};function pr(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 fr=["DEBUGGING ENABLED"],gr=e=>fr.indexOf(e)<0&&console.log(e),mr=e=>{console.error(e||"(null)"),Uo()};function yr(){if(dr)throw new Error("Assertion failed - heap is currently locked")}class vr{enqueuePostReleaseAction(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)}release(){if(dr!==this)throw new Error("Trying to release a lock which isn't current");for(cr.mono_wasm_gc_unlock(),dr=null;this.postReleaseActions?.length;)this.postReleaseActions.shift()(),yr()}static create(){return cr.mono_wasm_gc_lock(),new vr}}class wr{constructor(e){this.batchAddress=e,this.arrayRangeReader=br,this.arrayBuilderSegmentReader=_r,this.diffReader=Sr,this.editReader=Cr,this.frameReader=Er}updatedComponents(){return t.readStructField(this.batchAddress,0)}referenceFrames(){return t.readStructField(this.batchAddress,br.structLength)}disposedComponentIds(){return t.readStructField(this.batchAddress,2*br.structLength)}disposedEventHandlerIds(){return t.readStructField(this.batchAddress,3*br.structLength)}updatedComponentsEntry(e,t){return Ir(e,t,Sr.structLength)}referenceFramesEntry(e,t){return Ir(e,t,Er.structLength)}disposedComponentIdsEntry(e,n){const o=Ir(e,n,4);return t.readInt32Field(o)}disposedEventHandlerIdsEntry(e,n){const o=Ir(e,n,8);return t.readUint64Field(o)}}const br={structLength:8,values:e=>t.readObjectField(e,0),count:e=>t.readInt32Field(e,4)},_r={structLength:12,values:e=>{const n=t.readObjectField(e,0),o=t.getObjectFieldsBaseAddress(n);return t.readObjectField(o,0)},offset:e=>t.readInt32Field(e,4),count:e=>t.readInt32Field(e,8)},Sr={structLength:4+_r.structLength,componentId:e=>t.readInt32Field(e,0),edits:e=>t.readStructField(e,4),editsEntry:(e,t)=>Ir(e,t,Cr.structLength)},Cr={structLength:20,editType:e=>t.readInt32Field(e,0),siblingIndex:e=>t.readInt32Field(e,4),newTreeIndex:e=>t.readInt32Field(e,8),moveToSiblingIndex:e=>t.readInt32Field(e,8),removedAttributeName:e=>t.readStringField(e,16)},Er={structLength:36,frameType:e=>t.readInt16Field(e,4),subtreeLength:e=>t.readInt32Field(e,8),elementReferenceCaptureId:e=>t.readStringField(e,16),componentId:e=>t.readInt32Field(e,12),elementName:e=>t.readStringField(e,16),textContent:e=>t.readStringField(e,16),markupContent:e=>t.readStringField(e,16),attributeName:e=>t.readStringField(e,16),attributeValue:e=>t.readStringField(e,24,!0),attributeEventHandlerId:e=>t.readUint64Field(e,8)};function Ir(e,n,o){return t.getArrayEntryPtr(e,n,o)}class kr{constructor(e){this.componentManager=e}resolveRegisteredElement(e){const t=Number.parseInt(e);if(!Number.isNaN(t))return H(this.componentManager.resolveRootComponent(t))}getParameterValues(e){return this.componentManager.initialComponents[e].parameterValues}getParameterDefinitions(e){return this.componentManager.initialComponents[e].parameterDefinitions}getTypeName(e){return this.componentManager.initialComponents[e].typeName}getAssembly(e){return this.componentManager.initialComponents[e].assembly}getCount(){return this.componentManager.initialComponents.length}}let Tr,Rr,Ar,Dr,xr=!1,Nr=!1,Mr=!0,Pr=!1;const Lr=new Promise((e=>{Dr=e}));let Ur;const Br=new Promise((e=>{Ur=e}));let Or;const $r=new Promise((e=>{Or=e}));function Fr(e){if(Tr)throw new Error("WebAssembly options have already been configured.");!async function(e){const t=await e;Tr=t,Or()}(e)}function Hr(e){if(void 0!==Ar)throw new Error("Blazor WebAssembly has already started.");return Ar=new Promise(Wr.bind(null,e)),Ar}async function Wr(e,n,o){(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((()=>{}));const r=jr();!function(e){const t=D;D=(e,n,o)=>{((e,t,n)=>{const o=De(e);o?.eventDelegator.getHandler(t)&&ur.invokeWhenHeapUnlocked(n)})(e,n,(()=>t(e,n,o)))}}(),wt._internal.applyHotReload=(e,t,n,o,r)=>{ar.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDelta",e,t,n,o,r??null)},wt._internal.getApplyUpdateCapabilities=()=>ar.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","GetApplyUpdateCapabilities"),wt._internal.invokeJSJson=zr,wt._internal.endInvokeDotNetFromJS=qr,wt._internal.receiveWebAssemblyDotNetDataStream=Jr,wt._internal.receiveByteArray=Vr;const i=(t=ur,t);wt.platform=i,wt._internal.renderBatch=(e,t)=>{const n=ur.beginHeapLock();try{xe(e,new wr(t))}finally{n.release()}},wt._internal.navigationManager.listenForNavigationEvents(Un.WebAssembly,(async(e,t,n)=>{await ar.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t,n)}),(async(e,t,n,o)=>{const r=await ar.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChangingAsync",t,n,o);wt._internal.navigationManager.endLocationChanging(e,r)}));const s=new kr(e);wt._internal.registeredComponents={getRegisteredComponentsCount:()=>s.getCount(),getAssembly:e=>s.getAssembly(e),getTypeName:e=>s.getTypeName(e),getParameterDefinitions:e=>s.getParameterDefinitions(e)||"",getParameterValues:e=>s.getParameterValues(e)||""},wt._internal.getPersistedState=()=>Tt(document,Et)||"",wt._internal.getInitialComponentsUpdate=()=>Br,wt._internal.updateRootComponents=e=>wt._internal.dotNetExports?.UpdateRootComponentsCore(e),wt._internal.endUpdateRootComponents=t=>e.onAfterUpdateRootComponents?.(t),wt._internal.attachRootComponentToElement=(e,t,n)=>{const o=s.resolveRegisteredElement(e);o?Ae(n,o,t,!1):function(e,t,n){const o="::before";let r=!1;if(e.endsWith("::after"))e=e.slice(0,-7),r=!0;else if(e.endsWith(o))throw new Error(`The '${o}' selector is not supported.`);const i=w(e)||document.querySelector(e);if(!i)throw new Error(`Could not find any element matching selector '${e}'.`);Ae(n,W(i,!0),t,r)}(e,t,n)};try{await r,await i.start()}catch(e){throw new Error(`Failed to start platform. Reason: ${e}`)}i.callEntryPoint(),hr.invokeAfterStartedCallbacks(wt),Nr=!0,n()}function jr(){return Rr??=(async()=>{await $r;const e=Tr??{},t=Tr?.configureRuntime;e.configureRuntime=e=>{t?.(e),Pr&&e.withEnvironmentVariable("__BLAZOR_WEBASSEMBLY_WAIT_FOR_ROOT_COMPONENTS","true")},await ur.load(e,Dr),xr=!0})(),Rr}function zr(e,t,n,o,r){return 0!==r?(ar.beginInvokeJSFromDotNet(r,e,o,n,t),null):ar.invokeJSFromDotNet(e,o,n,t)}function qr(e,t,n){ar.endInvokeDotNetFromJS(e,t,n)}function Jr(e,t,n,o){!function(e,t,n,o,r){let i=vt.get(t);if(!i){const n=new ReadableStream({start(e){vt.set(t,e),i=e}});e.supplyDotNetStream(t,n)}r?(i.error(r),vt.delete(t)):0===o?(i.close(),vt.delete(t)):i.enqueue(n.length===o?n:n.subarray(0,o))}(ar,e,t,n,o)}function Vr(e,t){ar.receiveByteArray(e,t)}function Kr(e,t){t.namespaceURI?e.setAttributeNS(t.namespaceURI,t.name,t.value):e.setAttribute(t.name,t.value)}const Xr="data-permanent";var Gr,Yr;!function(e){e[e.None=0]="None",e[e.Some=1]="Some",e[e.Infinite=2]="Infinite"}(Gr||(Gr={})),function(e){e.Keep="keep",e.Update="update",e.Insert="insert",e.Delete="delete"}(Yr||(Yr={}));class Qr{static create(e,t,n){return 0===t&&n===e.length?e:new Qr(e,t,n)}constructor(e,t,n){this.source=e,this.startIndex=t,this.length=n}item(e){return this.source.item(e+this.startIndex)}forEach(e,t){for(let t=0;t=n&&s>=o&&r(e.item(i),t.item(s))===Gr.None;)i--,s--,a++;return a}(e,t,o,o,n),i=function(e){const t=[];let n=e.length-1,o=e[n]?.length-1;for(;n>0||o>0;){const r=0===n?Yr.Insert:0===o?Yr.Delete:e[n][o];switch(t.unshift(r),r){case Yr.Keep:case Yr.Update:n--,o--;break;case Yr.Insert:o--;break;case Yr.Delete:n--}}return t}(function(e,t,n){const o=[],r=[],i=e.length,s=t.length;if(0===i&&0===s)return[];for(let e=0;e<=i;e++)(o[e]=Array(s+1))[0]=e,r[e]=Array(s+1);const a=o[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=o[a-1][i]+1,l=o[a][i-1]+1;let h;switch(s){case Gr.None:h=o[a-1][i-1];break;case Gr.Some:h=o[a-1][i-1]+1;break;case Gr.Infinite:h=Number.MAX_VALUE}h{const t=Pe(e);history.pushState(null,"",e),t?Ue(e):bi(e,!0)}))}function vi(e){He()||bi(location.href,!1)}function wi(e){if(He()||e.defaultPrevented)return;const t=e.target;if(t instanceof HTMLFormElement){if(!function(e){const t=e.getAttribute("data-enhance");return"string"==typeof t&&""===t||"true"===t?.toLowerCase()}(t))return;const n=e.submitter?.getAttribute("formmethod")||t.method;if("dialog"===n)return void console.warn('A form cannot be enhanced when its method is "dialog".');const o=e.submitter?.getAttribute("formtarget")||t.target;if(""!==o&&"_self"!==o)return void console.warn('A form cannot be enhanced when its target is different from the default value "_self".');e.preventDefault();const r=new URL(e.submitter?.getAttribute("formaction")||t.action,document.baseURI),i={method:n},s=new FormData(t),a=e.submitter?.getAttribute("name"),c=e.submitter.getAttribute("value");a&&c&&s.append(a,c);const l=new URLSearchParams(s).toString();if("get"===i.method)r.search=l,history.pushState(null,"",r.toString());else{const n=e.submitter?.getAttribute("formenctype")||t.enctype;"multipart/form-data"===n?i.body=s:(i.body=l,i.headers={"content-type":n,accept:di})}bi(r.toString(),!1,i)}}async function bi(e,t,n,o){fi=!0,ui?.abort(),function(e,t){ke?.(e,t)}(e,t),pi.enhancedNavigationStarted(),ui=new AbortController;const r=ui.signal,i=fetch(e,Object.assign({signal:r,mode:"no-cors",headers:{accept:di}},n));let s=null;if(await async function(e,t,n,o){let r;try{if(r=await e,!r.body)return void n(r,"");const t=r.headers.get("ssr-framing");if(!t){const e=await r.text();return void n(r,e)}let o=!0;await r.body.pipeThrough(new TextDecoderStream).pipeThrough(function(e){let t="";return new TransformStream({transform(n,o){if(t+=n,t.indexOf(e,t.length-n.length-e.length)>=0){const n=t.split(e);n.slice(0,-1).forEach((e=>o.enqueue(e))),t=n[n.length-1]}},flush(e){e.enqueue(t)}})}(`\x3c!--${t}--\x3e`)).pipeTo(new WritableStream({write(e){o?(o=!1,n(r,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}}(i,r,((t,r)=>{const i=!n?.method||"get"===n.method,a=t.status>=200&&t.status<300;if("opaque"===t.type){if(i)return void Si(e);throw new Error("Enhanced navigation does not support making a non-GET request to an endpoint that redirects to an external origin. Avoid enabling enhanced navigation for form posts that may perform external redirections.")}if(a&&"allow"!==t.headers.get("blazor-enhanced-nav")){if(i)return void Si(e);throw new Error("Enhanced navigation does not support making a non-GET request to a non-Blazor endpoint. Avoid enabling enhanced navigation for forms that post to a non-Blazor endpoint.")}(t.redirected||o)&&((o?"get"===o:i)?history.replaceState(null,"",t.url):t.url!==location.href&&history.pushState(null,"",t.url),e=t.url);const c=t.headers.get("blazor-enhanced-nav-redirect-location");if(c)return void location.replace(c);t.redirected||i||!a||(Le(t.url,gi)?location.href!==gi&&history.pushState(null,"",gi):s=`Cannot perform enhanced form submission that changes the URL (except via a redirection), because then back/forward would not work. Either remove this form's 'action' attribute, or change its method to 'get', or do not mark it as enhanced.\nOld URL: ${location.href}\nNew URL: ${t.url}`),gi=t.url;const l=t.headers.get("content-type");if(l?.startsWith("text/html")&&r){const e=(new DOMParser).parseFromString(r,"text/html");ei(document,e),pi.documentUpdated()}else l?.startsWith("text/")&&r?_i(r):a||r?i?Si(e):_i(`Error: ${n.method} request to ${e} returned non-HTML content of type ${l||"unspecified"}.`):_i(`Error: ${t.status} ${t.statusText}`)})),!r.aborted){const t=e.indexOf("#");if(t>=0){const n=e.substring(t+1),o=document.getElementById(n);o?.scrollIntoView()}if(fi=!1,pi.enhancedNavigationCompleted(),s)throw new Error(s)}}function _i(e){document.documentElement.textContent=e;const t=document.documentElement.style;t.fontFamily="consolas, monospace",t.whiteSpace="pre-wrap",t.padding="1rem"}function Si(e){history.replaceState(null,"",e+"?"),location.replace(e)}let Ci,Ei=!0;function Ii(e,t){Ci=t,e?.disableDomPreservation&&(Ei=!1),customElements.define("blazor-ssr-end",ki)}class ki extends HTMLElement{connectedCallback(){const e=this.parentNode;e.parentNode?.removeChild(e),e.childNodes.forEach((e=>{if(e instanceof HTMLTemplateElement){const t=e.getAttribute("blazor-component-id");if(t)"true"!==e.getAttribute("enhanced-nav")&&ui||function(e,t){const n=function(e){const t=`bl:${e}`,n=document.createNodeIterator(document,NodeFilter.SHOW_COMMENT);let o=null;for(;(o=n.nextNode())&&o.textContent!==t;);if(!o)return null;const r=`/bl:${e}`;let i=null;for(;(i=n.nextNode())&&i.textContent!==r;);return i?{startMarker:o,endMarker:i}:null}(e);if(n){const{startMarker:e,endMarker:o}=n;if(Ei)ei({startExclusive:e,endExclusive:o},t);else{const n=o.parentNode,r=new Range;for(r.setStart(e,e.textContent.length),r.setEnd(o,0),r.deleteContents();t.childNodes[0];)n.insertBefore(t.childNodes[0],o)}Ci.documentUpdated()}}(t,e.content);else switch(e.getAttribute("type")){case"redirection":const t=Fe(e.content.textContent),n="form-post"===e.getAttribute("from");"true"===e.getAttribute("enhanced")&&Me(t)?bi(t,!1,void 0,n?"post":"get"):n?t!==location.href&&location.assign(t):location.replace(t);break;case"error":_i(e.content.textContent||"Error")}}}))}}class Ti{constructor(e){var t;this._circuitInactivityTimeoutMs=e,this._rootComponentsBySsrComponentId=new Map,this._seenDescriptors=new Set,this._pendingOperationBatches={},this._nextOperationBatchId=1,this._nextSsrComponentId=1,this._didWebAssemblyFailToLoadQuickly=!1,this._isComponentRefreshPending=!1,this.initialComponents=[],t=()=>{this.rootComponentsMayRequireRefresh()},E.push(t)}onAfterRenderBatch(e){e===Un.Server&&this.circuitMayHaveNoRootComponents()}onDocumentUpdated(){this.rootComponentsMayRequireRefresh()}onEnhancedNavigationCompleted(){this.rootComponentsMayRequireRefresh()}registerComponent(e){if(this._seenDescriptors.has(e))return;"webassembly"===e.type?this.startLoadingWebAssemblyIfNotStarted():"auto"===e.type&&this.startLoadingWebAssemblyIfNotStarted(1);const t=this._nextSsrComponentId++;this._seenDescriptors.add(e),this._rootComponentsBySsrComponentId.set(t,{descriptor:e,ssrComponentId:t})}unregisterComponent(e){this._seenDescriptors.delete(e.descriptor),this._rootComponentsBySsrComponentId.delete(e.ssrComponentId),this.circuitMayHaveNoRootComponents()}async startLoadingWebAssemblyIfNotStarted(e){if(void 0!==Rr)return;Pr=!0;const t=jr(),n=await Lr;void 0!==e&&(n.maxParallelDownloads=e),function(e){if(!e.cacheBootResources)return!1;const t=Ri(e);if(!t)return!1;const n=window.localStorage.getItem(t.key);return t.value===n}(n)||this.onWebAssemblyFailedToLoadQuickly(),await t,function(e){const t=Ri(e);t&&window.localStorage.setItem(t.key,t.value)}(n),this.rootComponentsMayRequireRefresh()}onWebAssemblyFailedToLoadQuickly(){this._didWebAssemblyFailToLoadQuickly||(this._didWebAssemblyFailToLoadQuickly=!0,this.rootComponentsMayRequireRefresh())}startCircutIfNotStarted(){return void 0===Go?Qo(this):!Vo||Vo.isDisposedOrDisposing()?er():void 0}async startWebAssemblyIfNotStarted(){this.startLoadingWebAssemblyIfNotStarted(),void 0===Ar&&await Hr(this)}rootComponentsMayRequireRefresh(){this._isComponentRefreshPending||(this._isComponentRefreshPending=!0,setTimeout((()=>{this._isComponentRefreshPending=!1,this.refreshRootComponents(this._rootComponentsBySsrComponentId.values())}),0))}circuitMayHaveNoRootComponents(){if(this.rendererHasExistingOrPendingComponents(Un.Server,"server","auto"))return clearTimeout(this._circuitInactivityTimeoutId),void(this._circuitInactivityTimeoutId=void 0);void 0===this._circuitInactivityTimeoutId&&(this._circuitInactivityTimeoutId=setTimeout((()=>{this.rendererHasExistingOrPendingComponents(Un.Server,"server","auto")||(async function(){await(Vo?.dispose())}(),this._circuitInactivityTimeoutId=void 0)}),this._circuitInactivityTimeoutMs))}rendererHasComponents(e){const t=De(e);return void 0!==t&&t.getRootComponentCount()>0}rendererHasExistingOrPendingComponents(e,...t){if(this.rendererHasComponents(e))return!0;for(const{descriptor:{type:n},assignedRendererId:o}of this._rootComponentsBySsrComponentId.values()){if(o===e)return!0;if(void 0===o&&-1!==t.indexOf(n))return!0}return!1}refreshRootComponents(e){const t=new Map;for(const n of e){const e=this.determinePendingOperation(n);if(!e)continue;const o=n.assignedRendererId;if(!o)throw new Error("Descriptors must be assigned a renderer ID before getting used as root components");let r=t.get(o);r||(r=[],t.set(o,r)),r.push(e)}for(const[e,n]of t){const t={batchId:this._nextOperationBatchId++,operations:n};this._pendingOperationBatches[t.batchId]=t;const o=JSON.stringify(t);e===Un.Server?tr(o):this.updateWebAssemblyRootComponents(o)}this.circuitMayHaveNoRootComponents()}updateWebAssemblyRootComponents(e){Mr?(Ur(e),Mr=!1):function(e){if(!Ar)throw new Error("Blazor WebAssembly has not started.");if(!wt._internal.updateRootComponents)throw new Error("Blazor WebAssembly has not initialized.");Nr?wt._internal.updateRootComponents(e):async function(e){if(await Ar,!wt._internal.updateRootComponents)throw new Error("Blazor WebAssembly has not initialized.");wt._internal.updateRootComponents(e)}(e)}(e)}resolveRendererIdForDescriptor(e){switch("auto"===e.type?this.getAutoRenderMode():e.type){case"server":return this.startCircutIfNotStarted(),Un.Server;case"webassembly":return this.startWebAssemblyIfNotStarted(),Un.WebAssembly;case null:return null}}getAutoRenderMode(){return this.rendererHasExistingOrPendingComponents(Un.WebAssembly,"webassembly")?"webassembly":this.rendererHasExistingOrPendingComponents(Un.Server,"server")?"server":xr?"webassembly":this._didWebAssemblyFailToLoadQuickly?"server":null}determinePendingOperation(e){if(t=e.descriptor,document.contains(t.start)){if(void 0===e.assignedRendererId){if(fi||"loading"===document.readyState)return null;const t=this.resolveRendererIdForDescriptor(e.descriptor);return null===t?null:T(t)?(be(e.descriptor.start,!0),e.assignedRendererId=t,e.uniqueIdAtLastUpdate=e.descriptor.uniqueId,{type:"add",ssrComponentId:e.ssrComponentId,marker:Ut(e.descriptor)}):null}return T(e.assignedRendererId)?e.uniqueIdAtLastUpdate===e.descriptor.uniqueId?null:(e.uniqueIdAtLastUpdate=e.descriptor.uniqueId,{type:"update",ssrComponentId:e.ssrComponentId,marker:Ut(e.descriptor)}):null}return e.hasPendingRemoveOperation?null:void 0===e.assignedRendererId?(this.unregisterComponent(e),null):T(e.assignedRendererId)?(be(e.descriptor.start,!1),e.hasPendingRemoveOperation=!0,{type:"remove",ssrComponentId:e.ssrComponentId}):null;var t}resolveRootComponent(e){const t=this._rootComponentsBySsrComponentId.get(e);if(!t)throw new Error(`Could not resolve a root component with SSR component ID '${e}'.`);return t.descriptor}onAfterUpdateRootComponents(e){const t=this._pendingOperationBatches[e];delete this._pendingOperationBatches[e];for(const e of t.operations)switch(e.type){case"remove":{const t=this._rootComponentsBySsrComponentId.get(e.ssrComponentId);t&&this.unregisterComponent(t);break}}}}function Ri(e){const t=e.resources?.hash,n=e.mainAssemblyName;return t&&n?{key:`blazor-resource-hash:${n}`,value:t}:null}class Ai{constructor(){this._eventListeners=new Map}static create(e){const t=new Ai;return e.addEventListener=t.addEventListener.bind(t),e.removeEventListener=t.removeEventListener.bind(t),t}addEventListener(e,t){let n=this._eventListeners.get(e);n||(n=new Set,this._eventListeners.set(e,n)),n.add(t)}removeEventListener(e,t){this._eventListeners.get(e)?.delete(t)}dispatchEvent(e,t){const n=this._eventListeners.get(e);if(!n)return;const o={...t,type:e};for(const e of n)e(o)}}let Di=null,xi=location.href,Ni=!1;function Mi(){null!==document.activeElement&&document.activeElement!==document.body||document.querySelector("[autofocus]")||Bi()}function Pi(){Le(xi,location.href)||(Ni=!0),xi=location.href}function Li(){Ni&&Bi()}function Ui(){Ni=!1}function Bi(){const e=Di?.getAttribute("selector");e&&st.focusBySelector(e)}class Oi extends HTMLElement{connectedCallback(){Di=this}disconnectedCallback(){Di===this&&(Di=null)}}let $i,Fi=!1;function Hi(e){if(Fi)throw new Error("Blazor has already started.");Fi=!0,e=e||{},e.logLevel??=bt.Error,wt._internal.hotReloadApplied=()=>{Oe()&&$e(location.href,!0)},$i=new Ti(e?.ssr?.circuitInactivityTimeoutMs??2e3);const t=Ai.create(wt),n={enhancedNavigationStarted:()=>{t.dispatchEvent("enhancednavigationstart",{})},documentUpdated:()=>{$i.onDocumentUpdated(),t.dispatchEvent("enhancedload",{})},enhancedNavigationCompleted(){$i.onEnhancedNavigationCompleted(),t.dispatchEvent("enhancednavigationend",{})}};return Zr=$i,Ii(e?.ssr,n),e?.ssr?.disableDomPreservation||(pi=n,document.addEventListener("click",yi),document.addEventListener("submit",wi),window.addEventListener("popstate",vi),Ie=mi),function(e){customElements.define("blazor-focus-on-navigate",Oi),e.addEventListener("enhancednavigationstart",Pi),e.addEventListener("enhancednavigationend",Li),document.addEventListener("focusin",Ui),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",Mi,{once:!0}):Mi()}(t),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",Wi.bind(null,e)):Wi(e),Promise.resolve()}function Wi(e){const t=Oo(e?.circuit||{});e.circuit=t;const n=async function(e,t){const n=Tt(document,It,"initializers");if(!n)return new zo(!1,t);const o=JSON.parse(atob(n))??[],r=new zo(!1,t);return await r.importInitializersAsync(o,[e]),r}(e,new _t(t.logLevel));!function(e){if(Ko)throw new Error("Circuit options have already been configured.");qo=async function(e){const t=await e;Ko=Oo(t)}(e)}(ji(n,t)),Fr(ji(n,e?.webAssembly||{})),function(e){const t=si(document);for(const e of t)Zr?.registerComponent(e)}(),$i.onDocumentUpdated(),async function(e){const t=await e;await t.invokeAfterStartedCallbacks(wt)}(n)}async function ji(e,t){return await e,t}wt.start=Hi,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&Hi()}(); +!function(){"use strict";var e;let t;var n,o;!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,d={[h]:new l(window)};d[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let u,p=1;function f(e){t.push(e)}function g(e){if(e&&"object"==typeof e){d[p]=new l(e);const t={[n]:p};return p++,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 o={[s]:t};try{const t=g(e);o[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return o}function y(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 v(){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=f,e.invokeMethod=function(e,t,...n){return v().invokeDotNetStaticMethod(e,t,...n)},e.invokeMethodAsync=function(e,t,...n){return v().invokeDotNetStaticMethodAsync(e,t,...n)},e.createJSObjectReference=g,e.createJSStreamReference=m,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&S(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(u=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,o){const r=y(this,t),i=k(_(e,o)(...r||[]),n);return null==i?null:R(this,i)}beginInvokeJSFromDotNet(e,t,n,o,r){const i=new Promise((e=>{const o=y(this,n);e(_(t,r)(...o||[]))}));e&&i.then((t=>R(this,[e,!0,k(t,o)]))).then((t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!0,t)),(t=>this._dotNetCallDispatcher.endInvokeJSFromDotNet(e,!1,JSON.stringify([e,!1,b(t)]))))}endInvokeDotNetFromJS(e,t,n){const o=t?y(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=R(this,o),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,r);return i?y(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=R(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 I;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 I;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 b(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function _(e,t){const n=d[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function S(e){delete d[e]}e.findJSFunction=_,e.disposeJSObjectReferenceById=S;class C{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=C,f((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(o))return new C(t[o],c);if(t.hasOwnProperty(n)){const e=t[n],o=d[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 E(n)}}return t}));class E{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class I{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function k(e,t){switch(t){case u.Default:return e;case u.JSObjectReference:return g(e);case u.JSStreamReference:return m(e);case u.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let T=0;function R(e,t){T=0,c=e;const n=JSON.stringify(t,A);return c=void 0,n}function A(e,t){if(t instanceof C)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(T,t);const e={[r]:T};return T++,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"}(n||(n={})),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",e[e.namedEvent=10]="namedEvent"}(o||(o={}));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 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,isComposing:t.isComposing};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(["cancel","close","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 S().invokeMethodAsync("AddRootComponent",t,o),i=new _(r,m[t]);return await i.setParameters(n),i}};function w(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||{}),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 S().invokeMethodAsync("SetRootComponentParameters",this._componentId,o,t)}async dispose(){if(null!==this._componentId){await S().invokeMethodAsync("RemoveRootComponent",this._componentId),this._componentId=null;for(const e of this._jsEventCallbackWrappers.values())e.dispose()}}}function S(){if(!g)throw new Error("Dynamic root components have not been enabled in this application.");return g}const C=new Map,E=[],I=new Map;function k(t,n,o,r){if(C.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);C.set(t,n),o&&r&&Object.keys(o).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])}}(A(t),o,r),I.get(t)?.[0]?.(),function(e){for(const t of E)t(e)}(t)}function T(e){return C.has(e)}function R(e,t,n){return D(e,t.eventHandlerId,(()=>A(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function A(e){const t=C.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let D=(e,t,n)=>n();const x=B(["abort","blur","cancel","canplay","canplaythrough","change","close","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},M=B(["click","dblclick","mousedown","mousemove","mouseup"]);class P{static{this.nextEventDelegatorId=0}constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++P.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new L(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(x,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(M,d)&&h.disabled))){if(!s){const n=c(e);i=n?.createEventArgs?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(N,t.type)&&t.preventDefault(),R(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 U:null}}class L{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 B(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const O=Symbol(),$=Symbol(),F=Symbol();function H(e){const{start:t,end:n}=e,o=t[F];if(o){if(o!==e)throw new Error("The start component comment was already associated with another component descriptor.");return t}const r=t.parentNode;if(!r)throw new Error(`Comment not connected to the DOM ${t.textContent}`);const i=W(r,!0),s=Y(i);t[$]=i,t[F]=e;const a=W(t);if(n){const e=Y(a),o=Array.prototype.indexOf.call(s,a)+1;let r=null;for(;r!==n;){const n=s.splice(o,1)[0];if(!n)throw new Error("Could not find the end component comment in the parent logical node list");n[$]=t,e.push(n),r=n}}return a}function W(e,t){if(O in e)return e;const n=[];if(e.childNodes.length>0){if(!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");e.childNodes.forEach((t=>{const o=W(t,!0);o[$]=e,n.push(o)}))}return e[O]=n,e}function j(e){const t=Y(e);for(;t.length;)J(e,0)}function z(e,t){const n=document.createComment("!");return q(n,e,t),n}function q(e,t,n){const o=e;let r=e;if(e instanceof Comment){const t=Y(o);if(t?.length>0){const t=oe(o),n=new Range;n.setStartBefore(e),n.setEndAfter(t),r=n.extractContents()}}const i=V(o);if(i){const e=Y(i),t=Array.prototype.indexOf.call(e,o);e.splice(t,1),delete o[$]}const s=Y(t);if(n0;)J(n,0)}const o=n;o.parentNode.removeChild(o)}function V(e){return e[$]||null}function K(e,t){return Y(e)[t]}function X(e){return e[F]||null}function G(e){const t=te(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function Y(e){return e[O]}function Q(e){const t=Y(V(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function Z(e){return O in e}function ee(e,t){const n=Y(e);t.forEach((e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=oe(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):ne(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 te(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 ne(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=Q(t);n?n.parentNode.insertBefore(e,n):ne(e,V(t))}}}function oe(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=Q(e);if(t)return t.previousSibling;{const t=V(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:oe(t)}}function re(e){return`_bl_${e}`}const ie="__internalId";e.attachReviver(((e,t)=>t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,ie)&&"string"==typeof t[ie]?function(e){const t=`[${re(e)}]`;return document.querySelector(t)}(t[ie]):t));const se="_blazorDeferredValue";function ae(e){e instanceof HTMLOptionElement?de(e):se in e&&he(e,e[se])}function ce(e){return"select-multiple"===e.type}function le(e,t){e.value=t||""}function he(e,t){e instanceof HTMLSelectElement?ce(e)?function(e,t){t||=[];for(let n=0;n{He()&&Ne(e,(e=>{Ye(e,!0,!1)}))}))}getRootComponentCount(){return this.rootComponentIds.size}attachRootComponentToLogicalElement(e,t,n){if(we(t))throw new Error(`Root component '${e}' could not be attached because its target element is already associated with a root component`);n&&(t=z(t,Y(t).length)),ve(t,!0),this.attachComponentToElement(e,t),this.rootComponentIds.add(e),fe.add(t)}updateComponent(e,t,n,o){const r=this.childComponentLocations[t];if(!r)throw new Error(`No element is currently associated with component ${t}`);fe.delete(r)&&(j(r),r instanceof Comment&&(r.textContent="!"));const i=te(r)?.getRootNode(),s=i&&i.activeElement;this.applyEdits(e,t,r,0,n,o),s instanceof HTMLElement&&i&&i.activeElement!==s&&s.focus()}disposeComponent(e){if(this.rootComponentIds.delete(e)){const t=this.childComponentLocations[e];ve(t,!1),!0===t[me]?fe.add(t):j(t)}delete this.childComponentLocations[e]}disposeEventHandler(e){this.eventDelegator.removeListener(e)}attachComponentToElement(e,t){this.childComponentLocations[e]=t}applyEdits(e,t,o,r,i,s){let a,c=0,l=r;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;i{const t=document.createElement("script");t.textContent=e.textContent,e.getAttributeNames().forEach((n=>{t.setAttribute(n,e.getAttribute(n))})),e.parentNode.replaceChild(t,e)})),ue.content));var s;let a=0;for(;i.firstChild;)q(i.firstChild,r,a++)}applyAttribute(e,t,n,o){const r=e.frameReader,i=r.attributeName(o),s=r.attributeEventHandlerId(o);if(s){const e=Se(i);return void this.eventDelegator.setListener(n,e,s,t)}const a=r.attributeValue(o);this.setOrRemoveAttributeOrProperty(n,i,a)}insertFrameRange(e,t,n,o,r,i,s){const a=o;for(let a=i;a{nt(t,e)})},enableNavigationInterception:function(e){if(void 0!==Ee&&Ee!==e)throw new Error("Only one interactive runtime may enable navigation interception at a time.");Ee=e},setHasLocationChangingListeners:function(e,t){const n=Je.get(e);if(!n)throw new Error(`Renderer with ID '${e}' is not listening for navigation events`);n.hasLocationChangingEventListeners=t},endLocationChanging:function(e,t){Ke&&e===qe&&(Ke(t),Ke=null)},navigateTo:function(e,t){Ge(e,t,!0)},refresh:function(e){!e&&Oe()?$e(location.href,!0):location.reload()},getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href,scrollToElement:Be};function Ge(e,t,n=!1){const o=Fe(e);!t.forceLoad&&Me(o)?it()?Ye(o,!1,t.replaceHistoryEntry,t.historyEntryState,n):$e(o,t.replaceHistoryEntry):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function Ye(e,t,n,o=void 0,r=!1){if(et(),Pe(e))return Qe(e,n,o),void Ue(e);const i=rt();(r||!i?.hasLocationChangingEventListeners||await tt(e,o,t,i))&&(Re=!0,Qe(e,n,o),await nt(t))}function Qe(e,t,n=void 0){t?history.replaceState({userState:n,_index:ze},"",e):(ze++,history.pushState({userState:n,_index:ze},"",e))}function Ze(e){return new Promise((t=>{const n=Ve;Ve=()=>{Ve=n,t()},history.go(e)}))}function et(){Ke&&(Ke(!1),Ke=null)}function tt(e,t,n,o){return new Promise((r=>{et(),qe++,Ke=r,o.locationChanging(qe,e,t,n)}))}async function nt(e,t){const n=t??location.href;await Promise.all(Array.from(Je,(async([t,o])=>{T(t)&&await o.locationChanged(n,history.state?.userState,e)})))}async function ot(e){Ve&&it()&&await Ve(e),ze=history.state?._index??0}function rt(){const e=We();if(void 0!==e)return Je.get(e)}function it(){return He()||!Oe()}const st={focus:function(e,t){if(e instanceof HTMLElement)e.focus({preventScroll:t});else{if(!(e instanceof SVGElement))throw new Error("Unable to focus an invalid element.");if(!e.hasAttribute("tabindex"))throw new Error("Unable to focus an SVG element that does not have a tabindex.");e.focus({preventScroll:t})}},focusBySelector:function(e){const t=document.querySelector(e);t&&(t.hasAttribute("tabindex")||(t.tabIndex=-1),t.focus({preventScroll:!0}))}},at={init:function(e,t,n,o=50){const r=lt(t);(r||document.documentElement).style.overflowAnchor="none";const i=document.createRange();u(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(o){o.forEach((o=>{if(!o.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const r=i.getBoundingClientRect().height,s=o.rootBounds?.height;o.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",o.intersectionRect.top-o.boundingClientRect.top,r,s):o.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",o.boundingClientRect.bottom-o.intersectionRect.bottom,r,s)}))}),{root:r,rootMargin:`${o}px`});s.observe(t),s.observe(n);const a=d(t),c=d(n),{observersByDotNetObjectId:l,id:h}=ht(e);function d(e){const t={attributes:!0},n=new MutationObserver(((n,o)=>{u(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 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)}l[h]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const{observersByDotNetObjectId:t,id:n}=ht(e),o=t[n];o&&(o.intersectionObserver.disconnect(),o.mutationObserverBefore.disconnect(),o.mutationObserverAfter.disconnect(),e.dispose(),delete t[n])}},ct=Symbol();function lt(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:lt(e.parentElement):null}function ht(e){const t=e._callDispatcher,n=e._id;return t[ct]??={},{observersByDotNetObjectId:t[ct],id:n}}const dt={getAndRemoveExistingTitle:function(){const e=document.head?document.head.getElementsByTagName("title"):[];if(0===e.length)return null;let t=null;for(let n=e.length-1;n>=0;n--){const o=e[n],r=o.previousSibling;r instanceof Comment&&null!==V(r)||(null===t&&(t=o.textContent),o.parentNode?.removeChild(o))}return t}},ut={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=pt(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){const t=Math.min(1,o/s.width),i=Math.min(1,r/s.height),a=Math.min(t,i),c=document.createElement("canvas");c.width=Math.round(s.width*a),c.height=Math.round(s.height*a),c.getContext("2d")?.drawImage(s,0,0,c.width,c.height),c.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:a?.size||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return pt(e,t).blob}};function pt(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 ft=new Set,gt={enableNavigationPrompt:function(e){0===ft.size&&window.addEventListener("beforeunload",mt),ft.add(e)},disableNavigationPrompt:function(e){ft.delete(e),0===ft.size&&window.removeEventListener("beforeunload",mt)}};function mt(e){e.preventDefault(),e.returnValue=!0}async function yt(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)}const vt=new Map,wt={navigateTo:function(e,t,n=!1){Ge(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,runtime:{},_internal:{navigationManager:Xe,domWrapper:st,Virtualize:at,PageTitle:dt,InputFile:ut,NavigationLock:gt,getJSDataStreamChunk:yt,attachWebRendererInterop:k}};var bt;window.Blazor=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"}(bt||(bt={})),class e{static{this.instance=new e}log(e,t){}};let _t=class{constructor(e){this.minLevel=e}log(e,t){if(e>=this.minLevel){const n=`[${(new Date).toISOString()}] ${bt[e]}: ${t}`;switch(e){case bt.Critical:case bt.Error:console.error(n);break;case bt.Warning:console.warn(n);break;case bt.Information:console.info(n);break;default:console.log(n)}}}};function St(e,t){switch(t){case"webassembly":return Rt(e,"webassembly");case"server":return function(e){return Rt(e,"server").sort(((e,t)=>e.sequence-t.sequence))}(e);case"auto":return Rt(e,"auto")}}const Ct=/^\s*Blazor-Server-Component-State:(?[a-zA-Z0-9+/=]+)$/,Et=/^\s*Blazor-WebAssembly-Component-State:(?[a-zA-Z0-9+/=]+)$/,It=/^\s*Blazor-Web-Initializers:(?[a-zA-Z0-9+/=]+)$/;function kt(e){return Tt(e,Ct)}function Tt(e,t,n="state"){if(e.nodeType===Node.COMMENT_NODE){const o=e.textContent||"",r=t.exec(o),i=r&&r.groups&&r.groups[n];return i&&e.parentNode?.removeChild(e),i}if(!e.hasChildNodes())return;const o=e.childNodes;for(let e=0;e.*)$/);function Dt(e,t){const n=e.currentElement;var o,r,i;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const s=At.exec(n.textContent),a=s&&s.groups&&s.groups.descriptor;if(!a)return;!function(e){if(e.parentNode instanceof Document)throw new Error("Root components cannot be marked as interactive. The element must be rendered statically so that scripts are not evaluated multiple times.")}(n);try{const s=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n&&"auto"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(a),c=function(e,t,n){const{prerenderId:o}=e;if(o){for(;n.next()&&n.currentElement;){const e=n.currentElement;if(e.nodeType!==Node.COMMENT_NODE)continue;if(!e.textContent)continue;const t=At.exec(e.textContent),r=t&&t[1];if(r)return Pt(r,o),e}throw new Error(`Could not find an end component comment for '${t}'.`)}}(s,n,e);if(t!==s.type)return;switch(s.type){case"webassembly":return r=n,i=c,Mt(o=s),{...o,uniqueId:xt++,start:r,end:i};case"server":return function(e,t,n){return Nt(e),{...e,uniqueId:xt++,start:t,end:n}}(s,n,c);case"auto":return function(e,t,n){return Nt(e),Mt(e),{...e,uniqueId:xt++,start:t,end:n}}(s,n,c)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}let xt=0;function Nt(e){const{descriptor:t,sequence:n}=e;if(!t)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===n)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(n))throw new Error(`Error parsing the sequence '${n}' for component '${JSON.stringify(e)}'`)}function Mt(e){const{assembly:t,typeName:n}=e;if(!t)throw new Error("assembly must be defined when using a descriptor.");if(!n)throw new Error("typeName must be defined when using a descriptor.");e.parameterDefinitions=e.parameterDefinitions&&atob(e.parameterDefinitions),e.parameterValues=e.parameterValues&&atob(e.parameterValues)}function Pt(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 Lt{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndex{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 en(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}async function tn(e,t,n,o,r,i){const s={},[a,c]=rn();s[a]=c,e.log(Kt.Trace,`(${t} transport) sending data. ${Zt(r,i.logMessageContent)}.`);const l=en(r)?"arraybuffer":"text",h=await n.post(o,{content:r,headers:{...s,...i.headers},responseType:l,timeout:i.timeout,withCredentials:i.withCredentials});e.log(Kt.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}class nn{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 on{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${(new Date).toISOString()}] ${Kt[e]}: ${t}`;switch(e){case Kt.Critical:case Kt.Error:this.out.error(n);break;case Kt.Warning:this.out.warn(n);break;case Kt.Information:this.out.info(n);break;default:this.out.log(n)}}}}function rn(){return["X-SignalR-User-Agent",sn(Gt,"","Browser",void 0)]}function sn(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 an(e){return e.stack?e.stack:e.message?e.message:`${e}`}class cn extends Vt{constructor(e){if(super(),this._logger=e,"undefined"==typeof fetch){const e="function"==typeof __webpack_require__?__non_webpack_require__: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("undefined"!=typeof global)return global;throw new Error("could not find global")}());if("undefined"==typeof AbortController){const e="function"==typeof __webpack_require__?__non_webpack_require__:require;this._abortControllerType=e("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new Ft;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 Ft});let o,r=null;if(e.timeout){const o=e.timeout;r=setTimeout((()=>{t.abort(),this._logger.log(Kt.Warning,"Timeout from HTTP request."),n=new $t}),o)}""===e.content&&(e.content=void 0),e.content&&(e.headers=e.headers||{},en(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(Kt.Warning,`Error from HTTP request. ${e}.`),e}finally{r&&clearTimeout(r),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const e=await ln(o,"text");throw new Ot(e||o.statusText,o.status)}const i=ln(o,e.responseType),s=await i;return new Jt(o.status,o.statusText,s)}getCookieString(e){return""}}function ln(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 hn extends Vt{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Ft):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&&(en(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 Ft)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new Jt(o.status,o.statusText,o.response||o.responseText)):n(new Ot(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(Kt.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new Ot(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(Kt.Warning,"Timeout from HTTP request."),n(new $t)},o.send(e.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class dn extends Vt{constructor(e){if(super(),"undefined"!=typeof fetch)this._httpClient=new cn(e);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this._httpClient=new hn(e)}}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Ft):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class un{static write(e){return`${e}${un.RecordSeparator}`}static parse(e){if(e[e.length-1]!==un.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(un.RecordSeparator);return t.pop(),t}}un.RecordSeparatorCode=30,un.RecordSeparator=String.fromCharCode(un.RecordSeparatorCode);class pn{writeHandshakeRequest(e){return un.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(en(e)){const o=new Uint8Array(e),r=o.indexOf(un.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(un.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=un.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}}var fn,gn;!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",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"}(fn||(fn={}));class mn{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 nn(this,e)}}class yn{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}async _send(e){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let e=()=>{},o=()=>{};en(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise(((t,n)=>{e=t,o=n}))),this._messages.push(new vn(t,this._totalMessageCount,e,o))}try{this._reconnectInProgress||await this._connection.send(t)}catch{this._disconnected()}await n}_ack(e){let t=-1;for(let n=0;nthis._nextReceivingSequenceId?this._connection.stop(new Error("Sequence ID greater than amount of messages we've received.")):this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=0!==this._messages.length?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:fn.Sequence,sequenceId:e}));const t=this._messages;for(const e of t)await this._connection.send(e._message);this._reconnectInProgress=!1}_dispose(e){null!=e||(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case fn.Invocation:case fn.StreamItem:case fn.Completion:case fn.StreamInvocation:case fn.CancelInvocation:return!0;case fn.Close:case fn.Sequence:case fn.Ping:case fn.Ack:return!1}}_ackTimer(){void 0===this._ackTimerHandle&&(this._ackTimerHandle=setTimeout((async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:fn.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}}class vn{constructor(e,t,n,o){this._message=e,this._id=t,this._resolver=n,this._rejector=o}}!function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"}(gn||(gn={}));class wn{static create(e,t,n,o,r,i,s){return new wn(e,t,n,o,r,i,s)}constructor(e,t,n,o,r,i,s){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(Kt.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")},Yt.isRequired(e,"connection"),Yt.isRequired(t,"logger"),Yt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=null!=r?r:3e4,this.keepAliveIntervalInMilliseconds=null!=i?i:15e3,this._statefulReconnectBufferSize=null!=s?s:1e5,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new pn,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=gn.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:fn.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!==gn.Disconnected&&this._connectionState!==gn.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!==gn.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=gn.Connecting,this._logger.log(Kt.Debug,"Starting HubConnection.");try{await this._startInternal(),Qt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=gn.Connected,this._connectionStarted=!0,this._logger.log(Kt.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=gn.Disconnected,this._logger.log(Kt.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{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(Kt.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(Kt.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;!!this.connection.features.reconnect&&(this._messageBuffer=new yn(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(e){throw this._logger.log(Kt.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.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch(e){}}_stopInternal(e){if(this._connectionState===gn.Disconnected)return this._logger.log(Kt.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===gn.Disconnecting)return this._logger.log(Kt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const t=this._connectionState;return this._connectionState=gn.Disconnecting,this._logger.log(Kt.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(Kt.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===gn.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new Ft("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._createStreamInvocation(e,t,o);let i;const s=new mn;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===fn.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._messageBuffer?this._messageBuffer._send(e):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===fn.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)if(!this._messageBuffer||this._messageBuffer._shouldProcessMessage(e))switch(e.type){case fn.Invocation:this._invokeClientMethod(e).catch((e=>{this._logger.log(Kt.Error,`Invoke client method threw error: ${an(e)}`)}));break;case fn.StreamItem:case fn.Completion:{const t=this._callbacks[e.invocationId];if(t){e.type===fn.Completion&&delete this._callbacks[e.invocationId];try{t(e)}catch(e){this._logger.log(Kt.Error,`Stream callback threw error: ${an(e)}`)}}break}case fn.Ping:break;case fn.Close:{this._logger.log(Kt.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}case fn.Ack:this._messageBuffer&&this._messageBuffer._ack(e);break;case fn.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(e);break;default:this._logger.log(Kt.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(Kt.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(Kt.Error,e);const n=new Error(e);throw this._handshakeRejecter(n),n}return this._logger.log(Kt.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===gn.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(Kt.Warning,`No client method with the name '${t}' found.`),void(e.invocationId&&(this._logger.log(Kt.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(Kt.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(Kt.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(Kt.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(Kt.Error,`Result given for '${t}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(Kt.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new Ft("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===gn.Disconnecting?this._completeClose(e):this._connectionState===gn.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===gn.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=gn.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(null!=e?e:new Error("Connection closed.")),this._messageBuffer=void 0),Qt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Kt.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(Kt.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this._completeClose(e);if(this._connectionState=gn.Reconnecting,e?this._logger.log(Kt.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(Kt.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach((t=>t.apply(this,[e])))}catch(t){this._logger.log(Kt.Error,`An onreconnecting callback called with error '${e}' threw error '${t}'.`)}if(this._connectionState!==gn.Reconnecting)return void this._logger.log(Kt.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this._logger.log(Kt.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!==gn.Reconnecting)return void this._logger.log(Kt.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this._startInternal(),this._connectionState=gn.Connected,this._logger.log(Kt.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach((e=>e.apply(this,[this.connection.connectionId])))}catch(e){this._logger.log(Kt.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`)}return}catch(e){if(this._logger.log(Kt.Information,`Reconnect attempt failed because of error '${e}'.`),this._connectionState!==gn.Reconnecting)return this._logger.log(Kt.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this._connectionState===gn.Disconnecting&&this._completeClose());o=e instanceof Error?e:new Error(e.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(Kt.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(Kt.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(Kt.Error,`Stream 'error' callback called with '${e}' threw error: ${an(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?{target:e,arguments:t,streamIds:o,type:fn.Invocation}:{target:e,arguments:t,type:fn.Invocation};{const n=this._invocationId;return this._invocationId++,0!==o.length?{target:e,arguments:t,invocationId:n.toString(),streamIds:o,type:fn.Invocation}:{target:e,arguments:t,invocationId:n.toString(),type:fn.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;o0)&&(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[Sn.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[Sn.Authorization]&&delete e.headers[Sn.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var En,In;!function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"}(En||(En={})),function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"}(In||(In={}));let kn=class{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 Tn{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new kn,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,t){if(Yt.isRequired(e,"url"),Yt.isRequired(t,"transferFormat"),Yt.isIn(t,In,"transferFormat"),this._url=e,this._logger.log(Kt.Trace,"(LongPolling transport) Connecting."),t===In.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]=rn(),r={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===In.Binary&&(i.responseType="arraybuffer");const s=`${e}&_=${Date.now()}`;this._logger.log(Kt.Trace,`(LongPolling transport) polling: ${s}.`);const a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(Kt.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new Ot(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(Kt.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,t);204===o.statusCode?(this._logger.log(Kt.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==o.statusCode?(this._logger.log(Kt.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new Ot(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(Kt.Trace,`(LongPolling transport) data received. ${Zt(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(Kt.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(e){this._running?e instanceof $t?this._logger.log(Kt.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=e,this._running=!1):this._logger.log(Kt.Trace,`(LongPolling transport) Poll errored after shutdown: ${e.message}`)}}finally{this._logger.log(Kt.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?tn(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(Kt.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(Kt.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=rn();e[t]=n;const o={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let r;try{await this._httpClient.delete(this._url,o)}catch(e){r=e}r?r instanceof Ot&&(404===r.statusCode?this._logger.log(Kt.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(Kt.Trace,`(LongPolling transport) Error sending a DELETE request: ${r}`)):this._logger.log(Kt.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(Kt.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(Kt.Trace,e),this.onclose(this._closeError)}}}class Rn{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 Yt.isRequired(e,"url"),Yt.isRequired(t,"transferFormat"),Yt.isIn(t,In,"transferFormat"),this._logger.log(Kt.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===In.Text){if(Qt.isBrowser||Qt.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]=rn();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(Kt.Trace,`(SSE transport) data received. ${Zt(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(Kt.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?tn(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 An{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 Yt.isRequired(e,"url"),Yt.isRequired(t,"transferFormat"),Yt.isIn(t,In,"transferFormat"),this._logger.log(Kt.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(Qt.isReactNative){const t={},[o,r]=rn();t[o]=r,n&&(t[Sn.Authorization]=`Bearer ${n}`),s&&(t[Sn.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===In.Binary&&(i.binaryType="arraybuffer"),i.onopen=t=>{this._logger.log(Kt.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(Kt.Information,`(WebSockets transport) ${t}.`)},i.onmessage=e=>{if(this._logger.log(Kt.Trace,`(WebSockets transport) data received. ${Zt(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(Kt.Trace,`(WebSockets transport) sending data. ${Zt(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(Kt.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 Dn{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Yt.isRequired(e,"url"),this._logger=function(e){return void 0===e?new on(Kt.Information):null===e?Xt.instance:void 0!==e.log?e:new on(e)}(t.logger),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 Cn(t.httpClient||new dn(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||In.Binary,Yt.isIn(e,In,"transferFormat"),this._logger.log(Kt.Debug,`Starting connection with transfer format '${In[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(Kt.Error,e),await this._stopPromise,Promise.reject(new Ft(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(Kt.Error,e),Promise.reject(new Ft(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 xn(this.transport)),this._sendQueue.send(e))}async stop(e){return"Disconnected"===this._connectionState?(this._logger.log(Kt.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(Kt.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(Kt.Error,`HttpConnection.transport.stop() threw error '${e}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(Kt.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!==En.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this._constructTransport(En.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 Ft("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 Tn&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(Kt.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(e){return this._logger.log(Kt.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]=rn();t[n]=o;const r=this._resolveNegotiateUrl(e);this._logger.log(Kt.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.useStatefulReconnect&&!0!==this._options._useStatefulReconnect?Promise.reject(new zt("Client didn't negotiate Stateful Reconnect but the server did.")):n}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof Ot&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(Kt.Error,t),Promise.reject(new zt(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(Kt.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,!0===(null==a?void 0:a.useStatefulReconnect));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(Kt.Error,`Failed to start the transport '${n.transport}': ${e}`),a=void 0,i.push(new jt(`${n.transport} failed: ${e}`,En[n.transport])),"Connecting"!==this._connectionState){const e="Failed to select transport before stop() was called.";return this._logger.log(Kt.Debug,e),Promise.reject(new Ft(e))}}}}return i.length>0?Promise.reject(new qt(`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 En.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new An(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case En.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Rn(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case En.LongPolling:return new Tn(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let o=!1;if(this.features.reconnect){try{this.features.disconnected(),await this.transport.connect(e,t),await this.features.resend()}catch{o=!0}o&&this._stopConnection(n)}else this._stopConnection(n)}:this.transport.onclose=e=>this._stopConnection(e),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,o){const r=En[e.transport];if(null==r)return this._logger.log(Kt.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||!!(t&e)}(t,r))return this._logger.log(Kt.Debug,`Skipping transport '${En[r]}' because it was disabled by the client.`),new Wt(`'${En[r]}' is disabled by the client.`,r);if(!(e.transferFormats.map((e=>In[e])).indexOf(n)>=0))return this._logger.log(Kt.Debug,`Skipping transport '${En[r]}' because it does not support the requested transfer format '${In[n]}'.`),new Error(`'${En[r]}' does not support ${In[n]}.`);if(r===En.WebSockets&&!this._options.WebSocket||r===En.ServerSentEvents&&!this._options.EventSource)return this._logger.log(Kt.Debug,`Skipping transport '${En[r]}' because it is not supported in your environment.'`),new Ht(`'${En[r]}' is not supported in your environment.`,r);this._logger.log(Kt.Debug,`Selecting transport '${En[r]}'.`);try{return this.features.reconnect=r===En.WebSockets?o:void 0,this._constructTransport(r)}catch(e){return e}}_isITransport(e){return e&&"object"==typeof e&&"connect"in e}_stopConnection(e){if(this._logger.log(Kt.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(Kt.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(Kt.Error,`Connection disconnected with error '${e}'.`):this._logger.log(Kt.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch((e=>{this._logger.log(Kt.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(Kt.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}else this._logger.log(Kt.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(!Qt.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(Kt.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?"true"===n.get("useStatefulReconnect")&&(this._options._useStatefulReconnect=!0):!0===this._options._useStatefulReconnect&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}}class xn{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new Nn,this._transportResult=new Nn,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new Nn),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 Nn;const e=this._transportResult;this._transportResult=void 0;const t="string"==typeof this._buffer[0]?this._buffer.join(""):xn._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 Nn{constructor(){this.promise=new Promise(((e,t)=>[this._resolver,this._rejecter]=[e,t]))}resolve(){this._resolver()}reject(e){this._rejecter(e)}}class Mn{constructor(){this.name="json",this.version=2,this.transferFormat=In.Text}parseMessages(e,t){if("string"!=typeof e)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];null===t&&(t=Xt.instance);const n=un.parse(e),o=[];for(const e of n){const n=JSON.parse(e);if("number"!=typeof n.type)throw new Error("Invalid payload.");switch(n.type){case fn.Invocation:this._isInvocationMessage(n);break;case fn.StreamItem:this._isStreamItemMessage(n);break;case fn.Completion:this._isCompletionMessage(n);break;case fn.Ping:case fn.Close:break;case fn.Ack:this._isAckMessage(n);break;case fn.Sequence:this._isSequenceMessage(n);break;default:t.log(Kt.Information,"Unknown message type '"+n.type+"' ignored.");continue}o.push(n)}return o}writeMessage(e){return un.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),void 0!==e.invocationId&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),void 0===e.item)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if("number"!=typeof e.sequenceId)throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if("string"!=typeof e||""===e)throw new Error(t)}}const Pn={trace:Kt.Trace,debug:Kt.Debug,info:Kt.Information,information:Kt.Information,warn:Kt.Warning,warning:Kt.Warning,error:Kt.Error,critical:Kt.Critical,none:Kt.None};class Ln{configureLogging(e){if(Yt.isRequired(e,"logging"),function(e){return void 0!==e.log}(e))this.logger=e;else if("string"==typeof e){const t=function(e){const t=Pn[e.toLowerCase()];if(void 0!==t)return t;throw new Error(`Unknown log level: ${e}`)}(e);this.logger=new on(t)}else this.logger=new on(e);return this}withUrl(e,t){return Yt.isRequired(e,"url"),Yt.isNotEmpty(e,"url"),this.url=e,this.httpConnectionOptions="object"==typeof t?{...this.httpConnectionOptions,...t}:{...this.httpConnectionOptions,transport:t},this}withHubProtocol(e){return Yt.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new _n(e):this.reconnectPolicy=e:this.reconnectPolicy=new _n,this}withServerTimeout(e){return Yt.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return Yt.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return void 0===this.httpConnectionOptions&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=null==e?void 0:e.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(void 0===e.logger&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new Dn(this.url,e);return wn.create(t,this.logger||Xt.instance,this.protocol||new Mn,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}var Un;!function(e){e[e.Default=0]="Default",e[e.Server=1]="Server",e[e.WebAssembly=2]="WebAssembly",e[e.WebView=3]="WebView"}(Un||(Un={}));var Bn,On,$n,Fn=4294967295;function Hn(e,t,n){var o=Math.floor(n/4294967296),r=n;e.setUint32(t,o),e.setUint32(t+4,r)}function Wn(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var jn=("undefined"==typeof process||"never"!==(null===(Bn=null===process||void 0===process?void 0:process.env)||void 0===Bn?void 0:Bn.TEXT_ENCODING))&&"undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function zn(e){for(var t=e.length,n=0,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);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 Xn,Gn=jn?new TextDecoder:null,Yn=jn?"undefined"!=typeof process&&"force"!==(null===($n=null===process||void 0===process?void 0:process.env)||void 0===$n?void 0:$n.TEXT_DECODER)?200:0:Fn,Qn=function(e,t){this.type=e,this.data=t},Zn=(Xn=function(e,t){return Xn=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])},Xn(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}Xn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),eo=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 Zn(t,e),t}(Error),to={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),Hn(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:Wn(t,4),nsec:t.getUint32(0)};default:throw new eo("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}},no=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(to)}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>Jn){var t=zn(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),Vn(e,this.bytes,this.pos),this.pos+=t}else t=zn(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,n){for(var o=e.length,r=n,i=0;i=55296&&s<=56319&&i>18&7|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128):(t[r++]=s>>12&15|224,t[r++]=s>>6&63|128)}else t[r++]=s>>6&31|192;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=oo(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=Kn(e,t,n),i=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(i,r),r},e}(),ao=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 ao(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,a=function(){var i,s,a,c,l,h,d,u;return ao(this,(function(p){switch(p.label){case 0:i=!1,p.label=1;case 1:p.trys.push([1,6,7,12]),t=co(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 po))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(io(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 ao(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=co(e),d.label=2;case 2:return[4,lo(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,lo(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 po))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,lo(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 lo?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 eo("Unrecognized type byte: ".concat(io(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 eo("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new eo("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 eo("Unrecognized array type byte: ".concat(io(e)))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new eo("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 eo("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 eo("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLengthYn?function(e,t,n){var o=e.subarray(t,t+n);return Gn.decode(o)}(this.bytes,r,e):Kn(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 eo("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw fo;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 eo("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=Wn(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}();class yo{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 vo=new Uint8Array([145,fn.Ping]);class wo{constructor(e){this.name="messagepack",this.version=2,this.transferFormat=In.Binary,this._errorResult=1,this._voidResult=2,this._nonVoidResult=3,e=e||{},this._encoder=new ro(e.extensionCodec,e.context,e.maxDepth,e.initialBufferSize,e.sortKeys,e.forceFloat32,e.ignoreUndefined,e.forceIntegerToFloat),this._decoder=new mo(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=Xt.instance);const o=yo.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 fn.Invocation:return this._writeInvocation(e);case fn.StreamInvocation:return this._writeStreamInvocation(e);case fn.StreamItem:return this._writeStreamItem(e);case fn.Completion:return this._writeCompletion(e);case fn.Ping:return yo.write(vo);case fn.CancelInvocation:return this._writeCancelInvocation(e);case fn.Close:return this._writeClose();case fn.Ack:return this._writeAck(e);case fn.Sequence:return this._writeSequence(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 fn.Invocation:return this._createInvocationMessage(this._readHeaders(n),n);case fn.StreamItem:return this._createStreamItemMessage(this._readHeaders(n),n);case fn.Completion:return this._createCompletionMessage(this._readHeaders(n),n);case fn.Ping:return this._createPingMessage(n);case fn.Close:return this._createCloseMessage(n);case fn.Ack:return this._createAckMessage(n);case fn.Sequence:return this._createSequenceMessage(n);default:return t.log(Kt.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:fn.Close}}_createPingMessage(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:fn.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:fn.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:fn.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:fn.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:fn.Completion}}_createAckMessage(e){if(e.length<1)throw new Error("Invalid payload for Ack message.");return{sequenceId:e[1],type:fn.Ack}}_createSequenceMessage(e){if(e.length<1)throw new Error("Invalid payload for Sequence message.");return{sequenceId:e[1],type:fn.Sequence}}_writeInvocation(e){let t;return t=e.streamIds?this._encoder.encode([fn.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):this._encoder.encode([fn.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),yo.write(t.slice())}_writeStreamInvocation(e){let t;return t=e.streamIds?this._encoder.encode([fn.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):this._encoder.encode([fn.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),yo.write(t.slice())}_writeStreamItem(e){const t=this._encoder.encode([fn.StreamItem,e.headers||{},e.invocationId,e.item]);return yo.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([fn.Completion,e.headers||{},e.invocationId,t,e.error]);break;case this._voidResult:n=this._encoder.encode([fn.Completion,e.headers||{},e.invocationId,t]);break;case this._nonVoidResult:n=this._encoder.encode([fn.Completion,e.headers||{},e.invocationId,t,e.result])}return yo.write(n.slice())}_writeCancelInvocation(e){const t=this._encoder.encode([fn.CancelInvocation,e.headers||{},e.invocationId]);return yo.write(t.slice())}_writeClose(){const e=this._encoder.encode([fn.Close,null]);return yo.write(e.slice())}_writeAck(e){const t=this._encoder.encode([fn.Ack,e.sequenceId]);return yo.write(t.slice())}_writeSequence(e){const t=this._encoder.encode([fn.Sequence,e.sequenceId]);return yo.write(t.slice())}_readHeaders(e){const t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t}}const bo="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,_o=bo?bo.decode.bind(bo):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)}}else o.push(n);o.length>1024&&(r.push(String.fromCharCode.apply(null,o)),o.length=0)}return r.push(String.fromCharCode.apply(null,o)),r.join("")},So=Math.pow(2,32),Co=Math.pow(2,21)-1;function Eo(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Io(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function ko(e,t){const n=Io(e,t+4);if(n>Co)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*So+Io(e,t)}class To{constructor(e){this.batchData=e;const t=new xo(e);this.arrayRangeReader=new No(e),this.arrayBuilderSegmentReader=new Mo(e),this.diffReader=new Ro(e),this.editReader=new Ao(e,t),this.frameReader=new Do(e,t)}updatedComponents(){return Eo(this.batchData,this.batchData.length-20)}referenceFrames(){return Eo(this.batchData,this.batchData.length-16)}disposedComponentIds(){return Eo(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return Eo(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return Eo(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return Eo(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return ko(this.batchData,n)}}class Ro{constructor(e){this.batchDataUint8=e}componentId(e){return Eo(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class Ao{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return Eo(this.batchDataUint8,e)}siblingIndex(e){return Eo(this.batchDataUint8,e+4)}newTreeIndex(e){return Eo(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return Eo(this.batchDataUint8,e+8)}removedAttributeName(e){const t=Eo(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class Do{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return Eo(this.batchDataUint8,e)}subtreeLength(e){return Eo(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=Eo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return Eo(this.batchDataUint8,e+8)}elementName(e){const t=Eo(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=Eo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=Eo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=Eo(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=Eo(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return ko(this.batchDataUint8,e+12)}}class xo{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=Eo(e,e.length-4)}readString(e){if(-1===e)return null;{const n=Eo(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(bt.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(bt.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(bt.Debug,`Applying batch ${e}.`),xe(Un.Server,new To(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(bt.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(bt.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}let Lo=!1;function Uo(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),Lo||(Lo=!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()}})))}class Bo{constructor(t,n,o,r){this._firstUpdate=!0,this._renderingFailed=!1,this._disposed=!1,this._circuitId=void 0,this._applicationState=n,this._componentManager=t,this._options=o,this._logger=r,this._renderQueue=new Po(this._logger),this._dispatcher=e.attachDispatcher(this)}start(){if(this.isDisposedOrDisposing())throw new Error("Cannot start a disposed circuit.");return this._startPromise||(this._startPromise=this.startCore()),this._startPromise}updateRootComponents(e){return this._firstUpdate?(this._firstUpdate=!1,this._connection?.send("UpdateRootComponents",e,this._applicationState)):this._connection?.send("UpdateRootComponents",e,"")}async startCore(){if(this._connection=await this.startConnection(),this._connection.state!==gn.Connected)return!1;const e=JSON.stringify(this._componentManager.initialComponents.map((e=>Ut(e))));if(this._circuitId=await this._connection.invoke("StartCircuit",Xe.getBaseURI(),Xe.getLocationHref(),e,this._applicationState||""),!this._circuitId)return!1;for(const e of this._options.circuitHandlers)e.onCircuitOpened&&e.onCircuitOpened();return!0}async startConnection(){const e=new wo;e.name="blazorpack";const t=(new Ln).withUrl("_blazor").withHubProtocol(e);this._options.configureSignalR(t);const n=t.build();n.on("JS.AttachComponent",((e,t)=>Ae(Un.Server,this.resolveElement(t),e,!1))),n.on("JS.BeginInvokeJS",this._dispatcher.beginInvokeJSFromDotNet.bind(this._dispatcher)),n.on("JS.EndInvokeDotNet",this._dispatcher.endInvokeDotNetFromJS.bind(this._dispatcher)),n.on("JS.ReceiveByteArray",this._dispatcher.receiveByteArray.bind(this._dispatcher)),n.on("JS.BeginTransmitStream",(e=>{const t=new ReadableStream({start:t=>{n.stream("SendDotNetStreamToJS",e).subscribe({next:e=>t.enqueue(e),complete:()=>t.close(),error:e=>t.error(e)})}});this._dispatcher.supplyDotNetStream(e,t)})),n.on("JS.RenderBatch",(async(e,t)=>{this._logger.log(Kt.Debug,`Received render batch with id ${e} and ${t.byteLength} bytes.`),await this._renderQueue.processBatch(e,t,this._connection),this._componentManager.onAfterRenderBatch?.(Un.Server)})),n.on("JS.EndUpdateRootComponents",(e=>{this._componentManager.onAfterUpdateRootComponents?.(e)})),n.on("JS.EndLocationChanging",wt._internal.navigationManager.endLocationChanging),n.onclose((e=>{this._interopMethodsForReconnection=function(e){const t=C.get(e);if(!t)throw new Error(`Interop methods are not registered for renderer ${e}`);return C.delete(e),t}(Un.Server),this._disposed||this._renderingFailed||this._options.reconnectionHandler.onConnectionDown(this._options.reconnectionOptions,e)})),n.on("JS.Error",(e=>{this._renderingFailed=!0,this.unhandledError(e),Uo()}));try{await n.start()}catch(e){if(this.unhandledError(e),"FailedToNegotiateWithServerError"===e.errorType)throw e;Uo(),e.innerErrors&&(e.innerErrors.some((e=>"UnsupportedTransportError"===e.errorType&&e.transport===En.WebSockets))?this._logger.log(Kt.Error,"Unable to connect, please ensure you are using an updated browser that supports WebSockets."):e.innerErrors.some((e=>"FailedToStartTransportError"===e.errorType&&e.transport===En.WebSockets))?this._logger.log(Kt.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===En.LongPolling))&&this._logger.log(Kt.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 n.connection?.features?.inherentKeepAlive&&this._logger.log(Kt.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."),n}async disconnect(){await(this._connection?.stop())}async reconnect(){if(!this._circuitId)throw new Error("Circuit host not initialized.");return this._connection.state===gn.Connected||(this._connection=await this.startConnection(),this._interopMethodsForReconnection&&(k(Un.Server,this._interopMethodsForReconnection),this._interopMethodsForReconnection=void 0),!!await this._connection.invoke("ConnectCircuit",this._circuitId)&&(this._options.reconnectionHandler.onConnectionUp(),!0))}beginInvokeDotNetFromJS(e,t,n,o,r){this.throwIfDispatchingWhenDisposed(),this._connection.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,o||0,r)}endInvokeJSFromDotNet(e,t,n){this.throwIfDispatchingWhenDisposed(),this._connection.send("EndInvokeJSFromDotNet",e,t,n)}sendByteArray(e,t){this.throwIfDispatchingWhenDisposed(),this._connection.send("ReceiveByteArray",e,t)}throwIfDispatchingWhenDisposed(){if(this._disposed)throw new Error("The circuit associated with this dispatcher is no longer available.")}sendLocationChanged(e,t,n){return this._connection.send("OnLocationChanged",e,t,n)}sendLocationChanging(e,t,n,o){return this._connection.send("OnLocationChanging",e,t,n,o)}sendJsDataStream(e,t,n){return 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)}(this._connection,e,t,n)}resolveElement(e){const t=w(e);if(t)return W(t,!0);const n=Number.parseInt(e);if(!Number.isNaN(n))return H(this._componentManager.resolveRootComponent(n));throw new Error(`Invalid sequence number or identifier '${e}'.`)}getRootComponentManager(){return this._componentManager}unhandledError(e){this._logger.log(Kt.Error,e),this.disconnect()}getDisconnectFormData(){const e=new FormData,t=this._circuitId;return e.append("circuitId",t),e}didRenderingFail(){return this._renderingFailed}isDisposedOrDisposing(){return void 0!==this._disposePromise}sendDisconnectBeacon(){if(this._disposed)return;const e=this.getDisconnectFormData();this._disposed=navigator.sendBeacon("_blazor/disconnect",e)}dispose(){return this._disposePromise||(this._disposePromise=this.disposeCore()),this._disposePromise}async disposeCore(){if(!this._startPromise)return void(this._disposed=!0);await this._startPromise,this._disposed=!0,this._connection?.stop();const e=this.getDisconnectFormData();fetch("_blazor/disconnect",{method:"POST",body:e});for(const e of this._options.circuitHandlers)e.onCircuitClosed&&e.onCircuitClosed()}}function Oo(e){const t={...$o,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...$o.reconnectionOptions,...e.reconnectionOptions}),t}const $o={configureSignalR:e=>{},logLevel:bt.Warning,initializers:void 0,circuitHandlers:[],reconnectionOptions:{maxRetries:30,retryIntervalMilliseconds:function(e,t){return t&&e>=t?null:e<10?0:e<20?5e3:3e4},dialogId:"components-reconnect-modal"}};class Fo{static{this.ReconnectOverlayClassName="components-reconnect-overlay"}static{this.ReconnectDialogClassName="components-reconnect-dialog"}static{this.ReconnectVisibleClassName="components-reconnect-visible"}static{this.RejoiningAnimationClassName="components-rejoining-animation"}static{this.AnimationRippleCount=2}constructor(e,t,n){this.document=t,this.logger=n,this.style=this.document.createElement("style"),this.style.innerHTML=Fo.Css,this.overlay=this.document.createElement("div"),this.overlay.className=Fo.ReconnectOverlayClassName,this.host=this.document.createElement("div"),this.host.id=e;const o=this.host.attachShadow({mode:"open"});this.dialog=t.createElement("div"),this.dialog.className=Fo.ReconnectDialogClassName,o.appendChild(this.style),o.appendChild(this.overlay),this.rejoiningAnimation=t.createElement("div"),this.rejoiningAnimation.className=Fo.RejoiningAnimationClassName;for(let e=0;e{"visible"===this.document.visibilityState&&this.retry()}}show(){this.document.contains(this.host)||this.document.body.appendChild(this.host),this.reloadButton.style.display="none",this.rejoiningAnimation.style.display="block",this.status.innerHTML="Rejoining the server...",this.host.style.display="block",this.overlay.classList.add(Fo.ReconnectVisibleClassName)}update(e,t){if(1===e||0===t)this.status.innerHTML="Rejoining the server...";else{const e=1===t?"second":"seconds";this.status.innerHTML=`Rejoin failed... trying again in ${t} ${e}`}}hide(){this.host.style.display="none",this.overlay.classList.remove(Fo.ReconnectVisibleClassName)}failed(){this.reloadButton.style.display="block",this.rejoiningAnimation.style.display="none",this.status.innerHTML="Failed to rejoin.
Please retry or reload the page.",this.document.addEventListener("visibilitychange",this.retryWhenDocumentBecomesVisible)}rejected(){location.reload()}async retry(){this.document.removeEventListener("visibilitychange",this.retryWhenDocumentBecomesVisible),this.show();try{await wt.reconnect()||this.rejected()}catch(e){this.logger.log(bt.Error,e),this.failed()}}static{this.Css=`\n .${this.ReconnectOverlayClassName} {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 10000;\n display: none;\n overflow: hidden;\n animation: components-reconnect-fade-in;\n }\n\n .${this.ReconnectOverlayClassName}.${this.ReconnectVisibleClassName} {\n display: block;\n }\n\n .${this.ReconnectOverlayClassName}::before {\n content: '';\n background-color: rgba(0, 0, 0, 0.4);\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n animation: components-reconnect-fadeInOpacity 0.5s ease-in-out;\n opacity: 1;\n }\n\n .${this.ReconnectOverlayClassName} p {\n margin: 0;\n text-align: center;\n }\n\n .${this.ReconnectOverlayClassName} button {\n border: 0;\n background-color: #6b9ed2;\n color: white;\n padding: 4px 24px;\n border-radius: 4px;\n }\n\n .${this.ReconnectOverlayClassName} button:hover {\n background-color: #3b6ea2;\n }\n\n .${this.ReconnectOverlayClassName} button:active {\n background-color: #6b9ed2;\n }\n\n .${this.ReconnectDialogClassName} {\n position: relative;\n background-color: white;\n width: 20rem;\n margin: 20vh auto;\n padding: 2rem;\n border-radius: 0.5rem;\n box-shadow: 0 3px 6px 2px rgba(0, 0, 0, 0.3);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 1rem;\n opacity: 0;\n animation: components-reconnect-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s, components-reconnect-fadeInOpacity 0.5s ease-out 0.3s;\n animation-fill-mode: forwards;\n z-index: 10001;\n }\n\n .${this.RejoiningAnimationClassName} {\n display: block;\n position: relative;\n width: 80px;\n height: 80px;\n }\n\n .${this.RejoiningAnimationClassName} div {\n position: absolute;\n border: 3px solid #0087ff;\n opacity: 1;\n border-radius: 50%;\n animation: ${this.RejoiningAnimationClassName} 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;\n }\n\n .${this.RejoiningAnimationClassName} div:nth-child(2) {\n animation-delay: -0.5s;\n }\n\n @keyframes ${this.RejoiningAnimationClassName} {\n 0% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 0;\n }\n\n 4.9% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 0;\n }\n\n 5% {\n top: 40px;\n left: 40px;\n width: 0;\n height: 0;\n opacity: 1;\n }\n\n 100% {\n top: 0px;\n left: 0px;\n width: 80px;\n height: 80px;\n opacity: 0;\n }\n }\n\n @keyframes components-reconnect-fadeInOpacity {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n }\n\n @keyframes components-reconnect-slideUp {\n 0% {\n transform: translateY(30px) scale(0.95);\n }\n\n 100% {\n transform: translateY(0);\n }\n }\n `}}class Ho{static{this.ShowClassName="components-reconnect-show"}static{this.HideClassName="components-reconnect-hide"}static{this.FailedClassName="components-reconnect-failed"}static{this.RejectedClassName="components-reconnect-rejected"}static{this.MaxRetriesId="components-reconnect-max-retries"}static{this.CurrentAttemptId="components-reconnect-current-attempt"}static{this.SecondsToNextAttemptId="components-seconds-to-next-attempt"}constructor(e,t,n){if(this.dialog=e,this.document=t,this.document=t,void 0!==n){const e=this.document.getElementById(Ho.MaxRetriesId);e&&(e.innerText=n.toString())}}show(){this.removeClasses(),this.dialog.classList.add(Ho.ShowClassName)}update(e,t){const n=this.document.getElementById(Ho.CurrentAttemptId);n&&(n.innerText=e.toString());const o=this.document.getElementById(Ho.SecondsToNextAttemptId);o&&(o.innerText=t.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Ho.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Ho.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Ho.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Ho.ShowClassName,Ho.HideClassName,Ho.FailedClassName,Ho.RejectedClassName)}}class Wo{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||wt.reconnect}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new Ho(t,document,e.maxRetries):new Fo(e.dialogId,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new jo(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class jo{static{this.MaximumFirstRetryInterval=3e3}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;void 0===e.maxRetries||tjo.MaximumFirstRetryInterval?jo.MaximumFirstRetryInterval:e.retryIntervalMilliseconds;if(await this.runTimer(n,1e3,(e=>{this.reconnectDisplay.update(t+1,Math.round(e/1e3))})),this.isDisposed)break;try{return await this.reconnectCallback()?void 0:void this.reconnectDisplay.rejected()}catch(e){this.logger.log(bt.Error,e)}}this.reconnectDisplay.failed()}async runTimer(e,t,n){if(e<=0)return void n(0);let o,r,i=Date.now();n(e);const s=()=>{if(this.isDisposed)return void r();const a=Date.now(),c=a-i;i=a;const l=Math.max(1,Math.floor(c/t)),h=t*l;if((e-=h){"visible"===document.visibilityState&&(clearTimeout(o),n(0),r())};o=setTimeout(s,t),document.addEventListener("visibilitychange",a),await new Promise((e=>r=e)),document.removeEventListener("visibilitychange",a)}}class zo{constructor(e=!0,t,n,o=0){this.singleRuntime=e,this.logger=t,this.webRendererId=o,this.afterStartedCallbacks=[],n&&this.afterStartedCallbacks.push(...n)}async importInitializersAsync(e,t){await Promise.all(e.map((e=>async 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){if(e.singleRuntime){const{beforeStart:n,afterStarted:o,beforeWebAssemblyStart:s,afterWebAssemblyStarted:a,beforeServerStart:c,afterServerStarted:l}=r;let h=n;e.webRendererId===Un.Server&&c&&(h=c),e.webRendererId===Un.WebAssembly&&s&&(h=s);let d=o;return e.webRendererId===Un.Server&&l&&(d=l),e.webRendererId===Un.WebAssembly&&a&&(d=a),i(e,h,d,t)}return function(e,t,n){const r=n[0],{beforeStart:s,afterStarted:a,beforeWebStart:c,afterWebStarted:l,beforeWebAssemblyStart:h,afterWebAssemblyStarted:d,beforeServerStart:u,afterServerStarted:p}=t,f=!(c||l||h||d||u||p||!s&&!a),g=f&&r.enableClassicInitializers;if(f&&!r.enableClassicInitializers)e.logger?.log(bt.Warning,`Initializer '${o}' will be ignored because multiple runtimes are available. Use 'before(Web|WebAssembly|Server)Start' and 'after(Web|WebAssembly|Server)Started' instead.`);else if(g)return i(e,s,a,n);if(function(e){e.webAssembly?e.webAssembly.initializers||(e.webAssembly.initializers={beforeStart:[],afterStarted:[]}):e.webAssembly={initializers:{beforeStart:[],afterStarted:[]}},e.circuit?e.circuit.initializers||(e.circuit.initializers={beforeStart:[],afterStarted:[]}):e.circuit={initializers:{beforeStart:[],afterStarted:[]}}}(r),h&&r.webAssembly.initializers.beforeStart.push(h),d&&r.webAssembly.initializers.afterStarted.push(d),u&&r.circuit.initializers.beforeStart.push(u),p&&r.circuit.initializers.afterStarted.push(p),l&&e.afterStartedCallbacks.push(l),c)return c(r)}(e,r,t)}function i(e,t,n,o){if(n&&e.afterStartedCallbacks.push(n),t)return t(...o)}}(this,e))))}async invokeAfterStartedCallbacks(e){const t=(n=this.webRendererId,I.get(n)?.[1]);var n;t&&await t,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let qo,Jo,Vo,Ko,Xo,Go,Yo;function Qo(e){if(void 0!==Go)throw new Error("Blazor Server has already started.");return Go=new Promise(Zo.bind(null,e)),Go}async function Zo(e,t,n){await qo;const o=await async function(e){if(e.initializers)return await Promise.all(e.initializers.beforeStart.map((t=>t(e)))),new zo(!1,void 0,e.initializers.afterStarted,Un.Server);const t=await fetch("_blazor/initializers",{method:"GET",credentials:"include",cache:"no-cache"}),n=await t.json(),o=new zo(!0,void 0,void 0,Un.Server);return await o.importInitializersAsync(n,[e]),o}(Ko);if(Jo=kt(document)||"",Xo=new _t(Ko.logLevel),Vo=new Bo(e,Jo,Ko,Xo),Xo.log(bt.Information,"Starting up Blazor server-side application."),wt.reconnect=async()=>!(Vo.didRenderingFail()||!await Vo.reconnect()&&(Xo.log(bt.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)),wt.defaultReconnectionHandler=new Wo(Xo),Ko.reconnectionHandler=Ko.reconnectionHandler||wt.defaultReconnectionHandler,wt._internal.navigationManager.listenForNavigationEvents(Un.Server,((e,t,n)=>Vo.sendLocationChanged(e,t,n)),((e,t,n,o)=>Vo.sendLocationChanging(e,t,n,o))),wt._internal.forceCloseConnection=()=>Vo.disconnect(),wt._internal.sendJSDataStream=(e,t,n)=>Vo.sendJsDataStream(e,t,n),!await Vo.start())return Xo.log(bt.Error,"Failed to start the circuit."),void t();const r=()=>{Vo.sendDisconnectBeacon()};wt.disconnect=r,window.addEventListener("unload",r,{capture:!1,once:!0}),Xo.log(bt.Information,"Blazor server-side application started."),o.invokeAfterStartedCallbacks(wt),t()}async function er(){if(!Go)throw new Error("Cannot start the circuit until Blazor Server has started.");return!(!Vo||Vo.isDisposedOrDisposing())||(Yo?await Yo:(await Go,(!Vo||!Vo.didRenderingFail())&&(Vo&&Vo.isDisposedOrDisposing()&&(Jo=kt(document)||"",Vo=new Bo(Vo.getRootComponentManager(),Jo,Ko,Xo)),Yo=Vo.start(),async function(e){await e,Yo===e&&(Yo=void 0)}(Yo),Yo)))}function tr(e){if(Vo&&!Vo.isDisposedOrDisposing())return Vo.updateRootComponents(e);!async function(e){await Go,await er()&&Vo.updateRootComponents(e)}(e)}const nr=navigator,or=nr.userAgentData&&nr.userAgentData.brands,rr=or&&or.length>0?or.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):window.chrome,ir=nr.userAgentData?.platform??navigator.platform;function sr(e){return 0!==e.debugLevel&&(rr||navigator.userAgent.includes("Firefox"))}let ar,cr,lr,hr,dr=null;const ur={load:function(e,t){return async function(e,t){const{dotnet:n}=await async function(e){if("undefined"==typeof WebAssembly||!WebAssembly.validate)throw new Error("This browser does not support WebAssembly.");let t="_framework/dotnet.js";if(e.loadBootResource){const n="dotnetjs",o=e.loadBootResource(n,"dotnet.js",t,"","js-module-dotnet");if("string"==typeof o)t=o;else if(o)throw new Error(`For a ${n} resource, custom loaders must supply a URI string.`)}const n=new URL(t,document.baseURI).toString();return await import(n)}(e),o=function(e,t){const n={maxParallelDownloads:1e6,enableDownloadRetry:!1,applicationEnvironment:e.environment},o={...window.Module||{},onConfigLoaded:async n=>{n.environmentVariables||(n.environmentVariables={}),"sharded"===n.globalizationMode&&(n.environmentVariables.__BLAZOR_SHARDED_ICU="1"),wt._internal.getApplicationEnvironment=()=>n.applicationEnvironment,t?.(n),hr=await async function(e,t){if(e.initializers)return await Promise.all(e.initializers.beforeStart.map((t=>t(e)))),new zo(!1,void 0,e.initializers.afterStarted,Un.WebAssembly);{const n=[e,t.resources?.extensions??{}],o=new zo(!0,void 0,void 0,Un.WebAssembly),r=Object.keys(t?.resources?.libraryInitializers||{});return await o.importInitializersAsync(r,n),o}}(e,n)},onDownloadResourceProgress:pr,config:n,out:gr,err:mr};return o}(e,t);e.applicationCulture&&n.withApplicationCulture(e.applicationCulture),e.environment&&n.withApplicationEnvironment(e.environment),e.loadBootResource&&n.withResourceLoader(e.loadBootResource),n.withModuleConfig(o),e.configureRuntime&&e.configureRuntime(n),lr=await n.create()}(e,t)},start:function(){return async function(){if(!lr)throw new Error("The runtime must be loaded it gets configured.");const{setModuleImports:t,INTERNAL:n,getConfig:o,invokeLibraryInitializers:r}=lr;cr=n,function(e){const t=ir.match(/^Mac/i)?"Cmd":"Alt";sr(e)&&console.info(`Debugging hotkey: Shift+${t}+D (when application has focus)`),document.addEventListener("keydown",(t=>{t.shiftKey&&(t.metaKey||t.altKey)&&"KeyD"===t.code&&(sr(e)?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())}():rr?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."))}))}(o()),wt.runtime=lr,wt._internal.dotNetCriticalError=mr,t("blazor-internal",{Blazor:{_internal:wt._internal}});const i=await lr.getAssemblyExports("Microsoft.AspNetCore.Components.WebAssembly");return Object.assign(wt._internal,{dotNetExports:{...i.Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime}}),ar=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,o,r)=>{if(yr(),!o&&!t)throw new Error("Either assemblyName or dotNetObjectId must have a non null value.");const i=o?o.toString():t;wt._internal.dotNetExports.BeginInvokeDotNet(e?e.toString():null,i,n,r)},endInvokeJSFromDotNet:(e,t,n)=>{wt._internal.dotNetExports.EndInvokeJS(n)},sendByteArray:(e,t)=>{wt._internal.dotNetExports.ReceiveByteArrayFromJS(e,t)},invokeDotNetFromJS:(e,t,n,o)=>(yr(),wt._internal.dotNetExports.InvokeDotNet(e||null,t,n??0,o))}),{invokeLibraryInitializers:r}}()},callEntryPoint:async function(){try{await lr.runMain(lr.getConfig().mainAssemblyName,[])}catch(e){console.error(e),Uo()}},getArrayEntryPtr:function(e,t,n){const o=function(e){return e+12}(e)+4+t*n;return o},getObjectFieldsBaseAddress:function(e){return e+8},readInt16Field:function(e,t){return lr.getHeapI16(e+(t||0))},readInt32Field:function(e,t){return lr.getHeapI32(e+(t||0))},readUint64Field:function(e,t){return lr.getHeapU52(e+(t||0))},readObjectField:function(e,t){return lr.getHeapU32(e+(t||0))},readStringField:function(e,t,n){const o=lr.getHeapU32(e+(t||0));if(0===o)return null;if(n){const e=cr.monoObjectAsBoolOrNullUnsafe(o);if("boolean"==typeof e)return e?"":null}return cr.monoStringToStringUnsafe(o)},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return yr(),dr=vr.create(),dr},invokeWhenHeapUnlocked:function(e){dr?dr.enqueuePostReleaseAction(e):e()}};function pr(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 fr=["DEBUGGING ENABLED"],gr=e=>fr.indexOf(e)<0&&console.log(e),mr=e=>{console.error(e||"(null)"),Uo()};function yr(){if(dr)throw new Error("Assertion failed - heap is currently locked")}class vr{enqueuePostReleaseAction(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)}release(){if(dr!==this)throw new Error("Trying to release a lock which isn't current");for(cr.mono_wasm_gc_unlock(),dr=null;this.postReleaseActions?.length;)this.postReleaseActions.shift()(),yr()}static create(){return cr.mono_wasm_gc_lock(),new vr}}class wr{constructor(e){this.batchAddress=e,this.arrayRangeReader=br,this.arrayBuilderSegmentReader=_r,this.diffReader=Sr,this.editReader=Cr,this.frameReader=Er}updatedComponents(){return t.readStructField(this.batchAddress,0)}referenceFrames(){return t.readStructField(this.batchAddress,br.structLength)}disposedComponentIds(){return t.readStructField(this.batchAddress,2*br.structLength)}disposedEventHandlerIds(){return t.readStructField(this.batchAddress,3*br.structLength)}updatedComponentsEntry(e,t){return Ir(e,t,Sr.structLength)}referenceFramesEntry(e,t){return Ir(e,t,Er.structLength)}disposedComponentIdsEntry(e,n){const o=Ir(e,n,4);return t.readInt32Field(o)}disposedEventHandlerIdsEntry(e,n){const o=Ir(e,n,8);return t.readUint64Field(o)}}const br={structLength:8,values:e=>t.readObjectField(e,0),count:e=>t.readInt32Field(e,4)},_r={structLength:12,values:e=>{const n=t.readObjectField(e,0),o=t.getObjectFieldsBaseAddress(n);return t.readObjectField(o,0)},offset:e=>t.readInt32Field(e,4),count:e=>t.readInt32Field(e,8)},Sr={structLength:4+_r.structLength,componentId:e=>t.readInt32Field(e,0),edits:e=>t.readStructField(e,4),editsEntry:(e,t)=>Ir(e,t,Cr.structLength)},Cr={structLength:20,editType:e=>t.readInt32Field(e,0),siblingIndex:e=>t.readInt32Field(e,4),newTreeIndex:e=>t.readInt32Field(e,8),moveToSiblingIndex:e=>t.readInt32Field(e,8),removedAttributeName:e=>t.readStringField(e,16)},Er={structLength:36,frameType:e=>t.readInt16Field(e,4),subtreeLength:e=>t.readInt32Field(e,8),elementReferenceCaptureId:e=>t.readStringField(e,16),componentId:e=>t.readInt32Field(e,12),elementName:e=>t.readStringField(e,16),textContent:e=>t.readStringField(e,16),markupContent:e=>t.readStringField(e,16),attributeName:e=>t.readStringField(e,16),attributeValue:e=>t.readStringField(e,24,!0),attributeEventHandlerId:e=>t.readUint64Field(e,8)};function Ir(e,n,o){return t.getArrayEntryPtr(e,n,o)}class kr{constructor(e){this.componentManager=e}resolveRegisteredElement(e){const t=Number.parseInt(e);if(!Number.isNaN(t))return H(this.componentManager.resolveRootComponent(t))}getParameterValues(e){return this.componentManager.initialComponents[e].parameterValues}getParameterDefinitions(e){return this.componentManager.initialComponents[e].parameterDefinitions}getTypeName(e){return this.componentManager.initialComponents[e].typeName}getAssembly(e){return this.componentManager.initialComponents[e].assembly}getCount(){return this.componentManager.initialComponents.length}}let Tr,Rr,Ar,Dr,xr=!1,Nr=!1,Mr=!0,Pr=!1;const Lr=new Promise((e=>{Dr=e}));let Ur;const Br=new Promise((e=>{Ur=e}));let Or;const $r=new Promise((e=>{Or=e}));function Fr(e){if(Tr)throw new Error("WebAssembly options have already been configured.");!async function(e){const t=await e;Tr=t,Or()}(e)}function Hr(e){if(void 0!==Ar)throw new Error("Blazor WebAssembly has already started.");return Ar=new Promise(Wr.bind(null,e)),Ar}async function Wr(e,n,o){(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((()=>{}));const r=jr();!function(e){const t=D;D=(e,n,o)=>{((e,t,n)=>{const o=De(e);o?.eventDelegator.getHandler(t)&&ur.invokeWhenHeapUnlocked(n)})(e,n,(()=>t(e,n,o)))}}(),wt._internal.applyHotReload=(e,t,n,o,r)=>{ar.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDelta",e,t,n,o,r??null)},wt._internal.applyHotReloadDeltas=(e,t)=>ar.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDeltas",e,t),wt._internal.getApplyUpdateCapabilities=()=>ar.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","GetApplyUpdateCapabilities"),wt._internal.invokeJSJson=zr,wt._internal.endInvokeDotNetFromJS=qr,wt._internal.receiveWebAssemblyDotNetDataStream=Jr,wt._internal.receiveByteArray=Vr;const i=(t=ur,t);wt.platform=i,wt._internal.renderBatch=(e,t)=>{const n=ur.beginHeapLock();try{xe(e,new wr(t))}finally{n.release()}},wt._internal.navigationManager.listenForNavigationEvents(Un.WebAssembly,(async(e,t,n)=>{await ar.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t,n)}),(async(e,t,n,o)=>{const r=await ar.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChangingAsync",t,n,o);wt._internal.navigationManager.endLocationChanging(e,r)}));const s=new kr(e);wt._internal.registeredComponents={getRegisteredComponentsCount:()=>s.getCount(),getAssembly:e=>s.getAssembly(e),getTypeName:e=>s.getTypeName(e),getParameterDefinitions:e=>s.getParameterDefinitions(e)||"",getParameterValues:e=>s.getParameterValues(e)||""},wt._internal.getPersistedState=()=>Tt(document,Et)||"",wt._internal.getInitialComponentsUpdate=()=>Br,wt._internal.updateRootComponents=e=>wt._internal.dotNetExports?.UpdateRootComponentsCore(e),wt._internal.endUpdateRootComponents=t=>e.onAfterUpdateRootComponents?.(t),wt._internal.attachRootComponentToElement=(e,t,n)=>{const o=s.resolveRegisteredElement(e);o?Ae(n,o,t,!1):function(e,t,n){const o="::before";let r=!1;if(e.endsWith("::after"))e=e.slice(0,-7),r=!0;else if(e.endsWith(o))throw new Error(`The '${o}' selector is not supported.`);const i=w(e)||document.querySelector(e);if(!i)throw new Error(`Could not find any element matching selector '${e}'.`);Ae(n,W(i,!0),t,r)}(e,t,n)};try{await r,await i.start()}catch(e){throw new Error(`Failed to start platform. Reason: ${e}`)}i.callEntryPoint(),hr.invokeAfterStartedCallbacks(wt),Nr=!0,n()}function jr(){return Rr??=(async()=>{await $r;const e=Tr??{},t=Tr?.configureRuntime;e.configureRuntime=e=>{t?.(e),Pr&&e.withEnvironmentVariable("__BLAZOR_WEBASSEMBLY_WAIT_FOR_ROOT_COMPONENTS","true")},await ur.load(e,Dr),xr=!0})(),Rr}function zr(e,t,n,o,r){return 0!==r?(ar.beginInvokeJSFromDotNet(r,e,o,n,t),null):ar.invokeJSFromDotNet(e,o,n,t)}function qr(e,t,n){ar.endInvokeDotNetFromJS(e,t,n)}function Jr(e,t,n,o){!function(e,t,n,o,r){let i=vt.get(t);if(!i){const n=new ReadableStream({start(e){vt.set(t,e),i=e}});e.supplyDotNetStream(t,n)}r?(i.error(r),vt.delete(t)):0===o?(i.close(),vt.delete(t)):i.enqueue(n.length===o?n:n.subarray(0,o))}(ar,e,t,n,o)}function Vr(e,t){ar.receiveByteArray(e,t)}function Kr(e,t){t.namespaceURI?e.setAttributeNS(t.namespaceURI,t.name,t.value):e.setAttribute(t.name,t.value)}const Xr="data-permanent";var Gr,Yr;!function(e){e[e.None=0]="None",e[e.Some=1]="Some",e[e.Infinite=2]="Infinite"}(Gr||(Gr={})),function(e){e.Keep="keep",e.Update="update",e.Insert="insert",e.Delete="delete"}(Yr||(Yr={}));class Qr{static create(e,t,n){return 0===t&&n===e.length?e:new Qr(e,t,n)}constructor(e,t,n){this.source=e,this.startIndex=t,this.length=n}item(e){return this.source.item(e+this.startIndex)}forEach(e,t){for(let t=0;t=n&&s>=o&&r(e.item(i),t.item(s))===Gr.None;)i--,s--,a++;return a}(e,t,o,o,n),i=function(e){const t=[];let n=e.length-1,o=e[n]?.length-1;for(;n>0||o>0;){const r=0===n?Yr.Insert:0===o?Yr.Delete:e[n][o];switch(t.unshift(r),r){case Yr.Keep:case Yr.Update:n--,o--;break;case Yr.Insert:o--;break;case Yr.Delete:n--}}return t}(function(e,t,n){const o=[],r=[],i=e.length,s=t.length;if(0===i&&0===s)return[];for(let e=0;e<=i;e++)(o[e]=Array(s+1))[0]=e,r[e]=Array(s+1);const a=o[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=o[a-1][i]+1,l=o[a][i-1]+1;let h;switch(s){case Gr.None:h=o[a-1][i-1];break;case Gr.Some:h=o[a-1][i-1]+1;break;case Gr.Infinite:h=Number.MAX_VALUE}h{const t=Pe(e);history.pushState(null,"",e),t?Ue(e):bi(e,!0)}))}function vi(e){He()||bi(location.href,!1)}function wi(e){if(He()||e.defaultPrevented)return;const t=e.target;if(t instanceof HTMLFormElement){if(!function(e){const t=e.getAttribute("data-enhance");return"string"==typeof t&&""===t||"true"===t?.toLowerCase()}(t))return;const n=e.submitter?.getAttribute("formmethod")||t.method;if("dialog"===n)return void console.warn('A form cannot be enhanced when its method is "dialog".');const o=e.submitter?.getAttribute("formtarget")||t.target;if(""!==o&&"_self"!==o)return void console.warn('A form cannot be enhanced when its target is different from the default value "_self".');e.preventDefault();const r=new URL(e.submitter?.getAttribute("formaction")||t.action,document.baseURI),i={method:n},s=new FormData(t),a=e.submitter?.getAttribute("name"),c=e.submitter.getAttribute("value");a&&c&&s.append(a,c);const l=new URLSearchParams(s).toString();if("get"===i.method)r.search=l,history.pushState(null,"",r.toString());else{const n=e.submitter?.getAttribute("formenctype")||t.enctype;"multipart/form-data"===n?i.body=s:(i.body=l,i.headers={"content-type":n,accept:di})}bi(r.toString(),!1,i)}}async function bi(e,t,n,o){fi=!0,ui?.abort(),function(e,t){ke?.(e,t)}(e,t),pi.enhancedNavigationStarted(),ui=new AbortController;const r=ui.signal,i=fetch(e,Object.assign({signal:r,mode:"no-cors",headers:{accept:di}},n));let s=null;if(await async function(e,t,n,o){let r;try{if(r=await e,!r.body)return void n(r,"");const t=r.headers.get("ssr-framing");if(!t){const e=await r.text();return void n(r,e)}let o=!0;await r.body.pipeThrough(new TextDecoderStream).pipeThrough(function(e){let t="";return new TransformStream({transform(n,o){if(t+=n,t.indexOf(e,t.length-n.length-e.length)>=0){const n=t.split(e);n.slice(0,-1).forEach((e=>o.enqueue(e))),t=n[n.length-1]}},flush(e){e.enqueue(t)}})}(`\x3c!--${t}--\x3e`)).pipeTo(new WritableStream({write(e){o?(o=!1,n(r,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}}(i,r,((t,r)=>{const i=!n?.method||"get"===n.method,a=t.status>=200&&t.status<300;if("opaque"===t.type){if(i)return void Si(e);throw new Error("Enhanced navigation does not support making a non-GET request to an endpoint that redirects to an external origin. Avoid enabling enhanced navigation for form posts that may perform external redirections.")}if(a&&"allow"!==t.headers.get("blazor-enhanced-nav")){if(i)return void Si(e);throw new Error("Enhanced navigation does not support making a non-GET request to a non-Blazor endpoint. Avoid enabling enhanced navigation for forms that post to a non-Blazor endpoint.")}(t.redirected||o)&&((o?"get"===o:i)?history.replaceState(null,"",t.url):t.url!==location.href&&history.pushState(null,"",t.url),e=t.url);const c=t.headers.get("blazor-enhanced-nav-redirect-location");if(c)return void location.replace(c);t.redirected||i||!a||(Le(t.url,gi)?location.href!==gi&&history.pushState(null,"",gi):s=`Cannot perform enhanced form submission that changes the URL (except via a redirection), because then back/forward would not work. Either remove this form's 'action' attribute, or change its method to 'get', or do not mark it as enhanced.\nOld URL: ${location.href}\nNew URL: ${t.url}`),gi=t.url;const l=t.headers.get("content-type");if(l?.startsWith("text/html")&&r){const e=(new DOMParser).parseFromString(r,"text/html");ei(document,e),pi.documentUpdated()}else l?.startsWith("text/")&&r?_i(r):a||r?i?Si(e):_i(`Error: ${n.method} request to ${e} returned non-HTML content of type ${l||"unspecified"}.`):_i(`Error: ${t.status} ${t.statusText}`)})),!r.aborted){const t=e.indexOf("#");if(t>=0){const n=e.substring(t+1),o=document.getElementById(n);o?.scrollIntoView()}if(fi=!1,pi.enhancedNavigationCompleted(),s)throw new Error(s)}}function _i(e){document.documentElement.textContent=e;const t=document.documentElement.style;t.fontFamily="consolas, monospace",t.whiteSpace="pre-wrap",t.padding="1rem"}function Si(e){history.replaceState(null,"",e+"?"),location.replace(e)}let Ci,Ei=!0;function Ii(e,t){Ci=t,e?.disableDomPreservation&&(Ei=!1),customElements.define("blazor-ssr-end",ki)}class ki extends HTMLElement{connectedCallback(){const e=this.parentNode;e.parentNode?.removeChild(e),e.childNodes.forEach((e=>{if(e instanceof HTMLTemplateElement){const t=e.getAttribute("blazor-component-id");if(t)"true"!==e.getAttribute("enhanced-nav")&&ui||function(e,t){const n=function(e){const t=`bl:${e}`,n=document.createNodeIterator(document,NodeFilter.SHOW_COMMENT);let o=null;for(;(o=n.nextNode())&&o.textContent!==t;);if(!o)return null;const r=`/bl:${e}`;let i=null;for(;(i=n.nextNode())&&i.textContent!==r;);return i?{startMarker:o,endMarker:i}:null}(e);if(n){const{startMarker:e,endMarker:o}=n;if(Ei)ei({startExclusive:e,endExclusive:o},t);else{const n=o.parentNode,r=new Range;for(r.setStart(e,e.textContent.length),r.setEnd(o,0),r.deleteContents();t.childNodes[0];)n.insertBefore(t.childNodes[0],o)}Ci.documentUpdated()}}(t,e.content);else switch(e.getAttribute("type")){case"redirection":const t=Fe(e.content.textContent),n="form-post"===e.getAttribute("from");"true"===e.getAttribute("enhanced")&&Me(t)?bi(t,!1,void 0,n?"post":"get"):n?t!==location.href&&location.assign(t):location.replace(t);break;case"error":_i(e.content.textContent||"Error")}}}))}}class Ti{constructor(e){var t;this._circuitInactivityTimeoutMs=e,this._rootComponentsBySsrComponentId=new Map,this._seenDescriptors=new Set,this._pendingOperationBatches={},this._nextOperationBatchId=1,this._nextSsrComponentId=1,this._didWebAssemblyFailToLoadQuickly=!1,this._isComponentRefreshPending=!1,this.initialComponents=[],t=()=>{this.rootComponentsMayRequireRefresh()},E.push(t)}onAfterRenderBatch(e){e===Un.Server&&this.circuitMayHaveNoRootComponents()}onDocumentUpdated(){this.rootComponentsMayRequireRefresh()}onEnhancedNavigationCompleted(){this.rootComponentsMayRequireRefresh()}registerComponent(e){if(this._seenDescriptors.has(e))return;"webassembly"===e.type?this.startLoadingWebAssemblyIfNotStarted():"auto"===e.type&&this.startLoadingWebAssemblyIfNotStarted(1);const t=this._nextSsrComponentId++;this._seenDescriptors.add(e),this._rootComponentsBySsrComponentId.set(t,{descriptor:e,ssrComponentId:t})}unregisterComponent(e){this._seenDescriptors.delete(e.descriptor),this._rootComponentsBySsrComponentId.delete(e.ssrComponentId),this.circuitMayHaveNoRootComponents()}async startLoadingWebAssemblyIfNotStarted(e){if(void 0!==Rr)return;Pr=!0;const t=jr(),n=await Lr;void 0!==e&&(n.maxParallelDownloads=e),function(e){if(!e.cacheBootResources)return!1;const t=Ri(e);if(!t)return!1;const n=window.localStorage.getItem(t.key);return t.value===n}(n)||this.onWebAssemblyFailedToLoadQuickly(),await t,function(e){const t=Ri(e);t&&window.localStorage.setItem(t.key,t.value)}(n),this.rootComponentsMayRequireRefresh()}onWebAssemblyFailedToLoadQuickly(){this._didWebAssemblyFailToLoadQuickly||(this._didWebAssemblyFailToLoadQuickly=!0,this.rootComponentsMayRequireRefresh())}startCircutIfNotStarted(){return void 0===Go?Qo(this):!Vo||Vo.isDisposedOrDisposing()?er():void 0}async startWebAssemblyIfNotStarted(){this.startLoadingWebAssemblyIfNotStarted(),void 0===Ar&&await Hr(this)}rootComponentsMayRequireRefresh(){this._isComponentRefreshPending||(this._isComponentRefreshPending=!0,setTimeout((()=>{this._isComponentRefreshPending=!1,this.refreshRootComponents(this._rootComponentsBySsrComponentId.values())}),0))}circuitMayHaveNoRootComponents(){if(this.rendererHasExistingOrPendingComponents(Un.Server,"server","auto"))return clearTimeout(this._circuitInactivityTimeoutId),void(this._circuitInactivityTimeoutId=void 0);void 0===this._circuitInactivityTimeoutId&&(this._circuitInactivityTimeoutId=setTimeout((()=>{this.rendererHasExistingOrPendingComponents(Un.Server,"server","auto")||(async function(){await(Vo?.dispose())}(),this._circuitInactivityTimeoutId=void 0)}),this._circuitInactivityTimeoutMs))}rendererHasComponents(e){const t=De(e);return void 0!==t&&t.getRootComponentCount()>0}rendererHasExistingOrPendingComponents(e,...t){if(this.rendererHasComponents(e))return!0;for(const{descriptor:{type:n},assignedRendererId:o}of this._rootComponentsBySsrComponentId.values()){if(o===e)return!0;if(void 0===o&&-1!==t.indexOf(n))return!0}return!1}refreshRootComponents(e){const t=new Map;for(const n of e){const e=this.determinePendingOperation(n);if(!e)continue;const o=n.assignedRendererId;if(!o)throw new Error("Descriptors must be assigned a renderer ID before getting used as root components");let r=t.get(o);r||(r=[],t.set(o,r)),r.push(e)}for(const[e,n]of t){const t={batchId:this._nextOperationBatchId++,operations:n};this._pendingOperationBatches[t.batchId]=t;const o=JSON.stringify(t);e===Un.Server?tr(o):this.updateWebAssemblyRootComponents(o)}this.circuitMayHaveNoRootComponents()}updateWebAssemblyRootComponents(e){Mr?(Ur(e),Mr=!1):function(e){if(!Ar)throw new Error("Blazor WebAssembly has not started.");if(!wt._internal.updateRootComponents)throw new Error("Blazor WebAssembly has not initialized.");Nr?wt._internal.updateRootComponents(e):async function(e){if(await Ar,!wt._internal.updateRootComponents)throw new Error("Blazor WebAssembly has not initialized.");wt._internal.updateRootComponents(e)}(e)}(e)}resolveRendererIdForDescriptor(e){switch("auto"===e.type?this.getAutoRenderMode():e.type){case"server":return this.startCircutIfNotStarted(),Un.Server;case"webassembly":return this.startWebAssemblyIfNotStarted(),Un.WebAssembly;case null:return null}}getAutoRenderMode(){return this.rendererHasExistingOrPendingComponents(Un.WebAssembly,"webassembly")?"webassembly":this.rendererHasExistingOrPendingComponents(Un.Server,"server")?"server":xr?"webassembly":this._didWebAssemblyFailToLoadQuickly?"server":null}determinePendingOperation(e){if(t=e.descriptor,document.contains(t.start)){if(void 0===e.assignedRendererId){if(fi||"loading"===document.readyState)return null;const t=this.resolveRendererIdForDescriptor(e.descriptor);return null===t?null:T(t)?(be(e.descriptor.start,!0),e.assignedRendererId=t,e.uniqueIdAtLastUpdate=e.descriptor.uniqueId,{type:"add",ssrComponentId:e.ssrComponentId,marker:Ut(e.descriptor)}):null}return T(e.assignedRendererId)?e.uniqueIdAtLastUpdate===e.descriptor.uniqueId?null:(e.uniqueIdAtLastUpdate=e.descriptor.uniqueId,{type:"update",ssrComponentId:e.ssrComponentId,marker:Ut(e.descriptor)}):null}return e.hasPendingRemoveOperation?null:void 0===e.assignedRendererId?(this.unregisterComponent(e),null):T(e.assignedRendererId)?(be(e.descriptor.start,!1),e.hasPendingRemoveOperation=!0,{type:"remove",ssrComponentId:e.ssrComponentId}):null;var t}resolveRootComponent(e){const t=this._rootComponentsBySsrComponentId.get(e);if(!t)throw new Error(`Could not resolve a root component with SSR component ID '${e}'.`);return t.descriptor}onAfterUpdateRootComponents(e){const t=this._pendingOperationBatches[e];delete this._pendingOperationBatches[e];for(const e of t.operations)switch(e.type){case"remove":{const t=this._rootComponentsBySsrComponentId.get(e.ssrComponentId);t&&this.unregisterComponent(t);break}}}}function Ri(e){const t=e.resources?.hash,n=e.mainAssemblyName;return t&&n?{key:`blazor-resource-hash:${n}`,value:t}:null}class Ai{constructor(){this._eventListeners=new Map}static create(e){const t=new Ai;return e.addEventListener=t.addEventListener.bind(t),e.removeEventListener=t.removeEventListener.bind(t),t}addEventListener(e,t){let n=this._eventListeners.get(e);n||(n=new Set,this._eventListeners.set(e,n)),n.add(t)}removeEventListener(e,t){this._eventListeners.get(e)?.delete(t)}dispatchEvent(e,t){const n=this._eventListeners.get(e);if(!n)return;const o={...t,type:e};for(const e of n)e(o)}}let Di=null,xi=location.href,Ni=!1;function Mi(){null!==document.activeElement&&document.activeElement!==document.body||document.querySelector("[autofocus]")||Bi()}function Pi(){Le(xi,location.href)||(Ni=!0),xi=location.href}function Li(){Ni&&Bi()}function Ui(){Ni=!1}function Bi(){const e=Di?.getAttribute("selector");e&&st.focusBySelector(e)}class Oi extends HTMLElement{connectedCallback(){Di=this}disconnectedCallback(){Di===this&&(Di=null)}}let $i,Fi=!1;function Hi(e){if(Fi)throw new Error("Blazor has already started.");Fi=!0,e=e||{},e.logLevel??=bt.Error,wt._internal.hotReloadApplied=()=>{Oe()&&$e(location.href,!0)},$i=new Ti(e?.ssr?.circuitInactivityTimeoutMs??2e3);const t=Ai.create(wt),n={enhancedNavigationStarted:()=>{t.dispatchEvent("enhancednavigationstart",{})},documentUpdated:()=>{$i.onDocumentUpdated(),t.dispatchEvent("enhancedload",{})},enhancedNavigationCompleted(){$i.onEnhancedNavigationCompleted(),t.dispatchEvent("enhancednavigationend",{})}};return Zr=$i,Ii(e?.ssr,n),e?.ssr?.disableDomPreservation||(pi=n,document.addEventListener("click",yi),document.addEventListener("submit",wi),window.addEventListener("popstate",vi),Ie=mi),function(e){customElements.define("blazor-focus-on-navigate",Oi),e.addEventListener("enhancednavigationstart",Pi),e.addEventListener("enhancednavigationend",Li),document.addEventListener("focusin",Ui),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",Mi,{once:!0}):Mi()}(t),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",Wi.bind(null,e)):Wi(e),Promise.resolve()}function Wi(e){const t=Oo(e?.circuit||{});e.circuit=t;const n=async function(e,t){const n=Tt(document,It,"initializers");if(!n)return new zo(!1,t);const o=JSON.parse(atob(n))??[],r=new zo(!1,t);return await r.importInitializersAsync(o,[e]),r}(e,new _t(t.logLevel));!function(e){if(Ko)throw new Error("Circuit options have already been configured.");qo=async function(e){const t=await e;Ko=Oo(t)}(e)}(ji(n,t)),Fr(ji(n,e?.webAssembly||{})),function(e){const t=si(document);for(const e of t)Zr?.registerComponent(e)}(),$i.onDocumentUpdated(),async function(e){const t=await e;await t.invokeAfterStartedCallbacks(wt)}(n)}async function ji(e,t){return await e,t}wt.start=Hi,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&Hi()}(); diff --git a/src/Components/Web.JS/dist/Release/blazor.webassembly.js b/src/Components/Web.JS/dist/Release/blazor.webassembly.js index 931d70db651..d901f1824c1 100644 --- a/src/Components/Web.JS/dist/Release/blazor.webassembly.js +++ b/src/Components/Web.JS/dist/Release/blazor.webassembly.js @@ -1 +1 @@ -!function(){"use strict";var e;let t;var n,r;!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 u=0,d={[u]:new l(window)};d[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let f,m=1;function h(e){t.push(e)}function p(e){if(e&&"object"==typeof e){d[m]=new l(e);const t={[n]:m};return m++,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=p(e);r[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return r}function b(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 v(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=h,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=p,e.createJSStreamReference=g,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&S(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(f=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,r){const o=b(this,t),i=N(E(e,r)(...o||[]),n);return null==i?null:k(this,i)}beginInvokeJSFromDotNet(e,t,n,r,o){const i=new Promise((e=>{const r=b(this,n);e(E(t,o)(...r||[]))}));e&&i.then((t=>k(this,[e,!0,N(t,r)]))).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 r=t?b(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=k(this,r),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,o);return i?b(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=k(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 I;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 I;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 w(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function E(e,t){const n=d[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function S(e){delete d[e]}e.findJSFunction=E,e.disposeJSObjectReferenceById=S;class C{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=C,h((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(r))return new C(t[r],c);if(t.hasOwnProperty(n)){const e=t[n],r=d[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 A(n)}}return t}));class A{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class I{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function N(e,t){switch(t){case f.Default:return e;case f.JSObjectReference:return p(e);case f.JSStreamReference:return g(e);case f.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let R=0;function k(e,t){R=0,c=e;const n=JSON.stringify(t,D);return c=void 0,n}function D(e,t){if(t instanceof C)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(R,t);const e={[o]:R};return R++,e}return t}}(e||(e={})),function(e){e[e.prependFrame=1]="prependFrame",e[e.removeFrame=2]="removeFrame",e[e.setAttribute=3]="setAttribute",e[e.removeAttribute=4]="removeAttribute",e[e.updateText=5]="updateText",e[e.stepIn=6]="stepIn",e[e.stepOut=7]="stepOut",e[e.updateMarkup=8]="updateMarkup",e[e.permutationListEntry=9]="permutationListEntry",e[e.permutationListEnd=10]="permutationListEnd"}(n||(n={})),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",e[e.namedEvent=10]="namedEvent"}(r||(r={}));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 t?.browserEventName||e}function u(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}}}}),u(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),u(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...f(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),u(["focus","blur","focusin","focusout"],{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,isComposing:t.isComposing};var t}}),u(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>f(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{...f(t=e),pointerId:t.pointerId,width:t.width,height:t.height,pressure:t.pressure,tiltX:t.tiltX,tiltY:t.tiltY,pointerType:t.pointerType,isPrimary:t.isPrimary};var t}}),u(["wheel","mousewheel"],{createEventArgs:e=>{return{...f(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),u(["cancel","close","toggle"],{createEventArgs:()=>({})});const m=["date","datetime-local","month","time","week"],h=new Map;let p,g,b=0;const y={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const r="__bl-dynamic-root:"+(++b).toString();h.set(r,e);const o=await E().invokeMethodAsync("AddRootComponent",t,r),i=new w(o,g[t]);return await i.setParameters(n),i}};class v{invoke(e){return this._callback(e)}setCallback(t){this._selfJSObjectReference||(this._selfJSObjectReference=e.createJSObjectReference(this)),this._callback=t}getJSObjectReference(){return this._selfJSObjectReference}dispose(){this._selfJSObjectReference&&e.disposeJSObjectReference(this._selfJSObjectReference)}}class 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 v)}setParameters(e){const t={},n=Object.entries(e||{}),r=n.length;for(const[e,r]of n){const n=this._jsEventCallbackWrappers.get(e.toLowerCase());n&&r?(n.setCallback(r),t[e]=n.getJSObjectReference()):t[e]=r}return E().invokeMethodAsync("SetRootComponentParameters",this._componentId,r,t)}async dispose(){if(null!==this._componentId){await E().invokeMethodAsync("RemoveRootComponent",this._componentId),this._componentId=null;for(const e of this._jsEventCallbackWrappers.values())e.dispose()}}}function E(){if(!p)throw new Error("Dynamic root components have not been enabled in this application.");return p}const S=new Map,C=[],A=new Map;function I(e,t,n){return R(e,t.eventHandlerId,(()=>N(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function N(e){const t=S.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let R=(e,t,n)=>n();const k=O(["abort","blur","cancel","canplay","canplaythrough","change","close","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),D={submit:!0},_=O(["click","dblclick","mousedown","mousemove","mouseup"]);class T{static{this.nextEventDelegatorId=0}constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++T.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new F(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(k,e);let l=!1;for(;r;){const f=r,m=this.getEventHandlerInfosForElement(f,!1);if(m){const n=m.getHandler(e);if(n&&(u=f,d=t.type,!((u instanceof HTMLButtonElement||u instanceof HTMLInputElement||u instanceof HTMLTextAreaElement||u instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(_,d)&&u.disabled))){if(!s){const n=c(e);i=n?.createEventArgs?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(D,t.type)&&t.preventDefault(),I(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},i)}m.stopPropagation(e)&&(l=!0),m.preventDefault(e)&&t.preventDefault()}r=a||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}}class F{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(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 O(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const M=Symbol(),x=Symbol(),P=Symbol();function B(e,t){if(M in e)return e;const n=[];if(e.childNodes.length>0){if(!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");e.childNodes.forEach((t=>{const r=B(t,!0);r[x]=e,n.push(r)}))}return e[M]=n,e}function H(e){const t=K(e);for(;t.length;)z(e,0)}function j(e,t){const n=document.createComment("!");return J(n,e,t),n}function J(e,t,n){const r=e;let o=e;if(e instanceof Comment){const t=K(r);if(t?.length>0){const t=G(r),n=new Range;n.setStartBefore(e),n.setEndAfter(t),o=n.extractContents()}}const i=$(r);if(i){const e=K(i),t=Array.prototype.indexOf.call(e,r);e.splice(t,1),delete r[x]}const s=K(t);if(n0;)z(n,0)}const r=n;r.parentNode.removeChild(r)}function $(e){return e[x]||null}function W(e,t){return K(e)[t]}function U(e){const t=Y(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function K(e){return e[M]}function V(e){const t=K($(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}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):q(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 Y(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 q(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):q(e,$(t))}}}function G(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=V(e);if(t)return t.previousSibling;{const t=$(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:G(t)}}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||=[];for(let n=0;n{Ne()&&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=e.composedPath&&e.composedPath();if(t)for(let e=0;e{const t=document.createElement("script");t.textContent=e.textContent,e.getAttributeNames().forEach((n=>{t.setAttribute(n,e.getAttribute(n))})),e.parentNode.replaceChild(t,e)})),ie.content));var s;let a=0;for(;i.firstChild;)J(i.firstChild,o,a++)}applyAttribute(e,t,n,r){const o=e.frameReader,i=o.attributeName(r),s=o.attributeEventHandlerId(r);if(s){const e=me(i);return void this.eventDelegator.setListener(n,e,s,t)}const a=o.attributeValue(r);this.setOrRemoveAttributeOrProperty(n,i,a)}insertFrameRange(e,t,n,r,o,i,s){const a=r;for(let a=i;a{Je(t,e)})},enableNavigationInterception:function(e){if(void 0!==pe&&pe!==e)throw new Error("Only one interactive runtime may enable navigation interception at a time.");pe=e},setHasLocationChangingListeners:function(e,t){const n=Te.get(e);if(!n)throw new Error(`Renderer with ID '${e}' is not listening for navigation events`);n.hasLocationChangingEventListeners=t},endLocationChanging:function(e,t){Le&&e===_e&&(Le(t),Le=null)},navigateTo:function(e,t){Me(e,t,!0)},refresh:function(e){!e&&Ce()?Ae(location.href,!0):location.reload()},getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href,scrollToElement:Se};function Me(e,t,n=!1){const r=Ie(e);!t.forceLoad&&Ee(r)?We()?xe(r,!1,t.replaceHistoryEntry,t.historyEntryState,n):Ae(r,t.replaceHistoryEntry):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function xe(e,t,n,r=void 0,o=!1){if(He(),function(e){const t=new URL(e);return""!==t.hash&&location.origin===t.origin&&location.pathname===t.pathname&&location.search===t.search}(e))return Pe(e,n,r),void function(e){const t=e.indexOf("#");t!==e.length-1&&Se(e.substring(t+1))}(e);const i=$e();(o||!i?.hasLocationChangingEventListeners||await je(e,r,t,i))&&(ve=!0,Pe(e,n,r),await Je(t))}function Pe(e,t,n=void 0){t?history.replaceState({userState:n,_index:De},"",e):(De++,history.pushState({userState:n,_index:De},"",e))}function Be(e){return new Promise((t=>{const n=Fe;Fe=()=>{Fe=n,t()},history.go(e)}))}function He(){Le&&(Le(!1),Le=null)}function je(e,t,n,r){return new Promise((o=>{He(),_e++,Le=o,r.locationChanging(_e,e,t,n)}))}async function Je(e,t){const n=t??location.href;await Promise.all(Array.from(Te,(async([t,r])=>{var o;o=t,S.has(o)&&await r.locationChanged(n,history.state?.userState,e)})))}async function ze(e){Fe&&We()&&await Fe(e),De=history.state?._index??0}function $e(){const e=Re();if(void 0!==e)return Te.get(e)}function We(){return Ne()||!Ce()}const Ue={focus:function(e,t){if(e instanceof HTMLElement)e.focus({preventScroll:t});else{if(!(e instanceof SVGElement))throw new Error("Unable to focus an invalid element.");if(!e.hasAttribute("tabindex"))throw new Error("Unable to focus an SVG element that does not have a tabindex.");e.focus({preventScroll:t})}},focusBySelector:function(e){const t=document.querySelector(e);t&&(t.hasAttribute("tabindex")||(t.tabIndex=-1),t.focus({preventScroll:!0}))}},Ke={init:function(e,t,n,r=50){const o=Xe(t);(o||document.documentElement).style.overflowAnchor="none";const i=document.createRange();f(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(r){r.forEach((r=>{if(!r.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const o=i.getBoundingClientRect().height,s=r.rootBounds?.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,o,s):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,o,s)}))}),{root:o,rootMargin:`${r}px`});s.observe(t),s.observe(n);const a=d(t),c=d(n),{observersByDotNetObjectId:l,id:u}=Ye(e);function d(e){const t={attributes:!0},n=new MutationObserver(((n,r)=>{f(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 f(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)}l[u]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const{observersByDotNetObjectId:t,id:n}=Ye(e),r=t[n];r&&(r.intersectionObserver.disconnect(),r.mutationObserverBefore.disconnect(),r.mutationObserverAfter.disconnect(),e.dispose(),delete t[n])}},Ve=Symbol();function Xe(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:Xe(e.parentElement):null}function Ye(e){const t=e._callDispatcher,n=e._id;return t[Ve]??={},{observersByDotNetObjectId:t[Ve],id:n}}const qe={getAndRemoveExistingTitle:function(){const e=document.head?document.head.getElementsByTagName("title"):[];if(0===e.length)return null;let t=null;for(let n=e.length-1;n>=0;n--){const r=e[n],o=r.previousSibling;o instanceof Comment&&null!==$(o)||(null===t&&(t=r.textContent),r.parentNode?.removeChild(r))}return t}},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=Ze(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){const t=Math.min(1,r/s.width),i=Math.min(1,o/s.height),a=Math.min(t,i),c=document.createElement("canvas");c.width=Math.round(s.width*a),c.height=Math.round(s.height*a),c.getContext("2d")?.drawImage(s,0,0,c.width,c.height),c.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:a?.size||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return Ze(e,t).blob}};function Ze(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,et={enableNavigationPrompt:function(e){0===Qe.size&&window.addEventListener("beforeunload",tt),Qe.add(e)},disableNavigationPrompt:function(e){Qe.delete(e),0===Qe.size&&window.removeEventListener("beforeunload",tt)}};function tt(e){e.preventDefault(),e.returnValue=!0}const nt=new Map,rt={navigateTo:function(e,t,n=!1){Me(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:y,runtime:{},_internal:{navigationManager:Oe,domWrapper:Ue,Virtualize:Ke,PageTitle:qe,InputFile:Ge,NavigationLock:et,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,o){if(S.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);S.set(t,n),r&&o&&Object.keys(r).length>0&&function(t,n,r){if(p)throw new Error("Dynamic root components have already been enabled.");p=t,g=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(t),r,o),A.get(t)?.[0]?.(),function(e){for(const t of C)t(e)}(t)}}};window.Blazor=rt;const ot=navigator,it=ot.userAgentData&&ot.userAgentData.brands,st=it&&it.length>0?it.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):window.chrome,at=ot.userAgentData?.platform??navigator.platform;function ct(e){return 0!==e.debugLevel&&(st||navigator.userAgent.includes("Firefox"))}let lt=!1;function ut(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),lt||(lt=!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()}})))}var dt,ft;!function(e){e[e.Default=0]="Default",e[e.Server=1]="Server",e[e.WebAssembly=2]="WebAssembly",e[e.WebView=3]="WebView"}(dt||(dt={})),function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(ft||(ft={}));class mt{constructor(e=!0,t,n,r=0){this.singleRuntime=e,this.logger=t,this.webRendererId=r,this.afterStartedCallbacks=[],n&&this.afterStartedCallbacks.push(...n)}async importInitializersAsync(e,t){await Promise.all(e.map((e=>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){if(e.singleRuntime){const{beforeStart:n,afterStarted:r,beforeWebAssemblyStart:s,afterWebAssemblyStarted:a,beforeServerStart:c,afterServerStarted:l}=o;let u=n;e.webRendererId===dt.Server&&c&&(u=c),e.webRendererId===dt.WebAssembly&&s&&(u=s);let d=r;return e.webRendererId===dt.Server&&l&&(d=l),e.webRendererId===dt.WebAssembly&&a&&(d=a),i(e,u,d,t)}return function(e,t,n){const o=n[0],{beforeStart:s,afterStarted:a,beforeWebStart:c,afterWebStarted:l,beforeWebAssemblyStart:u,afterWebAssemblyStarted:d,beforeServerStart:f,afterServerStarted:m}=t,h=!(c||l||u||d||f||m||!s&&!a),p=h&&o.enableClassicInitializers;if(h&&!o.enableClassicInitializers)e.logger?.log(ft.Warning,`Initializer '${r}' will be ignored because multiple runtimes are available. Use 'before(Web|WebAssembly|Server)Start' and 'after(Web|WebAssembly|Server)Started' instead.`);else if(p)return i(e,s,a,n);if(function(e){e.webAssembly?e.webAssembly.initializers||(e.webAssembly.initializers={beforeStart:[],afterStarted:[]}):e.webAssembly={initializers:{beforeStart:[],afterStarted:[]}},e.circuit?e.circuit.initializers||(e.circuit.initializers={beforeStart:[],afterStarted:[]}):e.circuit={initializers:{beforeStart:[],afterStarted:[]}}}(o),u&&o.webAssembly.initializers.beforeStart.push(u),d&&o.webAssembly.initializers.afterStarted.push(d),f&&o.circuit.initializers.beforeStart.push(f),m&&o.circuit.initializers.afterStarted.push(m),l&&e.afterStartedCallbacks.push(l),c)return c(o)}(e,o,t)}function i(e,t,n,r){if(n&&e.afterStartedCallbacks.push(n),t)return t(...r)}}(this,e))))}async invokeAfterStartedCallbacks(e){const t=(n=this.webRendererId,A.get(n)?.[1]);var n;t&&await t,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let ht,pt,gt,bt,yt=null;const vt={load:function(e,t){return async function(e,t){const{dotnet:n}=await async function(e){if("undefined"==typeof WebAssembly||!WebAssembly.validate)throw new Error("This browser does not support WebAssembly.");let t="_framework/dotnet.js";if(e.loadBootResource){const n="dotnetjs",r=e.loadBootResource(n,"dotnet.js",t,"","js-module-dotnet");if("string"==typeof r)t=r;else if(r)throw new Error(`For a ${n} resource, custom loaders must supply a URI string.`)}const n=new URL(t,document.baseURI).toString();return await import(n)}(e),r=function(e,t){const n={maxParallelDownloads:1e6,enableDownloadRetry:!1,applicationEnvironment:e.environment},r={...window.Module||{},onConfigLoaded:async n=>{n.environmentVariables||(n.environmentVariables={}),"sharded"===n.globalizationMode&&(n.environmentVariables.__BLAZOR_SHARDED_ICU="1"),rt._internal.getApplicationEnvironment=()=>n.applicationEnvironment,t?.(n),bt=await async function(e,t){if(e.initializers)return await Promise.all(e.initializers.beforeStart.map((t=>t(e)))),new mt(!1,void 0,e.initializers.afterStarted,dt.WebAssembly);{const n=[e,t.resources?.extensions??{}],r=new mt(!0,void 0,void 0,dt.WebAssembly),o=Object.keys(t?.resources?.libraryInitializers||{});return await r.importInitializersAsync(o,n),r}}(e,n)},onDownloadResourceProgress:wt,config:n,out:St,err:Ct};return r}(e,t);e.applicationCulture&&n.withApplicationCulture(e.applicationCulture),e.environment&&n.withApplicationEnvironment(e.environment),e.loadBootResource&&n.withResourceLoader(e.loadBootResource),n.withModuleConfig(r),e.configureRuntime&&e.configureRuntime(n),gt=await n.create()}(e,t)},start:function(){return async function(){if(!gt)throw new Error("The runtime must be loaded it gets configured.");const{setModuleImports:t,INTERNAL:n,getConfig:r,invokeLibraryInitializers:o}=gt;pt=n,function(e){const t=at.match(/^Mac/i)?"Cmd":"Alt";ct(e)&&console.info(`Debugging hotkey: Shift+${t}+D (when application has focus)`),document.addEventListener("keydown",(t=>{t.shiftKey&&(t.metaKey||t.altKey)&&"KeyD"===t.code&&(ct(e)?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())}():st?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."))}))}(r()),rt.runtime=gt,rt._internal.dotNetCriticalError=Ct,t("blazor-internal",{Blazor:{_internal:rt._internal}});const i=await gt.getAssemblyExports("Microsoft.AspNetCore.Components.WebAssembly");return Object.assign(rt._internal,{dotNetExports:{...i.Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime}}),ht=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{if(At(),!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)=>(At(),rt._internal.dotNetExports.InvokeDotNet(e||null,t,n??0,r))}),{invokeLibraryInitializers:o}}()},callEntryPoint:async function(){try{await gt.runMain(gt.getConfig().mainAssemblyName,[])}catch(e){console.error(e),ut()}},getArrayEntryPtr:function(e,t,n){const r=function(e){return e+12}(e)+4+t*n;return r},getObjectFieldsBaseAddress:function(e){return e+8},readInt16Field:function(e,t){return gt.getHeapI16(e+(t||0))},readInt32Field:function(e,t){return gt.getHeapI32(e+(t||0))},readUint64Field:function(e,t){return gt.getHeapU52(e+(t||0))},readObjectField:function(e,t){return gt.getHeapU32(e+(t||0))},readStringField:function(e,t,n){const r=gt.getHeapU32(e+(t||0));if(0===r)return null;if(n){const e=pt.monoObjectAsBoolOrNullUnsafe(r);if("boolean"==typeof e)return e?"":null}return pt.monoStringToStringUnsafe(r)},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return At(),yt=It.create(),yt},invokeWhenHeapUnlocked:function(e){yt?yt.enqueuePostReleaseAction(e):e()}};function wt(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 Et=["DEBUGGING ENABLED"],St=e=>Et.indexOf(e)<0&&console.log(e),Ct=e=>{console.error(e||"(null)"),ut()};function At(){if(yt)throw new Error("Assertion failed - heap is currently locked")}class It{enqueuePostReleaseAction(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)}release(){if(yt!==this)throw new Error("Trying to release a lock which isn't current");for(pt.mono_wasm_gc_unlock(),yt=null;this.postReleaseActions?.length;)this.postReleaseActions.shift()(),At()}static create(){return pt.mono_wasm_gc_lock(),new It}}class Nt{constructor(e){this.batchAddress=e,this.arrayRangeReader=Rt,this.arrayBuilderSegmentReader=kt,this.diffReader=Dt,this.editReader=_t,this.frameReader=Tt}updatedComponents(){return t.readStructField(this.batchAddress,0)}referenceFrames(){return t.readStructField(this.batchAddress,Rt.structLength)}disposedComponentIds(){return t.readStructField(this.batchAddress,2*Rt.structLength)}disposedEventHandlerIds(){return t.readStructField(this.batchAddress,3*Rt.structLength)}updatedComponentsEntry(e,t){return Ft(e,t,Dt.structLength)}referenceFramesEntry(e,t){return Ft(e,t,Tt.structLength)}disposedComponentIdsEntry(e,n){const r=Ft(e,n,4);return t.readInt32Field(r)}disposedEventHandlerIdsEntry(e,n){const r=Ft(e,n,8);return t.readUint64Field(r)}}const Rt={structLength:8,values:e=>t.readObjectField(e,0),count:e=>t.readInt32Field(e,4)},kt={structLength:12,values:e=>{const n=t.readObjectField(e,0),r=t.getObjectFieldsBaseAddress(n);return t.readObjectField(r,0)},offset:e=>t.readInt32Field(e,4),count:e=>t.readInt32Field(e,8)},Dt={structLength:4+kt.structLength,componentId:e=>t.readInt32Field(e,0),edits:e=>t.readStructField(e,4),editsEntry:(e,t)=>Ft(e,t,_t.structLength)},_t={structLength:20,editType:e=>t.readInt32Field(e,0),siblingIndex:e=>t.readInt32Field(e,4),newTreeIndex:e=>t.readInt32Field(e,8),moveToSiblingIndex:e=>t.readInt32Field(e,8),removedAttributeName:e=>t.readStringField(e,16)},Tt={structLength:36,frameType:e=>t.readInt16Field(e,4),subtreeLength:e=>t.readInt32Field(e,8),elementReferenceCaptureId:e=>t.readStringField(e,16),componentId:e=>t.readInt32Field(e,12),elementName:e=>t.readStringField(e,16),textContent:e=>t.readStringField(e,16),markupContent:e=>t.readStringField(e,16),attributeName:e=>t.readStringField(e,16),attributeValue:e=>t.readStringField(e,24,!0),attributeEventHandlerId:e=>t.readUint64Field(e,8)};function Ft(e,n,r){return t.getArrayEntryPtr(e,n,r)}const Lt=/^\s*Blazor-WebAssembly-Component-State:(?[a-zA-Z0-9+/=]+)$/;function Ot(e){return Mt(e,Lt)}function Mt(e,t,n="state"){if(e.nodeType===Node.COMMENT_NODE){const r=e.textContent||"",o=t.exec(r),i=o&&o.groups&&o.groups[n];return i&&e.parentNode?.removeChild(e),i}if(!e.hasChildNodes())return;const r=e.childNodes;for(let e=0;e.*)$/);function Bt(e,t){const n=e.currentElement;var r,o,i;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const s=Pt.exec(n.textContent),a=s&&s.groups&&s.groups.descriptor;if(!a)return;!function(e){if(e.parentNode instanceof Document)throw new Error("Root components cannot be marked as interactive. The element must be rendered statically so that scripts are not evaluated multiple times.")}(n);try{const s=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n&&"auto"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(a),c=function(e,t,n){const{prerenderId:r}=e;if(r){for(;n.next()&&n.currentElement;){const e=n.currentElement;if(e.nodeType!==Node.COMMENT_NODE)continue;if(!e.textContent)continue;const t=Pt.exec(e.textContent),o=t&&t[1];if(o)return Kt(o,r),e}throw new Error(`Could not find an end component comment for '${t}'.`)}}(s,n,e);if(t!==s.type)return;switch(s.type){case"webassembly":return o=n,i=c,Ut(r=s),{...r,uniqueId:$t++,start:o,end:i};case"server":return function(e,t,n){return Wt(e),{...e,uniqueId:$t++,start:t,end:n}}(s,n,c);case"auto":return function(e,t,n){return Wt(e),Ut(e),{...e,uniqueId:$t++,start:t,end:n}}(s,n,c)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}let Ht,jt,Jt,zt,$t=0;function Wt(e){const{descriptor:t,sequence:n}=e;if(!t)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===n)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(n))throw new Error(`Error parsing the sequence '${n}' for component '${JSON.stringify(e)}'`)}function Ut(e){const{assembly:t,typeName:n}=e;if(!t)throw new Error("assembly must be defined when using a descriptor.");if(!n)throw new Error("typeName must be defined when using a descriptor.");e.parameterDefinitions=e.parameterDefinitions&&atob(e.parameterDefinitions),e.parameterValues=e.parameterValues&&atob(e.parameterValues)}function Kt(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 Vt{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndex{zt=e}));const Yt=new Promise((e=>{}));let qt;const Gt=new Promise((e=>{qt=e}));function Zt(e){if(Ht)throw new Error("WebAssembly options have already been configured.");!async function(e){const t=await e;Ht=t,qt()}(e)}function Qt(e){if(void 0!==Jt)throw new Error("Blazor WebAssembly has already started.");return Jt=new Promise(en.bind(null,e)),Jt}async function en(e,n,r){(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((()=>{}));const o=tn();!function(e){const t=R;R=(e,n,r)=>{((e,t,n)=>{const r=function(e){return he[e]}(e);r?.eventDelegator.getHandler(t)&&vt.invokeWhenHeapUnlocked(n)})(e,n,(()=>t(e,n,r)))}}(),rt._internal.applyHotReload=(e,t,n,r,o)=>{ht.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDelta",e,t,n,r,o??null)},rt._internal.getApplyUpdateCapabilities=()=>ht.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","GetApplyUpdateCapabilities"),rt._internal.invokeJSJson=nn,rt._internal.endInvokeDotNetFromJS=rn,rt._internal.receiveWebAssemblyDotNetDataStream=on,rt._internal.receiveByteArray=sn;const i=(t=vt,t);rt.platform=i,rt._internal.renderBatch=(e,t)=>{const n=vt.beginHeapLock();try{!function(e,t){const n=he[e];if(!n)throw new Error(`There is no browser renderer with ID ${e}.`);const r=t.arrayRangeReader,o=t.updatedComponents(),i=r.values(o),s=r.count(o),a=t.referenceFrames(),c=r.values(a),l=t.diffReader;for(let e=0;e{await ht.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t,n)}),(async(e,t,n,r)=>{const o=await ht.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChangingAsync",t,n,r);rt._internal.navigationManager.endLocationChanging(e,o)}));const s=new Xt(e);rt._internal.registeredComponents={getRegisteredComponentsCount:()=>s.getCount(),getAssembly:e=>s.getAssembly(e),getTypeName:e=>s.getTypeName(e),getParameterDefinitions:e=>s.getParameterDefinitions(e)||"",getParameterValues:e=>s.getParameterValues(e)||""},rt._internal.getPersistedState=()=>Ot(document)||"",rt._internal.getInitialComponentsUpdate=()=>Yt,rt._internal.updateRootComponents=e=>rt._internal.dotNetExports?.UpdateRootComponentsCore(e),rt._internal.endUpdateRootComponents=t=>e.onAfterUpdateRootComponents?.(t),rt._internal.attachRootComponentToElement=(e,t,n)=>{const r=s.resolveRegisteredElement(e);r?we(n,r,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=function(e){const t=h.get(e);if(t)return h.delete(e),t}(e)||document.querySelector(e);if(!i)throw new Error(`Could not find any element matching selector '${e}'.`);we(n,B(i,!0),t,o)}(e,t,n)};try{await o,await i.start()}catch(e){throw new Error(`Failed to start platform. Reason: ${e}`)}i.callEntryPoint(),bt.invokeAfterStartedCallbacks(rt),n()}function tn(){return jt??=(async()=>{await Gt;const e=Ht??{},t=Ht?.configureRuntime;e.configureRuntime=e=>{t?.(e)},await vt.load(e,zt)})(),jt}function nn(e,t,n,r,o){return 0!==o?(ht.beginInvokeJSFromDotNet(o,e,r,n,t),null):ht.invokeJSFromDotNet(e,r,n,t)}function rn(e,t,n){ht.endInvokeDotNetFromJS(e,t,n)}function on(e,t,n,r){!function(e,t,n,r,o){let i=nt.get(t);if(!i){const n=new ReadableStream({start(e){nt.set(t,e),i=e}});e.supplyDotNetStream(t,n)}o?(i.error(o),nt.delete(t)):0===r?(i.close(),nt.delete(t)):i.enqueue(n.length===r?n:n.subarray(0,r))}(ht,e,t,n,r)}function sn(e,t){ht.receiveByteArray(e,t)}class an{constructor(e){this.initialComponents=e}resolveRootComponent(e){return this.initialComponents[e]}}class cn{constructor(){this._eventListeners=new Map}static create(e){const t=new cn;return e.addEventListener=t.addEventListener.bind(t),e.removeEventListener=t.removeEventListener.bind(t),t}addEventListener(e,t){let n=this._eventListeners.get(e);n||(n=new Set,this._eventListeners.set(e,n)),n.add(t)}removeEventListener(e,t){this._eventListeners.get(e)?.delete(t)}dispatchEvent(e,t){const n=this._eventListeners.get(e);if(!n)return;const r={...t,type:e};for(const e of n)e(r)}}let ln=!1;async function un(e){if(ln)throw new Error("Blazor has already started.");ln=!0,Zt(Promise.resolve(e||{})),cn.create(rt);const t=xt(document,"webassembly"),n=new an(t);await Qt(n)}rt.start=un,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&un().catch(Ct)}(); +!function(){"use strict";var e;let t;var n,r;!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 u=0,d={[u]:new l(window)};d[0]._cachedFunctions.set("import",(e=>("string"==typeof e&&e.startsWith("./")&&(e=new URL(e.substr(2),document.baseURI).toString()),import(e))));let f,m=1;function h(e){t.push(e)}function p(e){if(e&&"object"==typeof e){d[m]=new l(e);const t={[n]:m};return m++,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=p(e);r[n]=t[n]}catch(t){throw new Error(`Cannot create a JSStreamReference from the value '${e}'.`)}return r}function b(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 v(e);return void 0===a?a=t:a&&(a=null),t},e.attachReviver=h,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=p,e.createJSStreamReference=g,e.disposeJSObjectReference=function(e){const t=e&&e[n];"number"==typeof t&&S(t)},function(e){e[e.Default=0]="Default",e[e.JSObjectReference=1]="JSObjectReference",e[e.JSStreamReference=2]="JSStreamReference",e[e.JSVoidResult=3]="JSVoidResult"}(f=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,r){const o=b(this,t),i=N(E(e,r)(...o||[]),n);return null==i?null:k(this,i)}beginInvokeJSFromDotNet(e,t,n,r,o){const i=new Promise((e=>{const r=b(this,n);e(E(t,o)(...r||[]))}));e&&i.then((t=>k(this,[e,!0,N(t,r)]))).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 r=t?b(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=k(this,r),i=this._dotNetCallDispatcher.invokeDotNetFromJS(e,t,n,o);return i?b(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=k(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 I;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 I;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 w(e){return e instanceof Error?`${e.message}\n${e.stack}`:e?e.toString():"null"}function E(e,t){const n=d[t];if(n)return n.findFunction(e);throw new Error(`JS object instance with ID ${t} does not exist (has it been disposed?).`)}function S(e){delete d[e]}e.findJSFunction=E,e.disposeJSObjectReferenceById=S;class C{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=C,h((function(e,t){if(t&&"object"==typeof t){if(t.hasOwnProperty(r))return new C(t[r],c);if(t.hasOwnProperty(n)){const e=t[n],r=d[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 A(n)}}return t}));class A{constructor(e){this._streamPromise=e}stream(){return this._streamPromise}async arrayBuffer(){return new Response(await this.stream()).arrayBuffer()}}class I{constructor(){this.streamPromise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}function N(e,t){switch(t){case f.Default:return e;case f.JSObjectReference:return p(e);case f.JSStreamReference:return g(e);case f.JSVoidResult:return null;default:throw new Error(`Invalid JS call result type '${t}'.`)}}let R=0;function k(e,t){R=0,c=e;const n=JSON.stringify(t,D);return c=void 0,n}function D(e,t){if(t instanceof C)return t.serializeAsArg();if(t instanceof Uint8Array){c.getDotNetCallDispatcher().sendByteArray(R,t);const e={[o]:R};return R++,e}return t}}(e||(e={})),function(e){e[e.prependFrame=1]="prependFrame",e[e.removeFrame=2]="removeFrame",e[e.setAttribute=3]="setAttribute",e[e.removeAttribute=4]="removeAttribute",e[e.updateText=5]="updateText",e[e.stepIn=6]="stepIn",e[e.stepOut=7]="stepOut",e[e.updateMarkup=8]="updateMarkup",e[e.permutationListEntry=9]="permutationListEntry",e[e.permutationListEnd=10]="permutationListEnd"}(n||(n={})),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",e[e.namedEvent=10]="namedEvent"}(r||(r={}));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 t?.browserEventName||e}function u(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}}}}),u(["copy","cut","paste"],{createEventArgs:e=>({type:e.type})}),u(["drag","dragend","dragenter","dragleave","dragover","dragstart","drop"],{createEventArgs:e=>{return{...f(t=e),dataTransfer:t.dataTransfer?{dropEffect:t.dataTransfer.dropEffect,effectAllowed:t.dataTransfer.effectAllowed,files:Array.from(t.dataTransfer.files).map((e=>e.name)),items:Array.from(t.dataTransfer.items).map((e=>({kind:e.kind,type:e.type}))),types:t.dataTransfer.types}:null};var t}}),u(["focus","blur","focusin","focusout"],{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,isComposing:t.isComposing};var t}}),u(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","mouseleave","mouseenter","dblclick"],{createEventArgs:e=>f(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{...f(t=e),pointerId:t.pointerId,width:t.width,height:t.height,pressure:t.pressure,tiltX:t.tiltX,tiltY:t.tiltY,pointerType:t.pointerType,isPrimary:t.isPrimary};var t}}),u(["wheel","mousewheel"],{createEventArgs:e=>{return{...f(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),u(["cancel","close","toggle"],{createEventArgs:()=>({})});const m=["date","datetime-local","month","time","week"],h=new Map;let p,g,b=0;const y={async add(e,t,n){if(!n)throw new Error("initialParameters must be an object, even if empty.");const r="__bl-dynamic-root:"+(++b).toString();h.set(r,e);const o=await E().invokeMethodAsync("AddRootComponent",t,r),i=new w(o,g[t]);return await i.setParameters(n),i}};class v{invoke(e){return this._callback(e)}setCallback(t){this._selfJSObjectReference||(this._selfJSObjectReference=e.createJSObjectReference(this)),this._callback=t}getJSObjectReference(){return this._selfJSObjectReference}dispose(){this._selfJSObjectReference&&e.disposeJSObjectReference(this._selfJSObjectReference)}}class 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 v)}setParameters(e){const t={},n=Object.entries(e||{}),r=n.length;for(const[e,r]of n){const n=this._jsEventCallbackWrappers.get(e.toLowerCase());n&&r?(n.setCallback(r),t[e]=n.getJSObjectReference()):t[e]=r}return E().invokeMethodAsync("SetRootComponentParameters",this._componentId,r,t)}async dispose(){if(null!==this._componentId){await E().invokeMethodAsync("RemoveRootComponent",this._componentId),this._componentId=null;for(const e of this._jsEventCallbackWrappers.values())e.dispose()}}}function E(){if(!p)throw new Error("Dynamic root components have not been enabled in this application.");return p}const S=new Map,C=[],A=new Map;function I(e,t,n){return R(e,t.eventHandlerId,(()=>N(e).invokeMethodAsync("DispatchEventAsync",t,n)))}function N(e){const t=S.get(e);if(!t)throw new Error(`No interop methods are registered for renderer ${e}`);return t}let R=(e,t,n)=>n();const k=O(["abort","blur","cancel","canplay","canplaythrough","change","close","cuechange","durationchange","emptied","ended","error","focus","load","loadeddata","loadedmetadata","loadend","loadstart","mouseenter","mouseleave","pointerenter","pointerleave","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","toggle","unload","volumechange","waiting","DOMNodeInsertedIntoDocument","DOMNodeRemovedFromDocument"]),D={submit:!0},_=O(["click","dblclick","mousedown","mousemove","mouseup"]);class T{static{this.nextEventDelegatorId=0}constructor(e){this.browserRendererId=e,this.afterClickCallbacks=[];const t=++T.nextEventDelegatorId;this.eventsCollectionKey=`_blazorEvents_${t}`,this.eventInfoStore=new F(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(k,e);let l=!1;for(;r;){const f=r,m=this.getEventHandlerInfosForElement(f,!1);if(m){const n=m.getHandler(e);if(n&&(u=f,d=t.type,!((u instanceof HTMLButtonElement||u instanceof HTMLInputElement||u instanceof HTMLTextAreaElement||u instanceof HTMLSelectElement)&&Object.prototype.hasOwnProperty.call(_,d)&&u.disabled))){if(!s){const n=c(e);i=n?.createEventArgs?n.createEventArgs(t):{},s=!0}Object.prototype.hasOwnProperty.call(D,t.type)&&t.preventDefault(),I(this.browserRendererId,{eventHandlerId:n.eventHandlerId,eventName:e,eventFieldInfo:o.fromEvent(n.renderingComponentId,t)},i)}m.stopPropagation(e)&&(l=!0),m.preventDefault(e)&&t.preventDefault()}r=a||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}}class F{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(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 O(e){const t={};return e.forEach((e=>{t[e]=!0})),t}const M=Symbol(),x=Symbol(),P=Symbol();function B(e,t){if(M in e)return e;const n=[];if(e.childNodes.length>0){if(!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");e.childNodes.forEach((t=>{const r=B(t,!0);r[x]=e,n.push(r)}))}return e[M]=n,e}function H(e){const t=K(e);for(;t.length;)z(e,0)}function j(e,t){const n=document.createComment("!");return J(n,e,t),n}function J(e,t,n){const r=e;let o=e;if(e instanceof Comment){const t=K(r);if(t?.length>0){const t=G(r),n=new Range;n.setStartBefore(e),n.setEndAfter(t),o=n.extractContents()}}const i=W(r);if(i){const e=K(i),t=Array.prototype.indexOf.call(e,r);e.splice(t,1),delete r[x]}const s=K(t);if(n0;)z(n,0)}const r=n;r.parentNode.removeChild(r)}function W(e){return e[x]||null}function $(e,t){return K(e)[t]}function U(e){const t=Y(e);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function K(e){return e[M]}function V(e){const t=K(W(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}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):q(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 Y(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 q(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):q(e,W(t))}}}function G(e){if(e instanceof Element||e instanceof DocumentFragment)return e;const t=V(e);if(t)return t.previousSibling;{const t=W(e);return t instanceof Element||t instanceof DocumentFragment?t.lastChild:G(t)}}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||=[];for(let n=0;n{Ne()&&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=e.composedPath&&e.composedPath();if(t)for(let e=0;e{const t=document.createElement("script");t.textContent=e.textContent,e.getAttributeNames().forEach((n=>{t.setAttribute(n,e.getAttribute(n))})),e.parentNode.replaceChild(t,e)})),ie.content));var s;let a=0;for(;i.firstChild;)J(i.firstChild,o,a++)}applyAttribute(e,t,n,r){const o=e.frameReader,i=o.attributeName(r),s=o.attributeEventHandlerId(r);if(s){const e=me(i);return void this.eventDelegator.setListener(n,e,s,t)}const a=o.attributeValue(r);this.setOrRemoveAttributeOrProperty(n,i,a)}insertFrameRange(e,t,n,r,o,i,s){const a=r;for(let a=i;a{Je(t,e)})},enableNavigationInterception:function(e){if(void 0!==pe&&pe!==e)throw new Error("Only one interactive runtime may enable navigation interception at a time.");pe=e},setHasLocationChangingListeners:function(e,t){const n=Te.get(e);if(!n)throw new Error(`Renderer with ID '${e}' is not listening for navigation events`);n.hasLocationChangingEventListeners=t},endLocationChanging:function(e,t){Le&&e===_e&&(Le(t),Le=null)},navigateTo:function(e,t){Me(e,t,!0)},refresh:function(e){!e&&Ce()?Ae(location.href,!0):location.reload()},getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href,scrollToElement:Se};function Me(e,t,n=!1){const r=Ie(e);!t.forceLoad&&Ee(r)?$e()?xe(r,!1,t.replaceHistoryEntry,t.historyEntryState,n):Ae(r,t.replaceHistoryEntry):function(e,t){if(location.href===e){const t=e+"?";history.replaceState(null,"",t),location.replace(e)}else t?location.replace(e):location.href=e}(e,t.replaceHistoryEntry)}async function xe(e,t,n,r=void 0,o=!1){if(He(),function(e){const t=new URL(e);return""!==t.hash&&location.origin===t.origin&&location.pathname===t.pathname&&location.search===t.search}(e))return Pe(e,n,r),void function(e){const t=e.indexOf("#");t!==e.length-1&&Se(e.substring(t+1))}(e);const i=We();(o||!i?.hasLocationChangingEventListeners||await je(e,r,t,i))&&(ve=!0,Pe(e,n,r),await Je(t))}function Pe(e,t,n=void 0){t?history.replaceState({userState:n,_index:De},"",e):(De++,history.pushState({userState:n,_index:De},"",e))}function Be(e){return new Promise((t=>{const n=Fe;Fe=()=>{Fe=n,t()},history.go(e)}))}function He(){Le&&(Le(!1),Le=null)}function je(e,t,n,r){return new Promise((o=>{He(),_e++,Le=o,r.locationChanging(_e,e,t,n)}))}async function Je(e,t){const n=t??location.href;await Promise.all(Array.from(Te,(async([t,r])=>{var o;o=t,S.has(o)&&await r.locationChanged(n,history.state?.userState,e)})))}async function ze(e){Fe&&$e()&&await Fe(e),De=history.state?._index??0}function We(){const e=Re();if(void 0!==e)return Te.get(e)}function $e(){return Ne()||!Ce()}const Ue={focus:function(e,t){if(e instanceof HTMLElement)e.focus({preventScroll:t});else{if(!(e instanceof SVGElement))throw new Error("Unable to focus an invalid element.");if(!e.hasAttribute("tabindex"))throw new Error("Unable to focus an SVG element that does not have a tabindex.");e.focus({preventScroll:t})}},focusBySelector:function(e){const t=document.querySelector(e);t&&(t.hasAttribute("tabindex")||(t.tabIndex=-1),t.focus({preventScroll:!0}))}},Ke={init:function(e,t,n,r=50){const o=Xe(t);(o||document.documentElement).style.overflowAnchor="none";const i=document.createRange();f(n.parentElement)&&(t.style.display="table-row",n.style.display="table-row");const s=new IntersectionObserver((function(r){r.forEach((r=>{if(!r.isIntersecting)return;i.setStartAfter(t),i.setEndBefore(n);const o=i.getBoundingClientRect().height,s=r.rootBounds?.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,o,s):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,o,s)}))}),{root:o,rootMargin:`${r}px`});s.observe(t),s.observe(n);const a=d(t),c=d(n),{observersByDotNetObjectId:l,id:u}=Ye(e);function d(e){const t={attributes:!0},n=new MutationObserver(((n,r)=>{f(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 f(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)}l[u]={intersectionObserver:s,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const{observersByDotNetObjectId:t,id:n}=Ye(e),r=t[n];r&&(r.intersectionObserver.disconnect(),r.mutationObserverBefore.disconnect(),r.mutationObserverAfter.disconnect(),e.dispose(),delete t[n])}},Ve=Symbol();function Xe(e){return e&&e!==document.body&&e!==document.documentElement?"visible"!==getComputedStyle(e).overflowY?e:Xe(e.parentElement):null}function Ye(e){const t=e._callDispatcher,n=e._id;return t[Ve]??={},{observersByDotNetObjectId:t[Ve],id:n}}const qe={getAndRemoveExistingTitle:function(){const e=document.head?document.head.getElementsByTagName("title"):[];if(0===e.length)return null;let t=null;for(let n=e.length-1;n>=0;n--){const r=e[n],o=r.previousSibling;o instanceof Comment&&null!==W(o)||(null===t&&(t=r.textContent),r.parentNode?.removeChild(r))}return t}},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=Ze(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){const t=Math.min(1,r/s.width),i=Math.min(1,o/s.height),a=Math.min(t,i),c=document.createElement("canvas");c.width=Math.round(s.width*a),c.height=Math.round(s.height*a),c.getContext("2d")?.drawImage(s,0,0,c.width,c.height),c.toBlob(e,n)})),c={id:++e._blazorInputFileNextFileId,lastModified:i.lastModified,name:i.name,size:a?.size||0,contentType:n,blob:a||i.blob};return e._blazorFilesById[c.id]=c,c},readFileData:async function(e,t){return Ze(e,t).blob}};function Ze(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,et={enableNavigationPrompt:function(e){0===Qe.size&&window.addEventListener("beforeunload",tt),Qe.add(e)},disableNavigationPrompt:function(e){Qe.delete(e),0===Qe.size&&window.removeEventListener("beforeunload",tt)}};function tt(e){e.preventDefault(),e.returnValue=!0}const nt=new Map,rt={navigateTo:function(e,t,n=!1){Me(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:y,runtime:{},_internal:{navigationManager:Oe,domWrapper:Ue,Virtualize:Ke,PageTitle:qe,InputFile:Ge,NavigationLock:et,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,o){if(S.has(t))throw new Error(`Interop methods are already registered for renderer ${t}`);S.set(t,n),r&&o&&Object.keys(r).length>0&&function(t,n,r){if(p)throw new Error("Dynamic root components have already been enabled.");p=t,g=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(t),r,o),A.get(t)?.[0]?.(),function(e){for(const t of C)t(e)}(t)}}};window.Blazor=rt;const ot=navigator,it=ot.userAgentData&&ot.userAgentData.brands,st=it&&it.length>0?it.some((e=>"Google Chrome"===e.brand||"Microsoft Edge"===e.brand||"Chromium"===e.brand)):window.chrome,at=ot.userAgentData?.platform??navigator.platform;function ct(e){return 0!==e.debugLevel&&(st||navigator.userAgent.includes("Firefox"))}let lt=!1;function ut(){const e=document.querySelector("#blazor-error-ui");e&&(e.style.display="block"),lt||(lt=!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()}})))}var dt,ft;!function(e){e[e.Default=0]="Default",e[e.Server=1]="Server",e[e.WebAssembly=2]="WebAssembly",e[e.WebView=3]="WebView"}(dt||(dt={})),function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(ft||(ft={}));class mt{constructor(e=!0,t,n,r=0){this.singleRuntime=e,this.logger=t,this.webRendererId=r,this.afterStartedCallbacks=[],n&&this.afterStartedCallbacks.push(...n)}async importInitializersAsync(e,t){await Promise.all(e.map((e=>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){if(e.singleRuntime){const{beforeStart:n,afterStarted:r,beforeWebAssemblyStart:s,afterWebAssemblyStarted:a,beforeServerStart:c,afterServerStarted:l}=o;let u=n;e.webRendererId===dt.Server&&c&&(u=c),e.webRendererId===dt.WebAssembly&&s&&(u=s);let d=r;return e.webRendererId===dt.Server&&l&&(d=l),e.webRendererId===dt.WebAssembly&&a&&(d=a),i(e,u,d,t)}return function(e,t,n){const o=n[0],{beforeStart:s,afterStarted:a,beforeWebStart:c,afterWebStarted:l,beforeWebAssemblyStart:u,afterWebAssemblyStarted:d,beforeServerStart:f,afterServerStarted:m}=t,h=!(c||l||u||d||f||m||!s&&!a),p=h&&o.enableClassicInitializers;if(h&&!o.enableClassicInitializers)e.logger?.log(ft.Warning,`Initializer '${r}' will be ignored because multiple runtimes are available. Use 'before(Web|WebAssembly|Server)Start' and 'after(Web|WebAssembly|Server)Started' instead.`);else if(p)return i(e,s,a,n);if(function(e){e.webAssembly?e.webAssembly.initializers||(e.webAssembly.initializers={beforeStart:[],afterStarted:[]}):e.webAssembly={initializers:{beforeStart:[],afterStarted:[]}},e.circuit?e.circuit.initializers||(e.circuit.initializers={beforeStart:[],afterStarted:[]}):e.circuit={initializers:{beforeStart:[],afterStarted:[]}}}(o),u&&o.webAssembly.initializers.beforeStart.push(u),d&&o.webAssembly.initializers.afterStarted.push(d),f&&o.circuit.initializers.beforeStart.push(f),m&&o.circuit.initializers.afterStarted.push(m),l&&e.afterStartedCallbacks.push(l),c)return c(o)}(e,o,t)}function i(e,t,n,r){if(n&&e.afterStartedCallbacks.push(n),t)return t(...r)}}(this,e))))}async invokeAfterStartedCallbacks(e){const t=(n=this.webRendererId,A.get(n)?.[1]);var n;t&&await t,await Promise.all(this.afterStartedCallbacks.map((t=>t(e))))}}let ht,pt,gt,bt,yt=null;const vt={load:function(e,t){return async function(e,t){const{dotnet:n}=await async function(e){if("undefined"==typeof WebAssembly||!WebAssembly.validate)throw new Error("This browser does not support WebAssembly.");let t="_framework/dotnet.js";if(e.loadBootResource){const n="dotnetjs",r=e.loadBootResource(n,"dotnet.js",t,"","js-module-dotnet");if("string"==typeof r)t=r;else if(r)throw new Error(`For a ${n} resource, custom loaders must supply a URI string.`)}const n=new URL(t,document.baseURI).toString();return await import(n)}(e),r=function(e,t){const n={maxParallelDownloads:1e6,enableDownloadRetry:!1,applicationEnvironment:e.environment},r={...window.Module||{},onConfigLoaded:async n=>{n.environmentVariables||(n.environmentVariables={}),"sharded"===n.globalizationMode&&(n.environmentVariables.__BLAZOR_SHARDED_ICU="1"),rt._internal.getApplicationEnvironment=()=>n.applicationEnvironment,t?.(n),bt=await async function(e,t){if(e.initializers)return await Promise.all(e.initializers.beforeStart.map((t=>t(e)))),new mt(!1,void 0,e.initializers.afterStarted,dt.WebAssembly);{const n=[e,t.resources?.extensions??{}],r=new mt(!0,void 0,void 0,dt.WebAssembly),o=Object.keys(t?.resources?.libraryInitializers||{});return await r.importInitializersAsync(o,n),r}}(e,n)},onDownloadResourceProgress:wt,config:n,out:St,err:Ct};return r}(e,t);e.applicationCulture&&n.withApplicationCulture(e.applicationCulture),e.environment&&n.withApplicationEnvironment(e.environment),e.loadBootResource&&n.withResourceLoader(e.loadBootResource),n.withModuleConfig(r),e.configureRuntime&&e.configureRuntime(n),gt=await n.create()}(e,t)},start:function(){return async function(){if(!gt)throw new Error("The runtime must be loaded it gets configured.");const{setModuleImports:t,INTERNAL:n,getConfig:r,invokeLibraryInitializers:o}=gt;pt=n,function(e){const t=at.match(/^Mac/i)?"Cmd":"Alt";ct(e)&&console.info(`Debugging hotkey: Shift+${t}+D (when application has focus)`),document.addEventListener("keydown",(t=>{t.shiftKey&&(t.metaKey||t.altKey)&&"KeyD"===t.code&&(ct(e)?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())}():st?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."))}))}(r()),rt.runtime=gt,rt._internal.dotNetCriticalError=Ct,t("blazor-internal",{Blazor:{_internal:rt._internal}});const i=await gt.getAssemblyExports("Microsoft.AspNetCore.Components.WebAssembly");return Object.assign(rt._internal,{dotNetExports:{...i.Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime}}),ht=e.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{if(At(),!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)=>(At(),rt._internal.dotNetExports.InvokeDotNet(e||null,t,n??0,r))}),{invokeLibraryInitializers:o}}()},callEntryPoint:async function(){try{await gt.runMain(gt.getConfig().mainAssemblyName,[])}catch(e){console.error(e),ut()}},getArrayEntryPtr:function(e,t,n){const r=function(e){return e+12}(e)+4+t*n;return r},getObjectFieldsBaseAddress:function(e){return e+8},readInt16Field:function(e,t){return gt.getHeapI16(e+(t||0))},readInt32Field:function(e,t){return gt.getHeapI32(e+(t||0))},readUint64Field:function(e,t){return gt.getHeapU52(e+(t||0))},readObjectField:function(e,t){return gt.getHeapU32(e+(t||0))},readStringField:function(e,t,n){const r=gt.getHeapU32(e+(t||0));if(0===r)return null;if(n){const e=pt.monoObjectAsBoolOrNullUnsafe(r);if("boolean"==typeof e)return e?"":null}return pt.monoStringToStringUnsafe(r)},readStructField:function(e,t){return e+(t||0)},beginHeapLock:function(){return At(),yt=It.create(),yt},invokeWhenHeapUnlocked:function(e){yt?yt.enqueuePostReleaseAction(e):e()}};function wt(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 Et=["DEBUGGING ENABLED"],St=e=>Et.indexOf(e)<0&&console.log(e),Ct=e=>{console.error(e||"(null)"),ut()};function At(){if(yt)throw new Error("Assertion failed - heap is currently locked")}class It{enqueuePostReleaseAction(e){this.postReleaseActions||(this.postReleaseActions=[]),this.postReleaseActions.push(e)}release(){if(yt!==this)throw new Error("Trying to release a lock which isn't current");for(pt.mono_wasm_gc_unlock(),yt=null;this.postReleaseActions?.length;)this.postReleaseActions.shift()(),At()}static create(){return pt.mono_wasm_gc_lock(),new It}}class Nt{constructor(e){this.batchAddress=e,this.arrayRangeReader=Rt,this.arrayBuilderSegmentReader=kt,this.diffReader=Dt,this.editReader=_t,this.frameReader=Tt}updatedComponents(){return t.readStructField(this.batchAddress,0)}referenceFrames(){return t.readStructField(this.batchAddress,Rt.structLength)}disposedComponentIds(){return t.readStructField(this.batchAddress,2*Rt.structLength)}disposedEventHandlerIds(){return t.readStructField(this.batchAddress,3*Rt.structLength)}updatedComponentsEntry(e,t){return Ft(e,t,Dt.structLength)}referenceFramesEntry(e,t){return Ft(e,t,Tt.structLength)}disposedComponentIdsEntry(e,n){const r=Ft(e,n,4);return t.readInt32Field(r)}disposedEventHandlerIdsEntry(e,n){const r=Ft(e,n,8);return t.readUint64Field(r)}}const Rt={structLength:8,values:e=>t.readObjectField(e,0),count:e=>t.readInt32Field(e,4)},kt={structLength:12,values:e=>{const n=t.readObjectField(e,0),r=t.getObjectFieldsBaseAddress(n);return t.readObjectField(r,0)},offset:e=>t.readInt32Field(e,4),count:e=>t.readInt32Field(e,8)},Dt={structLength:4+kt.structLength,componentId:e=>t.readInt32Field(e,0),edits:e=>t.readStructField(e,4),editsEntry:(e,t)=>Ft(e,t,_t.structLength)},_t={structLength:20,editType:e=>t.readInt32Field(e,0),siblingIndex:e=>t.readInt32Field(e,4),newTreeIndex:e=>t.readInt32Field(e,8),moveToSiblingIndex:e=>t.readInt32Field(e,8),removedAttributeName:e=>t.readStringField(e,16)},Tt={structLength:36,frameType:e=>t.readInt16Field(e,4),subtreeLength:e=>t.readInt32Field(e,8),elementReferenceCaptureId:e=>t.readStringField(e,16),componentId:e=>t.readInt32Field(e,12),elementName:e=>t.readStringField(e,16),textContent:e=>t.readStringField(e,16),markupContent:e=>t.readStringField(e,16),attributeName:e=>t.readStringField(e,16),attributeValue:e=>t.readStringField(e,24,!0),attributeEventHandlerId:e=>t.readUint64Field(e,8)};function Ft(e,n,r){return t.getArrayEntryPtr(e,n,r)}const Lt=/^\s*Blazor-WebAssembly-Component-State:(?[a-zA-Z0-9+/=]+)$/;function Ot(e){return Mt(e,Lt)}function Mt(e,t,n="state"){if(e.nodeType===Node.COMMENT_NODE){const r=e.textContent||"",o=t.exec(r),i=o&&o.groups&&o.groups[n];return i&&e.parentNode?.removeChild(e),i}if(!e.hasChildNodes())return;const r=e.childNodes;for(let e=0;e.*)$/);function Bt(e,t){const n=e.currentElement;var r,o,i;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const s=Pt.exec(n.textContent),a=s&&s.groups&&s.groups.descriptor;if(!a)return;!function(e){if(e.parentNode instanceof Document)throw new Error("Root components cannot be marked as interactive. The element must be rendered statically so that scripts are not evaluated multiple times.")}(n);try{const s=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n&&"auto"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(a),c=function(e,t,n){const{prerenderId:r}=e;if(r){for(;n.next()&&n.currentElement;){const e=n.currentElement;if(e.nodeType!==Node.COMMENT_NODE)continue;if(!e.textContent)continue;const t=Pt.exec(e.textContent),o=t&&t[1];if(o)return Kt(o,r),e}throw new Error(`Could not find an end component comment for '${t}'.`)}}(s,n,e);if(t!==s.type)return;switch(s.type){case"webassembly":return o=n,i=c,Ut(r=s),{...r,uniqueId:Wt++,start:o,end:i};case"server":return function(e,t,n){return $t(e),{...e,uniqueId:Wt++,start:t,end:n}}(s,n,c);case"auto":return function(e,t,n){return $t(e),Ut(e),{...e,uniqueId:Wt++,start:t,end:n}}(s,n,c)}}catch(e){throw new Error(`Found malformed component comment at ${n.textContent}`)}}}let Ht,jt,Jt,zt,Wt=0;function $t(e){const{descriptor:t,sequence:n}=e;if(!t)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===n)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(n))throw new Error(`Error parsing the sequence '${n}' for component '${JSON.stringify(e)}'`)}function Ut(e){const{assembly:t,typeName:n}=e;if(!t)throw new Error("assembly must be defined when using a descriptor.");if(!n)throw new Error("typeName must be defined when using a descriptor.");e.parameterDefinitions=e.parameterDefinitions&&atob(e.parameterDefinitions),e.parameterValues=e.parameterValues&&atob(e.parameterValues)}function Kt(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 Vt{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndex{zt=e}));const Yt=new Promise((e=>{}));let qt;const Gt=new Promise((e=>{qt=e}));function Zt(e){if(Ht)throw new Error("WebAssembly options have already been configured.");!async function(e){const t=await e;Ht=t,qt()}(e)}function Qt(e){if(void 0!==Jt)throw new Error("Blazor WebAssembly has already started.");return Jt=new Promise(en.bind(null,e)),Jt}async function en(e,n,r){(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((()=>{}));const o=tn();!function(e){const t=R;R=(e,n,r)=>{((e,t,n)=>{const r=function(e){return he[e]}(e);r?.eventDelegator.getHandler(t)&&vt.invokeWhenHeapUnlocked(n)})(e,n,(()=>t(e,n,r)))}}(),rt._internal.applyHotReload=(e,t,n,r,o)=>{ht.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDelta",e,t,n,r,o??null)},rt._internal.applyHotReloadDeltas=(e,t)=>ht.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","ApplyHotReloadDeltas",e,t),rt._internal.getApplyUpdateCapabilities=()=>ht.invokeDotNetStaticMethod("Microsoft.AspNetCore.Components.WebAssembly","GetApplyUpdateCapabilities"),rt._internal.invokeJSJson=nn,rt._internal.endInvokeDotNetFromJS=rn,rt._internal.receiveWebAssemblyDotNetDataStream=on,rt._internal.receiveByteArray=sn;const i=(t=vt,t);rt.platform=i,rt._internal.renderBatch=(e,t)=>{const n=vt.beginHeapLock();try{!function(e,t){const n=he[e];if(!n)throw new Error(`There is no browser renderer with ID ${e}.`);const r=t.arrayRangeReader,o=t.updatedComponents(),i=r.values(o),s=r.count(o),a=t.referenceFrames(),c=r.values(a),l=t.diffReader;for(let e=0;e{await ht.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChanged",e,t,n)}),(async(e,t,n,r)=>{const o=await ht.invokeDotNetStaticMethodAsync("Microsoft.AspNetCore.Components.WebAssembly","NotifyLocationChangingAsync",t,n,r);rt._internal.navigationManager.endLocationChanging(e,o)}));const s=new Xt(e);rt._internal.registeredComponents={getRegisteredComponentsCount:()=>s.getCount(),getAssembly:e=>s.getAssembly(e),getTypeName:e=>s.getTypeName(e),getParameterDefinitions:e=>s.getParameterDefinitions(e)||"",getParameterValues:e=>s.getParameterValues(e)||""},rt._internal.getPersistedState=()=>Ot(document)||"",rt._internal.getInitialComponentsUpdate=()=>Yt,rt._internal.updateRootComponents=e=>rt._internal.dotNetExports?.UpdateRootComponentsCore(e),rt._internal.endUpdateRootComponents=t=>e.onAfterUpdateRootComponents?.(t),rt._internal.attachRootComponentToElement=(e,t,n)=>{const r=s.resolveRegisteredElement(e);r?we(n,r,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=function(e){const t=h.get(e);if(t)return h.delete(e),t}(e)||document.querySelector(e);if(!i)throw new Error(`Could not find any element matching selector '${e}'.`);we(n,B(i,!0),t,o)}(e,t,n)};try{await o,await i.start()}catch(e){throw new Error(`Failed to start platform. Reason: ${e}`)}i.callEntryPoint(),bt.invokeAfterStartedCallbacks(rt),n()}function tn(){return jt??=(async()=>{await Gt;const e=Ht??{},t=Ht?.configureRuntime;e.configureRuntime=e=>{t?.(e)},await vt.load(e,zt)})(),jt}function nn(e,t,n,r,o){return 0!==o?(ht.beginInvokeJSFromDotNet(o,e,r,n,t),null):ht.invokeJSFromDotNet(e,r,n,t)}function rn(e,t,n){ht.endInvokeDotNetFromJS(e,t,n)}function on(e,t,n,r){!function(e,t,n,r,o){let i=nt.get(t);if(!i){const n=new ReadableStream({start(e){nt.set(t,e),i=e}});e.supplyDotNetStream(t,n)}o?(i.error(o),nt.delete(t)):0===r?(i.close(),nt.delete(t)):i.enqueue(n.length===r?n:n.subarray(0,r))}(ht,e,t,n,r)}function sn(e,t){ht.receiveByteArray(e,t)}class an{constructor(e){this.initialComponents=e}resolveRootComponent(e){return this.initialComponents[e]}}class cn{constructor(){this._eventListeners=new Map}static create(e){const t=new cn;return e.addEventListener=t.addEventListener.bind(t),e.removeEventListener=t.removeEventListener.bind(t),t}addEventListener(e,t){let n=this._eventListeners.get(e);n||(n=new Set,this._eventListeners.set(e,n)),n.add(t)}removeEventListener(e,t){this._eventListeners.get(e)?.delete(t)}dispatchEvent(e,t){const n=this._eventListeners.get(e);if(!n)return;const r={...t,type:e};for(const e of n)e(r)}}let ln=!1;async function un(e){if(ln)throw new Error("Blazor has already started.");ln=!0,Zt(Promise.resolve(e||{})),cn.create(rt);const t=xt(document,"webassembly"),n=new an(t);await Qt(n)}rt.start=un,window.DotNet=e,document&&document.currentScript&&"false"!==document.currentScript.getAttribute("autostart")&&un().catch(Ct)}(); diff --git a/src/Components/Web.JS/src/Boot.WebAssembly.Common.ts b/src/Components/Web.JS/src/Boot.WebAssembly.Common.ts index dde64d499d0..b31a1c4b356 100644 --- a/src/Components/Web.JS/src/Boot.WebAssembly.Common.ts +++ b/src/Components/Web.JS/src/Boot.WebAssembly.Common.ts @@ -97,10 +97,15 @@ async function startCore(components: RootComponentManager { dispatcher.invokeDotNetStaticMethod('Microsoft.AspNetCore.Components.WebAssembly', 'ApplyHotReloadDelta', id, metadataDelta, ilDelta, pdbDelta, updatedTypes ?? null); }; + Blazor._internal.applyHotReloadDeltas = (deltas: { moduleId: string, metadataDelta: string, ilDelta: string, pdbDelta: string, updatedTypes: number[] }[], loggingLevel: number) => { + return dispatcher.invokeDotNetStaticMethod('Microsoft.AspNetCore.Components.WebAssembly', 'ApplyHotReloadDeltas', deltas, loggingLevel); + }; + Blazor._internal.getApplyUpdateCapabilities = () => dispatcher.invokeDotNetStaticMethod('Microsoft.AspNetCore.Components.WebAssembly', 'GetApplyUpdateCapabilities'); // Configure JS interop diff --git a/src/Components/Web.JS/src/GlobalExports.ts b/src/Components/Web.JS/src/GlobalExports.ts index b285450182d..71d9b052c17 100644 --- a/src/Components/Web.JS/src/GlobalExports.ts +++ b/src/Components/Web.JS/src/GlobalExports.ts @@ -89,7 +89,11 @@ export interface IBlazor { } // APIs invoked by hot reload + + // obsolete: applyHotReload?: (id: string, metadataDelta: string, ilDelta: string, pdbDelta: string | undefined, updatedTypes?: number[]) => void; + + applyHotReloadDeltas?: (deltas: { moduleId: string, metadataDelta: string, ilDelta: string, pdbDelta: string, updatedTypes: number[] }[], loggingLevel: number) => {message: string, severity: number}[]; getApplyUpdateCapabilities?: () => string; hotReloadApplied?: () => void; } diff --git a/src/Components/WebAssembly/WebAssembly/src/HotReload/AgentMessageSeverity.cs b/src/Components/WebAssembly/WebAssembly/src/HotReload/AgentMessageSeverity.cs new file mode 100644 index 00000000000..3ab84cecde9 --- /dev/null +++ b/src/Components/WebAssembly/WebAssembly/src/HotReload/AgentMessageSeverity.cs @@ -0,0 +1,11 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.DotNet.HotReload; + +internal enum AgentMessageSeverity : byte +{ + Verbose = 0, + Warning = 1, + Error = 2, +} diff --git a/src/Components/WebAssembly/WebAssembly/src/HotReload/AgentReporter.cs b/src/Components/WebAssembly/WebAssembly/src/HotReload/AgentReporter.cs new file mode 100644 index 00000000000..0950dac4e38 --- /dev/null +++ b/src/Components/WebAssembly/WebAssembly/src/HotReload/AgentReporter.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq; + +namespace Microsoft.DotNet.HotReload; + +internal sealed class AgentReporter +{ + private readonly List<(string message, AgentMessageSeverity severity)> _log = []; + + public void Report(string message, AgentMessageSeverity severity) + { + _log.Add((message, severity)); + } + + public IReadOnlyCollection<(string message, AgentMessageSeverity severity)> GetAndClearLogEntries(ResponseLoggingLevel level) + { + lock (_log) + { + var filteredLog = (level != ResponseLoggingLevel.Verbose) + ? _log.Where(static entry => entry.severity != AgentMessageSeverity.Verbose) + : _log; + + var log = filteredLog.ToArray(); + _log.Clear(); + return log; + } + } +} diff --git a/src/Components/WebAssembly/WebAssembly/src/HotReload/HotReloadAgent.cs b/src/Components/WebAssembly/WebAssembly/src/HotReload/HotReloadAgent.cs index 76606a3264e..b2c50556be7 100644 --- a/src/Components/WebAssembly/WebAssembly/src/HotReload/HotReloadAgent.cs +++ b/src/Components/WebAssembly/WebAssembly/src/HotReload/HotReloadAgent.cs @@ -1,37 +1,105 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -// Based on the implementation in https://raw.githubusercontent.com/dotnet/sdk/aad0424c0bfaa60c8bd136a92fd131e53d14561a/src/BuiltInTools/DotNetDeltaApplier/HotReloadAgent.cs - using System.Collections.Concurrent; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; -namespace Microsoft.Extensions.HotReload; +namespace Microsoft.DotNet.HotReload; +#if NET +[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Hot reload is only expected to work when trimming is disabled.")] +#endif internal sealed class HotReloadAgent : IDisposable { - /// Flags for hot reload handler Types like MVC's HotReloadService. - private const DynamicallyAccessedMemberTypes HotReloadHandlerLinkerFlags = DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods; + private const string MetadataUpdaterTypeName = "System.Reflection.Metadata.MetadataUpdater"; + private const string ApplyUpdateMethodName = "ApplyUpdate"; + private const string GetCapabilitiesMethodName = "GetCapabilities"; + + private delegate void ApplyUpdateDelegate(Assembly assembly, ReadOnlySpan metadataDelta, ReadOnlySpan ilDelta, ReadOnlySpan pdbDelta); - private readonly Action _log; - private readonly AssemblyLoadEventHandler _assemblyLoad; private readonly ConcurrentDictionary> _deltas = new(); private readonly ConcurrentDictionary _appliedAssemblies = new(); - private volatile UpdateHandlerActions? _handlerActions; + private readonly ApplyUpdateDelegate _applyUpdate; + private readonly MetadataUpdateHandlerInvoker _metadataUpdateHandlerInvoker; - public HotReloadAgent(Action log) + public AgentReporter Reporter { get; } + public string Capabilities { get; } + + private HotReloadAgent(AgentReporter reporter, ApplyUpdateDelegate applyUpdate, string capabilities) { - _log = log; - _assemblyLoad = OnAssemblyLoad; - AppDomain.CurrentDomain.AssemblyLoad += _assemblyLoad; + Reporter = reporter; + _metadataUpdateHandlerInvoker = new(reporter); + _applyUpdate = applyUpdate; + Capabilities = capabilities; + + AppDomain.CurrentDomain.AssemblyLoad += OnAssemblyLoad; + } + + public static bool TryCreate(AgentReporter reporter, [NotNullWhen(true)] out HotReloadAgent? agent) + { + GetUpdaterMethodsAndCapabilities(reporter, out var applyUpdate, out var capabilities); + if (applyUpdate != null && !string.IsNullOrEmpty(capabilities)) + { + agent = new HotReloadAgent(reporter, applyUpdate, capabilities); + return true; + } + + agent = null; + return false; + } + + public void Dispose() + { + AppDomain.CurrentDomain.AssemblyLoad -= OnAssemblyLoad; + } + + private static void GetUpdaterMethodsAndCapabilities(AgentReporter reporter, out ApplyUpdateDelegate? applyUpdate, out string? capabilities) + { + applyUpdate = null; + capabilities = null; + + var metadataUpdater = Type.GetType(MetadataUpdaterTypeName + ", System.Runtime.Loader", throwOnError: false); + if (metadataUpdater == null) + { + reporter.Report($"Type not found: {MetadataUpdaterTypeName}", AgentMessageSeverity.Error); + return; + } + + var applyUpdateMethod = metadataUpdater.GetMethod(ApplyUpdateMethodName, BindingFlags.Public | BindingFlags.Static, binder: null, [typeof(Assembly), typeof(ReadOnlySpan), typeof(ReadOnlySpan), typeof(ReadOnlySpan)], modifiers: null); + if (applyUpdateMethod == null) + { + reporter.Report($"{MetadataUpdaterTypeName}.{ApplyUpdateMethodName} not found.", AgentMessageSeverity.Error); + return; + } + + applyUpdate = (ApplyUpdateDelegate)applyUpdateMethod.CreateDelegate(typeof(ApplyUpdateDelegate)); + + var getCapabilities = metadataUpdater.GetMethod(GetCapabilitiesMethodName, BindingFlags.NonPublic | BindingFlags.Static, binder: null, Type.EmptyTypes, modifiers: null); + if (getCapabilities == null) + { + reporter.Report($"{MetadataUpdaterTypeName}.{GetCapabilitiesMethodName} not found.", AgentMessageSeverity.Error); + return; + } + + try + { + capabilities = getCapabilities.Invoke(obj: null, parameters: null) as string; + } + catch (Exception e) + { + reporter.Report($"Error retrieving capabilities: {e.Message}", AgentMessageSeverity.Error); + } } private void OnAssemblyLoad(object? _, AssemblyLoadEventArgs eventArgs) { - _handlerActions = null; + _metadataUpdateHandlerInvoker.Clear(); + var loadedAssembly = eventArgs.LoadedAssembly; var moduleId = TryGetModuleId(loadedAssembly); if (moduleId is null) @@ -46,185 +114,29 @@ internal sealed class HotReloadAgent : IDisposable } } - internal sealed class UpdateHandlerActions + public void ApplyDeltas(IEnumerable deltas) { - public List> ClearCache { get; } = new(); - public List> UpdateApplication { get; } = new(); - } - - [UnconditionalSuppressMessage("Trimmer", "IL2072", - Justification = "The handlerType passed to GetHandlerActions is preserved by MetadataUpdateHandlerAttribute with DynamicallyAccessedMemberTypes.All.")] - private UpdateHandlerActions GetMetadataUpdateHandlerActions() - { - // We need to execute MetadataUpdateHandlers in a well-defined order. For v1, the strategy that is used is to topologically - // sort assemblies so that handlers in a dependency are executed before the dependent (e.g. the reflection cache action - // in System.Private.CoreLib is executed before System.Text.Json clears it's own cache.) - // This would ensure that caches and updates more lower in the application stack are up to date - // before ones higher in the stack are recomputed. - var sortedAssemblies = TopologicalSort(AppDomain.CurrentDomain.GetAssemblies()); - var handlerActions = new UpdateHandlerActions(); - foreach (var assembly in sortedAssemblies) + foreach (var delta in deltas) { - foreach (var attr in assembly.GetCustomAttributesData()) - { - // Look up the attribute by name rather than by type. This would allow netstandard targeting libraries to - // define their own copy without having to cross-compile. - if (attr.AttributeType.FullName != "System.Reflection.Metadata.MetadataUpdateHandlerAttribute") - { - continue; - } + Reporter.Report($"Applying delta to module {delta.ModuleId}.", AgentMessageSeverity.Verbose); - IList ctorArgs = attr.ConstructorArguments; - if (ctorArgs.Count != 1 || - ctorArgs[0].Value is not Type handlerType) - { - _log($"'{attr}' found with invalid arguments."); - continue; - } - - GetHandlerActions(handlerActions, handlerType); - } - } - - return handlerActions; - } - - internal void GetHandlerActions( - UpdateHandlerActions handlerActions, - [DynamicallyAccessedMembers(HotReloadHandlerLinkerFlags)] Type handlerType) - { - bool methodFound = false; - - if (GetUpdateMethod(handlerType, "ClearCache") is MethodInfo clearCache) - { - handlerActions.ClearCache.Add(CreateAction(clearCache)); - methodFound = true; - } - - if (GetUpdateMethod(handlerType, "UpdateApplication") is MethodInfo updateApplication) - { - handlerActions.UpdateApplication.Add(CreateAction(updateApplication)); - methodFound = true; - } - - if (!methodFound) - { - _log($"No invokable methods found on metadata handler type '{handlerType}'. " + - $"Allowed methods are ClearCache, UpdateApplication"); - } - - Action CreateAction(MethodInfo update) - { - Action action = update.CreateDelegate>(); - return types => - { - try - { - action(types); - } - catch (Exception ex) - { - _log($"Exception from '{action}': {ex}"); - } - }; - } - - MethodInfo? GetUpdateMethod([DynamicallyAccessedMembers(HotReloadHandlerLinkerFlags)] Type handlerType, string name) - { - if (handlerType.GetMethod(name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static, new[] { typeof(Type[]) }) is MethodInfo updateMethod && - updateMethod.ReturnType == typeof(void)) - { - return updateMethod; - } - - foreach (MethodInfo method in handlerType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance)) - { - if (method.Name == name) - { - _log($"Type '{handlerType}' has method '{method}' that does not match the required signature."); - break; - } - } - - return null; - } - } - - internal static List TopologicalSort(Assembly[] assemblies) - { - var sortedAssemblies = new List(assemblies.Length); - - var visited = new HashSet(StringComparer.Ordinal); - - foreach (var assembly in assemblies) - { - Visit(assemblies, assembly, sortedAssemblies, visited); - } - - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Hot reload is only expected to work when trimming is disabled.")] - static void Visit(Assembly[] assemblies, Assembly assembly, List sortedAssemblies, HashSet visited) - { - var assemblyIdentifier = assembly.GetName().Name!; - if (!visited.Add(assemblyIdentifier)) - { - return; - } - - foreach (var dependencyName in assembly.GetReferencedAssemblies()) - { - var dependency = Array.Find(assemblies, a => a.GetName().Name == dependencyName.Name); - if (dependency is not null) - { - Visit(assemblies, dependency, sortedAssemblies, visited); - } - } - - sortedAssemblies.Add(assembly); - } - - return sortedAssemblies; - } - - public void ApplyDeltas(IReadOnlyList deltas) - { - for (var i = 0; i < deltas.Count; i++) - { - var item = deltas[i]; foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { - if (TryGetModuleId(assembly) is Guid moduleId && moduleId == item.ModuleId) + if (TryGetModuleId(assembly) is Guid moduleId && moduleId == delta.ModuleId) { - MetadataUpdater.ApplyUpdate(assembly, item.MetadataDelta, item.ILDelta, item.PdbBytes ?? ReadOnlySpan.Empty); + _applyUpdate(assembly, delta.MetadataDelta, delta.ILDelta, delta.PdbDelta); } } // Additionally stash the deltas away so it may be applied to assemblies loaded later. - var cachedDeltas = _deltas.GetOrAdd(item.ModuleId, static _ => new()); - cachedDeltas.Add(item); + var cachedDeltas = _deltas.GetOrAdd(delta.ModuleId, static _ => new()); + cachedDeltas.Add(delta); } - try - { - // Defer discovering metadata updata handlers until after hot reload deltas have been applied. - // This should give enough opportunity for AppDomain.GetAssemblies() to be sufficiently populated. - _handlerActions ??= GetMetadataUpdateHandlerActions(); - var handlerActions = _handlerActions; - - Type[]? updatedTypes = GetMetadataUpdateTypes(deltas); - - handlerActions.ClearCache.ForEach(a => a(updatedTypes)); - handlerActions.UpdateApplication.ForEach(a => a(updatedTypes)); - - _log("Deltas applied."); - } - catch (Exception ex) - { - _log(ex.ToString()); - } + _metadataUpdateHandlerInvoker.Invoke(GetMetadataUpdateTypes(deltas)); } - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Hot reload is only expected to work when trimming is disabled.")] - private static Type[] GetMetadataUpdateTypes(IReadOnlyList deltas) + private Type[] GetMetadataUpdateTypes(IEnumerable deltas) { List? types = null; @@ -236,44 +148,45 @@ internal sealed class HotReloadAgent : IDisposable continue; } - var assemblyTypes = assembly.GetTypes(); - - foreach (var updatedType in delta.UpdatedTypes ?? Array.Empty()) + foreach (var updatedType in delta.UpdatedTypes) { - var type = assemblyTypes.FirstOrDefault(t => t.MetadataToken == updatedType); - if (type != null) + // Must be a TypeDef. + Debug.Assert(MetadataTokens.EntityHandle(updatedType) is { Kind: HandleKind.TypeDefinition, IsNil: false }); + + // The type has to be in the manifest module since Hot Reload does not support multi-module assemblies: + try { + var type = assembly.ManifestModule.ResolveType(updatedType); types ??= new(); types.Add(type); } + catch (Exception e) + { + Reporter.Report($"Failed to load type 0x{updatedType:X8}: {e.Message}", AgentMessageSeverity.Warning); + } } } return types?.ToArray() ?? Type.EmptyTypes; } - public void ApplyDeltas(Assembly assembly, IReadOnlyList deltas) + private void ApplyDeltas(Assembly assembly, IReadOnlyList deltas) { try { foreach (var item in deltas) { - MetadataUpdater.ApplyUpdate(assembly, item.MetadataDelta, item.ILDelta, ReadOnlySpan.Empty); + _applyUpdate(assembly, item.MetadataDelta, item.ILDelta, item.PdbDelta); } - _log("Deltas applied."); + Reporter.Report("Deltas applied.", AgentMessageSeverity.Verbose); } catch (Exception ex) { - _log(ex.ToString()); + Reporter.Report(ex.ToString(), AgentMessageSeverity.Warning); } } - public void Dispose() - { - AppDomain.CurrentDomain.AssemblyLoad -= _assemblyLoad; - } - private static Guid? TryGetModuleId(Assembly loadedAssembly) { try diff --git a/src/Components/WebAssembly/WebAssembly/src/HotReload/MetadataUpdateHandlerInvoker.cs b/src/Components/WebAssembly/WebAssembly/src/HotReload/MetadataUpdateHandlerInvoker.cs new file mode 100644 index 00000000000..fab00eb691c --- /dev/null +++ b/src/Components/WebAssembly/WebAssembly/src/HotReload/MetadataUpdateHandlerInvoker.cs @@ -0,0 +1,244 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics.CodeAnalysis; +using System.Reflection; + +namespace Microsoft.DotNet.HotReload; + +/// +/// Finds and invokes metadata update handlers. +/// +#if NET +[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Hot reload is only expected to work when trimming is disabled.")] +[UnconditionalSuppressMessage("Trimming", "IL2070", Justification = "Hot reload is only expected to work when trimming is disabled.")] +#endif +internal sealed class MetadataUpdateHandlerInvoker(AgentReporter reporter) +{ + internal sealed class RegisteredActions(IReadOnlyList> clearCache, IReadOnlyList> updateApplication) + { + public void Invoke(Type[] updatedTypes) + { + foreach (var action in clearCache) + { + action(updatedTypes); + } + + foreach (var action in updateApplication) + { + action(updatedTypes); + } + } + + /// + /// For testing. + /// + internal IEnumerable> ClearCache => clearCache; + + /// + /// For testing. + /// + internal IEnumerable> UpdateApplication => updateApplication; + } + + private const string ClearCacheHandlerName = "ClearCache"; + private const string UpdateApplicationHandlerName = "UpdateApplication"; + + private RegisteredActions? _actions; + + /// + /// Call when a new assembly is loaded. + /// + internal void Clear() + => Interlocked.Exchange(ref _actions, null); + + /// + /// Invokes all registerd handlers. + /// + internal void Invoke(Type[] updatedTypes) + { + try + { + // Defer discovering metadata updata handlers until after hot reload deltas have been applied. + // This should give enough opportunity for AppDomain.GetAssemblies() to be sufficiently populated. + var actions = _actions; + if (actions == null) + { + Interlocked.CompareExchange(ref _actions, GetMetadataUpdateHandlerActions(), null); + actions = _actions; + } + + reporter.Report($"Invoking metadata update handlers. {updatedTypes.Length} type(s) updated.", AgentMessageSeverity.Verbose); + + actions.Invoke(updatedTypes); + + reporter.Report("Deltas applied.", AgentMessageSeverity.Verbose); + } + catch (Exception e) + { + reporter.Report(e.ToString(), AgentMessageSeverity.Warning); + } + } + + private IEnumerable GetHandlerTypes() + { + // We need to execute MetadataUpdateHandlers in a well-defined order. For v1, the strategy that is used is to topologically + // sort assemblies so that handlers in a dependency are executed before the dependent (e.g. the reflection cache action + // in System.Private.CoreLib is executed before System.Text.Json clears its own cache.) + // This would ensure that caches and updates more lower in the application stack are up to date + // before ones higher in the stack are recomputed. + var sortedAssemblies = TopologicalSort(AppDomain.CurrentDomain.GetAssemblies()); + + foreach (var assembly in sortedAssemblies) + { + foreach (var attr in TryGetCustomAttributesData(assembly)) + { + // Look up the attribute by name rather than by type. This would allow netstandard targeting libraries to + // define their own copy without having to cross-compile. + if (attr.AttributeType.FullName != "System.Reflection.Metadata.MetadataUpdateHandlerAttribute") + { + continue; + } + + IList ctorArgs = attr.ConstructorArguments; + if (ctorArgs.Count != 1 || + ctorArgs[0].Value is not Type handlerType) + { + reporter.Report($"'{attr}' found with invalid arguments.", AgentMessageSeverity.Warning); + continue; + } + + yield return handlerType; + } + } + } + + public RegisteredActions GetMetadataUpdateHandlerActions() + => GetMetadataUpdateHandlerActions(GetHandlerTypes()); + + /// + /// Internal for testing. + /// + internal RegisteredActions GetMetadataUpdateHandlerActions(IEnumerable handlerTypes) + { + var clearCacheActions = new List>(); + var updateApplicationActions = new List>(); + + foreach (var handlerType in handlerTypes) + { + bool methodFound = false; + + if (GetUpdateMethod(handlerType, ClearCacheHandlerName) is MethodInfo clearCache) + { + clearCacheActions.Add(CreateAction(clearCache)); + methodFound = true; + } + + if (GetUpdateMethod(handlerType, UpdateApplicationHandlerName) is MethodInfo updateApplication) + { + updateApplicationActions.Add(CreateAction(updateApplication)); + methodFound = true; + } + + if (!methodFound) + { + reporter.Report( + $"Expected to find a static method '{ClearCacheHandlerName}' or '{UpdateApplicationHandlerName}' on type '{handlerType.AssemblyQualifiedName}' but neither exists.", + AgentMessageSeverity.Warning); + } + } + + return new RegisteredActions(clearCacheActions, updateApplicationActions); + + Action CreateAction(MethodInfo update) + { + var action = (Action)update.CreateDelegate(typeof(Action)); + return types => + { + try + { + action(types); + } + catch (Exception ex) + { + reporter.Report($"Exception from '{action}': {ex}", AgentMessageSeverity.Warning); + } + }; + } + + MethodInfo? GetUpdateMethod(Type handlerType, string name) + { + if (handlerType.GetMethod(name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static, binder: null, [typeof(Type[])], modifiers: null) is MethodInfo updateMethod && + updateMethod.ReturnType == typeof(void)) + { + return updateMethod; + } + + foreach (MethodInfo method in handlerType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance)) + { + if (method.Name == name) + { + reporter.Report($"Type '{handlerType}' has method '{method}' that does not match the required signature.", AgentMessageSeverity.Warning); + break; + } + } + + return null; + } + } + + private IList TryGetCustomAttributesData(Assembly assembly) + { + try + { + return assembly.GetCustomAttributesData(); + } + catch (Exception e) + { + // In cross-platform scenarios, such as debugging in VS through WSL, Roslyn + // runs on Windows, and the agent runs on Linux. Assemblies accessible to Windows + // may not be available or loaded on linux (such as WPF's assemblies). + // In such case, we can ignore the assemblies and continue enumerating handlers for + // the rest of the assemblies of current domain. + reporter.Report($"'{assembly.FullName}' is not loaded ({e.Message})", AgentMessageSeverity.Verbose); + return []; + } + } + + /// + /// Internal for testing. + /// + internal static List TopologicalSort(Assembly[] assemblies) + { + var sortedAssemblies = new List(assemblies.Length); + + var visited = new HashSet(StringComparer.Ordinal); + + foreach (var assembly in assemblies) + { + Visit(assemblies, assembly, sortedAssemblies, visited); + } + + static void Visit(Assembly[] assemblies, Assembly assembly, List sortedAssemblies, HashSet visited) + { + var assemblyIdentifier = assembly.GetName().Name!; + if (!visited.Add(assemblyIdentifier)) + { + return; + } + + foreach (var dependencyName in assembly.GetReferencedAssemblies()) + { + var dependency = Array.Find(assemblies, a => a.GetName().Name == dependencyName.Name); + if (dependency is not null) + { + Visit(assemblies, dependency, sortedAssemblies, visited); + } + } + + sortedAssemblies.Add(assembly); + } + + return sortedAssemblies; + } +} diff --git a/src/Components/WebAssembly/WebAssembly/src/HotReload/ResponseLoggingLevel.cs b/src/Components/WebAssembly/WebAssembly/src/HotReload/ResponseLoggingLevel.cs new file mode 100644 index 00000000000..dd05c372bf2 --- /dev/null +++ b/src/Components/WebAssembly/WebAssembly/src/HotReload/ResponseLoggingLevel.cs @@ -0,0 +1,10 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.DotNet.HotReload; + +internal enum ResponseLoggingLevel : byte +{ + WarningsAndErrors = 0, + Verbose = 1, +} diff --git a/src/Components/WebAssembly/WebAssembly/src/HotReload/UpdateDelta.cs b/src/Components/WebAssembly/WebAssembly/src/HotReload/UpdateDelta.cs index 6b8ee89cf58..d02b1c4d46b 100644 --- a/src/Components/WebAssembly/WebAssembly/src/HotReload/UpdateDelta.cs +++ b/src/Components/WebAssembly/WebAssembly/src/HotReload/UpdateDelta.cs @@ -1,17 +1,13 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.Extensions.HotReload; +namespace Microsoft.DotNet.HotReload; -internal sealed class UpdateDelta +internal readonly struct UpdateDelta(Guid moduleId, byte[] metadataDelta, byte[] ilDelta, byte[] pdbDelta, int[] updatedTypes) { - public Guid ModuleId { get; set; } - - public byte[] MetadataDelta { get; set; } = default!; - - public byte[] ILDelta { get; set; } = default!; - - public byte[]? PdbBytes { get; set; } - - public int[]? UpdatedTypes { get; set; } + public Guid ModuleId { get; } = moduleId; + public byte[] MetadataDelta { get; } = metadataDelta; + public byte[] ILDelta { get; } = ilDelta; + public byte[] PdbDelta { get; } = pdbDelta; + public int[] UpdatedTypes { get; } = updatedTypes; } diff --git a/src/Components/WebAssembly/WebAssembly/src/HotReload/WebAssemblyHotReload.cs b/src/Components/WebAssembly/WebAssembly/src/HotReload/WebAssemblyHotReload.cs index 8d3bcbd52e8..fc8eafc861f 100644 --- a/src/Components/WebAssembly/WebAssembly/src/HotReload/WebAssemblyHotReload.cs +++ b/src/Components/WebAssembly/WebAssembly/src/HotReload/WebAssemblyHotReload.cs @@ -2,13 +2,17 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; -using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Globalization; -using System.Reflection; -using System.Runtime.InteropServices.JavaScript; -using Microsoft.Extensions.HotReload; +using System.Linq; +using System.Net.Http; +using System.Text.Json; +using Microsoft.AspNetCore.Components.WebAssembly.Services; +using Microsoft.DotNet.HotReload; using Microsoft.JSInterop; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + namespace Microsoft.AspNetCore.Components.WebAssembly.HotReload; /// @@ -16,49 +20,143 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.HotReload; /// code. /// [EditorBrowsable(EditorBrowsableState.Never)] +[UnconditionalSuppressMessage( + "Trimming", + "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", + Justification = "Hot Reload does not support trimming")] public static partial class WebAssemblyHotReload { - private const string BlazorHotReloadModuleName = "blazor-hotreload"; - - private static HotReloadAgent? _hotReloadAgent; - private static readonly UpdateDelta[] _updateDeltas = new[] + /// + /// For framework use only. + /// + public readonly struct LogEntry { - new UpdateDelta(), - }; + public string Message { get; init; } + public int Severity { get; init; } + } + + /// + /// For framework use only. + /// + internal sealed class Update + { + public int Id { get; set; } + public Delta[] Deltas { get; set; } = default!; + } + + /// + /// For framework use only. + /// + public readonly struct Delta + { + public string ModuleId { get; init; } + public byte[] MetadataDelta { get; init; } + public byte[] ILDelta { get; init; } + public byte[] PdbDelta { get; init; } + public int[] UpdatedTypes { get; init; } + } + + private static readonly AgentReporter s_reporter = new(); + private static readonly JsonSerializerOptions s_jsonSerializerOptions = new(JsonSerializerDefaults.Web); + + private static bool s_initialized; + private static HotReloadAgent? s_hotReloadAgent; internal static async Task InitializeAsync() { if (Environment.GetEnvironmentVariable("__ASPNETCORE_BROWSER_TOOLS") == "true" && OperatingSystem.IsBrowser()) { - // Attempt to read previously applied hot reload deltas if the ASP.NET Core browser tools are available (indicated by the presence of the Environment variable). - // The agent is injected in to the hosted app and can serve this script that can provide results from local-storage. - // See https://github.com/dotnet/aspnetcore/issues/37357#issuecomment-941237000 - await JSHost.ImportAsync(BlazorHotReloadModuleName, "/_framework/blazor-hotreload.js"); - await ReceiveHotReloadAsync(); + s_initialized = true; + + if (!HotReloadAgent.TryCreate(s_reporter, out var agent)) + { + return; + } + + var existingAgent = Interlocked.CompareExchange(ref s_hotReloadAgent, agent, null); + if (existingAgent != null) + { + throw new InvalidOperationException("Hot Reload agent already initialized"); + } + + await ApplyPreviousDeltasAsync(agent); } } + private static async ValueTask ApplyPreviousDeltasAsync(HotReloadAgent agent) + { + string errorMessage; + + using var client = new HttpClient() + { + BaseAddress = new Uri(WebAssemblyNavigationManager.Instance.BaseUri, UriKind.Absolute) + }; + + try + { + var response = await client.GetAsync("/_framework/blazor-hotreload"); + if (response.IsSuccessStatusCode) + { + var deltasJson = await response.Content.ReadAsStringAsync(); + var updates = deltasJson != "" ? JsonSerializer.Deserialize(deltasJson, s_jsonSerializerOptions) : null; + if (updates == null) + { + s_reporter.Report($"No previous updates to apply.", AgentMessageSeverity.Verbose); + return; + } + + var i = 1; + foreach (var update in updates) + { + s_reporter.Report($"Reapplying update {i}/{updates.Length}.", AgentMessageSeverity.Verbose); + + agent.ApplyDeltas( + update.Deltas.Select(d => new UpdateDelta(Guid.Parse(d.ModuleId, CultureInfo.InvariantCulture), d.MetadataDelta, d.ILDelta, d.PdbDelta, d.UpdatedTypes))); + + i++; + } + + return; + } + + errorMessage = $"HTTP GET '/_framework/blazor-hotreload' returned {response.StatusCode}"; + } + catch (Exception e) + { + errorMessage = e.ToString(); + } + + s_reporter.Report($"Failed to retrieve and apply previous deltas from the server: ${errorMessage}", AgentMessageSeverity.Error); + } + + private static HotReloadAgent? GetAgent() + => s_hotReloadAgent ?? (s_initialized ? throw new InvalidOperationException("Hot Reload agent not initialized") : null); + + /// + /// For framework use only. + /// + [Obsolete("Use ApplyHotReloadDeltas instead")] + [JSInvokable(nameof(ApplyHotReloadDelta))] + public static void ApplyHotReloadDelta(string moduleIdString, byte[] metadataDelta, byte[] ilDelta, byte[] pdbBytes, int[]? updatedTypes) + { + GetAgent()?.ApplyDeltas( + [new UpdateDelta(Guid.Parse(moduleIdString, CultureInfo.InvariantCulture), metadataDelta, ilDelta, pdbBytes, updatedTypes ?? [])]); + } + /// /// For framework use only. /// - [JSInvokable(nameof(ApplyHotReloadDelta))] - public static void ApplyHotReloadDelta(string moduleIdString, byte[] metadataDelta, byte[] ilDelta, byte[] pdbBytes, int[]? updatedTypes) + [JSInvokable(nameof(ApplyHotReloadDeltas))] + public static LogEntry[] ApplyHotReloadDeltas(Delta[] deltas, int loggingLevel) { - // Analyzer has a bug where it doesn't handle ConditionalAttribute: https://github.com/dotnet/roslyn/issues/63464 -#pragma warning disable IDE0200 // Remove unnecessary lambda expression - Interlocked.CompareExchange(ref _hotReloadAgent, new HotReloadAgent(m => Debug.WriteLine(m)), null); -#pragma warning restore IDE0200 // Remove unnecessary lambda expression + var agent = GetAgent(); - var moduleId = Guid.Parse(moduleIdString, CultureInfo.InvariantCulture); + agent?.ApplyDeltas( + deltas.Select(d => new UpdateDelta(Guid.Parse(d.ModuleId, CultureInfo.InvariantCulture), d.MetadataDelta, d.ILDelta, d.PdbDelta, d.UpdatedTypes))); - _updateDeltas[0].ModuleId = moduleId; - _updateDeltas[0].MetadataDelta = metadataDelta; - _updateDeltas[0].ILDelta = ilDelta; - _updateDeltas[0].PdbBytes = pdbBytes; - _updateDeltas[0].UpdatedTypes = updatedTypes; - - _hotReloadAgent.ApplyDeltas(_updateDeltas); + return s_reporter.GetAndClearLogEntries((ResponseLoggingLevel)loggingLevel) + .Select(log => new LogEntry() { Message = log.message, Severity = (int)log.severity }).ToArray(); } /// @@ -66,15 +164,5 @@ public static partial class WebAssemblyHotReload /// [JSInvokable(nameof(GetApplyUpdateCapabilities))] public static string GetApplyUpdateCapabilities() - { - var method = typeof(System.Reflection.Metadata.MetadataUpdater).GetMethod("GetCapabilities", BindingFlags.NonPublic | BindingFlags.Static, Type.EmptyTypes); - if (method is null) - { - return string.Empty; - } - return (string)method.Invoke(obj: null, parameters: null)!; - } - - [JSImport("receiveHotReloadAsync", BlazorHotReloadModuleName)] - private static partial Task ReceiveHotReloadAsync(); + => GetAgent()?.Capabilities ?? ""; } diff --git a/src/Components/WebAssembly/WebAssembly/src/PublicAPI.Shipped.txt b/src/Components/WebAssembly/WebAssembly/src/PublicAPI.Shipped.txt index 61755ac3eb8..9ce568a05d8 100644 --- a/src/Components/WebAssembly/WebAssembly/src/PublicAPI.Shipped.txt +++ b/src/Components/WebAssembly/WebAssembly/src/PublicAPI.Shipped.txt @@ -81,6 +81,24 @@ Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostConfiguration Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostConfiguration.WebAssemblyHostConfiguration() -> void Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostEnvironmentExtensions Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta.Delta() -> void +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta.ILDelta.get -> byte[]! +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta.ILDelta.init -> void +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta.MetadataDelta.get -> byte[]! +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta.MetadataDelta.init -> void +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta.ModuleId.get -> string! +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta.ModuleId.init -> void +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta.PdbDelta.get -> byte[]! +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta.PdbDelta.init -> void +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta.UpdatedTypes.get -> int[]! +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta.UpdatedTypes.init -> void +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.LogEntry +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.LogEntry.LogEntry() -> void +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.LogEntry.Message.get -> string! +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.LogEntry.Message.init -> void +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.LogEntry.Severity.get -> int +Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.LogEntry.Severity.init -> void Microsoft.AspNetCore.Components.WebAssembly.Http.BrowserRequestCache Microsoft.AspNetCore.Components.WebAssembly.Http.BrowserRequestCache.Default = 0 -> Microsoft.AspNetCore.Components.WebAssembly.Http.BrowserRequestCache Microsoft.AspNetCore.Components.WebAssembly.Http.BrowserRequestCache.ForceCache = 4 -> Microsoft.AspNetCore.Components.WebAssembly.Http.BrowserRequestCache @@ -108,6 +126,7 @@ static Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostEnviro static Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostEnvironmentExtensions.IsProduction(this Microsoft.AspNetCore.Components.WebAssembly.Hosting.IWebAssemblyHostEnvironment! hostingEnvironment) -> bool static Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostEnvironmentExtensions.IsStaging(this Microsoft.AspNetCore.Components.WebAssembly.Hosting.IWebAssemblyHostEnvironment! hostingEnvironment) -> bool static Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.ApplyHotReloadDelta(string! moduleIdString, byte[]! metadataDelta, byte[]! ilDelta, byte[]! pdbBytes, int[]? updatedTypes) -> void +static Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.ApplyHotReloadDeltas(Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.Delta[]! deltas, int loggingLevel) -> Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.LogEntry[]! static Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.GetApplyUpdateCapabilities() -> string! static Microsoft.AspNetCore.Components.WebAssembly.Http.WebAssemblyHttpRequestMessageExtensions.SetBrowserRequestCache(this System.Net.Http.HttpRequestMessage! requestMessage, Microsoft.AspNetCore.Components.WebAssembly.Http.BrowserRequestCache requestCache) -> System.Net.Http.HttpRequestMessage! static Microsoft.AspNetCore.Components.WebAssembly.Http.WebAssemblyHttpRequestMessageExtensions.SetBrowserRequestCredentials(this System.Net.Http.HttpRequestMessage! requestMessage, Microsoft.AspNetCore.Components.WebAssembly.Http.BrowserRequestCredentials requestCredentials) -> System.Net.Http.HttpRequestMessage! diff --git a/src/Components/WebAssembly/WebAssembly/test/WebAssemblyHotReloadTest.cs b/src/Components/WebAssembly/WebAssembly/test/WebAssemblyHotReloadTest.cs deleted file mode 100644 index 525cb3c7ac0..00000000000 --- a/src/Components/WebAssembly/WebAssembly/test/WebAssemblyHotReloadTest.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.AspNetCore.Components.RenderTree; -using Microsoft.Extensions.HotReload; - -namespace Microsoft.AspNetCore.Components.WebAssembly.HotReload; - -public class WebAssemblyHotReloadTest -{ - [Fact] - public void WebAssemblyHotReload_DiscoversMetadataHandlers_FromHot() - { - // Arrange - var hotReloadManager = typeof(Renderer).Assembly.GetType("Microsoft.AspNetCore.Components.HotReload.HotReloadManager"); - Assert.NotNull(hotReloadManager); - - var handlerActions = new HotReloadAgent.UpdateHandlerActions(); - var logs = new List(); - var hotReloadAgent = new HotReloadAgent(logs.Add); - - // Act - hotReloadAgent.GetHandlerActions(handlerActions, hotReloadManager); - - // Assert - Assert.Empty(handlerActions.ClearCache); - Assert.Single(handlerActions.UpdateApplication); - } -}