!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).RevealMarkdown=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n ?/gm,""),t.push({type:"blockquote",raw:m,tokens:this.blockTokens(s,[],x)});else if(s=this.rules.block.list.exec(e))for(e=e.substring(s[0].length),o={type:"list",raw:m=s[0],ordered:g=(i=s[2]).length>1,start:g?+i:"",loose:!1,items:[]},t.push(o),n=!1,p=(s=s[0].match(this.rules.block.item)).length,u=0;u 1?1===a.length:a.length>1||this.options.smartLists&&a!==i)&&(e=(k=s.slice(u+1).join("\n"))+e,o.raw=o.raw.substring(o.raw.length-k.length),u=p-1)),r=n||/\n\n(?!\s*$)/.test(l),u!==p-1&&(n="\n"===l.charAt(l.length-1),r||(r=n)),r&&(o.loose=!0),d=void 0,(f=/^\[[ xX]\] /.test(l))&&(d=" "!==l[1],l=l.replace(/^\[[ xX]\] +/,"")),o.items.push({raw:m,task:f,checked:d,loose:r,tokens:this.blockTokens(l,[],!1)});else if(s=this.rules.block.html.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:this.options.sanitize?"paragraph":"html",raw:m,pre:!this.options.sanitizer&&("pre"===s[1]||"script"===s[1]||"style"===s[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(s[0]):j(s[0]):s[0]});else if(x&&(s=this.rules.block.def.exec(e)))e=e.substring(s[0].length),s[3]&&(s[3]=s[3].substring(1,s[3].length-1)),h=s[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[h]||(this.tokens.links[h]={href:s[2],title:s[3]});else if((s=this.rules.block.table.exec(e))&&(l={type:"table",header:D(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/\n$/,"").split("\n"):[]}).header.length===l.align.length){for(e=e.substring(s[0].length),l.raw=s[0],p=l.align.length,u=0;u /i.test(l[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(l[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(l[0])&&(this.inRawBlock=!1),e=e.substring(l[0].length),h=l[0],r=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(l[0]):j(l[0]):l[0],t.push({type:this.options.sanitize?"text":"html",raw:h,text:r}),p+=r;else if(l=this.rules.inline.link.exec(e))(c=H(l[2],"()"))>-1&&(u=(0===l[0].indexOf("!")?5:4)+l[1].length+c,l[2]=l[2].substring(0,c),l[0]=l[0].substring(0,u).trim(),l[3]=""),e=e.substring(l[0].length),h=l[0],this.inLink=!0,i=l[2],this.options.pedantic?(n=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i))?(i=n[1],a=n[3]):a="":a=l[3]?l[3].slice(1,-1):"",i=i.trim().replace(/^<([\s\S]*)>$/,"$1"),p+=this.outputLink(l,{href:this.escapes(i),title:this.escapes(a)},t,h),this.inLink=!1;else if((l=this.rules.inline.reflink.exec(e))||(l=this.rules.inline.nolink.exec(e))){if(e=e.substring(l[0].length),h=l[0],n=(l[2]||l[1]).replace(/\s+/g," "),!(n=this.tokens.links[n.toLowerCase()])||!n.href){p+=r=l[0].charAt(0),t.push({type:"text",raw:r,text:r}),e=l[0].substring(1)+e;continue}this.inLink=!0,p+=this.outputLink(l,n,t,h),this.inLink=!1}else if(l=this.rules.inline.strong.exec(e))e=e.substring(l[0].length),h=l[0],s=t?[]:null,r=this.inlineTokens(l[4]||l[3]||l[2]||l[1],s),t.push({type:"strong",raw:h,text:r,tokens:s}),p+=r;else if(l=this.rules.inline.em.exec(e))e=e.substring(l[0].length),h=l[0],s=t?[]:null,r=this.inlineTokens(l[6]||l[5]||l[4]||l[3]||l[2]||l[1],s),t.push({type:"em",raw:h,text:r,tokens:s}),p+=r;else if(l=this.rules.inline.code.exec(e))e=e.substring(l[0].length),h=l[0],r=j(l[2].trim(),!0),t.push({type:"codespan",raw:h,text:r}),p+=r;else if(l=this.rules.inline.br.exec(e))e=e.substring(l[0].length),h=l[0],t.push({type:"br",raw:h}),p+="\n";else if(l=this.rules.inline.del.exec(e))e=e.substring(l[0].length),h=l[0],s=t?[]:null,r=this.inlineTokens(l[1],s),t.push({type:"del",raw:h,text:r,tokens:s}),p+=r;else if(l=this.rules.inline.autolink.exec(e))e=e.substring(l[0].length),h=l[0],i="@"===l[2]?"mailto:"+(r=j(this.options.mangle?this.mangle(l[1]):l[1])):r=j(l[1]),t.push({type:"link",raw:h,text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}),p+=r;else if(this.inLink||!(l=this.rules.inline.url.exec(e))){if(l=this.rules.inline.text.exec(e))e=e.substring(l[0].length),h=l[0],r=this.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(l[0]):j(l[0]):l[0]:j(this.options.smartypants?this.smartypants(l[0]):l[0]),t.push({type:"text",raw:h,text:r}),p+=r;else if(e){var g="Infinite loop on byte: "+e.charCodeAt(0);if(!this.options.silent)throw new Error(g);console.error(g)}}else{if("@"===l[2])i="mailto:"+(r=j(this.options.mangle?this.mangle(l[0]):l[0]));else{do{o=l[0],l[0]=this.rules.inline._backpedal.exec(l[0])[0]}while(o!==l[0]);r=j(l[0]),i="www."===l[1]?"http://"+r:r}e=e.substring(l[0].length),h=l[0],t.push({type:"link",raw:h,text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}),p+=r}return p}},{key:"escapes",value:function(e){return e?e.replace(N._escapes,"$1"):e}},{key:"outputLink",value:function(e,t,n,r){var s=t.href,i=t.title?j(t.title):null,a=n?[]:null;if("!"!==e[0].charAt(0)){var l=this.inlineTokens(e[1],a);return n.push({type:"link",raw:r,text:l,href:s,title:i,tokens:a}),l}var o=j(e[1]);return n.push({type:"image",raw:r,text:o,href:s,title:i}),o}},{key:"smartypants",value:function(e){return e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}},{key:"mangle",value:function(e){var t,n,r="",s=e.length;for(t=0;t "+e+".5&&(n="x"+n.toString(16)),r+=""+n+";";return r}}],[{key:"lex",value:function(t,n){return new e(n).lex(t)}},{key:"rules",get:function(){return{block:P,inline:N}}}]),e}(),U=s.defaults,F=S,V=w,X=function(){function e(n){t(this,e),this.options=n||U}return r(e,[{key:"code",value:function(e,t,n){var r=(t||"").match(/\S*/)[0];if(this.options.highlight){var s=this.options.highlight(e,r);null!=s&&s!==e&&(n=!0,e=s)}return r?'
\n":"'+(n?e:V(e,!0))+"
"}},{key:"blockquote",value:function(e){return""+(n?e:V(e,!0))+"
\n"+e+"
\n"}},{key:"html",value:function(e){return e}},{key:"heading",value:function(e,t,n,r){return this.options.headerIds?"
\n":"
\n"}},{key:"list",value:function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+""+r+">\n"}},{key:"listitem",value:function(e){return"\n\n"+e+"\n"+t+"
\n"}},{key:"tablerow",value:function(e){return"\n"+e+" \n"}},{key:"tablecell",value:function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+""+n+">\n"}},{key:"strong",value:function(e){return""+e+""}},{key:"em",value:function(e){return""+e+""}},{key:"codespan",value:function(e){return""+e+"
"}},{key:"br",value:function(){return this.options.xhtml?"
":"
"}},{key:"del",value:function(e){return""+e+""}},{key:"link",value:function(e,t,n){if(null===(e=F(this.options.sanitize,this.options.baseUrl,e)))return n;var r='"+n+""}},{key:"image",value:function(e,t,n){if(null===(e=F(this.options.sanitize,this.options.baseUrl,e)))return n;var r='":">"}},{key:"text",value:function(e){return e}}]),e}(),G=function(){function e(){t(this,e)}return r(e,[{key:"strong",value:function(e){return e}},{key:"em",value:function(e){return e}},{key:"codespan",value:function(e){return e}},{key:"del",value:function(e){return e}},{key:"html",value:function(e){return e}},{key:"text",value:function(e){return e}},{key:"link",value:function(e,t,n){return""+n}},{key:"image",value:function(e,t,n){return""+n}},{key:"br",value:function(){return""}}]),e}(),J=function(){function e(){t(this,e),this.seen={}}return r(e,[{key:"slug",value:function(e){var t=e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t)){var n=t;do{this.seen[n]++,t=n+"-"+this.seen[n]}while(this.seen.hasOwnProperty(t))}return this.seen[t]=0,t}}]),e}(),K=s.defaults,Q=_,W=function(){function e(n){t(this,e),this.options=n||K,this.options.renderer=this.options.renderer||new X,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new G,this.slugger=new J}return r(e,[{key:"parse",value:function(e){var t,n,r,s,i,a,l,o,c,u,h,p,g,f,d,b,k,m,x=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],y="",v=e.length;for(t=0;t
"+te(e.message+"",!0)+"";throw e}}ie.options=ie.setOptions=function(e){return Y(ie.defaults,e),re(ie.defaults),ie},ie.getDefaults=ne,ie.defaults=se,ie.Parser=W,ie.parser=W.parse,ie.Renderer=X,ie.TextRenderer=G,ie.Lexer=B,ie.lexer=B.lex,ie.Slugger=J,ie.parse=ie;var ae=ie; /*! * The reveal.js markdown plugin. Handles parsing of * markdown inside of presentations as well as loading * of external markdown documents. */function le(e){var t=(e.querySelector("[data-template]")||e.querySelector("script")||e).textContent,n=(t=t.replace(new RegExp("__SCRIPT_END__","g"),"<\/script>")).match(/^\n?(\s*)/)[1].length,r=t.match(/^\n?(\t*)/)[1].length;return r>0?t=t.replace(new RegExp("\\n?\\t{"+r+"}","g"),"\n"):n>1&&(t=t.replace(new RegExp("\\n? {"+n+"}","g"),"\n")),t}function oe(e){for(var t=e.attributes,n=[],r=0,s=t.length;r