Comparing version 1.11.0 to 1.11.1
@@ -1,2 +0,2 @@ | ||
!function(t){var e;"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):(e=(e=(e=(e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jsforce||(e.jsforce={})).modules||(e.modules={})).api||(e.api={})).Streaming=t()}(function(){return function i(s,r,o){function c(e,t){if(!r[e]){if(!s[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(a)return a(e,!0);throw(n=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",n}n=r[e]={exports:{}},s[e][0].call(n.exports,function(t){return c(s[e][1][t]||t)},n,n.exports,i,s,r,o)}return r[e].exports}for(var a="function"==typeof require&&require,t=0;t<o.length;t++)c(o[t]);return c}({1:[function(t,e,n){var i={AuthFailure:function(n){this.incoming=function(t,e){("/meta/connect"!==t.channel&&"/meta/handshake"!==t.channel||!t.advice||"none"!=t.advice.reconnect?e:n)(t)}},Replay:function(t,e){var i="replay",s=null!=e,r=e,o=t;this.setExtensionEnabled=function(t){s=t},this.setReplay=function(t){r=parseInt(t,10)},this.setChannel=function(t){o=t},this.incoming=function(t,e){"/meta/handshake"===t.channel?t.ext&&1==t.ext[i]&&(s=!0):t.channel===o&&t.data&&t.data.event&&t.data.event.replayId&&(r=t.data.event.replayId),e(t)},this.outgoing=function(t,e){var n;"/meta/subscribe"===t.channel&&t.subscription===o&&s&&(t.ext||(t.ext={}),(n={})[o]=r,t.ext[i]=n),e(t)}}};e.exports=i},{}],2:[function(t,e,n){"use strict";function i(t,e){this._streaming=t,this.name=e}var s=window.jsforce.require("events"),r=window.jsforce.require("inherits"),o=window.jsforce.require("lodash/core"),c=t("faye"),a=t("./streaming-extension"),t=window.jsforce.require("./core");i.prototype.subscribe=function(t){return this._streaming.subscribe(this.name,t)},i.prototype.unsubscribe=function(t){return this._streaming.unsubscribe(this.name,t),this};function u(t,e){this._streaming=t,this._name=e}u.prototype.subscribe=function(t){return this._streaming.subscribe(this._name,t)},u.prototype.unsubscribe=function(t){return this._streaming.unsubscribe(this._name,t),this},u.prototype.push=function(e,t){var n=o.isArray(e);e=n?e:[e];var i=this._streaming._conn;return this._id||(this._id=i.sobject("StreamingChannel").findOne({Name:this._name},"Id").then(function(t){return t.Id})),this._id.then(function(t){t="/sobjects/StreamingChannel/"+t+"/push";return i.requestPost(t,{pushEvents:e})}).then(function(t){return n?t:t[0]}).thenCall(t)};function l(t){this._conn=t}r(l,s.EventEmitter),l.prototype._createClient=function(t,e){var t="string"==typeof t&&0===t.indexOf("/u/"),t=[this._conn.instanceUrl,"cometd"+(!0==t&&"36.0"===this._conn.version?"/replay":""),this._conn.version].join("/"),n=new c.Client(t,{});return n.setHeader("Authorization","OAuth "+this._conn.accessToken),e instanceof Array&&e.forEach(function(t){n.addExtension(t)}),-1===n._dispatcher.getConnectionTypes().indexOf("callback-polling")&&(n._dispatcher.selectTransport("long-polling"),n._dispatcher._transport.batching=!1),n},l.prototype._getFayeClient=function(t){var e=0===t.indexOf("/u/")?"generic":"pushTopic";return this._fayeClients&&this._fayeClients[e]||(this._fayeClients=this._fayeClients||{},this._fayeClients[e]=this._createClient(t)),this._fayeClients[e]},l.prototype.topic=function(t){return this._topics=this._topics||{},this._topics[t]=this._topics[t]||new i(this,t)},l.prototype.channel=function(t){return new u(this,t)},l.prototype.subscribe=function(t,e){t=0===t.indexOf("/")?t:"/topic/"+t;return this._getFayeClient(t).subscribe(t,e)},l.prototype.unsubscribe=function(t,e){t=0===t.indexOf("/")?t:"/topic/"+t;return this._getFayeClient(t).unsubscribe(t,e),this},l.prototype.createClient=function(t){return this._createClient(null,t)},t.on("connection:new",function(t){t.streaming=new l(t)}),t.StreamingExtension=a,e.exports=l},{"./streaming-extension":1,faye:5}],3:[function(t,e,n){"use strict";var i=t("./raw"),s=[],r=[],o=i.makeRequestCallFromTimer(function(){if(r.length)throw r.shift()});function c(t){var e=s.length?s.pop():new a;e.task=t,i(e)}function a(){this.task=null}e.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}}},{"./raw":4}],4:[function(t,h,e){(function(t){"use strict";function e(t){i.length||(n(),0),i[i.length]=t}h.exports=e;var n,i=[],s=0;function r(){for(;s<i.length;){var t=s;if(s+=1,i[t].call(),1024<s){for(var e=0,n=i.length-s;e<n;e++)i[e]=i[e+s];i.length-=s,s=0}}i.length=0,s=0,0}var o,c,a,t=void 0!==t?t:self,u=t.MutationObserver||t.WebKitMutationObserver;function l(i){return function(){var t=setTimeout(n,0),e=setInterval(n,50);function n(){clearTimeout(t),clearInterval(e),i()}}}n="function"==typeof u?(c=1,o=new u(o=r),a=document.createTextNode(""),o.observe(a,{characterData:!0}),function(){c=-c,a.data=c}):l(r),e.requestFlush=n,e.makeRequestCallFromTimer=l}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(t,e,n){"use strict";var i=t("./util/constants"),s=t("./mixins/logging"),t={VERSION:i.VERSION,Client:t("./protocol/client"),Scheduler:t("./protocol/scheduler")};s.wrapper=t,e.exports=t},{"./mixins/logging":7,"./protocol/client":11,"./protocol/scheduler":17,"./util/constants":29}],6:[function(t,e,n){(function(i){"use strict";var s=t("../util/promise");e.exports={then:function(t,e){var n=this;return this._promise||(this._promise=new s(function(t,e){n._resolve=t,n._reject=e})),0===arguments.length?this._promise:this._promise.then(t,e)},callback:function(e,n){return this.then(function(t){e.call(n,t)})},errback:function(e,n){return this.then(null,function(t){e.call(n,t)})},timeout:function(t,e){this.then();var n=this;this._timer=i.setTimeout(function(){n._reject(e)},1e3*t)},setDeferredStatus:function(t,e){this._timer&&i.clearTimeout(this._timer),this.then(),"succeeded"===t?this._resolve(e):"failed"===t?this._reject(e):delete this._promise}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../util/promise":34}],7:[function(t,e,n){"use strict";var i,o=t("../util/to_json"),c={LOG_LEVELS:{fatal:4,error:3,warn:2,info:1,debug:0},writeLog:function(t,e){var n,i,s,r=c.logger||(c.wrapper||c).logger;r&&(n=Array.prototype.slice.apply(t),i="[Faye",s=this.className,t=n.shift().replace(/\?/g,function(){try{return o(n.shift())}catch(t){return"[Object]"}}),s&&(i+="."+s),i+="] ","function"==typeof r[e]?r[e](i+t):"function"==typeof r&&r(i+t))}};for(i in c.LOG_LEVELS)!function(t){c[t]=function(){this.writeLog(arguments,t)}}(i);e.exports=c},{"../util/to_json":36}],8:[function(t,e,n){"use strict";var i={countListeners:function(t){return this.listeners(t).length},bind:function(t,e,n){function i(){e.apply(n,s.call(arguments))}var s=Array.prototype.slice;return this._listeners=this._listeners||[],this._listeners.push([t,e,n,i]),this.on(t,i)},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])))}};t("../util/extend")(i,t("../util/event_emitter").prototype),i.trigger=i.emit,e.exports=i},{"../util/event_emitter":32,"../util/extend":33}],9:[function(t,e,n){(function(r){"use strict";e.exports={addTimeout:function(t,e,n,i){var s;this._timeouts=this._timeouts||{},this._timeouts.hasOwnProperty(t)||((s=this)._timeouts[t]=r.setTimeout(function(){delete s._timeouts[t],n.call(i)},1e3*e))},removeTimeout:function(t){this._timeouts=this._timeouts||{};var e=this._timeouts[t];e&&(r.clearTimeout(e),delete this._timeouts[t])},removeAllTimeouts:function(){for(var t in this._timeouts=this._timeouts||{},this._timeouts)this.removeTimeout(t)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],10:[function(t,e,n){"use strict";var i=t("../util/class"),s=t("../util/extend"),r=t("../mixins/publisher"),o=t("./grammar"),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){t=this.parse(t);return t?t[0]===this.META:null},isService:function(t){t=this.parse(t);return t?t[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,e=[];for(t in this._channels)e.push(t);return e},remove:function(t){delete this._channels[t]},hasSubscription:function(t){return this._channels.hasOwnProperty(t)},subscribe:function(t,e){for(var n=0,i=t.length;n<i;n++){var s=t[n];(this._channels[s]=this._channels[s]||new c(s)).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)}}})}),e.exports=c},{"../mixins/publisher":8,"../util/class":28,"../util/extend":33,"./grammar":15}],11:[function(m,y,t){(function(s){"use strict";var r=m("asap"),t=m("../util/class"),o=(m("../util/promise"),m("../util/uri")),c=m("../util/array"),n=m("../util/browser"),a=m("../util/constants"),e=m("../util/extend"),u=m("../util/validate_options"),i=m("../mixins/deferrable"),l=m("../mixins/logging"),h=m("../mixins/publisher"),f=m("./channel"),d=m("./dispatcher"),p=m("./error"),_=m("./extensible"),v=m("./publication"),g=m("./subscription"),t=t({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,e){this.info("New client created for ?",t),u(e=e||{},["interval","timeout","endpoints","proxy","retry","scheduler","websocketExtensions","tls","ca"]),this._channels=new f.Set,this._dispatcher=d.create(this,t||this.DEFAULT_ENDPOINT,e),this._messageId=0,this._state=this.UNCONNECTED,this._responseCallbacks={},this._advice={reconnect:this.RETRY,interval:1e3*(e.interval||this.INTERVAL),timeout:1e3*(e.timeout||this.CONNECTION_TIMEOUT)},this._dispatcher.timeout=this._advice.timeout/1e3,this._dispatcher.bind("message",this._receiveMessage,this),n.Event&&void 0!==s.onbeforeunload&&n.Event.on(s,"beforeunload",function(){c.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(e,n){var i;this._advice.reconnect!==this.NONE&&this._state===this.UNCONNECTED&&(this._state=this.CONNECTING,(i=this).info("Initiating handshake with ?",o.stringify(this._dispatcher.endpoint)),this._dispatcher.selectTransport(a.MANDATORY_CONNECTION_TYPES),this._sendMessage({channel:f.HANDSHAKE,version:a.BAYEUX_VERSION,supportedConnectionTypes:this._dispatcher.getConnectionTypes()},{},function(t){t.successful?(this._state=this.CONNECTED,this._dispatcher.clientId=t.clientId,this._dispatcher.selectTransport(t.supportedConnectionTypes),this.info("Handshake successful: ?",this._dispatcher.clientId),this.subscribe(this._channels.getKeys(),!0),e&&r(function(){e.call(n)})):(this.info("Handshake unsuccessful"),s.setTimeout(function(){i.handshake(e,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:f.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 e=new v;return this._sendMessage({channel:f.DISCONNECT,clientId:this._dispatcher.clientId},{},function(t){t.successful?(this._dispatcher.close(),e.setDeferredStatus("succeeded")):e.setDeferredStatus("failed",p.parse(t.error))},this),this.info("Clearing channel listeners for ?",this._dispatcher.clientId),this._channels=new f.Set,e}},subscribe:function(e,n,i){if(e instanceof Array)return c.map(e,function(t){return this.subscribe(t,n,i)},this);var s=new g(this,e,n,i),t=!0===n;return this._channels.hasSubscription(e)&&!t?(this._channels.subscribe([e],s),s.setDeferredStatus("succeeded")):this.connect(function(){this.info("Client ? attempting to subscribe to ?",this._dispatcher.clientId,e),t||this._channels.subscribe([e],s),this._sendMessage({channel:f.SUBSCRIBE,clientId:this._dispatcher.clientId,subscription:e},{},function(t){if(!t.successful)return s.setDeferredStatus("failed",p.parse(t.error)),this._channels.unsubscribe(e,s);t=[].concat(t.subscription);this.info("Subscription acknowledged for ? to ?",this._dispatcher.clientId,t),s.setDeferredStatus("succeeded")},this)},this),s},unsubscribe:function(t,e){if(t instanceof Array)return c.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:f.UNSUBSCRIBE,clientId:this._dispatcher.clientId,subscription:t},{},function(t){t.successful&&(t=[].concat(t.subscription),this.info("Unsubscription acknowledged for ? from ?",this._dispatcher.clientId,t))},this)},this)},publish:function(t,e,n){u(n||{},["attempts","deadline"]);var i=new v;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",p.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){e(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;s.setTimeout(function(){t.connect()},this._advice.interval)}});e(t.prototype,i),e(t.prototype,h),e(t.prototype,l),e(t.prototype,_),y.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../mixins/deferrable":6,"../mixins/logging":7,"../mixins/publisher":8,"../util/array":26,"../util/browser":27,"../util/class":28,"../util/constants":29,"../util/extend":33,"../util/promise":34,"../util/uri":37,"../util/validate_options":38,"./channel":10,"./dispatcher":12,"./error":13,"./extensible":14,"./publication":16,"./subscription":18,asap:3}],12:[function(l,h,t){(function(s){"use strict";var t=l("../util/class"),c=l("../util/uri"),a=l("../util/cookies"),e=l("../util/extend"),n=l("../mixins/logging"),i=l("../mixins/publisher"),r=l("../transport"),u=l("./scheduler"),o=t({className:"Dispatcher",MAX_REQUEST_SIZE:2048,DEFAULT_RETRY:5,UP:1,DOWN:2,initialize:function(t,e,n){this._client=t,this.endpoint=c.parse(e),this._alternates=n.endpoints||{},this.cookies=a.CookieJar&&new a.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,s=n.websocketExtensions;if(s)for(var r=0,o=(s=[].concat(s)).length;r<o;r++)this.addWebsocketExtension(s[r]);for(i in this.tls=n.tls||{},this.tls.ca=this.tls.ca||n.ca,this._alternates)this._alternates[i]=c.parse(this._alternates[i]);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)},setHeader:function(t,e){this.headers[t]=e},close:function(){var t=this._transport;delete this._transport,t&&t.close()},getConnectionTypes:function(){return r.getConnectionTypes()},selectTransport:function(t){r.get(this,t,this._disabled,function(t){this.debug("Selected ? transport for ?",t.connectionType,c.stringify(t.endpoint)),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=t.id,s=n.attempts,r=n.deadline&&(new Date).getTime()+1e3*n.deadline,n=this._envelopes[i];n||(r=new this._scheduler(t,{timeout:e,interval:this.retry,attempts:s,deadline:r}),n=this._envelopes[i]={message:t,scheduler:r}),this._sendEnvelope(n)},_sendEnvelope:function(t){if(this._transport&&!t.request&&!t.timer){var e=t.message,n=t.scheduler,i=this;if(!n.isDeliverable())return n.abort(),void delete this._envelopes[e.id];t.timer=s.setTimeout(function(){i.handleError(e)},1e3*n.getTimeout()),n.send(),t.request=this._transport.sendMessage(e)}},handleResponse:function(t){var e=this._envelopes[t.id];void 0!==t.successful&&e&&(e.scheduler.succeed(),delete this._envelopes[t.id],s.clearTimeout(e.timer)),this.trigger("message",t),this._state!==this.UP&&(this._state=this.UP,this._client.trigger("transport:up"))},handleError:function(t,e){var n=this._envelopes[t.id],t=n&&n.request,i=this;t&&(t.then(function(t){t&&t.abort&&t.abort()}),(t=n.scheduler).fail(),s.clearTimeout(n.timer),n.request=n.timer=null,e?this._sendEnvelope(n):n.timer=s.setTimeout(function(){n.timer=null,i._sendEnvelope(n)},1e3*t.getInterval()),this._state!==this.DOWN&&(this._state=this.DOWN,this._client.trigger("transport:down")))}});o.create=function(t,e,n){return new o(t,e,n)},e(o.prototype,i),e(o.prototype,n),h.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../mixins/logging":7,"../mixins/publisher":8,"../transport":19,"../util/class":28,"../util/cookies":30,"../util/extend":33,"../util/uri":37,"./scheduler":17}],13:[function(t,e,n){"use strict";var i=t("../util/class"),s=t("./grammar"),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,c={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(o in c)!function(t){r[t]=function(){return new r(c[t][0],arguments,c[t][1]).toString()}}(o);e.exports=r},{"../util/class":28,"./grammar":15}],14:[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(i,t,s,r,o){if(this.debug("Passing through ? extensions: ?",i,t),!this._extensions)return r.call(o,t);var c=this._extensions.slice(),a=function(t){if(!t)return r.call(o,t);var e=c.shift();if(!e)return r.call(o,t);var n=e[i];if(!n)return a(t);3<=n.length?e[i](t,s,a):e[i](t,a)};a(t)}};t("../util/extend")(i,t("../mixins/logging")),e.exports=i},{"../mixins/logging":7,"../util/extend":33}],15:[function(t,e,n){"use strict";e.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])|\-|\_))*)*$/}},{}],16:[function(t,e,n){"use strict";var i=t("../util/class"),t=t("../mixins/deferrable");e.exports=i(t)},{"../mixins/deferrable":6,"../util/class":28}],17:[function(t,e,n){"use strict";function i(t,e){this.message=t,this.options=e,this.attempts=0}t("../util/extend")(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&&t<=e)&&!(void 0!==n&&n<i)},send:function(){this.attempts+=1},succeed:function(){},fail:function(){},abort:function(){}}),e.exports=i},{"../util/extend":33}],18:[function(t,e,n){"use strict";var i=t("../util/class"),s=t("../util/extend"),t=t("../mixins/deferrable"),i=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){e=e[0];this._callback&&this._callback.call(this._context,e.data),this._withChannel&&this._withChannel[0].call(this._withChannel[1],e.channel,e.data)},cancel:function(){this._cancelled||(this._client.unsubscribe(this._channels,this),this._cancelled=!0)},unsubscribe:function(){this.cancel()}});s(i.prototype,t),e.exports=i},{"../mixins/deferrable":6,"../util/class":28,"../util/extend":33}],19:[function(t,e,n){"use strict";var i=t("./transport");i.register("websocket",t("./web_socket")),i.register("eventsource",t("./event_source")),i.register("long-polling",t("./xhr")),i.register("cross-origin-long-polling",t("./cors")),i.register("callback-polling",t("./jsonp")),e.exports=i},{"./cors":20,"./event_source":21,"./jsonp":22,"./transport":23,"./web_socket":24,"./xhr":25}],20:[function(s,r,t){(function(a){"use strict";var t=s("../util/class"),e=s("../util/set"),u=s("../util/uri"),n=s("../util/extend"),i=s("../util/to_json"),l=n(t(s("./transport"),{encode:function(t){return"message="+encodeURIComponent(i(t))},request:function(e){var t,n=a.XDomainRequest?XDomainRequest:XMLHttpRequest,i=new n,s=++l._id,r=this._dispatcher.headers,o=this;if(i.open("POST",u.stringify(this.endpoint),!0),i.setRequestHeader)for(t in i.setRequestHeader("Pragma","no-cache"),r)r.hasOwnProperty(t)&&i.setRequestHeader(t,r[t]);function c(){i&&(l._pending.remove(s),i.onload=i.onerror=i.ontimeout=i.onprogress=null,i=null)}return i.onload=function(){var t;try{t=JSON.parse(i.responseText)}catch(t){}c(),t?o._receive(t):o._handleError(e)},i.onerror=i.ontimeout=function(){c(),o._handleError(e)},i.onprogress=function(){},n===a.XDomainRequest&&l._pending.add({id:s,xhr:i}),i.send(this.encode(e)),i}}),{_id:0,_pending:new e,isUsable:function(t,e,n,i){if(u.isSameOrigin(e))return n.call(i,!1);if(a.XDomainRequest)return n.call(i,e.protocol===location.protocol);if(a.XMLHttpRequest){e=new XMLHttpRequest;return n.call(i,void 0!==e.withCredentials)}return n.call(i,!1)}});r.exports=l}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../util/class":28,"../util/extend":33,"../util/set":35,"../util/to_json":36,"../util/uri":37,"./transport":23}],21:[function(i,u,t){(function(s){"use strict";var t=i("../util/class"),r=i("../util/uri"),o=i("../util/copy_object"),e=i("../util/extend"),n=i("../mixins/deferrable"),c=i("./transport"),a=i("./xhr"),t=e(t(c,{initialize:function(t,e){if(c.prototype.initialize.call(this,t,e),!s.EventSource)return this.setDeferredStatus("failed");this._xhr=new a(t,e),(e=o(e)).pathname+="/"+t.clientId;var n=new s.EventSource(r.stringify(e)),i=this;n.onopen=function(){i._everConnected=!0,i.setDeferredStatus("succeeded")},n.onerror=function(){i._everConnected?i._handleError([]):(i.setDeferredStatus("failed"),n.close())},n.onmessage=function(t){var e;try{e=JSON.parse(t.data)}catch(t){}e?i._receive(e):i._handleError([])},this._socket=n},close:function(){this._socket&&(this._socket.onopen=this._socket.onerror=this._socket.onmessage=null,this._socket.close(),delete this._socket)},isUsable:function(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(e,n,i,s){if(!e.clientId)return i.call(s,!1);a.isUsable(e,n,function(t){return t?void this.create(e,n).isUsable(i,s):i.call(s,!1)},this)},create:function(t,e){var n=t.transports.eventsource=t.transports.eventsource||{},i=t.clientId,s=o(e);return s.pathname+="/"+(i||""),n[s=r.stringify(s)]=n[s]||new this(t,e),n[s]}});e(t.prototype,n),u.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../mixins/deferrable":6,"../util/class":28,"../util/copy_object":31,"../util/extend":33,"../util/uri":37,"./transport":23,"./xhr":25}],22:[function(n,i,t){(function(c){"use strict";var t=n("../util/class"),a=n("../util/uri"),u=n("../util/copy_object"),e=n("../util/extend"),l=n("../util/to_json"),h=e(t(n("./transport"),{encode:function(t){var e=u(this.endpoint);return e.query.message=l(t),e.query.jsonp="__jsonp"+h._cbCount+"__",a.stringify(e)},request:function(t){var e=document.getElementsByTagName("head")[0],n=document.createElement("script"),i=h.getCallbackName(),s=u(this.endpoint),r=this;s.query.message=l(t),s.query.jsonp=i;function o(){if(!c[i])return!1;c[i]=void 0;try{delete c[i]}catch(t){}n.parentNode.removeChild(n)}return c[i]=function(t){o(),r._receive(t)},n.type="text/javascript",n.src=a.stringify(s),e.appendChild(n),n.onerror=function(){o(),r._handleError(t)},{abort:o}}}),{_cbCount:0,getCallbackName:function(){return this._cbCount+=1,"__jsonp"+this._cbCount+"__"},isUsable:function(t,e,n,i){n.call(i,!0)}});i.exports=h}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../util/class":28,"../util/copy_object":31,"../util/extend":33,"../util/to_json":36,"../util/uri":37,"./transport":23}],23:[function(a,u,t){(function(r){"use strict";var t=a("../util/class"),o=a("../util/cookies").Cookie,n=a("../util/promise"),l=a("../util/uri"),h=a("../util/array"),i=a("../util/extend"),e=a("../mixins/logging"),s=a("../mixins/timeouts"),c=a("../protocol/channel"),t=i(t({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=i({},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,l.stringify(this.endpoint),t),this.batching?(this._outbox.push(t),this._flushLargeBatch(),t.channel===c.HANDSHAKE?this._publish(.01):(t.channel===c.CONNECT&&(this._connectMessage=t),this._publish(this.MAX_DELAY))):n.resolve(this.request([t]))},_makePromise:function(){var e=this;this._requestPromise=this._requestPromise||new n(function(t){e._resolvePromise=t})},_publish:function(t){return this._makePromise(),this.addTimeout("publish",t,function(){this._flush(),delete this._requestPromise},this),this._requestPromise},_flush:function(){this.removeTimeout("publish"),1<this._outbox.length&&this._connectMessage&&(this._connectMessage.advice={timeout:0}),this._resolvePromise(this.request(this._outbox)),this._connectMessage=null,this._outbox=[]},_flushLargeBatch:function(){var t;this.encode(this._outbox).length<this._dispatcher.maxRequestSize||(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,l.stringify(this.endpoint),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,l.stringify(this.endpoint),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=l.stringify(this.endpoint);return t?h.map(t.getCookiesSync(e),function(t){return t.cookieString()}).join("; "):""},_storeCookies:function(t){var e,n=this._dispatcher.cookies,i=l.stringify(this.endpoint);if(t&&n)for(var s=0,r=(t=[].concat(t)).length;s<r;s++)e=o.parse(t[s]),n.setCookieSync(e,i)},_findProxy:function(){if(void 0!==r){var t=this.endpoint.protocol;if(t){var e,n=t.replace(/:$/,"").toLowerCase()+"_proxy",i=n.toUpperCase(),s=r.env;return"http_proxy"===n&&s.REQUEST_METHOD?(1===(t=Object.keys(s).filter(function(t){return/^http_proxy$/i.test(t)})).length?t[0]===n&&void 0===s[i]&&(e=s[n]):1<t.length&&(e=s[n]),e=e||s["CGI_"+i]):(e=s[n]||s[i])&&!s[n]&&console.warn("The environment variable "+i+" is discouraged. Use "+n+"."),e}}}}),{get:function(r,o,c,a,u){var t=r.endpoint;h.asyncEach(this._transports,function(t,e){var n=t[0],i=t[1],s=r.endpointFor(n);return 0<=h.indexOf(c,n)?e():h.indexOf(o,n)<0?(i.isUsable(r,s,function(){}),e()):void i.isUsable(r,s,function(t){if(!t)return e();t=i.hasOwnProperty("create")?i.create(r,s):new i(r,s);a.call(u,t)})},function(){throw new Error("Could not find a usable connection type for "+l.stringify(t))})},register:function(t,e){this._transports.push([t,e]),e.prototype.connectionType=t},getConnectionTypes:function(){return h.map(this._transports,function(t){return t[0]})},_transports:[]});i(t.prototype,e),i(t.prototype,s),u.exports=t}).call(this,a("_process"))},{"../mixins/logging":7,"../mixins/timeouts":9,"../protocol/channel":10,"../util/array":26,"../util/class":28,"../util/cookies":30,"../util/extend":33,"../util/promise":34,"../util/uri":37,_process:40}],24:[function(f,d,t){(function(t){"use strict";var e=f("../util/class"),r=f("../util/promise"),o=f("../util/set"),n=f("../util/uri"),i=f("../util/browser"),s=f("../util/copy_object"),c=f("../util/extend"),a=f("../util/to_json"),u=f("../util/websocket"),l=f("../mixins/deferrable"),h=c(e(f("./transport"),{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(n){this._pending=this._pending||new o;for(var t=0,e=n.length;t<e;t++)this._pending.add(n[t]);var i=this,s=new r(function(e,t){i.callback(function(t){t&&1===t.readyState&&(t.send(a(n)),e(t))}),i.connect()});return{abort:function(){s.then(function(t){t.close()})}}},connect:function(){if(!h._unloaded&&(this._state=this._state||this.UNCONNECTED,this._state===this.UNCONNECTED)){this._state=this.CONNECTING;var n=this._createSocket();if(!n)return this.setDeferredStatus("failed");var s=this,i=!(n.onopen=function(){n.headers&&s._storeCookies(n.headers["set-cookie"]),s._socket=n,s._state=s.CONNECTED,s._everConnected=!0,s._ping(),s.setDeferredStatus("succeeded",n)});n.onclose=n.onerror=function(){var t,e;i||(i=!0,t=s._state===s.CONNECTED,n.onopen=n.onclose=n.onerror=n.onmessage=null,delete s._socket,s._state=s.UNCONNECTED,s.removeTimeout("ping"),e=s._pending?s._pending.toArray():[],delete s._pending,t||s._everConnected?(s.setDeferredStatus("unknown"),s._handleError(e,t)):s.setDeferredStatus("failed"))},n.onmessage=function(t){var e;try{e=JSON.parse(t.data)}catch(t){}if(e){for(var n=0,i=(e=[].concat(e)).length;n<i;n++)void 0!==e[n].successful&&s._pending.remove(e[n]);s._receive(e)}}}},close:function(){this._socket&&this._socket.close()},_createSocket:function(){var t=h.getSocketUrl(this.endpoint),e=this._dispatcher.headers,n=this._dispatcher.wsExtensions,i=this._getCookies(),s=this._dispatcher.tls,s={extensions:n,headers:e,proxy:this._proxy,tls:s};return""!==i&&(s.headers.Cookie=i),u.create(t,[],s)},_ping:function(){this._socket&&1===this._socket.readyState&&(this._socket.send("[]"),this.addTimeout("ping",this._dispatcher.timeout/2,this._ping,this))}}),{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=s(t)).protocol=this.PROTOCOLS[t.protocol],n.stringify(t)},isUsable:function(t,e,n,i){this.create(t,e).isUsable(n,i)}});c(h.prototype,l),i.Event&&void 0!==t.onbeforeunload&&i.Event.on(t,"beforeunload",function(){h._unloaded=!0}),d.exports=h}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../mixins/deferrable":6,"../util/browser":27,"../util/class":28,"../util/copy_object":31,"../util/extend":33,"../util/promise":34,"../util/set":35,"../util/to_json":36,"../util/uri":37,"../util/websocket":39,"./transport":23}],25:[function(i,r,t){(function(c){"use strict";var t=i("../util/class"),s=i("../util/uri"),a=i("../util/browser"),e=i("../util/extend"),n=i("../util/to_json"),t=e(t(i("./transport"),{encode:function(t){return n(t)},request:function(i){var s,t=this.endpoint.href,r=this;if(c.XMLHttpRequest)s=new XMLHttpRequest;else{if(!c.ActiveXObject)return this._handleError(i);s=new ActiveXObject("Microsoft.XMLHTTP")}s.open("POST",t,!0),s.setRequestHeader("Content-Type","application/json"),s.setRequestHeader("Pragma","no-cache"),s.setRequestHeader("X-Requested-With","XMLHttpRequest");var e,n=this._dispatcher.headers;for(e in n)n.hasOwnProperty(e)&&s.setRequestHeader(e,n[e]);function o(){s.abort()}return void 0!==c.onbeforeunload&&a.Event.on(c,"beforeunload",o),s.onreadystatechange=function(){if(s&&4===s.readyState){var t=null,e=s.status,n=s.responseText,e=200<=e&&e<300||304===e||1223===e;if(void 0!==c.onbeforeunload&&a.Event.detach(c,"beforeunload",o),s.onreadystatechange=function(){},s=null,!e)return r._handleError(i);try{t=JSON.parse(n)}catch(t){}t?r._receive(t):r._handleError(i)}},s.send(this.encode(i)),s}}),{isUsable:function(t,e,n,i){e="ReactNative"===navigator.product||s.isSameOrigin(e);n.call(i,e)}});r.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../util/browser":27,"../util/class":28,"../util/extend":33,"../util/to_json":36,"../util/uri":37,"./transport":23}],26:[function(t,e,n){"use strict";e.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){function s(){if(!a){for(a=!0;0<c;)--c,!((o+=1)===r?n&&n.call(i):void e(t[o],u));a=!1}}var r=t.length,o=-1,c=0,a=!1,u=function(){c+=1,s()};u()}}},{}],27:[function(t,n,e){(function(t){"use strict";var e={_registry:[],on:function(t,e,n,i){function s(){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!==t.onunload&&e.on(t,"unload",e.detach,e),n.exports={Event:e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],28:[function(t,e,n){"use strict";var s=t("./extend");e.exports=function(t,e){"function"!=typeof t&&(e=t,t=Object);function n(){return this.initialize&&this.initialize.apply(this,arguments)||this}function i(){}return i.prototype=t.prototype,n.prototype=new i,s(n.prototype,e),n}},{"./extend":33}],29:[function(t,e,n){e.exports={VERSION:"1.2.4",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"]}},{}],30:[function(t,e,n){"use strict";e.exports={}},{}],31:[function(t,e,n){"use strict";var s=function(t){var e,n,i;if(t instanceof Array){for(e=[],n=t.length;n--;)e[n]=s(t[n]);return e}if("object"!=typeof t)return t;for(i in e=null===t?null:{},t)e[i]=s(t[i]);return e};e.exports=s},{}],32:[function(t,e,n){var o="function"==typeof Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(){}(e.exports=i).prototype.emit=function(t){if("error"===t&&(!this._events||!this._events.error||o(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 n=Array.prototype.slice.call(arguments,1);e.apply(this,n)}return!0}if(o(e)){for(var n=Array.prototype.slice.call(arguments,1),i=e.slice(),s=0,r=i.length;s<r;s++)i[s].apply(this,n);return!0}return!1},i.prototype.on=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]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,this},i.prototype.once=function(e,n){var i=this;return i.on(e,function t(){i.removeListener(e,t),n.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 n=this._events[t];if(o(n)){var i=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}(n,e);if(i<0)return this;n.splice(i,1),0==n.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={}: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]=[]),o(this._events[t])||(this._events[t]=[this._events[t]]),this._events[t]}},{}],33:[function(t,e,n){"use strict";e.exports=function(t,e,n){if(!e)return t;for(var i in e)e.hasOwnProperty(i)&&(t.hasOwnProperty(i)&&!1===n||t[i]!==e[i]&&(t[i]=e[i]));return t}},{}],34:[function(t,e,n){"use strict";function s(t){return t}function r(t){throw t}function o(t){var e;this._state=0,this._onFulfilled=[],this._onRejected=[],"function"==typeof t&&(e=this,t(function(t){h(e,t)},function(t){d(e,t)}))}var i=t("asap");o.prototype.then=function(t,e){var n=new o;return c(this,t,n),a(this,e,n),n},o.prototype.catch=function(t){return this.then(null,t)};var c=function(t,e,n){"function"!=typeof e&&(e=s);function i(t){u(e,t,n)}0===t._state?t._onFulfilled.push(i):1===t._state&&i(t._value)},a=function(t,e,n){"function"!=typeof e&&(e=r);function i(t){u(e,t,n)}0===t._state?t._onRejected.push(i):2===t._state&&i(t._reason)},u=function(t,e,n){i(function(){l(t,e,n)})},l=function(t,e,n){var i;try{i=t(e)}catch(t){return d(n,t)}i===n?d(n,new TypeError("Recursive promise chain detected")):h(n,i)},h=function(e,t){var n,i=!1;try{if(n=typeof t,"function"!=typeof(n=null!==t&&("function"==n||"object"==n)&&t.then))return f(e,t);n.call(t,function(t){i^(i=!0)&&h(e,t)},function(t){i^(i=!0)&&d(e,t)})}catch(t){if(!(i^(i=!0)))return;d(e,t)}},f=function(t,e){if(0===t._state){t._state=1,t._value=e,t._onRejected=[];for(var n,i=t._onFulfilled;n=i.shift();)n(e)}},d=function(t,e){if(0===t._state){t._state=2,t._reason=e,t._onFulfilled=[];for(var n,i=t._onRejected;n=i.shift();)n(e)}};o.resolve=function(n){return new o(function(t,e){t(n)})},o.reject=function(n){return new o(function(t,e){e(n)})},o.all=function(e){return new o(function(n,i){var t,s=[],r=e.length;if(0===r)return n(s);for(t=0;t<r;t++)!function(t,e){o.resolve(t).then(function(t){s[e]=t,0==--r&&n(s)},i)}(e[t],t)})},o.race=function(s){return new o(function(t,e){for(var n=0,i=s.length;n<i;n++)o.resolve(s[n]).then(t,e)})},o.deferred=o.pending=function(){var n={};return n.promise=new o(function(t,e){n.resolve=t,n.reject=e}),n},e.exports=o},{asap:3}],35:[function(t,e,n){"use strict";t=t("./class");e.exports=t({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,t=this._index[e];return delete this._index[e],t},toArray:function(){var e=[];return this.forEach(function(t){e.push(t)}),e}})},{"./class":28}],36:[function(t,e,n){"use strict";e.exports=function(t){return JSON.stringify(t,function(t,e){return this[t]instanceof Array?this[t]:e})}},{}],37:[function(t,e,n){"use strict";e.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(n){if("string"!=typeof n)return n;var t,e,i,s,r,o={},c=function(e,t){n=n.replace(t,function(t){return o[e]=t,""}),o[e]=o[e]||""};for(c("protocol",/^[a-z]+\:/i),c("host",/^\/\/[^\/\?#]+/),/^\//.test(n)||o.host||(n=location.pathname.replace(/[^\/]*$/,"")+n),c("pathname",/^[^\?#]*/),c("search",/^\?[^#]*/),c("hash",/^#.*/),o.protocol=o.protocol||location.protocol,o.host?(o.host=o.host.substr(2),t=o.host.split(":"),o.hostname=t[0],o.port=t[1]||""):(o.host=location.host,o.hostname=location.hostname,o.port=location.port),o.pathname=o.pathname||"/",o.path=o.pathname+o.search,r={},i=0,s=(e=(c=o.search.replace(/^\?/,""))?c.split("&"):[]).length;i<s;i++)t=e[i].split("="),r[decodeURIComponent(t[0]||"")]=decodeURIComponent(t[1]||"");return o.query=r,o.href=this.stringify(o),o},stringify:function(t){var e=t.protocol+"//"+t.hostname;return t.port&&(e+=":"+t.port),e+=t.pathname+this.queryString(t.query)+(t.hash||"")},queryString:function(t){var e,n=[];for(e in t)t.hasOwnProperty(e)&&n.push(encodeURIComponent(e)+"="+encodeURIComponent(t[e]));return 0===n.length?"":"?"+n.join("&")}}},{}],38:[function(t,e,n){"use strict";var i=t("./array");e.exports=function(t,e){for(var n in t)if(i.indexOf(e,n)<0)throw new Error("Unrecognized option: "+n)}},{"./array":26}],39:[function(t,e,n){(function(t){"use strict";var i=t.MozWebSocket||t.WebSocket;e.exports={create:function(t,e,n){return"function"!=typeof i?null:new i(t)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],40:[function(t,e,n){var i,s,e=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function c(e){if(i===setTimeout)return setTimeout(e,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{s="function"==typeof clearTimeout?clearTimeout:o}catch(t){s=o}}();var a,u=[],l=!1,h=-1;function f(){l&&a&&(l=!1,a.length?u=a.concat(u):h=-1,u.length&&d())}function d(){if(!l){var t=c(f);l=!0;for(var e=u.length;e;){for(a=u,u=[];++h<e;)a&&a[h].run();h=-1,e=u.length}a=null,l=!1,function(e){if(s===clearTimeout)return clearTimeout(e);if((s===o||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(e);try{s(e)}catch(t){try{return s.call(null,e)}catch(t){return s.call(this,e)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function _(){}e.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new p(t,e)),1!==u.length||l||c(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=_,e.addListener=_,e.once=_,e.off=_,e.removeListener=_,e.removeAllListeners=_,e.emit=_,e.prependListener=_,e.prependOnceListener=_,e.listeners=function(t){return[]},e.binding=function(t){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(t){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}},{}]},{},[2])(2)}); | ||
!function(t){var e;"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):(e=(e=(e=(e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jsforce||(e.jsforce={})).modules||(e.modules={})).api||(e.api={})).Streaming=t()}(function(){return function i(s,r,o){function c(e,t){if(!r[e]){if(!s[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(a)return a(e,!0);throw(n=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",n}n=r[e]={exports:{}},s[e][0].call(n.exports,function(t){return c(s[e][1][t]||t)},n,n.exports,i,s,r,o)}return r[e].exports}for(var a="function"==typeof require&&require,t=0;t<o.length;t++)c(o[t]);return c}({1:[function(t,e,n){var i={AuthFailure:function(n){this.incoming=function(t,e){("/meta/connect"!==t.channel&&"/meta/handshake"!==t.channel||!t.advice||"none"!=t.advice.reconnect?e:n)(t)}},Replay:function(t,e){var i="replay",s=null!=e,r=e,o=t;this.setExtensionEnabled=function(t){s=t},this.setReplay=function(t){r=parseInt(t,10)},this.setChannel=function(t){o=t},this.incoming=function(t,e){"/meta/handshake"===t.channel?t.ext&&1==t.ext[i]&&(s=!0):t.channel===o&&t.data&&t.data.event&&t.data.event.replayId&&(r=t.data.event.replayId),e(t)},this.outgoing=function(t,e){var n;"/meta/subscribe"===t.channel&&t.subscription===o&&s&&(t.ext||(t.ext={}),(n={})[o]=r,t.ext[i]=n),e(t)}}};e.exports=i},{}],2:[function(t,e,n){"use strict";function i(t,e){this._streaming=t,this.name=e}var s=window.jsforce.require("events"),r=window.jsforce.require("inherits"),o=window.jsforce.require("lodash/core"),c=t("faye"),a=t("./streaming-extension"),t=window.jsforce.require("./core");i.prototype.subscribe=function(t){return this._streaming.subscribe(this.name,t)},i.prototype.unsubscribe=function(t){return this._streaming.unsubscribe(this.name,t),this};function u(t,e){this._streaming=t,this._name=e}u.prototype.subscribe=function(t){return this._streaming.subscribe(this._name,t)},u.prototype.unsubscribe=function(t){return this._streaming.unsubscribe(this._name,t),this},u.prototype.push=function(e,t){var n=o.isArray(e);e=n?e:[e];var i=this._streaming._conn;return this._id||(this._id=i.sobject("StreamingChannel").findOne({Name:this._name},"Id").then(function(t){return t.Id})),this._id.then(function(t){t="/sobjects/StreamingChannel/"+t+"/push";return i.requestPost(t,{pushEvents:e})}).then(function(t){return n?t:t[0]}).thenCall(t)};function l(t){this._conn=t}r(l,s.EventEmitter),l.prototype._createClient=function(t,e){var t="string"==typeof t&&0===t.indexOf("/u/"),t=[this._conn.instanceUrl,"cometd"+(!0==t&&"36.0"===this._conn.version?"/replay":""),this._conn.version].join("/"),n=new c.Client(t,{});return n.setHeader("Authorization","OAuth "+this._conn.accessToken),e instanceof Array&&e.forEach(function(t){n.addExtension(t)}),-1===n._dispatcher.getConnectionTypes().indexOf("callback-polling")&&(n._dispatcher.selectTransport("long-polling"),n._dispatcher._transport.batching=!1),n},l.prototype._getFayeClient=function(t){var e=0===t.indexOf("/u/")?"generic":"pushTopic";return this._fayeClients&&this._fayeClients[e]||(this._fayeClients=this._fayeClients||{},this._fayeClients[e]=this._createClient(t)),this._fayeClients[e]},l.prototype.topic=function(t){return this._topics=this._topics||{},this._topics[t]=this._topics[t]||new i(this,t)},l.prototype.channel=function(t){return new u(this,t)},l.prototype.subscribe=function(t,e){t=0===t.indexOf("/")?t:"/topic/"+t;return this._getFayeClient(t).subscribe(t,e)},l.prototype.unsubscribe=function(t,e){t=0===t.indexOf("/")?t:"/topic/"+t;return this._getFayeClient(t).unsubscribe(t,e),this},l.prototype.createClient=function(t){return this._createClient(null,t)},t.on("connection:new",function(t){t.streaming=new l(t)}),t.StreamingExtension=a,e.exports=l},{"./streaming-extension":1,faye:5}],3:[function(t,e,n){"use strict";var i=t("./raw"),s=[],r=[],o=i.makeRequestCallFromTimer(function(){if(r.length)throw r.shift()});function c(t){var e=s.length?s.pop():new a;e.task=t,i(e)}function a(){this.task=null}e.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}}},{"./raw":4}],4:[function(t,h,e){(function(t){"use strict";function e(t){i.length||(n(),0),i[i.length]=t}h.exports=e;var n,i=[],s=0;function r(){for(;s<i.length;){var t=s;if(s+=1,i[t].call(),1024<s){for(var e=0,n=i.length-s;e<n;e++)i[e]=i[e+s];i.length-=s,s=0}}i.length=0,s=0,0}var o,c,a,t=void 0!==t?t:self,u=t.MutationObserver||t.WebKitMutationObserver;function l(i){return function(){var t=setTimeout(n,0),e=setInterval(n,50);function n(){clearTimeout(t),clearInterval(e),i()}}}n="function"==typeof u?(c=1,o=new u(o=r),a=document.createTextNode(""),o.observe(a,{characterData:!0}),function(){c=-c,a.data=c}):l(r),e.requestFlush=n,e.makeRequestCallFromTimer=l}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(t,e,n){"use strict";var i=t("./util/constants"),s=t("./mixins/logging"),t={VERSION:i.VERSION,Client:t("./protocol/client"),Scheduler:t("./protocol/scheduler")};s.wrapper=t,e.exports=t},{"./mixins/logging":7,"./protocol/client":11,"./protocol/scheduler":17,"./util/constants":30}],6:[function(t,e,n){(function(i){"use strict";var s=t("../util/promise");e.exports={then:function(t,e){var n=this;return this._promise||(this._promise=new s(function(t,e){n._resolve=t,n._reject=e})),0===arguments.length?this._promise:this._promise.then(t,e)},callback:function(e,n){return this.then(function(t){e.call(n,t)})},errback:function(e,n){return this.then(null,function(t){e.call(n,t)})},timeout:function(t,e){this.then();var n=this;this._timer=i.setTimeout(function(){n._reject(e)},1e3*t)},setDeferredStatus:function(t,e){this._timer&&i.clearTimeout(this._timer),this.then(),"succeeded"===t?this._resolve(e):"failed"===t?this._reject(e):delete this._promise}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../util/promise":34}],7:[function(t,e,n){"use strict";var i,o=t("../util/to_json"),c={LOG_LEVELS:{fatal:4,error:3,warn:2,info:1,debug:0},writeLog:function(t,e){var n,i,s,r=c.logger||(c.wrapper||c).logger;r&&(n=Array.prototype.slice.apply(t),i="[Faye",s=this.className,t=n.shift().replace(/\?/g,function(){try{return o(n.shift())}catch(t){return"[Object]"}}),s&&(i+="."+s),i+="] ","function"==typeof r[e]?r[e](i+t):"function"==typeof r&&r(i+t))}};for(i in c.LOG_LEVELS)!function(t){c[t]=function(){this.writeLog(arguments,t)}}(i);e.exports=c},{"../util/to_json":36}],8:[function(t,e,n){"use strict";var i={countListeners:function(t){return this.listeners(t).length},bind:function(t,e,n){function i(){e.apply(n,s.call(arguments))}var s=Array.prototype.slice;return this._listeners=this._listeners||[],this._listeners.push([t,e,n,i]),this.on(t,i)},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])))}};t("../util/assign")(i,t("../util/event_emitter").prototype),i.trigger=i.emit,e.exports=i},{"../util/assign":27,"../util/event_emitter":33}],9:[function(t,e,n){(function(r){"use strict";e.exports={addTimeout:function(t,e,n,i){var s;this._timeouts=this._timeouts||{},this._timeouts.hasOwnProperty(t)||((s=this)._timeouts[t]=r.setTimeout(function(){delete s._timeouts[t],n.call(i)},1e3*e))},removeTimeout:function(t){this._timeouts=this._timeouts||{};var e=this._timeouts[t];e&&(r.clearTimeout(e),delete this._timeouts[t])},removeAllTimeouts:function(){for(var t in this._timeouts=this._timeouts||{},this._timeouts)this.removeTimeout(t)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],10:[function(t,e,n){"use strict";var i=t("../util/class"),s=t("../util/assign"),r=t("../mixins/publisher"),o=t("./grammar"),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){t=this.parse(t);return t?t[0]===this.META:null},isService:function(t){t=this.parse(t);return t?t[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,e=[];for(t in this._channels)e.push(t);return e},remove:function(t){delete this._channels[t]},hasSubscription:function(t){return this._channels.hasOwnProperty(t)},subscribe:function(t,e){for(var n=0,i=t.length;n<i;n++){var s=t[n];(this._channels[s]=this._channels[s]||new c(s)).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)}}})}),e.exports=c},{"../mixins/publisher":8,"../util/assign":27,"../util/class":29,"./grammar":15}],11:[function(v,m,t){(function(s){"use strict";var r=v("asap"),t=v("../util/class"),o=(v("../util/promise"),v("../util/array")),n=v("../util/browser"),c=v("../util/constants"),e=v("../util/assign"),a=v("../util/validate_options"),i=v("../mixins/deferrable"),u=v("../mixins/logging"),l=v("../mixins/publisher"),h=v("./channel"),f=v("./dispatcher"),d=v("./error"),p=v("./extensible"),_=v("./publication"),g=v("./subscription"),t=t({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,e){this.info("New client created for ?",t),a(e=e||{},["interval","timeout","endpoints","proxy","retry","scheduler","websocketExtensions","tls","ca"]),this._channels=new h.Set,this._dispatcher=f.create(this,t||this.DEFAULT_ENDPOINT,e),this._messageId=0,this._state=this.UNCONNECTED,this._responseCallbacks={},this._advice={reconnect:this.RETRY,interval:1e3*(e.interval||this.INTERVAL),timeout:1e3*(e.timeout||this.CONNECTION_TIMEOUT)},this._dispatcher.timeout=this._advice.timeout/1e3,this._dispatcher.bind("message",this._receiveMessage,this),n.Event&&void 0!==s.onbeforeunload&&n.Event.on(s,"beforeunload",function(){o.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(e,n){var i;this._advice.reconnect!==this.NONE&&this._state===this.UNCONNECTED&&(this._state=this.CONNECTING,(i=this).info("Initiating handshake with ?",this._dispatcher.endpoint.href),this._dispatcher.selectTransport(c.MANDATORY_CONNECTION_TYPES),this._sendMessage({channel:h.HANDSHAKE,version:c.BAYEUX_VERSION,supportedConnectionTypes:this._dispatcher.getConnectionTypes()},{},function(t){t.successful?(this._state=this.CONNECTED,this._dispatcher.clientId=t.clientId,this._dispatcher.selectTransport(t.supportedConnectionTypes),this.info("Handshake successful: ?",this._dispatcher.clientId),this.subscribe(this._channels.getKeys(),!0),e&&r(function(){e.call(n)})):(this.info("Handshake unsuccessful"),s.setTimeout(function(){i.handshake(e,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:h.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 e=new _;return this._sendMessage({channel:h.DISCONNECT,clientId:this._dispatcher.clientId},{},function(t){t.successful?(this._dispatcher.close(),e.setDeferredStatus("succeeded")):e.setDeferredStatus("failed",d.parse(t.error))},this),this.info("Clearing channel listeners for ?",this._dispatcher.clientId),this._channels=new h.Set,e}},subscribe:function(e,n,i){if(e instanceof Array)return o.map(e,function(t){return this.subscribe(t,n,i)},this);var s=new g(this,e,n,i),t=!0===n;return this._channels.hasSubscription(e)&&!t?(this._channels.subscribe([e],s),s.setDeferredStatus("succeeded")):this.connect(function(){this.info("Client ? attempting to subscribe to ?",this._dispatcher.clientId,e),t||this._channels.subscribe([e],s),this._sendMessage({channel:h.SUBSCRIBE,clientId:this._dispatcher.clientId,subscription:e},{},function(t){if(!t.successful)return s.setDeferredStatus("failed",d.parse(t.error)),this._channels.unsubscribe(e,s);t=[].concat(t.subscription);this.info("Subscription acknowledged for ? to ?",this._dispatcher.clientId,t),s.setDeferredStatus("succeeded")},this)},this),s},unsubscribe:function(t,e){if(t instanceof Array)return o.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:h.UNSUBSCRIBE,clientId:this._dispatcher.clientId,subscription:t},{},function(t){t.successful&&(t=[].concat(t.subscription),this.info("Unsubscription acknowledged for ? from ?",this._dispatcher.clientId,t))},this)},this)},publish:function(t,e,n){a(n||{},["attempts","deadline"]);var i=new _;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",d.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){e(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;s.setTimeout(function(){t.connect()},this._advice.interval)}});e(t.prototype,i),e(t.prototype,l),e(t.prototype,u),e(t.prototype,p),m.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../mixins/deferrable":6,"../mixins/logging":7,"../mixins/publisher":8,"../util/array":26,"../util/assign":27,"../util/browser":28,"../util/class":29,"../util/constants":30,"../util/promise":34,"../util/validate_options":38,"./channel":10,"./dispatcher":12,"./error":13,"./extensible":14,"./publication":16,"./subscription":18,asap:3}],12:[function(l,h,t){(function(s){"use strict";var t=l("../util/class"),c=l("../util/uri"),a=l("../util/cookies"),e=l("../util/assign"),n=l("../mixins/logging"),i=l("../mixins/publisher"),r=l("../transport"),u=l("./scheduler"),o=t({className:"Dispatcher",MAX_REQUEST_SIZE:2048,DEFAULT_RETRY:5,UP:1,DOWN:2,initialize:function(t,e,n){this._client=t,this.endpoint=c.parse(e),this._alternates=n.endpoints||{},this.cookies=a.CookieJar&&new a.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,s=n.websocketExtensions;if(s)for(var r=0,o=(s=[].concat(s)).length;r<o;r++)this.addWebsocketExtension(s[r]);for(i in this.tls=n.tls||{},this.tls.ca=this.tls.ca||n.ca,this._alternates)this._alternates[i]=c.parse(this._alternates[i]);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),r.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 r.getConnectionTypes()},selectTransport:function(t){r.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=t.id,s=n.attempts,r=n.deadline&&(new Date).getTime()+1e3*n.deadline,n=this._envelopes[i];n||(r=new this._scheduler(t,{timeout:e,interval:this.retry,attempts:s,deadline:r}),n=this._envelopes[i]={message:t,scheduler:r}),this._sendEnvelope(n)},_sendEnvelope:function(t){if(this._transport&&!t.request&&!t.timer){var e=t.message,n=t.scheduler,i=this;if(!n.isDeliverable())return n.abort(),void delete this._envelopes[e.id];t.timer=s.setTimeout(function(){i.handleError(e)},1e3*n.getTimeout()),n.send(),t.request=this._transport.sendMessage(e)}},handleResponse:function(t){var e=this._envelopes[t.id];void 0!==t.successful&&e&&(e.scheduler.succeed(),delete this._envelopes[t.id],s.clearTimeout(e.timer)),this.trigger("message",t),this._state!==this.UP&&(this._state=this.UP,this._client.trigger("transport:up"))},handleError:function(t,e){var n=this._envelopes[t.id],t=n&&n.request,i=this;t&&(t.then(function(t){t&&t.abort&&t.abort()}),(t=n.scheduler).fail(),s.clearTimeout(n.timer),n.request=n.timer=null,e?this._sendEnvelope(n):n.timer=s.setTimeout(function(){n.timer=null,i._sendEnvelope(n)},1e3*t.getInterval()),this._state!==this.DOWN&&(this._state=this.DOWN,this._client.trigger("transport:down")))}});o.create=function(t,e,n){return new o(t,e,n)},e(o.prototype,i),e(o.prototype,n),h.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../mixins/logging":7,"../mixins/publisher":8,"../transport":19,"../util/assign":27,"../util/class":29,"../util/cookies":31,"../util/uri":37,"./scheduler":17}],13:[function(t,e,n){"use strict";var i=t("../util/class"),s=t("./grammar"),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,c={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(o in c)!function(t){r[t]=function(){return new r(c[t][0],arguments,c[t][1]).toString()}}(o);e.exports=r},{"../util/class":29,"./grammar":15}],14:[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(i,t,s,r,o){if(this.debug("Passing through ? extensions: ?",i,t),!this._extensions)return r.call(o,t);var c=this._extensions.slice(),a=function(t){if(!t)return r.call(o,t);var e=c.shift();if(!e)return r.call(o,t);var n=e[i];if(!n)return a(t);3<=n.length?e[i](t,s,a):e[i](t,a)};a(t)}};t("../util/assign")(i,t("../mixins/logging")),e.exports=i},{"../mixins/logging":7,"../util/assign":27}],15:[function(t,e,n){"use strict";e.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])|\-|\_))*)*$/}},{}],16:[function(t,e,n){"use strict";var i=t("../util/class"),t=t("../mixins/deferrable");e.exports=i(t)},{"../mixins/deferrable":6,"../util/class":29}],17:[function(t,e,n){"use strict";function i(t,e){this.message=t,this.options=e,this.attempts=0}t("../util/assign")(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&&t<=e)&&!(void 0!==n&&n<i)},send:function(){this.attempts+=1},succeed:function(){},fail:function(){},abort:function(){}}),e.exports=i},{"../util/assign":27}],18:[function(t,e,n){"use strict";var i=t("../util/class"),s=t("../util/assign"),t=t("../mixins/deferrable"),i=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){e=e[0];this._callback&&this._callback.call(this._context,e.data),this._withChannel&&this._withChannel[0].call(this._withChannel[1],e.channel,e.data)},cancel:function(){this._cancelled||(this._client.unsubscribe(this._channels,this),this._cancelled=!0)},unsubscribe:function(){this.cancel()}});s(i.prototype,t),e.exports=i},{"../mixins/deferrable":6,"../util/assign":27,"../util/class":29}],19:[function(t,e,n){"use strict";var i=t("./transport");i.register("websocket",t("./web_socket")),i.register("eventsource",t("./event_source")),i.register("long-polling",t("./xhr")),i.register("cross-origin-long-polling",t("./cors")),i.register("callback-polling",t("./jsonp")),e.exports=i},{"./cors":20,"./event_source":21,"./jsonp":22,"./transport":23,"./web_socket":24,"./xhr":25}],20:[function(r,o,t){(function(a){"use strict";var t=r("../util/class"),e=r("../util/set"),s=r("../util/uri"),n=r("../util/assign"),i=r("../util/to_json"),u=n(t(r("./transport"),{encode:function(t){return"message="+encodeURIComponent(i(t))},request:function(e){var t,n=a.XDomainRequest?XDomainRequest:XMLHttpRequest,i=new n,s=++u._id,r=this._dispatcher.headers,o=this;if(i.open("POST",this.endpoint.href,!0),i.withCredentials=!0,i.setRequestHeader)for(t in i.setRequestHeader("Pragma","no-cache"),r)r.hasOwnProperty(t)&&i.setRequestHeader(t,r[t]);function c(){i&&(u._pending.remove(s),i.onload=i.onerror=i.ontimeout=i.onprogress=null,i=null)}return i.onload=function(){var t;try{t=JSON.parse(i.responseText)}catch(t){}c(),t?o._receive(t):o._handleError(e)},i.onerror=i.ontimeout=function(){c(),o._handleError(e)},i.onprogress=function(){},n===a.XDomainRequest&&u._pending.add({id:s,xhr:i}),i.send(this.encode(e)),i}}),{_id:0,_pending:new e,isUsable:function(t,e,n,i){if(s.isSameOrigin(e))return n.call(i,!1);if(a.XDomainRequest)return n.call(i,e.protocol===location.protocol);if(a.XMLHttpRequest){e=new XMLHttpRequest;return n.call(i,void 0!==e.withCredentials)}return n.call(i,!1)}});o.exports=u}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../util/assign":27,"../util/class":29,"../util/set":35,"../util/to_json":36,"../util/uri":37,"./transport":23}],21:[function(i,u,t){(function(s){"use strict";var t=i("../util/class"),r=i("../util/uri"),o=i("../util/copy_object"),e=i("../util/assign"),n=i("../mixins/deferrable"),c=i("./transport"),a=i("./xhr"),t=e(t(c,{initialize:function(t,e){if(c.prototype.initialize.call(this,t,e),!s.EventSource)return this.setDeferredStatus("failed");this._xhr=new a(t,e),(e=o(e)).pathname+="/"+t.clientId;var n=new s.EventSource(r.stringify(e)),i=this;n.onopen=function(){i._everConnected=!0,i.setDeferredStatus("succeeded")},n.onerror=function(){i._everConnected?i._handleError([]):(i.setDeferredStatus("failed"),n.close())},n.onmessage=function(t){var e;try{e=JSON.parse(t.data)}catch(t){}e?i._receive(e):i._handleError([])},this._socket=n},close:function(){this._socket&&(this._socket.onopen=this._socket.onerror=this._socket.onmessage=null,this._socket.close(),delete this._socket)},isUsable:function(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(e,n,i,s){if(!e.clientId)return i.call(s,!1);a.isUsable(e,n,function(t){return t?void this.create(e,n).isUsable(i,s):i.call(s,!1)},this)},create:function(t,e){var n=t.transports.eventsource=t.transports.eventsource||{},i=t.clientId,s=o(e);return s.pathname+="/"+(i||""),n[s=r.stringify(s)]=n[s]||new this(t,e),n[s]}});e(t.prototype,n),u.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../mixins/deferrable":6,"../util/assign":27,"../util/class":29,"../util/copy_object":32,"../util/uri":37,"./transport":23,"./xhr":25}],22:[function(n,i,t){(function(c){"use strict";var t=n("../util/class"),a=n("../util/uri"),u=n("../util/copy_object"),e=n("../util/assign"),l=n("../util/to_json"),h=e(t(n("./transport"),{encode:function(t){var e=u(this.endpoint);return e.query.message=l(t),e.query.jsonp="__jsonp"+h._cbCount+"__",a.stringify(e)},request:function(t){var e=document.getElementsByTagName("head")[0],n=document.createElement("script"),i=h.getCallbackName(),s=u(this.endpoint),r=this;s.query.message=l(t),s.query.jsonp=i;function o(){if(!c[i])return!1;c[i]=void 0;try{delete c[i]}catch(t){}n.parentNode.removeChild(n)}return c[i]=function(t){o(),r._receive(t)},n.type="text/javascript",n.src=a.stringify(s),e.appendChild(n),n.onerror=function(){o(),r._handleError(t)},{abort:o}}}),{_cbCount:0,getCallbackName:function(){return this._cbCount+=1,"__jsonp"+this._cbCount+"__"},isUsable:function(t,e,n,i){n.call(i,!0)}});i.exports=h}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../util/assign":27,"../util/class":29,"../util/copy_object":32,"../util/to_json":36,"../util/uri":37,"./transport":23}],23:[function(a,u,t){(function(r){"use strict";var t=a("../util/class"),o=a("../util/cookies").Cookie,n=a("../util/promise"),l=a("../util/array"),i=a("../util/assign"),e=a("../mixins/logging"),s=a("../mixins/timeouts"),c=a("../protocol/channel"),t=i(t({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=i({},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===c.HANDSHAKE?this._publish(.01):(t.channel===c.CONNECT&&(this._connectMessage=t),this._publish(this.MAX_DELAY))):n.resolve(this.request([t]))},_makePromise:function(){var e=this;this._requestPromise=this._requestPromise||new n(function(t){e._resolvePromise=t})},_publish:function(t){return this._makePromise(),this.addTimeout("publish",t,function(){this._flush(),delete this._requestPromise},this),this._requestPromise},_flush:function(){this.removeTimeout("publish"),1<this._outbox.length&&this._connectMessage&&(this._connectMessage.advice={timeout:0}),this._resolvePromise(this.request(this._outbox)),this._connectMessage=null,this._outbox=[]},_flushLargeBatch:function(){var t;this.encode(this._outbox).length<this._dispatcher.maxRequestSize||(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?l.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 s=0,r=(t=[].concat(t)).length;s<r;s++)e=o.parse(t[s]),n.setCookieSync(e,i)},_findProxy:function(){if(void 0!==r){var t=this.endpoint.protocol;if(t){var e,n=t.replace(/:$/,"").toLowerCase()+"_proxy",i=n.toUpperCase(),s=r.env;return"http_proxy"===n&&s.REQUEST_METHOD?(1===(t=Object.keys(s).filter(function(t){return/^http_proxy$/i.test(t)})).length?t[0]===n&&void 0===s[i]&&(e=s[n]):1<t.length&&(e=s[n]),e=e||s["CGI_"+i]):(e=s[n]||s[i])&&!s[n]&&console.warn("The environment variable "+i+" is discouraged. Use "+n+"."),e}}}}),{get:function(r,o,c,a,u){var t=r.endpoint;l.asyncEach(this._transports,function(t,e){var n=t[0],i=t[1],s=r.endpointFor(n);return 0<=l.indexOf(c,n)?e():l.indexOf(o,n)<0?(i.isUsable(r,s,function(){}),e()):void i.isUsable(r,s,function(t){if(!t)return e();t=i.hasOwnProperty("create")?i.create(r,s):new i(r,s);a.call(u,t)})},function(){throw new Error("Could not find a usable connection type for "+t.href)})},register:function(t,e){this._transports.push([t,e]),e.prototype.connectionType=t},getConnectionTypes:function(){return l.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:[]});i(t.prototype,e),i(t.prototype,s),u.exports=t}).call(this,a("_process"))},{"../mixins/logging":7,"../mixins/timeouts":9,"../protocol/channel":10,"../util/array":26,"../util/assign":27,"../util/class":29,"../util/cookies":31,"../util/promise":34,_process:40}],24:[function(f,d,t){(function(t){"use strict";var e=f("../util/class"),r=f("../util/promise"),o=f("../util/set"),n=f("../util/uri"),i=f("../util/browser"),s=f("../util/copy_object"),c=f("../util/assign"),a=f("../util/to_json"),u=f("../util/websocket"),l=f("../mixins/deferrable"),h=c(e(f("./transport"),{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(n){this._pending=this._pending||new o;for(var t=0,e=n.length;t<e;t++)this._pending.add(n[t]);var i=this,s=new r(function(e,t){i.callback(function(t){t&&1===t.readyState&&(t.send(a(n)),e(t))}),i.connect()});return{abort:function(){s.then(function(t){t.close()})}}},connect:function(){if(!h._unloaded&&(this._state=this._state||this.UNCONNECTED,this._state===this.UNCONNECTED)){this._state=this.CONNECTING;var n=this._createSocket();if(!n)return this.setDeferredStatus("failed");var s=this,i=!(n.onopen=function(){n.headers&&s._storeCookies(n.headers["set-cookie"]),s._socket=n,s._state=s.CONNECTED,s._everConnected=!0,s.setDeferredStatus("succeeded",n)});n.onclose=n.onerror=function(){var t,e;i||(i=!0,t=s._state===s.CONNECTED,n.onopen=n.onclose=n.onerror=n.onmessage=null,delete s._socket,s._state=s.UNCONNECTED,e=s._pending?s._pending.toArray():[],delete s._pending,t||s._everConnected?(s.setDeferredStatus("unknown"),s._handleError(e,t)):s.setDeferredStatus("failed"))},n.onmessage=function(t){var e;try{e=JSON.parse(t.data)}catch(t){}if(e){for(var n=0,i=(e=[].concat(e)).length;n<i;n++)void 0!==e[n].successful&&s._pending.remove(e[n]);s._receive(e)}}}},close:function(){this._socket&&this._socket.close()},_createSocket:function(){var t=h.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 u.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=s(t)).protocol=this.PROTOCOLS[t.protocol],n.stringify(t)},isUsable:function(t,e,n,i){this.create(t,e).isUsable(n,i)}});c(h.prototype,l),i.Event&&void 0!==t.onbeforeunload&&i.Event.on(t,"beforeunload",function(){void 0===h._unloaded&&(h._unloaded=!0)}),d.exports=h}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../mixins/deferrable":6,"../util/assign":27,"../util/browser":28,"../util/class":29,"../util/copy_object":32,"../util/promise":34,"../util/set":35,"../util/to_json":36,"../util/uri":37,"../util/websocket":39,"./transport":23}],25:[function(i,r,t){(function(c){"use strict";var t=i("../util/class"),s=i("../util/uri"),a=i("../util/browser"),e=i("../util/assign"),n=i("../util/to_json"),t=e(t(i("./transport"),{encode:function(t){return n(t)},request:function(i){var s,t=this.endpoint.href,r=this;if(c.XMLHttpRequest)s=new XMLHttpRequest;else{if(!c.ActiveXObject)return this._handleError(i);s=new ActiveXObject("Microsoft.XMLHTTP")}s.open("POST",t,!0),s.setRequestHeader("Content-Type","application/json"),s.setRequestHeader("Pragma","no-cache"),s.setRequestHeader("X-Requested-With","XMLHttpRequest");var e,n=this._dispatcher.headers;for(e in n)n.hasOwnProperty(e)&&s.setRequestHeader(e,n[e]);function o(){s.abort()}return void 0!==c.onbeforeunload&&a.Event.on(c,"beforeunload",o),s.onreadystatechange=function(){if(s&&4===s.readyState){var t=null,e=s.status,n=s.responseText,e=200<=e&&e<300||304===e||1223===e;if(void 0!==c.onbeforeunload&&a.Event.detach(c,"beforeunload",o),s.onreadystatechange=function(){},s=null,!e)return r._handleError(i);try{t=JSON.parse(n)}catch(t){}t?r._receive(t):r._handleError(i)}},s.send(this.encode(i)),s}}),{isUsable:function(t,e,n,i){e="ReactNative"===navigator.product||s.isSameOrigin(e);n.call(i,e)}});r.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../util/assign":27,"../util/browser":28,"../util/class":29,"../util/to_json":36,"../util/uri":37,"./transport":23}],26:[function(t,e,n){"use strict";e.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){function s(){if(!a){for(a=!0;0<c;)--c,!((o+=1)===r?n&&n.call(i):void e(t[o],u));a=!1}}var r=t.length,o=-1,c=0,a=!1,u=function(){c+=1,s()};u()}}},{}],27:[function(t,e,n){"use strict";var s=Array.prototype.forEach,r=Object.prototype.hasOwnProperty;e.exports=function(i){return s.call(arguments,function(t,e){if(0!==e)for(var n in t)r.call(t,n)&&(i[n]=t[n])}),i}},{}],28:[function(t,n,e){(function(t){"use strict";var e={_registry:[],on:function(t,e,n,i){function s(){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!==t.onunload&&e.on(t,"unload",e.detach,e),n.exports={Event:e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],29:[function(t,e,n){"use strict";var s=t("./assign");e.exports=function(t,e){"function"!=typeof t&&(e=t,t=Object);function n(){return this.initialize&&this.initialize.apply(this,arguments)||this}function i(){}return i.prototype=t.prototype,n.prototype=new i,s(n.prototype,e),n}},{"./assign":27}],30:[function(t,e,n){e.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"]}},{}],31:[function(t,e,n){"use strict";e.exports={}},{}],32:[function(t,e,n){"use strict";var s=function(t){var e,n,i;if(t instanceof Array){for(e=[],n=t.length;n--;)e[n]=s(t[n]);return e}if("object"!=typeof t)return t;for(i in e=null===t?null:{},t)e[i]=s(t[i]);return e};e.exports=s},{}],33:[function(t,e,n){var o="function"==typeof Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(){}(e.exports=i).prototype.emit=function(t){if("error"===t&&(!this._events||!this._events.error||o(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 n=Array.prototype.slice.call(arguments,1);e.apply(this,n)}return!0}if(o(e)){for(var n=Array.prototype.slice.call(arguments,1),i=e.slice(),s=0,r=i.length;s<r;s++)i[s].apply(this,n);return!0}return!1},i.prototype.on=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]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,this},i.prototype.once=function(e,n){var i=this;return i.on(e,function t(){i.removeListener(e,t),n.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 n=this._events[t];if(o(n)){var i=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}(n,e);if(i<0)return this;n.splice(i,1),0==n.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={}: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]=[]),o(this._events[t])||(this._events[t]=[this._events[t]]),this._events[t]}},{}],34:[function(t,e,n){"use strict";function o(t){this._state=-1,this._value=null,this._defer=[],s(this,t)}var c=t("asap");o.prototype.then=function(t,e){var n=new o,e={promise:n,onFulfilled:t,onRejected:e};return-1===this._state?this._defer.push(e):r(this,e),n},o.prototype.catch=function(t){return this.then(null,t)};var s=function(e,t){if("function"==typeof t){var n=0,i=function(t){0==n++&&h(e,t)};try{t(function(t){0==n++&&a(e,t)},i)}catch(t){i(t)}}},r=function(t,e){var n=t._state,i=t._value,s=e.promise,r=[e.onFulfilled,e.onRejected][n];if("function"!=typeof r)return(0,[a,h][n])(s,i);c(function(){try{a(s,r(i))}catch(t){h(s,t)}})},a=function(e,n){if(e===n)return h(e,new TypeError("Recursive promise chain detected"));var i;try{i=u(n)}catch(t){return h(e,t)}if(!i)return l(e,n);s(e,function(t,e){i.call(n,t,e)})},u=function(t){var e=typeof t,t=("object"==e||"function"==e)&&t&&t.then;return"function"==typeof t?t:null},l=function(t,e){i(t,0,e)},h=function(t,e){i(t,1,e)},i=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;)r(t,i[s++])};o.resolve=function(n){try{if(u(n))return n}catch(t){return o.reject(t)}return new o(function(t,e){t(n)})},o.reject=function(n){return new o(function(t,e){e(n)})},o.all=function(e){return new o(function(n,i){var s=[],r=e.length;if(0===r)return n(s);for(var t=0;t<r;t++)!function(t,e){o.resolve(t).then(function(t){s[e]=t,0==--r&&n(s)},i)}(e[t],t)})},o.race=function(s){return new o(function(t,e){for(var n=0,i=s.length;n<i;n++)o.resolve(s[n]).then(t,e)})},o.deferred=function(){var n={};return n.promise=new o(function(t,e){n.resolve=t,n.reject=e}),n},e.exports=o},{asap:3}],35:[function(t,e,n){"use strict";t=t("./class");e.exports=t({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,t=this._index[e];return delete this._index[e],t},toArray:function(){var e=[];return this.forEach(function(t){e.push(t)}),e}})},{"./class":29}],36:[function(t,e,n){"use strict";e.exports=function(t){return JSON.stringify(t,function(t,e){return this[t]instanceof Array?this[t]:e})}},{}],37:[function(t,e,n){"use strict";e.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(n){if("string"!=typeof n)return n;var t,e,i,s,r,o={},c=function(e,t){n=n.replace(t,function(t){return o[e]=t,""}),o[e]=o[e]||""};for(c("protocol",/^[a-z]+\:/i),c("host",/^\/\/[^\/\?#]+/),/^\//.test(n)||o.host||(n=location.pathname.replace(/[^\/]*$/,"")+n),c("pathname",/^[^\?#]*/),c("search",/^\?[^#]*/),c("hash",/^#.*/),o.protocol=o.protocol||location.protocol,o.host?(o.host=o.host.substr(2),/@/.test(o.host)&&(o.auth=o.host.split("@")[0],o.host=o.host.split("@")[1]),t=o.host.match(/^\[([^\]]+)\]|^[^:]+/),o.hostname=t[1]||t[0],o.port=(o.host.match(/:(\d+)$/)||[])[1]||""):(o.host=location.host,o.hostname=location.hostname,o.port=location.port),o.pathname=o.pathname||"/",o.path=o.pathname+o.search,r={},i=0,s=(e=(c=o.search.replace(/^\?/,""))?c.split("&"):[]).length;i<s;i++)t=e[i].split("="),r[decodeURIComponent(t[0]||"")]=decodeURIComponent(t[1]||"");return o.query=r,o.href=this.stringify(o),o},stringify:function(t){var e=t.auth?t.auth+"@":"",e=t.protocol+"//"+e+t.host;return e+=t.pathname+this.queryString(t.query)+(t.hash||"")},queryString:function(t){var e,n=[];for(e in t)t.hasOwnProperty(e)&&n.push(encodeURIComponent(e)+"="+encodeURIComponent(t[e]));return 0===n.length?"":"?"+n.join("&")}}},{}],38:[function(t,e,n){"use strict";var i=t("./array");e.exports=function(t,e){for(var n in t)if(i.indexOf(e,n)<0)throw new Error("Unrecognized option: "+n)}},{"./array":26}],39:[function(t,e,n){(function(t){"use strict";var i=t.MozWebSocket||t.WebSocket;e.exports={create:function(t,e,n){return"function"!=typeof i?null:new i(t)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],40:[function(t,e,n){var i,s,e=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function c(e){if(i===setTimeout)return setTimeout(e,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{s="function"==typeof clearTimeout?clearTimeout:o}catch(t){s=o}}();var a,u=[],l=!1,h=-1;function f(){l&&a&&(l=!1,a.length?u=a.concat(u):h=-1,u.length&&d())}function d(){if(!l){var t=c(f);l=!0;for(var e=u.length;e;){for(a=u,u=[];++h<e;)a&&a[h].run();h=-1,e=u.length}a=null,l=!1,function(e){if(s===clearTimeout)return clearTimeout(e);if((s===o||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(e);try{s(e)}catch(t){try{return s.call(null,e)}catch(t){return s.call(this,e)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function _(){}e.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new p(t,e)),1!==u.length||l||c(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=_,e.addListener=_,e.once=_,e.off=_,e.removeListener=_,e.removeAllListeners=_,e.emit=_,e.prependListener=_,e.prependOnceListener=_,e.listeners=function(t){return[]},e.binding=function(t){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(t){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}},{}]},{},[2])(2)}); | ||
//# sourceMappingURL=jsforce-api-streaming.min.js.map |
'use strict'; | ||
module.exports = '1.11.0'; | ||
module.exports = '1.11.1'; |
@@ -13,3 +13,3 @@ { | ||
"homepage": "http://github.com/jsforce/jsforce", | ||
"version": "1.11.0", | ||
"version": "1.11.1", | ||
"repository": { | ||
@@ -73,3 +73,3 @@ "type": "git", | ||
"request": "^2.72.0", | ||
"xml2js": "^0.4.16" | ||
"xml2js": "^0.5.0" | ||
}, | ||
@@ -76,0 +76,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
9720674
87287
5
2
+ Addedxml2js@0.5.0(transitive)
- Removedxml2js@0.4.23(transitive)
Updatedxml2js@^0.5.0