/*! Editor.md v1.4.0 | /var/www/html/editor.md/lib/codemirror/addons.min.js | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-03-23 */
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){e.defineOption("showTrailingSpace",!1,function(t,n,o){o==e.Init&&(o=!1),o&&!n?t.removeOverlay("trailingspace"):!o&&n&&t.addOverlay({token:function(e){for(var t=e.string.length,n=t;n&&/\s/.test(e.string.charAt(n-1));--n);return n>e.pos?(e.pos=n,null):(e.pos=t,"trailingspace")},name:"trailingspace"})})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n){var o,r=e.getWrapperElement();return o=r.appendChild(document.createElement("div")),o.className=n?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?o.innerHTML=t:o.appendChild(t),o}function n(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(o,r,i){function a(e){if("string"==typeof e)u.value=e;else{if(f)return;f=!0,s.parentNode.removeChild(s),c.focus(),i.onClose&&i.onClose(s)}}i||(i={}),n(this,null);var l,s=t(this,o,i.bottom),f=!1,c=this,u=s.getElementsByTagName("input")[0];return u?(i.value&&(u.value=i.value,u.select()),i.onInput&&e.on(u,"input",function(e){i.onInput(e,u.value,a)}),i.onKeyUp&&e.on(u,"keyup",function(e){i.onKeyUp(e,u.value,a)}),e.on(u,"keydown",function(t){i&&i.onKeyDown&&i.onKeyDown(t,u.value,a)||((27==t.keyCode||i.closeOnEnter!==!1&&13==t.keyCode)&&(u.blur(),e.e_stop(t),a()),13==t.keyCode&&r(u.value,t))}),i.closeOnBlur!==!1&&e.on(u,"blur",a),u.focus()):(l=s.getElementsByTagName("button")[0])&&(e.on(l,"click",function(){a(),c.focus()}),i.closeOnBlur!==!1&&e.on(l,"blur",a),l.focus()),a}),e.defineExtension("openConfirm",function(o,r,i){function a(){f||(f=!0,l.parentNode.removeChild(l),c.focus())}n(this,null);var l=t(this,o,i&&i.bottom),s=l.getElementsByTagName("button"),f=!1,c=this,u=1;s[0].focus();for(var d=0;d=u&&a()},200)}),e.on(h,"focus",function(){++u})}}),e.defineExtension("openNotification",function(o,r){function i(){s||(s=!0,clearTimeout(a),l.parentNode.removeChild(l))}n(this,i);var a,l=t(this,o,r&&r.bottom),s=!1,f=r&&"undefined"!=typeof r.duration?r.duration:5e3;return e.on(l,"click",function(t){e.e_preventDefault(t),i()}),f&&(a=setTimeout(i,f)),i})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,i){if(this.atOccurrence=!1,this.doc=e,null==i&&"string"==typeof t&&(i=!1),r=r?e.clipPos(r):o(0,0),this.pos={from:r,to:r},"string"!=typeof t)t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(n,r){if(n){t.lastIndex=0;for(var i,a,l=e.getLine(r.line).slice(0,r.ch),s=0;;){t.lastIndex=s;var f=t.exec(l);if(!f)break;if(i=f,a=i.index,s=i.index+(i[0].length||1),s==l.length)break}var c=i&&i[0].length||0;c||(0==a&&0==l.length?i=void 0:a!=e.getLine(r.line).length&&c++)}else{t.lastIndex=r.ch;var l=e.getLine(r.line),i=t.exec(l),c=i&&i[0].length||0,a=i&&i.index;a+c==l.length||c||(c=1)}return i&&c?{from:o(r.line,a),to:o(r.line,a+c),match:i}:void 0};else{var a=t;i&&(t=t.toLowerCase());var l=i?function(e){return e.toLowerCase()}:function(e){return e},s=t.split("\n");if(1==s.length)this.matches=t.length?function(r,i){if(r){var s=e.getLine(i.line).slice(0,i.ch),f=l(s),c=f.lastIndexOf(t);if(c>-1)return c=n(s,f,c),{from:o(i.line,c),to:o(i.line,c+a.length)}}else{var s=e.getLine(i.line).slice(i.ch),f=l(s),c=f.indexOf(t);if(c>-1)return c=n(s,f,c)+i.ch,{from:o(i.line,c),to:o(i.line,c+a.length)}}}:function(){};else{var f=a.split("\n");this.matches=function(t,n){var r=s.length-1;if(t){if(n.line-(s.length-1)=1;--c,--a)if(s[c]!=l(e.getLine(a)))return;var u=e.getLine(a),d=u.length-f[0].length;if(l(u.slice(d))!=s[0])return;return{from:o(a,d),to:i}}if(!(n.line+(s.length-1)>e.lastLine())){var u=e.getLine(n.line),d=u.length-f[0].length;if(l(u.slice(d))==s[0]){for(var h=o(n.line,d),a=n.line+1,c=1;r>c;++c,++a)if(s[c]!=l(e.getLine(a)))return;if(l(e.getLine(a).slice(0,f[r].length))==s[r])return{from:h,to:o(a,f[r].length)}}}}}}}function n(e,t,n){if(e.length==t.length)return n;for(var o=Math.min(n,e.length);;){var r=e.slice(0,o).toLowerCase().length;if(n>r)++o;else{if(!(r>n))return o;--o}}}var o=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=o(e,0);return n.pos={from:t,to:t},n.atOccurrence=!1,!1}for(var n=this,r=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,r))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!r.line)return t(0);r=o(r.line-1,this.doc.getLine(r.line-1).length)}else{var i=this.doc.lineCount();if(r.line==i-1)return t(i);r=o(r.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(t){if(this.atOccurrence){var n=e.splitLines(t);this.doc.replaceRange(n,this.pos.from,this.pos.to),this.pos.to=o(this.pos.from.line+n.length-1,n[n.length-1].length+(1==n.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,n,o){return new t(this.doc,e,n,o)}),e.defineDocExtension("getSearchCursor",function(e,n,o){return new t(this,e,n,o)}),e.defineExtension("selectMatches",function(t,n){for(var o,r=[],i=this.getSearchCursor(t,this.getCursor("from"),n);(o=i.findNext())&&!(e.cmpPos(i.to(),this.getCursor("to"))>0);)r.push({anchor:i.from(),head:i.to()});r.length&&this.setSelections(r,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var n=e.exec(t.string);return n&&n.index==t.pos?(t.pos+=n[0].length,"searching"):void(n?t.pos=n.index:t.skipToEnd())}}}function n(){this.posFrom=this.posTo=this.query=null,this.overlay=null}function o(e){return e.state.search||(e.state.search=new n)}function r(e){return"string"==typeof e&&e==e.toLowerCase()}function i(e,t,n){return e.getSearchCursor(t,n,r(t))}function a(e,t,n,o,r){e.openDialog?e.openDialog(t,r,{value:o}):r(prompt(n,o))}function l(e,t,n,o){e.openConfirm?e.openConfirm(t,o):confirm(n)&&o[0]()}function s(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(n){}return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function f(e,n){var i=o(e);return i.query?c(e,n):void a(e,h,"Search for:",e.getSelection(),function(o){e.operation(function(){o&&!i.query&&(i.query=s(o),e.removeOverlay(i.overlay,r(i.query)),i.overlay=t(i.query,r(i.query)),e.addOverlay(i.overlay),e.showMatchesOnScrollbar&&(i.annotate&&(i.annotate.clear(),i.annotate=null),i.annotate=e.showMatchesOnScrollbar(i.query,r(i.query))),i.posFrom=i.posTo=e.getCursor(),c(e,n))})})}function c(t,n){t.operation(function(){var r=o(t),a=i(t,r.query,n?r.posFrom:r.posTo);(a.find(n)||(a=i(t,r.query,n?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),a.find(n)))&&(t.setSelection(a.from(),a.to()),t.scrollIntoView({from:a.from(),to:a.to()}),r.posFrom=a.from(),r.posTo=a.to())})}function u(e){e.operation(function(){var t=o(e);t.query&&(t.query=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function d(e,t){e.getOption("readOnly")||a(e,p,"Replace:",e.getSelection(),function(n){n&&(n=s(n),a(e,m,"Replace with:","",function(o){if(t)e.operation(function(){for(var t=i(e,n);t.findNext();)if("string"!=typeof n){var r=e.getRange(t.from(),t.to()).match(n);t.replace(o.replace(/\$(\d)/g,function(e,t){return r[t]}))}else t.replace(o)});else{u(e);var r=i(e,n,e.getCursor()),a=function(){var t,o=r.from();!(t=r.findNext())&&(r=i(e,n),!(t=r.findNext())||o&&r.from().line==o.line&&r.from().ch==o.ch)||(e.setSelection(r.from(),r.to()),e.scrollIntoView({from:r.from(),to:r.to()}),l(e,g,"Replace?",[function(){s(t)},a]))},s=function(e){r.replace("string"==typeof n?o:o.replace(/\$(\d)/g,function(t,n){return e[n]})),a()};a()}}))})}var h='Search: (Use /re/ syntax for regexp search)',p='Replace: (Use /re/ syntax for regexp search)',m='With: ',g="Replace? ";e.commands.find=function(e){u(e),f(e)},e.commands.findNext=f,e.commands.findPrev=function(e){f(e,!0)},e.commands.clearSearch=u,e.commands.replace=d,e.commands.replaceAll=function(e){d(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){function n(e){clearTimeout(o.doRedraw),o.doRedraw=setTimeout(function(){o.redraw()},e)}this.cm=e,this.options=t,this.buttonHeight=t.scrollButtonHeight||e.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=e.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var o=this;e.on("refresh",this.resizeHandler=function(){clearTimeout(o.doUpdate),o.doUpdate=setTimeout(function(){o.computeScale()&&n(20)},100)}),e.on("markerAdded",this.resizeHandler),e.on("markerCleared",this.resizeHandler),t.listenForChanges!==!1&&e.on("change",this.changeHandler=function(){n(250)})}e.defineExtension("annotateScrollbar",function(e){return"string"==typeof e&&(e={className:e}),new t(this,e)}),e.defineOption("scrollButtonHeight",0),t.prototype.computeScale=function(){var e=this.cm,t=(e.getWrapperElement().clientHeight-e.display.barHeight-2*this.buttonHeight)/e.heightAtLine(e.lastLine()+1,"local");return t!=this.hScale?(this.hScale=t,!0):void 0},t.prototype.update=function(e){this.annotations=e,this.redraw()},t.prototype.redraw=function(e){e!==!1&&this.computeScale();var t=this.cm,n=this.hScale,o=document.createDocumentFragment(),r=this.annotations;if(t.display.barWidth)for(var i,a=0;af+.9));)l=r[++a],f=t.charCoords(l.to,"local").bottom*n;if(f!=s){var c=Math.max(f-s,3),u=o.appendChild(document.createElement("div"));u.style.cssText="position: absolute; right: 0px; width: "+Math.max(t.display.barWidth-1,2)+"px; top: "+(s+this.buttonHeight)+"px; height: "+c+"px",u.className=this.options.className}}this.div.textContent="",this.div.appendChild(o)},t.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n,o){this.cm=e;var r={listenForChanges:!1};for(var i in o)r[i]=o[i];r.className||(r.className="CodeMirror-search-match"),this.annotation=e.annotateScrollbar(r),this.query=t,this.caseFold=n,this.gap={from:e.firstLine(),to:e.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var a=this;e.on("change",this.changeHandler=function(e,t){a.onChange(t)})}function n(e,t,n){return t>=e?e:Math.max(t,e+n)}e.defineExtension("showMatchesOnScrollbar",function(e,n,o){return"string"==typeof o&&(o={className:o}),o||(o={}),new t(this,e,n,o)});var o=1e3;t.prototype.findMatches=function(){if(this.gap){for(var t=0;t=this.gap.to)break;n.to.line>=this.gap.from&&this.matches.splice(t--,1)}for(var r=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),this.caseFold);r.findNext();){var n={from:r.from(),to:r.to()};if(n.from.line>=this.gap.to)break;if(this.matches.splice(t++,0,n),this.matches.length>o)break}this.gap=null}},t.prototype.onChange=function(t){var o=t.from.line,r=e.changeEnd(t).line,i=r-t.to.line;if(this.gap?(this.gap.from=Math.min(n(this.gap.from,o,i),t.from.line),this.gap.to=Math.max(n(this.gap.to,o,i),t.from.line)):this.gap={from:t.from.line,to:r+1},i)for(var a=0;af.ch&&(v=v.slice(0,v.length-c.end+f.ch));var y=v.toLowerCase();if(!v||"string"==c.type&&(c.end!=f.ch||!/[\"\']/.test(c.string.charAt(c.string.length-1))||1==c.string.length)||"tag"==c.type&&"closeTag"==d.type||c.string.indexOf("/")==c.string.length-1||m&&r(m,y)>-1||i(t,v,f,d,!0))return e.Pass;var b=g&&r(g,y)>-1;o[s]={indent:b,text:">"+(b?"\n\n":"")+""+v+">",newPos:b?e.Pos(f.line+1,0):e.Pos(f.line,f.ch+1)}}for(var s=n.length-1;s>=0;s--){var C=o[s];t.replaceRange(C.text,n[s].head,n[s].anchor,"+insert");var x=t.listSelections().slice(0);x[s]={head:C.newPos,anchor:C.newPos},t.setSelections(x),C.indent&&(t.indentLine(C.newPos.line,null,!0),t.indentLine(C.newPos.line+1,null,!0))}}function n(t,n){for(var o=t.listSelections(),r=[],a=n?"/":"",l=0;l";else{if("htmlmixed"!=t.getMode().name||"css"!=c.mode.name)return e.Pass;r[l]=a+"style>"}else{if(!u.context||!u.context.tagName||i(t,u.context.tagName,s,u))return e.Pass;r[l]=a+u.context.tagName+">"}}t.replaceSelections(r),o=t.listSelections();for(var l=0;ln;++n)if(e[n]==t)return n;return-1}function i(t,n,o,r,i){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,o.line+500),l=e.scanForClosingTag(t,o,null,a);if(!l||l.tag!=n)return!1;for(var s=r.context,f=i?1:0;s&&s.tagName==n;s=s.prev)++f;o=l.to;for(var c=1;f>c;c++){var u=e.scanForClosingTag(t,o,null,a);if(!u||u.tag!=n)return!1;o=u.to}return!0}e.defineOption("autoCloseTags",!1,function(n,r,i){if(i!=e.Init&&i&&n.removeKeyMap("autoCloseTags"),r){var a={name:"autoCloseTags"};("object"!=typeof r||r.whenClosing)&&(a["'/'"]=function(e){return o(e)}),("object"!=typeof r||r.whenOpening)&&(a["'>'"]=function(e){return t(e)}),n.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],l=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return n(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,r,i,a){function l(e){var n=s(t,r);if(!n||n.to.line-n.from.linet.firstLine();)r=e.Pos(r.line-1,0),c=l(!1);if(c&&!c.cleared&&"unfold"!==a){var u=n(t,i);e.on(u,"mousedown",function(t){d.clear(),e.e_preventDefault(t)});var d=t.markText(c.from,c.to,{replacedWith:u,clearOnEnter:!0,__isFold:!0});d.on("clear",function(n,o){e.signal(t,"unfold",t,n,o)}),e.signal(t,"fold",t,c.from,c.to)}}function n(e,t){var n=o(e,t,"widget");if("string"==typeof n){var r=document.createTextNode(n);n=document.createElement("span"),n.appendChild(r),n.className="CodeMirror-foldmarker"}return n}function o(e,t,n){if(t&&void 0!==t[n])return t[n];var o=e.options.foldOptions;return o&&void 0!==o[n]?o[n]:r[n]}e.newFoldFunction=function(e,n){return function(o,r){t(o,r,{rangeFinder:e,widget:n})}},e.defineExtension("foldCode",function(e,n,o){t(this,e,n,o)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),n=0;n=n;n++)t.foldCode(e.Pos(n,0),null,"fold")})},e.commands.unfoldAll=function(t){t.operation(function(){for(var n=t.firstLine(),o=t.lastLine();o>=n;n++)t.foldCode(e.Pos(n,0),null,"unfold")})},e.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,n){for(var o=0;o=l&&(n=r(i.indicatorOpen))}e.setGutterMarker(t,i.gutter,n),++a})}function a(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){i(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function l(e,t,n){var o=e.state.foldGutter;if(o){var r=o.options;n==r.gutter&&e.foldCode(u(t,0),r.rangeFinder)}}function s(e){var t=e.state.foldGutter;if(t){var n=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){a(e)},n.foldOnChangeTimeSpan||600)}}function f(e){var t=e.state.foldGutter;if(t){var n=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var n=e.getViewport();t.from==t.to||n.from-t.to>20||t.from-n.to>20?a(e):e.operation(function(){n.fromt.to&&(i(e,t.to,n.to),t.to=n.to)})},n.updateViewportTimeSpan||400)}}function c(e,t){var n=e.state.foldGutter;if(n){var o=t.line;o>=n.from&&o=s;++s){var c=t.getLine(s),u=i(c);if(u>a)l=s;else if(/\S/.test(c))break}return l?{from:e.Pos(n.line,r.length),to:e.Pos(l,t.getLine(l).length)}:void 0}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","brace",function(t,n){function o(o){for(var r=n.ch,s=0;;){var f=0>=r?-1:l.lastIndexOf(o,r-1);if(-1!=f){if(1==s&&f=p;++p)for(var m=t.getLine(p),g=p==a?r:0;;){var v=m.indexOf(s,g),y=m.indexOf(f,g);if(0>v&&(v=m.length),0>y&&(y=m.length),g=Math.min(v,y),g==m.length)break;if(t.getTokenTypeAt(e.Pos(p,g+1))==i)if(g==v)++d;else if(!--d){c=p,u=g;break e}++g}if(null!=c&&(a!=c||u!=r))return{from:e.Pos(a,r),to:e.Pos(c,u)}}}),e.registerHelper("fold","import",function(t,n){function o(n){if(nt.lastLine())return null;var o=t.getTokenAt(e.Pos(n,1));if(/\S/.test(o.string)||(o=t.getTokenAt(e.Pos(n,o.end+1))),"keyword"!=o.type||"import"!=o.string)return null;for(var r=n,i=Math.min(t.lastLine(),n+10);i>=r;++r){var a=t.getLine(r),l=a.indexOf(";");if(-1!=l)return{startCh:o.end,end:e.Pos(r,l)}}}var r,n=n.line,i=o(n);if(!i||o(n-1)||(r=o(n-2))&&r.end.line==n-1)return null;for(var a=i.end;;){var l=o(a.line+1);if(null==l)break;a=l.end}return{from:t.clipPos(e.Pos(n,i.startCh+1)),to:a}}),e.registerHelper("fold","include",function(t,n){function o(n){if(nt.lastLine())return null;var o=t.getTokenAt(e.Pos(n,1));return/\S/.test(o.string)||(o=t.getTokenAt(e.Pos(n,o.end+1))),"meta"==o.type&&"#include"==o.string.slice(0,8)?o.start+8:void 0}var n=n.line,r=o(n);if(null==r||null!=o(n-1))return null;for(var i=n;;){var a=o(i+1);if(null==a)break;++i}return{from:e.Pos(n,r+1),to:t.clipPos(e.Pos(i))}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line-t.line||e.ch-t.ch}function n(e,t,n,o){this.line=t,this.ch=n,this.cm=e,this.text=e.getLine(t),this.min=o?o.from:e.firstLine(),this.max=o?o.to-1:e.lastLine()}function o(e,t){var n=e.cm.getTokenTypeAt(d(e.line,t));return n&&/\btag\b/.test(n)}function r(e){return e.line>=e.max?void 0:(e.ch=0,e.text=e.cm.getLine(++e.line),!0)}function i(e){return e.line<=e.min?void 0:(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0)}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(r(e))continue;return}{if(o(e,t+1)){var n=e.text.lastIndexOf("/",t),i=n>-1&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t+1}}}function l(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(i(e))continue;return}if(o(e,t+1)){m.lastIndex=t,e.ch=t;var n=m.exec(e.text);if(n&&n.index==t)return n}else e.ch=t}}function s(e){for(;;){m.lastIndex=e.ch;var t=m.exec(e.text);if(!t){if(r(e))continue;return}{if(o(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function f(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(i(e))continue;return}{if(o(e,t+1)){var n=e.text.lastIndexOf("/",t),r=n>-1&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,r?"selfClose":"regular"}e.ch=t}}}function c(e,t){for(var n=[];;){var o,r=s(e),i=e.line,l=e.ch-(r?r[0].length:0);if(!r||!(o=a(e)))return;if("selfClose"!=o)if(r[1]){for(var f=n.length-1;f>=0;--f)if(n[f]==r[2]){n.length=f;break}if(0>f&&(!t||t==r[2]))return{tag:r[2],from:d(i,l),to:d(e.line,e.ch)}}else n.push(r[2])}}function u(e,t){for(var n=[];;){var o=f(e);if(!o)return;if("selfClose"!=o){var r=e.line,i=e.ch,a=l(e);if(!a)return;if(a[1])n.push(a[2]);else{for(var s=n.length-1;s>=0;--s)if(n[s]==a[2]){n.length=s;break}if(0>s&&(!t||t==a[2]))return{tag:a[2],from:d(e.line,e.ch),to:d(r,i)}}}else l(e)}}var d=e.Pos,h="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",p=h+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",m=new RegExp("<(/?)(["+h+"]["+p+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var o=new n(e,t.line,0);;){var r,i=s(o);if(!i||o.line!=t.line||!(r=a(o)))return;if(!i[1]&&"selfClose"!=r){var t=d(o.line,o.ch),l=c(o,i[2]);return l&&{from:t,to:l.from}}}}),e.findMatchingTag=function(e,o,r){var i=new n(e,o.line,o.ch,r);if(-1!=i.text.indexOf(">")||-1!=i.text.indexOf("<")){var s=a(i),f=s&&d(i.line,i.ch),h=s&&l(i);if(s&&h&&!(t(i,o)>0)){var p={from:d(i.line,i.ch),to:f,tag:h[2]};return"selfClose"==s?{open:p,close:null,at:"open"}:h[1]?{open:u(i,h[2]),close:p,at:"close"}:(i=new n(e,f.line,f.ch,r),{open:p,close:c(i,h[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,o){for(var r=new n(e,t.line,t.ch,o);;){var i=u(r);if(!i)break;var a=new n(e,t.line,t.ch,o),l=c(a,i.tag);if(l)return{open:i,close:l}}},e.scanForClosingTag=function(e,t,o,r){var i=new n(e,t.line,t.ch,r?{from:0,to:r}:null);return c(i,o)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","markdown",function(t,n){function o(n){var o=t.getTokenTypeAt(e.Pos(n,0));return o&&/\bheader\b/.test(o)}function r(e,t,n){var r=t&&t.match(/^#+/);return r&&o(e)?r[0].length:(r=n&&n.match(/^[=\-]+\s*$/),r&&o(e+1)?"="==n[0]?1:2:i)}var i=100,a=t.getLine(n.line),l=t.getLine(n.line+1),s=r(n.line,a,l);if(s===i)return void 0;for(var f=t.lastLine(),c=n.line,u=t.getLine(c+2);f>c&&!(r(c+1,l,u)<=s);)++c,l=u,u=t.getLine(c+2);return{from:e.Pos(n.line,a.length),to:e.Pos(c,t.getLine(c).length)}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerGlobalHelper("fold","comment",function(e){return e.blockCommentStart&&e.blockCommentEnd},function(t,n){var o=t.getModeAt(n),r=o.blockCommentStart,i=o.blockCommentEnd;if(r&&i){for(var a,l=n.line,s=t.getLine(l),f=n.ch,c=0;;){var u=0>=f?-1:s.lastIndexOf(r,f-1);if(-1!=u){if(1==c&&u=g;++g)for(var v=t.getLine(g),y=g==l?a:0;;){var b=v.indexOf(r,y),C=v.indexOf(i,y);if(0>b&&(b=v.length),0>C&&(C=v.length),y=Math.min(b,C),y==v.length)break;if(y==b)++p;else if(!--p){d=g,h=y;break e}++y}if(null!=d&&(l!=d||h!=a))return{from:e.Pos(l,a),to:e.Pos(d,h)}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,n,o){return{startState:function(){return{base:e.startState(t),overlay:e.startState(n),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(o){return{base:e.copyState(t,o.base),overlay:e.copyState(n,o.overlay),basePos:o.basePos,baseCur:null,overlayPos:o.overlayPos,overlayCur:null}},token:function(e,r){return(e!=r.streamSeen||Math.min(r.basePos,r.overlayPos)=n.ch+1)return/\bstring2?\b/.test(l);a.start=a.pos}}function o(o,r){for(var i={name:"autoCloseBrackets",Backspace:function(n){if(n.getOption("disableInput"))return e.Pass;for(var r=n.listSelections(),i=0;i=0;i--){var l=r[i].head;n.replaceRange("",f(l.line,l.ch-1),f(l.line,l.ch+1))}}},a="",l=0;l1&&r.indexOf(t)>=0&&i.getRange(f(m.line,m.ch-2),m)==t+t&&(m.ch<=2||i.getRange(f(m.line,m.ch-3),f(m.line,m.ch-2))!=t))h="addFour";else if('"'==t||"'"==t){if(e.isWordChar(c)||!n(i,m,t))return e.Pass;h="both"}else{if(!(i.getLine(m.line).length==m.ch||a.indexOf(c)>=0||s.test(c)))return e.Pass;h="both"}else h="surround";if(l){if(l!=h)return e.Pass}else l=h}i.operation(function(){if("skip"==l)i.execCommand("goCharRight");else if("skipThree"==l)for(var e=0;3>e;e++)i.execCommand("goCharRight");else if("surround"==l){for(var n=i.getSelections(),e=0;el&&e.addOverlay(t.overlay=a(i.slice(l,s),n,t.style)))}var f=e.getCursor("from"),c=e.getCursor("to");if(f.line==c.line&&(!t.wordsOnly||r(e,f,c))){var u=e.getRange(f,c).replace(/^\s+|\s+$/g,"");u.length>=t.minChars&&e.addOverlay(t.overlay=a(u,!1,t.style))}})}function r(e,t,n){var o=e.getRange(t,n);if(null!==o.match(/^\w+$/)){if(t.ch>0){var r={line:t.line,ch:t.ch-1},i=e.getRange(r,t);if(null===i.match(/\W/))return!1}if(n.ch