Create a gist now

Instantly share code, notes, and snippets.

@maxogden /index.js
Last active Dec 19, 2015

What would you like to do?
requirebin sketch
var term = require('hypernal')()
var tablify = require('tablify').tablify
var request = require('browser-request')
var url = require('url')
var parsedURL = url.parse(window.location.href, true)
term.appendTo(document.body)
// style fake terminal
var termEl = term.term.element
termEl.style['font'] = '13px Monaco, mono'
termEl.style.height = '100%'
termEl.style.padding = '5px'
termEl.style.overflow = 'auto'
termEl.style['white-space'] = 'pre'
if (parsedURL.query.q) {
var query = 'http://npmsearch.com/query?fl=name,description,homepage&rows=200&sort=rating+desc&q=' + parsedURL.query.q
request({json: true, url: query}, function(err, resp, data) {
var docs = data.results.map(function(doc) {
var isLong = doc.description.length > 60
doc.description = doc.description.substr(0, 60)
if (isLong) doc.description += '...'
return doc
})
term.write(tablify(docs))
})
} else {
term.write('RELOAD WITH ?q=your_search_term')
}
require=function e(t,r,n){function s(o,a){if(!r[o]){if(!t[o]){var h="function"==typeof require&&require;if(!a&&h)return h(o,!0);if(i)return i(o,!0);throw Error("Cannot find module '"+o+"'")}var c=r[o]={exports:{}};t[o][0].call(c.exports,function(e){var r=t[o][1][e];return s(r?r:e)},c,c.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;n.length>o;o++)s(n[o]);return s}({1:[function(t,e,r){var n="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};(function(t){function s(t){throw RangeError(T[t])}function i(t,e){for(var r=t.length;r--;)t[r]=e(t[r]);return t}function o(t,e){return i(t.split(B),e).join(".")}function a(t){for(var e,r,n=[],s=0,i=t.length;i>s;)e=t.charCodeAt(s++),e>=55296&&56319>=e&&i>s?(r=t.charCodeAt(s++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),s--)):n.push(e);return n}function h(t){return i(t,function(t){var e="";return t>65535&&(t-=65536,e+=M(55296|1023&t>>>10),t=56320|1023&t),e+=M(t)}).join("")}function c(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:x}function u(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function l(t,e,r){var n=0;for(t=r?O(t/S):t>>1,t+=O(t/e);t>U*E>>1;n+=x)t=O(t/U);return O(n+(U+1)*t/(t+A))}function f(t){var e,r,n,i,o,a,u,f,p,d,g=[],b=t.length,m=0,y=C,v=L;for(r=t.lastIndexOf(I),0>r&&(r=0),n=0;r>n;++n)t.charCodeAt(n)>=128&&s("not-basic"),g.push(t.charCodeAt(n));for(i=r>0?r+1:0;b>i;){for(o=m,a=1,u=x;i>=b&&s("invalid-input"),f=c(t.charCodeAt(i++)),(f>=x||f>O((k-m)/a))&&s("overflow"),m+=f*a,p=v>=u?_:u>=v+E?E:u-v,!(p>f);u+=x)d=x-p,a>O(k/d)&&s("overflow"),a*=d;e=g.length+1,v=l(m-o,e,0==o),O(m/e)>k-y&&s("overflow"),y+=O(m/e),m%=e,g.splice(m++,0,y)}return h(g)}function p(t){var e,r,n,i,o,h,c,f,p,d,g,b,m,y,v,w=[];for(t=a(t),b=t.length,e=C,r=0,o=L,h=0;b>h;++h)g=t[h],128>g&&w.push(M(g));for(n=i=w.length,i&&w.push(I);b>n;){for(c=k,h=0;b>h;++h)g=t[h],g>=e&&c>g&&(c=g);for(m=n+1,c-e>O((k-r)/m)&&s("overflow"),r+=(c-e)*m,e=c,h=0;b>h;++h)if(g=t[h],e>g&&++r>k&&s("overflow"),g==e){for(f=r,p=x;d=o>=p?_:p>=o+E?E:p-o,!(d>f);p+=x)v=f-d,y=x-d,w.push(M(u(d+v%y,0))),f=O(v/y);w.push(M(u(f,0))),o=l(r,m,n==i),r=0,++n}++r,++e}return w.join("")}function d(t){return o(t,function(t){return j.test(t)?f(t.slice(4).toLowerCase()):t})}function g(t){return o(t,function(t){return R.test(t)?"xn--"+p(t):t})}var b="object"==typeof r&&r,m="object"==typeof e&&e&&e.exports==b&&e,y="object"==typeof n&&n;(y.global===y||y.window===y)&&(t=y);var v,w,k=2147483647,x=36,_=1,E=26,A=38,S=700,L=72,C=128,I="-",j=/^xn--/,R=/[^ -~]/,B=/\x2E|\u3002|\uFF0E|\uFF61/g,T={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},U=x-_,O=Math.floor,M=String.fromCharCode;if(v={version:"1.2.3",ucs2:{decode:a,encode:h},decode:f,encode:p,toASCII:g,toUnicode:d},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return v});else if(b&&!b.nodeType)if(m)m.exports=v;else for(w in v)v.hasOwnProperty(w)&&(b[w]=v[w]);else t.punycode=v})(this)},{}],2:[function(t,e){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,s,i){e=e||"&",s=s||"=";var o={};if("string"!=typeof t||0===t.length)return o;var a=/\+/g;t=t.split(e);var h=1e3;i&&"number"==typeof i.maxKeys&&(h=i.maxKeys);var c=t.length;h>0&&c>h&&(c=h);for(var u=0;c>u;++u){var l,f,p,d,g=t[u].replace(a,"%20"),b=g.indexOf(s);b>=0?(l=g.substr(0,b),f=g.substr(b+1)):(l=g,f=""),p=decodeURIComponent(l),d=decodeURIComponent(f),r(o,p)?n(o[p])?o[p].push(d):o[p]=[o[p],d]:o[p]=d}return o};var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],3:[function(t,e){"use strict";function r(t,e){if(t.map)return t.map(e);for(var r=[],n=0;t.length>n;n++)r.push(e(t[n],n));return r}var n=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};e.exports=function(t,e,o,a){return e=e||"&",o=o||"=",null===t&&(t=void 0),"object"==typeof t?r(i(t),function(r){var i=encodeURIComponent(n(r))+o;return s(t[r])?t[r].map(function(t){return i+encodeURIComponent(n(t))}).join(e):i+encodeURIComponent(n(t[r]))}).join(e):a?encodeURIComponent(n(a))+o+encodeURIComponent(n(t)):""};var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},{}],4:[function(t,e,r){"use strict";r.decode=r.parse=t("./decode"),r.encode=r.stringify=t("./encode")},{"./decode":2,"./encode":3}],DI4pi1:[function(t,e,r){(function(){"use strict";function e(t,e,r){if(t&&"object"==typeof t&&t.href)return t;if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var s={},i=t;i=i.trim();var c=h.exec(i);if(c){c=c[0];var u=c.toLowerCase();s.protocol=u,i=i.substr(c.length)}if(r||c||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var l="//"===i.substr(0,2);!l||c&&v[c]||(i=i.substr(2),s.slashes=!0)}if(!v[c]&&(l||c&&!w[c])){var x=i.indexOf("@");if(-1!==x){for(var _=i.slice(0,x),E=!0,A=0,S=d.length;S>A;A++)if(-1!==_.indexOf(d[A])){E=!1;break}E&&(s.auth=decodeURIComponent(_),i=i.substr(x+1))}for(var L=-1,A=0,S=p.length;S>A;A++){var C=i.indexOf(p[A]);-1!==C&&(0>L||L>C)&&(L=C)}-1!==L?(s.host=i.substr(0,L),i=i.substr(L)):(s.host=i,i="");for(var I=o(s.host),j=Object.keys(I),A=0,S=j.length;S>A;A++){var R=j[A];s[R]=I[R]}s.hostname=s.hostname||"";var B="["===s.hostname[0]&&"]"===s.hostname[s.hostname.length-1];if(s.hostname.length>g)s.hostname="";else if(!B)for(var T=s.hostname.split(/\./),A=0,S=T.length;S>A;A++){var U=T[A];if(U&&!U.match(b)){for(var O="",M=0,q=U.length;q>M;M++)O+=U.charCodeAt(M)>127?"x":U[M];if(!O.match(b)){var D=T.slice(0,A),P=T.slice(A+1),F=U.match(m);F&&(D.push(F[1]),P.unshift(F[2])),P.length&&(i="/"+P.join(".")+i),s.hostname=D.join(".");break}}}if(s.hostname=s.hostname.toLowerCase(),!B){for(var N=s.hostname.split("."),H=[],A=0;N.length>A;++A){var W=N[A];H.push(W.match(/[^A-Za-z0-9_-]/)?"xn--"+a.encode(W):W)}s.hostname=H.join(".")}s.host=(s.hostname||"")+(s.port?":"+s.port:""),s.href+=s.host,B&&(s.hostname=s.hostname.substr(1,s.hostname.length-2),"/"!==i[0]&&(i="/"+i))}if(!y[u])for(var A=0,S=f.length;S>A;A++){var V=f[A],z=encodeURIComponent(V);z===V&&(z=escape(V)),i=i.split(V).join(z)}var J=i.indexOf("#");-1!==J&&(s.hash=i.substr(J),i=i.slice(0,J));var K=i.indexOf("?");return-1!==K?(s.search=i.substr(K),s.query=i.substr(K+1),e&&(s.query=k.parse(s.query)),i=i.slice(0,K)):e&&(s.search="",s.query={}),i&&(s.pathname=i),w[c]&&s.hostname&&!s.pathname&&(s.pathname="/"),(s.pathname||s.search)&&(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.href=n(s),s}function n(t){"string"==typeof t&&(t=e(t));var r=t.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var n=t.protocol||"",s=t.pathname||"",i=t.hash||"",o=!1,a="";void 0!==t.host?o=r+t.host:void 0!==t.hostname&&(o=r+(-1===t.hostname.indexOf(":")?t.hostname:"["+t.hostname+"]"),t.port&&(o+=":"+t.port)),t.query&&"object"==typeof t.query&&Object.keys(t.query).length&&(a=k.stringify(t.query));var h=t.search||a&&"?"+a||"";return n&&":"!==n.substr(-1)&&(n+=":"),t.slashes||(!n||w[n])&&o!==!1?(o="//"+(o||""),s&&"/"!==s.charAt(0)&&(s="/"+s)):o||(o=""),i&&"#"!==i.charAt(0)&&(i="#"+i),h&&"?"!==h.charAt(0)&&(h="?"+h),n+o+s+h+i}function s(t,e){return n(i(t,e))}function i(t,r){if(!t)return r;if(t=e(n(t),!1,!0),r=e(n(r),!1,!0),t.hash=r.hash,""===r.href)return t.href=n(t),t;if(r.slashes&&!r.protocol)return r.protocol=t.protocol,w[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=n(r),r;if(r.protocol&&r.protocol!==t.protocol){if(!w[r.protocol])return r.href=n(r),r;if(t.protocol=r.protocol,!r.host&&!v[r.protocol]){for(var s=(r.pathname||"").split("/");s.length&&!(r.host=s.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),""!==s[0]&&s.unshift(""),2>s.length&&s.unshift(""),r.pathname=s.join("/")}return t.pathname=r.pathname,t.search=r.search,t.query=r.query,t.host=r.host||"",t.auth=r.auth,t.hostname=r.hostname||r.host,t.port=r.port,(void 0!==t.pathname||void 0!==t.search)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.slashes=t.slashes||r.slashes,t.href=n(t),t}var i=t.pathname&&"/"===t.pathname.charAt(0),o=void 0!==r.host||r.pathname&&"/"===r.pathname.charAt(0),a=o||i||t.host&&r.pathname,h=a,c=t.pathname&&t.pathname.split("/")||[],s=r.pathname&&r.pathname.split("/")||[],u=t.protocol&&!w[t.protocol];if(u&&(delete t.hostname,delete t.port,t.host&&(""===c[0]?c[0]=t.host:c.unshift(t.host)),delete t.host,r.protocol&&(delete r.hostname,delete r.port,r.host&&(""===s[0]?s[0]=r.host:s.unshift(r.host)),delete r.host),a=a&&(""===s[0]||""===c[0])),o)t.host=r.host||""===r.host?r.host:t.host,t.hostname=r.hostname||""===r.hostname?r.hostname:t.hostname,t.search=r.search,t.query=r.query,c=s;else if(s.length)c||(c=[]),c.pop(),c=c.concat(s),t.search=r.search,t.query=r.query;else if("search"in r){if(u){t.hostname=t.host=c.shift();var l=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;l&&(t.auth=l.shift(),t.host=t.hostname=l.shift())}return t.search=r.search,t.query=r.query,(void 0!==t.pathname||void 0!==t.search)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=n(t),t}if(!c.length)return delete t.pathname,t.search?delete t.path:t.path="/"+t.search,t.href=n(t),t;for(var f=c.slice(-1)[0],p=(t.host||r.host)&&("."===f||".."===f)||""===f,d=0,g=c.length;g>=0;g--)f=c[g],"."==f?c.splice(g,1):".."===f?(c.splice(g,1),d++):d&&(c.splice(g,1),d--);if(!a&&!h)for(;d--;d)c.unshift("..");!a||""===c[0]||c[0]&&"/"===c[0].charAt(0)||c.unshift(""),p&&"/"!==c.join("/").substr(-1)&&c.push("");var b=""===c[0]||c[0]&&"/"===c[0].charAt(0);if(u){t.hostname=t.host=b?"":c.length?c.shift():"";var l=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;l&&(t.auth=l.shift(),t.host=t.hostname=l.shift())}return a=a||t.host&&c.length,a&&!b&&c.unshift(""),t.pathname=c.join("/"),(void 0!==t.pathname||void 0!==t.search)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=r.auth||t.auth,t.slashes=t.slashes||r.slashes,t.href=n(t),t}function o(t){var e={},r=c.exec(t);return r&&(r=r[0],":"!==r&&(e.port=r.substr(1)),t=t.substr(0,t.length-r.length)),t&&(e.hostname=t),e}var a=t("punycode");r.parse=e,r.resolve=s,r.resolveObject=i,r.format=n;var h=/^([a-z0-9.+-]+:)/i,c=/:[0-9]*$/,u=["<",">",'"',"`"," ","\r","\n"," "],l=["{","}","|","\\","^","~","`"].concat(u),f=["'"].concat(u),p=["%","/","?",";","#"].concat(l).concat(f),d=["/","@","?","#"].concat(u),g=255,b=/^[a-zA-Z0-9][a-z0-9A-Z_-]{0,62}$/,m=/^([a-zA-Z0-9][a-z0-9A-Z_-]{0,62})(.*)$/,y={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=t("querystring")})()},{punycode:1,querystring:4}],url:[function(t,e){e.exports=t("DI4pi1")},{}]},{},[]),require=function e(t,r,n){function s(o,a){if(!r[o]){if(!t[o]){var h="function"==typeof require&&require;if(!a&&h)return h(o,!0);if(i)return i(o,!0);throw Error("Cannot find module '"+o+"'")}var c=r[o]={exports:{}};t[o][0].call(c.exports,function(e){var r=t[o][1][e];return s(r?r:e)},c,c.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;n.length>o;o++)s(n[o]);return s}({"6dchHw":[function(t,e){(function(){var t,r,n;t=e.exports=function(e,n){return r(e)?t.tablifyArrays(e,n):t.tablifyDicts(e,n)},t.tablify=t,t.tablifyArrays=function(t,e){var r,s,i,o;for(r=new n(e),i=0,o=t.length;o>i;i++)s=t[i],r.push(s);return r.stringify()},t.tablifyDicts=function(t,e){var r,s,i,o,a,h,c,u,l,f,p,d,g;if(e=e||{},null==e.has_header&&(e.has_header=!0),null==e.show_index&&(e.show_index=!0),!e.keys){for(a={},c=0,f=t.length;f>c;c++){s=t[c];for(o in s)a[o]=!0}e.keys=function(){var t;t=[];for(o in a)t.push(o);return t}(),e.keys.sort()}for(r=new n(e),e.has_header&&(h=function(){var t,r,n,s;for(n=e.keys,s=[],t=0,r=n.length;r>t;t++)o=n[t],s.push(o);return s}(),r.push(h)),i=u=0,p=t.length;p>u;i=++u){for(s=t[i],h=[],g=e.keys,l=0,d=g.length;d>l;l++)o=g[l],h.push(null!=s[o]?s[o]:null);r.push(h)}return r.stringify()},n=function(){function t(t){this.opts=t||{},this.opts.spacer=null!=this.opts.spacer?this.opts.spacer:" | ",this.opts.row_start=null!=this.opts.row_start?this.opts.spaces:"| ",this.opts.row_end=null!=this.opts.row_end?this.opts.row_end:" |",this.opts.row_sep_char=this.opts.row_sep_char?this.opts.row_sep_char:"-",this.opts.has_header=null!=this.opts.has_header?this.opts.has_header:!1,this.opts.show_index=null!=this.opts.show_index?this.opts.show_index:!1,this.rows=[],this.col_widths=[],this.opts.border===!1&&(t.spacer=" ",this.opts.row_start=this.opts.row_end=this.opts.row_sep_char="")}return t.prototype.push=function(t){var e,r,n,s,i,o,a;for(n=function(){var r,n,s;for(s=[],r=0,n=t.length;n>r;r++)e=t[r],s.push(e);return s}(),this.opts.show_index&&(s=this.rows.length,this.opts.has_header&&s--,0>s?n.splice(0,0,"#"):n.splice(0,0,s)),this.rows.push(n),a=[],r=i=0,o=n.length;o>i;r=++i)e=n[r],null==this.col_widths[r]||this.col_widths[r]<this.len(e)?a.push(this.col_widths[r]=this.len(e)):a.push(void 0);return a},t.prototype.stringify=function(){var t,e,r,n,s,i,o,a,h,c,u,l,f,p,d,g;for(s=[],i=this.opts.row_start.length+this.opts.row_end.length,p=this.col_widths,a=0,u=p.length;u>a;a++)o=p[a],i+=o;for(i+=this.opts.spacer.length*(this.col_widths.length-1),null!=this.opts.row_sep_char&&s.push(this.chars(this.opts.row_sep_char,i)),d=this.rows,e=h=0,l=d.length;l>h;e=++h){for(n=d[e],r=this.opts.row_start,g=this.col_widths,t=c=0,f=g.length;f>c;t=++c)o=g[t],r+=this.ljust(null!=n[t]?n[t]:"",o),this.col_widths.length-1>t&&(r+=this.opts.spacer);r+=this.opts.row_end,s.push(r),this.opts.row_sep_char&&0===e&&this.opts.has_header&&s.push(this.chars(this.opts.row_sep_char,i))}return null!=this.opts.row_sep_char&&s.push(this.chars(this.opts.row_sep_char,i)),s.join("\n")},t.prototype.toStr=function(t){if(null===t)return"null";if(t===void 0)return"";if("object"!=typeof t)return""+t;try{return JSON.stringify(t)}catch(e){return"["+e.message+"]"}},t.prototype.len=function(t){return this.toStr(t).length},t.prototype.chars=function(t,e){var r;return function(){var n,s;for(s=[],r=n=0;e>=0?e>n:n>e;r=e>=0?++n:--n)s.push(t);return s}().join("")},t.prototype.ljust=function(t,e){return""+this.toStr(t)+this.chars(" ",e-this.len(t))},t.prototype.rjust=function(t,e){return""+this.chars(" ",e-this.len(t))+this.toStr(t)},t}(),r=function(t){var e,r,n;for(r=0,n=t.length;n>r;r++)if(e=t[r],!Array.isArray(e))return!1;return!0}}).call(this)},{}],tablify:[function(t,e){e.exports=t("6dchHw")},{}]},{},[]),require=function e(t,r,n){function s(o,a){if(!r[o]){if(!t[o]){var h="function"==typeof require&&require;if(!a&&h)return h(o,!0);if(i)return i(o,!0);throw Error("Cannot find module '"+o+"'")}var c=r[o]={exports:{}};t[o][0].call(c.exports,function(e){var r=t[o][1][e];return s(r?r:e)},c,c.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;n.length>o;o++)s(n[o]);return s}({kjYHdP:[function(t,e){"use strict";function r(t){var e=t.getAttribute("style")||"";t.setAttribute("style",e+"overflow-y: auto; /* white-space: pre; */")}function n(t){t&&(t.scrollTop=t.scrollHeight)}var s=t("./term"),i=t("through");e.exports=function(t){var e=new s(t);e.open();var o=i(e.write.bind(e));return o.appendTo=function(t){"string"==typeof t&&(t=document.querySelector(t)),t.appendChild(e.element),r(t),o.container=t,e.element.style.position="relative"},o.writeln=function(t){e.writeln(t),o.tail&&n(o.container)},o.write=function(t){e.write(t),o.tail&&n(o.container)},o.reset=e.reset.bind(e),o.element=e.element,o.term=e,o}},{"./term":30,through:29}],hypernal:[function(t,e){e.exports=t("kjYHdP")},{}],3:[function(t,e){"use strict";e.exports=function(t){t.prototype.blankLine=function(t){for(var e=t?this.curAttr:this.defAttr,r=[e," "],n=[],s=0;this.cols>s;s++)n[s]=r;return n}}},{}],4:[function(t,e){"use strict";e.exports=function(t){t.charsets={},t.charsets.SCLD={"`":"◆",a:"▒",b:" ",c:"\f",d:"\r",e:"\n",f:"°",g:"±",h:"␤",i:" ",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.charsets.UK=null,t.charsets.US=null,t.charsets.Dutch=null,t.charsets.Finnish=null,t.charsets.French=null,t.charsets.FrenchCanadian=null,t.charsets.German=null,t.charsets.Italian=null,t.charsets.NorwegianDanish=null,t.charsets.Spanish=null,t.charsets.Swedish=null,t.charsets.Swiss=null,t.charsets.ISOLatin=null}},{}],5:[function(t,e){"use strict";e.exports=function(t){t.colors=["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec"],t.colors=function(){function e(t,e,n){s.push("#"+r(t)+r(e)+r(n))}function r(t){return t=t.toString(16),2>t.length?"0"+t:t}var n,s=t.colors,i=[0,95,135,175,215,255];for(n=0;216>n;n++)e(i[0|n/36%6],i[0|n/6%6],i[n%6]);for(n=0;24>n;n++)i=8+10*n,e(i,i,i);return s}(),t.defaultColors={bg:"#000000",fg:"#f0f0f0"},t.colors[256]=t.defaultColors.bg,t.colors[257]=t.defaultColors.fg}},{}],6:[function(t,e){"use strict";e.exports=function(t){t.prototype.charAttributes=function(t){for(var e,r,n,s=t.length,i=0;s>i;i++)if(n=t[i],n>=30&&37>=n)this.curAttr=-261633&this.curAttr|n-30<<9;else if(n>=40&&47>=n)this.curAttr=-512&this.curAttr|n-40;else if(n>=90&&97>=n)n+=8,this.curAttr=-261633&this.curAttr|n-90<<9;else if(n>=100&&107>=n)n+=8,this.curAttr=-512&this.curAttr|n-100;else if(0===n)this.curAttr=this.defAttr;else if(1===n)this.curAttr=this.curAttr|1<<18;else if(4===n)this.curAttr=this.curAttr|2<<18;else if(7===n||27===n){if(7===n){if(4&this.curAttr>>18)continue;this.curAttr=this.curAttr|4<<18}else if(27===n){if(4&~(this.curAttr>>18))continue;this.curAttr=-1048577&this.curAttr}e=511&this.curAttr,r=511&this.curAttr>>9,this.curAttr=-262144&this.curAttr|(e<<9|r)}else if(22===n)this.curAttr=-262145&this.curAttr;else if(24===n)this.curAttr=-524289&this.curAttr;else if(39===n)this.curAttr=-261633&this.curAttr,this.curAttr=this.curAttr|(511&this.defAttr>>9)<<9;else if(49===n)this.curAttr=-512&this.curAttr,this.curAttr=this.curAttr|511&this.defAttr;else if(38===n){if(5!==t[i+1])continue;i+=2,n=255&t[i],this.curAttr=-261633&this.curAttr|n<<9}else if(48===n){if(5!==t[i+1])continue;i+=2,n=255&t[i],this.curAttr=-512&this.curAttr|n}}}},{}],7:[function(t,e){"use strict";e.exports=function(t){t.prototype.saveCursor=function(){this.savedX=this.x,this.savedY=this.y},t.prototype.restoreCursor=function(){this.x=this.savedX||0,this.y=this.savedY||0},t.prototype.cursorUp=function(t){var e=t[0];1>e&&(e=1),this.y-=e,0>this.y&&(this.y=0)},t.prototype.cursorDown=function(t){var e=t[0];1>e&&(e=1),this.y+=e,this.y>=this.rows&&(this.y=this.rows-1)},t.prototype.cursorForward=function(t){var e=t[0];1>e&&(e=1),this.x+=e,this.x>=this.cols&&(this.x=this.cols-1)},t.prototype.cursorBackward=function(t){var e=t[0];1>e&&(e=1),this.x-=e,0>this.x&&(this.x=0)},t.prototype.cursorPos=function(t){var e,r;e=t[0]-1,r=t.length>=2?t[1]-1:0,0>e?e=0:e>=this.rows&&(e=this.rows-1),0>r?r=0:r>=this.cols&&(r=this.cols-1),this.x=r,this.y=e},t.prototype.cursorNextLine=function(t){var e=t[0];1>e&&(e=1),this.y+=e,this.y>=this.rows&&(this.y=this.rows-1),this.x=0},t.prototype.cursorPrecedingLine=function(t){var e=t[0];1>e&&(e=1),this.y-=e,0>this.y&&(this.y=0),this.x=0},t.prototype.cursorCharAbsolute=function(t){var e=t[0];1>e&&(e=1),this.x=e-1},t.prototype.cursorForwardTab=function(t){for(var e=t[0]||1;e--;)this.x=this.nextStop()},t.prototype.cursorBackwardTab=function(t){for(var e=t[0]||1;e--;)this.x=this.prevStop()}}},{}],8:[function(t,e){"use strict";e.exports=function(t){t.prototype.insertChars=function(t){var e,r,n,s;for(e=t[0],1>e&&(e=1),r=this.y+this.ybase,n=this.x,s=[this.curAttr," "];e--&&this.cols>n;)this.lines[r].splice(n++,0,s),this.lines[r].pop()},t.prototype.insertLines=function(t){var e,r,n;for(e=t[0],1>e&&(e=1),r=this.y+this.ybase,n=this.rows-1-this.scrollBottom,n=this.rows-1+this.ybase-n+1;e--;)this.lines.splice(r,0,this.blankLine(!0)),this.lines.splice(n,1);this.updateRange(this.y),this.updateRange(this.scrollBottom)},t.prototype.deleteLines=function(t){var e,r,n;for(e=t[0],1>e&&(e=1),r=this.y+this.ybase,n=this.rows-1-this.scrollBottom,n=this.rows-1+this.ybase-n;e--;)this.lines.splice(n+1,0,this.blankLine(!0)),this.lines.splice(r,1);this.updateRange(this.y),this.updateRange(this.scrollBottom)},t.prototype.deleteChars=function(t){var e,r,n;for(e=t[0],1>e&&(e=1),r=this.y+this.ybase,n=[this.curAttr," "];e--;)this.lines[r].splice(this.x,1),this.lines[r].push(n)},t.prototype.eraseChars=function(t){var e,r,n,s;for(e=t[0],1>e&&(e=1),r=this.y+this.ybase,n=this.x,s=[this.curAttr," "];e--&&this.cols>n;)this.lines[r][n++]=s}}},{}],9:[function(t,e){"use strict";e.exports=function(t){t.prototype.charPosAbsolute=function(t){var e=t[0];1>e&&(e=1),this.x=e-1,this.x>=this.cols&&(this.x=this.cols-1)},t.prototype.HPositionRelative=function(t){var e=t[0];1>e&&(e=1),this.x+=e,this.x>=this.cols&&(this.x=this.cols-1)},t.prototype.linePosAbsolute=function(t){var e=t[0];1>e&&(e=1),this.y=e-1,this.y>=this.rows&&(this.y=this.rows-1)},t.prototype.VPositionRelative=function(t){var e=t[0];1>e&&(e=1),this.y+=e,this.y>=this.rows&&(this.y=this.rows-1)},t.prototype.HVPosition=function(t){1>t[0]&&(t[0]=1),1>t[1]&&(t[1]=1),this.y=t[0]-1,this.y>=this.rows&&(this.y=this.rows-1),this.x=t[1]-1,this.x>=this.cols&&(this.x=this.cols-1)}}},{}],10:[function(t,e){"use strict";e.exports=function(t){t.prototype.repeatPrecedingCharacter=function(t){for(var e=t[0]||1,r=this.lines[this.ybase+this.y],n=r[this.x-1]||[this.defAttr," "];e--;)r[this.x++]=n}}},{}],11:[function(t,e){"use strict";e.exports=function(t){t.prototype.softReset=function(){this.cursorHidden=!1,this.insertMode=!1,this.originMode=!1,this.wraparoundMode=!1,this.applicationKeypad=!1,this.scrollTop=0,this.scrollBottom=this.rows-1,this.curAttr=this.defAttr,this.x=this.y=0,this.charset=null,this.glevel=0,this.charsets=[null]}}},{}],12:[function(t,e){"use strict";e.exports=function(t){t.prototype.tabClear=function(t){var e=t[0];0>=e?delete this.tabs[this.x]:3===e&&(this.tabs={})}}},{}],13:[function(t,e){"use strict";e.exports=function(t){t.prototype.log=function(){if(t.debug&&window.console&&window.console.log){var e=Array.prototype.slice.call(arguments);window.console.log.apply(window.console,e)}},t.prototype.error=function(){if(t.debug&&window.console&&window.console.error){var e=Array.prototype.slice.call(arguments);window.console.error.apply(window.console,e)}}}},{}],14:[function(t,e){"use strict";e.exports=function(t){t.prototype.destroy=function(){this.readable=!1,this.writable=!1,this._events={},this.handler=function(){},this.write=function(){}}}},{}],15:[function(t,e){"use strict";e.exports=function(t){t.prototype.eraseRight=function(t,e){for(var r=this.lines[this.ybase+e],n=[this.curAttr," "];this.cols>t;t++)r[t]=n;this.updateRange(e)},t.prototype.eraseLeft=function(t,e){var r=this.lines[this.ybase+e],n=[this.curAttr," "];for(t++;t--;)r[t]=n;this.updateRange(e)},t.prototype.eraseLine=function(t){this.eraseRight(0,t)},t.prototype.eraseInDisplay=function(t){var e;switch(t[0]){case 0:for(this.eraseRight(this.x,this.y),e=this.y+1;this.rows>e;e++)this.eraseLine(e);break;case 1:for(this.eraseLeft(this.x,this.y),e=this.y;e--;)this.eraseLine(e);break;case 2:for(e=this.rows;e--;)this.eraseLine(e);break;case 3:}},t.prototype.eraseInLine=function(t){switch(t[0]){case 0:this.eraseRight(this.x,this.y);break;case 1:this.eraseLeft(this.x,this.y);break;case 2:this.eraseLine(this.y)}}}},{}],16:[function(t,e){"use strict";var r=t("../states");e.exports=function(t){t.prototype.index=function(){this.y++,this.y>this.scrollBottom&&(this.y--,this.scroll()),this.state=r.normal},t.prototype.reverseIndex=function(){var t;this.y--,this.y<this.scrollTop&&(this.y++,this.lines.splice(this.y+this.ybase,0,this.blankLine(!0)),t=this.rows-1-this.scrollBottom,this.lines.splice(this.rows-1+this.ybase-t+1,1),this.updateRange(this.scrollTop),this.updateRange(this.scrollBottom)),this.state=r.normal}}},{"../states":25}],17:[function(t,e){"use strict";e.exports=function(t){t.prototype.reset=function(){t.call(this,this.cols,this.rows),this.refresh(0,this.rows-1)}}},{}],18:[function(t,e){"use strict";var r=t("../states");e.exports=function(t){t.prototype.tabSet=function(){this.tabs[this.x]=!0,this.state=r.normal}}},{"../states":25}],19:[function(t,e){"use strict";function r(){var t=document.createElement("span");t.innerHTML="hello world",document.body.appendChild(t);var e=t.scrollWidth;t.style.fontWeight="bold";var r=t.scrollWidth;return document.body.removeChild(t),e!==r}e.exports=function(t){t.prototype.open=function(){var e,n=0;for(this.element=document.createElement("div"),this.element.className="terminal",this.children=[];this.rows>n;n++)e=document.createElement("div"),this.element.appendChild(e),this.children.push(e);this.refresh(0,this.rows-1),null===t.brokenBold&&(t.brokenBold=r()),this.element.style.backgroundColor=t.defaultColors.bg,this.element.style.color=t.defaultColors.fg}}},{}],20:[function(t,e){"use strict";e.exports=function(t){t.termName="xterm",t.geometry=[80,24],t.cursorBlink=!0,t.visualBell=!1,t.popOnBell=!1,t.scrollback=1e3,t.screenKeys=!1,t.programFeatures=!1,t.debug=!1}},{}],21:[function(t,e){"use strict";function r(){for(;this.y>=this.rows;){this.lines.push(this.blankLine());var t=document.createElement("div");this.element.appendChild(t),this.children.push(t),this.rows++}}e.exports=function(t){t.prototype.updateRange=function(t){this.refreshStart>t&&(this.refreshStart=t),t>this.refreshEnd&&(this.refreshEnd=t),r.bind(this)()},t.prototype.maxRange=function(){this.refreshStart=0,this.refreshEnd=this.rows-1}}},{}],22:[function(t,e){"use strict";e.exports=function(t){t.prototype.refresh=function(e,r){var n,s,i,o,a,h,c,u,l,f,p,d,g,b;for(c=this.cols,s=e;r>=s;s++){if(g=s+this.ydisp,o=this.lines[g],!o)return this.reset();for(a="",n=s===this.y&&this.cursorState&&this.ydisp===this.ybase&&!this.cursorHidden?this.x:-1,l=this.defAttr,i=0;c>i;i++){switch(u=o[i][0],h=o[i][1],i===n&&(u=-1),u!==l&&(l!==this.defAttr&&(a+="</span>"),u!==this.defAttr&&(-1===u?a+='<span class="reverse-video">':(a+='<span style="',p=511&u,f=511&u>>9,d=u>>18,1&d&&(t.brokenBold||(a+="font-weight:bold;"),8>f&&(f+=8)),2&d&&(a+="text-decoration:underline;"),256!==p&&(a+="background-color:"+t.colors[p]+";"),257!==f&&(a+="color:"+t.colors[f]+";"),a+='">'))),h){case"&":a+="&";break;case"<":a+="<";break;case">":a+=">";break;default:a+=" ">=h?" ":h}l=u}l!==this.defAttr&&(a+="</span>"),this.children[s].innerHTML=a}b&&b.appendChild(this.element)}}},{}],23:[function(t,e){"use strict";e.exports=function(t){t.prototype.setgCharset=function(t,e){this.charsets[t]=e,this.glevel===t&&(this.charset=e)}}},{}],24:[function(t,e){"use strict";e.exports=function(t){t.prototype.setgLevel=function(t){this.glevel=t,this.charset=this.charsets[t]}}},{}],25:[function(t,e){"use strict";e.exports={normal:0,escaped:1,csi:2,osc:3,charset:4,dcs:5,ignore:6}},{}],26:[function(t,e){"use strict";e.exports=function(t){t.prototype.setupStops=function(t){for(null!=t?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);this.cols>t;t+=8)this.tabs[t]=!0},t.prototype.prevStop=function(t){for(null==t&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this.cols?this.cols-1:0>t?0:t},t.prototype.nextStop=function(t){for(null==t&&(t=this.x);!this.tabs[++t]&&this.cols>t;);return t>=this.cols?this.cols-1:0>t?0:t}}},{}],27:[function(t,e){"use strict";e.exports=function(t){t.prototype.ch=function(t){return t?[this.curAttr," "]:[this.defAttr," "]},t.prototype.is=function(e){var r=this.termName||t.termName;return 0===(r+"").indexOf(e)}}},{}],28:[function(t,e){"use strict";function r(t){return t.replace(/([^\r])\n/g,"$1\r\n")}function n(t){return/(^|\n) /.test(t)?t.split("\n").map(function(t){for(var e=0;" "===t.charAt(0);)t=t.slice(1),e++;for(;e--;)t="&nbsp;"+t;return t}).join("\r\n"):t}var s=t("./states");e.exports=function(t){t.prototype.write=function(e){e=r(e),e=n(e);var i,o,a=e.length,h=0;for(this.refreshStart=this.y,this.refreshEnd=this.y,this.ybase!==this.ydisp&&(this.ydisp=this.ybase,this.maxRange());a>h;h++)switch(o=e[h],this.state){case s.normal:switch(o){case"":this.bell();break;case"\n":case" ":case"\f":this.convertEol&&(this.x=0),this.y++;break;case"\r":this.x=0;break;case"\b":this.x>0&&this.x--;break;case" ":this.x=this.nextStop();break;case"":this.setgLevel(1);break;case"":this.setgLevel(0);break;case"":this.state=s.escaped;break;default:o>=" "&&(this.charset&&this.charset[o]&&(o=this.charset[o]),this.x>=this.cols&&(this.x=0,this.y++),this.lines[this.y+this.ybase]&&(this.lines[this.y+this.ybase][this.x]=[this.curAttr,o]),this.x++,this.updateRange(this.y))}break;case s.escaped:switch(o){case"[":this.params=[],this.currentParam=0,this.state=s.csi;break;case"]":this.params=[],this.currentParam=0,this.state=s.osc;break;case"P":this.params=[],this.currentParam=0,this.state=s.dcs;break;case"_":this.stateType="apc",this.state=s.ignore;break;case"^":this.stateType="pm",this.state=s.ignore;break;case"c":this.reset();break;case"E":this.x=0;break;case"D":this.index();break;case"M":this.reverseIndex();break;case"%":this.setgLevel(0),this.setgCharset(0,t.charsets.US),this.state=s.normal,h++;break;case"(":case")":case"*":case"+":case"-":case".":switch(o){case"(":this.gcharset=0;break;case")":this.gcharset=1;break;case"*":this.gcharset=2;break;case"+":this.gcharset=3;break;case"-":this.gcharset=1;break;case".":this.gcharset=2}this.state=s.charset;break;case"/":this.gcharset=3,this.state=s.charset,h--;break;case"N":break;case"O":break;case"n":this.setgLevel(2);break;case"o":this.setgLevel(3);break;case"|":this.setgLevel(3);break;case"}":this.setgLevel(2);break;case"~":this.setgLevel(1);break;case"7":this.saveCursor(),this.state=s.normal;break;case"8":this.restoreCursor(),this.state=s.normal;break;case"#":this.state=s.normal,h++;break;case"H":this.tabSet();break;case"=":this.log("Serial port requested application keypad."),this.applicationKeypad=!0,this.state=s.normal;break;case">":this.log("Switching back to normal keypad."),this.applicationKeypad=!1,this.state=s.normal;break;default:this.state=s.normal,this.error("Unknown ESC control: %s.",o)}break;case s.charset:switch(o){case"0":i=t.charsets.SCLD;break;case"A":i=t.charsets.UK;break;case"B":i=t.charsets.US;break;case"4":i=t.charsets.Dutch;break;case"C":case"5":i=t.charsets.Finnish;break;case"R":i=t.charsets.French;break;case"Q":i=t.charsets.FrenchCanadian;break;case"K":i=t.charsets.German;break;case"Y":i=t.charsets.Italian;break;case"E":case"6":i=t.charsets.NorwegianDanish;break;case"Z":i=t.charsets.Spanish;break;case"H":case"7":i=t.charsets.Swedish;break;case"=":i=t.charsets.Swiss;break;case"/":i=t.charsets.ISOLatin,h++;break;default:i=t.charsets.US}this.setgCharset(this.gcharset,i),this.gcharset=null,this.state=s.normal;break;case s.osc:if(""===o||""===o){switch(""===o&&h++,this.params.push(this.currentParam),this.params[0]){case 0:case 1:case 2:this.params[1]&&(this.title=this.params[1],this.handleTitle(this.title));break;case 3:break;case 4:case 5:break;case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:break;case 46:break;case 50:break;case 51:break;case 52:break;case 104:case 105:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:}this.params=[],this.currentParam=0,this.state=s.normal}else this.params.length?this.currentParam+=o:o>="0"&&"9">=o?this.currentParam=10*this.currentParam+o.charCodeAt(0)-48:";"===o&&(this.params.push(this.currentParam),this.currentParam="");break;case s.csi:if("?"===o||">"===o||"!"===o){this.prefix=o;break}if(o>="0"&&"9">=o){this.currentParam=10*this.currentParam+o.charCodeAt(0)-48;break}if("$"===o||'"'===o||" "===o||"'"===o){this.postfix=o;break}if(this.params.push(this.currentParam),this.currentParam=0,";"===o)break;
switch(this.state=s.normal,o){case"A":this.cursorUp(this.params);break;case"B":this.cursorDown(this.params);break;case"C":this.cursorForward(this.params);break;case"D":this.cursorBackward(this.params);break;case"H":this.cursorPos(this.params);break;case"J":this.eraseInDisplay(this.params);break;case"K":this.eraseInLine(this.params);break;case"m":this.charAttributes(this.params);break;case"n":this.deviceStatus(this.params);break;case"@":this.insertChars(this.params);break;case"E":this.cursorNextLine(this.params);break;case"F":this.cursorPrecedingLine(this.params);break;case"G":this.cursorCharAbsolute(this.params);break;case"L":this.insertLines(this.params);break;case"M":this.deleteLines(this.params);break;case"P":this.deleteChars(this.params);break;case"X":this.eraseChars(this.params);break;case"`":this.charPosAbsolute(this.params);break;case"a":this.HPositionRelative(this.params);break;case"c":break;case"d":this.linePosAbsolute(this.params);break;case"e":this.VPositionRelative(this.params);break;case"f":this.HVPosition(this.params);break;case"h":break;case"l":break;case"r":break;case"s":this.saveCursor(this.params);break;case"u":this.restoreCursor(this.params);break;case"I":this.cursorForwardTab(this.params);break;case"S":break;case"T":2>this.params.length&&!this.prefix;break;case"Z":this.cursorBackwardTab(this.params);break;case"b":this.repeatPrecedingCharacter(this.params);break;case"g":this.tabClear(this.params);break;case"p":switch(this.prefix){case"!":this.softReset(this.params)}break;default:this.error("Unknown CSI code: %s.",o)}this.prefix="",this.postfix="";break;case s.dcs:if(""===o||""===o){switch(""===o&&h++,this.prefix){case"":break;case"$q":var c=this.currentParam;switch(c){case'"q':c='0"q';break;case'"p':c='61"p';break;case"r":c=""+(this.scrollTop+1)+";"+(this.scrollBottom+1)+"r";break;case"m":c="0m";break;default:this.error("Unknown DCS Pt: %s.",c),c=""}break;case"+p":break;default:this.error("Unknown DCS prefix: %s.",this.prefix)}this.currentParam=0,this.prefix="",this.state=s.normal}else this.currentParam?this.currentParam+=o:this.prefix||"$"===o||"+"===o?2===this.prefix.length?this.currentParam=o:this.prefix+=o:this.currentParam=o;break;case s.ignore:""===o||""===o?(""===o&&h++,this.stateData="",this.state=s.normal):(this.stateData||(this.stateData=""),this.stateData+=o)}this.updateRange(this.y),this.refresh(this.refreshStart,this.refreshEnd)},t.prototype.writeln=function(t){t=t.replace(/ /g,"&nbsp;"),this.write(t+" \r\n")}}},{"./states":25}],29:[function(t,e,r){function n(t,e,r){function n(){for(;c.length&&!l.paused;){var t=c.shift();if(null===t)return l.emit("end");l.emit("data",t)}}function o(){l.writable=!1,e.call(l),!l.readable&&l.autoDestroy&&l.destroy()}t=t||function(t){this.queue(t)},e=e||function(){this.queue(null)};var a=!1,h=!1,c=[],u=!1,l=new i;return l.readable=l.writable=!0,l.paused=!1,l.autoDestroy=!(r&&r.autoDestroy===!1),l.write=function(e){return t.call(this,e),!l.paused},l.queue=l.push=function(t){return u?l:(null==t&&(u=!0),c.push(t),n(),l)},l.on("end",function(){l.readable=!1,!l.writable&&l.autoDestroy&&s.nextTick(function(){l.destroy()})}),l.end=function(t){return a?void 0:(a=!0,arguments.length&&l.write(t),o(),l)},l.destroy=function(){return h?void 0:(h=!0,a=!0,c.length=0,l.writable=l.readable=!1,l.emit("close"),l)},l.pause=function(){return l.paused?void 0:(l.paused=!0,l)},l.resume=function(){return l.paused&&(l.paused=!1,l.emit("resume")),n(),l.paused||l.emit("drain"),l},l}var s=t("__browserify_process"),i=t("stream");r=e.exports=n,n.through=n},{__browserify_process:33,stream:37}],30:[function(t,e){"use strict";function r(t){if(t=t||{},!(this instanceof r))return new r(t);this.cols=t.cols||500,this.rows=t.rows||100,this.ybase=0,this.ydisp=0,this.x=0,this.y=0,this.cursorState=0,this.cursorHidden=!1,this.convertEol=!1,this.state=n.normal,this.queue="",this.scrollTop=0,this.scrollBottom=this.rows-1,this.applicationKeypad=!1,this.originMode=!1,this.insertMode=!1,this.wraparoundMode=!1,this.normal=null,this.charset=null,this.gcharset=null,this.glevel=0,this.charsets=[null],this.element,this.children,this.refreshStart,this.refreshEnd,this.savedX,this.savedY,this.savedCols,this.readable=!0,this.writable=!0,this.defAttr=131840,this.curAttr=this.defAttr,this.params=[],this.currentParam=0,this.prefix="",this.postfix="",this.lines=[];for(var e=this.rows;e--;)this.lines.push(this.blankLine());this.tabs,this.setupStops()}var n=t("./lib/states");e.exports=r,t("./lib/colors")(r),t("./lib/options")(r),t("./lib/open")(r),t("./lib/destroy")(r),t("./lib/refresh")(r),t("./lib/write")(r),t("./lib/setgLevel"),t("./lib/setgCharset"),t("./lib/debug")(r),t("./lib/stops")(r),t("./lib/erase")(r),t("./lib/blankLine")(r),t("./lib/range")(r),t("./lib/util")(r),t("./lib/esc/index.js")(r),t("./lib/esc/reset.js")(r),t("./lib/esc/tabSet.js")(r),t("./lib/csi/charAttributes")(r),t("./lib/csi/insert-delete")(r),t("./lib/csi/position")(r),t("./lib/csi/cursor")(r),t("./lib/csi/repeatPrecedingCharacter")(r),t("./lib/csi/tabClear")(r),t("./lib/csi/softReset")(r),t("./lib/charsets.js")(r)},{"./lib/blankLine":3,"./lib/charsets.js":4,"./lib/colors":5,"./lib/csi/charAttributes":6,"./lib/csi/cursor":7,"./lib/csi/insert-delete":8,"./lib/csi/position":9,"./lib/csi/repeatPrecedingCharacter":10,"./lib/csi/softReset":11,"./lib/csi/tabClear":12,"./lib/debug":13,"./lib/destroy":14,"./lib/erase":15,"./lib/esc/index.js":16,"./lib/esc/reset.js":17,"./lib/esc/tabSet.js":18,"./lib/open":19,"./lib/options":20,"./lib/range":21,"./lib/refresh":22,"./lib/setgCharset":23,"./lib/setgLevel":24,"./lib/states":25,"./lib/stops":26,"./lib/util":27,"./lib/write":28}],31:[function(t,e,r){var n=t("__browserify_process");n.EventEmitter||(n.EventEmitter=function(){});var s=r.EventEmitter=n.EventEmitter,i="function"==typeof Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o=10;s.prototype.setMaxListeners=function(t){this._events||(this._events={}),this._events.maxListeners=t},s.prototype.emit=function(t){if("error"===t&&(!this._events||!this._events.error||i(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var e=this._events[t];if(!e)return!1;if("function"==typeof e){switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:var r=Array.prototype.slice.call(arguments,1);e.apply(this,r)}return!0}if(i(e)){for(var r=Array.prototype.slice.call(arguments,1),n=e.slice(),s=0,o=n.length;o>s;s++)n[s].apply(this,r);return!0}return!1},s.prototype.addListener=function(t,e){if("function"!=typeof e)throw Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",t,e),this._events[t])if(i(this._events[t])){if(!this._events[t].warned){var r;r=void 0!==this._events.maxListeners?this._events.maxListeners:o,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),console.trace())}this._events[t].push(e)}else this._events[t]=[this._events[t],e];else this._events[t]=e;return this},s.prototype.on=s.prototype.addListener,s.prototype.once=function(t,e){var r=this;return r.on(t,function n(){r.removeListener(t,n),e.apply(this,arguments)}),this},s.prototype.removeListener=function(t,e){if("function"!=typeof e)throw Error("removeListener only takes instances of Function");if(!this._events||!this._events[t])return this;var r=this._events[t];if(i(r)){var n=r.indexOf(e);if(0>n)return this;r.splice(n,1),0==r.length&&delete this._events[t]}else this._events[t]===e&&delete this._events[t];return this},s.prototype.removeAllListeners=function(t){return t&&this._events&&this._events[t]&&(this._events[t]=null),this},s.prototype.listeners=function(t){return this._events||(this._events={}),this._events[t]||(this._events[t]=[]),i(this._events[t])||(this._events[t]=[this._events[t]]),this._events[t]}},{__browserify_process:33}],32:[function(t,e){e.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],33:[function(t,e){var r=e.exports={};r.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var r=[];return window.addEventListener("message",function(t){if(t.source===window&&"process-tick"===t.data&&(t.stopPropagation(),r.length>0)){var e=r.shift();e()}},!0),function(t){r.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.binding=function(){throw Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw Error("process.chdir is not supported")}},{}],34:[function(t,e,r){function n(t,e){var r=typeof t;if("base64"===e&&"string"===r)for(t=he(t);0!==t.length%4;)t+="=";var s;if("number"===r)s=pe(t);else if("string"===r)s=n.byteLength(t,e);else{if("object"!==r)throw Error("First argument needs to be a number, array or string.");s=pe(t.length)}var i=le(new Uint8Array(s));if(n.isBuffer(t))i.set(t);else if(de(t))for(var o=0;s>o;o++)i[o]=n.isBuffer(t)?t.readUInt8(o):t[o];else"string"===r&&i.write(t,0,e);return i}function s(t,e,r,s){r=Number(r)||0;var i=t.length-r;s?(s=Number(s),s>i&&(s=i)):s=i;var o=e.length;if(0!==o%2)throw Error("Invalid hex string");s>o/2&&(s=o/2);for(var a=0;s>a;a++){var h=parseInt(e.substr(2*a,2),16);if(isNaN(h))throw Error("Invalid hex string");t[r+a]=h}return n._charsWritten=2*a,a}function i(t,e,r,s){return n._charsWritten=ve(be(e),t,r,s)}function o(t,e,r,s){return n._charsWritten=ve(me(e),t,r,s)}function a(t,e,r,n){return o(t,e,r,n)}function h(t,e,r,s){return n._charsWritten=ve(ye(e),t,r,s)}function c(t,e,r,n){if(isFinite(e))isFinite(r)||(n=r,r=void 0);else{var c=n;n=e,e=r,r=c}e=Number(e)||0;var u=this.length-e;switch(r?(r=Number(r),r>u&&(r=u)):r=u,n=((n||"utf8")+"").toLowerCase()){case"hex":return s(this,t,e,r);case"utf8":case"utf-8":return i(this,t,e,r);case"ascii":return o(this,t,e,r);case"binary":return a(this,t,e,r);case"base64":return h(this,t,e,r);default:throw Error("Unknown encoding")}}function u(t,e,r){var n=this instanceof ue?this._proxy:this;if(t=((t||"utf8")+"").toLowerCase(),e=Number(e)||0,r=void 0!==r?Number(r):r=n.length,r===e)return"";switch(t){case"hex":return m(n,e,r);case"utf8":case"utf-8":return d(n,e,r);case"ascii":return g(n,e,r);case"binary":return b(n,e,r);case"base64":return p(n,e,r);default:throw Error("Unknown encoding")}}function l(){return{type:"Buffer",data:Array.prototype.slice.call(this,0)}}function f(t,e,r,n){var s=this;if(r||(r=0),n||0===n||(n=this.length),e||(e=0),n!==r&&0!==t.length&&0!==s.length){if(r>n)throw Error("sourceEnd < sourceStart");if(0>e||e>=t.length)throw Error("targetStart out of bounds");if(0>r||r>=s.length)throw Error("sourceStart out of bounds");if(0>n||n>s.length)throw Error("sourceEnd out of bounds");n>this.length&&(n=this.length),n-r>t.length-e&&(n=t.length-e+r);for(var i=0;n-r>i;i++)t[i+e]=this[i+r]}}function p(e,r,n){var s=e.slice(r,n);return t("base64-js").fromByteArray(s)}function d(t,e,r){for(var n=t.slice(e,r),s="",i="",o=0;n.length>o;)127>=n[o]?(s+=we(i)+String.fromCharCode(n[o]),i=""):i+="%"+n[o].toString(16),o++;return s+we(i)}function g(t,e,r){for(var n=t.slice(e,r),s="",i=0;n.length>i;i++)s+=String.fromCharCode(n[i]);return s}function b(t,e,r){return g(t,e,r)}function m(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var s="",i=e;r>i;i++)s+=ge(t[i]);return s}function y(t,e){var r=this.length;return t=fe(t,r,0),e=fe(e,r,r),le(this.subarray(t,e))}function v(t,e){var r=this;return e||(Ee(void 0!==t&&null!==t,"missing offset"),Ee(r.length>t,"Trying to read beyond buffer length")),t>=r.length?void 0:r[t]}function w(t,e,r,n){n||(Ee("boolean"==typeof r,"missing or invalid endian"),Ee(void 0!==e&&null!==e,"missing offset"),Ee(t.length>e+1,"Trying to read beyond buffer length"));var s=t.length;if(!(e>=s)){if(e+1===s){var i=new DataView(new ArrayBuffer(2));return i.setUint8(0,t[s-1]),i.getUint16(0,r)}return t._dataview.getUint16(e,r)}}function k(t,e){return w(this,t,!0,e)}function x(t,e){return w(this,t,!1,e)}function _(t,e,r,n){n||(Ee("boolean"==typeof r,"missing or invalid endian"),Ee(void 0!==e&&null!==e,"missing offset"),Ee(t.length>e+3,"Trying to read beyond buffer length"));var s=t.length;if(!(e>=s)){if(e+3>=s){for(var i=new DataView(new ArrayBuffer(4)),o=0;s>o+e;o++)i.setUint8(o,t[o+e]);return i.getUint32(0,r)}return t._dataview.getUint32(e,r)}}function E(t,e){return _(this,t,!0,e)}function A(t,e){return _(this,t,!1,e)}function S(t,e){var r=this;return e||(Ee(void 0!==t&&null!==t,"missing offset"),Ee(r.length>t,"Trying to read beyond buffer length")),t>=r.length?void 0:r._dataview.getInt8(t)}function L(t,e,r,n){n||(Ee("boolean"==typeof r,"missing or invalid endian"),Ee(void 0!==e&&null!==e,"missing offset"),Ee(t.length>e+1,"Trying to read beyond buffer length"));var s=t.length;if(!(e>=s)){if(e+1===s){var i=new DataView(new ArrayBuffer(2));return i.setUint8(0,t[s-1]),i.getInt16(0,r)}return t._dataview.getInt16(e,r)}}function C(t,e){return L(this,t,!0,e)}function I(t,e){return L(this,t,!1,e)}function j(t,e,r,n){n||(Ee("boolean"==typeof r,"missing or invalid endian"),Ee(void 0!==e&&null!==e,"missing offset"),Ee(t.length>e+3,"Trying to read beyond buffer length"));var s=t.length;if(!(e>=s)){if(e+3>=s){for(var i=new DataView(new ArrayBuffer(4)),o=0;s>o+e;o++)i.setUint8(o,t[o+e]);return i.getInt32(0,r)}return t._dataview.getInt32(e,r)}}function R(t,e){return j(this,t,!0,e)}function B(t,e){return j(this,t,!1,e)}function T(t,e,r,n){return n||(Ee("boolean"==typeof r,"missing or invalid endian"),Ee(t.length>e+3,"Trying to read beyond buffer length")),t._dataview.getFloat32(e,r)}function U(t,e){return T(this,t,!0,e)}function O(t,e){return T(this,t,!1,e)}function M(t,e,r,n){return n||(Ee("boolean"==typeof r,"missing or invalid endian"),Ee(t.length>e+7,"Trying to read beyond buffer length")),t._dataview.getFloat64(e,r)}function q(t,e){return M(this,t,!0,e)}function D(t,e){return M(this,t,!1,e)}function P(t,e,r){var n=this;r||(Ee(void 0!==t&&null!==t,"missing value"),Ee(void 0!==e&&null!==e,"missing offset"),Ee(n.length>e,"trying to write beyond buffer length"),ke(t,255)),e>=n.length||(n[e]=t)}function F(t,e,r,n,s){s||(Ee(void 0!==e&&null!==e,"missing value"),Ee("boolean"==typeof n,"missing or invalid endian"),Ee(void 0!==r&&null!==r,"missing offset"),Ee(t.length>r+1,"trying to write beyond buffer length"),ke(e,65535));var i=t.length;if(!(r>=i))if(r+1===i){var o=new DataView(new ArrayBuffer(2));o.setUint16(0,e,n),t[r]=o.getUint8(0)}else t._dataview.setUint16(r,e,n)}function N(t,e,r){F(this,t,e,!0,r)}function H(t,e,r){F(this,t,e,!1,r)}function W(t,e,r,n,s){s||(Ee(void 0!==e&&null!==e,"missing value"),Ee("boolean"==typeof n,"missing or invalid endian"),Ee(void 0!==r&&null!==r,"missing offset"),Ee(t.length>r+3,"trying to write beyond buffer length"),ke(e,4294967295));var i=t.length;if(!(r>=i))if(r+3>=i){var o=new DataView(new ArrayBuffer(4));o.setUint32(0,e,n);for(var a=0;i>a+r;a++)t[a+r]=o.getUint8(a)}else t._dataview.setUint32(r,e,n)}function V(t,e,r){W(this,t,e,!0,r)}function z(t,e,r){W(this,t,e,!1,r)}function J(t,e,r){var n=this;r||(Ee(void 0!==t&&null!==t,"missing value"),Ee(void 0!==e&&null!==e,"missing offset"),Ee(n.length>e,"Trying to write beyond buffer length"),xe(t,127,-128)),e>=n.length||n._dataview.setInt8(e,t)}function K(t,e,r,n,s){s||(Ee(void 0!==e&&null!==e,"missing value"),Ee("boolean"==typeof n,"missing or invalid endian"),Ee(void 0!==r&&null!==r,"missing offset"),Ee(t.length>r+1,"Trying to write beyond buffer length"),xe(e,32767,-32768));var i=t.length;if(!(r>=i))if(r+1===i){var o=new DataView(new ArrayBuffer(2));o.setInt16(0,e,n),t[r]=o.getUint8(0)}else t._dataview.setInt16(r,e,n)}function X(t,e,r){K(this,t,e,!0,r)}function Y(t,e,r){K(this,t,e,!1,r)}function G(t,e,r,n,s){s||(Ee(void 0!==e&&null!==e,"missing value"),Ee("boolean"==typeof n,"missing or invalid endian"),Ee(void 0!==r&&null!==r,"missing offset"),Ee(t.length>r+3,"Trying to write beyond buffer length"),xe(e,2147483647,-2147483648));var i=t.length;if(!(r>=i))if(r+3>=i){var o=new DataView(new ArrayBuffer(4));o.setInt32(0,e,n);for(var a=0;i>a+r;a++)t[a+r]=o.getUint8(a)}else t._dataview.setInt32(r,e,n)}function Z(t,e,r){G(this,t,e,!0,r)}function $(t,e,r){G(this,t,e,!1,r)}function Q(t,e,r,n,s){s||(Ee(void 0!==e&&null!==e,"missing value"),Ee("boolean"==typeof n,"missing or invalid endian"),Ee(void 0!==r&&null!==r,"missing offset"),Ee(t.length>r+3,"Trying to write beyond buffer length"),_e(e,3.4028234663852886e38,-3.4028234663852886e38));var i=t.length;if(!(r>=i))if(r+3>=i){var o=new DataView(new ArrayBuffer(4));o.setFloat32(0,e,n);for(var a=0;i>a+r;a++)t[a+r]=o.getUint8(a)}else t._dataview.setFloat32(r,e,n)}function te(t,e,r){Q(this,t,e,!0,r)}function ee(t,e,r){Q(this,t,e,!1,r)}function re(t,e,r,n,s){s||(Ee(void 0!==e&&null!==e,"missing value"),Ee("boolean"==typeof n,"missing or invalid endian"),Ee(void 0!==r&&null!==r,"missing offset"),Ee(t.length>r+7,"Trying to write beyond buffer length"),_e(e,1.7976931348623157e308,-1.7976931348623157e308));var i=t.length;if(!(r>=i))if(r+7>=i){var o=new DataView(new ArrayBuffer(8));o.setFloat64(0,e,n);for(var a=0;i>a+r;a++)t[a+r]=o.getUint8(a)}else t._dataview.setFloat64(r,e,n)}function ne(t,e,r){re(this,t,e,!0,r)}function se(t,e,r){re(this,t,e,!1,r)}function ie(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),"string"==typeof t&&(t=t.charCodeAt(0)),"number"!=typeof t||isNaN(t))throw Error("value is not a number");if(e>r)throw Error("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw Error("start out of bounds");if(0>r||r>this.length)throw Error("end out of bounds");for(var n=e;r>n;n++)this[n]=t}}function oe(){for(var t=[],e=this.length,n=0;e>n;n++)if(t[n]=ge(this[n]),n===r.INSPECT_MAX_BYTES){t[n+1]="...";break}return"<Buffer "+t.join(" ")+">"}function ae(){return new n(this).buffer}function he(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ce(){var t=new Uint8Array(0);t.foo=function(){return 42};try{return 42===t.foo()}catch(e){return!1}}function ue(t){this._arr=t,0!==t.byteLength&&(this._dataview=new DataView(t.buffer,t.byteOffset,t.byteLength))}function le(t){if(void 0===Ae&&(Ae=ce()),Ae)return t.write=c,t.toString=u,t.toLocaleString=u,t.toJSON=l,t.copy=f,t.slice=y,t.readUInt8=v,t.readUInt16LE=k,t.readUInt16BE=x,t.readUInt32LE=E,t.readUInt32BE=A,t.readInt8=S,t.readInt16LE=C,t.readInt16BE=I,t.readInt32LE=R,t.readInt32BE=B,t.readFloatLE=U,t.readFloatBE=O,t.readDoubleLE=q,t.readDoubleBE=D,t.writeUInt8=P,t.writeUInt16LE=N,t.writeUInt16BE=H,t.writeUInt32LE=V,t.writeUInt32BE=z,t.writeInt8=J,t.writeInt16LE=X,t.writeInt16BE=Y,t.writeInt32LE=Z,t.writeInt32BE=$,t.writeFloatLE=te,t.writeFloatBE=ee,t.writeDoubleLE=ne,t.writeDoubleBE=se,t.fill=ie,t.inspect=oe,t.toArrayBuffer=ae,t._isBuffer=!0,0!==t.byteLength&&(t._dataview=new DataView(t.buffer,t.byteOffset,t.byteLength)),t;var e=new ue(t),r=new Proxy(e,Se);return e._proxy=r,r}function fe(t,e,r){return"number"!=typeof t?r:(t=~~t,t>=e?e:t>=0?t:(t+=e,t>=0?t:0))}function pe(t){return t=~~Math.ceil(+t),0>t?0:t}function de(t){return Array.isArray(t)||n.isBuffer(t)||t&&"object"==typeof t&&"number"==typeof t.length}function ge(t){return 16>t?"0"+t.toString(16):t.toString(16)}function be(t){for(var e=[],r=0;t.length>r;r++)if(127>=t.charCodeAt(r))e.push(t.charCodeAt(r));else for(var n=encodeURIComponent(t.charAt(r)).substr(1).split("%"),s=0;n.length>s;s++)e.push(parseInt(n[s],16));return e}function me(t){for(var e=[],r=0;t.length>r;r++)e.push(255&t.charCodeAt(r));return e}function ye(e){return t("base64-js").toByteArray(e)}function ve(t,e,r,n){for(var s=0;n>s&&!(s+r>=e.length||s>=t.length);)e[s+r]=t[s],s++;return s}function we(t){try{return decodeURIComponent(t)}catch(e){return String.fromCharCode(65533)}}function ke(t,e){Ee("number"==typeof t,"cannot write a non-number as a number"),Ee(t>=0,"specified a negative value for writing an unsigned value"),Ee(e>=t,"value is larger than maximum value for type"),Ee(Math.floor(t)===t,"value has a fractional component")}function xe(t,e,r){Ee("number"==typeof t,"cannot write a non-number as a number"),Ee(e>=t,"value larger than maximum allowed value"),Ee(t>=r,"value smaller than minimum allowed value"),Ee(Math.floor(t)===t,"value has a fractional component")}function _e(t,e,r){Ee("number"==typeof t,"cannot write a non-number as a number"),Ee(e>=t,"value larger than maximum allowed value"),Ee(t>=r,"value smaller than minimum allowed value")}function Ee(t,e){if(!t)throw Error(e||"Failed assertion")}r.Buffer=n,r.SlowBuffer=n,r.INSPECT_MAX_BYTES=50,n.poolSize=8192;var Ae;n.isEncoding=function(t){switch((t+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},n.isBuffer=function(t){return t&&t._isBuffer},n.byteLength=function(t,e){switch(e||"utf8"){case"hex":return t.length/2;case"utf8":case"utf-8":return be(t).length;case"ascii":case"binary":return t.length;case"base64":return ye(t).length;default:throw Error("Unknown encoding")}},n.concat=function(t,e){if(!Array.isArray(t))throw Error("Usage: Buffer.concat(list, [totalLength])\nlist should be an Array.");var r,s;if(0===t.length)return new n(0);if(1===t.length)return t[0];if("number"!=typeof e)for(e=0,r=0;t.length>r;r++)s=t[r],e+=s.length;var i=new n(e),o=0;for(r=0;t.length>r;r++)s=t[r],s.copy(i,o),o+=s.length;return i},ue.prototype.write=c,ue.prototype.toString=u,ue.prototype.toLocaleString=u,ue.prototype.toJSON=l,ue.prototype.copy=f,ue.prototype.slice=y,ue.prototype.readUInt8=v,ue.prototype.readUInt16LE=k,ue.prototype.readUInt16BE=x,ue.prototype.readUInt32LE=E,ue.prototype.readUInt32BE=A,ue.prototype.readInt8=S,ue.prototype.readInt16LE=C,ue.prototype.readInt16BE=I,ue.prototype.readInt32LE=R,ue.prototype.readInt32BE=B,ue.prototype.readFloatLE=U,ue.prototype.readFloatBE=O,ue.prototype.readDoubleLE=q,ue.prototype.readDoubleBE=D,ue.prototype.writeUInt8=P,ue.prototype.writeUInt16LE=N,ue.prototype.writeUInt16BE=H,ue.prototype.writeUInt32LE=V,ue.prototype.writeUInt32BE=z,ue.prototype.writeInt8=J,ue.prototype.writeInt16LE=X,ue.prototype.writeInt16BE=Y,ue.prototype.writeInt32LE=Z,ue.prototype.writeInt32BE=$,ue.prototype.writeFloatLE=te,ue.prototype.writeFloatBE=ee,ue.prototype.writeDoubleLE=ne,ue.prototype.writeDoubleBE=se,ue.prototype.fill=ie,ue.prototype.inspect=oe,ue.prototype.toArrayBuffer=ae,ue.prototype._isBuffer=!0,ue.prototype.subarray=function(){return this._arr.subarray.apply(this._arr,arguments)},ue.prototype.set=function(){return this._arr.set.apply(this._arr,arguments)};var Se={get:function(t,e){return e in t?t[e]:t._arr[e]},set:function(t,e,r){t._arr[e]=r}}},{"base64-js":35}],35:[function(t,e){(function(){"use strict";function t(t){var e,r,s,i,o,a;if(t.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(o=t.indexOf("="),o=o>0?t.length-o:0,a=[],s=o>0?t.length-4:t.length,e=0,r=0;s>e;e+=4,r+=3)i=n.indexOf(t[e])<<18|n.indexOf(t[e+1])<<12|n.indexOf(t[e+2])<<6|n.indexOf(t[e+3]),a.push((16711680&i)>>16),a.push((65280&i)>>8),a.push(255&i);return 2===o?(i=n.indexOf(t[e])<<2|n.indexOf(t[e+1])>>4,a.push(255&i)):1===o&&(i=n.indexOf(t[e])<<10|n.indexOf(t[e+1])<<4|n.indexOf(t[e+2])>>2,a.push(255&i>>8),a.push(255&i)),a}function r(t){function e(t){return n[63&t>>18]+n[63&t>>12]+n[63&t>>6]+n[63&t]}var r,s,i,o=t.length%3,a="";for(r=0,i=t.length-o;i>r;r+=3)s=(t[r]<<16)+(t[r+1]<<8)+t[r+2],a+=e(s);switch(o){case 1:s=t[t.length-1],a+=n[s>>2],a+=n[63&s<<4],a+="==";break;case 2:s=(t[t.length-2]<<8)+t[t.length-1],a+=n[s>>10],a+=n[63&s>>4],a+=n[63&s<<2],a+="="}return a}var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";e.exports.toByteArray=t,e.exports.fromByteArray=r})()},{}],36:[function(t,e){function r(t){return this instanceof r?(o.call(this,t),a.call(this,t),t&&t.readable===!1&&(this.readable=!1),t&&t.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,t&&t.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",n),void 0):new r(t)}function n(){if(!this.allowHalfOpen&&!this._writableState.ended){var t=this;i(function(){t.end()})}}e.exports=r;var s=t("inherits"),i=t("setimmediate"),o=t("./readable.js"),a=t("./writable.js");s(r,o),r.prototype.pipe=a.prototype.pipe,r.prototype.write=a.prototype.write,r.prototype.end=a.prototype.end,r.prototype._write=a.prototype._write},{"./readable.js":40,"./writable.js":42,inherits:32,setimmediate:38}],37:[function(t,e){function r(){n.call(this)}e.exports=r;var n=t("events").EventEmitter,s=t("inherits");s(r,n),r.Readable=t("./readable.js"),r.Writable=t("./writable.js"),r.Duplex=t("./duplex.js"),r.Transform=t("./transform.js"),r.PassThrough=t("./passthrough.js"),r.Stream=r,r.prototype.pipe=function(t,e){function r(e){t.writable&&!1===t.write(e)&&c.pause&&c.pause()}function s(){c.readable&&c.resume&&c.resume()}function i(){u||(u=!0,t.end())}function o(){u||(u=!0,"function"==typeof t.destroy&&t.destroy())}function a(t){if(h(),0===n.listenerCount(this,"error"))throw t}function h(){c.removeListener("data",r),t.removeListener("drain",s),c.removeListener("end",i),c.removeListener("close",o),c.removeListener("error",a),t.removeListener("error",a),c.removeListener("end",h),c.removeListener("close",h),t.removeListener("close",h)}var c=this;c.on("data",r),t.on("drain",s),t._isStdio||e&&e.end===!1||(c.on("end",i),c.on("close",o));var u=!1;return c.on("error",a),t.on("error",a),c.on("end",h),c.on("close",h),t.on("close",h),t.emit("pipe",c),t}},{"./duplex.js":36,"./passthrough.js":39,"./readable.js":40,"./transform.js":41,"./writable.js":42,events:31,inherits:32}],38:[function(require,module,exports){var process=require("__browserify_process"),global="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};(function(global,undefined){"use strict";function canUseNextTick(){return"object"==typeof process&&"[object process]"===Object.prototype.toString.call(process)}function canUseMessageChannel(){return!!global.MessageChannel}function canUsePostMessage(){if(!global.postMessage||global.importScripts)return!1;var t=!0,e=global.onmessage;return global.onmessage=function(){t=!1},global.postMessage("","*"),global.onmessage=e,t}function canUseReadyStateChange(){return"document"in global&&"onreadystatechange"in global.document.createElement("script")}function installNextTickImplementation(t){t.setImmediate=function(){var t=tasks.addFromSetImmediateArguments(arguments);return process.nextTick(function(){tasks.runIfPresent(t)}),t}}function installMessageChannelImplementation(t){var e=new global.MessageChannel;e.port1.onmessage=function(t){var e=t.data;tasks.runIfPresent(e)},t.setImmediate=function(){var t=tasks.addFromSetImmediateArguments(arguments);return e.port2.postMessage(t),t}}function installPostMessageImplementation(t){function e(t,e){return"string"==typeof t&&t.substring(0,e.length)===e}function r(t){if(t.source===global&&e(t.data,n)){var r=t.data.substring(n.length);tasks.runIfPresent(r)}}var n="com.bn.NobleJS.setImmediate"+Math.random();global.addEventListener?global.addEventListener("message",r,!1):global.attachEvent("onmessage",r),t.setImmediate=function(){var t=tasks.addFromSetImmediateArguments(arguments);return global.postMessage(n+t,"*"),t}}function installReadyStateChangeImplementation(t){t.setImmediate=function(){var t=tasks.addFromSetImmediateArguments(arguments),e=global.document.createElement("script");return e.onreadystatechange=function(){tasks.runIfPresent(t),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e),t}}function installSetTimeoutImplementation(t){t.setImmediate=function(){var t=tasks.addFromSetImmediateArguments(arguments);return global.setTimeout(function(){tasks.runIfPresent(t)},0),t}}var tasks=function(){function Task(t,e){this.handler=t,this.args=e}Task.prototype.run=function(){if("function"==typeof this.handler)this.handler.apply(undefined,this.args);else{var scriptSource=""+this.handler;eval(scriptSource)}};var nextHandle=1,tasksByHandle={},currentlyRunningATask=!1;return{addFromSetImmediateArguments:function(t){var e=t[0],r=Array.prototype.slice.call(t,1),n=new Task(e,r),s=nextHandle++;return tasksByHandle[s]=n,s},runIfPresent:function(t){if(currentlyRunningATask)global.setTimeout(function(){tasks.runIfPresent(t)},0);else{var e=tasksByHandle[t];if(e){currentlyRunningATask=!0;try{e.run()}finally{delete tasksByHandle[t],currentlyRunningATask=!1}}}},remove:function(t){delete tasksByHandle[t]}}}();if(!global.setImmediate){var attachTo="function"==typeof Object.getPrototypeOf&&"setTimeout"in Object.getPrototypeOf(global)?Object.getPrototypeOf(global):global;canUseNextTick()?installNextTickImplementation(attachTo):canUsePostMessage()?installPostMessageImplementation(attachTo):canUseMessageChannel()?installMessageChannelImplementation(attachTo):canUseReadyStateChange()?installReadyStateChangeImplementation(attachTo):installSetTimeoutImplementation(attachTo),attachTo.clearImmediate=tasks.remove}})("object"==typeof global&&global?global:this)},{__browserify_process:33}],39:[function(t,e){function r(t){return this instanceof r?(n.call(this,t),void 0):new r(t)}e.exports=r;var n=t("./transform.js"),s=t("inherits");s(r,n),r.prototype._transform=function(t,e,r){r(null,t)}},{"./transform.js":41,inherits:32}],40:[function(t,e){function r(e){e=e||{};var r=e.highWaterMark;this.highWaterMark=r||0===r?r:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!e.objectMode,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(_||(_=t("string_decoder").StringDecoder),this.decoder=new _(e.encoding),this.encoding=e.encoding)}function n(t){return this instanceof n?(this._readableState=new r(t,this),this.readable=!0,A.call(this),void 0):new n(t)}function s(t,e,r,n,s){var o=h(e,r);if(o)t.emit("error",o);else if(null===r||void 0===r)e.reading=!1,e.ended||c(t,e);else if(e.objectMode||r&&r.length>0)if(e.ended&&!s){var a=Error("stream.push() after EOF");t.emit("error",a)}else if(e.endEmitted&&s){var a=Error("stream.unshift() after end event");t.emit("error",a)}else!e.decoder||s||n||(r=e.decoder.write(r)),e.length+=e.objectMode?1:r.length,s?e.buffer.unshift(r):(e.reading=!1,e.buffer.push(r)),e.needReadable&&u(t),f(t,e);else s||(e.reading=!1);return i(e)}function i(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}function o(t){if(t>=I)t=I;else{t--;for(var e=1;32>e;e<<=1)t|=t>>e;t++}return t}function a(t,e){return 0===e.length&&e.ended?0:e.objectMode?0===t?0:1:isNaN(t)||null===t?e.flowing&&e.buffer.length?e.buffer[0].length:e.length:0>=t?0:(t>e.highWaterMark&&(e.highWaterMark=o(t)),t>e.length?e.ended?e.length:(e.needReadable=!0,0):t)}function h(t,e){var r=null;return S.isBuffer(e)||"string"==typeof e||null===e||void 0===e||t.objectMode||r||(r=new TypeError("Invalid non-string/buffer chunk")),r}function c(t,e){if(e.decoder&&!e.ended){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.length>0?u(t):v(t)}function u(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,e.sync?L(function(){l(t)
}):l(t))}function l(t){t.emit("readable")}function f(t,e){e.readingMore||(e.readingMore=!0,L(function(){p(t,e)}))}function p(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function d(t){return function(){var e=t._readableState;e.awaitDrain--,0===e.awaitDrain&&g(t)}}function g(t){function e(t){var e=t.write(r);!1===e&&n.awaitDrain++}var r,n=t._readableState;for(n.awaitDrain=0;n.pipesCount&&null!==(r=t.read());)if(1===n.pipesCount?e(n.pipes,0,null):w(n.pipes,e),t.emit("data",r),n.awaitDrain>0)return;return 0===n.pipesCount?(n.flowing=!1,E.listenerCount(t,"data")>0&&m(t),void 0):(n.ranOut=!0,void 0)}function b(){this._readableState.ranOut&&(this._readableState.ranOut=!1,g(this))}function m(t,e){var r=t._readableState;if(r.flowing)throw Error("Cannot switch to old mode now.");var n=e||!1,s=!1;t.readable=!0,t.pipe=A.prototype.pipe,t.on=t.addListener=A.prototype.on,t.on("readable",function(){s=!0;for(var e;!n&&null!==(e=t.read());)t.emit("data",e);null===e&&(s=!1,t._readableState.needReadable=!0)}),t.pause=function(){n=!0,this.emit("pause")},t.resume=function(){n=!1,s?L(function(){t.emit("readable")}):this.read(0),this.emit("resume")},t.emit("readable")}function y(t,e){var r,n=e.buffer,s=e.length,i=!!e.decoder,o=!!e.objectMode;if(0===n.length)return null;if(0===s)r=null;else if(o)r=n.shift();else if(!t||t>=s)r=i?n.join(""):S.concat(n,s),n.length=0;else if(n[0].length>t){var a=n[0];r=a.slice(0,t),n[0]=a.slice(t)}else if(t===n[0].length)r=n.shift();else{r=i?"":new S(t);for(var h=0,c=0,u=n.length;u>c&&t>h;c++){var a=n[0],l=Math.min(t-h,a.length);i?r+=a.slice(0,l):a.copy(r,h,0,l),a.length>l?n[0]=a.slice(l):n.shift(),h+=l}}return r}function v(t){var e=t._readableState;if(e.length>0)throw Error("endReadable called on non-empty stream");!e.endEmitted&&e.calledRead&&(e.ended=!0,L(function(){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}))}function w(t,e){for(var r=0,n=t.length;n>r;r++)e(t[r],r)}function k(t,e){for(var r=0,n=t.length;n>r;r++)if(t[r]===e)return r;return-1}var x=t("__browserify_process");e.exports=n,n.ReadableState=r;var _,E=t("events").EventEmitter,A=t("./index.js"),S=t("buffer").Buffer,L=t("setimmediate"),C=t("inherits");C(n,A),n.prototype.push=function(t,e){var r=this._readableState;return"string"!=typeof t||r.objectMode||(e=e||r.defaultEncoding,e!==r.encoding&&(t=new S(t,e),e="")),s(this,r,t,e,!1)},n.prototype.unshift=function(t){var e=this._readableState;return s(this,e,t,"",!0)},n.prototype.setEncoding=function(e){_||(_=t("string_decoder").StringDecoder),this._readableState.decoder=new _(e),this._readableState.encoding=e};var I=8388608;n.prototype.read=function(t){var e=this._readableState;e.calledRead=!0;var r=t;if(("number"!=typeof t||t>0)&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return u(this),null;if(t=a(t,e),0===t&&e.ended)return 0===e.length&&v(this),null;var n=e.needReadable;e.length-t<=e.highWaterMark&&(n=!0),(e.ended||e.reading)&&(n=!1),n&&(e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1),n&&!e.reading&&(t=a(r,e));var s;return s=t>0?y(t,e):null,null===s&&(e.needReadable=!0,t=0),e.length-=t,0!==e.length||e.ended||(e.needReadable=!0),e.ended&&!e.endEmitted&&0===e.length&&v(this),s},n.prototype._read=function(){this.emit("error",Error("not implemented"))},n.prototype.pipe=function(t,e){function r(t){t===c&&s()}function n(){t.end()}function s(){t.removeListener("close",o),t.removeListener("finish",a),t.removeListener("drain",p),t.removeListener("error",i),t.removeListener("unpipe",r),c.removeListener("end",n),c.removeListener("end",s),(!t._writableState||t._writableState.needDrain)&&p()}function i(e){h(),0===m&&0===E.listenerCount(t,"error")&&t.emit("error",e)}function o(){t.removeListener("finish",a),h()}function a(){t.removeListener("close",o),h()}function h(){c.unpipe(t)}var c=this,u=this._readableState;switch(u.pipesCount){case 0:u.pipes=t;break;case 1:u.pipes=[u.pipes,t];break;default:u.pipes.push(t)}u.pipesCount+=1;var l=(!e||e.end!==!1)&&t!==x.stdout&&t!==x.stderr,f=l?n:s;u.endEmitted?L(f):c.once("end",f),t.on("unpipe",r);var p=d(c);t.on("drain",p);var m=E.listenerCount(t,"error");return t.once("error",i),t.once("close",o),t.once("finish",a),t.emit("pipe",c),u.flowing||(this.on("readable",b),u.flowing=!0,L(function(){g(c)})),t},n.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,this.removeListener("readable",b),e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var r=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,this.removeListener("readable",b),e.flowing=!1;for(var s=0;n>s;s++)r[s].emit("unpipe",this);return this}var s=k(e.pipes,t);return-1===s?this:(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this),this)},n.prototype.on=function(t,e){var r=A.prototype.on.call(this,t,e);if("data"!==t||this._readableState.flowing||m(this),"readable"===t&&this.readable){var n=this._readableState;n.readableListening||(n.readableListening=!0,n.emittedReadable=!1,n.needReadable=!0,n.reading?n.length&&u(this,n):this.read(0))}return r},n.prototype.addListener=n.prototype.on,n.prototype.resume=function(){m(this),this.read(0),this.emit("resume")},n.prototype.pause=function(){m(this,!0),this.emit("pause")},n.prototype.wrap=function(t){var e=this._readableState,r=!1,n=this;t.on("end",function(){if(e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&n.push(t)}n.push(null)}),t.on("data",function(s){if(e.decoder&&(s=e.decoder.write(s)),s&&(e.objectMode||s.length)){var i=n.push(s);i||(r=!0,t.pause())}});for(var s in t)"function"==typeof t[s]&&this[s]===void 0&&(this[s]=function(e){return function(){return t[e].apply(t,arguments)}}(s));var i=["error","close","destroy","pause","resume"];return w(i,function(e){t.on(e,function(t){return n.emit.apply(n,e,t)})}),n._read=function(){r&&(r=!1,t.resume())},n},n._fromList=y},{"./index.js":37,__browserify_process:33,buffer:34,events:31,inherits:32,setimmediate:38,string_decoder:43}],41:[function(t,e){function r(t,e){this.afterTransform=function(t,r){return n(e,t,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function n(t,e,r){var n=t._transformState;n.transforming=!1;var s=n.writecb;if(!s)return t.emit("error",Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,null!==r&&void 0!==r&&t.push(r),s&&s(e);var i=t._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&t._read(i.highWaterMark)}function s(t){if(!(this instanceof s))return new s(t);o.call(this,t),this._transformState=new r(t,this);var e=this;this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(t){i(e,t)}):i(e)})}function i(t,e){if(e)return t.emit("error",e);var r=t._writableState;t._readableState;var n=t._transformState;if(r.length)throw Error("calling transform done when ws.length != 0");if(n.transforming)throw Error("calling transform done when still transforming");return t.push(null)}e.exports=s;var o=t("./duplex.js"),a=t("inherits");a(s,o),s.prototype.push=function(t,e){return this._transformState.needTransform=!1,o.prototype.push.call(this,t,e)},s.prototype._transform=function(){throw Error("not implemented")},s.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var s=this._readableState;(n.needTransform||s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}},s.prototype._read=function(){var t=this._transformState;t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0}},{"./duplex.js":36,inherits:32}],42:[function(t,e){function r(t,e,r){this.chunk=t,this.encoding=e,this.callback=r}function n(t,e){t=t||{};var r=t.highWaterMark;this.highWaterMark=r||0===r?r:16384,this.objectMode=!!t.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){f(e,t)},this.writecb=null,this.writelen=0,this.buffer=[]}function s(t){return this instanceof s||this instanceof w.Duplex?(this._writableState=new n(t,this),this.writable=!0,w.call(this),void 0):new s(t)}function i(t,e,r){var n=Error("write after end");t.emit("error",n),k(function(){r(n)})}function o(t,e,r,n){var s=!0;if(!x.isBuffer(r)&&"string"!=typeof r&&null!==r&&void 0!==r&&!e.objectMode){var i=new TypeError("Invalid non-string/buffer chunk");t.emit("error",i),k(function(){n(i)}),s=!1}return s}function a(t,e,r){return t.objectMode||t.decodeStrings===!1||"string"!=typeof e||(e=new x(e,r)),e}function h(t,e,n,s,i){n=a(e,n,s);var o=e.objectMode?1:n.length;e.length+=o;var h=e.length<e.highWaterMark;return e.needDrain=!h,e.writing?e.buffer.push(new r(n,s,i)):c(t,e,o,n,s,i),h}function c(t,e,r,n,s,i){e.writelen=r,e.writecb=i,e.writing=!0,e.sync=!0,t._write(n,s,e.onwrite),e.sync=!1}function u(t,e,r,n,s){r?k(function(){s(n)}):s(n),t.emit("error",n)}function l(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function f(t,e){var r=t._writableState,n=r.sync,s=r.writecb;if(l(r),e)u(t,r,n,e,s);else{var i=b(t,r);i||r.bufferProcessing||!r.buffer.length||g(t,r),n?k(function(){p(t,r,i,s)}):p(t,r,i,s)}}function p(t,e,r,n){r||d(t,e),n(),r&&m(t,e)}function d(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function g(t,e){e.bufferProcessing=!0;for(var r=0;e.buffer.length>r;r++){var n=e.buffer[r],s=n.chunk,i=n.encoding,o=n.callback,a=e.objectMode?1:s.length;if(c(t,e,a,s,i,o),e.writing){r++;break}}e.bufferProcessing=!1,e.buffer.length>r?e.buffer=e.buffer.slice(r):e.buffer.length=0}function b(t,e){return e.ending&&0===e.length&&!e.finished&&!e.writing}function m(t,e){var r=b(t,e);return r&&(e.finished=!0,t.emit("finish")),r}function y(t,e,r){e.ending=!0,m(t,e),r&&(e.finished?k(r):t.once("finish",r)),e.ended=!0}e.exports=s,s.WritableState=n;var v=t("inherits"),w=t("./index.js"),k=t("setimmediate"),x=t("buffer").Buffer;v(s,w),s.prototype.pipe=function(){this.emit("error",Error("Cannot pipe. Not readable."))},s.prototype.write=function(t,e,r){var n=this._writableState,s=!1;return"function"==typeof e&&(r=e,e=null),x.isBuffer(t)?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=function(){}),n.ended?i(this,n,r):o(this,n,t,r)&&(s=h(this,n,t,e,r)),s},s.prototype._write=function(t,e,r){r(Error("not implemented"))},s.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),t!==void 0&&null!==t&&this.write(t,e),n.ending||n.finished||y(this,n,r)}},{"./index.js":37,buffer:34,inherits:32,setimmediate:38}],43:[function(t,e,r){function n(t){if(t&&!a.isEncoding(t))throw Error("Unknown encoding: "+t)}function s(t){return t.toString(this.encoding)}function i(t){var e=this.charReceived=t.length%2;return this.charLength=e?2:0,e}function o(t){var e=this.charReceived=t.length%3;return this.charLength=e?3:0,e}var a=t("buffer").Buffer,h=r.StringDecoder=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),n(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=i;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=o;break;default:return this.write=s,void 0}this.charBuffer=new a(6),this.charReceived=0,this.charLength=0};h.prototype.write=function(t){for(var e="",r=0;this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,r,n),this.charReceived+=n-r,r=n,this.charReceived<this.charLength)return"";e=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var s=e.charCodeAt(e.length-1);if(!(s>=55296&&56319>=s)){if(this.charReceived=this.charLength=0,n==t.length)return e;t=t.slice(n,t.length);break}this.charLength+=this.surrogateSize,e=""}var i=this.detectIncompleteChar(t),o=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-i,o),this.charReceived=i,o-=i),e+=t.toString(this.encoding,0,o);var o=e.length-1,s=e.charCodeAt(o);if(s>=55296&&56319>=s){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),this.charBuffer.write(e.charAt(e.length-1),this.encoding),e.substring(0,o)}return e},h.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var r=t[t.length-e];if(1==e&&6==r>>5){this.charLength=2;break}if(2>=e&&14==r>>4){this.charLength=3;break}if(3>=e&&30==r>>3){this.charLength=4;break}}return e},h.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var r=this.charReceived,n=this.charBuffer,s=this.encoding;e+=n.slice(0,r).toString(s)}return e}},{buffer:34}]},{},[]),require=function e(t,r,n){function s(o,a){if(!r[o]){if(!t[o]){var h="function"==typeof require&&require;if(!a&&h)return h(o,!0);if(i)return i(o,!0);throw Error("Cannot find module '"+o+"'")}var c=r[o]={exports:{}};t[o][0].call(c.exports,function(e){var r=t[o][1][e];return s(r?r:e)},c,c.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;n.length>o;o++)s(n[o]);return s}({QOlT1u:[function(t,e){function r(t,e){if("function"!=typeof e)throw Error("Bad callback given: "+e);if(!t)throw Error("No options given");var o=t.onResponse;if(t="string"==typeof t?{uri:t}:JSON.parse(JSON.stringify(t)),t.onResponse=o,t.verbose&&(r.log=i()),t.url&&(t.uri=t.url,delete t.url),!t.uri&&""!==t.uri)throw Error("options.uri is a required argument");if("string"!=typeof t.uri)throw Error("options.uri must be a string");for(var a=["proxy","_redirectsFollowed","maxRedirects","followRedirect"],c=0;a.length>c;c++)if(t[a[c]])throw Error("options."+a[c]+" is not supported");if(t.callback=e,t.method=t.method||"GET",t.headers=t.headers||{},t.body=t.body||null,t.timeout=t.timeout||r.DEFAULT_TIMEOUT,t.headers.host)throw Error("Options.headers.host is not supported");return t.json&&(t.headers.accept=t.headers.accept||"application/json","GET"!==t.method&&(t.headers["content-type"]="application/json"),"boolean"!=typeof t.json?t.body=JSON.stringify(t.json):"string"!=typeof t.body&&(t.body=JSON.stringify(t.body))),t.onResponse=t.onResponse||s,t.onResponse===!0&&(t.onResponse=e,t.callback=s),!t.headers.authorization&&t.auth&&(t.headers.authorization="Basic "+h(t.auth.username+":"+t.auth.password)),n(t)}function n(t){function e(){u=!0;var e=Error("ETIMEDOUT");return e.code="ETIMEDOUT",e.duration=t.timeout,r.log.error("Timeout",{id:h._id,milliseconds:t.timeout}),t.callback(e,h)}function n(){if(u)return r.log.debug("Ignoring timed out state change",{state:h.readyState,id:h.id});if(r.log.debug("State change",{state:h.readyState,id:h.id,timed_out:u}),h.readyState===c.OPENED){r.log.debug("Request started",{id:h.id});for(var e in t.headers)h.setRequestHeader(e,t.headers[e])}else h.readyState===c.HEADERS_RECEIVED?s():h.readyState===c.LOADING?(s(),i()):h.readyState===c.DONE&&(s(),i(),o())}function s(){if(!g.response){if(g.response=!0,r.log.debug("Got response",{id:h.id,status:h.status}),clearTimeout(h.timeoutTimer),h.statusCode=h.status,f&&0==h.statusCode){var e=Error("CORS request rejected: "+t.uri);return e.cors="rejected",g.loading=!0,g.end=!0,t.callback(e,h)}t.onResponse(null,h)}}function i(){g.loading||(g.loading=!0,r.log.debug("Response body loading",{id:h.id}))}function o(){if(!g.end){if(g.end=!0,r.log.debug("Request done",{id:h.id}),h.body=h.responseText,t.json)try{h.body=JSON.parse(h.responseText)}catch(e){return t.callback(e,h)}t.callback(null,h,h.body)}}var h=new c,u=!1,f=a(t.uri),p="withCredentials"in h;if(l+=1,h.seq_id=l,h.id=l+": "+t.method+" "+t.uri,h._id=h.id,f&&!p){var d=Error("Browser does not support cross-origin request: "+t.uri);return d.cors="unsupported",t.callback(d,h)}h.timeoutTimer=setTimeout(e,t.timeout);var g={response:!1,loading:!1,end:!1};return h.onreadystatechange=n,h.open(t.method,t.uri,!0),f&&(h.withCredentials=!!t.withCredentials),h.send(t.body),h}function s(){}function i(){var t,e,r={},n=["trace","debug","info","warn","error"];for(e=0;n.length>e;e++)t=n[e],r[t]=s,"undefined"!=typeof console&&console&&console[t]&&(r[t]=o(console,t));return r}function o(t,e){function r(r,n){return"object"==typeof n&&(r+=" "+JSON.stringify(n)),t[e].call(t,r)}return r}function a(t){var e,r=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/;try{e=location.href}catch(n){e=document.createElement("a"),e.href="",e=e.href}var s=r.exec(e.toLowerCase())||[],i=r.exec(t.toLowerCase()),o=!(!i||i[1]==s[1]&&i[2]==s[2]&&(i[3]||("http:"===i[1]?80:443))==(s[3]||("http:"===s[1]?80:443)));return o}function h(t){var e,r,n,s,i,o,a,h,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=0,l=0,f="",p=[];if(!t)return t;do e=t.charCodeAt(u++),r=t.charCodeAt(u++),n=t.charCodeAt(u++),h=e<<16|r<<8|n,s=63&h>>18,i=63&h>>12,o=63&h>>6,a=63&h,p[l++]=c.charAt(s)+c.charAt(i)+c.charAt(o)+c.charAt(a);while(t.length>u);switch(f=p.join(""),t.length%3){case 1:f=f.slice(0,-2)+"==";break;case 2:f=f.slice(0,-1)+"="}return f}var c=XMLHttpRequest;if(!c)throw Error("missing XMLHttpRequest");e.exports=r,r.log={trace:s,debug:s,info:s,warn:s,error:s};var u=18e4,l=0;r.withCredentials=!1,r.DEFAULT_TIMEOUT=u,r.defaults=function(t){var e=function(e){var r=function(r,n){r="string"==typeof r?{uri:r}:JSON.parse(JSON.stringify(r));for(var s in t)void 0===r[s]&&(r[s]=t[s]);return e(r,n)};return r},n=e(r);return n.get=e(r.get),n.post=e(r.post),n.put=e(r.put),n.head=e(r.head),n};var f=["get","put","post","head"];f.forEach(function(t){var e=t.toUpperCase(),n=t.toLowerCase();r[n]=function(t){"string"==typeof t?t={method:e,uri:t}:(t=JSON.parse(JSON.stringify(t)),t.method=e);var n=[t].concat(Array.prototype.slice.apply(arguments,[1]));return r.apply(this,n)}}),r.couch=function(t,e){function n(t,r,n){if(t)return e(t,r,n);if((200>r.statusCode||r.statusCode>299)&&n.error){t=Error("CouchDB error: "+(n.error.reason||n.error.error));for(var s in n)t[s]=n[s];return e(t,r,n)}return e(t,r,n)}"string"==typeof t&&(t={uri:t}),t.json=!0,t.body&&(t.json=t.body),delete t.body,e=e||s;var i=r(t,n);return i}},{}],"browser-request":[function(t,e){e.exports=t("QOlT1u")},{}]},{},[]);var term=require("hypernal")(),tablify=require("tablify").tablify,request=require("browser-request"),url=require("url"),parsedURL=url.parse(window.location.href,!0);term.appendTo(document.body);var termEl=term.term.element;if(termEl.style.font="13px Monaco, mono",termEl.style.height="100%",termEl.style.padding="5px",termEl.style.overflow="auto",termEl.style["white-space"]="pre",parsedURL.query.q){var query="http://npmsearch.com/query?fl=name,description,homepage&rows=200&sort=rating+desc&q="+parsedURL.query.q;request({json:!0,url:query},function(t,e,r){var n=r.results.map(function(t){var e=t.description.length>60;return t.description=t.description.substr(0,60),e&&(t.description+="..."),t});term.write(tablify(n))})}else term.write("RELOAD WITH ?q=your_search_term");
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; }
body, html { height: 100%; width: 100%; }</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment