From 7d6c30782c12e8c6f40043e8d32e9d52dc67c6b4 Mon Sep 17 00:00:00 2001 From: Guillaume ZAHRA Date: Sat, 4 Dec 2021 19:24:45 +0100 Subject: [PATCH] - Fix invalid 'require' keyword in blazor.server.js added by Babel in transpilation that cannot be used on a pure javascript environment --- src/Blazor.Polyfill.Server/Blazor.Polyfill.Server.csproj | 5 ++++- .../BlazorPolyfillMiddlewareExtensions.cs | 4 ++++ src/Blazor.Polyfill.Server/dist/blazor.server.packaged.js | 2 +- src/MyApp/MyApp.csproj | 5 ++++- src/MyApp/Startup.cs | 4 ++-- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Blazor.Polyfill.Server/Blazor.Polyfill.Server.csproj b/src/Blazor.Polyfill.Server/Blazor.Polyfill.Server.csproj index 15b46d9..150caaa 100644 --- a/src/Blazor.Polyfill.Server/Blazor.Polyfill.Server.csproj +++ b/src/Blazor.Polyfill.Server/Blazor.Polyfill.Server.csproj @@ -3,7 +3,7 @@ net6.0 true - 6.0.100.2 + 6.0.100.3 Guillaume ZAHRA Daddoon true @@ -14,6 +14,9 @@ https://github.com/Daddoon/Blazor.Polyfill blazor blazor-server ie11 edgeHTML edge-legacy polyfill +6.0.100.3: +- Fix invalid 'require' keyword in blazor.server.js added by Babel in transpilation that cannot be used on a pure javascript environment + 6.0.100.2: - Blazor.Polyfill now respect the autostart attribute value at start - Added the ES5ConversionScope option in Blazor.Polyfill configuration. This option is meant to transpile None, Razor Class Libraries, or All Javascript files to ES5 automatically and store it in a es5cache store for your application. Files will be used automatically at runtime when needed. Keeping them under source control is advised. diff --git a/src/Blazor.Polyfill.Server/BlazorPolyfillMiddlewareExtensions.cs b/src/Blazor.Polyfill.Server/BlazorPolyfillMiddlewareExtensions.cs index 5c02753..2abb2b9 100644 --- a/src/Blazor.Polyfill.Server/BlazorPolyfillMiddlewareExtensions.cs +++ b/src/Blazor.Polyfill.Server/BlazorPolyfillMiddlewareExtensions.cs @@ -363,6 +363,10 @@ private static FileContentReference GetPatchedBlazorServerFile() //We still need to fix 'state' regex evaluation code, as it was expecting a named capture group. js = Regex.Replace(js, "([_a-zA-Z0-9]+)(.groups[ ]*&&[ ]*[_a-zA-Z0-9]+.groups.state)", "$1[1]"); + //Here we fix invalids interopRequireWildcard(require(''.concat(n))) to _interopRequireWildcard(''.concat(n)) (works for '' or "") + //Warning: " is written "" here but must be read as " from the regex logic: We are in a verbatim string + js = Regex.Replace(js, @"(require\((['""]['""].concat\([a-zA-Z]+\))\))", "$2"); + #endregion Regex named groups fix //Minify with AjaxMin (we don't want an additional external tool with NPM or else for managing this diff --git a/src/Blazor.Polyfill.Server/dist/blazor.server.packaged.js b/src/Blazor.Polyfill.Server/dist/blazor.server.packaged.js index 9e73c07..72e37d9 100644 --- a/src/Blazor.Polyfill.Server/dist/blazor.server.packaged.js +++ b/src/Blazor.Polyfill.Server/dist/blazor.server.packaged.js @@ -1 +1 @@ -function _possibleConstructorReturn(n,t){return t&&(_typeof(t)==="object"||typeof t=="function")?t:_assertThisInitialized(n)}function _assertThisInitialized(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function _inherits(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}});t&&_setPrototypeOf(n,t)}function _wrapNativeSuper(n){var t=typeof Map=="function"?new Map:undefined;return _wrapNativeSuper=function(n){function i(){return _construct(n,arguments,_getPrototypeOf(this).constructor)}if(n===null||!_isNativeFunction(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t!="undefined"){if(t.has(n))return t.get(n);t.set(n,i)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(i,n)},_wrapNativeSuper(n)}function isNativeReflectConstruct(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(n){return!1}}function _construct(){return _construct=isNativeReflectConstruct()?Reflect.construct:function(n,t,i){var r=[null],f,u;return r.push.apply(r,t),f=Function.bind.apply(n,r),u=new f,i&&_setPrototypeOf(u,i.prototype),u},_construct.apply(null,arguments)}function _isNativeFunction(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function _setPrototypeOf(n,t){return _setPrototypeOf=Object.setPrototypeOf||function(n,t){return n.__proto__=t,n},_setPrototypeOf(n,t)}function _getPrototypeOf(n){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},_getPrototypeOf(n)}function _toConsumableArray(n){return _arrayWithoutHoles(n)||_iterableToArray(n)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance");}function _iterableToArray(n){if(Symbol.iterator in Object(n)||Object.prototype.toString.call(n)==="[object Arguments]")return Array.from(n)}function _arrayWithoutHoles(n){if(Array.isArray(n)){for(var t=0,i=new Array(n.length);t0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return ft in n||(n[ft]=[]),n}function hu(n,t){var i=document.createComment("!");return ot(i,n,t),i}function ot(n,t,i){var r=n,u,f;if(_instanceof(n,Comment)&&v(r)&&v(r).length>0)throw new Error("Not implemented: inserting non-empty logical container");if(b(r))throw new Error("Not implemented: moving existing logical children");u=v(t);i0;)st(i,0);u=i;u.parentNode.removeChild(u)}function b(n){return n[hi]||null}function kt(n,t){return v(n)[t]}function cu(n){var t=lu(n);return"http://www.w3.org/2000/svg"===t.namespaceURI&&"foreignObject"!==t.tagName}function v(n){return n[ft]}function ko(n,t){var i=v(n);t.forEach(function(n){n.moveRangeStart=i[n.fromSiblingIndex];n.moveRangeEnd=vu(n.moveRangeStart)});t.forEach(function(t){var u=t.moveToBeforeMarker=document.createComment("marker"),r=i[t.toSiblingIndex+1];r?r.parentNode.insertBefore(u,r):ci(u,n)});t.forEach(function(n){for(var i=n.moveToBeforeMarker,r=i.parentNode,f=n.moveRangeStart,e=n.moveRangeEnd,t=f,u;t;){if(u=t.nextSibling,r.insertBefore(t,i),t===e)break;t=u}r.removeChild(i)});t.forEach(function(n){i[n.toSiblingIndex]=n.moveRangeStart})}function lu(n){if(_instanceof(n,Element)||_instanceof(n,DocumentFragment))return n;if(_instanceof(n,Comment))return n.parentNode;throw new Error("Not a valid logical element");}function au(n){var t=v(b(n));return t[Array.prototype.indexOf.call(t,n)+1]||null}function ci(n,t){if(_instanceof(t,Element)||_instanceof(t,DocumentFragment))t.appendChild(n);else{if(!_instanceof(t,Comment))throw new Error("Cannot append node because the parent is not a valid logical element. Parent: ".concat(t));var i=au(t);i?i.parentNode.insertBefore(n,i):ci(n,b(t))}}function vu(n){var i,t;return _instanceof(n,Element)||_instanceof(n,DocumentFragment)?n:(i=au(n),i)?i.previousSibling:(t=b(n),_instanceof(t,Element)||_instanceof(t,DocumentFragment)?t.lastChild:vu(t))}function li(n){return"function"==typeof Symbol?Symbol():n}function yu(n){return"_bl_".concat(n)}function ns(n,t){var i=n.frameReader;switch(i.frameType(t)){case s.component:case s.element:case s.region:return i.subtreeLength(t)-1;default:return 0}}function vi(n){if(n.startsWith("on"))return n.substring(2);throw new Error("Attribute should be an event name, but doesn't start with 'on'. Value: '".concat(n,"'"));}function yi(n){return"select-multiple"===n.type}function nf(n,t){n.value=t||""}function tf(n,t){_instanceof(n,HTMLSelectElement)?yi(n)?function(n,t){t||(t=[]);for(var i=0;i2&&arguments[2]!==undefined?arguments[2]:!1,r=hf(n),i=_instanceof(t,Object)?t:{forceLoad:t,replaceHistoryEntry:u};!i.forceLoad&&lf(r)?ef(r,!1,i.replaceHistoryEntry):function(n,t){if(location.href===n){var i=n+"?";history.replaceState(null,"",i);location.replace(n)}else t?location.replace(n):location.href=n}(n,i.replaceHistoryEntry)}function ef(n,t,i){wi=!0;i?history.replaceState(null,"",n):history.pushState(null,"",n);sf(t)}function sf(){return di.apply(this,arguments)}function di(){return di=_asyncToGenerator(regeneratorRuntime.mark(function n(t){return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(n.t0=bi,!n.t0){n.next=4;break}return n.next=4,bi(location.href,t);case 4:case"end":return n.stop()}},n)})),di.apply(this,arguments)}function hf(n){return dt=dt||document.createElement("a"),dt.href=n,dt.href}function cf(n,t){return n?n.tagName===t?n:cf(n.parentElement,t):null}function lf(n){var i=(t=document.baseURI).substr(0,t.lastIndexOf("/")+1),t;return n.startsWith(i)}function af(n){return n?"visible"!==getComputedStyle(n).overflowY?n:af(n.parentElement):null}function pf(n,t){var i=n._blazorFilesById[t];if(!i)throw new Error("There is no file with ID ".concat(t,". The file list may have changed."));return i}function wf(){return nr.apply(this,arguments)}function nr(){return nr=_asyncToGenerator(regeneratorRuntime.mark(function n(t,i,r){return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(!_instanceof(t,Blob)){n.next=6;break}return n.next=3,function(){var n=_asyncToGenerator(regeneratorRuntime.mark(function t(n,i,r){var u,f;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return u=n.slice(i,i+r),t.next=3,u.arrayBuffer();case 3:return f=t.sent,t.abrupt("return",new Uint8Array(f));case 5:case"end":return t.stop()}},t)}));return function(){return n.apply(this,arguments)}}()(t,i,r);case 3:n.t0=n.sent;n.next=7;break;case 6:n.t0=function(n,t,i){return new Uint8Array(n.buffer,n.byteOffset+t,i)}(t,i,r);case 7:return n.abrupt("return",n.t0);case 8:case"end":return n.stop()}},n)})),nr.apply(this,arguments)}function lt(n,t){var i="";return ur(n)?(i="Binary data of length ".concat(n.byteLength),t&&(i+=". Content: '".concat(function(n){var i=new Uint8Array(n),t="";return i.forEach(function(n){t+="0x".concat(n<16?"0":"").concat(n.toString(16)," ")}),t.substr(0,t.length-1)}(n),"'"))):"string"==typeof n&&(i="String data of length ".concat(n.length),t&&(i+=". Content: '".concat(n,"'"))),i}function ur(n){return n&&"undefined"!=typeof ArrayBuffer&&(_instanceof(n,ArrayBuffer)||n.constructor&&"ArrayBuffer"===n.constructor.name)}function kf(){return fr.apply(this,arguments)}function fr(){return fr=_asyncToGenerator(regeneratorRuntime.mark(function t(i,r,u,f,e,o,s){var h,c,a,l,v,y,p,w;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(h={},!e){t.next=6;break}return t.next=4,e();case 4:c=t.sent;c&&(h={Authorization:"Bearer ".concat(c)});case 6:return a=vt(),l=_slicedToArray(a,2),v=l[0],y=l[1],h[v]=y,i.log(n.Trace,"(".concat(r," transport) sending data. ").concat(lt(o,s.logMessageContent),".")),p=ur(o)?"arraybuffer":"text",t.next=11,u.post(f,{content:o,headers:_objectSpread({},h,{},s.headers),responseType:p,timeout:s.timeout,withCredentials:s.withCredentials});case 11:w=t.sent;i.log(n.Trace,"(".concat(r," transport) request complete. Response status: ").concat(w.statusCode,"."));case 13:case"end":return t.stop()}},t)})),fr.apply(this,arguments)}function vt(){var n="X-SignalR-User-Agent";return y.isNode&&(n="User-Agent"),[n,hs("6.0.0-rc.2.21480.10",cs(),y.isNode?"NodeJS":"Browser",ls())]}function hs(n,t,i,r){var u="Microsoft SignalR/",f=n.split(".");return u+="".concat(f[0],".").concat(f[1]),u+=" (".concat(n,"; "),u+=t&&""!==t?"".concat(t,"; "):"Unknown OS; ",u+="".concat(i),u+=r?"; ".concat(r):"; Unknown Runtime Version",u+=")",u}function cs(){if(!y.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function ls(){if(y.isNode)return process.versions.node}function gf(n){return n.stack?n.stack:n.message?n.message:"".concat(n)}function te(n,t){var i;switch(t){case"arraybuffer":i=n.arrayBuffer();break;case"text":i=n.text();break;case"blob":case"document":case"json":throw new Error("".concat(t," is not supported."));default:i=n.text()}return i}function fe(n,t,i){var r=Math.floor(i/4294967296),u=i;n.setUint32(t,r);n.setUint32(t+4,u)}function ee(n,t){return 4294967296*n.getInt32(t)+n.getUint32(t+4)}function oe(n){for(var t,u,f=n.length,r=0,i=0;i=55296&&t<=56319&&i65535&&(e-=65536,r.push(e>>>10&1023|55296),e=56320|1023&e),r.push(e)):r.push(u),r.length>=4096&&(s+=String.fromCharCode.apply(String,r),r.length=0);return r.length>0&&(s+=String.fromCharCode.apply(String,r)),s}function ii(n){return _instanceof(n,Uint8Array)?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):_instanceof(n,ArrayBuffer)?new Uint8Array(n):Uint8Array.from(n)}function or(n){return(n<0?"-":"")+"0x"+Math.abs(n).toString(16).padStart(2,"0")}function ye(){return lr.apply(this,arguments)}function lr(){return lr=_asyncToGenerator(regeneratorRuntime.mark(function n(){var t;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:t=document.querySelector("#blazor-error-ui");t&&(t.style.display="block");ve||(ve=!0,document.querySelectorAll("#blazor-error-ui .reload").forEach(function(n){n.onclick=function(n){location.reload();n.preventDefault()}}),document.querySelectorAll("#blazor-error-ui .dismiss").forEach(function(n){n.onclick=function(n){var t=document.querySelector("#blazor-error-ui");t&&(t.style.display="none");n.preventDefault()}}));case 2:case"end":return n.stop()}},n)})),lr.apply(this,arguments)}function r(n,t){return n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24}function pe(n,t){return n[t]+(n[t+1]<<8)+(n[t+2]<<16)+(n[t+3]<<24>>>0)}function we(n,t){var i=pe(n,t+4);if(i>bh)throw new Error("Cannot read uint64 with high order part ".concat(i,", because the result would exceed Number.MAX_SAFE_INTEGER."));return i*wh+pe(n,t)}function no(n){var i,r,t,u;if(n.nodeType===Node.COMMENT_NODE){var o=n.textContent||"",f=ge.exec(o),e=f&&f[1];return e&&(null===(i=n.parentNode)||void 0===i||i.removeChild(n)),e}if(n.hasChildNodes())for(r=n.childNodes,t=0;t1)){u.next=14;break}return u.next=12,n.send("ReceiveJSDataChunk",i,o,l,null);case 12:u.next=20;break;case 14:return u.next=16,n.invoke("ReceiveJSDataChunk",i,o,l,null);case 16:if(u.sent){u.next=18;break}return u.abrupt("break",23);case 18:a=(new Date).valueOf();v=a-s;s=a;e=Math.max(1,Math.round(500/Math.max(1,v)));case 20:f+=c;o++;case 21:u.next=4;break;case 23:u.next=29;break;case 25:return u.prev=25,u.t0=u["catch"](1),u.next=29,n.send("ReceiveJSDataChunk",i,-1,null,u.t0.toString());case 29:case"end":return u.stop()}},u,null,[[1,25]])})),0)}(f,n,t,i)},n.prev=8,n.next=11,f.start();case 11:n.next=18;break;case 13:if(n.prev=13,n.t0=n["catch"](8),!(eo(f,n.t0,i),"FailedToNegotiateWithServerError"===n.t0.errorType)){n.next=17;break}throw n.t0;case 17:ye();case 18:return n.abrupt("return",(c.attachDispatcher({beginInvokeDotNetFromJS:function(n,t,i,r,u){f.send("BeginInvokeDotNetFromJS",n?n.toString():null,t,i,r||0,u)},endInvokeJSFromDotNet:function(n,t,i){f.send("EndInvokeJSFromDotNet",n,t,i)},sendByteArray:function(n,t){f.send("ReceiveByteArray",n,t)}}),f));case 19:case"end":return n.stop()}},n,null,[[8,13]])})),dr.apply(this,arguments)}function eo(n,t,i){i.log(u.Error,t);n&&n.stop()}var c,l,s,ri={},bt,fu,eu,dt,vf,yf,ht,h,k,f,y,df,at,ne,re,ue,yt,ce,be,vr,de,yr,ge,pr;ri.g=function(){if("object"==(typeof globalThis=="undefined"?"undefined":_typeof(globalThis)))return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==(typeof window=="undefined"?"undefined":_typeof(window)))return window}}(),function(n){function nt(n){b.push(n)}function y(n){if(n&&"object"==_typeof(n)){i[v]=new g(n);var t=_defineProperty({},k,v);return v++,t}throw new Error("Cannot create a JSObjectReference from the value '".concat(n,"'."));}function tt(n){var t=-1,i,r;if(_instanceof(n,ArrayBuffer)&&(n=new Uint8Array(n)),_instanceof(n,Blob))t=n.size;else{if(!_instanceof(n.buffer,ArrayBuffer))throw new Error("Supplied value is not a typed array or blob.");if(void 0===n.byteLength)throw new Error("Cannot create a JSStreamReference from the value '".concat(n,"' as it doesn't have a byteLength."));t=n.byteLength}i={__jsStreamReferenceLength:t};try{r=y(n);i.__jsObjectId=r.__jsObjectId}catch(u){throw new Error("Cannot create a JSStreamReference from the value '".concat(n,"'."));}return i}function o(n){return n?JSON.parse(n,function(n,t){return b.reduce(function(t,i){return i(n,t)},t)}):null}function it(n,t,i,r){var f=s(),e,u;if(f.invokeDotNetFromJS)return e=l(r),u=f.invokeDotNetFromJS(n,t,i,e),u?o(u):null;throw new Error("The current dispatcher does not support synchronous calls from JS to .NET. Use invokeMethodAsync instead.");}function p(n,t,i,r){var u,e,o;if(n&&i)throw new Error("For instance method calls, assemblyName should be null. Received '".concat(n,"'."));u=ot++;e=new Promise(function(n,t){f[u]={resolve:n,reject:t}});try{o=l(r);s().beginInvokeDotNetFromJS(u,n,t,i,o)}catch(n){rt(u,!1,n)}return e}function s(){if(null!==e)return e;throw new Error("No .NET call dispatcher has been set.");}function rt(n,t,i){if(!f.hasOwnProperty(n))throw new Error("There is no pending async call with ID ".concat(n,"."));var r=f[n];delete f[n];t?r.resolve(i):r.reject(i)}function st(n){return _instanceof(n,Error)?"".concat(n.message,"\n").concat(n.stack):n?n.toString():"null"}function w(n,t){var r=i[t];if(r)return r.findFunction(n);throw new Error("JS object instance with ID ".concat(t," does not exist (has it been disposed?)."));}function ut(n){delete i[n]}function et(n,t){switch(t){case r.Default:return n;case r.JSObjectReference:return y(n);case r.JSStreamReference:return tt(n);case r.JSVoidResult:return null;default:throw new Error("Invalid JS call result type '".concat(t,"'."));}}function l(n){return u=0,JSON.stringify(n,ht)}function ht(n,t){if(_instanceof(t,h))return t.serializeAsArg();if(_instanceof(t,Uint8Array)){e.sendByteArray(u,t);var i=_defineProperty({},d,u);return u++,i}return t}var h,ft,c,u;window.DotNet=n;var b=[],a=new Map,t=new Map,k="__jsObjectId",d="__byte[]",g=function(){function n(t){_classCallCheck(this,n);this._jsObject=t;this._cachedFunctions=new Map}return _createClass(n,[{key:"findFunction",value:function(n){var i=this._cachedFunctions.get(n),r,t;if(i)return i;if(t=this._jsObject,n.split(".").forEach(function(i){if(!(i in t))throw new Error("Could not find '".concat(n,"' ('").concat(i,"' was undefined)."));r=t;t=t[i]}),_instanceof(t,Function))return t=t.bind(r),this._cachedFunctions.set(n,t),t;throw new Error("The value '".concat(n,"' is not a function."));}},{key:"getWrappedObject",value:function(){return this._jsObject}}]),n}(),f={},i={0:new g(window)};i[0]._cachedFunctions.set("import",function(n){return"string"==typeof n&&n.startsWith("./")&&(n=document.baseURI+n.substr(2)),Promise.resolve().then(function(){return _interopRequireWildcard(require("".concat(n)))})});var r,ot=1,v=1,e=null;n.attachDispatcher=function(n){e=n};n.attachReviver=nt;n.invokeMethod=function(n,t){for(var r=arguments.length,u=new Array(r>2?r-2:0),i=2;i2?r-2:0),i=2;i1?i-1:0),t=1;t1?i-1:0),t=1;t3&&arguments[3]!==undefined?arguments[3]:50,u=af(t),r,f,e;(u||document.documentElement).style.overflowAnchor="none";r=new IntersectionObserver(function(r){r.forEach(function(r){var u;if(r.isIntersecting){var o=t.getBoundingClientRect(),f=i.getBoundingClientRect().top-o.bottom,e=null===(u=r.rootBounds)||void 0===u?void 0:u.height;r.target===t?n.invokeMethodAsync("OnSpacerBeforeVisible",r.intersectionRect.top-r.boundingClientRect.top,f,e):r.target===i&&i.offsetHeight>0&&n.invokeMethodAsync("OnSpacerAfterVisible",r.boundingClientRect.bottom-r.intersectionRect.bottom,f,e)}})},{root:u,rootMargin:"".concat(s,"px")});r.observe(t);r.observe(i);f=o(t);e=o(i);gi[n._id]={intersectionObserver:r,mutationObserverBefore:f,mutationObserverAfter:e}},dispose:function(n){var t=gi[n._id];t&&(t.intersectionObserver.disconnect(),t.mutationObserverBefore.disconnect(),t.mutationObserverAfter.disconnect(),n.dispose(),delete gi[n._id])}},gi={};vf={getAndRemoveExistingTitle:function(){var r,u=document.getElementsByTagName("title"),t,i,n,f;if(0===u.length)return null;for(t=null,i=u.length-1;i>=0;i--)n=u[i],f=n.previousSibling,_instanceof(f,Comment)&&null!==b(f)||(null===t&&(t=n.textContent),null===(r=n.parentNode)||void 0===r||r.removeChild(n));return t}};yf={init:function(n,t){t._blazorInputFileNextFileId=0;t.addEventListener("click",function(){t.value=""});t.addEventListener("change",function(){t._blazorFilesById={};var i=Array.prototype.map.call(t.files,function(n){var i={id:++t._blazorInputFileNextFileId,lastModified:new Date(n.lastModified).toISOString(),name:n.name,size:n.size,contentType:n.type,readPromise:void 0,arrayBuffer:void 0,blob:n};return t._blazorFilesById[i.id]=i,i});n.invokeMethodAsync("NotifyChange",i)})},toImageFile:function(){function i(){return n.apply(this,arguments)}var n=_asyncToGenerator(regeneratorRuntime.mark(function t(n,i,r,u,f){var o,e,s,h;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=pf(n,i),t.next=3,new Promise(function(n){var t=new Image;t.onload=function(){URL.revokeObjectURL(t.src);n(t)};t.onerror=function(){t.onerror=null;URL.revokeObjectURL(t.src)};t.src=URL.createObjectURL(o.blob)});case 3:return e=t.sent,t.next=6,new Promise(function(n){var i,s=Math.min(1,u/e.width),h=Math.min(1,f/e.height),o=Math.min(s,h),t=document.createElement("canvas");t.width=Math.round(e.width*o);t.height=Math.round(e.height*o);null===(i=t.getContext("2d"))||void 0===i||i.drawImage(e,0,0,t.width,t.height);t.toBlob(n,r)});case 6:return s=t.sent,h={id:++n._blazorInputFileNextFileId,lastModified:o.lastModified,name:o.name,size:(null==s?void 0:s.size)||0,contentType:r,blob:s||o.blob},t.abrupt("return",(n._blazorFilesById[h.id]=h,h));case 9:case"end":return t.stop()}},t)}));return i}(),readFileData:function(){function i(){return n.apply(this,arguments)}var n=_asyncToGenerator(regeneratorRuntime.mark(function t(n,i){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",pf(n,i).blob);case 1:case"end":return t.stop()}},t)}));return i}()};ht=new Map;h={navigateTo:ff,registerCustomEventType:function(n,t){if(!t)throw new Error("The options parameter is required.");if(ut.has(n))throw new Error("The event '".concat(n,"' is already registered."));if(t.browserEventName){var i=ui.get(t.browserEventName);i?i.push(n):ui.set(t.browserEventName,[n]);gr.forEach(function(i){return i(n,t.browserEventName)})}ut.set(n,t)},rootComponents:lo,_internal:{navigationManager:ki,domWrapper:ts,Virtualize:is,PageTitle:vf,InputFile:yf,getJSDataStreamChunk:wf,receiveDotNetDataStream:function(n,t,i,r){var u=ht.get(n),f;u||(f=new ReadableStream({start:function(t){ht.set(n,t);u=t}}),c.jsCallDispatcher.supplyDotNetStream(n,f));r?(u.error(r),ht.delete(n)):0===i?(u.close(),ht.delete(n)):u.enqueue(t.length===i?t:t.subarray(0,i))},attachWebRendererInterop:function(n,t,i,r){if(bt.has(n))throw new Error("Interop methods are already registered for renderer ".concat(n));bt.set(n,t);Object.keys(i).length>0&&function(n,t,i){var r,f,u,a,o;if(wt)throw new Error("Dynamic root components have already been enabled.");for(wt=n,tu=t,r=0,f=Object.entries(i);r0&&arguments[0]!==undefined?arguments[0]:"A timeout occurred.",i;return _classCallCheck(this,t),i=(_instanceof(this,t)?this.constructor:void 0).prototype,n=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,r)),n.__proto__=i,n}return _inherits(t,n),t}(_wrapNativeSuper(Error)),ct=function(n){function t(){var n,r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"An abort occurred.",i;return _classCallCheck(this,t),i=(_instanceof(this,t)?this.constructor:void 0).prototype,n=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,r)),n.__proto__=i,n}return _inherits(t,n),t}(_wrapNativeSuper(Error)),us=function(n){function t(n,i){var r,u;return _classCallCheck(this,t),u=(_instanceof(this,t)?this.constructor:void 0).prototype,r=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,n)),r.transport=i,r.errorType="UnsupportedTransportError",r.__proto__=u,r}return _inherits(t,n),t}(_wrapNativeSuper(Error)),fs=function(n){function t(n,i){var r,u;return _classCallCheck(this,t),u=(_instanceof(this,t)?this.constructor:void 0).prototype,r=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,n)),r.transport=i,r.errorType="DisabledTransportError",r.__proto__=u,r}return _inherits(t,n),t}(_wrapNativeSuper(Error)),es=function(n){function t(n,i){var r,u;return _classCallCheck(this,t),u=(_instanceof(this,t)?this.constructor:void 0).prototype,r=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,n)),r.transport=i,r.errorType="FailedToStartTransportError",r.__proto__=u,r}return _inherits(t,n),t}(_wrapNativeSuper(Error)),os=function(n){function t(n){var i,r;return _classCallCheck(this,t),r=(_instanceof(this,t)?this.constructor:void 0).prototype,i=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,n)),i.errorType="FailedToNegotiateWithServerError",i.__proto__=r,i}return _inherits(t,n),t}(_wrapNativeSuper(Error)),ss=function(n){function t(n,i){var r,u;return _classCallCheck(this,t),u=(_instanceof(this,t)?this.constructor:void 0).prototype,r=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,n)),r.innerErrors=i,r.__proto__=u,r}return _inherits(t,n),t}(_wrapNativeSuper(Error)),ir=function ir(n,t,i){_classCallCheck(this,ir);this.statusCode=n;this.statusText=t;this.content=i},rr=function(){function n(){_classCallCheck(this,n)}return _createClass(n,[{key:"get",value:function(n,t){return this.send(_objectSpread({},t,{method:"GET",url:n}))}},{key:"post",value:function(n,t){return this.send(_objectSpread({},t,{method:"POST",url:n}))}},{key:"delete",value:function(n,t){return this.send(_objectSpread({},t,{method:"DELETE",url:n}))}},{key:"getCookieString",value:function(){return""}}]),n}(),n,e,o,t,i;!function(n){n[n.Trace=0]="Trace";n[n.Debug=1]="Debug";n[n.Information=2]="Information";n[n.Warning=3]="Warning";n[n.Error=4]="Error";n[n.Critical=5]="Critical";n[n.None=6]="None"}(n||(n={}));k=function(){function n(){_classCallCheck(this,n)}return _createClass(n,[{key:"log",value:function(){}}]),n}();k.instance=new k;f=function(){function n(){_classCallCheck(this,n)}return _createClass(n,null,[{key:"isRequired",value:function(n,t){if(null==n)throw new Error("The '".concat(t,"' argument is required."));}},{key:"isNotEmpty",value:function(n,t){if(!n||n.match(/^\s*$/))throw new Error("The '".concat(t,"' argument should not be empty."));}},{key:"isIn",value:function(n,t,i){if(!(n in t))throw new Error("Unknown ".concat(i," value: ").concat(n,"."));}}]),n}();y=function(){function n(){_classCallCheck(this,n)}return _createClass(n,null,[{key:"isBrowser",get:function(){return"object"==(typeof window=="undefined"?"undefined":_typeof(window))}},{key:"isWebWorker",get:function(){return"object"==(typeof self=="undefined"?"undefined":_typeof(self))&&"importScripts"in self}},{key:"isNode",get:function(){return!this.isBrowser&&!this.isWebWorker}}]),n}();df=function(){function n(t,i){_classCallCheck(this,n);this._subject=t;this._observer=i}return _createClass(n,[{key:"dispose",value:function(){var n=this._subject.observers.indexOf(this._observer);n>-1&&this._subject.observers.splice(n,1);0===this._subject.observers.length&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(function(){})}}]),n}();at=function(){function t(n){_classCallCheck(this,t);this._minLevel=n;this.out=console}return _createClass(t,[{key:"log",value:function(t,i){if(t>=this._minLevel){var r="[".concat((new Date).toISOString(),"] ").concat(n[t],": ").concat(i);switch(t){case n.Critical:case n.Error:this.out.error(r);break;case n.Warning:this.out.warn(r);break;case n.Information:this.out.info(r);break;default:this.out.log(r)}}}}]),t}();ne=function(t){function i(n){var t,r,u;return _classCallCheck(this,i),(t=_possibleConstructorReturn(this,_getPrototypeOf(i).call(this)),t._logger=n,"undefined"==typeof fetch)?(r=require,t._jar=new(r("tough-cookie").CookieJar),t._fetchType=r("node-fetch"),t._fetchType=r("fetch-cookie")(t._fetchType,t._jar)):t._fetchType=fetch.bind(function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==ri.g)return ri.g;throw new Error("could not find global");}()),"undefined"==typeof AbortController?(u=require,t._abortControllerType=u("abort-controller")):t._abortControllerType=AbortController,_possibleConstructorReturn(t)}return _inherits(i,t),_createClass(i,[{key:"send",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(t){var l=this,u,f,r,e,o,s,h,c;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!(t.abortSignal&&t.abortSignal.aborted)){i.next=2;break}throw new ct;case 2:if(t.method){i.next=4;break}throw new Error("No method defined.");case 4:if(t.url){i.next=6;break}throw new Error("No url defined.");case 6:return u=new this._abortControllerType,t.abortSignal&&(t.abortSignal.onabort=function(){u.abort();f=new ct}),e=null,t.timeout&&(o=t.timeout,e=setTimeout(function(){u.abort();l._logger.log(n.Warning,"Timeout from HTTP request.");f=new tr},o)),i.prev=10,i.next=13,this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:!0===t.withCredentials?"include":"same-origin",headers:_objectSpread({"Content-Type":"text/plain;charset=UTF-8","X-Requested-With":"XMLHttpRequest"},t.headers),method:t.method,mode:"cors",redirect:"follow",signal:u.signal});case 13:r=i.sent;i.next=21;break;case 16:if(i.prev=16,i.t0=i["catch"](10),!f){i.next=20;break}throw f;case 20:throw this._logger.log(n.Warning,"Error from HTTP request. ".concat(i.t0,".")),i.t0;case 21:return i.prev=21,e&&clearTimeout(e),t.abortSignal&&(t.abortSignal.onabort=null),i.finish(21);case 24:if(r.ok){i.next=29;break}return i.next=27,te(r,"text");case 27:s=i.sent;throw new it(s||r.statusText,r.status);case 29:return h=te(r,t.responseType),i.next=32,h;case 32:return c=i.sent,i.abrupt("return",new ir(r.status,r.statusText,c));case 34:case"end":return i.stop()}},i,this,[[10,16,21,24]])}));return r}()},{key:"getCookieString",value:function(){return""}}]),i}(rr);var as=function(t){function i(n){var t;return _classCallCheck(this,i),t=_possibleConstructorReturn(this,_getPrototypeOf(i).call(this)),t._logger=n,t}return _inherits(i,t),_createClass(i,[{key:"send",value:function(t){var i=this;return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new ct):t.method?t.url?new Promise(function(r,u){var f=new XMLHttpRequest,e;f.open(t.method,t.url,!0);f.withCredentials=void 0===t.withCredentials||t.withCredentials;f.setRequestHeader("X-Requested-With","XMLHttpRequest");f.setRequestHeader("Content-Type","text/plain;charset=UTF-8");e=t.headers;e&&Object.keys(e).forEach(function(n){f.setRequestHeader(n,e[n])});t.responseType&&(f.responseType=t.responseType);t.abortSignal&&(t.abortSignal.onabort=function(){f.abort();u(new ct)});t.timeout&&(f.timeout=t.timeout);f.onload=function(){t.abortSignal&&(t.abortSignal.onabort=null);f.status>=200&&f.status<300?r(new ir(f.status,f.statusText,f.response||f.responseText)):u(new it(f.response||f.responseText||f.statusText,f.status))};f.onerror=function(){i._logger.log(n.Warning,"Error from HTTP request. ".concat(f.status,": ").concat(f.statusText,"."));u(new it(f.statusText,f.status))};f.ontimeout=function(){i._logger.log(n.Warning,"Timeout from HTTP request.");u(new tr)};f.send(t.content||"")}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}]),i}(rr),vs=function(n){function t(n){var i;if(_classCallCheck(this,t),i=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this)),"undefined"!=typeof fetch)i._httpClient=new ne(n);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");i._httpClient=new as(n)}return _possibleConstructorReturn(i)}return _inherits(t,n),_createClass(t,[{key:"send",value:function(n){return n.abortSignal&&n.abortSignal.aborted?Promise.reject(new ct):n.method?n.url?this._httpClient.send(n):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}},{key:"getCookieString",value:function(n){return this._httpClient.getCookieString(n)}}]),t}(rr),d=function d(){_classCallCheck(this,d)};d.Authorization="Authorization";d.Cookie="Cookie",function(n){n[n.None=0]="None";n[n.WebSockets=1]="WebSockets";n[n.ServerSentEvents=2]="ServerSentEvents";n[n.LongPolling=4]="LongPolling"}(e||(e={})),function(n){n[n.Text=1]="Text";n[n.Binary=2]="Binary"}(o||(o={}));var ys=function(){function n(){_classCallCheck(this,n);this._isAborted=!1;this.onabort=null}return _createClass(n,[{key:"abort",value:function(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}},{key:"signal",get:function(){return this}},{key:"aborted",get:function(){return this._isAborted}}]),n}(),ie=function(){function t(n,i,r,u){_classCallCheck(this,t);this._httpClient=n;this._accessTokenFactory=i;this._logger=r;this._pollAbort=new ys;this._options=u;this._running=!1;this.onreceive=null;this.onclose=null}return _createClass(t,[{key:"connect",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(t,r){var c,s,l,a,v,u,y,h,e;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!(f.isRequired(t,"url"),f.isRequired(r,"transferFormat"),f.isIn(r,o,"transferFormat"),this._url=t,this._logger.log(n.Trace,"(LongPolling transport) Connecting."),r===o.Binary&&"undefined"!=typeof XMLHttpRequest&&"string"!=typeof(new XMLHttpRequest).responseType)){i.next=2;break}throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");case 2:return c=vt(),s=_slicedToArray(c,2),l=s[0],a=s[1],v=_objectSpread(_defineProperty({},l,a),this._options.headers),u={abortSignal:this._pollAbort.signal,headers:v,timeout:1e5,withCredentials:this._options.withCredentials},r===o.Binary&&(u.responseType="arraybuffer"),i.next=6,this._getAccessToken();case 6:return y=i.sent,this._updateHeaderToken(u,y),h="".concat(t,"&_=").concat(Date.now()),this._logger.log(n.Trace,"(LongPolling transport) polling: ".concat(h,".")),i.next=12,this._httpClient.get(h,u);case 12:e=i.sent;200!==e.statusCode?(this._logger.log(n.Error,"(LongPolling transport) Unexpected response code: ".concat(e.statusCode,".")),this._closeError=new it(e.statusText||"",e.statusCode),this._running=!1):this._running=!0;this._receiving=this._poll(this._url,u);case 14:case"end":return i.stop()}},i,this)}));return r}()},{key:"_getAccessToken",value:function(){function i(){return n.apply(this,arguments)}var n=_asyncToGenerator(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(!this._accessTokenFactory){n.next=6;break}return n.next=3,this._accessTokenFactory();case 3:n.t0=n.sent;n.next=7;break;case 6:n.t0=null;case 7:return n.abrupt("return",n.t0);case 8:case"end":return n.stop()}},t,this)}));return i}()},{key:"_updateHeaderToken",value:function(n,t){n.headers||(n.headers={});t?n.headers[d.Authorization]="Bearer ".concat(t):n.headers[d.Authorization]&&delete n.headers[d.Authorization]}},{key:"_poll",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(t,r){var e,f,u;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:i.prev=0;case 1:if(!this._running){i.next=20;break}return i.next=4,this._getAccessToken();case 4:return e=i.sent,this._updateHeaderToken(r,e),i.prev=6,f="".concat(t,"&_=").concat(Date.now()),this._logger.log(n.Trace,"(LongPolling transport) polling: ".concat(f,".")),i.next=11,this._httpClient.get(f,r);case 11:u=i.sent;204===u.statusCode?(this._logger.log(n.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==u.statusCode?(this._logger.log(n.Error,"(LongPolling transport) Unexpected response code: ".concat(u.statusCode,".")),this._closeError=new it(u.statusText||"",u.statusCode),this._running=!1):u.content?(this._logger.log(n.Trace,"(LongPolling transport) data received. ".concat(lt(u.content,this._options.logMessageContent),".")),this.onreceive&&this.onreceive(u.content)):this._logger.log(n.Trace,"(LongPolling transport) Poll timed out, reissuing.");i.next=18;break;case 15:i.prev=15;i.t0=i["catch"](6);this._running?_instanceof(i.t0,tr)?this._logger.log(n.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=i.t0,this._running=!1):this._logger.log(n.Trace,"(LongPolling transport) Poll errored after shutdown: ".concat(i.t0.message));case 18:i.next=1;break;case 20:return i.prev=20,this._logger.log(n.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose(),i.finish(20);case 23:case"end":return i.stop()}},i,this,[[0,,20,23],[6,15]])}));return r}()},{key:"send",value:function(){function i(){return n.apply(this,arguments)}var n=_asyncToGenerator(regeneratorRuntime.mark(function t(n){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._running?kf(this._logger,"LongPolling",this._httpClient,this._url,this._accessTokenFactory,n,this._options):Promise.reject(new Error("Cannot send until the transport is connected")));case 1:case"end":return t.stop()}},t,this)}));return i}()},{key:"stop",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(){var t,f,r,e,o,u,s;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return this._logger.log(n.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort(),i.prev=1,i.next=4,this._receiving;case 4:return this._logger.log(n.Trace,"(LongPolling transport) sending DELETE request to ".concat(this._url,".")),t={},f=vt(),r=_slicedToArray(f,2),e=r[0],o=r[1],t[e]=o,u={headers:_objectSpread({},t,{},this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials},i.next=10,this._getAccessToken();case 10:return s=i.sent,this._updateHeaderToken(u,s),i.next=14,this._httpClient.delete(this._url,u);case 14:this._logger.log(n.Trace,"(LongPolling transport) DELETE request sent.");case 15:return i.prev=15,this._logger.log(n.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose(),i.finish(15);case 18:case"end":return i.stop()}},i,this,[[1,,15,18]])}));return r}()},{key:"_raiseOnClose",value:function(){if(this.onclose){var t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError);this._logger.log(n.Trace,t);this.onclose(this._closeError)}}},{key:"pollAborted",get:function(){return this._pollAbort.aborted}}]),t}(),ps=function(){function t(n,i,r,u){_classCallCheck(this,t);this._httpClient=n;this._accessTokenFactory=i;this._logger=r;this._options=u;this.onreceive=null;this.onclose=null}return _createClass(t,[{key:"connect",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(t,r){var u=this,e;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!(f.isRequired(t,"url"),f.isRequired(r,"transferFormat"),f.isIn(r,o,"transferFormat"),this._logger.log(n.Trace,"(SSE transport) Connecting."),this._url=t,this._accessTokenFactory)){i.next=5;break}return i.next=3,this._accessTokenFactory();case 3:e=i.sent;e&&(t+=(t.indexOf("?")<0?"?":"&")+"access_token=".concat(encodeURIComponent(e)));case 5:return i.abrupt("return",new Promise(function(i,f){var e,h=!1,c,s;if(r===o.Text){if(y.isBrowser||y.isWebWorker)e=new u._options.EventSource(t,{withCredentials:u._options.withCredentials});else{c=u._httpClient.getCookieString(t);s={};s.Cookie=c;var a=vt(),l=_slicedToArray(a,2),v=l[0],p=l[1];s[v]=p;e=new u._options.EventSource(t,{withCredentials:u._options.withCredentials,headers:_objectSpread({},s,{},u._options.headers)})}try{e.onmessage=function(t){if(u.onreceive)try{u._logger.log(n.Trace,"(SSE transport) data received. ".concat(lt(t.data,u._options.logMessageContent),"."));u.onreceive(t.data)}catch(t){return void u._close(t)}};e.onerror=function(){h?u._close():f(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))};e.onopen=function(){u._logger.log(n.Information,"SSE connected to ".concat(u._url));u._eventSource=e;h=!0;i()}}catch(t){return void f(t)}}else f(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}));case 6:case"end":return i.stop()}},i,this)}));return r}()},{key:"send",value:function(){function i(){return n.apply(this,arguments)}var n=_asyncToGenerator(regeneratorRuntime.mark(function t(n){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._eventSource?kf(this._logger,"SSE",this._httpClient,this._url,this._accessTokenFactory,n,this._options):Promise.reject(new Error("Cannot send until the transport is connected")));case 1:case"end":return t.stop()}},t,this)}));return i}()},{key:"stop",value:function(){return this._close(),Promise.resolve()}},{key:"_close",value:function(n){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(n))}}]),t}(),ws=function(){function t(n,i,r,u,f,e){_classCallCheck(this,t);this._logger=r;this._accessTokenFactory=i;this._logMessageContent=u;this._webSocketConstructor=f;this._httpClient=n;this.onreceive=null;this.onclose=null;this._headers=e}return _createClass(t,[{key:"connect",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(t,r){var u=this,e;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!(f.isRequired(t,"url"),f.isRequired(r,"transferFormat"),f.isIn(r,o,"transferFormat"),this._logger.log(n.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory)){i.next=5;break}return i.next=3,this._accessTokenFactory();case 3:e=i.sent;e&&(t+=(t.indexOf("?")<0?"?":"&")+"access_token=".concat(encodeURIComponent(e)));case 5:return i.abrupt("return",new Promise(function(i,f){var e,s;t=t.replace(/^http/,"ws");u._httpClient.getCookieString(t);s=!1;e||(e=new u._webSocketConstructor(t));r===o.Binary&&(e.binaryType="arraybuffer");e.onopen=function(){u._logger.log(n.Information,"WebSocket connected to ".concat(t,"."));u._webSocket=e;s=!0;i()};e.onerror=function(t){var i=null;i="undefined"!=typeof ErrorEvent&&_instanceof(t,ErrorEvent)?t.error:"There was an error with the transport";u._logger.log(n.Information,"(WebSockets transport) ".concat(i,"."))};e.onmessage=function(t){if(u._logger.log(n.Trace,"(WebSockets transport) data received. ".concat(lt(t.data,u._logMessageContent),".")),u.onreceive)try{u.onreceive(t.data)}catch(t){return void u._close(t)}};e.onclose=function(n){if(s)u._close(n);else{var t=null;t="undefined"!=typeof ErrorEvent&&_instanceof(n,ErrorEvent)?n.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.";f(new Error(t))}}}));case 6:case"end":return i.stop()}},i,this)}));return r}()},{key:"send",value:function(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(n.Trace,"(WebSockets transport) sending data. ".concat(lt(t,this._logMessageContent),".")),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}},{key:"stop",value:function(){return this._webSocket&&this._close(void 0),Promise.resolve()}},{key:"_close",value:function(t){this._webSocket&&(this._webSocket.onclose=function(){},this._webSocket.onmessage=function(){},this._webSocket.onerror=function(){},this._webSocket.close(),this._webSocket=void 0);this._logger.log(n.Trace,"(WebSockets transport) socket closed.");this.onclose&&(!this._isCloseEvent(t)||!1!==t.wasClean&&1e3===t.code?_instanceof(t,Error)?this.onclose(t):this.onclose():this.onclose(new Error("WebSocket closed with status code: ".concat(t.code," (").concat(t.reason||"no reason given",")."))))}},{key:"_isCloseEvent",value:function(n){return n&&"boolean"==typeof n.wasClean&&"number"==typeof n.code}}]),t}(),bs=function(){function t(i){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},u;if(_classCallCheck(this,t),this._stopPromiseResolver=function(){},this.features={},this._negotiateVersion=1,f.isRequired(i,"url"),this._logger=void 0===(u=r.logger)?new at(n.Information):null===u?k.instance:void 0!==u.log?u:new at(u),this.baseUrl=this._resolveUrl(i),(r=r||{}).logMessageContent=void 0!==r.logMessageContent&&r.logMessageContent,"boolean"!=typeof r.withCredentials&&void 0!==r.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");r.withCredentials=void 0===r.withCredentials||r.withCredentials;r.timeout=void 0===r.timeout?1e5:r.timeout;"undefined"==typeof WebSocket||r.WebSocket||(r.WebSocket=WebSocket);"undefined"==typeof EventSource||r.EventSource||(r.EventSource=EventSource);this._httpClient=r.httpClient||new vs(this._logger);this._connectionState="Disconnected";this._connectionStarted=!1;this._options=r;this.onreceive=null;this.onclose=null}return _createClass(t,[{key:"start",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(t){var r,u;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!(t=t||o.Binary,f.isIn(t,o,"transferFormat"),this._logger.log(n.Debug,"Starting connection with transfer format '".concat(o[t],"'.")),"Disconnected"!==this._connectionState)){i.next=2;break}return i.abrupt("return",Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state.")));case 2:return this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),i.next=6,this._startInternalPromise;case 6:if(!("Disconnecting"===this._connectionState)){i.next=12;break}return r="Failed to start the HttpConnection before stop() was called.",this._logger.log(n.Error,r),i.next=11,this._stopPromise;case 11:return i.abrupt("return",Promise.reject(new Error(r)));case 12:if(!("Connected"!==this._connectionState)){i.next=15;break}return u="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!",i.abrupt("return",(this._logger.log(n.Error,u),Promise.reject(new Error(u))));case 15:this._connectionStarted=!0;case 16:case"end":return i.stop()}},i,this)}));return r}()},{key:"send",value:function(n){return"Connected"!==this._connectionState?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new ks(this.transport)),this._sendQueue.send(n))}},{key:"stop",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(t){var r=this;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!("Disconnected"===this._connectionState)){i.next=4;break}i.t0=(this._logger.log(n.Debug,"Call to HttpConnection.stop(".concat(t,") ignored because the connection is already in the disconnected state.")),Promise.resolve());i.next=16;break;case 4:if(!("Disconnecting"===this._connectionState)){i.next=8;break}i.t1=(this._logger.log(n.Debug,"Call to HttpConnection.stop(".concat(t,") ignored because the connection is already in the disconnecting state.")),this._stopPromise);i.next=15;break;case 8:return this._connectionState="Disconnecting",this._stopPromise=new Promise(function(n){r._stopPromiseResolver=n}),i.next=12,this._stopInternal(t);case 12:return i.next=14,this._stopPromise;case 14:i.t1=void i.sent;case 15:i.t0=i.t1;case 16:return i.abrupt("return",i.t0);case 17:case"end":return i.stop()}},i,this)}));return r}()},{key:"_stopInternal",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(t){return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return this._stopError=t,i.prev=1,i.next=4,this._startInternalPromise;case 4:i.next=8;break;case 6:i.prev=6;i.t0=i["catch"](1);case 8:if(!this.transport){i.next=20;break}return i.prev=9,i.next=12,this.transport.stop();case 12:i.next=17;break;case 14:i.prev=14;i.t1=i["catch"](9);this._logger.log(n.Error,"HttpConnection.transport.stop() threw error '".concat(i.t1,"'."));this._stopConnection();case 17:this.transport=void 0;i.next=21;break;case 20:this._logger.log(n.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.");case 21:case"end":return i.stop()}},i,this,[[1,6],[9,14]])}));return r}()},{key:"_startInternal",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(t){var o=this,u,r,f;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(u=this.baseUrl,this._accessTokenFactory=this._options.accessTokenFactory,i.prev=2,!this._options.skipNegotiation){i.next=11;break}if(!(this._options.transport!==e.WebSockets)){i.next=6;break}throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");case 6:return this.transport=this._constructTransport(e.WebSockets),i.next=9,this._startTransport(u,t);case 9:i.next=28;break;case 11:r=null;f=0;case 12:return i.next=14,this._getNegotiationResponse(u);case 14:if(r=i.sent,!("Disconnecting"===this._connectionState||"Disconnected"===this._connectionState)){i.next=17;break}throw new Error("The connection was stopped during negotiation.");case 17:if(!r.error){i.next=19;break}throw new Error(r.error);case 19:if(!r.ProtocolVersion){i.next=21;break}throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");case 21:(r.url&&(u=r.url),r.accessToken)&&function(){var n=r.accessToken;o._accessTokenFactory=function(){return n}}();f++;case 23:if(r.url&&f<100){i.next=12;break}case 24:if(!(100===f&&r.url)){i.next=26;break}throw new Error("Negotiate redirection limit exceeded.");case 26:return i.next=28,this._createTransport(u,this._options.transport,r,t);case 28:_instanceof(this.transport,ie)&&(this.features.inherentKeepAlive=!0);"Connecting"===this._connectionState&&(this._logger.log(n.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected");i.next=34;break;case 31:return i.prev=31,i.t0=i["catch"](2),i.abrupt("return",(this._logger.log(n.Error,"Failed to start the connection: "+i.t0),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(i.t0)));case 34:case"end":return i.stop()}},i,this,[[2,31]])}));return r}()},{key:"_getNegotiationResponse",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(t){var u,o,c,s,l,a,h,f,r,e;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(u={},!this._accessTokenFactory){i.next=6;break}return i.next=4,this._accessTokenFactory();case 4:o=i.sent;o&&(u[d.Authorization]="Bearer ".concat(o));case 6:return c=vt(),s=_slicedToArray(c,2),l=s[0],a=s[1],u[l]=a,h=this._resolveNegotiateUrl(t),this._logger.log(n.Debug,"Sending negotiation request: ".concat(h,".")),i.prev=10,i.next=13,this._httpClient.post(h,{content:"",headers:_objectSpread({},u,{},this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});case 13:if(f=i.sent,!(200!==f.statusCode)){i.next=16;break}return i.abrupt("return",Promise.reject(new Error("Unexpected status code returned from negotiate '".concat(f.statusCode,"'"))));case 16:return r=JSON.parse(f.content),i.abrupt("return",((!r.negotiateVersion||r.negotiateVersion<1)&&(r.connectionToken=r.connectionId),r));case 20:return i.prev=20,i.t0=i["catch"](10),e="Failed to complete negotiation with the server: "+i.t0,i.abrupt("return",(_instanceof(i.t0,it)&&404===i.t0.statusCode&&(e+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(n.Error,e),Promise.reject(new os(e))));case 24:case"end":return i.stop()}},i,this,[[10,20]])}));return r}()},{key:"_createConnectUrl",value:function(n,t){return t?n+(-1===n.indexOf("?")?"?":"&")+"id=".concat(t):n}},{key:"_createTransport",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(t,r,u,f){var l,o,b,s,a,y,p,v,k,h,c,w;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(l=this._createConnectUrl(t,u.connectionToken),!this._isITransport(r)){i.next=7;break}return this._logger.log(n.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=r,i.next=6,this._startTransport(l,f);case 6:return i.abrupt("return",void(this.connectionId=u.connectionId));case 7:o=[];b=u.availableTransports||[];s=u;a=!0;y=!1;p=undefined;i.prev=12;v=b[Symbol.iterator]();case 14:if(a=(k=v.next()).done){i.next=47;break}if(h=k.value,c=this._resolveTransportOrError(h,r,f),!_instanceof(c,Error)){i.next=21;break}o.push("".concat(h.transport," failed:"));o.push(c);i.next=44;break;case 21:if(!this._isITransport(c)){i.next=44;break}if(!(this.transport=c,!s)){i.next=33;break}return i.prev=23,i.next=26,this._getNegotiationResponse(t);case 26:s=i.sent;i.next=32;break;case 29:return i.prev=29,i.t0=i["catch"](23),i.abrupt("return",Promise.reject(i.t0));case 32:l=this._createConnectUrl(t,s.connectionToken);case 33:return i.prev=33,i.next=36,this._startTransport(l,f);case 36:return i.abrupt("return",void(this.connectionId=s.connectionId));case 39:if(i.prev=39,i.t1=i["catch"](33),!(this._logger.log(n.Error,"Failed to start the transport '".concat(h.transport,"': ").concat(i.t1)),s=void 0,o.push(new es("".concat(h.transport," failed: ").concat(i.t1),e[h.transport])),"Connecting"!==this._connectionState)){i.next=44;break}return w="Failed to select transport before stop() was called.",i.abrupt("return",(this._logger.log(n.Debug,w),Promise.reject(new Error(w))));case 44:a=!0;i.next=14;break;case 47:i.next=53;break;case 49:i.prev=49;i.t2=i["catch"](12);y=!0;p=i.t2;case 53:i.prev=53;i.prev=54;a||v.return==null||v.return();case 56:if(i.prev=56,!y){i.next=59;break}throw p;case 59:return i.finish(56);case 60:return i.finish(53);case 61:return i.abrupt("return",o.length>0?Promise.reject(new ss("Unable to connect to the server with any of the available transports. ".concat(o.join(" ")),o)):Promise.reject(new Error("None of the transports supported by the client are supported by the server.")));case 62:case"end":return i.stop()}},i,this,[[12,49,53,61],[23,29],[33,39],[54,,56,60]])}));return r}()},{key:"_constructTransport",value:function(n){switch(n){case e.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new ws(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case e.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new ps(this._httpClient,this._accessTokenFactory,this._logger,this._options);case e.LongPolling:return new ie(this._httpClient,this._accessTokenFactory,this._logger,this._options);default:throw new Error("Unknown transport: ".concat(n,"."));}}},{key:"_startTransport",value:function(n,t){var i=this;return this.transport.onreceive=this.onreceive,this.transport.onclose=function(n){return i._stopConnection(n)},this.transport.connect(n,t)}},{key:"_resolveTransportOrError",value:function(t,i,r){var u=e[t.transport];if(null==u)return this._logger.log(n.Debug,"Skipping transport '".concat(t.transport,"' because it is not supported by this client.")),new Error("Skipping transport '".concat(t.transport,"' because it is not supported by this client."));if(!function(n,t){return!n||0!=(t&n)}(i,u))return this._logger.log(n.Debug,"Skipping transport '".concat(e[u],"' because it was disabled by the client.")),new fs("'".concat(e[u],"' is disabled by the client."),u);if(!(t.transferFormats.map(function(n){return o[n]}).indexOf(r)>=0))return this._logger.log(n.Debug,"Skipping transport '".concat(e[u],"' because it does not support the requested transfer format '").concat(o[r],"'.")),new Error("'".concat(e[u],"' does not support ").concat(o[r],"."));if(u===e.WebSockets&&!this._options.WebSocket||u===e.ServerSentEvents&&!this._options.EventSource)return this._logger.log(n.Debug,"Skipping transport '".concat(e[u],"' because it is not supported in your environment.'")),new us("'".concat(e[u],"' is not supported in your environment."),u);this._logger.log(n.Debug,"Selecting transport '".concat(e[u],"'."));try{return this._constructTransport(u)}catch(t){return t}}},{key:"_isITransport",value:function(n){return n&&"object"==_typeof(n)&&"connect"in n}},{key:"_stopConnection",value:function(t){var i=this;if(this._logger.log(n.Debug,"HttpConnection.stopConnection(".concat(t,") called while in state ").concat(this._connectionState,".")),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,"Disconnected"!==this._connectionState){if("Connecting"===this._connectionState)throw this._logger.log(n.Warning,"Call to HttpConnection.stopConnection(".concat(t,") was ignored because the connection is still in the connecting state.")),new Error("HttpConnection.stopConnection(".concat(t,") was called while the connection is still in the connecting state."));if("Disconnecting"===this._connectionState&&this._stopPromiseResolver(),t?this._logger.log(n.Error,"Connection disconnected with error '".concat(t,"'.")):this._logger.log(n.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(function(t){i._logger.log(n.Error,"TransportSendQueue.stop() threw error '".concat(t,"'."))}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(r){this._logger.log(n.Error,"HttpConnection.onclose(".concat(t,") threw error '").concat(r,"'."))}}}else this._logger.log(n.Debug,"Call to HttpConnection.stopConnection(".concat(t,") was ignored because the connection is already in the disconnected state."))}},{key:"_resolveUrl",value:function(t){if(0===t.lastIndexOf("https://",0)||0===t.lastIndexOf("http://",0))return t;if(!y.isBrowser||!window.document)throw new Error("Cannot resolve '".concat(t,"'."));var i=window.document.createElement("a");return i.href=t,this._logger.log(n.Information,"Normalizing '".concat(t,"' to '").concat(i.href,"'.")),i.href}},{key:"_resolveNegotiateUrl",value:function(n){var i=n.indexOf("?"),t=n.substring(0,-1===i?n.length:i);return"/"!==t[t.length-1]&&(t+="/"),t+="negotiate",t+=-1===i?"":n.substring(i),-1===t.indexOf("negotiateVersion")&&(t+=-1===i?"?":"&",t+="negotiateVersion="+this._negotiateVersion),t}}]),t}(),ks=function(){function n(t){_classCallCheck(this,n);this._transport=t;this._buffer=[];this._executing=!0;this._sendBufferedData=new gt;this._transportResult=new gt;this._sendLoopPromise=this._sendLoop()}return _createClass(n,[{key:"send",value:function(n){return this._bufferData(n),this._transportResult||(this._transportResult=new gt),this._transportResult.promise}},{key:"stop",value:function(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}},{key:"_bufferData",value:function(n){if(this._buffer.length&&_typeof(this._buffer[0])!=_typeof(n))throw new Error("Expected data to be of type ".concat(_typeof(this._buffer)," but was of type ").concat(_typeof(n)));this._buffer.push(n);this._sendBufferedData.resolve()}},{key:"_sendLoop",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(){var t,r;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this._sendBufferedData.promise;case 2:if(this._executing){i.next=5;break}return this._transportResult&&this._transportResult.reject("Connection stopped."),i.abrupt("break",21);case 5:return this._sendBufferedData=new gt,t=this._transportResult,this._transportResult=void 0,r="string"==typeof this._buffer[0]?this._buffer.join(""):n._concatBuffers(this._buffer),this._buffer.length=0,i.prev=10,i.next=13,this._transport.send(r);case 13:t.resolve();i.next=19;break;case 16:i.prev=16;i.t0=i["catch"](10);t.reject(i.t0);case 19:i.next=0;break;case 21:case"end":return i.stop()}},i,this,[[10,16]])}));return r}()}],[{key:"_concatBuffers",value:function(n){var h=n.map(function(n){return n.byteLength}).reduce(function(n,t){return n+t}),u=new Uint8Array(h),f=0,i=!0,e=!1,o=undefined,t,s,r;try{for(t=n[Symbol.iterator]();!(i=(s=t.next()).done);i=!0)r=s.value,u.set(new Uint8Array(r),f),f+=r.byteLength}catch(c){e=!0;o=c}finally{try{i||t.return==null||t.return()}finally{if(e)throw o;}}return u.buffer}}]),n}(),gt=function(){function n(){var t=this;_classCallCheck(this,n);this.promise=new Promise(function(n,i){var r;return r=[n,i],t._resolver=r[0],t._rejecter=r[1],r})}return _createClass(n,[{key:"resolve",value:function(){this._resolver()}},{key:"reject",value:function(n){this._rejecter(n)}}]),n}(),w=function(){function n(){_classCallCheck(this,n)}return _createClass(n,null,[{key:"write",value:function(t){return"".concat(t).concat(n.RecordSeparator)}},{key:"parse",value:function(t){if(t[t.length-1]!==n.RecordSeparator)throw new Error("Message is incomplete.");var i=t.split(n.RecordSeparator);return i.pop(),i}}]),n}();w.RecordSeparatorCode=30;w.RecordSeparator=String.fromCharCode(w.RecordSeparatorCode);re=function(){function n(){_classCallCheck(this,n)}return _createClass(n,[{key:"writeHandshakeRequest",value:function(n){return w.write(JSON.stringify(n))}},{key:"parseHandshakeResponse",value:function(n){var f,e,t,o,r,i,s,u,c,h;if(ur(n)){if(t=new Uint8Array(n),o=t.indexOf(w.RecordSeparatorCode),-1===o)throw new Error("Message is incomplete.");r=o+1;f=String.fromCharCode.apply(null,Array.prototype.slice.call(t.slice(0,r)));e=t.byteLength>r?t.slice(r).buffer:null}else{if(i=n,s=i.indexOf(w.RecordSeparator),-1===s)throw new Error("Message is incomplete.");u=s+1;f=i.substring(0,u);e=i.length>u?i.substring(u):null}if(c=w.parse(f),h=JSON.parse(c[0]),h.type)throw new Error("Expected a handshake response from the server.");return[e,h]}}]),n}();!function(n){n[n.Invocation=1]="Invocation";n[n.StreamItem=2]="StreamItem";n[n.Completion=3]="Completion";n[n.StreamInvocation=4]="StreamInvocation";n[n.CancelInvocation=5]="CancelInvocation";n[n.Ping=6]="Ping";n[n.Close=7]="Close"}(t||(t={}));ue=function(){function n(){_classCallCheck(this,n);this.observers=[]}return _createClass(n,[{key:"next",value:function(n){var i=!0,r=!1,u=undefined,t,f,e;try{for(t=this.observers[Symbol.iterator]();!(i=(f=t.next()).done);i=!0)e=f.value,e.next(n)}catch(o){r=!0;u=o}finally{try{i||t.return==null||t.return()}finally{if(r)throw u;}}}},{key:"error",value:function(n){var i=!0,u=!1,f=undefined,t,e,r;try{for(t=this.observers[Symbol.iterator]();!(i=(e=t.next()).done);i=!0)r=e.value,r.error&&r.error(n)}catch(o){u=!0;f=o}finally{try{i||t.return==null||t.return()}finally{if(u)throw f;}}}},{key:"complete",value:function(){var t=!0,r=!1,u=undefined,n,f,i;try{for(n=this.observers[Symbol.iterator]();!(t=(f=n.next()).done);t=!0)i=f.value,i.complete&&i.complete()}catch(e){r=!0;u=e}finally{try{t||n.return==null||n.return()}finally{if(r)throw u;}}}},{key:"subscribe",value:function(n){return this.observers.push(n),new df(this,n)}}]),n}();!function(n){n.Disconnected="Disconnected";n.Connecting="Connecting";n.Connected="Connected";n.Disconnecting="Disconnecting";n.Reconnecting="Reconnecting"}(i||(i={}));var ds=function(){function r(u,e,o,s){var h=this;_classCallCheck(this,r);this._nextKeepAlive=0;this._freezeEventListener=function(){h._logger.log(n.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")};f.isRequired(u,"connection");f.isRequired(e,"logger");f.isRequired(o,"protocol");this.serverTimeoutInMilliseconds=3e4;this.keepAliveIntervalInMilliseconds=15e3;this._logger=e;this._protocol=o;this.connection=u;this._reconnectPolicy=s;this._handshakeProtocol=new re;this.connection.onreceive=function(n){return h._processIncomingData(n)};this.connection.onclose=function(n){return h._connectionClosed(n)};this._callbacks={};this._methods={};this._closedCallbacks=[];this._reconnectingCallbacks=[];this._reconnectedCallbacks=[];this._invocationId=0;this._receivedHandshakeResponse=!1;this._connectionState=i.Disconnected;this._connectionStarted=!1;this._cachedPingMessage=this._protocol.writeMessage({type:t.Ping})}return _createClass(r,[{key:"start",value:function(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}},{key:"_startWithStateTransitions",value:function(){function u(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function r(){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(this._connectionState!==i.Disconnected)){t.next=2;break}return t.abrupt("return",Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state.")));case 2:return this._connectionState=i.Connecting,this._logger.log(n.Debug,"Starting HubConnection."),t.prev=3,t.next=6,this._startInternal();case 6:y.isBrowser&&document&&document.addEventListener("freeze",this._freezeEventListener);this._connectionState=i.Connected;this._connectionStarted=!0;this._logger.log(n.Debug,"HubConnection connected successfully.");t.next=15;break;case 12:return t.prev=12,t.t0=t["catch"](3),t.abrupt("return",(this._connectionState=i.Disconnected,this._logger.log(n.Debug,"HubConnection failed to start successfully because of error '".concat(t.t0,"'.")),Promise.reject(t.t0)));case 15:case"end":return t.stop()}},r,this,[[3,12]])}));return u}()},{key:"_startInternal",value:function(){function r(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function i(){var t=this,r,u;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1,r=new Promise(function(n,i){t._handshakeResolver=n;t._handshakeRejecter=i}),i.next=4,this.connection.start(this._protocol.transferFormat);case 4:return i.prev=4,u={protocol:this._protocol.name,version:this._protocol.version},this._logger.log(n.Debug,"Sending handshake request."),i.next=9,this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(u));case 9:return this._logger.log(n.Information,"Using HubProtocol '".concat(this._protocol.name,"'.")),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),i.next=15,r;case 15:if(!this._stopDuringStartError){i.next=17;break}throw this._stopDuringStartError;case 17:i.next=27;break;case 19:return i.prev=19,i.t0=i["catch"](4),this._logger.log(n.Debug,"Hub handshake failed with error '".concat(i.t0,"' during start(). Stopping HubConnection.")),this._cleanupTimeout(),this._cleanupPingTimer(),i.next=26,this.connection.stop(i.t0);case 26:throw i.t0;case 27:case"end":return i.stop()}},i,this,[[4,19]])}));return r}()},{key:"stop",value:function(){function i(){return n.apply(this,arguments)}var n=_asyncToGenerator(regeneratorRuntime.mark(function t(){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._startPromise,this._stopPromise=this._stopInternal(),t.next=4,this._stopPromise;case 4:return t.prev=4,t.next=7,n;case 7:t.next=11;break;case 9:t.prev=9;t.t0=t["catch"](4);case 11:case"end":return t.stop()}},t,this,[[4,9]])}));return i}()},{key:"_stopInternal",value:function(t){return this._connectionState===i.Disconnected?(this._logger.log(n.Debug,"Call to HubConnection.stop(".concat(t,") ignored because it is already in the disconnected state.")),Promise.resolve()):this._connectionState===i.Disconnecting?(this._logger.log(n.Debug,"Call to HttpConnection.stop(".concat(t,") ignored because the connection is already in the disconnecting state.")),this._stopPromise):(this._connectionState=i.Disconnecting,this._logger.log(n.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(n.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new Error("The connection was stopped before the hub handshake could complete."),this.connection.stop(t)))}},{key:"stream",value:function(n){for(var u=this,e=arguments.length,o=new Array(e>1?e-1:0),f=1;f1?i-1:0),t=1;t1?u-1:0),r=1;r=0&&u>=0&&i<=17179869183?0===u&&i<=4294967295?(t=new Uint8Array(4),(r=new DataView(t.buffer)).setUint32(0,i),t):(f=i/4294967296,e=4294967295&i,t=new Uint8Array(8),(r=new DataView(t.buffer)).setUint32(0,u<<2|3&f),r.setUint32(4,e),t):(t=new Uint8Array(12),(r=new DataView(t.buffer)).setUint32(0,u),fe(r,4,i),t)}((t=1e6*((i=n.getTime())-1e3*(r=Math.floor(i/1e3))),{sec:r+(u=Math.floor(t/1e9)),nsec:t-1e9*u})):null},decode:function(n){var t=function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength),i;switch(n.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:return i=t.getUint32(0),{sec:4294967296*(3&i)+t.getUint32(4),nsec:i>>>2};case 12:return{sec:ee(t,4),nsec:t.getUint32(0)};default:throw new p("Unrecognized data size for timestamp (expected 4, 8, or 12): "+n.length);}}(n);return new Date(1e3*t.sec+t.nsec/1e6)}},he=function(){function n(){this.builtInEncoders=[];this.builtInDecoders=[];this.encoders=[];this.decoders=[];this.register(oh)}return n.prototype.register=function(n){var t=n.type,r=n.encode,u=n.decode,i;t>=0?(this.encoders[t]=r,this.decoders[t]=u):(i=1+t,this.builtInEncoders[i]=r,this.builtInDecoders[i]=u)},n.prototype.tryToEncode=function(n,t){for(var r,u,i=0;ithis.maxDepth)throw new Error("Too deep objects in depth "+t);null==n?this.encodeNil():"boolean"==typeof n?this.encodeBoolean(n):"number"==typeof n?this.encodeNumber(n):"string"==typeof n?this.encodeString(n):this.encodeObject(n,t)},n.prototype.ensureBufferSizeToWrite=function(n){var t=this.pos+n;this.view.byteLength=0?n<128?this.writeU8(n):n<256?(this.writeU8(204),this.writeU8(n)):n<65536?(this.writeU8(205),this.writeU16(n)):n<4294967296?(this.writeU8(206),this.writeU32(n)):(this.writeU8(207),this.writeU64(n)):n>=-32?this.writeU8(224|n+32):n>=-128?(this.writeU8(208),this.writeI8(n)):n>=-32768?(this.writeU8(209),this.writeI16(n)):n>=-2147483648?(this.writeU8(210),this.writeI32(n)):(this.writeU8(211),this.writeI64(n)):this.forceFloat32?(this.writeU8(202),this.writeF32(n)):(this.writeU8(203),this.writeF64(n))},n.prototype.writeStringHeader=function(n){if(n<32)this.writeU8(160+n);else if(n<256)this.writeU8(217),this.writeU8(n);else if(n<65536)this.writeU8(218),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too long string: "+n+" bytes in UTF-8");this.writeU8(219);this.writeU32(n)}},n.prototype.encodeString=function(n){if(n.length>ih){var t=oe(n);this.ensureBufferSizeToWrite(5+t);this.writeStringHeader(t);rh(n,this.bytes,this.pos);this.pos+=t}else t=oe(n),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(n,t,i){for(var r,e,o=n.length,u=i,f=0;f>6&31|192:(r>=55296&&r<=56319&&f>12&15|224,t[u++]=r>>6&63|128):(t[u++]=r>>18&7|240,t[u++]=r>>12&63|128,t[u++]=r>>6&63|128)),t[u++]=63&r|128):t[u++]=r}(n,this.bytes,this.pos),this.pos+=t},n.prototype.encodeObject=function(n,t){var i=this.extensionCodec.tryToEncode(n,this.context);if(null!=i)this.encodeExtension(i);else if(Array.isArray(n))this.encodeArray(n,t);else if(ArrayBuffer.isView(n))this.encodeBinary(n);else{if("object"!=_typeof(n))throw new Error("Unrecognized object: "+Object.prototype.toString.apply(n));this.encodeMap(n,t)}},n.prototype.encodeBinary=function(n){var t=n.byteLength,i;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: "+t);this.writeU8(198);this.writeU32(t)}i=ii(n);this.writeU8a(i)},n.prototype.encodeArray=function(n,t){var i=n.length,r,u,f;if(i<16)this.writeU8(144+i);else if(i<65536)this.writeU8(220),this.writeU16(i);else{if(!(i<4294967296))throw new Error("Too large array: "+i);this.writeU8(221);this.writeU32(i)}for(r=0,u=n;r0&&n<=this.maxKeyLength},n.prototype.find=function(n,t,i){var r,f;n:for(r=0,f=this.caches[i-1];r=this.maxLengthPerKey?i[Math.random()*i.length|0]=r:i.push(r)},n.prototype.decode=function(n,t,i){var u=this.find(n,t,i),r,f;return null!=u?(this.hit++,u):(this.miss++,r=se(n,t,i),f=Uint8Array.prototype.slice.call(n,t,t+i),this.store(f,r),r)},n}(),sr=function(n,t){function o(e){return function(o){return function(e){if(f)throw new TypeError("Generator is already executing.");for(;r;)try{if(f=1,u&&(i=2&e[0]?u.return:e[0]?u.throw||((i=u.return)&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;switch(u=0,i&&(e=[2&e[0],i.value]),e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!((i=(i=r.trys).length>0&&i[i.length-1])||6!==e[0]&&2!==e[0])){r=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]1||f(n,t)})})}function f(n,t){try{_instanceof((i=o[n](t)).value,rt)?Promise.resolve(i.value.v).then(h,c):s(r[0][2],i)}catch(n){s(r[0][3],n)}var i}function h(n){f("next",n)}function c(n){f("throw",n)}function s(n,t){n(t);r.shift();r.length&&f(r[0][0],r[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var u,o=i.apply(n,t||[]),r=[];return u={},e("next"),e("throw"),e("return"),u[Symbol.asyncIterator]=function(){return this},u},hr=new DataView(new ArrayBuffer(0)),ch=new Uint8Array(hr.buffer),cr=function(){try{hr.getInt8(0)}catch(n){return n.constructor}throw new Error("never reached");}(),ae=new cr("Insufficient data"),lh=new sh,ah=function(){function n(n,t,i,r,u,f,e,o){void 0===n&&(n=he.defaultCodec);void 0===t&&(t=void 0);void 0===i&&(i=g);void 0===r&&(r=g);void 0===u&&(u=g);void 0===f&&(f=g);void 0===e&&(e=g);void 0===o&&(o=lh);this.extensionCodec=n;this.context=t;this.maxStrLength=i;this.maxBinLength=r;this.maxArrayLength=u;this.maxMapLength=f;this.maxExtLength=e;this.keyDecoder=o;this.totalPos=0;this.pos=0;this.view=hr;this.bytes=ch;this.headByte=-1;this.stack=[]}return n.prototype.reinitializeState=function(){this.totalPos=0;this.headByte=-1;this.stack.length=0},n.prototype.setBuffer=function(n){this.bytes=ii(n);this.view=function(n){if(_instanceof(n,ArrayBuffer))return new DataView(n);var t=ii(n);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes);this.pos=0},n.prototype.appendBuffer=function(n){if(-1!==this.headByte||this.hasRemaining(1)){var t=this.bytes.subarray(this.pos),r=ii(n),i=new Uint8Array(t.length+r.length);i.set(t);i.set(r,t.length);this.setBuffer(i)}else this.setBuffer(n)},n.prototype.hasRemaining=function(n){return this.view.byteLength-this.pos>=n},n.prototype.createExtraByteError=function(n){var t=this.view,i=this.pos;return new RangeError("Extra "+(t.byteLength-i)+" of "+t.byteLength+" byte(s) found at buffer["+n+"]")},n.prototype.decode=function(n){this.reinitializeState();this.setBuffer(n);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},n.prototype.decodeMulti=function(n){return sr(this,function(t){switch(t.label){case 0:this.reinitializeState();this.setBuffer(n);t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}})},n.prototype.decodeAsync=function(n){var i,r,f,e,o,u,t;return o=this,void 0,t=function(){var t,o,s,h,u,c,l,a;return sr(this,function(v){switch(v.label){case 0:t=!1;v.label=1;case 1:v.trys.push([1,6,7,12]);i=le(n);v.label=2;case 2:return[4,i.next()];case 3:if((r=v.sent()).done)return[3,5];if(s=r.value,t)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s);try{o=this.doDecodeSync();t=!0}catch(n){if(!_instanceof(n,cr))throw n;}this.totalPos+=this.pos;v.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return h=v.sent(),f={error:h},[3,12];case 7:return v.trys.push([7,,10,11]),r&&!r.done&&(e=i.return)?[4,e.call(i)]:[3,9];case 8:v.sent();v.label=9;case 9:return[3,11];case 10:if(f)throw f.error;return[7];case 11:return[7];case 12:if(t){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,o]}throw c=(u=this).headByte,l=u.pos,a=u.totalPos,new RangeError("Insufficient data in parsing "+or(c)+" at "+a+" ("+l+" in the current buffer)");}})},new((u=void 0)||(u=Promise))(function(n,i){function f(n){try{r(t.next(n))}catch(n){i(n)}}function e(n){try{r(t.throw(n))}catch(n){i(n)}}function r(t){var i;t.done?n(t.value):(i=t.value,_instanceof(i,u)?i:new u(function(n){n(i)})).then(f,e)}r((t=t.apply(o,[])).next())})},n.prototype.decodeArrayStream=function(n){return this.decodeMultiAsync(n,!0)},n.prototype.decodeStream=function(n){return this.decodeMultiAsync(n,!1)},n.prototype.decodeMultiAsync=function(n,t){return hh(this,arguments,function(){var f,i,r,u,o,s,h,e,c;return sr(this,function(l){switch(l.label){case 0:f=t;i=-1;l.label=1;case 1:l.trys.push([1,13,14,19]);r=le(n);l.label=2;case 2:return[4,rt(r.next())];case 3:if((u=l.sent()).done)return[3,12];if(o=u.value,t&&0===i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o);f&&(i=this.readArraySize(),f=!1,this.complete());l.label=4;case 4:l.trys.push([4,9,,10]);l.label=5;case 5:return[4,rt(this.doDecodeSync())];case 6:return[4,l.sent()];case 7:return l.sent(),0==--i?[3,8]:[3,5];case 8:return[3,10];case 9:if(!_instanceof(s=l.sent(),cr))throw s;return[3,10];case 10:this.totalPos+=this.pos;l.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return h=l.sent(),e={error:h},[3,19];case 14:return l.trys.push([14,,17,18]),u&&!u.done&&(c=r.return)?[4,rt(c.call(r))]:[3,16];case 15:l.sent();l.label=16;case 16:return[3,18];case 17:if(e)throw e.error;return[7];case 18:return[7];case 19:return[2]}})})},n.prototype.doDecodeSync=function(){var t,n,u,i,f,r,e;n:for(;;){if(t=this.readHeadByte(),n=void 0,t>=224)n=t-256;else if(t<192)if(t<128)n=t;else if(t<144){if(0!=(i=t-128)){this.pushMapState(i);this.complete();continue n}n={}}else if(t<160){if(0!=(i=t-144)){this.pushArrayState(i);this.complete();continue n}n=[]}else u=t-160,n=this.decodeUtf8String(u,0);else if(192===t)n=null;else if(194===t)n=!1;else if(195===t)n=!0;else if(202===t)n=this.readF32();else if(203===t)n=this.readF64();else if(204===t)n=this.readU8();else if(205===t)n=this.readU16();else if(206===t)n=this.readU32();else if(207===t)n=this.readU64();else if(208===t)n=this.readI8();else if(209===t)n=this.readI16();else if(210===t)n=this.readI32();else if(211===t)n=this.readI64();else if(217===t)u=this.lookU8(),n=this.decodeUtf8String(u,1);else if(218===t)u=this.lookU16(),n=this.decodeUtf8String(u,2);else if(219===t)u=this.lookU32(),n=this.decodeUtf8String(u,4);else if(220===t){if(0!==(i=this.readU16())){this.pushArrayState(i);this.complete();continue n}n=[]}else if(221===t){if(0!==(i=this.readU32())){this.pushArrayState(i);this.complete();continue n}n=[]}else if(222===t){if(0!==(i=this.readU16())){this.pushMapState(i);this.complete();continue n}n={}}else if(223===t){if(0!==(i=this.readU32())){this.pushMapState(i);this.complete();continue n}n={}}else if(196===t)i=this.lookU8(),n=this.decodeBinary(i,1);else if(197===t)i=this.lookU16(),n=this.decodeBinary(i,2);else if(198===t)i=this.lookU32(),n=this.decodeBinary(i,4);else if(212===t)n=this.decodeExtension(1,0);else if(213===t)n=this.decodeExtension(2,0);else if(214===t)n=this.decodeExtension(4,0);else if(215===t)n=this.decodeExtension(8,0);else if(216===t)n=this.decodeExtension(16,0);else if(199===t)i=this.lookU8(),n=this.decodeExtension(i,1);else if(200===t)i=this.lookU16(),n=this.decodeExtension(i,2);else{if(201!==t)throw new p("Unrecognized type byte: "+or(t));i=this.lookU32();n=this.decodeExtension(i,4)}for(this.complete(),f=this.stack;f.length>0;)if(r=f[f.length-1],0===r.type){if(r.array[r.position]=n,r.position++,r.position!==r.size)continue n;f.pop();n=r.array}else{if(1===r.type){if("string"!=(e=_typeof(n))&&"number"!==e)throw new p("The type of key must be string or number but "+_typeof(n));if("__proto__"===n)throw new p("The key __proto__ is not allowed");r.key=n;r.type=2;continue n}if(r.map[r.key]=n,r.readCount++,r.readCount!==r.size){r.key=null;r.type=1;continue n}f.pop();n=r.map}return n}},n.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},n.prototype.complete=function(){this.headByte=-1},n.prototype.readArraySize=function(){var n=this.readHeadByte();switch(n){case 220:return this.readU16();case 221:return this.readU32();default:if(n<160)return n-144;throw new p("Unrecognized array type byte: "+or(n));}},n.prototype.pushMapState=function(n){if(n>this.maxMapLength)throw new p("Max length exceeded: map length ("+n+") > maxMapLengthLength ("+this.maxMapLength+")");this.stack.push({type:1,size:n,key:null,readCount:0,map:{}})},n.prototype.pushArrayState=function(n){if(n>this.maxArrayLength)throw new p("Max length exceeded: array length ("+n+") > maxArrayLength ("+this.maxArrayLength+")");this.stack.push({type:0,size:n,array:new Array(n),position:0})},n.prototype.decodeUtf8String=function(n,t){var r,u,i;if(n>this.maxStrLength)throw new p("Max length exceeded: UTF-8 byte length ("+n+") > maxStrLength ("+this.maxStrLength+")");if(this.bytes.byteLengthfh?function(n,t,i){var r=n.subarray(t,t+i);return uh.decode(r)}(this.bytes,i,n):se(this.bytes,i,n),this.pos+=t+n,u},n.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},n.prototype.decodeBinary=function(n,t){if(n>this.maxBinLength)throw new p("Max length exceeded: bin length ("+n+") > maxBinLength ("+this.maxBinLength+")");if(!this.hasRemaining(n+t))throw ae;var i=this.pos+t,r=this.bytes.subarray(i,i+n);return this.pos+=t+n,r},n.prototype.decodeExtension=function(n,t){if(n>this.maxExtLength)throw new p("Max length exceeded: ext length ("+n+") > maxExtLength ("+this.maxExtLength+")");var i=this.view.getInt8(this.pos+t),r=this.decodeBinary(n,t+1);return this.extensionCodec.decode(r,i,this.context)},n.prototype.lookU8=function(){return this.view.getUint8(this.pos)},n.prototype.lookU16=function(){return this.view.getUint16(this.pos)},n.prototype.lookU32=function(){return this.view.getUint32(this.pos)},n.prototype.readU8=function(){var n=this.view.getUint8(this.pos);return this.pos++,n},n.prototype.readI8=function(){var n=this.view.getInt8(this.pos);return this.pos++,n},n.prototype.readU16=function(){var n=this.view.getUint16(this.pos);return this.pos+=2,n},n.prototype.readI16=function(){var n=this.view.getInt16(this.pos);return this.pos+=2,n},n.prototype.readU32=function(){var n=this.view.getUint32(this.pos);return this.pos+=4,n},n.prototype.readI32=function(){var n=this.view.getInt32(this.pos);return this.pos+=4,n},n.prototype.readU64=function(){var n,t,i=(n=this.view,t=this.pos,4294967296*n.getUint32(t)+n.getUint32(t+4));return this.pos+=8,i},n.prototype.readI64=function(){var n=ee(this.view,this.pos);return this.pos+=8,n},n.prototype.readF32=function(){var n=this.view.getFloat32(this.pos);return this.pos+=4,n},n.prototype.readF64=function(){var n=this.view.getFloat64(this.pos);return this.pos+=8,n},n}(),nt=function(){function n(){_classCallCheck(this,n)}return _createClass(n,null,[{key:"write",value:function(n){var t=n.byteLength||n.length,i=[],u,r;do u=127&t,t>>=7,t>0&&(u|=128),i.push(u);while(t>0);return t=n.byteLength||n.length,r=new Uint8Array(i.length+t),r.set(i,0),r.set(n,i.length),r.buffer}},{key:"parse",value:function(n){for(var e=[],r=new Uint8Array(n),o=[0,7,14,21,28],i=0;i7)throw new Error("Messages bigger than 2GB are not supported.");if(!(r.byteLength>=i+t+f))throw new Error("Incomplete message.");e.push(r.slice?r.slice(i+t,i+t+f):r.subarray(i+t,i+t+f));i=i+t+f}return e}}]),n}(),vh=new Uint8Array([145,t.Ping]),yh=function(){function i(n){_classCallCheck(this,i);this.name="messagepack";this.version=1;this.transferFormat=o.Binary;this._errorResult=1;this._voidResult=2;this._nonVoidResult=3;n=n||{};this._encoder=new ce(n.extensionCodec,n.context,n.maxDepth,n.initialBufferSize,n.sortKeys,n.forceFloat32,n.ignoreUndefined,n.forceIntegerToFloat);this._decoder=new ah(n.extensionCodec,n.context,n.maxStrLength,n.maxBinLength,n.maxArrayLength,n.maxMapLength,n.maxExtLength)}return _createClass(i,[{key:"parseMessages",value:function(n,t){var i,r,h,c,f;if(!(i=n)||"undefined"==typeof ArrayBuffer||!(_instanceof(i,ArrayBuffer)||i.constructor&&"ArrayBuffer"===i.constructor.name))throw new Error("Invalid input for MessagePack hub protocol. Expected an ArrayBuffer.");null===t&&(t=k.instance);var l=nt.parse(n),e=[],u=!0,o=!1,s=undefined;try{for(r=l[Symbol.iterator]();!(u=(h=r.next()).done);u=!0)c=h.value,f=this._parseMessage(c,t),f&&e.push(f)}catch(a){o=!0;s=a}finally{try{u||r.return==null||r.return()}finally{if(o)throw s;}}return e}},{key:"writeMessage",value:function(n){switch(n.type){case t.Invocation:return this._writeInvocation(n);case t.StreamInvocation:return this._writeStreamInvocation(n);case t.StreamItem:return this._writeStreamItem(n);case t.Completion:return this._writeCompletion(n);case t.Ping:return nt.write(vh);case t.CancelInvocation:return this._writeCancelInvocation(n);default:throw new Error("Invalid message type.");}}},{key:"_parseMessage",value:function(i,r){var u,f;if(0===i.length)throw new Error("Invalid payload.");if(u=this._decoder.decode(i),0===u.length||!_instanceof(u,Array))throw new Error("Invalid payload.");f=u[0];switch(f){case t.Invocation:return this._createInvocationMessage(this._readHeaders(u),u);case t.StreamItem:return this._createStreamItemMessage(this._readHeaders(u),u);case t.Completion:return this._createCompletionMessage(this._readHeaders(u),u);case t.Ping:return this._createPingMessage(u);case t.Close:return this._createCloseMessage(u);default:return r.log(n.Information,"Unknown message type '"+f+"' ignored."),null}}},{key:"_createCloseMessage",value:function(n){if(n.length<2)throw new Error("Invalid payload for Close message.");return{allowReconnect:n.length>=3?n[2]:void 0,error:n[1],type:t.Close}}},{key:"_createPingMessage",value:function(n){if(n.length<1)throw new Error("Invalid payload for Ping message.");return{type:t.Ping}}},{key:"_createInvocationMessage",value:function(n,i){if(i.length<5)throw new Error("Invalid payload for Invocation message.");var r=i[2];return r?{arguments:i[4],headers:n,invocationId:r,streamIds:[],target:i[3],type:t.Invocation}:{arguments:i[4],headers:n,streamIds:[],target:i[3],type:t.Invocation}}},{key:"_createStreamItemMessage",value:function(n,i){if(i.length<4)throw new Error("Invalid payload for StreamItem message.");return{headers:n,invocationId:i[2],item:i[3],type:t.StreamItem}}},{key:"_createCompletionMessage",value:function(n,i){var r,u,f;if(i.length<4)throw new Error("Invalid payload for Completion message.");if(r=i[3],r!==this._voidResult&&i.length<5)throw new Error("Invalid payload for Completion message.");switch(r){case this._errorResult:u=i[4];break;case this._nonVoidResult:f=i[4]}return{error:u,headers:n,invocationId:i[2],result:f,type:t.Completion}}},{key:"_writeInvocation",value:function(n){var i;return i=n.streamIds?this._encoder.encode([t.Invocation,n.headers||{},n.invocationId||null,n.target,n.arguments,n.streamIds]):this._encoder.encode([t.Invocation,n.headers||{},n.invocationId||null,n.target,n.arguments]),nt.write(i.slice())}},{key:"_writeStreamInvocation",value:function(n){var i;return i=n.streamIds?this._encoder.encode([t.StreamInvocation,n.headers||{},n.invocationId,n.target,n.arguments,n.streamIds]):this._encoder.encode([t.StreamInvocation,n.headers||{},n.invocationId,n.target,n.arguments]),nt.write(i.slice())}},{key:"_writeStreamItem",value:function(n){var i=this._encoder.encode([t.StreamItem,n.headers||{},n.invocationId,n.item]);return nt.write(i.slice())}},{key:"_writeCompletion",value:function(n){var i=n.error?this._errorResult:n.result?this._nonVoidResult:this._voidResult,r;switch(i){case this._errorResult:r=this._encoder.encode([t.Completion,n.headers||{},n.invocationId,i,n.error]);break;case this._voidResult:r=this._encoder.encode([t.Completion,n.headers||{},n.invocationId,i]);break;case this._nonVoidResult:r=this._encoder.encode([t.Completion,n.headers||{},n.invocationId,i,n.result])}return nt.write(r.slice())}},{key:"_writeCancelInvocation",value:function(n){var i=this._encoder.encode([t.CancelInvocation,n.headers||{},n.invocationId]);return nt.write(i.slice())}},{key:"_readHeaders",value:function(n){var t=n[1];if("object"!=_typeof(t))throw new Error("Invalid headers.");return t}}]),i}(),ve=!1;var ar="function"==typeof TextDecoder?new TextDecoder("utf-8"):null,ph=ar?ar.decode.bind(ar):function(n){for(var r=0,h=n.length,i=[],f=[],t,e,o,s,u;r65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u));i.length>1024&&(f.push(String.fromCharCode.apply(null,i)),i.length=0)}return f.push(String.fromCharCode.apply(null,i)),f.join("")},wh=Math.pow(2,32),bh=Math.pow(2,21)-1;var kh=function(){function n(t){_classCallCheck(this,n);this.batchData=t;var i=new tc(t);this.arrayRangeReader=new ic(t);this.arrayBuilderSegmentReader=new rc(t);this.diffReader=new dh(t);this.editReader=new gh(t,i);this.frameReader=new nc(t,i)}return _createClass(n,[{key:"updatedComponents",value:function(){return r(this.batchData,this.batchData.length-20)}},{key:"referenceFrames",value:function(){return r(this.batchData,this.batchData.length-16)}},{key:"disposedComponentIds",value:function(){return r(this.batchData,this.batchData.length-12)}},{key:"disposedEventHandlerIds",value:function(){return r(this.batchData,this.batchData.length-8)}},{key:"updatedComponentsEntry",value:function(n,t){var i=n+4*t;return r(this.batchData,i)}},{key:"referenceFramesEntry",value:function(n,t){return n+20*t}},{key:"disposedComponentIdsEntry",value:function(n,t){var i=n+4*t;return r(this.batchData,i)}},{key:"disposedEventHandlerIdsEntry",value:function(n,t){var i=n+8*t;return we(this.batchData,i)}}]),n}(),dh=function(){function n(t){_classCallCheck(this,n);this.batchDataUint8=t}return _createClass(n,[{key:"componentId",value:function(n){return r(this.batchDataUint8,n)}},{key:"edits",value:function(n){return n+4}},{key:"editsEntry",value:function(n,t){return n+16*t}}]),n}(),gh=function(){function n(t,i){_classCallCheck(this,n);this.batchDataUint8=t;this.stringReader=i}return _createClass(n,[{key:"editType",value:function(n){return r(this.batchDataUint8,n)}},{key:"siblingIndex",value:function(n){return r(this.batchDataUint8,n+4)}},{key:"newTreeIndex",value:function(n){return r(this.batchDataUint8,n+8)}},{key:"moveToSiblingIndex",value:function(n){return r(this.batchDataUint8,n+8)}},{key:"removedAttributeName",value:function(n){var t=r(this.batchDataUint8,n+12);return this.stringReader.readString(t)}}]),n}(),nc=function(){function n(t,i){_classCallCheck(this,n);this.batchDataUint8=t;this.stringReader=i}return _createClass(n,[{key:"frameType",value:function(n){return r(this.batchDataUint8,n)}},{key:"subtreeLength",value:function(n){return r(this.batchDataUint8,n+4)}},{key:"elementReferenceCaptureId",value:function(n){var t=r(this.batchDataUint8,n+4);return this.stringReader.readString(t)}},{key:"componentId",value:function(n){return r(this.batchDataUint8,n+8)}},{key:"elementName",value:function(n){var t=r(this.batchDataUint8,n+8);return this.stringReader.readString(t)}},{key:"textContent",value:function(n){var t=r(this.batchDataUint8,n+4);return this.stringReader.readString(t)}},{key:"markupContent",value:function(n){var t=r(this.batchDataUint8,n+4);return this.stringReader.readString(t)}},{key:"attributeName",value:function(n){var t=r(this.batchDataUint8,n+4);return this.stringReader.readString(t)}},{key:"attributeValue",value:function(n){var t=r(this.batchDataUint8,n+8);return this.stringReader.readString(t)}},{key:"attributeEventHandlerId",value:function(n){return we(this.batchDataUint8,n+12)}}]),n}(),tc=function(){function n(t){_classCallCheck(this,n);this.batchDataUint8=t;this.stringTableStartIndex=r(t,t.length-4)}return _createClass(n,[{key:"readString",value:function(n){var t;if(-1===n)return null;var i=r(this.batchDataUint8,this.stringTableStartIndex+4*n),u=function(n,t){for(var r,u=0,f=0,i=0;i<4;i++){if(r=n[t+i],u|=(127&r)<this.nextBatchId)){t.next=14;break}if(!this.fatalError){t.next=12;break}return this.logger.log(u.Debug,"Received a new batch ".concat(n," but errored out on a previous batch ").concat(this.nextBatchId-1)),t.next=9,r.send("OnRenderCompleted",this.nextBatchId-1,this.fatalError.toString());case 9:t.t0=void t.sent;t.next=13;break;case 12:t.t0=void this.logger.log(u.Debug,"Waiting for batch ".concat(this.nextBatchId,". Batch ").concat(n," not processed."));case 13:return t.abrupt("return",t.t0);case 14:return t.prev=14,this.nextBatchId++,this.logger.log(u.Debug,"Applying batch ".concat(n,".")),function(n,t){var r=pi[n],u,f,l,e,v;if(!r)throw new Error("There is no browser renderer with ID ".concat(n,"."));var i=t.arrayRangeReader,o=t.updatedComponents(),y=i.values(o),p=i.count(o),w=t.referenceFrames(),b=i.values(w),s=t.diffReader;for(u=0;u=this.minLevel){var i="[".concat((new Date).toISOString(),"] ").concat(u[n],": ").concat(t);switch(n){case u.Critical:case u.Error:console.error(i);break;case u.Warning:console.warn(i);break;case u.Information:console.info(i);break;default:console.log(i)}}}}]),n}(),fc=function(){function n(t,i){_classCallCheck(this,n);this.circuitId=void 0;this.components=t;this.applicationState=i}return _createClass(n,[{key:"reconnect",value:function(n){if(!this.circuitId)throw new Error("Circuit host not initialized.");return n.state!==i.Connected?Promise.resolve(!1):n.invoke("ConnectCircuit",this.circuitId)}},{key:"initialize",value:function(n){if(this.circuitId)throw new Error("Circuit host '".concat(this.circuitId,"' already initialized."));this.circuitId=n}},{key:"startCircuit",value:function(){function r(){return n.apply(this,arguments)}var n=_asyncToGenerator(regeneratorRuntime.mark(function t(n){var r;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(n.state!==i.Connected)){t.next=2;break}return t.abrupt("return",!1);case 2:return t.next=4,n.invoke("StartCircuit",ki.getBaseURI(),ki.getLocationHref(),JSON.stringify(this.components.map(function(n){return n.toRecord()})),this.applicationState||"");case 4:return r=t.sent,t.abrupt("return",!!r&&(this.initialize(r),!0));case 6:case"end":return t.stop()}},t,this)}));return r}()},{key:"resolveElement",value:function(n){var i=function(n){var t=oi.get(n);if(t)return oi.delete(n),t}(n),t;if(i)return et(i,!0);if(t=Number.parseInt(n),!Number.isNaN(t))return function(n,t){if(!n.parentNode)throw new Error("Comment not connected to the DOM ".concat(n.textContent));var i=n.parentNode,r=et(i,!0),u=v(r);return Array.from(i.childNodes).forEach(function(n){return u.push(n)}),n[hi]=r,t&&(n[su]=t,et(t)),et(n)}(this.components[t].start,this.components[t].end);throw new Error("Invalid sequence number or identifier '".concat(n,"'."));}}]),n}(),ke={configureSignalR:function(){},logLevel:u.Warning,reconnectionOptions:{maxRetries:8,retryIntervalMilliseconds:2e4,dialogId:"components-reconnect-modal"}},ec=function(){function n(t,i,r,f){var e=this;_classCallCheck(this,n);this.maxRetries=i;this.document=r;this.logger=f;this.addedToDom=!1;this.modal=this.document.createElement("div");this.modal.id=t;this.maxRetries=i;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";this.modal.innerHTML='
<\/h5>