window.CodeMirror=function(){function m(a,b){function c(e){l.onDragEvent&&l.onDragEvent(G,Ta(e))||ib(e)}function d(e){return 0<=e&&e<x.size}function g(e){for(var a=x;!a.lines;)for(var q=0;;++q){var b=a.children[q],c=b.chunkSize();if(e<c){a=b;break}e-=c}return a.lines[e]}function n(e,a){ma=!0;for(var q=a-e.height,b=e;b;b=b.parent)b.height+=q}function f(e,a){e.styles||e.highlight(T,e.stateAfter=Ua(ga(e)),l.tabSize);return e.getContent(l.tabSize,a,l.lineWrapping)}function p(e){var a={line:0,ch:0};qc(a,
{line:x.size-1,ch:g(x.size-1).text.length},jb(e),a,a);wa=!0}function t(e){var a=[];x.iter(0,x.size,function(e){a.push(e.text)});return a.join(e||"\n")}function Q(e){if(!l.onDragEvent||!l.onDragEvent(G,Ta(e))){C(e);var a=Va(e,!0),q=e.dataTransfer.files;if(a&&!l.readOnly)if(q&&q.length&&window.FileReader&&window.File){var b=q.length,c=Array(b),k=0;e=function(e,q){var d=new FileReader;d.onload=function(){c[q]=d.result;++k==b&&(a=H(a),w(function(){var e=Z(c.join(""),a,a);ia(a,e)})())};d.readAsText(e)};
for(var d=0;d<b;++d)e(q[d],d)}else if(!kb||K(a,h.from)||K(h.to,a))try{(c=e.dataTransfer.getData("Text"))&&rc(function(){var e=h.from,q=h.to;ia(a,a);kb&&Z("",e,q);Wa(c);ja()})}catch(g){}}}function Uc(e){var a=Pb();e.dataTransfer.setData("Text",a);e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(u("img"),0,0)}function lb(e,a){if("string"==typeof e&&(e=Qb[e],!e))return!1;var q=ka;try{l.readOnly&&(mb=!0),a&&(ka=null),e(G)}catch(b){if(b!=sc)throw b;return!1}finally{ka=q,mb=!1}return!0}function tc(e){function a(){d=
!0}var q=P(l.keyMap),b=q.auto;clearTimeout(uc);b&&!xa(e)&&(uc=setTimeout(function(){P(l.keyMap)==q&&(l.keyMap=b.call?b.call(null,G):b)},50));var c=Fa[V(e,"keyCode")],k=!1,k=ya&&nb;if(null==c||e.altGraphKey)return!1;V(e,"altKey")&&(c="Alt-"+c);V(e,k?"metaKey":"ctrlKey")&&(c="Ctrl-"+c);V(e,k?"ctrlKey":"metaKey")&&(c="Cmd-"+c);var d=!1,k=V(e,"shiftKey")?I("Shift-"+c,l.extraKeys,l.keyMap,function(e){return lb(e,!0)},a)||I(c,l.extraKeys,l.keyMap,function(e){if("string"==typeof e&&/^go[A-Z]/.test(e))return lb(e)},
a):I(c,l.extraKeys,l.keyMap,lb,a);d&&(k=!1);k&&(C(e),ob(),Ga&&(e.oldKeyCode=e.keyCode,e.keyCode=0));return k}function Vc(e,a){var q=I("'"+a+"'",l.extraKeys,l.keyMap,function(e){return lb(e,!0)});q&&(C(e),ob());return q}function vc(e){ca||La();Ga&&27==e.keyCode&&(e.returnValue=!1);Ma&&pb()&&(Ma=!1);if(!l.onKeyEvent||!l.onKeyEvent(G,Ta(e))){var a=V(e,"keyCode");gb(16==a||V(e,"shiftKey"));var q=tc(e);ya&&(Rb=q?a:null,!q&&88==a&&V(e,nb?"metaKey":"ctrlKey")&&Wa(""))}}function La(){if("nocursor"!=l.readOnly){if(!ca){if(l.onFocus)l.onFocus(G);
ca=!0;-1==v.className.search(/\bCodeMirror-focused\b/)&&(v.className+=" CodeMirror-focused")}qb();ob()}}function Sb(){if(ca){if(l.onBlur)l.onBlur(G);ca=!1;za&&w(function(){za&&(za(),za=null)})();v.className=v.className.replace(" CodeMirror-focused","")}clearInterval(Tb);setTimeout(function(){ca||(ka=null)},150)}function qc(e,a,q,b,c){if(!mb){var k=[];x.iter(e.line,a.line+1,function(e){k.push(r(e.text,e.markedSpans))});if(S)for(S.addChange(e.line,q.length,k);S.done.length>l.undoDepth;)S.done.shift();
q=Aa(y(k[0]),y(aa(k)),e.ch,a.ch,q);wc(e,a,q,b,c)}}function xc(e,a){if(e.length){for(var q=e.pop(),b=[],c=q.length-1;0<=c;--c){var k=q[c],d=[],l=k.start+k.added;x.iter(k.start,l,function(e){d.push(r(e.text,e.markedSpans))});b.push({start:k.start,added:k.old.length,old:d});var h={line:k.start+k.old.length-1,ch:Wc(D(aa(d)),D(aa(k.old)))};wc({line:k.start,ch:0},{line:l-1,ch:g(l-1).text.length},k.old,h,h)}wa=!0;a.push(b)}}function wc(e,a,q,b,c){function k(e){return e<=Math.min(a.line,a.line+u)?e:e+u}if(!mb){var d=
!1,f=na.text.length;l.lineWrapping||x.iter(e.line,a.line+1,function(e){if(!e.hidden&&e.text.length==f)return d=!0});if(e.line!=a.line||1<q.length)ma=!0;var Ka=a.line-e.line,U=g(e.line),p=g(a.line),m=aa(q);if(0==e.ch&&0==a.ch&&""==D(m)){for(var w=[],r=0,M=q.length-1;r<M;++r)w.push(new E(D(q[r]),y(q[r])));p.update(p.text,y(m));Ka&&x.remove(e.line,Ka,Xa);w.length&&x.insert(e.line,w)}else if(U==p)if(1==q.length)U.update(U.text.slice(0,e.ch)+D(q[0])+U.text.slice(a.ch),y(q[0]));else{w=[];r=1;for(M=q.length-
1;r<M;++r)w.push(new E(D(q[r]),y(q[r])));w.push(new E(D(m)+U.text.slice(a.ch),y(m)));U.update(U.text.slice(0,e.ch)+D(q[0]),y(q[0]));x.insert(e.line+1,w)}else if(1==q.length)U.update(U.text.slice(0,e.ch)+D(q[0])+p.text.slice(a.ch),y(q[0])),x.remove(e.line+1,Ka,Xa);else{w=[];U.update(U.text.slice(0,e.ch)+D(q[0]),y(q[0]));p.update(D(m)+p.text.slice(a.ch),y(m));r=1;for(M=q.length-1;r<M;++r)w.push(new E(D(q[r]),y(q[r])));1<Ka&&x.remove(e.line+1,Ka-1,Xa);x.insert(e.line+1,w)}if(l.lineWrapping){var t=Math.max(5,
v.clientWidth/Ub()-3);x.iter(e.line,e.line+q.length,function(e){if(!e.hidden){var a=Math.ceil(e.text.length/t)||1;a!=e.height&&n(e,a)}})}else x.iter(e.line,e.line+q.length,function(e){var a=e.text;!e.hidden&&a.length>f&&(na=e,f=a.length,rb=!0,d=!1)}),d&&(Ya=!0);ea=Math.min(ea,e.line);sb(400);var u=q.length-Ka-1;qa.push({from:e.line,to:a.line+1,diff:u});if(l.onChange){for(r=0;r<q.length;++r)"string"!=typeof q[r]&&(q[r]=q[r].text);e={from:e,to:a,text:q};if(Na){for(q=Na;q.next;q=q.next);q.next=e}else Na=
e}Za(H(b),H(c),k(h.from.line),k(h.to.line))}}function yc(){var e=x.height*oa()+2*J.offsetTop;return.99*e>v.offsetHeight?e:!1}function Vb(e){var a=yc();F.style.display=a?"block":"none";a?(zc.style.height=pa.style.minHeight=a+"px",F.style.height=v.clientHeight+"px",null!=e&&(F.scrollTop=v.scrollTop=e,tb&&setTimeout(function(){F.scrollTop==e&&(F.scrollTop=e+(e?-1:1),F.scrollTop=e)},0))):pa.style.minHeight="";ub.style.top=Oa*oa()+"px"}function Ac(){na=g(0);rb=!0;var e=na.text.length;x.iter(1,x.size,function(a){var q=
a.text;!a.hidden&&q.length>e&&(e=q.length,na=a)});Ya=!1}function Z(e,a,q){function b(la){if(K(la,a))return la;if(!K(q,la))return c;var d=la.line+e.length-(q.line-a.line)-1,g=la.ch;la.line==q.line&&(g+=aa(e).length-(q.ch-(q.line==a.line?a.ch:0)));return{line:d,ch:g}}a=H(a);q=q?H(q):a;e=jb(e);var c;va(e,a,q,function(e){c=e;return{from:b(h.from),to:b(h.to)}});return c}function Wa(e,a){va(jb(e),h.from,h.to,function(e){return"end"==a?{from:e,to:e}:"start"==a?{from:h.from,to:h.from}:{from:h.from,to:e}})}
function va(e,a,q,b){var c=1==e.length?e[0].length+a.ch:aa(e).length;b=b({line:a.line+e.length-1,ch:c});qc(a,q,e,b.from,b.to)}function Bc(e,a,q){var b=e.line,c=a.line;if(b==c)return g(b).text.slice(e.ch,a.ch);var k=[g(b).text.slice(e.ch)];x.iter(b+1,c,function(e){k.push(e.text)});k.push(g(c).text.slice(0,a.ch));return k.join(q||"\n")}function Pb(e){return Bc(h.from,h.to,e)}function qb(){Ma||Wb.set(l.pollInterval,function(){pb();ca&&qb()})}function $a(){function e(){pb()||a?(Ma=!1,qb()):(a=!0,Wb.set(60,
e))}var a=!1;Ma=!0;Wb.set(20,e)}function pb(){if(!ca||Xc(z)||l.readOnly)return!1;var e=z.value;if(e==ha)return!1;vb||Cc();ka=null;for(var a=0,q=Math.min(ha.length,e.length);a<q&&ha[a]==e[a];)++a;a<ha.length?h.from={line:h.from.line,ch:h.from.ch-(ha.length-a)}:wb&&B(h.from,h.to)&&(h.to={line:h.to.line,ch:Math.min(g(h.to.line).text.length,h.to.ch+(e.length-a))});Wa(e.slice(a),"end");1E3<e.length?z.value=ha="":ha=e;vb||Dc();return!0}function xb(e){B(h.from,h.to)?e&&(ha=z.value=""):(ha="",z.value=Pb(),
ca&&(e=z,Xb?(e.selectionStart=0,e.selectionEnd=e.value.length):e.select()))}function ja(){"nocursor"!=l.readOnly&&z.focus()}function Yc(){var e=Ec();Ea(e.x,e.y,e.x,e.yBot);if(ca){var a=pa.getBoundingClientRect(),q=null;0>e.y+a.top?q=!0:e.y+a.top+oa()>(window.innerHeight||document.documentElement.clientHeight)&&(q=!1);if(null!=q){if(a="none"==W.style.display)W.style.display="",W.style.left=e.x+"px",W.style.top=e.y-Oa+"px";W.scrollIntoView(q);a&&(W.style.display="none")}}}function Ec(){var e=ra(h.inverted?
h.from:h.to);return{x:l.lineWrapping?Math.min(e.x,J.offsetWidth):e.x,y:e.y,yBot:e.yBot}}function Ea(e,a,q,b){e=Ia(e,a,q,b);null!=e.scrollLeft&&(v.scrollLeft=e.scrollLeft);null!=e.scrollTop&&(F.scrollTop=v.scrollTop=e.scrollTop)}function Ia(e,a,q,b){var c=J.offsetLeft,k=J.offsetTop;a+=k;b+=k;e+=c;q+=c;var d=v.clientHeight,g=F.scrollTop,h={},f=yc()||Infinity;a<g?h.scrollTop=a<k+10?0:Math.max(0,a):b>g+d&&(h.scrollTop=(b+k>f-10?f:b)-d);a=v.clientWidth;b=v.scrollLeft;k=l.fixedGutter?ba.clientWidth:0;c=
e<k+c+10;e<b+k||c?(c&&(e=0),h.scrollLeft=Math.max(0,e-10-k)):q>a+b-3&&(h.scrollLeft=q+10-a);return h}function Ja(e){var a=oa();e=(null!=e?e:F.scrollTop)-J.offsetTop;var b=Math.ceil((e+v.clientHeight)/a);return{from:Yb(x,Math.max(0,Math.floor(e/a))),to:Yb(x,b)}}function Ba(e,a,b){function c(){var e=fa.firstChild,a=!1;x.iter(N,R,function(b){if(e){if(!b.hidden){var q=Math.round(e.offsetHeight/U)||1;b.height!=q&&(n(b,q),ma=a=!0)}e=e.nextSibling}});return a}if(v.clientWidth){var d=Ja(b);if(!0!==e&&0==
e.length&&d.from>N&&d.to<R)Vb(b);else{var k=Math.max(d.from-100,0),g=Math.min(x.size,d.to+100);N<k&&20>k-N&&(k=N);R>g&&20>R-g&&(g=Math.min(x.size,R));e=!0===e?[]:fb([{from:N,to:R,domStart:0}],e);for(var h=d=0;h<e.length;++h){var f=e[h];f.from<k&&(f.domStart+=k-f.from,f.from=k);f.to>g&&(f.to=g);f.from>=f.to?e.splice(h--,1):d+=f.to-f.from}if(d==g-k&&k==N&&g==R)Vb(b);else{e.sort(function(e,a){return e.domStart-a.domStart});var U=oa(),d=ba.style.display;fa.style.display="none";hb(k,g,e);fa.style.display=
ba.style.display="";(h=k!=N||g!=R||Fc!=v.clientHeight+U)&&(Fc=v.clientHeight+U);(k!=N||g!=R&&l.onViewportChange)&&setTimeout(function(){if(l.onViewportChange)l.onViewportChange(G,k,g)});N=k;R=g;Oa=Zb(x,k);sb(100);if(fa.childNodes.length!=R-N)throw Error("BAD PATCH! "+JSON.stringify(e)+" size="+(R-N)+" nodes="+fa.childNodes.length);l.lineWrapping&&c();ba.style.display=d;(h||ma)&&$b()&&l.lineWrapping&&c()&&$b();Vb(b);eb();if(!a&&l.onUpdate)l.onUpdate(G);return!0}}}else N=R=Oa=0}function fb(e,a){for(var b=
0,c=a.length||0;b<c;++b){for(var d=a[b],k=[],g=d.diff||0,h=0,l=e.length;h<l;++h){var f=e[h];d.to<=f.from&&d.diff?k.push({from:f.from+g,to:f.to+g,domStart:f.domStart}):d.to<=f.from||d.from>=f.to?k.push(f):(d.from>f.from&&k.push({from:f.from,to:d.from,domStart:f.domStart}),d.to<f.to&&k.push({from:d.to+g,to:f.to+g,domStart:f.domStart+(d.to-f.from)}))}e=k}return e}function hb(e,a,b){function c(e){var a=e.nextSibling;e.parentNode.removeChild(e);return a}if(b.length){for(var d=0,k=fa.firstChild,g=0;g<b.length;++g){for(var h=
b[g];h.domStart>d;)k=c(k),d++;for(var l=0,h=h.to-h.from;l<h;++l)k=k.nextSibling,d++}for(;k;)k=c(k)}else ac(fa);var n=b.shift(),k=fa.firstChild,l=e;x.iter(e,a,function(e){n&&n.to==l&&(n=b.shift());if(!n||n.from>l){if(e.hidden)var a=u("pre");else a=f(e),e.className&&(a.className=e.className),e.bgClassName&&(e=u("pre","\u00a0",e.bgClassName,"position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2"),a=u("div",[e,a],null,"position: relative"));fa.insertBefore(a,k)}else k=k.nextSibling;++l})}
function $b(){if(l.gutter||l.lineNumbers){var e=ub.offsetHeight,a=v.clientHeight;ba.style.height=(2>e-a?a:e)+"px";var b=document.createDocumentFragment(),c=N,d;x.iter(N,Math.max(R,N+1),function(e){if(e.hidden)b.appendChild(u("pre"));else{var a=e.gutterMarker,da=l.lineNumbers?l.lineNumberFormatter(c+l.firstLineNumber):null;a&&a.text?da=a.text.replace("%N%",null!=da?da:""):null==da&&(da="\u00a0");var k=b.appendChild(u("pre",null,a&&a.style));k.innerHTML=da;for(da=1;da<e.height;++da)k.appendChild(u("br")),
k.appendChild(document.createTextNode("\u00a0"));a||(d=c)}++c});ba.style.display="none";ab(Pa,b);if(null!=d&&l.lineNumbers){for(var e=Pa.childNodes[d-N],a=String(x.size).length,k=Zc(e.firstChild),g="";k.length+g.length<a;)g+="\u00a0";g&&e.insertBefore(document.createTextNode(g),e.firstChild)}ba.style.display="";e=2<Math.abs((parseInt(J.style.marginLeft)||0)-ba.offsetWidth);J.style.marginLeft=ba.offsetWidth+"px";ma=!1;return e}}function eb(){var e=B(h.from,h.to),a=ra(h.from,!0),b=e?a:ra(h.to,!0),c=
h.inverted?a:b,d=oa(),k=Qa(Y),g=Qa(fa);Ha.style.top=Math.max(0,Math.min(v.offsetHeight,c.y+g.top-k.top))+"px";Ha.style.left=Math.max(0,Math.min(v.offsetWidth,c.x+g.left-k.left))+"px";if(e)W.style.top=c.y+"px",W.style.left=(l.lineWrapping?Math.min(c.x,J.offsetWidth):c.x)+"px",W.style.display="",yb.style.display="none";else{var e=a.y==b.y,f=document.createDocumentFragment(),n=J.clientWidth||J.offsetWidth,c=J.clientHeight||J.offsetHeight,k=function(e,a,b,q){f.appendChild(u("div",null,"CodeMirror-selected",
"position: absolute; left: "+e+"px; top: "+a+"px; "+($c?"width: "+(b?n-b-e:n)+"px":"right: "+b+"px")+"; height: "+q+"px"))};h.from.ch&&0<=a.y&&k(a.x,a.y,e?n-b.x:0,d);a=Math.max(0,a.y+(h.from.ch?d:0));g=Math.min(b.y,c)-a;g>.2*d&&k(0,a,0,g);e&&h.from.ch||!(b.y<c-.5*d)||k(0,b.y,n-b.x,d);ab(yb,f);W.style.display="none";yb.style.display=""}}function gb(e){ka=e?ka||(h.inverted?h.to:h.from):null}function ia(e,a){var b=ka&&H(ka);b&&(K(b,e)?e=b:K(a,b)&&(a=b));Za(e,a);zb=!0}function Za(e,a,b,c){Ab=null;null==
b&&(b=h.from.line,c=h.to.line);if(!B(h.from,e)||!B(h.to,a)){if(K(a,e)){var d=a;a=e;e=d}e.line!=b&&((b=Bb(e,b,h.from.ch))?e=b:bc(e.line,!1));a.line!=c&&(a=Bb(a,c,h.to.ch));B(e,a)?h.inverted=!1:B(e,h.to)?h.inverted=!1:B(a,h.from)&&(h.inverted=!0);if(l.autoClearEmptyLines&&B(h.from,h.to)&&(h.inverted?e:a).line!=h.from.line&&h.from.line<x.size){var k=g(h.from.line);/^\s+$/.test(k.text)&&setTimeout(w(function(){if(k.parent&&/^\s+$/.test(k.text)){var e=ga(k);Z("",{line:e,ch:0},{line:e,ch:k.text.length})}},
10))}h.from=e;h.to=a;Ca=!0}}function Bb(e,a,b){function c(a){for(var d=e.line+a,da=1==a?x.size:-1;d!=da;){var la=g(d);if(!la.hidden){a=e.ch;if(k||a>b||a>la.text.length)a=la.text.length;return{line:d,ch:a}}d+=a}}var d=g(e.line),k=e.ch==d.text.length&&e.ch!=b;return d.hidden?e.line>=a?c(1)||c(-1):c(-1)||c(1):e}function Da(a,b,q){a=H({line:a,ch:b||0});(q?ia:Za)(a,a)}function Cb(a){return Math.max(0,Math.min(a,x.size-1))}function H(a){if(0>a.line)return{line:0,ch:0};if(a.line>=x.size)return{line:x.size-
1,ch:g(x.size-1).text.length};var b=a.ch,q=g(a.line).text.length;return null==b||b>q?{line:a.line,ch:q}:0>b?{line:a.line,ch:0}:a}function cc(a,b){function q(b){if(k==(0>a?0:f.text.length)){if(b=!b)a:{b=d+a;for(var q=0>a?-1:x.size;b!=q;b+=a){var c=g(b);if(!c.hidden){d=b;f=c;b=!0;break a}}b=void 0}if(b)k=0>a?f.text.length:0;else return!1}else k+=a;return!0}var c=h.inverted?h.from:h.to,d=c.line,k=c.ch,f=g(d);if("char"==b)q();else if("column"==b)q(!0);else if("word"==b)for(c=!1;!(0>a)||q();){if(Db(f.text.charAt(k)))c=
!0;else if(c){0>a&&(a=1,q());break}if(0<a&&!q())break}return{line:d,ch:k}}function Gc(a){var b=g(a.line).text,q=a.ch,c=a.ch;if(b){!1===a.after||c==b.length?--q:++c;for(var d=b.charAt(q),d=Db(d)?Db:/\s/.test(d)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!Db(a)};0<q&&d(b.charAt(q-1));)--q;for(;c<b.length&&d(b.charAt(c));)++c}return{from:{line:a.line,ch:q},to:{line:a.line,ch:c}}}function nc(a){ia({line:a,ch:0},H({line:a+1,ch:0}))}function Eb(a,b){b||(b="add");if("smart"==b)if(T.indent)var c=
Ua(a);else b="prev";var d=g(a),h=d.indentation(l.tabSize),k=d.text.match(/^\s*/)[0],f;"smart"==b&&(f=T.indent(c,d.text.slice(k.length),d.text),f==sc&&(b="prev"));"prev"==b?f=a?g(a-1).indentation(l.tabSize):0:"add"==b?f=h+l.indentUnit:"subtract"==b&&(f=h-l.indentUnit);f=Math.max(0,f);c="";d=0;if(l.indentWithTabs)for(h=Math.floor(f/l.tabSize);h;--h)d+=l.tabSize,c+="\t";d<f&&(c+=Hc(f-d));c!=k&&Z(c,{line:a,ch:0},{line:a,ch:k.length})}function Ic(){T=m.getMode(l,l.mode);x.iter(0,x.size,function(a){a.stateAfter=
null});ea=0;sb(100)}function oc(a,b){if(l.lineWrapping){Y.className+=" CodeMirror-wrap";var c=v.clientWidth/Ub()-3;x.iter(0,x.size,function(a){if(!a.hidden){var e=Math.ceil(a.text.length/c)||1;1!=e&&n(a,e)}});J.style.minWidth=Fb.style.left=""}else Y.className=Y.className.replace(" CodeMirror-wrap",""),Ac(),x.iter(0,x.size,function(a){1==a.height||a.hidden||n(a,1)});qa.push({from:0,to:x.size})}function Jc(){v.className=v.className.replace(/\s*cm-s-\S+/g,"")+l.theme.replace(/(^|\s)\s*/g," cm-s-")}function Kc(){var a=
sa[l.keyMap].style;Y.className=Y.className.replace(/\s*cm-keymap-\S+/g,"")+(a?" cm-keymap-"+a:"")}function Gb(a,b){this.lines=[];this.type=a;b&&(this.style=b)}function dc(a,b,c,d){a=H(a);b=H(b);var g=new Gb("range",c);if(d)for(var k in d)d.hasOwnProperty(k)&&(g[k]=d[k]);var f=a.line;x.iter(f,b.line+1,function(c){var q={from:f==a.line?a.ch:null,to:f==b.line?b.ch:null,marker:g};(c.markedSpans||(c.markedSpans=[])).push(q);g.lines.push(c);++f});qa.push({from:a.line,to:b.line+1});return g}function Lc(a,
b){var c=a,d=a;"number"==typeof a?d=g(Cb(a)):c=ga(a);if(null!=c&&b(d,c))qa.push({from:c,to:c+1});else return null;return d}function bc(a,b){return Lc(a,function(a,e){if(a.hidden!=b){a.hidden=b;l.lineWrapping||(b&&a.text.length==na.text.length?Ya=!0:!b&&a.text.length>na.text.length&&(na=a,Ya=!1));n(a,b?0:1);var c=h.from.line,d=h.to.line;if(b&&(c==e||d==e)){c=c==e?Bb({line:c,ch:0},c,0):h.from;d=d==e?Bb({line:d,ch:0},d,0):h.to;if(!d)return;Za(c,d)}return ma=!0}})}function ec(a,b){if(0==b)return{top:0,
left:0};l.lineWrapping&&b<a.text.length&&Hb.test(a.text.slice(b-1,b+1));var c=f(a,b);ab(Ra,c);var c=c.anchor,d=c.offsetTop,g=c.offsetLeft;Ga&&0==d&&0==g&&(d=u("span","x"),c.parentNode.insertBefore(d,c.nextSibling),d=d.offsetTop);return{top:d,left:g}}function ra(a,b){var c,d=oa(),f=d*(Zb(x,a.line)-(b?Oa:0));if(0==a.ch)c=0;else{var k=ec(g(a.line),a.ch);c=k.left;l.lineWrapping&&(f+=Math.max(0,k.top))}return{x:c,y:f,yBot:f+d}}function Ib(a,b){function c(a){a=ec(n,a);if(p){var e=Math.round(a.top/d);m=
e!=w;return Math.max(0,a.left+(e-w)*v.clientWidth)}return a.left}var d=oa(),f=Ub(),k=Oa+Math.floor(b/d);if(0>k)return{line:0,ch:0};var h=Yb(x,k);if(h>=x.size)return{line:x.size-1,ch:g(x.size-1).text.length};var n=g(h),r=n.text,p=l.lineWrapping,w=p?k-Zb(x,h):0;if(0>=a&&0==w)return{line:h,ch:0};for(var m=!1,M=k=0,r=r.length,u=Math.min(r,Math.ceil((a+w*v.clientWidth*.9)/f));;){var t=c(u);if(t<=a&&u<r)u=Math.min(r,Math.ceil(1.2*u));else{f=t;r=u;break}}if(a>f)return{line:h,ch:r};u=Math.floor(.8*r);t=c(u);
t<a&&(k=u,M=t);for(;;){if(1>=r-k)return M=a-M<f-a,{line:h,ch:M?k:r,after:M};u=Math.ceil((k+r)/2);t=c(u);t>a?(r=u,f=t,m&&(f+=1E3)):(k=u,M=t)}}function oa(){if(null==Sa){Sa=u("pre");for(var a=0;49>a;++a)Sa.appendChild(document.createTextNode("x")),Sa.appendChild(u("br"));Sa.appendChild(document.createTextNode("x"))}a=fa.clientHeight;if(a==Mc)return fc;Mc=a;ab(Ra,Sa.cloneNode(!0));fc=Ra.firstChild.offsetHeight/50||1;ac(Ra);return fc}function Ub(){if(v.clientWidth==Nc)return Oc;Nc=v.clientWidth;var a=
u("span","x"),b=u("pre",[a]);ab(Ra,b);return Oc=a.offsetWidth||10}function Va(a,b){var c=Qa(v,!0),d,g;try{d=a.clientX,g=a.clientY}catch(k){return null}if(!b&&(d-c.left>v.clientWidth||g-c.top>v.clientHeight))return null;c=Qa(J,!0);return Ib(d-c.left,g-c.top)}function Pc(a){function b(){Ha.style.position="relative";z.style.cssText=g;gc&&(F.scrollTop=d);qb();if(null!=z.selectionStart){clearTimeout(hc);var a=z.value=" "+(B(h.from,h.to)?"":z.value),e=0;ha=" ";z.selectionStart=1;z.selectionEnd=a.length;
hc=setTimeout(function U(){" "==ha&&0==z.selectionStart?w(Qb.selectAll)(G):10>e++?hc=setTimeout(U,500):xb()},200)}}var c=Va(a),d=F.scrollTop;if(c&&!ya){(B(h.from,h.to)||K(c,h.from)||!K(c,h.to))&&w(Da)(c.line,c.ch);var g=z.style.cssText;Ha.style.position="absolute";z.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(a.clientY-5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: white; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
ja();xb(!0);B(h.from,h.to)&&(z.value=ha=" ");if(bb){ib(a);var k=A(window,"mouseup",function(){k();setTimeout(b,20)},!0)}else setTimeout(b,50)}}function ob(){clearInterval(Tb);var a=!0;W.style.visibility="";Tb=setInterval(function(){W.style.visibility=(a=!a)?"":"hidden"},l.cursorBlinkRate)}function Qc(a){function b(a,e,c){if(a.text){var d=a.styles;a=l?0:a.text.length-1;for(var q,g=l?0:d.length-2,f=l?d.length:-2;g!=f;g+=2*n){var k=d[g];if(d[g+1]!=m)a+=n*k.length;else for(var h=l?0:k.length-1,da=l?k.length:
-1;h!=da;h+=n,a+=n)if(a>=e&&a<c&&u.test(q=k.charAt(h))){var r=ic[q];if(">"==r.charAt(1)==l)M.push(q);else{if(M.pop()!=r.charAt(0))return{pos:a,match:!1};if(!M.length)return{pos:a,match:!0}}}}}}var c=h.inverted?h.from:h.to,d=g(c.line),f=c.ch-1,k=0<=f&&ic[d.text.charAt(f)]||ic[d.text.charAt(++f)];if(k){k.charAt(0);for(var l=">"==k.charAt(1),n=l?1:-1,r=d.styles,p=f+1,k=0,v=r.length;k<v;k+=2)if(0>=(p-=r[k].length)){var m=r[k+1];break}for(var M=[d.text.charAt(f)],u=/[(){}[\]]/,k=c.line,v=l?Math.min(k+
100,x.size):Math.max(-1,k-100);k!=v;k+=n){var d=g(k),t=k==c.line;if(t=b(d,t&&l?f+1:0,t&&!l?f:d.text.length))break}t||(t={pos:null,match:!1});var m=t.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",z=dc({line:c.line,ch:f},{line:c.line,ch:f+1},m),E=null!=t.pos&&dc({line:k,ch:t.pos},{line:k,ch:t.pos+1},m),c=w(function(){z.clear();E&&E.clear()});a?setTimeout(c,800):za=c}}function pc(a){var b,c,d=a;for(a-=40;d>a;--d){if(0==d)return 0;var f=g(d-1);if(f.stateAfter)return d;f=f.indentation(l.tabSize);
if(null==c||b>f)c=d-1,b=f}return c}function Ua(a){var b=pc(a),c=b&&g(b-1).stateAfter,c=c?L(T,c):ta(T);x.iter(b,a,function(d){d.process(T,c,l.tabSize);d.stateAfter=b==a-1||0==b%5?L(T,c):null});return c}function ad(){if(!(ea>=R)){var a=+new Date+l.workTime,b=L(T,Ua(ea)),c=ea;x.iter(ea,R,function(c){ea>=N?(c.highlight(T,b,l.tabSize),c.stateAfter=L(T,b)):(c.process(T,b,l.tabSize),c.stateAfter=0==ea%5?L(T,b):null);++ea;if(+new Date>a)return sb(l.workDelay),!0});R>c&&ea>=N&&w(function(){qa.push({from:c,
to:ea})})()}}function sb(a){ea<R&&bd.set(a,ad)}function Cc(){wa=zb=Na=null;qa=[];Ca=!1;Xa=[]}function Dc(){Ya&&Ac();if(rb&&!l.lineWrapping){var a=Fb.offsetWidth,b=ec(na,na.text.length).left;jc||(Fb.style.left=b+"px",J.style.minWidth=b+a+"px");rb=!1}var c,d;Ca&&(a=Ec(),c=Ia(a.x,a.y,a.x,a.yBot));if(qa.length||c&&null!=c.scrollTop)d=Ba(qa,!0,c&&c.scrollTop);d||(Ca&&eb(),ma&&$b());c&&Yc();Ca&&ob();ca&&(!0===wa||!1!==wa&&Ca)&&xb(zb);Ca&&l.matchBrackets&&setTimeout(w(function(){za&&(za(),za=null);B(h.from,
h.to)&&Qc(!1)}),20);b=Ca;a=Xa;if(Na&&l.onChange&&G)l.onChange(G,Na);if(b&&l.onCursorActivity)l.onCursorActivity(G);for(b=0;b<a.length;++b)a[b](G);if(d&&l.onUpdate)l.onUpdate(G)}function w(a){return function(){vb++||Cc();try{var b=a.apply(this,arguments)}finally{--vb||Dc()}return b}}function rc(a){S.startCompound();try{return a()}finally{S.endCompound()}}var l={},kc=m.defaults,cb;for(cb in kc)kc.hasOwnProperty(cb)&&(l[cb]=(b&&b.hasOwnProperty(cb)?b:kc)[cb]);var z=u("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em");
z.setAttribute("wrap","off");z.setAttribute("autocorrect","off");z.setAttribute("autocapitalize","off");var Ha=u("div",[z],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),zc=u("div",null,"CodeMirror-scrollbar-inner"),F=u("div",[zc],"CodeMirror-scrollbar"),fa=u("div"),yb=u("div",null,null,"position: relative; z-index: -1"),W=u("pre","\u00a0","CodeMirror-cursor"),Fb=u("pre","\u00a0","CodeMirror-cursor","visibility: hidden"),Ra=u("div",null,null,"position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden;"),
J=u("div",[Ra,W,Fb,yb,fa],null,"position: relative; z-index: 0"),Pa=u("div",null,"CodeMirror-gutter-text"),ba=u("div",[Pa],"CodeMirror-gutter"),ub=u("div",[ba,u("div",[J],"CodeMirror-lines")],null,"position: relative"),pa=u("div",[ub],null,"position: relative"),v=u("div",[pa],"CodeMirror-scroll");v.setAttribute("tabIndex","-1");var Y=u("div",[Ha,F,v],"CodeMirror"+(l.lineWrapping?" CodeMirror-wrap":""));a.appendChild?a.appendChild(Y):a(Y);Jc();Kc();Xb&&(z.style.width="0px");tb||(v.draggable=!0);J.style.outline=
"none";null!=l.tabindex&&(z.tabIndex=l.tabindex);l.autofocus&&ja();l.gutter||l.lineNumbers||(ba.style.display="none");lc&&(Ha.style.height="1px",Ha.style.position="absolute");cd?(F.style.zIndex=-2,F.style.visibility="hidden"):jc&&(F.style.minWidth="18px");var Wb=new mc,bd=new mc,Tb,T,x=new Jb([new X([new E("")])]),ea=0,ca;Ic();var h={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},ka,Kb,Lb,ua=0,kb,wb=!1,mb=!1,wa,zb,qa,Na,Ca,ma,Xa,Oa=0,N=0,R=0,Fc=0,za,na=g(0),Ya=!1,rb=!0,Ma=!1,Ab=null;w(function(){p(l.value||
"");wa=!1})();var S=new Mb;A(v,"mousedown",w(function(a){function b(c){tb&&(v.draggable=!1);kb=!1;u();E();10>Math.abs(a.clientX-c.clientX)+Math.abs(a.clientY-c.clientY)&&(C(c),Da(n.line,n.ch,!0),ja())}function c(a){if("single"==r)ia(n,a);else if("double"==r){var e=Gc(a);K(a,M)?ia(e.from,t):ia(M,e.to)}else"triple"==r&&(K(a,M)?ia(t,H({line:a.line,ch:0})):ia(M,H({line:a.line+1,ch:0})))}function d(a){var e=Va(a,!0);if(e&&!B(e,p)){ca||La();p=e;c(e);wa=!1;var b=Ja();if(e.line>=b.to||e.line<b.from)m=setTimeout(w(function(){d(a)}),
150)}}function g(a){clearTimeout(m);var e=Va(a);e&&c(e);C(a);ja();wa=!0;x();u()}gb(V(a,"shiftKey"));for(var f=a.target||a.srcElement;f!=Y;f=f.parentNode)if(f.parentNode==pa&&f!=ub)return;for(f=a.target||a.srcElement;f!=Y;f=f.parentNode)if(f.parentNode==Pa){if(l.onGutterClick)l.onGutterClick(G,Nb(Pa.childNodes,f)+N,a);return C(a)}var n=Va(a);switch(Rc(a)){case 3:bb&&Pc(a);return;case 2:n&&Da(n.line,n.ch,!0);setTimeout(ja,20);C(a);return}if(n){ca||La();var f=+new Date,r="single";Lb&&Lb.time>f-400&&
B(Lb.pos,n)?(r="triple",C(a),setTimeout(ja,20),nc(n.line)):Kb&&Kb.time>f-400&&B(Kb.pos,n)?(r="double",Lb={time:f,pos:n},C(a),f=Gc(n),ia(f.from,f.to)):Kb={time:f,pos:n};var p=n,m;if(!l.dragDrop||!dd||l.readOnly||B(h.from,h.to)||K(n,h.from)||K(h.to,n)||"single"!=r){C(a);"single"==r&&Da(n.line,n.ch,!0);var M=h.from,t=h.to,x=A(document,"mousemove",w(function(a){clearTimeout(m);C(a);Ga||Rc(a)?d(a):g(a)}),!0),u=A(document,"mouseup",w(g),!0)}else{tb&&(v.draggable=!0);var u=A(document,"mouseup",w(b),!0),
E=A(v,"drop",w(b),!0);kb=!0;v.dragDrop&&v.dragDrop()}}else(a.target||a.srcElement)==v&&C(a)}));A(v,"dblclick",w(function(a){for(var b=a.target||a.srcElement;b!=Y;b=b.parentNode)if(b.parentNode==Pa)return C(a);C(a)}));A(J,"selectstart",C);bb||A(v,"contextmenu",Pc);A(v,"scroll",function(a){l.fixedGutter&&ba.style.left!=v.scrollLeft+"px"&&(ba.style.left=v.scrollLeft+"px");v.scrollTop!=ua&&(ua=v.scrollTop,F.scrollTop!=ua&&(F.scrollTop=ua),Ba([]));if(l.onScroll)l.onScroll(G)});A(F,"scroll",function(a){F.scrollTop!=
ua&&(ua=v.scrollTop=F.scrollTop,Ba([]))});A(F,"mousedown",function(){ca&&setTimeout(ja,0)});var ed=A(window,"resize",function(){Y.parentNode?Ba(!0):ed()},!0);A(z,"keyup",w(function(a){l.onKeyEvent&&l.onKeyEvent(G,Ta(a))||16==V(a,"keyCode")&&(ka=null)}));A(z,"input",$a);A(z,"keydown",w(vc));A(z,"keypress",w(function(a){Ma&&pb();if(!l.onKeyEvent||!l.onKeyEvent(G,Ta(a))){var b=V(a,"keyCode"),c=V(a,"charCode");ya&&b==Rb?(Rb=null,C(a)):(ya&&(!a.which||10>a.which)||lc)&&tc(a)||(b=String.fromCharCode(null==
c?b:c),l.electricChars&&T.electricChars&&l.smartIndent&&!l.readOnly&&-1<T.electricChars.indexOf(b)&&setTimeout(w(function(){Eb(h.to.line,"smart")}),75),Vc(a,b)||$a())}}));A(z,"focus",La);A(z,"blur",Sb);l.dragDrop&&(A(v,"dragstart",Uc),A(v,"dragenter",c),A(v,"dragover",c),A(v,"drop",w(Q)));A(v,"paste",function(){ja();$a()});A(z,"paste",$a);A(z,"cut",w(function(){l.readOnly||Wa("")}));lc&&A(pa,"mouseup",function(){document.activeElement==z&&z.blur();ja()});var Sc;try{Sc=document.activeElement==z}catch(e){}Sc||
l.autofocus?setTimeout(La,20):Sb();var G=Y.CodeMirror={getValue:t,setValue:w(p),getSelection:Pb,replaceSelection:w(Wa),getCode:t,setCode:p,focus:function(){window.focus();ja();La();$a()},setOption:function(a,b){var c=l[a];l[a]=b;"mode"==a||"indentUnit"==a?Ic():"readOnly"==a&&"nocursor"==b?(Sb(),z.blur()):"readOnly"!=a||b?"theme"==a?Jc():"lineWrapping"==a&&c!=b?w(oc)():"tabSize"==a?Ba(!0):"keyMap"==a&&Kc():xb(!0);if("lineNumbers"==a||"gutter"==a||"firstLineNumber"==a||"theme"==a||"lineNumberFormatter"==
a)c=l.gutter||l.lineNumbers,ba.style.display=c?"":"none",c?ma=!0:fa.parentNode.style.marginLeft=0,Ba(!0)},getOption:function(a){return l[a]},getMode:function(){return T},undo:w(function(){xc(S.done,S.undone)}),redo:w(function(){xc(S.undone,S.done)}),indentLine:w(function(a,b){"string"!=typeof b&&(b=null==b?l.smartIndent?"smart":"prev":b?"add":"subtract");d(a)&&Eb(a,b)}),indentSelection:w(function(a){if(B(h.from,h.to))return Eb(h.from.line,a);for(var b=h.to.line-(h.to.ch?0:1),c=h.from.line;c<=b;++c)Eb(c,
a)}),historySize:function(){return{undo:S.done.length,redo:S.undone.length}},clearHistory:function(){S=new Mb},setHistory:function(a){S=new Mb;S.done=a.done;S.undone=a.undone},getHistory:function(){function a(b){for(var e=0,c=[],d;e<b.length;++e){c.push(d=[]);for(var f=0,g=b[e];f<g.length;++f){var h=[],l=g[f];d.push({start:l.start,added:l.added,old:h});for(var n=0;n<l.old.length;++n)h.push(D(l.old[n]))}}return c}return{done:a(S.done),undone:a(S.undone)}},matchBrackets:w(function(){Qc(!0)}),getTokenAt:w(function(a){a=
H(a);return g(a.line).getTokenAt(T,Ua(a.line),l.tabSize,a.ch)}),getStateAfter:function(a){a=Cb(null==a?x.size-1:a);return Ua(a+1)},cursorCoords:function(a,b){null==a&&(a=h.inverted);return this.charCoords(a?h.from:h.to,b)},charCoords:function(a,b){a=H(a);if("local"==b)return ra(a,!1);if("div"==b)return ra(a,!0);var c=ra(a,!0),d=Qa(J);return{x:d.left+c.x,y:d.top+c.y,yBot:d.top+c.yBot}},coordsChar:function(a){var b=Qa(J);return Ib(a.x-b.left,a.y-b.top)},markText:w(dc),setBookmark:function(a){a=H(a);
var b=new Gb("bookmark"),c=g(a.line);a={from:a.ch,to:a.ch,marker:b};(c.markedSpans||(c.markedSpans=[])).push(a);b.lines.push(c);return b},findMarksAt:function(a){a=H(a);var b=[],c=g(a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var f=c[d];(null==f.from||f.from<=a.ch)&&(null==f.to||f.to>=a.ch)&&b.push(f.marker)}return b},setMarker:w(function(a,b,c){"number"==typeof a&&(a=g(Cb(a)));a.gutterMarker={text:b,style:c};ma=!0;return a}),clearMarker:w(function(a){"number"==typeof a&&(a=g(Cb(a)));a.gutterMarker=
null;ma=!0}),setLineClass:w(function(a,b,c){return Lc(a,function(a){if(a.className!=b||a.bgClassName!=c)return a.className=b,a.bgClassName=c,!0})}),hideLine:w(function(a){return bc(a,!0)}),showLine:w(function(a){return bc(a,!1)}),onDeleteLine:function(a,b){if("number"==typeof a){if(!d(a))return null;a=g(a)}(a.handlers||(a.handlers=[])).push(b);return a},lineInfo:function(a){if("number"==typeof a){if(!d(a))return null;var b=a;a=g(a);if(!a)return null}else if(b=ga(a),null==b)return null;var c=a.gutterMarker;
return{line:b,handle:a,text:a.text,markerText:c&&c.text,markerClass:c&&c.style,lineClass:a.className,bgClass:a.bgClassName}},getViewport:function(){return{from:N,to:R}},addWidget:function(a,b,c,d,f){a=ra(H(a));var g=a.yBot,h=a.x;b.style.position="absolute";pa.appendChild(b);if("over"==d)g=a.y;else if("near"==d){d=Math.max(v.offsetHeight,x.height*oa());var l=Math.max(pa.clientWidth,J.clientWidth)-J.offsetLeft;a.yBot+b.offsetHeight>d&&a.y>b.offsetHeight&&(g=a.y-b.offsetHeight);h+b.offsetWidth>l&&(h=
l-b.offsetWidth)}b.style.top=g+J.offsetTop+"px";b.style.left=b.style.right="";"right"==f?(h=pa.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==f?h=0:"middle"==f&&(h=(pa.clientWidth-b.offsetWidth)/2),b.style.left=h+J.offsetLeft+"px");c&&Ea(h,g,h+b.offsetWidth,g+b.offsetHeight)},lineCount:function(){return x.size},clipPos:H,getCursor:function(a){null==a&&(a=h.inverted);a=a?h.from:h.to;return{line:a.line,ch:a.ch}},somethingSelected:function(){return!B(h.from,h.to)},setCursor:w(function(a,b,c){null==
b&&"number"==typeof a.line?Da(a.line,a.ch,c):Da(a,b,c)}),setSelection:w(function(a,b,c){(c?ia:Za)(H(a),H(b||a))}),getLine:function(a){if(d(a))return g(a).text},getLineHandle:function(a){if(d(a))return g(a)},setLine:w(function(a,b){d(a)&&Z(b,{line:a,ch:0},{line:a,ch:g(a).text.length})}),removeLine:w(function(a){d(a)&&Z("",{line:a,ch:0},H({line:a+1,ch:0}))}),replaceRange:w(Z),getRange:function(a,b,c){return Bc(H(a),H(b),c)},triggerOnKeyDown:w(vc),execCommand:function(a){return Qb[a](G)},moveH:w(function(a,
b){var c=0>a?h.from:h.to;if(ka||B(h.from,h.to))c=cc(a,b);Da(c.line,c.ch,!0)}),deleteH:w(function(a,b){B(h.from,h.to)?0>a?Z("",cc(a,b),h.to):Z("",h.from,cc(a,b)):Z("",h.from,h.to);zb=!0}),moveV:w(function(a,b){var c=ra(h.inverted?h.from:h.to,!0);null!=Ab&&(c.x=Ab);if("page"==b)var d=Ib(c.x,c.y+Math.min(v.clientHeight,window.innerHeight||document.documentElement.clientHeight)*a);else"line"==b&&(d=oa(),d=Ib(c.x,c.y+.5*d+a*d));"page"==b&&(F.scrollTop+=ra(d,!0).y-c.y);Da(d.line,d.ch,!0);Ab=c.x}),toggleOverwrite:function(){wb?
(wb=!1,W.className=W.className.replace(" CodeMirror-overwrite","")):(wb=!0,W.className+=" CodeMirror-overwrite")},posFromIndex:function(a){var b=0,c;x.iter(0,x.size,function(d){d=d.text.length+1;if(d>a)return c=a,!0;a-=d;++b});return H({line:b,ch:c})},indexFromPos:function(a){if(0>a.line||0>a.ch)return 0;var b=a.ch;x.iter(0,a.line,function(a){b+=a.text.length+1});return b},scrollTo:function(a,b){null!=a&&(v.scrollLeft=a);null!=b&&(F.scrollTop=v.scrollTop=b);Ba([])},getScrollInfo:function(){return{x:v.scrollLeft,
y:F.scrollTop,height:F.scrollHeight,width:v.scrollWidth}},setSize:function(a,b){function c(a){a=String(a);return/^\d+$/.test(a)?a+"px":a}null!=a&&(Y.style.width=c(a));null!=b&&(v.style.height=c(b));G.refresh()},operation:function(a){return w(a)()},compoundChange:function(a){return rc(a)},refresh:function(){Ba(!0,null,ua);F.scrollHeight>ua&&(F.scrollTop=ua)},getInputField:function(){return z},getWrapperElement:function(){return Y},getScrollerElement:function(){return v},getGutterElement:function(){return ba}},
uc,Rb=null,ha="";Gb.prototype.clear=w(function(){for(var a=Infinity,b=-Infinity,c=0;c<this.lines.length;++c){var d=this.lines[c],f=O(d.markedSpans,this,!0);if(null!=f.from||null!=f.to)d=ga(d),a=Math.min(a,d),b=Math.max(b,d)}Infinity!=a&&qa.push({from:a,to:b+1});this.lines.length=0});Gb.prototype.find=function(){for(var a,b,c=0;c<this.lines.length;++c){var d=this.lines[c],f=O(d.markedSpans,this);if(null!=f.from||null!=f.to)d=ga(d),null!=f.from&&(a={line:d,ch:f.from}),null!=f.to&&(b={line:d,ch:f.to})}return"bookmark"==
this.type?a:a&&{from:a,to:b}};var fc,Mc,Sa,Oc,Nc=0,hc,ic={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},vb=0,db;for(db in Ob)Ob.propertyIsEnumerable(db)&&!G.propertyIsEnumerable(db)&&(G[db]=Ob[db]);return G}function P(a){return"string"==typeof a?sa[a]:a}function I(a,b,c,d,g){function n(b){b=P(b);var c=b[a];if(!1===c)return g&&g(),!0;if(null!=c&&d(c))return!0;if(b.nofallthrough)return g&&g(),!0;b=b.fallthrough;if(null==b)return!1;if("[object Array]"!=Object.prototype.toString.call(b))return n(b);
for(var c=0,r=b.length;c<r;++c)if(n(b[c]))return!0;return!1}return b&&n(b)?!0:n(c)}function xa(a){a=Fa[V(a,"keyCode")];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function L(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);var c={},d;for(d in b){var g=b[d];g instanceof Array&&(g=g.concat([]));c[d]=g}return c}function ta(a,b,c){return a.startState?a.startState(b,c):!0}function Q(a,b){this.pos=this.start=0;this.string=a;this.tabSize=b||8}function O(a,b,c){if(a)for(var d=0;d<a.length;++d){var g=
a[d];if(g.marker==b)return c&&a.splice(d,1),g}}function Aa(a,b,c,d,g){if(!a&&!b)return g;if(a)for(var n=0,f;n<a.length;++n){var p=a[n],m=p.marker;if(null==p.from||(m.inclusiveLeft?p.from<=c:p.from<c)||"bookmark"==m.type&&p.from==c&&void 0!=p.from){var t=null==p.to||(m.inclusiveRight?p.to>=c:p.to>c);(f||(f=[])).push({from:p.from,to:t?null:p.to,marker:m})}}a=f;if(b)for(var n=0,u;n<b.length;++n)if(f=b[n],p=f.marker,null==f.to||(p.inclusiveRight?f.to>=d:f.to>d)||"bookmark"==p.type&&f.from==d)m=null==
f.from||(p.inclusiveLeft?f.from<=d:f.from<d),(u||(u=[])).push({from:m?null:f.from-d,to:null==f.to?null:f.to-d,marker:p});b=u;u=1==g.length;n=aa(g).length+(u?c:0);if(a)for(d=0;d<a.length;++d)if(f=a[d],null==f.to)(p=O(b,f.marker),p)?u&&(f.to=null==p.to?null:p.to+n):f.to=c;if(b)for(d=0;d<b.length;++d)f=b[d],null!=f.to&&(f.to+=n),null==f.from?(p=O(a,f.marker),p||(f.from=n,u&&(a||(a=[])).push(f))):(f.from+=n,u&&(a||(a=[])).push(f));c=[r(g[0],a)];if(!u){u=g.length-2;var E;if(0<u&&a)for(d=0;d<a.length;++d)null==
a[d].to&&(E||(E=[])).push({from:null,to:null,marker:a[d].marker});for(d=0;d<u;++d)c.push(r(g[d+1],E));c.push(r(aa(g),b))}return c}function D(a){return"string"==typeof a?a:a.text}function y(a){return"string"==typeof a?null:a.markedSpans}function r(a,b){return b?{text:a,markedSpans:b}:a}function p(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c){var d=b[c].marker.lines,g=Nb(d,a);d.splice(g,1)}a.markedSpans=null}}function t(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.lines.push(a);a.markedSpans=
b}}function E(a,b){this.text=a;this.height=1;t(this,b)}function X(a){this.lines=a;this.parent=null;for(var b=0,c=a.length,d=0;b<c;++b)a[b].parent=this,d+=a[b].height;this.height=d}function Jb(a){this.children=a;for(var b=0,c=0,d=0,g=a.length;d<g;++d){var n=a[d],b=b+n.chunkSize(),c=c+n.height;n.parent=this}this.size=b;this.height=c;this.parent=null}function ga(a){if(null==a.parent)return null;var b=a.parent;a=Nb(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}function Yb(a,b){var c=0;a:do{for(var d=0,g=a.children.length;d<g;++d){var n=a.children[d],f=n.height;if(b<f){a=n;continue a}b-=f;c+=n.chunkSize()}return c}while(!a.lines);d=0;for(g=a.lines.length;d<g;++d){n=a.lines[d].height;if(b<n)break;b-=n}return c+d}function Zb(a,b){var c=0;a:do{for(var d=0,g=a.children.length;d<g;++d){var n=a.children[d],f=n.chunkSize();if(b<f){a=n;continue a}b-=f;c+=n.height}return c}while(!a.lines);for(d=0;d<b;++d)c+=a.lines[d].height;return c}function Mb(){this.time=
0;this.done=[];this.undone=[];this.compound=0;this.closed=!1}function nc(){ib(this)}function Ta(a){a.stop||(a.stop=nc);return a}function C(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function eb(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function ib(a){C(a);eb(a)}function Rc(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));nb&&a.ctrlKey&&1==b&&(b=3);return b}function V(a,b){return a.override&&a.override.hasOwnProperty(b)?a.override[b]:a[b]}function A(a,
b,c,d){if("function"==typeof a.addEventListener){if(a.addEventListener(b,c,!1),d)return function(){a.removeEventListener(b,c,!1)}}else{var g=function(a){c(a||window.event)};a.attachEvent("on"+b,g);if(d)return function(){a.detachEvent("on"+b,g)}}}function mc(){this.id=null}function fb(a,b,c){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var d=0,g=0;d<b;++d)"\t"==a.charAt(d)?g+=c-g%c:++g;return g}function Qa(a,b){try{var c=a.getBoundingClientRect(),c={top:c.top,left:c.left}}catch(g){c=
{top:0,left:0}}if(!b)if(null==window.pageYOffset){var d=document.documentElement||document.body.parentNode;null==d.scrollTop&&(d=document.body);c.top+=d.scrollTop;c.left+=d.scrollLeft}else c.top+=window.pageYOffset,c.left+=window.pageXOffset;return c}function Zc(a){return a.textContent||a.innerText||a.nodeValue||""}function Hc(a){for(;Ia.length<=a;)Ia.push(aa(Ia)+" ");return Ia[a]}function aa(a){return a[a.length-1]}function B(a,b){return a.line==b.line&&a.ch==b.ch}function K(a,b){return a.line<b.line||
a.line==b.line&&a.ch<b.ch}function u(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)gb(a,b);else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function ac(a){a.innerHTML="";return a}function ab(a,b){ac(a).appendChild(b)}function gb(a,b){gc?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function Wc(a,b){if(!b)return 0;if(!a)return b.length;for(var c=a.length,d=b.length;0<=c&&0<=d&&a.charAt(c)==b.charAt(d);--c,
--d);return d+1}function Nb(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;++c)if(a[c]==b)return c;return-1}function Db(a){return/\w/.test(a)||a.toUpperCase()!=a.toLowerCase()}m.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,smartIndent:!0,tabSize:4,keyMap:"default",extraKeys:null,electricChars:!0,autoClearEmptyLines:!1,onKeyEvent:null,onDragEvent:null,lineWrapping:!1,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,dragDrop:!0,onChange:null,
onCursorActivity:null,onViewportChange:null,onGutterClick:null,onUpdate:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,cursorBlinkRate:530,workTime:100,workDelay:200,pollInterval:100,undoDepth:40,tabindex:null,autofocus:null,lineNumberFormatter:function(a){return a}};var Xb=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),nb=Xb||/Mac/.test(navigator.platform);/Win/.test(navigator.platform);var Ja=m.modes={},va=m.mimeModes={};m.defineMode=function(a,b){m.defaults.mode||
"null"==a||(m.defaults.mode=a);if(2<arguments.length){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}Ja[a]=b};m.defineMIME=function(a,b){va[a]=b};m.resolveMode=function(a){if("string"==typeof a&&va.hasOwnProperty(a))a=va[a];else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return m.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}};m.getMode=function(a,b){b=m.resolveMode(b);var c=Ja[b.name];if(!c)return m.getMode(a,
"text/plain");c=c(a,b);if(Ea.hasOwnProperty(b.name)){var d=Ea[b.name],g;for(g in d)d.hasOwnProperty(g)&&(c[g]=d[g])}c.name=b.name;return c};m.listModes=function(){var a=[],b;for(b in Ja)Ja.propertyIsEnumerable(b)&&a.push(b);return a};m.listMIMEs=function(){var a=[],b;for(b in va)va.propertyIsEnumerable(b)&&a.push({mime:b,mode:va[b]});return a};var Ob=m.extensions={};m.defineExtension=function(a,b){Ob[a]=b};var Ea=m.modeExtensions={};m.extendMode=function(a,b){var c=Ea.hasOwnProperty(a)?Ea[a]:Ea[a]=
{},d;for(d in b)b.hasOwnProperty(d)&&(c[d]=b[d])};var Qb=m.commands={selectAll:function(a){a.setSelection({line:0,ch:0},{line:a.lineCount()-1})},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),d=!B(b,c);d||a.getLine(b.line).length!=b.ch?a.replaceRange("",b,d?c:{line:b.line}):a.replaceRange("",b,{line:b.line+1,ch:0})},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",{line:b,ch:0},{line:b})},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.setCursor(0,
0,!0)},goDocEnd:function(a){a.setSelection({line:a.lineCount()-1},null,!0)},goLineStart:function(a){a.setCursor(a.getCursor().line,0,!0)},goLineStartSmart:function(a){var b=a.getCursor(),c=a.getLine(b.line),c=Math.max(0,c.search(/\S/));a.setCursor(b.line,b.ch<=c&&b.ch?0:c,!0)},goLineEnd:function(a){a.setSelection({line:a.getCursor().line},null,!0)},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")},goWordRight:function(a){a.moveH(1,"word")},delCharLeft:function(a){a.deleteH(-1,"char")},delCharRight:function(a){a.deleteH(1,"char")},delWordLeft:function(a){a.deleteH(-1,"word")},delWordRight:function(a){a.deleteH(1,"word")},indentAuto:function(a){a.indentSelection("smart")},
indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection("\t","end")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.replaceSelection("\t","end")},transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);0<b.ch&&b.ch<c.length-1&&a.replaceRange(c.charAt(b.ch)+c.charAt(b.ch-1),{line:b.line,ch:b.ch-1},{line:b.line,ch:b.ch+1})},newlineAndIndent:function(a){a.replaceSelection("\n",
"end");a.indentLine(a.getCursor().line)},toggleOverwrite:function(a){a.toggleOverwrite()}},sa=m.keyMap={};sa.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharRight",Backspace:"delCharLeft",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"};sa.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo",
"Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goWordLeft","Ctrl-Right":"goWordRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordLeft","Ctrl-Delete":"delWordRight","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",fallthrough:"basic"};sa.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":"goWordLeft","Alt-Right":"goWordRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordLeft","Ctrl-Alt-Backspace":"delWordRight","Alt-Delete":"delWordRight","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",fallthrough:["basic","emacsy"]};
sa["default"]=nb?sa.macDefault:sa.pcDefault;sa.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":"goPageUp","Shift-Ctrl-V":"goPageDown","Ctrl-D":"delCharRight","Ctrl-H":"delCharLeft","Alt-D":"delWordRight","Alt-Backspace":"delWordLeft","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};m.fromTextArea=function(a,b){function c(){a.value=f.getValue()}b||(b={});b.value=
a.value;!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex);if(null==b.autofocus){var d=document.body;try{d=document.activeElement}catch(r){}b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}if(a.form){var g=A(a.form,"submit",c,!0);if("function"==typeof a.form.submit){var n=a.form.submit;a.form.submit=function Tc(){c();a.form.submit=n;a.form.submit();a.form.submit=Tc}}}a.style.display="none";var f=m(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);f.save=c;f.getTextArea=
function(){return a};f.toTextArea=function(){c();a.parentNode.removeChild(f.getWrapperElement());a.style.display="";a.form&&(g(),"function"==typeof a.form.submit&&(a.form.submit=n))};return f};var bb=/gecko\/\d{7}/i.test(navigator.userAgent),Ga=/MSIE \d/.test(navigator.userAgent),jc=/MSIE [1-7]\b/.test(navigator.userAgent),gc=/MSIE [1-8]\b/.test(navigator.userAgent),$c=Ga&&5==document.documentMode,tb=/WebKit\//.test(navigator.userAgent),oc=/Chrome\//.test(navigator.userAgent),ya=/Opera\//.test(navigator.userAgent),
pc=/Apple Computer/.test(navigator.vendor),lc=/KHTML\//.test(navigator.userAgent),cd=/Mac OS X 10\D([7-9]|\d\d)\D/.test(navigator.userAgent);m.copyState=L;m.startState=ta;m.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);b=c.state;a=c.mode}return c||{mode:a,state:b}};Q.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},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(){return fb(this.string,
this.start,this.tabSize)},indentation:function(){return fb(this.string,null,this.tabSize)},match:function(a,b,c){if("string"==typeof a){var d=function(a){return c?a.toLowerCase():a};if(d(this.string).indexOf(d(a),this.pos)==this.pos)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)}};m.StringStream=Q;var hb=" ";bb||Ga&&!jc?hb="\u200b":
ya&&(hb="");E.prototype={update:function(a,b){this.text=a;this.stateAfter=this.styles=null;p(this);t(this,b)},highlight:function(a,b,c){c=new Q(this.text,c);var d=this.styles||(this.styles=[]),g=d.length=0;for(""==this.text&&a.blankLine&&a.blankLine(b);!c.eol();){var n=a.token(c,b),f=c.current();c.start=c.pos;g&&d[g-1]==n?d[g-2]+=f:f&&(d[g++]=f,d[g++]=n);if(5E3<c.pos){d[g++]=this.text.slice(c.pos);d[g++]=null;break}}},process:function(a,b,c){c=new Q(this.text,c);for(""==this.text&&a.blankLine&&a.blankLine(b);!c.eol()&&
5E3>=c.pos;)a.token(c,b),c.start=c.pos},getTokenAt:function(a,b,c,d){for(c=new Q(this.text,c);c.pos<d&&!c.eol();){c.start=c.pos;var g=a.token(c,b)}return{start:c.start,end:c.pos,string:c.current(),className:g||null,state:b}},indentation:function(a){return fb(this.text,null,a)},getContent:function(a,b,c){function d(b,c,d){if(c){n&&Ga&&" "==c.charAt(0)&&(c="\u00a0"+c.slice(1));n=!1;if(r.test(c))for(var g=document.createDocumentFragment(),p=0;;){r.lastIndex=p;var m=r.exec(c),t=m?m.index-p:c.length-p;
t&&(g.appendChild(document.createTextNode(c.slice(p,p+t))),f+=t);if(!m)break;p+=t+1;"\t"==m[0]?(m=a-f%a,g.appendChild(u("span",Hc(m),"cm-tab")),f+=m):(t=u("span","\u2022","cm-invalidchar"),t.title="\\u"+m[0].charCodeAt(0).toString(16),g.appendChild(t),f+=1)}else{f+=c.length;var g=document.createTextNode(c)}d?b.appendChild(u("span",[g],d)):b.appendChild(g)}}function g(a){return a?"cm-"+a.replace(/ +/g," cm-"):null}var n=!0,f=0,r=/[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g,p=u("pre"),m=d;if(null!=
b)var t=0,E=p.anchor=u("span"),m=function(a,f,g){var n=f.length;if(b>=t&&b<t+n){b>t&&(d(a,f.slice(0,b-t),g),c&&a.appendChild(u("wbr")));a.appendChild(E);var p=b-t;d(E,ya?f.slice(p,p+1):f.slice(p),g);ya&&d(a,f.slice(p+1),g);b--;t+=n}else t+=n,d(a,f,g),t==b&&t==D?(gb(E,hb),a.appendChild(E)):t>b+10&&/\s/.test(f)&&(m=function(){})};var A=this.styles,B=this.text,y=this.markedSpans,D=B.length;if(B||null!=b)if(y&&y.length){y.sort(function(a,b){return a.from-b.from});for(var C=0,B=0,X="",ga=y[0].from||0,
L=[],O=0,I=function(){for(var a;O<y.length&&((a=y[O]).from==C||null==a.from);)"range"==a.marker.type&&L.push(a),++O;ga=O<y.length?y[O].from:Infinity;for(a=0;a<L.length;++a){var b=L[a].to;null==b&&(b=Infinity);b==C?L.splice(a--,1):ga=Math.min(b,ga)}};C<D;){ga==C&&I();for(var K=Math.min(D,ga);;){if(X){for(var Z=C+X.length,P=aa,V=0;V<L.length;++V){var Q=L[V],P=(P?P+" ":"")+Q.marker.style;Q.marker.endStyle&&Q.to===Math.min(Z,K)&&(P+=" "+Q.marker.endStyle);Q.marker.startStyle&&Q.from===C&&(P+=" "+Q.marker.startStyle)}m(p,
Z>K?X.slice(0,K-C):X,P);if(Z>=K){X=X.slice(K-C);C=K;break}C=Z}X=A[B++];aa=g(A[B++])}}}else for(X=B=0;X<D;B+=2){var I=A[B],aa=A[B+1],K=I.length;X+K>D&&(I=I.slice(0,D-X));X+=K;m(p,I,g(aa))}else m(p," ");return p},cleanUp:function(){this.parent=null;p(this)}};X.prototype={chunkSize:function(){return this.lines.length},remove:function(a,b,c){for(var d=a,g=a+b;d<g;++d){var n=this.lines[d];this.height-=n.height;n.cleanUp();if(n.handlers)for(var f=0;f<n.handlers.length;++f)c.push(n.handlers[f])}this.lines.splice(a,
b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertHeight:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));a=0;for(c=b.length;a<c;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};Jb.prototype={chunkSize:function(){return this.size},remove:function(a,b,c){this.size-=b;for(var d=0;d<this.children.length;++d){var g=this.children[d],n=g.chunkSize();if(a<n){var f=Math.min(b,n-
a),p=g.height;g.remove(a,f,c);this.height-=p-g.height;n==f&&(this.children.splice(d--,1),g.parent=null);if(0==(b-=f))break;a=0}else a-=n}25>this.size-b&&(a=[],this.collapse(a),this.children=[new X(a)],this.children[0].parent=this)},collapse:function(a){for(var b=0,c=this.children.length;b<c;++b)this.children[b].collapse(a)},insert:function(a,b){for(var c=0,d=0,g=b.length;d<g;++d)c+=b[d].height;this.insertHeight(a,b,c)},insertHeight:function(a,b,c){this.size+=b.length;this.height+=c;for(var d=0,g=
this.children.length;d<g;++d){var n=this.children[d],f=n.chunkSize();if(a<=f){n.insertHeight(a,b,c);if(n.lines&&50<n.lines.length){for(;50<n.lines.length;)a=n.lines.splice(n.lines.length-25,25),a=new X(a),n.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 Jb(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=Nb(a.parent.children,a);
a.parent.children.splice(c+1,0,b)}else c=new Jb(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iter:function(a,b,c){this.iterN(a,b-a,c)},iterN:function(a,b,c){for(var d=0,g=this.children.length;d<g;++d){var n=this.children[d],f=n.chunkSize();if(a<f){f=Math.min(b,f-a);if(n.iterN(a,f,c))return!0;if(0==(b-=f))break;a=0}else a-=f}}};Mb.prototype={addChange:function(a,b,c){this.undone.length=0;var d=+new Date,g=aa(this.done),n=g&&aa(g),
f=d-this.time;if(this.compound&&g&&!this.closed)g.push({start:a,added:b,old:c});else if(400<f||!n||this.closed||n.start>a+c.length||n.start+n.added<a)this.done.push([{start:a,added:b,old:c}]),this.closed=!1;else{for(var g=Math.max(0,n.start-a),f=Math.max(0,a+c.length-(n.start+n.added)),p=g;0<p;--p)n.old.unshift(c[p-1]);for(p=f;0<p;--p)n.old.push(c[c.length-p]);g&&(n.start=a);n.added+=b-(c.length-g-f)}this.time=d},startCompound:function(){this.compound++||(this.closed=!0)},endCompound:function(){--this.compound||
(this.closed=!0)}};m.e_stop=ib;m.e_preventDefault=C;m.e_stopPropagation=eb;m.connect=A;mc.prototype={set:function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)}};var sc=m.Pass={toString:function(){return"CodeMirror.Pass"}},dd=function(){if(gc)return!1;var a=u("div");return"draggable"in a||"dragDrop"in a}();(function(){var a=u("textarea");a.value="foo\nbar";return-1<a.value.indexOf("\r")?"\r\n":"\n"})();var Hb=/^$/;bb?Hb=/$'/:pc?Hb=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:oc&&(Hb=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/);
var Ia=[""],jb=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var g=a.indexOf("\n",b);-1==g&&(g=a.length);var n=a.slice(b,"\r"==a.charAt(g-1)?g-1:g),f=n.indexOf("\r");-1!=f?(c.push(n.slice(0,f)),b+=f+1):(c.push(n),b=g+1)}return c}:function(a){return a.split(/\r\n?|\n/)};m.splitLines=jb;var Xc=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};m.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}});m.defineMIME("text/plain","null");var Fa={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:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",
189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};m.keyNames=Fa;(function(){for(var a=0;10>a;a++)Fa[a+48]=String(a);for(a=65;90>=a;a++)Fa[a]=String.fromCharCode(a);for(a=1;12>=a;a++)Fa[a+111]=Fa[a+63235]="F"+a})();m.version="2.34";return m}();
CodeMirror.runMode=function(m,P,I,xa){function L(p){return p.replace(/[<&]/,function(p){return"<"==p?"&lt;":"&amp;"})}P=CodeMirror.getMode(CodeMirror.defaults,P);var ta=1==I.nodeType,Q=xa&&xa.tabSize||CodeMirror.defaults.tabSize;if(ta){var O=I,Aa=[],D=0;I=function(p,r){if("\n"==p)Aa.push("<br>"),D=0;else{for(var m="",t=0;;){var y=p.indexOf("\t",t);if(-1==y){m+=L(p.slice(t));D+=p.length-t;break}else{D+=y-t;m+=L(p.slice(t,y));t=Q-D%Q;D+=t;for(var I=0;I<t;++I)m+=" ";t=y+1}}r?Aa.push('<span class="cm-'+
L(r)+'">'+m+"</span>"):Aa.push(m)}}}m=CodeMirror.splitLines(m);xa=CodeMirror.startState(P);for(var y=0,r=m.length;y<r;++y){y&&I("\n");for(var p=new CodeMirror.StringStream(m[y]);!p.eol();){var t=P.token(p,xa);I(p.current(),t,y,p.start);p.start=p.pos}}ta&&(O.innerHTML=Aa.join(""))};
CodeMirror.defineMode("mysql",function(m){function P(r,p){var m=r.next();O=null;if("$"==m||"?"==m)return r.match(/^[\w\d]*/),"variable-2";if("<"!=m||r.match(/^[\s\u00a0=]/,!1)){if('"'==m||"'"==m)return p.tokenize=I(m),p.tokenize(r,p);if("`"==m)return p.tokenize=xa(m),p.tokenize(r,p);if(/[{}\(\),\.;\[\]]/.test(m))return O=m,null;if("-"==m){if("-"==r.next())return r.skipToEnd(),"comment"}else{if(y.test(m))return r.eatWhile(y),null;if(":"==m)return r.eatWhile(/[\w\d\._\-]/),"atom";r.eatWhile(/[_\w\d]/);
if(r.eat(":"))return r.eatWhile(/[\w\d_\-]/),"atom";m=r.current();return Aa.test(m)?null:D.test(m)?"keyword":"variable"}}else return r.match(/^[^\s\u00a0>]*>?/),"atom"}function I(m){return function(p,t){for(var E=!1,y;null!=(y=p.next());){if(y==m&&!E){t.tokenize=P;break}E=!E&&"\\"==y}return"string"}}function xa(m){return function(p,t){for(var E=!1,y;null!=(y=p.next());){if(y==m&&!E){t.tokenize=P;break}E=!E&&"\\"==y}return"variable-2"}}function L(m,p,t){m.context={prev:m.context,indent:m.indent,col:t,
type:p}}function ta(m){m.indent=m.context.indent;m.context=m.context.prev}var Q=m.indentUnit,O,Aa=/^(?:str|lang|langmatches|datatype|bound|sameterm|isiri|isuri|isblank|isliteral|union|a)$/i,D=/^(?:ACCESSIBLE|ALTER|AS|BEFORE|BINARY|BY|CASE|CHARACTER|COLUMN|CONTINUE|CROSS|CURRENT_TIMESTAMP|DATABASE|DAY_MICROSECOND|DEC|DEFAULT|DESC|DISTINCT|DOUBLE|EACH|ENCLOSED|EXIT|FETCH|FLOAT8|FOREIGN|GRANT|HIGH_PRIORITY|HOUR_SECOND|IN|INNER|INSERT|INT2|INT8|INTO|JOIN|KILL|LEFT|LINEAR|LOCALTIME|LONG|LOOP|MATCH|MEDIUMTEXT|MINUTE_SECOND|NATURAL|NULL|OPTIMIZE|OR|OUTER|PRIMARY|RANGE|READ_WRITE|REGEXP|REPEAT|RESTRICT|RIGHT|SCHEMAS|SENSITIVE|SHOW|SPECIFIC|SQLSTATE|SQL_CALC_FOUND_ROWS|STARTING|TERMINATED|TINYINT|TRAILING|UNDO|UNLOCK|USAGE|UTC_DATE|VALUES|VARCHARACTER|WHERE|WRITE|ZEROFILL|ALL|AND|ASENSITIVE|BIGINT|BOTH|CASCADE|CHAR|COLLATE|CONSTRAINT|CREATE|CURRENT_TIME|CURSOR|DAY_HOUR|DAY_SECOND|DECLARE|DELETE|DETERMINISTIC|DIV|DUAL|ELSEIF|EXISTS|FALSE|FLOAT4|FORCE|FULLTEXT|HAVING|HOUR_MINUTE|IGNORE|INFILE|INSENSITIVE|INT1|INT4|INTERVAL|ITERATE|KEYS|LEAVE|LIMIT|LOAD|LOCK|LONGTEXT|MASTER_SSL_VERIFY_SERVER_CERT|MEDIUMINT|MINUTE_MICROSECOND|MODIFIES|NO_WRITE_TO_BINLOG|ON|OPTIONALLY|OUT|PRECISION|PURGE|READS|REFERENCES|RENAME|REQUIRE|REVOKE|SCHEMA|SELECT|SET|SPATIAL|SQLEXCEPTION|SQL_BIG_RESULT|SSL|TABLE|TINYBLOB|TO|TRUE|UNIQUE|UPDATE|USING|UTC_TIMESTAMP|VARCHAR|WHEN|WITH|YEAR_MONTH|ADD|ANALYZE|ASC|BETWEEN|BLOB|CALL|CHANGE|CHECK|CONDITION|CONVERT|CURRENT_DATE|CURRENT_USER|DATABASES|DAY_MINUTE|DECIMAL|DELAYED|DESCRIBE|DISTINCTROW|DROP|ELSE|ESCAPED|EXPLAIN|FLOAT|FOR|FROM|GROUP|HOUR_MICROSECOND|IF|INDEX|INOUT|INT|INT3|INTEGER|IS|KEY|LEADING|LIKE|LINES|LOCALTIMESTAMP|LONGBLOB|LOW_PRIORITY|MEDIUMBLOB|MIDDLEINT|MOD|NOT|NUMERIC|OPTION|ORDER|OUTFILE|PROCEDURE|READ|REAL|RELEASE|REPLACE|RETURN|RLIKE|SECOND_MICROSECOND|SEPARATOR|SMALLINT|SQL|SQLWARNING|SQL_SMALL_RESULT|STRAIGHT_JOIN|THEN|TINYTEXT|TRIGGER|UNION|UNSIGNED|USE|UTC_TIME|VARBINARY|VARYING|WHILE|XOR|FULL|COLUMNS|MIN|MAX|STDEV|COUNT)$/i,
y=/[*+\-<>=&|]/;return{startState:function(m){return{tokenize:P,context:null,indent:0,col:0}},token:function(m,p){m.sol()&&(p.context&&null==p.context.align&&(p.context.align=!1),p.indent=m.indentation());if(m.eatSpace())return null;var t=p.tokenize(m,p);"comment"!=t&&p.context&&null==p.context.align&&"pattern"!=p.context.type&&(p.context.align=!0);if("("==O)L(p,")",m.column());else if("["==O)L(p,"]",m.column());else if("{"==O)L(p,"}",m.column());else if(/[\]\}\)]/.test(O)){for(;p.context&&"pattern"==
p.context.type;)ta(p);p.context&&O==p.context.type&&ta(p)}else"."==O&&p.context&&"pattern"==p.context.type?ta(p):/atom|string|variable/.test(t)&&p.context&&(/[\}\]]/.test(p.context.type)?L(p,"pattern",m.column()):"pattern"!=p.context.type||p.context.align||(p.context.align=!0,p.context.col=m.column()));return t},indent:function(m,p){var t=p&&p.charAt(0),y=m.context;if(/[\]\}]/.test(t))for(;y&&"pattern"==y.type;)y=y.prev;t=y&&t==y.type;return y?"pattern"==y.type?y.col:y.align?y.col+(t?0:1):y.indent+
(t?0:Q):0}}});CodeMirror.defineMIME("text/x-mysql","mysql");CodeMirror.defineExtension("canHighlight",function(){return!0});CodeMirror.defineExtension("highlightSql",function(m,P,I){CodeMirror.runMode(I,"text/x-mysql",m.get(0))});CodeMirror.defineExtension("lastLine",function(){return this.lineCount()});CodeMirror.defineExtension("jumpToLine",function(m){this.setCursor(m,null)});
