!function(){function e(e){return e}function t(r){return function(e){var t=u("img",["image-output"]);return t.src="data:image/"+r+";base64,"+d(e).replace(/\n/g,""),t}}function r(){var t=this,e=c.display_priority.filter(function(e){return(t.raw.data||t.raw)[e]})[0];return e&&c.display[e]?c.display[e](t.raw[e]||t.raw.data[e]):u("div",["empty-output"])}function n(){var e=u("pre",["pyerr"]),t=this.raw.traceback.join("\n");return e.innerHTML=c.highlighter(c.ansi(o(t)),e),e}var i,a,s,l=this,p=void 0!==l.window,u=(a=(p?l:(i=new(require("jsdom").JSDOM)).window).document,function(e,t){e=a.createElement(e);return e.className=(t||[]).map(function(e){return c.prefix+e}).join(" "),e}),o=function(e){return e.replace(//g,">")},d=function(e){return e.join?e.map(d).join(""):e},c={prefix:"nb-",markdown:(s=l.marked||"function"==typeof require&&require("marked"))&&s.parse||e,ansi:(s=l.ansi_up||"function"==typeof require&&require("ansi_up"))&&s.ansi_to_html||e,sanitizer:(s=l.DOMPurify||"function"==typeof require&&require("dompurify"),(p?s&&s.sanitize:s(i.window).sanitize)||e),highlighter:e,VERSION:"0.7.0",Input:function(e,t){this.raw=e,this.cell=t}},h=(c.Input.prototype.render=function(){var e,t,r,n;return this.raw.length?(e=u("div",["input"]),"number"==typeof(n=this.cell).number&&e.setAttribute("data-prompt-number",this.cell.number),t=u("pre"),r=u("code"),n=n.worksheet.notebook.metadata,n=this.cell.raw.language||n.language||n.kernelspec&&n.kernelspec.language||n.language_info&&n.language_info.name,r.setAttribute("data-language",n),r.className="lang-"+n,r.innerHTML=c.highlighter(o(d(this.raw)),t,r,n),t.appendChild(r),e.appendChild(t),this.el=e):u("div")},c.display={},c.display.text=function(e){var t=u("pre",["text-output"]);return t.innerHTML=c.highlighter(c.ansi(d(e)),t),t},c.display["text/plain"]=c.display.text,c.display.html=function(e){var t=u("div",["html-output"]);return t.innerHTML=c.sanitizer(d(e)),t},c.display["text/html"]=c.display.html,c.display.marked=function(e){return c.display.html(c.markdown(d(e)))},c.display["text/markdown"]=c.display.marked,c.display.svg=function(e){var t=u("div",["svg-output"]);return t.innerHTML=d(e),t},c.display["text/svg+xml"]=c.display.svg,c.display["image/svg+xml"]=c.display.svg,c.display.latex=function(e){var t=u("div",["latex-output"]);return t.innerHTML=d(e),t},c.display["text/latex"]=c.display.latex,c.display.javascript=function(e){var t=u("script");return t.innerHTML=d(e),t},c.display["application/javascript"]=c.display.javascript,c.display.png=t("png"),c.display["image/png"]=c.display.png,c.display.jpeg=t("jpeg"),c.display["image/jpeg"]=c.display.jpeg,c.display_priority=["png","image/png","jpeg","image/jpeg","svg","image/svg+xml","text/svg+xml","html","text/html","text/markdown","latex","text/latex","javascript","application/javascript","text","text/plain"],c.Output=function(e,t){this.raw=e,this.cell=t,this.type=e.output_type},c.Output.prototype.renderers={display_data:r,execute_result:r,pyout:r,pyerr:n,error:n,stream:function(){var e=u("pre",[this.raw.stream||this.raw.name]),t=d(this.raw.text);return e.innerHTML=c.highlighter(c.ansi(o(t)),e),e}},c.Output.prototype.render=function(){var e=u("div",["output"]),t=("number"==typeof this.cell.number&&e.setAttribute("data-prompt-number",this.cell.number),this.renderers[this.type].call(this));return e.appendChild(t),this.el=e},c.coalesceStreams=function(e){var t,r;return e.length?(t=e[0],r=[t],e.slice(1).forEach(function(e){"stream"===e.raw.output_type&&"stream"===t.raw.output_type&&e.raw.stream===t.raw.stream&&e.raw.name===t.raw.name?t.raw.text=t.raw.text.concat(e.raw.text):(r.push(e),t=e)}),r):e},[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!(c.Cell=function(e,t){var r=this;r.raw=e,r.worksheet=t,r.type=e.cell_type,"code"===r.type&&(r.number=-1")))):e.innerHTML=c.sanitizer(c.markdown(t)),e},heading:function(){var e=u("h"+this.raw.level,["cell","heading-cell"]);return e.innerHTML=c.sanitizer(d(this.raw.source)),e},raw:function(){var e=u("div",["cell","raw-cell"]);return e.innerHTML=o(d(this.raw.source)),e},code:function(){var t=u("div",["cell","code-cell"]);t.appendChild(this.input.render()),this.outputs.forEach(function(e){t.appendChild(e.render())});return t}},c.Cell.prototype.render=function(){var e=this.renderers[this.type].call(this);return this.el=e},c.Worksheet=function(e,t){var r=this;this.raw=e,this.notebook=t,this.cells=e.cells.map(function(e){return new c.Cell(e,r)}),this.render=function(){var t=u("div",["worksheet"]);return r.cells.forEach(function(e){t.appendChild(e.render())}),this.el=t}},c.Notebook=function(e,t){var r=this,t=(this.raw=e,this.config=t,this.metadata=e.metadata||{}),t=(this.title=t.title||t.name,e.worksheets||[{cells:e.cells}]);this.worksheets=t.map(function(e){return new c.Worksheet(e,r)}),this.sheet=this.worksheets[0]},c.Notebook.prototype.render=function(){var t=u("div",["notebook"]);return this.worksheets.forEach(function(e){t.appendChild(e.render())}),this.el=t},c.parse=function(e,t){return new c.Notebook(e,t)},"function"==typeof define&&define.amd&&define(function(){return c}),"undefined"!=typeof exports?(exports="undefined"!=typeof module&&module.exports?module.exports=c:exports).nb=c:l.nb=c}.call(this);