diff --git a/src/Components/Components/src/PublicAPI.Unshipped.txt b/src/Components/Components/src/PublicAPI.Unshipped.txt index 98ca3f39e896..2f6b57dcfd8a 100644 --- a/src/Components/Components/src/PublicAPI.Unshipped.txt +++ b/src/Components/Components/src/PublicAPI.Unshipped.txt @@ -15,6 +15,7 @@ Microsoft.AspNetCore.Components.DynamicComponent.Type.set -> void Microsoft.AspNetCore.Components.CascadingTypeParameterAttribute Microsoft.AspNetCore.Components.CascadingTypeParameterAttribute.CascadingTypeParameterAttribute(string! name) -> void Microsoft.AspNetCore.Components.CascadingTypeParameterAttribute.Name.get -> string! +Microsoft.AspNetCore.Components.RenderTree.Renderer.GetEventArgsType(ulong eventHandlerId) -> System.Type! static Microsoft.AspNetCore.Components.ParameterView.FromDictionary(System.Collections.Generic.IDictionary! parameters) -> Microsoft.AspNetCore.Components.ParameterView virtual Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.RenderTree.EventFieldInfo? fieldInfo, System.EventArgs! eventArgs) -> System.Threading.Tasks.Task! *REMOVED*readonly Microsoft.AspNetCore.Components.RenderTree.RenderTreeEdit.RemovedAttributeName -> string diff --git a/src/Components/Components/src/RenderTree/EventArgsTypeCache.cs b/src/Components/Components/src/RenderTree/EventArgsTypeCache.cs new file mode 100644 index 000000000000..314545941589 --- /dev/null +++ b/src/Components/Components/src/RenderTree/EventArgsTypeCache.cs @@ -0,0 +1,42 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Concurrent; +using System.Reflection; + +namespace Microsoft.AspNetCore.Components.RenderTree +{ + internal static class EventArgsTypeCache + { + private static ConcurrentDictionary Cache = new ConcurrentDictionary(); + + public static Type GetEventArgsType(MethodInfo methodInfo) + { + return Cache.GetOrAdd(methodInfo, methodInfo => + { + var parameterInfos = methodInfo.GetParameters(); + if (parameterInfos.Length == 0) + { + return typeof(EventArgs); + } + else if (parameterInfos.Length > 1) + { + throw new InvalidOperationException($"The method {methodInfo} cannot be used as an event handler because it declares more than one parameter."); + } + else + { + var declaredType = parameterInfos[0].ParameterType; + if (typeof(EventArgs).IsAssignableFrom(declaredType)) + { + return declaredType; + } + else + { + throw new InvalidOperationException($"The event handler parameter type {declaredType.FullName} for event must inherit from {typeof(EventArgs).FullName}."); + } + } + }); + } + } +} diff --git a/src/Components/Components/src/RenderTree/Renderer.cs b/src/Components/Components/src/RenderTree/Renderer.cs index bb6f2931c4e5..8e058f1da9a3 100644 --- a/src/Components/Components/src/RenderTree/Renderer.cs +++ b/src/Components/Components/src/RenderTree/Renderer.cs @@ -249,11 +249,7 @@ public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo? fie { Dispatcher.AssertAccess(); - if (!_eventBindings.TryGetValue(eventHandlerId, out var callback)) - { - throw new ArgumentException($"There is no event handler associated with this event. EventId: '{eventHandlerId}'.", nameof(eventHandlerId)); - } - + var callback = GetRequiredEventCallback(eventHandlerId); Log.HandlingEvent(_logger, eventHandlerId, eventArgs); if (fieldInfo != null) @@ -291,6 +287,24 @@ public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo? fie return result; } + /// + /// Gets the event arguments type for the specified event handler. + /// + /// The value from the original event attribute. + /// The parameter type expected by the event handler. Normally this is a subclass of . + public Type GetEventArgsType(ulong eventHandlerId) + { + var methodInfo = GetRequiredEventCallback(eventHandlerId).Delegate?.Method; + + // The DispatchEventAsync code paths allow for the case where Delegate or its method + // is null, and in this case the event receiver just receives null. This won't happen + // under normal circumstances, but to avoid creating a new failure scenario, allow for + // that edge case here too. + return methodInfo == null + ? typeof(EventArgs) + : EventArgsTypeCache.GetEventArgsType(methodInfo); + } + internal void InstantiateChildComponentOnFrame(ref RenderTreeFrame frame, int parentComponentId) { if (frame.FrameTypeField != RenderTreeFrameType.Component) @@ -404,6 +418,16 @@ internal void TrackReplacedEventHandlerId(ulong oldEventHandlerId, ulong newEven _eventHandlerIdReplacements.Add(oldEventHandlerId, newEventHandlerId); } + private EventCallback GetRequiredEventCallback(ulong eventHandlerId) + { + if (!_eventBindings.TryGetValue(eventHandlerId, out var callback)) + { + throw new ArgumentException($"There is no event handler associated with this event. EventId: '{eventHandlerId}'.", nameof(eventHandlerId)); + } + + return callback; + } + private ulong FindLatestEventHandlerIdInChain(ulong eventHandlerId) { while (_eventHandlerIdReplacements.TryGetValue(eventHandlerId, out var replacementEventHandlerId)) diff --git a/src/Components/Components/test/RendererTest.cs b/src/Components/Components/test/RendererTest.cs index 5a5acc6e896d..3c12040f9a0d 100644 --- a/src/Components/Components/test/RendererTest.cs +++ b/src/Components/Components/test/RendererTest.cs @@ -484,6 +484,98 @@ public void CanDispatchEventsToTopLevelComponents() Assert.Same(eventArgs, receivedArgs); } + [Fact] + public void CanGetEventArgsTypeForHandler() + { + // Arrange: Render a component with an event handler + var renderer = new TestRenderer(); + + var component = new EventComponent + { + OnArbitraryDelegateEvent = (Func)(args => Task.CompletedTask), + }; + var componentId = renderer.AssignRootComponentId(component); + component.TriggerRender(); + + var eventHandlerId = renderer.Batches.Single() + .ReferenceFrames + .First(frame => frame.AttributeValue != null) + .AttributeEventHandlerId; + + // Assert: Can determine event args type + var eventArgsType = renderer.GetEventArgsType(eventHandlerId); + Assert.Same(typeof(DerivedEventArgs), eventArgsType); + } + + [Fact] + public void CanGetEventArgsTypeForParameterlessHandler() + { + // Arrange: Render a component with an event handler + var renderer = new TestRenderer(); + + var component = new EventComponent + { + OnArbitraryDelegateEvent = (Func)(() => Task.CompletedTask), + }; + var componentId = renderer.AssignRootComponentId(component); + component.TriggerRender(); + + var eventHandlerId = renderer.Batches.Single() + .ReferenceFrames + .First(frame => frame.AttributeValue != null) + .AttributeEventHandlerId; + + // Assert: Can determine event args type + var eventArgsType = renderer.GetEventArgsType(eventHandlerId); + Assert.Same(typeof(EventArgs), eventArgsType); + } + + [Fact] + public void CannotGetEventArgsTypeForMultiParameterHandler() + { + // Arrange: Render a component with an event handler + var renderer = new TestRenderer(); + + var component = new EventComponent + { + OnArbitraryDelegateEvent = (Action)((x, y) => { }), + }; + var componentId = renderer.AssignRootComponentId(component); + component.TriggerRender(); + + var eventHandlerId = renderer.Batches.Single() + .ReferenceFrames + .First(frame => frame.AttributeValue != null) + .AttributeEventHandlerId; + + // Assert: Cannot determine event args type + var ex = Assert.Throws(() => renderer.GetEventArgsType(eventHandlerId)); + Assert.Contains("declares more than one parameter", ex.Message); + } + + [Fact] + public void CannotGetEventArgsTypeForHandlerWithNonEventArgsParameter() + { + // Arrange: Render a component with an event handler + var renderer = new TestRenderer(); + + var component = new EventComponent + { + OnArbitraryDelegateEvent = (Action)(arg => { }), + }; + var componentId = renderer.AssignRootComponentId(component); + component.TriggerRender(); + + var eventHandlerId = renderer.Batches.Single() + .ReferenceFrames + .First(frame => frame.AttributeValue != null) + .AttributeEventHandlerId; + + // Assert: Cannot determine event args type + var ex = Assert.Throws(() => renderer.GetEventArgsType(eventHandlerId)); + Assert.Contains($"must inherit from {typeof(EventArgs).FullName}", ex.Message); + } + [Fact] public void DispatchEventHandlesSynchronousExceptionsFromEventHandlers() { @@ -4224,6 +4316,9 @@ private class EventComponent : AutoRenderComponent, IComponent, IHandleEvent [Parameter] public EventCallback OnClickEventCallbackOfT { get; set; } + [Parameter] + public Delegate OnArbitraryDelegateEvent { get; set; } + public bool SkipElement { get; set; } private int renderCount = 0; @@ -4269,6 +4364,12 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) { builder.AddAttribute(5, "onclickaction", OnClickAsyncAction); } + + if (OnArbitraryDelegateEvent != null) + { + builder.AddAttribute(6, "onarbitrarydelegateevent", OnArbitraryDelegateEvent); + } + builder.CloseElement(); builder.CloseElement(); } diff --git a/src/Components/Server/src/Circuits/CircuitHost.cs b/src/Components/Server/src/Circuits/CircuitHost.cs index 91222e9513cd..63c96073f682 100644 --- a/src/Components/Server/src/Circuits/CircuitHost.cs +++ b/src/Components/Server/src/Circuits/CircuitHost.cs @@ -399,7 +399,7 @@ public async Task DispatchEvent(string eventDescriptorJson, string eventArgsJson WebEventData webEventData; try { - webEventData = WebEventData.Parse(eventDescriptorJson, eventArgsJson); + webEventData = WebEventData.Parse(Renderer, eventDescriptorJson, eventArgsJson); } catch (Exception ex) { diff --git a/src/Components/Shared/src/WebEventData.cs b/src/Components/Shared/src/WebEventData.cs index 2940cc61d830..ca3cc6ac4332 100644 --- a/src/Components/Shared/src/WebEventData.cs +++ b/src/Components/Shared/src/WebEventData.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Diagnostics.CodeAnalysis; using System.Text.Json; using Microsoft.AspNetCore.Components.RenderTree; @@ -10,8 +11,8 @@ namespace Microsoft.AspNetCore.Components.Web internal class WebEventData { // This class represents the second half of parsing incoming event data, - // once the type of the eventArgs becomes known. - public static WebEventData Parse(string eventDescriptorJson, string eventArgsJson) + // once the event ID (and possibly the type of the eventArgs) becomes known. + public static WebEventData Parse(Renderer renderer, string eventDescriptorJson, string eventArgsJson) { WebEventDescriptor eventDescriptor; try @@ -24,17 +25,19 @@ public static WebEventData Parse(string eventDescriptorJson, string eventArgsJso } return Parse( + renderer, eventDescriptor, eventArgsJson); } - public static WebEventData Parse(WebEventDescriptor eventDescriptor, string eventArgsJson) + public static WebEventData Parse(Renderer renderer, WebEventDescriptor eventDescriptor, string eventArgsJson) { + var parsedEventArgs = ParseEventArgsJson(renderer, eventDescriptor.EventHandlerId, eventDescriptor.EventName, eventArgsJson); return new WebEventData( eventDescriptor.BrowserRendererId, eventDescriptor.EventHandlerId, InterpretEventFieldInfo(eventDescriptor.EventFieldInfo), - ParseEventArgsJson(eventDescriptor.EventHandlerId, eventDescriptor.EventArgsType, eventArgsJson)); + parsedEventArgs); } private WebEventData(int browserRendererId, ulong eventHandlerId, EventFieldInfo? eventFieldInfo, EventArgs eventArgs) @@ -53,36 +56,140 @@ private WebEventData(int browserRendererId, ulong eventHandlerId, EventFieldInfo public EventArgs EventArgs { get; } - private static EventArgs ParseEventArgsJson(ulong eventHandlerId, string eventArgsType, string eventArgsJson) + private static EventArgs ParseEventArgsJson(Renderer renderer, ulong eventHandlerId, string eventName, string eventArgsJson) { try { - return eventArgsType switch + if (TryGetStandardWebEventArgsType(eventName, out var eventArgsType)) { - "change" => DeserializeChangeEventArgs(eventArgsJson), - "clipboard" => Deserialize(eventArgsJson), - "drag" => Deserialize(eventArgsJson), - "error" => Deserialize(eventArgsJson), - "focus" => Deserialize(eventArgsJson), - "keyboard" => Deserialize(eventArgsJson), - "mouse" => Deserialize(eventArgsJson), - "pointer" => Deserialize(eventArgsJson), - "progress" => Deserialize(eventArgsJson), - "touch" => Deserialize(eventArgsJson), - "unknown" => EventArgs.Empty, - "wheel" => Deserialize(eventArgsJson), - "toggle" => Deserialize(eventArgsJson), - _ => throw new InvalidOperationException($"Unsupported event type '{eventArgsType}'. EventId: '{eventHandlerId}'."), - }; + // Special case for ChangeEventArgs because its value type can be one of + // several types, and System.Text.Json doesn't pick types dynamically + if (eventArgsType == typeof(ChangeEventArgs)) + { + return DeserializeChangeEventArgs(eventArgsJson); + } + } + else + { + // For custom events, the args type is determined from the associated delegate + eventArgsType = renderer.GetEventArgsType(eventHandlerId); + } + + return (EventArgs)JsonSerializer.Deserialize(eventArgsJson, eventArgsType, JsonSerializerOptionsProvider.Options)!; } catch (Exception e) { throw new InvalidOperationException($"There was an error parsing the event arguments. EventId: '{eventHandlerId}'.", e); } - } - static T Deserialize(string json) => JsonSerializer.Deserialize(json, JsonSerializerOptionsProvider.Options)!; + private static bool TryGetStandardWebEventArgsType(string eventName, [MaybeNullWhen(false)] out Type type) + { + // For back-compatibility, we recognize the built-in list of web event names and hard-code + // rules about the deserialization type for their eventargs. This makes it possible to declare + // an event handler as receiving EventArgs, and have it actually receive a subclass at runtime + // depending on the event that was raised. + // + // The following list should remain in sync with EventArgsFactory.ts. + + switch (eventName) + { + case "input": + case "change": + type = typeof(ChangeEventArgs); + return true; + + case "copy": + case "cut": + case "paste": + type = typeof(ClipboardEventArgs); + return true; + + case "drag": + case "dragend": + case "dragenter": + case "dragleave": + case "dragover": + case "dragstart": + case "drop": + type = typeof(DragEventArgs); + return true; + + case "focus": + case "blur": + case "focusin": + case "focusout": + type = typeof(FocusEventArgs); + return true; + + case "keydown": + case "keyup": + case "keypress": + type = typeof(KeyboardEventArgs); + return true; + + case "contextmenu": + case "click": + case "mouseover": + case "mouseout": + case "mousemove": + case "mousedown": + case "mouseup": + case "dblclick": + type = typeof(MouseEventArgs); + return true; + + case "error": + type = typeof(ErrorEventArgs); + return true; + + case "loadstart": + case "timeout": + case "abort": + case "load": + case "loadend": + case "progress": + type = typeof(ProgressEventArgs); + return true; + + case "touchcancel": + case "touchend": + case "touchmove": + case "touchenter": + case "touchleave": + case "touchstart": + type = typeof(TouchEventArgs); + return true; + + case "gotpointercapture": + case "lostpointercapture": + case "pointercancel": + case "pointerdown": + case "pointerenter": + case "pointerleave": + case "pointermove": + case "pointerout": + case "pointerover": + case "pointerup": + type = typeof(PointerEventArgs); + return true; + + case "wheel": + case "mousewheel": + type = typeof(WheelEventArgs); + return true; + + case "toggle": + type = typeof(EventArgs); + return true; + + default: + // For custom event types, there are no built-in rules, so the deserialization type is + // determined by the parameter declared on the delegate. + type = null; + return false; + } + } private static EventFieldInfo? InterpretEventFieldInfo(EventFieldInfo? fieldInfo) { @@ -111,6 +218,8 @@ private static EventArgs ParseEventArgsJson(ulong eventHandlerId, string eventAr return null; } + static T Deserialize(string json) => JsonSerializer.Deserialize(json, JsonSerializerOptionsProvider.Options)!; + private static ChangeEventArgs DeserializeChangeEventArgs(string eventArgsJson) { var changeArgs = Deserialize(eventArgsJson); diff --git a/src/Components/Web.JS/dist/Release/blazor.server.js b/src/Components/Web.JS/dist/Release/blazor.server.js index 0fb5f0449caf..7dcc67486403 100644 --- a/src/Components/Web.JS/dist/Release/blazor.server.js +++ b/src/Components/Web.JS/dist/Release/blazor.server.js @@ -1,23 +1,25 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=64)}([function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),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"}(r||(r={}))},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return c})),n.d(t,"c",(function(){return u})),n.d(t,"f",(function(){return l})),n.d(t,"h",(function(){return h})),n.d(t,"i",(function(){return f})),n.d(t,"e",(function(){return d})),n.d(t,"d",(function(){return p})),n.d(t,"b",(function(){return g})),n.d(t,"g",(function(){return y}));var r=n(0),o=n(13),i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]-1&&this.subject.observers.splice(e,1),0===this.subject.observers.length&&this.subject.cancelCallback&&this.subject.cancelCallback().catch((function(e){}))},e}(),g=function(){function e(e){this.minimumLogLevel=e,this.outputConsole=console}return e.prototype.log=function(e,t){if(e>=this.minimumLogLevel)switch(e){case r.a.Critical:case r.a.Error:this.outputConsole.error("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Warning:this.outputConsole.warn("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Information:this.outputConsole.info("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;default:this.outputConsole.log("["+(new Date).toISOString()+"] "+r.a[e]+": "+t)}},e}();function y(){var e="X-SignalR-User-Agent";return u.isNode&&(e="User-Agent"),[e,b("0.0.0-DEV_BUILD",m(),w(),v())]}function b(e,t,n,r){var o="Microsoft SignalR/",i=e.split(".");return o+=i[0]+"."+i[1],o+=" ("+e+"; ",o+=t&&""!==t?t+"; ":"Unknown OS; ",o+=""+n,o+=r?"; "+r:"; Unknown Runtime Version",o+=")"}function m(){if(!u.isNode)return"";switch(e.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return e.platform}}function v(){if(u.isNode)return e.versions.node}function w(){return u.isNode?"NodeJS":"Browser"}}).call(this,n(11))},function(e,t,n){"use strict";n.d(t,"l",(function(){return s})),n.d(t,"k",(function(){return a})),n.d(t,"a",(function(){return c})),n.d(t,"g",(function(){return u})),n.d(t,"j",(function(){return l})),n.d(t,"e",(function(){return h})),n.d(t,"f",(function(){return f})),n.d(t,"c",(function(){return d})),n.d(t,"h",(function(){return p})),n.d(t,"d",(function(){return g})),n.d(t,"i",(function(){return y})),n.d(t,"b",(function(){return b}));const r=w("_blazorLogicalChildren"),o=w("_blazorLogicalParent"),i=w("_blazorLogicalEnd");function s(e,t){if(!e.parentNode)throw new Error("Comment not connected to the DOM "+e.textContent);const n=e.parentNode,r=a(n,!0),s=g(r);return Array.from(n.childNodes).forEach(e=>s.push(e)),e[o]=r,t&&(e[i]=t,a(t)),a(e)}function a(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return r in e||(e[r]=[]),e}function c(e,t){const n=document.createComment("!");return u(n,e,t),n}function u(e,t,n){const i=e;if(e instanceof Comment){if(g(i)&&g(i).length>0)throw new Error("Not implemented: inserting non-empty logical container")}if(h(i))throw new Error("Not implemented: moving existing logical children");const s=g(t);if(n0;)l(n,0)}const r=n;r.parentNode.removeChild(r)}function h(e){return e[o]||null}function f(e){return e[i]||null}function d(e,t){return g(e)[t]}function p(e){return"http://www.w3.org/2000/svg"===b(e).namespaceURI}function g(e){return e[r]}function y(e,t){const n=g(e);t.forEach(e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=function e(t){if(t instanceof Element)return t;const n=m(t);if(n)return n.previousSibling;{const n=h(t);return n instanceof Element?n.lastChild:e(n)}}(e.moveRangeStart)}),t.forEach(t=>{const r=t.moveToBeforeMarker=document.createComment("marker"),o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):v(r,e)}),t.forEach(e=>{const t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd;let 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 b(e){if(e instanceof Element)return e;if(e instanceof Comment)return e.parentNode;throw new Error("Not a valid logical element")}function m(e){const t=g(h(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function v(e,t){if(t instanceof Element)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=m(t);n?n.parentNode.insertBefore(e,n):v(e,h(t))}}}function w(e){return"function"==typeof Symbol?Symbol():e}},function(e,t,n){"use strict";let r;function o(e){return r=e,r}n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}))},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){var t;window.DotNet=e;var n=[],r=function(){function e(e){this._jsObject=e,this._cachedFunctions=new Map}return e.prototype.findFunction=function(e){var t=this._cachedFunctions.get(e);if(t)return t;var n,r=this._jsObject;if(e.split(".").forEach((function(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.")},e.prototype.getWrappedObject=function(){return this._jsObject},e}(),o={},i=((t={})[0]=new r(window),t);i[0]._cachedFunctions.set("import",(function(e){return"string"==typeof e&&e.startsWith("./")&&(e=document.baseURI+e.substr(2)),import(e)}));var s,a=1,c=1,u=null;function l(e){n.push(e)}function h(e){var t;if(e&&"object"==typeof e){i[c]=new r(e);var n=((t={}).__jsObjectId=c,t);return c++,n}throw new Error("Cannot create a JSObjectReference from the value '"+e+"'.")}function f(e){return e?JSON.parse(e,(function(e,t){return n.reduce((function(t,n){return n(e,t)}),t)})):null}function d(e,t,n,r){var o=g();if(o.invokeDotNetFromJS){var i=JSON.stringify(r,S),s=o.invokeDotNetFromJS(e,t,n,i);return s?f(s):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeMethodAsync instead.")}function p(e,t,n,r){if(e&&n)throw new Error("For instance method calls, assemblyName should be null. Received '"+e+"'.");var i=a++,s=new Promise((function(e,t){o[i]={resolve:e,reject:t}}));try{var c=JSON.stringify(r,S);g().beginInvokeDotNetFromJS(i,e,t,n,c)}catch(e){y(i,!1,e)}return s}function g(){if(null!==u)return u;throw new Error("No .NET call dispatcher has been set.")}function y(e,t,n){if(!o.hasOwnProperty(e))throw new Error("There is no pending async call with ID "+e+".");var r=o[e];delete o[e],t?r.resolve(n):r.reject(n)}function b(e){return e instanceof Error?e.message+"\n"+e.stack:e?e.toString():"null"}function m(e,t){var n=i[t];if(n)return n.findFunction(e);throw new Error("JS object instance with ID "+t+" does not exist (has it been disposed?).")}function v(e){delete i[e]}e.attachDispatcher=function(e){u=e},e.attachReviver=l,e.invokeMethod=function(e,t){for(var n=[],r=2;rh(!1))},enableNavigationInterception:function(){o=!0},navigateTo:u,getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href};function c(e){e.notifyAfterClick(e=>{if(!o)return;if(0!==e.button||function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e))return;if(e.defaultPrevented)return;const t=function(e){const t=!window._blazorDisableComposedPath&&e.composedPath&&e.composedPath();if(t){for(let e=0;et(e))}getEventHandlerInfosForElement(e,t){return e.hasOwnProperty(this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new d:null}}h.nextEventDelegatorId=0;class f{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={}}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(this.countByEventName.hasOwnProperty(e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=u.hasOwnProperty(e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(this.infosByEventHandlerId.hasOwnProperty(t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=t.eventName;0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}}class d{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return this.handlers.hasOwnProperty(e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function p(e){const t={};return e.forEach(e=>{t[e]=!0}),t}var g=n(2),y=n(4);function b(e){return"_bl_"+e}y.a.attachReviver((e,t)=>t&&"object"==typeof t&&t.hasOwnProperty("__internalId")&&"string"==typeof t.__internalId?function(e){const t=`[${b(e)}]`;return document.querySelector(t)}(t.__internalId):t);var m=n(10),v=n(5);const w=document.createElement("template"),E=document.createElementNS("http://www.w3.org/2000/svg","g"),S={submit:!0},_={};class k{constructor(e){this.childComponentLocations={},this.browserRendererId=e,this.eventDelegator=new h((e,t,n,r)=>{!function(e,t,n,r,o){S[e.type]&&e.preventDefault();const i={browserRendererId:t,eventHandlerId:n,eventArgsType:r.type,eventFieldInfo:o};Object(m.a)(i,r.data)}(e,this.browserRendererId,t,n,r)}),Object(v.a)(this.eventDelegator)}attachRootComponentToLogicalElement(e,t){this.attachComponentToElement(e,t),_[e]=t}updateComponent(e,t,n,r){var o;const i=this.childComponentLocations[t];if(!i)throw new Error("No element is currently associated with component "+t);const s=_[t];if(s){const e=Object(g.f)(s);delete _[t],e?function(e,t){const n=Object(g.e)(e);if(!n)throw new Error("Can't clear between nodes. The start node does not have a logical parent.");const r=Object(g.d)(n),o=r.indexOf(e)+1,i=r.indexOf(t);for(let e=o;e<=i;e++)Object(g.j)(n,o);e.textContent="!"}(s,e):function(e){let t;for(;t=e.firstChild;)e.removeChild(t)}(s)}const a=null===(o=Object(g.b)(i))||void 0===o?void 0:o.ownerDocument,c=a&&a.activeElement;this.applyEdits(e,t,i,0,n,r),c instanceof HTMLElement&&a&&a.activeElement!==c&&c.focus()}disposeComponent(e){delete this.childComponentLocations[e]}disposeEventHandler(e){this.eventDelegator.removeListener(e)}attachComponentToElement(e,t){this.childComponentLocations[e]=t}applyEdits(e,t,n,o,i,s){let a,c=0,u=o;const l=e.arrayBuilderSegmentReader,h=e.editReader,f=e.frameReader,d=l.values(i),p=l.offset(i),y=p+l.count(i);for(let i=p;i1)for(var n=1;n=0,"must have a non-negative type"),o(s,"must have a decode function"),this.registerEncoder((function(e){return e instanceof t}),(function(t){var o=i(),s=r.allocUnsafe(1);return s.writeInt8(e,0),o.append(s),o.append(n(t)),o})),this.registerDecoder(e,s),this},registerEncoder:function(e,n){return o(e,"must have an encode function"),o(n,"must have an encode function"),t.push({check:e,encode:n}),this},registerDecoder:function(e,t){return o(e>=0,"must have a non-negative type"),o(t,"must have a decode function"),n.push({type:e,decode:t}),this},encoder:s.encoder,decoder:s.decoder,buffer:!0,type:"msgpack5",IncompleteBufferError:a.IncompleteBufferError}}},function(e,t,n){"use strict";var r=n(12),o=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=h;var i=n(8);i.inherits=n(7);var s=n(29),a=n(33);i.inherits(h,s);for(var c=o(a.prototype),u=0;u{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()}})}}},function(e,t,n){"use strict";function r(){return!(!document||!document.currentScript||"false"===document.currentScript.getAttribute("autostart"))}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";function r(e,t){switch(t){case"webassembly":return function(e){const t=o(e,"webassembly"),n=[];for(let e=0;ee.id-t.id)}(e);case"server":return function(e){const t=o(e,"server"),n=[];for(let e=0;ee.sequence-t.sequence)}(e)}}function o(e,t){if(!e.hasChildNodes())return[];const n=[],r=new u(e.childNodes);for(;r.next()&&r.currentElement;){const e=s(r,t);if(e)n.push(e);else{const e=o(r.currentElement,t);for(let t=0;t.*)$/;function s(e,t){const n=e.currentElement;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const r=new RegExp(i).exec(n.textContent),o=r&&r.groups&&r.groups.descriptor;if(!o)return;try{const r=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(o);switch(t){case"webassembly":return function(e,t,n){const{type:r,assembly:o,typeName:i,parameterDefinitions:s,parameterValues:c,prerenderId:u}=e;if("webassembly"!==r)return;if(!o)throw new Error("assembly must be defined when using a descriptor.");if(!i)throw new Error("typeName must be defined when using a descriptor.");if(u){const e=a(u,n);if(!e)throw new Error(`Could not find an end component comment for '${t}'`);return{type:r,assembly:o,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:c&&atob(c),start:t,prerenderId:u,end:e}}return{type:r,assembly:o,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:c&&atob(c),start:t}}(r,n,e);case"server":return function(e,t,n){const{type:r,descriptor:o,sequence:i,prerenderId:s}=e;if("server"!==r)return;if(!o)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===i)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(i))throw new Error(`Error parsing the sequence '${i}' for component '${JSON.stringify(e)}'`);if(s){const e=a(s,n);if(!e)throw new Error(`Could not find an end component comment for '${t}'`);return{type:r,sequence:i,descriptor:o,start:t,prerenderId:s,end:e}}return{type:r,sequence:i,descriptor:o,start:t}}(r,n,e)}}catch(e){throw new Error("Found malformed component comment at "+n.textContent)}}}function a(e,t){for(;t.next()&&t.currentElement;){const n=t.currentElement;if(n.nodeType!==Node.COMMENT_NODE)continue;if(!n.textContent)continue;const r=new RegExp(i).exec(n.textContent),o=r&&r[1];if(o)return c(o,e),n}}function c(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 u{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndex0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]-1&&this.subject.observers.splice(e,1),0===this.subject.observers.length&&this.subject.cancelCallback&&this.subject.cancelCallback().catch((function(e){}))},e}(),g=function(){function e(e){this.minimumLogLevel=e,this.outputConsole=console}return e.prototype.log=function(e,t){if(e>=this.minimumLogLevel)switch(e){case r.a.Critical:case r.a.Error:this.outputConsole.error("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Warning:this.outputConsole.warn("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Information:this.outputConsole.info("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;default:this.outputConsole.log("["+(new Date).toISOString()+"] "+r.a[e]+": "+t)}},e}();function y(){var e="X-SignalR-User-Agent";return u.isNode&&(e="User-Agent"),[e,m("0.0.0-DEV_BUILD",b(),w(),v())]}function m(e,t,n,r){var o="Microsoft SignalR/",i=e.split(".");return o+=i[0]+"."+i[1],o+=" ("+e+"; ",o+=t&&""!==t?t+"; ":"Unknown OS; ",o+=""+n,o+=r?"; "+r:"; Unknown Runtime Version",o+=")"}function b(){if(!u.isNode)return"";switch(e.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return e.platform}}function v(){if(u.isNode)return e.versions.node}function w(){return u.isNode?"NodeJS":"Browser"}}).call(this,n(12))},function(e,t,n){"use strict";n.d(t,"l",(function(){return s})),n.d(t,"k",(function(){return a})),n.d(t,"a",(function(){return c})),n.d(t,"g",(function(){return u})),n.d(t,"j",(function(){return l})),n.d(t,"e",(function(){return f})),n.d(t,"f",(function(){return h})),n.d(t,"c",(function(){return d})),n.d(t,"h",(function(){return p})),n.d(t,"d",(function(){return g})),n.d(t,"i",(function(){return y})),n.d(t,"b",(function(){return m}));const r=w("_blazorLogicalChildren"),o=w("_blazorLogicalParent"),i=w("_blazorLogicalEnd");function s(e,t){if(!e.parentNode)throw new Error("Comment not connected to the DOM "+e.textContent);const n=e.parentNode,r=a(n,!0),s=g(r);return Array.from(n.childNodes).forEach(e=>s.push(e)),e[o]=r,t&&(e[i]=t,a(t)),a(e)}function a(e,t){if(e.childNodes.length>0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return r in e||(e[r]=[]),e}function c(e,t){const n=document.createComment("!");return u(n,e,t),n}function u(e,t,n){const i=e;if(e instanceof Comment){if(g(i)&&g(i).length>0)throw new Error("Not implemented: inserting non-empty logical container")}if(f(i))throw new Error("Not implemented: moving existing logical children");const s=g(t);if(n0;)l(n,0)}const r=n;r.parentNode.removeChild(r)}function f(e){return e[o]||null}function h(e){return e[i]||null}function d(e,t){return g(e)[t]}function p(e){return"http://www.w3.org/2000/svg"===m(e).namespaceURI}function g(e){return e[r]}function y(e,t){const n=g(e);t.forEach(e=>{e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=function e(t){if(t instanceof Element)return t;const n=b(t);if(n)return n.previousSibling;{const n=f(t);return n instanceof Element?n.lastChild:e(n)}}(e.moveRangeStart)}),t.forEach(t=>{const r=t.moveToBeforeMarker=document.createComment("marker"),o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):v(r,e)}),t.forEach(e=>{const t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd;let 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 m(e){if(e instanceof Element)return e;if(e instanceof Comment)return e.parentNode;throw new Error("Not a valid logical element")}function b(e){const t=g(f(e));return t[Array.prototype.indexOf.call(t,e)+1]||null}function v(e,t){if(t instanceof Element)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=b(t);n?n.parentNode.insertBefore(e,n):v(e,f(t))}}}function w(e){return"function"==typeof Symbol?Symbol():e}},function(e,t,n){"use strict";let r;function o(e){return r=e,r}n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}))},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){var t;window.DotNet=e;var n=[],r=function(){function e(e){this._jsObject=e,this._cachedFunctions=new Map}return e.prototype.findFunction=function(e){var t=this._cachedFunctions.get(e);if(t)return t;var n,r=this._jsObject;if(e.split(".").forEach((function(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.")},e.prototype.getWrappedObject=function(){return this._jsObject},e}(),o={},i=((t={})[0]=new r(window),t);i[0]._cachedFunctions.set("import",(function(e){return"string"==typeof e&&e.startsWith("./")&&(e=document.baseURI+e.substr(2)),import(e)}));var s,a=1,c=1,u=null;function l(e){n.push(e)}function f(e){var t;if(e&&"object"==typeof e){i[c]=new r(e);var n=((t={}).__jsObjectId=c,t);return c++,n}throw new Error("Cannot create a JSObjectReference from the value '"+e+"'.")}function h(e){return e?JSON.parse(e,(function(e,t){return n.reduce((function(t,n){return n(e,t)}),t)})):null}function d(e,t,n,r){var o=g();if(o.invokeDotNetFromJS){var i=JSON.stringify(r,S),s=o.invokeDotNetFromJS(e,t,n,i);return s?h(s):null}throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeMethodAsync instead.")}function p(e,t,n,r){if(e&&n)throw new Error("For instance method calls, assemblyName should be null. Received '"+e+"'.");var i=a++,s=new Promise((function(e,t){o[i]={resolve:e,reject:t}}));try{var c=JSON.stringify(r,S);g().beginInvokeDotNetFromJS(i,e,t,n,c)}catch(e){y(i,!1,e)}return s}function g(){if(null!==u)return u;throw new Error("No .NET call dispatcher has been set.")}function y(e,t,n){if(!o.hasOwnProperty(e))throw new Error("There is no pending async call with ID "+e+".");var r=o[e];delete o[e],t?r.resolve(n):r.reject(n)}function m(e){return e instanceof Error?e.message+"\n"+e.stack:e?e.toString():"null"}function b(e,t){var n=i[t];if(n)return n.findFunction(e);throw new Error("JS object instance with ID "+t+" does not exist (has it been disposed?).")}function v(e){delete i[e]}e.attachDispatcher=function(e){u=e},e.attachReviver=l,e.invokeMethod=function(e,t){for(var n=[],r=2;r({})},s=[];function a(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=o.get(t.browserEventName);n?n.push(e):o.set(t.browserEventName,[e]),s.forEach(n=>n(e,t.browserEventName))}r.set(e,t)}function c(e){return r.get(e)}function u(e){return o.get(e)}function l(e){const t=r.get(e);return(null==t?void 0:t.browserEventName)||e}function f(e,t){e.forEach(e=>r.set(e,t))}function h(e){const t=[];for(let n=0;n{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}}),f(["focus","blur","focusin","focusout"],i),f(["keydown","keyup","keypress"],{createEventArgs:e=>{return{key:(t=e).key,code:t.code,location:t.location,repeat:t.repeat,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey};var t}}),f(["contextmenu","click","mouseover","mouseout","mousemove","mousedown","mouseup","dblclick"],{createEventArgs:e=>d(e)}),f(["error"],{createEventArgs:e=>{return{message:(t=e).message,filename:t.filename,lineno:t.lineno,colno:t.colno};var t}}),f(["loadstart","timeout","abort","load","loadend","progress"],{createEventArgs:e=>{return{lengthComputable:(t=e).lengthComputable,loaded:t.loaded,total:t.total};var t}}),f(["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};var t}}),f(["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}}),f(["wheel","mousewheel"],{createEventArgs:e=>{return{...d(t=e),deltaX:t.deltaX,deltaY:t.deltaY,deltaZ:t.deltaZ,deltaMode:t.deltaMode};var t}}),f(["toggle"],i);const p=["date","datetime-local","month","time","week"]},function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return c})),n.d(t,"c",(function(){return u})),n.d(t,"d",(function(){return d}));n(4);var r=n(7);let o=!1,i=!1,s=null;const a={listenForNavigationEvents:function(e){if(s=e,i)return;i=!0,window.addEventListener("popstate",()=>f(!1))},enableNavigationInterception:function(){o=!0},navigateTo:u,getBaseURI:()=>document.baseURI,getLocationHref:()=>location.href};function c(e){e.notifyAfterClick(e=>{if(!o)return;if(0!==e.button||function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e))return;if(e.defaultPrevented)return;const t=function(e){const t=!window._blazorDisableComposedPath&&e.composedPath&&e.composedPath();if(t){for(let e=0;ethis.dispatchGlobalEventToAllElements(t,e)),"click"===e.type&&this.afterClickCallbacks.forEach(t=>t(e))}dispatchGlobalEventToAllElements(e,t){let n=t.target,r=null,o=!1;const f=c.hasOwnProperty(e);let h=!1;for(;n;){const c=this.getEventHandlerInfosForElement(n,!1);if(c){const f=c.getHandler(e);if(f&&(d=n,p=t.type,!((d instanceof HTMLButtonElement||d instanceof HTMLInputElement||d instanceof HTMLTextAreaElement||d instanceof HTMLSelectElement)&&l.hasOwnProperty(p)&&d.disabled))){if(!o){const n=Object(a.d)(e);r=(null==n?void 0:n.createEventArgs)?n.createEventArgs(t):{},o=!0}u.hasOwnProperty(t.type)&&t.preventDefault(),Object(s.a)({browserRendererId:this.browserRendererId,eventHandlerId:f.eventHandlerId,eventName:e,eventFieldInfo:i.fromEvent(f.renderingComponentId,t)},r)}c.stopPropagation(e)&&(h=!0),c.preventDefault(e)&&t.preventDefault()}n=f||h?null:n.parentElement}var d,p}getEventHandlerInfosForElement(e,t){return e.hasOwnProperty(this.eventsCollectionKey)?e[this.eventsCollectionKey]:t?e[this.eventsCollectionKey]=new d:null}}f.nextEventDelegatorId=0;class h{constructor(e){this.globalListener=e,this.infosByEventHandlerId={},this.countByEventName={},a.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=Object(a.b)(e),this.countByEventName.hasOwnProperty(e))this.countByEventName[e]++;else{this.countByEventName[e]=1;const t=c.hasOwnProperty(e);document.addEventListener(e,this.globalListener,t)}}update(e,t){if(this.infosByEventHandlerId.hasOwnProperty(t))throw new Error(`Event ${t} is already tracked`);const n=this.infosByEventHandlerId[e];delete this.infosByEventHandlerId[e],n.eventHandlerId=t,this.infosByEventHandlerId[t]=n}remove(e){const t=this.infosByEventHandlerId[e];if(t){delete this.infosByEventHandlerId[e];const n=Object(a.b)(t.eventName);0==--this.countByEventName[n]&&(delete this.countByEventName[n],document.removeEventListener(n,this.globalListener))}return t}handleEventNameAliasAdded(e,t){if(this.countByEventName.hasOwnProperty(e)){const n=this.countByEventName[e];delete this.countByEventName[e],document.removeEventListener(e,this.globalListener),this.addGlobalListener(t),this.countByEventName[t]+=n-1}}}class d{constructor(){this.handlers={},this.preventDefaultFlags=null,this.stopPropagationFlags=null}getHandler(e){return this.handlers.hasOwnProperty(e)?this.handlers[e]:null}setHandler(e,t){this.handlers[e]=t}removeHandler(e){delete this.handlers[e]}preventDefault(e,t){return void 0!==t&&(this.preventDefaultFlags=this.preventDefaultFlags||{},this.preventDefaultFlags[e]=t),!!this.preventDefaultFlags&&this.preventDefaultFlags[e]}stopPropagation(e,t){return void 0!==t&&(this.stopPropagationFlags=this.stopPropagationFlags||{},this.stopPropagationFlags[e]=t),!!this.stopPropagationFlags&&this.stopPropagationFlags[e]}}function p(e){const t={};return e.forEach(e=>{t[e]=!0}),t}var g=n(2),y=n(4);function m(e){return"_bl_"+e}y.a.attachReviver((e,t)=>t&&"object"==typeof t&&t.hasOwnProperty("__internalId")&&"string"==typeof t.__internalId?function(e){const t=`[${m(e)}]`;return document.querySelector(t)}(t.__internalId):t);var b=n(6);const v=document.createElement("template"),w=document.createElementNS("http://www.w3.org/2000/svg","g"),E={};class S{constructor(e){this.childComponentLocations={},this.eventDelegator=new f(e),Object(b.a)(this.eventDelegator)}attachRootComponentToLogicalElement(e,t){this.attachComponentToElement(e,t),E[e]=t}updateComponent(e,t,n,r){var o;const i=this.childComponentLocations[t];if(!i)throw new Error("No element is currently associated with component "+t);const s=E[t];if(s){const e=Object(g.f)(s);delete E[t],e?function(e,t){const n=Object(g.e)(e);if(!n)throw new Error("Can't clear between nodes. The start node does not have a logical parent.");const r=Object(g.d)(n),o=r.indexOf(e)+1,i=r.indexOf(t);for(let e=o;e<=i;e++)Object(g.j)(n,o);e.textContent="!"}(s,e):function(e){let t;for(;t=e.firstChild;)e.removeChild(t)}(s)}const a=null===(o=Object(g.b)(i))||void 0===o?void 0:o.ownerDocument,c=a&&a.activeElement;this.applyEdits(e,t,i,0,n,r),c instanceof HTMLElement&&a&&a.activeElement!==c&&c.focus()}disposeComponent(e){delete this.childComponentLocations[e]}disposeEventHandler(e){this.eventDelegator.removeListener(e)}attachComponentToElement(e,t){this.childComponentLocations[e]=t}applyEdits(e,t,n,o,i,s){let a,c=0,u=o;const l=e.arrayBuilderSegmentReader,f=e.editReader,h=e.frameReader,d=l.values(i),p=l.offset(i),y=p+l.count(i);for(let i=p;i=0,"must have a non-negative type"),o(s,"must have a decode function"),this.registerEncoder((function(e){return e instanceof t}),(function(t){var o=i(),s=r.allocUnsafe(1);return s.writeInt8(e,0),o.append(s),o.append(n(t)),o})),this.registerDecoder(e,s),this},registerEncoder:function(e,n){return o(e,"must have an encode function"),o(n,"must have an encode function"),t.push({check:e,encode:n}),this},registerDecoder:function(e,t){return o(e>=0,"must have a non-negative type"),o(t,"must have a decode function"),n.push({type:e,decode:t}),this},encoder:s.encoder,decoder:s.decoder,buffer:!0,type:"msgpack5",IncompleteBufferError:a.IncompleteBufferError}}},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,u=[],l=!1,f=-1;function h(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&d())}function d(){if(!l){var e=a(h);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f1)for(var n=1;n * @license MIT */ -var r=n(42),o=n(43),i=n(44);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return F(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return x(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function b(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,o);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,o){var i,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var l=-1;for(i=n;ia&&(n=a-c),i=n;i>=0;i--){for(var h=!0,f=0;fo&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var s=0;s>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+h<=n)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(i=e[o+1]))&&(c=(31&u)<<6|63&i)>127&&(l=c);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(c=(15&u)<<12|(63&i)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=h}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},c.prototype.compare=function(e,t,n,r,o){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(i,s),u=this.slice(r,o),l=e.slice(t,n),h=0;ho)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return E(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return _(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function D(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function M(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function A(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,i){return i||A(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,i){return i||A(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||j(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);j(this,e,t,n,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);j(this,e,t,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!c.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function H(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(L,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(9))},function(e,t,n){"use strict";var r=n(49).Duplex,o=n(26),i=n(14).Buffer;function s(e){if(!(this instanceof s))return new s(e);if(this._bufs=[],this.length=0,"function"==typeof e){this._callback=e;var t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(function(e){e.on("error",t)})),this.on("unpipe",(function(e){e.removeListener("error",t)}))}else this.append(e);r.call(this)}o.inherits(s,r),s.prototype._offset=function(e){var t,n=0,r=0;if(0===e)return[0,0];for(;rthis.length||e<0)){var t=this._offset(e);return this._bufs[t[0]][t[1]]}},s.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},s.prototype.copy=function(e,t,n,r){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof r||r>this.length)&&(r=this.length),n>=this.length)return e||i.alloc(0);if(r<=0)return e||i.alloc(0);var o,s,a=!!e,c=this._offset(n),u=r-n,l=u,h=a&&t||0,f=c[1];if(0===n&&r==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:i.concat(this._bufs,this.length);for(s=0;s(o=this._bufs[s].length-f))){this._bufs[s].copy(e,h,f,f+l),h+=o;break}this._bufs[s].copy(e,h,f),h+=o,l-=o,f&&(f=0)}return e.length>h?e.slice(0,h):e},s.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return new s;var n=this._offset(e),r=this._offset(t),o=this._bufs.slice(n[0],r[0]+1);return 0==r[1]?o.pop():o[o.length-1]=o[o.length-1].slice(0,r[1]),0!=n[1]&&(o[0]=o[0].slice(n[1])),new s(o)},s.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},s.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){for(var e=0,t=new s;ethis.length?this.length:t;for(var r=this._offset(t),o=r[0],a=r[1];o=e.length){var u=c.indexOf(e,a);if(-1!==u)return this._reverseOffset([o,u]);a=c.length-e.length+1}else{var l=this._reverseOffset([o,a]);if(this._match(l,e))return l;a++}}a=0}return-1},s.prototype._match=function(e,t){if(this.length-e0&&s.length>o&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=f.bind(r);return o.listener=n,r.wrapFn=o,o}function p(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,l=y(c,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){s=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";var r=n(54).Buffer,o=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=h,t=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return o>0&&(e.lastNeed=o-1),o;if(--r=0)return o>0&&(e.lastNeed=o-2),o;if(--r=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},i.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){(function(e){var r=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),c=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),p(n)?r.showHidden=n:n&&t._extend(r,n),m(r.showHidden)&&(r.showHidden=!1),m(r.depth)&&(r.depth=2),m(r.colors)&&(r.colors=!1),m(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=c),l(r,e,r.depth)}function c(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function u(e,t){return e}function l(e,n,r){if(e.customInspect&&n&&_(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var o=n.inspect(r,e);return b(o)||(o=l(e,o,r)),o}var i=function(e,t){if(m(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(y(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,n);if(i)return i;var s=Object.keys(n),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),S(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return h(n);if(0===s.length){if(_(n)){var c=n.name?": "+n.name:"";return e.stylize("[Function"+c+"]","special")}if(v(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return e.stylize(Date.prototype.toString.call(n),"date");if(S(n))return h(n)}var u,w="",k=!1,C=["{","}"];(d(n)&&(k=!0,C=["[","]"]),_(n))&&(w=" [Function"+(n.name?": "+n.name:"")+"]");return v(n)&&(w=" "+RegExp.prototype.toString.call(n)),E(n)&&(w=" "+Date.prototype.toUTCString.call(n)),S(n)&&(w=" "+h(n)),0!==s.length||k&&0!=n.length?r<0?v(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),u=k?function(e,t,n,r,o){for(var i=[],s=0,a=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(u,w,C)):C[0]+w+C[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,o,i){var s,a,c;if((c=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),x(r,o)||(s="["+o+"]"),a||(e.seen.indexOf(c.value)<0?(a=g(n)?l(e,c.value,null):l(e,c.value,n-1)).indexOf("\n")>-1&&(a=i?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),m(s)){if(i&&o.match(/^\d+$/))return a;(s=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return"number"==typeof e}function b(e){return"string"==typeof e}function m(e){return void 0===e}function v(e){return w(e)&&"[object RegExp]"===k(e)}function w(e){return"object"==typeof e&&null!==e}function E(e){return w(e)&&"[object Date]"===k(e)}function S(e){return w(e)&&("[object Error]"===k(e)||e instanceof Error)}function _(e){return"function"==typeof e}function k(e){return Object.prototype.toString.call(e)}function C(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(m(i)&&(i=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!s[n])if(new RegExp("\\b"+n+"\\b","i").test(i)){var r=e.pid;s[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else s[n]=function(){};return s[n]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=p,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=m,t.isRegExp=v,t.isObject=w,t.isDate=E,t.isError=S,t.isFunction=_,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(47);var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(){var e=new Date,t=[C(e.getHours()),C(e.getMinutes()),C(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function x(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",T(),t.format.apply(t,arguments))},t.inherits=n(48),t._extend=function(e,t){if(!t||!w(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var R="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function O(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(R&&e[R]){var t;if("function"!=typeof(t=e[R]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,R,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),o=[],i=0;i{var o;if(!r.isIntersecting)return;const i=t.getBoundingClientRect(),s=n.getBoundingClientRect().top-i.bottom,a=null===(o=r.rootBounds)||void 0===o?void 0:o.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,s,a):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,s,a)})}),{root:o,rootMargin:r+"px"});i.observe(t),i.observe(n);const a=u(t),c=u(n);function u(e){const t=new MutationObserver(()=>{i.unobserve(e),i.observe(e)});return t.observe(e,{attributes:!0}),t}s[e._id]={intersectionObserver:i,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const t=s[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete s[e._id])}},s={};window.Blazor={navigateTo:r.c,_internal:{navigationManager:r.b,domWrapper:o,Virtualize:i}}},function(e,t,n){ +var r=n(35),o=n(36),i=n(37);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return F(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return _(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){var i,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var l=-1;for(i=n;ia&&(n=a-c),i=n;i>=0;i--){for(var f=!0,h=0;ho&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var s=0;s>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function k(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function _(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+f<=n)switch(f){case 1:u<128&&(l=u);break;case 2:128==(192&(i=e[o+1]))&&(c=(31&u)<<6|63&i)>127&&(l=c);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(c=(15&u)<<12|(63&i)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},c.prototype.compare=function(e,t,n,r,o){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(i,s),u=this.slice(r,o),l=e.slice(t,n),f=0;fo)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return E(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return I(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function D(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function A(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function B(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(e,t,n,r,i){return i||B(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function N(e,t,n,r,i){return i||B(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||j(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):A(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):A(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);j(this,e,t,n,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);j(this,e,t,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):A(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):A(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return M(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return N(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return N(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!c.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function H(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(10))},function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,n(16).Buffer)},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));let r=!1;async function o(){let e=document.querySelector("#blazor-error-ui");if(e&&(e.style.display="block"),!r){r=!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()}})}}},function(e,t,n){"use strict";function r(){return!(!document||!document.currentScript||"false"===document.currentScript.getAttribute("autostart"))}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";function r(e,t){switch(t){case"webassembly":return function(e){const t=o(e,"webassembly"),n=[];for(let e=0;ee.id-t.id)}(e);case"server":return function(e){const t=o(e,"server"),n=[];for(let e=0;ee.sequence-t.sequence)}(e)}}function o(e,t){if(!e.hasChildNodes())return[];const n=[],r=new u(e.childNodes);for(;r.next()&&r.currentElement;){const e=s(r,t);if(e)n.push(e);else{const e=o(r.currentElement,t);for(let t=0;t.*)$/;function s(e,t){const n=e.currentElement;if(n&&n.nodeType===Node.COMMENT_NODE&&n.textContent){const r=new RegExp(i).exec(n.textContent),o=r&&r.groups&&r.groups.descriptor;if(!o)return;try{const r=function(e){const t=JSON.parse(e),{type:n}=t;if("server"!==n&&"webassembly"!==n)throw new Error(`Invalid component type '${n}'.`);return t}(o);switch(t){case"webassembly":return function(e,t,n){const{type:r,assembly:o,typeName:i,parameterDefinitions:s,parameterValues:c,prerenderId:u}=e;if("webassembly"!==r)return;if(!o)throw new Error("assembly must be defined when using a descriptor.");if(!i)throw new Error("typeName must be defined when using a descriptor.");if(u){const e=a(u,n);if(!e)throw new Error(`Could not find an end component comment for '${t}'`);return{type:r,assembly:o,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:c&&atob(c),start:t,prerenderId:u,end:e}}return{type:r,assembly:o,typeName:i,parameterDefinitions:s&&atob(s),parameterValues:c&&atob(c),start:t}}(r,n,e);case"server":return function(e,t,n){const{type:r,descriptor:o,sequence:i,prerenderId:s}=e;if("server"!==r)return;if(!o)throw new Error("descriptor must be defined when using a descriptor.");if(void 0===i)throw new Error("sequence must be defined when using a descriptor.");if(!Number.isInteger(i))throw new Error(`Error parsing the sequence '${i}' for component '${JSON.stringify(e)}'`);if(s){const e=a(s,n);if(!e)throw new Error(`Could not find an end component comment for '${t}'`);return{type:r,sequence:i,descriptor:o,start:t,prerenderId:s,end:e}}return{type:r,sequence:i,descriptor:o,start:t}}(r,n,e)}}catch(e){throw new Error("Found malformed component comment at "+n.textContent)}}}function a(e,t){for(;t.next()&&t.currentElement;){const n=t.currentElement;if(n.nodeType!==Node.COMMENT_NODE)continue;if(!n.textContent)continue;const r=new RegExp(i).exec(n.textContent),o=r&&r[1];if(o)return c(o,e),n}}function c(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 u{constructor(e){this.childNodes=e,this.currentIndex=-1,this.length=e.length}next(){return this.currentIndex++,this.currentIndexthis.length||e<0)){var t=this._offset(e);return this._bufs[t[0]][t[1]]}},s.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},s.prototype.copy=function(e,t,n,r){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof r||r>this.length)&&(r=this.length),n>=this.length)return e||i.alloc(0);if(r<=0)return e||i.alloc(0);var o,s,a=!!e,c=this._offset(n),u=r-n,l=u,f=a&&t||0,h=c[1];if(0===n&&r==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:i.concat(this._bufs,this.length);for(s=0;s(o=this._bufs[s].length-h))){this._bufs[s].copy(e,f,h,h+l),f+=o;break}this._bufs[s].copy(e,f,h),f+=o,l-=o,h&&(h=0)}return e.length>f?e.slice(0,f):e},s.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return new s;var n=this._offset(e),r=this._offset(t),o=this._bufs.slice(n[0],r[0]+1);return 0==r[1]?o.pop():o[o.length-1]=o[o.length-1].slice(0,r[1]),0!=n[1]&&(o[0]=o[0].slice(n[1])),new s(o)},s.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},s.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){for(var e=0,t=new s;ethis.length?this.length:t;for(var r=this._offset(t),o=r[0],a=r[1];o=e.length){var u=c.indexOf(e,a);if(-1!==u)return this._reverseOffset([o,u]);a=c.length-e.length+1}else{var l=this._reverseOffset([o,a]);if(this._match(l,e))return l;a++}}a=0}return-1},s.prototype._match=function(e,t){if(this.length-e=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),c=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),p(n)?r.showHidden=n:n&&t._extend(r,n),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=c),l(r,e,r.depth)}function c(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function u(e,t){return e}function l(e,n,r){if(e.customInspect&&n&&I(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var o=n.inspect(r,e);return m(o)||(o=l(e,o,r)),o}var i=function(e,t){if(b(t))return e.stylize("undefined","undefined");if(m(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(y(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,n);if(i)return i;var s=Object.keys(n),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),S(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(n);if(0===s.length){if(I(n)){var c=n.name?": "+n.name:"";return e.stylize("[Function"+c+"]","special")}if(v(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return e.stylize(Date.prototype.toString.call(n),"date");if(S(n))return f(n)}var u,w="",C=!1,k=["{","}"];(d(n)&&(C=!0,k=["[","]"]),I(n))&&(w=" [Function"+(n.name?": "+n.name:"")+"]");return v(n)&&(w=" "+RegExp.prototype.toString.call(n)),E(n)&&(w=" "+Date.prototype.toUTCString.call(n)),S(n)&&(w=" "+f(n)),0!==s.length||C&&0!=n.length?r<0?v(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),u=C?function(e,t,n,r,o){for(var i=[],s=0,a=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(u,w,k)):k[0]+w+k[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,o,i){var s,a,c;if((c=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),O(r,o)||(s="["+o+"]"),a||(e.seen.indexOf(c.value)<0?(a=g(n)?l(e,c.value,null):l(e,c.value,n-1)).indexOf("\n")>-1&&(a=i?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),b(s)){if(i&&o.match(/^\d+$/))return a;(s=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function d(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return"number"==typeof e}function m(e){return"string"==typeof e}function b(e){return void 0===e}function v(e){return w(e)&&"[object RegExp]"===C(e)}function w(e){return"object"==typeof e&&null!==e}function E(e){return w(e)&&"[object Date]"===C(e)}function S(e){return w(e)&&("[object Error]"===C(e)||e instanceof Error)}function I(e){return"function"==typeof e}function C(e){return Object.prototype.toString.call(e)}function k(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(b(i)&&(i=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!s[n])if(new RegExp("\\b"+n+"\\b","i").test(i)){var r=e.pid;s[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else s[n]=function(){};return s[n]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=p,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=m,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=b,t.isRegExp=v,t.isObject=w,t.isDate=E,t.isError=S,t.isFunction=I,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(40);var _=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(){var e=new Date,t=[k(e.getHours()),k(e.getMinutes()),k(e.getSeconds())].join(":");return[e.getDate(),_[e.getMonth()],t].join(" ")}function O(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",T(),t.format.apply(t,arguments))},t.inherits=n(41),t._extend=function(e,t){if(!t||!w(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var x="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(x&&e[x]){var t;if("function"!=typeof(t=e[x]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,x,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),o=[],i=0;i{var o;if(!r.isIntersecting)return;const i=t.getBoundingClientRect(),s=n.getBoundingClientRect().top-i.bottom,a=null===(o=r.rootBounds)||void 0===o?void 0:o.height;r.target===t?e.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,s,a):r.target===n&&n.offsetHeight>0&&e.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,s,a)})}),{root:o,rootMargin:r+"px"});i.observe(t),i.observe(n);const a=u(t),c=u(n);function u(e){const t=new MutationObserver(()=>{i.unobserve(e),i.observe(e)});return t.observe(e,{attributes:!0}),t}s[e._id]={intersectionObserver:i,mutationObserverBefore:a,mutationObserverAfter:c}},dispose:function(e){const t=s[e._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),e.dispose(),delete s[e._id])}},s={};var a=n(5);window.Blazor={navigateTo:r.c,registerCustomEventType:a.e,_internal:{navigationManager:r.b,domWrapper:o,Virtualize:i}}},function(e,t,n){ /*! safe-buffer. MIT License. Feross Aboukhadijeh */ -var r=n(22),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),s.prototype=Object.create(o.prototype),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";(function(t,r){var o=n(12);e.exports=v;var i,s=n(30);v.ReadableState=m;n(24).EventEmitter;var a=function(e,t){return e.listeners(t).length},c=n(31),u=n(14).Buffer,l=t.Uint8Array||function(){};var h=n(8);h.inherits=n(7);var f=n(50),d=void 0;d=f&&f.debuglog?f.debuglog("stream"):function(){};var p,g=n(51),y=n(32);h.inherits(v,c);var b=["error","close","destroy","pause","resume"];function m(e,t){e=e||{};var r=t instanceof(i=i||n(16));this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var o=e.highWaterMark,s=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(p||(p=n(25).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function v(e){if(i=i||n(16),!(this instanceof v))return new v(e);this._readableState=new m(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function w(e,t,n,r,o){var i,s=e._readableState;null===t?(s.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,_(e)}(e,s)):(o||(i=function(e,t){var n;r=t,u.isBuffer(r)||r instanceof l||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(s,t)),i?e.emit("error",i):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),r?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):E(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?E(e,s,t,!1):C(e,s)):E(e,s,t,!1))):r||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function _(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?o.nextTick(k,e):k(e))}function k(e){d("emit readable"),e.emit("readable"),R(e)}function C(e,t){t.readingMore||(t.readingMore=!0,o.nextTick(I,e,t))}function I(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ei.length?i.length:e;if(s===i.length?o+=i:o+=i.slice(0,e),0===(e-=s)){s===i.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(s));break}++r}return t.length-=r,o}(e,t):function(e,t){var n=u.allocUnsafe(e),r=t.head,o=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,s),0===(e-=s)){s===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(s));break}++o}return t.length-=o,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function P(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,o.nextTick(j,t,e))}function j(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function D(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?P(this):_(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&P(this),null;var r,o=t.needReadable;return d("need readable",o),(0===t.length||t.length-e0?O(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&P(this)),null!==r&&this.emit("data",r),r},v.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,d("pipe count=%d opts=%j",i.pipesCount,t);var c=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?l:v;function u(t,r){d("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,d("cleanup"),e.removeListener("close",b),e.removeListener("finish",m),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",l),n.removeListener("end",v),n.removeListener("data",g),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function l(){d("onend"),e.end()}i.endEmitted?o.nextTick(c):n.once("end",c),e.on("unpipe",u);var h=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,R(e))}}(n);e.on("drain",h);var f=!1;var p=!1;function g(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==D(i.pipes,e))&&!f&&(d("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function y(t){d("onerror",t),v(),e.removeListener("error",y),0===a(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",m),v()}function m(){d("onfinish"),e.removeListener("close",b),v()}function v(){d("unpipe"),n.unpipe(e)}return n.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",y),e.once("close",b),e.once("finish",m),e.emit("pipe",n),i.flowing||(d("pipe resume"),n.resume()),e},v.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?r:i.nextTick;m.WritableState=b;var u=n(8);u.inherits=n(7);var l={deprecate:n(35)},h=n(31),f=n(14).Buffer,d=o.Uint8Array||function(){};var p,g=n(32);function y(){}function b(e,t){a=a||n(16),e=e||{};var r=t instanceof a;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var o=e.highWaterMark,u=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===e.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,o){--t.pendingcb,n?(i.nextTick(o,r),i.nextTick(k,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(o(r),e._writableState.errorEmitted=!0,e.emit("error",r),k(e,t))}(e,n,r,t,o);else{var s=S(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||E(e,n),r?c(w,e,n,s,o):w(e,n,s,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function m(e){if(a=a||n(16),!(p.call(m,this)||this instanceof a))return new m(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function v(e,t,n,r,o,i,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,n?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function w(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),k(e,t)}function E(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=new Array(r),i=t.corkedRequestsFree;i.entry=n;for(var a=0,c=!0;n;)o[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;o.allBuffers=c,v(e,t,!0,t.length,o,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,l=n.encoding,h=n.callback;if(v(e,t,!1,t.objectMode?1:u.length,u,l,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function _(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),k(e,t)}))}function k(e,t){var n=S(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(_,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}u.inherits(m,h),b.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(b.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===m&&(e&&e._writableState instanceof b)}})):p=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,n){var r,o=this._writableState,s=!1,a=!o.objectMode&&(r=e,f.isBuffer(r)||r instanceof d);return a&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=y),o.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,n,r,o,i){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n));return t}(t,r,o);r!==s&&(n=!0,o="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,k(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=g.destroy,m.prototype._undestroy=g.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(11),n(34).setImmediate,n(9))},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(53),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(9))},function(e,t,n){(function(t){function n(e){try{if(!t.localStorage)return!1}catch(e){return!1}var n=t.localStorage[e];return null!=n&&"true"===String(n).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}}).call(this,n(9))},function(e,t,n){"use strict";e.exports=s;var r=n(16),o=n(8);function i(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),r?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):E(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?E(e,s,t,!1):C(e,s)):E(e,s,t,!1))):r||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function _(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?o.nextTick(k,e):k(e))}function k(e){d("emit readable"),e.emit("readable"),R(e)}function C(e,t){t.readingMore||(t.readingMore=!0,o.nextTick(I,e,t))}function I(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ei.length?i.length:e;if(s===i.length?o+=i:o+=i.slice(0,e),0===(e-=s)){s===i.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(s));break}++r}return t.length-=r,o}(e,t):function(e,t){var n=u.allocUnsafe(e),r=t.head,o=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,s),0===(e-=s)){s===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(s));break}++o}return t.length-=o,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function P(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,o.nextTick(j,t,e))}function j(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function D(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?P(this):_(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&P(this),null;var r,o=t.needReadable;return d("need readable",o),(0===t.length||t.length-e0?O(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&P(this)),null!==r&&this.emit("data",r),r},v.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,d("pipe count=%d opts=%j",i.pipesCount,t);var c=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?l:v;function u(t,r){d("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,d("cleanup"),e.removeListener("close",b),e.removeListener("finish",m),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",l),n.removeListener("end",v),n.removeListener("data",g),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function l(){d("onend"),e.end()}i.endEmitted?o.nextTick(c):n.once("end",c),e.on("unpipe",u);var h=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,R(e))}}(n);e.on("drain",h);var f=!1;var p=!1;function g(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==D(i.pipes,e))&&!f&&(d("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function y(t){d("onerror",t),v(),e.removeListener("error",y),0===a(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",m),v()}function m(){d("onfinish"),e.removeListener("close",b),v()}function v(){d("unpipe"),n.unpipe(e)}return n.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",y),e.once("close",b),e.once("finish",m),e.emit("pipe",n),i.flowing||(d("pipe resume"),n.resume()),e},v.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1?r:i.nextTick;m.WritableState=b;var u=Object.create(n(8));u.inherits=n(7);var l={deprecate:n(35)},h=n(38),f=n(14).Buffer,d=o.Uint8Array||function(){};var p,g=n(39);function y(){}function b(e,t){a=a||n(17),e=e||{};var r=t instanceof a;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var o=e.highWaterMark,u=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===e.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,o){--t.pendingcb,n?(i.nextTick(o,r),i.nextTick(k,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(o(r),e._writableState.errorEmitted=!0,e.emit("error",r),k(e,t))}(e,n,r,t,o);else{var s=S(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||E(e,n),r?c(w,e,n,s,o):w(e,n,s,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function m(e){if(a=a||n(17),!(p.call(m,this)||this instanceof a))return new m(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function v(e,t,n,r,o,i,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,n?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function w(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),k(e,t)}function E(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=new Array(r),i=t.corkedRequestsFree;i.entry=n;for(var a=0,c=!0;n;)o[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;o.allBuffers=c,v(e,t,!0,t.length,o,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,l=n.encoding,h=n.callback;if(v(e,t,!1,t.objectMode?1:u.length,u,l,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function _(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),k(e,t)}))}function k(e,t){var n=S(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(_,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}u.inherits(m,h),b.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(b.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===m&&(e&&e._writableState instanceof b)}})):p=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,n){var r,o=this._writableState,s=!1,a=!o.objectMode&&(r=e,f.isBuffer(r)||r instanceof d);return a&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=y),o.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,n,r,o,i){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n));return t}(t,r,o);r!==s&&(n=!0,o="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,k(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=g.destroy,m.prototype._undestroy=g.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(11),n(34).setImmediate,n(9))},function(e,t,n){"use strict";e.exports=s;var r=n(17),o=Object.create(n(8));function i(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length0?s-4:s;for(n=0;n>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===a&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,c[l++]=255&t);1===a&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=0,a=n-o;sa?a:s+16383));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var o,i,s=[],a=t;a>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,s,a=8*o-r-1,c=(1<>1,l=-7,h=n?o-1:0,f=n?-1:1,d=e[t+h];for(h+=f,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+e[t+h],h+=f,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+e[t+h],h+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),i-=u}return(d?-1:1)*s*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var s,a,c,u=8*i-o-1,l=(1<>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?f/c:f*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*c-1)*Math.pow(2,o),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;e[n+d]=255&a,d+=p,a/=256,o-=8);for(s=s<0;e[n+d]=255&s,d+=p,s/=256,u-=8);e[n+d-p]|=128*g}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(t){var r=n(46); +var r=n(16),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),s.prototype=Object.create(o.prototype),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){(t=e.exports=n(28)).Stream=t,t.Readable=t,t.Writable=n(32),t.Duplex=n(14),t.Transform=n(34),t.PassThrough=n(50)},function(e,t,n){"use strict";(function(t,r){var o=n(22);e.exports=v;var i,s=n(42);v.ReadableState=b;n(29).EventEmitter;var a=function(e,t){return e.listeners(t).length},c=n(30),u=n(24).Buffer,l=t.Uint8Array||function(){};var f=Object.create(n(17));f.inherits=n(13);var h=n(43),d=void 0;d=h&&h.debuglog?h.debuglog("stream"):function(){};var p,g=n(44),y=n(31);f.inherits(v,c);var m=["error","close","destroy","pause","resume"];function b(e,t){e=e||{};var r=t instanceof(i=i||n(14));this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var o=e.highWaterMark,s=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(p||(p=n(33).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function v(e){if(i=i||n(14),!(this instanceof v))return new v(e);this._readableState=new b(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function w(e,t,n,r,o){var i,s=e._readableState;null===t?(s.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,I(e)}(e,s)):(o||(i=function(e,t){var n;r=t,u.isBuffer(r)||r instanceof l||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(s,t)),i?e.emit("error",i):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),r?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):E(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?E(e,s,t,!1):k(e,s)):E(e,s,t,!1))):r||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function I(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?o.nextTick(C,e):C(e))}function C(e){d("emit readable"),e.emit("readable"),x(e)}function k(e,t){t.readingMore||(t.readingMore=!0,o.nextTick(_,e,t))}function _(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ei.length?i.length:e;if(s===i.length?o+=i:o+=i.slice(0,e),0===(e-=s)){s===i.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(s));break}++r}return t.length-=r,o}(e,t):function(e,t){var n=u.allocUnsafe(e),r=t.head,o=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,s),0===(e-=s)){s===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(s));break}++o}return t.length-=o,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function P(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,o.nextTick(j,t,e))}function j(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function D(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?P(this):I(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&P(this),null;var r,o=t.needReadable;return d("need readable",o),(0===t.length||t.length-e0?R(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&P(this)),null!==r&&this.emit("data",r),r},v.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,d("pipe count=%d opts=%j",i.pipesCount,t);var c=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?l:v;function u(t,r){d("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,d("cleanup"),e.removeListener("close",m),e.removeListener("finish",b),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",l),n.removeListener("end",v),n.removeListener("data",g),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function l(){d("onend"),e.end()}i.endEmitted?o.nextTick(c):n.once("end",c),e.on("unpipe",u);var f=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,x(e))}}(n);e.on("drain",f);var h=!1;var p=!1;function g(t){d("ondata"),p=!1,!1!==e.write(t)||p||((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==D(i.pipes,e))&&!h&&(d("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function y(t){d("onerror",t),v(),e.removeListener("error",y),0===a(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",b),v()}function b(){d("onfinish"),e.removeListener("close",m),v()}function v(){d("unpipe"),n.unpipe(e)}return n.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",y),e.once("close",m),e.once("finish",b),e.emit("pipe",n),i.flowing||(d("pipe resume"),n.resume()),e},v.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i0&&s.length>o&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=h.bind(r);return o.listener=n,r.wrapFn=o,o}function p(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,l=y(c,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){s=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){e.exports=n(29).EventEmitter},function(e,t,n){"use strict";var r=n(22);function o(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,i=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return i||s?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(o,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(r.nextTick(o,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){"use strict";(function(t,r,o){var i=n(22);function s(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=b;var a,c=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:i.nextTick;b.WritableState=m;var u=Object.create(n(17));u.inherits=n(13);var l={deprecate:n(48)},f=n(30),h=n(24).Buffer,d=o.Uint8Array||function(){};var p,g=n(31);function y(){}function m(e,t){a=a||n(14),e=e||{};var r=t instanceof a;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var o=e.highWaterMark,u=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,o){--t.pendingcb,n?(i.nextTick(o,r),i.nextTick(C,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(o(r),e._writableState.errorEmitted=!0,e.emit("error",r),C(e,t))}(e,n,r,t,o);else{var s=S(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||E(e,n),r?c(w,e,n,s,o):w(e,n,s,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function b(e){if(a=a||n(14),!(p.call(b,this)||this instanceof a))return new b(e);this._writableState=new m(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function v(e,t,n,r,o,i,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,n?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function w(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),C(e,t)}function E(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=new Array(r),i=t.corkedRequestsFree;i.entry=n;for(var a=0,c=!0;n;)o[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;o.allBuffers=c,v(e,t,!0,t.length,o,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,l=n.encoding,f=n.callback;if(v(e,t,!1,t.objectMode?1:u.length,u,l,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function I(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),C(e,t)}))}function C(e,t){var n=S(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(I,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}u.inherits(b,f),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===b&&(e&&e._writableState instanceof m)}})):p=function(e){return e instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(e,t,n){var r,o=this._writableState,s=!1,a=!o.objectMode&&(r=e,h.isBuffer(r)||r instanceof d);return a&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=y),o.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,n,r,o,i){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n));return t}(t,r,o);r!==s&&(n=!0,o="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,C(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),b.prototype.destroy=g.destroy,b.prototype._undestroy=g.undestroy,b.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(12),n(46).setImmediate,n(10))},function(e,t,n){"use strict";var r=n(49).Buffer,o=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=f,t=3;break;default:return this.write=h,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return o>0&&(e.lastNeed=o-1),o;if(--r=0)return o>0&&(e.lastNeed=o-2),o;if(--r=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},i.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";e.exports=s;var r=n(14),o=Object.create(n(17));function i(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length0?s-4:s;for(n=0;n>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===a&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,c[l++]=255&t);1===a&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=0,a=n-o;sa?a:s+16383));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var o,i,s=[],a=t;a>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,s,a=8*o-r-1,c=(1<>1,l=-7,f=n?o-1:0,h=n?-1:1,d=e[t+f];for(f+=h,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+e[t+f],f+=h,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),i-=u}return(d?-1:1)*s*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var s,a,c,u=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?h/c:h*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,o),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;e[n+d]=255&a,d+=p,a/=256,o-=8);for(s=s<0;e[n+d]=255&s,d+=p,s/=256,u-=8);e[n+d-p]|=128*g}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(t){var r=n(39); /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */function o(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o=0;u--)if(l[u]!==h[u])return!1;for(u=l.length-1;u>=0;u--)if(a=l[u],!v(e[a],t[a],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function E(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function S(e,t,n,r){var o;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),o=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!o&&b(o,n,"Missing expected exception"+r);var i="string"==typeof r,a=!e&&o&&!n;if((!e&&s.isError(o)&&i&&E(o,n)||a)&&b(o,n,"Got unwanted exception"+r),e&&o&&n&&!E(o,n)||!e&&o)throw o}f.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return g(y(e.actual),128)+" "+e.operator+" "+g(y(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,o=p(t),i=r.indexOf("\n"+o);if(i>=0){var s=r.indexOf("\n",i+1);r=r.substring(s+1)}this.stack=r}}},s.inherits(f.AssertionError,Error),f.fail=b,f.ok=m,f.equal=function(e,t,n){e!=t&&b(e,t,n,"==",f.equal)},f.notEqual=function(e,t,n){e==t&&b(e,t,n,"!=",f.notEqual)},f.deepEqual=function(e,t,n){v(e,t,!1)||b(e,t,n,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(e,t,n){v(e,t,!0)||b(e,t,n,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(e,t,n){v(e,t,!1)&&b(e,t,n,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function e(t,n,r){v(t,n,!0)&&b(t,n,r,"notDeepStrictEqual",e)},f.strictEqual=function(e,t,n){e!==t&&b(e,t,n,"===",f.strictEqual)},f.notStrictEqual=function(e,t,n){e===t&&b(e,t,n,"!==",f.notStrictEqual)},f.throws=function(e,t,n){S(!0,e,t,n)},f.doesNotThrow=function(e,t,n){S(!1,e,t,n)},f.ifError=function(e){if(e)throw e},f.strict=r((function e(t,n){t||b(t,!0,n,"==",e)}),f,{equal:f.strictEqual,deepEqual:f.deepStrictEqual,notEqual:f.notStrictEqual,notDeepEqual:f.notDeepStrictEqual}),f.strict.strict=f.strict;var _=Object.keys||function(e){var t=[];for(var n in e)a.call(e,n)&&t.push(n);return t}}).call(this,n(9))},function(e,t,n){"use strict"; + */function o(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o=0;u--)if(l[u]!==f[u])return!1;for(u=l.length-1;u>=0;u--)if(a=l[u],!v(e[a],t[a],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function E(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function S(e,t,n,r){var o;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),o=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!o&&m(o,n,"Missing expected exception"+r);var i="string"==typeof r,a=!e&&o&&!n;if((!e&&s.isError(o)&&i&&E(o,n)||a)&&m(o,n,"Got unwanted exception"+r),e&&o&&n&&!E(o,n)||!e&&o)throw o}h.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return g(y(e.actual),128)+" "+e.operator+" "+g(y(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,o=p(t),i=r.indexOf("\n"+o);if(i>=0){var s=r.indexOf("\n",i+1);r=r.substring(s+1)}this.stack=r}}},s.inherits(h.AssertionError,Error),h.fail=m,h.ok=b,h.equal=function(e,t,n){e!=t&&m(e,t,n,"==",h.equal)},h.notEqual=function(e,t,n){e==t&&m(e,t,n,"!=",h.notEqual)},h.deepEqual=function(e,t,n){v(e,t,!1)||m(e,t,n,"deepEqual",h.deepEqual)},h.deepStrictEqual=function(e,t,n){v(e,t,!0)||m(e,t,n,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function(e,t,n){v(e,t,!1)&&m(e,t,n,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=function e(t,n,r){v(t,n,!0)&&m(t,n,r,"notDeepStrictEqual",e)},h.strictEqual=function(e,t,n){e!==t&&m(e,t,n,"===",h.strictEqual)},h.notStrictEqual=function(e,t,n){e===t&&m(e,t,n,"!==",h.notStrictEqual)},h.throws=function(e,t,n){S(!0,e,t,n)},h.doesNotThrow=function(e,t,n){S(!1,e,t,n)},h.ifError=function(e){if(e)throw e},h.strict=r((function e(t,n){t||m(t,!0,n,"==",e)}),h,{equal:h.strictEqual,deepEqual:h.deepStrictEqual,notEqual:h.notStrictEqual,notDeepEqual:h.notDeepStrictEqual}),h.strict.strict=h.strict;var I=Object.keys||function(e){var t=[];for(var n in e)a.call(e,n)&&t.push(n);return t}}).call(this,n(10))},function(e,t,n){"use strict"; /* object-assign (c) Sindre Sorhus @license MIT -*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,a,c=s(e),u=1;u0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,o,i=r.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=i,o=a,t.copy(n,o),a+=s.data.length,s=s.next;return i},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,s,a,c=1,u={},l=!1,h=e.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(e);f=f&&f.setTimeout?f:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){p(e.data)},r=function(e){i.port2.postMessage(e)}):h&&"onreadystatechange"in h.createElement("script")?(o=h.documentElement,r=function(e){var t=h.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(p,0,e)}:(s="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&p(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),r=function(t){e.postMessage(s+t,"*")}),f.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,o,i=r.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=i,o=a,t.copy(n,o),a+=s.data.length,s=s.next;return i},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(47),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(10))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,s,a,c=1,u={},l=!1,f=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){p(e.data)},r=function(e){i.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(p,0,e)}:(s="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&p(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),r=function(t){e.postMessage(s+t,"*")}),h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n */ -var r=n(22),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),s.prototype=Object.create(o.prototype),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";e.exports=i;var r=n(36),o=n(8);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}o.inherits=n(7),o.inherits(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";var r=n(57).Transform,o=n(7),i=n(23);function s(e){(e=e||{}).objectMode=!0,e.highWaterMark=16,r.call(this,e),this._msgpack=e.msgpack}function a(e){if(!(this instanceof a))return(e=e||{}).msgpack=this,new a(e);s.call(this,e),this._wrap="wrap"in e&&e.wrap}function c(e){if(!(this instanceof c))return(e=e||{}).msgpack=this,new c(e);s.call(this,e),this._chunks=i(),this._wrap="wrap"in e&&e.wrap}o(s,r),o(a,s),a.prototype._transform=function(e,t,n){var r=null;try{r=this._msgpack.encode(this._wrap?e.value:e).slice(0)}catch(e){return this.emit("error",e),n()}this.push(r),n()},o(c,s),c.prototype._transform=function(e,t,n){e&&this._chunks.append(e);try{var r=this._msgpack.decode(this._chunks);this._wrap&&(r={value:r}),this.push(r)}catch(e){return void(e instanceof this._msgpack.IncompleteBufferError?n():this.emit("error",e))}this._chunks.length>0?this._transform(null,t,n):n()},e.exports.decoder=c,e.exports.encoder=a},function(e,t,n){(t=e.exports=n(37)).Stream=t,t.Readable=t,t.Writable=n(40),t.Duplex=n(17),t.Transform=n(41),t.PassThrough=n(61)},function(e,t){},function(e,t,n){"use strict";var r=n(14).Buffer,o=n(60);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,o,i=r.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=i,o=a,t.copy(n,o),a+=s.data.length,s=s.next;return i},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){"use strict";e.exports=i;var r=n(41),o=Object.create(n(8));function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}o.inherits=n(7),o.inherits(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";var r=n(23);function o(e){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e||"unable to decode"}n(26).inherits(o,Error),e.exports=function(e){return function(e){e instanceof r||(e=r().append(e));var t=i(e);if(t)return e.consume(t.bytesConsumed),t.value;throw new o};function t(e,t,n){return t>=n+e}function n(e,t){return{value:e,bytesConsumed:t}}function i(e,r){r=void 0===r?0:r;var o=e.length-r;if(o<=0)return null;var i,l,h,f=e.readUInt8(r),d=0;if(!function(e,t){var n=function(e){switch(e){case 196:return 2;case 197:return 3;case 198:return 5;case 199:return 3;case 200:return 4;case 201:return 6;case 202:return 5;case 203:return 9;case 204:return 2;case 205:return 3;case 206:return 5;case 207:return 9;case 208:return 2;case 209:return 3;case 210:return 5;case 211:return 9;case 212:return 3;case 213:return 4;case 214:return 6;case 215:return 10;case 216:return 18;case 217:return 2;case 218:return 3;case 219:return 5;case 222:return 3;default:return-1}}(e);return!(-1!==n&&t=0;h--)d+=e.readUInt8(r+h+1)*Math.pow(2,8*(7-h));return n(d,9);case 208:return n(d=e.readInt8(r+1),2);case 209:return n(d=e.readInt16BE(r+1),3);case 210:return n(d=e.readInt32BE(r+1),5);case 211:return n(d=function(e,t){var n=128==(128&e[t]);if(n)for(var r=1,o=t+7;o>=t;o--){var i=(255^e[o])+r;e[o]=255&i,r=i>>8}var s=e.readUInt32BE(t+0),a=e.readUInt32BE(t+4);return(4294967296*s+a)*(n?-1:1)}(e.slice(r+1,r+9),0),9);case 202:return n(d=e.readFloatBE(r+1),5);case 203:return n(d=e.readDoubleBE(r+1),9);case 217:return t(i=e.readUInt8(r+1),o,2)?n(d=e.toString("utf8",r+2,r+2+i),2+i):null;case 218:return t(i=e.readUInt16BE(r+1),o,3)?n(d=e.toString("utf8",r+3,r+3+i),3+i):null;case 219:return t(i=e.readUInt32BE(r+1),o,5)?n(d=e.toString("utf8",r+5,r+5+i),5+i):null;case 196:return t(i=e.readUInt8(r+1),o,2)?n(d=e.slice(r+2,r+2+i),2+i):null;case 197:return t(i=e.readUInt16BE(r+1),o,3)?n(d=e.slice(r+3,r+3+i),3+i):null;case 198:return t(i=e.readUInt32BE(r+1),o,5)?n(d=e.slice(r+5,r+5+i),5+i):null;case 220:return o<3?null:(i=e.readUInt16BE(r+1),s(e,r,i,3));case 221:return o<5?null:(i=e.readUInt32BE(r+1),s(e,r,i,5));case 222:return i=e.readUInt16BE(r+1),a(e,r,i,3);case 223:return i=e.readUInt32BE(r+1),a(e,r,i,5);case 212:return c(e,r,1);case 213:return c(e,r,2);case 214:return c(e,r,4);case 215:return c(e,r,8);case 216:return c(e,r,16);case 199:return i=e.readUInt8(r+1),l=e.readUInt8(r+2),t(i,o,3)?u(e,r,l,i,3):null;case 200:return i=e.readUInt16BE(r+1),l=e.readUInt8(r+3),t(i,o,4)?u(e,r,l,i,4):null;case 201:return i=e.readUInt32BE(r+1),l=e.readUInt8(r+5),t(i,o,6)?u(e,r,l,i,6):null}if(144==(240&f))return s(e,r,i=15&f,1);if(128==(240&f))return a(e,r,i=15&f,1);if(160==(224&f))return t(i=31&f,o,1)?n(d=e.toString("utf8",r+1,r+i+1),i+1):null;if(f>=224)return n(d=f-256,1);if(f<128)return n(f,1);throw new Error("not implemented yet")}function s(e,t,r,o){var s,a=[],c=0;for(t+=o,s=0;s0&&l.write(c,1)):h<=255&&!n?((l=r.allocUnsafe(2+h))[0]=217,l[1]=h,l.write(c,2)):h<=65535?((l=r.allocUnsafe(3+h))[0]=218,l.writeUInt16BE(h,1),l.write(c,3)):((l=r.allocUnsafe(5+h))[0]=219,l.writeUInt32BE(h,1),l.write(c,5));else if(c&&(c.readUInt32LE||c instanceof Uint8Array))c instanceof Uint8Array&&(c=r.from(c)),c.length<=255?((l=r.allocUnsafe(2))[0]=196,l[1]=c.length):c.length<=65535?((l=r.allocUnsafe(3))[0]=197,l.writeUInt16BE(c.length,1)):((l=r.allocUnsafe(5))[0]=198,l.writeUInt32BE(c.length,1)),l=o([l,c]);else if(Array.isArray(c))c.length<16?(l=r.allocUnsafe(1))[0]=144|c.length:c.length<65536?((l=r.allocUnsafe(3))[0]=220,l.writeUInt16BE(c.length,1)):((l=r.allocUnsafe(5))[0]=221,l.writeUInt32BE(c.length,1)),l=c.reduce((function(e,t){return e.append(a(t,!0)),e}),o().append(l));else{if(!s&&"function"==typeof c.getDate)return function(e){var t,n=1*e,i=Math.floor(n/1e3),s=1e6*(n-1e3*i);if(s||i>4294967295){(t=r.allocUnsafe(10))[0]=215,t[1]=-1;var a=4*s,c=i/Math.pow(2,32),u=a+c&4294967295,l=4294967295&i;t.writeInt32BE(u,2),t.writeInt32BE(l,6)}else(t=r.allocUnsafe(6))[0]=214,t[1]=-1,t.writeUInt32BE(Math.floor(n/1e3),2);return o().append(t)}(c);if("object"==typeof c)l=function(t){var n,i,s,a=[];for(n=0;n>8),a.push(255&s)):(a.push(201),a.push(s>>24),a.push(s>>16&255),a.push(s>>8&255),a.push(255&s));return o().append(r.from(a)).append(i)}(c)||function(e){var t,n,i=[],s=0;for(t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&"function"!=typeof e[t]&&(++s,i.push(a(t,!0)),i.push(a(e[t],!0)));s<16?(n=r.allocUnsafe(1))[0]=128|s:s<65535?((n=r.allocUnsafe(3))[0]=222,n.writeUInt16BE(s,1)):((n=r.allocUnsafe(5))[0]=223,n.writeUInt32BE(s,1));return i.unshift(n),i.reduce((function(e,t){return e.append(t)}),o())}(c);else if("number"==typeof c){if(function(e){return e%1!=0}(c))return i(c,t);if(c>=0)if(c<128)(l=r.allocUnsafe(1))[0]=c;else if(c<256)(l=r.allocUnsafe(2))[0]=204,l[1]=c;else if(c<65536)(l=r.allocUnsafe(3))[0]=205,l.writeUInt16BE(c,1);else if(c<=4294967295)(l=r.allocUnsafe(5))[0]=206,l.writeUInt32BE(c,1);else{if(!(c<=9007199254740991))return i(c,!0);(l=r.allocUnsafe(9))[0]=207,function(e,t){for(var n=7;n>=0;n--)e[n+1]=255&t,t/=256}(l,c)}else if(c>=-32)(l=r.allocUnsafe(1))[0]=256+c;else if(c>=-128)(l=r.allocUnsafe(2))[0]=208,l.writeInt8(c,1);else if(c>=-32768)(l=r.allocUnsafe(3))[0]=209,l.writeInt16BE(c,1);else if(c>-214748365)(l=r.allocUnsafe(5))[0]=210,l.writeInt32BE(c,1);else{if(!(c>=-9007199254740991))return i(c,!0);(l=r.allocUnsafe(9))[0]=211,function(e,t,n){var r=n<0;r&&(n=Math.abs(n));var o=n%4294967296,i=n/4294967296;if(e.writeUInt32BE(Math.floor(i),t+0),e.writeUInt32BE(o,t+4),r)for(var s=1,a=t+7;a>=t;a--){var c=(255^e[a])+s;e[a]=255&c,s=c>>8}}(l,1,c)}}}if(!l)throw new Error("not implemented yet");return u?l:l.slice()}return a}},function(e,t,n){"use strict";n.r(t);var r,o=n(4),i=(n(27),r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=function(e){function t(t,n){var r=this,o=this.constructor.prototype;return(r=e.call(this,t)||this).statusCode=n,r.__proto__=o,r}return i(t,e),t}(Error),a=function(e){function t(t){void 0===t&&(t="A timeout occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return i(t,e),t}(Error),c=function(e){function t(t){void 0===t&&(t="An abort occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return i(t,e),t}(Error),u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=200&&o.status<300?n(new l(o.status,o.statusText,o.response||o.responseText)):r(new s(o.statusText,o.status))},o.onerror=function(){t.logger.log(f.a.Warning,"Error from HTTP request. "+o.status+": "+o.statusText+"."),r(new s(o.statusText,o.status))},o.ontimeout=function(){t.logger.log(f.a.Warning,"Timeout from HTTP request."),r(new a)},o.send(e.content||"")})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t}(h),S=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_=function(e){function t(t){var n=e.call(this)||this;if("undefined"!=typeof fetch||d.c.isNode)n.httpClient=new m(t);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");n.httpClient=new E(t)}return n}return S(t,e),t.prototype.send=function(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new c):e.method?e.url?this.httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t.prototype.getCookieString=function(e){return this.httpClient.getCookieString(e)},t}(h),k=function(){function e(){}return e.write=function(t){return""+t+e.RecordSeparator},e.parse=function(t){if(t[t.length-1]!==e.RecordSeparator)throw new Error("Message is incomplete.");var n=t.split(e.RecordSeparator);return n.pop(),n},e.RecordSeparatorCode=30,e.RecordSeparator=String.fromCharCode(e.RecordSeparatorCode),e}(),C=function(){function e(){}return e.prototype.writeHandshakeRequest=function(e){return k.write(JSON.stringify(e))},e.prototype.parseHandshakeResponse=function(e){var t,n;if(Object(d.h)(e)){var r=new Uint8Array(e);if(-1===(i=r.indexOf(k.RecordSeparatorCode)))throw new Error("Message is incomplete.");var o=i+1;t=String.fromCharCode.apply(null,r.slice(0,o)),n=r.byteLength>o?r.slice(o).buffer:null}else{var i,s=e;if(-1===(i=s.indexOf(k.RecordSeparator)))throw new Error("Message is incomplete.");o=i+1;t=s.substring(0,o),n=s.length>o?s.substring(o):null}var a=k.parse(t),c=JSON.parse(a[0]);if(c.type)throw new Error("Expected a handshake response from the server.");return[n,c]},e}();!function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close"}(v||(v={}));var I,T=function(){function e(){this.observers=[]}return e.prototype.next=function(e){for(var t=0,n=this.observers;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?[2,Promise.reject(new Error("Unable to connect to the server with any of the available transports. "+i.join(" ")))]:[2,Promise.reject(new Error("None of the transports supported by the client are supported by the server."))]}}))}))},e.prototype.constructTransport=function(e){switch(e){case O.WebSockets:if(!this.options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new $(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.WebSocket,this.options.headers||{});case O.ServerSentEvents:if(!this.options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new W(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.EventSource,this.options.withCredentials,this.options.headers||{});case O.LongPolling:return new N(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.withCredentials,this.options.headers||{});default:throw new Error("Unknown transport: "+e+".")}},e.prototype.startTransport=function(e,t){var n=this;return this.transport.onreceive=this.onreceive,this.transport.onclose=function(e){return n.stopConnection(e)},this.transport.connect(e,t)},e.prototype.resolveTransportOrError=function(e,t,n){var r=O[e.transport];if(null==r)return this.logger.log(f.a.Debug,"Skipping transport '"+e.transport+"' because it is not supported by this client."),new Error("Skipping transport '"+e.transport+"' because it is not supported by this client.");if(!function(e,t){return!e||0!=(t&e)}(t,r))return this.logger.log(f.a.Debug,"Skipping transport '"+O[r]+"' because it was disabled by the client."),new Error("'"+O[r]+"' is disabled by the client.");if(!(e.transferFormats.map((function(e){return P[e]})).indexOf(n)>=0))return this.logger.log(f.a.Debug,"Skipping transport '"+O[r]+"' because it does not support the requested transfer format '"+P[n]+"'."),new Error("'"+O[r]+"' does not support "+P[n]+".");if(r===O.WebSockets&&!this.options.WebSocket||r===O.ServerSentEvents&&!this.options.EventSource)return this.logger.log(f.a.Debug,"Skipping transport '"+O[r]+"' because it is not supported in your environment.'"),new Error("'"+O[r]+"' is not supported in your environment.");this.logger.log(f.a.Debug,"Selecting transport '"+O[r]+"'.");try{return this.constructTransport(r)}catch(e){return e}},e.prototype.isITransport=function(e){return e&&"object"==typeof e&&"connect"in e},e.prototype.stopConnection=function(e){var t=this;if(this.logger.log(f.a.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(f.a.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(f.a.Error,"Connection disconnected with error '"+e+"'."):this.logger.log(f.a.Information,"Connection disconnected."),this.sendQueue&&(this.sendQueue.stop().catch((function(e){t.logger.log(f.a.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(f.a.Error,"HttpConnection.onclose("+e+") threw error '"+t+"'.")}}}else this.logger.log(f.a.Debug,"Call to HttpConnection.stopConnection("+e+") was ignored because the connection is already in the disconnected state.")},e.prototype.resolveUrl=function(e){if(0===e.lastIndexOf("https://",0)||0===e.lastIndexOf("http://",0))return e;if(!d.c.isBrowser||!window.document)throw new Error("Cannot resolve '"+e+"'.");var t=window.document.createElement("a");return t.href=e,this.logger.log(f.a.Information,"Normalizing '"+e+"' to '"+t.href+"'."),t.href},e.prototype.resolveNegotiateUrl=function(e){var t=e.indexOf("?"),n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",-1===(n+=-1===t?"":e.substring(t)).indexOf("negotiateVersion")&&(n+=-1===t?"?":"&",n+="negotiateVersion="+this.negotiateVersion),n},e}();var Q=function(){function e(e){this.transport=e,this.buffer=[],this.executing=!0,this.sendBufferedData=new Z,this.transportResult=new Z,this.sendLoopPromise=this.sendLoop()}return e.prototype.send=function(e){return this.bufferData(e),this.transportResult||(this.transportResult=new Z),this.transportResult.promise},e.prototype.stop=function(){return this.executing=!1,this.sendBufferedData.resolve(),this.sendLoopPromise},e.prototype.bufferData=function(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()},e.prototype.sendLoop=function(){return K(this,void 0,void 0,(function(){var t,n,r;return X(this,(function(o){switch(o.label){case 0:return[4,this.sendBufferedData.promise];case 1:if(o.sent(),!this.executing)return this.transportResult&&this.transportResult.reject("Connection stopped."),[3,6];this.sendBufferedData=new Z,t=this.transportResult,this.transportResult=void 0,n="string"==typeof this.buffer[0]?this.buffer.join(""):e.concatBuffers(this.buffer),this.buffer.length=0,o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.transport.send(n)];case 3:return o.sent(),t.resolve(),[3,5];case 4:return r=o.sent(),t.reject(r),[3,5];case 5:return[3,0];case 6:return[2]}}))}))},e.concatBuffers=function(e){for(var t=e.map((function(e){return e.byteLength})).reduce((function(e,t){return e+t})),n=new Uint8Array(t),r=0,o=0,i=e;o>=7)>0&&(r|=128),n.push(r)}while(t>0);t=e.byteLength||e.length;var o=new Uint8Array(n.length+t);return o.set(n,0),o.set(e,n.length),o.buffer},e.parse=function(e){for(var t=[],n=new Uint8Array(e),r=[0,7,14,21,28],o=0;o7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+i+s))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+i,o+i+s):n.subarray(o+i,o+i+s)),o=o+i+s}return t},e}();var ae=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=3?e[2]:void 0,error:e[1],type:v.Close}},e.prototype.createPingMessage=function(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:v.Ping}},e.prototype.createInvocationMessage=function(e,t){if(t.length<5)throw new Error("Invalid payload for Invocation message.");var n=t[2];return n?{arguments:t[4],headers:e,invocationId:n,streamIds:[],target:t[3],type:v.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:v.Invocation}},e.prototype.createStreamItemMessage=function(e,t){if(t.length<4)throw new Error("Invalid payload for StreamItem message.");return{headers:e,invocationId:t[2],item:t[3],type:v.StreamItem}},e.prototype.createCompletionMessage=function(e,t){if(t.length<4)throw new Error("Invalid payload for Completion message.");var n,r,o=t[3];if(o!==this.voidResult&&t.length<5)throw new Error("Invalid payload for Completion message.");switch(o){case this.errorResult:n=t[4];break;case this.nonVoidResult:r=t[4]}return{error:n,headers:e,invocationId:t[2],result:r,type:v.Completion}},e.prototype.writeInvocation=function(e){var t,n=ie(this.messagePackOptions);return t=e.streamIds?n.encode([v.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):n.encode([v.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),se.write(t.slice())},e.prototype.writeStreamInvocation=function(e){var t,n=ie(this.messagePackOptions);return t=e.streamIds?n.encode([v.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):n.encode([v.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),se.write(t.slice())},e.prototype.writeStreamItem=function(e){var t=ie(this.messagePackOptions).encode([v.StreamItem,e.headers||{},e.invocationId,e.item]);return se.write(t.slice())},e.prototype.writeCompletion=function(e){var t,n=ie(this.messagePackOptions),r=e.error?this.errorResult:e.result?this.nonVoidResult:this.voidResult;switch(r){case this.errorResult:t=n.encode([v.Completion,e.headers||{},e.invocationId,r,e.error]);break;case this.voidResult:t=n.encode([v.Completion,e.headers||{},e.invocationId,r]);break;case this.nonVoidResult:t=n.encode([v.Completion,e.headers||{},e.invocationId,r,e.result])}return se.write(t.slice())},e.prototype.writeCancelInvocation=function(e){var t=ie(this.messagePackOptions).encode([v.CancelInvocation,e.headers||{},e.invocationId]);return se.write(t.slice())},e.prototype.readHeaders=function(e){var t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t},e}(),le=n(19),he=n(20),fe=n(6);const de="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,pe=de?de.decode.bind(de):function(e){let t=0;const n=e.length,r=[],o=[];for(;t65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a)}r.length>1024&&(o.push(String.fromCharCode.apply(null,r)),r.length=0)}return o.push(String.fromCharCode.apply(null,r)),o.join("")};const ge=Math.pow(2,32),ye=Math.pow(2,21)-1;function be(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function me(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function ve(e,t){const n=me(e,t+4);if(n>ye)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*ge+me(e,t)}class we{constructor(e){this.batchData=e;const t=new ke(e);this.arrayRangeReader=new Ce(e),this.arrayBuilderSegmentReader=new Ie(e),this.diffReader=new Ee(e),this.editReader=new Se(e,t),this.frameReader=new _e(e,t)}updatedComponents(){return be(this.batchData,this.batchData.length-20)}referenceFrames(){return be(this.batchData,this.batchData.length-16)}disposedComponentIds(){return be(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return be(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return be(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return be(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return ve(this.batchData,n)}}class Ee{constructor(e){this.batchDataUint8=e}componentId(e){return be(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class Se{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return be(this.batchDataUint8,e)}siblingIndex(e){return be(this.batchDataUint8,e+4)}newTreeIndex(e){return be(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return be(this.batchDataUint8,e+8)}removedAttributeName(e){const t=be(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class _e{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return be(this.batchDataUint8,e)}subtreeLength(e){return be(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=be(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return be(this.batchDataUint8,e+8)}elementName(e){const t=be(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=be(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=be(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=be(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=be(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return ve(this.batchDataUint8,e+12)}}class ke{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=be(e,e.length-4)}readString(e){if(-1===e)return null;{const n=be(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const i=e[t+o];if(n|=(127&i)<this.nextBatchId)return this.fatalError?(this.logger.log(Te.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(Te.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(Te.Debug,`Applying batch ${e}.`),Object(fe.d)(this.browserRendererId,new we(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(Te.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(Te.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}class Re{constructor(){}log(e,t){}}Re.instance=new Re;class Oe{constructor(e){this.minimumLogLevel=e}log(e,t){if(e>=this.minimumLogLevel)switch(e){case Te.Critical:case Te.Error:console.error(`[${(new Date).toISOString()}] ${Te[e]}: ${t}`);break;case Te.Warning:console.warn(`[${(new Date).toISOString()}] ${Te[e]}: ${t}`);break;case Te.Information:console.info(`[${(new Date).toISOString()}] ${Te[e]}: ${t}`);break;default:console.log(`[${(new Date).toISOString()}] ${Te[e]}: ${t}`)}}}var Pe=n(5),je=n(2);class De{constructor(e){this.circuitId=void 0,this.components=e}reconnect(e){if(!this.circuitId)throw new Error("Circuit host not initialized.");return e.invoke("ConnectCircuit",this.circuitId)}initialize(e){if(this.circuitId)throw new Error(`Circuit host '${this.circuitId}' already initialized.`);this.circuitId=e}async startCircuit(e){const t=await e.invoke("StartCircuit",Pe.b.getBaseURI(),Pe.b.getLocationHref(),JSON.stringify(this.components.map(e=>e.toRecord())));return!!t&&(this.initialize(t),!0)}resolveElement(e){const t=Number.parseInt(e);if(Number.isNaN(t))throw new Error(`Invalid sequence number '${e}'.`);return Object(je.l)(this.components[t].start,this.components[t].end)}}var Me=n(10);const Ae={configureSignalR:e=>{},logLevel:Te.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class Be{constructor(e,t,n,r){this.maxRetries=t,this.document=n,this.logger=r,this.addedToDom=!1,this.modal=this.document.createElement("div"),this.modal.id=e,this.maxRetries=t;this.modal.style.cssText=["position: fixed","top: 0","right: 0","bottom: 0","left: 0","z-index: 1050","display: none","overflow: hidden","background-color: #fff","opacity: 0.8","text-align: center","font-weight: bold","transition: visibility 0s linear 500ms"].join(";"),this.modal.innerHTML='

