!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&&(s.innerHTML=r.slice(-100).join("\n"))}}},S={_getXHRObject:function(){var e=!1;try{e=new t.XMLHttpRequest}catch(n){try{e=new t.XDomainRequest}catch(n){try{e=new t.ActiveXObject("Msxml2.XMLHTTP")}catch(n){try{e=new t.ActiveXObject("Microsoft.XMLHTTP")}catch(t){e=!1}}}}return e},_send:function(e,n){(e=e||{}).timeout=e.timeout||3e4;var s=S._getXHRObject();if(s&&e.url){S.clear(e),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("Accept","application/json"),s.setRequestHeader("Content-type","application/x-www-form-urlencoded")):e.timeoutId=t.setTimeout((function(){try{s.abort()}catch(t){}S.clear(e),e.error(304)}),e.timeout+2e3),s.send(o),s}},_clear_script:function(t){t&&(t.onerror=t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t))},_clear_timeout:function(t){t.timeoutId=w(t.timeoutId)},clear:function(t){S._clear_timeout(t),S._clear_script(e.getElementById(t.scriptId))},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 e=n.data.callback;e&&(t[e]=function(){t[e]=null});var s=m();n.error(s-o>n.timeout/2?304:0)};i.onerror=a,i.onload=i.onreadystatechange=function(t){i.readyState&&!/loaded|complete/.test(i.readyState)||(S.clear(n),n.load())},n.beforeOpen&&n.beforeOpen({}),n.beforeSend&&n.beforeSend({}),n.timeoutId=t.setTimeout(a,n.timeout+2e3),n.scriptId=n.scriptId||m();var c=n.data.callback;return c&&(t[c]=function(){t[c]=null}),n.data.callback=n.scriptId+"_onmessage_"+m(),t[n.data.callback]=n.success,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.escape(e):""},C=function(e){return e?t.unescape(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,e,n,s){var i=t.wrapper.type===x.TYPE,o=t.useSSL,a=i?o?"wss://":"ws://":o?"https://":"http://";a+=t.host,a+=!o&&80===t.port||o&&443===t.port?"":":"+t.port,a+=e;var c=function(t,e){var n,s="";for(var i in t)t.hasOwnProperty&&!t.hasOwnProperty(i)||(s+="/"+i+(e&&(n=t[i]).backtrack?".b"+Number(n.backtrack):""));return s}(t.channels,s);if(t.channelsByArgument){var h={};h[t.channelsArgument]=c.substring(1),n=r({},n,h)}else a+=c;return g(a,n)},P=function(t){var e="",n=t.useSSL?"https://":"http://";for(var s in n+=t.host,n+=80!==t.port&&443!==t.port?":"+t.port:"",n+=t.urlPrefixPublisher,t.channels)if(!t.channels.hasOwnProperty||t.channels.hasOwnProperty(s)){e=s;break}return n+"?id="+e};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 E=function(t,e){return function(){return t.apply(e,arguments)}},w=function(e){return e&&t.clearTimeout(e),null},O=function(t){y.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)},I=function(){this.pushstream._onopen(),y.info("["+this.type+"] connection opened")},L=function(e){y.info("["+this.type+"] error (disconnected by server):",e),this.pushstream.readyState===j.OPEN&&this.type===A.TYPE&&"error"===e.type&&this.connection.readyState===t.EventSource.CONNECTING||(this._closeCurrentConnection(),this.pushstream._onerror({type:e&&("load"===e.type||"close"===e.type)||this.pushstream.readyState===j.CONNECTING?"load":"timeout"}))},x=function(e){if(!t.WebSocket&&!t.MozWebSocket)throw"WebSocket not supported";this.type=x.TYPE,this.pushstream=e,this.connection=null};x.TYPE="WebSocket",x.prototype={connect:function(){this._closeCurrentConnection();var e=r({},this.pushstream.extraParams(),d(),l(this.pushstream)),n=T(this.pushstream,this.pushstream.urlPrefixWebsocket,e,!this.pushstream._useControlArguments());this.connection=t.WebSocket?new t.WebSocket(n):new t.MozWebSocket(n),this.connection.onerror=E(L,this),this.connection.onclose=E(L,this),this.connection.onopen=E(I,this),this.connection.onmessage=E(O,this),y.info("[WebSocket] connecting to:",n)},disconnect:function(){this.connection&&(y.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 A=function(e){if(!t.EventSource)throw"EventSource not supported";this.type=A.TYPE,this.pushstream=e,this.connection=null};A.TYPE="EventSource",A.prototype={connect:function(){var e=this,n=function(){e._closeCurrentConnection(),setTimeout((function(){var s=r({},e.pushstream.extraParams(),d(),l(e.pushstream)),i=T(e.pushstream,e.pushstream.urlPrefixEventsource,s,!e.pushstream._useControlArguments());e.connection=new t.EventSource(i),e.connection.onerror=n,e.connection.onopen=E(I,e),e.connection.onmessage=E(O,e)}),e.pushstream.reconnectOnTimeoutInterval)};n()},disconnect:function(){this.connection&&(y.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 N=function(t){this.type=N.TYPE,this.pushstream=t,this.connection=null,this.url=null,this.frameloadtimer=null,this.pingtimer=null,this.iframeId="PushStreamManager_"+t.id};N.TYPE="Stream",N.prototype={connect:function(){this._closeCurrentConnection();var t=n.extract_xss_domain(this.pushstream.host);try{e.domain=t}catch(e){y.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=T(this.pushstream,this.pushstream.urlPrefixStream,s,!this.pushstream._useControlArguments()),y.debug("[Stream] connecting to:",this.url),this.loadFrame(this.url)},disconnect:function(){this.connection&&(y.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=w(this.pingtimer),this.frameloadtimer=w(this.frameloadtimer),this.connection=null,this.transferDoc=null,"function"==typeof t.CollectGarbage&&t.CollectGarbage())},loadFrame:function(n){this._clear_iframe();try{var s=new t.ActiveXObject("htmlfile");s.open(),s.write('