import{d as ye}from"./CIa53I7v.chunk.js";var B={},$={exports:{}},ee={exports:{}},te={exports:{}},ce;function Te(){if(ce)return te.exports;ce=1;var b=te.exports={type:m,isArray:a,isFunction:E,isPlainObject:k,each:s,extend:y,noop:function(){}},o=Object.prototype.toString,t={};"Boolean Number String Function Array Date RegExp Object".split(" ").forEach(function(u){t["[object "+u+"]"]=u.toLowerCase()});function m(u){return u==null?String(u):t[o.call(u)]||"object"}function E(u){return b.type(u)==="function"}function a(u){return b.type(u)==="array"}function s(u,c,r){var l,_=0,S=u.length,e=S===void 0||E(u);if(r)if(e){for(l in u)if(c.apply(u[l],r)===!1)break}else for(;_<S&&c.apply(u[_++],r)!==!1;);else if(e){for(l in u)if(c.call(u[l],l,u[l])===!1)break}else for(;_<S&&c.call(u[_],_,u[_++])!==!1;);return u}function k(u){return!(!u||b.type(u)!=="object")}function y(){var u,c,r,l,_,S,e=arguments[0]||{},n=1,d=arguments.length,h=!1;for(typeof e=="boolean"&&(h=e,e=arguments[1]||{},n=2),typeof e!="object"&&!b.isFunction(e)&&(e={}),d===n&&(e=this,--n);n<d;n++)if((u=arguments[n])!=null)for(c in u)r=e[c],l=u[c],e!==l&&(h&&l&&(b.isPlainObject(l)||(_=b.isArray(l)))?(_?(_=!1,S=r&&b.isArray(r)?r:[]):S=r&&b.isPlainObject(r)?r:{},e[c]=b.extend(h,S,l)):l!==void 0&&(e[c]=l));return e}return te.exports}var ue;function _e(){if(ue)return ee.exports;ue=1;var b=ee.exports=Te(),o=/\s+/,t={};function m(E){var a=t[E]={};return b.each(E.split(o),function(s,k){a[k]=!0}),a}return b.Callbacks=function(E){E=typeof E=="string"?t[E]||m(E):b.extend({},E);var a,s,k,y,u,c,r=[],l=!E.once&&[],_=function(e){for(a=E.memory&&e,s=!0,c=y||0,y=0,u=r.length,k=!0;r&&c<u;c++)if(r[c].apply(e[0],e[1])===!1&&E.stopOnFalse){a=!1;break}k=!1,r&&(l?l.length&&_(l.shift()):a?r=[]:S.disable())},S={add:function(){if(r){var e=r.length;(function n(d){b.each(d,function(h,p){var T=b.type(p);T==="function"?(!E.unique||!S.has(p))&&r.push(p):p&&p.length&&T!=="string"&&n(p)})})(arguments),k?u=r.length:a&&(y=e,_(a))}return this},remove:function(){return r&&b.each(arguments,function(e,n){for(var d;(d=b.inArray(n,r,d))>-1;)r.splice(d,1),k&&(d<=u&&u--,d<=c&&c--)}),this},has:function(e){return b.inArray(e,r)>-1},empty:function(){return r=[],this},disable:function(){return r=l=a=void 0,this},disabled:function(){return!r},lock:function(){return l=void 0,a||S.disable(),this},locked:function(){return!l},fireWith:function(e,n){return n=n||[],n=[e,n.slice?n.slice():n],r&&(!s||l)&&(k?l.push(n):_(n)),this},fire:function(){return S.fireWith(this,arguments),this},fired:function(){return!!s}};return S},ee.exports}var de;function Ce(){if(de)return $.exports;de=1;/*!
* jquery-deferred
* Copyright(c) 2011 Hidden <zzdhidden@gmail.com>
* MIT Licensed
*/var b=$.exports=_e(),o=Array.prototype.slice;return b.extend({Deferred:function(t){var m=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],E="pending",a={state:function(){return E},always:function(){return s.done(arguments).fail(arguments),this},then:function(){var k=arguments;return b.Deferred(function(y){b.each(m,function(u,c){var r=c[0],l=k[u];s[c[1]](b.isFunction(l)?function(){var _=l.apply(this,arguments);_&&b.isFunction(_.promise)?_.promise().done(y.resolve).fail(y.reject).progress(y.notify):y[r+"With"](this===s?y:this,[_])}:y[r])}),k=null}).promise()},promise:function(k){return k!=null?b.extend(k,a):a}},s={};return a.pipe=a.then,b.each(m,function(k,y){var u=y[2],c=y[3];a[y[1]]=u.add,c&&u.add(function(){E=c},m[k^1][2].disable,m[2][2].lock),s[y[0]]=u.fire,s[y[0]+"With"]=u.fireWith}),a.promise(s),t&&t.call(s,s),s},when:function(t){var m=0,E=o.call(arguments),a=E.length,s=a!==1||t&&b.isFunction(t.promise)?a:0,k=s===1?t:b.Deferred(),y=function(l,_,S){return function(e){_[l]=this,S[l]=arguments.length>1?o.call(arguments):e,S===u?k.notifyWith(_,S):--s||k.resolveWith(_,S)}},u,c,r;if(a>1)for(u=new Array(a),c=new Array(a),r=new Array(a);m<a;m++)E[m]&&b.isFunction(E[m].promise)?E[m].promise().done(y(m,r,E)).fail(k.reject).progress(y(m,c,u)):--s;return s||k.resolveWith(r,E),k.promise()}}),$.exports}var re,fe;function ke(){return fe||(fe=1,re=Ce()),re}var ie={exports:{}};/**
 * @preserve jquery-param (c) 2015 KNOWLEDGECODE | MIT
 */var he;function Re(){return he||(he=1,(function(b){(function(o){var t=function(m){var E=[],a=/\[\]$/,s=function(u){return Object.prototype.toString.call(u)==="[object Array]"},k=function(u,c){c=typeof c=="function"?c():c===null||c===void 0?"":c,E[E.length]=encodeURIComponent(u)+"="+encodeURIComponent(c)},y=function(u,c){var r,l,_;if(u)if(s(c))for(r=0,l=c.length;r<l;r++)a.test(u)?k(u,c[r]):y(u+"["+(typeof c[r]=="object"?r:"")+"]",c[r]);else if(c&&String(c)==="[object Object]")for(_ in c)y(u+"["+_+"]",c[_]);else k(u,c);else if(s(c))for(r=0,l=c.length;r<l;r++)k(c[r].name,c[r].value);else for(_ in c)y(_,c[_]);return E};return y("",m).join("&").replace(/%20/g,"+")};b.exports=t})()})(ie)),ie.exports}var ne,ge;function Ee(){if(ge)return ne;ge=1;var b=ke(),o=Re(),t=function(s){var k=s.events||{};return s&&s===s.window?{0:s,load:function(u){return s.addEventListener("load",u,!1)},bind:function(u,c){return s.addEventListener(u,c,!1)},unbind:function(u,c){return s.removeEventListener(u,c,!1)}}:{0:s,unbind:function(u,c){var r=k[u]||[];if(c){var l=r.indexOf(c);l!==-1&&r.splice(l,1)}else r=[];k[u]=r,s.events=k},bind:function(u,c){var r=k[u]||[];k[u]=r.concat(c),s.events=k},triggerHandler:function(u,c){var r=this,l=k[u]||[];l.forEach(function(_){c&&c[0]&&c[0].type===void 0?c=[{type:u}].concat(c||[]):c=c||[],_.apply(r,c)})}}},m=function(){try{return new window.XMLHttpRequest}catch{}},E=function(s){var k=m();s.xhrFields&&s.xhrFields.withCredentials&&(k.withCredentials=!0),k.onreadystatechange=function(){if(k.readyState===4)if(k.status===200&&!k._hasError)try{s.success&&s.success(JSON.parse(k.responseText))}catch{s.error&&s.error(k)}else s.error&&s.error(k)},k.withCredentials=s.xhrFields.withCredentials;var y="_="+new Date().getTime();return s.url.indexOf("?")===-1?s.url+="?"+y:s.url.indexOf("_=")===-1?s.url+="&"+y:s.url=s.url.replace(/_=\d+/,y),k.open(s.type,s.url),k.setRequestHeader("content-type",s.contentType),s.headers&&Object.keys(s.headers).forEach(function(u){var c=s.headers[u];k.setRequestHeader(u,c)}),k.send(s.data.data&&"data="+encodeURIComponent(s.data.data)),{abort:function(c){return k.abort(c)}}};return ne=b.extend(t,b,{defaultAjaxHeaders:null,ajax:E,inArray:function(s,k){return s.indexOf(k)!==-1},trim:function(s){return s&&s.trim()},isEmptyObject:function(s){return!s||Object.keys(s).length===0},makeArray:function(s){return[].slice.call(s,0)},param:function(s){return o(s)},support:{cors:(function(){var a=m();return!!a&&"withCredentials"in a})()}}),ne}var pe;function Pe(){if(pe)return B;pe=1,Object.defineProperty(B,"__esModule",{value:!0});var b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=Ee();/*!
 * ASP.NET SignalR JavaScript Library 2.4.1
 * http://signalr.net/
 *
 * Copyright (c) .NET Foundation. All rights reserved.
 * Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 *
 */return(function(t,m,E){var a={nojQuery:"jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.",noTransportOnInit:"No transport could be initialized successfully. Try specifying a different transport or none at all for auto initialization.",errorOnNegotiate:"Error during negotiation request.",stoppedWhileLoading:"The connection was stopped during page load.",stoppedWhileNegotiating:"The connection was stopped during the negotiate request.",errorParsingNegotiateResponse:"Error parsing negotiate response.",errorRedirectionExceedsLimit:"Negotiate redirection limit exceeded.",errorDuringStartRequest:"Error during start request. Stopping the connection.",errorFromServer:"Error message received from the server: '{0}'.",stoppedDuringStartRequest:"The connection was stopped during the start request.",errorParsingStartResponse:"Error parsing start response: '{0}'. Stopping the connection.",invalidStartResponse:"Invalid start response: '{0}'. Stopping the connection.",protocolIncompatible:"You are using a version of the client that isn't compatible with the server. Client version {0}, server version {1}.",aspnetCoreSignalrServer:"Detected a connection attempt to an ASP.NET Core SignalR Server. This client only supports connecting to an ASP.NET SignalR Server. See https://aka.ms/signalr-core-differences for details.",sendFailed:"Send failed.",parseFailed:"Failed at parsing response: {0}",longPollFailed:"Long polling request failed.",eventSourceFailedToConnect:"EventSource failed to connect.",eventSourceError:"Error raised by EventSource",webSocketClosed:"WebSocket closed.",pingServerFailedInvalidResponse:"Invalid ping response when pinging server: '{0}'.",pingServerFailed:"Failed to ping server.",pingServerFailedStatusCode:"Failed to ping server.  Server responded with status code {0}, stopping the connection.",pingServerFailedParse:"Failed to parse ping server response, stopping the connection.",noConnectionTransport:"Connection is in an invalid state, there is no transport active.",webSocketsInvalidState:"The Web Socket transport is in an invalid state, transitioning into reconnecting.",reconnectTimeout:"Couldn't reconnect within the configured timeout of {0} ms, disconnecting.",reconnectWindowTimeout:"The client has been inactive since {0} and it has exceeded the inactivity timeout of {1} ms. Stopping the connection.",jsonpNotSupportedWithAccessToken:"The JSONP protocol does not support connections that require a Bearer token to connect, such as the Azure SignalR Service."};if(typeof t!="function")throw new Error(a.nojQuery);var s,k,y=m.document.readyState==="complete",u=t(m),c="__Negotiate Aborted__",r={onStart:"onStart",onStarting:"onStarting",onReceived:"onReceived",onError:"onError",onConnectionSlow:"onConnectionSlow",onReconnecting:"onReconnecting",onReconnect:"onReconnect",onStateChanged:"onStateChanged",onDisconnect:"onDisconnect"},l={processData:!0,timeout:null,async:!0,global:!1,cache:!1},_=function(f,g){if(g!==!1){var i;typeof m.console>"u"||(i="["+new Date().toTimeString()+"] SignalR: "+f,m.console.debug?m.console.debug(i):m.console.log&&m.console.log(i))}},S=function(f,g,i){return g===f.state?(f.state=i,t(f).triggerHandler(r.onStateChanged,[{oldState:g,newState:i}]),!0):!1},e=function(f){return f.state===s.connectionState.disconnected},n=function(f){return f._.keepAliveData.activated&&f.transport.supportsKeepAlive(f)},d=function(f){var g,i;f._.configuredStopReconnectingTimeout||(i=function(x){var I=s._.format(s.resources.reconnectTimeout,x.disconnectTimeout);x.log(I),t(x).triggerHandler(r.onError,[s._.error(I,"TimeoutException")]),x.stop(!1,!1)},f.reconnecting(function(){var C=this;C.state===s.connectionState.reconnecting&&(g=m.setTimeout(function(){i(C)},C.disconnectTimeout))}),f.stateChanged(function(C){C.oldState===s.connectionState.reconnecting&&m.clearTimeout(g)}),f._.configuredStopReconnectingTimeout=!0)};s=function(f,g,i){return new s.fn.init(f,g,i)},s._={defaultContentType:"application/x-www-form-urlencoded; charset=UTF-8",ieVersion:(function(){var v,f;return m.navigator.appName==="Microsoft Internet Explorer"&&(f=/MSIE ([0-9]+\.[0-9]+)/.exec(m.navigator.userAgent),f&&(v=m.parseFloat(f[1]))),v})(),error:function(f,g,i){var C=new Error(f);return C.source=g,typeof i<"u"&&(C.context=i),C},transportError:function(f,g,i,C){var x=this.error(f,i,C);return x.transport=g?g.name:E,x},format:function(){for(var f=arguments[0],g=0;g<arguments.length-1;g++)f=f.replace("{"+g+"}",arguments[g+1]);return f},firefoxMajorVersion:function(f){var g=f.match(/Firefox\/(\d+)/);return!g||!g.length||g.length<2?0:parseInt(g[1],10)},configurePingInterval:function(f){var g=f._.config,i=function(x){t(f).triggerHandler(r.onError,[x])};g&&!f._.pingIntervalId&&g.pingInterval&&(f._.pingIntervalId=m.setInterval(function(){s.transports._logic.pingServer(f).fail(i)},g.pingInterval))}},s.events=r,s.resources=a,s.ajaxDefaults=l,s.changeState=S,s.isDisconnecting=e,s.connectionState={connecting:0,connected:1,reconnecting:2,disconnected:4},s.hub={start:function(){throw new Error("SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/js'><\/script>.")}},typeof u.on=="function"?u.on("load",function(){y=!0}):u.load(function(){y=!0});function h(v,f){if(t.isArray(v)){for(var g=v.length-1;g>=0;g--){var i=v[g];(t.type(i)!=="string"||!s.transports[i])&&(f.log("Invalid transport: "+i+", removing it from the transports list."),v.splice(g,1))}v.length===0&&(f.log("No transports remain within the specified transport array."),v=null)}else if(!s.transports[v]&&v!=="auto")f.log("Invalid transport: "+v.toString()+"."),v=null;else if(v==="auto"&&s._.ieVersion<=8)return["longPolling"];return v}function p(v){if(v==="http:")return 80;if(v==="https:")return 443}function T(v,f){return f.match(/:\d+$/)?f:f+":"+p(v)}function R(v,f){var g=this,i=[];g.tryBuffer=function(C){return v.state===t.signalR.connectionState.connecting?(i.push(C),!0):!1},g.drain=function(){if(v.state===t.signalR.connectionState.connected)for(;i.length>0;)f(i.shift())},g.clear=function(){i=[]}}s.fn=s.prototype={init:function(f,g,i){var C=t(this);this.url=f,this.qs=g,this.lastError=null,this._={keepAliveData:{},connectingMessageBuffer:new R(this,function(x){C.triggerHandler(r.onReceived,[x])}),lastMessageAt:new Date().getTime(),lastActiveAt:new Date().getTime(),beatInterval:5e3,beatHandle:null,totalTransportConnectTimeout:0,redirectQs:null},typeof i=="boolean"&&(this.logging=i)},_parseResponse:function(f){var g=this;return f&&(typeof f=="string"?g.json.parse(f):f)},_originalJson:m.JSON,json:m.JSON,isCrossDomain:function(f,g){var i;return f=t.trim(f),g=g||m.location,f.indexOf("http")!==0?!1:(i=m.document.createElement("a"),i.href=f,i.protocol+T(i.protocol,i.host)!==g.protocol+T(g.protocol,g.host))},ajaxDataType:"text",contentType:"application/json; charset=UTF-8",logging:!1,state:s.connectionState.disconnected,clientProtocol:"2.1",supportedProtocols:["1.5","2.0","2.1"],negotiateRedirectSupportedProtocols:["2.0","2.1"],reconnectDelay:2e3,transportConnectTimeout:0,disconnectTimeout:3e4,reconnectWindow:3e4,keepAliveWarnAt:2/3,start:function(f,g){var i=this,C={pingInterval:3e5,waitForPageLoad:!0,transport:"auto",jsonp:!1},x,I=i._deferral||t.Deferred(),w=m.document.createElement("a"),z=function(P,D){P.url===D&&P.baseUrl||(P.url=D,w.href=P.url,!w.protocol||w.protocol===":"?(P.protocol=m.document.location.protocol,P.host=w.host||m.document.location.host):(P.protocol=w.protocol,P.host=w.host),P.baseUrl=P.protocol+"//"+P.host,P.wsProtocol=P.protocol==="https:"?"wss://":"ws://",P.url.indexOf("//")===0&&(P.url=m.location.protocol+P.url,P.log("Protocol relative URL detected, normalizing it to '"+P.url+"'.")),P.isCrossDomain(P.url)&&(P.log("Auto detected cross domain url."),C.transport==="auto"&&(C.transport=["webSockets","serverSentEvents","longPolling"]),typeof P.withCredentials>"u"&&(P.withCredentials=!0),t.support.cors||(P.ajaxDataType="jsonp",P.log("Using jsonp because this browser doesn't support CORS.")),P.contentType=s._.defaultContentType))};if(i.lastError=null,i._deferral=I,!i.json)throw new Error("SignalR: No JSON parser found. Please ensure json2.js is referenced before the SignalR.js file if you need to support clients without native JSON parsing support, e.g. IE<8.");if(t.type(f)==="function"?g=f:t.type(f)==="object"&&(t.extend(C,f),t.type(C.callback)==="function"&&(g=C.callback)),C.transport=h(C.transport,i),!C.transport)throw new Error("SignalR: Invalid transport(s) specified, aborting start.");if(i._.config=C,!y&&C.waitForPageLoad===!0)return i._.deferredStartHandler=function(){i.start(f,g)},u.bind("load",i._.deferredStartHandler),I.promise();if(i.state===s.connectionState.connecting)return I.promise();if(S(i,s.connectionState.disconnected,s.connectionState.connecting)===!1)return I.resolve(i),I.promise();d(i),C.transport==="auto"&&C.jsonp===!0&&(C.transport="longPolling"),i.withCredentials=C.withCredentials,i._originalUrl=i.url,i.ajaxDataType=C.jsonp?"jsonp":"text",z(i,i.url),t(i).bind(r.onStart,function(A,P){t.type(g)==="function"&&g.call(i),I.resolve(i)}),i._.initHandler=s.transports._logic.initHandler(i),x=function(P,D){var F=s._.error(a.noTransportOnInit);if(D=D||0,D>=P.length){D===0?i.log("No transports supported by the server were selected."):D===1?i.log("No fallback transports were selected."):i.log("Fallback transports exhausted."),t(i).triggerHandler(r.onError,[F]),I.reject(F),i.stop();return}if(i.state!==s.connectionState.disconnected){var j=P[D],N=s.transports[j],W=function(){x(P,D+1)};i.transport=N;try{i._.initHandler.start(N,function(){var V=s._.firefoxMajorVersion(m.navigator.userAgent)>=11,Y=!0;i.log("The start request succeeded. Transitioning to the connected state."),n(i)&&s.transports._logic.monitorKeepAlive(i),s.transports._logic.startHeartbeat(i),s._.configurePingInterval(i),S(i,s.connectionState.connecting,s.connectionState.connected)||i.log("WARNING! The connection was not in the connecting state."),i._.connectingMessageBuffer.drain(),t(i).triggerHandler(r.onStart),u.bind("unload",function(){i.log("Window unloading, stopping the connection."),i.stop(Y)}),V&&u.bind("beforeunload",function(){m.setTimeout(function(){i.stop(Y)},0)})},W)}catch(V){i.log(N.name+" transport threw '"+V.message+"' when attempting to start."),W()}}};var q=i.url+"/negotiate",L=function(P,D){var F=s._.error(a.errorOnNegotiate,P,D._.negotiateRequest);t(D).triggerHandler(r.onError,F),I.reject(F),D.stop()};return t(i).triggerHandler(r.onStarting),q=s.transports._logic.prepareQueryString(i,q),i.log("Negotiating with '"+q+"'."),i._.negotiateRequest=(function(){var A,P=0,D=100,F,j,N=[],W=[],V=function(O,G){var U=s.transports._logic.prepareQueryString(O,O.url+"/negotiate");O.log("Negotiating with '"+U+"'.");var Q={url:U,error:function(Se,be){be!==c?L(Se,O):I.reject(s._.error(a.stoppedWhileNegotiating,null,O._.negotiateRequest))},success:G};return O.accessToken&&(Q.headers={Authorization:"Bearer "+O.accessToken}),s.transports._logic.ajax(O,Q)},Y=function le(O){try{A=i._parseResponse(O)}catch(U){L(s._.error(a.errorParsingNegotiateResponse,U),i);return}if(A.availableTransports){j=s._.error(a.aspnetCoreSignalrServer),t(i).triggerHandler(r.onError,[j]),I.reject(j);return}if(!A.ProtocolVersion||i.supportedProtocols.indexOf(A.ProtocolVersion)===-1){j=s._.error(s._.format(a.protocolIncompatible,i.clientProtocol,A.ProtocolVersion)),t(i).triggerHandler(r.onError,[j]),I.reject(j);return}if(i.negotiateRedirectSupportedProtocols.indexOf(A.ProtocolVersion)!==-1){if(A.Error){j=s._.error(s._.format(a.errorFromServer,A.Error)),t(i).triggerHandler(r.onError,[j]),I.reject(j);return}else if(A.RedirectUrl){if(P===D){L(s._.error(a.errorRedirectionExceedsLimit),i);return}C.transport==="auto"&&(C.transport=["webSockets","serverSentEvents","longPolling"]),i.log("Received redirect to: "+A.RedirectUrl),i.accessToken=A.AccessToken;var G=A.RedirectUrl.split("?",2);if(z(i,G[0]),i._.redirectQs=G.length===2?G[1]:null,i.ajaxDataType==="jsonp"&&i.accessToken){L(s._.error(a.jsonpNotSupportedWithAccessToken),i);return}P++,V(i,le);return}}F=i._.keepAliveData,i.appRelativeUrl=A.Url,i.id=A.ConnectionId,i.token=A.ConnectionToken,i.webSocketServerUrl=A.WebSocketServerUrl,i._.pollTimeout=A.ConnectionTimeout*1e3+1e4,i.disconnectTimeout=A.DisconnectTimeout*1e3,i._.totalTransportConnectTimeout=i.transportConnectTimeout+A.TransportConnectTimeout*1e3,A.KeepAliveTimeout?(F.activated=!0,F.timeout=A.KeepAliveTimeout*1e3,F.timeoutWarning=F.timeout*i.keepAliveWarnAt,i._.beatInterval=(F.timeout-F.timeoutWarning)/3):F.activated=!1,i.reconnectWindow=i.disconnectTimeout+(F.timeout||0),t.each(s.transports,function(U){if(U.indexOf("_")===0||U==="webSockets"&&!A.TryWebSockets)return!0;W.push(U)}),t.isArray(C.transport)?t.each(C.transport,function(U,Q){t.inArray(Q,W)>=0&&N.push(Q)}):C.transport==="auto"?N=W:t.inArray(C.transport,W)>=0&&N.push(C.transport),x(N)};return V(i,Y)})(),I.promise()},starting:function(f){var g=this;return t(g).bind(r.onStarting,function(i,C){f.call(g)}),g},send:function(f){var g=this;if(g.state===s.connectionState.disconnected)throw new Error("SignalR: Connection must be started before data can be sent. Call .start() before .send()");if(g.state===s.connectionState.connecting)throw new Error("SignalR: Connection has not been fully initialized. Use .start().done() or .start().fail() to run logic after the connection has started.");return g.transport.send(g,f),g},received:function(f){var g=this;return t(g).bind(r.onReceived,function(i,C){f.call(g,C)}),g},stateChanged:function(f){var g=this;return t(g).bind(r.onStateChanged,function(i,C){f.call(g,C)}),g},error:function(f){var g=this;return t(g).bind(r.onError,function(i,C,x){g.lastError=C,f.call(g,C,x)}),g},disconnected:function(f){var g=this;return t(g).bind(r.onDisconnect,function(i,C){f.call(g)}),g},connectionSlow:function(f){var g=this;return t(g).bind(r.onConnectionSlow,function(i,C){f.call(g)}),g},reconnecting:function(f){var g=this;return t(g).bind(r.onReconnecting,function(i,C){f.call(g)}),g},reconnected:function(f){var g=this;return t(g).bind(r.onReconnect,function(i,C){f.call(g)}),g},stop:function(f,g){var i=this,C=i._deferral;if(i._.deferredStartHandler&&u.unbind("load",i._.deferredStartHandler),delete i._.config,delete i._.deferredStartHandler,!y&&(!i._.config||i._.config.waitForPageLoad===!0)){i.log("Stopping connection prior to negotiate."),C&&C.reject(s._.error(a.stoppedWhileLoading));return}if(i.state!==s.connectionState.disconnected)return i.log("Stopping connection."),m.clearTimeout(i._.beatHandle),m.clearInterval(i._.pingIntervalId),i.transport&&(i.transport.stop(i),g!==!1&&i.transport.abort(i,f),n(i)&&s.transports._logic.stopMonitoringKeepAlive(i),i.transport=null),i._.negotiateRequest&&(i._.negotiateRequest.abort(c),delete i._.negotiateRequest),i._.initHandler&&i._.initHandler.stop(),delete i._deferral,delete i.messageId,delete i.groupsToken,delete i.id,delete i._.pingIntervalId,delete i._.lastMessageAt,delete i._.lastActiveAt,i._.connectingMessageBuffer.clear(),t(i).unbind(r.onStart),delete i.accessToken,delete i.protocol,delete i.host,delete i.baseUrl,delete i.wsProtocol,delete i.contentType,i.url=i._originalUrl,i._.redirectQs=null,S(i,i.state,s.connectionState.disconnected),t(i).triggerHandler(r.onDisconnect),i},log:function(f){_(f,this.logging)}},s.fn.init.prototype=s.fn,s.noConflict=function(){return t.connection===s&&(t.connection=k),s},t.connection&&(k=t.connection),t.connection=t.signalR=s})(o,window),(function(t,m,E){var a=t.signalR,s=t.signalR.events,k=t.signalR.changeState,y="__Start Aborted__",u;a.transports={};function c(S){S._.keepAliveData.monitoring&&r(S),u.markActive(S)&&(S._.beatHandle=m.setTimeout(function(){c(S)},S._.beatInterval))}function r(S){var e=S._.keepAliveData,n;S.state===a.connectionState.connected&&(n=new Date().getTime()-S._.lastMessageAt,n>=e.timeout?(S.log("Keep alive timed out.  Notifying transport that connection has been lost."),S.transport.lostConnection(S)):n>=e.timeoutWarning?e.userNotified||(S.log("Keep alive has been missed, connection may be dead/slow."),t(S).triggerHandler(s.onConnectionSlow),e.userNotified=!0):e.userNotified=!1)}function l(S,e){var n=S.url+e;return S.transport&&(n+="?transport="+S.transport.name),u.prepareQueryString(S,n)}function _(S){this.connection=S,this.startRequested=!1,this.startCompleted=!1,this.connectionStopped=!1}_.prototype={start:function(e,n,d){var h=this,p=h.connection,T=!1;if(h.startRequested||h.connectionStopped){p.log("WARNING! "+e.name+" transport cannot be started. Initialization ongoing or completed.");return}p.log(e.name+" transport starting."),e.start(p,function(){T||h.initReceived(e,n)},function(R){return T||(T=!0,h.transportFailed(e,R,d)),!h.startCompleted||h.connectionStopped}),h.transportTimeoutHandle=m.setTimeout(function(){T||(T=!0,p.log(e.name+" transport timed out when trying to connect."),h.transportFailed(e,E,d))},p._.totalTransportConnectTimeout)},stop:function(){this.connectionStopped=!0,m.clearTimeout(this.transportTimeoutHandle),a.transports._logic.tryAbortStartRequest(this.connection)},initReceived:function(e,n){var d=this,h=d.connection;if(d.startRequested){h.log("WARNING! The client received multiple init messages.");return}d.connectionStopped||(d.startRequested=!0,m.clearTimeout(d.transportTimeoutHandle),h.log(e.name+" transport connected. Initiating start request."),a.transports._logic.ajaxStart(h,function(){d.startCompleted=!0,n()}))},transportFailed:function(e,n,d){var h=this.connection,p=h._deferral,T;this.connectionStopped||(m.clearTimeout(this.transportTimeoutHandle),this.startRequested?this.startCompleted||(T=a._.error(a.resources.errorDuringStartRequest,n),h.log(e.name+" transport failed during the start request. Stopping the connection."),t(h).triggerHandler(s.onError,[T]),p&&p.reject(T),h.stop()):(e.stop(h),h.log(e.name+" transport failed to connect. Attempting to fall back."),d()))}},u=a.transports._logic={ajax:function(e,n){return t.ajax(t.extend(!0,{},t.signalR.ajaxDefaults,{type:"GET",data:{},xhrFields:{withCredentials:e.withCredentials},contentType:e.contentType,dataType:e.ajaxDataType},n))},pingServer:function(e){var n,d,h=t.Deferred();return e.transport?(n=e.url+"/ping",n=u.addQs(n,e.qs),d=u.ajax(e,{url:n,headers:e.accessToken?{Authorization:"Bearer "+e.accessToken}:{},success:function(T){var R;try{R=e._parseResponse(T)}catch(v){h.reject(a._.transportError(a.resources.pingServerFailedParse,e.transport,v,d)),e.stop();return}R.Response==="pong"?h.resolve():h.reject(a._.transportError(a._.format(a.resources.pingServerFailedInvalidResponse,T),e.transport,null,d))},error:function(T){T.status===401||T.status===403?(h.reject(a._.transportError(a._.format(a.resources.pingServerFailedStatusCode,T.status),e.transport,T,d)),e.stop()):h.reject(a._.transportError(a.resources.pingServerFailed,e.transport,T,d))}})):h.reject(a._.transportError(a.resources.noConnectionTransport,e.transport)),h.promise()},prepareQueryString:function(e,n){var d;return d=u.addQs(n,"clientProtocol="+e.clientProtocol),typeof e._.redirectQs=="string"?d=u.addQs(d,e._.redirectQs):d=u.addQs(d,e.qs),e.token&&(d+="&connectionToken="+m.encodeURIComponent(e.token)),e.data&&(d+="&connectionData="+m.encodeURIComponent(e.data)),d},addQs:function(e,n){var d=e.indexOf("?")!==-1?"&":"?",h;if(!n)return e;if((typeof n>"u"?"undefined":b(n))==="object")return e+d+t.param(n);if(typeof n=="string")return h=n.charAt(0),(h==="?"||h==="&")&&(d=""),e+d+n;throw new Error("Query string property must be either a string or object.")},getUrl:function(e,n,d,h,p){var T=n==="webSockets"?"":e.baseUrl,R=T+e.appRelativeUrl,v="transport="+n;return!p&&e.groupsToken&&(v+="&groupsToken="+m.encodeURIComponent(e.groupsToken)),d?(h?R+="/poll":R+="/reconnect",!p&&e.messageId&&(v+="&messageId="+m.encodeURIComponent(e.messageId))):R+="/connect",R+="?"+v,R=u.prepareQueryString(e,R),e.transport&&e.accessToken&&(e.transport.name==="serverSentEvents"||e.transport.name==="webSockets")&&(R+="&access_token="+m.encodeURIComponent(e.accessToken)),p||(R+="&tid="+Math.floor(Math.random()*11)),R},maximizePersistentResponse:function(e){return{MessageId:e.C,Messages:e.M,Initialized:typeof e.S<"u",ShouldReconnect:typeof e.T<"u",LongPollDelay:e.L,GroupsToken:e.G,Error:e.E}},updateGroups:function(e,n){n&&(e.groupsToken=n)},stringifySend:function(e,n){return typeof n=="string"||typeof n>"u"||n===null?n:e.json.stringify(n)},ajaxSend:function(e,n){var d=u.stringifySend(e,n),h=l(e,"/send"),p,T=function(v,f){t(f).triggerHandler(s.onError,[a._.transportError(a.resources.sendFailed,f.transport,v,p),n])};return p=u.ajax(e,{url:h,type:e.ajaxDataType==="jsonp"?"GET":"POST",contentType:a._.defaultContentType,headers:e.accessToken?{Authorization:"Bearer "+e.accessToken}:{},data:{data:d},success:function(v){var f;if(v){try{f=e._parseResponse(v)}catch(g){T(g,e),e.stop();return}u.triggerReceived(e,f)}},error:function(v,f){f==="abort"||f==="parsererror"||T(v,e)}}),p},ajaxAbort:function(e,n){if(!(typeof e.transport>"u")){n=typeof n>"u"?!0:n;var d=l(e,"/abort");u.ajax(e,{url:d,async:n,timeout:1e3,type:"POST",headers:e.accessToken?{Authorization:"Bearer "+e.accessToken}:{},dataType:"text"}),e.log("Fired ajax abort async = "+n+".")}},ajaxStart:function(e,n){var d=function(T){var R=e._deferral;R&&R.reject(T)},h=function(T){e.log("The start request failed. Stopping the connection."),t(e).triggerHandler(s.onError,[T]),d(T),e.stop()};e._.startRequest=u.ajax(e,{url:l(e,"/start"),headers:e.accessToken?{Authorization:"Bearer "+e.accessToken}:{},success:function(T,R,v){var f;try{f=e._parseResponse(T)}catch(g){h(a._.error(a._.format(a.resources.errorParsingStartResponse,T),g,v));return}f.Response==="started"?n():h(a._.error(a._.format(a.resources.invalidStartResponse,T),null,v))},error:function(T,R,v){R!==y?h(a._.error(a.resources.errorDuringStartRequest,v,T)):(e.log("The start request aborted because connection.stop() was called."),d(a._.error(a.resources.stoppedDuringStartRequest,null,T)))}})},tryAbortStartRequest:function(e){e._.startRequest&&(e._.startRequest.abort(y),delete e._.startRequest)},tryInitialize:function(e,n,d){n.Initialized&&d?d():n.Initialized&&e.log("WARNING! The client received an init message after reconnecting.")},triggerReceived:function(e,n){e._.connectingMessageBuffer.tryBuffer(n)||t(e).triggerHandler(s.onReceived,[n])},processMessages:function(e,n,d){var h;if(n&&typeof n.I<"u"){u.triggerReceived(e,n);return}if(u.markLastMessage(e),n){if(h=u.maximizePersistentResponse(n),h.Error){e.log("Received an error message from the server: "+n.E),t(e).triggerHandler(a.events.onError,[a._.error(n.E,"ServerError")]),e.stop(!1,!1);return}u.updateGroups(e,h.GroupsToken),h.MessageId&&(e.messageId=h.MessageId),h.Messages&&(t.each(h.Messages,function(p,T){u.triggerReceived(e,T)}),u.tryInitialize(e,h,d))}},monitorKeepAlive:function(e){var n=e._.keepAliveData;n.monitoring?e.log("Tried to monitor keep alive but it's already being monitored."):(n.monitoring=!0,u.markLastMessage(e),e._.keepAliveData.reconnectKeepAliveUpdate=function(){u.markLastMessage(e)},t(e).bind(s.onReconnect,e._.keepAliveData.reconnectKeepAliveUpdate),e.log("Now monitoring keep alive with a warning timeout of "+n.timeoutWarning+", keep alive timeout of "+n.timeout+" and disconnecting timeout of "+e.disconnectTimeout))},stopMonitoringKeepAlive:function(e){var n=e._.keepAliveData;n.monitoring&&(n.monitoring=!1,t(e).unbind(s.onReconnect,e._.keepAliveData.reconnectKeepAliveUpdate),e._.keepAliveData={},e.log("Stopping the monitoring of the keep alive."))},startHeartbeat:function(e){e._.lastActiveAt=new Date().getTime(),c(e)},markLastMessage:function(e){e._.lastMessageAt=new Date().getTime()},markActive:function(e){return u.verifyLastActive(e)?(e._.lastActiveAt=new Date().getTime(),!0):!1},isConnectedOrReconnecting:function(e){return e.state===a.connectionState.connected||e.state===a.connectionState.reconnecting},ensureReconnectingState:function(e){return k(e,a.connectionState.connected,a.connectionState.reconnecting)===!0&&t(e).triggerHandler(s.onReconnecting),e.state===a.connectionState.reconnecting},clearReconnectTimeout:function(e){e&&e._.reconnectTimeout&&(m.clearTimeout(e._.reconnectTimeout),delete e._.reconnectTimeout)},verifyLastActive:function(e){if(new Date().getTime()-e._.lastActiveAt>=e.reconnectWindow){var n=a._.format(a.resources.reconnectWindowTimeout,new Date(e._.lastActiveAt),e.reconnectWindow);return e.log(n),t(e).triggerHandler(s.onError,[a._.error(n,"TimeoutException")]),e.stop(!1,!1),!1}return!0},reconnect:function(e,n){var d=a.transports[n];if(u.isConnectedOrReconnecting(e)&&!e._.reconnectTimeout){if(!u.verifyLastActive(e))return;e._.reconnectTimeout=m.setTimeout(function(){u.verifyLastActive(e)&&(d.stop(e),u.ensureReconnectingState(e)&&(e.log(n+" reconnecting."),d.start(e)))},e.reconnectDelay)}},handleParseFailure:function(e,n,d,h,p){var T=a._.transportError(a._.format(a.resources.parseFailed,n),e.transport,d,p);h&&h(T)?e.log("Failed to parse server response while attempting to connect."):(t(e).triggerHandler(s.onError,[T]),e.stop())},initHandler:function(e){return new _(e)},foreverFrame:{count:0,connections:{}}}})(o,window),(function(t,m,E){var a=t.signalR,s=t.signalR.events,k=t.signalR.changeState,y=a.transports._logic;a.transports.webSockets={name:"webSockets",supportsKeepAlive:function(){return!0},send:function(c,r){var l=y.stringifySend(c,r);try{c.socket.send(l)}catch(_){t(c).triggerHandler(s.onError,[a._.transportError(a.resources.webSocketsInvalidState,c.transport,_,c.socket),r])}},start:function(c,r,l){var _,S=!1,e=this,n=!r,d=t(c);if(!m.WebSocket){l();return}c.socket||(c.webSocketServerUrl?_=c.webSocketServerUrl:_=c.wsProtocol+c.host,_+=y.getUrl(c,this.name,n),c.log("Connecting to websocket endpoint '"+_+"'."),c.socket=new m.WebSocket(_),c.socket.onopen=function(){S=!0,c.log("Websocket opened."),y.clearReconnectTimeout(c),k(c,a.connectionState.reconnecting,a.connectionState.connected)===!0&&d.triggerHandler(s.onReconnect)},c.socket.onclose=function(h){var p;this===c.socket&&(S&&typeof h.wasClean<"u"&&h.wasClean===!1?(p=a._.transportError(a.resources.webSocketClosed,c.transport,h),c.log("Unclean disconnect from websocket: "+(h.reason||"[no reason given]."))):c.log("Websocket closed."),(!l||!l(p))&&(p&&t(c).triggerHandler(s.onError,[p]),e.reconnect(c)))},c.socket.onmessage=function(h){var p;try{p=c._parseResponse(h.data)}catch(T){y.handleParseFailure(c,h.data,T,l,h);return}p&&y.processMessages(c,p,r)})},reconnect:function(c){y.reconnect(c,this.name)},lostConnection:function(c){this.reconnect(c)},stop:function(c){y.clearReconnectTimeout(c),c.socket&&(c.log("Closing the Websocket."),c.socket.close(),c.socket=null)},abort:function(c,r){y.ajaxAbort(c,r)}}})(o,window),(function(t,m,E){var a=t.signalR,s=t.signalR.events,k=t.signalR.changeState,y=a.transports._logic,u=function(r){m.clearTimeout(r._.reconnectAttemptTimeoutHandle),delete r._.reconnectAttemptTimeoutHandle};a.transports.serverSentEvents={name:"serverSentEvents",supportsKeepAlive:function(){return!0},timeOut:3e3,start:function(r,l,_){var S=this,e=!1,n=t(r),d=!l,h;if(r.eventSource&&(r.log("The connection already has an event source. Stopping it."),r.stop()),!m.EventSource){_&&(r.log("This browser doesn't support SSE."),_());return}h=y.getUrl(r,this.name,d);try{r.log("Attempting to connect to SSE endpoint '"+h+"'."),r.eventSource=new m.EventSource(h,{withCredentials:r.withCredentials})}catch(p){r.log("EventSource failed trying to connect with error "+p.Message+"."),_?_():(n.triggerHandler(s.onError,[a._.transportError(a.resources.eventSourceFailedToConnect,r.transport,p)]),d&&S.reconnect(r));return}d&&(r._.reconnectAttemptTimeoutHandle=m.setTimeout(function(){e===!1&&r.eventSource.readyState!==m.EventSource.OPEN&&S.reconnect(r)},S.timeOut)),r.eventSource.addEventListener("open",function(p){r.log("EventSource connected."),u(r),y.clearReconnectTimeout(r),e===!1&&(e=!0,k(r,a.connectionState.reconnecting,a.connectionState.connected)===!0&&n.triggerHandler(s.onReconnect))},!1),r.eventSource.addEventListener("message",function(p){var T;if(p.data!=="initialized"){try{T=r._parseResponse(p.data)}catch(R){y.handleParseFailure(r,p.data,R,_,p);return}y.processMessages(r,T,l)}},!1),r.eventSource.addEventListener("error",function(p){var T=a._.transportError(a.resources.eventSourceError,r.transport,p);this===r.eventSource&&(_&&_(T)||(r.log("EventSource readyState: "+r.eventSource.readyState+"."),p.eventPhase===m.EventSource.CLOSED?(r.log("EventSource reconnecting due to the server connection ending."),S.reconnect(r)):(r.log("EventSource error."),n.triggerHandler(s.onError,[T]))))},!1)},reconnect:function(r){y.reconnect(r,this.name)},lostConnection:function(r){this.reconnect(r)},send:function(r,l){y.ajaxSend(r,l)},stop:function(r){u(r),y.clearReconnectTimeout(r),r&&r.eventSource&&(r.log("EventSource calling close()."),r.eventSource.close(),r.eventSource=null,delete r.eventSource)},abort:function(r,l){y.ajaxAbort(r,l)}}})(o,window),(function(t,m,E){var a=t.signalR,s=t.signalR.events,k=t.signalR.changeState,y=a.transports._logic,u=function(){var l=m.document.createElement("iframe");return l.setAttribute("style","position:absolute;top:0;left:0;width:0;height:0;visibility:hidden;"),l},c=(function(){var r=null,l=1e3,_=0;return{prevent:function(){a._.ieVersion<=8&&(_===0&&(r=m.setInterval(function(){var e=u();m.document.body.appendChild(e),m.document.body.removeChild(e),e=null},l)),_++)},cancel:function(){_===1&&m.clearInterval(r),_>0&&_--}}})();a.transports.foreverFrame={name:"foreverFrame",supportsKeepAlive:function(){return!0},iframeClearThreshold:50,start:function(l,_,S){if(l.accessToken){S&&(l.log("Forever Frame does not support connections that require a Bearer token to connect, such as the Azure SignalR Service."),S());return}var e=this,n=y.foreverFrame.count+=1,d,h=u(),p=function(){l.log("Forever frame iframe finished loading and is no longer receiving messages."),(!S||!S())&&e.reconnect(l)};if(m.EventSource){S&&(l.log("Forever Frame is not supported by SignalR on browsers with SSE support."),S());return}h.setAttribute("data-signalr-connection-id",l.id),c.prevent(),d=y.getUrl(l,this.name),d+="&frameId="+n,m.document.documentElement.appendChild(h),l.log("Binding to iframe's load event."),h.addEventListener?h.addEventListener("load",p,!1):h.attachEvent&&h.attachEvent("onload",p),h.src=d,y.foreverFrame.connections[n]=l,l.frame=h,l.frameId=n,_&&(l.onSuccess=function(){l.log("Iframe transport started."),_()})},reconnect:function(l){var _=this;y.isConnectedOrReconnecting(l)&&y.verifyLastActive(l)&&m.setTimeout(function(){if(y.verifyLastActive(l)&&l.frame&&y.ensureReconnectingState(l)){var S=l.frame,e=y.getUrl(l,_.name,!0)+"&frameId="+l.frameId;l.log("Updating iframe src to '"+e+"'."),S.src=e}},l.reconnectDelay)},lostConnection:function(l){this.reconnect(l)},send:function(l,_){y.ajaxSend(l,_)},receive:function(l,_){var S,e,n;if(l.json!==l._originalJson&&(_=l._originalJson.stringify(_)),n=l._parseResponse(_),y.processMessages(l,n,l.onSuccess),l.state===t.signalR.connectionState.connected&&(l.frameMessageCount=(l.frameMessageCount||0)+1,l.frameMessageCount>a.transports.foreverFrame.iframeClearThreshold&&(l.frameMessageCount=0,S=l.frame.contentWindow||l.frame.contentDocument,S&&S.document&&S.document.body)))for(e=S.document.body;e.firstChild;)e.removeChild(e.firstChild)},stop:function(l){var _=null;if(c.cancel(),l.frame){if(l.frame.stop)l.frame.stop();else try{_=l.frame.contentWindow||l.frame.contentDocument,_.document&&_.document.execCommand&&_.document.execCommand("Stop")}catch(S){l.log("Error occurred when stopping foreverFrame transport. Message = "+S.message+".")}l.frame.parentNode===m.document.documentElement&&m.document.documentElement.removeChild(l.frame),delete y.foreverFrame.connections[l.frameId],l.frame=null,l.frameId=null,delete l.frame,delete l.frameId,delete l.onSuccess,delete l.frameMessageCount,l.log("Stopping forever frame.")}},abort:function(l,_){y.ajaxAbort(l,_)},getConnection:function(l){return y.foreverFrame.connections[l]},started:function(l){k(l,a.connectionState.reconnecting,a.connectionState.connected)===!0&&t(l).triggerHandler(s.onReconnect)}}})(o,window),(function(t,m,E){var a=t.signalR,s=t.signalR.events,k=t.signalR.changeState,y=t.signalR.isDisconnecting,u=a.transports._logic;a.transports.longPolling={name:"longPolling",supportsKeepAlive:function(){return!1},reconnectDelay:3e3,start:function(r,l,_){var S=this,e=function(){e=t.noop,r.log("LongPolling connected."),l?l():r.log("WARNING! The client received an init message after reconnecting.")},n=function(v){return _(v)?(r.log("LongPolling failed to connect."),!0):!1},d=r._,h=0,p=function(v){m.clearTimeout(d.reconnectTimeoutId),d.reconnectTimeoutId=null,k(v,a.connectionState.reconnecting,a.connectionState.connected)===!0&&(v.log("Raising the reconnect event"),t(v).triggerHandler(s.onReconnect))},T=36e5;r.pollXhr&&(r.log("Polling xhr requests already exists, aborting."),r.stop()),r.messageId=null,d.reconnectTimeoutId=null,d.pollTimeoutId=m.setTimeout(function(){(function R(v,f){var g=v.messageId,i=g===null,C=!i,x=!f,I=u.getUrl(v,S.name,C,x,!0),w={};v.messageId&&(w.messageId=v.messageId),v.groupsToken&&(w.groupsToken=v.groupsToken),y(v)!==!0&&(r.log("Opening long polling request to '"+I+"'."),v.pollXhr=u.ajax(r,{xhrFields:{onprogress:function(){u.markLastMessage(r)}},url:I,type:"POST",contentType:a._.defaultContentType,data:w,timeout:r._.pollTimeout,headers:r.accessToken?{Authorization:"Bearer "+r.accessToken}:{},success:function(q){var L,A=0,P,D;r.log("Long poll complete."),h=0;try{L=r._parseResponse(q)}catch(F){u.handleParseFailure(v,q,F,n,v.pollXhr);return}d.reconnectTimeoutId!==null&&p(v),L&&(P=u.maximizePersistentResponse(L)),u.processMessages(v,L,e),P&&t.type(P.LongPollDelay)==="number"&&(A=P.LongPollDelay),y(v)!==!0&&(D=P&&P.ShouldReconnect,!(D&&!u.ensureReconnectingState(v))&&(A>0?d.pollTimeoutId=m.setTimeout(function(){R(v,D)},A):R(v,D)))},error:function(q,L){var A=a._.transportError(a.resources.longPollFailed,r.transport,q,v.pollXhr);if(m.clearTimeout(d.reconnectTimeoutId),d.reconnectTimeoutId=null,L==="abort"){r.log("Aborted xhr request.");return}if(!n(A)){if(h++,r.state!==a.connectionState.reconnecting&&(r.log("An error occurred using longPolling. Status = "+L+".  Response = "+q.responseText+"."),t(v).triggerHandler(s.onError,[A])),(r.state===a.connectionState.connected||r.state===a.connectionState.reconnecting)&&!u.verifyLastActive(r)||!u.ensureReconnectingState(v))return;d.pollTimeoutId=m.setTimeout(function(){R(v,!0)},S.reconnectDelay)}}}),C&&f===!0&&(d.reconnectTimeoutId=m.setTimeout(function(){p(v)},Math.min(1e3*(Math.pow(2,h)-1),T))))})(r)},250)},lostConnection:function(r){r.pollXhr&&r.pollXhr.abort("lostConnection")},send:function(r,l){u.ajaxSend(r,l)},stop:function(r){m.clearTimeout(r._.pollTimeoutId),m.clearTimeout(r._.reconnectTimeoutId),delete r._.pollTimeoutId,delete r._.reconnectTimeoutId,r.pollXhr&&(r.pollXhr.abort(),r.pollXhr=null,delete r.pollXhr)},abort:function(r,l){u.ajaxAbort(r,l)}}})(o,window),(function(t,m,E){var a=0,s=".hubProxy",k=t.signalR;function y(n){return n+s}function u(n,d,h){var p,T=n.length,R=[];for(p=0;p<T;p+=1)n.hasOwnProperty(p)&&(R[p]=d.call(h,n[p],p,n));return R}function c(n){return t.isFunction(n)||t.type(n)==="undefined"?null:n}function r(n){for(var d in n)if(n.hasOwnProperty(d))return!0;return!1}function l(n,d){var h=n._.invocationCallbacks,p;r(h)&&n.log("Clearing hub invocation callbacks with error: "+d+"."),n._.invocationCallbackId=0,delete n._.invocationCallbacks,n._.invocationCallbacks={};for(var T in h)p=h[T],p.method.call(p.scope,{E:d})}function _(n){return t.isFunction(n)&&n.toString().slice(0,256).indexOf("// Call the client hub method")>=0}function S(n,d){return new S.fn.init(n,d)}S.fn=S.prototype={init:function(d,h){this.state={},this.connection=d,this.hubName=h,this._={callbackMap:{}}},constructor:S,hasSubscriptions:function(){return r(this._.callbackMap)},on:function(d,h,p){var T=this,R=T._.callbackMap,v=!p&&_(h);p=p||h,p._signalRGuid||(p._signalRGuid=a++),d=d.toLowerCase();var f=R[d];f||(f=[],R[d]=f);for(var g,i=0;i<f.length;i++)(f[i].guid===p._signalRGuid||v&&f[i].isFromOldGeneratedHubProxy)&&(g=f[i]);g||(g={guid:p._signalRGuid,eventHandlers:[],isFromOldGeneratedHubProxy:v},R[d].push(g));var C=function(I,w){h.apply(T,w)};return g.eventHandlers.push(C),t(T).bind(y(d),C),T},off:function(d,h,p){var T=this,R=T._.callbackMap,v,f=!p&&_(h);if(p=p||h,d=d.toLowerCase(),v=R[d],v)if(h){for(var g,i=0;i<v.length;i++)(v[i].guid===p._signalRGuid||f&&v[i].isFromOldGeneratedHubProxy)&&(g=v[i]);if(g){for(var C=0;C<g.eventHandlers.length;C++)t(T).unbind(y(d),g.eventHandlers[C]);v.splice(i,1),v.length===0&&delete R[d]}}else h||(t(T).unbind(y(d)),delete R[d]);return T},invoke:function(d){var h=this,p=h.connection,T=t.makeArray(arguments).slice(1),R=u(T,c),v={H:h.hubName,M:d,A:R,I:p._.invocationCallbackId},f=t.Deferred(),g=function(C){var x=h._maximizeHubResponse(C),I,w;t.extend(h.state,x.State),x.Progress?f.notifyWith?f.notifyWith(h,[x.Progress.Data]):p._.progressjQueryVersionLogged||(p.log("A hub method invocation progress update was received but the version of jQuery in use ("+t.prototype.jquery+") does not support progress updates. Upgrade to jQuery 1.7+ to receive progress notifications."),p._.progressjQueryVersionLogged=!0):x.Error?(x.StackTrace&&p.log(x.Error+`
`+x.StackTrace+"."),I=x.IsHubException?"HubException":"Exception",w=k._.error(x.Error,I),w.data=x.ErrorData,p.log(h.hubName+"."+d+" failed to execute. Error: "+w.message),f.rejectWith(h,[w])):(p.log("Invoked "+h.hubName+"."+d),f.resolveWith(h,[x.Result]))};return p._.invocationCallbacks[p._.invocationCallbackId.toString()]={scope:h,method:g},p._.invocationCallbackId+=1,t.isEmptyObject(h.state)||(v.S=h.state),p.log("Invoking "+h.hubName+"."+d),p.send(v),f.promise()},_maximizeHubResponse:function(d){return{State:d.S,Result:d.R,Progress:d.P?{Id:d.P.I,Data:d.P.D}:null,Id:d.I,IsHubException:d.H,Error:d.E,StackTrace:d.T,ErrorData:d.D}}},S.fn.init.prototype=S.fn;function e(n,d){var h={qs:null,logging:!1,useDefaultPath:!0};return t.extend(h,d),(!n||h.useDefaultPath)&&(n=(n||"")+"/signalr"),new e.fn.init(n,h)}e.fn=e.prototype=t.connection(),e.fn.init=function(n,d){var h={qs:null,logging:!1,useDefaultPath:!0},p=this;t.extend(h,d),t.signalR.fn.init.call(p,n,h.qs,h.logging),p.proxies={},p._.invocationCallbackId=0,p._.invocationCallbacks={},p.received(function(T){var R,v,f,g,i,C;T&&(typeof T.P<"u"?(f=T.P.I.toString(),g=p._.invocationCallbacks[f],g&&g.method.call(g.scope,T)):typeof T.I<"u"?(f=T.I.toString(),g=p._.invocationCallbacks[f],g&&(p._.invocationCallbacks[f]=null,delete p._.invocationCallbacks[f],g.method.call(g.scope,T))):(R=this._maximizeClientHubInvocation(T),p.log("Triggering client hub event '"+R.Method+"' on hub '"+R.Hub+"'."),i=R.Hub.toLowerCase(),C=R.Method.toLowerCase(),v=this.proxies[i],t.extend(v.state,R.State),t(v).triggerHandler(y(C),[R.Args])))}),p.error(function(T,R){var v,f;R&&(v=R.I,f=p._.invocationCallbacks[v],f&&(p._.invocationCallbacks[v]=null,delete p._.invocationCallbacks[v],f.method.call(f.scope,{E:T})))}),p.reconnecting(function(){p.transport&&p.transport.name==="webSockets"&&l(p,"Connection started reconnecting before invocation result was received.")}),p.disconnected(function(){l(p,"Connection was disconnected before invocation result was received.")})},e.fn._maximizeClientHubInvocation=function(n){return{Hub:n.H,Method:n.M,Args:n.A,State:n.S}},e.fn._registerSubscribedHubs=function(){var n=this;n._subscribedToHubs||(n._subscribedToHubs=!0,n.starting(function(){var d=[];t.each(n.proxies,function(h){this.hasSubscriptions()&&(d.push({name:h}),n.log("Client subscribed to hub '"+h+"'."))}),d.length===0&&n.log("No hubs have been subscribed to.  The client will not receive data from hubs.  To fix, declare at least one client side function prior to connection start for each hub you wish to subscribe to."),n.data=n.json.stringify(d)}))},e.fn.createHubProxy=function(n){n=n.toLowerCase();var d=this.proxies[n];return d||(d=S(this,n),this.proxies[n]=d),this._registerSubscribedHubs(),d},e.fn.init.prototype=e.fn,t.hubConnection=e})(o),(function(t,m){t.signalR.version="2.4.1"})(o),B.hubConnection=o.hubConnection,B.signalR=o.signalR,B}var Ae=Pe(),se=(b=>(b.AppleTv="apple-tv",b.Vivi="vivi",b))(se||{}),Z=(b=>(b.Available="available",b.Offline="offline",b.Busy="busy",b))(Z||{});const xe=class ae{constructor(o,t){this[Symbol.toStringTag]=o[Symbol.toStringTag],this.innerPromise=o,this.onTimeout=t,this.bindFunctions()}bindFunctions(){this.timeout=this.timeout.bind(this),this.then=this.then.bind(this),this.catch=this.catch.bind(this),this.finally=this.finally.bind(this)}timeout(o){return new Promise((t,m)=>{this.then(t).catch(m).finally(()=>clearTimeout(E));const E=setTimeout(()=>{var a;(a=this.onTimeout)==null||a.call(this),m(new Error("Promise timed out"))},o)})}then(o,t){return this.innerPromise.then(o,t)}catch(o){return this.innerPromise.catch(o)}finally(o){return this.innerPromise.finally(o)}static reject(o){return new ae(Promise.reject(o))}static fromPromise(o){return new ae(o)}};let oe=xe;class Ie{constructor(){this.callbacks=[],this.predicates=[],this.controller=new AbortController,this.signal=this.controller.signal,this.trigger=this.trigger.bind(this),this.on=this.on.bind(this),this.one=this.one.bind(this),this.off=this.off.bind(this),this.dispose=this.dispose.bind(this),this.isDisposed=this.isDisposed.bind(this)}trigger(o){this.callbacks.forEach((t,m)=>{const E=this.predicates[m];E&&!E(o)||t(o)})}on(o){this.isDisposed()&&console.warn("This EventChannel instance been disposed - this is a no-op");const t=this.callbacks.length;this.callbacks[t]=o,this.predicates[t]=()=>!0;const m=()=>{this.off(o)};return{off:m,filter:a=>(this.predicates[t]=a,m)}}one(o=()=>!0){if(this.isDisposed())return oe.reject(new Error("This EventChannel instance has been disposed"));let t;return new oe(new Promise((m,E)=>{t=this.on(s=>{this.signal.removeEventListener("abort",a),t(),m(s)}).filter(o);const a=()=>{t(),E(new Error("Aborted while waiting for message"))};this.signal.addEventListener("abort",a,{once:!0})}),()=>{t()})}off(o){const t=this.callbacks.indexOf(o);t!==-1&&(this.callbacks.splice(t,1),this.predicates.splice(t,1))}dispose(){this.callbacks.length=0,this.predicates.length=0,this.controller.abort()}isDisposed(){return this.signal.aborted}}class me{constructor(){this.channels={},this.trigger=this.trigger.bind(this),this.on=this.on.bind(this),this.one=this.one.bind(this),this.off=this.off.bind(this),this.dispose=this.dispose.bind(this),this.getChannel=this.getChannel.bind(this)}trigger(o,t){this.getChannel(o).trigger(t)}on(o,t){return this.getChannel(o).on(t)}one(o,t){return this.getChannel(o).one(t)}off(o,t){this.getChannel(o).off(t)}dispose(){this.trigger("dispose",M.void),Object.values(this.channels).forEach(o=>o.dispose()),this.channels={}}getChannel(o){return this.channels[o]||(this.channels[o]=new Ie),this.channels[o]}}const M={void:void 0};class De{constructor(){this.bindFunctions()}bindFunctions(){this.schedule=this.schedule.bind(this),this.every=this.every.bind(this),this.trigger=this.trigger.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this)}schedule(o){return this.task=o,this}every(o){return this.intervalInMilliseconds=o,this}trigger(){var o;return(o=this.task)==null||o.call(this,this),this}start(){return this.intervalId||(this.intervalId=setInterval(()=>this.trigger(),this.intervalInMilliseconds)),this}stop(){return this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this}}function we(b,o){return b._lastModified||(b._lastModified={}),new Proxy(b,{set:(t,m,E,a)=>{const s=b._lastModified[m.toString()];return s&&Date.now()<s+o?!0:Reflect.set(t,m,E,a)}})}function Fe(b){return b._lastModified||(b._lastModified={}),new Proxy(b,{set:(o,t,m,E)=>(b._lastModified[t.toString()]=Date.now(),Reflect.set(o,t,m,E))})}const ve={withDebouncedSetters:we,withTimestampedSetters:Fe};var K=(b=>(b[b.Offline=0]="Offline",b[b.Online=1]="Online",b[b.Locked=2]="Locked",b[b.Suspended=3]="Suspended",b))(K||{}),X=(b=>(b[b.PlaybackStatusChange=0]="PlaybackStatusChange",b[b.PositionChange=1]="PositionChange",b))(X||{}),H=(b=>(b.Begin="BEGIN",b.Play="PLAY",b.Pause="PAUSE",b.Load="LOAD",b.Scan="SCAN",b.Stop="STOP",b))(H||{});const He=2e3;class Le{constructor(o,t){return this.title=o,this.device=t,this.locked=!1,this.position=0,this.playbackStatus=H.Load,this.debounced=ve.withDebouncedSetters(this,He),ve.withTimestampedSetters(this)}}class je extends me{constructor(o,t){super(),this.client=o,this.localState=new Le(t.title,t.device),this.bindFunctions(),this.initialize()}bindFunctions(){this.initialize=this.initialize.bind(this),this.dispose=this.dispose.bind(this),this.handleDisconnected=this.handleDisconnected.bind(this),this.handleAllVideoMessages=this.handleAllVideoMessages.bind(this),this.handlePlaybackChange=this.handlePlaybackChange.bind(this),this.handlePositionChange=this.handlePositionChange.bind(this),this.loadSource=this.loadSource.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.isPlaying=this.isPlaying.bind(this),this.getPosition=this.getPosition.bind(this),this.getDuration=this.getDuration.bind(this),this.getVolume=this.getVolume.bind(this)}initialize(){this.client.on("dispose",this.dispose),this.client.on("disconnected",this.handleDisconnected),this.client.on("message",this.handleAllVideoMessages)}dispose(){this.client.off("dispose",this.dispose),this.client.off("disconnected",this.handleDisconnected),this.client.off("message",this.handleAllVideoMessages),this.client.stop(this.getDevice().id).catch(o=>console.error(o)),super.dispose()}handleDisconnected(){this.trigger("error",new Error("The connection to the Apple TV has been lost and cannot be recovered"))}handleAllVideoMessages(o){if(o.deviceId!==this.getDevice().id)return;const t=this.localState.debounced;switch(o.event){case X.PlaybackStatusChange:this.handlePlaybackChange(t,o);break;case X.PositionChange:this.handlePositionChange(t,o);break}}handlePlaybackChange(o,t){o.playbackStatus!==t.params.playbackStatus&&(o.playbackStatus=t.params.playbackStatus,this.trigger("playingchange",M.void),o.playbackStatus===H.Stop&&this.dispose())}handlePositionChange(o,t){o.position!==t.params.position&&(o.position=t.params.position,this.trigger("positionchange",M.void))}async loadSource(){try{if(this.localState.locked)return;await this.client.lock(this.getDevice().id),this.localState.locked=!0,await this.client.loadVideo(this.getDevice().id),this.trigger("sourceloaded",M.void)}catch(o){console.error(o),this.trigger("error",new Error("Could not load video on Apple TV device"))}}play(){this.localState.locked&&this.localState.playbackStatus!==H.Play&&(this.localState.playbackStatus=H.Play,this.client.play(this.getDevice().id),this.trigger("playingchange",M.void))}pause(){this.localState.locked&&this.localState.playbackStatus!==H.Pause&&(this.localState.playbackStatus=H.Pause,this.client.pause(this.getDevice().id),this.trigger("playingchange",M.void))}seek(o){this.localState.locked&&this.localState.position!==o&&(this.localState.position=o,this.client.seek(this.getDevice().id,o),this.trigger("positionchange",M.void))}setVolume(){console.info("Setting the volume is not supported on Apple TV")}setMuted(){console.info("Muting is not supported on Apple TV")}setSubtitles(){console.info("Subtitles are not supported on Apple TV")}isPlaying(){return this.localState.playbackStatus===H.Play||this.localState.playbackStatus===H.Begin||this.localState.playbackStatus===H.Load}isPlaybackFinished(){return this.localState.playbackStatus===H.Stop}getPosition(){return this.localState.position}getDuration(){}getVolume(){return 1}getMuted(){return!1}getSubtitles(){}getDevice(){return this.localState.device}getTitle(){return this.localState.title}}const Me=2e4,Oe=500,qe="DeviceUserHub",Ue=5e3;class J extends me{constructor(o){super(),this.options=o,this.accessToken=void 0,this.devices=[],this.heartbeat=new De,this.bindFunctions(),this.initialize()}bindFunctions(){this.initialize=this.initialize.bind(this),this.connect=this.connect.bind(this),this.subscribe=this.subscribe.bind(this),this.tryFixConnection=this.tryFixConnection.bind(this),this.invoke=this.invoke.bind(this),this.invokeDebounced=ye(this.invoke,Oe,!0),this.handleDeviceList=this.handleDeviceList.bind(this),this.handleDeviceStateChange=this.handleDeviceStateChange.bind(this),this.handleDevicePaired=this.handleDevicePaired.bind(this),this.handleDeviceUnpaired=this.handleDeviceUnpaired.bind(this),this.handlePlayStatusChange=this.handlePlayStatusChange.bind(this),this.handleTimeSync=this.handleTimeSync.bind(this),this.dispose=this.dispose.bind(this),this.canCastToDevice=this.canCastToDevice.bind(this),this.getDevices=this.getDevices.bind(this),this.startCastSession=this.startCastSession.bind(this),this.lock=this.lock.bind(this),this.loadVideo=this.loadVideo.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.stop=this.stop.bind(this),this.pair=this.pair.bind(this),this.unpair=this.unpair.bind(this),this.renameDevice=this.renameDevice.bind(this)}async initialize(){try{this.accessToken=await this.options.fetchAccessToken(),this.connection=Ae.hubConnection(this.accessToken.host,{logging:!1}),this.hubProxy=this.connection.createHubProxy(qe),this.hubProxy.on("DeviceList",this.handleDeviceList),this.hubProxy.on("DeviceStateChange",this.handleDeviceStateChange),this.hubProxy.on("Paired",this.handleDevicePaired),this.hubProxy.on("Unpaired",this.handleDeviceUnpaired),this.hubProxy.on("PlayStatusChange",this.handlePlayStatusChange),this.hubProxy.on("TimeSync",this.handleTimeSync),await this.connect(),await this.subscribe(this.accessToken.token),this.heartbeat.schedule(this.tryFixConnection).every(Ue).start()}catch(o){console.error(o),this.trigger("error",new Error("Could not connect to Online API"))}}async connect(){return new Promise((o,t)=>{this.connection.start({jsonp:!1,withCredentials:!1}).done(()=>o()).fail(()=>t(new Error("Could not connect to SignalR hub")))})}async subscribe(o){if(!await this.invoke("Subscribe",o))throw new Error("The subscription request was rejected by Online API")}async tryFixConnection(){if(this.connection.state===4)try{this.heartbeat.stop(),this.accessToken=await this.options.fetchAccessToken(),await this.connect(),await this.subscribe(this.accessToken.token)}catch(o){console.warn(o),console.warn("Could not reconnect to Online API")}finally{this.heartbeat.start()}}async invoke(o,...t){const m=new Promise((E,a)=>{var s;((s=this.hubProxy)==null?void 0:s.invoke(o,...t)).done(E).fail(a)});return oe.fromPromise(m).timeout(Me)}handleDeviceList(o){this.devices=o.filter(t=>t.type!=="vivi").map(J.convertToGenericDevice),this.trigger("deviceschange",M.void)}handleDeviceStateChange(o){const t=this.devices.findIndex(m=>m.id===o.deviceId);t>=0&&(this.devices[t]=J.convertToGenericDevice(o),this.trigger("deviceschange",M.void))}handleDevicePaired(o){o.type!=="vivi"&&(this.devices.push(J.convertToGenericDevice(o)),this.trigger("deviceschange",M.void))}handleDeviceUnpaired(o){this.devices=this.devices.filter(t=>t.id!==o),this.trigger("deviceschange",M.void)}handlePlayStatusChange(o,t){this.trigger("message",{event:X.PlaybackStatusChange,deviceId:o,params:{playbackStatus:t.commandType}})}handleTimeSync(o,t){this.trigger("message",{event:X.PositionChange,deviceId:o,params:{position:t}})}dispose(){this.hubProxy.off("DeviceList",this.handleDeviceList),this.hubProxy.off("DeviceStateChange",this.handleDeviceStateChange),this.hubProxy.off("Paired",this.handleDevicePaired),this.hubProxy.off("Unpaired",this.handleDeviceUnpaired),this.hubProxy.off("PlayStatusChange",this.handlePlayStatusChange),this.hubProxy.off("TimeSync",this.handleTimeSync),this.hubProxy.connection.stop(!1,!0),this.heartbeat.stop(),super.dispose()}canCastToDevice(o){return o===se.AppleTv}getDevices(){return this.devices}startCastSession(o){return new je(this,o)}async lock(o){if(!await this.invoke("Lock",o,this.options.userId,this.options.username??""))throw new Error("Could not lock device")}async loadVideo(o){if(!this.options.trackingCode)throw new Error("Tracking code must be provided to cast videos");await this.invoke("Command",{DeviceId:o,CommandType:H.Play,Data:this.options.trackingCode})}async play(o){await this.invoke("Command",{DeviceId:o,CommandType:H.Play})}async pause(o){await this.invoke("Command",{DeviceId:o,CommandType:H.Pause})}seek(o,t){this.invokeDebounced("Command",{DeviceId:o,CommandType:H.Play,Params:`1,${Math.trunc(t)}`})}async stop(o){await this.invoke("Command",{DeviceId:o,CommandType:H.Stop})}async pair(o){const t=await this.invoke("Pair",o);if(!t)throw new Error("Could not pair device");return t}async unpair(o){await this.invoke("Unpair",o)}async renameDevice({deviceId:o,deviceName:t}){if(!await this.invoke("Renamedevice",o,t))throw new Error("Could not rename device")}static convertToGenericDeviceStatus(o){switch(o){case K.Online:return Z.Available;case K.Locked:return Z.Busy;case K.Suspended:case K.Offline:return Z.Offline}}static convertToGenericDevice(o){return{id:o.deviceId,name:o.name,type:se.AppleTv,status:J.convertToGenericDeviceStatus(o.status)}}}export{J as A,Z as D,me as E,ve as P,De as S,M as a,se as b};
//# sourceMappingURL=C1lKaTCw.chunk.js.map