Alternatively, reload

',this.message=this.modal.querySelector("h5"),this.button=this.modal.querySelector("button"),this.reloadParagraph=this.modal.querySelector("p"),this.loader=this.getLoader(),this.message.after(this.loader),this.button.addEventListener("click",async()=>{this.show();try{await window.Blazor.reconnect()||this.rejected()}catch(e){this.logger.log(Te.Error,e),this.failed()}}),this.reloadParagraph.querySelector("a").addEventListener("click",()=>location.reload())}show(){this.addedToDom||(this.addedToDom=!0,this.document.body.appendChild(this.modal)),this.modal.style.display="block",this.loader.style.display="inline-block",this.button.style.display="none",this.reloadParagraph.style.display="none",this.message.textContent="Attempting to reconnect to the server...",this.modal.style.visibility="hidden",setTimeout(()=>{this.modal.style.visibility="visible"},0)}update(e){this.message.textContent=`Attempting to reconnect to the server: ${e} of ${this.maxRetries}`}hide(){this.modal.style.display="none"}failed(){this.button.style.display="block",this.reloadParagraph.style.display="none",this.loader.style.display="none",this.message.innerHTML="Reconnection failed. Try reloading the page if you're unable to reconnect.",this.message.querySelector("a").addEventListener("click",()=>location.reload())}rejected(){this.button.style.display="none",this.reloadParagraph.style.display="none",this.loader.style.display="none",this.message.innerHTML="Could not reconnect to the server. Reload the page to restore functionality.",this.message.querySelector("a").addEventListener("click",()=>location.reload())}getLoader(){const e=this.document.createElement("div");return e.style.cssText=["border: 0.3em solid #f3f3f3","border-top: 0.3em solid #3498db","border-radius: 50%","width: 2em","height: 2em","display: inline-block"].join(";"),e.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:2e3,iterations:1/0}),e}}class Ue{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const r=this.document.getElementById(Ue.MaxRetriesId);r&&(r.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(Ue.ShowClassName)}update(e){const t=this.document.getElementById(Ue.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Ue.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Ue.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Ue.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Ue.ShowClassName,Ue.HideClassName,Ue.FailedClassName,Ue.RejectedClassName)}}Ue.ShowClassName="components-reconnect-show",Ue.HideClassName="components-reconnect-hide",Ue.FailedClassName="components-reconnect-failed",Ue.RejectedClassName="components-reconnect-rejected",Ue.MaxRetriesId="components-reconnect-max-retries",Ue.CurrentAttemptId="components-reconnect-current-attempt";class Le{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||(()=>window.Blazor.reconnect())}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new Ue(t,e.maxRetries,document):new Be(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new Ne(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class Ne{constructor(e,t,n,r){this.logger=t,this.reconnectCallback=n,this.isDisposed=!1,this.reconnectDisplay=r,this.reconnectDisplay.show(),this.attemptPeriodicReconnection(e)}dispose(){this.isDisposed=!0,this.reconnectDisplay.hide()}async attemptPeriodicReconnection(e){for(let t=0;tNe.MaximumFirstRetryInterval?Ne.MaximumFirstRetryInterval:e.retryIntervalMilliseconds;if(await this.delay(n),this.isDisposed)break;try{return await this.reconnectCallback()?void 0:void this.reconnectDisplay.rejected()}catch(e){this.logger.log(Te.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise(t=>setTimeout(t,e))}}Ne.MaximumFirstRetryInterval=3e3;var Fe=n(21),He=n(18);let qe=!1,We=!1;async function ze(e){if(We)throw new Error("Blazor has already started.");We=!0;const t=function(e){const t={...Ae,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...Ae.reconnectionOptions,...e.reconnectionOptions}),t}(e),n=new Oe(t.logLevel);window.Blazor.defaultReconnectionHandler=new Le(n),window.Blazor._internal.InputFile=He.a,t.reconnectionHandler=t.reconnectionHandler||window.Blazor.defaultReconnectionHandler,n.log(Te.Information,"Starting up blazor server-side application.");const r=Object(Fe.a)(document,"server"),o=new De(r),i=await Je(t,n,o);if(!await o.startCircuit(i))return void n.log(Te.Error,"Failed to start the circuit.");let s=!1;const a=()=>{if(!s){const e=new FormData,t=o.circuitId;e.append("circuitId",t),s=navigator.sendBeacon("_blazor/disconnect",e)}};window.Blazor.disconnect=a,window.addEventListener("unload",a,{capture:!1,once:!0}),window.Blazor.reconnect=async e=>{if(qe)return!1;const r=e||await Je(t,n,o);return await o.reconnect(r)?(t.reconnectionHandler.onConnectionUp(),!0):(n.log(Te.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)},n.log(Te.Information,"Blazor server-side application started.")}async function Je(e,t,n){const r=new ue;r.name="blazorpack";const i=(new oe).withUrl("_blazor").withHubProtocol(r);e.configureSignalR(i);const s=i.build();Object(Me.b)((e,t)=>{s.send("DispatchBrowserEvent",JSON.stringify(e),JSON.stringify(t))}),window.Blazor._internal.navigationManager.listenForNavigationEvents((e,t)=>s.send("OnLocationChanged",e,t)),s.on("JS.AttachComponent",(e,t)=>Object(fe.b)(0,n.resolveElement(t),e)),s.on("JS.BeginInvokeJS",o.a.jsCallDispatcher.beginInvokeJSFromDotNet),s.on("JS.EndInvokeDotNet",e=>o.a.jsCallDispatcher.endInvokeDotNetFromJS(...o.a.parseJsonWithRevivers(e)));const a=xe.getOrCreate(t);s.on("JS.RenderBatch",(e,n)=>{t.log(Te.Debug,`Received render batch with id ${e} and ${n.byteLength} bytes.`),a.processBatch(e,n,s)}),s.onclose(t=>!qe&&e.reconnectionHandler.onConnectionDown(e.reconnectionOptions,t)),s.on("JS.Error",e=>{qe=!0,Ye(s,e,t),Object(le.a)()}),window.Blazor._internal.forceCloseConnection=()=>s.stop();try{await s.start()}catch(e){Ye(s,e,t)}return o.a.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{s.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,r||0,o)},endInvokeJSFromDotNet:(e,t,n)=>{s.send("EndInvokeJSFromDotNet",e,t,n)}}),s}function Ye(e,t,n){n.log(Te.Error,t),e&&e.stop()}window.Blazor.start=ze,Object(he.a)()&&ze()}]); \ No newline at end of file +var r=n(16),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),s.prototype=Object.create(o.prototype),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";e.exports=i;var r=n(34),o=Object.create(n(17));function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}o.inherits=n(13),o.inherits(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){ +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ +var r=n(16),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),s.prototype=Object.create(o.prototype),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";var r=n(27).Transform,o=n(13),i=n(21);function s(e){(e=e||{}).objectMode=!0,e.highWaterMark=16,r.call(this,e),this._msgpack=e.msgpack}function a(e){if(!(this instanceof a))return(e=e||{}).msgpack=this,new a(e);s.call(this,e),this._wrap="wrap"in e&&e.wrap}function c(e){if(!(this instanceof c))return(e=e||{}).msgpack=this,new c(e);s.call(this,e),this._chunks=i(),this._wrap="wrap"in e&&e.wrap}o(s,r),o(a,s),a.prototype._transform=function(e,t,n){var r=null;try{r=this._msgpack.encode(this._wrap?e.value:e).slice(0)}catch(e){return this.emit("error",e),n()}this.push(r),n()},o(c,s),c.prototype._transform=function(e,t,n){e&&this._chunks.append(e);try{var r=this._msgpack.decode(this._chunks);this._wrap&&(r={value:r}),this.push(r)}catch(e){return void(e instanceof this._msgpack.IncompleteBufferError?n():this.emit("error",e))}this._chunks.length>0?this._transform(null,t,n):n()},e.exports.decoder=c,e.exports.encoder=a},function(e,t,n){"use strict";var r=n(21);function o(e){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e||"unable to decode"}n(23).inherits(o,Error),e.exports=function(e){return function(e){e instanceof r||(e=r().append(e));var t=i(e);if(t)return e.consume(t.bytesConsumed),t.value;throw new o};function t(e,t,n){return t>=n+e}function n(e,t){return{value:e,bytesConsumed:t}}function i(e,r){r=void 0===r?0:r;var o=e.length-r;if(o<=0)return null;var i,l,f,h=e.readUInt8(r),d=0;if(!function(e,t){var n=function(e){switch(e){case 196:return 2;case 197:return 3;case 198:return 5;case 199:return 3;case 200:return 4;case 201:return 6;case 202:return 5;case 203:return 9;case 204:return 2;case 205:return 3;case 206:return 5;case 207:return 9;case 208:return 2;case 209:return 3;case 210:return 5;case 211:return 9;case 212:return 3;case 213:return 4;case 214:return 6;case 215:return 10;case 216:return 18;case 217:return 2;case 218:return 3;case 219:return 5;case 222:return 3;default:return-1}}(e);return!(-1!==n&&t=0;f--)d+=e.readUInt8(r+f+1)*Math.pow(2,8*(7-f));return n(d,9);case 208:return n(d=e.readInt8(r+1),2);case 209:return n(d=e.readInt16BE(r+1),3);case 210:return n(d=e.readInt32BE(r+1),5);case 211:return n(d=function(e,t){var n=128==(128&e[t]);if(n)for(var r=1,o=t+7;o>=t;o--){var i=(255^e[o])+r;e[o]=255&i,r=i>>8}var s=e.readUInt32BE(t+0),a=e.readUInt32BE(t+4);return(4294967296*s+a)*(n?-1:1)}(e.slice(r+1,r+9),0),9);case 202:return n(d=e.readFloatBE(r+1),5);case 203:return n(d=e.readDoubleBE(r+1),9);case 217:return t(i=e.readUInt8(r+1),o,2)?n(d=e.toString("utf8",r+2,r+2+i),2+i):null;case 218:return t(i=e.readUInt16BE(r+1),o,3)?n(d=e.toString("utf8",r+3,r+3+i),3+i):null;case 219:return t(i=e.readUInt32BE(r+1),o,5)?n(d=e.toString("utf8",r+5,r+5+i),5+i):null;case 196:return t(i=e.readUInt8(r+1),o,2)?n(d=e.slice(r+2,r+2+i),2+i):null;case 197:return t(i=e.readUInt16BE(r+1),o,3)?n(d=e.slice(r+3,r+3+i),3+i):null;case 198:return t(i=e.readUInt32BE(r+1),o,5)?n(d=e.slice(r+5,r+5+i),5+i):null;case 220:return o<3?null:(i=e.readUInt16BE(r+1),s(e,r,i,3));case 221:return o<5?null:(i=e.readUInt32BE(r+1),s(e,r,i,5));case 222:return i=e.readUInt16BE(r+1),a(e,r,i,3);case 223:return i=e.readUInt32BE(r+1),a(e,r,i,5);case 212:return c(e,r,1);case 213:return c(e,r,2);case 214:return c(e,r,4);case 215:return c(e,r,8);case 216:return c(e,r,16);case 199:return i=e.readUInt8(r+1),l=e.readUInt8(r+2),t(i,o,3)?u(e,r,l,i,3):null;case 200:return i=e.readUInt16BE(r+1),l=e.readUInt8(r+3),t(i,o,4)?u(e,r,l,i,4):null;case 201:return i=e.readUInt32BE(r+1),l=e.readUInt8(r+5),t(i,o,6)?u(e,r,l,i,6):null}if(144==(240&h))return s(e,r,i=15&h,1);if(128==(240&h))return a(e,r,i=15&h,1);if(160==(224&h))return t(i=31&h,o,1)?n(d=e.toString("utf8",r+1,r+i+1),i+1):null;if(h>=224)return n(d=h-256,1);if(h<128)return n(h,1);throw new Error("not implemented yet")}function s(e,t,r,o){var s,a=[],c=0;for(t+=o,s=0;s0&&l.write(c,1)):f<=255&&!n?((l=r.allocUnsafe(2+f))[0]=217,l[1]=f,l.write(c,2)):f<=65535?((l=r.allocUnsafe(3+f))[0]=218,l.writeUInt16BE(f,1),l.write(c,3)):((l=r.allocUnsafe(5+f))[0]=219,l.writeUInt32BE(f,1),l.write(c,5));else if(c&&(c.readUInt32LE||c instanceof Uint8Array))c instanceof Uint8Array&&(c=r.from(c)),c.length<=255?((l=r.allocUnsafe(2))[0]=196,l[1]=c.length):c.length<=65535?((l=r.allocUnsafe(3))[0]=197,l.writeUInt16BE(c.length,1)):((l=r.allocUnsafe(5))[0]=198,l.writeUInt32BE(c.length,1)),l=o([l,c]);else if(Array.isArray(c))c.length<16?(l=r.allocUnsafe(1))[0]=144|c.length:c.length<65536?((l=r.allocUnsafe(3))[0]=220,l.writeUInt16BE(c.length,1)):((l=r.allocUnsafe(5))[0]=221,l.writeUInt32BE(c.length,1)),l=c.reduce((function(e,t){return e.append(a(t,!0)),e}),o().append(l));else{if(!s&&"function"==typeof c.getDate)return function(e){var t,n=1*e,i=Math.floor(n/1e3),s=1e6*(n-1e3*i);if(s||i>4294967295){(t=r.allocUnsafe(10))[0]=215,t[1]=-1;var a=4*s,c=i/Math.pow(2,32),u=a+c&4294967295,l=4294967295&i;t.writeInt32BE(u,2),t.writeInt32BE(l,6)}else(t=r.allocUnsafe(6))[0]=214,t[1]=-1,t.writeUInt32BE(Math.floor(n/1e3),2);return o().append(t)}(c);if("object"==typeof c)l=function(t){var n,i,s,a=[];for(n=0;n>8),a.push(255&s)):(a.push(201),a.push(s>>24),a.push(s>>16&255),a.push(s>>8&255),a.push(255&s));return o().append(r.from(a)).append(i)}(c)||function(e){var t,n,i=[],s=0;for(t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&"function"!=typeof e[t]&&(++s,i.push(a(t,!0)),i.push(a(e[t],!0)));s<16?(n=r.allocUnsafe(1))[0]=128|s:s<65535?((n=r.allocUnsafe(3))[0]=222,n.writeUInt16BE(s,1)):((n=r.allocUnsafe(5))[0]=223,n.writeUInt32BE(s,1));return i.unshift(n),i.reduce((function(e,t){return e.append(t)}),o())}(c);else if("number"==typeof c){if(function(e){return e%1!=0}(c))return i(c,t);if(c>=0)if(c<128)(l=r.allocUnsafe(1))[0]=c;else if(c<256)(l=r.allocUnsafe(2))[0]=204,l[1]=c;else if(c<65536)(l=r.allocUnsafe(3))[0]=205,l.writeUInt16BE(c,1);else if(c<=4294967295)(l=r.allocUnsafe(5))[0]=206,l.writeUInt32BE(c,1);else{if(!(c<=9007199254740991))return i(c,!0);(l=r.allocUnsafe(9))[0]=207,function(e,t){for(var n=7;n>=0;n--)e[n+1]=255&t,t/=256}(l,c)}else if(c>=-32)(l=r.allocUnsafe(1))[0]=256+c;else if(c>=-128)(l=r.allocUnsafe(2))[0]=208,l.writeInt8(c,1);else if(c>=-32768)(l=r.allocUnsafe(3))[0]=209,l.writeInt16BE(c,1);else if(c>-214748365)(l=r.allocUnsafe(5))[0]=210,l.writeInt32BE(c,1);else{if(!(c>=-9007199254740991))return i(c,!0);(l=r.allocUnsafe(9))[0]=211,function(e,t,n){var r=n<0;r&&(n=Math.abs(n));var o=n%4294967296,i=n/4294967296;if(e.writeUInt32BE(Math.floor(i),t+0),e.writeUInt32BE(o,t+4),r)for(var s=1,a=t+7;a>=t;a--){var c=(255^e[a])+s;e[a]=255&c,s=c>>8}}(l,1,c)}}}if(!l)throw new Error("not implemented yet");return u?l:l.slice()}return a}},function(e,t,n){"use strict";n.r(t);var r,o=n(4),i=(n(25),r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=function(e){function t(t,n){var r=this,o=this.constructor.prototype;return(r=e.call(this,t)||this).statusCode=n,r.__proto__=o,r}return i(t,e),t}(Error),a=function(e){function t(t){void 0===t&&(t="A timeout occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return i(t,e),t}(Error),c=function(e){function t(t){void 0===t&&(t="An abort occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return i(t,e),t}(Error),u=function(){return(u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=200&&o.status<300?n(new l(o.status,o.statusText,o.response||o.responseText)):r(new s(o.statusText,o.status))},o.onerror=function(){t.logger.log(h.a.Warning,"Error from HTTP request. "+o.status+": "+o.statusText+"."),r(new s(o.statusText,o.status))},o.ontimeout=function(){t.logger.log(h.a.Warning,"Timeout from HTTP request."),r(new a)},o.send(e.content||"")})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t}(f),S=function(){var e=function(t,n){return(e=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])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),I=function(e){function t(t){var n=e.call(this)||this;if("undefined"!=typeof fetch||d.c.isNode)n.httpClient=new b(t);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");n.httpClient=new E(t)}return n}return S(t,e),t.prototype.send=function(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new c):e.method?e.url?this.httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t.prototype.getCookieString=function(e){return this.httpClient.getCookieString(e)},t}(f),C=function(){function e(){}return e.write=function(t){return""+t+e.RecordSeparator},e.parse=function(t){if(t[t.length-1]!==e.RecordSeparator)throw new Error("Message is incomplete.");var n=t.split(e.RecordSeparator);return n.pop(),n},e.RecordSeparatorCode=30,e.RecordSeparator=String.fromCharCode(e.RecordSeparatorCode),e}(),k=function(){function e(){}return e.prototype.writeHandshakeRequest=function(e){return C.write(JSON.stringify(e))},e.prototype.parseHandshakeResponse=function(e){var t,n;if(Object(d.h)(e)){var r=new Uint8Array(e);if(-1===(i=r.indexOf(C.RecordSeparatorCode)))throw new Error("Message is incomplete.");var o=i+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(r.slice(0,o))),n=r.byteLength>o?r.slice(o).buffer:null}else{var i,s=e;if(-1===(i=s.indexOf(C.RecordSeparator)))throw new Error("Message is incomplete.");o=i+1;t=s.substring(0,o),n=s.length>o?s.substring(o):null}var a=C.parse(t),c=JSON.parse(a[0]);if(c.type)throw new Error("Expected a handshake response from the server.");return[n,c]},e}();!function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close"}(v||(v={}));var _,T=function(){function e(){this.observers=[]}return e.prototype.next=function(e){for(var t=0,n=this.observers;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?[2,Promise.reject(new Error("Unable to connect to the server with any of the available transports. "+i.join(" ")))]:[2,Promise.reject(new Error("None of the transports supported by the client are supported by the server."))]}}))}))},e.prototype.constructTransport=function(e){switch(e){case R.WebSockets:if(!this.options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new V(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.WebSocket,this.options.headers||{});case R.ServerSentEvents:if(!this.options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new z(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.EventSource,this.options.withCredentials,this.options.headers||{});case R.LongPolling:return new F(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.withCredentials,this.options.headers||{});default:throw new Error("Unknown transport: "+e+".")}},e.prototype.startTransport=function(e,t){var n=this;return this.transport.onreceive=this.onreceive,this.transport.onclose=function(e){return n.stopConnection(e)},this.transport.connect(e,t)},e.prototype.resolveTransportOrError=function(e,t,n){var r=R[e.transport];if(null==r)return this.logger.log(h.a.Debug,"Skipping transport '"+e.transport+"' because it is not supported by this client."),new Error("Skipping transport '"+e.transport+"' because it is not supported by this client.");if(!function(e,t){return!e||0!=(t&e)}(t,r))return this.logger.log(h.a.Debug,"Skipping transport '"+R[r]+"' because it was disabled by the client."),new Error("'"+R[r]+"' is disabled by the client.");if(!(e.transferFormats.map((function(e){return P[e]})).indexOf(n)>=0))return this.logger.log(h.a.Debug,"Skipping transport '"+R[r]+"' because it does not support the requested transfer format '"+P[n]+"'."),new Error("'"+R[r]+"' does not support "+P[n]+".");if(r===R.WebSockets&&!this.options.WebSocket||r===R.ServerSentEvents&&!this.options.EventSource)return this.logger.log(h.a.Debug,"Skipping transport '"+R[r]+"' because it is not supported in your environment.'"),new Error("'"+R[r]+"' is not supported in your environment.");this.logger.log(h.a.Debug,"Selecting transport '"+R[r]+"'.");try{return this.constructTransport(r)}catch(e){return e}},e.prototype.isITransport=function(e){return e&&"object"==typeof e&&"connect"in e},e.prototype.stopConnection=function(e){var t=this;if(this.logger.log(h.a.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(h.a.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(h.a.Error,"Connection disconnected with error '"+e+"'."):this.logger.log(h.a.Information,"Connection disconnected."),this.sendQueue&&(this.sendQueue.stop().catch((function(e){t.logger.log(h.a.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(h.a.Error,"HttpConnection.onclose("+e+") threw error '"+t+"'.")}}}else this.logger.log(h.a.Debug,"Call to HttpConnection.stopConnection("+e+") was ignored because the connection is already in the disconnected state.")},e.prototype.resolveUrl=function(e){if(0===e.lastIndexOf("https://",0)||0===e.lastIndexOf("http://",0))return e;if(!d.c.isBrowser||!window.document)throw new Error("Cannot resolve '"+e+"'.");var t=window.document.createElement("a");return t.href=e,this.logger.log(h.a.Information,"Normalizing '"+e+"' to '"+t.href+"'."),t.href},e.prototype.resolveNegotiateUrl=function(e){var t=e.indexOf("?"),n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",-1===(n+=-1===t?"":e.substring(t)).indexOf("negotiateVersion")&&(n+=-1===t?"?":"&",n+="negotiateVersion="+this.negotiateVersion),n},e}();var Z=function(){function e(e){this.transport=e,this.buffer=[],this.executing=!0,this.sendBufferedData=new ee,this.transportResult=new ee,this.sendLoopPromise=this.sendLoop()}return e.prototype.send=function(e){return this.bufferData(e),this.transportResult||(this.transportResult=new ee),this.transportResult.promise},e.prototype.stop=function(){return this.executing=!1,this.sendBufferedData.resolve(),this.sendLoopPromise},e.prototype.bufferData=function(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()},e.prototype.sendLoop=function(){return X(this,void 0,void 0,(function(){var t,n,r;return G(this,(function(o){switch(o.label){case 0:return[4,this.sendBufferedData.promise];case 1:if(o.sent(),!this.executing)return this.transportResult&&this.transportResult.reject("Connection stopped."),[3,6];this.sendBufferedData=new ee,t=this.transportResult,this.transportResult=void 0,n="string"==typeof this.buffer[0]?this.buffer.join(""):e.concatBuffers(this.buffer),this.buffer.length=0,o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.transport.send(n)];case 3:return o.sent(),t.resolve(),[3,5];case 4:return r=o.sent(),t.reject(r),[3,5];case 5:return[3,0];case 6:return[2]}}))}))},e.concatBuffers=function(e){for(var t=e.map((function(e){return e.byteLength})).reduce((function(e,t){return e+t})),n=new Uint8Array(t),r=0,o=0,i=e;o>=7)>0&&(r|=128),n.push(r)}while(t>0);t=e.byteLength||e.length;var o=new Uint8Array(n.length+t);return o.set(n,0),o.set(e,n.length),o.buffer},e.parse=function(e){for(var t=[],n=new Uint8Array(e),r=[0,7,14,21,28],o=0;o7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+i+s))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+i,o+i+s):n.subarray(o+i,o+i+s)),o=o+i+s}return t},e}();var ce=function(){return(ce=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=3?e[2]:void 0,error:e[1],type:v.Close}},e.prototype.createPingMessage=function(e){if(e.length<1)throw new Error("Invalid payload for Ping message.");return{type:v.Ping}},e.prototype.createInvocationMessage=function(e,t){if(t.length<5)throw new Error("Invalid payload for Invocation message.");var n=t[2];return n?{arguments:t[4],headers:e,invocationId:n,streamIds:[],target:t[3],type:v.Invocation}:{arguments:t[4],headers:e,streamIds:[],target:t[3],type:v.Invocation}},e.prototype.createStreamItemMessage=function(e,t){if(t.length<4)throw new Error("Invalid payload for StreamItem message.");return{headers:e,invocationId:t[2],item:t[3],type:v.StreamItem}},e.prototype.createCompletionMessage=function(e,t){if(t.length<4)throw new Error("Invalid payload for Completion message.");var n,r,o=t[3];if(o!==this.voidResult&&t.length<5)throw new Error("Invalid payload for Completion message.");switch(o){case this.errorResult:n=t[4];break;case this.nonVoidResult:r=t[4]}return{error:n,headers:e,invocationId:t[2],result:r,type:v.Completion}},e.prototype.writeInvocation=function(e){var t,n=se(this.messagePackOptions);return t=e.streamIds?n.encode([v.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments,e.streamIds]):n.encode([v.Invocation,e.headers||{},e.invocationId||null,e.target,e.arguments]),ae.write(t.slice())},e.prototype.writeStreamInvocation=function(e){var t,n=se(this.messagePackOptions);return t=e.streamIds?n.encode([v.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments,e.streamIds]):n.encode([v.StreamInvocation,e.headers||{},e.invocationId,e.target,e.arguments]),ae.write(t.slice())},e.prototype.writeStreamItem=function(e){var t=se(this.messagePackOptions).encode([v.StreamItem,e.headers||{},e.invocationId,e.item]);return ae.write(t.slice())},e.prototype.writeCompletion=function(e){var t,n=se(this.messagePackOptions),r=e.error?this.errorResult:e.result?this.nonVoidResult:this.voidResult;switch(r){case this.errorResult:t=n.encode([v.Completion,e.headers||{},e.invocationId,r,e.error]);break;case this.voidResult:t=n.encode([v.Completion,e.headers||{},e.invocationId,r]);break;case this.nonVoidResult:t=n.encode([v.Completion,e.headers||{},e.invocationId,r,e.result])}return ae.write(t.slice())},e.prototype.writeCancelInvocation=function(e){var t=se(this.messagePackOptions).encode([v.CancelInvocation,e.headers||{},e.invocationId]);return ae.write(t.slice())},e.prototype.readHeaders=function(e){var t=e[1];if("object"!=typeof t)throw new Error("Invalid headers.");return t},e}(),fe=n(18),he=n(19),de=n(7);const pe="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,ge=pe?pe.decode.bind(pe):function(e){let t=0;const n=e.length,r=[],o=[];for(;t65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a)}r.length>1024&&(o.push(String.fromCharCode.apply(null,r)),r.length=0)}return o.push(String.fromCharCode.apply(null,r)),o.join("")};const ye=Math.pow(2,32),me=Math.pow(2,21)-1;function be(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function ve(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24>>>0)}function we(e,t){const n=ve(e,t+4);if(n>me)throw new Error(`Cannot read uint64 with high order part ${n}, because the result would exceed Number.MAX_SAFE_INTEGER.`);return n*ye+ve(e,t)}class Ee{constructor(e){this.batchData=e;const t=new ke(e);this.arrayRangeReader=new _e(e),this.arrayBuilderSegmentReader=new Te(e),this.diffReader=new Se(e),this.editReader=new Ie(e,t),this.frameReader=new Ce(e,t)}updatedComponents(){return be(this.batchData,this.batchData.length-20)}referenceFrames(){return be(this.batchData,this.batchData.length-16)}disposedComponentIds(){return be(this.batchData,this.batchData.length-12)}disposedEventHandlerIds(){return be(this.batchData,this.batchData.length-8)}updatedComponentsEntry(e,t){const n=e+4*t;return be(this.batchData,n)}referenceFramesEntry(e,t){return e+20*t}disposedComponentIdsEntry(e,t){const n=e+4*t;return be(this.batchData,n)}disposedEventHandlerIdsEntry(e,t){const n=e+8*t;return we(this.batchData,n)}}class Se{constructor(e){this.batchDataUint8=e}componentId(e){return be(this.batchDataUint8,e)}edits(e){return e+4}editsEntry(e,t){return e+16*t}}class Ie{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}editType(e){return be(this.batchDataUint8,e)}siblingIndex(e){return be(this.batchDataUint8,e+4)}newTreeIndex(e){return be(this.batchDataUint8,e+8)}moveToSiblingIndex(e){return be(this.batchDataUint8,e+8)}removedAttributeName(e){const t=be(this.batchDataUint8,e+12);return this.stringReader.readString(t)}}class Ce{constructor(e,t){this.batchDataUint8=e,this.stringReader=t}frameType(e){return be(this.batchDataUint8,e)}subtreeLength(e){return be(this.batchDataUint8,e+4)}elementReferenceCaptureId(e){const t=be(this.batchDataUint8,e+4);return this.stringReader.readString(t)}componentId(e){return be(this.batchDataUint8,e+8)}elementName(e){const t=be(this.batchDataUint8,e+8);return this.stringReader.readString(t)}textContent(e){const t=be(this.batchDataUint8,e+4);return this.stringReader.readString(t)}markupContent(e){const t=be(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeName(e){const t=be(this.batchDataUint8,e+4);return this.stringReader.readString(t)}attributeValue(e){const t=be(this.batchDataUint8,e+8);return this.stringReader.readString(t)}attributeEventHandlerId(e){return we(this.batchDataUint8,e+12)}}class ke{constructor(e){this.batchDataUint8=e,this.stringTableStartIndex=be(e,e.length-4)}readString(e){if(-1===e)return null;{const n=be(this.batchDataUint8,this.stringTableStartIndex+4*e),r=function(e,t){let n=0,r=0;for(let o=0;o<4;o++){const i=e[t+o];if(n|=(127&i)<this.nextBatchId)return this.fatalError?(this.logger.log(Oe.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(Oe.Debug,`Waiting for batch ${this.nextBatchId}. Batch ${e} not processed.`);try{this.nextBatchId++,this.logger.log(Oe.Debug,`Applying batch ${e}.`),Object(de.d)(this.browserRendererId,new Ee(t)),await this.completeBatch(n,e)}catch(t){throw this.fatalError=t.toString(),this.logger.log(Oe.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(Oe.Warning,`Failed to deliver completion notification for render '${t}'.`)}}}class Re{constructor(){}log(e,t){}}Re.instance=new Re;class Pe{constructor(e){this.minimumLogLevel=e}log(e,t){if(e>=this.minimumLogLevel)switch(e){case Oe.Critical:case Oe.Error:console.error(`[${(new Date).toISOString()}] ${Oe[e]}: ${t}`);break;case Oe.Warning:console.warn(`[${(new Date).toISOString()}] ${Oe[e]}: ${t}`);break;case Oe.Information:console.info(`[${(new Date).toISOString()}] ${Oe[e]}: ${t}`);break;default:console.log(`[${(new Date).toISOString()}] ${Oe[e]}: ${t}`)}}}var je=n(6),De=n(2);class Ae{constructor(e){this.circuitId=void 0,this.components=e}reconnect(e){if(!this.circuitId)throw new Error("Circuit host not initialized.");return e.invoke("ConnectCircuit",this.circuitId)}initialize(e){if(this.circuitId)throw new Error(`Circuit host '${this.circuitId}' already initialized.`);this.circuitId=e}async startCircuit(e){const t=await e.invoke("StartCircuit",je.b.getBaseURI(),je.b.getLocationHref(),JSON.stringify(this.components.map(e=>e.toRecord())));return!!t&&(this.initialize(t),!0)}resolveElement(e){const t=Number.parseInt(e);if(Number.isNaN(t))throw new Error(`Invalid sequence number '${e}'.`);return Object(De.l)(this.components[t].start,this.components[t].end)}}var Be=n(8);const Me={configureSignalR:e=>{},logLevel:Oe.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}};class Ne{constructor(e,t,n,r){this.maxRetries=t,this.document=n,this.logger=r,this.addedToDom=!1,this.modal=this.document.createElement("div"),this.modal.id=e,this.maxRetries=t;this.modal.style.cssText=["position: fixed","top: 0","right: 0","bottom: 0","left: 0","z-index: 1050","display: none","overflow: hidden","background-color: #fff","opacity: 0.8","text-align: center","font-weight: bold","transition: visibility 0s linear 500ms"].join(";"),this.modal.innerHTML='

