Added signalr client for MVC Added signalr hub Added signalr events when order status changes
13 lines
44 KiB
JavaScript
13 lines
44 KiB
JavaScript
/* @license
|
|
* 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.
|
|
*/
|
|
(function(n,t){typeof exports=="object"&&typeof module!="undefined"?module.exports=t():typeof define=="function"&&define.amd?define(t):n.signalR=t()})(this,function(){"use strict";function w(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs");}function f(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n["default"]:n}function u(n,t){return t={exports:{}},n(t,t.exports),t.exports}var i=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},ut=u(function(n){
|
|
/*!
|
|
* @overview es6-promise - a tiny implementation of Promises/A+.
|
|
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
|
* @license Licensed under MIT license
|
|
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
|
|
* @version v4.2.2+97478eb6
|
|
*/
|
|
(function(t,i){n.exports=i()})(i,function(){function bt(n){var t=typeof n;return n!==null&&(t==="object"||t==="function")}function ft(n){return typeof n=="function"}function kt(n){k=n}function dt(n){u=n}function ti(){return function(){return process.nextTick(o)}}function ii(){return typeof b!="undefined"?function(){b(o)}:d()}function ri(){var n=0,i=new ct(o),t=document.createTextNode("");return i.observe(t,{characterData:!0}),function(){t.data=n=++n%2}}function ui(){var n=new MessageChannel;return n.port1.onmessage=o,function(){return n.port2.postMessage(0)}}function d(){var n=setTimeout;return function(){return n(o,1)}}function o(){for(var t,i,n=0;n<e;n+=2)t=f[n],i=f[n+1],t(i),f[n]=undefined,f[n+1]=undefined;e=0}function fi(){try{var t=w,n=t("vertx");return b=n.runOnLoop||n.runOnContext,ii()}catch(i){return d()}}function nt(n,t){var f=this,i=new this.constructor(s),r,e;return i[l]===undefined&&pt(i),r=f._state,r?(e=arguments[r-1],u(function(){return yt(r,i,e,f._result)})):it(f,i,n,t),i}function tt(n){var i=this,t;return n&&typeof n=="object"&&n.constructor===i?n:(t=new i(s),y(t,n),t)}function s(){}function ei(){return new TypeError("You cannot resolve a promise with itself")}function oi(){return new TypeError("A promises callback cannot return that same promise.")}function lt(n){try{return n.then}catch(t){return v.error=t,v}}function si(n,t,i,r){try{n.call(t,i,r)}catch(u){return u}}function hi(n,i,f){u(function(n){var u=!1,e=si(f,i,function(t){u||(u=!0,i!==t?y(n,t):r(n,t))},function(i){u||(u=!0,t(n,i))},"Settle: "+(n._label||" unknown promise"));!u&&e&&(u=!0,t(n,e))},n)}function ci(n,i){i._state===a?r(n,i._result):i._state===c?t(n,i._result):it(i,undefined,function(t){return y(n,t)},function(i){return t(n,i)})}function at(n,i,u){i.constructor===n.constructor&&u===nt&&i.constructor.resolve===tt?ci(n,i):u===v?(t(n,v.error),v.error=null):u===undefined?r(n,i):ft(u)?hi(n,i,u):r(n,i)}function y(n,i){n===i?t(n,ei()):bt(i)?at(n,i,lt(i)):r(n,i)}function li(n){n._onerror&&n._onerror(n._result);rt(n)}function r(n,t){n._state===h&&(n._result=t,n._state=a,n._subscribers.length!==0&&u(rt,n))}function t(n,t){n._state===h&&(n._state=c,n._result=t,u(li,n))}function it(n,t,i,r){var f=n._subscribers,e=f.length;n._onerror=null;f[e]=t;f[e+a]=i;f[e+c]=r;e===0&&n._state&&u(rt,n)}function rt(n){var i=n._subscribers,f=n._state,t;if(i.length!==0){var r=void 0,u=void 0,e=n._result;for(t=0;t<i.length;t+=3)r=i[t],u=i[t+f],r?yt(f,r,u,e):u(e);n._subscribers.length=0}}function vt(){this.error=null}function ai(n,t){try{return n(t)}catch(i){return p.error=i,p}}function yt(n,i,u,f){var s=ft(u),e=void 0,l=void 0,o=void 0,v=void 0;if(s){if(e=ai(u,f),e===p?(v=!0,l=e.error,e.error=null):o=!0,i===e){t(i,oi());return}}else e=f,o=!0;i._state!==h||(s&&o?y(i,e):v?t(i,l):n===a?r(i,e):n===c&&t(i,e))}function vi(n,i){try{i(function(t){y(n,t)},function(i){t(n,i)})}catch(r){t(n,r)}}function yi(){return ut++}function pt(n){n[l]=ut++;n._state=undefined;n._result=undefined;n._subscribers=[]}function pi(){return new Error("Array Methods must be provided an Array")}function pi(){return new Error("Array Methods must be provided an Array")}function wi(n){return new wt(this,n).promise}function bi(n){var t=this;return ot(n)?new t(function(i,r){for(var f=n.length,u=0;u<f;u++)t.resolve(n[u]).then(i,r)}):new t(function(n,t){return t(new TypeError("You must pass an array to race."))})}function ki(n){var r=this,i=new r(s);return t(i,n),i}function di(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");}function gi(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");}function nr(){var t=void 0,r,u;if(typeof i!="undefined")t=i;else if(typeof self!="undefined")t=self;else try{t=Function("return this")()}catch(f){throw new Error("polyfill failed because global object is unavailable in this environment");}if(r=t.Promise,r){u=null;try{u=Object.prototype.toString.call(r.resolve())}catch(f){}if(u==="[object Promise]"&&!r.cast)return}t.Promise=n}var et=void 0,f,g,l,p,ut,wt,n;et=Array.isArray?Array.isArray:function(n){return Object.prototype.toString.call(n)==="[object Array]"};var ot=et,e=0,b=void 0,k=void 0,u=function(n,t){f[e]=n;f[e+1]=t;e+=2;e===2&&(k?k(o):g())};var st=typeof window!="undefined"?window:undefined,ht=st||{},ct=ht.MutationObserver||ht.WebKitMutationObserver,gt=typeof self=="undefined"&&typeof process!="undefined"&&{}.toString.call(process)==="[object process]",ni=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";f=new Array(1e3);g=void 0;g=gt?ti():ct?ri():ni?ui():st===undefined&&typeof w=="function"?fi():d();l=Math.random().toString(36).substring(16);var h=void 0,a=1,c=2,v=new vt;return p=new vt,ut=0,wt=function(){function i(n,i){this._instanceConstructor=n;this.promise=new n(s);this.promise[l]||pt(this.promise);ot(i)?(this.length=i.length,this._remaining=i.length,this._result=new Array(this.length),this.length===0?r(this.promise,this._result):(this.length=this.length||0,this._enumerate(i),this._remaining===0&&r(this.promise,this._result))):t(this.promise,pi())}return i.prototype._enumerate=function(n){for(var t=0;this._state===h&&t<n.length;t++)this._eachEntry(n[t],t)},i.prototype._eachEntry=function(t,i){var r=this._instanceConstructor,e=r.resolve,u,f;e===tt?(u=lt(t),u===nt&&t._state!==h?this._settledAt(t._state,i,t._result):typeof u!="function"?(this._remaining--,this._result[i]=t):r===n?(f=new r(s),at(f,t,u),this._willSettleAt(f,i)):this._willSettleAt(new r(function(n){return n(t)}),i)):this._willSettleAt(e(t),i)},i.prototype._settledAt=function(n,i,u){var f=this.promise;f._state===h&&(this._remaining--,n===c?t(f,u):this._result[i]=u);this._remaining===0&&r(f,this._result)},i.prototype._willSettleAt=function(n,t){var i=this;it(n,undefined,function(n){return i._settledAt(a,t,n)},function(n){return i._settledAt(c,t,n)})},i}(),n=function(){function n(t){this[l]=yi();this._result=this._state=undefined;this._subscribers=[];s!==t&&(typeof t!="function"&&di(),this instanceof n?vi(this,t):gi())}return n.prototype.catch=function(n){return this.then(null,n)},n.prototype.finally=function(n){var t=this,i=t.constructor;return t.then(function(t){return i.resolve(n()).then(function(){return t})},function(t){return i.resolve(n()).then(function(){throw t;})})},n}(),n.prototype.then=nt,n.all=wi,n.race=bi,n.resolve=tt,n.reject=ki,n._setScheduler=kt,n._setAsap=dt,n._asap=u,n.polyfill=nr,n.Promise=n,n.polyfill(),n})}),e=u(function(n,t){var r=i&&i.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),u,f;Object.defineProperty(t,"__esModule",{value:!0});u=function(n){function t(t,i){var u=this.constructor,r=this,f=u.prototype;return r=n.call(this,t)||this,r.statusCode=i,r.__proto__=f,r}return r(t,n),t}(Error);t.HttpError=u;f=function(n){function t(t){var u=this.constructor,i,r;return t===void 0&&(t="A timeout occurred."),i=this,r=u.prototype,i=n.call(this,t)||this,i.__proto__=r,i}return r(t,n),t}(Error);t.TimeoutError=f}),g,h,nt,r,tt,t,it,o,rt,c,p,k,d;f(e);var ft=e.HttpError,et=e.TimeoutError,n=u(function(n,t){Object.defineProperty(t,"__esModule",{value:!0});var i;(function(n){n[n.Trace=0]="Trace";n[n.Information=1]="Information";n[n.Warning=2]="Warning";n[n.Error=3]="Error";n[n.None=4]="None"})(i=t.LogLevel||(t.LogLevel={}))});f(n);g=n.LogLevel;h=u(function(t,r){var h=i&&i.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),o=i&&i.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},u,f,s;Object.defineProperty(r,"__esModule",{value:!0});u=function(){function n(n,t,i){this.statusCode=n;this.statusText=t;this.content=i}return n}();r.HttpResponse=u;f=function(){function n(){}return n.prototype.get=function(n,t){return this.send(o({},t,{method:"GET",url:n}))},n.prototype.post=function(n,t){return this.send(o({},t,{method:"POST",url:n}))},n}();r.HttpClient=f;s=function(t){function i(n){var i=t.call(this)||this;return i.logger=n,i}return h(i,t),i.prototype.send=function(t){var i=this;return new Promise(function(r,f){var o=new XMLHttpRequest;o.open(t.method,t.url,!0);o.withCredentials=!0;o.setRequestHeader("X-Requested-With","XMLHttpRequest");t.headers&&Object.keys(t.headers).forEach(function(n){return o.setRequestHeader(n,t.headers[n])});t.responseType&&(o.responseType=t.responseType);t.abortSignal&&(t.abortSignal.onabort=function(){o.abort()});t.timeout&&(o.timeout=t.timeout);o.onload=function(){t.abortSignal&&(t.abortSignal.onabort=null);o.status>=200&&o.status<300?r(new u(o.status,o.statusText,o.response||o.responseText)):f(new e.HttpError(o.statusText,o.status))};o.onerror=function(){i.logger.log(n.LogLevel.Warning,"Error from HTTP request. "+o.status+": "+o.statusText);f(new e.HttpError(o.statusText,o.status))};o.ontimeout=function(){i.logger.log(n.LogLevel.Warning,"Timeout from HTTP request.");f(new e.TimeoutError)};o.send(t.content||"")})},i}(f);r.DefaultHttpClient=s});f(h);var ot=h.HttpResponse,st=h.HttpClient,ht=h.DefaultHttpClient,s=u(function(t,i){var u,r,f;Object.defineProperty(i,"__esModule",{value:!0});u=function(){function n(){}return n.prototype.log=function(){},n}();i.NullLogger=u;r=function(){function t(n){this.minimumLogLevel=n}return t.prototype.log=function(t,i){if(t>=this.minimumLogLevel)switch(t){case n.LogLevel.Error:console.error(n.LogLevel[t]+": "+i);break;case n.LogLevel.Warning:console.warn(n.LogLevel[t]+": "+i);break;case n.LogLevel.Information:console.info(n.LogLevel[t]+": "+i);break;default:console.log(n.LogLevel[t]+": "+i)}},t}();i.ConsoleLogger=r;f=function(){function t(){}return t.createLogger=function(t){return t===undefined?new r(n.LogLevel.Information):t===null?new u:t.log?t:new r(t)},t}();i.LoggerFactory=f});f(s);var ct=s.NullLogger,lt=s.ConsoleLogger,at=s.LoggerFactory,y=u(function(n,t){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function n(){this.isAborted=!1}return n.prototype.abort=function(){this.isAborted||(this.isAborted=!0,this.onabort&&this.onabort())},Object.defineProperty(n.prototype,"signal",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"aborted",{get:function(){return this.isAborted},enumerable:!0,configurable:!0}),n}();t.AbortController=i});f(y);nt=y.AbortController;r=u(function(n,t){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function n(){}return n.isRequired=function(n,t){if(n===null||n===undefined)throw new Error("The '"+t+"' argument is required.");},n.isIn=function(n,t,i){if(!(n in t))throw new Error("Unknown "+i+" value: "+n+".");},n}();t.Arg=i});f(r);tt=r.Arg;t=u(function(t,u){function o(n){var t=null;return n instanceof ArrayBuffer?t="Binary data of length "+n.byteLength:typeof n=="string"&&(t="String data of length "+n.length),t}function v(t,i,r,u,f,e){return s(this,void 0,void 0,function(){var c,l,a,s;return h(this,function(h){switch(h.label){case 0:return l=f(),l&&(c=(s={},s.Authorization="Bearer "+f(),s)),t.log(n.LogLevel.Trace,"("+i+" transport) sending data. "+o(e)+"."),[4,r.post(u,{content:e,headers:c})];case 1:return a=h.sent(),t.log(n.LogLevel.Trace,"("+i+" transport) request complete. Response status: "+a.statusCode+"."),[2]}})})}var s=i&&i.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})},h=i&&i.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=u[e[0]&2?"return":e[0]?"throw":"next"])&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[0,i.value]);switch(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=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},p,f,c,l,a;Object.defineProperty(u,"__esModule",{value:!0}),function(n){n[n.WebSockets=0]="WebSockets";n[n.ServerSentEvents=1]="ServerSentEvents";n[n.LongPolling=2]="LongPolling"}(p=u.TransportType||(u.TransportType={})),function(n){n[n.Text=1]="Text";n[n.Binary=2]="Binary"}(f=u.TransferFormat||(u.TransferFormat={}));c=function(){function t(n,t){this.logger=t;this.accessTokenFactory=n||function(){return null}}return t.prototype.connect=function(t,i,u){var e=this;if(r.Arg.isRequired(t,"url"),r.Arg.isRequired(i,"transferFormat"),r.Arg.isIn(i,f,"transferFormat"),r.Arg.isRequired(u,"connection"),typeof WebSocket=="undefined")throw new Error("'WebSocket' is not supported in your environment.");return this.logger.log(n.LogLevel.Trace,"(WebSockets transport) Connecting"),new Promise(function(r,u){var h,s;t=t.replace(/^http/,"ws");h=e.accessTokenFactory();h&&(t+=(t.indexOf("?")<0?"?":"&")+("access_token="+encodeURIComponent(h)));s=new WebSocket(t);i===f.Binary&&(s.binaryType="arraybuffer");s.onopen=function(){e.logger.log(n.LogLevel.Information,"WebSocket connected to "+t);e.webSocket=s;r()};s.onerror=function(n){u(n.error)};s.onmessage=function(t){if(e.logger.log(n.LogLevel.Trace,"(WebSockets transport) data received. "+o(t.data)+"."),e.onreceive)e.onreceive(t.data)};s.onclose=function(n){if(e.onclose&&e.webSocket)if(n.wasClean===!1||n.code!==1e3)e.onclose(new Error("Websocket closed with status code: "+n.code+" ("+n.reason+")"));else e.onclose()}})},t.prototype.send=function(t){return this.webSocket&&this.webSocket.readyState===WebSocket.OPEN?(this.logger.log(n.LogLevel.Trace,"(WebSockets transport) sending data. "+o(t)+"."),this.webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")},t.prototype.stop=function(){return this.webSocket&&(this.webSocket.close(),this.webSocket=null),Promise.resolve()},t}();u.WebSocketTransport=c;l=function(){function t(n,t,i){this.httpClient=n;this.accessTokenFactory=t||function(){return null};this.logger=i}return t.prototype.connect=function(t,i,u){var e=this;if(r.Arg.isRequired(t,"url"),r.Arg.isRequired(i,"transferFormat"),r.Arg.isIn(i,f,"transferFormat"),r.Arg.isRequired(u,"connection"),typeof EventSource=="undefined")throw new Error("'EventSource' is not supported in your environment.");return this.logger.log(n.LogLevel.Trace,"(SSE transport) Connecting"),this.url=t,new Promise(function(r,u){var h,s;i!==f.Text&&u(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));h=e.accessTokenFactory();h&&(t+=(t.indexOf("?")<0?"?":"&")+("access_token="+encodeURIComponent(h)));s=new EventSource(t,{withCredentials:!0});try{s.onmessage=function(t){if(e.onreceive)try{e.logger.log(n.LogLevel.Trace,"(SSE transport) data received. "+o(t.data)+".");e.onreceive(t.data)}catch(i){if(e.onclose)e.onclose(i);return}};s.onerror=function(n){if(u(new Error(n.message||"Error occurred")),e.eventSource&&e.onclose)e.onclose(new Error(n.message||"Error occurred"))};s.onopen=function(){e.logger.log(n.LogLevel.Information,"SSE connected to "+e.url);e.eventSource=s;r()}}catch(c){return Promise.reject(c)}})},t.prototype.send=function(n){return s(this,void 0,void 0,function(){return h(this,function(){return[2,v(this.logger,"SSE",this.httpClient,this.url,this.accessTokenFactory,n)]})})},t.prototype.stop=function(){return this.eventSource&&(this.eventSource.close(),this.eventSource=null),Promise.resolve()},t}();u.ServerSentEventsTransport=l;a=function(){function t(n,t,i){this.httpClient=n;this.accessTokenFactory=t||function(){return null};this.logger=i;this.pollAbort=new y.AbortController}return t.prototype.connect=function(t,i,u){if(r.Arg.isRequired(t,"url"),r.Arg.isRequired(i,"transferFormat"),r.Arg.isIn(i,f,"transferFormat"),r.Arg.isRequired(u,"connection"),this.url=t,this.logger.log(n.LogLevel.Trace,"(LongPolling transport) Connecting"),u.features.inherentKeepAlive=!0,i===f.Binary&&typeof(new XMLHttpRequest).responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");return this.poll(this.url,i),Promise.resolve()},t.prototype.poll=function(t,i){return s(this,void 0,void 0,function(){var u,s,c,r,l;return h(this,function(h){switch(h.label){case 0:u={abortSignal:this.pollAbort.signal,headers:{},timeout:9e4};i===f.Binary&&(u.responseType="arraybuffer");s=this.accessTokenFactory();s&&(u.headers.Authorization="Bearer "+s);h.label=1;case 1:if(!!this.pollAbort.signal.aborted)return[3,6];h.label=2;case 2:return h.trys.push([2,4,,5]),c=t+"&_="+Date.now(),this.logger.log(n.LogLevel.Trace,"(LongPolling transport) polling: "+c),[4,this.httpClient.get(c,u)];case 3:if(r=h.sent(),r.statusCode===204)this.logger.log(n.LogLevel.Information,"(LongPolling transport) Poll terminated by server"),this.onclose&&this.onclose(),this.pollAbort.abort();else if(r.statusCode!==200){if(this.logger.log(n.LogLevel.Error,"(LongPolling transport) Unexpected response code: "+r.statusCode),this.onclose)this.onclose(new e.HttpError(r.statusText,r.statusCode));this.pollAbort.abort()}else if(r.content){if(this.logger.log(n.LogLevel.Trace,"(LongPolling transport) data received. "+o(r.content)+"."),this.onreceive)this.onreceive(r.content)}else this.logger.log(n.LogLevel.Trace,"(LongPolling transport) Poll timed out, reissuing.");return[3,5];case 4:if(l=h.sent(),l instanceof e.TimeoutError)this.logger.log(n.LogLevel.Trace,"(LongPolling transport) Poll timed out, reissuing.");else{if(this.onclose)this.onclose(l);this.pollAbort.abort()}return[3,5];case 5:return[3,1];case 6:return[2]}})})},t.prototype.send=function(n){return s(this,void 0,void 0,function(){return h(this,function(){return[2,v(this.logger,"LongPolling",this.httpClient,this.url,this.accessTokenFactory,n)]})})},t.prototype.stop=function(){return this.pollAbort.abort(),Promise.resolve()},t}();u.LongPollingTransport=a});f(t);var vt=t.TransportType,yt=t.TransferFormat,pt=t.WebSocketTransport,wt=t.ServerSentEventsTransport,bt=t.LongPollingTransport,a=u(function(u,f){var e=i&&i.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})},o=i&&i.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=u[e[0]&2?"return":e[0]?"throw":"next"])&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[0,i.value]);switch(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=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},c;Object.defineProperty(f,"__esModule",{value:!0});c=function(){function i(n,t){t===void 0&&(t={});this.features={};r.Arg.isRequired(n,"url");this.logger=s.LoggerFactory.createLogger(t.logger);this.baseUrl=this.resolveUrl(n);t=t||{};t.accessTokenFactory=t.accessTokenFactory||function(){return null};this.httpClient=t.httpClient||new h.DefaultHttpClient(this.logger);this.connectionState=2;this.options=t}return i.prototype.start=function(i){return(r.Arg.isRequired(i,"transferFormat"),r.Arg.isIn(i,t.TransferFormat,"transferFormat"),this.logger.log(n.LogLevel.Trace,"Starting connection with transfer format '"+t.TransferFormat[i]+"'."),this.connectionState!==2)?Promise.reject(new Error("Cannot start a connection that is not in the 'Disconnected' state.")):(this.connectionState=0,this.startPromise=this.startInternal(i),this.startPromise)},i.prototype.startInternal=function(i){return e(this,void 0,void 0,function(){var h=this,u,r,s,f,e;return o(this,function(o){switch(o.label){case 0:return(o.trys.push([0,6,,7]),!(this.options.transport===t.TransportType.WebSockets))?[3,2]:(this.url=this.baseUrl,this.transport=this.constructTransport(t.TransportType.WebSockets),[4,this.transport.connect(this.url,i,this)]);case 1:return o.sent(),[3,5];case 2:return u=this.options.accessTokenFactory(),r=void 0,u&&(r=(e={},e.Authorization="Bearer "+u,e)),[4,this.getNegotiationResponse(r)];case 3:return(s=o.sent(),this.connectionState===2)?[2]:[4,this.createTransport(this.options.transport,s,i,r)];case 4:o.sent();o.label=5;case 5:return this.transport.onreceive=this.onreceive,this.transport.onclose=function(n){return h.stopConnection(!0,n)},this.changeState(0,1),[3,7];case 6:f=o.sent();this.logger.log(n.LogLevel.Error,"Failed to start the connection: "+f);this.connectionState=2;this.transport=null;throw f;case 7:return[2]}})})},i.prototype.getNegotiationResponse=function(t){return e(this,void 0,void 0,function(){var i,u,r;return o(this,function(f){switch(f.label){case 0:i=this.resolveNegotiateUrl(this.baseUrl);this.logger.log(n.LogLevel.Trace,"Sending negotiation request: "+i);f.label=1;case 1:return f.trys.push([1,3,,4]),[4,this.httpClient.post(i,{content:"",headers:t})];case 2:return u=f.sent(),[2,JSON.parse(u.content)];case 3:r=f.sent();this.logger.log(n.LogLevel.Error,"Failed to complete negotiation with the server: "+r);throw r;case 4:return[2]}})})},i.prototype.updateConnectionId=function(n){this.connectionId=n.connectionId;this.url=this.baseUrl+(this.baseUrl.indexOf("?")===-1?"?":"&")+("id="+this.connectionId)},i.prototype.createTransport=function(i,r,u,f){return e(this,void 0,void 0,function(){var c,e,h,l,s,a;return o(this,function(o){switch(o.label){case 0:return(this.updateConnectionId(r),!this.isITransport(i))?[3,2]:(this.logger.log(n.LogLevel.Trace,"Connection was provided an instance of ITransport, using that directly."),this.transport=i,[4,this.transport.connect(this.url,u,this)]);case 1:return o.sent(),this.changeState(0,1),[2];case 2:c=r.availableTransports;e=0;h=c;o.label=3;case 3:return(e<h.length)?(l=h[e],this.connectionState=0,s=this.resolveTransport(l,i,u),!(typeof s=="number"))?[3,8]:(this.transport=this.constructTransport(s),!(r.connectionId===null))?[3,5]:[4,this.getNegotiationResponse(f)]:[3,9];case 4:r=o.sent();this.updateConnectionId(r);o.label=5;case 5:return o.trys.push([5,7,,8]),[4,this.transport.connect(this.url,u,this)];case 6:return o.sent(),this.changeState(0,1),[2];case 7:return a=o.sent(),this.logger.log(n.LogLevel.Error,"Failed to start the transport '"+t.TransportType[s]+"': "+a),this.connectionState=2,r.connectionId=null,[3,8];case 8:return e++,[3,3];case 9:throw new Error("Unable to initialize any of the available transports.");}})})},i.prototype.constructTransport=function(n){switch(n){case t.TransportType.WebSockets:return new t.WebSocketTransport(this.options.accessTokenFactory,this.logger);case t.TransportType.ServerSentEvents:return new t.ServerSentEventsTransport(this.httpClient,this.options.accessTokenFactory,this.logger);case t.TransportType.LongPolling:return new t.LongPollingTransport(this.httpClient,this.options.accessTokenFactory,this.logger);default:throw new Error("Unknown transport: "+n+".");}},i.prototype.resolveTransport=function(i,r,u){var f=t.TransportType[i.transport],e;if(f===null||f===undefined)this.logger.log(n.LogLevel.Trace,"Skipping transport '"+i.transport+"' because it is not supported by this client.");else if(e=i.transferFormats.map(function(n){return t.TransferFormat[n]}),r&&f!==r)this.logger.log(n.LogLevel.Trace,"Skipping transport '"+t.TransportType[f]+"' because it was disabled by the client.");else if(e.indexOf(u)>=0)if(f===t.TransportType.WebSockets&&typeof WebSocket=="undefined"||f===t.TransportType.ServerSentEvents&&typeof EventSource=="undefined")this.logger.log(n.LogLevel.Trace,"Skipping transport '"+t.TransportType[f]+"' because it is not supported in your environment.'");else return this.logger.log(n.LogLevel.Trace,"Selecting transport '"+t.TransportType[f]+"'"),f;else this.logger.log(n.LogLevel.Trace,"Skipping transport '"+t.TransportType[f]+"' because it does not support the requested transfer format '"+t.TransferFormat[u]+"'.");return null},i.prototype.isITransport=function(n){return typeof n=="object"&&"connect"in n},i.prototype.changeState=function(n,t){return this.connectionState===n?(this.connectionState=t,!0):!1},i.prototype.send=function(n){if(this.connectionState!==1)throw new Error("Cannot send data if the connection is not in the 'Connected' State.");return this.transport.send(n)},i.prototype.stop=function(n){return e(this,void 0,void 0,function(){var t,i;return o(this,function(r){switch(r.label){case 0:t=this.connectionState;this.connectionState=2;r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.startPromise];case 2:return r.sent(),[3,4];case 3:return i=r.sent(),[3,4];case 4:return this.stopConnection(t===1,n),[2]}})})},i.prototype.stopConnection=function(t,i){if(this.transport&&(this.transport.stop(),this.transport=null),i?this.logger.log(n.LogLevel.Error,"Connection disconnected with error '"+i+"'."):this.logger.log(n.LogLevel.Information,"Connection disconnected."),this.connectionState=2,t&&this.onclose)this.onclose(i)},i.prototype.resolveUrl=function(t){var i,u,r;if(t.lastIndexOf("https://",0)===0||t.lastIndexOf("http://",0)===0)return t;if(typeof window=="undefined"||!window||!window.document)throw new Error("Cannot resolve '"+t+"'.");return i=window.document.createElement("a"),i.href=t,u=!i.protocol||i.protocol===":"?window.document.location.protocol+"//"+(i.host||window.document.location.host):i.protocol+"//"+i.host,t&&t[0]==="/"||(t="/"+t),r=u+t,this.logger.log(n.LogLevel.Information,"Normalizing '"+t+"' to '"+r+"'."),r},i.prototype.resolveNegotiateUrl=function(n){var i=n.indexOf("?"),t=n.substring(0,i===-1?n.length:i);return t[t.length-1]!=="/"&&(t+="/"),t+="negotiate",t+(i===-1?"":n.substring(i))},i}();f.HttpConnection=c});f(a);it=a.HttpConnection;o=u(function(n,t){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function n(){}return n.write=function(t){return""+t+n.RecordSeparator},n.parse=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.RecordSeparatorCode=30,n.RecordSeparator=String.fromCharCode(n.RecordSeparatorCode),n}();t.TextMessageFormat=i});f(o);rt=o.TextMessageFormat;c=u(function(i,r){Object.defineProperty(r,"__esModule",{value:!0});r.JSON_HUB_PROTOCOL_NAME="json";var u=function(){function i(){this.name=r.JSON_HUB_PROTOCOL_NAME;this.version=1;this.transferFormat=t.TransferFormat.Text}return i.prototype.parseMessages=function(t,i){var h,f,u,e,c,r;if(!t)return[];for(i===null&&(i=new s.NullLogger),h=o.TextMessageFormat.parse(t),f=[],u=0,e=h;u<e.length;u++){if(c=e[u],r=JSON.parse(c),typeof r.type!="number")throw new Error("Invalid payload.");switch(r.type){case 1:this.isInvocationMessage(r);break;case 2:this.isStreamItemMessage(r);break;case 3:this.isCompletionMessage(r);break;case 6:break;case 7:break;default:i.log(n.LogLevel.Information,"Unknown message type '"+r.type+"' ignored.");continue}f.push(r)}return f},i.prototype.writeMessage=function(n){return o.TextMessageFormat.write(JSON.stringify(n))},i.prototype.isInvocationMessage=function(n){this.assertNotEmptyString(n.target,"Invalid payload for Invocation message.");n.invocationId!==undefined&&this.assertNotEmptyString(n.invocationId,"Invalid payload for Invocation message.")},i.prototype.isStreamItemMessage=function(n){if(this.assertNotEmptyString(n.invocationId,"Invalid payload for StreamItem message."),n.item===undefined)throw new Error("Invalid payload for StreamItem message.");},i.prototype.isCompletionMessage=function(n){if(n.result&&n.error)throw new Error("Invalid payload for Completion message.");!n.result&&n.error&&this.assertNotEmptyString(n.error,"Invalid payload for Completion message.");this.assertNotEmptyString(n.invocationId,"Invalid payload for Completion message.")},i.prototype.assertNotEmptyString=function(n,t){if(typeof n!="string"||n==="")throw new Error(t);},i}();r.JsonHubProtocol=u});f(c);var kt=c.JSON_HUB_PROTOCOL_NAME,dt=c.JsonHubProtocol,l=u(function(n,t){var i,r;Object.defineProperty(t,"__esModule",{value:!0});i=function(){function n(n,t){this.subject=n;this.observer=t}return n.prototype.dispose=function(){var n=this.subject.observers.indexOf(this.observer);n>-1&&this.subject.observers.splice(n,1);this.subject.observers.length===0&&this.subject.cancelCallback().catch(function(){})},n}();t.Subscription=i;r=function(){function n(n){this.observers=[];this.cancelCallback=n}return n.prototype.next=function(n){for(var r,t=0,i=this.observers;t<i.length;t++)r=i[t],r.next(n)},n.prototype.error=function(n){for(var r,t=0,i=this.observers;t<i.length;t++)r=i[t],r.error&&r.error(n)},n.prototype.complete=function(){for(var i,n=0,t=this.observers;n<t.length;n++)i=t[n],i.complete&&i.complete()},n.prototype.subscribe=function(n){return this.observers.push(n),new i(this,n)},n}();t.Subject=r});f(l);var gt=l.Subscription,ni=l.Subject,v=u(function(t,r){var e=i&&i.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})},h=i&&i.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=u[e[0]&2?"return":e[0]?"throw":"next"])&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[0,i.value]);switch(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=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},u,f;Object.defineProperty(r,"__esModule",{value:!0});r.JsonHubProtocol=c.JsonHubProtocol;u=3e4;f=function(){function t(n,t){t===void 0&&(t={});var i=this;t=t||{};this.timeoutInMilliseconds=t.timeoutInMilliseconds||u;this.protocol=t.protocol||new c.JsonHubProtocol;this.connection=typeof n=="string"?new a.HttpConnection(n,t):n;this.logger=s.LoggerFactory.createLogger(t.logger);this.connection.onreceive=function(n){return i.processIncomingData(n)};this.connection.onclose=function(n){return i.connectionClosed(n)};this.callbacks={};this.methods={};this.closedCallbacks=[];this.id=0}return t.prototype.processIncomingData=function(t){var e,r,u,i,f;if(this.cleanupTimeout(),this.receivedHandshakeResponse||(t=this.processHandshakeResponse(t),this.receivedHandshakeResponse=!0),t)for(e=this.protocol.parseMessages(t,this.logger),r=0,u=e;r<u.length;r++){i=u[r];switch(i.type){case 1:this.invokeClientMethod(i);break;case 2:case 3:f=this.callbacks[i.invocationId];f!=null&&(i.type===3&&delete this.callbacks[i.invocationId],f(i));break;case 6:break;case 7:this.logger.log(n.LogLevel.Information,"Close message received from server.");this.connection.stop(i.error?new Error("Server returned an error on close: "+i.error):null);break;default:this.logger.log(n.LogLevel.Warning,"Invalid message type: "+i.type)}}this.configureTimeout()},t.prototype.processHandshakeResponse=function(t){var s,h,c,f,e,r,i,a,l,u;try{if(t instanceof ArrayBuffer){if(f=new Uint8Array(t),r=f.indexOf(o.TextMessageFormat.RecordSeparatorCode),r===-1)throw new Error("Message is incomplete.");i=r+1;h=String.fromCharCode.apply(null,f.slice(0,i));c=f.byteLength>i?f.slice(i).buffer:null}else{if(e=t,r=e.indexOf(o.TextMessageFormat.RecordSeparator),r===-1)throw new Error("Message is incomplete.");i=r+1;h=e.substring(0,i);c=e.length>i?e.substring(i):null}a=o.TextMessageFormat.parse(h);s=JSON.parse(a[0])}catch(v){u="Error parsing handshake response: "+v;this.logger.log(n.LogLevel.Error,u);l=new Error(u);this.connection.stop(l);throw l;}return s.error?(u="Server returned handshake error: "+s.error,this.logger.log(n.LogLevel.Error,u),this.connection.stop(new Error(u))):this.logger.log(n.LogLevel.Trace,"Server handshake complete."),c},t.prototype.configureTimeout=function(){var n=this;this.connection.features&&this.connection.features.inherentKeepAlive||(this.timeoutHandle=setTimeout(function(){return n.serverTimeout()},this.timeoutInMilliseconds))},t.prototype.serverTimeout=function(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))},t.prototype.invokeClientMethod=function(t){var u=this,r=this.methods[t.target.toLowerCase()],i;r?(r.forEach(function(n){return n.apply(u,t.arguments)}),t.invocationId&&(i="Server requested a response, which is not supported in this version of the client.",this.logger.log(n.LogLevel.Error,i),this.connection.stop(new Error(i)))):this.logger.log(n.LogLevel.Warning,"No client method with the name '"+t.target+"' found.")},t.prototype.connectionClosed=function(n){var i=this,t=this.callbacks;this.callbacks={};Object.keys(t).forEach(function(i){var r=t[i];r(undefined,n?n:new Error("Invocation canceled due to connection being closed."))});this.cleanupTimeout();this.closedCallbacks.forEach(function(t){return t.apply(i,[n])})},t.prototype.start=function(){return e(this,void 0,void 0,function(){return h(this,function(t){switch(t.label){case 0:return this.logger.log(n.LogLevel.Trace,"Starting HubConnection."),this.receivedHandshakeResponse=!1,[4,this.connection.start(this.protocol.transferFormat)];case 1:return t.sent(),this.logger.log(n.LogLevel.Trace,"Sending handshake request."),[4,this.connection.send(o.TextMessageFormat.write(JSON.stringify({protocol:this.protocol.name,version:this.protocol.version})))];case 2:return t.sent(),this.logger.log(n.LogLevel.Information,"Using HubProtocol '"+this.protocol.name+"'."),this.cleanupTimeout(),this.configureTimeout(),[2]}})})},t.prototype.stop=function(){return this.logger.log(n.LogLevel.Trace,"Stopping HubConnection."),this.cleanupTimeout(),this.connection.stop()},t.prototype.stream=function(n){for(var i,t,e,r=this,f=[],u=1;u<arguments.length;u++)f[u-1]=arguments[u];return i=this.createStreamInvocation(n,f),t=new l.Subject(function(){var n=r.createCancelInvocation(i.invocationId),t=r.protocol.writeMessage(n);return delete r.callbacks[i.invocationId],r.connection.send(t)}),this.callbacks[i.invocationId]=function(n,i){if(i){t.error(i);return}n.type===3?n.error?t.error(new Error(n.error)):t.complete():t.next(n.item)},e=this.protocol.writeMessage(i),this.connection.send(e).catch(function(n){t.error(n);delete r.callbacks[i.invocationId]}),t},t.prototype.send=function(n){for(var r,u,i=[],t=1;t<arguments.length;t++)i[t-1]=arguments[t];return r=this.createInvocation(n,i,!0),u=this.protocol.writeMessage(r),this.connection.send(u)},t.prototype.invoke=function(n){for(var r,f,t=this,u=[],i=1;i<arguments.length;i++)u[i-1]=arguments[i];return r=this.createInvocation(n,u,!1),f=new Promise(function(n,i){t.callbacks[r.invocationId]=function(t,r){if(r){i(r);return}if(t.type===3){var u=t;u.error?i(new Error(u.error)):n(u.result)}else i(new Error("Unexpected message type: "+t.type))};var u=t.protocol.writeMessage(r);t.connection.send(u).catch(function(n){i(n);delete t.callbacks[r.invocationId]})}),f},t.prototype.on=function(n,t){n&&t&&(n=n.toLowerCase(),this.methods[n]||(this.methods[n]=[]),this.methods[n].indexOf(t)===-1)&&this.methods[n].push(t)},t.prototype.off=function(n,t){var i,r;n&&(n=n.toLowerCase(),i=this.methods[n],i)&&(t?(r=i.indexOf(t),r!==-1&&(i.splice(r,1),i.length===0&&delete this.methods[n])):delete this.methods[n])},t.prototype.onclose=function(n){n&&this.closedCallbacks.push(n)},t.prototype.cleanupTimeout=function(){this.timeoutHandle&&clearTimeout(this.timeoutHandle)},t.prototype.createInvocation=function(n,t,i){if(i)return{arguments:t,target:n,type:1};var r=this.id;return this.id++,{arguments:t,invocationId:r.toString(),target:n,type:1}},t.prototype.createStreamInvocation=function(n,t){var i=this.id;return this.id++,{arguments:t,invocationId:i.toString(),target:n,type:4}},t.prototype.createCancelInvocation=function(n){return{invocationId:n,type:5}},t}();r.HubConnection=f});f(v);var ti=v.JsonHubProtocol,ii=v.HubConnection,b=u(function(n,t){Object.defineProperty(t,"__esModule",{value:!0})});return f(b),p=u(function(i,r){function u(n){for(var t in n)r.hasOwnProperty(t)||(r[t]=n[t])}Object.defineProperty(r,"__esModule",{value:!0});u(e);u(h);u(a);u(v);u(b);u(n);u(s);u(t);u(l)}),f(p),k=u(function(n,t){function i(n){for(var i in n)t.hasOwnProperty(i)||(t[i]=n[i])}Object.defineProperty(t,"__esModule",{value:!0});i(p)}),d=f(k),d}),function(n){n(["jquery"],function(n){return function(){function v(n,t,r){return f({type:u.error,iconClass:i().iconClasses.error,message:n,optionsOverride:r,title:t})}function r(r,u){return(r||(r=i()),t=n("#"+r.containerId),t.length)?t:(u&&(t=nt(r)),t)}function y(n,t,r){return f({type:u.info,iconClass:i().iconClasses.info,message:n,optionsOverride:r,title:t})}function p(n){e=n}function w(n,t,r){return f({type:u.success,iconClass:i().iconClasses.success,message:n,optionsOverride:r,title:t})}function b(n,t,r){return f({type:u.warning,iconClass:i().iconClasses.warning,message:n,optionsOverride:r,title:t})}function k(n,u){var f=i();t||r(f);l(n,f,u)||g(f)}function d(u){var f=i();if(t||r(f),u&&n(":focus",u).length===0){s(u);return}t.children().length&&t.remove()}function g(i){for(var u=t.children(),r=u.length-1;r>=0;r--)l(n(u[r]),i)}function l(t,i,r){var u=r&&r.force?r.force:!1;return t&&(u||n(":focus",t).length===0)?(t[i.hideMethod]({duration:i.hideDuration,easing:i.hideEasing,complete:function(){s(t)}}),!0):!1}function nt(i){return t=n("<div/>").attr("id",i.containerId).addClass(i.positionClass),t.appendTo(n(i.target)),t}function tt(){return{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:undefined,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:undefined,closeMethod:!1,closeDuration:!1,closeEasing:!1,closeOnHover:!0,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'<button type="button">×<\/button>',closeClass:"toast-close-button",newestOnTop:!0,preventDuplicates:!1,progressBar:!1,progressClass:"toast-progress",rtl:!1}}function a(n){e&&e(n)}function f(u){function g(n){return n==null&&(n=""),n.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function nt(){ut();et();ot();st();ht();ct();ft();tt()}function tt(){var n="";switch(u.iconClass){case"toast-success":case"toast-info":n="polite";break;default:n="assertive"}e.attr("aria-live",n)}function it(){f.closeOnHover&&e.hover(vt,at);!f.onclick&&f.tapToDismiss&&e.click(v);f.closeButton&&p&&p.click(function(n){if(n.stopPropagation?n.stopPropagation():n.cancelBubble!==undefined&&n.cancelBubble!==!0&&(n.cancelBubble=!0),f.onCloseClick)f.onCloseClick(n);v(!0)});f.onclick&&e.click(function(n){f.onclick(n);v()})}function rt(){e.hide();e[f.showMethod]({duration:f.showDuration,easing:f.showEasing,complete:f.onShown});f.timeOut>0&&(y=setTimeout(v,f.timeOut),c.maxHideTime=parseFloat(f.timeOut),c.hideEta=(new Date).getTime()+c.maxHideTime,f.progressBar&&(c.intervalId=setInterval(yt,10)))}function ut(){u.iconClass&&e.addClass(f.toastClass).addClass(w)}function ft(){f.newestOnTop?t.prepend(e):t.append(e)}function et(){if(u.title){var n=u.title;f.escapeHtml&&(n=g(u.title));k.append(n).addClass(f.titleClass);e.append(k)}}function ot(){if(u.message){var n=u.message;f.escapeHtml&&(n=g(u.message));d.append(n).addClass(f.messageClass);e.append(d)}}function st(){f.closeButton&&(p.addClass(f.closeClass).attr("role","button"),e.prepend(p))}function ht(){f.progressBar&&(b.addClass(f.progressClass),e.prepend(b))}function ct(){f.rtl&&e.addClass("rtl")}function lt(n,t){if(n.preventDuplicates){if(t.message===o)return!0;o=t.message}return!1}function v(t){var i=t&&f.closeMethod!==!1?f.closeMethod:f.hideMethod,r=t&&f.closeDuration!==!1?f.closeDuration:f.hideDuration,u=t&&f.closeEasing!==!1?f.closeEasing:f.hideEasing;if(!n(":focus",e).length||t)return clearTimeout(c.intervalId),e[i]({duration:r,easing:u,complete:function(){s(e);clearTimeout(y);f.onHidden&&l.state!=="hidden"&&f.onHidden();l.state="hidden";l.endTime=new Date;a(l)}})}function at(){(f.timeOut>0||f.extendedTimeOut>0)&&(y=setTimeout(v,f.extendedTimeOut),c.maxHideTime=parseFloat(f.extendedTimeOut),c.hideEta=(new Date).getTime()+c.maxHideTime)}function vt(){clearTimeout(y);c.hideEta=0;e.stop(!0,!0)[f.showMethod]({duration:f.showDuration,easing:f.showEasing})}function yt(){var n=(c.hideEta-(new Date).getTime())/c.maxHideTime*100;b.width(n+"%")}var f=i(),w=u.iconClass||f.iconClass;if(typeof u.optionsOverride!="undefined"&&(f=n.extend(f,u.optionsOverride),w=u.optionsOverride.iconClass||w),!lt(f,u)){h++;t=r(f,!0);var y=null,e=n("<div/>"),k=n("<div/>"),d=n("<div/>"),b=n("<div/>"),p=n(f.closeHtml),c={intervalId:null,hideEta:null,maxHideTime:null},l={toastId:h,state:"visible",startTime:new Date,options:f,map:u};return nt(),rt(),it(),a(l),f.debug&&console&&console.log(l),e}}function i(){return n.extend({},tt(),c.options)}function s(n){(t||(t=r()),n.is(":visible"))||(n.remove(),n=null,t.children().length===0&&(t.remove(),o=undefined))}var t,e,h=0,u={error:"error",info:"info",success:"success",warning:"warning"},c={clear:k,remove:d,error:v,getContainer:r,info:y,options:{},subscribe:p,success:w,version:"2.1.4",warning:b},o;return c}()})}(typeof define=="function"&&define.amd?define:function(n,t){typeof module!="undefined"&&module.exports?module.exports=t(require("jquery")):window.toastr=t(window.jQuery)}); |