-
Notifications
You must be signed in to change notification settings - Fork 5
/
vein.min.js
2 lines (2 loc) · 38.5 KB
/
vein.min.js
1
2
(function(){function t(e,o,n){var i=t.resolve(e);if(null==i){n=n||e,o=o||"root";var r=Error('Failed to require "'+n+'" from "'+o+'"');throw r.path=n,r.parent=o,r.require=!0,r}var s=t.modules[i];return s.exports||(s.exports={},s.client=s.component=!0,s.call(this,s.exports,t.relative(i),s)),s.exports}t.modules={},t.aliases={},t.resolve=function(e){"/"===e.charAt(0)&&(e=e.slice(1));for(var o=e+"/index.js",n=[e,e+".js",e+".json",e+"/index.js",e+"/index.json"],i=0;n.length>i;i++){var e=n[i];if(t.modules.hasOwnProperty(e))return e}return t.aliases.hasOwnProperty(o)?t.aliases[o]:void 0},t.normalize=function(t,e){var o=[];if("."!=e.charAt(0))return e;t=t.split("/"),e=e.split("/");for(var n=0;e.length>n;++n)".."==e[n]?t.pop():"."!=e[n]&&""!=e[n]&&o.push(e[n]);return t.concat(o).join("/")},t.register=function(e,o){t.modules[e]=o},t.alias=function(e,o){if(!t.modules.hasOwnProperty(e))throw Error('Failed to alias "'+e+'", it does not exist');t.aliases[o]=e},t.relative=function(e){function o(t,e){for(var o=t.length;o--;)if(t[o]===e)return o;return-1}function n(o){var i=n.resolve(o);return t(i,e,o)}var i=t.normalize(e,"..");return n.resolve=function(n){var r=n.charAt(0);if("/"==r)return n.slice(1);if("."==r)return t.normalize(i,n);var s=e.split("/"),a=o(s,"deps")+1;return a||(a=0),n=s.slice(0,a+1).join("/")+"/deps/"+n},n.exists=function(e){return t.modules.hasOwnProperty(n.resolve(e))},n},t.register("component-indexof/index.js",function(t,e,o){var n=[].indexOf;o.exports=function(t,e){if(n)return t.indexOf(e);for(var o=0;t.length>o;++o)if(t[o]===e)return o;return-1}}),t.register("component-emitter/index.js",function(t,e,o){function n(t){return t?i(t):void 0}function i(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}var r=e("indexof");o.exports=n,n.prototype.on=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function o(){n.off(t,o),e.apply(this,arguments)}var n=this;return this._callbacks=this._callbacks||{},e._off=o,this.on(t,o),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var o=this._callbacks[t];if(!o)return this;if(1==arguments.length)return delete this._callbacks[t],this;var n=r(o,e._off||e);return~n&&o.splice(n,1),this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),o=this._callbacks[t];if(o){o=o.slice(0);for(var n=0,i=o.length;i>n;++n)o[n].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}}),t.register("LearnBoost-engine.io-protocol/lib/index.js",function(t,e){var o=e("./keys");t.protocol=2;var n=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},i=o(n),r={type:"error",data:"parser error"};t.encodePacket=function(t){var e=n[t.type];return void 0!==t.data&&(e+=t.data+""),""+e},t.decodePacket=function(t){var e=t.charAt(0);return Number(e)==e&&i[e]?t.length>1?{type:i[e],data:t.substring(1)}:{type:i[e]}:r},t.encodePayload=function(e){if(!e.length)return"0:";for(var o,n="",i=0,r=e.length;r>i;i++)o=t.encodePacket(e[i]),n+=o.length+":"+o;return n},t.decodePayload=function(e,o){var n;if(""==e)return o(r,0,1);for(var i,s,a="",c=0,p=e.length;p>c;c++){var l=e.charAt(c);if(":"!=l)a+=l;else{if(""==a||a!=(i=Number(a)))return o(r,0,1);if(s=e.substr(c+1,i),a!=s.length)return o(r,0,1);if(s.length){if(n=t.decodePacket(s),r.type==n.type&&r.data==n.data)return o(r,0,1);var u=o(n,c+i,p);if(!1===u)return}c+=i,a=""}}return""!=a?o(r,0,1):void 0}}),t.register("LearnBoost-engine.io-protocol/lib/keys.js",function(t,e,o){o.exports=Object.keys||function(t){var e=[],o=Object.prototype.hasOwnProperty;for(var n in t)o.call(t,n)&&e.push(n);return e}}),t.register("visionmedia-debug/index.js",function(t,e,o){o.exports="undefined"==typeof window?e("./lib/debug"):e("./debug")}),t.register("visionmedia-debug/debug.js",function(t,e,o){function n(t){return n.enabled(t)?function(e){var o=new Date,i=o-(n[t]||o);n[t]=o,e=t+" "+e+" +"+n.humanize(i),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}o.exports=n,n.names=[],n.skips=[],n.enable=function(t){try{localStorage.debug=t}catch(e){}for(var o=(t||"").split(/[\s,]+/),i=o.length,r=0;i>r;r++)t=o[r].replace("*",".*?"),"-"===t[0]?n.skips.push(RegExp("^"+t.substr(1)+"$")):n.names.push(RegExp("^"+t+"$"))},n.disable=function(){n.enable("")},n.humanize=function(t){var e=1e3,o=6e4,n=60*o;return t>=n?(t/n).toFixed(1)+"h":t>=o?(t/o).toFixed(1)+"m":t>=e?(0|t/e)+"s":t+"ms"},n.enabled=function(t){for(var e=0,o=n.skips.length;o>e;e++)if(n.skips[e].test(t))return!1;for(var e=0,o=n.names.length;o>e;e++)if(n.names[e].test(t))return!0;return!1},window.localStorage&&n.enable(localStorage.debug)}),t.register("LearnBoost-engine.io-client/lib/index.js",function(t,e,o){o.exports=e("./socket"),o.exports.parser=e("engine.io-parser")}),t.register("LearnBoost-engine.io-client/lib/socket.js",function(t,e,o){function n(t,e){if(!(this instanceof n))return new n(t,e);if(e=e||{},"object"==typeof t&&(e=t,t=null),t&&(t=r.parseUri(t),e.host=t.host,e.secure="https"==t.protocol||"wss"==t.protocol,e.port=t.port,t.query&&(e.query=t.query)),this.secure=null!=e.secure?e.secure:l.location&&"https:"==location.protocol,e.host){var o=e.host.split(":");e.hostname=o.shift(),o.length&&(e.port=o.pop())}this.hostname=e.hostname||(l.location?location.hostname:"localhost"),this.port=e.port||(l.location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},"string"==typeof this.query&&(this.query=r.qsParse(this.query)),this.upgrade=!1!==e.upgrade,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.timestampParam=e.timestampParam||"t",this.timestampRequests=!!e.timestampRequests,this.flashPath=e.flashPath||"",this.transports=e.transports||["polling","websocket","flashsocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=e.policyPort||843,this.open(),n.sockets.push(this),n.sockets.evs.emit("add",this)}function i(t){var e={};for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);return e}var r=e("./util"),s=e("./transports"),a=e("./emitter"),c=e("debug")("engine-client:socket"),p=e("engine.io-parser");o.exports=n;var l=r.global();a(n.prototype),n.protocol=p.protocol,n.sockets=[],n.sockets.evs=new a,n.Socket=n,n.Transport=e("./transport"),n.Emitter=e("./emitter"),n.transports=e("./transports"),n.util=e("./util"),n.parser=e("engine.io-parser"),n.prototype.createTransport=function(t){c('creating transport "%s"',t);var e=i(this.query);e.EIO=p.protocol,e.transport=t,this.id&&(e.sid=this.id);var o=new s[t]({hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:e,forceJSONP:this.forceJSONP,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,flashPath:this.flashPath,policyPort:this.policyPort});return o},n.prototype.open=function(){this.readyState="opening";var t=this.createTransport(this.transports[0]);t.open(),this.setTransport(t)},n.prototype.setTransport=function(t){var e=this;this.transport&&(c("clearing existing transport"),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},n.prototype.probe=function(t){function e(e){if(!n){n=!0;var r=Error("probe error: "+e);r.transport=o.name,o.close(),o=null,c('probe transport "%s" failed because of error: %s',t,e),i.emit("error",r)}}c('probing transport "%s"',t);var o=this.createTransport(t,{probe:1}),n=!1,i=this;o.once("open",function(){n||(c('probe transport "%s" opened',t),o.send([{type:"ping",data:"probe"}]),o.once("packet",function(r){if(!n)if("pong"==r.type&&"probe"==r.data)c('probe transport "%s" pong',t),i.upgrading=!0,i.emit("upgrading",o),c('pausing current transport "%s"',i.transport.name),i.transport.pause(function(){n||"closed"!=i.readyState&&"closing"!=i.readyState&&(c("changing transport and sending upgrade packet"),o.removeListener("error",e),i.emit("upgrade",o),i.setTransport(o),o.send([{type:"upgrade"}]),o=null,i.upgrading=!1,i.flush())});else{c('probe transport "%s" failed',t);var s=Error("probe error");s.transport=o.name,i.emit("error",s)}}))}),o.once("error",e),o.open(),this.once("close",function(){o&&(c("socket closed prematurely - aborting probe"),n=!0,o.close(),o=null)}),this.once("upgrading",function(t){o&&t.name!=o.name&&(c('"%s" works - aborting "%s"',t.name,o.name),o.close(),o=null)})},n.prototype.onOpen=function(){if(c("socket open"),this.readyState="open",this.emit("open"),this.onopen&&this.onopen.call(this),this.flush(),"open"==this.readyState&&this.upgrade&&this.transport.pause){c("starting upgrade probes");for(var t=0,e=this.upgrades.length;e>t;t++)this.probe(this.upgrades[t])}},n.prototype.onPacket=function(t){if("opening"==this.readyState||"open"==this.readyState)switch(c('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(r.parseJSON(t.data));break;case"pong":this.ping();break;case"error":var e=Error("server error");e.code=t.data,this.emit("error",e);break;case"message":this.emit("data",t.data),this.emit("message",t.data);var o={data:t.data};o.toString=function(){return t.data},this.onmessage&&this.onmessage.call(this,o)}else c('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),this.ping(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat)},n.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!=e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},n.prototype.ping=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){c("writing ping packet - expecting pong within %sms",t.pingTimeout),t.sendPacket("ping"),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},n.prototype.onDrain=function(){this.callbacks(),this.writeBuffer.splice(0,this.prevBufferLen),this.callbackBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0==this.writeBuffer.length?this.emit("drain"):this.flush()},n.prototype.callbacks=function(){for(var t=0;this.prevBufferLen>t;t++)this.callbackBuffer[t]&&this.callbackBuffer[t]()},n.prototype.flush=function(){"closed"!=this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(c("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(t,e){return this.sendPacket("message",t,e),this},n.prototype.sendPacket=function(t,e,o){var n={type:t,data:e};this.emit("packetCreate",n),this.writeBuffer.push(n),this.callbackBuffer.push(o),this.flush()},n.prototype.close=function(){return("opening"==this.readyState||"open"==this.readyState)&&(this.onClose("forced close"),c("socket closing - telling transport to close"),this.transport.close(),this.transport.removeAllListeners()),this},n.prototype.onError=function(t){c("socket error %j",t),this.emit("error",t),this.onClose("transport error",t)},n.prototype.onClose=function(t,e){if("opening"==this.readyState||"open"==this.readyState){c('socket close with reason: "%s"',t);var o=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),setTimeout(function(){o.writeBuffer=[],o.callbackBuffer=[]},0),this.readyState="closed",this.emit("close",t,e),this.onclose&&this.onclose.call(this),this.id=null}},n.prototype.filterUpgrades=function(t){for(var e=[],o=0,n=t.length;n>o;o++)~this.transports.indexOf(t[o])&&e.push(t[o]);return e}}),t.register("LearnBoost-engine.io-client/lib/transport.js",function(t,e,o){function n(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState=""}var i=(e("./util"),e("engine.io-parser")),r=e("./emitter");o.exports=n,r(n.prototype),n.prototype.onError=function(t,e){var o=Error(t);return o.type="TransportError",o.description=e,this.emit("error",o),this},n.prototype.open=function(){return("closed"==this.readyState||""==this.readyState)&&(this.readyState="opening",this.doOpen()),this},n.prototype.close=function(){return("opening"==this.readyState||"open"==this.readyState)&&(this.doClose(),this.onClose()),this},n.prototype.send=function(t){if("open"!=this.readyState)throw Error("Transport not open");this.write(t)},n.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},n.prototype.onData=function(t){this.onPacket(i.decodePacket(t))},n.prototype.onPacket=function(t){this.emit("packet",t)},n.prototype.onClose=function(){this.readyState="closed",this.emit("close")}}),t.register("LearnBoost-engine.io-client/lib/emitter.js",function(t,e,o){var n=e("emitter");o.exports=n,n.prototype.addEventListener=n.prototype.on,n.prototype.removeEventListener=n.prototype.off,n.prototype.removeListener=n.prototype.off}),t.register("LearnBoost-engine.io-client/lib/util.js",function(t,e){var o=!1;t.global=function(){return"undefined"!=typeof window?window:global},t.inherits=function(t,e){function o(){}o.prototype=e.prototype,t.prototype=new o},t.keys=Object.keys||function(t){var e=[],o=Object.prototype.hasOwnProperty;for(var n in t)o.call(t,n)&&e.push(n);return e},t.on=function(t,e,o,n){t.attachEvent?t.attachEvent("on"+e,o):t.addEventListener&&t.addEventListener(e,o,n)},t.load=function(e){var n=t.global();return n.document&&"complete"===document.readyState||o?e():(t.on(n,"load",e,!1),void 0)},"undefined"!=typeof window&&t.load(function(){o=!0}),t.defer=function(e){return t.ua.webkit&&"undefined"==typeof importScripts?(t.load(function(){setTimeout(e,100)}),void 0):e()};var n=/^[\],:{}\s]*$/,i=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,r=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,s=/(?:^|:|,)(?:\s*\[)+/g,a=/^\s+/,c=/\s+$/;t.parseJSON=function(e){var o=t.global();return"string"==typeof e&&e?(e=e.replace(a,"").replace(c,""),o.JSON&&JSON.parse?JSON.parse(e):n.test(e.replace(i,"@").replace(r,"]").replace(s,""))?Function("return "+e)():void 0):null},t.ua={},t.ua.hasCORS="undefined"!=typeof XMLHttpRequest&&function(){var t;try{t=new XMLHttpRequest}catch(e){return!1}return void 0!=t.withCredentials}(),t.ua.webkit="undefined"!=typeof navigator&&/webkit/i.test(navigator.userAgent),t.ua.gecko="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent),t.ua.android="undefined"!=typeof navigator&&/android/i.test(navigator.userAgent),t.ua.ios="undefined"!=typeof navigator&&/^(iPad|iPhone|iPod)$/.test(navigator.platform),t.ua.ios6=t.ua.ios&&/OS 6_/.test(navigator.userAgent),t.request=function(o){try{var n=e("xmlhttprequest").XMLHttpRequest;return new n}catch(i){}if(o&&"undefined"!=typeof XDomainRequest&&!t.ua.hasCORS)return new XDomainRequest;try{if("undefined"!=typeof XMLHttpRequest&&(!o||t.ua.hasCORS))return new XMLHttpRequest}catch(i){}if(!o)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(i){}};var p=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,l=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.parseUri=function(t){for(var e=p.exec(t||""),o={},n=14;n--;)o[l[n]]=e[n]||"";return o},t.qs=function(t){var e="";for(var o in t)t.hasOwnProperty(o)&&(e.length&&(e+="&"),e+=encodeURIComponent(o)+"="+encodeURIComponent(t[o]));return e},t.qsParse=function(t){for(var e={},o=t.split("&"),n=0,i=o.length;i>n;n++){var r=o[n].split("=");e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e}}),t.register("LearnBoost-engine.io-client/lib/transports/index.js",function(t,e){function o(t){var e,o=!1,r=!1;if(c.location){var s="https:"==location.protocol,p=location.port;Number(p)!==p&&(p=s?443:80),o=t.hostname!=location.hostname||p!=t.port,r=t.secure!=s}return e=a.request(o),r&&c.XDomainRequest&&e instanceof c.XDomainRequest?new i(t):e&&!t.forceJSONP?new n(t):new i(t)}var n=e("./polling-xhr"),i=e("./polling-jsonp"),r=e("./websocket"),s=e("./flashsocket"),a=e("../util");t.polling=o,t.websocket=r,t.flashsocket=s;var c=a.global()}),t.register("LearnBoost-engine.io-client/lib/transports/polling.js",function(t,e,o){function n(t){i.call(this,t)}var i=e("../transport"),r=e("../util"),s=e("engine.io-parser"),a=e("debug")("engine.io-client:polling");o.exports=n;var c=r.global();r.inherits(n,i),n.prototype.name="polling",n.prototype.doOpen=function(){this.poll()},n.prototype.pause=function(t){function e(){a("paused"),o.readyState="paused",t()}var o=this;if(this.readyState="pausing",this.polling||!this.writable){var n=0;this.polling&&(a("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){a("pre-pause polling complete"),--n||e()})),this.writable||(a("we are currently writing - waiting to pause"),n++,this.once("drain",function(){a("pre-pause writing complete"),--n||e()}))}else e()},n.prototype.poll=function(){a("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},n.prototype.onData=function(t){var e=this;a("polling got data %s",t),s.decodePayload(t,function(t){return"opening"==e.readyState&&e.onOpen(),"close"==t.type?(e.onClose(),!1):(e.onPacket(t),void 0)}),"closed"!=this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"==this.readyState?this.poll():a('ignoring poll - transport state "%s"',this.readyState))},n.prototype.doClose=function(){a("sending close packet"),this.send([{type:"close"}])},n.prototype.write=function(t){var e=this;this.writable=!1,this.doWrite(s.encodePayload(t),function(){e.writable=!0,e.emit("drain")})},n.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",o="";return(c.ActiveXObject||r.ua.android||r.ua.ios6||this.timestampRequests)&&(t[this.timestampParam]=+new Date),t=r.qs(t),this.port&&("https"==e&&443!=this.port||"http"==e&&80!=this.port)&&(o=":"+this.port),t.length&&(t="?"+t),e+"://"+this.hostname+o+this.path+t}}),t.register("LearnBoost-engine.io-client/lib/transports/polling-xhr.js",function(t,e,o){function n(){}function i(t){if(s.call(this,t),l.location){var e="https:"==location.protocol,o=location.port;Number(o)!==o&&(o=e?443:80),this.xd=t.hostname!=l.location.hostname||o!=t.port}}function r(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.async=!1!==t.async,this.data=void 0!=t.data?t.data:null,this.create()}var s=e("./polling"),a=e("../util"),c=e("../emitter"),p=e("debug")("engine.io-client:polling-xhr");o.exports=i,o.exports.Request=r;var l=a.global(),u=l[["Active"].concat("Object").join("X")];a.inherits(i,s),i.prototype.doOpen=function(){var t=this;a.defer(function(){s.prototype.doOpen.call(t)})},i.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,new r(t)},i.prototype.doWrite=function(t,e){var o=this.request({method:"POST",data:t}),n=this;o.on("success",e),o.on("error",function(t){n.onError("xhr post error",t)}),this.sendXhr=o},i.prototype.doPoll=function(){p("xhr poll");var t=this.request(),e=this;t.on("data",function(t){e.onData(t)}),t.on("error",function(t){e.onError("xhr poll error",t)}),this.pollXhr=t},c(r.prototype),r.prototype.create=function(){var t=this.xhr=a.request(this.xd),e=this;if(t.open(this.method,this.uri,this.async),"POST"==this.method)try{t.setRequestHeader?t.setRequestHeader("Content-type","text/plain;charset=UTF-8"):t.contentType="text/plain"}catch(o){}this.xd&&l.XDomainRequest&&t instanceof XDomainRequest?(t.onerror=function(t){e.onError(t)},t.onload=function(){e.onData(t.responseText)},t.onprogress=n):("withCredentials"in t&&(t.withCredentials=!0),t.onreadystatechange=function(){var o;try{if(4!=t.readyState)return;200==t.status||1223==t.status?o=t.responseText:e.onError(t.status)}catch(n){e.onError(n)}void 0!==o&&e.onData(o)}),p("sending xhr with url %s | data %s",this.uri,this.data),t.send(this.data),u&&(this.index=r.requestsCount++,r.requests[this.index]=this)},r.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},r.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},r.prototype.onError=function(t){this.emit("error",t),this.cleanup()},r.prototype.cleanup=function(){if(void 0!==this.xhr){this.xhr.onreadystatechange=n,this.xhr.onload=this.xhr.onerror=n;try{this.xhr.abort()}catch(t){}u&&delete r.requests[this.index],this.xhr=null}},r.prototype.abort=function(){this.cleanup()},u&&(r.requestsCount=0,r.requests={},l.attachEvent("onunload",function(){for(var t in r.requests)r.requests.hasOwnProperty(t)&&r.requests[t].abort()}))}),t.register("LearnBoost-engine.io-client/lib/transports/polling-jsonp.js",function(t,e,o){function n(t){i.call(this,t),s||(a.___eio||(a.___eio=[]),s=a.___eio),this.index=s.length;var e=this;s.push(function(t){e.onData(t)}),this.query.j=this.index}var i=e("./polling"),r=e("../util");o.exports=n;var s,a=r.global(),c=/\n/g;r.inherits(n,i),n.prototype.doOpen=function(){var t=this;r.defer(function(){i.prototype.doOpen.call(t)})},n.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null),i.prototype.doClose.call(this)},n.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(e,o),this.script=e,r.ua.gecko&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},n.prototype.doWrite=function(t,e){function o(){n(),e()}function n(){if(i.iframe)try{i.form.removeChild(i.iframe)}catch(t){i.onError("jsonp polling iframe removal error",t)}try{var e='<iframe src="javascript:0" name="'+i.iframeId+'">';r=document.createElement(e)}catch(t){r=document.createElement("iframe"),r.name=i.iframeId,r.src="javascript:0"}r.id=i.iframeId,i.form.appendChild(r),i.iframe=r}var i=this;if(!this.form){var r,s=document.createElement("form"),a=document.createElement("textarea"),p=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=p,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}this.form.action=this.uri(),n(),this.area.value=t.replace(c,"\\n");try{this.form.submit()}catch(l){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"==i.iframe.readyState&&o()}:this.iframe.onload=o}}),t.register("LearnBoost-engine.io-client/lib/transports/websocket.js",function(t,e,o){function n(t){r.call(this,t)}function i(){return"undefined"==typeof window?e("ws"):c.WebSocket||c.MozWebSocket}var r=e("../transport"),s=e("engine.io-parser"),a=e("../util");e("debug")("engine.io-client:websocket"),o.exports=n;var c=a.global();a.inherits(n,r),n.prototype.name="websocket",n.prototype.doOpen=function(){if(this.check()){var t=this;this.socket=new(i())(this.uri()),this.socket.onopen=function(){t.onOpen()},this.socket.onclose=function(){t.onClose()},this.socket.onmessage=function(e){t.onData(e.data)},this.socket.onerror=function(e){t.onError("websocket error",e)}}},n.prototype.write=function(t){function e(){o.writable=!0,o.emit("drain")}var o=this;this.writable=!1;for(var n=0,i=t.length;i>n;n++)this.socket.send(s.encodePacket(t[n]));"bufferedAmount"in this.socket?this.bufferedAmountId=setInterval(function(){0==o.socket.bufferedAmount&&(clearInterval(o.bufferedAmountId),e())},50):setTimeout(e,0)},n.prototype.onClose=function(){clearInterval(this.bufferedAmountId),r.prototype.onClose.call(this)},n.prototype.doClose=function(){this.socket!==void 0&&this.socket.close()},n.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",o="";return this.port&&("wss"==e&&443!=this.port||"ws"==e&&80!=this.port)&&(o=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=+new Date),t=a.qs(t),t.length&&(t="?"+t),e+"://"+this.hostname+o+this.path+t},n.prototype.check=function(){var t=i();return!(!t||"__initialize"in t&&this.name===n.prototype.name)}}),t.register("LearnBoost-engine.io-client/lib/transports/flashsocket.js",function(t,e,o){function n(t){s.call(this,t),this.flashPath=t.flashPath,this.policyPort=t.policyPort}function i(t,e){if(u[t])return e();var o=document.createElement("script"),n=!1;c('loading "%s"',t),o.onload=o.onreadystatechange=function(){if(!n&&!u[t]){var i=o.readyState;i&&"loaded"!=i&&"complete"!=i||(c('loaded "%s"',t),o.onload=o.onreadystatechange=null,n=!0,u[t]=!0,e())}},o.async=1,o.src=t;var i=document.getElementsByTagName("head")[0];i.insertBefore(o,i.firstChild)}function r(t,e){function o(n){return t[n]?(i(t[n],function(){o(++n)}),void 0):e()}o(0)}var s=e("./websocket"),a=e("../util"),c=e("debug")("engine.io-client:flashsocket");o.exports=n;var p=a.global(),l=p[["Active"].concat("Object").join("X")];a.inherits(n,s),n.prototype.name="flashsocket",n.prototype.doOpen=function(){function t(t){return function(){var e=Array.prototype.join.call(arguments," ");c("[websocketjs %s] %s",t,e)}}if(this.check()){WEB_SOCKET_LOGGER={log:t("debug"),error:t("error")},WEB_SOCKET_SUPPRESS_CROSS_DOMAIN_SWF_ERROR=!0,WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=!0,"undefined"==typeof WEB_SOCKET_SWF_LOCATION&&(WEB_SOCKET_SWF_LOCATION=this.flashPath+"WebSocketMainInsecure.swf");var e=[this.flashPath+"web_socket.js"];"undefined"==typeof swfobject&&e.unshift(this.flashPath+"swfobject.js");var o=this;r(e,function(){o.ready(function(){WebSocket.__addTask(function(){s.prototype.doOpen.call(o)})})})}},n.prototype.doClose=function(){if(this.socket){var t=this;WebSocket.__addTask(function(){s.prototype.doClose.call(t)})}},n.prototype.write=function(){var t=this,e=arguments;WebSocket.__addTask(function(){s.prototype.write.apply(t,e)})},n.prototype.ready=function(t){function e(){n.loaded||(843!=o.policyPort&&WebSocket.loadFlashPolicyFile("xmlsocket://"+o.host+":"+o.policyPort),WebSocket.__initialize(),n.loaded=!0),t.call(o)}if("undefined"!=typeof WebSocket&&"__initialize"in WebSocket&&swfobject&&!(10>swfobject.getFlashPlayerVersion().major)){var o=this;return document.body?e():(a.load(e),void 0)}},n.prototype.check=function(){if("undefined"==typeof window)return!1;if("undefined"!=typeof WebSocket&&!("__initialize"in WebSocket))return!1;if(l){var t=null;try{t=new l("ShockwaveFlash.ShockwaveFlash")}catch(e){}if(t)return!0}else for(var o=0,n=navigator.plugins.length;n>o;o++)for(var i=0,r=navigator.plugins[o].length;r>i;i++)if("Shockwave Flash"==navigator.plugins[o][i].description)return!0;return!1};var u={}}),t.register("wearefractal-protosock/dist/main.js",function(t,e,o){(function(){var t,n,i,r,s,a;a=e("./util"),t=e("./Client"),i=e("./defaultClient"),s={createClientWrapper:function(t){return function(e){return s.createClient(t,e)}},createClient:function(e,o){var n;return n=a.mergePlugins(i,e),new t(n,o)}},("undefined"==typeof window||null===window)&&(n=e("./Server"),r=e("./defaultServer"),e("http").globalAgent.maxSockets=999,s.createServer=function(t,e,o){var i;return i=a.mergePlugins(r,e),new n(t,i,o)},s.createServerWrapper=function(t){return function(e,o){return s.createServer(e,t,o)}}),o.exports=s}).call(this)}),t.register("wearefractal-protosock/dist/Socket.js",function(t,e,o){(function(){var t;t={write:function(t){var e=this;return this.parent.outbound(this,t,function(t){return e.send(t)}),this},disconnect:function(t){return this.close(t),this}},o.exports=t}).call(this)}),t.register("wearefractal-protosock/dist/util.js",function(t,e,o){(function(){var t,n,i={}.hasOwnProperty,r=function(t,e){function o(){this.constructor=t}for(var n in e)i.call(e,n)&&(t[n]=e[n]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t},s=[].slice;t=e("./Socket"),n={extendSocket:function(e){return r(e.prototype,t)},mergePlugins:function(){var t,e,o,i,r,a,c;for(t=arguments.length>=1?s.call(arguments,0):[],o={},a=0,c=t.length;c>a;a++){i=t[a];for(e in i)r=i[e],o[e]="object"==typeof r&&"server"!==e?n.mergePlugins(o[e],r):r}return o}},o.exports=n}).call(this)}),t.register("wearefractal-protosock/dist/defaultClient.js",function(t,e,o){(function(){var t;t={options:{},start:function(){},inbound:function(t,e,o){var n;try{n=JSON.parse(e)}catch(i){this.error(t,i)}o(n)},outbound:function(t,e,o){var n;try{n=JSON.stringify(e)}catch(i){this.error(t,i)}o(n)},validate:function(t,e,o){return o(!0)},invalid:function(){},connect:function(){},message:function(){},error:function(){},close:function(){}},"undefined"!=typeof window&&null!==window&&(t.options={host:window.location.hostname,port:window.location.port.length>0?parseInt(window.location.port):80,secure:"https:"===window.location.protocol},t.options.secure&&(t.options.port=443)),o.exports=t}).call(this)}),t.register("wearefractal-protosock/dist/Client.js",function(t,e,o){(function(){var t,n,i,r,s,a=function(t,e){return function(){return t.apply(e,arguments)}},c={}.hasOwnProperty,p=function(t,e){function o(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t};s=e("./util"),"undefined"!=typeof window&&null!==window?(i=e("engine.io"),n=e("emitter")):(i=e("engine.io-client"),n=e("events").EventEmitter),s.extendSocket(i.Socket),r=function(t){return t>10?15e3:t>5?5e3:t>3?1e3:1e3},t=function(t){function e(t,e){var o,n,r,s,c,p,l,u,h;null==e&&(e={}),this.reconnect=a(this.reconnect,this),this.handleClose=a(this.handleClose,this),this.handleError=a(this.handleError,this),this.handleMessage=a(this.handleMessage,this),this.handleConnection=a(this.handleConnection,this);for(n in t)r=t[n],this[n]=r;for(n in e)r=e[n],this.options[n]=r;null==(l=(s=this.options).reconnect)&&(s.reconnect=!0),null==(u=(c=this.options).reconnectLimit)&&(c.reconnectLimit=1/0),null==(h=(p=this.options).reconnectTimeout)&&(p.reconnectTimeout=1/0),this.isServer=!1,this.isClient=!0,this.isBrowser="undefined"!=typeof window&&null!==window,o={host:this.options.host,port:this.options.port,secure:this.options.secure,path:"/"+this.options.namespace,resource:this.options.resource,transports:this.options.transports,upgrade:this.options.upgrade,flashPath:this.options.flashPath,policyPort:this.options.policyPort,forceJSONP:this.options.forceJSONP,forceBust:this.options.forceBust,debug:this.options.debug},this.ssocket=new i(o),this.ssocket.parent=this,this.ssocket.once("open",this.handleConnection),this.ssocket.on("error",this.handleError),this.ssocket.on("message",this.handleMessage),this.ssocket.on("close",this.handleClose),this.start()}return p(e,t),e.prototype.disconnect=function(){return this.ssocket.disconnect(),this},e.prototype.destroy=function(){return this.options.reconnect=!1,this.ssocket.disconnect(),this.emit("destroyed"),this},e.prototype.handleConnection=function(){return this.emit("connected"),this.connect(this.ssocket)},e.prototype.handleMessage=function(t){var e=this;return this.emit("inbound",this.ssocket,t),this.inbound(this.ssocket,t,function(t){return e.validate(e.ssocket,t,function(o){return o?(e.emit("message",e.ssocket,t),e.message(e.ssocket,t)):(e.emit("invalid",e.ssocket,t),e.invalid(e.ssocket,t))
})})},e.prototype.handleError=function(t){return"string"==typeof t&&(t=Error(t)),this.error(this.ssocket,t)},e.prototype.handleClose=function(t){var e=this;if(!this.ssocket.reconnecting)return this.options.reconnect?this.reconnect(function(o){return null!=o?(e.emit("close",e.ssocket,t),e.close(e.ssocket,t)):void 0}):(this.emit("close",this.ssocket,t),this.close(this.ssocket,t))},e.prototype.reconnect=function(t){var e,o,n,i,s,a,c,p=this;return this.ssocket.reconnecting?t("Already reconnecting"):(this.ssocket.reconnecting=!0,"open"===this.ssocket.readyState&&this.ssocket.disconnect(),a=Date.now(),s=this.options.reconnectLimit,c=this.options.reconnectTimeout,e=0,n=function(){return p.ssocket.reconnecting=!1,p.emit("reconnected"),t()},i=function(e){return p.ssocket.reconnecting=!1,t(e)},this.ssocket.once("open",n),o=function(){return p.ssocket.reconnecting?e>=s?i("Exceeded max attempts"):Date.now()-a>c?i("Timeout on reconnect"):(e++,p.ssocket.open(),setTimeout(o,r(e))):void 0},setTimeout(o,r(e)))},e}(n),o.exports=t}).call(this)}),t.register("vein/dist/main.js",function(t,e,o){(function(){var t,n,i;t=e("protosock"),n=e("./Client"),o.exports={createClient:t.createClientWrapper(n)},("undefined"==typeof window||null===window)&&(i=e("./Server"),o.exports.createServer=t.createServerWrapper(i))}).call(this)}),t.register("vein/dist/Client.js",function(t,e,o){(function(){var t,e,n,i=[].slice;n=function(){var t;return t=function(){return(0|268435456*(1+Math.random())).toString(16)},t()+t()+t()},t=function(){function t(t,e){this._socket=t,this._name=e,this._services=[],this._callbacks={}}return t.prototype.add=function(t){var e,o,n;for(o=0,n=t.length;n>o;o++)e=t[o],this._services=t,this[e]=this._getSender(e);return this},t.prototype._getSender=function(t){var e=this;return function(){var o,r,s,a;return o=arguments.length>=2?i.call(arguments,0,a=arguments.length-1):(a=0,[]),r=arguments[a++],s=n(),"function"==typeof r?e._callbacks[s]=r:o.push(r),e._socket.write({type:"request",id:s,ns:e._name,service:t,args:o})}},t}(),e={options:{namespace:"Vein",resource:"default"},start:function(){return this.namespaces={}},ready:function(t){return this.synced?t(this.ns("main")._services,this.namespaces):this.once("ready",t)},ns:function(t){return this.namespaces[t]},validate:function(t,e,o){if("object"!=typeof e)return o(!1);if("string"!=typeof e.type)return o(!1);if("response"===e.type){if("string"!=typeof e.id)return o(!1);if("string"!=typeof e.ns)return o(!1);if(null==this.ns(e.ns))return o(!1);if("string"!=typeof e.service)return o(!1);if("function"!=typeof this.ns(e.ns)._callbacks[e.id])return o(!1);if(!Array.isArray(e.args))return o(!1)}else{if("services"!==e.type)return o(!1);if("object"!=typeof e.args)return o(!1)}return o(!0)},error:function(t,e){return this.emit("error",e,t)},message:function(e,o){var n,i,r,s,a,c,p;if("response"===o.type)return(a=this.ns(o.ns)._callbacks)[o.id].apply(a,o.args),delete this.ns(o.ns)._callbacks[o.id];if("services"===o.type){c=o.args;for(n in c)i=c[n],this.namespaces[n]?this.namespaces[n].add(i):(this.namespaces[n]=new t(e,n),this.namespaces[n].add(i));for(p=o.args.main,r=0,s=p.length;s>r;r++)n=p[r],this[n]=this.ns("main")[n];return this.synced=!0,this.emit("ready",this.ns("main")._services,this.namespaces)}}},o.exports=e}).call(this)}),t.register("vein/dist/Namespace.js",function(t,e,o){(function(){var t,n,i,r,s,a,c;a=e("fs").readdirSync,c=e("path"),s=c.join,i=c.basename,r=c.extname,n=e("async"),t=function(){function t(t){this._name=t,this._services={},this._stack=[]}return t.prototype.add=function(t,e){return this._services[t]=e,this},t.prototype.remove=function(t){return delete this._services[t],this},t.prototype.addFolder=function(t){var o,n,c,p,l,u,h;for(h=a(t),l=0,u=h.length;u>l;l++)n=h[l],o=r(n),p=i(n,o),null!=e.extensions[o]&&(c=e(s(t,n)),this.add(p,c));return this},t.prototype.use=function(t){return this._stack.push(t),this},t.prototype._middle=function(t,e,o){var i;return 0===this._stack.length?o():(i=function(o,n){return o(t,e,n)},n.forEachSeries(this._stack,i,o),void 0)},t}(),o.exports=t}).call(this)}),t.alias("wearefractal-protosock/dist/main.js","vein/deps/protosock/dist/main.js"),t.alias("wearefractal-protosock/dist/Socket.js","vein/deps/protosock/dist/Socket.js"),t.alias("wearefractal-protosock/dist/util.js","vein/deps/protosock/dist/util.js"),t.alias("wearefractal-protosock/dist/defaultClient.js","vein/deps/protosock/dist/defaultClient.js"),t.alias("wearefractal-protosock/dist/Client.js","vein/deps/protosock/dist/Client.js"),t.alias("wearefractal-protosock/dist/main.js","vein/deps/protosock/index.js"),t.alias("component-emitter/index.js","wearefractal-protosock/deps/emitter/index.js"),t.alias("component-indexof/index.js","component-emitter/deps/indexof/index.js"),t.alias("LearnBoost-engine.io-client/lib/index.js","wearefractal-protosock/deps/engine.io/lib/index.js"),t.alias("LearnBoost-engine.io-client/lib/socket.js","wearefractal-protosock/deps/engine.io/lib/socket.js"),t.alias("LearnBoost-engine.io-client/lib/transport.js","wearefractal-protosock/deps/engine.io/lib/transport.js"),t.alias("LearnBoost-engine.io-client/lib/emitter.js","wearefractal-protosock/deps/engine.io/lib/emitter.js"),t.alias("LearnBoost-engine.io-client/lib/util.js","wearefractal-protosock/deps/engine.io/lib/util.js"),t.alias("LearnBoost-engine.io-client/lib/transports/index.js","wearefractal-protosock/deps/engine.io/lib/transports/index.js"),t.alias("LearnBoost-engine.io-client/lib/transports/polling.js","wearefractal-protosock/deps/engine.io/lib/transports/polling.js"),t.alias("LearnBoost-engine.io-client/lib/transports/polling-xhr.js","wearefractal-protosock/deps/engine.io/lib/transports/polling-xhr.js"),t.alias("LearnBoost-engine.io-client/lib/transports/polling-jsonp.js","wearefractal-protosock/deps/engine.io/lib/transports/polling-jsonp.js"),t.alias("LearnBoost-engine.io-client/lib/transports/websocket.js","wearefractal-protosock/deps/engine.io/lib/transports/websocket.js"),t.alias("LearnBoost-engine.io-client/lib/transports/flashsocket.js","wearefractal-protosock/deps/engine.io/lib/transports/flashsocket.js"),t.alias("LearnBoost-engine.io-client/lib/index.js","wearefractal-protosock/deps/engine.io/index.js"),t.alias("component-emitter/index.js","LearnBoost-engine.io-client/deps/emitter/index.js"),t.alias("component-indexof/index.js","component-emitter/deps/indexof/index.js"),t.alias("LearnBoost-engine.io-protocol/lib/index.js","LearnBoost-engine.io-client/deps/engine.io-parser/lib/index.js"),t.alias("LearnBoost-engine.io-protocol/lib/keys.js","LearnBoost-engine.io-client/deps/engine.io-parser/lib/keys.js"),t.alias("LearnBoost-engine.io-protocol/lib/index.js","LearnBoost-engine.io-client/deps/engine.io-parser/index.js"),t.alias("LearnBoost-engine.io-protocol/lib/index.js","LearnBoost-engine.io-protocol/index.js"),t.alias("visionmedia-debug/index.js","LearnBoost-engine.io-client/deps/debug/index.js"),t.alias("visionmedia-debug/debug.js","LearnBoost-engine.io-client/deps/debug/debug.js"),t.alias("LearnBoost-engine.io-client/lib/index.js","LearnBoost-engine.io-client/index.js"),t.alias("wearefractal-protosock/dist/main.js","wearefractal-protosock/index.js"),t.alias("vein/dist/main.js","vein/index.js"),"object"==typeof exports?module.exports=t("vein"):"function"==typeof define&&define.amd?define(function(){return t("vein")}):window.Vein=t("vein")})();