Alternatively, reload

',this.message=this.modal.querySelector("h5"),this.button=this.modal.querySelector("button"),this.reloadParagraph=this.modal.querySelector("p"),this.loader=this.getLoader(),this.message.after(this.loader),this.button.addEventListener("click",async()=>{this.show();try{await window.Blazor.reconnect()||this.rejected()}catch(e){this.logger.log(Oe.Error,e),this.failed()}}),this.reloadParagraph.querySelector("a").addEventListener("click",()=>location.reload())}show(){this.addedToDom||(this.addedToDom=!0,this.document.body.appendChild(this.modal)),this.modal.style.display="block",this.loader.style.display="inline-block",this.button.style.display="none",this.reloadParagraph.style.display="none",this.message.textContent="Attempting to reconnect to the server...",this.modal.style.visibility="hidden",setTimeout(()=>{this.modal.style.visibility="visible"},0)}update(e){this.message.textContent=`Attempting to reconnect to the server: ${e} of ${this.maxRetries}`}hide(){this.modal.style.display="none"}failed(){this.button.style.display="block",this.reloadParagraph.style.display="none",this.loader.style.display="none",this.message.innerHTML="Reconnection failed. Try reloading the page if you're unable to reconnect.",this.message.querySelector("a").addEventListener("click",()=>location.reload())}rejected(){this.button.style.display="none",this.reloadParagraph.style.display="none",this.loader.style.display="none",this.message.innerHTML="Could not reconnect to the server. Reload the page to restore functionality.",this.message.querySelector("a").addEventListener("click",()=>location.reload())}getLoader(){const e=this.document.createElement("div");return e.style.cssText=["border: 0.3em solid #f3f3f3","border-top: 0.3em solid #3498db","border-radius: 50%","width: 2em","height: 2em","display: inline-block"].join(";"),e.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:2e3,iterations:1/0}),e}}class Ue{constructor(e,t,n){this.dialog=e,this.maxRetries=t,this.document=n,this.document=n;const r=this.document.getElementById(Ue.MaxRetriesId);r&&(r.innerText=this.maxRetries.toString())}show(){this.removeClasses(),this.dialog.classList.add(Ue.ShowClassName)}update(e){const t=this.document.getElementById(Ue.CurrentAttemptId);t&&(t.innerText=e.toString())}hide(){this.removeClasses(),this.dialog.classList.add(Ue.HideClassName)}failed(){this.removeClasses(),this.dialog.classList.add(Ue.FailedClassName)}rejected(){this.removeClasses(),this.dialog.classList.add(Ue.RejectedClassName)}removeClasses(){this.dialog.classList.remove(Ue.ShowClassName,Ue.HideClassName,Ue.FailedClassName,Ue.RejectedClassName)}}Ue.ShowClassName="components-reconnect-show",Ue.HideClassName="components-reconnect-hide",Ue.FailedClassName="components-reconnect-failed",Ue.RejectedClassName="components-reconnect-rejected",Ue.MaxRetriesId="components-reconnect-max-retries",Ue.CurrentAttemptId="components-reconnect-current-attempt";class Le{constructor(e,t,n){this._currentReconnectionProcess=null,this._logger=e,this._reconnectionDisplay=t,this._reconnectCallback=n||(()=>window.Blazor.reconnect())}onConnectionDown(e,t){if(!this._reconnectionDisplay){const t=document.getElementById(e.dialogId);this._reconnectionDisplay=t?new Ue(t,e.maxRetries,document):new Ne(e.dialogId,e.maxRetries,document,this._logger)}this._currentReconnectionProcess||(this._currentReconnectionProcess=new Fe(e,this._logger,this._reconnectCallback,this._reconnectionDisplay))}onConnectionUp(){this._currentReconnectionProcess&&(this._currentReconnectionProcess.dispose(),this._currentReconnectionProcess=null)}}class Fe{constructor(e,t,n,r){this.logger=t,this.reconnectCallback=n,this.isDisposed=!1,this.reconnectDisplay=r,this.reconnectDisplay.show(),this.attemptPeriodicReconnection(e)}dispose(){this.isDisposed=!0,this.reconnectDisplay.hide()}async attemptPeriodicReconnection(e){for(let t=0;tFe.MaximumFirstRetryInterval?Fe.MaximumFirstRetryInterval:e.retryIntervalMilliseconds;if(await this.delay(n),this.isDisposed)break;try{return await this.reconnectCallback()?void 0:void this.reconnectDisplay.rejected()}catch(e){this.logger.log(Oe.Error,e)}}this.reconnectDisplay.failed()}delay(e){return new Promise(t=>setTimeout(t,e))}}Fe.MaximumFirstRetryInterval=3e3;var He=n(20),qe=n(15);let We=!1,ze=!1;async function Je(e){if(ze)throw new Error("Blazor has already started.");ze=!0;const t=function(e){const t={...Me,...e};return e&&e.reconnectionOptions&&(t.reconnectionOptions={...Me.reconnectionOptions,...e.reconnectionOptions}),t}(e),n=new Pe(t.logLevel);window.Blazor.defaultReconnectionHandler=new Le(n),window.Blazor._internal.InputFile=qe.a,t.reconnectionHandler=t.reconnectionHandler||window.Blazor.defaultReconnectionHandler,n.log(Oe.Information,"Starting up blazor server-side application.");const r=Object(He.a)(document,"server"),o=new Ae(r),i=await Ye(t,n,o);if(!await o.startCircuit(i))return void n.log(Oe.Error,"Failed to start the circuit.");let s=!1;const a=()=>{if(!s){const e=new FormData,t=o.circuitId;e.append("circuitId",t),s=navigator.sendBeacon("_blazor/disconnect",e)}};window.Blazor.disconnect=a,window.addEventListener("unload",a,{capture:!1,once:!0}),window.Blazor.reconnect=async e=>{if(We)return!1;const r=e||await Ye(t,n,o);return await o.reconnect(r)?(t.reconnectionHandler.onConnectionUp(),!0):(n.log(Oe.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)},n.log(Oe.Information,"Blazor server-side application started.")}async function Ye(e,t,n){const r=new le;r.name="blazorpack";const i=(new ie).withUrl("_blazor").withHubProtocol(r);e.configureSignalR(i);const s=i.build();Object(Be.b)((e,t)=>{s.send("DispatchBrowserEvent",JSON.stringify(e),JSON.stringify(t))}),window.Blazor._internal.navigationManager.listenForNavigationEvents((e,t)=>s.send("OnLocationChanged",e,t)),s.on("JS.AttachComponent",(e,t)=>Object(de.b)(0,n.resolveElement(t),e)),s.on("JS.BeginInvokeJS",o.a.jsCallDispatcher.beginInvokeJSFromDotNet),s.on("JS.EndInvokeDotNet",e=>o.a.jsCallDispatcher.endInvokeDotNetFromJS(...o.a.parseJsonWithRevivers(e)));const a=xe.getOrCreate(t);s.on("JS.RenderBatch",(e,n)=>{t.log(Oe.Debug,`Received render batch with id ${e} and ${n.byteLength} bytes.`),a.processBatch(e,n,s)}),s.onclose(t=>!We&&e.reconnectionHandler.onConnectionDown(e.reconnectionOptions,t)),s.on("JS.Error",e=>{We=!0,$e(s,e,t),Object(fe.a)()}),window.Blazor._internal.forceCloseConnection=()=>s.stop();try{await s.start()}catch(e){$e(s,e,t)}return o.a.attachDispatcher({beginInvokeDotNetFromJS:(e,t,n,r,o)=>{s.send("BeginInvokeDotNetFromJS",e?e.toString():null,t,n,r||0,o)},endInvokeJSFromDotNet:(e,t,n)=>{s.send("EndInvokeJSFromDotNet",e,t,n)}}),s}function $e(e,t,n){n.log(Oe.Error,t),e&&e.stop()}window.Blazor.start=Je,Object(he.a)()&&Je()}]); \ No newline at end of file diff --git a/src/Components/Web.JS/src/Boot.Server.ts b/src/Components/Web.JS/src/Boot.Server.ts index ca6ddf28606d..8fd6135e0be7 100644 --- a/src/Components/Web.JS/src/Boot.Server.ts +++ b/src/Components/Web.JS/src/Boot.Server.ts @@ -8,7 +8,7 @@ import { RenderQueue } from './Platform/Circuits/RenderQueue'; import { ConsoleLogger } from './Platform/Logging/Loggers'; import { LogLevel, Logger } from './Platform/Logging/Logger'; import { CircuitDescriptor } from './Platform/Circuits/CircuitManager'; -import { setEventDispatcher } from './Rendering/RendererEventDispatcher'; +import { setEventDispatcher } from './Rendering/Events/EventDispatcher'; import { resolveOptions, CircuitStartOptions } from './Platform/Circuits/CircuitStartOptions'; import { DefaultReconnectionHandler } from './Platform/Circuits/DefaultReconnectionHandler'; import { attachRootComponentToLogicalElement } from './Rendering/Renderer'; diff --git a/src/Components/Web.JS/src/Boot.WebAssembly.ts b/src/Components/Web.JS/src/Boot.WebAssembly.ts index d5acaae49b4a..235a5b9ecd10 100644 --- a/src/Components/Web.JS/src/Boot.WebAssembly.ts +++ b/src/Components/Web.JS/src/Boot.WebAssembly.ts @@ -5,7 +5,7 @@ import { monoPlatform } from './Platform/Mono/MonoPlatform'; import { renderBatch, getRendererer, attachRootComponentToElement, attachRootComponentToLogicalElement } from './Rendering/Renderer'; import { SharedMemoryRenderBatch } from './Rendering/RenderBatch/SharedMemoryRenderBatch'; import { shouldAutoStart } from './BootCommon'; -import { setEventDispatcher } from './Rendering/RendererEventDispatcher'; +import { setEventDispatcher } from './Rendering/Events/EventDispatcher'; import { WebAssemblyResourceLoader } from './Platform/WebAssemblyResourceLoader'; import { WebAssemblyConfigLoader } from './Platform/WebAssemblyConfigLoader'; import { BootConfigResult } from './Platform/BootConfig'; diff --git a/src/Components/Web.JS/src/GlobalExports.ts b/src/Components/Web.JS/src/GlobalExports.ts index facb2eea445d..1443192e477a 100644 --- a/src/Components/Web.JS/src/GlobalExports.ts +++ b/src/Components/Web.JS/src/GlobalExports.ts @@ -1,10 +1,12 @@ import { navigateTo, internalFunctions as navigationManagerInternalFunctions } from './Services/NavigationManager'; import { domFunctions } from './DomWrapper'; import { Virtualize } from './Virtualize'; +import { registerCustomEventType } from './Rendering/Events/EventTypes'; // Make the following APIs available in global scope for invocation from JS window['Blazor'] = { navigateTo, + registerCustomEventType, _internal: { navigationManager: navigationManagerInternalFunctions, diff --git a/src/Components/Web.JS/src/Rendering/BrowserRenderer.ts b/src/Components/Web.JS/src/Rendering/BrowserRenderer.ts index 3fab6a2cd0c8..d541724dc547 100644 --- a/src/Components/Web.JS/src/Rendering/BrowserRenderer.ts +++ b/src/Components/Web.JS/src/Rendering/BrowserRenderer.ts @@ -1,15 +1,11 @@ import { RenderBatch, ArrayBuilderSegment, RenderTreeEdit, RenderTreeFrame, EditType, FrameType, ArrayValues } from './RenderBatch/RenderBatch'; -import { EventDelegator } from './EventDelegator'; -import { EventForDotNet, UIEventArgs, EventArgsType } from './EventForDotNet'; +import { EventDelegator } from './Events/EventDelegator'; import { LogicalElement, PermutationListEntry, toLogicalElement, insertLogicalChild, removeLogicalChild, getLogicalParent, getLogicalChild, createAndInsertLogicalContainer, isSvgElement, getLogicalChildrenArray, getLogicalSiblingEnd, permuteLogicalChildren, getClosestDomElement } from './LogicalElements'; import { applyCaptureIdToElement } from './ElementReferenceCapture'; -import { EventFieldInfo } from './EventFieldInfo'; -import { dispatchEvent } from './RendererEventDispatcher'; import { attachToEventDelegator as attachNavigationManagerToEventDelegator } from '../Services/NavigationManager'; const selectValuePropname = '_blazorSelectValue'; const sharedTemplateElemForParsing = document.createElement('template'); const sharedSvgElemForParsing = document.createElementNS('http://www.w3.org/2000/svg', 'g'); -const preventDefaultEvents: { [eventType: string]: boolean } = { submit: true }; const rootComponentsPendingFirstRender: { [componentId: number]: LogicalElement } = {}; const internalAttributeNamePrefix = '__internal_'; const eventPreventDefaultAttributeNamePrefix = 'preventDefault_'; @@ -20,13 +16,8 @@ export class BrowserRenderer { private childComponentLocations: { [componentId: number]: LogicalElement } = {}; - private browserRendererId: number; - public constructor(browserRendererId: number) { - this.browserRendererId = browserRendererId; - this.eventDelegator = new EventDelegator((event, eventHandlerId, eventArgs, eventFieldInfo) => { - raiseEvent(event, this.browserRendererId, eventHandlerId, eventArgs, eventFieldInfo); - }); + this.eventDelegator = new EventDelegator(browserRendererId); // We don't yet know whether or not navigation interception will be enabled, but in case it will be, // we wire up the navigation manager to the event delegator so it has the option to participate @@ -459,13 +450,6 @@ export interface ComponentDescriptor { end: Node; } -export interface EventDescriptor { - browserRendererId: number; - eventHandlerId: number; - eventArgsType: EventArgsType; - eventFieldInfo: EventFieldInfo | null; -} - function parseMarkup(markup: string, isSvg: boolean) { if (isSvg) { sharedSvgElemForParsing.innerHTML = markup || ' '; @@ -491,27 +475,6 @@ function countDescendantFrames(batch: RenderBatch, frame: RenderTreeFrame): numb } } -function raiseEvent( - event: Event, - browserRendererId: number, - eventHandlerId: number, - eventArgs: EventForDotNet, - eventFieldInfo: EventFieldInfo | null -): void { - if (preventDefaultEvents[event.type]) { - event.preventDefault(); - } - - const eventDescriptor = { - browserRendererId, - eventHandlerId, - eventArgsType: eventArgs.type, - eventFieldInfo: eventFieldInfo, - }; - - dispatchEvent(eventDescriptor, eventArgs.data); -} - function clearElement(element: Element) { let childNode: Node | null; while (childNode = element.firstChild) { diff --git a/src/Components/Web.JS/src/Rendering/EventForDotNet.ts b/src/Components/Web.JS/src/Rendering/EventForDotNet.ts deleted file mode 100644 index 8c6222e775b5..000000000000 --- a/src/Components/Web.JS/src/Rendering/EventForDotNet.ts +++ /dev/null @@ -1,378 +0,0 @@ -export class EventForDotNet { - public constructor(public readonly type: EventArgsType, public readonly data: TData) { - } - - public static fromDOMEvent(event: Event): EventForDotNet { - const element = event.target as Element; - switch (event.type) { - - case 'input': - case 'change': { - - if (isTimeBasedInput(element)) { - const normalizedValue = normalizeTimeBasedValue(element); - return new EventForDotNet('change', { type: event.type, value: normalizedValue }); - } - - const targetIsCheckbox = isCheckbox(element); - const newValue = targetIsCheckbox ? !!element['checked'] : element['value']; - return new EventForDotNet('change', { type: event.type, value: newValue }); - } - - case 'copy': - case 'cut': - case 'paste': - return new EventForDotNet('clipboard', { type: event.type }); - - case 'drag': - case 'dragend': - case 'dragenter': - case 'dragleave': - case 'dragover': - case 'dragstart': - case 'drop': - return new EventForDotNet('drag', parseDragEvent(event)); - - case 'focus': - case 'blur': - case 'focusin': - case 'focusout': - return new EventForDotNet('focus', { type: event.type }); - - case 'keydown': - case 'keyup': - case 'keypress': - return new EventForDotNet('keyboard', parseKeyboardEvent(event as KeyboardEvent)); - - case 'contextmenu': - case 'click': - case 'mouseover': - case 'mouseout': - case 'mousemove': - case 'mousedown': - case 'mouseup': - case 'dblclick': - return new EventForDotNet('mouse', parseMouseEvent(event as MouseEvent)); - - case 'error': - return new EventForDotNet('error', parseErrorEvent(event as ErrorEvent)); - - case 'loadstart': - case 'timeout': - case 'abort': - case 'load': - case 'loadend': - case 'progress': - return new EventForDotNet('progress', parseProgressEvent(event as ProgressEvent)); - - case 'touchcancel': - case 'touchend': - case 'touchmove': - case 'touchenter': - case 'touchleave': - case 'touchstart': - return new EventForDotNet('touch', parseTouchEvent(event as TouchEvent)); - - case 'gotpointercapture': - case 'lostpointercapture': - case 'pointercancel': - case 'pointerdown': - case 'pointerenter': - case 'pointerleave': - case 'pointermove': - case 'pointerout': - case 'pointerover': - case 'pointerup': - return new EventForDotNet('pointer', parsePointerEvent(event as PointerEvent)); - - case 'wheel': - case 'mousewheel': - return new EventForDotNet('wheel', parseWheelEvent(event as WheelEvent)); - - case 'toggle': - return new EventForDotNet('toggle', { type: event.type }); - - default: - return new EventForDotNet('unknown', { type: event.type }); - } - } -} - -function parseDragEvent(event: any) { - return { - ...parseMouseEvent(event), - dataTransfer: event.dataTransfer, - - }; -} - -function parseWheelEvent(event: WheelEvent) { - return { - ...parseMouseEvent(event), - deltaX: event.deltaX, - deltaY: event.deltaY, - deltaZ: event.deltaZ, - deltaMode: event.deltaMode, - }; -} - -function parseErrorEvent(event: ErrorEvent) { - return { - type: event.type, - message: event.message, - filename: event.filename, - lineno: event.lineno, - colno: event.colno, - }; -} - -function parseProgressEvent(event: ProgressEvent) { - return { - type: event.type, - lengthComputable: event.lengthComputable, - loaded: event.loaded, - total: event.total, - }; -} - -function parseTouchEvent(event: TouchEvent) { - - function parseTouch(touchList: TouchList) { - const touches: UITouchPoint[] = []; - - for (let i = 0; i < touchList.length; i++) { - const touch = touchList[i]; - touches.push({ - identifier: touch.identifier, - clientX: touch.clientX, - clientY: touch.clientY, - screenX: touch.screenX, - screenY: touch.screenY, - pageX: touch.pageX, - pageY: touch.pageY, - }); - } - return touches; - } - - return { - type: event.type, - detail: event.detail, - touches: parseTouch(event.touches), - targetTouches: parseTouch(event.targetTouches), - changedTouches: parseTouch(event.changedTouches), - ctrlKey: event.ctrlKey, - shiftKey: event.shiftKey, - altKey: event.altKey, - metaKey: event.metaKey, - }; -} - -function parseKeyboardEvent(event: KeyboardEvent) { - return { - type: event.type, - key: event.key, - code: event.code, - location: event.location, - repeat: event.repeat, - ctrlKey: event.ctrlKey, - shiftKey: event.shiftKey, - altKey: event.altKey, - metaKey: event.metaKey, - }; -} - -function parsePointerEvent(event: PointerEvent) { - return { - ...parseMouseEvent(event), - pointerId: event.pointerId, - width: event.width, - height: event.height, - pressure: event.pressure, - tiltX: event.tiltX, - tiltY: event.tiltY, - pointerType: event.pointerType, - isPrimary: event.isPrimary, - }; -} - -function parseMouseEvent(event: MouseEvent) { - return { - type: event.type, - detail: event.detail, - screenX: event.screenX, - screenY: event.screenY, - clientX: event.clientX, - clientY: event.clientY, - offsetX: event.offsetX, - offsetY: event.offsetY, - button: event.button, - buttons: event.buttons, - ctrlKey: event.ctrlKey, - shiftKey: event.shiftKey, - altKey: event.altKey, - metaKey: event.metaKey, - }; -} - -function isCheckbox(element: Element | null): boolean { - return !!element && element.tagName === 'INPUT' && element.getAttribute('type') === 'checkbox'; -} - -const timeBasedInputs = [ - 'date', - 'datetime-local', - 'month', - 'time', - 'week', -]; - -function isTimeBasedInput(element: Element): element is HTMLInputElement { - return timeBasedInputs.indexOf(element.getAttribute('type')!) !== -1; -} - -function normalizeTimeBasedValue(element: HTMLInputElement): string { - const value = element.value; - const type = element.type; - switch (type) { - case 'date': - case 'datetime-local': - case 'month': - return value; - case 'time': - return value.length === 5 ? value + ':00' : value; // Convert hh:mm to hh:mm:00 - case 'week': - // For now we are not going to normalize input type week as it is not trivial - return value; - } - - throw new Error(`Invalid element type '${type}'.`); -} - -// The following interfaces must be kept in sync with the UIEventArgs C# classes - -export type EventArgsType = 'change' | 'clipboard' | 'drag' | 'error' | 'focus' | 'keyboard' | 'mouse' | 'pointer' | 'progress' | 'touch' | 'unknown' | 'wheel' | 'toggle'; - -export interface UIEventArgs { - type: string; -} - -interface UIChangeEventArgs extends UIEventArgs { - value: string | boolean; -} - -interface UIClipboardEventArgs extends UIEventArgs { -} - -interface UIDragEventArgs extends UIEventArgs { - detail: number; - dataTransfer: UIDataTransfer; - screenX: number; - screenY: number; - clientX: number; - clientY: number; - button: number; - buttons: number; - ctrlKey: boolean; - shiftKey: boolean; - altKey: boolean; - metaKey: boolean; -} - -interface UIDataTransfer { - dropEffect: string; - effectAllowed: string; - files: string[]; - items: UIDataTransferItem[]; - types: string[]; -} - -interface UIDataTransferItem { - kind: string; - type: string; -} - -interface UIErrorEventArgs extends UIEventArgs { - message: string; - filename: string; - lineno: number; - colno: number; - - // omitting 'error' here since we'd have to serialize it, and it's not clear we will want to - // do that. https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent -} - -interface UIFocusEventArgs extends UIEventArgs { -} - -interface UIKeyboardEventArgs extends UIEventArgs { - key: string; - code: string; - location: number; - repeat: boolean; - ctrlKey: boolean; - shiftKey: boolean; - altKey: boolean; - metaKey: boolean; -} - -interface UIMouseEventArgs extends UIEventArgs { - detail: number; - screenX: number; - screenY: number; - clientX: number; - clientY: number; - offsetX: number; - offsetY: number; - button: number; - buttons: number; - ctrlKey: boolean; - shiftKey: boolean; - altKey: boolean; - metaKey: boolean; -} - -interface UIPointerEventArgs extends UIMouseEventArgs { - pointerId: number; - width: number; - height: number; - pressure: number; - tiltX: number; - tiltY: number; - pointerType: string; - isPrimary: boolean; -} - -interface UIProgressEventArgs extends UIEventArgs { - lengthComputable: boolean; - loaded: number; - total: number; -} - -interface UITouchEventArgs extends UIEventArgs { - detail: number; - touches: UITouchPoint[]; - targetTouches: UITouchPoint[]; - changedTouches: UITouchPoint[]; - ctrlKey: boolean; - shiftKey: boolean; - altKey: boolean; - metaKey: boolean; -} - -interface UITouchPoint { - identifier: number; - screenX: number; - screenY: number; - clientX: number; - clientY: number; - pageX: number; - pageY: number; -} - -interface UIWheelEventArgs extends UIMouseEventArgs { - deltaX: number; - deltaY: number; - deltaZ: number; - deltaMode: number; -} diff --git a/src/Components/Web.JS/src/Rendering/EventDelegator.ts b/src/Components/Web.JS/src/Rendering/Events/EventDelegator.ts similarity index 72% rename from src/Components/Web.JS/src/Rendering/EventDelegator.ts rename to src/Components/Web.JS/src/Rendering/Events/EventDelegator.ts index 8f63d9406f2f..fc3335682ba2 100644 --- a/src/Components/Web.JS/src/Rendering/EventDelegator.ts +++ b/src/Components/Web.JS/src/Rendering/Events/EventDelegator.ts @@ -1,5 +1,6 @@ -import { EventForDotNet, UIEventArgs } from './EventForDotNet'; import { EventFieldInfo } from './EventFieldInfo'; +import { dispatchEvent } from './EventDispatcher'; +import { eventNameAliasRegisteredCallbacks, getBrowserEventName, getEventNameAliases, getEventTypeOptions } from './EventTypes'; const nonBubblingEvents = toLookup([ 'abort', @@ -22,11 +23,9 @@ const nonBubblingEvents = toLookup([ 'DOMNodeRemovedFromDocument', ]); -const disableableEventNames = toLookup(['click', 'dblclick', 'mousedown', 'mousemove', 'mouseup']); +const alwaysPreventDefaultEvents: { [eventType: string]: boolean } = { submit: true }; -export interface OnEventCallback { - (event: Event, eventHandlerId: number, eventArgs: EventForDotNet, eventFieldInfo: EventFieldInfo | null): void; -} +const disableableEventNames = toLookup(['click', 'dblclick', 'mousedown', 'mousemove', 'mouseup']); // Responsible for adding/removing the eventInfo on an expando property on DOM elements, and // calling an EventInfoStore that deals with registering/unregistering the underlying delegated @@ -40,7 +39,7 @@ export class EventDelegator { private eventInfoStore: EventInfoStore; - constructor(private onEvent: OnEventCallback) { + constructor(private browserRendererId: number) { const eventDelegatorId = ++EventDelegator.nextEventDelegatorId; this.eventsCollectionKey = `_blazorEvents_${eventDelegatorId}`; this.eventInfoStore = new EventInfoStore(this.onGlobalEvent.bind(this)); @@ -105,41 +104,72 @@ export class EventDelegator { return; } + // Always dispatch to any listeners for the original underlying browser event name + this.dispatchGlobalEventToAllElements(evt.type, evt); + + // If this event name has aliases, dispatch for those listeners too + const eventNameAliases = getEventNameAliases(evt.type); + eventNameAliases && eventNameAliases.forEach(alias => + this.dispatchGlobalEventToAllElements(alias, evt)); + + // Special case for navigation interception + if (evt.type === 'click') { + this.afterClickCallbacks.forEach(callback => callback(evt as MouseEvent)); + } + } + + private dispatchGlobalEventToAllElements(eventName: string, browserEvent: Event) { + // Note that 'eventName' can be an alias. For example, eventName may be 'click.special' + // while browserEvent.type may be 'click'. + // Scan up the element hierarchy, looking for any matching registered event handlers - let candidateElement = evt.target as Element | null; - let eventArgs: EventForDotNet | null = null; // Populate lazily - const eventIsNonBubbling = nonBubblingEvents.hasOwnProperty(evt.type); + let candidateElement = browserEvent.target as Element | null; + let eventArgs: any = null; // Populate lazily + let eventArgsIsPopulated = false; + const eventIsNonBubbling = nonBubblingEvents.hasOwnProperty(eventName); let stopPropagationWasRequested = false; while (candidateElement) { const handlerInfos = this.getEventHandlerInfosForElement(candidateElement, false); if (handlerInfos) { - const handlerInfo = handlerInfos.getHandler(evt.type); - if (handlerInfo && !eventIsDisabledOnElement(candidateElement, evt.type)) { + const handlerInfo = handlerInfos.getHandler(eventName); + if (handlerInfo && !eventIsDisabledOnElement(candidateElement, browserEvent.type)) { // We are going to raise an event for this element, so prepare info needed by the .NET code - if (!eventArgs) { - eventArgs = EventForDotNet.fromDOMEvent(evt); + if (!eventArgsIsPopulated) { + const eventOptionsIfRegistered = getEventTypeOptions(eventName); + // For back-compat, if there's no registered createEventArgs, we supply empty event args (not null). + // But if there is a registered createEventArgs, it can supply anything (including null). + eventArgs = eventOptionsIfRegistered?.createEventArgs + ? eventOptionsIfRegistered.createEventArgs(browserEvent) + : {}; + eventArgsIsPopulated = true; } - const eventFieldInfo = EventFieldInfo.fromEvent(handlerInfo.renderingComponentId, evt); - this.onEvent(evt, handlerInfo.eventHandlerId, eventArgs, eventFieldInfo); + // For certain built-in events, having any .NET handler implicitly means we will prevent + // the browser's default behavior. This has to be based on the original browser event type name, + // not any alias (e.g., if you create a custom 'submit' variant, it should still preventDefault). + if (alwaysPreventDefaultEvents.hasOwnProperty(browserEvent.type)) { + browserEvent.preventDefault(); + } + + dispatchEvent({ + browserRendererId: this.browserRendererId, + eventHandlerId: handlerInfo.eventHandlerId, + eventName: eventName, + eventFieldInfo: EventFieldInfo.fromEvent(handlerInfo.renderingComponentId, browserEvent) + }, eventArgs); } - if (handlerInfos.stopPropagation(evt.type)) { + if (handlerInfos.stopPropagation(eventName)) { stopPropagationWasRequested = true; } - if (handlerInfos.preventDefault(evt.type)) { - evt.preventDefault(); + if (handlerInfos.preventDefault(eventName)) { + browserEvent.preventDefault(); } } candidateElement = (eventIsNonBubbling || stopPropagationWasRequested) ? null : candidateElement.parentElement; } - - // Special case for navigation interception - if (evt.type === 'click') { - this.afterClickCallbacks.forEach(callback => callback(evt as MouseEvent)); - } } private getEventHandlerInfosForElement(element: Element, createIfNeeded: boolean): EventHandlerInfosForElement | null { @@ -161,6 +191,7 @@ class EventInfoStore { private countByEventName: { [eventName: string]: number } = {}; constructor(private globalListener: EventListener) { + eventNameAliasRegisteredCallbacks.push(this.handleEventNameAliasAdded.bind(this)); } public add(info: EventHandlerInfo) { @@ -179,6 +210,9 @@ class EventInfoStore { } public addGlobalListener(eventName: string) { + // If this event name is an alias, update the global listener for the corresponding browser event + eventName = getBrowserEventName(eventName); + if (this.countByEventName.hasOwnProperty(eventName)) { this.countByEventName[eventName]++; } else { @@ -209,7 +243,9 @@ class EventInfoStore { if (info) { delete this.infosByEventHandlerId[eventHandlerId]; - const eventName = info.eventName; + // If this event name is an alias, update the global listener for the corresponding browser event + const eventName = getBrowserEventName(info.eventName); + if (--this.countByEventName[eventName] === 0) { delete this.countByEventName[eventName]; document.removeEventListener(eventName, this.globalListener); @@ -218,6 +254,22 @@ class EventInfoStore { return info; } + + private handleEventNameAliasAdded(aliasEventName, browserEventName) { + // If an event name alias gets registered later, we need to update the global listener + // registrations to match. This makes it equivalent to the alias having been registered + // before the elements with event handlers got rendered. + if (this.countByEventName.hasOwnProperty(aliasEventName)) { + // Delete old + const countByAliasEventName = this.countByEventName[aliasEventName]; + delete this.countByEventName[aliasEventName]; + document.removeEventListener(aliasEventName, this.globalListener); + + // Ensure corresponding count is added to new + this.addGlobalListener(browserEventName); + this.countByEventName[browserEventName] += countByAliasEventName - 1; + } + } } class EventHandlerInfosForElement { @@ -281,10 +333,10 @@ function toLookup(items: string[]): { [key: string]: boolean } { return result; } -function eventIsDisabledOnElement(element: Element, eventName: string): boolean { +function eventIsDisabledOnElement(element: Element, rawBrowserEventName: string): boolean { // We want to replicate the normal DOM event behavior that, for 'interactive' elements // with a 'disabled' attribute, certain mouse events are suppressed return (element instanceof HTMLButtonElement || element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement) - && disableableEventNames.hasOwnProperty(eventName) + && disableableEventNames.hasOwnProperty(rawBrowserEventName) && element.disabled; } diff --git a/src/Components/Web.JS/src/Rendering/RendererEventDispatcher.ts b/src/Components/Web.JS/src/Rendering/Events/EventDispatcher.ts similarity index 61% rename from src/Components/Web.JS/src/Rendering/RendererEventDispatcher.ts rename to src/Components/Web.JS/src/Rendering/Events/EventDispatcher.ts index 1b4870dac2bb..244052eabbf3 100644 --- a/src/Components/Web.JS/src/Rendering/RendererEventDispatcher.ts +++ b/src/Components/Web.JS/src/Rendering/Events/EventDispatcher.ts @@ -1,11 +1,17 @@ -import { EventDescriptor } from './BrowserRenderer'; -import { UIEventArgs } from './EventForDotNet'; +import { EventFieldInfo } from './EventFieldInfo'; -type EventDispatcher = (eventDescriptor: EventDescriptor, eventArgs: UIEventArgs) => void; +export interface EventDescriptor { + browserRendererId: number; + eventHandlerId: number; + eventName: string; + eventFieldInfo: EventFieldInfo | null; +} + +type EventDispatcher = (eventDescriptor: EventDescriptor, eventArgs: any) => void; let eventDispatcherInstance: EventDispatcher; -export function dispatchEvent(eventDescriptor: EventDescriptor, eventArgs: UIEventArgs): void { +export function dispatchEvent(eventDescriptor: EventDescriptor, eventArgs: any): void { if (!eventDispatcherInstance) { throw new Error('eventDispatcher not initialized. Call \'setEventDispatcher\' to configure it.'); } @@ -13,6 +19,6 @@ export function dispatchEvent(eventDescriptor: EventDescriptor, eventArgs: UIEve eventDispatcherInstance(eventDescriptor, eventArgs); } -export function setEventDispatcher(newDispatcher: (eventDescriptor: EventDescriptor, eventArgs: UIEventArgs) => void): void { +export function setEventDispatcher(newDispatcher: (eventDescriptor: EventDescriptor, eventArgs: any) => void): void { eventDispatcherInstance = newDispatcher; } diff --git a/src/Components/Web.JS/src/Rendering/EventFieldInfo.ts b/src/Components/Web.JS/src/Rendering/Events/EventFieldInfo.ts similarity index 100% rename from src/Components/Web.JS/src/Rendering/EventFieldInfo.ts rename to src/Components/Web.JS/src/Rendering/Events/EventFieldInfo.ts diff --git a/src/Components/Web.JS/src/Rendering/Events/EventTypes.ts b/src/Components/Web.JS/src/Rendering/Events/EventTypes.ts new file mode 100644 index 000000000000..977b604cf520 --- /dev/null +++ b/src/Components/Web.JS/src/Rendering/Events/EventTypes.ts @@ -0,0 +1,377 @@ +interface EventTypeOptions { + browserEventName?: string; + createEventArgs?: (event: Event) => any; +} + +const eventTypeRegistry: Map = new Map(); +const browserEventNamesToAliases: Map = new Map(); +const createBlankEventArgsOptions: EventTypeOptions = { createEventArgs: () => ({}) }; + +export const eventNameAliasRegisteredCallbacks: ((aliasEventName: string, browserEventName) => void)[] = []; + +export function registerCustomEventType(eventName: string, options: EventTypeOptions): void { + if (!options) { + throw new Error('The options parameter is required.'); + } + + // There can't be more than one registration for the same event name because then we wouldn't + // know which eventargs data to supply. + if (eventTypeRegistry.has(eventName)) { + throw new Error(`The event '${eventName}' is already registered.`); + } + + // If applicable, register this as an alias of the given browserEventName + if (options.browserEventName) { + const aliasGroup = browserEventNamesToAliases.get(options.browserEventName); + if (aliasGroup) { + aliasGroup.push(eventName); + } else { + browserEventNamesToAliases.set(options.browserEventName, [eventName]); + } + + // For developer convenience, it's allowed to register the custom event type *after* + // some listeners for it are already present. Once the event name alias gets registered, + // we have to notify any existing event delegators so they can update their delegated + // events list. + eventNameAliasRegisteredCallbacks.forEach(callback => callback(eventName, options.browserEventName)); + } + + eventTypeRegistry.set(eventName, options); +} + +export function getEventTypeOptions(eventName: string): EventTypeOptions | undefined { + return eventTypeRegistry.get(eventName); +} + +export function getEventNameAliases(eventName: string): string[] | undefined { + return browserEventNamesToAliases.get(eventName); +} + +export function getBrowserEventName(possibleAliasEventName: string): string { + const eventOptions = eventTypeRegistry.get(possibleAliasEventName); + return eventOptions?.browserEventName || possibleAliasEventName; +} + +function registerBuiltInEventType(eventNames: string[], options: EventTypeOptions) { + eventNames.forEach(eventName => eventTypeRegistry.set(eventName, options)); +} + +registerBuiltInEventType(['input', 'change'], { + createEventArgs: parseChangeEvent +}); + +registerBuiltInEventType(['copy', 'cut', 'paste'], createBlankEventArgsOptions); + +registerBuiltInEventType(['drag', 'dragend', 'dragenter', 'dragleave', 'dragover', 'dragstart', 'drop'], { + createEventArgs: e => parseDragEvent(e as DragEvent) +}); + +registerBuiltInEventType(['focus', 'blur', 'focusin', 'focusout'], createBlankEventArgsOptions); + +registerBuiltInEventType(['keydown', 'keyup', 'keypress'], { + createEventArgs: e => parseKeyboardEvent(e as KeyboardEvent) +}); + +registerBuiltInEventType(['contextmenu', 'click', 'mouseover', 'mouseout', 'mousemove', 'mousedown', 'mouseup', 'dblclick'], { + createEventArgs: e => parseMouseEvent(e as MouseEvent) +}); + +registerBuiltInEventType(['error'], { + createEventArgs: e => parseErrorEvent(e as ErrorEvent) +}); + +registerBuiltInEventType(['loadstart', 'timeout', 'abort', 'load', 'loadend', 'progress'], { + createEventArgs: e => parseProgressEvent(e as ProgressEvent) +}); + +registerBuiltInEventType(['touchcancel', 'touchend', 'touchmove', 'touchenter', 'touchleave', 'touchstart'], { + createEventArgs: e => parseTouchEvent(e as TouchEvent) +}); + +registerBuiltInEventType(['gotpointercapture', 'lostpointercapture', 'pointercancel', 'pointerdown', 'pointerenter', 'pointerleave', 'pointermove', 'pointerout', 'pointerover', 'pointerup'], { + createEventArgs: e => parsePointerEvent(e as PointerEvent) +}); + +registerBuiltInEventType(['wheel', 'mousewheel'], { + createEventArgs: e => parseWheelEvent(e as WheelEvent) +}); + +registerBuiltInEventType(['toggle'], createBlankEventArgsOptions); + +function parseChangeEvent(event: Event): ChangeEventArgs { + const element = event.target as Element; + if (isTimeBasedInput(element)) { + const normalizedValue = normalizeTimeBasedValue(element); + return { value: normalizedValue }; + } else { + const targetIsCheckbox = isCheckbox(element); + const newValue = targetIsCheckbox ? !!element['checked'] : element['value']; + return { value: newValue }; + } +} + +function parseWheelEvent(event: WheelEvent): WheelEventArgs { + return { + ...parseMouseEvent(event), + deltaX: event.deltaX, + deltaY: event.deltaY, + deltaZ: event.deltaZ, + deltaMode: event.deltaMode, + }; +} + +function parsePointerEvent(event: PointerEvent): PointerEventArgs { + return { + ...parseMouseEvent(event), + pointerId: event.pointerId, + width: event.width, + height: event.height, + pressure: event.pressure, + tiltX: event.tiltX, + tiltY: event.tiltY, + pointerType: event.pointerType, + isPrimary: event.isPrimary, + }; +} + +function parseTouchEvent(event: TouchEvent): TouchEventArgs { + return { + detail: event.detail, + touches: parseTouch(event.touches), + targetTouches: parseTouch(event.targetTouches), + changedTouches: parseTouch(event.changedTouches), + ctrlKey: event.ctrlKey, + shiftKey: event.shiftKey, + altKey: event.altKey, + metaKey: event.metaKey, + }; +} + +function parseProgressEvent(event: ProgressEvent): ProgressEventArgs { + return { + lengthComputable: event.lengthComputable, + loaded: event.loaded, + total: event.total, + }; +} + +function parseErrorEvent(event: ErrorEvent): ErrorEventArgs { + return { + message: event.message, + filename: event.filename, + lineno: event.lineno, + colno: event.colno, + }; +} + +function parseKeyboardEvent(event: KeyboardEvent): KeyboardEventArgs { + return { + key: event.key, + code: event.code, + location: event.location, + repeat: event.repeat, + ctrlKey: event.ctrlKey, + shiftKey: event.shiftKey, + altKey: event.altKey, + metaKey: event.metaKey, + }; +} + +function parseDragEvent(event: DragEvent): DragEventArgs { + return { + ...parseMouseEvent(event), + dataTransfer: event.dataTransfer ? { + dropEffect: event.dataTransfer.dropEffect, + effectAllowed: event.dataTransfer.effectAllowed, + files: Array.from(event.dataTransfer.files).map(f => f.name), + items: Array.from(event.dataTransfer.items).map(i => ({ kind: i.kind, type: i.type })), + types: event.dataTransfer.types, + } : null, + }; +} + +function parseTouch(touchList: TouchList): TouchPoint[] { + const touches: TouchPoint[] = []; + + for (let i = 0; i < touchList.length; i++) { + const touch = touchList[i]; + touches.push({ + identifier: touch.identifier, + clientX: touch.clientX, + clientY: touch.clientY, + screenX: touch.screenX, + screenY: touch.screenY, + pageX: touch.pageX, + pageY: touch.pageY, + }); + } + return touches; +} + +function parseMouseEvent(event: MouseEvent): MouseEventArgs { + return { + detail: event.detail, + screenX: event.screenX, + screenY: event.screenY, + clientX: event.clientX, + clientY: event.clientY, + offsetX: event.offsetX, + offsetY: event.offsetY, + button: event.button, + buttons: event.buttons, + ctrlKey: event.ctrlKey, + shiftKey: event.shiftKey, + altKey: event.altKey, + metaKey: event.metaKey, + }; +} + +function isCheckbox(element: Element | null): boolean { + return !!element && element.tagName === 'INPUT' && element.getAttribute('type') === 'checkbox'; +} + +const timeBasedInputs = [ + 'date', + 'datetime-local', + 'month', + 'time', + 'week', +]; + +function isTimeBasedInput(element: Element): element is HTMLInputElement { + return timeBasedInputs.indexOf(element.getAttribute('type')!) !== -1; +} + +function normalizeTimeBasedValue(element: HTMLInputElement): string { + const value = element.value; + const type = element.type; + switch (type) { + case 'date': + case 'datetime-local': + case 'month': + return value; + case 'time': + return value.length === 5 ? value + ':00' : value; // Convert hh:mm to hh:mm:00 + case 'week': + // For now we are not going to normalize input type week as it is not trivial + return value; + } + + throw new Error(`Invalid element type '${type}'.`); +} + +// The following interfaces must be kept in sync with the EventArgs C# classes + +interface ChangeEventArgs { + value: string | boolean; +} + +interface DragEventArgs { + detail: number; + dataTransfer: DataTransferEventArgs | null; + screenX: number; + screenY: number; + clientX: number; + clientY: number; + button: number; + buttons: number; + ctrlKey: boolean; + shiftKey: boolean; + altKey: boolean; + metaKey: boolean; +} + +interface DataTransferEventArgs { + dropEffect: string; + effectAllowed: string; + files: readonly string[]; + items: readonly DataTransferItem[]; + types: readonly string[]; +} + +interface DataTransferItem { + kind: string; + type: string; +} + +interface ErrorEventArgs { + message: string; + filename: string; + lineno: number; + colno: number; + + // omitting 'error' here since we'd have to serialize it, and it's not clear we will want to + // do that. https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent +} + +interface KeyboardEventArgs { + key: string; + code: string; + location: number; + repeat: boolean; + ctrlKey: boolean; + shiftKey: boolean; + altKey: boolean; + metaKey: boolean; +} + +interface MouseEventArgs { + detail: number; + screenX: number; + screenY: number; + clientX: number; + clientY: number; + offsetX: number; + offsetY: number; + button: number; + buttons: number; + ctrlKey: boolean; + shiftKey: boolean; + altKey: boolean; + metaKey: boolean; +} + +interface PointerEventArgs extends MouseEventArgs { + pointerId: number; + width: number; + height: number; + pressure: number; + tiltX: number; + tiltY: number; + pointerType: string; + isPrimary: boolean; +} + +interface ProgressEventArgs { + lengthComputable: boolean; + loaded: number; + total: number; +} + +interface TouchEventArgs { + detail: number; + touches: TouchPoint[]; + targetTouches: TouchPoint[]; + changedTouches: TouchPoint[]; + ctrlKey: boolean; + shiftKey: boolean; + altKey: boolean; + metaKey: boolean; +} + +interface TouchPoint { + identifier: number; + screenX: number; + screenY: number; + clientX: number; + clientY: number; + pageX: number; + pageY: number; +} + +interface WheelEventArgs extends MouseEventArgs { + deltaX: number; + deltaY: number; + deltaZ: number; + deltaMode: number; +} diff --git a/src/Components/Web.JS/src/Services/NavigationManager.ts b/src/Components/Web.JS/src/Services/NavigationManager.ts index 091481be13e3..66e4aad32c90 100644 --- a/src/Components/Web.JS/src/Services/NavigationManager.ts +++ b/src/Components/Web.JS/src/Services/NavigationManager.ts @@ -1,6 +1,6 @@ import '@microsoft/dotnet-js-interop'; import { resetScrollAfterNextBatch } from '../Rendering/Renderer'; -import { EventDelegator } from '../Rendering/EventDelegator'; +import { EventDelegator } from '../Rendering/Events/EventDelegator'; let hasEnabledNavigationInterception = false; let hasRegisteredNavigationEventListeners = false; diff --git a/src/Components/Web/src/PublicAPI.Unshipped.txt b/src/Components/Web/src/PublicAPI.Unshipped.txt index f887416cf935..f9125f300d01 100644 --- a/src/Components/Web/src/PublicAPI.Unshipped.txt +++ b/src/Components/Web/src/PublicAPI.Unshipped.txt @@ -16,3 +16,7 @@ Microsoft.AspNetCore.Components.Forms.InputTextArea.Element.set -> void *REMOVED*static Microsoft.AspNetCore.Components.Forms.BrowserFileExtensions.RequestImageFileAsync(this Microsoft.AspNetCore.Components.Forms.IBrowserFile! browserFile, string! format, int maxWith, int maxHeight) -> System.Threading.Tasks.ValueTask static Microsoft.AspNetCore.Components.ElementReferenceExtensions.FocusAsync(this Microsoft.AspNetCore.Components.ElementReference elementReference, bool preventScroll) -> System.Threading.Tasks.ValueTask static Microsoft.AspNetCore.Components.Forms.BrowserFileExtensions.RequestImageFileAsync(this Microsoft.AspNetCore.Components.Forms.IBrowserFile! browserFile, string! format, int maxWidth, int maxHeight) -> System.Threading.Tasks.ValueTask +Microsoft.AspNetCore.Components.RenderTree.WebEventDescriptor.EventName.get -> string! +Microsoft.AspNetCore.Components.RenderTree.WebEventDescriptor.EventName.set -> void +*REMOVED*Microsoft.AspNetCore.Components.RenderTree.WebEventDescriptor.EventArgsType.get -> string! +*REMOVED*Microsoft.AspNetCore.Components.RenderTree.WebEventDescriptor.EventArgsType.set -> void diff --git a/src/Components/Web/src/Web/WebEventCallbackFactoryEventArgsExtensions.cs b/src/Components/Web/src/Web/WebEventCallbackFactoryEventArgsExtensions.cs index d7f7d01ae205..e13959c43567 100644 --- a/src/Components/Web/src/Web/WebEventCallbackFactoryEventArgsExtensions.cs +++ b/src/Components/Web/src/Web/WebEventCallbackFactoryEventArgsExtensions.cs @@ -19,6 +19,7 @@ public static class WebEventCallbackFactoryEventArgsExtensions /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) @@ -37,6 +38,7 @@ public static EventCallback Create(this EventCallbackFactory /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) @@ -55,6 +57,7 @@ public static EventCallback Create(this EventCallbackFactory /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) @@ -73,6 +76,7 @@ public static EventCallback Create(this EventCallbackFactory fact /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) @@ -91,6 +95,7 @@ public static EventCallback Create(this EventCallbackFactory fact /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) @@ -109,6 +114,7 @@ public static EventCallback Create(this EventCallbackFactory fac /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) @@ -127,6 +133,7 @@ public static EventCallback Create(this EventCallbackFactory fac /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) @@ -145,6 +152,7 @@ public static EventCallback Create(this EventCallbackFactory fac /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) @@ -163,6 +171,7 @@ public static EventCallback Create(this EventCallbackFactory fac /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) @@ -181,6 +190,7 @@ public static EventCallback Create(this EventCallbackFactory /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) @@ -199,6 +209,7 @@ public static EventCallback Create(this EventCallbackFactory /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) @@ -217,6 +228,7 @@ public static EventCallback Create(this EventCallbackFactory fac /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) @@ -234,6 +246,7 @@ public static EventCallback Create(this EventCallbackFactory fac /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) @@ -252,6 +265,7 @@ public static EventCallback Create(this EventCallbackFactory f /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) @@ -270,6 +284,7 @@ public static EventCallback Create(this EventCallbackFactory f /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) @@ -288,6 +303,7 @@ public static EventCallback Create(this EventCallbackFactory /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) @@ -306,6 +322,7 @@ public static EventCallback Create(this EventCallbackFactory /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) @@ -324,6 +341,7 @@ public static EventCallback Create(this EventCallbackFactory fac /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) @@ -342,6 +360,7 @@ public static EventCallback Create(this EventCallbackFactory fac /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) @@ -360,6 +379,7 @@ public static EventCallback Create(this EventCallbackFactory fac /// The event receiver. /// The event callback. /// The . + [Obsolete("This extension method is obsolete and will be removed in a future version. Use the generic overload instead.")] public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) diff --git a/src/Components/Web/src/WebEventDescriptor.cs b/src/Components/Web/src/WebEventDescriptor.cs index 2e063b98f9e4..cc87d8f9d5fa 100644 --- a/src/Components/Web/src/WebEventDescriptor.cs +++ b/src/Components/Web/src/WebEventDescriptor.cs @@ -27,7 +27,7 @@ public sealed class WebEventDescriptor /// /// For framework use only. /// - public string EventArgsType { get; set; } = default!; + public string EventName { get; set; } = default!; /// /// For framework use only. diff --git a/src/Components/WebAssembly/WebAssembly/src/Infrastructure/JSInteropMethods.cs b/src/Components/WebAssembly/WebAssembly/src/Infrastructure/JSInteropMethods.cs index e31f92e8707a..c6eb32b09229 100644 --- a/src/Components/WebAssembly/WebAssembly/src/Infrastructure/JSInteropMethods.cs +++ b/src/Components/WebAssembly/WebAssembly/src/Infrastructure/JSInteropMethods.cs @@ -33,8 +33,8 @@ public static void NotifyLocationChanged(string uri, bool isInterceptedLink) [JSInvokable(nameof(DispatchEvent))] public static Task DispatchEvent(WebEventDescriptor eventDescriptor, string eventArgsJson) { - var webEvent = WebEventData.Parse(eventDescriptor, eventArgsJson); var renderer = RendererRegistry.Find(eventDescriptor.BrowserRendererId); + var webEvent = WebEventData.Parse(renderer, eventDescriptor, eventArgsJson); return renderer.DispatchEventAsync( webEvent.EventHandlerId, webEvent.EventFieldInfo, diff --git a/src/Components/test/E2ETest/ServerExecutionTests/ComponentHubInvalidEventTest.cs b/src/Components/test/E2ETest/ServerExecutionTests/ComponentHubInvalidEventTest.cs index 5d37553b5264..812259b3b4f8 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/ComponentHubInvalidEventTest.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/ComponentHubInvalidEventTest.cs @@ -44,7 +44,7 @@ public async Task DispatchingAnInvalidEventArgument_DoesNotProduceWarnings() { BrowserRendererId = 0, EventHandlerId = 3, - EventArgsType = "mouse", + EventName = "click", }); // Act @@ -71,7 +71,7 @@ public async Task DispatchingAnInvalidEvent_DoesNotTriggerWarnings() { BrowserRendererId = 0, EventHandlerId = 1990, - EventArgsType = "mouse", + EventName = "click", }); var eventArgs = new MouseEventArgs diff --git a/src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs b/src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs index 7333672c2a18..87747364bda6 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs @@ -440,7 +440,7 @@ public async Task DispatchingEventsWithInvalidEventArgs() { BrowserRendererId = 0, EventHandlerId = 6, - EventArgsType = "mouse", + EventName = "click", }; await Client.ExpectCircuitError(async () => @@ -478,7 +478,7 @@ public async Task DispatchingEventsWithInvalidEventHandlerId() { BrowserRendererId = 0, EventHandlerId = 1, - EventArgsType = "mouse", + EventName = "click", }; await Client.ExpectCircuitError(async () => diff --git a/src/Components/test/E2ETest/ServerExecutionTests/TestSubclasses.cs b/src/Components/test/E2ETest/ServerExecutionTests/TestSubclasses.cs index a69ca685033f..bcc5e55c0fa7 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/TestSubclasses.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/TestSubclasses.cs @@ -99,4 +99,12 @@ public ServerDynamicComponentRenderingTest(BrowserFixture browserFixture, Toggle { } } + + public class ServerEventCustomArgsTest : EventCustomArgsTest + { + public ServerEventCustomArgsTest(BrowserFixture browserFixture, ToggleExecutionModeServerFixture serverFixture, ITestOutputHelper output) + : base(browserFixture, serverFixture.WithServerExecution(), output) + { + } + } } diff --git a/src/Components/test/E2ETest/Tests/EventCustomArgsTest.cs b/src/Components/test/E2ETest/Tests/EventCustomArgsTest.cs new file mode 100644 index 000000000000..329af1353344 --- /dev/null +++ b/src/Components/test/E2ETest/Tests/EventCustomArgsTest.cs @@ -0,0 +1,179 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Linq; +using BasicTestApp; +using Microsoft.AspNetCore.Components.E2ETest.Infrastructure; +using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures; +using Microsoft.AspNetCore.E2ETesting; +using OpenQA.Selenium; +using OpenQA.Selenium.Interactions; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.AspNetCore.Components.E2ETest.Tests +{ + public class EventCustomArgsTest : ServerTestBase> + { + public EventCustomArgsTest( + BrowserFixture browserFixture, + ToggleExecutionModeServerFixture serverFixture, + ITestOutputHelper output) + : base(browserFixture, serverFixture, output) + { + } + + protected override void InitializeAsyncCore() + { + // Always do a full page reload because these tests need to start with no custom event registrations + Navigate(ServerPathBase, noReload: false); + Browser.MountTestComponent(); + } + + [Fact] + public void UnregisteredCustomEventWorks() + { + // This reflects functionality in 5.0 and earlier, in which you could have custom events + // registered with the Razor compiler but no way to register them with the runtime, so + // you could only receive empty eventargs. + Browser.Exists(By.Id("trigger-testevent-directly")).Click(); + Browser.Equal("Received testevent with args '{ MyProp=null }'", () => GetLogLines().Single()); + } + + [Fact] + public void CanRegisterCustomEventAfterRender_WithNoCreateEventArgs() + { + Browser.Exists(By.Id("register-testevent-with-no-createventargs")).Click(); + Browser.FindElement(By.Id("trigger-testevent-directly")).Click(); + Browser.Equal("Received testevent with args '{ MyProp=null }'", () => GetLogLines().Single()); + } + + [Fact] + public void CanRegisterCustomEventAfterRender_WithCreateEventArgsReturningNull() + { + Browser.Exists(By.Id("register-testevent-with-createventargs-that-returns-null")).Click(); + Browser.FindElement(By.Id("trigger-testevent-directly")).Click(); + Browser.Equal("Received testevent with args 'null'", () => GetLogLines().Single()); + } + + [Fact] + public void CanRegisterCustomEventAfterRender_WithCreateEventArgsReturningData() + { + Browser.Exists(By.Id("register-testevent-with-createventargs-that-supplies-args")).Click(); + Browser.FindElement(By.Id("trigger-testevent-directly")).Click(); + Browser.Equal("Received testevent with args '{ MyProp=Native event target ID=test-event-target-child }'", () => GetLogLines().Single()); + } + + [Fact] + public void CanAliasBrowserEvent_WithCreateEventArgsReturningData() + { + var input = Browser.Exists(By.CssSelector("#test-event-target-child input")); + Browser.FindElement(By.Id("register-custom-keydown")).Click(); + SendKeysSequentially(input, "ab"); + + Browser.Equal(new[] + { + "Received native keydown event", + "You pressed: a", + "Received native keydown event", + "You pressed: b", + }, GetLogLines); + + Assert.Equal("ab", input.GetAttribute("value")); + } + + [Fact] + public void CanAliasBrowserEvent_PreventDefaultOnNativeEvent() + { + var input = Browser.Exists(By.CssSelector("#test-event-target-child input")); + Browser.FindElement(By.Id("register-custom-keydown")).Click(); + Browser.FindElement(By.Id("custom-keydown-prevent-default")).Click(); + SendKeysSequentially(input, "ab"); + + Browser.Equal(new[] + { + "Received native keydown event", + "You pressed: a", + "Received native keydown event", + "You pressed: b", + }, GetLogLines); + + // Check it was actually preventDefault-ed + Assert.Equal("", input.GetAttribute("value")); + } + + [Fact] + public void CanAliasBrowserEvent_StopPropagationIndependentOfNativeEvent() + { + var input = Browser.Exists(By.CssSelector("#test-event-target-child input")); + Browser.FindElement(By.Id("register-custom-keydown")).Click(); + Browser.FindElement(By.Id("register-yet-another-keydown")).Click(); + Browser.FindElement(By.Id("custom-keydown-stop-propagation")).Click(); + SendKeysSequentially(input, "ab"); + + Browser.Equal(new[] + { + // The native event still bubbles up to its listener on an ancestor, and + // other aliased events still receive it, but the stopPropagation-ed + // variant does not + "Received native keydown event", + "Yet another aliased event received: a", + "Received native keydown event", + "Yet another aliased event received: b", + }, GetLogLines); + + Assert.Equal("ab", input.GetAttribute("value")); + } + + [Fact] + public void CanHaveMultipleAliasesForASingleBrowserEvent() + { + var input = Browser.Exists(By.CssSelector("#test-event-target-child input")); + Browser.FindElement(By.Id("register-custom-keydown")).Click(); + Browser.FindElement(By.Id("register-yet-another-keydown")).Click(); + SendKeysSequentially(input, "ab"); + + Browser.Equal(new[] + { + "Received native keydown event", + "You pressed: a", + "Yet another aliased event received: a", + "Received native keydown event", + "You pressed: b", + "Yet another aliased event received: b", + }, GetLogLines); + + Assert.Equal("ab", input.GetAttribute("value")); + } + + [Fact] + public void CanAliasBrowserEvent_WithoutAnyNativeListenerForBrowserEvent() + { + // Sets up a registration for a custom event name that's an alias for mouseover, + // but there's no regular listener for mouseover in the application at this point + Browser.Exists(By.Id("register-custom-mouseover")).Click(); + + new Actions(Browser) + .MoveToElement(Browser.FindElement(By.Id("test-event-target-child"))) + .Perform(); + + // Nonetheless, the custom event is still received + Browser.True(() => GetLogLines().Contains("Received custom mouseover event")); + } + + void SendKeysSequentially(IWebElement target, string text) + { + foreach (var c in text) + { + target.SendKeys(c.ToString()); + } + } + + private string[] GetLogLines() + => Browser.Exists(By.Id("test-log")) + .GetAttribute("value") + .Replace("\r\n", "\n") + .Split('\n', StringSplitOptions.RemoveEmptyEntries); + } +} diff --git a/src/Components/test/E2ETest/Tests/EventTest.cs b/src/Components/test/E2ETest/Tests/EventTest.cs index e0d74eeffc04..13e68a1bcf59 100644 --- a/src/Components/test/E2ETest/Tests/EventTest.cs +++ b/src/Components/test/E2ETest/Tests/EventTest.cs @@ -26,7 +26,6 @@ public EventTest( protected override void InitializeAsyncCore() { Navigate(ServerPathBase, noReload: true); - Browser.MountTestComponent(); } [Fact] @@ -300,6 +299,31 @@ public void RenderAttributesBeforeConnectedCallBack() Browser.Contains(expectedContent, () => element.Text); } + [Fact] + public void PolymorphicEventHandlersReceiveCorrectArgsSubclass() + { + // This is to show that the type of event argument received corresponds to the declared event + // name, and not to the argument type on the event handler delegate. Note that this is only + // supported (for back-compat) for the built-in standard web event types. For custom events, + // the eventargs deserialization type is determined purely by the delegate's parameters list. + Browser.MountTestComponent(); + + var elem = Browser.Exists(By.Id("polymorphic_event_elem")); + + // Output is initially empty + var output = Browser.Exists(By.Id("output")); + Assert.Equal(string.Empty, output.Text); + + // We can trigger a pointer event and receive a PointerEventArgs + new Actions(Browser).Click(elem).Perform(); + Browser.Equal("Microsoft.AspNetCore.Components.Web.PointerEventArgs:mouse", () => output.Text); + + // We can trigger a drag event and receive a DragEventArgs *on the same handler delegate* + Browser.FindElement(By.Id("clear_event_log")).Click(); + new Actions(Browser).DragAndDrop(elem, Browser.FindElement(By.Id("other"))).Perform(); + Browser.Equal("Microsoft.AspNetCore.Components.Web.DragEventArgs:1", () => output.Text); + } + void SendKeysSequentially(IWebElement target, string text) { // Calling it for each character works around some chars being skipped diff --git a/src/Components/test/testassets/BasicTestApp/EventBubblingComponent.razor b/src/Components/test/testassets/BasicTestApp/EventBubblingComponent.razor index 66c28ac823fa..87343158bad1 100644 --- a/src/Components/test/testassets/BasicTestApp/EventBubblingComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/EventBubblingComponent.razor @@ -1,10 +1,9 @@ 

