faye 1.0.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.md ADDED
@@ -0,0 +1,12 @@
1
+ Copyright 2009-2020 James Coglan
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software distributed
10
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
12
+ specific language governing permissions and limitations under the License.
data/README.md CHANGED
@@ -4,33 +4,7 @@ Faye is a set of tools for simple publish-subscribe messaging between web
4
4
  clients. It ships with easy-to-use message routing servers for Node.js and Rack
5
5
  applications, and clients that can be used on the server and in the browser.
6
6
 
7
- * Documentation: http://faye.jcoglan.com
8
- * Mailing list: http://groups.google.com/group/faye-users
9
- * Bug tracker: http://github.com/faye/faye/issues
10
- * Source code: http://github.com/faye/faye
11
-
12
-
13
- ## License
14
-
15
- (The MIT License)
16
-
17
- Copyright (c) 2009-2014 James Coglan and contributors
18
-
19
- Permission is hereby granted, free of charge, to any person obtaining a copy of
20
- this software and associated documentation files (the 'Software'), to deal in
21
- the Software without restriction, including without limitation the rights to
22
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
23
- of the Software, and to permit persons to whom the Software is furnished to do
24
- so, subject to the following conditions:
25
-
26
- The above copyright notice and this permission notice shall be included in all
27
- copies or substantial portions of the Software.
28
-
29
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
- SOFTWARE.
36
-
7
+ - Documentation: http://faye.jcoglan.com
8
+ - Mailing list: http://groups.google.com/group/faye-users
9
+ - Bug tracker: http://github.com/faye/faye/issues
10
+ - Source code: http://github.com/faye/faye
@@ -0,0 +1,2 @@
1
+ var Faye=function(t){var e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(i,s,function(e){return t[e]}.bind(null,s));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=38)}([function(t,e,n){"use strict";var i=Array.prototype.forEach,s=Object.prototype.hasOwnProperty;t.exports=function(t){return i.call(arguments,(function(e,n){if(0!==n)for(var i in e)s.call(e,i)&&(t[i]=e[i])})),t}},function(t,e,n){"use strict";var i=n(0);t.exports=function(t,e){"function"!=typeof t&&(e=t,t=Object);var n=function(){return this.initialize&&this.initialize.apply(this,arguments)||this},s=function(){};return s.prototype=t.prototype,n.prototype=new s,i(n.prototype,e),n}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";t.exports={isURI:function(t){return t&&t.protocol&&t.host&&t.path},isSameOrigin:function(t){return t.protocol===location.protocol&&t.hostname===location.hostname&&t.port===location.port},parse:function(t){if("string"!=typeof t)return t;var e,n,i,s,r,o,c={},a=function(e,n){t=t.replace(n,(function(t){return c[e]=t,""})),c[e]=c[e]||""};for(a("protocol",/^[a-z]+\:/i),a("host",/^\/\/[^\/\?#]+/),/^\//.test(t)||c.host||(t=location.pathname.replace(/[^\/]*$/,"")+t),a("pathname",/^[^\?#]*/),a("search",/^\?[^#]*/),a("hash",/^#.*/),c.protocol=c.protocol||location.protocol,c.host?(c.host=c.host.substr(2),/@/.test(c.host)&&(c.auth=c.host.split("@")[0],c.host=c.host.split("@")[1]),e=c.host.match(/^\[([^\]]+)\]|^[^:]+/),c.hostname=e[1]||e[0],c.port=(c.host.match(/:(\d+)$/)||[])[1]||""):(c.host=location.host,c.hostname=location.hostname,c.port=location.port),c.pathname=c.pathname||"/",c.path=c.pathname+c.search,o={},s=0,r=(i=(n=c.search.replace(/^\?/,""))?n.split("&"):[]).length;s<r;s++)e=i[s].split("="),o[decodeURIComponent(e[0]||"")]=decodeURIComponent(e[1]||"");return c.query=o,c.href=this.stringify(c),c},stringify:function(t){var e=t.auth?t.auth+"@":"",n=t.protocol+"//"+e+t.host;return n+=t.pathname+this.queryString(t.query)+(t.hash||"")},queryString:function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return 0===e.length?"":"?"+e.join("&")}}},function(t,e,n){"use strict";var i=n(1),s=n(18).Cookie,r=n(6),o=n(11),c=n(0),a=n(8),h=n(29),u=n(15),l=c(i({className:"Transport",DEFAULT_PORTS:{"http:":80,"https:":443,"ws:":80,"wss:":443},MAX_DELAY:0,batching:!0,initialize:function(t,e){this._dispatcher=t,this.endpoint=e,this._outbox=[],this._proxy=c({},this._dispatcher.proxy),this._proxy.origin||(this._proxy.origin=this._findProxy())},close:function(){},encode:function(t){return""},sendMessage:function(t){return this.debug("Client ? sending message to ?: ?",this._dispatcher.clientId,this.endpoint.href,t),this.batching?(this._outbox.push(t),this._flushLargeBatch(),t.channel===u.HANDSHAKE?this._publish(.01):(t.channel===u.CONNECT&&(this._connectMessage=t),this._publish(this.MAX_DELAY))):r.resolve(this.request([t]))},_makePromise:function(){var t=this;this._requestPromise=this._requestPromise||new r((function(e){t._resolvePromise=e}))},_publish:function(t){return this._makePromise(),this.addTimeout("publish",t,(function(){this._flush(),delete this._requestPromise}),this),this._requestPromise},_flush:function(){this.removeTimeout("publish"),this._outbox.length>1&&this._connectMessage&&(this._connectMessage.advice={timeout:0}),this._resolvePromise(this.request(this._outbox)),this._connectMessage=null,this._outbox=[]},_flushLargeBatch:function(){if(!(this.encode(this._outbox).length<this._dispatcher.maxRequestSize)){var t=this._outbox.pop();this._makePromise(),this._flush(),t&&this._outbox.push(t)}},_receive:function(t){if(t){t=[].concat(t),this.debug("Client ? received from ? via ?: ?",this._dispatcher.clientId,this.endpoint.href,this.connectionType,t);for(var e=0,n=t.length;e<n;e++)this._dispatcher.handleResponse(t[e])}},_handleError:function(t,e){t=[].concat(t),this.debug("Client ? failed to send to ? via ?: ?",this._dispatcher.clientId,this.endpoint.href,this.connectionType,t);for(var n=0,i=t.length;n<i;n++)this._dispatcher.handleError(t[n])},_getCookies:function(){var t=this._dispatcher.cookies,e=this.endpoint.href;return t?o.map(t.getCookiesSync(e),(function(t){return t.cookieString()})).join("; "):""},_storeCookies:function(t){var e,n=this._dispatcher.cookies,i=this.endpoint.href;if(t&&n)for(var r=0,o=(t=[].concat(t)).length;r<o;r++)e=s.parse(t[r]),n.setCookieSync(e,i)},_findProxy:function(){if("undefined"!=typeof process){var t=this.endpoint.protocol;if(t){var e,n,i=t.replace(/:$/,"").toLowerCase()+"_proxy",s=i.toUpperCase(),r=process.env;return"http_proxy"===i&&r.REQUEST_METHOD?(1===(e=Object.keys(r).filter((function(t){return/^http_proxy$/i.test(t)}))).length?e[0]===i&&void 0===r[s]&&(n=r[i]):e.length>1&&(n=r[i]),n=n||r["CGI_"+s]):(n=r[i]||r[s])&&!r[i]&&console.warn("The environment variable "+s+" is discouraged. Use "+i+"."),n}}}}),{get:function(t,e,n,i,s){var r=t.endpoint;o.asyncEach(this._transports,(function(r,c){var a=r[0],h=r[1],u=t.endpointFor(a);return o.indexOf(n,a)>=0?c():o.indexOf(e,a)<0?(h.isUsable(t,u,(function(){})),c()):void h.isUsable(t,u,(function(e){if(!e)return c();var n=h.hasOwnProperty("create")?h.create(t,u):new h(t,u);i.call(s,n)}))}),(function(){throw new Error("Could not find a usable connection type for "+r.href)}))},register:function(t,e){this._transports.push([t,e]),e.prototype.connectionType=t},getConnectionTypes:function(){return o.map(this._transports,(function(t){return t[0]}))},disable:function(t){if("autodisconnect"===t)for(var e=0;e<this._transports.length;e++)this._transports[e][1]._unloaded=!1},_transports:[]});c(l.prototype,a),c(l.prototype,h),t.exports=l},function(t,e,n){"use strict";t.exports=function(t){return JSON.stringify(t,(function(t,e){return this[t]instanceof Array?this[t]:e}))}},function(t,e,n){"use strict";var i=n(13),s=function(t){this._state=-1,this._value=null,this._defer=[],r(this,t)};s.prototype.then=function(t,e){var n=new s,i={promise:n,onFulfilled:t,onRejected:e};return-1===this._state?this._defer.push(i):o(this,i),n},s.prototype.catch=function(t){return this.then(null,t)};var r=function(t,e){if("function"==typeof e){var n=0,i=function(e){0==n++&&u(t,e)};try{e((function(e){0==n++&&c(t,e)}),i)}catch(t){i(t)}}},o=function(t,e){var n=t._state,s=t._value,r=e.promise,o=[e.onFulfilled,e.onRejected][n];if("function"!=typeof o)return(0,[c,u][n])(r,s);i((function(){try{c(r,o(s))}catch(t){u(r,t)}}))},c=function(t,e){if(t===e)return u(t,new TypeError("Recursive promise chain detected"));var n;try{n=a(e)}catch(e){return u(t,e)}if(!n)return h(t,e);r(t,(function(t,i){n.call(e,t,i)}))},a=function(t){var e=typeof t,n=("object"===e||"function"===e)&&t&&t.then;return"function"==typeof n?n:null},h=function(t,e){l(t,0,e)},u=function(t,e){l(t,1,e)},l=function(t,e,n){var i=t._defer,s=0;if(t._state=e,t._value=n,t._defer=null,0!==i.length)for(;s<i.length;)o(t,i[s++])};s.resolve=function(t){try{if(a(t))return t}catch(t){return s.reject(t)}return new s((function(e,n){e(t)}))},s.reject=function(t){return new s((function(e,n){n(t)}))},s.all=function(t){return new s((function(e,n){var i,r=[],o=t.length;if(0===o)return e(r);var c=function(t,i){s.resolve(t).then((function(t){r[i]=t,0==--o&&e(r)}),n)};for(i=0;i<o;i++)c(t[i],i)}))},s.race=function(t){return new s((function(e,n){for(var i=0,r=t.length;i<r;i++)s.resolve(t[i]).then(e,n)}))},s.deferred=function(){var t={};return t.promise=new s((function(e,n){t.resolve=e,t.reject=n})),t},t.exports=s},function(t,e,n){"use strict";(function(e){var i=n(6);t.exports={then:function(t,e){var n=this;return this._promise||(this._promise=new i((function(t,e){n._resolve=t,n._reject=e}))),0===arguments.length?this._promise:this._promise.then(t,e)},callback:function(t,e){return this.then((function(n){t.call(e,n)}))},errback:function(t,e){return this.then(null,(function(n){t.call(e,n)}))},timeout:function(t,n){this.then();var i=this;this._timer=e.setTimeout((function(){i._reject(n)}),1e3*t)},setDeferredStatus:function(t,n){this._timer&&e.clearTimeout(this._timer),this.then(),"succeeded"===t?this._resolve(n):"failed"===t?this._reject(n):delete this._promise}}}).call(this,n(2))},function(t,e,n){"use strict";var i=n(5),s={LOG_LEVELS:{fatal:4,error:3,warn:2,info:1,debug:0},writeLog:function(t,e){var n=s.logger||(s.wrapper||s).logger;if(n){var r=Array.prototype.slice.apply(t),o="[Faye",c=this.className,a=r.shift().replace(/\?/g,(function(){try{return i(r.shift())}catch(t){return"[Object]"}}));c&&(o+="."+c),o+="] ","function"==typeof n[e]?n[e](o+a):"function"==typeof n&&n(o+a)}}};for(var r in s.LOG_LEVELS)!function(t){s[t]=function(){this.writeLog(arguments,t)}}(r);t.exports=s},function(t,e,n){"use strict";var i={countListeners:function(t){return this.listeners(t).length},bind:function(t,e,n){var i=Array.prototype.slice,s=function(){e.apply(n,i.call(arguments))};return this._listeners=this._listeners||[],this._listeners.push([t,e,n,s]),this.on(t,s)},unbind:function(t,e,n){this._listeners=this._listeners||[];for(var i,s=this._listeners.length;s--;)(i=this._listeners[s])[0]===t&&(!e||i[1]===e&&i[2]===n)&&(this._listeners.splice(s,1),this.removeListener(t,i[3]))}};n(0)(i,n(28).prototype),i.trigger=i.emit,t.exports=i},,function(t,e,n){"use strict";t.exports={commonElement:function(t,e){for(var n=0,i=t.length;n<i;n++)if(-1!==this.indexOf(e,t[n]))return t[n];return null},indexOf:function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,i=t.length;n<i;n++)if(t[n]===e)return n;return-1},map:function(t,e,n){if(t.map)return t.map(e,n);var i=[];if(t instanceof Array)for(var s=0,r=t.length;s<r;s++)i.push(e.call(n||null,t[s],s));else for(var o in t)t.hasOwnProperty(o)&&i.push(e.call(n||null,o,t[o]));return i},filter:function(t,e,n){if(t.filter)return t.filter(e,n);for(var i=[],s=0,r=t.length;s<r;s++)e.call(n||null,t[s],s)&&i.push(t[s]);return i},asyncEach:function(t,e,n,i){var s=t.length,r=-1,o=0,c=!1,a=function(){if(o-=1,(r+=1)===s)return n&&n.call(i);e(t[r],h)},h=function(){o+=1,function(){if(!c){for(c=!0;o>0;)a();c=!1}}()};h()}}},function(t,e,n){"use strict";var i=function(t){var e,n,s;if(t instanceof Array){for(e=[],n=t.length;n--;)e[n]=i(t[n]);return e}if("object"==typeof t){for(s in e=null===t?null:{},t)e[s]=i(t[s]);return e}return t};t.exports=i},function(t,e,n){"use strict";var i=n(26),s=[],r=[],o=i.makeRequestCallFromTimer((function(){if(r.length)throw r.shift()}));function c(t){var e;(e=s.length?s.pop():new a).task=t,i(e)}function a(){this.task=null}t.exports=c,a.prototype.call=function(){try{this.task.call()}catch(t){c.onerror?c.onerror(t):(r.push(t),o())}finally{this.task=null,s[s.length]=this}}},function(t,e,n){"use strict";(function(e){var n={_registry:[],on:function(t,e,n,i){var s=function(){n.call(i)};t.addEventListener?t.addEventListener(e,s,!1):t.attachEvent("on"+e,s),this._registry.push({_element:t,_type:e,_callback:n,_context:i,_handler:s})},detach:function(t,e,n,i){for(var s,r=this._registry.length;r--;)s=this._registry[r],t&&t!==s._element||e&&e!==s._type||n&&n!==s._callback||i&&i!==s._context||(s._element.removeEventListener?s._element.removeEventListener(s._type,s._handler,!1):s._element.detachEvent("on"+s._type,s._handler),this._registry.splice(r,1),s=null)}};void 0!==e.onunload&&n.on(e,"unload",n.detach,n),t.exports={Event:n}}).call(this,n(2))},function(t,e,n){"use strict";var i=n(1),s=n(0),r=n(9),o=n(16),c=i({initialize:function(t){this.id=this.name=t},push:function(t){this.trigger("message",t)},isUnused:function(){return 0===this.countListeners("message")}});s(c.prototype,r),s(c,{HANDSHAKE:"/meta/handshake",CONNECT:"/meta/connect",SUBSCRIBE:"/meta/subscribe",UNSUBSCRIBE:"/meta/unsubscribe",DISCONNECT:"/meta/disconnect",META:"meta",SERVICE:"service",expand:function(t){var e=this.parse(t),n=["/**",t],i=e.slice();i[i.length-1]="*",n.push(this.unparse(i));for(var s=1,r=e.length;s<r;s++)(i=e.slice(0,s)).push("**"),n.push(this.unparse(i));return n},isValid:function(t){return o.CHANNEL_NAME.test(t)||o.CHANNEL_PATTERN.test(t)},parse:function(t){return this.isValid(t)?t.split("/").slice(1):null},unparse:function(t){return"/"+t.join("/")},isMeta:function(t){var e=this.parse(t);return e?e[0]===this.META:null},isService:function(t){var e=this.parse(t);return e?e[0]===this.SERVICE:null},isSubscribable:function(t){return this.isValid(t)?!this.isMeta(t)&&!this.isService(t):null},Set:i({initialize:function(){this._channels={}},getKeys:function(){var t=[];for(var e in this._channels)t.push(e);return t},remove:function(t){delete this._channels[t]},hasSubscription:function(t){return this._channels.hasOwnProperty(t)},subscribe:function(t,e){for(var n,i=0,s=t.length;i<s;i++){n=t[i],(this._channels[n]=this._channels[n]||new c(n)).bind("message",e)}},unsubscribe:function(t,e){var n=this._channels[t];return!!n&&(n.unbind("message",e),!!n.isUnused()&&(this.remove(t),!0))},distributeMessage:function(t){for(var e=c.expand(t.channel),n=0,i=e.length;n<i;n++){var s=this._channels[e[n]];s&&s.trigger("message",t)}}})}),t.exports=c},function(t,e,n){"use strict";t.exports={CHANNEL_NAME:/^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,CHANNEL_PATTERN:/^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,ERROR:/^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/,VERSION:/^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/}},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(3),r=n(18),o=n(0),c=n(8),a=n(9),h=n(19),u=n(22),l=i({className:"Dispatcher",MAX_REQUEST_SIZE:2048,DEFAULT_RETRY:5,UP:1,DOWN:2,initialize:function(t,e,n){this._client=t,this.endpoint=s.parse(e),this._alternates=n.endpoints||{},this.cookies=r.CookieJar&&new r.CookieJar,this._disabled=[],this._envelopes={},this.headers={},this.retry=n.retry||this.DEFAULT_RETRY,this._scheduler=n.scheduler||u,this._state=0,this.transports={},this.wsExtensions=[],this.proxy=n.proxy||{},"string"==typeof this._proxy&&(this._proxy={origin:this._proxy});var i=n.websocketExtensions;if(i)for(var o=0,c=(i=[].concat(i)).length;o<c;o++)this.addWebsocketExtension(i[o]);for(var a in this.tls=n.tls||{},this.tls.ca=this.tls.ca||n.ca,this._alternates)this._alternates[a]=s.parse(this._alternates[a]);this.maxRequestSize=this.MAX_REQUEST_SIZE},endpointFor:function(t){return this._alternates[t]||this.endpoint},addWebsocketExtension:function(t){this.wsExtensions.push(t)},disable:function(t){this._disabled.push(t),h.disable(t)},setHeader:function(t,e){this.headers[t]=e},close:function(){var t=this._transport;delete this._transport,t&&t.close()},getConnectionTypes:function(){return h.getConnectionTypes()},selectTransport:function(t){h.get(this,t,this._disabled,(function(t){this.debug("Selected ? transport for ?",t.connectionType,t.endpoint.href),t!==this._transport&&(this._transport&&this._transport.close(),this._transport=t,this.connectionType=t.connectionType)}),this)},sendMessage:function(t,e,n){n=n||{};var i,s=t.id,r=n.attempts,o=n.deadline&&(new Date).getTime()+1e3*n.deadline,c=this._envelopes[s];c||(i=new this._scheduler(t,{timeout:e,interval:this.retry,attempts:r,deadline:o}),c=this._envelopes[s]={message:t,scheduler:i}),this._sendEnvelope(c)},_sendEnvelope:function(t){if(this._transport&&!t.request&&!t.timer){var n=t.message,i=t.scheduler,s=this;if(!i.isDeliverable())return i.abort(),void delete this._envelopes[n.id];t.timer=e.setTimeout((function(){s.handleError(n)}),1e3*i.getTimeout()),i.send(),t.request=this._transport.sendMessage(n)}},handleResponse:function(t){var n=this._envelopes[t.id];void 0!==t.successful&&n&&(n.scheduler.succeed(),delete this._envelopes[t.id],e.clearTimeout(n.timer)),this.trigger("message",t),this._state!==this.UP&&(this._state=this.UP,this._client.trigger("transport:up"))},handleError:function(t,n){var i=this._envelopes[t.id],s=i&&i.request,r=this;if(s){s.then((function(t){t&&t.abort&&t.abort()}));var o=i.scheduler;o.fail(),e.clearTimeout(i.timer),i.request=i.timer=null,n?this._sendEnvelope(i):i.timer=e.setTimeout((function(){i.timer=null,r._sendEnvelope(i)}),1e3*o.getInterval()),this._state!==this.DOWN&&(this._state=this.DOWN,this._client.trigger("transport:down"))}}});l.create=function(t,e,n){return new l(t,e,n)},o(l.prototype,a),o(l.prototype,c),t.exports=l}).call(this,n(2))},function(t,e,n){"use strict";t.exports={}},function(t,e,n){"use strict";var i=n(4);i.register("websocket",n(30)),i.register("eventsource",n(32)),i.register("long-polling",n(21)),i.register("cross-origin-long-polling",n(33)),i.register("callback-polling",n(34)),t.exports=i},function(t,e,n){"use strict";var i=n(1);t.exports=i({initialize:function(){this._index={}},add:function(t){var e=void 0!==t.id?t.id:t;return!this._index.hasOwnProperty(e)&&(this._index[e]=t,!0)},forEach:function(t,e){for(var n in this._index)this._index.hasOwnProperty(n)&&t.call(e,this._index[n])},isEmpty:function(){for(var t in this._index)if(this._index.hasOwnProperty(t))return!1;return!0},member:function(t){for(var e in this._index)if(this._index[e]===t)return!0;return!1},remove:function(t){var e=void 0!==t.id?t.id:t,n=this._index[e];return delete this._index[e],n},toArray:function(){var t=[];return this.forEach((function(e){t.push(e)})),t}})},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(3),r=n(14),o=n(0),c=n(5),a=o(i(n(4),{encode:function(t){return c(t)},request:function(t){var n,i=this.endpoint.href,s=this;if(e.XMLHttpRequest)n=new XMLHttpRequest;else{if(!e.ActiveXObject)return this._handleError(t);n=new ActiveXObject("Microsoft.XMLHTTP")}n.open("POST",i,!0),n.setRequestHeader("Content-Type","application/json"),n.setRequestHeader("Pragma","no-cache"),n.setRequestHeader("X-Requested-With","XMLHttpRequest");var o=this._dispatcher.headers;for(var c in o)o.hasOwnProperty(c)&&n.setRequestHeader(c,o[c]);var a=function(){n.abort()};return void 0!==e.onbeforeunload&&r.Event.on(e,"beforeunload",a),n.onreadystatechange=function(){if(n&&4===n.readyState){var i=null,o=n.status,c=n.responseText,h=o>=200&&o<300||304===o||1223===o;if(void 0!==e.onbeforeunload&&r.Event.detach(e,"beforeunload",a),n.onreadystatechange=function(){},n=null,!h)return s._handleError(t);try{i=JSON.parse(c)}catch(t){}i?s._receive(i):s._handleError(t)}},n.send(this.encode(t)),n}}),{isUsable:function(t,e,n,i){var r="ReactNative"===navigator.product||s.isSameOrigin(e);n.call(i,r)}});t.exports=a}).call(this,n(2))},function(t,e,n){"use strict";var i=function(t,e){this.message=t,this.options=e,this.attempts=0};n(0)(i.prototype,{getTimeout:function(){return this.options.timeout},getInterval:function(){return this.options.interval},isDeliverable:function(){var t=this.options.attempts,e=this.attempts,n=this.options.deadline,i=(new Date).getTime();return!(void 0!==t&&e>=t)&&!(void 0!==n&&i>n)},send:function(){this.attempts+=1},succeed:function(){},fail:function(){},abort:function(){}}),t.exports=i},function(t,e){t.exports={VERSION:"1.4.0",BAYEUX_VERSION:"1.0",ID_LENGTH:160,JSONP_CALLBACK:"jsonpcallback",CONNECTION_TYPES:["long-polling","cross-origin-long-polling","callback-polling","websocket","eventsource","in-process"],MANDATORY_CONNECTION_TYPES:["long-polling","callback-polling","in-process"]}},function(t,e,n){"use strict";var i=n(1),s=n(0),r=n(7),o=i({initialize:function(t,e,n,i){this._client=t,this._channels=e,this._callback=n,this._context=i,this._cancelled=!1},withChannel:function(t,e){return this._withChannel=[t,e],this},apply:function(t,e){var n=e[0];this._callback&&this._callback.call(this._context,n.data),this._withChannel&&this._withChannel[0].call(this._withChannel[1],n.channel,n.data)},cancel:function(){this._cancelled||(this._client.unsubscribe(this._channels,this),this._cancelled=!0)},unsubscribe:function(){this.cancel()}});s(o.prototype,r),t.exports=o},function(t,e,n){"use strict";(function(e){var i=n(13),s=n(1),r=(n(6),n(11)),o=n(14),c=n(23),a=n(0),h=n(27),u=n(7),l=n(8),f=n(9),d=n(15),p=n(17),_=n(35),v=n(36),g=n(37),m=n(24),y=s({className:"Client",UNCONNECTED:1,CONNECTING:2,CONNECTED:3,DISCONNECTED:4,HANDSHAKE:"handshake",RETRY:"retry",NONE:"none",CONNECTION_TIMEOUT:60,DEFAULT_ENDPOINT:"/bayeux",INTERVAL:0,initialize:function(t,n){this.info("New client created for ?",t),h(n=n||{},["interval","timeout","endpoints","proxy","retry","scheduler","websocketExtensions","tls","ca"]),this._channels=new d.Set,this._dispatcher=p.create(this,t||this.DEFAULT_ENDPOINT,n),this._messageId=0,this._state=this.UNCONNECTED,this._responseCallbacks={},this._advice={reconnect:this.RETRY,interval:1e3*(n.interval||this.INTERVAL),timeout:1e3*(n.timeout||this.CONNECTION_TIMEOUT)},this._dispatcher.timeout=this._advice.timeout/1e3,this._dispatcher.bind("message",this._receiveMessage,this),o.Event&&void 0!==e.onbeforeunload&&o.Event.on(e,"beforeunload",(function(){r.indexOf(this._dispatcher._disabled,"autodisconnect")<0&&this.disconnect()}),this)},addWebsocketExtension:function(t){return this._dispatcher.addWebsocketExtension(t)},disable:function(t){return this._dispatcher.disable(t)},setHeader:function(t,e){return this._dispatcher.setHeader(t,e)},handshake:function(t,n){if(this._advice.reconnect!==this.NONE&&this._state===this.UNCONNECTED){this._state=this.CONNECTING;var s=this;this.info("Initiating handshake with ?",this._dispatcher.endpoint.href),this._dispatcher.selectTransport(c.MANDATORY_CONNECTION_TYPES),this._sendMessage({channel:d.HANDSHAKE,version:c.BAYEUX_VERSION,supportedConnectionTypes:this._dispatcher.getConnectionTypes()},{},(function(r){r.successful?(this._state=this.CONNECTED,this._dispatcher.clientId=r.clientId,this._dispatcher.selectTransport(r.supportedConnectionTypes),this.info("Handshake successful: ?",this._dispatcher.clientId),this.subscribe(this._channels.getKeys(),!0),t&&i((function(){t.call(n)}))):(this.info("Handshake unsuccessful"),e.setTimeout((function(){s.handshake(t,n)}),1e3*this._dispatcher.retry),this._state=this.UNCONNECTED)}),this)}},connect:function(t,e){if(this._advice.reconnect!==this.NONE&&this._state!==this.DISCONNECTED){if(this._state===this.UNCONNECTED)return this.handshake((function(){this.connect(t,e)}),this);this.callback(t,e),this._state===this.CONNECTED&&(this.info("Calling deferred actions for ?",this._dispatcher.clientId),this.setDeferredStatus("succeeded"),this.setDeferredStatus("unknown"),this._connectRequest||(this._connectRequest=!0,this.info("Initiating connection for ?",this._dispatcher.clientId),this._sendMessage({channel:d.CONNECT,clientId:this._dispatcher.clientId,connectionType:this._dispatcher.connectionType},{},this._cycleConnection,this)))}},disconnect:function(){if(this._state===this.CONNECTED){this._state=this.DISCONNECTED,this.info("Disconnecting ?",this._dispatcher.clientId);var t=new g;return this._sendMessage({channel:d.DISCONNECT,clientId:this._dispatcher.clientId},{},(function(e){e.successful?(this._dispatcher.close(),t.setDeferredStatus("succeeded")):t.setDeferredStatus("failed",_.parse(e.error))}),this),this.info("Clearing channel listeners for ?",this._dispatcher.clientId),this._channels=new d.Set,t}},subscribe:function(t,e,n){if(t instanceof Array)return r.map(t,(function(t){return this.subscribe(t,e,n)}),this);var i=new m(this,t,e,n),s=!0===e;return this._channels.hasSubscription(t)&&!s?(this._channels.subscribe([t],i),i.setDeferredStatus("succeeded"),i):(this.connect((function(){this.info("Client ? attempting to subscribe to ?",this._dispatcher.clientId,t),s||this._channels.subscribe([t],i),this._sendMessage({channel:d.SUBSCRIBE,clientId:this._dispatcher.clientId,subscription:t},{},(function(e){if(!e.successful)return i.setDeferredStatus("failed",_.parse(e.error)),this._channels.unsubscribe(t,i);var n=[].concat(e.subscription);this.info("Subscription acknowledged for ? to ?",this._dispatcher.clientId,n),i.setDeferredStatus("succeeded")}),this)}),this),i)},unsubscribe:function(t,e){if(t instanceof Array)return r.map(t,(function(t){return this.unsubscribe(t,e)}),this);this._channels.unsubscribe(t,e)&&this.connect((function(){this.info("Client ? attempting to unsubscribe from ?",this._dispatcher.clientId,t),this._sendMessage({channel:d.UNSUBSCRIBE,clientId:this._dispatcher.clientId,subscription:t},{},(function(t){if(t.successful){var e=[].concat(t.subscription);this.info("Unsubscription acknowledged for ? from ?",this._dispatcher.clientId,e)}}),this)}),this)},publish:function(t,e,n){h(n||{},["attempts","deadline"]);var i=new g;return this.connect((function(){this.info("Client ? queueing published message to ?: ?",this._dispatcher.clientId,t,e),this._sendMessage({channel:t,data:e,clientId:this._dispatcher.clientId},n,(function(t){t.successful?i.setDeferredStatus("succeeded"):i.setDeferredStatus("failed",_.parse(t.error))}),this)}),this),i},_sendMessage:function(t,e,n,i){t.id=this._generateMessageId();var s=this._advice.timeout?1.2*this._advice.timeout/1e3:1.2*this._dispatcher.retry;this.pipeThroughExtensions("outgoing",t,null,(function(t){t&&(n&&(this._responseCallbacks[t.id]=[n,i]),this._dispatcher.sendMessage(t,s,e||{}))}),this)},_generateMessageId:function(){return this._messageId+=1,this._messageId>=Math.pow(2,32)&&(this._messageId=0),this._messageId.toString(36)},_receiveMessage:function(t){var e,n=t.id;void 0!==t.successful&&(e=this._responseCallbacks[n],delete this._responseCallbacks[n]),this.pipeThroughExtensions("incoming",t,null,(function(t){t&&(t.advice&&this._handleAdvice(t.advice),this._deliverMessage(t),e&&e[0].call(e[1],t))}),this)},_handleAdvice:function(t){a(this._advice,t),this._dispatcher.timeout=this._advice.timeout/1e3,this._advice.reconnect===this.HANDSHAKE&&this._state!==this.DISCONNECTED&&(this._state=this.UNCONNECTED,this._dispatcher.clientId=null,this._cycleConnection())},_deliverMessage:function(t){t.channel&&void 0!==t.data&&(this.info("Client ? calling listeners for ? with ?",this._dispatcher.clientId,t.channel,t.data),this._channels.distributeMessage(t))},_cycleConnection:function(){this._connectRequest&&(this._connectRequest=null,this.info("Closed connection for ?",this._dispatcher.clientId));var t=this;e.setTimeout((function(){t.connect()}),this._advice.interval)}});a(y.prototype,u),a(y.prototype,f),a(y.prototype,l),a(y.prototype,v),t.exports=y}).call(this,n(2))},function(t,e,n){"use strict";(function(e){function n(t){s.length||(i(),!0),s[s.length]=t}t.exports=n;var i,s=[],r=0;function o(){for(;r<s.length;){var t=r;if(r+=1,s[t].call(),r>1024){for(var e=0,n=s.length-r;e<n;e++)s[e]=s[e+r];s.length-=r,r=0}}s.length=0,r=0,!1}var c,a,h,u=void 0!==e?e:self,l=u.MutationObserver||u.WebKitMutationObserver;function f(t){return function(){var e=setTimeout(i,0),n=setInterval(i,50);function i(){clearTimeout(e),clearInterval(n),t()}}}"function"==typeof l?(c=1,a=new l(o),h=document.createTextNode(""),a.observe(h,{characterData:!0}),i=function(){c=-c,h.data=c}):i=f(o),n.requestFlush=i,n.makeRequestCallFromTimer=f}).call(this,n(2))},function(t,e,n){"use strict";var i=n(11);t.exports=function(t,e){for(var n in t)if(i.indexOf(e,n)<0)throw new Error("Unrecognized option: "+n)}},function(t,e){var n="function"==typeof Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(){}t.exports=i,i.prototype.emit=function(t){if("error"===t&&(!this._events||!this._events.error||n(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var e=this._events[t];if(!e)return!1;if("function"==typeof e){switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:var i=Array.prototype.slice.call(arguments,1);e.apply(this,i)}return!0}if(n(e)){i=Array.prototype.slice.call(arguments,1);for(var s=e.slice(),r=0,o=s.length;r<o;r++)s[r].apply(this,i);return!0}return!1},i.prototype.addListener=function(t,e){if("function"!=typeof e)throw new Error("addListener only takes instances of Function");return this._events||(this._events={}),this.emit("newListener",t,e),this._events[t]?n(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){var n=this;return n.on(t,(function i(){n.removeListener(t,i),e.apply(this,arguments)})),this},i.prototype.removeListener=function(t,e){if("function"!=typeof e)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[t])return this;var i=this._events[t];if(n(i)){var s=function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(e===t[n])return n;return-1}(i,e);if(s<0)return this;i.splice(s,1),0==i.length&&delete this._events[t]}else this._events[t]===e&&delete this._events[t];return this},i.prototype.removeAllListeners=function(t){return 0===arguments.length?(this._events={},this):(t&&this._events&&this._events[t]&&(this._events[t]=null),this)},i.prototype.listeners=function(t){return this._events||(this._events={}),this._events[t]||(this._events[t]=[]),n(this._events[t])||(this._events[t]=[this._events[t]]),this._events[t]}},function(t,e,n){"use strict";(function(e){t.exports={addTimeout:function(t,n,i,s){if(this._timeouts=this._timeouts||{},!this._timeouts.hasOwnProperty(t)){var r=this;this._timeouts[t]=e.setTimeout((function(){delete r._timeouts[t],i.call(s)}),1e3*n)}},removeTimeout:function(t){this._timeouts=this._timeouts||{};var n=this._timeouts[t];n&&(e.clearTimeout(n),delete this._timeouts[t])},removeAllTimeouts:function(){for(var t in this._timeouts=this._timeouts||{},this._timeouts)this.removeTimeout(t)}}}).call(this,n(2))},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(6),r=n(20),o=n(3),c=n(14),a=n(12),h=n(0),u=n(5),l=n(31),f=n(7),d=h(i(n(4),{UNCONNECTED:1,CONNECTING:2,CONNECTED:3,batching:!1,isUsable:function(t,e){this.callback((function(){t.call(e,!0)})),this.errback((function(){t.call(e,!1)})),this.connect()},request:function(t){this._pending=this._pending||new r;for(var e=0,n=t.length;e<n;e++)this._pending.add(t[e]);var i=this,o=new s((function(e,n){i.callback((function(n){n&&1===n.readyState&&(n.send(u(t)),e(n))})),i.connect()}));return{abort:function(){o.then((function(t){t.close()}))}}},connect:function(){if(!d._unloaded&&(this._state=this._state||this.UNCONNECTED,this._state===this.UNCONNECTED)){this._state=this.CONNECTING;var t=this._createSocket();if(!t)return this.setDeferredStatus("failed");var e=this;t.onopen=function(){t.headers&&e._storeCookies(t.headers["set-cookie"]),e._socket=t,e._state=e.CONNECTED,e._everConnected=!0,e.setDeferredStatus("succeeded",t)};var n=!1;t.onclose=t.onerror=function(){if(!n){n=!0;var i=e._state===e.CONNECTED;t.onopen=t.onclose=t.onerror=t.onmessage=null,delete e._socket,e._state=e.UNCONNECTED;var s=e._pending?e._pending.toArray():[];delete e._pending,i||e._everConnected?(e.setDeferredStatus("unknown"),e._handleError(s,i)):e.setDeferredStatus("failed")}},t.onmessage=function(t){var n;try{n=JSON.parse(t.data)}catch(t){}if(n){for(var i=0,s=(n=[].concat(n)).length;i<s;i++)void 0!==n[i].successful&&e._pending.remove(n[i]);e._receive(n)}}}},close:function(){this._socket&&this._socket.close()},_createSocket:function(){var t=d.getSocketUrl(this.endpoint),e=this._dispatcher.headers,n=this._dispatcher.wsExtensions,i=this._getCookies(),s=this._dispatcher.tls,r={extensions:n,headers:e,proxy:this._proxy,tls:s};""!==i&&(r.headers.Cookie=i);try{return l.create(t,[],r)}catch(t){}}}),{PROTOCOLS:{"http:":"ws:","https:":"wss:"},create:function(t,e){var n=t.transports.websocket=t.transports.websocket||{};return n[e.href]=n[e.href]||new this(t,e),n[e.href]},getSocketUrl:function(t){return(t=a(t)).protocol=this.PROTOCOLS[t.protocol],o.stringify(t)},isUsable:function(t,e,n,i){this.create(t,e).isUsable(n,i)}});h(d.prototype,f),c.Event&&void 0!==e.onbeforeunload&&c.Event.on(e,"beforeunload",(function(){void 0===d._unloaded&&(d._unloaded=!0)})),t.exports=d}).call(this,n(2))},function(t,e,n){"use strict";(function(e){var n=e.MozWebSocket||e.WebSocket;t.exports={create:function(t,e,i){return"function"!=typeof n?null:new n(t)}}}).call(this,n(2))},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(3),r=n(12),o=n(0),c=n(7),a=n(4),h=n(21),u=o(i(a,{initialize:function(t,n){if(a.prototype.initialize.call(this,t,n),!e.EventSource)return this.setDeferredStatus("failed");this._xhr=new h(t,n),(n=r(n)).pathname+="/"+t.clientId;var i=new e.EventSource(s.stringify(n)),o=this;i.onopen=function(){o._everConnected=!0,o.setDeferredStatus("succeeded")},i.onerror=function(){o._everConnected?o._handleError([]):(o.setDeferredStatus("failed"),i.close())},i.onmessage=function(t){var e;try{e=JSON.parse(t.data)}catch(t){}e?o._receive(e):o._handleError([])},this._socket=i},close:function(){this._socket&&(this._socket.onopen=this._socket.onerror=this._socket.onmessage=null,this._socket.close(),delete this._socket)},isUsable:function(t,e){this.callback((function(){t.call(e,!0)})),this.errback((function(){t.call(e,!1)}))},encode:function(t){return this._xhr.encode(t)},request:function(t){return this._xhr.request(t)}}),{isUsable:function(t,e,n,i){if(!t.clientId)return n.call(i,!1);h.isUsable(t,e,(function(s){if(!s)return n.call(i,!1);this.create(t,e).isUsable(n,i)}),this)},create:function(t,e){var n=t.transports.eventsource=t.transports.eventsource||{},i=t.clientId,o=r(e);return o.pathname+="/"+(i||""),n[o=s.stringify(o)]=n[o]||new this(t,e),n[o]}});o(u.prototype,c),t.exports=u}).call(this,n(2))},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(20),r=n(3),o=n(0),c=n(5),a=o(i(n(4),{encode:function(t){return"message="+encodeURIComponent(c(t))},request:function(t){var n,i=e.XDomainRequest?XDomainRequest:XMLHttpRequest,s=new i,r=++a._id,o=this._dispatcher.headers,c=this;if(s.open("POST",this.endpoint.href,!0),s.withCredentials=!0,s.setRequestHeader)for(n in s.setRequestHeader("Pragma","no-cache"),o)o.hasOwnProperty(n)&&s.setRequestHeader(n,o[n]);var h=function(){if(!s)return!1;a._pending.remove(r),s.onload=s.onerror=s.ontimeout=s.onprogress=null,s=null};return s.onload=function(){var e;try{e=JSON.parse(s.responseText)}catch(t){}h(),e?c._receive(e):c._handleError(t)},s.onerror=s.ontimeout=function(){h(),c._handleError(t)},s.onprogress=function(){},i===e.XDomainRequest&&a._pending.add({id:r,xhr:s}),s.send(this.encode(t)),s}}),{_id:0,_pending:new s,isUsable:function(t,n,i,s){if(r.isSameOrigin(n))return i.call(s,!1);if(e.XDomainRequest)return i.call(s,n.protocol===location.protocol);if(e.XMLHttpRequest){var o=new XMLHttpRequest;return i.call(s,void 0!==o.withCredentials)}return i.call(s,!1)}});t.exports=a}).call(this,n(2))},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(3),r=n(12),o=n(0),c=n(5),a=o(i(n(4),{encode:function(t){var e=r(this.endpoint);return e.query.message=c(t),e.query.jsonp="__jsonp"+a._cbCount+"__",s.stringify(e)},request:function(t){var n=document.getElementsByTagName("head")[0],i=document.createElement("script"),o=a.getCallbackName(),h=r(this.endpoint),u=this;h.query.message=c(t),h.query.jsonp=o;var l=function(){if(!e[o])return!1;e[o]=void 0;try{delete e[o]}catch(t){}i.parentNode.removeChild(i)};return e[o]=function(t){l(),u._receive(t)},i.type="text/javascript",i.src=s.stringify(h),n.appendChild(i),i.onerror=function(){l(),u._handleError(t)},{abort:l}}}),{_cbCount:0,getCallbackName:function(){return this._cbCount+=1,"__jsonp"+this._cbCount+"__"},isUsable:function(t,e,n,i){n.call(i,!0)}});t.exports=a}).call(this,n(2))},function(t,e,n){"use strict";var i=n(1),s=n(16),r=i({initialize:function(t,e,n){this.code=t,this.params=Array.prototype.slice.call(e),this.message=n},toString:function(){return this.code+":"+this.params.join(",")+":"+this.message}});r.parse=function(t){if(t=t||"",!s.ERROR.test(t))return new r(null,[],t);var e=t.split(":"),n=parseInt(e[0]),i=e[1].split(",");t=e[2];return new r(n,i,t)};var o={versionMismatch:[300,"Version mismatch"],conntypeMismatch:[301,"Connection types not supported"],extMismatch:[302,"Extension mismatch"],badRequest:[400,"Bad request"],clientUnknown:[401,"Unknown client"],parameterMissing:[402,"Missing required parameter"],channelForbidden:[403,"Forbidden channel"],channelUnknown:[404,"Unknown channel"],channelInvalid:[405,"Invalid channel"],extUnknown:[406,"Unknown extension"],publishFailed:[407,"Failed to publish"],serverError:[500,"Internal server error"]};for(var c in o)!function(t){r[t]=function(){return new r(o[t][0],arguments,o[t][1]).toString()}}(c);t.exports=r},function(t,e,n){"use strict";var i={addExtension:function(t){this._extensions=this._extensions||[],this._extensions.push(t),t.added&&t.added(this)},removeExtension:function(t){if(this._extensions)for(var e=this._extensions.length;e--;)this._extensions[e]===t&&(this._extensions.splice(e,1),t.removed&&t.removed(this))},pipeThroughExtensions:function(t,e,n,i,s){if(this.debug("Passing through ? extensions: ?",t,e),!this._extensions)return i.call(s,e);var r=this._extensions.slice(),o=function(e){if(!e)return i.call(s,e);var c=r.shift();if(!c)return i.call(s,e);var a=c[t];if(!a)return o(e);a.length>=3?c[t](e,n,o):c[t](e,o)};o(e)}};n(0)(i,n(8)),t.exports=i},function(t,e,n){"use strict";var i=n(1),s=n(7);t.exports=i(s)},function(t,e,n){"use strict";var i=n(23),s=n(8),r={VERSION:i.VERSION,Client:n(25),Scheduler:n(22)};s.wrapper=r,t.exports=r}]);
2
+ //# sourceMappingURL=faye-browser-min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["webpack://Faye/webpack/bootstrap","webpack://Faye/./src/util/assign.js","webpack://Faye/./src/util/class.js","webpack://Faye/(webpack)/buildin/global.js","webpack://Faye/./src/util/uri.js","webpack://Faye/./src/transport/transport.js","webpack://Faye/./src/util/to_json.js","webpack://Faye/./src/util/promise.js","webpack://Faye/./src/mixins/deferrable.js","webpack://Faye/./src/mixins/logging.js","webpack://Faye/./src/mixins/publisher.js","webpack://Faye/./src/util/array.js","webpack://Faye/./src/util/copy_object.js","webpack://Faye/./node_modules/asap/browser-asap.js","webpack://Faye/./src/util/browser/event.js","webpack://Faye/./src/protocol/channel.js","webpack://Faye/./src/protocol/grammar.js","webpack://Faye/./src/protocol/dispatcher.js","webpack://Faye/./src/util/cookies/browser_cookies.js","webpack://Faye/./src/transport/browser_transports.js","webpack://Faye/./src/util/set.js","webpack://Faye/./src/transport/xhr.js","webpack://Faye/./src/protocol/scheduler.js","webpack://Faye/./src/util/constants.js","webpack://Faye/./src/protocol/subscription.js","webpack://Faye/./src/protocol/client.js","webpack://Faye/./node_modules/asap/browser-raw.js","webpack://Faye/./src/util/validate_options.js","webpack://Faye/./src/util/event_emitter.js","webpack://Faye/./src/mixins/timeouts.js","webpack://Faye/./src/transport/web_socket.js","webpack://Faye/./src/util/websocket/browser_websocket.js","webpack://Faye/./src/transport/event_source.js","webpack://Faye/./src/transport/cors.js","webpack://Faye/./src/transport/jsonp.js","webpack://Faye/./src/protocol/error.js","webpack://Faye/./src/protocol/extensible.js","webpack://Faye/./src/protocol/publication.js","webpack://Faye/./src/faye_browser.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","forEach","Array","hasOwn","target","arguments","source","assign","parent","methods","klass","this","initialize","apply","bridge","g","Function","e","window","isURI","uri","protocol","host","path","isSameOrigin","location","hostname","port","parse","url","parts","query","pairs","data","consume","pattern","replace","match","test","pathname","substr","auth","split","search","length","decodeURIComponent","href","stringify","string","queryString","hash","push","encodeURIComponent","join","Class","Cookie","Promise","array","Logging","Timeouts","Channel","Transport","className","DEFAULT_PORTS","MAX_DELAY","batching","dispatcher","endpoint","_dispatcher","_outbox","_proxy","proxy","origin","_findProxy","close","encode","messages","sendMessage","message","debug","clientId","_flushLargeBatch","channel","HANDSHAKE","_publish","CONNECT","_connectMessage","resolve","request","_makePromise","self","_requestPromise","_resolvePromise","delay","addTimeout","_flush","removeTimeout","advice","timeout","maxRequestSize","last","pop","_receive","replies","concat","connectionType","handleResponse","_handleError","immediate","handleError","_getCookies","cookies","map","getCookiesSync","cookie","cookieString","_storeCookies","setCookie","setCookieSync","process","keys","toLowerCase","upcase","toUpperCase","env","REQUEST_METHOD","filter","k","undefined","console","warn","allowed","disabled","callback","context","asyncEach","_transports","pair","resume","connType","connEndpoint","endpointFor","indexOf","isUsable","transport","Error","register","type","getConnectionTypes","disable","feature","_unloaded","JSON","asap","task","_state","_value","_defer","execute","then","onFulfilled","onRejected","promise","deferred","propagate","calls","rejectPromise","reason","reject","error","state","next","handler","pass","TypeError","getThen","fulfill","resolvePromise","settle","defer","all","promises","list","race","tuple","errback","_promise","_resolve","_reject","seconds","_timer","global","setTimeout","setDeferredStatus","status","clearTimeout","toJSON","LOG_LEVELS","fatal","info","writeLog","messageArgs","level","logger","wrapper","args","slice","banner","shift","Publisher","countListeners","eventType","listeners","listener","_listeners","on","unbind","splice","removeListener","trigger","emit","commonElement","lista","listb","needle","result","iterator","looping","iterate","loop","copyObject","clone","rawAsap","freeTasks","pendingErrors","requestErrorThrow","makeRequestCallFromTimer","rawTask","RawTask","onerror","Event","_registry","element","eventName","wrapped","addEventListener","attachEvent","_element","_type","_callback","_context","_handler","detach","removeEventListener","detachEvent","onunload","Grammar","id","isUnused","SUBSCRIBE","UNSUBSCRIBE","DISCONNECT","META","SERVICE","expand","segments","channels","copy","unparse","isValid","CHANNEL_NAME","CHANNEL_PATTERN","isMeta","isService","isSubscribable","Set","_channels","getKeys","remove","hasSubscription","subscribe","names","subscription","unsubscribe","distributeMessage","ERROR","VERSION","URI","Scheduler","Dispatcher","MAX_REQUEST_SIZE","DEFAULT_RETRY","UP","DOWN","client","options","_client","_alternates","endpoints","CookieJar","_disabled","_envelopes","headers","retry","_scheduler","scheduler","transports","wsExtensions","exts","websocketExtensions","addWebsocketExtension","tls","ca","extension","setHeader","_transport","selectTransport","transportTypes","attempts","deadline","Date","getTime","envelope","interval","_sendEnvelope","timer","isDeliverable","abort","getTimeout","send","reply","successful","succeed","req","fail","getInterval","_index","add","item","block","isEmpty","member","removed","toArray","browser","XHR","xhr","XMLHttpRequest","ActiveXObject","open","setRequestHeader","onbeforeunload","onreadystatechange","readyState","text","responseText","usable","navigator","product","made","now","BAYEUX_VERSION","ID_LENGTH","JSONP_CALLBACK","CONNECTION_TYPES","MANDATORY_CONNECTION_TYPES","Deferrable","Subscription","_cancelled","withChannel","_withChannel","cancel","constants","validateOptions","Extensible","Publication","Client","UNCONNECTED","CONNECTING","CONNECTED","DISCONNECTED","RETRY","NONE","CONNECTION_TIMEOUT","DEFAULT_ENDPOINT","INTERVAL","_messageId","_responseCallbacks","_advice","reconnect","_receiveMessage","disconnect","handshake","_sendMessage","version","supportedConnectionTypes","response","connect","_connectRequest","_cycleConnection","force","publish","publication","_generateMessageId","pipeThroughExtensions","Math","pow","toString","_handleAdvice","_deliverMessage","queue","requestFlush","index","flush","currentIndex","scan","newLength","toggle","observer","node","scope","BrowserMutationObserver","MutationObserver","WebKitMutationObserver","timeoutHandle","handleTimer","intervalHandle","setInterval","clearInterval","document","createTextNode","observe","characterData","validKeys","isArray","xs","EventEmitter","_events","addListener","once","x","removeAllListeners","_timeouts","removeAllTimeouts","ws","WebSocket","_pending","socket","_createSocket","onopen","_socket","_everConnected","closed","onclose","wasConnected","onmessage","pending","event","getSocketUrl","extensions","PROTOCOLS","sockets","websocket","WS","MozWebSocket","protocols","EventSource","_xhr","eventsource","CORS","xhrClass","XDomainRequest","_id","withCredentials","cleanUp","onload","ontimeout","onprogress","JSONP","jsonp","_cbCount","head","getElementsByTagName","script","createElement","callbackName","getCallbackName","cleanup","parentNode","removeChild","src","appendChild","code","params","parseInt","errors","versionMismatch","conntypeMismatch","extMismatch","badRequest","clientUnknown","parameterMissing","channelForbidden","channelUnknown","channelInvalid","extUnknown","publishFailed","serverError","addExtension","_extensions","added","removeExtension","stage","pipe","fn","Faye"],"mappings":"qBACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE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AAG6Q,EAAUuM,GAAOlb,EAASU,EAASya,GACnCxM,EAAUuM,GAAOlb,EAASmb,IAEhDA,EAAKnb,KAtCK,EAAQ,EA0CtBvE,CAAO+W,EAzCO,EAAQ,IA2CtBtZ,EAAOD,QAAUuZ,G,6BC5CjB,IAAIhU,EAAa,EAAQ,GACrBwT,EAAa,EAAQ,GAEzB9Y,EAAOD,QAAUuF,EAAMwT,I,6BCHvB,IAAIM,EAAY,EAAQ,IACpB1T,EAAY,EAAQ,GAEpByc,EAAO,CACTrO,QAAYsF,EAAUtF,QAEtB0F,OAAY,EAAQ,IACpBxF,UAAY,EAAQ,KAGtBtO,EAAQkJ,QAAUuT,EAElBniB,EAAOD,QAAUoiB","file":"build/client/faye-browser-min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 38);\n","'use strict';\n\nvar forEach = Array.prototype.forEach,\n hasOwn = Object.prototype.hasOwnProperty;\n\nmodule.exports = function(target) {\n forEach.call(arguments, function(source, i) {\n if (i === 0) return;\n\n for (var key in source) {\n if (hasOwn.call(source, key)) target[key] = source[key];\n }\n });\n\n return target;\n};\n","'use strict';\n\nvar assign = require('./assign');\n\nmodule.exports = function(parent, methods) {\n if (typeof parent !== 'function') {\n methods = parent;\n parent = Object;\n }\n\n var klass = function() {\n if (!this.initialize) return this;\n return this.initialize.apply(this, arguments) || this;\n };\n\n var bridge = function() {};\n bridge.prototype = parent.prototype;\n\n klass.prototype = new bridge();\n assign(klass.prototype, methods);\n\n return klass;\n};\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","'use strict';\n\nmodule.exports = {\n isURI: function(uri) {\n return uri && uri.protocol && uri.host && uri.path;\n },\n\n isSameOrigin: function(uri) {\n return uri.protocol === location.protocol &&\n uri.hostname === location.hostname &&\n uri.port === location.port;\n },\n\n parse: function(url) {\n if (typeof url !== 'string') return url;\n var uri = {}, parts, query, pairs, i, n, data;\n\n var consume = function(name, pattern) {\n url = url.replace(pattern, function(match) {\n uri[name] = match;\n return '';\n });\n uri[name] = uri[name] || '';\n };\n\n consume('protocol', /^[a-z]+\\:/i);\n consume('host', /^\\/\\/[^\\/\\?#]+/);\n\n if (!/^\\//.test(url) && !uri.host)\n url = location.pathname.replace(/[^\\/]*$/, '') + url;\n\n consume('pathname', /^[^\\?#]*/);\n consume('search', /^\\?[^#]*/);\n consume('hash', /^#.*/);\n\n uri.protocol = uri.protocol || location.protocol;\n\n if (uri.host) {\n uri.host = uri.host.substr(2);\n\n if (/@/.test(uri.host)) {\n uri.auth = uri.host.split('@')[0];\n uri.host = uri.host.split('@')[1];\n }\n parts = uri.host.match(/^\\[([^\\]]+)\\]|^[^:]+/);\n uri.hostname = parts[1] || parts[0];\n uri.port = (uri.host.match(/:(\\d+)$/) || [])[1] || '';\n } else {\n uri.host = location.host;\n uri.hostname = location.hostname;\n uri.port = location.port;\n }\n\n uri.pathname = uri.pathname || '/';\n uri.path = uri.pathname + uri.search;\n\n query = uri.search.replace(/^\\?/, '');\n pairs = query ? query.split('&') : [];\n data = {};\n\n for (i = 0, n = pairs.length; i < n; i++) {\n parts = pairs[i].split('=');\n data[decodeURIComponent(parts[0] || '')] = decodeURIComponent(parts[1] || '');\n }\n\n uri.query = data;\n\n uri.href = this.stringify(uri);\n return uri;\n },\n\n stringify: function(uri) {\n var auth = uri.auth ? uri.auth + '@' : '',\n string = uri.protocol + '//' + auth + uri.host;\n\n string += uri.pathname + this.queryString(uri.query) + (uri.hash || '');\n\n return string;\n },\n\n queryString: function(query) {\n var pairs = [];\n for (var key in query) {\n if (!query.hasOwnProperty(key)) continue;\n pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(query[key]));\n }\n if (pairs.length === 0) return '';\n return '?' + pairs.join('&');\n }\n};\n","'use strict';\n\nvar Class = require('../util/class'),\n Cookie = require('../util/cookies').Cookie,\n Promise = require('../util/promise'),\n array = require('../util/array'),\n assign = require('../util/assign'),\n Logging = require('../mixins/logging'),\n Timeouts = require('../mixins/timeouts'),\n Channel = require('../protocol/channel');\n\nvar Transport = assign(Class({ className: 'Transport',\n DEFAULT_PORTS: { 'http:': 80, 'https:': 443, 'ws:': 80, 'wss:': 443 },\n MAX_DELAY: 0,\n\n batching: true,\n\n initialize: function(dispatcher, endpoint) {\n this._dispatcher = dispatcher;\n this.endpoint = endpoint;\n this._outbox = [];\n this._proxy = assign({}, this._dispatcher.proxy);\n\n if (!this._proxy.origin)\n this._proxy.origin = this._findProxy();\n },\n\n close: function() {},\n\n encode: function(messages) {\n return '';\n },\n\n sendMessage: function(message) {\n this.debug('Client ? sending message to ?: ?',\n this._dispatcher.clientId, this.endpoint.href, message);\n\n if (!this.batching) return Promise.resolve(this.request([message]));\n\n this._outbox.push(message);\n this._flushLargeBatch();\n\n if (message.channel === Channel.HANDSHAKE)\n return this._publish(0.01);\n\n if (message.channel === Channel.CONNECT)\n this._connectMessage = message;\n\n return this._publish(this.MAX_DELAY);\n },\n\n _makePromise: function() {\n var self = this;\n\n this._requestPromise = this._requestPromise || new Promise(function(resolve) {\n self._resolvePromise = resolve;\n });\n },\n\n _publish: function(delay) {\n this._makePromise();\n\n this.addTimeout('publish', delay, function() {\n this._flush();\n delete this._requestPromise;\n }, this);\n\n return this._requestPromise;\n },\n\n _flush: function() {\n this.removeTimeout('publish');\n\n if (this._outbox.length > 1 && this._connectMessage)\n this._connectMessage.advice = { timeout: 0 };\n\n this._resolvePromise(this.request(this._outbox));\n\n this._connectMessage = null;\n this._outbox = [];\n },\n\n _flushLargeBatch: function() {\n var string = this.encode(this._outbox);\n if (string.length < this._dispatcher.maxRequestSize) return;\n var last = this._outbox.pop();\n\n this._makePromise();\n this._flush();\n\n if (last) this._outbox.push(last);\n },\n\n _receive: function(replies) {\n if (!replies) return;\n replies = [].concat(replies);\n\n this.debug('Client ? received from ? via ?: ?',\n this._dispatcher.clientId, this.endpoint.href, this.connectionType, replies);\n\n for (var i = 0, n = replies.length; i < n; i++)\n this._dispatcher.handleResponse(replies[i]);\n },\n\n _handleError: function(messages, immediate) {\n messages = [].concat(messages);\n\n this.debug('Client ? failed to send to ? via ?: ?',\n this._dispatcher.clientId, this.endpoint.href, this.connectionType, messages);\n\n for (var i = 0, n = messages.length; i < n; i++)\n this._dispatcher.handleError(messages[i]);\n },\n\n _getCookies: function() {\n var cookies = this._dispatcher.cookies,\n url = this.endpoint.href;\n\n if (!cookies) return '';\n\n return array.map(cookies.getCookiesSync(url), function(cookie) {\n return cookie.cookieString();\n }).join('; ');\n },\n\n _storeCookies: function(setCookie) {\n var cookies = this._dispatcher.cookies,\n url = this.endpoint.href,\n cookie;\n\n if (!setCookie || !cookies) return;\n setCookie = [].concat(setCookie);\n\n for (var i = 0, n = setCookie.length; i < n; i++) {\n cookie = Cookie.parse(setCookie[i]);\n cookies.setCookieSync(cookie, url);\n }\n },\n\n _findProxy: function() {\n if (typeof process === 'undefined') return undefined;\n\n var protocol = this.endpoint.protocol;\n if (!protocol) return undefined;\n\n var name = protocol.replace(/:$/, '').toLowerCase() + '_proxy',\n upcase = name.toUpperCase(),\n env = process.env,\n keys, proxy;\n\n if (name === 'http_proxy' && env.REQUEST_METHOD) {\n keys = Object.keys(env).filter(function(k) { return /^http_proxy$/i.test(k) });\n if (keys.length === 1) {\n if (keys[0] === name && env[upcase] === undefined)\n proxy = env[name];\n } else if (keys.length > 1) {\n proxy = env[name];\n }\n proxy = proxy || env['CGI_' + upcase];\n } else {\n proxy = env[name] || env[upcase];\n if (proxy && !env[name])\n console.warn('The environment variable ' + upcase +\n ' is discouraged. Use ' + name + '.');\n }\n return proxy;\n }\n\n}), {\n get: function(dispatcher, allowed, disabled, callback, context) {\n var endpoint = dispatcher.endpoint;\n\n array.asyncEach(this._transports, function(pair, resume) {\n var connType = pair[0], klass = pair[1],\n connEndpoint = dispatcher.endpointFor(connType);\n\n if (array.indexOf(disabled, connType) >= 0)\n return resume();\n\n if (array.indexOf(allowed, connType) < 0) {\n klass.isUsable(dispatcher, connEndpoint, function() {});\n return resume();\n }\n\n klass.isUsable(dispatcher, connEndpoint, function(isUsable) {\n if (!isUsable) return resume();\n var transport = klass.hasOwnProperty('create') ? klass.create(dispatcher, connEndpoint) : new klass(dispatcher, connEndpoint);\n callback.call(context, transport);\n });\n }, function() {\n throw new Error('Could not find a usable connection type for ' + endpoint.href);\n });\n },\n\n register: function(type, klass) {\n this._transports.push([type, klass]);\n klass.prototype.connectionType = type;\n },\n\n getConnectionTypes: function() {\n return array.map(this._transports, function(t) { return t[0] });\n },\n\n disable: function(feature) {\n if (feature !== 'autodisconnect') return;\n\n for (var i = 0; i < this._transports.length; i++)\n this._transports[i][1]._unloaded = false;\n },\n\n _transports: []\n});\n\nassign(Transport.prototype, Logging);\nassign(Transport.prototype, Timeouts);\n\nmodule.exports = Transport;\n","'use strict';\n\n// http://assanka.net/content/tech/2009/09/02/json2-js-vs-prototype/\n\nmodule.exports = function(object) {\n return JSON.stringify(object, function(key, value) {\n return (this[key] instanceof Array) ? this[key] : value;\n });\n};\n","'use strict';\n\nvar asap = require('asap');\n\nvar PENDING = -1,\n FULFILLED = 0,\n REJECTED = 1;\n\nvar Promise = function(task) {\n this._state = PENDING;\n this._value = null;\n this._defer = [];\n\n execute(this, task);\n};\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n var promise = new Promise();\n\n var deferred = {\n promise: promise,\n onFulfilled: onFulfilled,\n onRejected: onRejected\n };\n\n if (this._state === PENDING)\n this._defer.push(deferred);\n else\n propagate(this, deferred);\n\n return promise;\n};\n\nPromise.prototype['catch'] = function(onRejected) {\n return this.then(null, onRejected);\n};\n\nvar execute = function(promise, task) {\n if (typeof task !== 'function') return;\n\n var calls = 0;\n\n var resolvePromise = function(value) {\n if (calls++ === 0) resolve(promise, value);\n };\n\n var rejectPromise = function(reason) {\n if (calls++ === 0) reject(promise, reason);\n };\n\n try {\n task(resolvePromise, rejectPromise);\n } catch (error) {\n rejectPromise(error);\n }\n};\n\nvar propagate = function(promise, deferred) {\n var state = promise._state,\n value = promise._value,\n next = deferred.promise,\n handler = [deferred.onFulfilled, deferred.onRejected][state],\n pass = [resolve, reject][state];\n\n if (typeof handler !== 'function')\n return pass(next, value);\n\n asap(function() {\n try {\n resolve(next, handler(value));\n } catch (error) {\n reject(next, error);\n }\n });\n};\n\nvar resolve = function(promise, value) {\n if (promise === value)\n return reject(promise, new TypeError('Recursive promise chain detected'));\n\n var then;\n\n try {\n then = getThen(value);\n } catch (error) {\n return reject(promise, error);\n }\n\n if (!then) return fulfill(promise, value);\n\n execute(promise, function(resolvePromise, rejectPromise) {\n then.call(value, resolvePromise, rejectPromise);\n });\n};\n\nvar getThen = function(value) {\n var type = typeof value,\n then = (type === 'object' || type === 'function') && value && value.then;\n\n return (typeof then === 'function')\n ? then\n : null;\n};\n\nvar fulfill = function(promise, value) {\n settle(promise, FULFILLED, value);\n};\n\nvar reject = function(promise, reason) {\n settle(promise, REJECTED, reason);\n};\n\nvar settle = function(promise, state, value) {\n var defer = promise._defer, i = 0;\n\n promise._state = state;\n promise._value = value;\n promise._defer = null;\n\n if (defer.length === 0) return;\n while (i < defer.length) propagate(promise, defer[i++]);\n};\n\nPromise.resolve = function(value) {\n try {\n if (getThen(value)) return value;\n } catch (error) {\n return Promise.reject(error);\n }\n\n return new Promise(function(resolve, reject) { resolve(value) });\n};\n\nPromise.reject = function(reason) {\n return new Promise(function(resolve, reject) { reject(reason) });\n};\n\nPromise.all = function(promises) {\n return new Promise(function(resolve, reject) {\n var list = [], n = promises.length, i;\n\n if (n === 0) return resolve(list);\n\n var push = function(promise, i) {\n Promise.resolve(promise).then(function(value) {\n list[i] = value;\n if (--n === 0) resolve(list);\n }, reject);\n };\n\n for (i = 0; i < n; i++) push(promises[i], i);\n });\n};\n\nPromise.race = function(promises) {\n return new Promise(function(resolve, reject) {\n for (var i = 0, n = promises.length; i < n; i++)\n Promise.resolve(promises[i]).then(resolve, reject);\n });\n};\n\nPromise.deferred = function() {\n var tuple = {};\n\n tuple.promise = new Promise(function(resolve, reject) {\n tuple.resolve = resolve;\n tuple.reject = reject;\n });\n return tuple;\n};\n\nmodule.exports = Promise;\n","'use strict';\n\nvar Promise = require('../util/promise');\n\nmodule.exports = {\n then: function(callback, errback) {\n var self = this;\n if (!this._promise)\n this._promise = new Promise(function(resolve, reject) {\n self._resolve = resolve;\n self._reject = reject;\n });\n\n if (arguments.length === 0)\n return this._promise;\n else\n return this._promise.then(callback, errback);\n },\n\n callback: function(callback, context) {\n return this.then(function(value) { callback.call(context, value) });\n },\n\n errback: function(callback, context) {\n return this.then(null, function(reason) { callback.call(context, reason) });\n },\n\n timeout: function(seconds, message) {\n this.then();\n var self = this;\n this._timer = global.setTimeout(function() {\n self._reject(message);\n }, seconds * 1000);\n },\n\n setDeferredStatus: function(status, value) {\n if (this._timer) global.clearTimeout(this._timer);\n\n this.then();\n\n if (status === 'succeeded')\n this._resolve(value);\n else if (status === 'failed')\n this._reject(value);\n else\n delete this._promise;\n }\n};\n","'use strict';\n\nvar toJSON = require('../util/to_json');\n\nvar Logging = {\n LOG_LEVELS: {\n fatal: 4,\n error: 3,\n warn: 2,\n info: 1,\n debug: 0\n },\n\n writeLog: function(messageArgs, level) {\n var logger = Logging.logger || (Logging.wrapper || Logging).logger;\n if (!logger) return;\n\n var args = Array.prototype.slice.apply(messageArgs),\n banner = '[Faye',\n klass = this.className,\n\n message = args.shift().replace(/\\?/g, function() {\n try {\n return toJSON(args.shift());\n } catch (error) {\n return '[Object]';\n }\n });\n\n if (klass) banner += '.' + klass;\n banner += '] ';\n\n if (typeof logger[level] === 'function')\n logger[level](banner + message);\n else if (typeof logger === 'function')\n logger(banner + message);\n }\n};\n\nfor (var key in Logging.LOG_LEVELS)\n (function(level) {\n Logging[level] = function() {\n this.writeLog(arguments, level);\n };\n })(key);\n\nmodule.exports = Logging;\n","'use strict';\n\nvar assign = require('../util/assign'),\n EventEmitter = require('../util/event_emitter');\n\nvar Publisher = {\n countListeners: function(eventType) {\n return this.listeners(eventType).length;\n },\n\n bind: function(eventType, listener, context) {\n var slice = Array.prototype.slice,\n handler = function() { listener.apply(context, slice.call(arguments)) };\n\n this._listeners = this._listeners || [];\n this._listeners.push([eventType, listener, context, handler]);\n return this.on(eventType, handler);\n },\n\n unbind: function(eventType, listener, context) {\n this._listeners = this._listeners || [];\n var n = this._listeners.length, tuple;\n\n while (n--) {\n tuple = this._listeners[n];\n if (tuple[0] !== eventType) continue;\n if (listener && (tuple[1] !== listener || tuple[2] !== context)) continue;\n this._listeners.splice(n, 1);\n this.removeListener(eventType, tuple[3]);\n }\n }\n};\n\nassign(Publisher, EventEmitter.prototype);\nPublisher.trigger = Publisher.emit;\n\nmodule.exports = Publisher;\n","'use strict';\n\nmodule.exports = {\n commonElement: function(lista, listb) {\n for (var i = 0, n = lista.length; i < n; i++) {\n if (this.indexOf(listb, lista[i]) !== -1)\n return lista[i];\n }\n return null;\n },\n\n indexOf: function(list, needle) {\n if (list.indexOf) return list.indexOf(needle);\n\n for (var i = 0, n = list.length; i < n; i++) {\n if (list[i] === needle) return i;\n }\n return -1;\n },\n\n map: function(object, callback, context) {\n if (object.map) return object.map(callback, context);\n var result = [];\n\n if (object instanceof Array) {\n for (var i = 0, n = object.length; i < n; i++) {\n result.push(callback.call(context || null, object[i], i));\n }\n } else {\n for (var key in object) {\n if (!object.hasOwnProperty(key)) continue;\n result.push(callback.call(context || null, key, object[key]));\n }\n }\n return result;\n },\n\n filter: function(array, callback, context) {\n if (array.filter) return array.filter(callback, context);\n var result = [];\n for (var i = 0, n = array.length; i < n; i++) {\n if (callback.call(context || null, array[i], i))\n result.push(array[i]);\n }\n return result;\n },\n\n asyncEach: function(list, iterator, callback, context) {\n var n = list.length,\n i = -1,\n calls = 0,\n looping = false;\n\n var iterate = function() {\n calls -= 1;\n i += 1;\n if (i === n) return callback && callback.call(context);\n iterator(list[i], resume);\n };\n\n var loop = function() {\n if (looping) return;\n looping = true;\n while (calls > 0) iterate();\n looping = false;\n };\n\n var resume = function() {\n calls += 1;\n loop();\n };\n resume();\n }\n};\n","'use strict';\n\nvar copyObject = function(object) {\n var clone, i, key;\n if (object instanceof Array) {\n clone = [];\n i = object.length;\n while (i--) clone[i] = copyObject(object[i]);\n return clone;\n } else if (typeof object === 'object') {\n clone = (object === null) ? null : {};\n for (key in object) clone[key] = copyObject(object[key]);\n return clone;\n } else {\n return object;\n }\n};\n\nmodule.exports = copyObject;\n","\"use strict\";\n\n// rawAsap provides everything we need except exception management.\nvar rawAsap = require(\"./raw\");\n// RawTasks are recycled to reduce GC churn.\nvar freeTasks = [];\n// We queue errors to ensure they are thrown in right order (FIFO).\n// Array-as-queue is good enough here, since we are just dealing with exceptions.\nvar pendingErrors = [];\nvar requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);\n\nfunction throwFirstError() {\n if (pendingErrors.length) {\n throw pendingErrors.shift();\n }\n}\n\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\nmodule.exports = asap;\nfunction asap(task) {\n var rawTask;\n if (freeTasks.length) {\n rawTask = freeTasks.pop();\n } else {\n rawTask = new RawTask();\n }\n rawTask.task = task;\n rawAsap(rawTask);\n}\n\n// We wrap tasks with recyclable task objects. A task object implements\n// `call`, just like a function.\nfunction RawTask() {\n this.task = null;\n}\n\n// The sole purpose of wrapping the task is to catch the exception and recycle\n// the task object after its single use.\nRawTask.prototype.call = function () {\n try {\n this.task.call();\n } catch (error) {\n if (asap.onerror) {\n // This hook exists purely for testing purposes.\n // Its name will be periodically randomized to break any code that\n // depends on its existence.\n asap.onerror(error);\n } else {\n // In a web browser, exceptions are not fatal. However, to avoid\n // slowing down the queue of pending tasks, we rethrow the error in a\n // lower priority turn.\n pendingErrors.push(error);\n requestErrorThrow();\n }\n } finally {\n this.task = null;\n freeTasks[freeTasks.length] = this;\n }\n};\n","'use strict';\n\nvar Event = {\n _registry: [],\n\n on: function(element, eventName, callback, context) {\n var wrapped = function() { callback.call(context) };\n\n if (element.addEventListener)\n element.addEventListener(eventName, wrapped, false);\n else\n element.attachEvent('on' + eventName, wrapped);\n\n this._registry.push({\n _element: element,\n _type: eventName,\n _callback: callback,\n _context: context,\n _handler: wrapped\n });\n },\n\n detach: function(element, eventName, callback, context) {\n var i = this._registry.length, register;\n while (i--) {\n register = this._registry[i];\n\n if ((element && element !== register._element) ||\n (eventName && eventName !== register._type) ||\n (callback && callback !== register._callback) ||\n (context && context !== register._context))\n continue;\n\n if (register._element.removeEventListener)\n register._element.removeEventListener(register._type, register._handler, false);\n else\n register._element.detachEvent('on' + register._type, register._handler);\n\n this._registry.splice(i,1);\n register = null;\n }\n }\n};\n\nif (global.onunload !== undefined)\n Event.on(global, 'unload', Event.detach, Event);\n\nmodule.exports = {\n Event: Event\n};\n","'use strict';\n\nvar Class = require('../util/class'),\n assign = require('../util/assign'),\n Publisher = require('../mixins/publisher'),\n Grammar = require('./grammar');\n\nvar Channel = Class({\n initialize: function(name) {\n this.id = this.name = name;\n },\n\n push: function(message) {\n this.trigger('message', message);\n },\n\n isUnused: function() {\n return this.countListeners('message') === 0;\n }\n});\n\nassign(Channel.prototype, Publisher);\n\nassign(Channel, {\n HANDSHAKE: '/meta/handshake',\n CONNECT: '/meta/connect',\n SUBSCRIBE: '/meta/subscribe',\n UNSUBSCRIBE: '/meta/unsubscribe',\n DISCONNECT: '/meta/disconnect',\n\n META: 'meta',\n SERVICE: 'service',\n\n expand: function(name) {\n var segments = this.parse(name),\n channels = ['/**', name];\n\n var copy = segments.slice();\n copy[copy.length - 1] = '*';\n channels.push(this.unparse(copy));\n\n for (var i = 1, n = segments.length; i < n; i++) {\n copy = segments.slice(0, i);\n copy.push('**');\n channels.push(this.unparse(copy));\n }\n\n return channels;\n },\n\n isValid: function(name) {\n return Grammar.CHANNEL_NAME.test(name) ||\n Grammar.CHANNEL_PATTERN.test(name);\n },\n\n parse: function(name) {\n if (!this.isValid(name)) return null;\n return name.split('/').slice(1);\n },\n\n unparse: function(segments) {\n return '/' + segments.join('/');\n },\n\n isMeta: function(name) {\n var segments = this.parse(name);\n return segments ? (segments[0] === this.META) : null;\n },\n\n isService: function(name) {\n var segments = this.parse(name);\n return segments ? (segments[0] === this.SERVICE) : null;\n },\n\n isSubscribable: function(name) {\n if (!this.isValid(name)) return null;\n return !this.isMeta(name) && !this.isService(name);\n },\n\n Set: Class({\n initialize: function() {\n this._channels = {};\n },\n\n getKeys: function() {\n var keys = [];\n for (var key in this._channels) keys.push(key);\n return keys;\n },\n\n remove: function(name) {\n delete this._channels[name];\n },\n\n hasSubscription: function(name) {\n return this._channels.hasOwnProperty(name);\n },\n\n subscribe: function(names, subscription) {\n var name;\n for (var i = 0, n = names.length; i < n; i++) {\n name = names[i];\n var channel = this._channels[name] = this._channels[name] || new Channel(name);\n channel.bind('message', subscription);\n }\n },\n\n unsubscribe: function(name, subscription) {\n var channel = this._channels[name];\n if (!channel) return false;\n channel.unbind('message', subscription);\n\n if (channel.isUnused()) {\n this.remove(name);\n return true;\n } else {\n return false;\n }\n },\n\n distributeMessage: function(message) {\n var channels = Channel.expand(message.channel);\n\n for (var i = 0, n = channels.length; i < n; i++) {\n var channel = this._channels[channels[i]];\n if (channel) channel.trigger('message', message);\n }\n }\n })\n});\n\nmodule.exports = Channel;\n","'use strict';\n\nmodule.exports = {\n CHANNEL_NAME: /^\\/(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)))+(\\/(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)))+)*$/,\n CHANNEL_PATTERN: /^(\\/(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)))+)*\\/\\*{1,2}$/,\n ERROR: /^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)| |\\/|\\*|\\.))*(,(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)| |\\/|\\*|\\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)| |\\/|\\*|\\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\\-|\\_|\\!|\\~|\\(|\\)|\\$|\\@)| |\\/|\\*|\\.))*)$/,\n VERSION: /^([0-9])+(\\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\\-|\\_))*)*$/\n};\n","'use strict';\n\nvar Class = require('../util/class'),\n URI = require('../util/uri'),\n cookies = require('../util/cookies'),\n assign = require('../util/assign'),\n Logging = require('../mixins/logging'),\n Publisher = require('../mixins/publisher'),\n Transport = require('../transport'),\n Scheduler = require('./scheduler');\n\nvar Dispatcher = Class({ className: 'Dispatcher',\n MAX_REQUEST_SIZE: 2048,\n DEFAULT_RETRY: 5,\n\n UP: 1,\n DOWN: 2,\n\n initialize: function(client, endpoint, options) {\n this._client = client;\n this.endpoint = URI.parse(endpoint);\n this._alternates = options.endpoints || {};\n\n this.cookies = cookies.CookieJar && new cookies.CookieJar();\n this._disabled = [];\n this._envelopes = {};\n this.headers = {};\n this.retry = options.retry || this.DEFAULT_RETRY;\n this._scheduler = options.scheduler || Scheduler;\n this._state = 0;\n this.transports = {};\n this.wsExtensions = [];\n\n this.proxy = options.proxy || {};\n if (typeof this._proxy === 'string') this._proxy = { origin: this._proxy };\n\n var exts = options.websocketExtensions;\n if (exts) {\n exts = [].concat(exts);\n for (var i = 0, n = exts.length; i < n; i++)\n this.addWebsocketExtension(exts[i]);\n }\n\n this.tls = options.tls || {};\n this.tls.ca = this.tls.ca || options.ca;\n\n for (var type in this._alternates)\n this._alternates[type] = URI.parse(this._alternates[type]);\n\n this.maxRequestSize = this.MAX_REQUEST_SIZE;\n },\n\n endpointFor: function(connectionType) {\n return this._alternates[connectionType] || this.endpoint;\n },\n\n addWebsocketExtension: function(extension) {\n this.wsExtensions.push(extension);\n },\n\n disable: function(feature) {\n this._disabled.push(feature);\n Transport.disable(feature);\n },\n\n setHeader: function(name, value) {\n this.headers[name] = value;\n },\n\n close: function() {\n var transport = this._transport;\n delete this._transport;\n if (transport) transport.close();\n },\n\n getConnectionTypes: function() {\n return Transport.getConnectionTypes();\n },\n\n selectTransport: function(transportTypes) {\n Transport.get(this, transportTypes, this._disabled, function(transport) {\n this.debug('Selected ? transport for ?', transport.connectionType, transport.endpoint.href);\n\n if (transport === this._transport) return;\n if (this._transport) this._transport.close();\n\n this._transport = transport;\n this.connectionType = transport.connectionType;\n }, this);\n },\n\n sendMessage: function(message, timeout, options) {\n options = options || {};\n\n var id = message.id,\n attempts = options.attempts,\n deadline = options.deadline && new Date().getTime() + (options.deadline * 1000),\n envelope = this._envelopes[id],\n scheduler;\n\n if (!envelope) {\n scheduler = new this._scheduler(message, { timeout: timeout, interval: this.retry, attempts: attempts, deadline: deadline });\n envelope = this._envelopes[id] = { message: message, scheduler: scheduler };\n }\n\n this._sendEnvelope(envelope);\n },\n\n _sendEnvelope: function(envelope) {\n if (!this._transport) return;\n if (envelope.request || envelope.timer) return;\n\n var message = envelope.message,\n scheduler = envelope.scheduler,\n self = this;\n\n if (!scheduler.isDeliverable()) {\n scheduler.abort();\n delete this._envelopes[message.id];\n return;\n }\n\n envelope.timer = global.setTimeout(function() {\n self.handleError(message);\n }, scheduler.getTimeout() * 1000);\n\n scheduler.send();\n envelope.request = this._transport.sendMessage(message);\n },\n\n handleResponse: function(reply) {\n var envelope = this._envelopes[reply.id];\n\n if (reply.successful !== undefined && envelope) {\n envelope.scheduler.succeed();\n delete this._envelopes[reply.id];\n global.clearTimeout(envelope.timer);\n }\n\n this.trigger('message', reply);\n\n if (this._state === this.UP) return;\n this._state = this.UP;\n this._client.trigger('transport:up');\n },\n\n handleError: function(message, immediate) {\n var envelope = this._envelopes[message.id],\n request = envelope && envelope.request,\n self = this;\n\n if (!request) return;\n\n request.then(function(req) {\n if (req && req.abort) req.abort();\n });\n\n var scheduler = envelope.scheduler;\n scheduler.fail();\n\n global.clearTimeout(envelope.timer);\n envelope.request = envelope.timer = null;\n\n if (immediate) {\n this._sendEnvelope(envelope);\n } else {\n envelope.timer = global.setTimeout(function() {\n envelope.timer = null;\n self._sendEnvelope(envelope);\n }, scheduler.getInterval() * 1000);\n }\n\n if (this._state === this.DOWN) return;\n this._state = this.DOWN;\n this._client.trigger('transport:down');\n }\n});\n\nDispatcher.create = function(client, endpoint, options) {\n return new Dispatcher(client, endpoint, options);\n};\n\nassign(Dispatcher.prototype, Publisher);\nassign(Dispatcher.prototype, Logging);\n\nmodule.exports = Dispatcher;\n","'use strict';\n\nmodule.exports = {};\n","'use strict';\n\nvar Transport = require('./transport');\n\nTransport.register('websocket', require('./web_socket'));\nTransport.register('eventsource', require('./event_source'));\nTransport.register('long-polling', require('./xhr'));\nTransport.register('cross-origin-long-polling', require('./cors'));\nTransport.register('callback-polling', require('./jsonp'));\n\nmodule.exports = Transport;\n","'use strict';\n\nvar Class = require('./class');\n\nmodule.exports = Class({\n initialize: function() {\n this._index = {};\n },\n\n add: function(item) {\n var key = (item.id !== undefined) ? item.id : item;\n if (this._index.hasOwnProperty(key)) return false;\n this._index[key] = item;\n return true;\n },\n\n forEach: function(block, context) {\n for (var key in this._index) {\n if (this._index.hasOwnProperty(key))\n block.call(context, this._index[key]);\n }\n },\n\n isEmpty: function() {\n for (var key in this._index) {\n if (this._index.hasOwnProperty(key)) return false;\n }\n return true;\n },\n\n member: function(item) {\n for (var key in this._index) {\n if (this._index[key] === item) return true;\n }\n return false;\n },\n\n remove: function(item) {\n var key = (item.id !== undefined) ? item.id : item;\n var removed = this._index[key];\n delete this._index[key];\n return removed;\n },\n\n toArray: function() {\n var array = [];\n this.forEach(function(item) { array.push(item) });\n return array;\n }\n});\n","'use strict';\n\nvar Class = require('../util/class'),\n URI = require('../util/uri'),\n browser = require('../util/browser'),\n assign = require('../util/assign'),\n toJSON = require('../util/to_json'),\n Transport = require('./transport');\n\nvar XHR = assign(Class(Transport, {\n encode: function(messages) {\n return toJSON(messages);\n },\n\n request: function(messages) {\n var href = this.endpoint.href,\n self = this,\n xhr;\n\n // Prefer XMLHttpRequest over ActiveXObject if they both exist\n if (global.XMLHttpRequest) {\n xhr = new XMLHttpRequest();\n } else if (global.ActiveXObject) {\n xhr = new ActiveXObject('Microsoft.XMLHTTP');\n } else {\n return this._handleError(messages);\n }\n\n xhr.open('POST', href, true);\n xhr.setRequestHeader('Content-Type', 'application/json');\n xhr.setRequestHeader('Pragma', 'no-cache');\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\n var headers = this._dispatcher.headers;\n for (var key in headers) {\n if (!headers.hasOwnProperty(key)) continue;\n xhr.setRequestHeader(key, headers[key]);\n }\n\n var abort = function() { xhr.abort() };\n if (global.onbeforeunload !== undefined)\n browser.Event.on(global, 'beforeunload', abort);\n\n xhr.onreadystatechange = function() {\n if (!xhr || xhr.readyState !== 4) return;\n\n var replies = null,\n status = xhr.status,\n text = xhr.responseText,\n successful = (status >= 200 && status < 300) || status === 304 || status === 1223;\n\n if (global.onbeforeunload !== undefined)\n browser.Event.detach(global, 'beforeunload', abort);\n\n xhr.onreadystatechange = function() {};\n xhr = null;\n\n if (!successful) return self._handleError(messages);\n\n try {\n replies = JSON.parse(text);\n } catch (error) {}\n\n if (replies)\n self._receive(replies);\n else\n self._handleError(messages);\n };\n\n xhr.send(this.encode(messages));\n return xhr;\n }\n}), {\n isUsable: function(dispatcher, endpoint, callback, context) {\n var usable = (navigator.product === 'ReactNative')\n || URI.isSameOrigin(endpoint);\n\n callback.call(context, usable);\n }\n});\n\nmodule.exports = XHR;\n","'use strict';\n\nvar assign = require('../util/assign');\n\nvar Scheduler = function(message, options) {\n this.message = message;\n this.options = options;\n this.attempts = 0;\n};\n\nassign(Scheduler.prototype, {\n getTimeout: function() {\n return this.options.timeout;\n },\n\n getInterval: function() {\n return this.options.interval;\n },\n\n isDeliverable: function() {\n var attempts = this.options.attempts,\n made = this.attempts,\n deadline = this.options.deadline,\n now = new Date().getTime();\n\n if (attempts !== undefined && made >= attempts)\n return false;\n\n if (deadline !== undefined && now > deadline)\n return false;\n\n return true;\n },\n\n send: function() {\n this.attempts += 1;\n },\n\n succeed: function() {},\n\n fail: function() {},\n\n abort: function() {}\n});\n\nmodule.exports = Scheduler;\n","module.exports = {\n VERSION: '1.4.0',\n\n BAYEUX_VERSION: '1.0',\n ID_LENGTH: 160,\n JSONP_CALLBACK: 'jsonpcallback',\n CONNECTION_TYPES: ['long-polling', 'cross-origin-long-polling', 'callback-polling', 'websocket', 'eventsource', 'in-process'],\n\n MANDATORY_CONNECTION_TYPES: ['long-polling', 'callback-polling', 'in-process']\n};\n","'use strict';\n\nvar Class = require('../util/class'),\n assign = require('../util/assign'),\n Deferrable = require('../mixins/deferrable');\n\nvar Subscription = Class({\n initialize: function(client, channels, callback, context) {\n this._client = client;\n this._channels = channels;\n this._callback = callback;\n this._context = context;\n this._cancelled = false;\n },\n\n withChannel: function(callback, context) {\n this._withChannel = [callback, context];\n return this;\n },\n\n apply: function(context, args) {\n var message = args[0];\n\n if (this._callback)\n this._callback.call(this._context, message.data);\n\n if (this._withChannel)\n this._withChannel[0].call(this._withChannel[1], message.channel, message.data);\n },\n\n cancel: function() {\n if (this._cancelled) return;\n this._client.unsubscribe(this._channels, this);\n this._cancelled = true;\n },\n\n unsubscribe: function() {\n this.cancel();\n }\n});\n\nassign(Subscription.prototype, Deferrable);\n\nmodule.exports = Subscription;\n","'use strict';\n\nvar asap = require('asap'),\n Class = require('../util/class'),\n Promise = require('../util/promise'),\n array = require('../util/array'),\n browser = require('../util/browser'),\n constants = require('../util/constants'),\n assign = require('../util/assign'),\n validateOptions = require('../util/validate_options'),\n Deferrable = require('../mixins/deferrable'),\n Logging = require('../mixins/logging'),\n Publisher = require('../mixins/publisher'),\n Channel = require('./channel'),\n Dispatcher = require('./dispatcher'),\n Error = require('./error'),\n Extensible = require('./extensible'),\n Publication = require('./publication'),\n Subscription = require('./subscription');\n\nvar Client = Class({ className: 'Client',\n UNCONNECTED: 1,\n CONNECTING: 2,\n CONNECTED: 3,\n DISCONNECTED: 4,\n\n HANDSHAKE: 'handshake',\n RETRY: 'retry',\n NONE: 'none',\n\n CONNECTION_TIMEOUT: 60,\n\n DEFAULT_ENDPOINT: '/bayeux',\n INTERVAL: 0,\n\n initialize: function(endpoint, options) {\n this.info('New client created for ?', endpoint);\n options = options || {};\n\n validateOptions(options, ['interval', 'timeout', 'endpoints', 'proxy', 'retry', 'scheduler', 'websocketExtensions', 'tls', 'ca']);\n\n this._channels = new Channel.Set();\n this._dispatcher = Dispatcher.create(this, endpoint || this.DEFAULT_ENDPOINT, options);\n\n this._messageId = 0;\n this._state = this.UNCONNECTED;\n\n this._responseCallbacks = {};\n\n this._advice = {\n reconnect: this.RETRY,\n interval: 1000 * (options.interval || this.INTERVAL),\n timeout: 1000 * (options.timeout || this.CONNECTION_TIMEOUT)\n };\n this._dispatcher.timeout = this._advice.timeout / 1000;\n\n this._dispatcher.bind('message', this._receiveMessage, this);\n\n if (browser.Event && global.onbeforeunload !== undefined)\n browser.Event.on(global, 'beforeunload', function() {\n if (array.indexOf(this._dispatcher._disabled, 'autodisconnect') < 0)\n this.disconnect();\n }, this);\n },\n\n addWebsocketExtension: function(extension) {\n return this._dispatcher.addWebsocketExtension(extension);\n },\n\n disable: function(feature) {\n return this._dispatcher.disable(feature);\n },\n\n setHeader: function(name, value) {\n return this._dispatcher.setHeader(name, value);\n },\n\n // Request\n // MUST include: * channel\n // * version\n // * supportedConnectionTypes\n // MAY include: * minimumVersion\n // * ext\n // * id\n //\n // Success Response Failed Response\n // MUST include: * channel MUST include: * channel\n // * version * successful\n // * supportedConnectionTypes * error\n // * clientId MAY include: * supportedConnectionTypes\n // * successful * advice\n // MAY include: * minimumVersion * version\n // * advice * minimumVersion\n // * ext * ext\n // * id * id\n // * authSuccessful\n handshake: function(callback, context) {\n if (this._advice.reconnect === this.NONE) return;\n if (this._state !== this.UNCONNECTED) return;\n\n this._state = this.CONNECTING;\n var self = this;\n\n this.info('Initiating handshake with ?', this._dispatcher.endpoint.href);\n this._dispatcher.selectTransport(constants.MANDATORY_CONNECTION_TYPES);\n\n this._sendMessage({\n channel: Channel.HANDSHAKE,\n version: constants.BAYEUX_VERSION,\n supportedConnectionTypes: this._dispatcher.getConnectionTypes()\n\n }, {}, function(response) {\n\n if (response.successful) {\n this._state = this.CONNECTED;\n this._dispatcher.clientId = response.clientId;\n\n this._dispatcher.selectTransport(response.supportedConnectionTypes);\n\n this.info('Handshake successful: ?', this._dispatcher.clientId);\n\n this.subscribe(this._channels.getKeys(), true);\n if (callback) asap(function() { callback.call(context) });\n\n } else {\n this.info('Handshake unsuccessful');\n global.setTimeout(function() { self.handshake(callback, context) }, this._dispatcher.retry * 1000);\n this._state = this.UNCONNECTED;\n }\n }, this);\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * clientId * successful\n // * connectionType * clientId\n // MAY include: * ext MAY include: * error\n // * id * advice\n // * ext\n // * id\n // * timestamp\n connect: function(callback, context) {\n if (this._advice.reconnect === this.NONE) return;\n if (this._state === this.DISCONNECTED) return;\n\n if (this._state === this.UNCONNECTED)\n return this.handshake(function() { this.connect(callback, context) }, this);\n\n this.callback(callback, context);\n if (this._state !== this.CONNECTED) return;\n\n this.info('Calling deferred actions for ?', this._dispatcher.clientId);\n this.setDeferredStatus('succeeded');\n this.setDeferredStatus('unknown');\n\n if (this._connectRequest) return;\n this._connectRequest = true;\n\n this.info('Initiating connection for ?', this._dispatcher.clientId);\n\n this._sendMessage({\n channel: Channel.CONNECT,\n clientId: this._dispatcher.clientId,\n connectionType: this._dispatcher.connectionType\n\n }, {}, this._cycleConnection, this);\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * clientId * successful\n // MAY include: * ext * clientId\n // * id MAY include: * error\n // * ext\n // * id\n disconnect: function() {\n if (this._state !== this.CONNECTED) return;\n this._state = this.DISCONNECTED;\n\n this.info('Disconnecting ?', this._dispatcher.clientId);\n var promise = new Publication();\n\n this._sendMessage({\n channel: Channel.DISCONNECT,\n clientId: this._dispatcher.clientId\n\n }, {}, function(response) {\n if (response.successful) {\n this._dispatcher.close();\n promise.setDeferredStatus('succeeded');\n } else {\n promise.setDeferredStatus('failed', Error.parse(response.error));\n }\n }, this);\n\n this.info('Clearing channel listeners for ?', this._dispatcher.clientId);\n this._channels = new Channel.Set();\n\n return promise;\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * clientId * successful\n // * subscription * clientId\n // MAY include: * ext * subscription\n // * id MAY include: * error\n // * advice\n // * ext\n // * id\n // * timestamp\n subscribe: function(channel, callback, context) {\n if (channel instanceof Array)\n return array.map(channel, function(c) {\n return this.subscribe(c, callback, context);\n }, this);\n\n var subscription = new Subscription(this, channel, callback, context),\n force = (callback === true),\n hasSubscribe = this._channels.hasSubscription(channel);\n\n if (hasSubscribe && !force) {\n this._channels.subscribe([channel], subscription);\n subscription.setDeferredStatus('succeeded');\n return subscription;\n }\n\n this.connect(function() {\n this.info('Client ? attempting to subscribe to ?', this._dispatcher.clientId, channel);\n if (!force) this._channels.subscribe([channel], subscription);\n\n this._sendMessage({\n channel: Channel.SUBSCRIBE,\n clientId: this._dispatcher.clientId,\n subscription: channel\n\n }, {}, function(response) {\n if (!response.successful) {\n subscription.setDeferredStatus('failed', Error.parse(response.error));\n return this._channels.unsubscribe(channel, subscription);\n }\n\n var channels = [].concat(response.subscription);\n this.info('Subscription acknowledged for ? to ?', this._dispatcher.clientId, channels);\n subscription.setDeferredStatus('succeeded');\n }, this);\n }, this);\n\n return subscription;\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * clientId * successful\n // * subscription * clientId\n // MAY include: * ext * subscription\n // * id MAY include: * error\n // * advice\n // * ext\n // * id\n // * timestamp\n unsubscribe: function(channel, subscription) {\n if (channel instanceof Array)\n return array.map(channel, function(c) {\n return this.unsubscribe(c, subscription);\n }, this);\n\n var dead = this._channels.unsubscribe(channel, subscription);\n if (!dead) return;\n\n this.connect(function() {\n this.info('Client ? attempting to unsubscribe from ?', this._dispatcher.clientId, channel);\n\n this._sendMessage({\n channel: Channel.UNSUBSCRIBE,\n clientId: this._dispatcher.clientId,\n subscription: channel\n\n }, {}, function(response) {\n if (!response.successful) return;\n\n var channels = [].concat(response.subscription);\n this.info('Unsubscription acknowledged for ? from ?', this._dispatcher.clientId, channels);\n }, this);\n }, this);\n },\n\n // Request Response\n // MUST include: * channel MUST include: * channel\n // * data * successful\n // MAY include: * clientId MAY include: * id\n // * id * error\n // * ext * ext\n publish: function(channel, data, options) {\n validateOptions(options || {}, ['attempts', 'deadline']);\n var publication = new Publication();\n\n this.connect(function() {\n this.info('Client ? queueing published message to ?: ?', this._dispatcher.clientId, channel, data);\n\n this._sendMessage({\n channel: channel,\n data: data,\n clientId: this._dispatcher.clientId\n\n }, options, function(response) {\n if (response.successful)\n publication.setDeferredStatus('succeeded');\n else\n publication.setDeferredStatus('failed', Error.parse(response.error));\n }, this);\n }, this);\n\n return publication;\n },\n\n _sendMessage: function(message, options, callback, context) {\n message.id = this._generateMessageId();\n\n var timeout = this._advice.timeout\n ? 1.2 * this._advice.timeout / 1000\n : 1.2 * this._dispatcher.retry;\n\n this.pipeThroughExtensions('outgoing', message, null, function(message) {\n if (!message) return;\n if (callback) this._responseCallbacks[message.id] = [callback, context];\n this._dispatcher.sendMessage(message, timeout, options || {});\n }, this);\n },\n\n _generateMessageId: function() {\n this._messageId += 1;\n if (this._messageId >= Math.pow(2,32)) this._messageId = 0;\n return this._messageId.toString(36);\n },\n\n _receiveMessage: function(message) {\n var id = message.id, callback;\n\n if (message.successful !== undefined) {\n callback = this._responseCallbacks[id];\n delete this._responseCallbacks[id];\n }\n\n this.pipeThroughExtensions('incoming', message, null, function(message) {\n if (!message) return;\n if (message.advice) this._handleAdvice(message.advice);\n this._deliverMessage(message);\n if (callback) callback[0].call(callback[1], message);\n }, this);\n },\n\n _handleAdvice: function(advice) {\n assign(this._advice, advice);\n this._dispatcher.timeout = this._advice.timeout / 1000;\n\n if (this._advice.reconnect === this.HANDSHAKE && this._state !== this.DISCONNECTED) {\n this._state = this.UNCONNECTED;\n this._dispatcher.clientId = null;\n this._cycleConnection();\n }\n },\n\n _deliverMessage: function(message) {\n if (!message.channel || message.data === undefined) return;\n this.info('Client ? calling listeners for ? with ?', this._dispatcher.clientId, message.channel, message.data);\n this._channels.distributeMessage(message);\n },\n\n _cycleConnection: function() {\n if (this._connectRequest) {\n this._connectRequest = null;\n this.info('Closed connection for ?', this._dispatcher.clientId);\n }\n var self = this;\n global.setTimeout(function() { self.connect() }, this._advice.interval);\n }\n});\n\nassign(Client.prototype, Deferrable);\nassign(Client.prototype, Publisher);\nassign(Client.prototype, Logging);\nassign(Client.prototype, Extensible);\n\nmodule.exports = Client;\n","\"use strict\";\n\n// Use the fastest means possible to execute a task in its own turn, with\n// priority over other events including IO, animation, reflow, and redraw\n// events in browsers.\n//\n// An exception thrown by a task will permanently interrupt the processing of\n// subsequent tasks. The higher level `asap` function ensures that if an\n// exception is thrown by a task, that the task queue will continue flushing as\n// soon as possible, but if you use `rawAsap` directly, you are responsible to\n// either ensure that no exceptions are thrown from your task, or to manually\n// call `rawAsap.requestFlush` if an exception is thrown.\nmodule.exports = rawAsap;\nfunction rawAsap(task) {\n if (!queue.length) {\n requestFlush();\n flushing = true;\n }\n // Equivalent to push, but avoids a function call.\n queue[queue.length] = task;\n}\n\nvar queue = [];\n// Once a flush has been requested, no further calls to `requestFlush` are\n// necessary until the next `flush` completes.\nvar flushing = false;\n// `requestFlush` is an implementation-specific method that attempts to kick\n// off a `flush` event as quickly as possible. `flush` will attempt to exhaust\n// the event queue before yielding to the browser's own event loop.\nvar requestFlush;\n// The position of the next task to execute in the task queue. This is\n// preserved between calls to `flush` so that it can be resumed if\n// a task throws an exception.\nvar index = 0;\n// If a task schedules additional tasks recursively, the task queue can grow\n// unbounded. To prevent memory exhaustion, the task queue will periodically\n// truncate already-completed tasks.\nvar capacity = 1024;\n\n// The flush function processes all tasks that have been scheduled with\n// `rawAsap` unless and until one of those tasks throws an exception.\n// If a task throws an exception, `flush` ensures that its state will remain\n// consistent and will resume where it left off when called again.\n// However, `flush` does not make any arrangements to be called again if an\n// exception is thrown.\nfunction flush() {\n while (index < queue.length) {\n var currentIndex = index;\n // Advance the index before calling the task. This ensures that we will\n // begin flushing on the next task the task throws an error.\n index = index + 1;\n queue[currentIndex].call();\n // Prevent leaking memory for long chains of recursive calls to `asap`.\n // If we call `asap` within tasks scheduled by `asap`, the queue will\n // grow, but to avoid an O(n) walk for every task we execute, we don't\n // shift tasks off the queue after they have been executed.\n // Instead, we periodically shift 1024 tasks off the queue.\n if (index > capacity) {\n // Manually shift all values starting at the index back to the\n // beginning of the queue.\n for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {\n queue[scan] = queue[scan + index];\n }\n queue.length -= index;\n index = 0;\n }\n }\n queue.length = 0;\n index = 0;\n flushing = false;\n}\n\n// `requestFlush` is implemented using a strategy based on data collected from\n// every available SauceLabs Selenium web driver worker at time of writing.\n// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n\n// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` or `self` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\n\n/* globals self */\nvar scope = typeof global !== \"undefined\" ? global : self;\nvar BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;\n\n// MutationObservers are desirable because they have high priority and work\n// reliably everywhere they are implemented.\n// They are implemented in all modern browsers.\n//\n// - Android 4-4.3\n// - Chrome 26-34\n// - Firefox 14-29\n// - Internet Explorer 11\n// - iPad Safari 6-7.1\n// - iPhone Safari 7-7.1\n// - Safari 6-7\nif (typeof BrowserMutationObserver === \"function\") {\n requestFlush = makeRequestCallFromMutationObserver(flush);\n\n// MessageChannels are desirable because they give direct access to the HTML\n// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n// 11-12, and in web workers in many engines.\n// Although message channels yield to any queued rendering and IO tasks, they\n// would be better than imposing the 4ms delay of timers.\n// However, they do not work reliably in Internet Explorer or Safari.\n\n// Internet Explorer 10 is the only browser that has setImmediate but does\n// not have MutationObservers.\n// Although setImmediate yields to the browser's renderer, it would be\n// preferrable to falling back to setTimeout since it does not have\n// the minimum 4ms penalty.\n// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n// Desktop to a lesser extent) that renders both setImmediate and\n// MessageChannel useless for the purposes of ASAP.\n// https://github.com/kriskowal/q/issues/396\n\n// Timers are implemented universally.\n// We fall back to timers in workers in most engines, and in foreground\n// contexts in the following browsers.\n// However, note that even this simple case requires nuances to operate in a\n// broad spectrum of browsers.\n//\n// - Firefox 3-13\n// - Internet Explorer 6-9\n// - iPad Safari 4.3\n// - Lynx 2.8.7\n} else {\n requestFlush = makeRequestCallFromTimer(flush);\n}\n\n// `requestFlush` requests that the high priority event queue be flushed as\n// soon as possible.\n// This is useful to prevent an error thrown in a task from stalling the event\n// queue if the exception handled by Node.js’s\n// `process.on(\"uncaughtException\")` or by a domain.\nrawAsap.requestFlush = requestFlush;\n\n// To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\nfunction makeRequestCallFromMutationObserver(callback) {\n var toggle = 1;\n var observer = new BrowserMutationObserver(callback);\n var node = document.createTextNode(\"\");\n observer.observe(node, {characterData: true});\n return function requestCall() {\n toggle = -toggle;\n node.data = toggle;\n };\n}\n\n// The message channel technique was discovered by Malte Ubl and was the\n// original foundation for this library.\n// http://www.nonblocking.io/2011/06/windownexttick.html\n\n// Safari 6.0.5 (at least) intermittently fails to create message ports on a\n// page's first load. Thankfully, this version of Safari supports\n// MutationObservers, so we don't need to fall back in that case.\n\n// function makeRequestCallFromMessageChannel(callback) {\n// var channel = new MessageChannel();\n// channel.port1.onmessage = callback;\n// return function requestCall() {\n// channel.port2.postMessage(0);\n// };\n// }\n\n// For reasons explained above, we are also unable to use `setImmediate`\n// under any circumstances.\n// Even if we were, there is another bug in Internet Explorer 10.\n// It is not sufficient to assign `setImmediate` to `requestFlush` because\n// `setImmediate` must be called *by name* and therefore must be wrapped in a\n// closure.\n// Never forget.\n\n// function makeRequestCallFromSetImmediate(callback) {\n// return function requestCall() {\n// setImmediate(callback);\n// };\n// }\n\n// Safari 6.0 has a problem where timers will get lost while the user is\n// scrolling. This problem does not impact ASAP because Safari 6.0 supports\n// mutation observers, so that implementation is used instead.\n// However, if we ever elect to use timers in Safari, the prevalent work-around\n// is to add a scroll event listener that calls for a flush.\n\n// `setTimeout` does not call the passed callback if the delay is less than\n// approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n// even then.\n\nfunction makeRequestCallFromTimer(callback) {\n return function requestCall() {\n // We dispatch a timeout with a specified delay of 0 for engines that\n // can reliably accommodate that request. This will usually be snapped\n // to a 4 milisecond delay, but once we're flushing, there's no delay\n // between events.\n var timeoutHandle = setTimeout(handleTimer, 0);\n // However, since this timer gets frequently dropped in Firefox\n // workers, we enlist an interval handle that will try to fire\n // an event 20 times per second until it succeeds.\n var intervalHandle = setInterval(handleTimer, 50);\n\n function handleTimer() {\n // Whichever timer succeeds will cancel both timers and\n // execute the callback.\n clearTimeout(timeoutHandle);\n clearInterval(intervalHandle);\n callback();\n }\n };\n}\n\n// This is for `asap.js` only.\n// Its name will be periodically randomized to break any code that depends on\n// its existence.\nrawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;\n\n// ASAP was originally a nextTick shim included in Q. This was factored out\n// into this ASAP package. It was later adapted to RSVP which made further\n// amendments. These decisions, particularly to marginalize MessageChannel and\n// to capture the MutationObserver implementation in a closure, were integrated\n// back into ASAP proper.\n// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js\n","'use strict';\n\nvar array = require('./array');\n\nmodule.exports = function(options, validKeys) {\n for (var key in options) {\n if (array.indexOf(validKeys, key) < 0)\n throw new Error('Unrecognized option: ' + key);\n }\n};\n","/*\nCopyright Joyent, Inc. and other Node contributors. All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nvar isArray = typeof Array.isArray === 'function'\n ? Array.isArray\n : function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]'\n }\n;\nfunction indexOf (xs, x) {\n if (xs.indexOf) return xs.indexOf(x);\n for (var i = 0; i < xs.length; i++) {\n if (x === xs[i]) return i;\n }\n return -1;\n}\n\nfunction EventEmitter() {}\nmodule.exports = EventEmitter;\n\nEventEmitter.prototype.emit = function(type) {\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events || !this._events.error ||\n (isArray(this._events.error) && !this._events.error.length))\n {\n if (arguments[1] instanceof Error) {\n throw arguments[1]; // Unhandled 'error' event\n } else {\n throw new Error(\"Uncaught, unspecified 'error' event.\");\n }\n return false;\n }\n }\n\n if (!this._events) return false;\n var handler = this._events[type];\n if (!handler) return false;\n\n if (typeof handler == 'function') {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n var args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n return true;\n\n } else if (isArray(handler)) {\n var args = Array.prototype.slice.call(arguments, 1);\n\n var listeners = handler.slice();\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i].apply(this, args);\n }\n return true;\n\n } else {\n return false;\n }\n};\n\n// EventEmitter is defined in src/node_events.cc\n// EventEmitter.prototype.emit() is also defined there.\nEventEmitter.prototype.addListener = function(type, listener) {\n if ('function' !== typeof listener) {\n throw new Error('addListener only takes instances of Function');\n }\n\n if (!this._events) this._events = {};\n\n // To avoid recursion in the case that type == \"newListeners\"! Before\n // adding it to the listeners, first emit \"newListeners\".\n this.emit('newListener', type, listener);\n\n if (!this._events[type]) {\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n } else if (isArray(this._events[type])) {\n // If we've already got an array, just append.\n this._events[type].push(listener);\n } else {\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n var self = this;\n self.on(type, function g() {\n self.removeListener(type, g);\n listener.apply(this, arguments);\n });\n\n return this;\n};\n\nEventEmitter.prototype.removeListener = function(type, listener) {\n if ('function' !== typeof listener) {\n throw new Error('removeListener only takes instances of Function');\n }\n\n // does not use listeners(), so no side effect of creating _events[type]\n if (!this._events || !this._events[type]) return this;\n\n var list = this._events[type];\n\n if (isArray(list)) {\n var i = indexOf(list, listener);\n if (i < 0) return this;\n list.splice(i, 1);\n if (list.length == 0)\n delete this._events[type];\n } else if (this._events[type] === listener) {\n delete this._events[type];\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n if (arguments.length === 0) {\n this._events = {};\n return this;\n }\n\n // does not use listeners(), so no side effect of creating _events[type]\n if (type && this._events && this._events[type]) this._events[type] = null;\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n if (!this._events) this._events = {};\n if (!this._events[type]) this._events[type] = [];\n if (!isArray(this._events[type])) {\n this._events[type] = [this._events[type]];\n }\n return this._events[type];\n};\n","'use strict';\n\nmodule.exports = {\n addTimeout: function(name, delay, callback, context) {\n this._timeouts = this._timeouts || {};\n if (this._timeouts.hasOwnProperty(name)) return;\n var self = this;\n this._timeouts[name] = global.setTimeout(function() {\n delete self._timeouts[name];\n callback.call(context);\n }, 1000 * delay);\n },\n\n removeTimeout: function(name) {\n this._timeouts = this._timeouts || {};\n var timeout = this._timeouts[name];\n if (!timeout) return;\n global.clearTimeout(timeout);\n delete this._timeouts[name];\n },\n\n removeAllTimeouts: function() {\n this._timeouts = this._timeouts || {};\n for (var name in this._timeouts) this.removeTimeout(name);\n }\n};\n","'use strict';\n\nvar Class = require('../util/class'),\n Promise = require('../util/promise'),\n Set = require('../util/set'),\n URI = require('../util/uri'),\n browser = require('../util/browser'),\n copyObject = require('../util/copy_object'),\n assign = require('../util/assign'),\n toJSON = require('../util/to_json'),\n ws = require('../util/websocket'),\n Deferrable = require('../mixins/deferrable'),\n Transport = require('./transport');\n\nvar WebSocket = assign(Class(Transport, {\n UNCONNECTED: 1,\n CONNECTING: 2,\n CONNECTED: 3,\n\n batching: false,\n\n isUsable: function(callback, context) {\n this.callback(function() { callback.call(context, true) });\n this.errback(function() { callback.call(context, false) });\n this.connect();\n },\n\n request: function(messages) {\n this._pending = this._pending || new Set();\n for (var i = 0, n = messages.length; i < n; i++) this._pending.add(messages[i]);\n\n var self = this;\n\n var promise = new Promise(function(resolve, reject) {\n self.callback(function(socket) {\n if (!socket || socket.readyState !== 1) return;\n socket.send(toJSON(messages));\n resolve(socket);\n });\n\n self.connect();\n });\n\n return {\n abort: function() { promise.then(function(ws) { ws.close() }) }\n };\n },\n\n connect: function() {\n if (WebSocket._unloaded) return;\n\n this._state = this._state || this.UNCONNECTED;\n if (this._state !== this.UNCONNECTED) return;\n this._state = this.CONNECTING;\n\n var socket = this._createSocket();\n if (!socket) return this.setDeferredStatus('failed');\n\n var self = this;\n\n socket.onopen = function() {\n if (socket.headers) self._storeCookies(socket.headers['set-cookie']);\n self._socket = socket;\n self._state = self.CONNECTED;\n self._everConnected = true;\n self.setDeferredStatus('succeeded', socket);\n };\n\n var closed = false;\n socket.onclose = socket.onerror = function() {\n if (closed) return;\n closed = true;\n\n var wasConnected = (self._state === self.CONNECTED);\n socket.onopen = socket.onclose = socket.onerror = socket.onmessage = null;\n\n delete self._socket;\n self._state = self.UNCONNECTED;\n\n var pending = self._pending ? self._pending.toArray() : [];\n delete self._pending;\n\n if (wasConnected || self._everConnected) {\n self.setDeferredStatus('unknown');\n self._handleError(pending, wasConnected);\n } else {\n self.setDeferredStatus('failed');\n }\n };\n\n socket.onmessage = function(event) {\n var replies;\n try { replies = JSON.parse(event.data) } catch (error) {}\n\n if (!replies) return;\n\n replies = [].concat(replies);\n\n for (var i = 0, n = replies.length; i < n; i++) {\n if (replies[i].successful === undefined) continue;\n self._pending.remove(replies[i]);\n }\n self._receive(replies);\n };\n },\n\n close: function() {\n if (!this._socket) return;\n this._socket.close();\n },\n\n _createSocket: function() {\n var url = WebSocket.getSocketUrl(this.endpoint),\n headers = this._dispatcher.headers,\n extensions = this._dispatcher.wsExtensions,\n cookie = this._getCookies(),\n tls = this._dispatcher.tls,\n options = { extensions: extensions, headers: headers, proxy: this._proxy, tls: tls };\n\n if (cookie !== '') options.headers['Cookie'] = cookie;\n\n try {\n return ws.create(url, [], options);\n } catch (e) {\n // catch CSP error to allow transport to fallback to next connType\n }\n }\n\n}), {\n PROTOCOLS: {\n 'http:': 'ws:',\n 'https:': 'wss:'\n },\n\n create: function(dispatcher, endpoint) {\n var sockets = dispatcher.transports.websocket = dispatcher.transports.websocket || {};\n sockets[endpoint.href] = sockets[endpoint.href] || new this(dispatcher, endpoint);\n return sockets[endpoint.href];\n },\n\n getSocketUrl: function(endpoint) {\n endpoint = copyObject(endpoint);\n endpoint.protocol = this.PROTOCOLS[endpoint.protocol];\n return URI.stringify(endpoint);\n },\n\n isUsable: function(dispatcher, endpoint, callback, context) {\n this.create(dispatcher, endpoint).isUsable(callback, context);\n }\n});\n\nassign(WebSocket.prototype, Deferrable);\n\nif (browser.Event && global.onbeforeunload !== undefined) {\n browser.Event.on(global, 'beforeunload', function() {\n if (WebSocket._unloaded === undefined)\n WebSocket._unloaded = true;\n });\n}\n\nmodule.exports = WebSocket;\n","'use strict';\n\nvar WS = global.MozWebSocket || global.WebSocket;\n\nmodule.exports = {\n create: function(url, protocols, options) {\n if (typeof WS !== 'function') return null;\n return new WS(url);\n }\n};\n","'use strict';\n\nvar Class = require('../util/class'),\n URI = require('../util/uri'),\n copyObject = require('../util/copy_object'),\n assign = require('../util/assign'),\n Deferrable = require('../mixins/deferrable'),\n Transport = require('./transport'),\n XHR = require('./xhr');\n\nvar EventSource = assign(Class(Transport, {\n initialize: function(dispatcher, endpoint) {\n Transport.prototype.initialize.call(this, dispatcher, endpoint);\n if (!global.EventSource) return this.setDeferredStatus('failed');\n\n this._xhr = new XHR(dispatcher, endpoint);\n\n endpoint = copyObject(endpoint);\n endpoint.pathname += '/' + dispatcher.clientId;\n\n var socket = new global.EventSource(URI.stringify(endpoint)),\n self = this;\n\n socket.onopen = function() {\n self._everConnected = true;\n self.setDeferredStatus('succeeded');\n };\n\n socket.onerror = function() {\n if (self._everConnected) {\n self._handleError([]);\n } else {\n self.setDeferredStatus('failed');\n socket.close();\n }\n };\n\n socket.onmessage = function(event) {\n var replies;\n try { replies = JSON.parse(event.data) } catch (error) {}\n\n if (replies)\n self._receive(replies);\n else\n self._handleError([]);\n };\n\n this._socket = socket;\n },\n\n close: function() {\n if (!this._socket) return;\n this._socket.onopen = this._socket.onerror = this._socket.onmessage = null;\n this._socket.close();\n delete this._socket;\n },\n\n isUsable: function(callback, context) {\n this.callback(function() { callback.call(context, true) });\n this.errback(function() { callback.call(context, false) });\n },\n\n encode: function(messages) {\n return this._xhr.encode(messages);\n },\n\n request: function(messages) {\n return this._xhr.request(messages);\n }\n\n}), {\n isUsable: function(dispatcher, endpoint, callback, context) {\n var id = dispatcher.clientId;\n if (!id) return callback.call(context, false);\n\n XHR.isUsable(dispatcher, endpoint, function(usable) {\n if (!usable) return callback.call(context, false);\n this.create(dispatcher, endpoint).isUsable(callback, context);\n }, this);\n },\n\n create: function(dispatcher, endpoint) {\n var sockets = dispatcher.transports.eventsource = dispatcher.transports.eventsource || {},\n id = dispatcher.clientId;\n\n var url = copyObject(endpoint);\n url.pathname += '/' + (id || '');\n url = URI.stringify(url);\n\n sockets[url] = sockets[url] || new this(dispatcher, endpoint);\n return sockets[url];\n }\n});\n\nassign(EventSource.prototype, Deferrable);\n\nmodule.exports = EventSource;\n","'use strict';\n\nvar Class = require('../util/class'),\n Set = require('../util/set'),\n URI = require('../util/uri'),\n assign = require('../util/assign'),\n toJSON = require('../util/to_json'),\n Transport = require('./transport');\n\nvar CORS = assign(Class(Transport, {\n encode: function(messages) {\n return 'message=' + encodeURIComponent(toJSON(messages));\n },\n\n request: function(messages) {\n var xhrClass = global.XDomainRequest ? XDomainRequest : XMLHttpRequest,\n xhr = new xhrClass(),\n id = ++CORS._id,\n headers = this._dispatcher.headers,\n self = this,\n key;\n\n xhr.open('POST', this.endpoint.href, true);\n xhr.withCredentials = true;\n\n if (xhr.setRequestHeader) {\n xhr.setRequestHeader('Pragma', 'no-cache');\n for (key in headers) {\n if (!headers.hasOwnProperty(key)) continue;\n xhr.setRequestHeader(key, headers[key]);\n }\n }\n\n var cleanUp = function() {\n if (!xhr) return false;\n CORS._pending.remove(id);\n xhr.onload = xhr.onerror = xhr.ontimeout = xhr.onprogress = null;\n xhr = null;\n };\n\n xhr.onload = function() {\n var replies;\n try { replies = JSON.parse(xhr.responseText) } catch (error) {}\n\n cleanUp();\n\n if (replies)\n self._receive(replies);\n else\n self._handleError(messages);\n };\n\n xhr.onerror = xhr.ontimeout = function() {\n cleanUp();\n self._handleError(messages);\n };\n\n xhr.onprogress = function() {};\n\n if (xhrClass === global.XDomainRequest)\n CORS._pending.add({ id: id, xhr: xhr });\n\n xhr.send(this.encode(messages));\n return xhr;\n }\n}), {\n _id: 0,\n _pending: new Set(),\n\n isUsable: function(dispatcher, endpoint, callback, context) {\n if (URI.isSameOrigin(endpoint))\n return callback.call(context, false);\n\n if (global.XDomainRequest)\n return callback.call(context, endpoint.protocol === location.protocol);\n\n if (global.XMLHttpRequest) {\n var xhr = new XMLHttpRequest();\n return callback.call(context, xhr.withCredentials !== undefined);\n }\n return callback.call(context, false);\n }\n});\n\nmodule.exports = CORS;\n","'use strict';\n\nvar Class = require('../util/class'),\n URI = require('../util/uri'),\n copyObject = require('../util/copy_object'),\n assign = require('../util/assign'),\n toJSON = require('../util/to_json'),\n Transport = require('./transport');\n\nvar JSONP = assign(Class(Transport, {\n encode: function(messages) {\n var url = copyObject(this.endpoint);\n url.query.message = toJSON(messages);\n url.query.jsonp = '__jsonp' + JSONP._cbCount + '__';\n return URI.stringify(url);\n },\n\n request: function(messages) {\n var head = document.getElementsByTagName('head')[0],\n script = document.createElement('script'),\n callbackName = JSONP.getCallbackName(),\n endpoint = copyObject(this.endpoint),\n self = this;\n\n endpoint.query.message = toJSON(messages);\n endpoint.query.jsonp = callbackName;\n\n var cleanup = function() {\n if (!global[callbackName]) return false;\n global[callbackName] = undefined;\n try { delete global[callbackName] } catch (error) {}\n script.parentNode.removeChild(script);\n };\n\n global[callbackName] = function(replies) {\n cleanup();\n self._receive(replies);\n };\n\n script.type = 'text/javascript';\n script.src = URI.stringify(endpoint);\n head.appendChild(script);\n\n script.onerror = function() {\n cleanup();\n self._handleError(messages);\n };\n\n return { abort: cleanup };\n }\n}), {\n _cbCount: 0,\n\n getCallbackName: function() {\n this._cbCount += 1;\n return '__jsonp' + this._cbCount + '__';\n },\n\n isUsable: function(dispatcher, endpoint, callback, context) {\n callback.call(context, true);\n }\n});\n\nmodule.exports = JSONP;\n","'use strict';\n\nvar Class = require('../util/class'),\n Grammar = require('./grammar');\n\nvar Error = Class({\n initialize: function(code, params, message) {\n this.code = code;\n this.params = Array.prototype.slice.call(params);\n this.message = message;\n },\n\n toString: function() {\n return this.code + ':' +\n this.params.join(',') + ':' +\n this.message;\n }\n});\n\nError.parse = function(message) {\n message = message || '';\n if (!Grammar.ERROR.test(message)) return new Error(null, [], message);\n\n var parts = message.split(':'),\n code = parseInt(parts[0]),\n params = parts[1].split(','),\n message = parts[2];\n\n return new Error(code, params, message);\n};\n\n// http://code.google.com/p/cometd/wiki/BayeuxCodes\nvar errors = {\n versionMismatch: [300, 'Version mismatch'],\n conntypeMismatch: [301, 'Connection types not supported'],\n extMismatch: [302, 'Extension mismatch'],\n badRequest: [400, 'Bad request'],\n clientUnknown: [401, 'Unknown client'],\n parameterMissing: [402, 'Missing required parameter'],\n channelForbidden: [403, 'Forbidden channel'],\n channelUnknown: [404, 'Unknown channel'],\n channelInvalid: [405, 'Invalid channel'],\n extUnknown: [406, 'Unknown extension'],\n publishFailed: [407, 'Failed to publish'],\n serverError: [500, 'Internal server error']\n};\n\nfor (var name in errors)\n (function(name) {\n Error[name] = function() {\n return new Error(errors[name][0], arguments, errors[name][1]).toString();\n };\n })(name);\n\nmodule.exports = Error;\n","'use strict';\n\nvar assign = require('../util/assign'),\n Logging = require('../mixins/logging');\n\nvar Extensible = {\n addExtension: function(extension) {\n this._extensions = this._extensions || [];\n this._extensions.push(extension);\n if (extension.added) extension.added(this);\n },\n\n removeExtension: function(extension) {\n if (!this._extensions) return;\n var i = this._extensions.length;\n while (i--) {\n if (this._extensions[i] !== extension) continue;\n this._extensions.splice(i,1);\n if (extension.removed) extension.removed(this);\n }\n },\n\n pipeThroughExtensions: function(stage, message, request, callback, context) {\n this.debug('Passing through ? extensions: ?', stage, message);\n\n if (!this._extensions) return callback.call(context, message);\n var extensions = this._extensions.slice();\n\n var pipe = function(message) {\n if (!message) return callback.call(context, message);\n\n var extension = extensions.shift();\n if (!extension) return callback.call(context, message);\n\n var fn = extension[stage];\n if (!fn) return pipe(message);\n\n if (fn.length >= 3) extension[stage](message, request, pipe);\n else extension[stage](message, pipe);\n };\n pipe(message);\n }\n};\n\nassign(Extensible, Logging);\n\nmodule.exports = Extensible;\n","'use strict';\n\nvar Class = require('../util/class'),\n Deferrable = require('../mixins/deferrable');\n\nmodule.exports = Class(Deferrable);\n","'use strict';\n\nvar constants = require('./util/constants'),\n Logging = require('./mixins/logging');\n\nvar Faye = {\n VERSION: constants.VERSION,\n\n Client: require('./protocol/client'),\n Scheduler: require('./protocol/scheduler')\n};\n\nLogging.wrapper = Faye;\n\nmodule.exports = Faye;\n"],"sourceRoot":""}
@@ -0,0 +1,3371 @@
1
+ var Faye =
2
+ /******/ (function(modules) { // webpackBootstrap
3
+ /******/ // The module cache
4
+ /******/ var installedModules = {};
5
+ /******/
6
+ /******/ // The require function
7
+ /******/ function __webpack_require__(moduleId) {
8
+ /******/
9
+ /******/ // Check if module is in cache
10
+ /******/ if(installedModules[moduleId]) {
11
+ /******/ return installedModules[moduleId].exports;
12
+ /******/ }
13
+ /******/ // Create a new module (and put it into the cache)
14
+ /******/ var module = installedModules[moduleId] = {
15
+ /******/ i: moduleId,
16
+ /******/ l: false,
17
+ /******/ exports: {}
18
+ /******/ };
19
+ /******/
20
+ /******/ // Execute the module function
21
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
+ /******/
23
+ /******/ // Flag the module as loaded
24
+ /******/ module.l = true;
25
+ /******/
26
+ /******/ // Return the exports of the module
27
+ /******/ return module.exports;
28
+ /******/ }
29
+ /******/
30
+ /******/
31
+ /******/ // expose the modules object (__webpack_modules__)
32
+ /******/ __webpack_require__.m = modules;
33
+ /******/
34
+ /******/ // expose the module cache
35
+ /******/ __webpack_require__.c = installedModules;
36
+ /******/
37
+ /******/ // define getter function for harmony exports
38
+ /******/ __webpack_require__.d = function(exports, name, getter) {
39
+ /******/ if(!__webpack_require__.o(exports, name)) {
40
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
+ /******/ }
42
+ /******/ };
43
+ /******/
44
+ /******/ // define __esModule on exports
45
+ /******/ __webpack_require__.r = function(exports) {
46
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
+ /******/ }
49
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
+ /******/ };
51
+ /******/
52
+ /******/ // create a fake namespace object
53
+ /******/ // mode & 1: value is a module id, require it
54
+ /******/ // mode & 2: merge all properties of value into the ns
55
+ /******/ // mode & 4: return value when already ns object
56
+ /******/ // mode & 8|1: behave like require
57
+ /******/ __webpack_require__.t = function(value, mode) {
58
+ /******/ if(mode & 1) value = __webpack_require__(value);
59
+ /******/ if(mode & 8) return value;
60
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
+ /******/ var ns = Object.create(null);
62
+ /******/ __webpack_require__.r(ns);
63
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
+ /******/ return ns;
66
+ /******/ };
67
+ /******/
68
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
69
+ /******/ __webpack_require__.n = function(module) {
70
+ /******/ var getter = module && module.__esModule ?
71
+ /******/ function getDefault() { return module['default']; } :
72
+ /******/ function getModuleExports() { return module; };
73
+ /******/ __webpack_require__.d(getter, 'a', getter);
74
+ /******/ return getter;
75
+ /******/ };
76
+ /******/
77
+ /******/ // Object.prototype.hasOwnProperty.call
78
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
+ /******/
80
+ /******/ // __webpack_public_path__
81
+ /******/ __webpack_require__.p = "";
82
+ /******/
83
+ /******/
84
+ /******/ // Load entry module and return exports
85
+ /******/ return __webpack_require__(__webpack_require__.s = "./src/faye_browser.js");
86
+ /******/ })
87
+ /************************************************************************/
88
+ /******/ ({
89
+
90
+ /***/ "./node_modules/asap/browser-asap.js":
91
+ /*!*******************************************!*\
92
+ !*** ./node_modules/asap/browser-asap.js ***!
93
+ \*******************************************/
94
+ /*! no static exports found */
95
+ /***/ (function(module, exports, __webpack_require__) {
96
+
97
+ "use strict";
98
+
99
+
100
+ // rawAsap provides everything we need except exception management.
101
+ var rawAsap = __webpack_require__(/*! ./raw */ "./node_modules/asap/browser-raw.js");
102
+ // RawTasks are recycled to reduce GC churn.
103
+ var freeTasks = [];
104
+ // We queue errors to ensure they are thrown in right order (FIFO).
105
+ // Array-as-queue is good enough here, since we are just dealing with exceptions.
106
+ var pendingErrors = [];
107
+ var requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);
108
+
109
+ function throwFirstError() {
110
+ if (pendingErrors.length) {
111
+ throw pendingErrors.shift();
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Calls a task as soon as possible after returning, in its own event, with priority
117
+ * over other events like animation, reflow, and repaint. An error thrown from an
118
+ * event will not interrupt, nor even substantially slow down the processing of
119
+ * other events, but will be rather postponed to a lower priority event.
120
+ * @param {{call}} task A callable object, typically a function that takes no
121
+ * arguments.
122
+ */
123
+ module.exports = asap;
124
+ function asap(task) {
125
+ var rawTask;
126
+ if (freeTasks.length) {
127
+ rawTask = freeTasks.pop();
128
+ } else {
129
+ rawTask = new RawTask();
130
+ }
131
+ rawTask.task = task;
132
+ rawAsap(rawTask);
133
+ }
134
+
135
+ // We wrap tasks with recyclable task objects. A task object implements
136
+ // `call`, just like a function.
137
+ function RawTask() {
138
+ this.task = null;
139
+ }
140
+
141
+ // The sole purpose of wrapping the task is to catch the exception and recycle
142
+ // the task object after its single use.
143
+ RawTask.prototype.call = function () {
144
+ try {
145
+ this.task.call();
146
+ } catch (error) {
147
+ if (asap.onerror) {
148
+ // This hook exists purely for testing purposes.
149
+ // Its name will be periodically randomized to break any code that
150
+ // depends on its existence.
151
+ asap.onerror(error);
152
+ } else {
153
+ // In a web browser, exceptions are not fatal. However, to avoid
154
+ // slowing down the queue of pending tasks, we rethrow the error in a
155
+ // lower priority turn.
156
+ pendingErrors.push(error);
157
+ requestErrorThrow();
158
+ }
159
+ } finally {
160
+ this.task = null;
161
+ freeTasks[freeTasks.length] = this;
162
+ }
163
+ };
164
+
165
+
166
+ /***/ }),
167
+
168
+ /***/ "./node_modules/asap/browser-raw.js":
169
+ /*!******************************************!*\
170
+ !*** ./node_modules/asap/browser-raw.js ***!
171
+ \******************************************/
172
+ /*! no static exports found */
173
+ /***/ (function(module, exports, __webpack_require__) {
174
+
175
+ "use strict";
176
+ /* WEBPACK VAR INJECTION */(function(global) {
177
+
178
+ // Use the fastest means possible to execute a task in its own turn, with
179
+ // priority over other events including IO, animation, reflow, and redraw
180
+ // events in browsers.
181
+ //
182
+ // An exception thrown by a task will permanently interrupt the processing of
183
+ // subsequent tasks. The higher level `asap` function ensures that if an
184
+ // exception is thrown by a task, that the task queue will continue flushing as
185
+ // soon as possible, but if you use `rawAsap` directly, you are responsible to
186
+ // either ensure that no exceptions are thrown from your task, or to manually
187
+ // call `rawAsap.requestFlush` if an exception is thrown.
188
+ module.exports = rawAsap;
189
+ function rawAsap(task) {
190
+ if (!queue.length) {
191
+ requestFlush();
192
+ flushing = true;
193
+ }
194
+ // Equivalent to push, but avoids a function call.
195
+ queue[queue.length] = task;
196
+ }
197
+
198
+ var queue = [];
199
+ // Once a flush has been requested, no further calls to `requestFlush` are
200
+ // necessary until the next `flush` completes.
201
+ var flushing = false;
202
+ // `requestFlush` is an implementation-specific method that attempts to kick
203
+ // off a `flush` event as quickly as possible. `flush` will attempt to exhaust
204
+ // the event queue before yielding to the browser's own event loop.
205
+ var requestFlush;
206
+ // The position of the next task to execute in the task queue. This is
207
+ // preserved between calls to `flush` so that it can be resumed if
208
+ // a task throws an exception.
209
+ var index = 0;
210
+ // If a task schedules additional tasks recursively, the task queue can grow
211
+ // unbounded. To prevent memory exhaustion, the task queue will periodically
212
+ // truncate already-completed tasks.
213
+ var capacity = 1024;
214
+
215
+ // The flush function processes all tasks that have been scheduled with
216
+ // `rawAsap` unless and until one of those tasks throws an exception.
217
+ // If a task throws an exception, `flush` ensures that its state will remain
218
+ // consistent and will resume where it left off when called again.
219
+ // However, `flush` does not make any arrangements to be called again if an
220
+ // exception is thrown.
221
+ function flush() {
222
+ while (index < queue.length) {
223
+ var currentIndex = index;
224
+ // Advance the index before calling the task. This ensures that we will
225
+ // begin flushing on the next task the task throws an error.
226
+ index = index + 1;
227
+ queue[currentIndex].call();
228
+ // Prevent leaking memory for long chains of recursive calls to `asap`.
229
+ // If we call `asap` within tasks scheduled by `asap`, the queue will
230
+ // grow, but to avoid an O(n) walk for every task we execute, we don't
231
+ // shift tasks off the queue after they have been executed.
232
+ // Instead, we periodically shift 1024 tasks off the queue.
233
+ if (index > capacity) {
234
+ // Manually shift all values starting at the index back to the
235
+ // beginning of the queue.
236
+ for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
237
+ queue[scan] = queue[scan + index];
238
+ }
239
+ queue.length -= index;
240
+ index = 0;
241
+ }
242
+ }
243
+ queue.length = 0;
244
+ index = 0;
245
+ flushing = false;
246
+ }
247
+
248
+ // `requestFlush` is implemented using a strategy based on data collected from
249
+ // every available SauceLabs Selenium web driver worker at time of writing.
250
+ // https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
251
+
252
+ // Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
253
+ // have WebKitMutationObserver but not un-prefixed MutationObserver.
254
+ // Must use `global` or `self` instead of `window` to work in both frames and web
255
+ // workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
256
+
257
+ /* globals self */
258
+ var scope = typeof global !== "undefined" ? global : self;
259
+ var BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;
260
+
261
+ // MutationObservers are desirable because they have high priority and work
262
+ // reliably everywhere they are implemented.
263
+ // They are implemented in all modern browsers.
264
+ //
265
+ // - Android 4-4.3
266
+ // - Chrome 26-34
267
+ // - Firefox 14-29
268
+ // - Internet Explorer 11
269
+ // - iPad Safari 6-7.1
270
+ // - iPhone Safari 7-7.1
271
+ // - Safari 6-7
272
+ if (typeof BrowserMutationObserver === "function") {
273
+ requestFlush = makeRequestCallFromMutationObserver(flush);
274
+
275
+ // MessageChannels are desirable because they give direct access to the HTML
276
+ // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
277
+ // 11-12, and in web workers in many engines.
278
+ // Although message channels yield to any queued rendering and IO tasks, they
279
+ // would be better than imposing the 4ms delay of timers.
280
+ // However, they do not work reliably in Internet Explorer or Safari.
281
+
282
+ // Internet Explorer 10 is the only browser that has setImmediate but does
283
+ // not have MutationObservers.
284
+ // Although setImmediate yields to the browser's renderer, it would be
285
+ // preferrable to falling back to setTimeout since it does not have
286
+ // the minimum 4ms penalty.
287
+ // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
288
+ // Desktop to a lesser extent) that renders both setImmediate and
289
+ // MessageChannel useless for the purposes of ASAP.
290
+ // https://github.com/kriskowal/q/issues/396
291
+
292
+ // Timers are implemented universally.
293
+ // We fall back to timers in workers in most engines, and in foreground
294
+ // contexts in the following browsers.
295
+ // However, note that even this simple case requires nuances to operate in a
296
+ // broad spectrum of browsers.
297
+ //
298
+ // - Firefox 3-13
299
+ // - Internet Explorer 6-9
300
+ // - iPad Safari 4.3
301
+ // - Lynx 2.8.7
302
+ } else {
303
+ requestFlush = makeRequestCallFromTimer(flush);
304
+ }
305
+
306
+ // `requestFlush` requests that the high priority event queue be flushed as
307
+ // soon as possible.
308
+ // This is useful to prevent an error thrown in a task from stalling the event
309
+ // queue if the exception handled by Node.js’s
310
+ // `process.on("uncaughtException")` or by a domain.
311
+ rawAsap.requestFlush = requestFlush;
312
+
313
+ // To request a high priority event, we induce a mutation observer by toggling
314
+ // the text of a text node between "1" and "-1".
315
+ function makeRequestCallFromMutationObserver(callback) {
316
+ var toggle = 1;
317
+ var observer = new BrowserMutationObserver(callback);
318
+ var node = document.createTextNode("");
319
+ observer.observe(node, {characterData: true});
320
+ return function requestCall() {
321
+ toggle = -toggle;
322
+ node.data = toggle;
323
+ };
324
+ }
325
+
326
+ // The message channel technique was discovered by Malte Ubl and was the
327
+ // original foundation for this library.
328
+ // http://www.nonblocking.io/2011/06/windownexttick.html
329
+
330
+ // Safari 6.0.5 (at least) intermittently fails to create message ports on a
331
+ // page's first load. Thankfully, this version of Safari supports
332
+ // MutationObservers, so we don't need to fall back in that case.
333
+
334
+ // function makeRequestCallFromMessageChannel(callback) {
335
+ // var channel = new MessageChannel();
336
+ // channel.port1.onmessage = callback;
337
+ // return function requestCall() {
338
+ // channel.port2.postMessage(0);
339
+ // };
340
+ // }
341
+
342
+ // For reasons explained above, we are also unable to use `setImmediate`
343
+ // under any circumstances.
344
+ // Even if we were, there is another bug in Internet Explorer 10.
345
+ // It is not sufficient to assign `setImmediate` to `requestFlush` because
346
+ // `setImmediate` must be called *by name* and therefore must be wrapped in a
347
+ // closure.
348
+ // Never forget.
349
+
350
+ // function makeRequestCallFromSetImmediate(callback) {
351
+ // return function requestCall() {
352
+ // setImmediate(callback);
353
+ // };
354
+ // }
355
+
356
+ // Safari 6.0 has a problem where timers will get lost while the user is
357
+ // scrolling. This problem does not impact ASAP because Safari 6.0 supports
358
+ // mutation observers, so that implementation is used instead.
359
+ // However, if we ever elect to use timers in Safari, the prevalent work-around
360
+ // is to add a scroll event listener that calls for a flush.
361
+
362
+ // `setTimeout` does not call the passed callback if the delay is less than
363
+ // approximately 7 in web workers in Firefox 8 through 18, and sometimes not
364
+ // even then.
365
+
366
+ function makeRequestCallFromTimer(callback) {
367
+ return function requestCall() {
368
+ // We dispatch a timeout with a specified delay of 0 for engines that
369
+ // can reliably accommodate that request. This will usually be snapped
370
+ // to a 4 milisecond delay, but once we're flushing, there's no delay
371
+ // between events.
372
+ var timeoutHandle = setTimeout(handleTimer, 0);
373
+ // However, since this timer gets frequently dropped in Firefox
374
+ // workers, we enlist an interval handle that will try to fire
375
+ // an event 20 times per second until it succeeds.
376
+ var intervalHandle = setInterval(handleTimer, 50);
377
+
378
+ function handleTimer() {
379
+ // Whichever timer succeeds will cancel both timers and
380
+ // execute the callback.
381
+ clearTimeout(timeoutHandle);
382
+ clearInterval(intervalHandle);
383
+ callback();
384
+ }
385
+ };
386
+ }
387
+
388
+ // This is for `asap.js` only.
389
+ // Its name will be periodically randomized to break any code that depends on
390
+ // its existence.
391
+ rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;
392
+
393
+ // ASAP was originally a nextTick shim included in Q. This was factored out
394
+ // into this ASAP package. It was later adapted to RSVP which made further
395
+ // amendments. These decisions, particularly to marginalize MessageChannel and
396
+ // to capture the MutationObserver implementation in a closure, were integrated
397
+ // back into ASAP proper.
398
+ // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
399
+
400
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
401
+
402
+ /***/ }),
403
+
404
+ /***/ "./node_modules/webpack/buildin/global.js":
405
+ /*!***********************************!*\
406
+ !*** (webpack)/buildin/global.js ***!
407
+ \***********************************/
408
+ /*! no static exports found */
409
+ /***/ (function(module, exports) {
410
+
411
+ var g;
412
+
413
+ // This works in non-strict mode
414
+ g = (function() {
415
+ return this;
416
+ })();
417
+
418
+ try {
419
+ // This works if eval is allowed (see CSP)
420
+ g = g || new Function("return this")();
421
+ } catch (e) {
422
+ // This works if the window reference is available
423
+ if (typeof window === "object") g = window;
424
+ }
425
+
426
+ // g can still be undefined, but nothing to do about it...
427
+ // We return undefined, instead of nothing here, so it's
428
+ // easier to handle this case. if(!global) { ...}
429
+
430
+ module.exports = g;
431
+
432
+
433
+ /***/ }),
434
+
435
+ /***/ "./src/faye_browser.js":
436
+ /*!*****************************!*\
437
+ !*** ./src/faye_browser.js ***!
438
+ \*****************************/
439
+ /*! no static exports found */
440
+ /***/ (function(module, exports, __webpack_require__) {
441
+
442
+ "use strict";
443
+
444
+
445
+ var constants = __webpack_require__(/*! ./util/constants */ "./src/util/constants.js"),
446
+ Logging = __webpack_require__(/*! ./mixins/logging */ "./src/mixins/logging.js");
447
+
448
+ var Faye = {
449
+ VERSION: constants.VERSION,
450
+
451
+ Client: __webpack_require__(/*! ./protocol/client */ "./src/protocol/client.js"),
452
+ Scheduler: __webpack_require__(/*! ./protocol/scheduler */ "./src/protocol/scheduler.js")
453
+ };
454
+
455
+ Logging.wrapper = Faye;
456
+
457
+ module.exports = Faye;
458
+
459
+
460
+ /***/ }),
461
+
462
+ /***/ "./src/mixins/deferrable.js":
463
+ /*!**********************************!*\
464
+ !*** ./src/mixins/deferrable.js ***!
465
+ \**********************************/
466
+ /*! no static exports found */
467
+ /***/ (function(module, exports, __webpack_require__) {
468
+
469
+ "use strict";
470
+ /* WEBPACK VAR INJECTION */(function(global) {
471
+
472
+ var Promise = __webpack_require__(/*! ../util/promise */ "./src/util/promise.js");
473
+
474
+ module.exports = {
475
+ then: function(callback, errback) {
476
+ var self = this;
477
+ if (!this._promise)
478
+ this._promise = new Promise(function(resolve, reject) {
479
+ self._resolve = resolve;
480
+ self._reject = reject;
481
+ });
482
+
483
+ if (arguments.length === 0)
484
+ return this._promise;
485
+ else
486
+ return this._promise.then(callback, errback);
487
+ },
488
+
489
+ callback: function(callback, context) {
490
+ return this.then(function(value) { callback.call(context, value) });
491
+ },
492
+
493
+ errback: function(callback, context) {
494
+ return this.then(null, function(reason) { callback.call(context, reason) });
495
+ },
496
+
497
+ timeout: function(seconds, message) {
498
+ this.then();
499
+ var self = this;
500
+ this._timer = global.setTimeout(function() {
501
+ self._reject(message);
502
+ }, seconds * 1000);
503
+ },
504
+
505
+ setDeferredStatus: function(status, value) {
506
+ if (this._timer) global.clearTimeout(this._timer);
507
+
508
+ this.then();
509
+
510
+ if (status === 'succeeded')
511
+ this._resolve(value);
512
+ else if (status === 'failed')
513
+ this._reject(value);
514
+ else
515
+ delete this._promise;
516
+ }
517
+ };
518
+
519
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
520
+
521
+ /***/ }),
522
+
523
+ /***/ "./src/mixins/logging.js":
524
+ /*!*******************************!*\
525
+ !*** ./src/mixins/logging.js ***!
526
+ \*******************************/
527
+ /*! no static exports found */
528
+ /***/ (function(module, exports, __webpack_require__) {
529
+
530
+ "use strict";
531
+
532
+
533
+ var toJSON = __webpack_require__(/*! ../util/to_json */ "./src/util/to_json.js");
534
+
535
+ var Logging = {
536
+ LOG_LEVELS: {
537
+ fatal: 4,
538
+ error: 3,
539
+ warn: 2,
540
+ info: 1,
541
+ debug: 0
542
+ },
543
+
544
+ writeLog: function(messageArgs, level) {
545
+ var logger = Logging.logger || (Logging.wrapper || Logging).logger;
546
+ if (!logger) return;
547
+
548
+ var args = Array.prototype.slice.apply(messageArgs),
549
+ banner = '[Faye',
550
+ klass = this.className,
551
+
552
+ message = args.shift().replace(/\?/g, function() {
553
+ try {
554
+ return toJSON(args.shift());
555
+ } catch (error) {
556
+ return '[Object]';
557
+ }
558
+ });
559
+
560
+ if (klass) banner += '.' + klass;
561
+ banner += '] ';
562
+
563
+ if (typeof logger[level] === 'function')
564
+ logger[level](banner + message);
565
+ else if (typeof logger === 'function')
566
+ logger(banner + message);
567
+ }
568
+ };
569
+
570
+ for (var key in Logging.LOG_LEVELS)
571
+ (function(level) {
572
+ Logging[level] = function() {
573
+ this.writeLog(arguments, level);
574
+ };
575
+ })(key);
576
+
577
+ module.exports = Logging;
578
+
579
+
580
+ /***/ }),
581
+
582
+ /***/ "./src/mixins/publisher.js":
583
+ /*!*********************************!*\
584
+ !*** ./src/mixins/publisher.js ***!
585
+ \*********************************/
586
+ /*! no static exports found */
587
+ /***/ (function(module, exports, __webpack_require__) {
588
+
589
+ "use strict";
590
+
591
+
592
+ var assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
593
+ EventEmitter = __webpack_require__(/*! ../util/event_emitter */ "./src/util/event_emitter.js");
594
+
595
+ var Publisher = {
596
+ countListeners: function(eventType) {
597
+ return this.listeners(eventType).length;
598
+ },
599
+
600
+ bind: function(eventType, listener, context) {
601
+ var slice = Array.prototype.slice,
602
+ handler = function() { listener.apply(context, slice.call(arguments)) };
603
+
604
+ this._listeners = this._listeners || [];
605
+ this._listeners.push([eventType, listener, context, handler]);
606
+ return this.on(eventType, handler);
607
+ },
608
+
609
+ unbind: function(eventType, listener, context) {
610
+ this._listeners = this._listeners || [];
611
+ var n = this._listeners.length, tuple;
612
+
613
+ while (n--) {
614
+ tuple = this._listeners[n];
615
+ if (tuple[0] !== eventType) continue;
616
+ if (listener && (tuple[1] !== listener || tuple[2] !== context)) continue;
617
+ this._listeners.splice(n, 1);
618
+ this.removeListener(eventType, tuple[3]);
619
+ }
620
+ }
621
+ };
622
+
623
+ assign(Publisher, EventEmitter.prototype);
624
+ Publisher.trigger = Publisher.emit;
625
+
626
+ module.exports = Publisher;
627
+
628
+
629
+ /***/ }),
630
+
631
+ /***/ "./src/mixins/timeouts.js":
632
+ /*!********************************!*\
633
+ !*** ./src/mixins/timeouts.js ***!
634
+ \********************************/
635
+ /*! no static exports found */
636
+ /***/ (function(module, exports, __webpack_require__) {
637
+
638
+ "use strict";
639
+ /* WEBPACK VAR INJECTION */(function(global) {
640
+
641
+ module.exports = {
642
+ addTimeout: function(name, delay, callback, context) {
643
+ this._timeouts = this._timeouts || {};
644
+ if (this._timeouts.hasOwnProperty(name)) return;
645
+ var self = this;
646
+ this._timeouts[name] = global.setTimeout(function() {
647
+ delete self._timeouts[name];
648
+ callback.call(context);
649
+ }, 1000 * delay);
650
+ },
651
+
652
+ removeTimeout: function(name) {
653
+ this._timeouts = this._timeouts || {};
654
+ var timeout = this._timeouts[name];
655
+ if (!timeout) return;
656
+ global.clearTimeout(timeout);
657
+ delete this._timeouts[name];
658
+ },
659
+
660
+ removeAllTimeouts: function() {
661
+ this._timeouts = this._timeouts || {};
662
+ for (var name in this._timeouts) this.removeTimeout(name);
663
+ }
664
+ };
665
+
666
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
667
+
668
+ /***/ }),
669
+
670
+ /***/ "./src/protocol/channel.js":
671
+ /*!*********************************!*\
672
+ !*** ./src/protocol/channel.js ***!
673
+ \*********************************/
674
+ /*! no static exports found */
675
+ /***/ (function(module, exports, __webpack_require__) {
676
+
677
+ "use strict";
678
+
679
+
680
+ var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
681
+ assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
682
+ Publisher = __webpack_require__(/*! ../mixins/publisher */ "./src/mixins/publisher.js"),
683
+ Grammar = __webpack_require__(/*! ./grammar */ "./src/protocol/grammar.js");
684
+
685
+ var Channel = Class({
686
+ initialize: function(name) {
687
+ this.id = this.name = name;
688
+ },
689
+
690
+ push: function(message) {
691
+ this.trigger('message', message);
692
+ },
693
+
694
+ isUnused: function() {
695
+ return this.countListeners('message') === 0;
696
+ }
697
+ });
698
+
699
+ assign(Channel.prototype, Publisher);
700
+
701
+ assign(Channel, {
702
+ HANDSHAKE: '/meta/handshake',
703
+ CONNECT: '/meta/connect',
704
+ SUBSCRIBE: '/meta/subscribe',
705
+ UNSUBSCRIBE: '/meta/unsubscribe',
706
+ DISCONNECT: '/meta/disconnect',
707
+
708
+ META: 'meta',
709
+ SERVICE: 'service',
710
+
711
+ expand: function(name) {
712
+ var segments = this.parse(name),
713
+ channels = ['/**', name];
714
+
715
+ var copy = segments.slice();
716
+ copy[copy.length - 1] = '*';
717
+ channels.push(this.unparse(copy));
718
+
719
+ for (var i = 1, n = segments.length; i < n; i++) {
720
+ copy = segments.slice(0, i);
721
+ copy.push('**');
722
+ channels.push(this.unparse(copy));
723
+ }
724
+
725
+ return channels;
726
+ },
727
+
728
+ isValid: function(name) {
729
+ return Grammar.CHANNEL_NAME.test(name) ||
730
+ Grammar.CHANNEL_PATTERN.test(name);
731
+ },
732
+
733
+ parse: function(name) {
734
+ if (!this.isValid(name)) return null;
735
+ return name.split('/').slice(1);
736
+ },
737
+
738
+ unparse: function(segments) {
739
+ return '/' + segments.join('/');
740
+ },
741
+
742
+ isMeta: function(name) {
743
+ var segments = this.parse(name);
744
+ return segments ? (segments[0] === this.META) : null;
745
+ },
746
+
747
+ isService: function(name) {
748
+ var segments = this.parse(name);
749
+ return segments ? (segments[0] === this.SERVICE) : null;
750
+ },
751
+
752
+ isSubscribable: function(name) {
753
+ if (!this.isValid(name)) return null;
754
+ return !this.isMeta(name) && !this.isService(name);
755
+ },
756
+
757
+ Set: Class({
758
+ initialize: function() {
759
+ this._channels = {};
760
+ },
761
+
762
+ getKeys: function() {
763
+ var keys = [];
764
+ for (var key in this._channels) keys.push(key);
765
+ return keys;
766
+ },
767
+
768
+ remove: function(name) {
769
+ delete this._channels[name];
770
+ },
771
+
772
+ hasSubscription: function(name) {
773
+ return this._channels.hasOwnProperty(name);
774
+ },
775
+
776
+ subscribe: function(names, subscription) {
777
+ var name;
778
+ for (var i = 0, n = names.length; i < n; i++) {
779
+ name = names[i];
780
+ var channel = this._channels[name] = this._channels[name] || new Channel(name);
781
+ channel.bind('message', subscription);
782
+ }
783
+ },
784
+
785
+ unsubscribe: function(name, subscription) {
786
+ var channel = this._channels[name];
787
+ if (!channel) return false;
788
+ channel.unbind('message', subscription);
789
+
790
+ if (channel.isUnused()) {
791
+ this.remove(name);
792
+ return true;
793
+ } else {
794
+ return false;
795
+ }
796
+ },
797
+
798
+ distributeMessage: function(message) {
799
+ var channels = Channel.expand(message.channel);
800
+
801
+ for (var i = 0, n = channels.length; i < n; i++) {
802
+ var channel = this._channels[channels[i]];
803
+ if (channel) channel.trigger('message', message);
804
+ }
805
+ }
806
+ })
807
+ });
808
+
809
+ module.exports = Channel;
810
+
811
+
812
+ /***/ }),
813
+
814
+ /***/ "./src/protocol/client.js":
815
+ /*!********************************!*\
816
+ !*** ./src/protocol/client.js ***!
817
+ \********************************/
818
+ /*! no static exports found */
819
+ /***/ (function(module, exports, __webpack_require__) {
820
+
821
+ "use strict";
822
+ /* WEBPACK VAR INJECTION */(function(global) {
823
+
824
+ var asap = __webpack_require__(/*! asap */ "./node_modules/asap/browser-asap.js"),
825
+ Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
826
+ Promise = __webpack_require__(/*! ../util/promise */ "./src/util/promise.js"),
827
+ array = __webpack_require__(/*! ../util/array */ "./src/util/array.js"),
828
+ browser = __webpack_require__(/*! ../util/browser */ "./src/util/browser/event.js"),
829
+ constants = __webpack_require__(/*! ../util/constants */ "./src/util/constants.js"),
830
+ assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
831
+ validateOptions = __webpack_require__(/*! ../util/validate_options */ "./src/util/validate_options.js"),
832
+ Deferrable = __webpack_require__(/*! ../mixins/deferrable */ "./src/mixins/deferrable.js"),
833
+ Logging = __webpack_require__(/*! ../mixins/logging */ "./src/mixins/logging.js"),
834
+ Publisher = __webpack_require__(/*! ../mixins/publisher */ "./src/mixins/publisher.js"),
835
+ Channel = __webpack_require__(/*! ./channel */ "./src/protocol/channel.js"),
836
+ Dispatcher = __webpack_require__(/*! ./dispatcher */ "./src/protocol/dispatcher.js"),
837
+ Error = __webpack_require__(/*! ./error */ "./src/protocol/error.js"),
838
+ Extensible = __webpack_require__(/*! ./extensible */ "./src/protocol/extensible.js"),
839
+ Publication = __webpack_require__(/*! ./publication */ "./src/protocol/publication.js"),
840
+ Subscription = __webpack_require__(/*! ./subscription */ "./src/protocol/subscription.js");
841
+
842
+ var Client = Class({ className: 'Client',
843
+ UNCONNECTED: 1,
844
+ CONNECTING: 2,
845
+ CONNECTED: 3,
846
+ DISCONNECTED: 4,
847
+
848
+ HANDSHAKE: 'handshake',
849
+ RETRY: 'retry',
850
+ NONE: 'none',
851
+
852
+ CONNECTION_TIMEOUT: 60,
853
+
854
+ DEFAULT_ENDPOINT: '/bayeux',
855
+ INTERVAL: 0,
856
+
857
+ initialize: function(endpoint, options) {
858
+ this.info('New client created for ?', endpoint);
859
+ options = options || {};
860
+
861
+ validateOptions(options, ['interval', 'timeout', 'endpoints', 'proxy', 'retry', 'scheduler', 'websocketExtensions', 'tls', 'ca']);
862
+
863
+ this._channels = new Channel.Set();
864
+ this._dispatcher = Dispatcher.create(this, endpoint || this.DEFAULT_ENDPOINT, options);
865
+
866
+ this._messageId = 0;
867
+ this._state = this.UNCONNECTED;
868
+
869
+ this._responseCallbacks = {};
870
+
871
+ this._advice = {
872
+ reconnect: this.RETRY,
873
+ interval: 1000 * (options.interval || this.INTERVAL),
874
+ timeout: 1000 * (options.timeout || this.CONNECTION_TIMEOUT)
875
+ };
876
+ this._dispatcher.timeout = this._advice.timeout / 1000;
877
+
878
+ this._dispatcher.bind('message', this._receiveMessage, this);
879
+
880
+ if (browser.Event && global.onbeforeunload !== undefined)
881
+ browser.Event.on(global, 'beforeunload', function() {
882
+ if (array.indexOf(this._dispatcher._disabled, 'autodisconnect') < 0)
883
+ this.disconnect();
884
+ }, this);
885
+ },
886
+
887
+ addWebsocketExtension: function(extension) {
888
+ return this._dispatcher.addWebsocketExtension(extension);
889
+ },
890
+
891
+ disable: function(feature) {
892
+ return this._dispatcher.disable(feature);
893
+ },
894
+
895
+ setHeader: function(name, value) {
896
+ return this._dispatcher.setHeader(name, value);
897
+ },
898
+
899
+ // Request
900
+ // MUST include: * channel
901
+ // * version
902
+ // * supportedConnectionTypes
903
+ // MAY include: * minimumVersion
904
+ // * ext
905
+ // * id
906
+ //
907
+ // Success Response Failed Response
908
+ // MUST include: * channel MUST include: * channel
909
+ // * version * successful
910
+ // * supportedConnectionTypes * error
911
+ // * clientId MAY include: * supportedConnectionTypes
912
+ // * successful * advice
913
+ // MAY include: * minimumVersion * version
914
+ // * advice * minimumVersion
915
+ // * ext * ext
916
+ // * id * id
917
+ // * authSuccessful
918
+ handshake: function(callback, context) {
919
+ if (this._advice.reconnect === this.NONE) return;
920
+ if (this._state !== this.UNCONNECTED) return;
921
+
922
+ this._state = this.CONNECTING;
923
+ var self = this;
924
+
925
+ this.info('Initiating handshake with ?', this._dispatcher.endpoint.href);
926
+ this._dispatcher.selectTransport(constants.MANDATORY_CONNECTION_TYPES);
927
+
928
+ this._sendMessage({
929
+ channel: Channel.HANDSHAKE,
930
+ version: constants.BAYEUX_VERSION,
931
+ supportedConnectionTypes: this._dispatcher.getConnectionTypes()
932
+
933
+ }, {}, function(response) {
934
+
935
+ if (response.successful) {
936
+ this._state = this.CONNECTED;
937
+ this._dispatcher.clientId = response.clientId;
938
+
939
+ this._dispatcher.selectTransport(response.supportedConnectionTypes);
940
+
941
+ this.info('Handshake successful: ?', this._dispatcher.clientId);
942
+
943
+ this.subscribe(this._channels.getKeys(), true);
944
+ if (callback) asap(function() { callback.call(context) });
945
+
946
+ } else {
947
+ this.info('Handshake unsuccessful');
948
+ global.setTimeout(function() { self.handshake(callback, context) }, this._dispatcher.retry * 1000);
949
+ this._state = this.UNCONNECTED;
950
+ }
951
+ }, this);
952
+ },
953
+
954
+ // Request Response
955
+ // MUST include: * channel MUST include: * channel
956
+ // * clientId * successful
957
+ // * connectionType * clientId
958
+ // MAY include: * ext MAY include: * error
959
+ // * id * advice
960
+ // * ext
961
+ // * id
962
+ // * timestamp
963
+ connect: function(callback, context) {
964
+ if (this._advice.reconnect === this.NONE) return;
965
+ if (this._state === this.DISCONNECTED) return;
966
+
967
+ if (this._state === this.UNCONNECTED)
968
+ return this.handshake(function() { this.connect(callback, context) }, this);
969
+
970
+ this.callback(callback, context);
971
+ if (this._state !== this.CONNECTED) return;
972
+
973
+ this.info('Calling deferred actions for ?', this._dispatcher.clientId);
974
+ this.setDeferredStatus('succeeded');
975
+ this.setDeferredStatus('unknown');
976
+
977
+ if (this._connectRequest) return;
978
+ this._connectRequest = true;
979
+
980
+ this.info('Initiating connection for ?', this._dispatcher.clientId);
981
+
982
+ this._sendMessage({
983
+ channel: Channel.CONNECT,
984
+ clientId: this._dispatcher.clientId,
985
+ connectionType: this._dispatcher.connectionType
986
+
987
+ }, {}, this._cycleConnection, this);
988
+ },
989
+
990
+ // Request Response
991
+ // MUST include: * channel MUST include: * channel
992
+ // * clientId * successful
993
+ // MAY include: * ext * clientId
994
+ // * id MAY include: * error
995
+ // * ext
996
+ // * id
997
+ disconnect: function() {
998
+ if (this._state !== this.CONNECTED) return;
999
+ this._state = this.DISCONNECTED;
1000
+
1001
+ this.info('Disconnecting ?', this._dispatcher.clientId);
1002
+ var promise = new Publication();
1003
+
1004
+ this._sendMessage({
1005
+ channel: Channel.DISCONNECT,
1006
+ clientId: this._dispatcher.clientId
1007
+
1008
+ }, {}, function(response) {
1009
+ if (response.successful) {
1010
+ this._dispatcher.close();
1011
+ promise.setDeferredStatus('succeeded');
1012
+ } else {
1013
+ promise.setDeferredStatus('failed', Error.parse(response.error));
1014
+ }
1015
+ }, this);
1016
+
1017
+ this.info('Clearing channel listeners for ?', this._dispatcher.clientId);
1018
+ this._channels = new Channel.Set();
1019
+
1020
+ return promise;
1021
+ },
1022
+
1023
+ // Request Response
1024
+ // MUST include: * channel MUST include: * channel
1025
+ // * clientId * successful
1026
+ // * subscription * clientId
1027
+ // MAY include: * ext * subscription
1028
+ // * id MAY include: * error
1029
+ // * advice
1030
+ // * ext
1031
+ // * id
1032
+ // * timestamp
1033
+ subscribe: function(channel, callback, context) {
1034
+ if (channel instanceof Array)
1035
+ return array.map(channel, function(c) {
1036
+ return this.subscribe(c, callback, context);
1037
+ }, this);
1038
+
1039
+ var subscription = new Subscription(this, channel, callback, context),
1040
+ force = (callback === true),
1041
+ hasSubscribe = this._channels.hasSubscription(channel);
1042
+
1043
+ if (hasSubscribe && !force) {
1044
+ this._channels.subscribe([channel], subscription);
1045
+ subscription.setDeferredStatus('succeeded');
1046
+ return subscription;
1047
+ }
1048
+
1049
+ this.connect(function() {
1050
+ this.info('Client ? attempting to subscribe to ?', this._dispatcher.clientId, channel);
1051
+ if (!force) this._channels.subscribe([channel], subscription);
1052
+
1053
+ this._sendMessage({
1054
+ channel: Channel.SUBSCRIBE,
1055
+ clientId: this._dispatcher.clientId,
1056
+ subscription: channel
1057
+
1058
+ }, {}, function(response) {
1059
+ if (!response.successful) {
1060
+ subscription.setDeferredStatus('failed', Error.parse(response.error));
1061
+ return this._channels.unsubscribe(channel, subscription);
1062
+ }
1063
+
1064
+ var channels = [].concat(response.subscription);
1065
+ this.info('Subscription acknowledged for ? to ?', this._dispatcher.clientId, channels);
1066
+ subscription.setDeferredStatus('succeeded');
1067
+ }, this);
1068
+ }, this);
1069
+
1070
+ return subscription;
1071
+ },
1072
+
1073
+ // Request Response
1074
+ // MUST include: * channel MUST include: * channel
1075
+ // * clientId * successful
1076
+ // * subscription * clientId
1077
+ // MAY include: * ext * subscription
1078
+ // * id MAY include: * error
1079
+ // * advice
1080
+ // * ext
1081
+ // * id
1082
+ // * timestamp
1083
+ unsubscribe: function(channel, subscription) {
1084
+ if (channel instanceof Array)
1085
+ return array.map(channel, function(c) {
1086
+ return this.unsubscribe(c, subscription);
1087
+ }, this);
1088
+
1089
+ var dead = this._channels.unsubscribe(channel, subscription);
1090
+ if (!dead) return;
1091
+
1092
+ this.connect(function() {
1093
+ this.info('Client ? attempting to unsubscribe from ?', this._dispatcher.clientId, channel);
1094
+
1095
+ this._sendMessage({
1096
+ channel: Channel.UNSUBSCRIBE,
1097
+ clientId: this._dispatcher.clientId,
1098
+ subscription: channel
1099
+
1100
+ }, {}, function(response) {
1101
+ if (!response.successful) return;
1102
+
1103
+ var channels = [].concat(response.subscription);
1104
+ this.info('Unsubscription acknowledged for ? from ?', this._dispatcher.clientId, channels);
1105
+ }, this);
1106
+ }, this);
1107
+ },
1108
+
1109
+ // Request Response
1110
+ // MUST include: * channel MUST include: * channel
1111
+ // * data * successful
1112
+ // MAY include: * clientId MAY include: * id
1113
+ // * id * error
1114
+ // * ext * ext
1115
+ publish: function(channel, data, options) {
1116
+ validateOptions(options || {}, ['attempts', 'deadline']);
1117
+ var publication = new Publication();
1118
+
1119
+ this.connect(function() {
1120
+ this.info('Client ? queueing published message to ?: ?', this._dispatcher.clientId, channel, data);
1121
+
1122
+ this._sendMessage({
1123
+ channel: channel,
1124
+ data: data,
1125
+ clientId: this._dispatcher.clientId
1126
+
1127
+ }, options, function(response) {
1128
+ if (response.successful)
1129
+ publication.setDeferredStatus('succeeded');
1130
+ else
1131
+ publication.setDeferredStatus('failed', Error.parse(response.error));
1132
+ }, this);
1133
+ }, this);
1134
+
1135
+ return publication;
1136
+ },
1137
+
1138
+ _sendMessage: function(message, options, callback, context) {
1139
+ message.id = this._generateMessageId();
1140
+
1141
+ var timeout = this._advice.timeout
1142
+ ? 1.2 * this._advice.timeout / 1000
1143
+ : 1.2 * this._dispatcher.retry;
1144
+
1145
+ this.pipeThroughExtensions('outgoing', message, null, function(message) {
1146
+ if (!message) return;
1147
+ if (callback) this._responseCallbacks[message.id] = [callback, context];
1148
+ this._dispatcher.sendMessage(message, timeout, options || {});
1149
+ }, this);
1150
+ },
1151
+
1152
+ _generateMessageId: function() {
1153
+ this._messageId += 1;
1154
+ if (this._messageId >= Math.pow(2,32)) this._messageId = 0;
1155
+ return this._messageId.toString(36);
1156
+ },
1157
+
1158
+ _receiveMessage: function(message) {
1159
+ var id = message.id, callback;
1160
+
1161
+ if (message.successful !== undefined) {
1162
+ callback = this._responseCallbacks[id];
1163
+ delete this._responseCallbacks[id];
1164
+ }
1165
+
1166
+ this.pipeThroughExtensions('incoming', message, null, function(message) {
1167
+ if (!message) return;
1168
+ if (message.advice) this._handleAdvice(message.advice);
1169
+ this._deliverMessage(message);
1170
+ if (callback) callback[0].call(callback[1], message);
1171
+ }, this);
1172
+ },
1173
+
1174
+ _handleAdvice: function(advice) {
1175
+ assign(this._advice, advice);
1176
+ this._dispatcher.timeout = this._advice.timeout / 1000;
1177
+
1178
+ if (this._advice.reconnect === this.HANDSHAKE && this._state !== this.DISCONNECTED) {
1179
+ this._state = this.UNCONNECTED;
1180
+ this._dispatcher.clientId = null;
1181
+ this._cycleConnection();
1182
+ }
1183
+ },
1184
+
1185
+ _deliverMessage: function(message) {
1186
+ if (!message.channel || message.data === undefined) return;
1187
+ this.info('Client ? calling listeners for ? with ?', this._dispatcher.clientId, message.channel, message.data);
1188
+ this._channels.distributeMessage(message);
1189
+ },
1190
+
1191
+ _cycleConnection: function() {
1192
+ if (this._connectRequest) {
1193
+ this._connectRequest = null;
1194
+ this.info('Closed connection for ?', this._dispatcher.clientId);
1195
+ }
1196
+ var self = this;
1197
+ global.setTimeout(function() { self.connect() }, this._advice.interval);
1198
+ }
1199
+ });
1200
+
1201
+ assign(Client.prototype, Deferrable);
1202
+ assign(Client.prototype, Publisher);
1203
+ assign(Client.prototype, Logging);
1204
+ assign(Client.prototype, Extensible);
1205
+
1206
+ module.exports = Client;
1207
+
1208
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
1209
+
1210
+ /***/ }),
1211
+
1212
+ /***/ "./src/protocol/dispatcher.js":
1213
+ /*!************************************!*\
1214
+ !*** ./src/protocol/dispatcher.js ***!
1215
+ \************************************/
1216
+ /*! no static exports found */
1217
+ /***/ (function(module, exports, __webpack_require__) {
1218
+
1219
+ "use strict";
1220
+ /* WEBPACK VAR INJECTION */(function(global) {
1221
+
1222
+ var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
1223
+ URI = __webpack_require__(/*! ../util/uri */ "./src/util/uri.js"),
1224
+ cookies = __webpack_require__(/*! ../util/cookies */ "./src/util/cookies/browser_cookies.js"),
1225
+ assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
1226
+ Logging = __webpack_require__(/*! ../mixins/logging */ "./src/mixins/logging.js"),
1227
+ Publisher = __webpack_require__(/*! ../mixins/publisher */ "./src/mixins/publisher.js"),
1228
+ Transport = __webpack_require__(/*! ../transport */ "./src/transport/browser_transports.js"),
1229
+ Scheduler = __webpack_require__(/*! ./scheduler */ "./src/protocol/scheduler.js");
1230
+
1231
+ var Dispatcher = Class({ className: 'Dispatcher',
1232
+ MAX_REQUEST_SIZE: 2048,
1233
+ DEFAULT_RETRY: 5,
1234
+
1235
+ UP: 1,
1236
+ DOWN: 2,
1237
+
1238
+ initialize: function(client, endpoint, options) {
1239
+ this._client = client;
1240
+ this.endpoint = URI.parse(endpoint);
1241
+ this._alternates = options.endpoints || {};
1242
+
1243
+ this.cookies = cookies.CookieJar && new cookies.CookieJar();
1244
+ this._disabled = [];
1245
+ this._envelopes = {};
1246
+ this.headers = {};
1247
+ this.retry = options.retry || this.DEFAULT_RETRY;
1248
+ this._scheduler = options.scheduler || Scheduler;
1249
+ this._state = 0;
1250
+ this.transports = {};
1251
+ this.wsExtensions = [];
1252
+
1253
+ this.proxy = options.proxy || {};
1254
+ if (typeof this._proxy === 'string') this._proxy = { origin: this._proxy };
1255
+
1256
+ var exts = options.websocketExtensions;
1257
+ if (exts) {
1258
+ exts = [].concat(exts);
1259
+ for (var i = 0, n = exts.length; i < n; i++)
1260
+ this.addWebsocketExtension(exts[i]);
1261
+ }
1262
+
1263
+ this.tls = options.tls || {};
1264
+ this.tls.ca = this.tls.ca || options.ca;
1265
+
1266
+ for (var type in this._alternates)
1267
+ this._alternates[type] = URI.parse(this._alternates[type]);
1268
+
1269
+ this.maxRequestSize = this.MAX_REQUEST_SIZE;
1270
+ },
1271
+
1272
+ endpointFor: function(connectionType) {
1273
+ return this._alternates[connectionType] || this.endpoint;
1274
+ },
1275
+
1276
+ addWebsocketExtension: function(extension) {
1277
+ this.wsExtensions.push(extension);
1278
+ },
1279
+
1280
+ disable: function(feature) {
1281
+ this._disabled.push(feature);
1282
+ Transport.disable(feature);
1283
+ },
1284
+
1285
+ setHeader: function(name, value) {
1286
+ this.headers[name] = value;
1287
+ },
1288
+
1289
+ close: function() {
1290
+ var transport = this._transport;
1291
+ delete this._transport;
1292
+ if (transport) transport.close();
1293
+ },
1294
+
1295
+ getConnectionTypes: function() {
1296
+ return Transport.getConnectionTypes();
1297
+ },
1298
+
1299
+ selectTransport: function(transportTypes) {
1300
+ Transport.get(this, transportTypes, this._disabled, function(transport) {
1301
+ this.debug('Selected ? transport for ?', transport.connectionType, transport.endpoint.href);
1302
+
1303
+ if (transport === this._transport) return;
1304
+ if (this._transport) this._transport.close();
1305
+
1306
+ this._transport = transport;
1307
+ this.connectionType = transport.connectionType;
1308
+ }, this);
1309
+ },
1310
+
1311
+ sendMessage: function(message, timeout, options) {
1312
+ options = options || {};
1313
+
1314
+ var id = message.id,
1315
+ attempts = options.attempts,
1316
+ deadline = options.deadline && new Date().getTime() + (options.deadline * 1000),
1317
+ envelope = this._envelopes[id],
1318
+ scheduler;
1319
+
1320
+ if (!envelope) {
1321
+ scheduler = new this._scheduler(message, { timeout: timeout, interval: this.retry, attempts: attempts, deadline: deadline });
1322
+ envelope = this._envelopes[id] = { message: message, scheduler: scheduler };
1323
+ }
1324
+
1325
+ this._sendEnvelope(envelope);
1326
+ },
1327
+
1328
+ _sendEnvelope: function(envelope) {
1329
+ if (!this._transport) return;
1330
+ if (envelope.request || envelope.timer) return;
1331
+
1332
+ var message = envelope.message,
1333
+ scheduler = envelope.scheduler,
1334
+ self = this;
1335
+
1336
+ if (!scheduler.isDeliverable()) {
1337
+ scheduler.abort();
1338
+ delete this._envelopes[message.id];
1339
+ return;
1340
+ }
1341
+
1342
+ envelope.timer = global.setTimeout(function() {
1343
+ self.handleError(message);
1344
+ }, scheduler.getTimeout() * 1000);
1345
+
1346
+ scheduler.send();
1347
+ envelope.request = this._transport.sendMessage(message);
1348
+ },
1349
+
1350
+ handleResponse: function(reply) {
1351
+ var envelope = this._envelopes[reply.id];
1352
+
1353
+ if (reply.successful !== undefined && envelope) {
1354
+ envelope.scheduler.succeed();
1355
+ delete this._envelopes[reply.id];
1356
+ global.clearTimeout(envelope.timer);
1357
+ }
1358
+
1359
+ this.trigger('message', reply);
1360
+
1361
+ if (this._state === this.UP) return;
1362
+ this._state = this.UP;
1363
+ this._client.trigger('transport:up');
1364
+ },
1365
+
1366
+ handleError: function(message, immediate) {
1367
+ var envelope = this._envelopes[message.id],
1368
+ request = envelope && envelope.request,
1369
+ self = this;
1370
+
1371
+ if (!request) return;
1372
+
1373
+ request.then(function(req) {
1374
+ if (req && req.abort) req.abort();
1375
+ });
1376
+
1377
+ var scheduler = envelope.scheduler;
1378
+ scheduler.fail();
1379
+
1380
+ global.clearTimeout(envelope.timer);
1381
+ envelope.request = envelope.timer = null;
1382
+
1383
+ if (immediate) {
1384
+ this._sendEnvelope(envelope);
1385
+ } else {
1386
+ envelope.timer = global.setTimeout(function() {
1387
+ envelope.timer = null;
1388
+ self._sendEnvelope(envelope);
1389
+ }, scheduler.getInterval() * 1000);
1390
+ }
1391
+
1392
+ if (this._state === this.DOWN) return;
1393
+ this._state = this.DOWN;
1394
+ this._client.trigger('transport:down');
1395
+ }
1396
+ });
1397
+
1398
+ Dispatcher.create = function(client, endpoint, options) {
1399
+ return new Dispatcher(client, endpoint, options);
1400
+ };
1401
+
1402
+ assign(Dispatcher.prototype, Publisher);
1403
+ assign(Dispatcher.prototype, Logging);
1404
+
1405
+ module.exports = Dispatcher;
1406
+
1407
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
1408
+
1409
+ /***/ }),
1410
+
1411
+ /***/ "./src/protocol/error.js":
1412
+ /*!*******************************!*\
1413
+ !*** ./src/protocol/error.js ***!
1414
+ \*******************************/
1415
+ /*! no static exports found */
1416
+ /***/ (function(module, exports, __webpack_require__) {
1417
+
1418
+ "use strict";
1419
+
1420
+
1421
+ var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
1422
+ Grammar = __webpack_require__(/*! ./grammar */ "./src/protocol/grammar.js");
1423
+
1424
+ var Error = Class({
1425
+ initialize: function(code, params, message) {
1426
+ this.code = code;
1427
+ this.params = Array.prototype.slice.call(params);
1428
+ this.message = message;
1429
+ },
1430
+
1431
+ toString: function() {
1432
+ return this.code + ':' +
1433
+ this.params.join(',') + ':' +
1434
+ this.message;
1435
+ }
1436
+ });
1437
+
1438
+ Error.parse = function(message) {
1439
+ message = message || '';
1440
+ if (!Grammar.ERROR.test(message)) return new Error(null, [], message);
1441
+
1442
+ var parts = message.split(':'),
1443
+ code = parseInt(parts[0]),
1444
+ params = parts[1].split(','),
1445
+ message = parts[2];
1446
+
1447
+ return new Error(code, params, message);
1448
+ };
1449
+
1450
+ // http://code.google.com/p/cometd/wiki/BayeuxCodes
1451
+ var errors = {
1452
+ versionMismatch: [300, 'Version mismatch'],
1453
+ conntypeMismatch: [301, 'Connection types not supported'],
1454
+ extMismatch: [302, 'Extension mismatch'],
1455
+ badRequest: [400, 'Bad request'],
1456
+ clientUnknown: [401, 'Unknown client'],
1457
+ parameterMissing: [402, 'Missing required parameter'],
1458
+ channelForbidden: [403, 'Forbidden channel'],
1459
+ channelUnknown: [404, 'Unknown channel'],
1460
+ channelInvalid: [405, 'Invalid channel'],
1461
+ extUnknown: [406, 'Unknown extension'],
1462
+ publishFailed: [407, 'Failed to publish'],
1463
+ serverError: [500, 'Internal server error']
1464
+ };
1465
+
1466
+ for (var name in errors)
1467
+ (function(name) {
1468
+ Error[name] = function() {
1469
+ return new Error(errors[name][0], arguments, errors[name][1]).toString();
1470
+ };
1471
+ })(name);
1472
+
1473
+ module.exports = Error;
1474
+
1475
+
1476
+ /***/ }),
1477
+
1478
+ /***/ "./src/protocol/extensible.js":
1479
+ /*!************************************!*\
1480
+ !*** ./src/protocol/extensible.js ***!
1481
+ \************************************/
1482
+ /*! no static exports found */
1483
+ /***/ (function(module, exports, __webpack_require__) {
1484
+
1485
+ "use strict";
1486
+
1487
+
1488
+ var assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
1489
+ Logging = __webpack_require__(/*! ../mixins/logging */ "./src/mixins/logging.js");
1490
+
1491
+ var Extensible = {
1492
+ addExtension: function(extension) {
1493
+ this._extensions = this._extensions || [];
1494
+ this._extensions.push(extension);
1495
+ if (extension.added) extension.added(this);
1496
+ },
1497
+
1498
+ removeExtension: function(extension) {
1499
+ if (!this._extensions) return;
1500
+ var i = this._extensions.length;
1501
+ while (i--) {
1502
+ if (this._extensions[i] !== extension) continue;
1503
+ this._extensions.splice(i,1);
1504
+ if (extension.removed) extension.removed(this);
1505
+ }
1506
+ },
1507
+
1508
+ pipeThroughExtensions: function(stage, message, request, callback, context) {
1509
+ this.debug('Passing through ? extensions: ?', stage, message);
1510
+
1511
+ if (!this._extensions) return callback.call(context, message);
1512
+ var extensions = this._extensions.slice();
1513
+
1514
+ var pipe = function(message) {
1515
+ if (!message) return callback.call(context, message);
1516
+
1517
+ var extension = extensions.shift();
1518
+ if (!extension) return callback.call(context, message);
1519
+
1520
+ var fn = extension[stage];
1521
+ if (!fn) return pipe(message);
1522
+
1523
+ if (fn.length >= 3) extension[stage](message, request, pipe);
1524
+ else extension[stage](message, pipe);
1525
+ };
1526
+ pipe(message);
1527
+ }
1528
+ };
1529
+
1530
+ assign(Extensible, Logging);
1531
+
1532
+ module.exports = Extensible;
1533
+
1534
+
1535
+ /***/ }),
1536
+
1537
+ /***/ "./src/protocol/grammar.js":
1538
+ /*!*********************************!*\
1539
+ !*** ./src/protocol/grammar.js ***!
1540
+ \*********************************/
1541
+ /*! no static exports found */
1542
+ /***/ (function(module, exports, __webpack_require__) {
1543
+
1544
+ "use strict";
1545
+
1546
+
1547
+ module.exports = {
1548
+ CHANNEL_NAME: /^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,
1549
+ CHANNEL_PATTERN: /^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,
1550
+ ERROR: /^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/,
1551
+ VERSION: /^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/
1552
+ };
1553
+
1554
+
1555
+ /***/ }),
1556
+
1557
+ /***/ "./src/protocol/publication.js":
1558
+ /*!*************************************!*\
1559
+ !*** ./src/protocol/publication.js ***!
1560
+ \*************************************/
1561
+ /*! no static exports found */
1562
+ /***/ (function(module, exports, __webpack_require__) {
1563
+
1564
+ "use strict";
1565
+
1566
+
1567
+ var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
1568
+ Deferrable = __webpack_require__(/*! ../mixins/deferrable */ "./src/mixins/deferrable.js");
1569
+
1570
+ module.exports = Class(Deferrable);
1571
+
1572
+
1573
+ /***/ }),
1574
+
1575
+ /***/ "./src/protocol/scheduler.js":
1576
+ /*!***********************************!*\
1577
+ !*** ./src/protocol/scheduler.js ***!
1578
+ \***********************************/
1579
+ /*! no static exports found */
1580
+ /***/ (function(module, exports, __webpack_require__) {
1581
+
1582
+ "use strict";
1583
+
1584
+
1585
+ var assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js");
1586
+
1587
+ var Scheduler = function(message, options) {
1588
+ this.message = message;
1589
+ this.options = options;
1590
+ this.attempts = 0;
1591
+ };
1592
+
1593
+ assign(Scheduler.prototype, {
1594
+ getTimeout: function() {
1595
+ return this.options.timeout;
1596
+ },
1597
+
1598
+ getInterval: function() {
1599
+ return this.options.interval;
1600
+ },
1601
+
1602
+ isDeliverable: function() {
1603
+ var attempts = this.options.attempts,
1604
+ made = this.attempts,
1605
+ deadline = this.options.deadline,
1606
+ now = new Date().getTime();
1607
+
1608
+ if (attempts !== undefined && made >= attempts)
1609
+ return false;
1610
+
1611
+ if (deadline !== undefined && now > deadline)
1612
+ return false;
1613
+
1614
+ return true;
1615
+ },
1616
+
1617
+ send: function() {
1618
+ this.attempts += 1;
1619
+ },
1620
+
1621
+ succeed: function() {},
1622
+
1623
+ fail: function() {},
1624
+
1625
+ abort: function() {}
1626
+ });
1627
+
1628
+ module.exports = Scheduler;
1629
+
1630
+
1631
+ /***/ }),
1632
+
1633
+ /***/ "./src/protocol/subscription.js":
1634
+ /*!**************************************!*\
1635
+ !*** ./src/protocol/subscription.js ***!
1636
+ \**************************************/
1637
+ /*! no static exports found */
1638
+ /***/ (function(module, exports, __webpack_require__) {
1639
+
1640
+ "use strict";
1641
+
1642
+
1643
+ var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
1644
+ assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
1645
+ Deferrable = __webpack_require__(/*! ../mixins/deferrable */ "./src/mixins/deferrable.js");
1646
+
1647
+ var Subscription = Class({
1648
+ initialize: function(client, channels, callback, context) {
1649
+ this._client = client;
1650
+ this._channels = channels;
1651
+ this._callback = callback;
1652
+ this._context = context;
1653
+ this._cancelled = false;
1654
+ },
1655
+
1656
+ withChannel: function(callback, context) {
1657
+ this._withChannel = [callback, context];
1658
+ return this;
1659
+ },
1660
+
1661
+ apply: function(context, args) {
1662
+ var message = args[0];
1663
+
1664
+ if (this._callback)
1665
+ this._callback.call(this._context, message.data);
1666
+
1667
+ if (this._withChannel)
1668
+ this._withChannel[0].call(this._withChannel[1], message.channel, message.data);
1669
+ },
1670
+
1671
+ cancel: function() {
1672
+ if (this._cancelled) return;
1673
+ this._client.unsubscribe(this._channels, this);
1674
+ this._cancelled = true;
1675
+ },
1676
+
1677
+ unsubscribe: function() {
1678
+ this.cancel();
1679
+ }
1680
+ });
1681
+
1682
+ assign(Subscription.prototype, Deferrable);
1683
+
1684
+ module.exports = Subscription;
1685
+
1686
+
1687
+ /***/ }),
1688
+
1689
+ /***/ "./src/transport/browser_transports.js":
1690
+ /*!*********************************************!*\
1691
+ !*** ./src/transport/browser_transports.js ***!
1692
+ \*********************************************/
1693
+ /*! no static exports found */
1694
+ /***/ (function(module, exports, __webpack_require__) {
1695
+
1696
+ "use strict";
1697
+
1698
+
1699
+ var Transport = __webpack_require__(/*! ./transport */ "./src/transport/transport.js");
1700
+
1701
+ Transport.register('websocket', __webpack_require__(/*! ./web_socket */ "./src/transport/web_socket.js"));
1702
+ Transport.register('eventsource', __webpack_require__(/*! ./event_source */ "./src/transport/event_source.js"));
1703
+ Transport.register('long-polling', __webpack_require__(/*! ./xhr */ "./src/transport/xhr.js"));
1704
+ Transport.register('cross-origin-long-polling', __webpack_require__(/*! ./cors */ "./src/transport/cors.js"));
1705
+ Transport.register('callback-polling', __webpack_require__(/*! ./jsonp */ "./src/transport/jsonp.js"));
1706
+
1707
+ module.exports = Transport;
1708
+
1709
+
1710
+ /***/ }),
1711
+
1712
+ /***/ "./src/transport/cors.js":
1713
+ /*!*******************************!*\
1714
+ !*** ./src/transport/cors.js ***!
1715
+ \*******************************/
1716
+ /*! no static exports found */
1717
+ /***/ (function(module, exports, __webpack_require__) {
1718
+
1719
+ "use strict";
1720
+ /* WEBPACK VAR INJECTION */(function(global) {
1721
+
1722
+ var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
1723
+ Set = __webpack_require__(/*! ../util/set */ "./src/util/set.js"),
1724
+ URI = __webpack_require__(/*! ../util/uri */ "./src/util/uri.js"),
1725
+ assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
1726
+ toJSON = __webpack_require__(/*! ../util/to_json */ "./src/util/to_json.js"),
1727
+ Transport = __webpack_require__(/*! ./transport */ "./src/transport/transport.js");
1728
+
1729
+ var CORS = assign(Class(Transport, {
1730
+ encode: function(messages) {
1731
+ return 'message=' + encodeURIComponent(toJSON(messages));
1732
+ },
1733
+
1734
+ request: function(messages) {
1735
+ var xhrClass = global.XDomainRequest ? XDomainRequest : XMLHttpRequest,
1736
+ xhr = new xhrClass(),
1737
+ id = ++CORS._id,
1738
+ headers = this._dispatcher.headers,
1739
+ self = this,
1740
+ key;
1741
+
1742
+ xhr.open('POST', this.endpoint.href, true);
1743
+ xhr.withCredentials = true;
1744
+
1745
+ if (xhr.setRequestHeader) {
1746
+ xhr.setRequestHeader('Pragma', 'no-cache');
1747
+ for (key in headers) {
1748
+ if (!headers.hasOwnProperty(key)) continue;
1749
+ xhr.setRequestHeader(key, headers[key]);
1750
+ }
1751
+ }
1752
+
1753
+ var cleanUp = function() {
1754
+ if (!xhr) return false;
1755
+ CORS._pending.remove(id);
1756
+ xhr.onload = xhr.onerror = xhr.ontimeout = xhr.onprogress = null;
1757
+ xhr = null;
1758
+ };
1759
+
1760
+ xhr.onload = function() {
1761
+ var replies;
1762
+ try { replies = JSON.parse(xhr.responseText) } catch (error) {}
1763
+
1764
+ cleanUp();
1765
+
1766
+ if (replies)
1767
+ self._receive(replies);
1768
+ else
1769
+ self._handleError(messages);
1770
+ };
1771
+
1772
+ xhr.onerror = xhr.ontimeout = function() {
1773
+ cleanUp();
1774
+ self._handleError(messages);
1775
+ };
1776
+
1777
+ xhr.onprogress = function() {};
1778
+
1779
+ if (xhrClass === global.XDomainRequest)
1780
+ CORS._pending.add({ id: id, xhr: xhr });
1781
+
1782
+ xhr.send(this.encode(messages));
1783
+ return xhr;
1784
+ }
1785
+ }), {
1786
+ _id: 0,
1787
+ _pending: new Set(),
1788
+
1789
+ isUsable: function(dispatcher, endpoint, callback, context) {
1790
+ if (URI.isSameOrigin(endpoint))
1791
+ return callback.call(context, false);
1792
+
1793
+ if (global.XDomainRequest)
1794
+ return callback.call(context, endpoint.protocol === location.protocol);
1795
+
1796
+ if (global.XMLHttpRequest) {
1797
+ var xhr = new XMLHttpRequest();
1798
+ return callback.call(context, xhr.withCredentials !== undefined);
1799
+ }
1800
+ return callback.call(context, false);
1801
+ }
1802
+ });
1803
+
1804
+ module.exports = CORS;
1805
+
1806
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
1807
+
1808
+ /***/ }),
1809
+
1810
+ /***/ "./src/transport/event_source.js":
1811
+ /*!***************************************!*\
1812
+ !*** ./src/transport/event_source.js ***!
1813
+ \***************************************/
1814
+ /*! no static exports found */
1815
+ /***/ (function(module, exports, __webpack_require__) {
1816
+
1817
+ "use strict";
1818
+ /* WEBPACK VAR INJECTION */(function(global) {
1819
+
1820
+ var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
1821
+ URI = __webpack_require__(/*! ../util/uri */ "./src/util/uri.js"),
1822
+ copyObject = __webpack_require__(/*! ../util/copy_object */ "./src/util/copy_object.js"),
1823
+ assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
1824
+ Deferrable = __webpack_require__(/*! ../mixins/deferrable */ "./src/mixins/deferrable.js"),
1825
+ Transport = __webpack_require__(/*! ./transport */ "./src/transport/transport.js"),
1826
+ XHR = __webpack_require__(/*! ./xhr */ "./src/transport/xhr.js");
1827
+
1828
+ var EventSource = assign(Class(Transport, {
1829
+ initialize: function(dispatcher, endpoint) {
1830
+ Transport.prototype.initialize.call(this, dispatcher, endpoint);
1831
+ if (!global.EventSource) return this.setDeferredStatus('failed');
1832
+
1833
+ this._xhr = new XHR(dispatcher, endpoint);
1834
+
1835
+ endpoint = copyObject(endpoint);
1836
+ endpoint.pathname += '/' + dispatcher.clientId;
1837
+
1838
+ var socket = new global.EventSource(URI.stringify(endpoint)),
1839
+ self = this;
1840
+
1841
+ socket.onopen = function() {
1842
+ self._everConnected = true;
1843
+ self.setDeferredStatus('succeeded');
1844
+ };
1845
+
1846
+ socket.onerror = function() {
1847
+ if (self._everConnected) {
1848
+ self._handleError([]);
1849
+ } else {
1850
+ self.setDeferredStatus('failed');
1851
+ socket.close();
1852
+ }
1853
+ };
1854
+
1855
+ socket.onmessage = function(event) {
1856
+ var replies;
1857
+ try { replies = JSON.parse(event.data) } catch (error) {}
1858
+
1859
+ if (replies)
1860
+ self._receive(replies);
1861
+ else
1862
+ self._handleError([]);
1863
+ };
1864
+
1865
+ this._socket = socket;
1866
+ },
1867
+
1868
+ close: function() {
1869
+ if (!this._socket) return;
1870
+ this._socket.onopen = this._socket.onerror = this._socket.onmessage = null;
1871
+ this._socket.close();
1872
+ delete this._socket;
1873
+ },
1874
+
1875
+ isUsable: function(callback, context) {
1876
+ this.callback(function() { callback.call(context, true) });
1877
+ this.errback(function() { callback.call(context, false) });
1878
+ },
1879
+
1880
+ encode: function(messages) {
1881
+ return this._xhr.encode(messages);
1882
+ },
1883
+
1884
+ request: function(messages) {
1885
+ return this._xhr.request(messages);
1886
+ }
1887
+
1888
+ }), {
1889
+ isUsable: function(dispatcher, endpoint, callback, context) {
1890
+ var id = dispatcher.clientId;
1891
+ if (!id) return callback.call(context, false);
1892
+
1893
+ XHR.isUsable(dispatcher, endpoint, function(usable) {
1894
+ if (!usable) return callback.call(context, false);
1895
+ this.create(dispatcher, endpoint).isUsable(callback, context);
1896
+ }, this);
1897
+ },
1898
+
1899
+ create: function(dispatcher, endpoint) {
1900
+ var sockets = dispatcher.transports.eventsource = dispatcher.transports.eventsource || {},
1901
+ id = dispatcher.clientId;
1902
+
1903
+ var url = copyObject(endpoint);
1904
+ url.pathname += '/' + (id || '');
1905
+ url = URI.stringify(url);
1906
+
1907
+ sockets[url] = sockets[url] || new this(dispatcher, endpoint);
1908
+ return sockets[url];
1909
+ }
1910
+ });
1911
+
1912
+ assign(EventSource.prototype, Deferrable);
1913
+
1914
+ module.exports = EventSource;
1915
+
1916
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
1917
+
1918
+ /***/ }),
1919
+
1920
+ /***/ "./src/transport/jsonp.js":
1921
+ /*!********************************!*\
1922
+ !*** ./src/transport/jsonp.js ***!
1923
+ \********************************/
1924
+ /*! no static exports found */
1925
+ /***/ (function(module, exports, __webpack_require__) {
1926
+
1927
+ "use strict";
1928
+ /* WEBPACK VAR INJECTION */(function(global) {
1929
+
1930
+ var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
1931
+ URI = __webpack_require__(/*! ../util/uri */ "./src/util/uri.js"),
1932
+ copyObject = __webpack_require__(/*! ../util/copy_object */ "./src/util/copy_object.js"),
1933
+ assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
1934
+ toJSON = __webpack_require__(/*! ../util/to_json */ "./src/util/to_json.js"),
1935
+ Transport = __webpack_require__(/*! ./transport */ "./src/transport/transport.js");
1936
+
1937
+ var JSONP = assign(Class(Transport, {
1938
+ encode: function(messages) {
1939
+ var url = copyObject(this.endpoint);
1940
+ url.query.message = toJSON(messages);
1941
+ url.query.jsonp = '__jsonp' + JSONP._cbCount + '__';
1942
+ return URI.stringify(url);
1943
+ },
1944
+
1945
+ request: function(messages) {
1946
+ var head = document.getElementsByTagName('head')[0],
1947
+ script = document.createElement('script'),
1948
+ callbackName = JSONP.getCallbackName(),
1949
+ endpoint = copyObject(this.endpoint),
1950
+ self = this;
1951
+
1952
+ endpoint.query.message = toJSON(messages);
1953
+ endpoint.query.jsonp = callbackName;
1954
+
1955
+ var cleanup = function() {
1956
+ if (!global[callbackName]) return false;
1957
+ global[callbackName] = undefined;
1958
+ try { delete global[callbackName] } catch (error) {}
1959
+ script.parentNode.removeChild(script);
1960
+ };
1961
+
1962
+ global[callbackName] = function(replies) {
1963
+ cleanup();
1964
+ self._receive(replies);
1965
+ };
1966
+
1967
+ script.type = 'text/javascript';
1968
+ script.src = URI.stringify(endpoint);
1969
+ head.appendChild(script);
1970
+
1971
+ script.onerror = function() {
1972
+ cleanup();
1973
+ self._handleError(messages);
1974
+ };
1975
+
1976
+ return { abort: cleanup };
1977
+ }
1978
+ }), {
1979
+ _cbCount: 0,
1980
+
1981
+ getCallbackName: function() {
1982
+ this._cbCount += 1;
1983
+ return '__jsonp' + this._cbCount + '__';
1984
+ },
1985
+
1986
+ isUsable: function(dispatcher, endpoint, callback, context) {
1987
+ callback.call(context, true);
1988
+ }
1989
+ });
1990
+
1991
+ module.exports = JSONP;
1992
+
1993
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
1994
+
1995
+ /***/ }),
1996
+
1997
+ /***/ "./src/transport/transport.js":
1998
+ /*!************************************!*\
1999
+ !*** ./src/transport/transport.js ***!
2000
+ \************************************/
2001
+ /*! no static exports found */
2002
+ /***/ (function(module, exports, __webpack_require__) {
2003
+
2004
+ "use strict";
2005
+
2006
+
2007
+ var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
2008
+ Cookie = __webpack_require__(/*! ../util/cookies */ "./src/util/cookies/browser_cookies.js").Cookie,
2009
+ Promise = __webpack_require__(/*! ../util/promise */ "./src/util/promise.js"),
2010
+ array = __webpack_require__(/*! ../util/array */ "./src/util/array.js"),
2011
+ assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
2012
+ Logging = __webpack_require__(/*! ../mixins/logging */ "./src/mixins/logging.js"),
2013
+ Timeouts = __webpack_require__(/*! ../mixins/timeouts */ "./src/mixins/timeouts.js"),
2014
+ Channel = __webpack_require__(/*! ../protocol/channel */ "./src/protocol/channel.js");
2015
+
2016
+ var Transport = assign(Class({ className: 'Transport',
2017
+ DEFAULT_PORTS: { 'http:': 80, 'https:': 443, 'ws:': 80, 'wss:': 443 },
2018
+ MAX_DELAY: 0,
2019
+
2020
+ batching: true,
2021
+
2022
+ initialize: function(dispatcher, endpoint) {
2023
+ this._dispatcher = dispatcher;
2024
+ this.endpoint = endpoint;
2025
+ this._outbox = [];
2026
+ this._proxy = assign({}, this._dispatcher.proxy);
2027
+
2028
+ if (!this._proxy.origin)
2029
+ this._proxy.origin = this._findProxy();
2030
+ },
2031
+
2032
+ close: function() {},
2033
+
2034
+ encode: function(messages) {
2035
+ return '';
2036
+ },
2037
+
2038
+ sendMessage: function(message) {
2039
+ this.debug('Client ? sending message to ?: ?',
2040
+ this._dispatcher.clientId, this.endpoint.href, message);
2041
+
2042
+ if (!this.batching) return Promise.resolve(this.request([message]));
2043
+
2044
+ this._outbox.push(message);
2045
+ this._flushLargeBatch();
2046
+
2047
+ if (message.channel === Channel.HANDSHAKE)
2048
+ return this._publish(0.01);
2049
+
2050
+ if (message.channel === Channel.CONNECT)
2051
+ this._connectMessage = message;
2052
+
2053
+ return this._publish(this.MAX_DELAY);
2054
+ },
2055
+
2056
+ _makePromise: function() {
2057
+ var self = this;
2058
+
2059
+ this._requestPromise = this._requestPromise || new Promise(function(resolve) {
2060
+ self._resolvePromise = resolve;
2061
+ });
2062
+ },
2063
+
2064
+ _publish: function(delay) {
2065
+ this._makePromise();
2066
+
2067
+ this.addTimeout('publish', delay, function() {
2068
+ this._flush();
2069
+ delete this._requestPromise;
2070
+ }, this);
2071
+
2072
+ return this._requestPromise;
2073
+ },
2074
+
2075
+ _flush: function() {
2076
+ this.removeTimeout('publish');
2077
+
2078
+ if (this._outbox.length > 1 && this._connectMessage)
2079
+ this._connectMessage.advice = { timeout: 0 };
2080
+
2081
+ this._resolvePromise(this.request(this._outbox));
2082
+
2083
+ this._connectMessage = null;
2084
+ this._outbox = [];
2085
+ },
2086
+
2087
+ _flushLargeBatch: function() {
2088
+ var string = this.encode(this._outbox);
2089
+ if (string.length < this._dispatcher.maxRequestSize) return;
2090
+ var last = this._outbox.pop();
2091
+
2092
+ this._makePromise();
2093
+ this._flush();
2094
+
2095
+ if (last) this._outbox.push(last);
2096
+ },
2097
+
2098
+ _receive: function(replies) {
2099
+ if (!replies) return;
2100
+ replies = [].concat(replies);
2101
+
2102
+ this.debug('Client ? received from ? via ?: ?',
2103
+ this._dispatcher.clientId, this.endpoint.href, this.connectionType, replies);
2104
+
2105
+ for (var i = 0, n = replies.length; i < n; i++)
2106
+ this._dispatcher.handleResponse(replies[i]);
2107
+ },
2108
+
2109
+ _handleError: function(messages, immediate) {
2110
+ messages = [].concat(messages);
2111
+
2112
+ this.debug('Client ? failed to send to ? via ?: ?',
2113
+ this._dispatcher.clientId, this.endpoint.href, this.connectionType, messages);
2114
+
2115
+ for (var i = 0, n = messages.length; i < n; i++)
2116
+ this._dispatcher.handleError(messages[i]);
2117
+ },
2118
+
2119
+ _getCookies: function() {
2120
+ var cookies = this._dispatcher.cookies,
2121
+ url = this.endpoint.href;
2122
+
2123
+ if (!cookies) return '';
2124
+
2125
+ return array.map(cookies.getCookiesSync(url), function(cookie) {
2126
+ return cookie.cookieString();
2127
+ }).join('; ');
2128
+ },
2129
+
2130
+ _storeCookies: function(setCookie) {
2131
+ var cookies = this._dispatcher.cookies,
2132
+ url = this.endpoint.href,
2133
+ cookie;
2134
+
2135
+ if (!setCookie || !cookies) return;
2136
+ setCookie = [].concat(setCookie);
2137
+
2138
+ for (var i = 0, n = setCookie.length; i < n; i++) {
2139
+ cookie = Cookie.parse(setCookie[i]);
2140
+ cookies.setCookieSync(cookie, url);
2141
+ }
2142
+ },
2143
+
2144
+ _findProxy: function() {
2145
+ if (typeof process === 'undefined') return undefined;
2146
+
2147
+ var protocol = this.endpoint.protocol;
2148
+ if (!protocol) return undefined;
2149
+
2150
+ var name = protocol.replace(/:$/, '').toLowerCase() + '_proxy',
2151
+ upcase = name.toUpperCase(),
2152
+ env = process.env,
2153
+ keys, proxy;
2154
+
2155
+ if (name === 'http_proxy' && env.REQUEST_METHOD) {
2156
+ keys = Object.keys(env).filter(function(k) { return /^http_proxy$/i.test(k) });
2157
+ if (keys.length === 1) {
2158
+ if (keys[0] === name && env[upcase] === undefined)
2159
+ proxy = env[name];
2160
+ } else if (keys.length > 1) {
2161
+ proxy = env[name];
2162
+ }
2163
+ proxy = proxy || env['CGI_' + upcase];
2164
+ } else {
2165
+ proxy = env[name] || env[upcase];
2166
+ if (proxy && !env[name])
2167
+ console.warn('The environment variable ' + upcase +
2168
+ ' is discouraged. Use ' + name + '.');
2169
+ }
2170
+ return proxy;
2171
+ }
2172
+
2173
+ }), {
2174
+ get: function(dispatcher, allowed, disabled, callback, context) {
2175
+ var endpoint = dispatcher.endpoint;
2176
+
2177
+ array.asyncEach(this._transports, function(pair, resume) {
2178
+ var connType = pair[0], klass = pair[1],
2179
+ connEndpoint = dispatcher.endpointFor(connType);
2180
+
2181
+ if (array.indexOf(disabled, connType) >= 0)
2182
+ return resume();
2183
+
2184
+ if (array.indexOf(allowed, connType) < 0) {
2185
+ klass.isUsable(dispatcher, connEndpoint, function() {});
2186
+ return resume();
2187
+ }
2188
+
2189
+ klass.isUsable(dispatcher, connEndpoint, function(isUsable) {
2190
+ if (!isUsable) return resume();
2191
+ var transport = klass.hasOwnProperty('create') ? klass.create(dispatcher, connEndpoint) : new klass(dispatcher, connEndpoint);
2192
+ callback.call(context, transport);
2193
+ });
2194
+ }, function() {
2195
+ throw new Error('Could not find a usable connection type for ' + endpoint.href);
2196
+ });
2197
+ },
2198
+
2199
+ register: function(type, klass) {
2200
+ this._transports.push([type, klass]);
2201
+ klass.prototype.connectionType = type;
2202
+ },
2203
+
2204
+ getConnectionTypes: function() {
2205
+ return array.map(this._transports, function(t) { return t[0] });
2206
+ },
2207
+
2208
+ disable: function(feature) {
2209
+ if (feature !== 'autodisconnect') return;
2210
+
2211
+ for (var i = 0; i < this._transports.length; i++)
2212
+ this._transports[i][1]._unloaded = false;
2213
+ },
2214
+
2215
+ _transports: []
2216
+ });
2217
+
2218
+ assign(Transport.prototype, Logging);
2219
+ assign(Transport.prototype, Timeouts);
2220
+
2221
+ module.exports = Transport;
2222
+
2223
+
2224
+ /***/ }),
2225
+
2226
+ /***/ "./src/transport/web_socket.js":
2227
+ /*!*************************************!*\
2228
+ !*** ./src/transport/web_socket.js ***!
2229
+ \*************************************/
2230
+ /*! no static exports found */
2231
+ /***/ (function(module, exports, __webpack_require__) {
2232
+
2233
+ "use strict";
2234
+ /* WEBPACK VAR INJECTION */(function(global) {
2235
+
2236
+ var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
2237
+ Promise = __webpack_require__(/*! ../util/promise */ "./src/util/promise.js"),
2238
+ Set = __webpack_require__(/*! ../util/set */ "./src/util/set.js"),
2239
+ URI = __webpack_require__(/*! ../util/uri */ "./src/util/uri.js"),
2240
+ browser = __webpack_require__(/*! ../util/browser */ "./src/util/browser/event.js"),
2241
+ copyObject = __webpack_require__(/*! ../util/copy_object */ "./src/util/copy_object.js"),
2242
+ assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
2243
+ toJSON = __webpack_require__(/*! ../util/to_json */ "./src/util/to_json.js"),
2244
+ ws = __webpack_require__(/*! ../util/websocket */ "./src/util/websocket/browser_websocket.js"),
2245
+ Deferrable = __webpack_require__(/*! ../mixins/deferrable */ "./src/mixins/deferrable.js"),
2246
+ Transport = __webpack_require__(/*! ./transport */ "./src/transport/transport.js");
2247
+
2248
+ var WebSocket = assign(Class(Transport, {
2249
+ UNCONNECTED: 1,
2250
+ CONNECTING: 2,
2251
+ CONNECTED: 3,
2252
+
2253
+ batching: false,
2254
+
2255
+ isUsable: function(callback, context) {
2256
+ this.callback(function() { callback.call(context, true) });
2257
+ this.errback(function() { callback.call(context, false) });
2258
+ this.connect();
2259
+ },
2260
+
2261
+ request: function(messages) {
2262
+ this._pending = this._pending || new Set();
2263
+ for (var i = 0, n = messages.length; i < n; i++) this._pending.add(messages[i]);
2264
+
2265
+ var self = this;
2266
+
2267
+ var promise = new Promise(function(resolve, reject) {
2268
+ self.callback(function(socket) {
2269
+ if (!socket || socket.readyState !== 1) return;
2270
+ socket.send(toJSON(messages));
2271
+ resolve(socket);
2272
+ });
2273
+
2274
+ self.connect();
2275
+ });
2276
+
2277
+ return {
2278
+ abort: function() { promise.then(function(ws) { ws.close() }) }
2279
+ };
2280
+ },
2281
+
2282
+ connect: function() {
2283
+ if (WebSocket._unloaded) return;
2284
+
2285
+ this._state = this._state || this.UNCONNECTED;
2286
+ if (this._state !== this.UNCONNECTED) return;
2287
+ this._state = this.CONNECTING;
2288
+
2289
+ var socket = this._createSocket();
2290
+ if (!socket) return this.setDeferredStatus('failed');
2291
+
2292
+ var self = this;
2293
+
2294
+ socket.onopen = function() {
2295
+ if (socket.headers) self._storeCookies(socket.headers['set-cookie']);
2296
+ self._socket = socket;
2297
+ self._state = self.CONNECTED;
2298
+ self._everConnected = true;
2299
+ self.setDeferredStatus('succeeded', socket);
2300
+ };
2301
+
2302
+ var closed = false;
2303
+ socket.onclose = socket.onerror = function() {
2304
+ if (closed) return;
2305
+ closed = true;
2306
+
2307
+ var wasConnected = (self._state === self.CONNECTED);
2308
+ socket.onopen = socket.onclose = socket.onerror = socket.onmessage = null;
2309
+
2310
+ delete self._socket;
2311
+ self._state = self.UNCONNECTED;
2312
+
2313
+ var pending = self._pending ? self._pending.toArray() : [];
2314
+ delete self._pending;
2315
+
2316
+ if (wasConnected || self._everConnected) {
2317
+ self.setDeferredStatus('unknown');
2318
+ self._handleError(pending, wasConnected);
2319
+ } else {
2320
+ self.setDeferredStatus('failed');
2321
+ }
2322
+ };
2323
+
2324
+ socket.onmessage = function(event) {
2325
+ var replies;
2326
+ try { replies = JSON.parse(event.data) } catch (error) {}
2327
+
2328
+ if (!replies) return;
2329
+
2330
+ replies = [].concat(replies);
2331
+
2332
+ for (var i = 0, n = replies.length; i < n; i++) {
2333
+ if (replies[i].successful === undefined) continue;
2334
+ self._pending.remove(replies[i]);
2335
+ }
2336
+ self._receive(replies);
2337
+ };
2338
+ },
2339
+
2340
+ close: function() {
2341
+ if (!this._socket) return;
2342
+ this._socket.close();
2343
+ },
2344
+
2345
+ _createSocket: function() {
2346
+ var url = WebSocket.getSocketUrl(this.endpoint),
2347
+ headers = this._dispatcher.headers,
2348
+ extensions = this._dispatcher.wsExtensions,
2349
+ cookie = this._getCookies(),
2350
+ tls = this._dispatcher.tls,
2351
+ options = { extensions: extensions, headers: headers, proxy: this._proxy, tls: tls };
2352
+
2353
+ if (cookie !== '') options.headers['Cookie'] = cookie;
2354
+
2355
+ try {
2356
+ return ws.create(url, [], options);
2357
+ } catch (e) {
2358
+ // catch CSP error to allow transport to fallback to next connType
2359
+ }
2360
+ }
2361
+
2362
+ }), {
2363
+ PROTOCOLS: {
2364
+ 'http:': 'ws:',
2365
+ 'https:': 'wss:'
2366
+ },
2367
+
2368
+ create: function(dispatcher, endpoint) {
2369
+ var sockets = dispatcher.transports.websocket = dispatcher.transports.websocket || {};
2370
+ sockets[endpoint.href] = sockets[endpoint.href] || new this(dispatcher, endpoint);
2371
+ return sockets[endpoint.href];
2372
+ },
2373
+
2374
+ getSocketUrl: function(endpoint) {
2375
+ endpoint = copyObject(endpoint);
2376
+ endpoint.protocol = this.PROTOCOLS[endpoint.protocol];
2377
+ return URI.stringify(endpoint);
2378
+ },
2379
+
2380
+ isUsable: function(dispatcher, endpoint, callback, context) {
2381
+ this.create(dispatcher, endpoint).isUsable(callback, context);
2382
+ }
2383
+ });
2384
+
2385
+ assign(WebSocket.prototype, Deferrable);
2386
+
2387
+ if (browser.Event && global.onbeforeunload !== undefined) {
2388
+ browser.Event.on(global, 'beforeunload', function() {
2389
+ if (WebSocket._unloaded === undefined)
2390
+ WebSocket._unloaded = true;
2391
+ });
2392
+ }
2393
+
2394
+ module.exports = WebSocket;
2395
+
2396
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
2397
+
2398
+ /***/ }),
2399
+
2400
+ /***/ "./src/transport/xhr.js":
2401
+ /*!******************************!*\
2402
+ !*** ./src/transport/xhr.js ***!
2403
+ \******************************/
2404
+ /*! no static exports found */
2405
+ /***/ (function(module, exports, __webpack_require__) {
2406
+
2407
+ "use strict";
2408
+ /* WEBPACK VAR INJECTION */(function(global) {
2409
+
2410
+ var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
2411
+ URI = __webpack_require__(/*! ../util/uri */ "./src/util/uri.js"),
2412
+ browser = __webpack_require__(/*! ../util/browser */ "./src/util/browser/event.js"),
2413
+ assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
2414
+ toJSON = __webpack_require__(/*! ../util/to_json */ "./src/util/to_json.js"),
2415
+ Transport = __webpack_require__(/*! ./transport */ "./src/transport/transport.js");
2416
+
2417
+ var XHR = assign(Class(Transport, {
2418
+ encode: function(messages) {
2419
+ return toJSON(messages);
2420
+ },
2421
+
2422
+ request: function(messages) {
2423
+ var href = this.endpoint.href,
2424
+ self = this,
2425
+ xhr;
2426
+
2427
+ // Prefer XMLHttpRequest over ActiveXObject if they both exist
2428
+ if (global.XMLHttpRequest) {
2429
+ xhr = new XMLHttpRequest();
2430
+ } else if (global.ActiveXObject) {
2431
+ xhr = new ActiveXObject('Microsoft.XMLHTTP');
2432
+ } else {
2433
+ return this._handleError(messages);
2434
+ }
2435
+
2436
+ xhr.open('POST', href, true);
2437
+ xhr.setRequestHeader('Content-Type', 'application/json');
2438
+ xhr.setRequestHeader('Pragma', 'no-cache');
2439
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
2440
+
2441
+ var headers = this._dispatcher.headers;
2442
+ for (var key in headers) {
2443
+ if (!headers.hasOwnProperty(key)) continue;
2444
+ xhr.setRequestHeader(key, headers[key]);
2445
+ }
2446
+
2447
+ var abort = function() { xhr.abort() };
2448
+ if (global.onbeforeunload !== undefined)
2449
+ browser.Event.on(global, 'beforeunload', abort);
2450
+
2451
+ xhr.onreadystatechange = function() {
2452
+ if (!xhr || xhr.readyState !== 4) return;
2453
+
2454
+ var replies = null,
2455
+ status = xhr.status,
2456
+ text = xhr.responseText,
2457
+ successful = (status >= 200 && status < 300) || status === 304 || status === 1223;
2458
+
2459
+ if (global.onbeforeunload !== undefined)
2460
+ browser.Event.detach(global, 'beforeunload', abort);
2461
+
2462
+ xhr.onreadystatechange = function() {};
2463
+ xhr = null;
2464
+
2465
+ if (!successful) return self._handleError(messages);
2466
+
2467
+ try {
2468
+ replies = JSON.parse(text);
2469
+ } catch (error) {}
2470
+
2471
+ if (replies)
2472
+ self._receive(replies);
2473
+ else
2474
+ self._handleError(messages);
2475
+ };
2476
+
2477
+ xhr.send(this.encode(messages));
2478
+ return xhr;
2479
+ }
2480
+ }), {
2481
+ isUsable: function(dispatcher, endpoint, callback, context) {
2482
+ var usable = (navigator.product === 'ReactNative')
2483
+ || URI.isSameOrigin(endpoint);
2484
+
2485
+ callback.call(context, usable);
2486
+ }
2487
+ });
2488
+
2489
+ module.exports = XHR;
2490
+
2491
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
2492
+
2493
+ /***/ }),
2494
+
2495
+ /***/ "./src/util/array.js":
2496
+ /*!***************************!*\
2497
+ !*** ./src/util/array.js ***!
2498
+ \***************************/
2499
+ /*! no static exports found */
2500
+ /***/ (function(module, exports, __webpack_require__) {
2501
+
2502
+ "use strict";
2503
+
2504
+
2505
+ module.exports = {
2506
+ commonElement: function(lista, listb) {
2507
+ for (var i = 0, n = lista.length; i < n; i++) {
2508
+ if (this.indexOf(listb, lista[i]) !== -1)
2509
+ return lista[i];
2510
+ }
2511
+ return null;
2512
+ },
2513
+
2514
+ indexOf: function(list, needle) {
2515
+ if (list.indexOf) return list.indexOf(needle);
2516
+
2517
+ for (var i = 0, n = list.length; i < n; i++) {
2518
+ if (list[i] === needle) return i;
2519
+ }
2520
+ return -1;
2521
+ },
2522
+
2523
+ map: function(object, callback, context) {
2524
+ if (object.map) return object.map(callback, context);
2525
+ var result = [];
2526
+
2527
+ if (object instanceof Array) {
2528
+ for (var i = 0, n = object.length; i < n; i++) {
2529
+ result.push(callback.call(context || null, object[i], i));
2530
+ }
2531
+ } else {
2532
+ for (var key in object) {
2533
+ if (!object.hasOwnProperty(key)) continue;
2534
+ result.push(callback.call(context || null, key, object[key]));
2535
+ }
2536
+ }
2537
+ return result;
2538
+ },
2539
+
2540
+ filter: function(array, callback, context) {
2541
+ if (array.filter) return array.filter(callback, context);
2542
+ var result = [];
2543
+ for (var i = 0, n = array.length; i < n; i++) {
2544
+ if (callback.call(context || null, array[i], i))
2545
+ result.push(array[i]);
2546
+ }
2547
+ return result;
2548
+ },
2549
+
2550
+ asyncEach: function(list, iterator, callback, context) {
2551
+ var n = list.length,
2552
+ i = -1,
2553
+ calls = 0,
2554
+ looping = false;
2555
+
2556
+ var iterate = function() {
2557
+ calls -= 1;
2558
+ i += 1;
2559
+ if (i === n) return callback && callback.call(context);
2560
+ iterator(list[i], resume);
2561
+ };
2562
+
2563
+ var loop = function() {
2564
+ if (looping) return;
2565
+ looping = true;
2566
+ while (calls > 0) iterate();
2567
+ looping = false;
2568
+ };
2569
+
2570
+ var resume = function() {
2571
+ calls += 1;
2572
+ loop();
2573
+ };
2574
+ resume();
2575
+ }
2576
+ };
2577
+
2578
+
2579
+ /***/ }),
2580
+
2581
+ /***/ "./src/util/assign.js":
2582
+ /*!****************************!*\
2583
+ !*** ./src/util/assign.js ***!
2584
+ \****************************/
2585
+ /*! no static exports found */
2586
+ /***/ (function(module, exports, __webpack_require__) {
2587
+
2588
+ "use strict";
2589
+
2590
+
2591
+ var forEach = Array.prototype.forEach,
2592
+ hasOwn = Object.prototype.hasOwnProperty;
2593
+
2594
+ module.exports = function(target) {
2595
+ forEach.call(arguments, function(source, i) {
2596
+ if (i === 0) return;
2597
+
2598
+ for (var key in source) {
2599
+ if (hasOwn.call(source, key)) target[key] = source[key];
2600
+ }
2601
+ });
2602
+
2603
+ return target;
2604
+ };
2605
+
2606
+
2607
+ /***/ }),
2608
+
2609
+ /***/ "./src/util/browser/event.js":
2610
+ /*!***********************************!*\
2611
+ !*** ./src/util/browser/event.js ***!
2612
+ \***********************************/
2613
+ /*! no static exports found */
2614
+ /***/ (function(module, exports, __webpack_require__) {
2615
+
2616
+ "use strict";
2617
+ /* WEBPACK VAR INJECTION */(function(global) {
2618
+
2619
+ var Event = {
2620
+ _registry: [],
2621
+
2622
+ on: function(element, eventName, callback, context) {
2623
+ var wrapped = function() { callback.call(context) };
2624
+
2625
+ if (element.addEventListener)
2626
+ element.addEventListener(eventName, wrapped, false);
2627
+ else
2628
+ element.attachEvent('on' + eventName, wrapped);
2629
+
2630
+ this._registry.push({
2631
+ _element: element,
2632
+ _type: eventName,
2633
+ _callback: callback,
2634
+ _context: context,
2635
+ _handler: wrapped
2636
+ });
2637
+ },
2638
+
2639
+ detach: function(element, eventName, callback, context) {
2640
+ var i = this._registry.length, register;
2641
+ while (i--) {
2642
+ register = this._registry[i];
2643
+
2644
+ if ((element && element !== register._element) ||
2645
+ (eventName && eventName !== register._type) ||
2646
+ (callback && callback !== register._callback) ||
2647
+ (context && context !== register._context))
2648
+ continue;
2649
+
2650
+ if (register._element.removeEventListener)
2651
+ register._element.removeEventListener(register._type, register._handler, false);
2652
+ else
2653
+ register._element.detachEvent('on' + register._type, register._handler);
2654
+
2655
+ this._registry.splice(i,1);
2656
+ register = null;
2657
+ }
2658
+ }
2659
+ };
2660
+
2661
+ if (global.onunload !== undefined)
2662
+ Event.on(global, 'unload', Event.detach, Event);
2663
+
2664
+ module.exports = {
2665
+ Event: Event
2666
+ };
2667
+
2668
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
2669
+
2670
+ /***/ }),
2671
+
2672
+ /***/ "./src/util/class.js":
2673
+ /*!***************************!*\
2674
+ !*** ./src/util/class.js ***!
2675
+ \***************************/
2676
+ /*! no static exports found */
2677
+ /***/ (function(module, exports, __webpack_require__) {
2678
+
2679
+ "use strict";
2680
+
2681
+
2682
+ var assign = __webpack_require__(/*! ./assign */ "./src/util/assign.js");
2683
+
2684
+ module.exports = function(parent, methods) {
2685
+ if (typeof parent !== 'function') {
2686
+ methods = parent;
2687
+ parent = Object;
2688
+ }
2689
+
2690
+ var klass = function() {
2691
+ if (!this.initialize) return this;
2692
+ return this.initialize.apply(this, arguments) || this;
2693
+ };
2694
+
2695
+ var bridge = function() {};
2696
+ bridge.prototype = parent.prototype;
2697
+
2698
+ klass.prototype = new bridge();
2699
+ assign(klass.prototype, methods);
2700
+
2701
+ return klass;
2702
+ };
2703
+
2704
+
2705
+ /***/ }),
2706
+
2707
+ /***/ "./src/util/constants.js":
2708
+ /*!*******************************!*\
2709
+ !*** ./src/util/constants.js ***!
2710
+ \*******************************/
2711
+ /*! no static exports found */
2712
+ /***/ (function(module, exports) {
2713
+
2714
+ module.exports = {
2715
+ VERSION: '1.4.0',
2716
+
2717
+ BAYEUX_VERSION: '1.0',
2718
+ ID_LENGTH: 160,
2719
+ JSONP_CALLBACK: 'jsonpcallback',
2720
+ CONNECTION_TYPES: ['long-polling', 'cross-origin-long-polling', 'callback-polling', 'websocket', 'eventsource', 'in-process'],
2721
+
2722
+ MANDATORY_CONNECTION_TYPES: ['long-polling', 'callback-polling', 'in-process']
2723
+ };
2724
+
2725
+
2726
+ /***/ }),
2727
+
2728
+ /***/ "./src/util/cookies/browser_cookies.js":
2729
+ /*!*********************************************!*\
2730
+ !*** ./src/util/cookies/browser_cookies.js ***!
2731
+ \*********************************************/
2732
+ /*! no static exports found */
2733
+ /***/ (function(module, exports, __webpack_require__) {
2734
+
2735
+ "use strict";
2736
+
2737
+
2738
+ module.exports = {};
2739
+
2740
+
2741
+ /***/ }),
2742
+
2743
+ /***/ "./src/util/copy_object.js":
2744
+ /*!*********************************!*\
2745
+ !*** ./src/util/copy_object.js ***!
2746
+ \*********************************/
2747
+ /*! no static exports found */
2748
+ /***/ (function(module, exports, __webpack_require__) {
2749
+
2750
+ "use strict";
2751
+
2752
+
2753
+ var copyObject = function(object) {
2754
+ var clone, i, key;
2755
+ if (object instanceof Array) {
2756
+ clone = [];
2757
+ i = object.length;
2758
+ while (i--) clone[i] = copyObject(object[i]);
2759
+ return clone;
2760
+ } else if (typeof object === 'object') {
2761
+ clone = (object === null) ? null : {};
2762
+ for (key in object) clone[key] = copyObject(object[key]);
2763
+ return clone;
2764
+ } else {
2765
+ return object;
2766
+ }
2767
+ };
2768
+
2769
+ module.exports = copyObject;
2770
+
2771
+
2772
+ /***/ }),
2773
+
2774
+ /***/ "./src/util/event_emitter.js":
2775
+ /*!***********************************!*\
2776
+ !*** ./src/util/event_emitter.js ***!
2777
+ \***********************************/
2778
+ /*! no static exports found */
2779
+ /***/ (function(module, exports) {
2780
+
2781
+ /*
2782
+ Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2783
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
2784
+ this software and associated documentation files (the "Software"), to deal in
2785
+ the Software without restriction, including without limitation the rights to
2786
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
2787
+ of the Software, and to permit persons to whom the Software is furnished to do
2788
+ so, subject to the following conditions:
2789
+
2790
+ The above copyright notice and this permission notice shall be included in all
2791
+ copies or substantial portions of the Software.
2792
+
2793
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2794
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2795
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2796
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2797
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2798
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2799
+ SOFTWARE.
2800
+ */
2801
+
2802
+ var isArray = typeof Array.isArray === 'function'
2803
+ ? Array.isArray
2804
+ : function (xs) {
2805
+ return Object.prototype.toString.call(xs) === '[object Array]'
2806
+ }
2807
+ ;
2808
+ function indexOf (xs, x) {
2809
+ if (xs.indexOf) return xs.indexOf(x);
2810
+ for (var i = 0; i < xs.length; i++) {
2811
+ if (x === xs[i]) return i;
2812
+ }
2813
+ return -1;
2814
+ }
2815
+
2816
+ function EventEmitter() {}
2817
+ module.exports = EventEmitter;
2818
+
2819
+ EventEmitter.prototype.emit = function(type) {
2820
+ // If there is no 'error' event listener then throw.
2821
+ if (type === 'error') {
2822
+ if (!this._events || !this._events.error ||
2823
+ (isArray(this._events.error) && !this._events.error.length))
2824
+ {
2825
+ if (arguments[1] instanceof Error) {
2826
+ throw arguments[1]; // Unhandled 'error' event
2827
+ } else {
2828
+ throw new Error("Uncaught, unspecified 'error' event.");
2829
+ }
2830
+ return false;
2831
+ }
2832
+ }
2833
+
2834
+ if (!this._events) return false;
2835
+ var handler = this._events[type];
2836
+ if (!handler) return false;
2837
+
2838
+ if (typeof handler == 'function') {
2839
+ switch (arguments.length) {
2840
+ // fast cases
2841
+ case 1:
2842
+ handler.call(this);
2843
+ break;
2844
+ case 2:
2845
+ handler.call(this, arguments[1]);
2846
+ break;
2847
+ case 3:
2848
+ handler.call(this, arguments[1], arguments[2]);
2849
+ break;
2850
+ // slower
2851
+ default:
2852
+ var args = Array.prototype.slice.call(arguments, 1);
2853
+ handler.apply(this, args);
2854
+ }
2855
+ return true;
2856
+
2857
+ } else if (isArray(handler)) {
2858
+ var args = Array.prototype.slice.call(arguments, 1);
2859
+
2860
+ var listeners = handler.slice();
2861
+ for (var i = 0, l = listeners.length; i < l; i++) {
2862
+ listeners[i].apply(this, args);
2863
+ }
2864
+ return true;
2865
+
2866
+ } else {
2867
+ return false;
2868
+ }
2869
+ };
2870
+
2871
+ // EventEmitter is defined in src/node_events.cc
2872
+ // EventEmitter.prototype.emit() is also defined there.
2873
+ EventEmitter.prototype.addListener = function(type, listener) {
2874
+ if ('function' !== typeof listener) {
2875
+ throw new Error('addListener only takes instances of Function');
2876
+ }
2877
+
2878
+ if (!this._events) this._events = {};
2879
+
2880
+ // To avoid recursion in the case that type == "newListeners"! Before
2881
+ // adding it to the listeners, first emit "newListeners".
2882
+ this.emit('newListener', type, listener);
2883
+
2884
+ if (!this._events[type]) {
2885
+ // Optimize the case of one listener. Don't need the extra array object.
2886
+ this._events[type] = listener;
2887
+ } else if (isArray(this._events[type])) {
2888
+ // If we've already got an array, just append.
2889
+ this._events[type].push(listener);
2890
+ } else {
2891
+ // Adding the second element, need to change to array.
2892
+ this._events[type] = [this._events[type], listener];
2893
+ }
2894
+
2895
+ return this;
2896
+ };
2897
+
2898
+ EventEmitter.prototype.on = EventEmitter.prototype.addListener;
2899
+
2900
+ EventEmitter.prototype.once = function(type, listener) {
2901
+ var self = this;
2902
+ self.on(type, function g() {
2903
+ self.removeListener(type, g);
2904
+ listener.apply(this, arguments);
2905
+ });
2906
+
2907
+ return this;
2908
+ };
2909
+
2910
+ EventEmitter.prototype.removeListener = function(type, listener) {
2911
+ if ('function' !== typeof listener) {
2912
+ throw new Error('removeListener only takes instances of Function');
2913
+ }
2914
+
2915
+ // does not use listeners(), so no side effect of creating _events[type]
2916
+ if (!this._events || !this._events[type]) return this;
2917
+
2918
+ var list = this._events[type];
2919
+
2920
+ if (isArray(list)) {
2921
+ var i = indexOf(list, listener);
2922
+ if (i < 0) return this;
2923
+ list.splice(i, 1);
2924
+ if (list.length == 0)
2925
+ delete this._events[type];
2926
+ } else if (this._events[type] === listener) {
2927
+ delete this._events[type];
2928
+ }
2929
+
2930
+ return this;
2931
+ };
2932
+
2933
+ EventEmitter.prototype.removeAllListeners = function(type) {
2934
+ if (arguments.length === 0) {
2935
+ this._events = {};
2936
+ return this;
2937
+ }
2938
+
2939
+ // does not use listeners(), so no side effect of creating _events[type]
2940
+ if (type && this._events && this._events[type]) this._events[type] = null;
2941
+ return this;
2942
+ };
2943
+
2944
+ EventEmitter.prototype.listeners = function(type) {
2945
+ if (!this._events) this._events = {};
2946
+ if (!this._events[type]) this._events[type] = [];
2947
+ if (!isArray(this._events[type])) {
2948
+ this._events[type] = [this._events[type]];
2949
+ }
2950
+ return this._events[type];
2951
+ };
2952
+
2953
+
2954
+ /***/ }),
2955
+
2956
+ /***/ "./src/util/promise.js":
2957
+ /*!*****************************!*\
2958
+ !*** ./src/util/promise.js ***!
2959
+ \*****************************/
2960
+ /*! no static exports found */
2961
+ /***/ (function(module, exports, __webpack_require__) {
2962
+
2963
+ "use strict";
2964
+
2965
+
2966
+ var asap = __webpack_require__(/*! asap */ "./node_modules/asap/browser-asap.js");
2967
+
2968
+ var PENDING = -1,
2969
+ FULFILLED = 0,
2970
+ REJECTED = 1;
2971
+
2972
+ var Promise = function(task) {
2973
+ this._state = PENDING;
2974
+ this._value = null;
2975
+ this._defer = [];
2976
+
2977
+ execute(this, task);
2978
+ };
2979
+
2980
+ Promise.prototype.then = function(onFulfilled, onRejected) {
2981
+ var promise = new Promise();
2982
+
2983
+ var deferred = {
2984
+ promise: promise,
2985
+ onFulfilled: onFulfilled,
2986
+ onRejected: onRejected
2987
+ };
2988
+
2989
+ if (this._state === PENDING)
2990
+ this._defer.push(deferred);
2991
+ else
2992
+ propagate(this, deferred);
2993
+
2994
+ return promise;
2995
+ };
2996
+
2997
+ Promise.prototype['catch'] = function(onRejected) {
2998
+ return this.then(null, onRejected);
2999
+ };
3000
+
3001
+ var execute = function(promise, task) {
3002
+ if (typeof task !== 'function') return;
3003
+
3004
+ var calls = 0;
3005
+
3006
+ var resolvePromise = function(value) {
3007
+ if (calls++ === 0) resolve(promise, value);
3008
+ };
3009
+
3010
+ var rejectPromise = function(reason) {
3011
+ if (calls++ === 0) reject(promise, reason);
3012
+ };
3013
+
3014
+ try {
3015
+ task(resolvePromise, rejectPromise);
3016
+ } catch (error) {
3017
+ rejectPromise(error);
3018
+ }
3019
+ };
3020
+
3021
+ var propagate = function(promise, deferred) {
3022
+ var state = promise._state,
3023
+ value = promise._value,
3024
+ next = deferred.promise,
3025
+ handler = [deferred.onFulfilled, deferred.onRejected][state],
3026
+ pass = [resolve, reject][state];
3027
+
3028
+ if (typeof handler !== 'function')
3029
+ return pass(next, value);
3030
+
3031
+ asap(function() {
3032
+ try {
3033
+ resolve(next, handler(value));
3034
+ } catch (error) {
3035
+ reject(next, error);
3036
+ }
3037
+ });
3038
+ };
3039
+
3040
+ var resolve = function(promise, value) {
3041
+ if (promise === value)
3042
+ return reject(promise, new TypeError('Recursive promise chain detected'));
3043
+
3044
+ var then;
3045
+
3046
+ try {
3047
+ then = getThen(value);
3048
+ } catch (error) {
3049
+ return reject(promise, error);
3050
+ }
3051
+
3052
+ if (!then) return fulfill(promise, value);
3053
+
3054
+ execute(promise, function(resolvePromise, rejectPromise) {
3055
+ then.call(value, resolvePromise, rejectPromise);
3056
+ });
3057
+ };
3058
+
3059
+ var getThen = function(value) {
3060
+ var type = typeof value,
3061
+ then = (type === 'object' || type === 'function') && value && value.then;
3062
+
3063
+ return (typeof then === 'function')
3064
+ ? then
3065
+ : null;
3066
+ };
3067
+
3068
+ var fulfill = function(promise, value) {
3069
+ settle(promise, FULFILLED, value);
3070
+ };
3071
+
3072
+ var reject = function(promise, reason) {
3073
+ settle(promise, REJECTED, reason);
3074
+ };
3075
+
3076
+ var settle = function(promise, state, value) {
3077
+ var defer = promise._defer, i = 0;
3078
+
3079
+ promise._state = state;
3080
+ promise._value = value;
3081
+ promise._defer = null;
3082
+
3083
+ if (defer.length === 0) return;
3084
+ while (i < defer.length) propagate(promise, defer[i++]);
3085
+ };
3086
+
3087
+ Promise.resolve = function(value) {
3088
+ try {
3089
+ if (getThen(value)) return value;
3090
+ } catch (error) {
3091
+ return Promise.reject(error);
3092
+ }
3093
+
3094
+ return new Promise(function(resolve, reject) { resolve(value) });
3095
+ };
3096
+
3097
+ Promise.reject = function(reason) {
3098
+ return new Promise(function(resolve, reject) { reject(reason) });
3099
+ };
3100
+
3101
+ Promise.all = function(promises) {
3102
+ return new Promise(function(resolve, reject) {
3103
+ var list = [], n = promises.length, i;
3104
+
3105
+ if (n === 0) return resolve(list);
3106
+
3107
+ var push = function(promise, i) {
3108
+ Promise.resolve(promise).then(function(value) {
3109
+ list[i] = value;
3110
+ if (--n === 0) resolve(list);
3111
+ }, reject);
3112
+ };
3113
+
3114
+ for (i = 0; i < n; i++) push(promises[i], i);
3115
+ });
3116
+ };
3117
+
3118
+ Promise.race = function(promises) {
3119
+ return new Promise(function(resolve, reject) {
3120
+ for (var i = 0, n = promises.length; i < n; i++)
3121
+ Promise.resolve(promises[i]).then(resolve, reject);
3122
+ });
3123
+ };
3124
+
3125
+ Promise.deferred = function() {
3126
+ var tuple = {};
3127
+
3128
+ tuple.promise = new Promise(function(resolve, reject) {
3129
+ tuple.resolve = resolve;
3130
+ tuple.reject = reject;
3131
+ });
3132
+ return tuple;
3133
+ };
3134
+
3135
+ module.exports = Promise;
3136
+
3137
+
3138
+ /***/ }),
3139
+
3140
+ /***/ "./src/util/set.js":
3141
+ /*!*************************!*\
3142
+ !*** ./src/util/set.js ***!
3143
+ \*************************/
3144
+ /*! no static exports found */
3145
+ /***/ (function(module, exports, __webpack_require__) {
3146
+
3147
+ "use strict";
3148
+
3149
+
3150
+ var Class = __webpack_require__(/*! ./class */ "./src/util/class.js");
3151
+
3152
+ module.exports = Class({
3153
+ initialize: function() {
3154
+ this._index = {};
3155
+ },
3156
+
3157
+ add: function(item) {
3158
+ var key = (item.id !== undefined) ? item.id : item;
3159
+ if (this._index.hasOwnProperty(key)) return false;
3160
+ this._index[key] = item;
3161
+ return true;
3162
+ },
3163
+
3164
+ forEach: function(block, context) {
3165
+ for (var key in this._index) {
3166
+ if (this._index.hasOwnProperty(key))
3167
+ block.call(context, this._index[key]);
3168
+ }
3169
+ },
3170
+
3171
+ isEmpty: function() {
3172
+ for (var key in this._index) {
3173
+ if (this._index.hasOwnProperty(key)) return false;
3174
+ }
3175
+ return true;
3176
+ },
3177
+
3178
+ member: function(item) {
3179
+ for (var key in this._index) {
3180
+ if (this._index[key] === item) return true;
3181
+ }
3182
+ return false;
3183
+ },
3184
+
3185
+ remove: function(item) {
3186
+ var key = (item.id !== undefined) ? item.id : item;
3187
+ var removed = this._index[key];
3188
+ delete this._index[key];
3189
+ return removed;
3190
+ },
3191
+
3192
+ toArray: function() {
3193
+ var array = [];
3194
+ this.forEach(function(item) { array.push(item) });
3195
+ return array;
3196
+ }
3197
+ });
3198
+
3199
+
3200
+ /***/ }),
3201
+
3202
+ /***/ "./src/util/to_json.js":
3203
+ /*!*****************************!*\
3204
+ !*** ./src/util/to_json.js ***!
3205
+ \*****************************/
3206
+ /*! no static exports found */
3207
+ /***/ (function(module, exports, __webpack_require__) {
3208
+
3209
+ "use strict";
3210
+
3211
+
3212
+ // http://assanka.net/content/tech/2009/09/02/json2-js-vs-prototype/
3213
+
3214
+ module.exports = function(object) {
3215
+ return JSON.stringify(object, function(key, value) {
3216
+ return (this[key] instanceof Array) ? this[key] : value;
3217
+ });
3218
+ };
3219
+
3220
+
3221
+ /***/ }),
3222
+
3223
+ /***/ "./src/util/uri.js":
3224
+ /*!*************************!*\
3225
+ !*** ./src/util/uri.js ***!
3226
+ \*************************/
3227
+ /*! no static exports found */
3228
+ /***/ (function(module, exports, __webpack_require__) {
3229
+
3230
+ "use strict";
3231
+
3232
+
3233
+ module.exports = {
3234
+ isURI: function(uri) {
3235
+ return uri && uri.protocol && uri.host && uri.path;
3236
+ },
3237
+
3238
+ isSameOrigin: function(uri) {
3239
+ return uri.protocol === location.protocol &&
3240
+ uri.hostname === location.hostname &&
3241
+ uri.port === location.port;
3242
+ },
3243
+
3244
+ parse: function(url) {
3245
+ if (typeof url !== 'string') return url;
3246
+ var uri = {}, parts, query, pairs, i, n, data;
3247
+
3248
+ var consume = function(name, pattern) {
3249
+ url = url.replace(pattern, function(match) {
3250
+ uri[name] = match;
3251
+ return '';
3252
+ });
3253
+ uri[name] = uri[name] || '';
3254
+ };
3255
+
3256
+ consume('protocol', /^[a-z]+\:/i);
3257
+ consume('host', /^\/\/[^\/\?#]+/);
3258
+
3259
+ if (!/^\//.test(url) && !uri.host)
3260
+ url = location.pathname.replace(/[^\/]*$/, '') + url;
3261
+
3262
+ consume('pathname', /^[^\?#]*/);
3263
+ consume('search', /^\?[^#]*/);
3264
+ consume('hash', /^#.*/);
3265
+
3266
+ uri.protocol = uri.protocol || location.protocol;
3267
+
3268
+ if (uri.host) {
3269
+ uri.host = uri.host.substr(2);
3270
+
3271
+ if (/@/.test(uri.host)) {
3272
+ uri.auth = uri.host.split('@')[0];
3273
+ uri.host = uri.host.split('@')[1];
3274
+ }
3275
+ parts = uri.host.match(/^\[([^\]]+)\]|^[^:]+/);
3276
+ uri.hostname = parts[1] || parts[0];
3277
+ uri.port = (uri.host.match(/:(\d+)$/) || [])[1] || '';
3278
+ } else {
3279
+ uri.host = location.host;
3280
+ uri.hostname = location.hostname;
3281
+ uri.port = location.port;
3282
+ }
3283
+
3284
+ uri.pathname = uri.pathname || '/';
3285
+ uri.path = uri.pathname + uri.search;
3286
+
3287
+ query = uri.search.replace(/^\?/, '');
3288
+ pairs = query ? query.split('&') : [];
3289
+ data = {};
3290
+
3291
+ for (i = 0, n = pairs.length; i < n; i++) {
3292
+ parts = pairs[i].split('=');
3293
+ data[decodeURIComponent(parts[0] || '')] = decodeURIComponent(parts[1] || '');
3294
+ }
3295
+
3296
+ uri.query = data;
3297
+
3298
+ uri.href = this.stringify(uri);
3299
+ return uri;
3300
+ },
3301
+
3302
+ stringify: function(uri) {
3303
+ var auth = uri.auth ? uri.auth + '@' : '',
3304
+ string = uri.protocol + '//' + auth + uri.host;
3305
+
3306
+ string += uri.pathname + this.queryString(uri.query) + (uri.hash || '');
3307
+
3308
+ return string;
3309
+ },
3310
+
3311
+ queryString: function(query) {
3312
+ var pairs = [];
3313
+ for (var key in query) {
3314
+ if (!query.hasOwnProperty(key)) continue;
3315
+ pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(query[key]));
3316
+ }
3317
+ if (pairs.length === 0) return '';
3318
+ return '?' + pairs.join('&');
3319
+ }
3320
+ };
3321
+
3322
+
3323
+ /***/ }),
3324
+
3325
+ /***/ "./src/util/validate_options.js":
3326
+ /*!**************************************!*\
3327
+ !*** ./src/util/validate_options.js ***!
3328
+ \**************************************/
3329
+ /*! no static exports found */
3330
+ /***/ (function(module, exports, __webpack_require__) {
3331
+
3332
+ "use strict";
3333
+
3334
+
3335
+ var array = __webpack_require__(/*! ./array */ "./src/util/array.js");
3336
+
3337
+ module.exports = function(options, validKeys) {
3338
+ for (var key in options) {
3339
+ if (array.indexOf(validKeys, key) < 0)
3340
+ throw new Error('Unrecognized option: ' + key);
3341
+ }
3342
+ };
3343
+
3344
+
3345
+ /***/ }),
3346
+
3347
+ /***/ "./src/util/websocket/browser_websocket.js":
3348
+ /*!*************************************************!*\
3349
+ !*** ./src/util/websocket/browser_websocket.js ***!
3350
+ \*************************************************/
3351
+ /*! no static exports found */
3352
+ /***/ (function(module, exports, __webpack_require__) {
3353
+
3354
+ "use strict";
3355
+ /* WEBPACK VAR INJECTION */(function(global) {
3356
+
3357
+ var WS = global.MozWebSocket || global.WebSocket;
3358
+
3359
+ module.exports = {
3360
+ create: function(url, protocols, options) {
3361
+ if (typeof WS !== 'function') return null;
3362
+ return new WS(url);
3363
+ }
3364
+ };
3365
+
3366
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
3367
+
3368
+ /***/ })
3369
+
3370
+ /******/ });
3371
+ //# sourceMappingURL=faye-browser.js.map