// This is CodeMirror (http://codemirror.net), a code editor
// implemented in JavaScript on top of the browser's DOM.
//
// You can find some technical background for some of the code below
// at http://marijnhaverbeke.nl/blog/#cm-internals .
(function(r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else{if("function"==typeof define&&define.amd)return define([],r);this.CodeMirror=r()}})(function(){function r(a,b){if(!(this instanceof r))return new r(a,b);this.options=b=b||{};this.usercommands={};for(var c in bd)b.hasOwnProperty(c)||(b[c]=bd[c]);gc(b);var d=this.display=new Be(a,"string"==typeof b.value?0:b.value.first);d.wrapper.CodeMirror=this;cd(this);dd(this);b.lineWrapping&&(this.display.wrapper.className+=
" CodeMirror-wrap");b.autofocus&&!hc&&R(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new ic};var e=b.value;"string"==typeof e&&(e=new O(e,b.mode));K&&setTimeout(da(V,this,!0),20);Ce(this);var f=this;ea(this,function(){f.curOp.forceUpdate=!0;ed(f,e);b.autofocus&&!hc||ka()==d.input?setTimeout(da(Sa,f),20):jc(f);for(var a in Da)if(Da.hasOwnProperty(a))Da[a](f,b[a],fd);for(a=0;a<kc.length;++a)kc[a](f)})}
function Be(a,b){var c=this.input=u("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");P?c.style.width="1000px":c.setAttribute("wrap","off");Ta&&(c.style.border="1px solid black");c.setAttribute("autocorrect","off");c.setAttribute("autocapitalize","off");c.setAttribute("spellcheck","false");this.inputDiv=u("div",[c],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");this.scrollbarH=u("div",[u("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");
this.scrollbarV=u("div",[u("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");this.scrollbarFiller=u("div",null,"CodeMirror-scrollbar-filler");this.gutterFiller=u("div",null,"CodeMirror-gutter-filler");this.lineDiv=u("div",null,"CodeMirror-code");this.selectionDiv=u("div",null,null,"z-index: 1");this.cursorDiv=u("div",null,"CodeMirror-cursors");this.measure=u("div",null,"CodeMirror-measure");this.lineMeasure=u("div",null,"CodeMirror-measure");this.lineSpace=u("div",[this.measure,this.lineMeasure,
this.selectionDiv,this.lineDiv,this.cursorDiv],null,"position: relative; outline: none");this.mover=u("div",[u("div",[this.lineSpace],"CodeMirror-lines")],null,"position: relative");this.sizer=u("div",[this.mover],"CodeMirror-sizer");this.heightForcer=u("div",null,null,"position: absolute; height: "+ra+"px; width: 1px;");this.gutters=u("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=u("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex",
"-1");this.wrapper=u("div",[this.inputDiv,this.scrollbarH,this.scrollbarV,this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");Ua&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);Ta&&(c.style.width="0px");P||(this.scroller.draggable=!0);lc&&(this.inputDiv.style.height="1px",this.inputDiv.style.position="absolute");Ua&&(this.scrollbarH.style.minHeight=this.scrollbarV.style.minWidth="18px");a.appendChild?a.appendChild(this.wrapper):a(this.wrapper);this.viewFrom=this.viewTo=
b;this.view=[];this.externalMeasured=null;this.lastSizeC=this.viewOffset=0;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=this.updateLineNumbers=null;this.prevInput="";this.pollingFast=this.alignWidgets=!1;this.poll=new ic;this.cachedCharWidth=this.cachedTextHeight=null;this.inaccurateSelection=!1;this.maxLine=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1}function mc(a){a.doc.mode=r.getMode(a.options,a.doc.modeOption);
Va(a)}function Va(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null)});a.doc.frontier=a.doc.first;Wa(a,100);a.state.modeGen++;a.curOp&&S(a)}function gd(a){var b=sa(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/Xa(a.display)-3);return function(e){return Ea(a.doc,e)?0:c?(Math.ceil(e.text.length/d)||1)*b:b}}function nc(a){var b=a.doc,c=gd(a);b.iter(function(a){var b=c(a);b!=a.height&&W(a,b)})}function hd(a){var b=fa[a.options.keyMap].style;
a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(b?" cm-keymap-"+b:"")}function dd(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");Ya(a)}function Za(a){cd(a);S(a);setTimeout(function(){oc(a)},20)}function cd(a){var b=a.display.gutters,c=a.options.gutters;ta(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(u("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==
e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none";b=b.offsetWidth;a.display.sizer.style.marginLeft=b+"px";d&&(a.display.scrollbarH.style.left=a.options.fixedGutter?b+"px":0)}function vb(a){if(0==a.height)return 0;for(var b=a.text.length,c,d=a;c=ua(d,!0);)c=c.find(0,!0),d=c.from.line,b+=c.from.ch-c.to.ch;for(d=a;c=ua(d,!1);)c=c.find(0,!0),b-=d.text.length-c.from.ch,d=c.to.line,b+=d.text.length-c.to.ch;return b}function pc(a){var b=a.display;a=a.doc;
b.maxLine=t(a,a.first);b.maxLineLength=vb(b.maxLine);b.maxLineChanged=!0;a.iter(function(a){var d=vb(a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function gc(a){var b=L(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1<b&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function id(a){var b=a.display.scroller,c=a.display;return{scrollHeight:b.scrollHeight,clientHeight:b.clientHeight,barHeight:a.display.scrollbarV.clientHeight,
scrollWidth:b.scrollWidth,clientWidth:b.clientWidth,barWidth:a.display.scrollbarH.clientWidth,paddingVert:c.mover.offsetHeight-c.lineSpace.offsetHeight}}function wb(a,b){b||(b=id(a));var c=a.display,d=a.doc.height+b.paddingVert;c.sizer.style.minHeight=c.heightForcer.style.top=d+"px";c.gutters.style.height=Math.max(d,b.clientHeight-ra)+"px";var d=Math.max(d,b.scrollHeight),e=b.scrollWidth>b.clientWidth,f=d>b.clientHeight;f?(c.scrollbarV.style.display="block",c.scrollbarV.style.bottom=e?$a(c.measure)+
"px":"0",c.scrollbarV.firstChild.style.height=Math.max(0,d-b.clientHeight+(b.barHeight||c.scrollbarV.clientHeight))+"px"):(c.scrollbarV.style.display="",c.scrollbarV.firstChild.style.height="0");e?(c.scrollbarH.style.display="block",c.scrollbarH.style.right=f?$a(c.measure)+"px":"0",c.scrollbarH.firstChild.style.width=b.scrollWidth-b.clientWidth+(b.barWidth||c.scrollbarH.clientWidth)+"px"):(c.scrollbarH.style.display="",c.scrollbarH.firstChild.style.width="0");e&&f?(c.scrollbarFiller.style.display=
"block",c.scrollbarFiller.style.height=c.scrollbarFiller.style.width=$a(c.measure)+"px"):c.scrollbarFiller.style.display="";e&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=$a(c.measure)+"px",c.gutterFiller.style.width=c.gutters.offsetWidth+"px"):c.gutterFiller.style.display="";De&&0===$a(c.measure)&&(c.scrollbarV.style.minWidth=c.scrollbarH.style.minHeight=Ee?"18px":"12px",c.scrollbarV.style.pointerEvents=c.scrollbarH.style.pointerEvents=
"none")}function qc(a,b,c){var d=c&&null!=c.top?c.top:a.scroller.scrollTop,e=c&&c.height||a.wrapper.clientHeight,d=Math.floor(d-a.lineSpace.offsetTop),e=Math.ceil(d+e),d=va(b,d),e=va(b,e);if(c&&c.ensure){var f=c.ensure.from.line;c=c.ensure.to.line;if(f<d)return{from:f,to:va(b,la(t(b,f))-a.wrapper.clientHeight)};if(Math.min(c,b.lastLine())>=e)return{from:va(b,la(t(b,c))+a.wrapper.clientHeight),to:c}}return{from:d,to:e}}function oc(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&
a.options.fixedGutter){for(var d=rc(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&c[g].gutter&&(c[g].gutter.style.left=f);var h=c[g].alignable;if(h)for(var k=0;k<h.length;k++)h[k].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function sc(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function rc(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}
function xb(a,b,c){for(var d=a.display.viewFrom,e=a.display.viewTo,f,g=qc(a.display,a.doc,b),h=!0;;h=!1){var k=a.display.scroller.clientWidth,l;l=a;var n=g,p=l.display,m=l.doc;if(p.wrapper.offsetWidth)if(!c&&n.from>=p.viewFrom&&n.to<=p.viewTo&&0==jd(l))l=void 0;else{var q;q=l;if(q.options.lineNumbers){var s=q.doc,E=sc(q.options,s.first+s.size-1),s=q.display;if(E.length!=s.lineNumChars){var r=s.measure.appendChild(u("div",[u("div",E)],"CodeMirror-linenumber CodeMirror-gutter-elt")),A=r.firstChild.offsetWidth,
r=r.offsetWidth-A;s.lineGutter.style.width="";s.lineNumInnerWidth=Math.max(A,s.lineGutter.offsetWidth-r);s.lineNumWidth=s.lineNumInnerWidth+r;s.lineNumChars=s.lineNumInnerWidth?E.length:-1;s.lineGutter.style.width=s.lineNumWidth+"px";E=s.gutters.offsetWidth;s.scrollbarH.style.left=q.options.fixedGutter?E+"px":0;s.sizer.style.marginLeft=E+"px";q=!0}else q=!1}else q=!1;q&&tc(l);q=kd(l);A=m.first+m.size;s=Math.max(n.from-l.options.viewportMargin,m.first);E=Math.min(A,n.to+l.options.viewportMargin);p.viewFrom<
s&&20>s-p.viewFrom&&(s=Math.max(m.first,p.viewFrom));p.viewTo>E&&20>p.viewTo-E&&(E=Math.min(A,p.viewTo));Fa&&(s=ld(l.doc,s),E=md(l.doc,E));n=s!=p.viewFrom||E!=p.viewTo||p.lastSizeC!=p.wrapper.clientHeight;m=l;A=m.display;0==A.view.length||s>=A.viewTo||E<=A.viewFrom?(A.view=yb(m,s,E),A.viewFrom=s):(A.viewFrom>s?A.view=yb(m,s,A.viewFrom).concat(A.view):A.viewFrom<s&&(A.view=A.view.slice(ga(m,s))),A.viewFrom=s,A.viewTo<E?A.view=A.view.concat(yb(m,A.viewTo,E)):A.viewTo>E&&(A.view=A.view.slice(0,ga(m,
E))));A.viewTo=E;p.viewOffset=la(t(l.doc,p.viewFrom));l.display.mover.style.top=p.viewOffset+"px";m=jd(l);if(n||0!=m||c){if(4<m){var v=ka();p.lineDiv.style.display="none"}Fe(l,p.updateLineNumbers,q);4<m&&(p.lineDiv.style.display="",v&&ka()!=v&&v.offsetHeight&&v.focus());p.gutters.style.height="";ta(p.cursorDiv);ta(p.selectionDiv);n&&(p.lastSizeC=p.wrapper.clientHeight,Wa(l,400));l=l.display;c=l.lineDiv.offsetTop;for(p=0;p<l.view.length;p++)if(n=l.view[p],!n.hidden&&(Ua?(q=n.node.offsetTop+n.node.offsetHeight,
m=q-c,c=q):(m=n.node.getBoundingClientRect(),m=m.bottom-m.top),q=n.line.height-m,2>m&&(m=sa(l)),0.001<q||-0.001>q))if(W(n.line,m),nd(n.line),n.rest)for(m=0;m<n.rest.length;m++)nd(n.rest[m]);l=!0}else l=void 0}else tc(l),l=void 0;if(!l)break;f=!0;l=id(a);uc(a);wb(a,l);if(h&&a.options.lineWrapping&&k!=a.display.scroller.clientWidth)c=!0;else if(c=!1,b&&null!=b.top&&(b={top:Math.min(l.scrollHeight-l.clientHeight,b.top)}),g=qc(a.display,a.doc,b),g.from>=a.display.viewFrom&&g.to<=a.display.viewTo)break}a.display.updateLineNumbers=
null;f&&(M(a,"update",a),a.display.viewFrom==d&&a.display.viewTo==e||M(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo));return f}function nd(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function kd(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:rc(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,
wrapperWidth:b.wrapper.clientWidth}}function Fe(a,b,c){function d(b){var c=b.nextSibling;P&&wa&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return c}for(var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,k=e.view,e=e.viewFrom,l=0;l<k.length;l++){var n=k[l];if(!n.hidden)if(n.node){for(;h!=n.node;)h=d(h);h=f&&null!=b&&b<=e&&n.lineNumber;n.changes&&(-1<L(n.changes,"gutter")&&(h=!1),od(a,n,e,c));h&&(ta(n.lineNumber),n.lineNumber.appendChild(document.createTextNode(sc(a.options,
e))));h=n.node.nextSibling}else{var p=Ge(a,n,e,c);g.insertBefore(p,h)}e+=n.size}for(;h;)h=d(h)}function od(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];if("text"==f){var f=b,g=f.text.className,h=pd(a,f);f.text==f.node&&(f.node=h.pre);f.text.parentNode.replaceChild(h.pre,f.text);f.text=h.pre;h.bgClass!=f.bgClass||h.textClass!=f.textClass?(f.bgClass=h.bgClass,f.textClass=h.textClass,vc(f)):g&&(f.text.className=g)}else if("gutter"==f)qd(a,b,c,d);else if("class"==f)vc(b);else if("widget"==
f){f=b;g=d;f.alignable&&(f.alignable=null);for(var h=f.node.firstChild,k=void 0;h;h=k)k=h.nextSibling,"CodeMirror-linewidget"==h.className&&f.node.removeChild(h);rd(f,g)}}b.changes=null}function zb(a){a.node==a.text&&(a.node=u("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),Ua&&(a.node.style.zIndex=2));return a.node}function pd(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=
null,b.measure=c.measure,c.built):sd(a,b)}function vc(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;b&&(b+=" CodeMirror-linebackground");if(a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=zb(a);a.background=c.insertBefore(u("div",null,b),c.firstChild)}a.line.wrapClass?zb(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");a.text.className=(a.textClass?a.textClass+" "+(a.line.textClass||
""):a.line.textClass)||""}function qd(a,b,c,d){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);var e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=zb(b),f=b.gutter=f.insertBefore(u("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px"),b.text);!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=f.appendChild(u("div",sc(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+
"px; width: "+a.display.lineNumInnerWidth+"px")));if(e)for(b=0;b<a.options.gutters.length;++b){c=a.options.gutters[b];var g=e.hasOwnProperty(c)&&e[c];g&&f.appendChild(u("div",[g],"CodeMirror-gutter-elt","left: "+d.gutterLeft[c]+"px; width: "+d.gutterWidth[c]+"px"))}}}function Ge(a,b,c,d){var e=pd(a,b);b.text=b.node=e.pre;e.bgClass&&(b.bgClass=e.bgClass);e.textClass&&(b.textClass=e.textClass);vc(b);qd(a,b,c,d);rd(b,d);return b.node}function rd(a,b){td(a.line,a,b,!0);if(a.rest)for(var c=0;c<a.rest.length;c++)td(a.rest[c],
a,b,!1)}function td(a,b,c,d){if(a.widgets){var e=zb(b),f=0;for(a=a.widgets;f<a.length;++f){var g=a[f],h=u("div",[g.node],"CodeMirror-linewidget");g.handleMouseEvents||(h.ignoreEvents=!0);var k=g,l=h,n=c;if(k.noHScroll){(b.alignable||(b.alignable=[])).push(l);var p=n.wrapperWidth;l.style.left=n.fixedPos+"px";k.coverGutter||(p-=n.gutterTotalWidth,l.style.paddingLeft=n.gutterTotalWidth+"px");l.style.width=p+"px"}k.coverGutter&&(l.style.zIndex=5,l.style.position="relative",k.noHScroll||(l.style.marginLeft=
-n.gutterTotalWidth+"px"));d&&g.above?e.insertBefore(h,b.gutter||b.text):e.appendChild(h);M(g,"redraw")}}}function wc(a){return v(a.line,a.ch)}function xc(a,b){return 0>x(a,b)?b:a}function yc(a,b){return 0>x(a,b)?a:b}function X(a,b){this.ranges=a;this.primIndex=b}function D(a,b){this.anchor=a;this.head=b}function ha(a,b){var c=a[b];a.sort(function(a,b){return x(a.from(),b.from())});b=L(a,c);for(c=1;c<a.length;c++){var d=a[c],e=a[c-1];if(0<=x(e.to(),d.from())){var f=yc(e.from(),d.from()),g=xc(e.to(),
d.to()),d=f==e.head||f==d.head;c<=b&&--b;a.splice(c-- -1,2,new D(d?g:f,d?f:g))}}return new X(a,b)}function ia(a,b){return new X([new D(a,b||a)],0)}function w(a,b){if(b.line<a.first)return v(a.first,0);var c=a.first+a.size-1;if(b.line>c)return v(c,t(a,c).text.length);var c=t(a,b.line).text.length,d=b.ch,c=null==d||d>c?v(b.line,c):0>d?v(b.line,0):b;return c}function ab(a,b){return b>=a.first&&b<a.first+a.size}function ud(a,b,c,d){return a.cm&&a.cm.display.shift||a.extend?(a=b.anchor,d&&(b=0>x(c,a),
b!=0>x(d,a)?(a=c,c=d):b!=0>x(c,d)&&(c=d)),new D(a,c)):new D(d||c,c)}function bb(a,b,c,d){H(a,new X([ud(a,a.sel.primary(),b,c)],0),d)}function vd(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=ud(a,a.sel.ranges[e],b[e],null);b=ha(d,a.sel.primIndex);H(a,b,c)}function He(a,b){var c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new D(w(a,b[c].anchor),w(a,b[c].head))}};G(a,"beforeSelectionChange",a,c);a.cm&&G(a.cm,"beforeSelectionChange",a.cm,c);return c.ranges!=
b.ranges?ha(c.ranges,c.ranges.length-1):b}function wd(a,b,c){var d=a.history.done,e=B(d);e&&e.ranges?(d[d.length-1]=b,Ab(a,b,c)):H(a,b,c)}function H(a,b,c){Ab(a,b,c);b=a.sel;c=a.cm?a.cm.curOp.id:NaN;var d=a.history,e=d.pendingSelection,f=+new Date;e&&!d.atomicSelection&&c!=d.lastOp&&(e.ranges.length!=b.ranges.length||b.somethingSelected()!=e.somethingSelected()||f-d.pendingSelTime>(a.cm?a.cm.options.historySelectionEventDelay:1E3))&&cb(a,d.done);d.pendingSelection=b;d.pendingSelTime=f;d.lastOp=c}
function Ab(a,b,c){if(Y(a,"beforeSelectionChange")||a.cm&&Y(a.cm,"beforeSelectionChange"))b=He(a,b);var d=0>x(b.primary().head,a.sel.primary().head)?-1:1;xd(a,yd(a,b,d,!0));!1!==c&&a.cm&&Ga(a.cm)}function xd(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=a.cm.curOp.cursorActivity=!0),M(a,"cursorActivity",a))}function zd(a){xd(a,yd(a,a.sel,null,!1),!1)}function yd(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=Bb(a,g.anchor,c,d),k=Bb(a,g.head,
c,d);if(e||h!=g.anchor||k!=g.head)e||(e=b.ranges.slice(0,f)),e[f]=new D(h,k)}return e?ha(e,b.primIndex):b}function Bb(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=t(a,f.line);if(h.markedSpans)for(var k=0;k<h.markedSpans.length;++k){var l=h.markedSpans[k],n=l.marker;if((null==l.from||(n.inclusiveLeft?l.from<=f.ch:l.from<f.ch))&&(null==l.to||(n.inclusiveRight?l.to>=f.ch:l.to>f.ch))){if(d&&(G(n,"beforeCursorEnter"),n.explicitlyCleared))if(h.markedSpans){--k;continue}else break;if(n.atomic){k=
n.find(0>g?-1:1);if(0==x(k,f)&&(k.ch+=g,0>k.ch?k=k.line>a.first?w(a,v(k.line-1)):null:k.ch>h.text.length&&(k=k.line<a.first+a.size-1?v(k.line+1,0):null),!k)){if(e){if(!d)return Bb(a,b,c,!0);a.cantEdit=!0;return v(a.first,0)}e=!0;k=b;g=-g}f=k;continue a}}}return f}}function uc(a){for(var b=a.display,c=a.doc,d=document.createDocumentFragment(),e=document.createDocumentFragment(),f=0;f<c.sel.ranges.length;f++){var g=c.sel.ranges[f],h=g.empty();if(h||a.options.showCursorWhenSelecting){var k=a,l=d,n=ja(k,
g.head,"div"),p=l.appendChild(u("div","\u00a0","CodeMirror-cursor"));p.style.left=n.left+"px";p.style.top=n.top+"px";p.style.height=Math.max(0,n.bottom-n.top)*k.options.cursorHeight+"px";n.other&&(k=l.appendChild(u("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor")),k.style.display="",k.style.left=n.other.left+"px",k.style.top=n.other.top+"px",k.style.height=0.85*(n.other.bottom-n.other.top)+"px")}h||Ie(a,g,e)}a.options.moveInputWithCursor&&(c=ja(a,c.sel.primary().head,"div"),f=b.wrapper.getBoundingClientRect(),
g=b.lineDiv.getBoundingClientRect(),a=Math.max(0,Math.min(b.wrapper.clientHeight-10,c.top+g.top-f.top)),c=Math.max(0,Math.min(b.wrapper.clientWidth-10,c.left+g.left-f.left)),b.inputDiv.style.top=a+"px",b.inputDiv.style.left=c+"px");Z(b.cursorDiv,d);Z(b.selectionDiv,e)}function Ie(a,b,c){function d(a,b,c,d){0>b&&(b=0);h.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?k-a:c)+"px; height: "+(d-b)+"px"))}function e(b,c,e){var f=t(g,b),
h=f.text.length,n,p;Je($(f),c||0,null==e?h:e,function(g,r,u){var t=Cb(a,v(b,g),"div",f,"left"),w,y;g==r?(w=t,u=y=t.left):(w=Cb(a,v(b,r-1),"div",f,"right"),"rtl"==u&&(u=t,t=w,w=u),u=t.left,y=w.right);null==c&&0==g&&(u=l);3<w.top-t.top&&(d(u,t.top,null,t.bottom),u=l,t.bottom<w.top&&d(u,t.bottom,null,w.top));null==e&&r==h&&(y=k);if(!n||t.top<n.top||t.top==n.top&&t.left<n.left)n=t;if(!p||w.bottom>p.bottom||w.bottom==p.bottom&&w.right>p.right)p=w;u<l+1&&(u=l);d(u,w.top,y-u,w.bottom)});return{start:n,end:p}}
var f=a.display,g=a.doc,h=document.createDocumentFragment(),k=f.lineSpace.offsetWidth,l=Ad(a.display),f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var n=t(g,f.line),p=t(g,b.line),p=aa(n)==aa(p),f=e(f.line,f.ch,p?n.text.length:null).end;b=e(b.line,p?0:null,b.ch).start;p&&(f.top<b.top-2?(d(f.right,f.top,null,f.bottom),d(l,b.top,b.left,b.bottom)):d(f.right,f.top,b.left-f.right,f.bottom));f.bottom<b.top&&d(l,f.bottom,null,b.top)}c.appendChild(h)}function Db(a){if(a.state.focused){var b=
a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="";0<a.options.cursorBlinkRate&&(b.blinker=setInterval(function(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate))}}function Wa(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,da(Ke,a))}function Ke(a){var b=a.doc;b.frontier<b.first&&(b.frontier=b.first);if(!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=db(b.mode,eb(a,b.frontier));ea(a,function(){b.iter(b.frontier,
Math.min(b.first+b.size,a.display.viewTo+500),function(e){if(b.frontier>=a.display.viewFrom){var f=e.styles;e.styles=Bd(a,e,d,!0);for(var g=!f||f.length!=e.styles.length,h=0;!g&&h<f.length;++h)g=f[h]!=e.styles[h];g&&ma(a,b.frontier,"text");e.stateAfter=db(b.mode,d)}else zc(a,e.text,d),e.stateAfter=0==b.frontier%5?db(b.mode,d):null;++b.frontier;if(+new Date>c)return Wa(a,a.options.workDelay),!0})})}}function Le(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>g;--b){if(b<=f.first)return f.first;
var h=t(f,b-1);if(h.stateAfter&&(!c||b<=f.frontier))return b;h=ba(h.text,null,a.options.tabSize);if(null==e||d>h)e=b-1,d=h}return e}function eb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=Le(a,b,c),g=f>d.first&&t(d,f-1).stateAfter,g=g?db(d.mode,g):Me(d.mode);d.iter(f,b,function(c){zc(a,c.text,g);c.stateAfter=f==b-1||0==f%5||f>=e.viewFrom&&f<e.viewTo?db(d.mode,g):null;++f});c&&(d.frontier=f);return g}function Ad(a){return Z(a.measure,u("pre",null,null,"text-align: left")).appendChild(u("span",
"x")).offsetLeft}function Cd(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[ga(a,b)];var c=a.display.externalMeasured;if(c&&b>=c.lineN&&b<c.lineN+c.size)return c}function Eb(a,b){var c=C(b),d=Cd(a,c);d&&!d.text?d=null:d&&d.changes&&od(a,d,c,kd(a));if(!d){var e;e=aa(b);d=C(e);e=a.display.externalMeasured=new Dd(a.doc,e,d);e.lineN=d;d=e.built=sd(a,e);e.text=d.pre;Z(a.display.lineMeasure,d.pre);d=e}a:if(e=d,e.line==b)c={map:e.measure.map,cache:e.measure.cache};else{for(var f=
0;f<e.rest.length;f++)if(e.rest[f]==b){c={map:e.measure.maps[f],cache:e.measure.caches[f]};break a}for(f=0;f<e.rest.length;f++)if(C(e.rest[f])>c){c={map:e.measure.maps[f],cache:e.measure.caches[f],before:!0};break a}c=void 0}return{line:b,view:d,rect:null,map:c.map,cache:c.cache,before:c.before,hasHeights:!1}}function Ac(a,b,c,d){b.before&&(c=-1);var e=c+(d||""),f;if(b.cache.hasOwnProperty(e))f=b.cache[e];else{b.rect||(b.rect=b.view.text.getBoundingClientRect());if(!b.hasHeights){var g=b.view,h=b.rect,
k=a.options.lineWrapping,l=k&&a.display.scroller.clientWidth;if(!g.measure.heights||k&&g.measure.width!=l){var n=g.measure.heights=[];if(k)for(g.measure.width=l,g=g.text.firstChild.getClientRects(),k=0;k<g.length-1;k++){var l=g[k],p=g[k+1];2<Math.abs(l.bottom-p.bottom)&&n.push((l.bottom+p.top)/2-h.top)}n.push(h.bottom-h.top)}b.hasHeights=!0}var h=d,n=b.map,m,q,s;for(d=0;d<n.length;d+=3){var E=n[d],r=n[d+1];if(c<E)q=0,s=1,f="left";else if(c<r)q=c-E,s=q+1;else if(d==n.length-3||c==r&&n[d+3]>c)s=r-E,
q=s-1,c>=r&&(f="right");if(null!=q){m=n[d+2];E==r&&h==(m.insertLeft?"left":"right")&&(f=h);if("left"==h&&0==q)for(;d&&n[d-2]==n[d-3]&&n[d-1].insertLeft;)m=n[(d-=3)+2],f="left";if("right"==h&&q==r-E)for(;d<n.length-3&&n[d+3]==n[d+4]&&!n[d+5].insertLeft;)m=n[(d+=3)+2],f="right";break}}if(3==m.nodeType){for(;q&&fb(b.line.text.charAt(E+q));)--q;for(;E+s<r&&fb(b.line.text.charAt(E+s));)++s;if(I&&0==q&&s==r-E)c=m.parentNode.getBoundingClientRect();else if(na&&a.options.lineWrapping){var A=gb(m,q,s).getClientRects();
c=A.length?A["right"==h?A.length-1:0]:Ed}else c=gb(m,q,s).getBoundingClientRect()}else 0<q&&(f=h="right"),c=a.options.lineWrapping&&1<(A=m.getClientRects()).length?A["right"==h?A.length-1:0]:m.getBoundingClientRect();!I||q||c&&(c.left||c.right)||(c=(m=m.parentNode.getClientRects()[0])?{left:m.left,right:m.left+Xa(a.display),top:m.top,bottom:m.bottom}:Ed);m=(c.bottom+c.top)/2-b.rect.top;q=b.view.measure.heights;for(d=0;d<q.length-1&&!(m<q[d]);d++);a=d?q[d-1]:0;m=q[d];f={left:("right"==f?c.right:c.left)-
b.rect.left,right:("left"==f?c.left:c.right)-b.rect.left,top:a,bottom:m};c.left||c.right||(f.bogus=!0);f.bogus||(b.cache[e]=f)}return{left:f.left,right:f.right,top:f.top,bottom:f.bottom}}function Fd(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function Gd(a){a.display.externalMeasure=null;ta(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)Fd(a.display.view[b])}function Ya(a){Gd(a);a.display.cachedCharWidth=
a.display.cachedTextHeight=null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function Bc(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Fb(b.widgets[e]);c.top+=f;c.bottom+=f}if("line"==d)return c;d||(d="local");b=la(b);b="local"==d?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;if("page"==d||"window"==d)a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+("window"==d?0:window.pageYOffset||(document.documentElement||
document.body).scrollTop),d=a.left+("window"==d?0:window.pageXOffset||(document.documentElement||document.body).scrollLeft),c.left+=d,c.right+=d;c.top+=b;c.bottom+=b;return c}function Hd(a,b,c){if("div"==c)return b;var d=b.left;b=b.top;"page"==c?(d-=window.pageXOffset||(document.documentElement||document.body).scrollLeft,b-=window.pageYOffset||(document.documentElement||document.body).scrollTop):"local"!=c&&c||(c=a.display.sizer.getBoundingClientRect(),d+=c.left,b+=c.top);a=a.display.lineSpace.getBoundingClientRect();
return{left:d-a.left,top:b-a.top}}function Cb(a,b,c,d,e){d||(d=t(a.doc,b.line));var f=d;b=b.ch;d=Ac(a,Eb(a,d),b,e);return Bc(a,f,d,c)}function ja(a,b,c,d,e){function f(b,f){var g=Ac(a,e,b,f?"right":"left");f?g.left=g.right:g.right=g.left;return Bc(a,d,g,c)}function g(a,b){var c=h[b],d=c.level%2;a==Cc(c)&&b&&c.level<h[b-1].level?(c=h[--b],a=Dc(c)-(c.level%2?0:1),d=!0):a==Dc(c)&&b<h.length-1&&c.level<h[b+1].level&&(c=h[++b],a=Cc(c)-c.level%2,d=!1);return d&&a==c.to&&a>c.from?f(a-1):f(a,d)}d=d||t(a.doc,
b.line);e||(e=Eb(a,d));var h=$(d);b=b.ch;if(!h)return f(b);var k=Ec(h,b),k=g(b,k);null!=hb&&(k.other=g(b,hb));return k}function Id(a,b){var c=0;a.options.lineWrapping||(c=Xa(a.display)*b.ch);var d=t(a.doc,b.line),e=la(d)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:e,bottom:e+d.height}}function Gb(a,b,c,d){a=v(a,b);a.xRel=d;c&&(a.outside=!0);return a}function Fc(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(0>c)return Gb(d.first,0,!0,-1);var e=va(d,c),f=d.first+d.size-1;if(e>f)return Gb(d.first+
d.size-1,t(d,f).text.length,!0,1);0>b&&(b=0);for(d=t(d,e);;)if(e=Ne(a,d,e,b,c),f=(d=ua(d,!1))&&d.find(0,!0),d&&(e.ch>f.from.ch||e.ch==f.from.ch&&0<e.xRel))e=C(d=f.to.line);else return e}function Ne(a,b,c,d,e){function f(d){d=ja(a,v(c,d),"line",b,l);h=!0;if(g>d.bottom)return d.left-k;if(g<d.top)return d.left+k;h=!1;return d.left}var g=e-la(b),h=!1,k=2*a.display.wrapper.clientWidth,l=Eb(a,b),n=$(b),p=b.text.length;e=Hb(b);var m=Ib(b),q=f(e),s=h,r=f(m),u=h;if(d>r)return Gb(c,m,u,1);for(;;){if(n?m==e||
m==Gc(b,e,1):1>=m-e){n=d<q||d-q<=r-d?e:m;for(d-=n==e?q:r;fb(b.text.charAt(n));)++n;return Gb(c,n,n==e?s:u,-1>d?-1:1<d?1:0)}var A=Math.ceil(p/2),t=e+A;if(n)for(var t=e,w=0;w<A;++w)t=Gc(b,t,1);w=f(t);if(w>d){m=t;r=w;if(u=h)r+=1E3;p=A}else e=t,q=w,s=h,p-=A}}function sa(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==xa){xa=u("pre");for(var b=0;49>b;++b)xa.appendChild(document.createTextNode("x")),xa.appendChild(u("br"));xa.appendChild(document.createTextNode("x"))}Z(a.measure,xa);b=
xa.offsetHeight/50;3<b&&(a.cachedTextHeight=b);ta(a.measure);return b||1}function Xa(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=u("span","xxxxxxxxxx"),c=u("pre",[b]);Z(a.measure,c);b=b.getBoundingClientRect();b=(b.right-b.left)/10;2<b&&(a.cachedCharWidth=b);return b||10}function Ha(a){a.curOp={viewChanged:!1,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivity:!1,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++Oe};Jb++||
(oa=[])}function Ia(a){var b=a.curOp,c=a.doc,d=a.display;a.curOp=null;if(b.viewChanged||b.forceUpdate||null!=b.scrollTop||b.scrollToPos&&(b.scrollToPos.from.line<d.viewFrom||b.scrollToPos.to.line>=d.viewTo)){var e=xb(a,{top:b.scrollTop,ensure:b.scrollToPos},b.forceUpdate);a.display.scroller.offsetHeight&&(a.doc.scrollTop=a.display.scroller.scrollTop)}!e&&b.selectionChanged&&uc(a);b.updateMaxLine&&pc(a);if(d.maxLineChanged&&!a.options.lineWrapping&&d.maxLine){e=d.maxLine.text.length;e=Ac(a,Eb(a,d.maxLine),
e,void 0).left;d.maxLineChanged=!1;var e=Math.max(0,e+3+ra),f=Math.max(0,d.sizer.offsetLeft+e-d.scroller.clientWidth);d.sizer.style.minWidth=e+"px";f<c.scrollLeft&&null==b.scrollLeft&&Ja(a,Math.min(d.scroller.scrollLeft,f),!0);wb(a)}null!=b.scrollTop&&d.scroller.scrollTop!=b.scrollTop&&(e=Math.max(0,Math.min(d.scroller.scrollHeight-d.scroller.clientHeight,b.scrollTop)),d.scroller.scrollTop=d.scrollbarV.scrollTop=c.scrollTop=e);null!=b.scrollLeft&&d.scroller.scrollLeft!=b.scrollLeft&&(e=Math.max(0,
Math.min(d.scroller.scrollWidth-d.scroller.clientWidth,b.scrollLeft)),d.scroller.scrollLeft=d.scrollbarH.scrollLeft=c.scrollLeft=e,oc(a));if(b.scrollToPos){a:{c=w(a.doc,b.scrollToPos.from);d=w(a.doc,b.scrollToPos.to);e=b.scrollToPos.margin;for(null==e&&(e=0);;){var f=!1,g=ja(a,c),h=d&&d!=c?ja(a,d):g,h=Kb(a,Math.min(g.left,h.left),Math.min(g.top,h.top)-e,Math.max(g.left,h.left),Math.max(g.bottom,h.bottom)+e),k=a.doc.scrollTop,l=a.doc.scrollLeft;null!=h.scrollTop&&(ib(a,h.scrollTop),1<Math.abs(a.doc.scrollTop-
k)&&(f=!0));null!=h.scrollLeft&&(Ja(a,h.scrollLeft),1<Math.abs(a.doc.scrollLeft-l)&&(f=!0));if(!f){c=g;break a}}c=void 0}b.scrollToPos.isCursor&&a.state.focused&&(d=c,e=a.display,f=e.sizer.getBoundingClientRect(),c=null,0>d.top+f.top?c=!0:d.bottom+f.top>(window.innerHeight||document.documentElement.clientHeight)&&(c=!1),null==c||Pe||(d=u("div","\u200b",null,"position: absolute; top: "+(d.top-e.viewOffset-a.display.lineSpace.offsetTop)+"px; height: "+(d.bottom-d.top+ra)+"px; left: "+d.left+"px; width: 2px;"),
a.display.lineSpace.appendChild(d),d.scrollIntoView(c),a.display.lineSpace.removeChild(d)))}b.selectionChanged&&Db(a);a.state.focused&&b.updateInput&&V(a,b.typing);c=b.maybeHiddenMarkers;d=b.maybeUnhiddenMarkers;if(c)for(e=0;e<c.length;++e)c[e].lines.length||G(c[e],"hide");if(d)for(e=0;e<d.length;++e)d[e].lines.length&&G(d[e],"unhide");var n;--Jb||(n=oa,oa=null);if(b.changeObjs)for(e=0;e<b.changeObjs.length;e++)G(a,"change",a,b.changeObjs[e]);b.cursorActivity&&G(a,"cursorActivity",a);if(n)for(e=0;e<
n.length;++e)n[e]()}function ea(a,b){if(a.curOp)return b();Ha(a);try{return b()}finally{Ia(a)}}function J(a,b){return function(){if(a.curOp)return b.apply(a,arguments);Ha(a);try{return b.apply(a,arguments)}finally{Ia(a)}}}function F(a){return function(){if(this.curOp)return a.apply(this,arguments);Ha(this);try{return a.apply(this,arguments)}finally{Ia(this)}}}function Q(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);Ha(b);try{return a.apply(this,arguments)}finally{Ia(b)}}}
function Dd(a,b,c){for(var d=this.line=b,e;d=ua(d,!1);)d=d.find(1,!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?C(B(this.rest))-c+1:1;this.node=this.text=null;this.hidden=Ea(a,b)}function yb(a,b,c){var d=[],e;for(e=b;e<c;)b=new Dd(a.doc,t(a.doc,e),e),e+=b.size,d.push(b);return d}function S(a,b,c,d){null==b&&(b=a.doc.first);null==c&&(c=a.doc.first+a.doc.size);d||(d=0);Fa&&(b=ld(a.doc,b),c=md(a.doc,c));var e=a.display;d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=
b);a.curOp.viewChanged=!0;b>=e.viewTo||(c<=e.viewFrom?(e.viewFrom+=d,e.viewTo+=d):b<=e.viewFrom&&c>=e.viewTo?tc(a):b<=e.viewFrom?(e.view=e.view.slice(ga(a,c)),e.viewFrom=c+d,e.viewTo+=d):c>=e.viewTo?(e.view=e.view.slice(0,ga(a,b)),e.viewTo=b):(e.view=e.view.slice(0,ga(a,b)).concat(yb(a,b,c+d)).concat(e.view.slice(ga(a,c))),e.viewTo+=d));if(a=e.externalMeasured)c<a.lineN?a.lineN+=d:b<a.lineN+a.size&&(e.externalMeasured=null)}function ma(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;
e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null);b<d.viewFrom||b>=d.viewTo||(a=d.view[ga(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==L(a,c)&&a.push(c)))}function tc(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function ga(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,0>b)return d}function jd(a){a=a.display.view;for(var b=0,c=0;c<a.length;c++){var d=
a[c];d.hidden||d.node&&!d.changes||++b}return b}function Lb(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){Hc(a);a.state.focused&&Lb(a)})}function jb(a){function b(){Hc(a)||c?(a.display.pollingFast=!1,Lb(a)):(c=!0,a.display.poll.set(60,b))}var c=!1;a.display.pollingFast=!0;a.display.poll.set(20,b)}function Hc(a){var b=a.display.input,c=a.display.prevInput,d=a.doc;if(!a.state.focused||Qe(b)||Mb(a)||a.options.disableInput)return!1;a.state.pasteIncoming&&a.state.fakedLastChar&&
(b.value=b.value.substring(0,b.value.length-1),a.state.fakedLastChar=!1);var e=b.value;if(e==c&&!a.somethingSelected())return!1;if(K&&!I&&a.display.inputHasSelection===e)return V(a),!1;var f=!a.curOp;f&&Ha(a);a.display.shift=!1;for(var g=0,h=Math.min(c.length,e.length);g<h&&c.charCodeAt(g)==e.charCodeAt(g);)++g;for(var h=e.slice(g),k=Ka(h),l=a.state.pasteIncoming&&1<k.length&&d.sel.ranges.length==k.length,n=d.sel.ranges.length-1;0<=n;n--){var p=d.sel.ranges[n],m=p.from(),q=p.to();g<c.length?m=v(m.line,
m.ch-(c.length-g)):a.state.overwrite&&p.empty()&&!a.state.pasteIncoming&&(q=v(q.line,Math.min(t(d,q.line).text.length,q.ch+B(k).length)));var s=a.curOp.updateInput,m={from:m,to:q,text:l?[k[n]]:k,origin:a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input"};La(a.doc,m);M(a,"inputRead",a,m);if(h&&!a.state.pasteIncoming&&a.options.electricChars&&a.options.smartIndent&&100>p.head.ch&&(!n||d.sel.ranges[n-1].head.line!=p.head.line)&&(m=a.getModeAt(p.head).electricChars))for(q=0;q<m.length;q++)if(-1<
h.indexOf(m.charAt(q))){Nb(a,p.head.line,"smart");break}}Ga(a);a.curOp.updateInput=s;a.curOp.typing=!0;1E3<e.length||-1<e.indexOf("\n")?b.value=a.display.prevInput="":a.display.prevInput=e;f&&Ia(a);a.state.pasteIncoming=a.state.cutIncoming=!1;return!0}function V(a,b){var c,d,e=a.doc;a.somethingSelected()?(a.display.prevInput="",c=e.sel.primary(),d=(c=Jd&&(100<c.to().line-c.from().line||1E3<(d=a.getSelection()).length))?"-":d||a.getSelection(),a.display.input.value=d,a.state.focused&&Ob(a.display.input),
K&&!I&&(a.display.inputHasSelection=d)):b||(a.display.prevInput=a.display.input.value="",K&&!I&&(a.display.inputHasSelection=null));a.display.inaccurateSelection=c}function R(a){"nocursor"==a.options.readOnly||hc&&ka()==a.display.input||a.display.input.focus()}function Mb(a){return a.options.readOnly||a.doc.cantEdit}function Ce(a){function b(){a.state.focused&&setTimeout(da(R,a),0)}function c(){null==h&&(h=setTimeout(function(){h=null;g.cachedCharWidth=g.cachedTextHeight=kb=null;a.setSize()},100))}
function d(){for(var a=g.wrapper.parentNode;a&&a!=document.body;a=a.parentNode);a?setTimeout(d,5E3):pa(window,"resize",c)}function e(b){ca(a,b)||Ic(b)}function f(b){g.inaccurateSelection&&(g.prevInput="",g.inaccurateSelection=!1,g.input.value=a.getSelection(),Ob(g.input));"cut"==b.type&&(a.state.cutIncoming=!0)}var g=a.display;z(g.scroller,"mousedown",J(a,Re));K?z(g.scroller,"dblclick",J(a,function(b){if(!ca(a,b)){var c=Ma(a,b);!c||Jc(a,b,"gutterClick",!0,M)||ya(a.display,b)||(N(b),b=Kd(t(a.doc,c.line).text,
c),bb(a.doc,b.from,b.to))}})):z(g.scroller,"dblclick",function(b){ca(a,b)||N(b)});z(g.lineSpace,"selectstart",function(a){ya(g,a)||N(a)});Kc||z(g.scroller,"contextmenu",function(b){Ld(a,b)});z(g.scroller,"scroll",function(){g.scroller.clientHeight&&(ib(a,g.scroller.scrollTop),Ja(a,g.scroller.scrollLeft,!0),G(a,"scroll",a))});z(g.scrollbarV,"scroll",function(){g.scroller.clientHeight&&ib(a,g.scrollbarV.scrollTop)});z(g.scrollbarH,"scroll",function(){g.scroller.clientHeight&&Ja(a,g.scrollbarH.scrollLeft)});
z(g.scroller,"mousewheel",function(b){Md(a,b)});z(g.scroller,"DOMMouseScroll",function(b){Md(a,b)});z(g.scrollbarH,"mousedown",b);z(g.scrollbarV,"mousedown",b);z(g.wrapper,"scroll",function(){g.wrapper.scrollTop=g.wrapper.scrollLeft=0});var h;z(window,"resize",c);setTimeout(d,5E3);z(g.input,"keyup",J(a,Nd));z(g.input,"input",function(){K&&!I&&a.display.inputHasSelection&&(a.display.inputHasSelection=null);jb(a)});z(g.input,"keydown",J(a,Od));z(g.input,"keypress",J(a,Pd));z(g.input,"focus",da(Sa,a));
z(g.input,"blur",da(jc,a));a.options.dragDrop&&(z(g.scroller,"dragstart",function(b){var c=a;if(K&&(!c.state.draggingText||100>+new Date-Qd))Ic(b);else if(!ca(c,b)&&!ya(c.display,b)&&(b.dataTransfer.setData("Text",c.getSelection()),b.dataTransfer.setDragImage&&!Rd)){var d=u("img",null,null,"position: fixed; left: 0; top: 0;");d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";T&&(d.width=d.height=1,c.display.wrapper.appendChild(d),d._top=d.offsetTop);b.dataTransfer.setDragImage(d,
0,0);T&&d.parentNode.removeChild(d)}}),z(g.scroller,"dragenter",e),z(g.scroller,"dragover",e),z(g.scroller,"drop",J(a,Se)));z(g.scroller,"paste",function(b){ya(g,b)||(a.state.pasteIncoming=!0,R(a),jb(a))});z(g.input,"paste",function(){if(P&&!(a.state.fakedLastChar||200>new Date-a.state.lastMiddleDown)){var b=g.input.selectionStart,c=g.input.selectionEnd;g.input.value+="$";g.input.selectionStart=b;g.input.selectionEnd=c;a.state.fakedLastChar=!0}a.state.pasteIncoming=!0;jb(a)});z(g.input,"cut",f);z(g.input,
"copy",f);lc&&z(g.sizer,"mouseup",function(){ka()==g.input&&g.input.blur();R(a)})}function ya(a,b){for(var c=b.target||b.srcElement;c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function Ma(a,b,c,d){var e=a.display;if(!c&&(c=b.target||b.srcElement,c==e.scrollbarH||c==e.scrollbarH.firstChild||c==e.scrollbarV||c==e.scrollbarV.firstChild||c==e.scrollbarFiller||c==e.gutterFiller))return null;var f,g,e=e.lineSpace.getBoundingClientRect();try{f=b.clientX-
e.left,g=b.clientY-e.top}catch(h){return null}b=Fc(a,f,g);var k;d&&1==b.xRel&&(k=t(a.doc,b.line).text).length==b.ch&&(d=ba(k,k.length,a.options.tabSize)-k.length,b=v(b.line,Math.round((f-Ad(a.display))/Xa(a.display))-d));return b}function Re(a){if(!ca(this,a)){var b=this.display;b.shift=a.shiftKey;if(ya(b,a))P||(b.scroller.draggable=!1,setTimeout(function(){b.scroller.draggable=!0},100));else if(!Jc(this,a,"gutterClick",!0,M)){var c=Ma(this,a);window.focus();switch(Sd(a)){case 1:c?Te(this,a,c):(a.target||
a.srcElement)==b.scroller&&N(a);break;case 2:P&&(this.state.lastMiddleDown=+new Date);c&&bb(this.doc,c);setTimeout(da(R,this),20);N(a);break;case 3:Kc&&Ld(this,a)}}}}function Te(a,b,c){a.state.focused||Sa(a);var d=+new Date,e;Pb&&Pb.time>d-400&&0==x(Pb.pos,c)?e="triple":Qb&&Qb.time>d-400&&0==x(Qb.pos,c)?(e="double",Pb={time:d,pos:c}):(e="single",Qb={time:d,pos:c});d=a.doc.sel;a.options.dragDrop&&Ue&&!Mb(a)&&"single"==e&&-1<d.contains(c)&&d.somethingSelected()?Ve(a,b,c):We(a,b,c,e)}function Ve(a,b,
c){var d=a.display,e=J(a,function(f){P&&(d.scroller.draggable=!1);a.state.draggingText=!1;pa(document,"mouseup",e);pa(d.scroller,"drop",e);10>Math.abs(b.clientX-f.clientX)+Math.abs(b.clientY-f.clientY)&&(N(f),bb(a.doc,c),R(a),K&&!I&&setTimeout(function(){document.body.focus();R(a)},20))});P&&(d.scroller.draggable=!0);a.state.draggingText=e;d.scroller.dragDrop&&d.scroller.dragDrop();z(document,"mouseup",e);z(d.scroller,"drop",e)}function We(a,b,c,d){function e(b,e){if(e||0!=x(l,b))if(l=b,"rect"==d){for(var f=
[],g=a.options.tabSize,h=ba(t(k,c.line).text,c.ch,g),m=ba(t(k,b.line).text,b.ch,g),p=Math.min(h,m),h=Math.max(h,m),m=Math.min(c.line,b.line),q=Math.min(a.lastLine(),Math.max(c.line,b.line));m<=q;m++){var s=t(k,m).text,r=Td(s,p,g);p==h?f.push(new D(v(m,r),v(m,r))):s.length>r&&f.push(new D(v(m,r),v(m,Td(s,h,g))))}f.length||f.push(new D(c,c));H(k,new X(f,f.length-1))}else f=n.primary(),g=f.anchor,p=b,"single"!=d&&(h="double"==d?Kd(t(k,b.line).text,b):{from:v(b.line,0),to:w(k,v(b.line+1,0))},0<x(h.to,
g)?(p=h.to,g=yc(f.from(),h.from)):(p=h.from,g=xc(f.to(),h.to))),f=n.ranges.slice(0),f[n.primIndex]=new D(w(k,g),p),H(k,ha(f,n.primIndex))}function f(b){var c=++m,g=Ma(a,b,!0,"rect"==d);if(g)if(0!=x(g,l)){a.state.focused||Sa(a);e(g);var n=qc(h,k);(g.line>=n.to||g.line<n.from)&&setTimeout(J(a,function(){m==c&&f(b)}),150)}else{var q=b.clientY<p.top?-20:b.clientY>p.bottom?20:0;q&&setTimeout(J(a,function(){m==c&&(h.scroller.scrollTop+=q,f(b))}),50)}}function g(b){m=Infinity;N(b);R(a);pa(document,"mousemove",
q);pa(document,"mouseup",s);cb(k,k.history.done);k.history.atomicSelection=!1}var h=a.display,k=a.doc;N(b);cb(k,k.history.done);k.history.atomicSelection=!0;(wa?b.metaKey:b.ctrlKey)?(b=k.sel.contains(c),-1<b?H(k,new X(k.sel.ranges,b),!1):H(k,ha(k.sel.ranges.concat([new D(c,c)]),k.sel.ranges.length),!1)):b.altKey?(H(k,ia(c,c),void 0),d="rect",c=Ma(a,b,!0,!0)):bb(k,c,c);var l=c,n=k.sel;if("double"==d||"triple"==d)e(c,!0),n=k.sel;var p=h.wrapper.getBoundingClientRect(),m=0,q=J(a,function(a){I||(na?a.buttons:
Sd(a))?f(a):g(a)}),s=J(a,g);z(document,"mousemove",q);z(document,"mouseup",s)}function Jc(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(h){return!1}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&N(b);d=a.display;var k=d.lineDiv.getBoundingClientRect();if(g>k.bottom||!Y(a,c))return Lc(b);g-=k.top-d.viewOffset;for(k=0;k<a.options.gutters.length;++k){var l=d.gutters.childNodes[k];if(l&&l.getBoundingClientRect().right>=f)return f=va(a.doc,g),e(a,c,a,f,a.options.gutters[k],
b),Lc(b)}}function Se(a){var b=this;if(!ca(b,a)&&!ya(b.display,a)){N(a);K&&(Qd=+new Date);var c=Ma(b,a,!0),d=a.dataTransfer.files;if(c&&!Mb(b))if(d&&d.length&&window.FileReader&&window.File){var e=d.length,f=Array(e),g=0;a=function(a,d){var h=new FileReader;h.onload=function(){f[d]=h.result;if(++g==e){c=w(b.doc,c);var a={from:c,to:c,text:Ka(f.join("\n")),origin:"paste"};La(b.doc,a);wd(b.doc,ia(c,Na(a)))}};h.readAsText(a)};for(var h=0;h<e;++h)a(d[h],h)}else if(b.state.draggingText&&-1<b.doc.sel.contains(c))b.state.draggingText(a),
setTimeout(da(R,b),20);else try{if(f=a.dataTransfer.getData("Text")){var k=b.state.draggingText&&b.listSelections();Ab(b.doc,ia(c,c));if(k)for(h=0;h<k.length;++h)Rb(b.doc,"",k[h].anchor,k[h].head,"drag");b.replaceSelection(f,"around","paste");R(b)}}catch(l){}}}function ib(a,b){2>Math.abs(a.doc.scrollTop-b)||(a.doc.scrollTop=b,lb||xb(a,{top:b}),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbarV.scrollTop!=b&&(a.display.scrollbarV.scrollTop=b),lb&&xb(a),Wa(a,100))}
function Ja(a,b,c){(c?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,oc(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function Md(a,b){var c=b.wheelDeltaX,d=b.wheelDeltaY;null==c&&b.detail&&b.axis==b.HORIZONTAL_AXIS&&(c=b.detail);null==d&&b.detail&&b.axis==b.VERTICAL_AXIS?d=b.detail:null==d&&(d=b.wheelDelta);
var e=a.display,f=e.scroller;if(c&&f.scrollWidth>f.clientWidth||d&&f.scrollHeight>f.clientHeight){if(d&&wa&&P){var g=b.target,h=e.view;a:for(;g!=f;g=g.parentNode)for(var k=0;k<h.length;k++)if(h[k].node==g){a.display.currentWheelTarget=g;break a}}!c||lb||T||null==U?(d&&null!=U&&(g=d*U,h=a.doc.scrollTop,k=h+e.wrapper.clientHeight,0>g?h=Math.max(0,h+g-50):k=Math.min(a.doc.height,k+g+50),xb(a,{top:h,bottom:k})),20>Sb&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=
c,e.wheelDY=d,setTimeout(function(){if(null!=e.wheelStartX){var a=f.scrollLeft-e.wheelStartX,b=f.scrollTop-e.wheelStartY,a=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null;a&&(U=(U*Sb+a)/(Sb+1),++Sb)}},200)):(e.wheelDX+=c,e.wheelDY+=d))):(d&&ib(a,Math.max(0,Math.min(f.scrollTop+d*U,f.scrollHeight-f.clientHeight))),Ja(a,Math.max(0,Math.min(f.scrollLeft+c*U,f.scrollWidth-f.clientWidth))),N(b),e.wheelStartX=null)}}function Tb(a,b,c){if("string"==typeof b&&(b=Oa[b],
!b))return!1;a.display.pollingFast&&Hc(a)&&(a.display.pollingFast=!1);var d=a.display.shift,e=!1;try{Mb(a)&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Ud}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function Vd(a){var b=a.state.keyMaps.slice(0);a.options.extraKeys&&b.push(a.options.extraKeys);b.push(a.options.keyMap);return b}function Wd(a,b){var c=Mc(a.options.keyMap),d=c.auto;clearTimeout(Xd);d&&!Xe(b)&&(Xd=setTimeout(function(){Mc(a.options.keyMap)==c&&(a.options.keyMap=
d.call?d.call(null,a):d,hd(a))},50));var e=Ye(b,!0),f=!1;if(!e)return!1;f=Vd(a);if(f=b.shiftKey?Ub("Shift-"+e,f,function(b){return Tb(a,b,!0)})||Ub(e,f,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return Tb(a,b)}):Ub(e,f,function(b){return Tb(a,b)}))N(b),Db(a),M(a,"keyHandled",a,e,b);return f}function Ze(a,b,c){var d=Ub("'"+c+"'",Vd(a),function(b){return Tb(a,b,!0)});d&&(N(b),Db(a),M(a,"keyHandled",a,"'"+c+"'",b));return d}function Od(a){this.state.focused||Sa(this);if(!ca(this,a)){K&&
27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=Wd(this,a);T&&(Nc=c?b:null,!c&&88==b&&!Jd&&(wa?a.metaKey:a.ctrlKey)&&this.replaceSelection(""))}}function Nd(a){ca(this,a)||16!=a.keyCode||(this.doc.sel.shift=!1)}function Pd(a){if(!ca(this,a)){var b=a.keyCode,c=a.charCode;T&&b==Nc?(Nc=null,N(a)):(T&&(!a.which||10>a.which)||lc)&&Wd(this,a)||(b=String.fromCharCode(null==c?b:c),Ze(this,a,b)||(K&&!I&&(this.display.inputHasSelection=null),jb(this)))}}function Sa(a){"nocursor"!=
a.options.readOnly&&(a.state.focused||(G(a,"focus",a),a.state.focused=!0,-1==a.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(a.display.wrapper.className+=" CodeMirror-focused"),a.curOp||(V(a),P&&setTimeout(da(V,a,!0),0))),Lb(a),Db(a))}function jc(a){a.state.focused&&(G(a,"blur",a),a.state.focused=!1,a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-focused",""));clearInterval(a.display.blinker);setTimeout(function(){a.state.focused||(a.display.shift=!1)},
150)}function Ld(a,b){function c(){if(null!=e.input.selectionStart){var a=e.input.value="\u200b"+(k?e.input.value:"");e.prevInput="\u200b";e.input.selectionStart=1;e.input.selectionEnd=a.length}}function d(){e.inputDiv.style.position="relative";e.input.style.cssText=h;I&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=g);Lb(a);if(null!=e.input.selectionStart){na&&!I||c();clearTimeout(Oc);var b=0,d=function(){"\u200b"==e.prevInput&&0==e.input.selectionStart?J(a,Oa.selectAll)(a):10>b++?Oc=setTimeout(d,
500):V(a)};Oc=setTimeout(d,200)}}if(!ca(a,b,"contextmenu")){var e=a.display;if(!ya(e,b)&&!$e(a,b)){var f=Ma(a,b),g=e.scroller.scrollTop;if(f&&!T){a.options.resetSelectionOnContextMenu&&-1==a.doc.sel.contains(f)&&J(a,H)(a.doc,ia(f),!1);var h=e.input.style.cssText;e.inputDiv.style.position="absolute";e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: transparent; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);";
R(a);V(a);var k=a.somethingSelected();k||(e.input.value=e.prevInput=" ");na&&!I&&c();if(Kc){Ic(b);var l=function(){pa(window,"mouseup",l);setTimeout(d,20)};z(window,"mouseup",l)}else setTimeout(d,50)}}}}function $e(a,b){return Y(a,"gutterContextMenu")?Jc(a,b,"gutterContextMenu",!1,G):!1}function Yd(a,b){if(0>x(a,b.from))return a;if(0>=x(a,b.to))return Na(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&&(d+=Na(b).ch-b.to.ch);return v(c,d)}function Pc(a,b){for(var c=
[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new D(Yd(e.anchor,b),Yd(e.head,b)))}return ha(c,a.sel.primIndex)}function Zd(a,b,c){return a.line==b.line?v(c.line,a.ch-b.ch+c.ch):v(c.line+(a.line-b.line),a.ch)}function $d(a,b,c){b={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};c&&(b.update=function(b,c,f,g){b&&(this.from=w(a,b));c&&(this.to=w(a,c));f&&(this.text=f);void 0!==g&&(this.origin=g)});G(a,"beforeChange",a,b);a.cm&&G(a.cm,
"beforeChange",a.cm,b);return b.canceled?null:{from:b.from,to:b.to,text:b.text,origin:b.origin}}function La(a,b,c){if(a.cm){if(!a.cm.curOp)return J(a.cm,La)(a,b,c);if(a.cm.state.suppressEdits)return}if(Y(a,"beforeChange")||a.cm&&Y(a.cm,"beforeChange"))if(b=$d(a,b,!0),!b)return;if(c=ae&&!c&&af(a,b.from,b.to))for(var d=c.length-1;0<=d;--d)be(a,{from:c[d].from,to:c[d].to,text:d?[""]:b.text});else be(a,b)}function be(a,b){if(1!=b.text.length||""!=b.text[0]||0!=x(b.from,b.to)){var c=Pc(a,b);ce(a,b,c,a.cm?
a.cm.curOp.id:NaN);mb(a,b,c,Qc(a,b));var d=[];Pa(a,function(a,c){c||-1!=L(d,a.history)||(de(a.history,b),d.push(a.history));mb(a,b,null,Qc(a,b))})}}function Vb(a,b,c){if(!a.cm||!a.cm.state.suppressEdits){for(var d=a.history,e,f=a.sel,g="undo"==b?d.done:d.undone,h="undo"==b?d.undone:d.done,k=0;k<g.length&&!c&&g[k].ranges;k++);if(k!=g.length){for(cb(a,h);;)if(e=g.pop(),e.ranges){h.push(e);if(c&&!e.equals(a.sel))return d.pendingSelection=e,Ab(a,e);f=e}else break;c=[];Rc(f,h);h.push({changes:c,generation:d.generation});
d.generation=e.generation||++d.maxGeneration;d=Y(a,"beforeChange")||a.cm&&Y(a.cm,"beforeChange");for(k=e.changes.length-1;0<=k;--k){var l=e.changes[k];l.origin=b;if(d&&!$d(a,l,!1)){g.length=0;break}c.push(Sc(a,l));f=k?Pc(a,l,null):B(g);mb(a,l,f,ee(a,l));var n=[];Pa(a,function(a,b){b||-1!=L(n,a.history)||(de(a.history,l),n.push(a.history));mb(a,l,null,ee(a,l))})}}}}function fe(a,b){a.first+=b;a.sel=new X(Tc(a.sel.ranges,function(a){return new D(v(a.anchor.line+b,a.anchor.ch),v(a.head.line+b,a.head.ch))}),
a.sel.primIndex);a.cm&&S(a.cm,a.first,a.first,b)}function mb(a,b,c,d){if(a.cm&&!a.cm.curOp)return J(a.cm,mb)(a,b,c,d);if(b.to.line<a.first)fe(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);fe(a,e);b={from:v(a.first,0),to:v(b.to.line+e,b.to.ch),text:[B(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:v(e,t(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=nb(a,b.from,
b.to);c||(c=Pc(a,b,null));a.cm?bf(a.cm,b,d):Uc(a,b,d);H(a,c,!1)}}function bf(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,k=f.line;a.options.lineWrapping||(k=C(aa(t(d,f.line))),d.iter(k,g.line+1,function(a){if(a==e.maxLine)return h=!0}));-1<d.sel.contains(b.from,b.to)&&(a.curOp.cursorActivity=!0);Uc(d,b,c,gd(a));a.options.lineWrapping||(d.iter(k,f.line+b.text.length,function(a){var b=vb(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=
!0));d.frontier=Math.min(d.frontier,f.line);Wa(a,400);c=b.text.length-(g.line-f.line)-1;f.line!=g.line||1!=b.text.length||ge(a.doc,b)?S(a,f.line,g.line+1,c):ma(a,f.line,"text");Y(a,"change")&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push({from:f,to:g,text:b.text,removed:b.removed,origin:b.origin})}function Rb(a,b,c,d,e){d||(d=c);if(0>x(d,c)){var f=d;d=c;c=f}"string"==typeof b&&(b=Ka(b));La(a,{from:c,to:d,text:b,origin:e})}function Kb(a,b,c,d,e){var f=a.display,g=sa(a.display);0>c&&(c=0);var h=
a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,k=f.scroller.clientHeight-ra,l={},n=a.doc.height+(f.mover.offsetHeight-f.lineSpace.offsetHeight),p=c<g,g=e>n-g;c<h?l.scrollTop=p?0:c:e>h+k&&(c=Math.min(c,(g?n:e)-k),c!=h&&(l.scrollTop=c));a=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft;h=f.scroller.clientWidth-ra;b+=f.gutters.offsetWidth;d+=f.gutters.offsetWidth;f=f.gutters.offsetWidth;c=b<f+10;b<a+f||c?(c&&(b=0),l.scrollLeft=Math.max(0,b-10-f)):d>
h+a-3&&(l.scrollLeft=d+10-h);return l}function Vc(a,b,c){null==b&&null==c||Wb(a);null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b);null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function Ga(a){Wb(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin,isCursor:!0}}function Wb(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=Id(a,b.from),d=Id(a,b.to),b=Kb(a,
Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(b.scrollLeft,b.scrollTop)}}function Nb(a,b,c,d){var e=a.doc,f;null==c&&(c="add");"smart"==c&&(a.doc.mode.indent?f=eb(a,b):c="prev");var g=a.options.tabSize,h=t(e,b),k=ba(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var l=h.text.match(/^\s*/)[0],n;if(!d&&!/\S/.test(h.text))n=0,c="not";else if("smart"==c&&(n=a.doc.mode.indent(f,h.text.slice(l.length),h.text),n==Ud)){if(!d)return;
c="prev"}"prev"==c?n=b>e.first?ba(t(e,b-1).text,null,g):0:"add"==c?n=k+a.options.indentUnit:"subtract"==c?n=k-a.options.indentUnit:"number"==typeof c&&(n=k+c);n=Math.max(0,n);f="";c=0;if(a.options.indentWithTabs)for(d=Math.floor(n/g);d;--d)c+=g,f+="\t";c<n&&(f+=he(n-c));if(f!=l)Rb(a.doc,f,v(b,0),v(b,l.length),"+input");else for(d=0;d<e.sel.ranges.length;d++)if(a=e.sel.ranges[d],a.head.line==b&&a.head.ch<l.length){c=v(b,l.length);b=e;e=d;l=new D(c,c);a=b.sel.ranges.slice(0);a[e]=l;H(b,ha(a,b.sel.primIndex));
break}h.stateAfter=null}function Xb(a,b,c,d){var e=b,f=b,g=a.doc;"number"==typeof b?f=t(g,Math.max(g.first,Math.min(b,g.first+g.size-1))):e=C(b);if(null!=e&&d(f,e))ma(a,e,c);else return null;return f}function Yb(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&0>=x(f.from,B(d).to);){var g=d.pop();if(0>x(g.from,f.from)){f.from=g.from;break}}d.push(f)}ea(a,function(){for(var b=d.length-1;0<=b;b--)Rb(a.doc,"",d[b].from,d[b].to,"+delete");Ga(a)})}function Wc(a,b,c,
d,e){function f(b){var d=(e?Gc:ie)(k,h,c,!0);if(null==d){if(b=!b)b=g+c,b<a.first||b>=a.first+a.size?b=l=!1:(g=b,b=k=t(a,b));if(b)h=e?(0>c?Ib:Hb)(k):0>c?k.text.length:0;else return l=!1}else h=d;return!0}var g=b.line,h=b.ch;b=c;var k=t(a,g),l=!0;if("char"==d)f();else if("column"==d)f(!0);else if("word"==d||"group"==d){var n=null;d="group"==d;for(var p=!0;!(0>c)||f(!p);p=!1){var m=k.text.charAt(h)||"\n",m=Zb(m)?"w":d?/\s/.test(m)?null:"p":null;if(n&&n!=m){0>c&&(c=1,f());break}m&&(n=m);if(0<c&&!f(!p))break}}b=
Bb(a,v(g,h),b,!0);l||(b.hitSide=!0);return b}function je(a,b,c,d){var e=a.doc,f=b.left,g;"page"==d?(d=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),g=b.top+c*(d-(0>c?1.5:0.5)*sa(a.display))):"line"==d&&(g=0<c?b.bottom+3:b.top-3);for(;;){var h=Fc(a,f,g);if(!h.outside)break;if(0>c?0>=g:g>=e.height){h.hitSide=!0;break}g+=5*c}return h}function Kd(a,b){var c=b.ch,d=b.ch;if(a){(0>b.xRel||d==a.length)&&c?--c:++d;for(var e=a.charAt(c),e=Zb(e)?Zb:/\s/.test(e)?
function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!Zb(a)};0<c&&e(a.charAt(c-1));)--c;for(;d<a.length&&e(a.charAt(d));)++d}return{from:v(b.line,c),to:v(b.line,d)}}function y(a,b,c,d){r.defaults[a]=b;c&&(Da[a]=d?function(a,b,d){d!=fd&&c(a,b,d)}:c)}function Mc(a){return"string"==typeof a?fa[a]:a}function ob(a,b,c,d,e){if(d&&d.shared)return cf(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return J(a.cm,ob)(a,b,c,d,e);var f=new za(a,e);e=x(b,c);d&&$b(d,f);if(0<e||0==e&&!1!==f.clearWhenEmpty)return f;
f.replacedWith&&(f.collapsed=!0,f.widgetNode=u("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||(f.widgetNode.ignoreEvents=!0),d.insertLeft&&(f.widgetNode.insertLeft=!0));if(f.collapsed){if(ke(a,b.line,b,c,f)||b.line!=c.line&&ke(a,c.line,b,c,f))throw Error("Inserting collapsed marker partially overlapping an existing one");Fa=!0}f.addToHistory&&ce(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var g=b.line,h=a.cm,k;a.iter(g,c.line+1,function(a){h&&f.collapsed&&!h.options.lineWrapping&&
aa(a)==h.display.maxLine&&(k=!0);f.collapsed&&g!=b.line&&W(a,0);var d=new ac(f,g==b.line?b.ch:null,g==c.line?c.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([d]):[d];d.marker.attachLine(a);++g});f.collapsed&&a.iter(b.line,c.line+1,function(b){Ea(a,b)&&W(b,0)});f.clearOnEnter&&z(f,"beforeCursorEnter",function(){f.clear()});f.readOnly&&(ae=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());f.collapsed&&(f.id=++df,f.atomic=!0);if(h){k&&(h.curOp.updateMaxLine=!0);if(f.collapsed)S(h,
b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle)for(d=b.line;d<=c.line;d++)ma(h,d,"text");f.atomic&&zd(h.doc)}return f}function cf(a,b,c,d,e){d=$b(d);d.shared=!1;var f=[ob(a,b,c,d,e)],g=f[0],h=d.widgetNode;Pa(a,function(a){h&&(d.widgetNode=h.cloneNode(!0));f.push(ob(a,w(a,b),w(a,c),d,e));for(var l=0;l<a.linked.length;++l)if(a.linked[l].isParent)return;g=B(f)});return new bc(f,g)}function ac(a,b,c){this.marker=a;this.from=b;this.to=c}function pb(a,b){if(a)for(var c=0;c<a.length;++c){var d=
a[c];if(d.marker==b)return d}}function Qc(a,b){var c=ab(a,b.from.line)&&t(a,b.from.line).markedSpans,d=ab(a,b.to.line)&&t(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==x(b.from,b.to);if(c)for(var h=0,k;h<c.length;++h){var l=c[h],n=l.marker;if(null==l.from||(n.inclusiveLeft?l.from<=e:l.from<e)||l.from==e&&!("bookmark"!=n.type||g&&l.marker.insertLeft)){var p=null==l.to||(n.inclusiveRight?l.to>=e:l.to>e);(k||(k=[])).push(new ac(n,l.from,p?null:l.to))}}c=k;if(d)for(var h=
0,m;h<d.length;++h)if(k=d[h],l=k.marker,null==k.to||(l.inclusiveRight?k.to>=f:k.to>f)||k.from==f&&"bookmark"==l.type&&(!g||k.marker.insertLeft))n=null==k.from||(l.inclusiveLeft?k.from<=f:k.from<f),(m||(m=[])).push(new ac(l,n?null:k.from-f,null==k.to?null:k.to-f));d=m;g=1==b.text.length;m=B(b.text).length+(g?e:0);if(c)for(f=0;f<c.length;++f)if(h=c[f],null==h.to)(k=pb(d,h.marker),k)?g&&(h.to=null==k.to?null:k.to+m):h.to=e;if(d)for(f=0;f<d.length;++f)h=d[f],null!=h.to&&(h.to+=m),null==h.from?(k=pb(c,
h.marker),k||(h.from=m,g&&(c||(c=[])).push(h))):(h.from+=m,g&&(c||(c=[])).push(h));c&&(c=le(c));d&&d!=c&&(d=le(d));e=[c];if(!g){var g=b.text.length-2,q;if(0<g&&c)for(f=0;f<c.length;++f)null==c[f].to&&(q||(q=[])).push(new ac(c[f].marker,null,null));for(f=0;f<g;++f)e.push(q);e.push(d)}return e}function le(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&!1!==c.marker.clearWhenEmpty&&a.splice(b--,1)}return a.length?a:null}function ee(a,b){var c;if(c=b["spans_"+a.id]){for(var d=0,
e=[];d<b.text.length;++d)e.push(ef(c[d]));c=e}else c=null;d=Qc(a,b);if(!c)return d;if(!d)return c;for(e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g){var h=0;a:for(;h<g.length;++h){for(var k=g[h],l=0;l<f.length;++l)if(f[l].marker==k.marker)continue a;f.push(k)}}else g&&(c[e]=g)}return c}function af(a,b,c){var d=null;a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=L(d,c)||(d||(d=[])).push(c)}});if(!d)return null;
a=[{from:b,to:c}];for(b=0;b<d.length;++b){c=d[b];for(var e=c.find(0),f=0;f<a.length;++f){var g=a[f];if(!(0>x(g.to,e.from)||0<x(g.from,e.to))){var h=[f,1],k=x(g.from,e.from),l=x(g.to,e.to);(0>k||!c.inclusiveLeft&&!k)&&h.push({from:g.from,to:e.from});(0<l||!c.inclusiveRight&&!l)&&h.push({from:e.to,to:g.to});a.splice.apply(a,h);f+=h.length-1}}}return a}function me(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function ne(a,b){if(b){for(var c=0;c<
b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function oe(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var c=a.find(),d=b.find(),e=x(c.from,d.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return e?-e:(c=x(c.to,d.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?c:b.id-a.id}function ua(a,b){var c=Fa&&a.markedSpans,d;if(c)for(var e,f=0;f<c.length;++f)e=c[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!d||0>oe(d,e.marker))&&(d=e.marker);return d}function ke(a,b,c,d,e){a=
t(a,b);if(a=Fa&&a.markedSpans)for(b=0;b<a.length;++b){var f=a[b];if(f.marker.collapsed){var g=f.marker.find(0),h=x(g.from,c)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),k=x(g.to,d)||(f.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:0);if(!(0<=h&&0>=k||0>=h&&0<=k)&&(0>=h&&0<(x(g.to,c)||(f.marker.inclusiveRight?1:0)-(e.inclusiveLeft?-1:0))||0<=h&&0>(x(g.from,d)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveRight?1:0))))return!0}}}function aa(a){for(var b;b=ua(a,!0);)a=b.find(-1,!0).line;return a}
function ld(a,b){var c=t(a,b),d=aa(c);return c==d?b:C(d)}function md(a,b){if(b>a.lastLine())return b;var c=t(a,b),d;if(!Ea(a,c))return b;for(;d=ua(c,!1);)c=d.find(1,!0).line;return C(c)+1}function Ea(a,b){var c=Fa&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed&&(null==d.from||!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&Xc(a,b,d)))return!0}function Xc(a,b,c){if(null==c.to)return b=c.marker.find(1,!0),Xc(a,b.line,pb(b.line.markedSpans,c.marker));if(c.marker.inclusiveRight&&
c.to==b.text.length)return!0;for(var d,e=0;e<b.markedSpans.length;++e)if(d=b.markedSpans[e],d.marker.collapsed&&!d.marker.widgetNode&&d.from==c.to&&(null==d.to||d.to!=c.from)&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&Xc(a,b,d))return!0}function Fb(a){if(null!=a.height)return a.height;a.node.parentNode&&1==a.node.parentNode.nodeType||Z(a.cm.display.measure,u("div",[a.node],null,"position: relative"));return a.height=a.node.offsetHeight}function ff(a,b,c,d){var e=new cc(a,c,d);e.noHScroll&&
(a.display.alignWidgets=!0);Xb(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e);e.line=b;if(!Ea(a.doc,b)||e.showIfHidden)c=la(b)<a.doc.scrollTop,W(b,b.height+Fb(e)),c&&Vc(a,null,e.height);return!0});return e}function pe(a,b,c,d,e,f){var g=c.flattenSpans;null==g&&(g=a.options.flattenSpans);var h=0,k=null,l=new dc(b,a.options.tabSize),n;for(""==b&&c.blankLine&&c.blankLine(d);!l.eol();){l.pos>a.options.maxHighlightLength?
(g=!1,f&&zc(a,b,d,l.pos),l.pos=b.length,n=null):n=c.token(l,d);if(a.options.addModeClass){var p=r.innerMode(c,d).mode.name;p&&(n="m-"+(n?p+" "+n:p))}g&&k==n||(h<l.start&&e(l.start,k),h=l.start,k=n);l.start=l.pos}for(;h<l.pos;)a=Math.min(l.pos,h+5E4),e(a,k),h=a}function Bd(a,b,c,d){var e=[a.state.modeGen];pe(a,b.text,a.doc.mode,c,function(a,b){e.push(a,b)},d);for(c=0;c<a.state.overlays.length;++c){var f=a.state.overlays[c],g=1,h=0;pe(a,b.text,f.mode,!0,function(a,b){for(var c=g;h<a;){var d=e[g];d>
a&&e.splice(g,1,a,e[g+1],d);g+=2;h=Math.min(a,d)}if(b)if(f.opaque)e.splice(c,g-c,a,b),g=c+2;else for(;c<g;c+=2)d=e[c+1],e[c+1]=d?d+" "+b:b})}return e}function qe(a,b){b.styles&&b.styles[0]==a.state.modeGen||(b.styles=Bd(a,b,b.stateAfter=eb(a,C(b))));return b.styles}function zc(a,b,c,d){var e=a.doc.mode,f=new dc(b,a.options.tabSize);f.start=f.pos=d||0;for(""==b&&e.blankLine&&e.blankLine(c);!f.eol()&&f.pos<=a.options.maxHighlightLength;)e.token(f,c),f.start=f.pos}function re(a,b){if(!a)return null;
for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:RegExp("(?:^|s)"+c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}if(/^\s*$/.test(a))return null;c=b.cm.options.addModeClass?gf:hf;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function sd(a,b){var c=u("span",null,null,P?"padding-right: .1px":null),c={pre:u("pre",[c]),content:c,col:0,pos:0,cm:a};b.measure={};for(var d=0;d<=(b.rest?
b.rest.length:0);d++){var e=d?b.rest[d-1]:b.line,f;c.pos=0;c.addToken=jf;(na||P)&&a.getOption("lineWrapping")&&(c.addToken=kf(c.addToken));var g;if(null!=Yc)g=Yc;else{g=Z(a.display.measure,document.createTextNode("A\u062eA"));var h=gb(g,0,1).getBoundingClientRect();g=h.left==h.right?!1:Yc=3>gb(g,1,2).getBoundingClientRect().right-h.right}g&&(f=$(e))&&(c.addToken=lf(c.addToken,f));c.map=[];a:{g=c;var h=qe(a,e),k=e.markedSpans,e=e.text,l=0;if(k)for(var n=e.length,p=0,m=1,q="",s=void 0,r=0,t=void 0,
v=void 0,w=void 0,y=void 0,x=void 0;;){if(r==p){for(var t=v=w=y="",x=null,r=Infinity,z=[],C=0;C<k.length;++C){var B=k[C],D=B.marker;B.from<=p&&(null==B.to||B.to>p)?(null!=B.to&&r>B.to&&(r=B.to,v=""),D.className&&(t+=" "+D.className),D.startStyle&&B.from==p&&(w+=" "+D.startStyle),D.endStyle&&B.to==r&&(v+=" "+D.endStyle),D.title&&!y&&(y=D.title),D.collapsed&&(!x||0>oe(x.marker,D))&&(x=B)):B.from>p&&r>B.from&&(r=B.from);"bookmark"==D.type&&B.from==p&&D.widgetNode&&z.push(D)}if(x&&(x.from||0)==p&&(se(g,
(null==x.to?n+1:x.to)-p,x.marker,null==x.from),null==x.to))break a;if(!x&&z.length)for(C=0;C<z.length;++C)se(g,0,z[C])}if(p>=n)break;for(z=Math.min(n,r);;){if(q){C=p+q.length;x||(B=C>z?q.slice(0,z-p):q,g.addToken(g,B,s?s+t:t,w,p+B.length==r?v:"",y));if(C>=z){q=q.slice(z-p);p=z;break}p=C;w=""}q=e.slice(l,l=h[m++]);s=re(h[m++],g)}}else for(var m=1;m<h.length;m+=2)g.addToken(g,e.slice(l,l=h[m]),re(h[m+1],g))}0==c.map.length&&c.map.push(0,0,c.content.appendChild(mf(a.display.measure)));0==d?(b.measure.map=
c.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(c.map),(b.measure.caches||(b.measure.caches=[])).push({}))}G(a,"renderLine",a,b.line,c.pre);return c}function jf(a,b,c,d,e,f){if(b){var g=a.cm.options.specialChars,h=!1;if(g.test(b))for(var k=document.createDocumentFragment(),l=0;;){g.lastIndex=l;var n=g.exec(b),p=n?n.index-l:b.length-l;if(p){var m=document.createTextNode(b.slice(l,l+p));I?k.appendChild(u("span",[m])):k.appendChild(m);a.map.push(a.pos,a.pos+p,m);a.col+=p;a.pos+=
p}if(!n)break;l+=p+1;"\t"==n[0]?(m=a.cm.options.tabSize,n=m-a.col%m,m=k.appendChild(u("span",he(n),"cm-tab")),a.col+=n):(m=a.cm.options.specialCharPlaceholder(n[0]),I?k.appendChild(u("span",[m])):k.appendChild(m),a.col+=1);a.map.push(a.pos,a.pos+1,m);a.pos++}else{a.col+=b.length;var k=document.createTextNode(b);a.map.push(a.pos,a.pos+b.length,k);I&&(h=!0);a.pos+=b.length}if(c||d||e||h)return b=c||"",d&&(b+=d),e&&(b+=e),d=u("span",[k],b),f&&(d.title=f),a.content.appendChild(d);a.content.appendChild(k)}}
function kf(a){function b(a){for(var b=" ",e=0;e<a.length-2;++e)b+=e%2?" ":"\u00a0";return b+" "}return function(c,d,e,f,g,h){a(c,d.replace(/ {3,}/g,b),e,f,g,h)}}function lf(a,b){return function(c,d,e,f,g,h){e=e?e+" cm-force-border":"cm-force-border";for(var k=c.pos,l=k+d.length;;){for(var n=0;n<b.length;n++){var p=b[n];if(p.to>k&&p.from<=k)break}if(p.to>=l)return a(c,d,e,f,g,h);a(c,d.slice(0,p.to-k),e,f,null,h);f=null;d=d.slice(p.to-k);k=p.to}}}function se(a,b,c,d){if(c=!d&&c.widgetNode)a.map.push(a.pos,
a.pos+b,c),a.content.appendChild(c);a.pos+=b}function ge(a,b){return 0==b.from.ch&&0==b.to.ch&&""==B(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Uc(a,b,c,d){function e(a,c,e){var f=d;a.text=c;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null);null!=a.order&&(a.order=null);me(a);ne(a,e);c=f?f(a):1;c!=a.height&&W(a,c);M(a,"change",a,b)}var f=b.from,g=b.to,h=b.text,k=t(a,f.line),l=t(a,g.line),n=B(h),p=c?c[h.length-1]:null,m=g.line-f.line;if(ge(a,b)){for(var q=0,s=[];q<h.length-
1;++q)s.push(new Aa(h[q],c?c[q]:null,d));e(l,l.text,p);m&&a.remove(f.line,m);s.length&&a.insert(f.line,s)}else if(k==l)if(1==h.length)e(k,k.text.slice(0,f.ch)+n+k.text.slice(g.ch),p);else{s=[];for(q=1;q<h.length-1;++q)s.push(new Aa(h[q],c?c[q]:null,d));s.push(new Aa(n+k.text.slice(g.ch),p,d));e(k,k.text.slice(0,f.ch)+h[0],c?c[0]:null);a.insert(f.line+1,s)}else if(1==h.length)e(k,k.text.slice(0,f.ch)+h[0]+l.text.slice(g.ch),c?c[0]:null),a.remove(f.line+1,m);else{e(k,k.text.slice(0,f.ch)+h[0],c?c[0]:
null);e(l,n+l.text.slice(g.ch),p);q=1;for(s=[];q<h.length-1;++q)s.push(new Aa(h[q],c?c[q]:null,d));1<m&&a.remove(f.line+1,m-1);a.insert(f.line+1,s)}M(a,"change",a,b)}function qb(a){this.lines=a;this.parent=null;for(var b=0,c=0;b<a.length;++b)a[b].parent=this,c+=a[b].height;this.height=c}function rb(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d],b=b+e.chunkSize(),c=c+e.height;e.parent=this}this.size=b;this.height=c;this.parent=null}function Pa(a,b,c){function d(a,f,g){if(a.linked)for(var h=
0;h<a.linked.length;++h){var k=a.linked[h];if(k.doc!=f){var l=g&&k.sharedHist;if(!c||l)b(k.doc,l),d(k.doc,a,l)}}}d(a,null,!0)}function ed(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;nc(a);mc(a);a.options.lineWrapping||pc(a);a.options.mode=b.modeOption;S(a)}function t(a,b){b-=a.first;if(0>b||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(b<f){c=e;break}b-=f}return c.lines[b]}
function nb(a,b,c){var d=[],e=b.line;a.iter(b.line,c.line+1,function(a){a=a.text;e==c.line&&(a=a.slice(0,c.ch));e==b.line&&(a=a.slice(b.ch));d.push(a);++e});return d}function Zc(a,b,c){var d=[];a.iter(b,c,function(a){d.push(a.text)});return d}function W(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function C(a){if(null==a.parent)return null;var b=a.parent;a=L(b.lines,a);for(var c=b.parent;c;b=c,c=c.parent)for(var d=0;c.children[d]!=b;++d)a+=c.children[d].chunkSize();return a+b.first}
function va(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(b<f){a=e;continue a}b-=f;c+=e.chunkSize()}return c}while(!a.lines);for(d=0;d<a.lines.length;++d){e=a.lines[d].height;if(b<e)break;b-=e}return c+d}function la(a){a=aa(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;else b+=e.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length&&(e=a.children[d],e!=c);++d)b+=e.height;return b}function $(a){var b=
a.order;null==b&&(b=a.order=nf(a.text));return b}function ec(a,b){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.pendingSelTime=0;this.lastOrigin=this.lastOp=null;this.pendingSelection=b.sel;this.generation=this.maxGeneration=a||1;this.atomicSelection=!1}function Sc(a,b){var c={from:wc(b.from),to:Na(b),text:nb(a,b.from,b.to)};te(a,c,b.from.line,b.to.line+1);Pa(a,function(a){te(a,c,b.from.line,b.to.line+1)},!0);return c}function ce(a,b,c,d){var e=a.history;e.undone.length=
0;cb(a,e.done);var f=+new Date,g,h;if(h=e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0))){a:{for(;;)if((g=B(e.done))&&g.ranges)e.done.pop();else break a;g=void 0}h=g}if(h){var k=B(g.changes);0==x(b.from,b.to)&&0==x(b.from,k.to)?k.to=Na(b):g.changes.push(Sc(a,b))}else for((g=B(e.done))&&g.ranges||Rc(a.sel,e.done),g={changes:[Sc(a,b)],generation:e.generation},e.done.push(g);e.done.length>e.undoDepth;)e.done.shift(),
e.done[0].ranges||e.done.shift();e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=f;e.lastOp=d;e.lastOrigin=b.origin;k||G(a,"historyAdded")}function Rc(a,b){var c=B(b);c&&c.ranges&&c.equals(a)||b.push(a)}function cb(a,b){var c=a.history;c.pendingSelection&&(Rc(c.pendingSelection,b),c.pendingSelection=null)}function te(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans);++f})}
function ef(a){if(!a)return null;for(var b=0,c;b<a.length;++b)a[b].marker.explicitlyCleared?c||(c=a.slice(0,b)):c&&c.push(a[b]);return c?c.length?c:null:a}function Qa(a,b,c){for(var d=0,e=[];d<a.length;++d){var f=a[d];if(f.ranges)e.push(c?X.prototype.deepCopy.call(f):f);else{var f=f.changes,g=[];e.push({changes:g});for(var h=0;h<f.length;++h){var k=f[h],l;g.push({from:k.from,to:k.to,text:k.text});if(b)for(var n in k)(l=n.match(/^spans_(\d+)$/))&&-1<L(b,Number(l[1]))&&(B(g)[n]=k[n],delete k[n])}}}return e}
function ue(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function ve(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges){f.copied||(f=a[e]=f.deepCopy(),f.copied=!0);for(var h=0;h<f.ranges.length;h++)ue(f.ranges[h].anchor,b,c,d),ue(f.ranges[h].head,b,c,d)}else{for(h=0;h<f.changes.length;++h){var k=f.changes[h];if(c<k.from.line)k.from=v(k.from.line+d,k.from.ch),k.to=v(k.to.line+d,k.to.ch);else if(b<=k.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function de(a,b){var c=b.from.line,
d=b.to.line,e=b.text.length-(d-c)-1;ve(a.done,c,d,e);ve(a.undone,c,d,e)}function Lc(a){return null!=a.defaultPrevented?a.defaultPrevented:!1==a.returnValue}function Sd(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));wa&&a.ctrlKey&&1==b&&(b=3);return b}function M(a,b){function c(a){return function(){a.apply(null,e)}}var d=a._handlers&&a._handlers[b];if(d){var e=Array.prototype.slice.call(arguments,2);oa||(++Jb,oa=[],setTimeout(of,0));for(var f=0;f<d.length;++f)oa.push(c(d[f]))}}
function of(){--Jb;var a=oa;oa=null;for(var b=0;b<a.length;++b)a[b]()}function ca(a,b,c){G(a,c||b.type,a,b);return Lc(b)||b.codemirrorIgnore}function Y(a,b){var c=a._handlers&&a._handlers[b];return c&&0<c.length}function Ra(a){a.prototype.on=function(a,c){z(this,a,c)};a.prototype.off=function(a,c){pa(this,a,c)}}function ic(){this.id=null}function Td(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);e+=f-d;e+=c-e%c;d=f+1;
if(e>=b)return d}}function he(a){for(;fc.length<=a;)fc.push(B(fc)+" ");return fc[a]}function B(a){return a[a.length-1]}function L(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function Tc(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function we(a,b){var c;Object.create?c=Object.create(a):(c=function(){},c.prototype=a,c=new c);b&&$b(b,c);return c}function $b(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function da(a){var b=Array.prototype.slice.call(arguments,
1);return function(){return a.apply(null,b)}}function xe(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function fb(a){return 768<=a.charCodeAt(0)&&pf.test(a)}function u(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)a.appendChild(document.createTextNode(b));else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function ta(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function Z(a,b){return ta(a).appendChild(b)}
function ka(){return document.activeElement}function $a(a){if(null!=kb)return kb;var b=u("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");Z(a,b);b.offsetWidth&&(kb=b.offsetHeight-b.clientHeight);return kb||0}function mf(a){if(null==$c){var b=u("span","\u200b");Z(a,u("span",[b,document.createTextNode("x")]));0!=a.firstChild.offsetHeight&&($c=1>=b.offsetWidth&&2<b.offsetHeight&&!Ua)}return $c?u("span","\u200b"):u("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px")}
function Je(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];if(g.from<c&&g.to>b||b==c&&g.to==b)d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0}e||d(b,c,"ltr")}function Cc(a){return a.level%2?a.to:a.from}function Dc(a){return a.level%2?a.from:a.to}function Hb(a){return(a=$(a))?Cc(a[0]):0}function Ib(a){var b=$(a);return b?Dc(B(b)):a.text.length}function ye(a,b){var c=t(a.doc,b),d=aa(c);d!=c&&(b=C(d));d=(c=$(d))?c[0].level%2?Ib(d):Hb(d):0;return v(b,
d)}function Ec(a,b){hb=null;for(var c=0,d;c<a.length;++c){var e=a[c];if(e.from<b&&e.to>b)return c;if(e.from==b||e.to==b)if(null==d)d=c;else{var f;f=e.level;var g=a[d].level,h=a[0].level;f=f==h?!0:g==h?!1:f<g;if(f)return e.from!=e.to&&(hb=d),c;e.from!=e.to&&(hb=c);break}}return d}function ad(a,b,c,d){if(!d)return b+c;do b+=c;while(0<b&&fb(a.text.charAt(b)));return b}function Gc(a,b,c,d){var e=$(a);if(!e)return ie(a,b,c,d);var f=Ec(e,b),g=e[f];for(b=ad(a,b,g.level%2?-c:c,d);;){if(b>g.from&&b<g.to)return b;
if(b==g.from||b==g.to){if(Ec(e,b)==f)return b;g=e[f+c];return 0<c==g.level%2?g.to:g.from}g=e[f+=c];if(!g)return null;b=0<c==g.level%2?ad(a,g.to,-1,d):ad(a,g.from,1,d)}}function ie(a,b,c,d){b+=c;if(d)for(;0<b&&fb(a.text.charAt(b));)b+=c;return 0>b||b>a.text.length?null:b}var lb=/gecko\/\d/i.test(navigator.userAgent),K=/MSIE \d/.test(navigator.userAgent),Ua=K&&(null==document.documentMode||8>document.documentMode),I=K&&(null==document.documentMode||9>document.documentMode),qf=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),
na=K||qf,P=/WebKit\//.test(navigator.userAgent),rf=P&&/Qt\/\d+\.\d+/.test(navigator.userAgent),sf=/Chrome\//.test(navigator.userAgent),T=/Opera\//.test(navigator.userAgent),Rd=/Apple Computer/.test(navigator.vendor),lc=/KHTML\//.test(navigator.userAgent),De=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),Ee=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Pe=/PhantomJS/.test(navigator.userAgent),Ta=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),hc=
Ta||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),wa=Ta||/Mac/.test(navigator.platform),tf=/win/i.test(navigator.platform),Ba=T&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Ba&&(Ba=Number(Ba[1]));Ba&&15<=Ba&&(T=!1,P=!0);var ze=wa&&(rf||T&&(null==Ba||12.11>Ba)),Kc=lb||na&&!I,ae=!1,Fa=!1,v=r.Pos=function(a,b){if(!(this instanceof v))return new v(a,b);this.line=a;this.ch=b},x=r.cmpPos=function(a,b){return a.line-b.line||a.ch-b.ch};X.prototype={primary:function(){return this.ranges[this.primIndex]},
equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(0!=x(c.anchor,d.anchor)||0!=x(c.head,d.head))return!1}return!0},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new D(wc(this.ranges[b].anchor),wc(this.ranges[b].head));return new X(a,this.primIndex)},somethingSelected:function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;
return!1},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(0<=x(b,d.from())&&0>=x(a,d.to()))return c}return-1}};D.prototype={from:function(){return yc(this.anchor,this.head)},to:function(){return xc(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Ed={left:0,right:0,top:0,bottom:0},xa,Oe=0,Qb,Pb,Qd=0,Sb=0,U=null;na?U=-0.53:lb?U=15:sf?U=-0.7:Rd&&(U=-1/3);var Xd,Nc=null,Oc,Na=r.changeEnd=
function(a){return a.text?v(a.from.line+a.text.length-1,B(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};r.prototype={constructor:r,focus:function(){window.focus();R(this);jb(this)},setOption:function(a,b){var c=this.options,d=c[a];if(c[a]!=b||"mode"==a)c[a]=b,Da.hasOwnProperty(a)&&J(this,Da[a])(this,b,d)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,
c=0;c<b.length;++c)if(b[c]==a||"string"!=typeof b[c]&&b[c].name==a)return b.splice(c,1),!0},addOverlay:F(function(a,b){var c=a.token?a:r.getMode(this.options,a);if(c.startState)throw Error("Overlays may not be stateful.");this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque});this.state.modeGen++;S(this)}),removeOverlay:F(function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||"string"==typeof a&&d.name==a){b.splice(c,1);this.state.modeGen++;S(this);break}}}),
indentLine:F(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");ab(this.doc,a)&&Nb(this,a,b,c)}),indentSelection:F(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty())e.head.line>c&&(Nb(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Ga(this));else for(var f=Math.max(c,e.from().line),c=e.to(),c=Math.min(this.lastLine(),c.line-(c.ch?0:1))+1;f<c;++f)Nb(this,f,a)}}),getTokenAt:function(a,
b){var c=this.doc;a=w(c,a);for(var d=eb(this,a.line,b),e=this.doc.mode,c=t(c,a.line),c=new dc(c.text,this.options.tabSize);c.pos<a.ch&&!c.eol();){c.start=c.pos;var f=e.token(c,d)}return{start:c.start,end:c.pos,string:c.current(),type:f||null,state:d}},getTokenTypeAt:function(a){a=w(this.doc,a);var b=qe(this,t(this.doc,a.line)),c=0,d=(b.length-1)/2;a=a.ch;if(0==a)return b[2];for(;;){var e=c+d>>1;if((e?b[2*e-1]:0)>=a)d=e;else if(b[2*e+1]<a)c=e+1;else return b[2*e+2]}},getModeAt:function(a){var b=this.doc.mode;
return b.innerMode?r.innerMode(b,this.getTokenAt(a).state).mode:b},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!Ca.hasOwnProperty(b))return Ca;var d=Ca[b],e=this.getModeAt(a);if("string"==typeof e[b])d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;f<e[b].length;f++){var g=d[e[b][f]];g&&c.push(g)}else e.helperType&&d[e.helperType]?c.push(d[e.helperType]):d[e.name]&&c.push(d[e.name]);for(f=0;f<d._global.length;f++)g=d._global[f],g.pred(e,this)&&-1==
L(c,g.val)&&c.push(g.val);return c},getStateAfter:function(a,b){var c=this.doc;a=Math.max(c.first,Math.min(null==a?c.first+c.size-1:a,c.first+c.size-1));return eb(this,a+1,b)},cursorCoords:function(a,b){var c;c=this.doc.sel.primary();c=null==a?c.head:"object"==typeof a?w(this.doc,a):a?c.from():c.to();return ja(this,c,b||"page")},charCoords:function(a,b){return Cb(this,w(this.doc,a),b||"page")},coordsChar:function(a,b){a=Hd(this,a,b||"page");return Fc(this,a.left,a.top)},lineAtHeight:function(a,b){a=
Hd(this,{top:a,left:0},b||"page").top;return va(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=!1,d=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>d&&(a=d,c=!0);d=t(this.doc,a);return Bc(this,t(this.doc,a),{top:0,left:0},b||"page").top+(c?d.height:0)},defaultTextHeight:function(){return sa(this.display)},defaultCharWidth:function(){return Xa(this.display)},setGutterMarker:F(function(a,b,c){return Xb(this,a,"gutter",function(a){var e=a.gutterMarkers||(a.gutterMarkers=
{});e[b]=c;!c&&xe(e)&&(a.gutterMarkers=null);return!0})}),clearGutter:F(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,ma(b,d,"gutter"),xe(c.gutterMarkers)&&(c.gutterMarkers=null));++d})}),addLineClass:F(function(a,b,c){return Xb(this,a,"class",function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[e]){if(RegExp("(?:^|\\s)"+c+"(?:$|\\s)").test(a[e]))return!1;a[e]+=" "+c}else a[e]=c;return!0})}),
removeLineClass:F(function(a,b,c){return Xb(this,a,"class",function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",f=a[e];if(f)if(null==c)a[e]=null;else{var g=f.match(RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!g)return!1;var h=g.index+g[0].length;a[e]=f.slice(0,g.index)+(g.index&&h!=f.length?" ":"")+f.slice(h)||null}else return!1;return!0})}),addLineWidget:F(function(a,b,c){return ff(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!ab(this.doc,
a))return null;var b=a;a=t(this.doc,a);if(!a)return null}else if(b=C(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=ja(this,w(this.doc,a));var g=a.bottom,h=a.left;b.style.position="absolute";f.sizer.appendChild(b);if("over"==d)g=a.top;else if("above"==
d||"near"==d){var k=Math.max(f.wrapper.clientHeight,this.doc.height),l=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>k)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=k&&(g=a.bottom);h+b.offsetWidth>l&&(h=l-b.offsetWidth)}b.style.top=g+"px";b.style.left=b.style.right="";"right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px");c&&
(a=Kb(this,h,g,h+b.offsetWidth,g+b.offsetHeight),null!=a.scrollTop&&ib(this,a.scrollTop),null!=a.scrollLeft&&Ja(this,a.scrollLeft))},triggerOnKeyDown:F(Od),triggerOnKeyPress:F(Pd),triggerOnKeyUp:F(Nd),setCommand:function(a,b){this.usercommands[a]=b;Oa[a]||(Oa[a]=function(b){var d=b.usercommands[a];d?d.apply(b,arguments):console.log("cm: unable to find user command!")})},execCommand:function(a){if(Oa.hasOwnProperty(a))return Oa[a](this)},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);var f=0;
for(a=w(this.doc,a);f<b&&(a=Wc(this.doc,a,e,c,d),!a.hitSide);++f);return a},moveH:F(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Wc(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()})}),deleteH:F(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):Yb(this,function(d){var e=Wc(c,d.head,a,b,!1);return 0>a?{from:e,to:d.head}:{from:d.head,to:e}})}),findPosV:function(a,b,c,d){var e=
1;0>b&&(e=-1,b=-b);var f=0;for(a=w(this.doc,a);f<b&&(a=ja(this,a,"div"),null==d?d=a.left:a.left=d,a=je(this,a,e,c),!a.hitSide);++f);return a},moveV:F(function(a,b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.sel.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(g){if(f)return 0>a?g.from():g.to();var k=ja(c,g.head,"div");null!=g.goalColumn&&(k.left=g.goalColumn);e.push(k.left);var l=je(c,k,a,b);"page"==b&&g==d.sel.primary()&&Vc(c,null,Cb(c,l,"div").top-k.top);return l});if(e.length)for(var g=
0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=e[g]}),toggleOverwrite:function(a){if(null==a||a!=this.state.overwrite)(this.state.overwrite=!this.state.overwrite)?this.display.cursorDiv.className+=" CodeMirror-overwrite":this.display.cursorDiv.className=this.display.cursorDiv.className.replace(" CodeMirror-overwrite",""),G(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return ka()==this.display.input},scrollTo:F(function(a,b){null==a&&null==b||Wb(this);null!=a&&(this.curOp.scrollLeft=
a);null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=this.display.scroller,b=ra;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:F(function(a,b){null==a?a={from:this.doc.sel.primary().head,to:null}:"number"==typeof a?a={from:v(a,0),to:null}:null==a.from&&(a={from:a,to:null});a.to||(a.to=a.from);a.margin=b||0;if(null!=a.from.line)Wb(this),this.curOp.scrollToPos=a;else{var c=
Kb(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin);this.scrollTo(c.scrollLeft,c.scrollTop)}}),setSize:F(function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a));null!=b&&(this.display.wrapper.style.height=c(b));this.options.lineWrapping&&Gd(this);this.curOp.forceUpdate=!0;G(this,"refresh",this)}),operation:function(a){return ea(this,
a)},refresh:F(function(){var a=this.display.cachedTextHeight;S(this);Ya(this);this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop);(null==a||0.5<Math.abs(a-sa(this.display)))&&nc(this);G(this,"refresh",this)}),swapDoc:F(function(a){var b=this.doc;b.cm=null;ed(this,a);Ya(this);V(this);this.scrollTo(a.scrollLeft,a.scrollTop);M(this,"swapDoc",this,b);return b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},
getGutterElement:function(){return this.display.gutters}};Ra(r);var bd=r.defaults={},Da=r.optionHandlers={},fd=r.Init={toString:function(){return"CodeMirror.Init"}};y("value","",function(a,b){a.setValue(b)},!0);y("mode",null,function(a,b){a.doc.modeOption=b;mc(a)},!0);y("indentUnit",2,mc,!0);y("indentWithTabs",!1);y("smartIndent",!0);y("tabSize",4,function(a){Va(a);Ya(a);S(a)},!0);y("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(a,b){a.options.specialChars=RegExp(b.source+
(b.test("\t")?"":"|\t"),"g");a.refresh()},!0);y("specialCharPlaceholder",function(a){var b=u("span","\u2022","cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);return b},function(a){a.refresh()},!0);y("electricChars",!0);y("rtlMoveVisually",!tf);y("wholeLineUpdateBefore",!0);y("theme","default",function(a){dd(a);Za(a)},!0);y("keyMap","default",hd);y("extraKeys",null);y("lineWrapping",!1,function(a){a.options.lineWrapping?(a.display.wrapper.className+=" CodeMirror-wrap",a.display.sizer.style.minWidth=
""):(a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-wrap",""),pc(a));nc(a);S(a);Ya(a);setTimeout(function(){wb(a)},100)},!0);y("gutters",[],function(a){gc(a.options);Za(a)},!0);y("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?rc(a.display)+"px":"0";a.refresh()},!0);y("coverGutterNextToScrollbar",!1,wb,!0);y("lineNumbers",!1,function(a){gc(a.options);Za(a)},!0);y("firstLineNumber",1,Za,!0);y("lineNumberFormatter",function(a){return a},Za,!0);y("showCursorWhenSelecting",
!1,uc,!0);y("resetSelectionOnContextMenu",!0);y("readOnly",!1,function(a,b){"nocursor"==b?(jc(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||V(a))});y("disableInput",!1,function(a,b){b||V(a)},!0);y("dragDrop",!0);y("cursorBlinkRate",530);y("cursorScrollMargin",0);y("cursorHeight",1);y("workTime",100);y("workDelay",100);y("flattenSpans",!0,Va,!0);y("addModeClass",!1,Va,!0);y("pollInterval",100);y("undoDepth",200,function(a,b){a.doc.history.undoDepth=b});y("historyEventDelay",
500);y("historySelectionEventDelay",1E3);y("viewportMargin",10,function(a){a.refresh()},!0);y("maxHighlightLength",1E4,Va,!0);y("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)});y("tabindex",null,function(a,b){a.display.input.tabIndex=b||""});y("autofocus",null);var Ae=r.modes={},sb=r.mimeModes={};r.defineMode=function(a,b){r.defaults.mode||"null"==a||(r.defaults.mode=a);if(2<arguments.length){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}Ae[a]=
b};r.defineMIME=function(a,b){sb[a]=b};r.resolveMode=function(a){if("string"==typeof a&&sb.hasOwnProperty(a))a=sb[a];else if(a&&"string"==typeof a.name&&sb.hasOwnProperty(a.name)){var b=sb[a.name];a=we(b,a);a.name=b.name}else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return r.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}};r.getMode=function(a,b){b=r.resolveMode(b);var c=Ae[b.name];if(!c)return r.getMode(a,"text/plain");c=c(a,b);if(tb.hasOwnProperty(b.name)){var d=
tb[b.name],e;for(e in d)d.hasOwnProperty(e)&&(c.hasOwnProperty(e)&&(c["_"+e]=c[e]),c[e]=d[e])}c.name=b.name;b.helperType&&(c.helperType=b.helperType);if(b.modeProps)for(e in b.modeProps)c[e]=b.modeProps[e];return c};r.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}});r.defineMIME("text/plain","null");var tb=r.modeExtensions={};r.extendMode=function(a,b){var c=tb.hasOwnProperty(a)?tb[a]:tb[a]={};$b(b,c)};r.defineExtension=function(a,b){r.prototype[a]=b};r.defineDocExtension=function(a,
b){O.prototype[a]=b};r.defineOption=y;var kc=[];r.defineInitHook=function(a){kc.push(a)};var Ca=r.helpers={};r.registerHelper=function(a,b,c){Ca.hasOwnProperty(a)||(Ca[a]=r[a]={_global:[]});Ca[a][b]=c};r.registerGlobalHelper=function(a,b,c,d){r.registerHelper(a,b,d);Ca[a]._global.push({pred:c,val:d})};var db=r.copyState=function(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);var c={},d;for(d in b){var e=b[d];e instanceof Array&&(e=e.concat([]));c[d]=e}return c},Me=r.startState=function(a,
b,c){return a.startState?a.startState(b,c):!0};r.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state;a=c.mode}return c||{mode:a,state:b}};var Oa=r.commands={selectAll:function(a){a.setSelection(v(a.firstLine(),0),v(a.lastLine()),!1)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),!1)},killLine:function(a){Yb(a,function(b){if(b.empty()){var c=t(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?
{from:b.head,to:v(b.head.line+1,0)}:{from:b.head,to:v(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){Yb(a,function(b){return{from:v(b.from().line,0),to:w(a.doc,v(b.to().line+1,0))}})},delLineLeft:function(a){Yb(a,function(a){return{from:v(a.from().line,0),to:a.from()}})},undo:function(a){a.undo()},redo:function(a){a.redo()},undoSelection:function(a){a.undoSelection()},redoSelection:function(a){a.redoSelection()},goDocStart:function(a){a.extendSelection(v(a.firstLine(),0))},
goDocEnd:function(a){a.extendSelection(v(a.lastLine()))},goLineStart:function(a){a.extendSelectionsBy(function(b){return ye(a,b.head.line)})},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){var c=ye(a,b.head.line),d=a.getLineHandle(c.line),e=$(d);return e&&0!=e[0].level?c:(d=Math.max(0,d.text.search(/\S/)),v(c.line,b.head.line==c.line&&b.head.ch<=d&&b.head.ch?0:d))})},goLineEnd:function(a){a.extendSelectionsBy(function(b){b=b.head.line;for(var c,d=t(a.doc,b);c=ua(d,!1);)d=c.find(1,!0).line,
b=null;c=(c=$(d))?c[0].level%2?Hb(d):Ib(d):d.text.length;return v(null==b?C(d):b,c)})},goLineRight:function(a){a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div")})},goLineLeft:function(a){a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")})},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,
"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},
delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection("\t",null,"+input")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.replaceSelection("\t",
null,"+input")},transposeChars:function(a){ea(a,function(){for(var b=a.listSelections(),c=0;c<b.length;c++){var d=b[c].head,e=t(a.doc,d.line);0<d.ch&&d.ch<e.length-1&&a.replaceRange(e.charAt(d.ch)+e.charAt(d.ch-1),v(d.line,d.ch-1),v(d.line,d.ch+1))}})},newlineAndIndent:function(a){ea(a,function(){for(var b=a.listSelections().length,c=0;c<b;c++){var d=a.listSelections()[c];a.replaceRange("\n",d.anchor,d.head,"+input");a.indentLine(d.from().line+1,null,!0);Ga(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},
fa=r.keyMap={};fa.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"};fa.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart",
"Ctrl-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"};
fa.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess",
"Cmd-]":"indentMore","Cmd-Backspace":"delLineLeft","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection",fallthrough:["basic","emacsy"]};fa.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};
fa["default"]=wa?fa.macDefault:fa.pcDefault;var Ub=r.lookupKey=function(a,b,c){function d(b){b=Mc(b);var e=b[a];if(!1===e)return"stop";if(null!=e&&c(e))return!0;if(b.nofallthrough)return"stop";b=b.fallthrough;if(null==b)return!1;if("[object Array]"!=Object.prototype.toString.call(b))return d(b);for(e=0;e<b.length;++e){var f=d(b[e]);if(f)return f}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return"stop"!=f}},Xe=r.isModifierKey=function(a){a=qa[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==
a||"Mod"==a},Ye=r.keyName=function(a,b){if(T&&34==a.keyCode&&a["char"])return!1;var c=qa[a.keyCode];if(null==c||a.altGraphKey)return!1;a.altKey&&(c="Alt-"+c);if(ze?a.metaKey:a.ctrlKey)c="Ctrl-"+c;if(ze?a.ctrlKey:a.metaKey)c="Cmd-"+c;!b&&a.shiftKey&&(c="Shift-"+c);return c};r.fromTextArea=function(a,b){function c(){a.value=k.getValue()}b||(b={});b.value=a.value;!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex);!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder);if(null==b.autofocus){var d=
ka();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}if(a.form&&(z(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var e=a.form,f=e.submit;try{var g=e.submit=function(){c();e.submit=f;e.submit();e.submit=g}}catch(h){}}a.style.display="none";var k=r(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);k.save=c;k.getTextArea=function(){return a};k.toTextArea=function(){c();a.parentNode.removeChild(k.getWrapperElement());a.style.display="";a.form&&(pa(a.form,"submit",c),"function"==
typeof a.form.submit&&(a.form.submit=f))};return k};var dc=r.StringStream=function(a,b){this.pos=this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0};dc.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);
if("string"==typeof a?b==a:b&&(a.test?a.test(b):a(b)))return++this.pos,b},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0},backUp:function(a){this.pos-=a},column:function(){this.lastColumnPos<this.start&&(this.lastColumnValue=
ba(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);return this.lastColumnValue-(this.lineStart?ba(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return ba(this.string,null,this.tabSize)-(this.lineStart?ba(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if("string"==typeof a){var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);if(d(e)==d(a))return!1!==b&&(this.pos+=
a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);return a}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var za=r.TextMarker=function(a,b){this.lines=[];this.type=b;this.doc=a};Ra(za);za.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&Ha(a);if(Y(this,"clear")){var c=this.find();
c&&M(this,"clear",c.from,c.to)}for(var d=c=null,e=0;e<this.lines.length;++e){var f=this.lines[e],g=pb(f.markedSpans,this);a&&!this.collapsed?ma(a,C(f),"text"):a&&(null!=g.to&&(d=C(f)),null!=g.from&&(c=C(f)));for(var h=f,k=f.markedSpans,l=g,n=void 0,p=0;p<k.length;++p)k[p]!=l&&(n||(n=[])).push(k[p]);h.markedSpans=n;null==g.from&&this.collapsed&&!Ea(this.doc,f)&&a&&W(f,sa(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e)f=aa(this.lines[e]),g=vb(f),g>a.display.maxLineLength&&
(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=c&&a&&this.collapsed&&S(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&zd(a.doc));b&&Ia(a)}};za.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=pb(f.markedSpans,this);if(null!=g.from&&(c=v(b?f:C(f),g.from),-1==a))return c;if(null!=g.to&&(d=v(b?f:C(f),g.to),1==a))return d}return c&&
{from:c,to:d}};za.prototype.changed=function(){var a=this.find(-1,!0),b=this.doc.cm;if(a&&b){var c=a.line,a=C(a.line),d=Cd(b,a);d&&Fd(d);a>=b.display.viewFrom&&a<b.display.viewTo&&(a=b.display.view[ga(b,a)],!a.hidden&&a.node&&a.node.offsetHeight!=c.height&&W(c,a.node.offsetHeight),ea(b,function(){b.curOp.selectionChanged=b.curOp.forceUpdate=b.curOp.updateMaxLine=!0}))}};za.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=L(b.maybeHiddenMarkers,
this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};za.prototype.detachLine=function(a){this.lines.splice(L(this.lines,a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};var df=0,bc=r.SharedTextMarker=function(a,b){this.markers=a;this.primary=b;for(var c=0,d=this;c<a.length;++c)a[c].parent=this,z(a[c],"clear",function(){d.clear()})};Ra(bc);bc.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=
!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();M(this,"clear")}};bc.prototype.find=function(a,b){return this.primary.find(a,b)};var cc=r.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.cm=a;this.node=b};Ra(cc);cc.prototype.clear=function(){var a=this.cm,b=this.line.widgets,c=C(this.line);if(null!=c&&b){for(var d=0;d<b.length;++d)b[d]==this&&b.splice(d--,1);b.length||(this.line.widgets=null);b=la(this.line)<a.doc.scrollTop;W(this.line,Math.max(0,
this.line.height-Fb(this)));b&&Vc(a,null,-this.height);ea(a,function(){ma(a,c,"widget")})}};cc.prototype.changed=function(){var a=this.height,b=this.cm;this.height=null;if(a=Fb(this)-a){W(this.line,this.line.height+a);var c=C(this.line);ea(b,function(){ma(b,c,"widget")})}};var Aa=r.Line=function(a,b,c){this.text=a;ne(this,b);this.height=c?c(this):1};Ra(Aa);Aa.prototype.lineNo=function(){return C(this)};var hf={},gf={};qb.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,
b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height;var f=e;f.parent=null;me(f);M(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};rb.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=
b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,e-a),g=d.height;d.removeInner(a,f);this.height-=g-d.height;e==f&&(this.children.splice(c--,1),d.parent=null);if(0==(b-=f))break;a=0}else a-=e}25>this.size-b&&(1<this.children.length||!(this.children[0]instanceof qb))&&(c=[],this.collapse(c),this.children=[new qb(c)],this.children[0].parent=this)},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,
b,c){this.size+=b.length;this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<=f){e.insertInner(a,b,c);if(e.lines&&50<e.lines.length){for(;50<e.lines.length;)a=e.lines.splice(e.lines.length-25,25),a=new qb(a),e.height-=a.height,this.children.splice(d+1,0,a),a.parent=this;this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new rb(b);if(a.parent){a.size-=b.size;
a.height-=b.height;var c=L(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new rb(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,c))return!0;if(0==(b-=f))break;a=0}else a-=f}}};var uf=0,O=r.Doc=function(a,b,c){if(!(this instanceof O))return new O(a,b,c);null==c&&(c=0);rb.call(this,
[new qb([new Aa("",null)])]);this.first=c;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.frontier=c;c=v(c,0);this.sel=ia(c);this.history=new ec(null,this);this.id=++uf;this.modeOption=b;"string"==typeof a&&(a=Ka(a));Uc(this,{from:c,to:c,text:a});H(this,ia(c),!1)};O.prototype=we(rb.prototype,{constructor:O,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;
this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=Zc(this,this.first,this.first+this.size);return!1===a?b:b.join(a||"\n")},setValue:Q(function(a){var b=v(this.first,0),c=this.first+this.size-1;La(this,{from:b,to:v(c,t(this,c).text.length),text:Ka(a),origin:"setValue"},!0);H(this,ia(b))}),replaceRange:function(a,b,c,d){b=w(this,b);c=c?w(this,c):b;Rb(this,a,b,c,d)},getRange:function(a,b,c){a=nb(this,w(this,a),w(this,b));return!1===
c?a:a.join(c||"\n")},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(ab(this,a))return t(this,a)},getLineNumber:function(a){return C(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=t(this,a));return aa(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return w(this,a)},getCursor:function(a){var b=this.sel.primary();return null==a||"head"==
a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||!1===a?b.to():b.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Q(function(a,b,c){a=w(this,"number"==typeof a?v(a,b||0):a);H(this,ia(a,null),c)}),setSelection:Q(function(a,b,c){var d=w(this,a);a=w(this,b||a);H(this,ia(d,a),c)}),extendSelection:Q(function(a,b,c){bb(this,w(this,a),b&&w(this,b),c)}),extendSelections:Q(function(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=
w(this,a[d]);vd(this,c)}),extendSelectionsBy:Q(function(a,b){vd(this,Tc(this.sel.ranges,a),b)}),setSelections:Q(function(a,b,c){if(a.length){for(var d=0,e=[];d<a.length;d++)e[d]=new D(w(this,a[d].anchor),w(this,a[d].head));null==b&&(b=a.length-1);H(this,ha(e,b),c)}}),addSelection:Q(function(a,b){var c=this.sel.ranges.slice(0);c.push(new D(w(this,a),w(this,b||a)));H(this,ha(c,c.length-1),!1)}),getSelection:function(a){for(var b=this.sel.ranges,c,d=0;d<b.length;d++){var e=nb(this,b[d].from(),b[d].to());
c=c?c.concat(e):e}return!1===a?c:c.join(a||"\n")},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=nb(this,c[d].from(),c[d].to());!1!==a&&(e=e.join(a||"\n"));b[d]=e}return b},replaceSelection:Q(function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c)}),replaceSelections:function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:Ka(a[f]),origin:c}}if(f=b)if(f="end"!=
b){f=[];c=a=v(this.first,0);for(e=0;e<d.length;e++){var h=d[e],g=Zd(h.from,a,c),k=Zd(Na(h),a,c);a=h.to;c=k;"around"==b?(h=this.sel.ranges[e],h=0>x(h.head,h.anchor),f[e]=new D(h?k:g,h?g:k)):f[e]=new D(g,g)}f=new X(f,this.sel.primIndex)}b=f;for(f=d.length-1;0<=f;f--)La(this,d[f]);b?wd(this,b):this.cm&&Ga(this.cm)},undo:Q(function(){Vb(this,"undo")}),redo:Q(function(){Vb(this,"redo")}),undoSelection:Q(function(){Vb(this,"undo",!0)}),redoSelection:Q(function(){Vb(this,"redo",!0)}),setExtending:function(a){this.extend=
a},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new ec(this.history.maxGeneration,this)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){a&&(this.history.lastOp=this.history.lastOrigin=null);return this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},
getHistory:function(){return{done:Qa(this.history.done),undone:Qa(this.history.undone)}},setHistory:function(a){var b=this.history=new ec(this.history.maxGeneration,this);b.done=Qa(a.done.slice(0),null,!0);b.undone=Qa(a.undone.slice(0),null,!0)},markText:function(a,b,c){return ob(this,w(this,a),w(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1};a=w(this,a);return ob(this,a,a,c,"bookmark")},findMarksAt:function(a){a=
w(this,a);var b=[],c=t(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b){a=w(this,a);b=w(this,b);var c=[],d=a.line;this.iter(a.line,b.line+1,function(e){if(e=e.markedSpans)for(var f=0;f<e.length;f++){var g=e[f];d==a.line&&a.ch>g.to||null==g.from&&d!=a.line||d==b.line&&g.from>b.ch||c.push(g.marker.parent||g.marker)}++d});return c},getAllMarks:function(){var a=
[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)null!=b[c].from&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,c=this.first;this.iter(function(d){d=d.text.length+1;if(d>a)return b=a,!0;a-=d;++c});return w(this,v(c,b))},indexFromPos:function(a){a=w(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;this.iter(this.first,a.line,function(a){b+=a.text.length+1});return b},copy:function(a){var b=new O(Zc(this,this.first,this.first+this.size),this.modeOption,
this.first);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<c&&(c=a.to);b=new O(Zc(this,b,c),a.mode||this.modeOption,b);a.sharedHist&&(b.history=this.history);(this.linked||(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:!0,
sharedHist:a.sharedHist}];return b},unlinkDoc:function(a){a instanceof r&&(a=a.doc);if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);break}if(a.history==this.history){var c=[a.id];Pa(a,function(a){c.push(a.id)},!0);a.history=new ec(null,a);a.history.done=Qa(this.history.done,c);a.history.undone=Qa(this.history.undone,c)}},iterLinkedDocs:function(a){Pa(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});
O.prototype.eachLine=O.prototype.iter;var vf=["iter","insert","remove","copy","getEditor"],ub;for(ub in O.prototype)O.prototype.hasOwnProperty(ub)&&0>L(vf,ub)&&(r.prototype[ub]=function(a){return function(){return a.apply(this.doc,arguments)}}(O.prototype[ub]));Ra(O);var N=r.e_preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},wf=r.e_stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},Ic=r.e_stop=function(a){N(a);wf(a)},z=r.on=function(a,
b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),(a[b]||(a[b]=[])).push(c))},pa=r.off=function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else if(a=a._handlers&&a._handlers[b])for(b=0;b<a.length;++b)if(a[b]==c){a.splice(b,1);break}},G=r.signal=function(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,
d)},oa,Jb=0,ra=30,Ud=r.Pass={toString:function(){return"CodeMirror.Pass"}};ic.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var ba=r.countColumn=function(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));d=d||0;for(e=e||0;;){var f=a.indexOf("\t",d);if(0>f||f>=b)return e+(b-d);e+=f-d;e+=c-e%c;d=f+1}},fc=[""],Ob=function(a){a.select()};Ta?Ob=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:na&&(Ob=function(a){try{a.select()}catch(b){}});[].indexOf&&
(L=function(a,b){return a.indexOf(b)});[].map&&(Tc=function(a,b){return a.map(b)});var xf=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Zb=r.isWordChar=function(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||xf.test(a))},pf=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,
gb;gb=document.createRange?function(a,b,c){var d=document.createRange();d.setEnd(a,c);d.setStart(a,b);return d}:function(a,b,c){var d=document.body.createTextRange();d.moveToElementText(a.parentNode);d.collapse(!0);d.moveEnd("character",c);d.moveStart("character",b);return d};K&&(ka=function(){try{return document.activeElement}catch(a){return document.body}});var Ue=function(){if(I)return!1;var a=u("div");return"draggable"in a||"dragDrop"in a}(),kb,$c,Yc,Ka=r.splitLines=3!="\n\nb".split(/\n/).length?
function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},Qe=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},Jd=
function(){var a=u("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),qa={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",
219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};r.keyNames=qa;(function(){for(var a=0;10>a;a++)qa[a+48]=qa[a+96]=String(a);for(a=65;90>=a;a++)qa[a]=String.fromCharCode(a);for(a=1;12>=a;a++)qa[a+111]=qa[a+63235]="F"+a})();var hb,nf=function(){function a(a){return 247>=a?c.charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1773>=a?d.charAt(a-1536):1774<=a&&2220>=a?"r":8192<=a&&8203>=a?"w":
8204==a?"b":"L"}function b(a,b,c){this.level=a;this.from=b;this.to=c}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",d="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",
e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,k=/[1n]/;return function(c){if(!e.test(c))return!1;for(var d=c.length,p=[],m=0,q;m<d;++m)p.push(a(c.charCodeAt(m)));for(var m=0,s="L";m<d;++m)q=p[m],"m"==q?p[m]=s:s=q;m=0;for(s="L";m<d;++m)q=p[m],"1"==q&&"r"==s?p[m]="n":g.test(q)&&(s=q,"r"==q&&(p[m]="R"));m=1;for(s=p[0];m<d-1;++m)q=p[m],"+"==q&&"1"==s&&"1"==p[m+1]?p[m]="1":","!=q||s!=p[m+1]||"1"!=s&&"n"!=s||(p[m]=s),s=q;for(m=0;m<d;++m)if(q=p[m],","==q)p[m]="N";else if("%"==
q){for(s=m+1;s<d&&"%"==p[s];++s);var r=m&&"!"==p[m-1]||s<d&&"1"==p[s]?"1":"N";for(q=m;q<s;++q)p[q]=r;m=s-1}m=0;for(s="L";m<d;++m)q=p[m],"L"==s&&"1"==q?p[m]="L":g.test(q)&&(s=q);for(m=0;m<d;++m)if(f.test(p[m])){for(s=m+1;s<d&&f.test(p[s]);++s);q="L"==(s<d?p[s]:"L");r="L"==(m?p[m-1]:"L")||q?"L":"R";for(q=m;q<s;++q)p[q]=r;m=s-1}for(var s=[],t,m=0;m<d;)if(h.test(p[m])){q=m;for(++m;m<d&&h.test(p[m]);++m);s.push(new b(0,q,m))}else{var u=m,r=s.length;for(++m;m<d&&"L"!=p[m];++m);for(q=u;q<m;)if(k.test(p[q])){u<
q&&s.splice(r,0,new b(1,u,q));u=q;for(++q;q<m&&k.test(p[q]);++q);s.splice(r,0,new b(2,u,q));u=q}else++q;u<m&&s.splice(r,0,new b(1,u,m))}1==s[0].level&&(t=c.match(/^\s+/))&&(s[0].from=t[0].length,s.unshift(new b(0,0,t[0].length)));1==B(s).level&&(t=c.match(/\s+$/))&&(B(s).to-=t[0].length,s.push(new b(0,d-t[0].length,d)));s[0].level!=B(s).level&&s.push(new b(s[0].level,d,d));return s}}();r.version="4.0.0";return r});