Bubbling standard event

-@* Temporarily hard-coding the internal names - this will be replaced once the Razor compiler supports @onevent:stopPropagation and @onevent:preventDefault *@
@* This element shows you can stop propagation even without necessarily also handling the event *@ -
- + + + + + + + + + + + + + +

+ +

+ +

+ +

+ +

Event log

+ + + + +@code { + string logValue = string.Empty; + bool customKeyDownPreventDefault; + bool customKeyDownStopPropagation; + + void LogMessage(string message) + { + logValue += message + Environment.NewLine; + } + + void HandleTestEvent(TestEventArgs eventArgs) + { + var args = eventArgs == null ? "null" : $"{{ MyProp={eventArgs.MyProp ?? "null"} }}"; + LogMessage($"Received testevent with args '{args}'"); + } + + void HandleCustomKeyDown(TestKeyDownEventArgs eventArgs) + { + LogMessage($"You pressed: {eventArgs.CustomKeyInfo}"); + } + + void HandleYetAnotherKeyboardEvent(YetAnotherCustomKeyboardEventArgs eventArgs) + { + LogMessage($"Yet another aliased event received: {eventArgs.YouPressed}"); + } +} diff --git a/src/Components/test/testassets/BasicTestApp/EventCustomArgsTypes.cs b/src/Components/test/testassets/BasicTestApp/EventCustomArgsTypes.cs new file mode 100644 index 000000000000..a6acf9494fed --- /dev/null +++ b/src/Components/test/testassets/BasicTestApp/EventCustomArgsTypes.cs @@ -0,0 +1,28 @@ +using System; +using Microsoft.AspNetCore.Components; + +namespace BasicTestApp.CustomEventTypesNamespace +{ + [EventHandler("ontestevent", typeof(TestEventArgs), true, true)] + [EventHandler("onkeydown.testvariant", typeof(TestKeyDownEventArgs), true, true)] + [EventHandler("onkeydown.yetanother", typeof(YetAnotherCustomKeyboardEventArgs), true, true)] + [EventHandler("oncustommouseover", typeof(EventArgs), true, true)] + public static class EventHandlers + { + } + + class TestEventArgs : EventArgs + { + public string MyProp { get; set; } + } + + class TestKeyDownEventArgs : EventArgs + { + public string CustomKeyInfo { get; set; } + } + + class YetAnotherCustomKeyboardEventArgs : EventArgs + { + public string YouPressed { get; set; } + } +} diff --git a/src/Components/test/testassets/BasicTestApp/EventPreventDefaultComponent.razor b/src/Components/test/testassets/BasicTestApp/EventPreventDefaultComponent.razor index d365de99de43..b7294d794234 100644 --- a/src/Components/test/testassets/BasicTestApp/EventPreventDefaultComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/EventPreventDefaultComponent.razor @@ -6,10 +6,6 @@ you almost certainly don't really want to perform a server-side post, especially given that it would occur before an async event handler.

