/* sockjs-client v1.4.0 | http://sockjs.org | MIT license */ (function(a){"object"===typeof exports&&"undefined"!==typeof module?module.exports=a():"function"===typeof define&&define.amd?define([],a):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).SockJS=a()})(function(){return function(){function a(f,k,d){function c(e,g){if(!k[e]){if(!f[e]){var h="function"==typeof require&&require;if(!g&&h)return h(e,!0);if(b)return b(e,!0);h=Error("Cannot find module '"+e+"'");throw h.code="MODULE_NOT_FOUND",h;}h=k[e]={exports:{}};f[e][0].call(h.exports,function(b){return c(f[e][1][b]||b)},h,h.exports,a,f,k,d)}return k[e].exports}for(var b="function"==typeof require&&require,g=0;garguments.length)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");G.call(this);this.readyState=b.CONNECTING;this.protocol=this.extensions="";d=d||{};d.protocols_whitelist&&X.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead.");this._transportsWhitelist=d.transports;this._transportOptions=d.transportOptions||{};this._timeout=d.timeout||0;var h=d.sessionId||8;if("function"===typeof h)this._generateSessionId=h;else if("number"===typeof h)this._generateSessionId=function(){return l.string(h)};else throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");this._server=d.server||l.numberString(1E3);var e=new g(a);if(e.host&&e.protocol){if(e.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==e.protocol&&"https:"!==e.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+e.protocol+"' is not allowed.");}else throw new SyntaxError("The URL '"+a+"' is invalid");var p="https:"===e.protocol;if("https:"===A.protocol&&!p)throw Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");c?Array.isArray(c)||(c=[c]):c=[];var m=c.sort();m.forEach(function(b,a){if(!b)throw new SyntaxError("The protocols entry '"+b+"' is invalid.");if(a=a))throw Error("InvalidAccessError: Invalid code");if(c&&123=a||2E3===a||this.readyState!==b.CONNECTING?this._close(a,c):this._connect()};b.prototype._open=function(){u("_open",this._transport&&this._transport.transportName,this.readyState);this.readyState===b.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=b.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new w("open")),u("connected",this.transport)):this._close(1006,"Server lost session")};b.prototype._close=function(a,c,d){u("_close",this.transport,a,c,d,this.readyState);var e=!1;this._ir&&(e=!0,this._ir.close(),this._ir=null);this._transport&&(this._transport.close(),this.transport=this._transport=null);if(this.readyState===b.CLOSED)throw Error("InvalidStateError: SockJS has already been closed");this.readyState=b.CLOSING;setTimeout(function(){this.readyState=b.CLOSED;e&&this.dispatchEvent(new w("error"));var h=new R("close");h.wasClean=d||!1;h.code=a||1E3;h.reason=c;this.dispatchEvent(h);this.onmessage=this.onclose=this.onerror=null;u("disconnected")}.bind(this),0)};b.prototype.countRTO=function(b){return 100>>0;if("[object Function]"!==b.toString.call(a))throw new TypeError;for(;++g>>0;if(!c)return-1;var d=0;1>>0;n=a.exec(e);){m=n.index+n[0].length;if(m>p&&(g.push(e.slice(p,n.index)),!b&&1=d))break;a.lastIndex===n.index&&a.lastIndex++}p===e.length?!E&&a.test("")||g.push(""):g.push(e.slice(p));return g.length>d?g.slice(0,d):g}}():"0".split(void 0,0).length&&(g.split=function(a,b){return void 0===a&&0===b?[]:t.call(this,a,b)});var m=g.substr;f="".substr&&"b"!=="0b".substr(-1);a(g,{substr:function(a,b){return m.call(this,0>a?0>(a=this.length+a)?0:a:a,b)}},f)},{}],16:[function(a,f,k){f.exports=[a("./transport/websocket"),a("./transport/xhr-streaming"),a("./transport/xdr-streaming"),a("./transport/eventsource"),a("./transport/lib/iframe-wrap")(a("./transport/eventsource")),a("./transport/htmlfile"),a("./transport/lib/iframe-wrap")(a("./transport/htmlfile")),a("./transport/xhr-polling"),a("./transport/xdr-polling"),a("./transport/lib/iframe-wrap")(a("./transport/xhr-polling")),a("./transport/jsonp-polling")]},{"./transport/eventsource":20,"./transport/htmlfile":21,"./transport/jsonp-polling":23,"./transport/lib/iframe-wrap":26,"./transport/websocket":38,"./transport/xdr-polling":39,"./transport/xdr-streaming":40,"./transport/xhr-polling":41,"./transport/xhr-streaming":42}],17:[function(a,f,k){(function(d,c){function b(a,b,c,d){n(a,b);var e=this;g.call(this);setTimeout(function(){e._start(a,b,c,d)},0)}var g=a("events").EventEmitter,e=a("inherits"),h=a("../../utils/event"),l=a("../../utils/url"),r=c.XMLHttpRequest,n=function(){};"production"!==d.env.NODE_ENV&&(n=a("debug")("sockjs-client:browser:xhr"));e(b,g);b.prototype._start=function(a,c,d,e){var g=this;try{this.xhr=new r}catch(A){}if(this.xhr){c=l.addQuery(c,"t\x3d"+ +new Date);this.unloadRef=h.unloadAdd(function(){n("unload cleanup");g._cleanup(!0)});try{this.xhr.open(a,c,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){n("xhr timeout");g.emit("finish",0,"");g._cleanup(!1)})}catch(A){n("exception",A);this.emit("finish",0,"");this._cleanup(!1);return}e&&e.noCredentials||!b.supportsCORS||(n("withCredentials"),this.xhr.withCredentials=!0);if(e&&e.headers)for(var m in e.headers)this.xhr.setRequestHeader(m,e.headers[m]);this.xhr.onreadystatechange=function(){if(g.xhr){var a=g.xhr,b,c;n("readyState",a.readyState);switch(a.readyState){case 3:try{c=a.status,b=a.responseText}catch(S){}n("status",c);1223===c&&(c=204);200===c&&b&&0b;b++)d.push(String.fromCharCode(b));a.lastIndex=0;d.join("").replace(a,function(a){c[a]="\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4);return""});a.lastIndex=0;return c};f.exports={quote:function(a){a=d.stringify(a);c.lastIndex=0;if(!c.test(a))return a;b||(b=g(c));return a.replace(c,function(a){return b[a]})}}},{json3:58}],46:[function(a,f,k){(function(d){var c=a("./random"),b={},g=!1,e=d.chrome&&d.chrome.app&&d.chrome.app.runtime;f.exports={attachEvent:function(a,b){"undefined"!==typeof d.addEventListener?d.addEventListener(a,b,!1):d.document&&d.attachEvent&&(d.document.attachEvent("on"+a,b),d.attachEvent("on"+a,b))},detachEvent:function(a,b){"undefined"!==typeof d.addEventListener?d.removeEventListener(a,b,!1):d.document&&d.detachEvent&&(d.document.detachEvent("on"+a,b),d.detachEvent("on"+a,b))},unloadAdd:function(a){if(e)return null;var d=c.string(8);b[d]=a;g&&setTimeout(this.triggerUnloadCallbacks,0);return d},unloadDel:function(a){a in b&&delete b[a]},triggerUnloadCallbacks:function(){for(var a in b)b[a](),delete b[a]}};e||f.exports.attachEvent("unload",function(){g||(g=!0,f.exports.triggerUnloadCallbacks())})}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{"./random":50}],47:[function(a,f,k){(function(d,c){var b=a("./event"),g=a("json3"),e=a("./browser"),h=function(){};"production"!==d.env.NODE_ENV&&(h=a("debug")("sockjs-client:utils:iframe"));f.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){f.exports.WPrefix in c||(c[f.exports.WPrefix]={})},postMessage:function(a,b){c.parent!==c?c.parent.postMessage(g.stringify({windowId:f.exports.currentWindowId,type:a,data:b||""}),"*"):h("Cannot postMessage, no parent window.",a,b)},createIframe:function(a,d){var e=c.document.createElement("iframe"),g,f,p=function(){h("unattach");clearTimeout(g);try{e.onload=null}catch(w){}e.onerror=null},k=function(){h("cleanup");e&&(p(),setTimeout(function(){e&&e.parentNode.removeChild(e);e=null},0),b.unloadDel(f))},l=function(a){h("onerror",a);e&&(k(),d(a))};e.src=a;e.style.display="none";e.style.position="absolute";e.onerror=function(){l("onerror")};e.onload=function(){h("onload");clearTimeout(g);g=setTimeout(function(){l("onload timeout")},2E3)};c.document.body.appendChild(e);g=setTimeout(function(){l("timeout")},15E3);f=b.unloadAdd(k);return{post:function(a,b){h("post",a,b);setTimeout(function(){try{e&&e.contentWindow&&e.contentWindow.postMessage(a,b)}catch(A){}},0)},cleanup:k,loaded:p}},createHtmlfile:function(a,d){var e=["Active"].concat("Object").join("X"),g=new c[e]("htmlfile"),m,k,l,r=function(){clearTimeout(m);l.onerror=null},w=function(){g&&(r(),b.unloadDel(k),l.parentNode.removeChild(l),l=g=null,CollectGarbage())},G=function(a){h("onerror",a);g&&(w(),d(a))};g.open();g.write('\x3chtml\x3e\x3cscript\x3edocument.domain\x3d"'+c.document.domain+'";\x3c/script\x3e\x3c/html\x3e');g.close();g.parentWindow[f.exports.WPrefix]=c[f.exports.WPrefix];e=g.createElement("div");g.body.appendChild(e);l=g.createElement("iframe");e.appendChild(l);l.src=a;l.onerror=function(){G("onerror")};m=setTimeout(function(){G("timeout")},15E3);k=b.unloadAdd(w);return{post:function(a,b){try{setTimeout(function(){l&&l.contentWindow&&l.contentWindow.postMessage(a,b)},0)}catch(J){}},cleanup:w,loaded:r}}};f.exports.iframeEnabled=!1;c.document&&(f.exports.iframeEnabled=("function"===typeof c.postMessage||"object"===typeof c.postMessage)&&!e.isKonqueror())}).call(this,{env:{}},"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{"./browser":44,"./event":46,debug:55,json3:58}],48:[function(a,f,k){(function(a){var c={};["log","debug","warn"].forEach(function(b){var d;try{d=a.console&&a.console[b]&&a.console[b].apply}catch(e){}c[b]=d?function(){return a.console[b].apply(a.console,arguments)}:"log"===b?function(){}:c.log});f.exports=c}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],49:[function(a,f,k){f.exports={isObject:function(a){var c=typeof a;return"function"===c||"object"===c&&!!a},extend:function(a){if(!this.isObject(a))return a;for(var c,b,d=1,e=arguments.length;d=1.5*d?"s":"")}f.exports=function(a,g){g=g||{};var b=typeof a;if("string"===b&&0f?b+("\\u00"+D(2,f.toString(16))):b+(e?g[c]:a.charAt(c))}}return b+'"'},P=function(a,b,c,d,e,g,f){var h,k,m,p,n,L,O,q,C;try{h=b[a]}catch(ca){}if("object"==typeof h&&h)if(k=t.call(h),"[object Date]"!=k||x.call(h,"toJSON"))"function"==typeof h.toJSON&&("[object Number]"!=k&&"[object String]"!=k&&"[object Array]"!=k||x.call(h,"toJSON"))&&(h=h.toJSON(a));else if(h>-1/0&&h<1/0){if(K){p=B(h/864E5);for(k=B(p/365.2425)+1970-1;K(k+1,0)<=p;k++);for(m=B((p-K(k,0))/30.42);K(k,m+1)<=p;m++);p=1+p-K(k,m);n=(h%864E5+864E5)%864E5;L=B(n/36E5)%24;O=B(n/6E4)%60;q=B(n/1E3)%60;n%=1E3}else k=h.getUTCFullYear(),m=h.getUTCMonth(),p=h.getUTCDate(),L=h.getUTCHours(),O=h.getUTCMinutes(),q=h.getUTCSeconds(),n=h.getUTCMilliseconds();h=(0>=k||1E4<=k?(0>k?"-":"+")+D(6,0>k?-k:k):D(4,k))+"-"+D(2,m+1)+"-"+D(2,p)+"T"+D(2,L)+":"+D(2,O)+":"+D(2,q)+"."+D(3,n)+"Z"}else h=null;c&&(h=c.call(b,a,h));if(null===h)return"null";k=t.call(h);if("[object Boolean]"==k)return""+h;if("[object Number]"==k)return h>-1/0&&h<1/0?""+h:"null";if("[object String]"==k)return U(""+h);if("object"==typeof h){for(a=f.length;a--;)if(f[a]===h)throw l();f.push(h);C=[];b=g;g+=e;if("[object Array]"==k){m=0;for(a=h.length;m=d.length?d:d.slice(0,10));return P("",(p={},p[""]=a,p),g,f,e,"",[])}}if(!g("json-parse")){var aa=k.fromCharCode,ba={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},q,N,v=function(){q=N=null;throw p();},F=function(){for(var a=N,b=a.length,c,d,e,g,f;qf)v();else if(92==f)switch(f=a.charCodeAt(++q),f){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:c+=ba[f];q++;break;case 117:d=++q;for(e=q+4;q=f||97<=f&&102>=f||65<=f&&70>=f||v();c+=aa("0x"+a.slice(d,q));break;default:v()}else{if(34==f)break;f=a.charCodeAt(q);for(d=q;32<=f&&92!=f&&34!=f;)f=a.charCodeAt(++q);c+=a.slice(d,q)}if(34==a.charCodeAt(q))return q++,c;v();default:d=q;45==f&&(g=!0,f=a.charCodeAt(++q));if(48<=f&&57>=f){for(48==f&&(f=a.charCodeAt(q+1),48<=f&&57>=f)&&v();q=f);q++);if(46==a.charCodeAt(q)){for(e=++q;e=f);e++);e==q&&v();q=e}f=a.charCodeAt(q);if(101==f||69==f){f=a.charCodeAt(++q);43!=f&&45!=f||q++;for(e=q;e=f);e++);e==q&&v();q=e}return+a.slice(d,q)}g&&v();if("true"==a.slice(q,q+4))return q+=4,!0;if("false"==a.slice(q,q+5))return q+=5,!1;if("null"==a.slice(q,q+4))return q+=4,null;v()}return"$"},Q=function(a){var b,c;"$"==a&&v();if("string"==typeof a){if("@"==(I?a.charAt(0):a[0]))return a.slice(1);if("["==a){for(b=[];;c||(c=!0)){a=F();if("]"==a)break;c&&(","==a?(a=F(),"]"==a&&v()):v());","==a&&v();b.push(Q(a))}return b}if("{"==a){for(b={};;c||(c=!0)){a=F();if("}"==a)break;c&&(","==a?(a=F(),"}"==a&&v()):v());","!=a&&"string"==typeof a&&"@"==(I?a.charAt(0):a[0])&&":"==F()||v();b[a.slice(1)]=Q(F())}return b}v()}return a},W=function(a,b,c){c=V(a,b,c);c===y?delete a[b]:a[b]=c},V=function(a,b,c){var d=a[b],e;if("object"==typeof d&&d)if("[object Array]"==t.call(d))for(e=d.length;e--;)W(d,e,c);else H(d,function(a){W(d,a,c)});return c.call(a,b,d)};d.parse=function(a,b){var c,d;q=0;N=""+a;c=Q(F());"$"!=F()&&v();q=N=null;return b&&"[object Function]"==t.call(b)?V((d={},d[""]=c,d),"",b):c}}}d.runInContext=c;return d}var b={"function":!0,object:!0},d=b[typeof k]&&k&&!k.nodeType&&k,e=b[typeof window]&&window||this,h=d&&b[typeof f]&&f&&!f.nodeType&&"object"==typeof a&&a;!h||h.global!==h&&h.window!==h&&h.self!==h||(e=h);if(d)c(e,d);else{var l=e.JSON,r=e.JSON3,n=!1,t=c(e,e.JSON3={noConflict:function(){n||(n=!0,e.JSON=l,e.JSON3=r,l=r=null);return t}});e.JSON={parse:t.parse,stringify:t.stringify}}}).call(this)}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],59:[function(a,f,k){var d=Object.prototype.hasOwnProperty;k.stringify=function(a,b){b=b||"";var c=[];"string"!==typeof b&&(b="?");for(var e in a)d.call(a,e)&&c.push(encodeURIComponent(e)+"\x3d"+encodeURIComponent(a[e]));return c.length?b+c.join("\x26"):""};k.parse=function(a){for(var b=/([^=?&]+)=?([^&]*)/g,c={},d;d=b.exec(a);){var f=decodeURIComponent(d[1].replace(/\+/g," "));d=decodeURIComponent(d[2].replace(/\+/g," "));f in c||(c[f]=d)}return c}},{}],60:[function(a,f,k){f.exports=function(a,c){c=c.split(":")[0];a=+a;if(!a)return!1;switch(c){case "http":case "ws":return 80!==a;case "https":case "wss":return 443!==a;case "ftp":return 21!==a;case "gopher":return 70!==a;case "file":return!1}return 0!==a}},{}],61:[function(a,f,k){(function(d){function c(a){var b=d&&d.location||{};a=a||b;var b={},c=typeof a,e;if("blob:"===a.protocol)b=new g(unescape(a.pathname),{});else if("string"===c)for(e in b=new g(a,{}),t)delete b[e];else if("object"===c){for(e in a)e in t||(b[e]=a[e]);void 0===b.slashes&&(b.slashes=r.test(a.href))}return b}function b(a){a=k.exec(a);return{protocol:a[1]?a[1].toLowerCase():"",slashes:!!a[2],rest:a[3]}}function g(a,d,f){if(!(this instanceof g))return new g(a,d,f);var k,p,m,l,t=n.slice();k=typeof d;var r=0;"object"!==k&&"string"!==k&&(f=d,d=null);f&&"function"!==typeof f&&(f=h.parse);d=c(d);p=b(a||"");k=!p.protocol&&!p.slashes;this.slashes=p.slashes||k&&d.slashes;this.protocol=p.protocol||d.protocol||"";a=p.rest;for(p.slashes||(t[3]=[/(.*)/,"pathname"]);r