exports.connect=function(p){var n=!1,b="",d,f=0,m,c={},k={},l=[];p.on("data",function(a){if(f){if(a.length<=f){f-=a.length;m(a);0==f&&(m=void 0);return}m(a.substr(0,f));a=a.substr(f);f=0;m=void 0}b+=a;n&&console.log("] "+JSON.stringify(a));"\n"==b[0]&&(b=b.substr(1));if(c)for(var e in c)b.substr(0,e.length)==e&&(b=c[e](b));for(a=b.indexOf("\r");0<=a;){var g=b.substr(0,a);if(0"]&&">"==b[0]&&(b=c[">"](b)),c)b.substr(0,e.length)==e&&(b=c[e](b));a=b.indexOf("\r")}});var h={debug:function(a){n=!1!==a;return{line:b,lineCallback:d,handlers:c,lineHandlers:k,waiting:l}},cmd:function(a,b,g){if(d)n&&console.log("Queued "+JSON.stringify(a)),l.push([a,b,g]);else if(n&&console.log("["+JSON.stringify(a)),p.write(a),b){var e=setTimeout(function(){d=void 0;g&&g();void 0===d&&0