-

- Later, it's likely that we'll add a syntax for controlling whether any given event handler - triggers a synchronous preventDefault before the event handler runs. -

Form with onsubmit handler

diff --git a/src/Components/test/testassets/BasicTestApp/Index.razor b/src/Components/test/testassets/BasicTestApp/Index.razor index e58c7ffc757d..909d4780716c 100644 --- a/src/Components/test/testassets/BasicTestApp/Index.razor +++ b/src/Components/test/testassets/BasicTestApp/Index.razor @@ -27,7 +27,7 @@ - + diff --git a/src/Components/test/testassets/BasicTestApp/MouseEventComponent.razor b/src/Components/test/testassets/BasicTestApp/MouseEventComponent.razor index 9b9d05eedcc3..d529d3094568 100644 --- a/src/Components/test/testassets/BasicTestApp/MouseEventComponent.razor +++ b/src/Components/test/testassets/BasicTestApp/MouseEventComponent.razor @@ -23,12 +23,17 @@
Drop Target

- +

Another input (to distract you)

+ +

+ Polymorphic args handler: +

Click or drag me
+

@code { @@ -39,56 +44,68 @@ { DumpEvent(e); message += "onmouseover,"; - StateHasChanged(); } void OnMouseOut(MouseEventArgs e) { DumpEvent(e); message += "onmouseout,"; - StateHasChanged(); } void OnMouseMove(MouseEventArgs e) { DumpEvent(e); message += "onmousemove,"; - StateHasChanged(); } void OnMouseDown(MouseEventArgs e) { DumpEvent(e); message += "onmousedown,"; - StateHasChanged(); } void OnMouseUp(MouseEventArgs e) { DumpEvent(e); message += "onmouseup,"; - StateHasChanged(); } void OnPointerDown(PointerEventArgs e) { DumpEvent(e); message += "onpointerdown"; - StateHasChanged(); } void OnDragStart(DragEventArgs e) { DumpEvent(e); message += "ondragstart,"; - StateHasChanged(); } void OnDrop(DragEventArgs e) { DumpEvent(e); message += "ondrop,"; - StateHasChanged(); + } + + void OnPolymorphicEvent(EventArgs e) + { + // The purpose of this handler is to show that, even though the declared args type is + // the EventArgs base class, at runtime we actually receive the subclass corresponding + // to the event that occurred. Note that this will only be supported for the built-in + // web event types (for back compatibility), and cannot work for any custom events, + // since we have no way to know which subclass you'd want for a custom event. + message += e.GetType().FullName; + + switch (e) + { + case PointerEventArgs pointerEvent: + message += $":{pointerEvent.PointerType}"; + break; + case DragEventArgs dragEvent: + message += $":{dragEvent.Buttons}"; + break; + } } void DumpEvent(MouseEventArgs e)