-
Notifications
You must be signed in to change notification settings - Fork 0
/
warlock.min.js
1 lines (1 loc) · 30.2 KB
/
warlock.min.js
1
(function(){function t(){return t}function n(t,r){var i=n.resolve(t),s=n.modules[i];if(!s)throw Error('failed to require "'+t+'" from '+r);return s.exports||(s.exports={},s.call(s.exports,s,s.exports,n.relative(i),e)),s.exports}var e=this;n.modules={},n.resolve=function(e){var t=e,r=e+".js",i=e+"/index.js";return n.modules[r]&&r||n.modules[i]&&i||t},n.register=function(e,t){n.modules[e]=t},n.relative=function(e){return function(r){if("debug"==r)return t;if("."!=r.charAt(0))return n(r);var i=e.split("/"),s=r.split("/");i.pop();for(var o=0;o<s.length;o++){var u=s[o];".."==u?i.pop():"."!=u&&i.push(u)}return n(i.join("/"),e)}},n.register("node_modules/engine.io-client/lib/engine.io-client.js",function(e,t,n,r){t.version="0.3.10",t.protocol=1,t.util=n("./util"),t.parser=n("./parser"),t.Socket=n("./socket"),t.EventEmitter=n("./event-emitter"),t.Transport=n("./transport"),t.transports=n("./transports")}),n.register("node_modules/engine.io-client/lib/event-emitter.js",function(e,t,n,r){function i(){}function s(e){return"[object Array]"==Object.prototype.toString.call(e)}e.exports=i,i.prototype.on=function(e,t){return this.$events||(this.$events={}),this.$events[e]?s(this.$events[e])?this.$events[e].push(t):this.$events[e]=[this.$events[e],t]:this.$events[e]=t,this},i.prototype.addListener=i.prototype.on,i.prototype.once=function(e,t){function r(){n.removeListener(e,r),t.apply(this,arguments)}var n=this;return r.listener=t,this.on(e,r),this},i.prototype.removeListener=function(e,t){if(this.$events&&this.$events[e]){var n=this.$events[e];if(s(n)){var r=-1;for(var i=0,o=n.length;i<o;i++)if(n[i]===t||n[i].listener&&n[i].listener===t){r=i;break}if(r<0)return this;n.splice(r,1),n.length||delete this.$events[e]}else(n===t||n.listener&&n.listener===t)&&delete this.$events[e]}return this},i.prototype.removeAllListeners=function(e){return e===undefined?(this.$events={},this):(this.$events&&this.$events[e]&&(this.$events[e]=null),this)},i.prototype.listeners=function(e){return this.$events||(this.$events={}),this.$events[e]||(this.$events[e]=[]),s(this.$events[e])||(this.$events[e]=[this.$events[e]]),this.$events[e]},i.prototype.emit=function(e){if(!this.$events)return!1;var t=this.$events[e];if(!t)return!1;var n=Array.prototype.slice.call(arguments,1);if("function"==typeof t)t.apply(this,n);else{if(!s(t))return!1;var r=t.slice();for(var i=0,o=r.length;i<o;i++)r[i].apply(this,n)}return!0},i.prototype.addEventListener=i.prototype.on,i.prototype.removeEventListener=i.prototype.removeListener,i.prototype.dispatchEvent=i.prototype.emit}),n.register("node_modules/engine.io-client/lib/parser.js",function(e,t,n,r){var i=n("./util"),s=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},o=i.keys(s),u={type:"error",data:"parser error"};t.encodePacket=function(e){var t=s[e.type];return undefined!==e.data&&(t+=e.data+""),""+t},t.decodePacket=function(e){var t=e.charAt(0);return Number(t)!=t||!o[t]?u:e.length>1?{type:o[t],data:e.substring(1)}:{type:o[t]}},t.encodePayload=function(e){if(!e.length)return"0:";var n="",r;for(var i=0,s=e.length;i<s;i++)r=t.encodePacket(e[i]),n+=r.length+":"+r;return n},t.decodePayload=function(e){if(e=="")return[u];var n=[],r="",i,s,o;for(var a=0,f=e.length;a<f;a++){var l=e.charAt(a);if(":"!=l)r+=l;else{if(""==r||r!=(i=Number(r)))return[u];s=e.substr(a+1,i);if(r!=s.length)return[u];if(s.length){o=t.decodePacket(s);if(u.type==o.type&&u.data==o.data)return[u];n.push(o)}a+=i,r=""}}return r!=""?[u]:n}}),n.register("node_modules/engine.io-client/lib/socket.js",function(e,t,n,r){function a(e){if("string"==typeof e){var t=i.parseUri(e);e=arguments[1]||{},e.host=t.host,e.secure=t.protocol=="https"||t.protocol=="wss",e.port=t.port}e=e||{},this.secure=null!=e.secure?e.secure:r.location&&"https:"==location.protocol,this.host=e.host||e.hostname||(r.location?location.hostname:"localhost"),this.port=e.port||(r.location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},this.query.uid=l(),this.upgrade=!1!==e.upgrade,this.resource=e.resource||"default",this.path=(e.path||"/engine.io").replace(/\/$/,""),this.path+="/"+this.resource+"/",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.policyPort=e.policyPort||843,this.open(),a.sockets.push(this),a.sockets.evs.emit("add",this)}function f(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function l(){return(Math.random()+"").substr(5)+(Math.random()+"").substr(5)}var i=n("./util"),s=n("./transports"),o=n("debug")("engine-client:socket"),u=n("./event-emitter");e.exports=a,i.inherits(a,u),a.sockets=[],a.sockets.evs=new u,a.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=f(this.query);t.transport=e,this.id&&(t.sid=this.id);var n=new s[e]({host:this.host,port:this.port,secure:this.secure,path:this.path,query:t,forceJSONP:this.forceJSONP,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,flashPath:this.flashPath,policyPort:this.policyPort});return n},a.prototype.open=function(){this.readyState="opening";var e=this.createTransport(this.transports[0]);e.open(),this.setTransport(e)},a.prototype.setTransport=function(e){var t=this;this.transport&&(o("clearing existing transport"),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.flush()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},a.prototype.probe=function(e){function i(i){if(n)return;n=!0;var s=Error("probe error: "+i);s.transport=t.name,t.close(),t=null,o('probe transport "%s" failed because of error: %s',e,i),r.emit("error",s)}o('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,r=this;t.once("open",function(){if(n)return;o('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(s){if(n)return;if("pong"==s.type&&"probe"==s.data)o('probe transport "%s" pong',e),r.upgrading=!0,r.emit("upgrading",t),o('pausing current transport "%s"',r.transport.name),r.transport.pause(function(){if(n)return;if("closed"==r.readyState||"closing"==r.readyState)return;o("changing transport and sending upgrade packet"),t.removeListener("error",i),r.emit("upgrade",t),r.setTransport(t),t.send([{type:"upgrade"}]),t=null,r.upgrading=!1,r.flush()});else{o('probe transport "%s" failed',e);var u=Error("probe error");u.transport=t.name,r.emit("error",u)}})}),t.once("error",i),t.open(),this.once("close",function(){t&&(o("socket closed prematurely - aborting probe"),n=!0,t.close(),t=null)}),this.once("upgrading",function(e){t&&e.name!=t.name&&(o('"%s" works - aborting "%s"',e.name,t.name),t.close(),t=null)})},a.prototype.onOpen=function(){o("socket open"),this.readyState="open",this.emit("open"),this.onopen&&this.onopen.call(this),this.flush();if("open"==this.readyState&&this.upgrade&&this.transport.pause){o("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},a.prototype.onPacket=function(e){if("opening"==this.readyState||"open"==this.readyState){o('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat");switch(e.type){case"open":this.onHandshake(i.parseJSON(e.data));break;case"pong":this.ping();break;case"error":var t=Error("server error");t.code=e.data,this.emit("error",t);break;case"message":this.emit("message",e.data);var n={data:e.data};n.toString=function(){return e.data},this.onmessage&&this.onmessage.call(this,n)}}else o('packet received with socket readyState "%s"',this.readyState)},a.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=e.upgrades,this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),this.ping(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat)},a.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout(function(){if("closed"==t.readyState)return;t.onClose("ping timeout")},e||t.pingInterval+t.pingTimeout)},a.prototype.ping=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout(function(){o("writing ping packet - expecting pong within %sms",e.pingTimeout),e.sendPacket("ping"),e.onHeartbeat(e.pingTimeout)},e.pingInterval)},a.prototype.flush=function(){"closed"!=this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(o("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.writeBuffer=[])},a.prototype.write=a.prototype.send=function(e){return this.sendPacket("message",e),this},a.prototype.sendPacket=function(e,t){var n={type:e,data:t};this.emit("packetCreate",n),this.writeBuffer.push(n),this.flush()},a.prototype.close=function(){if("opening"==this.readyState||"open"==this.readyState)this.onClose("forced close"),o("socket closing - telling transport to close"),this.transport.close(),this.transport.removeAllListeners();return this},a.prototype.onError=function(e){this.emit("error",e),this.onClose("transport error",e)},a.prototype.onClose=function(e,t){"closed"!=this.readyState&&(o('socket close with reason: "%s"',e),clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.readyState="closed",this.emit("close",e,t),this.onclose&&this.onclose.call(this),this.id=null)}}),n.register("node_modules/engine.io-client/lib/transport.js",function(e,t,n,r){function u(e){this.path=e.path,this.host=e.host,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState=""}var i=n("./util"),s=n("./parser"),o=n("./event-emitter");e.exports=u,i.inherits(u,o),u.prototype.onError=function(e,t){var n=Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},u.prototype.open=function(){if("closed"==this.readyState||""==this.readyState)this.readyState="opening",this.doOpen();return this},u.prototype.close=function(){if("opening"==this.readyState||"open"==this.readyState)this.doClose(),this.onClose();return this},u.prototype.send=function(e){if("open"!=this.readyState)throw Error("Transport not open");this.write(e)},u.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},u.prototype.onData=function(e){this.onPacket(s.decodePacket(e))},u.prototype.onPacket=function(e){this.emit("packet",e)},u.prototype.onClose=function(){this.readyState="closed",this.emit("close")}}),n.register("node_modules/engine.io-client/lib/transports/flashsocket.js",function(e,t,n,r){function u(e){i.call(this,e),this.flashPath=e.flashPath,this.policyPort=e.policyPort}function f(e,t){if(a[e])return t();var n=document.createElement("script"),r=!1;n.onload=n.onreadystatechange=function(){if(r||a[e])return;var i=n.readyState;if(!i||"loaded"==i||"complete"==i)n.onload=n.onreadystatechange=null,r=!0,a[e]=!0,t()},n.async=1,n.src=e;var i=document.getElementsByTagName("head")[0];i.insertBefore(n,i.firstChild)}function l(e,t){function n(r){if(!e[r])return t();f(e[r],function(){n(++r)})}n(0)}var i=n("./websocket"),s=n("../util");e.exports=u;var o=r[["Active"].concat("Object").join("X")];s.inherits(u,i),u.prototype.name="flashsocket",u.prototype.doOpen=function(){function e(e){return function(){var e=Array.prototype.join.call(arguments," ")}}if(!this.check())return;WEB_SOCKET_LOGGER={log:e("debug"),error:e("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 t=[this.flashPath+"web_socket.js"];"undefined"==typeof swfobject&&t.unshift(this.flashPath+"swfobject.js");var n=this;l(t,function(){n.ready(function(){WebSocket.__addTask(function(){i.prototype.doOpen.call(n)})})})},u.prototype.doClose=function(){if(!this.socket)return;var e=this;WebSocket.__addTask(function(){i.prototype.doClose.call(e)})},u.prototype.write=function(){var e=this,t=arguments;WebSocket.__addTask(function(){i.prototype.write.apply(e,t)})},u.prototype.ready=function(e){function t(){u.loaded||(843!=n.policyPort&&WebSocket.loadFlashPolicyFile("xmlsocket://"+n.host+":"+n.policyPort),WebSocket.__initialize(),u.loaded=!0),e.call(n)}if(!(typeof WebSocket!="undefined"&&"__initialize"in WebSocket)||!swfobject)return;if(swfobject.getFlashPlayerVersion().major<10)return;var n=this;if(document.body)return t();s.load(t)},u.prototype.check=function(){if(typeof WebSocket=="undefined"||"__initialize"in WebSocket){if(o){var e=null;try{e=new o("ShockwaveFlash.ShockwaveFlash")}catch(t){}if(e)return!0}else for(var n=0,r=navigator.plugins.length;n<r;n++)for(var i=0,s=navigator.plugins[n].length;i<s;i++)if(navigator.plugins[n][i].description=="Shockwave Flash")return!0;return!1}return!1};var a={}}),n.register("node_modules/engine.io-client/lib/transports/index.js",function(e,t,n,r){function f(e){var t,n=!1,o=!1;if(r.location){var u="https:"==location.protocol,f=location.port;Number(f)!=f&&(f=u?443:80),n=e.host!=location.hostname||f!=e.port,o=e.secure!=u}return t=a.request(n),o&&r.XDomainRequest&&t instanceof r.XDomainRequest?new s(e):t&&!e.forceJSONP?new i(e):new s(e)}var i=n("./polling-xhr"),s=n("./polling-jsonp"),o=n("./websocket"),u=n("./flashsocket"),a=n("../util");t.polling=f,t.websocket=o,t.flashsocket=u}),n.register("node_modules/engine.io-client/lib/transports/polling-jsonp.js",function(e,t,n,r){function f(){}function l(e){i.call(this,e),u||(r.___eio||(r.___eio=[]),u=r.___eio),this.index=u.length;var t=this;u.push(function(e){t.onData(e)}),this.query.j=this.index}var i=n("./polling"),s=n("../util");e.exports=l;var o=/\n/g,u,a=0;s.inherits(l,i),l.prototype.doOpen=function(){var e=this;s.defer(function(){i.prototype.doOpen.call(e)})},l.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)},l.prototype.doPoll=function(){var e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri();var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t),this.script=e,s.ua.gecko&&setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)},100)},l.prototype.doWrite=function(e,t){function a(){f(),t()}function f(){n.iframe&&n.form.removeChild(n.iframe);try{u=document.createElement('<iframe name="'+n.iframeId+'">')}catch(e){u=document.createElement("iframe"),u.name=n.iframeId}u.id=n.iframeId,n.form.appendChild(u),n.iframe=u}var n=this;if(!this.form){var r=document.createElement("form"),i=document.createElement("textarea"),s=this.iframeId="eio_iframe_"+this.index,u;r.className="socketio",r.style.position="absolute",r.style.top="-1000px",r.style.left="-1000px",r.target=s,r.method="POST",r.setAttribute("accept-charset","utf-8"),i.name="d",r.appendChild(i),document.body.appendChild(r),this.form=r,this.area=i}this.form.action=this.uri(),f(),this.area.value=e.replace(o,"\\n");try{this.form.submit()}catch(l){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){n.iframe.readyState=="complete"&&a()}:this.iframe.onload=a}}),n.register("node_modules/engine.io-client/lib/transports/polling-xhr.js",function(e,t,n,r){function a(){}function f(e){i.call(this,e),r.location&&(this.xd=e.host!=r.location.hostname||r.location.port!=e.port)}function l(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.async=!1!==e.async,this.data=undefined!=e.data?e.data:null,this.create()}var i=n("./polling"),s=n("../event-emitter"),o=n("../util");e.exports=f,e.exports.Request=l;var u=r[["Active"].concat("Object").join("X")];o.inherits(f,i),f.prototype.doOpen=function(){var e=this;o.defer(function(){i.prototype.doOpen.call(e)})},f.prototype.request=function(e){return e=e||{},e.uri=this.uri(),e.xd=this.xd,new l(e)},f.prototype.doWrite=function(e,t){var n=this.request({method:"POST",data:e}),r=this;n.on("success",t),n.on("error",function(e){r.onError("xhr post error",e)}),this.sendXhr=n},f.prototype.doPoll=function(){var e=this.request(),t=this;e.on("data",function(e){t.onData(e)}),e.on("error",function(e){t.onError("xhr poll error",e)}),this.pollXhr=e},o.inherits(l,s),l.prototype.create=function(){var e=this.xhr=o.request(this.xd),t=this;e.open(this.method,this.uri,this.async);if("POST"==this.method)try{e.setRequestHeader?e.setRequestHeader("Content-type","text/plain;charset=UTF-8"):e.contentType="text/plain"}catch(n){}this.xd&&r.XDomainRequest&&e instanceof XDomainRequest?(e.onerror=function(e){t.onError(e)},e.onload=function(){t.onData(e.responseText)},e.onprogress=a):("withCredentials"in e&&(e.withCredentials=!0),e.onreadystatechange=function(){var n;try{if(4!=e.readyState)return;200==e.status||1223==e.status?n=e.responseText:t.onError(e.status)}catch(r){t.onError(r)}undefined!==n&&t.onData(n)}),e.send(this.data),u&&(this.index=l.requestsCount++,l.requests[this.index]=this)},l.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},l.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},l.prototype.onError=function(e){this.emit("error",e),this.cleanup()},l.prototype.cleanup=function(){this.xhr.onreadystatechange=a,this.xhr.onload=this.xhr.onerror=a;try{this.xhr.abort()}catch(e){}u&&delete l.requests[this.index],this.xhr=null},l.prototype.abort=function(){this.cleanup()},u&&(l.requestsCount=0,l.requests={},r.attachEvent("onunload",function(){for(var e in l.requests)l.requests.hasOwnProperty(e)&&l.requests[e].abort()}))}),n.register("node_modules/engine.io-client/lib/transports/polling.js",function(e,t,n,r){function u(e){i.call(this,e)}var i=n("../transport"),s=n("../util"),o=n("../parser");e.exports=u,s.inherits(u,i),u.prototype.name="polling",u.prototype.doOpen=function(){this.poll()},u.prototype.pause=function(e){function r(){n.readyState="paused",e()}var t=0,n=this;this.readyState="pausing";if(this.polling||!this.writable){var i=0;this.polling&&(i++,this.once("pollComplete",function(){--i||r()})),this.writable||(i++,this.once("drain",function(){--i||r()}))}else r()},u.prototype.poll=function(){this.polling=!0,this.doPoll(),this.emit("poll")},u.prototype.onData=function(e){var t=o.decodePayload(e);for(var n=0,r=t.length;n<r;n++){"opening"==this.readyState&&this.onOpen();if("close"==t[n].type){this.onClose();return}this.onPacket(t[n])}this.polling=!1,this.emit("pollComplete"),"open"==this.readyState&&this.poll()},u.prototype.doClose=function(){this.send([{type:"close"}])},u.prototype.write=function(e){var t=this;this.writable=!1,this.doWrite(o.encodePayload(e),function(){t.writable=!0,t.emit("drain")})},u.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";if(r.ActiveXObject||s.ua.android||s.ua.ios6||this.timestampRequests)e[this.timestampParam]=+(new Date);return e=s.qs(e),this.port&&("https"==t&&this.port!=443||"http"==t&&this.port!=80)&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+this.host+n+this.path+e}}),n.register("node_modules/engine.io-client/lib/transports/websocket.js",function(e,t,n,r){function u(e){i.call(this,e)}function a(){return r.WebSocket||r.MozWebSocket}var i=n("../transport"),s=n("../parser"),o=n("../util");e.exports=u,o.inherits(u,i),u.prototype.name="websocket",u.prototype.doOpen=function(){if(!this.check())return;var e=this;this.socket=new(a())(this.uri()),this.socket.onopen=function(){e.onOpen()},this.socket.onclose=function(){e.onClose()},this.socket.onmessage=function(t){e.onData(t.data)},this.socket.onerror=function(t){e.onError("websocket error",t)}},u.prototype.write=function(e){for(var t=0,n=e.length;t<n;t++)this.socket.send(s.encodePacket(e[t]))},u.prototype.doClose=function(){typeof this.socket!="undefined"&&this.socket.close()},u.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",n="";return this.port&&("wss"==t&&this.port!=443||"ws"==t&&this.port!=80)&&(n=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=+(new Date)),e=o.qs(e),e.length&&(e="?"+e),t+"://"+this.host+n+this.path+e},u.prototype.check=function(){var e=a();return!!e&&!("__initialize"in e&&this.name===u.prototype.name)}}),n.register("node_modules/engine.io-client/lib/util.js",function(e,t,n,r){var i=!1;t.inherits=function(t,n){function r(){}r.prototype=n.prototype,t.prototype=new r},t.keys=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var r in e)n.call(e,r)&&t.push(r);return t},t.on=function(e,t,n,r){e.attachEvent?e.attachEvent("on"+t,n):e.addEventListener&&e.addEventListener(t,n,r)},t.load=function(e){if(r.document&&document.readyState==="complete"||i)return e();t.on(r,"load",e,!1)},"undefined"!=typeof window&&t.load(function(){i=!0}),t.defer=function(e){if(!t.ua.webkit||"undefined"!=typeof importScripts)return e();t.load(function(){setTimeout(e,100)})};var s=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,u=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,a=/(?:^|:|,)(?:\s*\[)+/g,f=/^\s+/,l=/\s+$/;t.parseJSON=function(e){if("string"!=typeof e||!e)return null;e=e.replace(f,"").replace(l,"");if(r.JSON&&JSON.parse)return JSON.parse(e);if(s.test(e.replace(o,"@").replace(u,"]").replace(a,"")))return Function("return "+e)()},t.ua={},t.ua.hasCORS="undefined"!=typeof XMLHttpRequest&&function(){try{var e=new XMLHttpRequest}catch(t){return!1}return e.withCredentials!=undefined}(),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(n){if(n&&"undefined"!=typeof XDomainRequest&&!t.ua.hasCORS)return new XDomainRequest;try{if("undefined"!=typeof XMLHttpRequest&&(!n||t.ua.hasCORS))return new XMLHttpRequest}catch(r){}if(!n)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(r){}};var c=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,h=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.parseUri=function(e){var t=c.exec(e||""),n={},r=14;while(r--)n[h[r]]=t[r]||"";return n},t.qs=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=n+"="+encodeURIComponent(e[n]));return t}}),n.register("Client.js",function(e,t,n,r){(function(){var t,r,i,s,o,u,a=function(e,t){return function(){return e.apply(t,arguments)}},f={}.hasOwnProperty,l=function(e,t){function r(){this.constructor=e}for(var n in t)f.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};u=n("./util"),o=u.isBrowser(),o?(i=n("node_modules/engine.io-client/lib/engine.io-client"),r=i.EventEmitter):(i=n("engine.io-client"),r=n("events").EventEmitter),u.extendSocket(i.Socket),s=function(e){return e>10?15e3:e>5?5e3:e>3?1e3:1e3},t=function(e){function t(e,t){var n,r,s,u,f,l,c;t==null&&(t={}),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(r in e)s=e[r],this[r]=s;for(r in t)s=t[r],this.options[r]=s;(l=(u=this.options).reconnect)==null&&(u.reconnect=!0),(c=(f=this.options).reconnectLimit)==null&&(f.reconnectLimit=Infinity),this.isServer=!1,this.isClient=!0,this.isBrowser=o,n={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.Socket(n),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}return l(t,e),t.prototype.disconnect=function(){return this.ssocket.disconnect(),this},t.prototype.handleConnection=function(){return this.emit("connected"),this.connect(this.ssocket)},t.prototype.handleMessage=function(e){var t=this;return this.emit("inbound",this.ssocket,e),this.inbound(this.ssocket,e,function(e){return t.validate(t.ssocket,e,function(n){return n?(t.emit("message",t.ssocket,e),t.message(t.ssocket,e)):(t.emit("invalid",t.ssocket,e),t.invalid(t.ssocket,e))})})},t.prototype.handleError=function(e){return typeof e=="string"&&(e=Error(e)),this.error(this.ssocket,e)},t.prototype.handleClose=function(e){var t=this;if(this.ssocket.reconnecting)return;return this.options.reconnect?this.reconnect(function(n){if(n==null)return;return t.emit("close",t.ssocket,e),t.close(t.ssocket,e)}):(this.emit("close",this.ssocket,e),this.close(this.ssocket,e))},t.prototype.reconnect=function(e){var t,n,r,i,o,u=this;return this.ssocket.reconnecting?e("Already reconnecting"):(this.ssocket.reconnecting=!0,this.ssocket.readyState==="open"&&this.ssocket.disconnect(),o=this.options.reconnectLimit,t=0,r=function(){return u.ssocket.reconnecting=!1,e()},i=function(t){return u.ssocket.reconnecting=!1,e(t)},this.ssocket.once("open",r),n=function(){if(!u.ssocket.reconnecting)return;return t<o?(t++,u.ssocket.open(),setTimeout(n,s(t))):i("Exceeded max attempts")},setTimeout(n,s(t)))},t}(r),e.exports=t}).call(this)}),n.register("defaultClient.js",function(e,t,n,r){(function(){var t;t={options:{},start:function(){},inbound:function(e,t,n){var r;try{r=JSON.parse(t)}catch(i){this.error(e,i)}return n(r),n},outbound:function(e,t,n){var r;try{r=JSON.stringify(t)}catch(i){this.error(e,i)}n(r)},validate:function(e,t,n){return n(!0)},invalid:function(){},connect:function(){},message:function(){},error:function(){},close:function(){}},t.options={host:window.location.hostname,port:window.location.port.length>0?parseInt(window.location.port):80,secure:window.location.protocol==="https:"},t.options.secure&&(t.options.port=443),e.exports=t}).call(this)}),n.register("main.js",function(e,t,n,r){(function(){var e,t;t=n("./util"),e={createClientWrapper:function(t){return function(n){return e.createClient(t,n)}},createClient:function(e,r){var i,s,o;return i=n("./Client"),s=n("./defaultClient"),o=t.mergePlugins(s,e),new i(o,r)}},window.ProtoSock=e}).call(this)}),n.register("Socket.js",function(e,t,n,r){(function(){e.exports={write:function(e){var t=this;return this.parent.outbound(this,e,function(e){return t.send(e)}),this},disconnect:function(e){return this.close(e),this}}}).call(this)}),n.register("util.js",function(e,t,n,r){(function(){var t,r={}.hasOwnProperty,i=function(e,t){function i(){this.constructor=e}for(var n in t)r.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype,e},s=[].slice;e.exports=t={extendSocket:function(e){var t;return t=n("./Socket"),i(e.prototype,t)},mergePlugins:function(){var e,n,r,i,o,u,a;e=1>arguments.length?[]:s.call(arguments,0),r={};for(u=0,a=e.length;u<a;u++){i=e[u];for(n in i)o=i[n],typeof o=="object"&&n!=="server"?r[n]=t.mergePlugins(r[n],o):r[n]=o}return r},isBrowser:function(){return!0}}}).call(this)}),main=n("main")})(),function(){var e,t,n,r,i=this,s={}.hasOwnProperty,o=function(e,t){return function(){return e.apply(t,arguments)}};r=typeof window!="undefined",n=function(){var e;return e=function(){return((1+Math.random())*268435456|0).toString(16)},e()+e()+e()},t=function(e){var t,n,r,i;if(typeof e=="object"){if(e.length!=null)return function(){var n,r,i;i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(t);return i}();r={};for(n in e){if(!s.call(e,n))continue;i=e[n],r[n]=i}return r}return e},e=function(){function e(e,t){this.fn=e,this.parent=t,this.doTrans=o(this.doTrans,this),this.run=o(this.run,this),this.log={},this.root={},this.id=n()}return e.prototype.run=function(e){var t=this;return this.parent.ready(function(){return t.doTrans(e)})},e.prototype.doTrans=function(e){var n,r=this;this.root=t(this.parent.root),n={get:function(e){return t(r.root[e])},set:function(e,t){var i,s;return(s=(i=r.log)[e])==null&&(i[e]={current:n.get(e)}),r.log[e].value=t,r.root[e]=t,n},"delete":function(e){return n.set(e)},incr:function(e,t){return t==null&&(t=1),n.set(e,n.get(e)+t)},decr:function(e,t){return t==null&&(t=1),n.set(e,n.get(e)-t)},push:function(e,t){var r;return r=n.get(e),r.push(t),n.set(e,r)},unshift:function(e,t){var r;return r=n.get(e),r.unshift(t),n.set(e,r)},retry:function(){return r.parent.once("sync",n.restart)},restart:function(){return r.parent.removeAllListeners("failed."+r.id),r.parent.removeAllListeners("complete."+r.id),r.log={},r.root={},r.run(e)},abort:function(t){var n;return n="Transaction aborted",t!=null&&(n+=": "+t),e(Error(n))},done:function(){return e!=null&&r.parent.once("complete."+r.id,e),r.parent.once("failed."+r.id,n.restart),r.parent.ssocket.write({type:"transaction",id:r.id,log:r.log})}},this.fn.call(n)},e}(),r?window.WarlockTransaction=e:module.exports=e}.call(this),function(){var e,t,n;n=typeof window!="undefined",n?e=window.WarlockTransaction:e=require("./Transaction"),t={options:{namespace:"Warlock",resource:"default"},start:function(){this.root={},this.synced=!1,this.subscribers={},this.on("sync",this.runSubscribers)},validate:function(e,t,n){if(typeof t!="object")return n(!1);if(typeof t.type!="string")return n(!1);switch(t.type){case"sync":if(typeof t.value!="object")return n(!1);break;case"complete":case"failed":if(typeof t.id!="string")return n(!1);break;default:return n(!1)}return n(!0)},message:function(e,t){var n,r,i;switch(t.type){case"sync":i=t.value;for(n in i)r=i[n],this.root[n]=r;this.synced?this.emit("sync",t.value):(this.synced=!0,this.emit("ready"));break;case"complete":case"failed":this.emit(""+t.type+"."+t.id)}},atomic:function(t){return new e(t,this)},ready:function(e){return this.synced?e():this.once("ready",e)},subscribe:function(e,t){var n,r;return((r=(n=this.subscribers)[e])!=null?r:n[e]=[]).push(t)},runSubscribers:function(e){var t,n,r,i,s,o;for(t in e){r=e[t];if(this.subscribers[t]!=null){o=this.subscribers[t];for(i=0,s=o.length;i<s;i++)n=o[i],n(t,r)}}}},n?window.Warlock={createClient:ProtoSock.createClientWrapper(t)}:module.exports=t}.call(this);