!function(){“use strict”;var Faye={VERSION:“1.1.2”,BAYEUX_VERSION:“1.0”,ID_LENGTH:160,JSONP_CALLBACK:“jsonpcallback”,CONNECTION_TYPES:,MANDATORY_CONNECTION_TYPES:,ENV:“undefined”!=typeof
window?window:global,extend:function(e,t,n){if(!t)return e;for(var i in t)t.hasOwnProperty(i)&&(e.hasOwnProperty(i)&&n===!1||e!==t&&(e=t));return
e},random:function(e){e=e||this.ID_LENGTH;for(var
t=Math.ceil(e*Math.log(2)/Math.log(36)),n=csprng(e,36);n.length<t;)n=“0”+n;return
n},validateOptions:function(e,t){for(var n in
e)if(this.indexOf(t,n)<0)throw Error(“Unrecognized option:
”+n)},clientIdFromMessages:function(e){var
t=this.filter([].concat(e),function(e){return“/meta/connect”===e.channel});return
t&&t.clientId},copyObject:function(e){var t,n,i;if(e instanceof
Array){for(t=[],n=e.length;n–;)t=Faye.copyObject(e);return t}if(“object”==typeof
e){t=null===e?null:{};for(i in e)t=Faye.copyObject(e);return t}return
e},commonElement:function(e,t){for(var n=0,i=e.length;i>n;n++)if(-1!==this.indexOf(t,e))return e;return null},indexOf:function(e,t){if(e.indexOf)return
e.indexOf(t);for(var n=0,i=e.length;i>n;n++)if(e===t)return
n;return-1},map:function(e,t,n){if(e.map)return e.map(t,n);var i=[];if(e
instanceof Array)for(var s=0,r=e.length;r>s;s++)i.push(t.call(n||null,e,s));else
for(var o in e)e.hasOwnProperty(o)&&i.push(t.call(n||null,o,e));return
i},filter:function(e,t,n){if(e.filter)return e.filter(t,n);for(var i=[],s=0,r=e.length;r>s;s++)t.call(n||null,e,s)&&i.push(e);return i},asyncEach:function(e,t,n,i){var
s=e.length,r=-1,o=0,a=!1,c=function(){return
o-=1,r+=1,r===s?n&&n.call(i):void t(e,u)},h=function(){if(!a){for(a=!0;o>0;)c();a=!1}},u=function(){o+=1,h()};u()},toJSON:function(e){return
this.stringify?this.stringify(e,function(e,t){return thisinstanceof Array?this:t}):JSON.stringify(e)}};“undefined”!=typeof
module?module.exports=Faye:“undefined”!=typeof
window&&(window.Faye=Faye),Faye.Class=function(e,t){“function”!=typeof
e&&(t=e,e=Object);var n=function(){return
this.initialize?this.initialize.apply(this,arguments)||this:this},i=function(){};return
i.prototype=e.prototype,n.prototype=new
i,Faye.extend(n.prototype,t),n},function(){function
e(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;ne
'“'}function
str(e,t){var n,i,s,r,o,a=gap,c=t;switch(c&&”object“==typeof
c&&”function“==typeof
c.toJSON&&(c=c.toJSON(e)),”function“==typeof
rep&&(c=rep.call(t,e,c)),typeof c){case”string“:return
quote©;case”number“:return
isFinite©?c+”“:”null“;case”boolean“:case”null“:return
c+”“;case”object“:if(!c)return”null“;if(gap+=indent,o=[],”[object
Array]“===Object.prototype.toString.apply©){for(r=c.length,n=0;r>n;n+=1)o=str(n,c)||”null“;return s=0===o.length?”[]“:gap?”“:”[“+o.join(”,“)+”]“,gap=a,s}if(rep&&”object“==typeof
rep)for(r=rep.length,n=0;r>n;n+=1)”string“==typeof rep&&(i=rep,s=str(i,c),s&&o.push(quote(i)+(gap?”:
“:”:“)+s));else for(i in
c)Object.prototype.hasOwnProperty.call(c,i)&&(s=str(i,c),s&&o.push(quote(i)+(gap?”:
“:”:“)+s));return
s=0===o.length?”{}“:gap?”{n“+gap+o.join(”,n“gap)
”n“a
”}“:”{“+o.join(”,“)+”}“,gap=a,s}}”function“!=typeof
Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return
isFinite(this.valueOf())?this.getUTCFullYear()+”-“+f(this.getUTCMonth()1)
”-“+f(this.getUTCDate())+”T“+f(this.getUTCHours())+”:“+f(this.getUTCMinutes())+”:“+f(this.getUTCSeconds())+”Z“:null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return
this.valueOf()});var cx=//g,escapable=//g,gap,indent,meta={”b“:”\b“,”
“:”\t“,”n“:”\n“,”f“:”\f“,”r“:”\r“,'”':'\“',”\“:”\\“},rep;Faye.stringify=function(e,t,n){var
i;if(gap=”“,indent=”“,”number“==typeof n)for(i=0;n>i;i+=1)indent+=”
“;else”string“==typeof
n&&(indent=n);if(rep=t,t&&”function“!=typeof
t&&(”object“!=typeof t||”number“!=typeof t.length))throw
Error(”JSON.stringify“);return str(”“,{”“:e})},”function“!=typeof
JSON.stringify&&(JSON.stringify=Faye.stringify),”function“!=typeof
JSON.parse&&(JSON.parse=function(text,reviver){function
walk(e,t){var n,i,s=e;if(s&&”object“==typeof
s)for(n in
s)Object.prototype.hasOwnProperty.call(s,n)&&(i=walk(s,n),void 0!==i?s=i:delete s); return
reviver.call(e,t,s)}var
j;if(text+=”“,cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return”\u“+(”0000“+e.charCodeAt(0).toString(16)).slice(-4)})),/^[],:{}s]*$/.test(text.replace(/\(?:|u{4})/g,“@”).replace(/“*”|true|false|null|-?d+(?:.d*)?(?:[+-]?d+)?/g,“]”).replace(/(?:^|:|,)(?:s*[)+/g,“”)))return
j=eval(“(”text
“)”),“function”==typeof
reviver?walk({“”:j},“”):j;throw new
SyntaxError(“JSON.parse”)})}(),Faye.Transport.WebSocket=Faye.extend(Faye.Class(Faye.Transport,{UNCONNECTED:1,CONNECTING:2,CONNECTED:3,batching:!1,isUsable:function(e,t){this.callback(function(){e.call(t,!0)}),this.errback(function(){e.call(t,!1)}),this.connect()},request:function(e){this._pending=this._pending||new
Faye.Set;for(var t=0,n=e.length;n>t;t++)this._pending.add(e);var i=new Faye.Promise;return
this.callback(function(t){t&&1===t.readyState&&(t.send(Faye.toJSON(e)),Faye.Promise.fulfill(i,t))},this),this.connect(),{abort:function(){i.then(function(e){e.close()})}}},connect:function(){if(!Faye.Transport.WebSocket._unloaded&&(this._state=this._state||this.UNCONNECTED,this._state===this.UNCONNECTED)){this._state=this.CONNECTING;var
e=this._createSocket();if(!e)return this.setDeferredStatus(“failed”);var
t=this;e.onopen=function(){e.headers&&t._storeCookies(e.headers),t._socket=e,t._state=t.CONNECTED,t._everConnected=!0,t._ping(),t.setDeferredStatus(“succeeded”,e)};var
n=!1;e.onclose=e.onerror=function(){if(!n){n=!0;var
i=t._state===t.CONNECTED;e.onopen=e.onclose=e.onerror=e.onmessage=null,delete
t._socket,t._state=t.UNCONNECTED,t.removeTimeout(“ping”),t.setDeferredStatus(“unknown”);var
s=t._pending?t._pending.toArray():[];delete
t._pending,i?t._handleError(s,!0):t._everConnected?t._handleError(s):t.setDeferredStatus(“failed”)}},e.onmessage=function(e){var
n=JSON.parse(e.data);if(n){n=[].concat(n);for(var
i=0,s=n.length;s>i;i++)void 0!==n.successful&&t._pending.remove(n);t._receive(n)}}}},close:function(){this._socket&&this._socket.close()},_createSocket:function(){var
e=Faye.Transport.WebSocket.getSocketUrl(this.endpoint),t=this._dispatcher.headers,n=this._dispatcher.wsExtensions,i=this._getCookies(),s=this._dispatcher.tls,r={extensions:n,headers:t,proxy:this._proxy,tls:s};return“”!==i&&(r.headers.Cookie=i),Faye.WebSocket?new
Faye.WebSocket.Client(e,[],r):Faye.ENV.MozWebSocket?new
MozWebSocket(e):Faye.ENV.WebSocket?new WebSocket(e):void
0},_ping:function(){this._socket&&(this._socket.send(“[]”),this.addTimeout(“ping”,this._dispatcher.timeout/2,this._ping,this))}}),{PROTOCOLS:{“”:“ws:”,“https:”:“wss:”},create:function(e,t){var
n=e.transports.websocket=e.transports.websocket||{};return n=n||new this(e,t),n},getSocketUrl:function(e){return e=Faye.copyObject(e),e.protocol=this.PROTOCOLS,Faye.URI.stringify(e)},isUsable:function(e,t,n,i){this.create(e,t).isUsable(n,i)}}),Faye.extend(Faye.Transport.WebSocket.prototype,Faye.Deferrable),Faye.Transport.register(“websocket”,Faye.Transport.WebSocket),Faye.Event&&void
0!==Faye.ENV.onbeforeunload&&Faye.Event.on(Faye.ENV,“beforeunload”,function(){Faye.Transport.WebSocket._unloaded=!0}),Faye.Transport.EventSource=Faye.extend(Faye.Class(Faye.Transport,{initialize:function(e,t){if(Faye.Transport.prototype.initialize.call(this,e,t),!Faye.ENV.EventSource)return
this.setDeferredStatus(“failed”);this._xhr=new Faye.Transport.XHR(e,t),t=Faye.copyObject(t),t.pathname+=“/”+e.clientId;var
n=new
EventSource(Faye.URI.stringify(t)),i=this;n.onopen=function(){i._everConnected=!0,i.setDeferredStatus(“succeeded”)},n.onerror=function(){i._everConnected?i._handleError([]):(i.setDeferredStatus(“failed”),n.close())},n.onmessage=function(e){i._receive(JSON.parse(e.data))},this._socket=n},close:function(){this._socket&&(this._socket.onopen=this._socket.onerror=this._socket.onmessage=null,this._socket.close(),delete
this._socket)},isUsable:function(e,t){this.callback(function(){e.call(t,!0)}),this.errback(function(){e.call(t,!1)})},encode:function(e){return
this._xhr.encode(e)},request:function(e){return
this._xhr.request(e)}}),{isUsable:function(e,t,n,i){var s=e.clientId;return
s?void Faye.Transport.XHR.isUsable(e,t,function(s){return
s?void
this.create(e,t).isUsable(n,i):n.call(i,!1)},this):n.call(i,!1)},create:function(e,t){var
n=e.transports.eventsource=e.transports.eventsource||{},i=e.clientId,s=Faye.copyObject(t);return
s.pathname+=“/”+(i||“”),s=Faye.URI.stringify(s),n=n||new this(e,t),n}}),Faye.extend(Faye.Transport.EventSource.prototype,Faye.Deferrable),Faye.Transport.register(“eventsource”,Faye.Transport.EventSource),Faye.Transport.XHR=Faye.extend(Faye.Class(Faye.Transport,{encode:function(e){return
Faye.toJSON(e)},request:function(e){var
t=this.endpoint.href,n=Faye.ENV.ActiveXObject?new
ActiveXObject(“Microsoft.XMLHTTP”):new
XMLHttpRequest,i=this;n.open(“POST”,t,!0),n.setRequestHeader(“Content-Type”,“application/json”),n.setRequestHeader(“Pragma”,“no-cache”),n.setRequestHeader(“X-Requested-With”,“XMLHttpRequest”);var
s=this._dispatcher.headers;for(var r in s)s.hasOwnProperty®&&n.setRequestHeader(r,s);var
o=function(){n.abort()};return void
0!==Faye.ENV.onbeforeunload&&Faye.Event.on(Faye.ENV,“beforeunload”,o),n.onreadystatechange=function(){if(n&&4===n.readyState){var
t=null,s=n.status,r=n.responseText,a=s>=200&&300>s||304===s||1223===s;if(void
0!==Faye.ENV.onbeforeunload&&Faye.Event.detach(Faye.ENV,“beforeunload”,o),n.onreadystatechange=function(){},n=null,!a)return
i._handleError(e);try{t=JSON.parse®}catch©{}t?i._receive(t):i._handleError(e)}},n.send(this.encode(e)),n}}),{isUsable:function(e,t,n,i){n.call(i,Faye.URI.isSameOrigin(t))}}),Faye.Transport.register(“long-polling”,Faye.Transport.XHR),Faye.Transport.CORS=Faye.extend(Faye.Class(Faye.Transport,{encode:function(e){return“message=”+encodeURIComponent(Faye.toJSON(e))},request:function(e){var
t,n=Faye.ENV.XDomainRequest?XDomainRequest:XMLHttpRequest,i=new
n,s=++Faye.Transport.CORS._id,r=this._dispatcher.headers,o=this;if(i.open(“POST”,Faye.URI.stringify(this.endpoint),!0),i.setRequestHeader){i.setRequestHeader(“Pragma”,“no-cache”);for(t
in r)r.hasOwnProperty(t)&&i.setRequestHeader(t,r)}var
a=function(){return
i?(Faye.Transport.CORS._pending.remove(s),i.onload=i.onerror=i.ontimeout=i.onprogress=null,void(i=null)):!1};return
i.onload=function(){var
t=null;try{t=JSON.parse(i.responseText)}catch(n){}a(),t?o._receive(t):o._handleError(e)},i.onerror=i.ontimeout=function(){a(),o._handleError(e)},i.onprogress=function(){},n===Faye.ENV.XDomainRequest&&Faye.Transport.CORS._pending.add({id:s,xhr:i}),i.send(this.encode(e)),i}}),{_id:0,_pending:new
Faye.Set,isUsable:function(e,t,n,i){if(Faye.URI.isSameOrigin(t))return
n.call(i,!1);if(Faye.ENV.XDomainRequest)return
n.call(i,t.protocol===Faye.ENV.location.protocol);if(Faye.ENV.XMLHttpRequest){var
s=new Faye.ENV.XMLHttpRequest;return
n.call(i,void 0!==s.withCredentials)}return
n.call(i,!1)}}),Faye.Transport.register(“cross-origin-long-polling”,Faye.Transport.CORS),Faye.Transport.JSONP=Faye.extend(Faye.Class(Faye.Transport,{encode:function(e){var
t=Faye.copyObject(this.endpoint);return
t.query.message=Faye.toJSON(e),t.query.jsonp=“__jsonp”Faye.Transport.JSONP._cbCount
“__”,Faye.URI.stringify(t)},request:function(e){var
t=document.getElementsByTagName(“head”),n=document.createElement(“script”),i=Faye.Transport.JSONP.getCallbackName(),s=Faye.copyObject(this.endpoint),r=this;s.query.message=Faye.toJSON(e),s.query.jsonp=i;var
o=function(){if(!Faye.ENV)return!1;Faye.ENV=void 0;try{delete Faye.ENV}catch(e){}n.parentNode.removeChild(n)};return Faye.ENV=function(e){o(),r._receive(e)},n.type=“text/javascript”,n.src=Faye.URI.stringify(s),t.appendChild(n),n.onerror=function(){o(),r._handleError(e)},{abort:o}}}),{_cbCount:0,getCallbackName:function(){return
this._cbCount+=1,“__jsonp”this._cbCount
“__”},isUsable:function(e,t,n,i){n.call(i,!0)}}),Faye.Transport.register(“callback-polling”,Faye.Transport.JSONP)}();
//# sourceMappingURL=faye-browser-min.js.map