(function(){function z(b,c){var a=Array.prototype.slice.call(arguments,2);return function(){c=typeof c=="string"?b[c]:c;return c.apply(b,a.concat(Array.prototype.slice.call(arguments,0)))}}function G(){var b=require("fs"),c=require("sys");this.global=GLOBAL;this.getCwd=process.cwd;this.log=function(){var a;try{c.error(a=Array.prototype.map.call(arguments,function(g){if(g instanceof Error&&g.message)return"Error:"+g.message+"\nStack:"+g.stack+"\nArguments:"+g.arguments;return typeof g=="string"?g:
JSON.stringify(g)}).join(" "))}catch(d){c.error(a=Array.prototype.join.call(arguments," ")+"\n")}return a};this.getPath=function(){var a=__filename.split("/");a.pop();return a.join("/")||"."};this.eval=process.compile;this.findModule=function(a){for(var d=0,g;g=a[d];++d)try{g.src=b.readFileSync(g.filePath);return g}catch(f){}return false};this.require=require;this.include=include}function H(){var b=window.XMLHttpRequest||function(){return new ActiveXObject("Msxml2.XMLHTTP")},c=Array.prototype.slice,
a=null,d=null;this.global=window;this.global.jsio=jsio;this.log=function(){var f=c.call(arguments,0);if(typeof console!="undefined"&&console.log)console.log.apply?console.log.apply(console,arguments):console.log(f);return f.join(" ")};this.getCwd=function(){if(!a){var f=window.location.toString().split("#")[0];a=f.substring(0,f.lastIndexOf("/")+1)}return a};this.getPath=function(){if(!d){try{for(var f=RegExp("(.*?)"+jsio.__filename+"(\\?.*)?$"),k=document.getElementsByTagName("script"),e=0,h;h=k[e];++e){var l=
h.src.match(f);if(l){d=l[1];if(/^[A-Za-z]*:\/\//.test(d))d=A(d,this.getCwd());break}}}catch(o){}d||(d=".")}return d};var g=typeof eval("(function(){})")=="undefined"?function(f){return(new Function("return "+f))()}:function(f,k){f=f+"\n//@ sourceURL="+k;return window.eval(f)};this.eval=function(f,k){try{return g(f,k)}catch(e){if(e instanceof SyntaxError){e.message="a syntax error is preventing execution of "+k;e.type="syntax_error";try{var h=function(){var o=document.createElement("iframe");o.style.cssText=
"position:absolute;top:-999px;left:-999px;width:1px;height:1px;visibility:hidden";o.src='javascript:document.open();document.write("<scr"+"ipt src=\''+k+'\'></scr"+"ipt>")';setTimeout(function(){try{document.body.appendChild(o)}catch(n){}},0)};document.body?h():window.addEventListener("load",h,false)}catch(l){}}throw e;}};this.findModule=function(f){for(var k=0,e;e=f[k];++k){var h=new b;try{h.open("GET",e.filePath,false);h.send(null)}catch(l){i.log("e:",l);continue}if(!(h.status==404||h.status==-1100||
0)){e.src=h.responseText;return e}}return false}}function B(b,c){var a=i.eval("(function(_){with(_){delete _;(function(){"+c.src+"\n}).call(this)}})",c.filePath);try{a.call(b.exports,b)}catch(d){if(d.type=="syntax_error")throw Error("error importing module: "+d.message);else if(!d.jsioLogged){d.jsioLogged=true;d.type=="stack_overflow"?i.log("Stack overflow in",c.filePath,":",d):i.log("ERROR LOADING",c.filePath,":",d)}throw d;}}function x(b,c,a){if(!c||(a=a||".")!=b.charAt(0))return b;for(var d=1;b.charAt(d)==
a;)++d;c=c.split(a).slice(0,-d);if(c.length){c=c.join(a);if(c.charAt(c.length-1)!=a)c+=a}return c+b.substring(d)}function I(b,c){var a,d=[];if(a=c.match(/^(from|external)\s+([\w.$]+)\s+import\s+(.*)$/)){d[0]={from:x(a[2],b),external:a[1]=="external","import":{}};a[3].replace(/\s*([\w.$*]+)(?:\s+as\s+([\w.$]+))?/g,function(f,k,e){d[0]["import"][k]=e||k})}else if(a=c.match(/^import\s+(.*)$/))a[1].replace(/\s*([\w.$]+)(?:\s+as\s+([\w.$]+))?,?/g,function(f,k,e){fullPkg=x(k,b);d[d.length]=e?{from:fullPkg,
as:e}:{from:fullPkg,as:k}});else if(a=c.match(/[\w.0-9$\/]/)){a=a[0];var g=a.charAt(0)=="/";a=a.replace(/^\//,"").replace(/\.\.?\//g,".").replace(/\//g,".");d[0]={from:g?a:x(a,b),as:a}}else{a="Invalid jsio request: jsio('"+c+"')";throw SyntaxError?new SyntaxError(a):Error(a);}return d}function J(b,c){var a={exports:{},global:i.global},d=i.getCwd(),g=c.lastIndexOf("/"),f=g>0;a.require=a.jsio=z(this,C,a,b);a.module={id:b};if(b!="base"){a.jsio("from base import *");a.logging.__create(b,a)}a.jsio.__jsio=
jsio;a.jsio.__env=jsio.__env;a.jsio.__dir=f?A(c.substring(0,g),d):"";a.jsio.__filename=f?c.substring(g):c;a.jsio.__path=b;return a}function A(b,c){var a=b.match("^"+c);if(a&&a[0]==c)return b.slice(c.length+(b[c.length]=="/"?1:0));return b}function C(b,c,a,d){b=d||b||i.global;d=I(c,a);for(var g=d.length,f=g>1?{}:null,k=0;k<g;++k){var e=d[k],h=e.from,l=jsio.modules;if(!(h in l)){try{var o;if(!(o=y[h])){var n=h,q;var j=n;if(j.charAt(0)=="."){for(var m=0;j.charAt(m+1)==".";)++m;var u;u=i.getCwd().replace(/\/$/,
"");if(m)u=u.split("/").slice(0,-m).join("/");q=[{filePath:u+"/"+j.substring(m+1).split(".").join("/")+".js"}]}else{var D=j.split("."),r=D[0],E=D.join("/");if(r in jsio.path)q=[{filePath:(jsio.path[r].length&&jsio.path[r].replace(/([^\/])$/,"$1/")||jsio.path[r])+E+".js"}];else{j=[];var v=typeof jsio.path.__default__=="string"?[jsio.path.__default__]:jsio.path.__default__;m=0;for(var K=v.length;m<K;++m){var F=v[m].length&&v[m].replace(/([^\/])$/,"$1/")||v[m];j.push({filePath:F+E+".js",baseMod:r,basePath:F})}q=
j}}var s=i.findModule(q);if(!s){b=[];o=0;for(m=void 0;m=q[o];++o)b.push(m.filePath);throw Error("Module not found: "+n+" (looked in "+b.join(", ")+")");}if(!(s.baseMod in jsio.path))jsio.path[s.baseMod]=s.basePath;o=s}n=o}catch(L){i.log("\nError executing '",a,"': could not load module",h,"\n\tpath:",c,"\n\trequest:",a,"\n");throw L;}if(e.external){j=l[h]={};for(var t in e["import"])j[t]=undefined;B(j,n);for(t in e["import"])if(j[t]===undefined)j[t]=i.global[t]}else{j=J(h,n.filePath);l[h]=j.exports;
B(j,n);l[h]=j.exports}}n=l[h];if(g==1)f=n;if(e.as){h=e.as.match(/^\.*(.*?)\.*$/)[1];e=h.split(".");l=e.length-1;j=b;for(var p=0;p<l;++p){var w=e[p];if(w){j[w]||(j[w]={});j=j[w]}}j[e[l]]=n;if(g>1)f[h]=n}else if(e["import"])if(e["import"]["*"])for(p in l[h])b[p]=n[p];else try{for(p in e["import"])b[e["import"][p]]=n[p]}catch(M){i.log("module: ",l);throw M;}}return f}var i,y={"net.protocols.delimited":{src:'jsio("import net.interfaces");\nexports.DelimitedProtocol=Class(net.interfaces.Protocol,function(){this.init=function(a){a||(a="\\r\\n");this.delimiter=a;this.buffer=""};this.connectionMade=function(){logger.debug("connectionMade")};this.dataReceived=function(a){if(a){logger.debug("dataReceived:("+a.length+")",a);logger.debug("last 2:",a.slice(a.length-2));this.buffer+=a;for(logger.debug("index",this.buffer.indexOf(this.delimiter));(a=this.buffer.indexOf(this.delimiter))!=-1;){var b=this.buffer.slice(0,a);this.buffer=this.buffer.slice(a+\nthis.delimiter.length);this.lineReceived(b)}}};this.lineReceived=function(a){logger.debug("Not implemented, lineReceived:",a)};this.sendLine=function(a){logger.debug("WRITE:",a+this.delimiter);try{this.transport.write(a+this.delimiter)}catch(b){logger.error(b)}};this.connectionLost=function(){logger.debug("connectionLost")}});\n',
filePath:"jsio/net/protocols/delimited.js"},"net.env":{src:'function getObj(c,a,b){try{jsio("from .env."+(b||jsio.__env.name)+"."+a+" import "+c+" as result")}catch(d){throw logger.error("Invalid transport (",a,") or environment (",b,")");}return result}exports.getListener=bind(this,getObj,"Listener");exports.getConnector=bind(this,getObj,"Connector");\n',filePath:"jsio/net/env.js"},"std.base64":{src:'for(var alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",pad="=",padChar=alphabet.charAt(alphabet.length-1),shorten=function(a,b){for(var c=b;c>0;c--)a.pop()},decode_map={},i=0,n=alphabet.length;i<n;i++)decode_map[alphabet.charAt(i)]=i;var alphabet_inverse=RegExp("[^"+alphabet.replace("-","\\\\-")+"]"),Base64CodecError=exports.Base64CodecError=function(a){this.message=a};\nBase64CodecError.prototype.toString=function(){return"Base64CodecError"+(this.message?": "+this.message:"")};var assertOrBadInput=function(a,b){if(!a)throw new Base64CodecError(b);};\nexports.encode=function(a){assertOrBadInput(!/[^\\x00-\\xFF]/.test(a),"Input contains out-of-range characters.");var b="\\u0000\\u0000\\u0000".slice(a.length%3||3);a+=b;for(var c=[],d=0,f=a.length;d<f;d+=3){var e=(a.charCodeAt(d)<<16)+(a.charCodeAt(d+1)<<8)+a.charCodeAt(d+2);c.push(alphabet.charAt(e>>18&63),alphabet.charAt(e>>12&63),alphabet.charAt(e>>6&63),alphabet.charAt(e&63))}shorten(c,b.length);return c.join("")};\nexports.decode=function(a){logger.debug("decode",a);a=a.replace(/\\s/g,"");for(var b=a.length;a.charAt(--b)===pad;);a=a.slice(0,b+1);assertOrBadInput(!alphabet_inverse.test(a),"Input contains out-of-range characters.");var c=Array(5-(a.length%4||4)).join(padChar);a+=c;var d=[];b=0;for(var f=a.length;b<f;b+=4){newchars=(decode_map[a.charAt(b)]<<18)+(decode_map[a.charAt(b+1)]<<12)+(decode_map[a.charAt(b+2)]<<6)+decode_map[a.charAt(b+3)];d.push(newchars>>16&255,newchars>>8&255,newchars&255)}shorten(d,\nc.length);a=String.fromCharCode.apply(String,d);logger.debug("decoded",a);return a};\n',
filePath:"jsio/std/base64.js"},"lib.Enum":{src:'exports=function(){if(arguments.length==1)if(typeof arguments[0]=="object"){var b=arguments[0],a;for(a in b)b[a]in b||(b[b[a]]=a);return b}else if(typeof arguments[0]!="string")c=arguments[0];if(!c)var c=arguments;b={};a=0;for(var d=c.length;a<d;++a){if(c[a])b[c[a]]=a+1;b[a+1]=c[a]}return b};\n',filePath:"jsio/lib/Enum.js"},"net.errors":{src:'var makeErrorClass=function(b){var c=function(a){if(typeof a=="string")this.message=a;else this.data=a};c.prototype={type:b,toString:function(){return b+(this.message?": "+this.message:"")}};return c};exports.ReadyStateError=makeErrorClass("ReadyStateError");exports.InvalidEncodingError=makeErrorClass("InvalidEncodingError");exports.ExpiredSession=makeErrorClass("ExpiredSession");exports.ServerUnreachable=makeErrorClass("ServerUnreachable",100);\nexports.ConnectionTimeout=makeErrorClass("ConnectionTimeout",101);exports.ServerProtocolError=makeErrorClass("ServerProtocolError",200);exports.ServerClosedConnection=makeErrorClass("ServerClosedConnection",301);exports.ConnectionClosedCleanly=makeErrorClass("ConnectionClosedCleanly",300);\n',
filePath:"jsio/net/errors.js"},"net.env.browser.csp":{src:'jsio("import net.interfaces");jsio("from net.csp.client import CometSession");jsio("import std.utf8 as utf8");\nexports.Connector=Class(net.interfaces.Connector,function(){this.connect=function(){this._state=net.interfaces.STATE.CONNECTING;var a=new CometSession;a.onconnect=bind(this,"cometSessionOnConnect",a);a.ondisconnect=bind(this,"onDisconnect");logger.debug("opening the connection");this._opts.encoding="plain";var b=this._opts.url;delete this._opts.url;a.connect(b,this._opts)};this.cometSessionOnConnect=function(a){logger.debug("conn has opened");this.onConnect(new Transport(a))}});\nvar Transport=Class(net.interfaces.Transport,function(){this.init=function(a){this._conn=a};this.makeConnection=function(a){this._conn.onread=bind(a,"dataReceived")};this.write=function(a){this._conn.write(this._encoding=="utf8"?utf8.encode(a):a)};this.loseConnection=function(){this._conn.close()}});\n',
filePath:"jsio/net/env/browser/csp.js"},"std.JSON":{src:'exports.createGlobal=function(){if(typeof JSON=="undefined")JSON={};if(typeof JSON.stringify!=="function")JSON.stringify=exports.stringify;if(typeof JSON.parse!=="function")JSON.parse=exports.parse};\n(function(){function n(b){o.lastIndex=0;return o.test(b)?\'"\'+b.replace(o,function(g){var c=q[g];return typeof c==="string"?c:"\\\\u"+("0000"+g.charCodeAt(0).toString(16)).slice(-4)})+\'"\':\'"\'+b+\'"\'}function l(b,g){var c=h,a=g[b];if(a&&typeof a==="object"&&typeof a.toJSON==="function")a=a.toJSON(b);if(typeof k==="function")a=k.call(g,b,a);switch(typeof a){case "string":return n(a);case "number":return isFinite(a)?String(a):"null";case "boolean":return String(a);case "object":if(a===null)return"null";\nif(a.constructor===Date)return exports.stringifyDate(a);h+=m;var d=[];if(a.constructor===Array){for(var i=a.length,e=0;e<i;e+=1)d[e]=l(e,a)||"null";var j=d.length===0?"[]":h?"[\\n"+h+d.join(",\\n"+h)+"\\n"+c+"]":"["+d.join(",")+"]";h=c;return j}if(k&&typeof k==="object"){i=k.length;for(e=0;e<i;e+=1){var f=k[e];if(typeof f==="string")if(j=l(f,a))d.push(n(f)+(h?": ":":")+j)}}else for(f in a)if(Object.hasOwnProperty.call(a,f))if(j=l(f,a))d.push(n(f)+(h?": ":":")+j);j=d.length===0?"{}":h?"{\\n"+h+d.join(",\\n"+\nh)+"\\n"+c+"}":"{"+d.join(",")+"}";h=c;return j}}var p=/[\\u0000\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,o=/[\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,h,m,q={"\\u0008":"\\\\b","\\t":"\\\\t","\\n":"\\\\n","\\u000c":"\\\\f","\\r":"\\\\r",\'"\':\'\\\\"\',"\\\\":"\\\\\\\\"},k;exports.stringify=function(b,g,c){m=h="";if(typeof c==="number")for(var a=0;a<c;a+=1)m+=" ";else if(typeof c==="string")m=\nc;if((k=g)&&typeof g!=="function"&&(typeof g!=="object"||typeof g.length!=="number"))throw Error("JSON stringify: invalid replacer");return l("",{"":b})};exports.stringifyDate=function(b){var g=b.getUTCFullYear(),c=b.getUTCMonth()+1,a=b.getUTCDate(),d=b.getUTCHours(),i=b.getUTCMinutes(),e=b.getUTCSeconds();b=b.getUTCMilliseconds();if(c<10)c="0"+c;if(a<10)a="0"+a;if(d<10)d="0"+d;if(i<10)i="0"+i;if(e<10)e="0"+e;if(b<10)b="00"+b;else if(b<100)b="0"+b;return\'"\'+g+"-"+c+"-"+a+"T"+d+":"+i+":"+e+"."+b+\'Z"\'};\nexports.parse=function(b,g){p.lastIndex=0;if(p.test(b))b=b.replace(p,function(d){return"\\\\u"+("0000"+d.charCodeAt(0).toString(16)).slice(-4)});if(/^[\\],:{}\\s]*$/.test(b.replace(/\\\\(?:["\\\\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\\\\n\\r]*"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g,"]").replace(/(?:^|:|,)(?:\\s*\\[)+/g,""))){var c=eval("("+b+")");if(g){var a=function(d,i){var e,j,f=d[i];if(f&&typeof f==="object")for(e in f)if(Object.hasOwnProperty.call(f,e)){j=a(f,e);if(j!==undefined)f[e]=\nj;else delete f[e]}return g.call(d,i,f)};return a({"":c},"")}else return c}throw new SyntaxError("JSON.parse");}})();\n',
filePath:"jsio/std/JSON.js"},"net.env.browser.websocket":{src:'jsio("import net.interfaces");jsio("import std.utf8 as utf8");jsio("import net.errors as Errors");\nexports.Connector=Class(net.interfaces.Connector,function(){this.connect=function(){this._state=net.interfaces.STATE.CONNECTING;var a=this._opts.url,b=this._opts.wsConstructor||window.WebSocket;logger.info("this._opts",this._opts);a=new b(a);a.onopen=bind(this,"webSocketOnOpen",a);a.onclose=bind(this,"webSocketOnClose",a);a.onerror=bind(this,"webSocketOnError",a)};this.webSocketOnOpen=function(a){this.onConnect(new Transport(a))};this.webSocketOnClose=function(a,b){var c;c={rawError:b,webSocket:a};\nc=b.wasClean?new Errors.ServerClosedConnection("WebSocket Connection Closed",c):this._state==net.interfaces.STATE.CONNECTED?new Errors.ConnectionTimeout("WebSocket Connection Timed Out",c):new Errors.ServerUnreachable("WebSocket Connection Failed",c);logger.debug("conn closed",c);this.onDisconnect(c)};this.webSocketOnError=function(a,b){logger.debug("websocket error",b)}});\nvar Transport=Class(net.interfaces.Transport,function(){this.init=function(a){this._ws=a};this.makeConnection=function(a){this._ws.onmessage=function(b){b=utf8.encode(b.data);a.dataReceived(b)}};this.write=function(a){if(this._encoding=="plain"){result=utf8.decode(a);a=result[0]}this._ws.send(a)};this.loseConnection=function(){this._ws.close()}});\n',
filePath:"jsio/net/env/browser/websocket.js"},"net.protocols.rtjp":{src:'jsio("import net.interfaces");jsio("from net.protocols.delimited import DelimitedProtocol");\nexports.RTJPProtocol=Class(DelimitedProtocol,function(c){this.init=function(){c(this,"init",["\\r\\n"]);this.frameId=0};this.connectionMade=function(){logger.debug("connectionMade")};this.frameReceived=function(){};this.sendFrame=function(b,a){a||(a={});logger.debug("sendFrame",b,a);this.sendLine(JSON.stringify([++this.frameId,b,a]));return this.frameId};this.lineReceived=function(b){try{var a=JSON.parse(b);if(a.length!=3)logger.error("Invalid frame length");else if(typeof a[0]!="number")logger.error("Invalid frame id");\nelse if(typeof a[1]!="string")logger.error("Invalid frame name");else{logger.debug("frameReceived:",a[0],a[1],a[2]);this.frameReceived(a[0],a[1],a[2])}}catch(d){logger.error(d)}};this.connectionLost=function(){logger.debug("conn lost")}});\n',
filePath:"jsio/net/protocols/rtjp.js"},"net.csp.client":{src:'jsio("import std.base64 as base64");jsio("import std.utf8 as utf8");jsio("import std.uri as uri");jsio("import net.errors as errors");jsio("import .transports");jsio("import lib.Enum as Enum");var READYSTATE=exports.READYSTATE=Enum({INITIAL:0,CONNECTING:1,CONNECTED:2,DISCONNECTING:3,DISCONNECTED:4});\nexports.CometSession=Class(function(){var g=0;this.init=function(){this._id=++g;this._url=null;this.readyState=READYSTATE.INITIAL;this._options=this._transport=this._sessionKey=null;this._writeBuffer=this._utf8ReadBuffer="";this._handshakeLater=this._lastSentId=this._lastEventId=this._packetsInFlight=null;this._handshakeBackoff=50;this._timeoutTimer=this._handshakeTimeoutTimer=this._handshakeRetryTimer=null;this._cometBackoff=this._writeBackoff=50;this._nullReceived=this._nullSent=this._nullInFlight=\nthis._nullInBuffer=false};this.setEncoding=function(a){if(a!=this._options.encoding){if(a!="utf8"&&a!="plain")throw new errors.InvalidEncodingError;if(a=="plain"&&this._buffer){var b=this._utf8ReadBuffer;this._utf8ReadBuffer="";this._doOnRead(b)}this._options.encoding=a}};this.connect=function(a,b){this._url=a.replace(/\\/$/,"");this._options=b||{};this._options.encoding=this._options.encoding||"utf8";this.setEncoding(this._options.encoding);this._options.connectTimeout=this._options.connectTimeout||\n1E4;this._transport=new (transports.chooseTransport(a,this._options));this._transport.handshakeFailure=bind(this,this._handshakeFailure);this._transport.handshakeSuccess=bind(this,this._handshakeSuccess);this._transport.cometFailure=bind(this,this._cometFailure);this._transport.cometSuccess=bind(this,this._cometSuccess);this._transport.sendFailure=bind(this,this._writeFailure);this._transport.sendSuccess=bind(this,this._writeSuccess);this.readyState=READYSTATE.CONNECTING;this._transport.handshake(this._url,\nthis._options);this._handshakeTimeoutTimer=$setTimeout(bind(this,this._handshakeTimeout),this._options.connectTimeout)};this.write=function(a,b){if(this.readyState!=READYSTATE.CONNECTED)throw new errors.ReadyStateError;b=b||this._options.encoding||"utf8";if(b=="utf8")a=utf8.encode(a);this._writeBuffer+=a;this._doWrite()};this._protocolError=function(a){logger.debug("_protocolError",a);this.readyState=READYSTATE.DISCONNECTED;this._doWrite(true);this._doOnDisconnect(new errors.ServerProtocolError(a))};\nthis._receivedNullPacket=function(){logger.debug("_receivedNullPacket");this._receivedNull=true;if(this._nullInFlight||this._nullInBuffer||this._nullSent)this.readyState=READYSTATE.DISCONNECTED;else{this.readyState=READYSTATE.DISCONNECTING;this._doWrite(true)}this._doOnDisconnect(new errors.ConnectionClosedCleanly)};this._sentNullPacket=function(){logger.debug("_sentNullPacket");if((this._nullSent=true)&&this._nullReceived)this.readyState=READYSTATE.DISCONNECTED};this.close=function(a){logger.debug("close called",\na,"readyState",this.readyState);switch(this.readyState){case READYSTATE.CONNECTING:clearTimeout(this._handshakeRetryTimer);clearTimeout(this._handshakeTimeoutTimer);this.readyState=READYSTATE.DISCONNECTED;this._doOnDisconnect(a);break;case READYSTATE.CONNECTED:this.readyState=READYSTATE.DISCONNECTING;this._doWrite(true);clearTimeout(this._timeoutTimer);break;case READYSTATE.DISCONNECTED:throw new errors.ReadyStateError("Session is already disconnected");}this._sessionKey=null;this._opened=false;this.readyState=\nREADYSTATE.DISCONNECTED;this._doOnDisconnect(a)};this._handshakeTimeout=function(){logger.debug("handshake timeout");this._handshakeTimeoutTimer=null;this._doOnDisconnect(new errors.ServerUnreachable)};this._handshakeSuccess=function(a){logger.debug("handshake success",a);if(this.readyState!=READYSTATE.CONNECTING)logger.debug("received handshake success in invalid readyState:",this.readyState);else{clearTimeout(this._handshakeTimeoutTimer);this._handshakeTimeoutTimer=null;this._sessionKey=a.response.session;\nthis._opened=true;this.readyState=READYSTATE.CONNECTED;this._doOnConnect();this._doConnectComet()}};this._handshakeFailure=function(a){logger.debug("handshake failure",a);if(this.readyState==READYSTATE.CONNECTING){if(a.status==404){clearTimeout(this._handshakeTimeoutTimer);return this._doOnDisconnect(new errors.ServerUnreachable)}logger.debug("trying again in ",this._handshakeBackoff);this._handshakeRetryTimer=$setTimeout(bind(this,function(){this._handshakeRetryTimer=null;this._transport.handshake(this._url,\nthis._options)}),this._handshakeBackoff);this._handshakeBackoff*=2}};this._writeSuccess=function(){if(!(this.readyState!=READYSTATE.CONNECTED&&this.readyState!=READYSTATE.DISCONNECTING)){if(this._nullInFlight)return this._sentNullPacket();this._resetTimeoutTimer();this.writeBackoff=50;this._packetsInFlight=null;if(this._writeBuffer||this._nullInBuffer)this._doWrite(this._nullInBuffer)}};this._writeFailure=function(){if(!(this.readyState!=READYSTATE.CONNECTED&&this.READYSTATE!=READYSTATE.DISCONNECTING)){this._writeTimer=\n$setTimeout(bind(this,function(){this._writeTimer=null;this.__doWrite(this._nullInBuffer)}),this._writeBackoff);this._writeBackoff*=2}};this._doWrite=function(a){if(this._packetsInFlight){if(a)this._nullInBuffer=true}else this.__doWrite(a)};this.__doWrite=function(a){logger.debug("_writeBuffer:",this._writeBuffer);if(!this._packetsInFlight&&this._writeBuffer){this._packetsInFlight=[this._transport.encodePacket(++this._lastSentId,this._writeBuffer,this._options)];this._writeBuffer=""}if(a&&!this._writeBuffer){if(!this._packetsInFlight)this._packetsInFlight=\n[];this._packetsInFlight.push([++this._lastSentId,0,null]);this._nullInFlight=true}if(this._packetsInFlight){logger.debug("sending packets:",JSON.stringify(this._packetsInFlight));this._transport.send(this._url,this._sessionKey,this._lastEventId||0,JSON.stringify(this._packetsInFlight),this._options)}else logger.debug("no packets to send")};this._doConnectComet=function(){logger.debug("_doConnectComet");this._transport.comet(this._url,this._sessionKey,this._lastEventId||0,this._options)};this._cometFailure=\nfunction(a){if(this.readyState==READYSTATE.CONNECTED){if(a.status==404&&a.response=="Session not found")return this.close(new errors.ExpiredSession(a));this._cometTimer=$setTimeout(bind(this,function(){this._doConnectComet()}),this._cometBackoff);this._cometBackoff*=2}};this._cometSuccess=function(a){if(!(this.readyState!=READYSTATE.CONNECTED&&this.readyState!=READYSTATE.DISCONNECTING)){logger.debug("comet Success:",a);this._cometBackoff=50;this._resetTimeoutTimer();for(var b=a.response,d=0,c;(c=\nb[d])||d<b.length;d++){logger.debug("process packet:",c);if(c===null)return this.close(new errors.ServerProtocolError(a));logger.debug("process packet",c);var e=c[0],h=c[1];a=c[2];if(!(typeof this._lastEventId=="number"&&e<=this._lastEventId)){if(typeof this._lastEventId=="number"&&e!=this._lastEventId+1)return this._protocolError("Ack id too high");this._lastEventId=e;if(a==null)return this._receivedNullPacket();if(h==1)try{logger.debug("before base64 decode:",a);a=base64.decode(a);logger.debug("after base64 decode:",\na)}catch(i){return this._protocolError("Unable to decode base64 payload")}if(this._options.encoding=="utf8"){this._utf8ReadBuffer+=a;logger.debug("before utf8 decode, _utf8ReadBuffer:",this._utf8ReadBuffer);c=utf8.decode(this._utf8ReadBuffer);a=c[0];this._utf8ReadBuffer=this._utf8ReadBuffer.slice(c[1]);logger.debug("after utf8 decode, _utf8ReadBuffer:",this._utf8ReadBuffer,"data:",a)}logger.debug("dispatching data:",a);try{this._doOnRead(a)}catch(f){logger.error("application code threw an error. (re-throwing in timeout):",\nf);setTimeout(function(){logger.debug("timeout fired, throwing error",f);throw f;},0)}}}this._doConnectComet()}};this._doOnRead=function(a){if(typeof this.onread=="function"){logger.debug("call onread function",a);this.onread(a)}else logger.debug("skipping onread callback (function missing)")};this._doOnDisconnect=function(a){if(typeof this.ondisconnect=="function"){logger.debug("call ondisconnect function",a);this.ondisconnect(a)}else logger.debug("skipping ondisconnect callback (function missing)")};\nthis._doOnConnect=function(){if(typeof this.onconnect=="function"){logger.debug("call onconnect function");try{this.onconnect()}catch(a){logger.debug("onconnect caused errror",a);setTimeout(function(){throw a;},0)}}else logger.debug("skipping onconnect callback (function missing)")};this._resetTimeoutTimer=function(){clearTimeout(this._timeoutTimer);this._timeoutTimer=$setTimeout(bind(this,function(){logger.debug("connection timeout expired");this.close(new errors.ConnectionTimeout)}),this._getTimeoutInterval())};\nthis._getTimeoutInterval=function(){return 45E3}});\n',
filePath:"jsio/net/csp/client.js"},"net.interfaces":{src:'jsio("import net");jsio("import lib.Enum as Enum");var ctx=jsio.__env.global;exports.Protocol=Class(function(){this.connectionMade=function(){};this.dataReceived=function(){};this.connectionLost=function(){}});exports.Client=Class(function(){this.init=function(a){this._protocol=a};this.connect=function(a,b){this._remote=new this._protocol;this._remote._client=this;net.connect(this._remote,a,b)}});\nexports.Server=Class(function(){this.init=function(a){this._protocolClass=a};this.buildProtocol=function(){return new this._protocolClass};this.listen=function(a,b){return net.listen(this,a,b)}});exports.Transport=Class(function(){this._encoding="plain";this.write=function(){throw Error("Not implemented");};this.getPeer=function(){throw Error("Not implemented");};this.setEncoding=function(a){this._encoding=a};this.getEncoding=function(){return this._encoding}});\nexports.Listener=Class(function(){this.init=function(a,b){this._server=a;this._opts=b||{}};this.onConnect=function(a){var b=this._server.buildProtocol();b.transport=a;b.server=this._server;a.protocol=b;a.makeConnection(b);b.connectionMade()};this.listen=function(){throw Error("Abstract class");};this.stop=function(){}});exports.STATE=Enum("INITIAL","DISCONNECTED","CONNECTING","CONNECTED");\nexports.Connector=Class(function(){this.init=function(a,b){this._protocol=a;this._opts=b;this._state=exports.STATE.INITIAL};this.onConnect=function(a){this._state=exports.STATE.CONNECTED;a.makeConnection(this._protocol);this._protocol.transport=a;try{this._protocol.connectionMade()}catch(b){throw logger.error(b);}};this.onDisconnect=function(a){var b=this._state==exports.STATE.CONNECTED;this._state=exports.STATE.DISCONNECTED;try{this._protocol.connectionLost(a,b)}catch(c){throw logger.error(c);}};\nthis.getProtocol=function(){return this._protocol}});\n',
filePath:"jsio/net/interfaces.js"},base:{src:'exports.log=jsio.__env.log;exports.GLOBAL=jsio.__env.global;\nexports.bind=function(a,b){if(arguments.length>2){var d=Array.prototype.slice.call(arguments,2);return typeof b=="string"?function(){if(a[b])return a[b].apply(a,d.concat(Array.prototype.slice.call(arguments,0)));else throw logger.error("No method:",b,"for context",a);}:function(){return b.apply(a,d.concat(Array.prototype.slice.call(arguments,0)))}}else return typeof b=="string"?function(){if(a[b])return a[b].apply(a,arguments);else throw logger.error("No method:",b,"for context",a);}:function(){return b.apply(a,\narguments)}};\nexports.Class=function(a,b){if(!a)throw Error("parent or prototype not provided");if(b)if(a instanceof Array){b.prototype={};for(var d=0,f;f=a[d];++d)for(var c in f.prototype)c in b.prototype||(b.prototype[c]=f.prototype[c]);a=a[0]}else b.prototype=a.prototype;else{b=a;a=null}d=function(){if(this.init)return this.init.apply(this,arguments)};d.prototype=new b(a?function(g,e,h){h=h||[];for(var i=b;i=i.prototype;)if(i[e])return i[e].apply(g,h);throw Error("method "+e+" does not exist");}:null);return d.prototype.constructor=\nd};exports.$setTimeout=function(a,b){var d=Array.prototype.slice.call(arguments,2);return setTimeout(function(){try{a.apply(this,d)}catch(f){}},b)};exports.$setInterval=function(a,b){var d=Array.prototype.slice.call(arguments,2);return setInterval(function(){try{a.apply(this,d)}catch(f){}},b)};exports.$clearTimeout=function(a){return a?clearTimeout(a):null};exports.$clearInterval=function(a){return a?clearInterval(a):null};\nexports.logging=function(){var a={DEBUG:1,LOG:2,INFO:3,WARN:4,ERROR:5},b={},d=false;a.setProduction=function(c){d=!!c};a.get=function(c){return b.hasOwnProperty(c)?b[c]:b[c]=new f(c)};a.set=function(c,g){b[c]=g};a.getAll=function(){return b};a.__create=function(c,g){g.logger=a.get(c)};var f=exports.Class(function(){function c(e,h){return function(){if(!d&&e>=this._level)return this._listener.apply(this._listener,[h,this._name].concat(g.call(arguments)));return arguments[0]}}this.init=function(e,h){this._name=\ne;this._level=h||a.LOG;this._listener=exports.log};this.setLevel=function(e){this._level=e};var g=Array.prototype.slice;this.setListener=function(e){log=e};this.debug=c(a.DEBUG,"DEBUG");this.log=c(a.LOG,"LOG");this.info=c(a.INFO,"INFO");this.warn=c(a.WARN,"WARN");this.error=c(a.ERROR,"ERROR")});return a}();var logger=exports.logging.get("jsiocore");\n',
filePath:"jsio/base.js"},hookbox:{src:'jsio("from net import connect as jsioConnect");jsio("from net.protocols.rtjp import RTJPProtocol");jsio("from util.browserdetect import BrowserDetect");exports.__jsio=jsio.__jsio;exports.logging=logging;logger.setLevel(0);\nexports.connect=function(d,a){d.match("/$")||(d+="/");var b=new HookBoxProtocol(d,a);if(window.WebSocket&&!BrowserDetect.isSafari){jsioConnect(b,"websocket",{url:d.replace("http://","ws://")+"ws"});b.connectionLost=bind(b,"_connectionLost","websocket")}else{jsioConnect(b,"csp",{url:d+"csp"});b.connectionLost=bind(b,"_connectionLost","csp")}return b};\nvar Subscription=Class(function(){this.init=function(d,a){this.channelName=a.channel_name;this.history=a.history;this.historySize=a.history_size;this.state=a.state;this.presence=a.presence;this.canceled=false;this.publish=bind(d,"publish",this.channelName)};this.onPublish=function(){};this.onSubscribe=function(){};this.onUnsubscribe=function(){};this.onState=function(){};this.frame=function(d,a){logger.debug("received frame",d,a);switch(d){case "PUBLISH":if(this.historySize)for(this.history.push(["PUBLISH",\n{user:a.user,payload:a.payload}]);this.history.length>this.historySize;)this.history.shift();this.onPublish(a);break;case "UNSUBSCRIBE":if(this.historySize)for(this.history.push(["UNSUBSCRIBE",{user:a.user}]);this.history.length>this.historySize;)this.history.shift();for(var b=0,c;c=this.presence[b];++b)if(c==a.user){this.presence.splice(b,1);break}this.onUnsubscribe(a);break;case "SUBSCRIBE":if(this.historySize)for(this.history.push(["SUBSCRIBE",{user:a.user}]);this.history.length>this.historySize;)this.history.shift();\nthis.presence.push(a.user);this.onSubscribe(a);break;case "STATE_UPDATE":for(b=0;c=a.deletes[b];++b)delete this.state[c];for(c in a.updates)this.state[c]=a.updates[c];this.onState(a)}};this.cancel=function(){if(!this.canceled){logger.debug("calling this._onCancel()");this._onCancel()}};this._onCancel=function(){}});\nHookBoxProtocol=Class([RTJPProtocol],function(d){this.onOpen=function(){};this.onClose=function(){};this.onError=function(){};this.onSubscribed=function(){};this.onUnsubscribed=function(){};this.onMessaged=function(){};this.init=function(a,b){d(this,"init",[]);this.url=a;try{this.cookieString=b||document.cookie}catch(c){this.cookieString=""}this.connected=false;this._subscriptions={};this._buffered_subs=[];this._publishes=[];this._messages=[];this._errors={};this.username=null};this.subscribe=function(a){this.connected?\nthis.sendFrame("SUBSCRIBE",{channel_name:a}):this._buffered_subs.push(a)};this.publish=function(a,b){this.connected?this.sendFrame("PUBLISH",{channel_name:a,payload:JSON.stringify(b)}):this._publishes.push([a,b])};this.message=function(a,b){this.connected?this.sendFrame("MESSAGE",{name:a,payload:JSON.stringify(b)}):this._messages.push([a,b])};this.connectionMade=function(){logger.debug("connectionMade");this.transport.setEncoding("utf8");this.sendFrame("CONNECT",{cookie_string:this.cookieString})};\nthis.frameReceived=function(a,b,c){switch(b){case "MESSAGE":this.onMessaged(c);break;case "CONNECTED":this.connected=true;for(this.username=c.name;this._buffered_subs.length;)this.sendFrame("SUBSCRIBE",{channel_name:this._buffered_subs.shift()});for(;this._publishes.length;)this.publish.apply(this,this._publishes.splice(0,1)[0]);for(;this._messages.length;)this.message.apply(this,this._messages.splice(0,1)[0]);this.onOpen();break;case "SUBSCRIBE":if(c.user==this.username){b=new Subscription(this,\nc);this._subscriptions[c.channel_name]=b;b._onCancel=bind(this,function(){this.sendFrame("UNSUBSCRIBE",{channel_name:c.channel_name})});this.onSubscribed(c.channel_name,b);K=b}else this._subscriptions[c.channel_name].frame(b,c);break;case "STATE_UPDATE":case "PUBLISH":a=this._subscriptions[c.channel_name];a.frame(b,c);break;case "UNSUBSCRIBE":a=this._subscriptions[c.channel_name];a.canceled=true;a.frame(b,c);if(c.user==this.username){delete this._subscriptions[c.channel_name];this.onUnsubscribed(a,\nc)}break;case "ERROR":this.onError(c);break;case "SET_COOKIE":document.cookie=c.cookie}};this._connectionLost=function(a,b,c){if(c){logger.debug("connectionLost");this.connected=false;this.onClose()}else{logger.debug("connectionFailed",a);if(a=="websocket"){logger.debug("retry with csp");this.connectionLost=bind(this,"_connectionLost","csp");jsioConnect(this,"csp",{url:this.url+"csp"})}else{this.connected=false;this.onClose()}}};this.disconnect=function(){this.transport.loseConnection()}});\n',
filePath:"hookbox.js"},"std.uri":{src:'var attrs=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];\nexports.Uri=Class(function(){this.init=function(a,b){var e=exports.parse(a,b);for(c in e)this["_"+c]=e[c]};for(var d=0,c;c=attrs[d];++d)(function(a){var b=a.charAt(0).toUpperCase()+a.slice(1);this["get"+b]=function(){return this["_"+a]};this["set"+b]=function(e){this["_"+a]=e}}).call(this,c);this.toString=this.render=function(){return(this._protocol?this._protocol+"://":"")+(this._host?this._host+((this._port||80)==80?"":":"+this._port):"")+this._path+(this._query?"?"+this._query:"")+(this._anchor?\n"#"+this._anchor:"")}});exports.buildQuery=function(d){var c=[];for(key in d)c.push(encodeURIComponent(key)+"="+encodeURIComponent(d[key]));return c.join("&")};exports.parseQuery=function(d){d=d.split("&");for(var c=d.length,a={},b=0;b<c;++b){var e=d[b].split("="),f=decodeURIComponent(e[0]);if(f)a[f]=decodeURIComponent(e[1])}return a};\nvar strictRegex=/^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,looseRegex=/^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/,queryStringRegex=/(?:^|&)([^&=]*)=?([^&]*)/g;\nexports.parse=function(d,c){for(var a={},b=(c?strictRegex:looseRegex).exec(d),e=0,f;f=attrs[e];++e)a[f]=b[e]||"";var g=a.queryKey={};a.query.replace(queryStringRegex,function(h,i,j){if(h)g[i]=j});return a};exports.isSameDomain=function(d,c){var a=exports.parse(d),b=exports.parse(c);return a.port==b.port&&a.host==b.host&&a.protocol==b.protocol};\n',
filePath:"jsio/std/uri.js"},"net.csp.transports":{src:'jsio("import std.uri as uri");jsio("import std.base64 as base64");jsio("from util.browserdetect import BrowserDetect");\n(function(){var c;exports.getDoc=function(){if(c)return c;try{if(c=window.ActiveXObject&&new ActiveXObject("htmlfile")){c.open().write("<html></html>");c.close();window.attachEvent("onunload",function(){try{c.body.innerHTML=""}catch(e){}c=null})}}catch(d){}c||(c=document);return c};exports.XHR=function(){var d=window;exports.getDoc();return new (exports.XHR=d.XMLHttpRequest?d.XMLHttpRequest:function(){return d.ActiveXObject&&new d.ActiveXObject("Msxml2.XMLHTTP")||null})};exports.createXHR=function(){return new exports.XHR}})();\nfunction isLocalFile(c){return/^file:\\/\\//.test(c)}function isWindowDomain(c){return uri.isSameDomain(c,window.location.href)}function canUseXHR(c){if(isLocalFile(c))return false;var d=new exports.XHR;if(!d)return false;if(isWindowDomain(c))return true;if(window.XMLHttpRequest&&(d.__proto__==XMLHttpRequest.prototype||d instanceof window.XMLHttpRequest)&&d.withCredentials!==undefined||window.XDomainRequest&&d instanceof window.XDomainRequest)return true}var transports=exports.transports={};\nexports.chooseTransport=function(c,d){switch(d.preferredTransport){case "jsonp":return transports.jsonp;default:if(canUseXHR(c))return transports.xhr;return transports.jsonp}};var PARAMS={xhrstream:{is:"1",bs:"\\n"},xhrpoll:{du:"0"},xhrlongpoll:{},sselongpoll:{bp:"data: ",bs:"\\r\\n",se:"1"},ssestream:{bp:"data: ",bs:"\\r\\n",se:"1",is:"1"}};\nexports.Transport=Class(function(){this.handshake=function(){throw Error("handshake Not Implemented");};this.comet=function(){throw Error("comet Not Implemented");};this.send=function(){throw Error("send Not Implemented");};this.encodePacket=function(){throw Error("encodePacket Not Implemented");};this.abort=function(){throw Error("abort Not Implemented");}});\nvar baseTransport=Class(exports.Transport,function(){this.init=function(){this._aborted=false;this._handshakeArgs={d:"{}",ct:"application/javascript"}};this.handshake=function(c,d){logger.debug("handshake:",c,d);this._makeRequest("send",c+"/handshake",this._handshakeArgs,this.handshakeSuccess,this.handshakeFailure)};this.comet=function(c,d,e,f){logger.debug("comet:",c,d,e,f);args={s:d,a:e};this._makeRequest("comet",c+"/comet",args,this.cometSuccess,this.cometFailure)};this.send=function(c,d,e,f,i){logger.debug("send:",\nc,d,f,i);args={d:f,s:d,a:e};this._makeRequest("send",c+"/send",args,this.sendSuccess,this.sendFailure)}});\ntransports.xhr=Class(baseTransport,function(c){this.init=function(){c(this,"init");this._xhr={send:new exports.XHR,comet:new exports.XHR}};this.abort=function(){this._aborted=true;for(var e in this._xhr)this._xhr.hasOwnProperty(e)&&this._abortXHR(e)};this._abortXHR=function(e){logger.debug("aborting XHR");var f=this._xhr[e];try{if("onload"in f)f.onload=f.onerror=f.ontimeout=null;else if("onreadystatechange"in f)f.onreadystatechange=null;f.abort&&f.abort()}catch(i){logger.debug("error aborting xhr",\ni)}this._xhr[e]=new exports.XHR};var d=!exports.createXHR().sendAsBinary;this.encodePacket=function(e,f){return d?[e,1,base64.encode(f)]:[e,0,f]};this._onReadyStateChange=function(e,f,i){var k=this._xhr[e];try{var j={status:k.status}}catch(h){i({response:"Could not access status"})}try{if(k.readyState!=4)return;j.response=eval(k.responseText);if(j.status!=200){logger.debug("XHR failed with status ",k.status);i(j);return}logger.debug("XHR data received")}catch(a){logger.debug("Error in XHR::onReadyStateChange",\na);i(j);this._abortXHR(e);logger.debug("done handling XHR error");return}f(j)};this._makeRequest=function(e,f,i,k,j){if(!this._aborted){var h=this._xhr[e],a=i.d||null;"d"in i&&delete i.d;h.open("POST",f+"?"+uri.buildQuery(i));h.setRequestHeader("Content-Type","text/plain");if("onload"in h){h.onload=bind(this,"_onReadyStateChange",e,k,j);h.onerror=h.ontimeout=j}else if("onreadystatechange"in h)h.onreadystatechange=bind(this,"_onReadyStateChange",e,k,j);setTimeout(bind(h,h.sendAsBinary?"sendAsBinary":\n"send",a),0)}}});var EMPTY_FUNCTION=function(){},SLICE=Array.prototype.slice;\ntransports.jsonp=Class(baseTransport,function(c){function d(a,b){logger.debug("successful: ",a.url,b);a.completed=true;logger.debug("calling the cb");a.cb.call(GLOBAL,{status:200,response:b});logger.debug("cb called")}function e(a,b){if(!(b&&b.readyState!="loaded")){b.onreadystatechange=function(){};f.call(this,a)}}function f(a,b){k(this._ifr[a.type]);if(!a.completed){var g={status:b?200:404,response:b||"Unable to load resouce"};logger.debug("error making request:",a.url,g);logger.debug("calling eb");\na.eb.call(GLOBAL,g)}}var i=function(){var a=exports.getDoc();if(!a.body)return false;var b=a.createElement("iframe");with(b.style){display="block";width=height=border=margin=padding="0";overflow=visibility="hidden";position="absolute";top=left="-999px"}b.cbId=0;a.body.appendChild(b);b.src=\'javascript:var d=document;d.open();d.write("<html><body></body></html>");d.close();\';return b},k=function(a){var b=a.contentWindow,g=b.document;logger.debug("removing script tags");for(var m=g.getElementsByTagName("script"),\nn=m.length-1;n>=0;--n)g.body.removeChild(m[n]);logger.debug("deleting iframe callbacks");b["cb"+a.cbId]=b["eb"+a.cbId]=EMPTY_FUNCTION},j=function(a){$setTimeout(function(){a&&a.parentNode&&a.parentNode.removeChild(a)},6E4)};this.init=function(){c(this,"init");this._onReady=[];this._isReady=false;this._createIframes()};this._createIframes=function(){this._ifr={send:i(),comet:i()};if(this._ifr.send===false)return $setTimeout(bind(this,"_createIframes"),100);this._isReady=true;var a=this._onReady;this._onReady=\n[];for(var b=0,g;g=a[b];++b)this._makeRequest.apply(this,g)};this.encodePacket=function(a,b){return[a,1,base64.encode(b)]};this.abort=function(){this._aborted=true;for(var a in this._ifr)if(this._ifr.hasOwnProperty(a)){var b=this._ifr[a];k(b);j(b)}};this._makeRequest=function(a,b,g,m,n){if(!this._isReady)return this._onReady.push(arguments);var l=++this._ifr[a].cbId;l={type:a,id:l,cb:m,eb:n,cbName:"cb"+l,ebName:"eb"+l,completed:false};g.n=Math.random();switch(a){case "send":g.rs=";";g.rp=l.cbName;\nbreak;case "comet":g.bs=";";g.bp=l.cbName}l.url=b+"?"+uri.buildQuery(g);$setTimeout(bind(this,"_request",l),0)};this._request=function(a){var b=this._ifr[a.type].contentWindow,g=b.document,m=g.body;b[a.ebName]=bind(this,f,a);b[a.cbName]=bind(this,d,a);if(BrowserDetect.isWebKit){g.open();g.write(\'<script src="\'+a.url+\'"><\\/script><script>\'+ebName+"(false)<\\/script>");g.close()}else{b=g.createElement("script");b.src=a.url;if(b.onreadystatechange===null)b.onreadystatechange=bind(this,e,a,b);m.appendChild(b);\nif(!BrowserDetect.isIE){b=g.createElement("script");b.innerHTML=a.ebName+"(false)";m.appendChild(b)}}h()};var h=BrowserDetect.isFirefox?function(){var a=document.body;if(a){if(!h.iframe)h.iframe=document.createElement("iframe");a.insertBefore(h.iframe,a.firstChild);a.removeChild(h.iframe)}}:function(){}});\n',
filePath:"jsio/net/csp/transports.js"},net:{src:'jsio("import net.env");jsio("import std.JSON as JSON");JSON.createGlobal();exports.listen=function(a,b,c){if(!b)throw logger.error("No transport provided for net.listen");a=new (net.env.getListener(b))(a,c);a.listen();return a};exports.connect=function(a,b,c){a=new (net.env.getConnector(b))(a,c);a.connect();return a};exports.quickServer=function(a){jsio("import net.interfaces");return new net.interfaces.Server(a)};\n',filePath:"jsio/net.js"},"util.browserdetect":{src:'exports.BrowserDetect=new function(){function e(c){for(var b=0,a;a=c[b];b++){var f=a.string,h=a.prop;a.identity=a.identity||a.subString;d=a.versionSearch||a.identity;if(f){if(f.indexOf(a.subString)!=-1)return a.identity}else if(h)return a.identity}}function g(c){var b=c.indexOf(d);if(b!=-1)return parseFloat(c.substring(b+d.length+1))}var d,i=[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},\n{string:navigator.platform,subString:"Linux"}];this.browser=e([{string:navigator.userAgent,subString:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox"},{string:navigator.vendor,subString:"Camino"},\n{string:navigator.userAgent,subString:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"IE",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}])||"unknown";this.version=g(navigator.userAgent)||g(navigator.appVersion)||"unknown";this.OS=e(i)||"unknown";this.isWebKit=/ AppleWebKit\\//.test(navigator.userAgent);this["is"+this.browser]=this.version};\n',
filePath:"jsio/util/browserdetect.js"},"std.utf8":{src:'exports.UnicodeCodecError=function(a){this.message=a};var UnicodeCodecError=exports.UnicodeCodecError;UnicodeCodecError.prototype.toString=function(){return"UnicodeCodecError"+(this.message?": "+this.message:"")};exports.encode=function(a){try{return unescape(encodeURIComponent(a))}catch(b){throw new UnicodeCodecError("invalid input string");}};\nexports.decode=function(a){if(/[^\\x00-\\xFF]/.test(a))throw new UnicodeCodecError("invalid utf-8 bytes");var b,c;b=c=a.length;if(a.charCodeAt(b-1)>=128){for(var d=1;d<=3;d++)if(a.charCodeAt(b-d)>=192){c=b-d;break}try{decodeURIComponent(escape(a.slice(c)));c=b}catch(e){}}try{return[decodeURIComponent(escape(a.slice(0,c))),c]}catch(f){throw new UnicodeCodecError("invalid utf-8 bytes");}};\n',
filePath:"jsio/std/utf8.js"}};jsio=z(this,C,null,"");jsio.__filename="jsio.js";jsio.modules=[];jsio.setCachedSrc=function(b,c,a){y[b]={filePath:c,src:a}};jsio.getCachedSrc=function(b){return y[b]};jsio.path={};jsio.setPath=function(b){jsio.path.__default__=typeof b=="string"?[b]:b};jsio.setEnv=function(b){if(!(i&&(b==i||b==i.name))){if(typeof b=="string"){switch(b){case "node":i=new G;break;default:i=new H}i.name=b}else i=b;jsio.__env=i;jsio.__dir=i.getCwd();jsio.path.__default__||jsio.setPath(i.getPath())}};
if(typeof process!=="undefined"&&process.version)jsio.setEnv("node");else if(typeof XMLHttpRequest!="undefined"||typeof ActiveXObject!="undefined")jsio.setEnv("browser")})();jsio("import hookbox as hookbox");

