"+this._plainTextFormatterFactory.format(e)+"
")},v.prototype.insertHTML=function(e){this.getCommand("insertHTML").execute(this._htmlFormatterFactory.format(e))},v.prototype.isDebugModeEnabled=function(){return this.options.debug},v.prototype.registerHTMLFormatter=function(e,t){this._htmlFormatterFactory.formatters[e].push(t)},v.prototype.registerPlainTextFormatter=function(e){this._plainTextFormatterFactory.formatters.push(e)},m.prototype.format=function(e){var t=this.formatters.reduce(function(e,t){return t(e)},e);return t},g.prototype=Object.create(m.prototype),g.prototype.constructor=g,g.prototype.format=function(e){var n=t([this.formatters.sanitize,this.formatters.normalize]),r=n.reduce(function(e,t){return t(e)},e);return r},g.prototype.formatForExport=function(e){return this.formatters.export.reduce(function(e,t){return t(e)},e)},v}),define("scribe-plugin-toolbar",[],function(){return function(e){return function(t){var n=e.querySelectorAll("button[data-command-name]");Array.prototype.forEach.call(n,function(e){function n(){var n=t.getCommand(e.dataset.commandName),r=new t.api.Selection;r.range&&n.queryState()?e.classList.add("active"):e.classList.remove("active"),r.range&&n.queryEnabled()?e.removeAttribute("disabled"):e.setAttribute("disabled","disabled")}e.addEventListener("click",function(){var n=t.getCommand(e.dataset.commandName);t.el.focus(),n.execute()}),t.el.addEventListener("keyup",n),t.el.addEventListener("mouseup",n),t.el.addEventListener("focus",n),t.el.addEventListener("blur",n),t.on("content-changed",n)})}}}),define("scribe-plugins/linkPromptCommand",[],function(){return function(){return function(e){var t=new e.api.Command("createLink"),n=e.el.tagName.toLowerCase()==="a";t.nodeName="A",t.execute=function(){var t;if(n)t=e.el;else{var r=new e.api.Selection,i=r.range;t=r.getContaining(function(e){return e.nodeName===this.nodeName}.bind(this))}var s=t?t.href:"http://",o=window.prompt("Enter a link.",s);!n&&t&&(i.selectNode(t),r.selection.removeAllRanges(),r.selection.addRange(i)),o&&(/^https?\:\/\//.test(o)||(!/^mailto\:/.test(o)&&/@/.test(o)?o="mailto:"+o:o="http://"+o),n?t.href=o:e.api.SimpleCommand.prototype.execute.call(this,o))},t.queryState=function(){var t=new e.api.Selection;return!!t.getContaining(function(e){return e.nodeName===this.nodeName}.bind(this))},e.commands.linkPrompt=t}}}),define("Editor",["scribe","scribe-plugin-toolbar","./scribe-plugins/linkPromptCommand"],function(e,t,n){function r(e,t){this.dytomate=e,this.element=t,this.listeners={},this.body=null,this.overlay={},this.toolbar={},this.textarea=null,this.scribe=null,this.mode=r.MODE.WYSIWYG,this.enabled=!1}return r.MODE={WYSIWYG:"wysiwyg",HTML:"html"},r.prototype.enable=function(){return this.enabled||(this.body=document.querySelector("body"),this.initElement(),this.removeExtraWhitespace(),this.initOverlay(),this.initScribe(),this.attachListeners(),this.enabled=!0),this},r.prototype.disable=function(){return this.enabled&&(this.save(),this.detachListeners(),this.deinitOverlay(),this.deinitElement(),this.deinitScribe(),this.enabled=!1),this},r.prototype.initElement=function(){return this.element.style.outline="none",this.dytomate.setElementDytomateAttribute(this.element,"in-edit","true"),this},r.prototype.deinitElement=function(){return this.dytomate.removeElementDytomateAttribute(this.element,"in-edit"),this},r.prototype.initOverlay=function(){var e=this.element.getBoundingClientRect();this.overlay.window=document.createElement("div"),this.textarea=document.createElement("textarea"),this.toolbar.container=document.createElement("div"),["top","left","right","bottom"].forEach(function(e){this.overlay[e]=document.createElement("div"),this.overlay[e].style.position="fixed",this.overlay[e].style.zIndex=999,this.overlay[e].style.backgroundColor=this.dytomate.options.editorOverlayColor},this),["boldButton","italicButton","linkButton","htmlButton"].forEach(function(e,t){this.toolbar[e]=document.createElement("button"),this.toolbar[e].style.position="absolute",this.toolbar[e].style.top="0",this.toolbar[e].style.left=this.toPx((this.dytomate.options.editorToolbarButtonSize+this.dytomate.options.editorToolbarButtonSpacing)*t),this.toolbar[e].style.width=this.toPx(this.dytomate.options.editorToolbarButtonSize),this.toolbar[e].style.height=this.toPx(this.dytomate.options.editorToolbarButtonSize),this.toolbar[e].style.padding="0",this.toolbar[e].style.margin="0",this.toolbar[e].style.border=this.toPx(this.dytomate.options.editorToolbarButtonBorderWidth)+" solid "+this.dytomate.options.editorToolbarButtonBorderColor,this.toolbar[e].style.boxShadow="0 0 "+this.toPx(this.dytomate.options.editorToolbarButtonShadowSize)+" "+this.dytomate.options.editorToolbarButtonShadowColor,this.toolbar[e].style.cursor="pointer",this.toolbar[e].style.backgroundSize="contain",this.toolbar[e].style.backgroundColor=this.dytomate.options.editorToolbarButtonColor,this.toolbar[e].classList.add("dytomate-editor-command-button"),this.toolbar[e].addEventListener("mouseover",function(){this.toolbar[e].style.backgroundColor=this.dytomate.options.editorToolbarButtonHoverColor,this.toolbar[e].style.boxShadow="0 0 "+this.toPx(this.dytomate.options.editorToolbarButtonShadowHoverSize)+" "+this.dytomate.options.editorToolbarButtonShadowColor}.bind(this)),this.toolbar[e].addEventListener("mouseout",function(){this.toolbar[e].style.backgroundColor=this.dytomate.options.editorToolbarButtonColor,this.toolbar[e].style.boxShadow="0 0 "+this.toPx(this.dytomate.options.editorToolbarButtonShadowSize)+" "+this.dytomate.options.editorToolbarButtonShadowColor}.bind(this))},this),this.overlay.window.style.position="fixed",this.overlay.window.style.zIndex=999,this.overlay.window.style.boxSizing="content-box",this.overlay.window.style.padding=this.toPx(this.dytomate.options.editorPadding),this.overlay.window.style.border=this.toPx(this.dytomate.options.editorBorderWidth)+" solid "+this.dytomate.options.editorBorderColor,this.overlay.window.style.pointerEvents="none",this.overlay.window.style.boxShadow="0 0 "+this.toPx(this.dytomate.options.editorShadowSize)+" "+this.dytomate.options.editorShadowColor,this.textarea.style.position="fixed",this.textarea.style.zIndex=999,this.textarea.style.display="none",this.textarea.style.boxSizing="content-box",this.textarea.style.padding=this.toPx(this.dytomate.options.editorPadding),this.textarea.style.border=this.toPx(this.dytomate.options.editorBorderWidth)+" solid "+this.dytomate.options.editorBorderColor,this.textarea.style.resize="none",this.textarea.classList.add("dytomate-editor-textarea"),this.overlay.top.style.top="0",this.overlay.top.style.left="0",this.overlay.top.style.right="0",this.overlay.left.style.left="0",this.overlay.right.style.right="0",this.overlay.bottom.style.left="0",this.overlay.bottom.style.right="0",this.overlay.bottom.style.bottom="0",this.toolbar.container.style.position="fixed",this.toolbar.container.style.zIndex=999,this.toolbar.boldButton.setAttribute("data-command-name","bold"),this.toolbar.boldButton.style.backgroundImage="url(data:image/gif;base64,R0lGODlhQABAAKIHALa2tsXFxVJSUvf394WFhebm5gAAAP///yH5BAEAAAcALAAAAABAAEAAQAP/eLrc/jDK+YS5OJsAB7BaaBADZYLiBZjHgKbGylawaga1IZQz9IoCgnBIEBhzOgCv58vJZgOkYdn7hZ4sF1LJPFg1xrA4LI11aWVYEBDgnk9OUxRJeC++GaxEW9vZvTkcDwEENSR/aDB6EgBIfm94GIsUODkCBV2RNlmaF3WIoKGio4idaSIEmKOdkw2NW6CsLAVSqpBxLIWBf7I3SLa3Na0LfCmPsadSgqR3uBIFuoZUZ72cv8GKXa+GwCzVM9swh0zfJtHi2CnLEgGmU7zJZUZuzPX29/j5zO6n89OhnUgUGFiAED8zoso1GHAOHTJh5qT8I+dsQkMgE2cohEALk8m6TBUnmPqUTsSwhaY+UoRooqOhUiE7BHyYbcKcGt1KXmGnaRzAHAQCCBVaJJIAeqQO9mOTUaeGYR4uhjj6kyWFcMZyVonJiI6djey8UuNqcUvTCGDDAj3bxOqMSn20iiTbFahcCWk5ShzrlsJNnE7zzJAKhi3eXREGEJJyLHA8cXeZtBlKubLly0MBRNbHuTO+BAA7)",this.toolbar.italicButton.setAttribute("data-command-name","italic"),this.toolbar.italicButton.style.backgroundImage="url(data:image/gif;base64,R0lGODlhQABAAKIHAJ2dnSwsLGNjY/j4+OLi4sPDwwAAAP///yH5BAEAAAcALAAAAABAAEAAQAP/eLrc/jDKSasjJmsjrP9RsWUAaJ5DMHZn6wmjMbj0BMRErT/iWO7AA0AVMxSCyAbMEGg6n00mK3nqbY7UGsaXraVWs67rNsKKq7Hf2bTdTNfwuHw+CJOLnNyc0tYEwnsUXxt/gRZLG3qGE4gaiosRd46QE1YaapQPfSSZEQMxb50Mg36AogsDjUympwqSGY+tpJenAKp4tK26u7yBKVG4GgKYmZZXvQREib0HmwbEuqoBsa3OobqvBtSnsxzMB8bPzN2FveHQrbfbop8r3+rjyhnlvOFmu+SsrefvOMzO6GrFuKer27VW2dZ1yscsW8BO4byxIwDAVrBnABTCKcCxC6PHjxwB6PtGMk4CADs=)",this.toolbar.linkButton.setAttribute("data-command-name","linkPrompt"),this.toolbar.linkButton.style.backgroundImage="url(data:image/gif;base64,R0lGODlhQABAAKIHANXV1YKCgiQkJKenp/f398jIyAAAAP///yH5BAEAAAcALAAAAABAAEAAQAP/eLrc/jDKSSsMJusMrP8HthXUsBkdSIkauRTGAAHCFqj4UdTavdC2nApw8j0IBcKCwMsYhbOTLMK0KaHYA7GY7XoJAZfXy8qIDyaNIDWOlA3nCbDXXqQNa+0pI1DugnUzTQY+MHs+BCdxWXNOHlV0gRFbGlOQjpKZmpucmWVsnR5vAIYaoKENb4sKd3inmqoelE5XbbEWjYSSpZgKuVO+g0+cBR25NwQdf5GowYAYAcIHVauBxw53T5eEtWPXFtvD3org0s2zMQ7h3c0M6FztsrTx9PX29/gPIq/5qSd5/fzt4cOv3q1WKPDdYoCw4KaFDxqigiiBFxx2tshZWNYrfRBFCd8kLSRAcpK5QGBOgJoD7MfJTBJ1DDLjjFknE320DBLAU0nIeD9/truGRGYQAA4zoUP2xtGlanV+InwSU5JQO7qWvIy6VUI4TVepCMPoxWLLCes4oTt7pOumtRC+1oOrFRC+pQDKBCBr7928gA1m7QUcocBgwogTS0gAADs=)",this.toolbar.htmlButton.style.backgroundImage="url(data:image/gif;base64,R0lGODlhQABAAIABAAAAAP///yH5BAEAAAEALAAAAABAAEAAAALWjI+py+0Po5y02ouz3g8ADkZeSDLeWKbBiaok27obHMsZXdsVfuoYn/NBgD2hhFg0DpFBJYKZdC6gUemByrImsFUpN6v9gq3isbJsNqLTujVM7Wa74u82XV661+f6farv9/LxN5hXGNI1k3izeBGo8ciIZ0EDwsNxqVipGUlBBAkkmen4+YNkWrrDRLqq2uoJ5Ro7wQVLZTsr8nW0u9TbIaYbDDzc4OZwbLyGvGwS55ysQAfdvHUnff2kZ5191ae9bQCIMj5YLj6+Ur7O3n6oBR8vPy9TAAA7)",this.positionOverlay();for(var t in this.overlay)this.overlay.hasOwnProperty(t)&&this.body.appendChild(this.overlay[t]);for(var t in this.toolbar)this.toolbar.hasOwnProperty(t)&&t!=="container"&&this.toolbar.container.appendChild(this.toolbar[t]);return this.body.appendChild(this.textarea),this.body.appendChild(this.toolbar.container),this},r.prototype.deinitOverlay=function(){for(var e in this.overlay)this.overlay.hasOwnProperty(e)&&this.body.removeChild(this.overlay[e]);return this.body.removeChild(this.textarea),this.body.removeChild(this.toolbar.container),this.overlay={},this.toolbar={},this.textarea=null,this},r.prototype.positionOverlay=function(){var e=this.element.getBoundingClientRect(),t=window.innerHeight,n=this.element.offsetWidth,r=this.element.offsetHeight,i=this.dytomate.options.editorPadding,s=this.dytomate.options.editorBorderWidth,o=this.dytomate.options.editorToolbarOffsetX,u=this.dytomate.options.editorToolbarOffsetY,a=this.dytomate.options.editorToolbarButtonSize,f=u>0?0:Math.abs(u),l=e.top-i,c=e.left-i,h=n,p=r+f,d=l,v=l,m=c,g=r+f+i*2+s*2,y=l,b=e.left+n+i+s*2,w=g,E=e.top+r+f+i+s*2,S=E+u,x=c+o;return S+a>t&&(S=e.top-i-s-a-u-f,f>0&&(l-=f,d-=f,v-=f,y-=f,E-=f)),this.overlay.window.style.top=this.toPx(l),this.overlay.window.style.left=this.toPx(c),this.overlay.window.style.width=this.toPx(h),this.overlay.window.style.height=this.toPx(p),this.textarea.style.top=this.toPx(l),this.textarea.style.left=this.toPx(c),this.textarea.style.width=this.toPx(h),this.textarea.style.height=this.toPx(p),this.overlay.top.style.height=this.toPx(d),this.overlay.left.style.top=this.toPx(v),this.overlay.left.style.width=this.toPx(m),this.overlay.left.style.height=this.toPx(g),this.overlay.right.style.top=this.toPx(y),this.overlay.right.style.left=this.toPx(b),this.overlay.right.style.height=this.toPx(w),this.overlay.bottom.style.top=this.toPx(E),this.toolbar.container.style.top=this.toPx(S),this.toolbar.container.style.left=this.toPx(x),this},r.prototype.removeExtraWhitespace=function(){var e=this.element.innerHTML;e=e.replace(/\r?\n|\r|\t/g,""),this.element.innerHTML=e;var t=function(e){for(var t=0;t