(function(){var b,a=[].slice;b=(function(){var h,g,e,j,f,d,c;c=function(k){return(k.charAt(0)).toUpperCase()+k.substring(1)};j=function(k){return k.replace(/[-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")};f=function(t,k,s){var q,o,n,r,p,m;if(t instanceof Array){if(k instanceof Array){for(q=o=0,r=t.length;o=0&&l<10){m=f(h(this.holders),g(this.holders),m);l+=1}if(k){this.holders={}}return m};i.prototype.parseInline=function(m,l,k,n){if(l==null){l=""}if(k==null){k=true}if(n==null){n=true}m=this.call("beforeParseInline",m);m=m.replace(/(^|[^\\])(`+)(.+?)\2/mg,(function(o){return function(){var p;p=1<=arguments.length?a.call(arguments,0):[];return p[1]+o.makeHolder(""+(e(p[3]))+"
")}})(this));m=m.replace(/\\(.)/g,(function(o){return function(){var q,p;p=1<=arguments.length?a.call(arguments,0):[];q=e(p[1]);q=q.replace(/\$/g,"$");return o.makeHolder(q)}})(this));m=m.replace(/<(https?:\/\/.+)>/ig,(function(o){return function(){var q,r,p;r=1<=arguments.length?a.call(arguments,0):[];p=o.cleanUrl(r[1]);q=o.call("parseLink",r[1]);return o.makeHolder(''+q+"")}})(this));m=m.replace(/<(\/?)([a-z0-9-]+)(\s+[^>]*)?>/ig,(function(o){return function(){var p;p=1<=arguments.length?a.call(arguments,0):[];if((("|"+o.commonWhiteList+"|"+l+"|").indexOf("|"+p[2].toLowerCase()+"|"))>=0){return o.makeHolder(p[0])}else{return e(p[0])}}})(this));m=f(["<",">"],["<",">"],m);m=m.replace(/\[\^((?:[^\]]|\\\]|\\\[)+?)\]/g,(function(o){return function(){var q,p;p=1<=arguments.length?a.call(arguments,0):[];q=o.footnotes.indexOf(p[1]);if(q<0){q=o.footnotes.length+1;o.footnotes.push(o.parseInline(p[1],"",false))}return o.makeHolder(''+q+"")}})(this));m=m.replace(/!\[((?:[^\]]|\\\]|\\\[)*?)\]\(((?:[^\)]|\\\)|\\\()+?)\)/g,(function(o){return function(){var r,q,p;q=1<=arguments.length?a.call(arguments,0):[];r=e(o.escapeBracket(q[1]));p=o.escapeBracket(q[2]);p=o.cleanUrl(p);return o.makeHolder('')}})(this));m=m.replace(/!\[((?:[^\]]|\\\]|\\\[)*?)\]\[((?:[^\]]|\\\]|\\\[)+?)\]/g,(function(o){return function(){var r,q,p;q=1<=arguments.length?a.call(arguments,0):[];r=e(o.escapeBracket(q[1]));p=o.definitions[q[2]]!=null?'':r;return o.makeHolder(p)}})(this));m=m.replace(/\[((?:[^\]]|\\\]|\\\[)+?)\]\(((?:[^\)]|\\\)|\\\()+?)\)/g,(function(o){return function(){var r,q,p;q=1<=arguments.length?a.call(arguments,0):[];r=o.parseInline(o.escapeBracket(q[1]),"",false,false);p=o.escapeBracket(q[2]);p=o.cleanUrl(p);return o.makeHolder(''+r+"")}})(this));m=m.replace(/\[((?:[^\]]|\\\]|\\\[)+?)\]\[((?:[^\]]|\\\]|\\\[)+?)\]/g,(function(o){return function(){var r,q,p;q=1<=arguments.length?a.call(arguments,0):[];r=o.parseInline(o.escapeBracket(q[1]),"",false,false);p=o.definitions[q[2]]!=null?''+r+"":r;return o.makeHolder(p)}})(this));m=this.parseInlineCallback(m);m=m.replace(/<([_a-z0-9-\.\+]+@[^@]+\.[a-z]{2,})>/ig,'$1');if(n){m=m.replace(/(^|[^"])((https?):[x80-xff_a-z0-9-\.\/%#!@\?\+=~\|\,&\(\)]+)($|[^"])/ig,(function(o){return function(){var p,q;q=1<=arguments.length?a.call(arguments,0):[];p=o.call("parseLink",q[2]);return q[1]+''+p+""+q[4]}})(this))}m=this.call("afterParseInlineBeforeRelease",m);m=this.releaseHolder(m,k);m=this.call("afterParseInline",m);return m};i.prototype.parseInlineCallback=function(k){k=k.replace(/(\*{3})((?:.|\r)+?)\1/mg,(function(l){return function(){var m;m=1<=arguments.length?a.call(arguments,0):[];return""+(l.parseInlineCallback(m[2]))+""}})(this));k=k.replace(/(\*{2})((?:.|\r)+?)\1/mg,(function(l){return function(){var m;m=1<=arguments.length?a.call(arguments,0):[];return""+(l.parseInlineCallback(m[2]))+""}})(this));k=k.replace(/(\*)((?:.|\r)+?)\1/mg,(function(l){return function(){var m;m=1<=arguments.length?a.call(arguments,0):[];return""+(l.parseInlineCallback(m[2]))+""}})(this));k=k.replace(/(\s+|^)(_{3})((?:.|\r)+?)\2(\s+|$)/mg,(function(l){return function(){var m;m=1<=arguments.length?a.call(arguments,0):[];return m[1]+""+(l.parseInlineCallback(m[3]))+""+m[4]}})(this));k=k.replace(/(\s+|^)(_{2})((?:.|\r)+?)\2(\s+|$)/mg,(function(l){return function(){var m;m=1<=arguments.length?a.call(arguments,0):[];return m[1]+""+(l.parseInlineCallback(m[3]))+""+m[4]}})(this));k=k.replace(/(\s+|^)(_)((?:.|\r)+?)\2(\s+|$)/mg,(function(l){return function(){var m;m=1<=arguments.length?a.call(arguments,0):[];return m[1]+""+(l.parseInlineCallback(m[3]))+""+m[4]}})(this));k=k.replace(/(~{2})((?:.|\r)+?)\1/mg,(function(l){return function(){var m;m=1<=arguments.length?a.call(arguments,0):[];return""+(l.parseInlineCallback(m[2]))+""}})(this));return k};i.prototype.parseBlock=function(A,k){var E,o,x,p,r,C,F,J,D,G,w,u,z,B,n,v,s,t,y,H,q,I;s=A.split("\n");for(F=0,G=s.length;F
"}};i.prototype.parsePre=function(k){var l;k=k.map(function(m){return e(m.substring(4))});l=k.join("\n");if(l.match(/^\s*$/)){return""}else{return""+(e(o))+"
"}};i.prototype.parseShtml=function(k){return d((k.slice(1,-1)).join("\n"))};i.prototype.parseSh=function(l,m){var k;k=this.parseInline(d(l[0],"# "));if(k.match(/^\s*$/)){return""}else{return""+l+"
"+(this.parse(l))+"
"}};i.prototype.parseList=function(k){var w,v,B,G,z,D,s,C,r,q,u,y,n,A,p,t,E,F,x,o;v="";A=99999;t=[];for(G=B=0,C=k.length;B";x=p?null:true;t=false;for(G=D=0,E=k.length;D
"};i.prototype.parseHr=function(){return"";for(G in m){o=m[G];r=o[0],z=o[1];F=p?"th":"td";y+="<"+F;if(r>1){y+=' colspan="'+r+'"'}if((n[G]!=null)&&n[G]!=="none"){y+=' align="'+n[G]+'"'}y+=">"+(this.parseInline(z))+(""+F+">")}y+=" ";if(p){y+=""}else{if(x){x=false}}}if(x!==null){y+=""}return y+="
"};i.prototype.parseNormal=function(k){var l;k=k.map((function(m){return function(n){return m.parseInline(n)}})(this));l=d(k.join("\n"));l=l.replace(/(\n\s*){2,}/g,"
");l=l.replace(/\n/g,"
");if(l.match(/^\s*$/)){return""}else{return"
"+l+"
"}};i.prototype.parseFootnote=function(k,o){var l,m,n;n=o[0],m=o[1];l=this.footnotes.indexOf(m);if(l>=0){k=k.slice(0);k[0]=k[0].replace(/^\[\^((?:[^\]]|\]|\[)+?)\]:/,"");this.footnotes[l]=k}return""};i.prototype.parseDefinition=function(){return""};i.prototype.parseHtml=function(k,l){k=k.map((function(m){return function(n){return m.parseInline(n,m.specialWhiteList[l]!=null?m.specialWhiteList[l]:"")}})(this));return k.join("\n")};i.prototype.cleanUrl=function(k){var l;if(!!(l=k.match(/^\s*((http|https|ftp|mailto):[x80-xff_a-z0-9-\.\/%#!@\?\+=~\|\,&\(\)]+)/i))){l[1]}if(!!(l=k.match(/^\s*([x80-xff_a-z0-9-\.\/%#!@\?\+=~\|\,&]+)/i))){return l[1]}else{return"#"}};i.prototype.escapeBracket=function(k){return f(["\\[","\\]","\\(","\\)"],["[","]","(",")"],k)};i.prototype.startBlock=function(k,m,l){if(l==null){l=null}this.pos+=1;this.current=k;this.blocks.push([k,m,m,l]);return this};i.prototype.endBlock=function(){this.current="normal";return this};i.prototype.isBlock=function(k,l){if(l==null){l=null}return this.current===k&&(null===l?true:this.blocks[this.pos][3]===l)};i.prototype.getBlock=function(){if(this.blocks[this.pos]!=null){return this.blocks[this.pos]}else{return null}};i.prototype.setBlock=function(l,k){if(l==null){l=null}if(k==null){k=null}if(l!==null){this.blocks[this.pos][2]=l}if(k!==null){this.blocks[this.pos][3]=k}return this};i.prototype.backBlock=function(n,k,o){var m,l;if(o==null){o=null}if(this.pos<0){return this.startBlock(k,0,o)}l=this.blocks[this.pos][2];this.blocks[this.pos][2]=l-n;m=[k,l-n+1,l,o];if(this.blocks[this.pos][1]<=this.blocks[this.pos][2]){this.pos+=1;this.blocks.push(m)}else{this.blocks[this.pos]=m}this.current=k;return this};i.prototype.combineBlock=function(){var l,k;if(this.pos<1){return this}k=this.blocks[this.pos-1].slice(0);l=this.blocks[this.pos].slice(0);k[2]=l[2];this.blocks[this.pos-1]=k;this.current=k[0];this.blocks=this.blocks.slice(0,-1);this.pos-=1;return this};return i})();if(typeof module!=="undefined"&&module!==null){module.exports=b}else{if(typeof window!=="undefined"&&window!==null){window.HyperDown=b}}}).call(this);