!function(t,e){"use strict";if(!t.PushStream){var n={},s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o=function(t){return(t<10?"0":"")+t};n.dateToUTCString=function(t){var e=o(t.getUTCHours())+":"+o(t.getUTCMinutes())+":"+o(t.getUTCSeconds());return s[t.getUTCDay()]+", "+o(t.getUTCDate())+" "+i[t.getUTCMonth()]+" "+t.getUTCFullYear()+" "+e+" GMT"};var r=function(){for(var t=arguments[0]||{},e=0;e100&&(n.innerHTML=o.slice(-100).join("\n"))}}},S={_getXHRObject:function(e){var n=!1;if(e){try{n=new t.XDomainRequest}catch(t){}if(n)return n}try{n=new t.XMLHttpRequest}catch(e){try{n=new t.ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{n=new t.ActiveXObject("Microsoft.XMLHTTP")}catch(t){n=!1}}}return n},_send:function(e,n){(e=e||{}).timeout=e.timeout||3e4;var s=S._getXHRObject(e.crossDomain);if(s&&e.url){S.clear(e),e.xhr=s,t.XDomainRequest&&s instanceof t.XDomainRequest?(s.onload=function(){e.afterReceive&&e.afterReceive(s),e.success&&e.success(s.responseText)},s.onerror=s.ontimeout=function(){e.afterReceive&&e.afterReceive(s),e.error&&e.error(s.status)}):s.onreadystatechange=function(){4===s.readyState&&(S.clear(e),e.afterReceive&&e.afterReceive(s),200===s.status?e.success&&e.success(s.responseText):e.error&&e.error(s.status))},e.beforeOpen&&e.beforeOpen(s);var i={},o=null,a="GET";return n?(o=p(e.data),a="POST"):i=e.data||{},s.open(a,g(e.url,r({},i,d())),!0),e.beforeSend&&e.beforeSend(s),n?s.setRequestHeader&&(s.setRequestHeader("Accept","application/json"),s.setRequestHeader("Content-type","application/x-www-form-urlencoded")):e.timeoutId=t.setTimeout(function(){S.clear(e);try{s.abort()}catch(t){}e.error(304)},e.timeout+2e3),s.send(o),s}},_clear_xhr:function(t){t&&(t.onreadystatechange=null)},_clear_script:function(t){t&&(t.onerror=t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t))},_clear_timeout:function(t){t.timeoutId=x(t.timeoutId)},_clear_jsonp:function(e){var n=e.data.callback;n&&(t[n]=function(){t[n]=null})},clear:function(t){S._clear_timeout(t),S._clear_jsonp(t),S._clear_script(e.getElementById(t.scriptId)),S._clear_xhr(t.xhr)},jsonp:function(n){n.timeout=n.timeout||3e4,S.clear(n);var s=e.head||e.getElementsByTagName("head")[0],i=e.createElement("script"),o=m(),a=function(){S.clear(n);var t=m();n.error(t-o>n.timeout/2?304:403)};return i.onerror=a,i.onload=i.onreadystatechange=function(){i.readyState&&!/loaded|complete/.test(i.readyState)||(n.afterSuccess?(S.clear(n),n.load()):a())},n.beforeOpen&&n.beforeOpen({}),n.beforeSend&&n.beforeSend({}),n.timeoutId=t.setTimeout(a,n.timeout+2e3),n.scriptId=n.scriptId||m(),n.afterSuccess=null,n.data.callback=n.scriptId+"_onmessage_"+m(),t[n.data.callback]=function(){n.afterSuccess=!0,n.success.apply(null,arguments)},i.setAttribute("src",g(n.url,r({},n.data,d()))),i.setAttribute("async","async"),i.setAttribute("id",n.scriptId),s.insertBefore(i,s.firstChild),n},load:function(t){return S._send(t,!1)},post:function(t){return S._send(t,!0)}},b=function(e){return e?t.encodeURIComponent(e):""},C=function(e){return e?t.decodeURIComponent(e):""};n.parseMessage=function(t,e){var s=t;return _(t)&&(s=n.parseJSON(t)),{id:s[e.jsonIdKey],channel:s[e.jsonChannelKey],text:_(s[e.jsonTextKey])?C(s[e.jsonTextKey]):s[e.jsonTextKey],tag:s[e.jsonTagKey],time:s[e.jsonTimeKey],eventid:s[e.jsonEventIdKey]||""}};var T=function(t){return t.backtrack?".b"+Number(t.backtrack):""},P=function(t,e){var n="";for(var s in t)t.hasOwnProperty&&!t.hasOwnProperty(s)||(n+="/"+s+(e?T(t[s]):""));return n},E=function(t,e,n,s){var i=t.wrapper.type===M.TYPE,o=t.useSSL,a=I(o,t.port),c=i?o?"wss://":"ws://":o?"https://":"http://";c+=t.host,c+=a?":"+a:"",c+=e;var h=P(t.channels,s);if(t.channelsByArgument){var u={};u[t.channelsArgument]=h.substring(1),n=r({},n,u)}else c+=h;return g(c,n)},w=function(t){var e=I(t.useSSL,t.port),n=t.useSSL?"https://":"http://";return n+=t.host,n+=e?":"+e:"",(n+=t.urlPrefixPublisher)+"?id="+P(t.channels,!1)};n.extract_xss_domain=function(t){if(t.match(/^(\d{1,3}\.){3}\d{1,3}$/))return t;var e=t.split("."),n=Math.max(e.length-1,t.match(/(\w{4,}\.\w{2}|\.\w{3,})$/)?2:3);return e.slice(-1*n).join(".")};var I=function(t,e){return e=Number(e||(t?443:80)),!t&&80===e||t&&443===e?"":e};n.isCrossDomainUrl=function(n){if(!n)return!1;var s=e.createElement("a");s.href=n;var i=I("https:"===t.location.protocol,t.location.port),o=I("https:"===s.protocol,s.port);return t.location.protocol!==s.protocol||t.location.hostname!==s.hostname||i!==o};var O=function(t,e){return function(){return t.apply(e,arguments)}},x=function(e){return e&&t.clearTimeout(e),null},L=function(t){v.info("["+this.type+"] message received",arguments);var e=n.parseMessage(t.data,this.pushstream);e.tag&&(this.pushstream._etag=e.tag),e.time&&(this.pushstream._lastModified=e.time),e.eventid&&(this.pushstream._lastEventId=e.eventid),this.pushstream._onmessage(e.text,e.id,e.channel,e.eventid,!0,e.time)},A=function(){this.pushstream._onopen(),v.info("["+this.type+"] connection opened")},N=function(e){v.info("["+this.type+"] error (disconnected by server):",e),this.pushstream.readyState===U.OPEN&&this.type===j.TYPE&&"error"===e.type&&this.connection.readyState===t.EventSource.CONNECTING||(this._closeCurrentConnection(),this.pushstream._onerror({type:e&&("load"===e.type||"close"===e.type&&1006===e.code)||this.pushstream.readyState===U.CONNECTING?"load":"timeout"}))},M=function(e){if(!t.WebSocket&&!t.MozWebSocket)throw"WebSocket not supported";this.type=M.TYPE,this.pushstream=e,this.connection=null};M.TYPE="WebSocket",M.prototype={connect:function(){this._closeCurrentConnection();var e=r({},this.pushstream.extraParams(),d(),l(this.pushstream)),n=E(this.pushstream,this.pushstream.urlPrefixWebsocket,e,!this.pushstream._useControlArguments());this.connection=t.WebSocket?new t.WebSocket(n):new t.MozWebSocket(n),this.connection.onerror=O(N,this),this.connection.onclose=O(N,this),this.connection.onopen=O(A,this),this.connection.onmessage=O(L,this),v.info("[WebSocket] connecting to:",n)},disconnect:function(){this.connection&&(v.debug("[WebSocket] closing connection to:",this.connection.url),this.connection.onclose=null,this._closeCurrentConnection(),this.pushstream._onclose())},_closeCurrentConnection:function(){if(this.connection){try{this.connection.close()}catch(t){}this.connection=null}},sendMessage:function(t){this.connection&&this.connection.send(t)}};var j=function(e){if(!t.EventSource)throw"EventSource not supported";this.type=j.TYPE,this.pushstream=e,this.connection=null};j.TYPE="EventSource",j.prototype={connect:function(){this._closeCurrentConnection();var e=r({},this.pushstream.extraParams(),d(),l(this.pushstream)),n=E(this.pushstream,this.pushstream.urlPrefixEventsource,e,!this.pushstream._useControlArguments());this.connection=new t.EventSource(n),this.connection.onerror=O(N,this),this.connection.onopen=O(A,this),this.connection.onmessage=O(L,this),v.info("[EventSource] connecting to:",n)},disconnect:function(){this.connection&&(v.debug("[EventSource] closing connection to:",this.connection.url),this.connection.onclose=null,this._closeCurrentConnection(),this.pushstream._onclose())},_closeCurrentConnection:function(){if(this.connection){try{this.connection.close()}catch(t){}this.connection=null}}};var k=function(t){this.type=k.TYPE,this.pushstream=t,this.connection=null,this.url=null,this.frameloadtimer=null,this.pingtimer=null,this.iframeId="PushStreamManager_"+t.id};k.TYPE="Stream",k.prototype={connect:function(){this._closeCurrentConnection();var t=n.extract_xss_domain(this.pushstream.host);try{e.domain=t}catch(e){v.error("[Stream] (warning) problem setting document.domain = "+t+" (OBS: IE8 does not support set IP numbers as domain)")}var s=r({},this.pushstream.extraParams(),d(),{streamid:this.pushstream.id},l(this.pushstream));this.url=E(this.pushstream,this.pushstream.urlPrefixStream,s,!this.pushstream._useControlArguments()),v.debug("[Stream] connecting to:",this.url),this.loadFrame(this.url)},disconnect:function(){this.connection&&(v.debug("[Stream] closing connection to:",this.url),this._closeCurrentConnection(),this.pushstream._onclose())},_clear_iframe:function(){var t=e.getElementById(this.iframeId);t&&(t.onload=null,t.src="about:blank",t.parentNode&&t.parentNode.removeChild(t))},_closeCurrentConnection:function(){this._clear_iframe(),this.connection&&(this.pingtimer=x(this.pingtimer),this.frameloadtimer=x(this.frameloadtimer),this.connection=null,this.transferDoc=null,"function"==typeof t.CollectGarbage&&t.CollectGarbage())},loadFrame:function(n){this._clear_iframe();var s=null;if("ActiveXObject"in t){var i=new t.ActiveXObject("htmlfile");i.open(),i.write("