﻿!function(ga,X){"object"==typeof exports&&"undefined"!=typeof module?module.exports=X():"function"==typeof define&&define.amd?define("codemirror.js",X):ga.CodeMirror=X()}(this,function(){function ga(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function X(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function Z(a,b){return X(a).appendChild(b)}function r(a,b,c,d){a=document.createElement(a);if(c&&(a.className=c),d&&(a.style.cssText=d),"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 Za(a,b,c,d){a=r(a,b,c,d);return a.setAttribute("role","presentation"),a}function va(a,b){if(3==b.nodeType&&(b=b.parentNode),a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)}function qa(){var a;try{a=document.activeElement}catch(b){a=document.body||null}for(;a&&a.shadowRoot&&a.shadowRoot.activeElement;)a=a.shadowRoot.activeElement;return a}function Ea(a,b){var c=a.className;ga(b).test(c)||
(a.className+=(c?" ":"")+b)}function Jc(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)c[d]&&!ga(c[d]).test(b)&&(b+=" "+c[d]);return b}function Kc(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Fa(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||!1===c&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function ea(a,b,c,d,e){null==b&&-1==(b=a.search(/[^\s\u00a0]/))&&(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}}function N(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function Lc(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);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}}function Mc(a){for(;dc.length<=a;)dc.push(z(dc)+" ");return dc[a]}function z(a){return a[a.length-1]}function ec(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function bg(a,b,c){for(var d=0,e=c(b);d<a.length&&
c(a[d])<=e;)d++;a.splice(d,0,b)}function Qd(){}function Rd(a,b){var c;return Object.create?c=Object.create(a):(Qd.prototype=a,c=new Qd),b&&Fa(b,c),c}function Nc(a){return/\w/.test(a)||""<a&&(a.toUpperCase()!=a.toLowerCase()||cg.test(a))}function fc(a,b){return b?!!(-1<b.source.indexOf("\\w")&&Nc(a))||b.test(a):Nc(a)}function Sd(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Oc(a){return 768<=a.charCodeAt(0)&&dg.test(a)}function Td(a,b,c){for(;(0>c?0<b:b<a.length)&&Oc(a.charAt(b));)b+=
c;return b}function gc(a,b,c){for(;;){if(1>=Math.abs(b-c))return a(b)?b:c;var d=Math.floor((b+c)/2);a(d)?c=d:b=d}}function eg(a,b,c){this.input=c;this.scrollbarFiller=r("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("cm-not-content","true");this.gutterFiller=r("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content","true");this.lineDiv=Za("div",null,"CodeMirror-code");this.selectionDiv=r("div",null,null,"position: relative; z-index: 1");
this.cursorDiv=r("div",null,"CodeMirror-cursors");this.measure=r("div",null,"CodeMirror-measure");this.lineMeasure=r("div",null,"CodeMirror-measure");this.lineSpace=Za("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");var d=Za("div",[this.lineSpace],"CodeMirror-lines");this.mover=r("div",[d],null,"position: relative");this.sizer=r("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=r("div",null,null,
"position: absolute; height: "+Ud+"px; width: 1px;");this.gutters=r("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=r("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=r("div",[this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");C&&8>B&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);R||wa&&rb||(this.scroller.draggable=!0);a&&(a.appendChild?a.appendChild(this.wrapper):
a(this.wrapper));this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=b.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine=this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged=
!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;c.init(this)}function w(a,b){if(0>(b-=a.first)||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 Ga(a,b,c){var d=[],e=b.line;return 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}),d}function Pc(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function la(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function D(a){if(null==a.parent)return null;var b=a.parent;a=N(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 Ha(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 sb(a,b){return b>=a.first&&b<a.first+a.size}function Qc(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function m(a,b,c){if(void 0===c&&(c=null),!(this instanceof m))return new m(a,b,c);this.line=a;this.ch=b;this.sticky=c}function x(a,b){return a.line-b.line||a.ch-b.ch}function Rc(a,b){return a.sticky==b.sticky&&0==x(a,b)}function Sc(a){return m(a.line,a.ch)}function hc(a,b){return 0>x(a,b)?b:a}
function ic(a,b){return 0>x(a,b)?a:b}function v(a,b){if(b.line<a.first)return m(a.first,0);var c=a.first+a.size-1;if(b.line>c)c=m(c,w(a,c).text.length);else var c=w(a,b.line).text.length,d=b.ch,c=null==d||d>c?m(b.line,c):0>d?m(b.line,0):b;return c}function Vd(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=v(a,b[d]);return c}function jc(a,b,c){this.marker=a;this.from=b;this.to=c}function tb(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Tc(a,b){if(b.full)return null;
var c=sb(a,b.from.line)&&w(a,b.from.line).markedSpans,d=sb(a,b.to.line)&&w(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),h;if(c)for(var k=0;k<c.length;++k){var l=c[k],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 q=null==l.to||(n.inclusiveRight?l.to>=e:l.to>e);(h||(h=[])).push(new jc(n,l.from,q?null:l.to))}}var c=h,p;if(d)for(h=0;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),(p||(p=[])).push(new jc(l,n?null:k.from-f,null==k.to?null:k.to-f));d=p;f=1==b.text.length;g=z(b.text).length+(f?e:0);if(c)for(p=0;p<c.length;++p)h=c[p],null==h.to&&((k=tb(d,h.marker))?f&&(h.to=null==k.to?null:k.to+g):h.to=e);if(d)for(e=0;e<d.length;++e)p=d[e],(null!=p.to&&(p.to+=g),null==p.from)?tb(c,p.marker)||(p.from=g,f&&(c||(c=[])).push(p)):(p.from+=
g,f&&(c||(c=[])).push(p));c&&(c=Wd(c));d&&d!=c&&(d=Wd(d));e=[c];if(!f){var u,f=b.text.length-2;if(0<f&&c)for(g=0;g<c.length;++g)null==c[g].to&&(u||(u=[])).push(new jc(c[g].marker,null,null));for(c=0;c<f;++c)e.push(u);e.push(d)}return e}function Wd(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 fg(a,b,c){var d=null;if(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!=N(d,c)||(d||(d=[])).push(c)}}),!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-3}}}return a}function Xd(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);
a.markedSpans=null}}function Yd(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Zd(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:x(c.to,d.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0)||b.id-a.id}function Ia(a,b){var c,d=xa&&a.markedSpans;if(d)for(var e=void 0,f=0;f<d.length;++f)e=d[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!c||0>Zd(c,
e.marker))&&(c=e.marker);return c}function $d(a,b,c,d,e){a=w(a,b);if(a=xa&&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&&(f.marker.inclusiveRight&&e.inclusiveLeft?0<=x(g.to,c):0<x(g.to,c))||0<=h&&(f.marker.inclusiveRight&&e.inclusiveLeft?0>=x(g.from,d):0>x(g.from,d))))return!0}}}function ma(a){for(var b;b=
Ia(a,!0);)a=b.find(-1,!0).line;return a}function Uc(a,b){var c=w(a,b),d=ma(c);return c==d?b:D(d)}function ae(a,b){if(b>a.lastLine())return b;var c,d=w(a,b);if(!Ja(a,d))return b;for(;c=Ia(d,!1);)d=c.find(1,!0).line;return D(d)+1}function Ja(a,b){var c=xa&&b.markedSpans;if(c)for(var d=void 0,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed)if(null==d.from||!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&Vc(a,b,d))return!0}function Vc(a,b,c){if(null==c.to)return b=c.marker.find(1,!0),Vc(a,b.line,
tb(b.line.markedSpans,c.marker));if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var d=void 0,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)&&Vc(a,b,d))return!0}function na(a){a=ma(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;b+=e.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length;++d){e=a.children[d];
if(e==c)break;b+=e.height}return b}function kc(a){if(0==a.height)return 0;for(var b,c=a.text.length,d=a;b=Ia(d,!0);)b=b.find(0,!0),d=b.from.line,c+=b.from.ch-b.to.ch;for(d=a;b=Ia(d,!1);)a=b.find(0,!0),c-=d.text.length-a.from.ch,d=a.to.line,c+=d.text.length-a.to.ch;return c}function Wc(a){var b=a.display;a=a.doc;b.maxLine=w(a,a.first);b.maxLineLength=kc(b.maxLine);b.maxLineChanged=!0;a.iter(function(a){var d=kc(a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function gg(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];(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 Xc(a,b,c){var d;ub=null;for(var e=0;e<a.length;++e){var f=a[e];if(f.from<b&&f.to>b)return e;f.to==b&&(f.from!=f.to&&"before"==c?d=e:ub=e);f.from==b&&(f.from!=f.to&&"before"!=c?d=e:ub=e)}return null!=d?d:ub}function ya(a,b){var c=a.order;return null==c&&(c=a.order=hg(a.text,b)),c}function Yc(a,b,c){b=Td(a.text,b+c,c);return 0>
b||b>a.text.length?null:b}function Zc(a,b,c){a=Yc(a,b.ch,c);return null==a?null:new m(b.line,a,0>c?"after":"before")}function $c(a,b,c,d,e){if(a&&(a=ya(c,b.doc.direction))){var f=0>e?z(a):a[0],g=0>e==(1==f.level)?"after":"before";if(0<f.level){var h=$a(b,c);a=0>e?c.text.length-1:0;var k=ra(b,h,a).top;a=gc(function(a){return ra(b,h,a).top==k},0>e==(1==f.level)?f.from:f.to-1,a);"before"==g&&(a=Yc(c,a,1))}else a=0>e?f.to:f.from;return new m(d,a,g)}return new m(d,0>e?c.text.length:0,0>e?"before":"after")}
function be(a,b,c,d){var e=ya(b,a.doc.direction);if(!e)return Zc(b,c,d);c.ch>=b.text.length?(c.ch=b.text.length,c.sticky="before"):0>=c.ch&&(c.ch=0,c.sticky="after");var f=Xc(e,c.ch,c.sticky),g=e[f];if("ltr"==a.doc.direction&&0==g.level%2&&(0<d?g.to>c.ch:g.from<c.ch))return Zc(b,c,d);var h,k=function(a,d){return Yc(b,a instanceof m?a.ch:a,d)},l=function(d){return a.options.lineWrapping?(h=h||$a(a,b),ce(a,b,h,Ka(a,b,ra(a,h,d),"line").top)):{begin:0,end:b.text.length}},n=l("before"==c.sticky?k(c,-1):
c.ch);if("rtl"==a.doc.direction||1==g.level){var q=1==g.level==0>d,p=k(c,q?1:-1);if(null!=p&&(q?p<=g.to&&p<=n.end:p>=g.from&&p>=n.begin))return new m(c.line,p,q?"before":"after")}g=function(a,b,d){for(;0<=a&&a<e.length;a+=b){var f=e[a],g=0<b==(1!=f.level),h=g?d.begin:k(d.end,-1);if(f.from<=h&&h<f.to||(h=g?f.from:k(f.to,-1),d.begin<=h&&h<d.end))return a=h,g?new m(c.line,k(a,1),"before"):new m(c.line,a,"after")}};if(f=g(f+d,d,n))return f;n=0<d?n.end:k(n.begin,-1);return null==n||0<d&&n==b.text.length||
!(f=g(0<d?0:e.length-1,d,l(n)))?null:f}function aa(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=(a=a._handlers)&&a[b];d&&(c=N(d,c),-1<c&&(a[b]=d.slice(0,c).concat(d.slice(c+1))))}}function F(a,b){var c=a._handlers&&a._handlers[b]||lc;if(c.length)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function K(a,b,c){return"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=
!0}}),F(a,c||b.type,a,b),ad(b)||b.codemirrorIgnore}function de(a){var b=a._handlers&&a._handlers.cursorActivity;if(b){a=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var c=0;c<b.length;++c)-1==N(a,b[c])&&a.push(b[c])}}function fa(a,b){return 0<(a._handlers&&a._handlers[b]||lc).length}function ab(a){a.prototype.on=function(a,c){t(this,a,c)};a.prototype.off=function(a,c){aa(this,a,c)}}function S(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function ee(a){a.stopPropagation?
a.stopPropagation():a.cancelBubble=!0}function ad(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function vb(a){S(a);ee(a)}function fe(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),ha&&a.ctrlKey&&1==b&&(b=3),b}function ig(a){if(null==bd){var b=r("span","​");Z(a,r("span",[b,document.createTextNode("x")]));0!=a.firstChild.offsetHeight&&(bd=1>=b.offsetWidth&&2<b.offsetHeight&&!(C&&8>B))}a=bd?r("span","​"):r("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");
return a.setAttribute("cm-text",""),a}function jg(a,b){2<arguments.length&&(b.dependencies=Array.prototype.slice.call(arguments,2));cd[a]=b}function mc(a){if("string"==typeof a&&bb.hasOwnProperty(a))a=bb[a];else if(a&&"string"==typeof a.name&&bb.hasOwnProperty(a.name)){var b=bb[a.name];"string"==typeof b&&(b={name:b});a=Rd(b,a);a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return mc("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return mc("application/json")}return"string"==
typeof a?{name:a}:a||{name:"null"}}function dd(a,b){b=mc(b);var c=cd[b.name];if(!c)return dd(a,"text/plain");c=c(a,b);if(cb.hasOwnProperty(b.name)){var d=cb[b.name],e;for(e in d)d.hasOwnProperty(e)&&(c.hasOwnProperty(e)&&(c["_"+e]=c[e]),c[e]=d[e])}if(c.name=b.name,b.helperType&&(c.helperType=b.helperType),b.modeProps)for(var f in b.modeProps)c[f]=b.modeProps[f];return c}function kg(a,b){Fa(b,cb.hasOwnProperty(a)?cb[a]:cb[a]={})}function La(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}function ed(a,b){for(var c;a.innerMode&&(c=a.innerMode(b))&&c.mode!=a;)b=c.state,a=c.mode;return c||{mode:a,state:b}}function ge(a,b,c){return!a.startState||a.startState(b,c)}function he(a,b,c,d){var e=[a.state.modeGen],f={};ie(a,b.text,a.doc.mode,c,function(a,b){return e.push(a,b)},f,d);d=c.state;for(var g=0;g<a.state.overlays.length;++g)!function(d){var g=a.state.overlays[d],l=1,n=0;c.state=!0;ie(a,b.text,g.mode,
c,function(a,b){for(var d=l;n<a;){var c=e[l];c>a&&e.splice(l,1,a,e[l+1],c);l+=2;n=Math.min(a,c)}if(b)if(g.opaque)e.splice(d,l-d,a,"overlay "+b),l=d+2;else for(;d<l;d+=2)c=e[d+1],e[d+1]=(c?c+" ":"")+"overlay "+b},f)}(g);return c.state=d,{styles:e,classes:f.bgClass||f.textClass?f:null}}function je(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=wb(a,D(b)),e=b.text.length>a.options.maxHighlightLength&&La(a.doc.mode,d.state),f=he(a,b,d);e&&(d.state=e);b.stateAfter=d.save(!e);b.styles=f.styles;
f.classes?b.styleClasses=f.classes:b.styleClasses&&(b.styleClasses=null);c===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function wb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return new sa(d,!0,b);var f=lg(a,b,c),g=f>d.first&&w(d,f-1).stateAfter,h=g?sa.fromSaved(d,g,f):new sa(d,ge(d.mode),f);return d.iter(f,b,function(d){fd(a,d.text,h);var c=h.line;d.stateAfter=c==b-1||0==c%5||c>=e.viewFrom&&c<e.viewTo?h.save():null;
h.nextLine()}),c&&(d.modeFrontier=h.line),h}function fd(a,b,c,d){var e=a.doc.mode;a=new H(b,a.options.tabSize,c);a.start=a.pos=d||0;for(""==b&&ke(e,c.state);!a.eol();)gd(e,a,c.state),a.start=a.pos}function ke(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode){var c=ed(a,b);return c.mode.blankLine?c.mode.blankLine(c.state):void 0}}function gd(a,b,c,d){for(var e=0;10>e;e++){d&&(d[0]=ed(a,c).mode);var f=a.token(b,c);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream.");
}function le(a,b,c,d){var e,f=a.doc,g=f.mode;b=v(f,b);var h,k=w(f,b.line);c=wb(a,b.line,c);a=new H(k.text,a.options.tabSize,c);for(d&&(h=[]);(d||a.pos<b.ch)&&!a.eol();)a.start=a.pos,e=gd(g,a,c.state),d&&h.push(new me(a,e,La(f.mode,c.state)));return d?h:new me(a,e,c.state)}function ne(a,b){if(a)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]:(new RegExp("(?:^|s)"+c[2]+"(?:$|s)")).test(b[d])||
(b[d]+=" "+c[2])}return a}function ie(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var k,l=0,n=null,q=new H(b,a.options.tabSize,d),p=a.options.addModeClass&&[null];for(""==b&&ne(ke(c,d.state),f);!q.eol();){if(q.pos>a.options.maxHighlightLength?(h=!1,g&&fd(a,b,d,q.pos),q.pos=b.length,k=null):k=ne(gd(c,q,d.state,p),f),p){var u=p[0].name;u&&(k="m-"+(k?u+" "+k:u))}if(!h||n!=k){for(;l<q.start;)l=Math.min(q.start,l+5E3),e(l,n);n=k}q.start=q.pos}for(;l<q.pos;)a=Math.min(q.pos,
l+5E3),e(a,n),l=a}function lg(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=w(f,b-1),k=h.stateAfter;if(k&&(!c||b+(k instanceof nc?k.lookAhead:0)<=f.modeFrontier))return b;h=ea(h.text,null,a.options.tabSize);(null==e||d>h)&&(e=b-1,d=h)}return e}function mg(a,b){if(a.modeFrontier=Math.min(a.modeFrontier,b),!(a.highlightFrontier<b-10)){for(var c=a.first,d=b-1;d>c;d--){var e=w(a,d).stateAfter;if(e&&(!(e instanceof nc)||d+e.lookAhead<b)){c=
d+1;break}}a.highlightFrontier=Math.min(a.highlightFrontier,c)}}function oe(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?ng:og;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$\x26"))}function pe(a,b){var c=Za("span",null,null,R?"padding-right: .1px":null),c={pre:Za("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:(C||R)&&a.getOption("lineWrapping")};b.measure={};for(var d=0;d<=(b.rest?b.rest.length:0);d++){var e=d?b.rest[d-1]:b.line,f=void 0;c.pos=0;c.addToken=
pg;var g;g=a.display.measure;if(null!=hd)g=hd;else{var h=Z(g,document.createTextNode("AخA")),k=db(h,0,1).getBoundingClientRect(),h=db(h,1,2).getBoundingClientRect();g=(X(g),!(!k||k.left==k.right)&&(hd=3>h.right-k.right))}g&&(f=ya(e,a.doc.direction))&&(c.addToken=qg(c.addToken,f));c.map=[];a:{f=c;g=je(a,e,b!=a.display.externalMeasured&&D(e));var l=e.markedSpans,k=e.text,h=0;if(l)for(var n=void 0,q=void 0,p=void 0,u=void 0,O=void 0,m=void 0,J=void 0,w=k.length,G=0,r=1,t="",x=0;;){if(x==G){for(var p=
u=O=m=q="",J=null,x=1/0,v=[],z=void 0,A=0;A<l.length;++A){var y=l[A],B=y.marker;"bookmark"==B.type&&y.from==G&&B.widgetNode?v.push(B):y.from<=G&&(null==y.to||y.to>G||B.collapsed&&y.to==G&&y.from==G)?(null!=y.to&&y.to!=G&&x>y.to&&(x=y.to,u=""),B.className&&(p+=" "+B.className),B.css&&(q=(q?q+";":"")+B.css),B.startStyle&&y.from==G&&(O+=" "+B.startStyle),B.endStyle&&y.to==x&&(z||(z=[])).push(B.endStyle,y.to),B.title&&!m&&(m=B.title),B.collapsed&&(!J||0>Zd(J.marker,B))&&(J=y)):y.from>G&&x>y.from&&(x=
y.from)}if(z)for(A=0;A<z.length;A+=2)z[A+1]==x&&(u+=" "+z[A]);if(!J||J.from==G)for(z=0;z<v.length;++z)qe(f,0,v[z]);if(J&&(J.from||0)==G){if(qe(f,(null==J.to?w+1:J.to)-G,J.marker,null==J.from),null==J.to)break a;J.to==G&&(J=!1)}}if(G>=w)break;for(v=Math.min(w,x);;){if(t){z=G+t.length;J||(A=z>v?t.slice(0,v-G):t,f.addToken(f,A,n?n+p:p,O,G+A.length==x?u:"",m,q));if(z>=v){t=t.slice(v-G);G=v;break}G=z;O=""}t=k.slice(h,h=g[r++]);n=oe(g[r++],f.cm.options)}}else for(l=1;l<g.length;l+=2)f.addToken(f,k.slice(h,
h=g[l]),oe(g[l+1],f.cm.options))}e.styleClasses&&(e.styleClasses.bgClass&&(c.bgClass=Jc(e.styleClasses.bgClass,c.bgClass||"")),e.styleClasses.textClass&&(c.textClass=Jc(e.styleClasses.textClass,c.textClass||"")));0==c.map.length&&c.map.push(0,0,c.content.appendChild(ig(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({}))}R&&(d=c.content.lastChild,(/\bcm-tab\b/.test(d.className)||d.querySelector&&
d.querySelector(".cm-tab"))&&(c.content.className="cm-tab-wrap-hack"));return F(a,"renderLine",a,b.line,c.pre),c.pre.className&&(c.textClass=Jc(c.pre.className,c.textClass||"")),c}function rg(a){var b=r("span","•","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b.setAttribute("aria-label",b.title),b}function pg(a,b,c,d,e,f,g){if(b){var h;if(a.splitSpaces)if(h=a.trailingSpace,1<b.length&&!/  /.test(b))h=b;else{for(var k="",l=0;l<b.length;l++){var n=b.charAt(l);" "!=n||!h||l!=b.length-
1&&32!=b.charCodeAt(l+1)||(n=" ");k+=n;h=" "==n}h=k}else h=b;k=h;l=a.cm.state.specialChars;n=!1;if(l.test(b)){h=document.createDocumentFragment();for(var q=0;;){l.lastIndex=q;var p=l.exec(b),u=p?p.index-q:b.length-q;if(u){var O=document.createTextNode(k.slice(q,q+u));C&&9>B?h.appendChild(r("span",[O])):h.appendChild(O);a.map.push(a.pos,a.pos+u,O);a.col+=u;a.pos+=u}if(!p)break;q+=u+1;u=void 0;"\t"==p[0]?(p=a.cm.options.tabSize,p-=a.col%p,u=h.appendChild(r("span",Mc(p),"cm-tab")),u.setAttribute("role",
"presentation"),u.setAttribute("cm-text","\t"),a.col+=p):"\r"==p[0]||"\n"==p[0]?(u=h.appendChild(r("span","\r"==p[0]?"␍":"␤","cm-invalidchar")),u.setAttribute("cm-text",p[0]),a.col+=1):(u=a.cm.options.specialCharPlaceholder(p[0]),u.setAttribute("cm-text",p[0]),C&&9>B?h.appendChild(r("span",[u])):h.appendChild(u),a.col+=1);a.map.push(a.pos,a.pos+1,u);a.pos++}}else a.col+=b.length,h=document.createTextNode(k),a.map.push(a.pos,a.pos+b.length,h),C&&9>B&&(n=!0),a.pos+=b.length;if(a.trailingSpace=32==k.charCodeAt(b.length-
1),c||d||e||n||g)return b=c||"",d&&(b+=d),e&&(b+=e),d=r("span",[h],b,g),f&&(d.title=f),a.content.appendChild(d);a.content.appendChild(h)}}function qg(a,b){return function(c,d,e,f,g,h,k){e=e?e+" cm-force-border":"cm-force-border";for(var l=c.pos,n=l+d.length;;){for(var q=void 0,p=0;p<b.length&&(q=b[p],!(q.to>l&&q.from<=l));p++);if(q.to>=n)return a(c,d,e,f,g,h,k);a(c,d.slice(0,q.to-l),e,f,null,h,k);f=null;d=d.slice(q.to-l);l=q.to}}}function qe(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+
b,e);!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function re(a,b,c){for(var d=this.line=b,e;d=Ia(d,!1);)d=d.find(1,!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?D(z(this.rest))-c+1:1;this.node=this.text=null;this.hidden=Ja(a,b)}function oc(a,b,c){var d,e=[];for(d=b;d<c;)b=new re(a.doc,w(a.doc,d),d),d+=
b.size,e.push(b);return e}function sg(a,b){var c=a.ownsGroup;if(c)try{var d=c.delayedCallbacks,e=0;do{for(;e<d.length;e++)d[e].call(null);for(var f=0;f<c.ops.length;f++){var g=c.ops[f];if(g.cursorActivityHandlers)for(;g.cursorActivityCalled<g.cursorActivityHandlers.length;)g.cursorActivityHandlers[g.cursorActivityCalled++].call(null,g.cm)}}while(e<d.length)}finally{eb=null,b(c)}}function P(a,b){var c=a._handlers&&a._handlers[b]||lc;if(c.length){var d,e=Array.prototype.slice.call(arguments,2);eb?d=
eb.delayedCallbacks:xb?d=xb:(d=xb=[],setTimeout(tg,0));for(var f=0;f<c.length;++f)!function(a){d.push(function(){return c[a].apply(null,e)})}(f)}}function tg(){var a=xb;xb=null;for(var b=0;b<a.length;++b)a[b]()}function se(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];if("text"==f){var f=a,g=b,h=g.text.className,k=te(f,g);g.text==g.node&&(g.node=k.pre);g.text.parentNode.replaceChild(k.pre,g.text);g.text=k.pre;k.bgClass!=g.bgClass||k.textClass!=g.textClass?(g.bgClass=k.bgClass,g.textClass=
k.textClass,id(f,g)):h&&(g.text.className=h)}else if("gutter"==f)ue(a,b,c,d);else if("class"==f)id(a,b);else if("widget"==f){f=a;g=b;h=d;g.alignable&&(g.alignable=null);for(var k=g.node.firstChild,l=void 0;k;k=l)l=k.nextSibling,"CodeMirror-linewidget"==k.className&&g.node.removeChild(k);ve(f,g,h)}}b.changes=null}function yb(a){return a.node==a.text&&(a.node=r("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),C&&8>B&&(a.node.style.zIndex=
2)),a.node}function te(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):pe(a,b)}function id(a,b){var c=b.bgClass?b.bgClass+" "+(b.line.bgClass||""):b.line.bgClass;if(c&&(c+=" CodeMirror-linebackground"),b.background)c?b.background.className=c:(b.background.parentNode.removeChild(b.background),b.background=null);else if(c){var d=yb(b);b.background=d.insertBefore(r("div",null,c),d.firstChild);a.display.input.setUneditable(b.background)}b.line.wrapClass?
yb(b).className=b.line.wrapClass:b.node!=b.text&&(b.node.className="");b.text.className=(b.textClass?b.textClass+" "+(b.line.textClass||""):b.line.textClass)||""}function ue(a,b,c,d){if(b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null),b.gutterBackground&&(b.node.removeChild(b.gutterBackground),b.gutterBackground=null),b.line.gutterClass){var e=yb(b);b.gutterBackground=r("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,"left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+
"px; width: "+d.gutterTotalWidth+"px");a.display.input.setUneditable(b.gutterBackground);e.insertBefore(b.gutterBackground,b.text)}e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=yb(b),g=b.gutter=r("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px");if(a.display.input.setUneditable(g),f.insertBefore(g,b.text),b.line.gutterClass&&(g.className+=" "+b.line.gutterClass),!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=
g.appendChild(r("div",Qc(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))),e)for(b=0;b<a.options.gutters.length;++b)c=a.options.gutters[b],(f=e.hasOwnProperty(c)&&e[c])&&g.appendChild(r("div",[f],"CodeMirror-gutter-elt","left: "+d.gutterLeft[c]+"px; width: "+d.gutterWidth[c]+"px"))}}function ug(a,b,c,d){var e=te(a,b);return b.text=b.node=e.pre,e.bgClass&&(b.bgClass=e.bgClass),e.textClass&&(b.textClass=
e.textClass),id(a,b),ue(a,b,c,d),ve(a,b,d),b.node}function ve(a,b,c){if(we(a,b.line,b,c,!0),b.rest)for(var d=0;d<b.rest.length;d++)we(a,b.rest[d],b,c,!1)}function we(a,b,c,d,e){if(b.widgets){var f=yb(c),g=0;for(b=b.widgets;g<b.length;++g){var h=b[g],k=r("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||k.setAttribute("cm-ignore-events","true");var l=h,n=k,q=d;if(l.noHScroll){(c.alignable||(c.alignable=[])).push(n);var p=q.wrapperWidth;n.style.left=q.fixedPos+"px";l.coverGutter||(p-=q.gutterTotalWidth,
n.style.paddingLeft=q.gutterTotalWidth+"px");n.style.width=p+"px"}l.coverGutter&&(n.style.zIndex=5,n.style.position="relative",l.noHScroll||(n.style.marginLeft=-q.gutterTotalWidth+"px"));a.display.input.setUneditable(k);e&&h.above?f.insertBefore(k,c.gutter||c.text):f.appendChild(k);P(h,"redraw")}}}function zb(a){if(null!=a.height)return a.height;var b=a.doc.cm;if(!b)return 0;if(!va(document.body,a.node)){var c="position: relative;";a.coverGutter&&(c+="margin-left: -"+b.display.gutters.offsetWidth+
"px;");a.noHScroll&&(c+="width: "+b.display.wrapper.clientWidth+"px;");Z(b.display.measure,r("div",[a.node],null,c))}return a.height=a.node.parentNode.offsetHeight}function ta(a,b){for(var c=b.target||b.srcElement;c!=a.wrapper;c=c.parentNode)if(!c||1==c.nodeType&&"true"==c.getAttribute("cm-ignore-events")||c.parentNode==a.sizer&&c!=a.mover)return!0}function jd(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function xe(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=Z(a.measure,r("pre",
"x")),b=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,b={left:parseInt(b.paddingLeft),right:parseInt(b.paddingRight)};return isNaN(b.left)||isNaN(b.right)||(a.cachedPaddingH=b),b}function oa(a){return Ud-a.display.nativeBarWidth}function Ma(a){return a.display.scroller.clientWidth-oa(a)-a.display.barWidth}function kd(a){return a.display.scroller.clientHeight-oa(a)-a.display.barHeight}function ye(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<
a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(b=0;b<a.rest.length;b++)if(D(a.rest[b])>c)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}function ld(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[Na(a,b)];var c=a.display.externalMeasured;return c&&b>=c.lineN&&b<c.lineN+c.size?c:void 0}function $a(a,b){var c=D(b),d=ld(a,c);d&&!d.text?d=null:d&&d.changes&&(se(a,d,c,md(a)),a.curOp.forceUpdate=!0);if(!d){var e;e=
ma(b);d=D(e);e=a.display.externalMeasured=new re(a.doc,e,d);e.lineN=d;d=e.built=pe(a,e);d=(e.text=d.pre,Z(a.display.lineMeasure,d.pre),e)}c=ye(d,b,c);return{line:b,view:d,rect:null,map:c.map,cache:c.cache,before:c.before,hasHeights:!1}}function ra(a,b,c,d,e){b.before&&(c=-1);var f=c+(d||"");if(b.cache.hasOwnProperty(f))a=b.cache[f];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&&Ma(a);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],q=g[k+1];2<Math.abs(l.bottom-q.bottom)&&n.push((l.bottom+q.top)/2-h.top)}n.push(h.bottom-h.top)}b.hasHeights=!0}var n=d,p,g=ze(b.map,c,n);d=g.node;h=g.start;k=g.end;c=g.collapse;if(3==d.nodeType){for(var u=0;4>u;u++){for(;h&&Oc(b.line.text.charAt(g.coverStart+h));)--h;for(;g.coverStart+k<g.coverEnd&&Oc(b.line.text.charAt(g.coverStart+k));)++k;if(C&&9>B&&0==h&&k==g.coverEnd-
g.coverStart)k=d.parentNode.getBoundingClientRect();else{k=db(d,h,k).getClientRects();l=Ae;if("left"==n)for(q=0;q<k.length&&(l=k[q]).left==l.right;q++);else for(q=k.length-1;0<=q&&(l=k[q]).left==l.right;q--);k=l}if(p=k,p.left||p.right||0==h)break;k=h;--h;c="right"}C&&11>B&&((u=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=nd?u=nd:(n=Z(a.display.measure,r("span","x")),u=n.getBoundingClientRect(),n=db(n,0,1).getBoundingClientRect(),u=nd=1<Math.abs(u.left-n.left)),
u=!u),u||(u=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI,p={left:p.left*u,right:p.right*u,top:p.top*n,bottom:p.bottom*n}))}else 0<h&&(c=n="right"),p=a.options.lineWrapping&&1<(u=d.getClientRects()).length?u["right"==n?u.length-1:0]:d.getBoundingClientRect();!(C&&9>B)||h||p&&(p.left||p.right)||(p=(p=d.parentNode.getClientRects()[0])?{left:p.left,right:p.left+Ab(a.display),top:p.top,bottom:p.bottom}:Ae);d=p.top-b.rect.top;h=p.bottom-b.rect.top;u=(d+h)/2;n=b.view.measure.heights;
for(g=0;g<n.length-1&&!(u<n[g]);g++);c={left:("right"==c?p.right:p.left)-b.rect.left,right:("left"==c?p.left:p.right)-b.rect.left,top:g?n[g-1]:0,bottom:n[g]};a=(p.left||p.right||(c.bogus=!0),a.options.singleCursorHeightPerLine||(c.rtop=d,c.rbottom=h),c);a.bogus||(b.cache[f]=a)}return{left:a.left,right:a.right,top:e?a.rtop:a.top,bottom:e?a.rbottom:a.bottom}}function ze(a,b,c){for(var d,e,f,g,h,k,l=0;l<a.length;l+=3)if(h=a[l],k=a[l+1],b<h?(e=0,f=1,g="left"):b<k?(e=b-h,f=e+1):(l==a.length-3||b==k&&a[l+
3]>b)&&(f=k-h,e=f-1,b>=k&&(g="right")),null!=e){if(d=a[l+2],h==k&&c==(d.insertLeft?"left":"right")&&(g=c),"left"==c&&0==e)for(;l&&a[l-2]==a[l-3]&&a[l-1].insertLeft;)d=a[2+(l-=3)],g="left";if("right"==c&&e==k-h)for(;l<a.length-3&&a[l+3]==a[l+4]&&!a[l+5].insertLeft;)d=a[(l+=3)+2],g="right";break}return{node:d,start:e,end:f,collapse:g,coverStart:h,coverEnd:k}}function Be(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 Ce(a){a.display.externalMeasure=
null;X(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)Be(a.display.view[b])}function Bb(a){Ce(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function De(){return pc&&qc?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Ee(){return pc&&
qc?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Ka(a,b,c,d,e){if(!e&&b.widgets)for(e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=zb(b.widgets[e]);c.top+=f;c.bottom+=f}if("line"==d)return c;d||(d="local");b=na(b);if("local"==d?b+=a.display.lineSpace.offsetTop:b-=a.display.viewOffset,"page"==d||"window"==d)a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+
("window"==d?0:Ee()),d=a.left+("window"==d?0:De()),c.left+=d,c.right+=d;return c.top+=b,c.bottom+=b,c}function Fe(a,b,c){if("div"==c)return b;var d=b.left;b=b.top;"page"==c?(d-=De(),b-=Ee()):"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 rc(a,b,c,d,e){d||(d=w(a.doc,b.line));var f=d;b=b.ch;d=ra(a,$a(a,d),b,e);return Ka(a,f,d,c)}function ia(a,b,c,d,e,f){function g(b,g){var h=ra(a,
e,b,g?"right":"left",f);return g?h.left=h.right:h.right=h.left,Ka(a,d,h,c)}function h(a,b,d){return g(d?a-1:a,0!=k[b].level%2!=d)}d=d||w(a.doc,b.line);e||(e=$a(a,d));var k=ya(d,a.doc.direction),l=b.ch;b=b.sticky;if(l>=d.text.length?(l=d.text.length,b="before"):0>=l&&(l=0,b="after"),!k)return g("before"==b?l-1:l,"before"==b);var n=Xc(k,l,b),q=ub,n=h(l,n,"before"==b);return null!=q&&(n.other=h(l,q,"before"!=b)),n}function Ge(a,b){var c=0;b=v(a.doc,b);a.options.lineWrapping||(c=Ab(a.display)*b.ch);var d=
w(a.doc,b.line),e=na(d)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:e,bottom:e+d.height}}function od(a,b,c){var d=a.doc;if(0>(c+=a.display.viewOffset))return a=m(d.first,0,null),a.xRel=-1,a.outside=!0,a;var e=Ha(d,c),f=d.first+d.size-1;if(e>f)return a=w(d,f).text.length,a=m(d.first+d.size-1,a,null),a.xRel=1,a.outside=!0,a;0>b&&(b=0);for(f=w(d,e);;){d=vg(a,f,e,b,c);f=(e=Ia(f,!1))&&e.find(0,!0);if(!e||!(d.ch>f.from.ch||d.ch==f.from.ch&&0<d.xRel))return d;e=D(f=f.to.line)}}function ce(a,
b,c,d){var e=b.text.length,f=gc(function(e){return Ka(a,b,ra(a,c,e-1),"line").bottom<=d},e,0);return e=gc(function(e){return Ka(a,b,ra(a,c,e),"line").top>d},f,e),{begin:f,end:e}}function vg(a,b,c,d,e){e-=na(b);var f=0,g=b.text.length,h=$a(a,b);if(ya(b,a.doc.direction)){if(a.options.lineWrapping){var k;k=ce(a,b,h,e);f=k.begin;g=k.end}c=new m(c,Math.floor(f+(g-f)/2));var l;k=ia(a,c,"line",b,h).left;var n=k<d?1:-1,q=k-d,p=Math.ceil((g-f)/4);a:do{k=q;l=c;for(var u=0;u<p;++u){var O=c;if(null==(c=be(a,
b,c,n))||c.ch<f||g<=("before"==c.sticky?c.ch-1:c.ch)){c=O;break a}}if(q=ia(a,c,"line",b,h).left-d,1<p)n=Math.abs(q-k)/p,p=Math.min(p,Math.ceil(Math.abs(q)/n)),n=0>q?1:-1}while(0!=q&&(1<p||0>n!=0>q&&Math.abs(q)<=Math.abs(k)));if(Math.abs(q)>Math.abs(k)){if(0>q==0>k)throw Error("Broke out of infinite loop in coordsCharInner");c=l}}else f=gc(function(c){var f=Ka(a,b,ra(a,h,c),"line");return f.top>e?(g=Math.min(c,g),!0):!(f.bottom<=e)&&(f.left>d||!(f.right<d)&&d-f.left<f.right-d)},f,g),f=Td(b.text,f,
1),c=new m(c,f,f==g?"before":"after");f=ia(a,c,"line",b,h);return(e<f.top||f.bottom<e)&&(c.outside=!0),c.xRel=d<f.left?-1:d>f.right?1:0,c}function Oa(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Pa){Pa=r("pre");for(var b=0;49>b;++b)Pa.appendChild(document.createTextNode("x")),Pa.appendChild(r("br"));Pa.appendChild(document.createTextNode("x"))}Z(a.measure,Pa);b=Pa.offsetHeight/50;return 3<b&&(a.cachedTextHeight=b),X(a.measure),b||1}function Ab(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;
var b=r("span","xxxxxxxxxx"),c=r("pre",[b]);Z(a.measure,c);b=b.getBoundingClientRect();b=(b.right-b.left)/10;return 2<b&&(a.cachedCharWidth=b),b||10}function md(a){for(var b=a.display,c={},d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g)c[a.options.gutters[g]]=f.offsetLeft+f.clientLeft+e,d[a.options.gutters[g]]=f.clientWidth;return{fixedPos:pd(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function pd(a){return a.scroller.getBoundingClientRect().left-
a.sizer.getBoundingClientRect().left}function He(a){var b=Oa(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/Ab(a.display)-3);return function(e){if(Ja(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function qd(a){var b=a.doc,c=He(a);b.iter(function(a){var b=c(a);b!=a.height&&la(a,b)})}function Qa(a,b,c,d){var e=a.display;if(!c&&"true"==(b.target||
b.srcElement).getAttribute("cm-not-content"))return null;var f,g;c=e.lineSpace.getBoundingClientRect();try{f=b.clientX-c.left,g=b.clientY-c.top}catch(h){return null}var k;b=od(a,f,g);d&&1==b.xRel&&(k=w(a.doc,b.line).text).length==b.ch&&(d=ea(k,k.length,a.options.tabSize)-k.length,b=m(b.line,Math.max(0,Math.round((f-xe(a.display).left)/Ab(a.display))-d)));return b}function Na(a,b){if(b>=a.display.viewTo||0>(b-=a.display.viewFrom))return null;for(var c=a.display.view,d=0;d<c.length;d++)if(0>(b-=c[d].size))return d}
function Cb(a){a.display.input.showSelection(a.display.input.prepareSelection())}function Ie(a,b){for(var c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g<c.sel.ranges.length;g++)if(!1!==b||g!=c.sel.primIndex){var h=c.sel.ranges[g];if(!(h.from().line>=a.display.viewTo||h.to().line<a.display.viewFrom)){var k=h.empty();(k||a.options.showCursorWhenSelecting)&&Je(a,h.head,e);k||wg(a,h,f)}}return d}function Je(a,b,c){b=ia(a,b,"div",null,null,
!a.options.singleCursorHeightPerLine);var d=c.appendChild(r("div"," ","CodeMirror-cursor"));if(d.style.left=b.left+"px",d.style.top=b.top+"px",d.style.height=Math.max(0,b.bottom-b.top)*a.options.cursorHeight+"px",b.other)a=c.appendChild(r("div"," ","CodeMirror-cursor CodeMirror-secondarycursor")),a.style.display="",a.style.left=b.other.left+"px",a.style.top=b.other.top+"px",a.style.height=.85*(b.other.bottom-b.other.top)+"px"}function wg(a,b,c){function d(a,b,d,c){0>b&&(b=0);b=Math.round(b);c=Math.round(c);
h.appendChild(r("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px;\n                             top: "+b+"px; width: "+(null==d?n-a:d)+"px;\n                             height: "+(c-b)+"px"))}function e(b,c,e){var f,h,k=w(g,b),q=k.text.length;return gg(ya(k,g.direction),c||0,null==e?q:e,function(g,w,t){var r,x,v=rc(a,m(b,g),"div",k,"left");if(g==w)r=v,t=x=v.left;else{if(r=rc(a,m(b,w-1),"div",k,"right"),"rtl"==t)t=v,v=r,r=t;t=v.left;x=r.right}null==c&&0==g&&(t=l);3<r.top-v.top&&
(d(t,v.top,null,v.bottom),t=l,v.bottom<r.top&&d(t,v.bottom,null,r.top));null==e&&w==q&&(x=n);(!f||v.top<f.top||v.top==f.top&&v.left<f.left)&&(f=v);(!h||r.bottom>h.bottom||r.bottom==h.bottom&&r.right>h.right)&&(h=r);t<l+1&&(t=l);d(t,r.top,x-t,r.bottom)}),{start:f,end:h}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),k=xe(a.display),l=k.left,n=Math.max(f.sizerWidth,Ma(a)-f.sizer.offsetLeft)-k.right,f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var q=w(g,f.line),k=w(g,b.line),
k=ma(q)==ma(k),f=e(f.line,f.ch,k?q.text.length+1:null).end;b=e(b.line,k?0:null,b.ch).start;k&&(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 rd(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(){return b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},
a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function Ke(a){a.state.focused||(a.display.input.focus(),sd(a))}function Le(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Db(a))},100)}function sd(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(F(a,"focus",a,b),a.state.focused=!0,Ea(a.display.wrapper,"CodeMirror-focused"),
a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),R&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),rd(a))}function Db(a,b){a.state.delayingBlurEvent||(a.state.focused&&(F(a,"blur",a,b),a.state.focused=!1,Ra(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function sc(a){a=a.display;for(var b=a.lineDiv.offsetTop,c=0;c<a.view.length;c++){var d=
a.view[c],e=void 0;if(!d.hidden){if(C&&8>B)var f=d.node.offsetTop+d.node.offsetHeight,e=f-b,b=f;else e=d.node.getBoundingClientRect(),e=e.bottom-e.top;f=d.line.height-e;if(2>e&&(e=Oa(a)),(.005<f||-.005>f)&&(la(d.line,e),Me(d.line),d.rest))for(e=0;e<d.rest.length;e++)Me(d.rest[e])}}}function Me(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.parentNode.offsetHeight}function td(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop,d=Math.floor(d-
a.lineSpace.offsetTop),e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,d=Ha(b,d),e=Ha(b,e);if(c&&c.ensure){var f=c.ensure.from.line;c=c.ensure.to.line;f<d?(d=f,e=Ha(b,na(w(b,f))+a.wrapper.clientHeight)):Math.min(c,b.lastLine())>=e&&(d=Ha(b,na(w(b,c))-a.wrapper.clientHeight),e=c)}return{from:d,to:Math.max(e,d+1)}}function Ne(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=pd(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),c[g].gutterBackground&&(c[g].gutterBackground.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 Oe(a){if(!a.options.lineNumbers)return!1;var b=a.doc,b=Qc(a.options,b.first+b.size-1),c=a.display;if(b.length!=c.lineNumChars){var d=c.measure.appendChild(r("div",[r("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),
e=d.firstChild.offsetWidth,d=d.offsetWidth-e;return c.lineGutter.style.width="",c.lineNumInnerWidth=Math.max(e,c.lineGutter.offsetWidth-d)+1,c.lineNumWidth=c.lineNumInnerWidth+d,c.lineNumChars=c.lineNumInnerWidth?b.length:-1,c.lineGutter.style.width=c.lineNumWidth+"px",ud(a),!0}return!1}function vd(a,b){var c=a.display,d=Oa(a.display);0>b.top&&(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:c.scroller.scrollTop,f=kd(a),g={};b.bottom-b.top>f&&(b.bottom=b.top+f);var h=a.doc.height+
jd(c),k=b.top<d,d=b.bottom>h-d;b.top<e?g.scrollTop=k?0:b.top:b.bottom>e+f&&(f=Math.min(b.top,(d?h:b.bottom)-f),f!=e&&(g.scrollTop=f));e=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:c.scroller.scrollLeft;c=Ma(a)-(a.options.fixedGutter?c.gutters.offsetWidth:0);f=b.right-b.left>c;return f&&(b.right=b.left+c),10>b.left?g.scrollLeft=0:b.left<e?g.scrollLeft=Math.max(0,b.left-(f?0:10)):b.right>c+e-3&&(g.scrollLeft=b.right+(f?0:10)-c),g}function tc(a,b){null!=b&&(uc(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?
a.doc.scrollTop:a.curOp.scrollTop)+b)}function fb(a){uc(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}}function Eb(a,b,c){null==b&&null==c||uc(a);null!=b&&(a.curOp.scrollLeft=b);null!=c&&(a.curOp.scrollTop=c)}function uc(a){var b=a.curOp.scrollToPos;b&&(a.curOp.scrollToPos=null,Pe(a,Ge(a,b.from),Ge(a,b.to),b.margin))}function Pe(a,b,c,d){b=vd(a,{left:Math.min(b.left,c.left),top:Math.min(b.top,c.top)-d,right:Math.max(b.right,c.right),bottom:Math.max(b.bottom,
c.bottom)+d});Eb(a,b.scrollLeft,b.scrollTop)}function Fb(a,b){2>Math.abs(a.doc.scrollTop-b)||(wa||wd(a,{top:b}),Qe(a,b,!0),wa&&wd(a),Gb(a,100))}function Qe(a,b,c){b=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b);(a.display.scroller.scrollTop!=b||c)&&(a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b))}function Sa(a,b,c,d){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);(c?
b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))&&!d||(a.doc.scrollLeft=b,Ne(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function Hb(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+jd(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,
scrollHeight:d+oa(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function gb(a,b){b||(b=Hb(a));var c=a.display.barWidth,d=a.display.barHeight;Re(a,b);for(var e=0;4>e&&c!=a.display.barWidth||d!=a.display.barHeight;e++)c!=a.display.barWidth&&a.options.lineWrapping&&sc(a),Re(a,Hb(a)),c=a.display.barWidth,d=a.display.barHeight}function Re(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+
"px";c.heightForcer.style.borderBottom=d.bottom+"px solid transparent";d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="";d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function Se(a){a.display.scrollbars&&
(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&Ra(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new Te[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);t(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});b.setAttribute("cm-not-content","true")},function(b,c){"horizontal"==c?Sa(a,b):Fb(a,b)},a);a.display.scrollbars.addClass&&Ea(a.display.wrapper,a.display.scrollbars.addClass)}
function Ta(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++xg};a=a.curOp;eb?eb.ops.push(a):a.ownsGroup=eb={ops:[a],delayedCallbacks:[]}}function Ua(a){sg(a.curOp,function(a){for(var c=0;c<a.ops.length;c++)a.ops[c].cm.curOp=null;a=a.ops;for(c=0;c<a.length;c++){var d=a[c],e=d.cm,f=e.display,
g=e.display;!g.scrollbarsClipped&&g.scroller.offsetWidth&&(g.nativeBarWidth=g.scroller.offsetWidth-g.scroller.clientWidth,g.heightForcer.style.height=oa(e)+"px",g.sizer.style.marginBottom=-g.nativeBarWidth+"px",g.sizer.style.borderRightWidth=oa(e)+"px",g.scrollbarsClipped=!0);d.updateMaxLine&&Wc(e);d.mustUpdate=d.viewChanged||d.forceUpdate||null!=d.scrollTop||d.scrollToPos&&(d.scrollToPos.from.line<f.viewFrom||d.scrollToPos.to.line>=f.viewTo)||f.maxLineChanged&&e.options.lineWrapping;d.update=d.mustUpdate&&
new vc(e,d.mustUpdate&&{top:d.scrollTop,ensure:d.scrollToPos},d.forceUpdate)}for(c=0;c<a.length;c++)d=a[c],d.updatedDisplay=d.mustUpdate&&xd(d.cm,d.update);for(c=0;c<a.length;c++)d=a[c],e=d.cm,f=e.display,d.updatedDisplay&&sc(e),d.barMeasure=Hb(e),f.maxLineChanged&&!e.options.lineWrapping&&(g=void 0,g=f.maxLine.text.length,g=ra(e,$a(e,f.maxLine),g,void 0),d.adjustWidthTo=g.left+3,e.display.sizerWidth=d.adjustWidthTo,d.barMeasure.scrollWidth=Math.max(f.scroller.clientWidth,f.sizer.offsetLeft+d.adjustWidthTo+
oa(e)+e.display.barWidth),d.maxScrollLeft=Math.max(0,f.sizer.offsetLeft+d.adjustWidthTo-Ma(e))),(d.updatedDisplay||d.selectionChanged)&&(d.preparedSelection=f.input.prepareSelection(d.focus));for(c=0;c<a.length;c++)d=a[c],e=d.cm,null!=d.adjustWidthTo&&(e.display.sizer.style.minWidth=d.adjustWidthTo+"px",d.maxScrollLeft<e.doc.scrollLeft&&Sa(e,Math.min(e.display.scroller.scrollLeft,d.maxScrollLeft),!0),e.display.maxLineChanged=!1),f=d.focus&&d.focus==qa()&&(!document.hasFocus||document.hasFocus()),
d.preparedSelection&&e.display.input.showSelection(d.preparedSelection,f),(d.updatedDisplay||d.startHeight!=e.doc.height)&&gb(e,d.barMeasure),d.updatedDisplay&&yd(e,d.barMeasure),d.selectionChanged&&rd(e),e.state.focused&&d.updateInput&&e.display.input.reset(d.typing),f&&Ke(d.cm);for(c=0;c<a.length;c++){d=a[c];e=d.cm;f=e.display;g=e.doc;if(d.updatedDisplay&&Ue(e,d.update),null==f.wheelStartX||null==d.scrollTop&&null==d.scrollLeft&&!d.scrollToPos||(f.wheelStartX=f.wheelStartY=null),null!=d.scrollTop&&
Qe(e,d.scrollTop,d.forceScroll),null!=d.scrollLeft&&Sa(e,d.scrollLeft,!0,!0),d.scrollToPos){var h=v(g,d.scrollToPos.from),k=v(g,d.scrollToPos.to),l=d.scrollToPos.margin;null==l&&(l=0);var n=void 0;e.options.lineWrapping||h!=k||(h=h.ch?m(h.line,"before"==h.sticky?h.ch-1:h.ch,"after"):h,k="before"==h.sticky?m(h.line,h.ch+1,"before"):h);for(var q=0;5>q;q++){var p=!1,n=ia(e,h),u=k&&k!=h?ia(e,k):n,n={left:Math.min(n.left,u.left),top:Math.min(n.top,u.top)-l,right:Math.max(n.left,u.left),bottom:Math.max(n.bottom,
u.bottom)+l},u=vd(e,n),O=e.doc.scrollTop,t=e.doc.scrollLeft;if(null!=u.scrollTop&&(Fb(e,u.scrollTop),1<Math.abs(e.doc.scrollTop-O)&&(p=!0)),null!=u.scrollLeft&&(Sa(e,u.scrollLeft),1<Math.abs(e.doc.scrollLeft-t)&&(p=!0)),!p)break}k=n;K(e,"scrollCursorIntoView")||(l=e.display,q=l.sizer.getBoundingClientRect(),h=null,(0>k.top+q.top?h=!0:k.bottom+q.top>(window.innerHeight||document.documentElement.clientHeight)&&(h=!1),null==h||yg)||(k=r("div","​",null,"position: absolute;\n                         top: "+
(k.top-l.viewOffset-e.display.lineSpace.offsetTop)+"px;\n                         height: "+(k.bottom-k.top+oa(e)+l.barHeight)+"px;\n                         left: "+k.left+"px; width: "+Math.max(2,k.right-k.left)+"px;"),e.display.lineSpace.appendChild(k),k.scrollIntoView(h),e.display.lineSpace.removeChild(k)))}k=d.maybeHiddenMarkers;h=d.maybeUnhiddenMarkers;if(k)for(l=0;l<k.length;++l)k[l].lines.length||F(k[l],"hide");if(h)for(k=0;k<h.length;++k)h[k].lines.length&&F(h[k],"unhide");f.wrapper.offsetHeight&&
(g.scrollTop=e.display.scroller.scrollTop);d.changeObjs&&F(e,"changes",e,d.changeObjs);d.update&&d.update.finish()}})}function Y(a,b){if(a.curOp)return b();Ta(a);try{return b()}finally{Ua(a)}}function L(a,b){return function(){if(a.curOp)return b.apply(a,arguments);Ta(a);try{return b.apply(a,arguments)}finally{Ua(a)}}}function T(a){return function(){if(this.curOp)return a.apply(this,arguments);Ta(this);try{return a.apply(this,arguments)}finally{Ua(this)}}}function M(a){return function(){var b=this.cm;
if(!b||b.curOp)return a.apply(this,arguments);Ta(b);try{return a.apply(this,arguments)}finally{Ua(b)}}}function V(a,b,c,d){null==b&&(b=a.doc.first);null==c&&(c=a.doc.first+a.doc.size);d||(d=0);var e=a.display;if(d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)xa&&Uc(a.doc,b)<e.viewTo&&za(a);else if(c<=e.viewFrom)xa&&ae(a.doc,c+d)>e.viewFrom?za(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)za(a);else if(b<=
e.viewFrom){var f=wc(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):za(a)}else if(c>=e.viewTo)(f=wc(a,b,b,-1))?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):za(a);else{var f=wc(a,b,b,-1),g=wc(a,c,c+d,1);f&&g?(e.view=e.view.slice(0,f.index).concat(oc(a,f.lineN,g.lineN)).concat(e.view.slice(g.index)),e.viewTo+=d):za(a)}(a=e.externalMeasured)&&(c<a.lineN?a.lineN+=d:b<a.lineN+a.size&&(e.externalMeasured=null))}function Aa(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[Na(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==N(a,c)&&a.push(c)))}function za(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function wc(a,b,c,d){var e=Na(a,b),f=a.display.view;if(!xa||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var g=a.display.viewFrom,h=0;h<e;h++)g+=f[h].size;if(g!=b){if(0<d){if(e==f.length-
1)return null;b=g+f[e].size-b;e++}else b=g-b;c+=b}for(;Uc(a.doc,c)!=c;){if(e==(0>d?0:f.length-1))return null;c+=d*f[e-(0>d?1:0)].size;e+=d}return{index:e,lineN:c}}function Ve(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 Gb(a,b){a.doc.highlightFrontier<a.display.viewTo&&a.state.highlight.set(b,Kc(zg,a))}function zg(a){var b=a.doc;if(!(b.highlightFrontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=wb(a,b.highlightFrontier),
e=[];b.iter(d.line,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(d.line>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength?La(b.mode,d.state):null,k=he(a,f,d,!0);h&&(d.state=h);f.styles=k.styles;h=f.styleClasses;(k=k.classes)?f.styleClasses=k:h&&(f.styleClasses=null);k=!g||g.length!=f.styles.length||h!=k&&(!h||!k||h.bgClass!=k.bgClass||h.textClass!=k.textClass);for(h=0;!k&&h<g.length;++h)k=g[h]!=f.styles[h];k&&e.push(d.line);f.stateAfter=d.save()}else f.text.length<=
a.options.maxHighlightLength&&fd(a,f.text,d),f.stateAfter=0==d.line%5?d.save():null;d.nextLine();if(+new Date>c)return Gb(a,a.options.workDelay),!0});b.highlightFrontier=d.line;b.modeFrontier=Math.max(b.modeFrontier,d.line);e.length&&Y(a,function(){for(var b=0;b<e.length;b++)Aa(a,e[b],"text")})}}function xd(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden)return za(a),!1;if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo)&&c.renderedView==
c.view&&0==Ve(a))return!1;Oe(a)&&(za(a),b.dims=md(a));var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFrom<f&&20>f-c.viewFrom&&(f=Math.max(d.first,c.viewFrom));c.viewTo>g&&20>c.viewTo-g&&(g=Math.min(e,c.viewTo));xa&&(f=Uc(a.doc,f),g=ae(a.doc,g));d=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;e=a.display;0==e.view.length||f>=e.viewTo||g<=e.viewFrom?(e.view=oc(a,
f,g),e.viewFrom=f):(e.viewFrom>f?e.view=oc(a,f,e.viewFrom).concat(e.view):e.viewFrom<f&&(e.view=e.view.slice(Na(a,f))),e.viewFrom=f,e.viewTo<g?e.view=e.view.concat(oc(a,e.viewTo,g)):e.viewTo>g&&(e.view=e.view.slice(0,Na(a,g))));e.viewTo=g;c.viewOffset=na(w(a.doc,c.viewFrom));a.display.mover.style.top=c.viewOffset+"px";g=Ve(a);if(!d&&0==g&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;a.hasFocus()?f=null:(f=qa())&&va(a.display.lineDiv,f)?(f={activeElt:f},
window.getSelection&&(e=window.getSelection(),e.anchorNode&&e.extend&&va(a.display.lineDiv,e.anchorNode)&&(f.anchorNode=e.anchorNode,f.anchorOffset=e.anchorOffset,f.focusNode=e.focusNode,f.focusOffset=e.focusOffset))):f=null;4<g&&(c.lineDiv.style.display="none");Ag(a,c.updateLineNumbers,b.dims);4<g&&(c.lineDiv.style.display="");c.renderedView=c.view;(g=f)&&g.activeElt&&g.activeElt!=qa()&&(g.activeElt.focus(),g.anchorNode&&va(document.body,g.anchorNode)&&va(document.body,g.focusNode))&&(f=window.getSelection(),
e=document.createRange(),e.setEnd(g.anchorNode,g.anchorOffset),e.collapse(!1),f.removeAllRanges(),f.addRange(e),f.extend(g.focusNode,g.focusOffset));return X(c.cursorDiv),X(c.selectionDiv),c.gutters.style.height=c.sizer.style.minHeight=0,d&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth,Gb(a,400)),c.updateLineNumbers=null,!0}function Ue(a,b){for(var c=b.viewport,d=!0;(d&&a.options.lineWrapping&&b.oldDisplayWidth!=Ma(a)||(c&&null!=c.top&&(c={top:Math.min(a.doc.height+jd(a.display)-
kd(a),c.top)}),b.visible=td(a.display,a.doc,c),!(b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)))&&xd(a,b);d=!1)sc(a),d=Hb(a),Cb(a),gb(a,d),yd(a,d),b.force=!1;b.signal(a,"update",a);a.display.viewFrom==a.display.reportedViewFrom&&a.display.viewTo==a.display.reportedViewTo||(b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo)}function wd(a,b){var c=new vc(a,b);if(xd(a,c)){sc(a);
Ue(a,c);var d=Hb(a);Cb(a);gb(a,d);yd(a,d);c.finish()}}function Ag(a,b,c){function d(b){var d=b.nextSibling;return R&&ha&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),d}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&&n.node.parentNode==g){for(;h!=n.node;)h=d(h);h=f&&null!=b&&b<=e&&n.lineNumber;n.changes&&(-1<N(n.changes,"gutter")&&(h=!1),se(a,n,e,c));h&&(X(n.lineNumber),
n.lineNumber.appendChild(document.createTextNode(Qc(a.options,e))));h=n.node.nextSibling}else{var q=ug(a,n,e,c);g.insertBefore(q,h)}e+=n.size}for(;h;)h=d(h)}function ud(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function yd(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";a.display.heightForcer.style.top=b.docHeight+"px";a.display.gutters.style.height=b.docHeight+a.display.barHeight+oa(a)+"px"}function We(a){var b=a.display.gutters,c=a.options.gutters;X(b);for(var d=
0;d<c.length;++d){var e=c[d],f=b.appendChild(r("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";ud(a)}function zd(a){var b=N(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 Xe(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;return null==b&&a.detail&&
a.axis==a.HORIZONTAL_AXIS&&(b=a.detail),null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta),{x:b,y:c}}function Bg(a){a=Xe(a);return a.x*=ba,a.y*=ba,a}function Ye(a,b){var c=Xe(b),d=c.x,c=c.y,e=a.display,f=e.scroller,g=f.scrollWidth>f.clientWidth,h=f.scrollHeight>f.clientHeight;if(d&&g||c&&h){if(c&&ha&&R){var g=b.target,k=e.view;a:for(;g!=f;g=g.parentNode)for(var l=0;l<k.length;l++)if(k[l].node==g){a.display.currentWheelTarget=g;break a}}if(d&&!wa&&!ja&&null!=ba)return c&&
h&&Fb(a,Math.max(0,f.scrollTop+c*ba)),Sa(a,Math.max(0,f.scrollLeft+d*ba)),(!c||c&&h)&&S(b),void(e.wheelStartX=null);c&&null!=ba&&(h=c*ba,g=a.doc.scrollTop,k=g+e.wrapper.clientHeight,0>h?g=Math.max(0,g+h-50):k=Math.min(a.doc.height,k+h+50),wd(a,{top:g,bottom:k}));20>xc&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=d,e.wheelDY=c,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&&(ba=(ba*xc+a)/(xc+1),++xc)}},200)):(e.wheelDX+=d,e.wheelDY+=c))}}function ka(a,b){var c=a[b];a.sort(function(a,b){return x(a.from(),b.from())});b=N(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=ic(e.from(),d.from()),g=hc(e.to(),d.to()),d=e.empty()?d.from()==d.head:e.from()==e.head;c<=b&&--b;a.splice(--c,2,new A(d?g:f,d?f:g))}}return new ca(a,b)}function ua(a,b){return new ca([new A(a,b||a)],0)}function Ba(a){return a.text?
m(a.from.line+a.text.length-1,z(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Ze(a,b){if(0>x(a,b.from))return a;if(0>=x(a,b.to))return Ba(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;return a.line==b.to.line&&(d+=Ba(b).ch-b.to.ch),m(c,d)}function Ad(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new A(Ze(e.anchor,b),Ze(e.head,b)))}return ka(c,a.sel.primIndex)}function $e(a,b,c){return a.line==b.line?m(c.line,a.ch-b.ch+c.ch):m(c.line+
(a.line-b.line),a.ch)}function Bd(a){a.doc.mode=dd(a.options,a.doc.modeOption);Ib(a)}function Ib(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null)});a.doc.modeFrontier=a.doc.highlightFrontier=a.doc.first;Gb(a,100);a.state.modeGen++;a.curOp&&V(a)}function af(a,b){return 0==b.from.ch&&0==b.to.ch&&""==z(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Cd(a,b,c,d){function e(a,c,e){a.text=c;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null);null!=
a.order&&(a.order=null);Xd(a);Yd(a,e);c=d?d(a):1;c!=a.height&&la(a,c);P(a,"change",a,b)}function f(a,b){for(var e=[],f=a;f<b;++f)e.push(new hb(k[f],c?c[f]:null,d));return e}var g=b.from,h=b.to,k=b.text,l=w(a,g.line),n=w(a,h.line),q=z(k),p=c?c[k.length-1]:null,u=h.line-g.line;b.full?(a.insert(0,f(0,k.length)),a.remove(k.length,a.size-k.length)):af(a,b)?(h=f(0,k.length-1),e(n,n.text,p),u&&a.remove(g.line,u),h.length&&a.insert(g.line,h)):l==n?1==k.length?e(l,l.text.slice(0,g.ch)+q+l.text.slice(h.ch),
p):(u=f(1,k.length-1),u.push(new hb(q+l.text.slice(h.ch),p,d)),e(l,l.text.slice(0,g.ch)+k[0],c?c[0]:null),a.insert(g.line+1,u)):1==k.length?(e(l,l.text.slice(0,g.ch)+k[0]+n.text.slice(h.ch),c?c[0]:null),a.remove(g.line+1,u)):(e(l,l.text.slice(0,g.ch)+k[0],c?c[0]:null),e(n,q+n.text.slice(h.ch),p),p=f(1,k.length-1),1<u&&a.remove(g.line+1,u-1),a.insert(g.line+1,p));P(a,"change",a,b)}function Va(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;c&&!l||(b(k.doc,l),d(k.doc,a,l))}}}d(a,null,!0)}function bf(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;qd(a);Bd(a);cf(a);a.options.lineWrapping||Wc(a);a.options.mode=b.modeOption;V(a)}function cf(a){("rtl"==a.doc.direction?Ea:Ra)(a.display.lineDiv,"CodeMirror-rtl")}function Cg(a){Y(a,function(){cf(a);V(a)})}function yc(a){this.done=[];this.undone=[];this.undoDepth=1/0;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=
this.lastSelOp=null;this.generation=this.maxGeneration=a||1}function Dd(a,b){var c={from:Sc(b.from),to:Ba(b),text:Ga(a,b.from,b.to)};return df(a,c,b.from.line,b.to.line+1),Va(a,function(a){return df(a,c,b.from.line,b.to.line+1)},!0),c}function ef(a){for(;a.length&&z(a).ranges;)a.pop()}function ff(a,b,c,d){var e=a.history;e.undone.length=0;var f,g,h=+new Date,k;if(k=e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>h-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))k=
f=e.lastOp==d?(ef(e.done),z(e.done)):e.done.length&&!z(e.done).ranges?z(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),z(e.done)):void 0;if(k)g=z(f.changes),0==x(b.from,b.to)&&0==x(b.from,g.to)?g.to=Ba(b):f.changes.push(Dd(a,b));else for((f=z(e.done))&&f.ranges||zc(a.sel,e.done),f={changes:[Dd(a,b)],generation:e.generation},e.done.push(f);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=e.lastSelTime=
h;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;g||F(a,"historyAdded")}function zc(a,b){var c=z(b);c&&c.ranges&&c.equals(a)||b.push(a)}function df(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(d){d.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=d.markedSpans);++f})}function Dg(a){if(!a)return null;for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function gf(a,
b){var c;if(c=b["spans_"+a.id]){for(var d=[],e=0;e<b.text.length;++e)d.push(Dg(c[e]));c=d}else c=null;d=Tc(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 ib(a,b,c){for(var d=[],e=0;e<a.length;++e){var f=a[e];if(f.ranges)d.push(c?ca.prototype.deepCopy.call(f):f);else{var f=f.changes,g=[];d.push({changes:g});for(var h=
0;h<f.length;++h){var k=f[h],l=void 0;if(g.push({from:k.from,to:k.to,text:k.text}),b)for(var n in k)(l=n.match(/^spans_(\d+)$/))&&-1<N(b,Number(l[1]))&&(z(g)[n]=k[n],delete k[n])}}}return d}function Ed(a,b,c,d){return d?(a=a.anchor,c&&(d=0>x(b,a),d!=0>x(c,a)?(a=b,b=c):d!=0>x(b,c)&&(b=c)),new A(a,b)):new A(c||b,b)}function Ac(a,b,c,d,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend));Q(a,new ca([Ed(a.sel.primary(),b,c,e)],0),d)}function hf(a,b,c){for(var d=[],e=a.cm&&(a.cm.display.shift||a.extend),
f=0;f<a.sel.ranges.length;f++)d[f]=Ed(a.sel.ranges[f],b[f],null,e);Q(a,ka(d,a.sel.primIndex),c)}function Fd(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c;Q(a,ka(e,a.sel.primIndex),d)}function Eg(a,b,c){c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new A(v(a,b[c].anchor),v(a,b[c].head))},origin:c&&c.origin};return F(a,"beforeSelectionChange",a,c),a.cm&&F(a.cm,"beforeSelectionChange",a.cm,c),c.ranges!=b.ranges?ka(c.ranges,c.ranges.length-1):b}function jf(a,
b,c){var d=a.history.done,e=z(d);e&&e.ranges?(d[d.length-1]=b,Bc(a,b,c)):Q(a,b,c)}function Q(a,b,c){Bc(a,b,c);b=a.sel;var d=a.cm?a.cm.curOp.id:NaN,e=a.history,f=c&&c.origin,g;if(!(g=d==e.lastSelOp)&&(g=f&&e.lastSelOrigin==f)&&!(g=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){g=z(e.done);var h=f.charAt(0);g="*"==h||"+"==h&&g.ranges.length==b.ranges.length&&g.somethingSelected()==b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}g?e.done[e.done.length-
1]=b:zc(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=d;c&&!1!==c.clearRedo&&ef(e.undone)}function Bc(a,b,c){(fa(a,"beforeSelectionChange")||a.cm&&fa(a.cm,"beforeSelectionChange"))&&(b=Eg(a,b,c));kf(a,lf(a,b,c&&c.bias||(0>x(b.primary().head,a.sel.primary().head)?-1:1),!0));c&&!1===c.scroll||!a.cm||fb(a.cm)}function kf(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,de(a.cm)),P(a,"cursorActivity",a))}function mf(a){kf(a,lf(a,a.sel,null,
!1))}function lf(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=b.ranges.length==a.sel.ranges.length&&a.sel.ranges[f],k=Gd(a,g.anchor,h&&h.anchor,c,d),h=Gd(a,g.head,h&&h.head,c,d);(e||k!=g.anchor||h!=g.head)&&(e||(e=b.ranges.slice(0,f)),e[f]=new A(k,h))}return e?ka(e,b.primIndex):b}function jb(a,b,c,d,e){var f=w(a,b.line);if(f.markedSpans)for(var g=0;g<f.markedSpans.length;++g){var h=f.markedSpans[g],k=h.marker;if((null==h.from||(k.inclusiveLeft?h.from<=b.ch:h.from<b.ch))&&(null==
h.to||(k.inclusiveRight?h.to>=b.ch:h.to>b.ch))){if(e&&(F(k,"beforeCursorEnter"),k.explicitlyCleared)){if(f.markedSpans){--g;continue}break}if(k.atomic){if(c&&(g=k.find(0>d?1:-1),h=void 0,(0>d?k.inclusiveRight:k.inclusiveLeft)&&(g=nf(a,g,-d,g&&g.line==b.line?f:null)),g&&g.line==b.line&&(h=x(g,c))&&(0>d?0>h:0<h)))return jb(a,g,b,d,e);c=k.find(0>d?-1:1);return(0>d?k.inclusiveLeft:k.inclusiveRight)&&(c=nf(a,c,d,c.line==b.line?f:null)),c?jb(a,c,b,d,e):null}}}return b}function Gd(a,b,c,d,e){d=d||1;return jb(a,
b,c,d,e)||!e&&jb(a,b,c,d,!0)||jb(a,b,c,-d,e)||!e&&jb(a,b,c,-d,!0)||(a.cantEdit=!0,m(a.first,0))}function nf(a,b,c,d){return 0>c&&0==b.ch?b.line>a.first?v(a,m(b.line-1)):null:0<c&&b.ch==(d||w(a,b.line)).text.length?b.line<a.first+a.size-1?m(b.line+1,0):null:new m(b.line,b.ch+c)}function of(a){a.setSelection(m(a.firstLine(),0),m(a.lastLine()),pa)}function pf(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return d.canceled=!0}};return c&&(d.update=function(b,
c,g,h){b&&(d.from=v(a,b));c&&(d.to=v(a,c));g&&(d.text=g);void 0!==h&&(d.origin=h)}),F(a,"beforeChange",a,d),a.cm&&F(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function kb(a,b,c){if(a.cm){if(!a.cm.curOp)return L(a.cm,kb)(a,b,c);if(a.cm.state.suppressEdits)return}if(!(fa(a,"beforeChange")||a.cm&&fa(a.cm,"beforeChange"))||(b=pf(a,b,!0)))if(c=qf&&!c&&fg(a,b.from,b.to))for(var d=c.length-1;0<=d;--d)rf(a,{from:c[d].from,to:c[d].to,text:d?[""]:b.text});
else rf(a,b)}function rf(a,b){if(1!=b.text.length||""!=b.text[0]||0!=x(b.from,b.to)){var c=Ad(a,b);ff(a,b,c,a.cm?a.cm.curOp.id:NaN);Jb(a,b,c,Tc(a,b));var d=[];Va(a,function(a,c){c||-1!=N(d,a.history)||(sf(a.history,b),d.push(a.history));Jb(a,b,null,Tc(a,b))})}}function Cc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits||c){for(var d,e=a.history,f=a.sel,g="undo"==b?e.done:e.undone,h="undo"==b?e.undone:e.done,k=0;k<g.length&&(d=g[k],c?!d.ranges||d.equals(a.sel):d.ranges);k++);if(k!=g.length){for(e.lastOrigin=
e.lastSelOrigin=null;d=g.pop(),d.ranges;){if(zc(d,h),c&&!d.equals(a.sel))return void Q(a,d,{clearRedo:!1});f=d}var l=[];zc(f,h);h.push({changes:l,generation:e.generation});e.generation=d.generation||++e.maxGeneration;var n=fa(a,"beforeChange")||a.cm&&fa(a.cm,"beforeChange");for(c=d.changes.length-1;0<=c;--c)if(e=function(c){var e=d.changes[c];if(e.origin=b,n&&!pf(a,e,!1))return g.length=0,{};l.push(Dd(a,e));var f=c?Ad(a,e):z(g);Jb(a,e,f,gf(a,e));!c&&a.cm&&a.cm.scrollIntoView({from:e.from,to:Ba(e)});
var h=[];Va(a,function(a,b){b||-1!=N(h,a.history)||(sf(a.history,e),h.push(a.history));Jb(a,e,null,gf(a,e))})}(c))return e.v}}}function tf(a,b){if(0!=b&&(a.first+=b,a.sel=new ca(ec(a.sel.ranges,function(a){return new A(m(a.anchor.line+b,a.anchor.ch),m(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){V(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)Aa(a.cm,d,"gutter")}}function Jb(a,b,c,d){if(a.cm&&!a.cm.curOp)return L(a.cm,Jb)(a,b,c,d);if(b.to.line<a.first)return void tf(a,
b.text.length-1-(b.to.line-b.from.line));if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);tf(a,e);b={from:m(a.first,0),to:m(b.to.line+e,b.to.ch),text:[z(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:m(e,w(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=Ga(a,b.from,b.to);c||(c=Ad(a,b));a.cm?Fg(a.cm,b,d):Cd(a,b,d);Bc(a,c,pa)}}function Fg(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=D(ma(w(d,f.line))),d.iter(k,g.line+1,function(a){if(a==e.maxLine)return h=!0,!0}));-1<d.sel.contains(b.from,b.to)&&de(a);Cd(d,b,c,He(a));a.options.lineWrapping||(d.iter(k,f.line+b.text.length,function(a){var b=kc(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0));mg(d,f.line);Gb(a,400);c=b.text.length-(g.line-f.line)-1;b.full?V(a):f.line!=g.line||1!=b.text.length||af(a.doc,b)?V(a,f.line,g.line+1,c):Aa(a,f.line,"text");c=fa(a,"changes");
if((d=fa(a,"change"))||c)b={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin},d&&P(a,"change",a,b),c&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function lb(a,b,c,d,e){if(d||(d=c),0>x(d,c)){var f=d;d=c;c=f}"string"==typeof b&&(b=a.splitLines(b));kb(a,{from:c,to:d,text:b,origin:e})}function uf(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges)for(f.copied||(f=a[e]=f.deepCopy(),f.copied=!0),g=0;g<f.ranges.length;g++){var h=f.ranges[g].anchor,
k=b;c<h.line?h.line+=d:k<h.line&&(h.line=k,h.ch=0);h=f.ranges[g].head;k=b;c<h.line?h.line+=d:k<h.line&&(h.line=k,h.ch=0)}else{for(h=0;h<f.changes.length;++h)if(k=f.changes[h],c<k.from.line)k.from=m(k.from.line+d,k.from.ch),k.to=m(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 sf(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;uf(a.done,c,d,e);uf(a.undone,c,d,e)}function Kb(a,b,c,d){var e=b,f=b;return"number"==typeof b?f=w(a,Math.max(a.first,Math.min(b,
a.first+a.size-1))):e=D(b),null==e?null:(d(f,e)&&a.cm&&Aa(a.cm,e,c),f)}function Lb(a){this.lines=a;this.parent=null;for(var b=0,c=0;c<a.length;++c)a[c].parent=this,b+=a[c].height;this.height=b}function Mb(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 Gg(a,b,c,d){var e=new Nb(a,c,d),f=a.cm;return f&&e.noHScroll&&(f.display.alignWidgets=!0),Kb(a,b,"widget",function(b){var c=b.widgets||
(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,f&&!Ja(a,b))c=na(b)<a.scrollTop,la(b,b.height+zb(e)),c&&tc(f,e.height),f.curOp.forceUpdate=!0;return!0}),P(f,"lineWidgetAdded",f,e,"number"==typeof b?b:D(b)),e}function mb(a,b,c,d,e){if(d&&d.shared)return Hg(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return L(a.cm,mb)(a,b,c,d,e);var f=new Ca(a,e);e=x(b,c);if(d&&Fa(d,f,!1),0<e||0==e&&!1!==f.clearWhenEmpty)return f;if(f.replacedWith&&(f.collapsed=!0,
f.widgetNode=Za("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if($d(a,b.line,b,c,f)||b.line!=c.line&&$d(a,c.line,b,c,f))throw Error("Inserting collapsed marker partially overlapping an existing one");xa=!0}f.addToHistory&&ff(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var g,h=b.line,k=a.cm;a.iter(h,c.line+1,function(a){k&&f.collapsed&&!k.options.lineWrapping&&ma(a)==k.display.maxLine&&
(g=!0);f.collapsed&&h!=b.line&&la(a,0);var d=new jc(f,h==b.line?b.ch:null,h==c.line?c.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([d]):[d];d.marker.attachLine(a);++h});f.collapsed&&a.iter(b.line,c.line+1,function(b){Ja(a,b)&&la(b,0)});f.clearOnEnter&&t(f,"beforeCursorEnter",function(){return f.clear()});f.readOnly&&(qf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());if(f.collapsed&&(f.id=++vf,f.atomic=!0),k){if(g&&(k.curOp.updateMaxLine=!0),f.collapsed)V(k,b.line,
c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(d=b.line;d<=c.line;d++)Aa(k,d,"text");f.atomic&&mf(k.doc);P(k,"markerAdded",k,f)}return f}function Hg(a,b,c,d,e){d=Fa(d);d.shared=!1;var f=[mb(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Va(a,function(a){h&&(d.widgetNode=h.cloneNode(!0));f.push(mb(a,v(a,b),v(a,c),d,e));for(var l=0;l<a.linked.length;++l)if(a.linked[l].isParent)return;g=z(f)}),new Ob(f,g)}function wf(a){return a.findMarks(m(a.first,0),a.clipPos(m(a.lastLine())),
function(a){return a.parent})}function Ig(a){for(var b=0;b<a.length;b++)!function(b){b=a[b];var d=[b.primary.doc];Va(b.primary.doc,function(a){return d.push(a)});for(var e=0;e<b.markers.length;e++){var f=b.markers[e];-1==N(d,f.doc)&&(f.parent=null,b.markers.splice(e--,1))}}(b)}function Jg(a){var b=this;if(xf(b),!K(b,a)&&!ta(b.display,a)){S(a);C&&(yf=+new Date);var c=Qa(b,a,!0),d=a.dataTransfer.files;if(c&&!b.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),
g=0,h=0;h<e;++h)!function(a,d){if(!b.options.allowDropFileTypes||-1!=N(b.options.allowDropFileTypes,a.type)){var h=new FileReader;h.onload=L(b,function(){var a=h.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a=""),f[d]=a,++g==e)c=v(b.doc,c),a={from:c,to:c,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"},kb(b.doc,a),jf(b.doc,ua(c,Ba(a)))});h.readAsText(a)}}(d[h],h);else{if(b.state.draggingText&&-1<b.doc.sel.contains(c))return b.state.draggingText(a),void setTimeout(function(){return b.display.input.focus()},
20);try{if(h=a.dataTransfer.getData("Text")){var k;if(b.state.draggingText&&!b.state.draggingText.copy&&(k=b.listSelections()),Bc(b.doc,ua(c,c)),k)for(d=0;d<k.length;++d)lb(b.doc,"",k[d].anchor,k[d].head,"drag");b.replaceSelection(h,"around","paste");b.display.input.focus()}}catch(l){}}}}function xf(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function zf(a){if(document.getElementsByClassName)for(var b=document.getElementsByClassName("CodeMirror"),
c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function Kg(){var a;t(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null;zf(Lg)},100))});t(window,"blur",function(){return zf(Db)})}function Lg(a){var b=a.display;b.lastWrapHeight==b.wrapper.clientHeight&&b.lastWrapWidth==b.wrapper.clientWidth||(b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize())}function Mg(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,f,g=0;g<b.length-1;g++){var h=
b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))c=!0;else if(/^(c|ctrl|control)$/i.test(h))d=!0;else{if(!/^s(hift)?$/i.test(h))throw Error("Unrecognized modifier name: "+h);e=!0}}return c&&(a="Alt-"+a),d&&(a="Ctrl-"+a),f&&(a="Cmd-"+a),e&&(a="Shift-"+a),a}function Ng(a){var b={},c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];if(!/^(name|fallthrough|(de|at)tach)$/.test(c)){if("..."!=d)for(var e=ec(c.split(" "),Mg),f=0;f<e.length;f++){var g=void 0,h=void 0;f==e.length-1?(h=e.join(" "),
g=d):(h=e.slice(0,f+1).join(" "),g="...");var k=b[h];if(k){if(k!=g)throw Error("Inconsistent bindings for "+h);}else b[h]=g}delete a[c]}}for(var l in b)a[l]=b[l];return a}function nb(a,b,c,d){b=Dc(b);var e=b.call?b.call(a,d):b[a];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return nb(a,b.fallthrough,c,d);for(e=0;e<b.fallthrough.length;e++){var f=nb(a,b.fallthrough[e],c,d);
if(f)return f}}}function Af(a){a="string"==typeof a?a:Da[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function Bf(a,b,c){var d=a;return b.altKey&&"Alt"!=d&&(a="Alt-"+a),(Cf?b.metaKey:b.ctrlKey)&&"Ctrl"!=d&&(a="Ctrl-"+a),(Cf?b.ctrlKey:b.metaKey)&&"Cmd"!=d&&(a="Cmd-"+a),!c&&b.shiftKey&&"Shift"!=d&&(a="Shift-"+a),a}function Df(a,b){if(ja&&34==a.keyCode&&a["char"])return!1;var c=Da[a.keyCode];return null!=c&&!a.altGraphKey&&Bf(c,a,b)}function Dc(a){return"string"==typeof a?Pb[a]:a}function ob(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,z(d).to);){var g=d.pop();if(0>x(g.from,f.from)){f.from=g.from;break}}d.push(f)}Y(a,function(){for(var b=d.length-1;0<=b;b--)lb(a.doc,"",d[b].from,d[b].to,"+delete");fb(a)})}function Ef(a,b){var c=w(a.doc,b),d=ma(c);return d!=c&&(b=D(d)),$c(!0,a,d,b,1)}function Ff(a,b){var c=Ef(a,b.line),d=w(a.doc,c.line),e=ya(d,a.doc.direction);return e&&0!=e[0].level?c:(d=Math.max(0,d.text.search(/\S/)),m(c.line,b.line==
c.line&&b.ch<=d&&b.ch?0:d,c.sticky))}function Ec(a,b,c){if("string"==typeof b&&!(b=Qb[b]))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Fc}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function Og(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=nb(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&nb(b,a.options.extraKeys,c,a)||nb(b,a.options.keyMap,c,a)}function Rb(a,
b,c,d){var e=a.state.keySeq;if(e){if(Af(b))return"handled";Pg.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())});b=e+" "+b}d=Og(a,b,d);return"multi"==d&&(a.state.keySeq=b),"handled"==d&&P(a,"keyHandled",a,b,c),"handled"!=d&&"multi"!=d||(S(c),rd(a)),e&&!d&&/\'$/.test(b)?(S(c),!0):!!d}function Gf(a,b){var c=Df(b,!0);return!!c&&(b.shiftKey&&!a.state.keySeq?Rb(a,"Shift-"+c,b,function(b){return Ec(a,b,!0)})||Rb(a,c,b,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):
b.motion)return Ec(a,b)}):Rb(a,c,b,function(b){return Ec(a,b)}))}function Qg(a,b,c){return Rb(a,"'"+c+"'",b,function(b){return Ec(a,b,!0)})}function Hf(a){if(this.curOp.focus=qa(),!K(this,a)){C&&11>B&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=Gf(this,a);ja&&(Hd=c?b:null,!c&&88==b&&!Rg&&(ha?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||Sg(this)}}function Sg(a){function b(a){18!=
a.keyCode&&a.altKey||(Ra(c,"CodeMirror-crosshair"),aa(document,"keyup",b),aa(document,"mouseover",b))}var c=a.display.lineDiv;Ea(c,"CodeMirror-crosshair");t(document,"keyup",b);t(document,"mouseover",b)}function If(a){16==a.keyCode&&(this.doc.sel.shift=!1);K(this,a)}function Jf(a){if(!(ta(this.display,a)||K(this,a)||a.ctrlKey&&!a.altKey||ha&&a.metaKey)){var b=a.keyCode,c=a.charCode;if(ja&&b==Hd)return Hd=null,void S(a);ja&&(!a.which||10>a.which)&&Gf(this,a)||(b=String.fromCharCode(null==c?b:c),"\b"!=
b&&(Qg(this,a,b)||this.display.input.onKeyPress(a)))}}function Tg(a,b){var c=+new Date;return Sb&&Sb.compare(c,a,b)?(Tb=Sb=null,"triple"):Tb&&Tb.compare(c,a,b)?(Sb=new Id(c,a,b),Tb=null,"double"):(Tb=new Id(c,a,b),Sb=null,"single")}function Kf(a){var b=this.display;if(!(K(this,a)||b.activeTouch&&b.input.supportsTouch())){if(b.input.ensurePolled(),b.shift=a.shiftKey,ta(b,a))return void(R||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100)));if(!Jd(this,a,"gutterClick",
!0)){var c=Qa(this,a),d=fe(a),e=c?Tg(c,d):"single";window.focus();1==d&&this.state.selectingText&&this.state.selectingText(a);c&&Ug(this,d,c,e,a)||(1==d?c?Vg(this,c,e,a):(a.target||a.srcElement)==b.scroller&&S(a):2==d?(c&&Ac(this.doc,c),setTimeout(function(){return b.input.focus()},20)):3==d&&(Kd?Lf(this,a):Le(this)))}}}function Ug(a,b,c,d,e){var f="Click";return"double"==d?f="Double"+f:"triple"==d&&(f="Triple"+f),f=(1==b?"Left":2==b?"Middle":"Right")+f,Rb(a,Bf(f,e),e,function(b){if("string"==typeof b&&
(b=Qb[b]),!b)return!1;var d=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),d=b(a,c)!=Fc}finally{a.state.suppressEdits=!1}return d})}function Vg(a,b,c,d){C?setTimeout(Kc(Ke,a),0):a.curOp.focus=qa();var e,f;f=(f=a.getOption("configureMouse"))?f(a,c,d):{};null==f.unit&&(f.unit=(Wg?d.shiftKey&&d.metaKey:d.altKey)?"rectangle":"single"==c?"char":"double"==c?"word":"line");f=((null==f.extend||a.doc.extend)&&(f.extend=a.doc.extend||d.shiftKey),null==f.addNew&&(f.addNew=ha?d.metaKey:d.ctrlKey),null==f.moveOnDrag&&
(f.moveOnDrag=!(ha?d.altKey:d.ctrlKey)),f);var g=a.doc.sel;a.options.dragDrop&&Xg&&!a.isReadOnly()&&"single"==c&&-1<(e=g.contains(b))&&(0>x((e=g.ranges[e]).from(),b)||0<b.xRel)&&(0<x(e.to(),b)||0>b.xRel)?Yg(a,d,b,f):Zg(a,d,b,f)}function Yg(a,b,c,d){var e=a.display,f=!1,g=L(a,function(b){R&&(e.scroller.draggable=!1);a.state.draggingText=!1;aa(document,"mouseup",g);aa(document,"mousemove",h);aa(e.scroller,"dragstart",k);aa(e.scroller,"drop",g);f||(S(b),d.addNew||Ac(a.doc,c,null,null,d.extend),R||C&&
9==B?setTimeout(function(){document.body.focus();e.input.focus()},20):e.input.focus())}),h=function(a){f=f||10<=Math.abs(b.clientX-a.clientX)+Math.abs(b.clientY-a.clientY)},k=function(){return f=!0};R&&(e.scroller.draggable=!0);a.state.draggingText=g;g.copy=!d.moveOnDrag;e.scroller.dragDrop&&e.scroller.dragDrop();t(document,"mouseup",g);t(document,"mousemove",h);t(e.scroller,"dragstart",k);t(e.scroller,"drop",g);Le(a);setTimeout(function(){return e.input.focus()},20)}function Mf(a,b,c){if("char"==
c)return new A(b,b);if("word"==c)return a.findWordAt(b);if("line"==c)return new A(m(b.line,0),v(a.doc,m(b.line+1,0)));a=c(a,b);return new A(a.from,a.to)}function Zg(a,b,c,d){function e(b){if(0!=x(u,b))if(u=b,"rectangle"==d.unit){for(var e=[],f=a.options.tabSize,g=ea(w(k,c.line).text,c.ch,f),h=ea(w(k,b.line).text,b.ch,f),p=Math.min(g,h),g=Math.max(g,h),h=Math.min(c.line,b.line),O=Math.min(a.lastLine(),Math.max(c.line,b.line));h<=O;h++){var r=w(k,h).text,t=Lc(r,p,f);p==g?e.push(new A(m(h,t),m(h,t))):
r.length>t&&e.push(new A(m(h,t),m(h,Lc(r,g,f))))}e.length||e.push(new A(c,c));Q(k,ka(q.ranges.slice(0,n).concat(e),n),{origin:"*mouse",scroll:!1});a.scrollIntoView(b)}else f=l,p=Mf(a,b,d.unit),b=f.anchor,0<x(p.anchor,b)?(e=p.head,b=ic(f.from(),p.anchor)):(e=p.anchor,b=hc(f.to(),p.head)),f=q.ranges.slice(0),f[n]=new A(v(k,b),e),Q(k,ka(f,n),Ld)}function f(b){var c=++r,g=Qa(a,b,!0,"rectangle"==d.unit);if(g)if(0!=x(g,u)){a.curOp.focus=qa();e(g);var l=td(h,k);(g.line>=l.to||g.line<l.from)&&setTimeout(L(a,
function(){r==c&&f(b)}),150)}else{var n=b.clientY<O.top?-20:b.clientY>O.bottom?20:0;n&&setTimeout(L(a,function(){r==c&&(h.scroller.scrollTop+=n,f(b))}),50)}}function g(b){a.state.selectingText=!1;r=1/0;S(b);h.input.focus();aa(document,"mousemove",J);aa(document,"mouseup",y);k.history.lastSelOrigin=null}var h=a.display,k=a.doc;S(b);var l,n,q=k.sel,p=q.ranges;(d.addNew&&!d.extend?(n=k.sel.contains(c),l=-1<n?p[n]:new A(c,c)):(l=k.sel.primary(),n=k.sel.primIndex),"rectangle"==d.unit)?(d.addNew||(l=new A(c,
c)),c=Qa(a,b,!0,!0),n=-1):(b=Mf(a,c,d.unit),l=d.extend?Ed(l,b.anchor,b.head,d.extend):b);d.addNew?-1==n?(n=p.length,Q(k,ka(p.concat([l]),n),{scroll:!1,origin:"*mouse"})):1<p.length&&p[n].empty()&&"char"==d.unit&&!d.extend?(Q(k,ka(p.slice(0,n).concat(p.slice(n+1)),0),{scroll:!1,origin:"*mouse"}),q=k.sel):Fd(k,n,l,Ld):(n=0,Q(k,new ca([l],0),Ld),q=k.sel);var u=c,O=h.wrapper.getBoundingClientRect(),r=0,J=L(a,function(a){fe(a)?f(a):g(a)}),y=L(a,g);a.state.selectingText=y;t(document,"mousemove",J);t(document,
"mouseup",y)}function Jd(a,b,c,d){var e,f;try{e=b.clientX,f=b.clientY}catch(g){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&S(b);d=a.display;var h=d.lineDiv.getBoundingClientRect();if(f>h.bottom||!fa(a,c))return ad(b);f-=h.top-d.viewOffset;for(h=0;h<a.options.gutters.length;++h){var k=d.gutters.childNodes[h];if(k&&k.getBoundingClientRect().right>=e)return F(a,c,a,Ha(a.doc,f),a.options.gutters[h],b),ad(b)}}function Lf(a,b){var c;(c=ta(a.display,b))||(c=!!fa(a,
"gutterContextMenu")&&Jd(a,b,"gutterContextMenu",!1));c||K(a,b,"contextmenu")||a.display.input.onContextMenu(b)}function Nf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");Bb(a)}function Ub(a){We(a);V(a);Ne(a)}function $g(a,b,c){!b!=!(c&&c!=pb)&&(c=a.display.dragFunctions,b=b?t:aa,b(a.display.scroller,"dragstart",c.start),b(a.display.scroller,"dragenter",c.enter),b(a.display.scroller,"dragover",c.over),b(a.display.scroller,
"dragleave",c.leave),b(a.display.scroller,"drop",c.drop))}function ah(a){a.options.lineWrapping?(Ea(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Ra(a.display.wrapper,"CodeMirror-wrap"),Wc(a));qd(a);V(a);Bb(a);setTimeout(function(){return gb(a)},100)}function E(a,b){var c=this;if(!(this instanceof E))return new E(a,b);this.options=b=b?Fa(b):{};Fa(Of,b,!1);zd(b);var d=b.value;"string"==typeof d&&(d=new W(d,b.mode,null,b.lineSeparator,b.direction));
this.doc=d;var e=new E.inputStyles[b.inputStyle](this),e=this.display=new eg(a,d,e);e.wrapper.CodeMirror=this;We(this);Nf(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");Se(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Wa,keySeq:null,specialChars:null};b.autofocus&&!rb&&e.input.focus();C&&11>B&&setTimeout(function(){return c.display.input.reset(!0)},
20);bh(this);Pf||(Kg(),Pf=!0);Ta(this);this.curOp.forceUpdate=!0;bf(this,d);b.autofocus&&!rb||this.hasFocus()?setTimeout(Kc(sd,this),20):Db(this);for(var f in Gc)Gc.hasOwnProperty(f)&&Gc[f](c,b[f],pb);Oe(this);b.finishInit&&b.finishInit(this);for(d=0;d<Md.length;++d)Md[d](c);Ua(this);R&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(e.lineDiv).textRendering&&(e.lineDiv.style.textRendering="auto")}function bh(a){function b(){d.activeTouch&&(e=setTimeout(function(){return d.activeTouch=null},
1E3),f=d.activeTouch,f.end=+new Date)}function c(a,b){if(null==b.left)return!0;var c=b.left-a.left,d=b.top-a.top;return 400<c*c+d*d}var d=a.display;t(d.scroller,"mousedown",L(a,Kf));C&&11>B?t(d.scroller,"dblclick",L(a,function(b){if(!K(a,b)){var c=Qa(a,b);!c||Jd(a,b,"gutterClick",!0)||ta(a.display,b)||(S(b),b=a.findWordAt(c),Ac(a.doc,b.anchor,b.head))}})):t(d.scroller,"dblclick",function(b){return K(a,b)||S(b)});Kd||t(d.scroller,"contextmenu",function(b){return Lf(a,b)});var e,f={end:0};t(d.scroller,
"touchstart",function(b){var c;if(c=!K(a,b))1!=b.touches.length?c=!1:(c=b.touches[0],c=1>=c.radiusX&&1>=c.radiusY),c=!c;c&&(d.input.ensurePolled(),clearTimeout(e),c=+new Date,d.activeTouch={start:c,moved:!1,prev:300>=c-f.end?f:null},1==b.touches.length&&(d.activeTouch.left=b.touches[0].pageX,d.activeTouch.top=b.touches[0].pageY))});t(d.scroller,"touchmove",function(){d.activeTouch&&(d.activeTouch.moved=!0)});t(d.scroller,"touchend",function(e){var f=d.activeTouch;if(f&&!ta(d,e)&&null!=f.left&&!f.moved&&
300>new Date-f.start){var g=a.coordsChar(d.activeTouch,"page"),f=!f.prev||c(f,f.prev)?new A(g,g):!f.prev.prev||c(f,f.prev.prev)?a.findWordAt(g):new A(m(g.line,0),v(a.doc,m(g.line+1,0)));a.setSelection(f.anchor,f.head);a.focus();S(e)}b()});t(d.scroller,"touchcancel",b);t(d.scroller,"scroll",function(){d.scroller.clientHeight&&(Fb(a,d.scroller.scrollTop),Sa(a,d.scroller.scrollLeft,!0),F(a,"scroll",a))});t(d.scroller,"mousewheel",function(b){return Ye(a,b)});t(d.scroller,"DOMMouseScroll",function(b){return Ye(a,
b)});t(d.wrapper,"scroll",function(){return d.wrapper.scrollTop=d.wrapper.scrollLeft=0});d.dragFunctions={enter:function(b){K(a,b)||vb(b)},over:function(b){if(!K(a,b)){var c=Qa(a,b);if(c){var d=document.createDocumentFragment();Je(a,c,d);a.display.dragCursor||(a.display.dragCursor=r("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv));Z(a.display.dragCursor,d)}vb(b)}},start:function(b){if(C&&(!a.state.draggingText||100>
+new Date-yf))b=void vb(b);else{if(!K(a,b)&&!ta(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.effectAllowed="copyMove",b.dataTransfer.setDragImage&&!Qf)){var c=r("img",null,null,"position: fixed; left: 0; top: 0;");c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw\x3d\x3d";ja&&(c.width=c.height=1,a.display.wrapper.appendChild(c),c._top=c.offsetTop);b.dataTransfer.setDragImage(c,0,0);ja&&c.parentNode.removeChild(c)}b=void 0}return b},drop:L(a,
Jg),leave:function(b){K(a,b)||xf(a)}};var g=d.input.getField();t(g,"keyup",function(b){return If.call(a,b)});t(g,"keydown",L(a,Hf));t(g,"keypress",L(a,Jf));t(g,"focus",function(b){return sd(a,b)});t(g,"blur",function(b){return Db(a,b)})}function Vb(a,b,c,d){var e,f=a.doc;null==c&&(c="add");"smart"==c&&(f.mode.indent?e=wb(a,b).state:c="prev");var g=a.options.tabSize,h=w(f,b),k=ea(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var l,n=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&
((l=f.mode.indent(e,h.text.slice(n.length),h.text))==Fc||150<l)){if(!d)return;c="prev"}}else l=0,c="not";"prev"==c?l=b>f.first?ea(w(f,b-1).text,null,g):0:"add"==c?l=k+a.options.indentUnit:"subtract"==c?l=k-a.options.indentUnit:"number"==typeof c&&(l=k+c);l=Math.max(0,l);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(l/g);a;--a)d+=g,c+="\t";if(d<l&&(c+=Mc(l-d)),c!=n)return lb(f,c,m(b,0),m(b,n.length),"+input"),h.stateAfter=null,!0;for(g=0;g<f.sel.ranges.length;g++)if(h=f.sel.ranges[g],h.head.line==
b&&h.head.ch<n.length){b=m(b,n.length);Fd(f,g,new A(b,b));break}}function Rf(a){da=a}function Nd(a,b,c,d,e){var f=a.doc;a.display.shift=!1;d||(d=f.sel);var g=a.state.pasteIncoming||"paste"==e,h=Od(b),k=null;if(g&&1<d.ranges.length)if(da&&da.text.join("\n")==b){if(0==d.ranges.length%da.text.length)for(var k=[],l=0;l<da.text.length;l++)k.push(f.splitLines(da.text[l]))}else h.length==d.ranges.length&&a.options.pasteLinesPerSelection&&(k=ec(h,function(a){return[a]}));for(var n,l=d.ranges.length-1;0<=
l;l--){n=d.ranges[l];var q=n.from(),p=n.to();n.empty()&&(c&&0<c?q=m(q.line,q.ch-c):a.state.overwrite&&!g?p=m(p.line,Math.min(w(f,p.line).text.length,p.ch+z(h).length)):da&&da.lineWise&&da.text.join("\n")==b&&(q=p=m(q.line,0)));n=a.curOp.updateInput;q={from:q,to:p,text:k?k[l%k.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};kb(a.doc,q);P(a,"inputRead",a,q)}b&&!g&&Sf(a,b);fb(a);a.curOp.updateInput=n;a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=!1}function Tf(a,b){var c=
a.clipboardData&&a.clipboardData.getData("Text");if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||Y(b,function(){return Nd(b,c,0,null,"paste")}),!0}function Sf(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;0<=d;d--){var e=c.ranges[d];if(!(100<e.head.ch||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars)for(var h=0;h<f.electricChars.length;h++){if(-1<b.indexOf(f.electricChars.charAt(h))){g=
Vb(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(w(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=Vb(a,e.head.line,"smart"));g&&P(a,"electricInput",a,e.head.line)}}}function Uf(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line,e={anchor:m(e,0),head:m(e+1,0)};c.push(e);b.push(a.getRange(e.anchor,e.head))}return{text:b,ranges:c}}function Vf(a,b){a.setAttribute("autocorrect","off");a.setAttribute("autocapitalize","off");a.setAttribute("spellcheck",
!!b)}function Wf(){var a=r("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),b=r("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return R?a.style.width="1000px":a.setAttribute("wrap","off"),Wb&&(a.style.border="1px solid black"),Vf(a),b}function Pd(a,b,c,d,e){function f(d){var f;if(null==(f=e?be(a.cm,k,b,c):Zc(k,b,c))){d||(d=b.line+c,d=!(!(d<a.first||d>=a.first+a.size)&&(b=new m(d,b.ch,b.sticky),k=w(a,d))));
if(d)return!1;b=$c(e,a.cm,k,b.line,c)}else b=f;return!0}var g=b,h=c,k=w(a,b.line);if("char"==d)f();else if("column"==d)f(!0);else if("word"==d||"group"==d){var l=null;d="group"==d;for(var n=a.cm&&a.cm.getHelper(b,"wordChars"),q=!0;!(0>c)||f(!q);q=!1){var p=k.text.charAt(b.ch)||"\n",p=fc(p,n)?"w":d&&"\n"==p?"n":!d||/\s/.test(p)?null:"p";if(!d||q||p||(p="s"),l&&l!=p){0>c&&(c=1,f(),b.sticky="after");break}if(p&&(l=p),0<c&&!f(!q))break}}h=Gd(a,b,g,h,!0);return Rc(g,h)&&(h.hitSide=!0),h}function Xf(a,
b,c,d){var e,f=a.doc,g=b.left;"page"==d?(d=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),d=Math.max(d-.5*Oa(a.display),3),e=(0<c?b.bottom:b.top)+c*d):"line"==d&&(e=0<c?b.bottom+3:b.top-3);for(var h;h=od(a,g,e),h.outside;){if(0>c?0>=e:e>=f.height){h.hitSide=!0;break}e+=5*c}return h}function Yf(a,b){var c=ld(a,b.line);if(!c||c.hidden)return null;var d=w(a.doc,b.line),c=ye(c,d,b.line),d=ya(d,a.doc.direction),e="left";d&&(e=Xc(d,b.ch)%2?"right":"left");
c=ze(c.map,b.ch,e);return c.offset="right"==c.collapse?c.end:c.start,c}function ch(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function qb(a,b){return b&&(a.bad=!0),a}function dh(a,b,c,d,e){function f(a){return function(b){return b.id==a}}function g(){l&&(k+=n,l=!1)}function h(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)(b=c||b.textContent.replace(/\u200b/g,""))&&(g(),k+=b);else{var u;if(c=b.getAttribute("cm-marker"))b=a.findMarks(m(d,
0),m(e+1,0),f(+c)),b.length&&(u=b[0].find())&&(b=Ga(a.doc,u.from,u.to).join(n))&&(g(),k+=b);else if("false"!=b.getAttribute("contenteditable")){(u=/^(pre|div|p)$/i.test(b.nodeName))&&g();for(c=0;c<b.childNodes.length;c++)h(b.childNodes[c]);u&&(l=!0)}}}else 3==b.nodeType&&(b=b.nodeValue)&&(g(),k+=b)}for(var k="",l=!1,n=a.doc.lineSeparator();h(b),b!=c;)b=b.nextSibling;return k}function Hc(a,b,c){var d;if(b==a.display.lineDiv){if(!(d=a.display.lineDiv.childNodes[c]))return qb(a.clipPos(m(a.display.viewTo-
1)),!0);b=null;c=0}else for(d=b;;d=d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==d)return eh(f,b,c)}}function eh(a,b,c){function d(b,c,d){for(var e=-1;e<(l?l.length:0);e++)for(var f=0>e?k.map:l[e],g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==c)return c=D(0>e?a.line:a.rest[e]),e=f[g]+d,(0>d||h!=b)&&(e=f[g+(d?1:0)]),m(c,e)}}var e=a.text.firstChild,f=!1;if(!b||!va(e,
b))return qb(m(D(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[c],c=0,!b))return c=a.rest?z(a.rest):a.line,qb(m(D(c),c.text.length),f);var g=3==b.nodeType?b:null,h=b;for(g||1!=b.childNodes.length||3!=b.firstChild.nodeType||(g=b.firstChild,c&&(c=g.nodeValue.length));h.parentNode!=e;)h=h.parentNode;var k=a.measure,l=k.maps;if(b=d(g,h,c))return qb(b,f);e=h.nextSibling;for(g=g?g.nodeValue.length-c:0;e;e=e.nextSibling){if(b=d(e,e.firstChild,0))return qb(m(b.line,b.ch-g),f);g+=e.textContent.length}for(h=
h.previousSibling;h;h=h.previousSibling){if(b=d(h,h.firstChild,-1))return qb(m(b.line,b.ch+c),f);c+=h.textContent.length}}var U=navigator.userAgent,Zf=navigator.platform,wa=/gecko\/\d/i.test(U),$f=/MSIE \d/.test(U),ag=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(U),Xb=/Edge\/(\d+)/.exec(U),C=$f||ag||Xb,B=C&&($f?document.documentMode||6:+(Xb||ag)[1]),R=!Xb&&/WebKit\//.test(U),fh=R&&/Qt\/\d+\.\d+/.test(U),pc=!Xb&&/Chrome\//.test(U),ja=/Opera\//.test(U),Qf=/Apple Computer/.test(navigator.vendor),gh=
/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(U),yg=/PhantomJS/.test(U),Wb=!Xb&&/AppleWebKit/.test(U)&&/Mobile\/\w+/.test(U),qc=/Android/.test(U),rb=Wb||qc||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(U),ha=Wb||/Mac/.test(Zf),Wg=/\bCrOS\b/.test(U),hh=/win/i.test(Zf),Xa=ja&&U.match(/Version\/(\d*\.\d*)/);Xa&&(Xa=Number(Xa[1]));Xa&&15<=Xa&&(ja=!1,R=!0);var db,Cf=ha&&(fh||ja&&(null==Xa||12.11>Xa)),Kd=wa||C&&9<=B,Ra=function(a,b){var c=a.className,d=ga(b).exec(c);if(d){var e=c.slice(d.index+d[0].length);
a.className=c.slice(0,d.index)+(e?d[1]+e:"")}};db=document.createRange?function(a,b,c,d){var e=document.createRange();return e.setEnd(d||a,c),e.setStart(a,b),e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}return d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d};var Yb=function(a){a.select()};Wb?Yb=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:C&&(Yb=function(a){try{a.select()}catch(b){}});var Wa=
function(){this.id=null};Wa.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var bd,hd,Ud=30,Fc={toString:function(){return"CodeMirror.Pass"}},pa={scroll:!1},Ld={origin:"*mouse"},Zb={origin:"+move"},dc=[""],cg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,dg=/[\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]/,
qf=!1,xa=!1,ub=null,hg=function(){function a(a){return 247>=a?c.charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1785>=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="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",
e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,k=/[1n]/;return function(c,d){var q="ltr"==d?"L":"R";if(0==c.length||"ltr"==d&&!e.test(c))return!1;for(var p=c.length,u=[],m=0;m<p;++m)u.push(a(c.charCodeAt(m)));for(var m=0,r=q;m<p;++m){var t=u[m];"m"==t?u[m]=r:r=t}m=0;for(r=q;m<p;++m)t=u[m],"1"==t&&"r"==r?u[m]="n":g.test(t)&&(r=t,"r"==t&&(u[m]="R"));m=1;for(r=u[0];m<p-1;++m)t=u[m],"+"==t&&"1"==r&&"1"==u[m+1]?u[m]="1":","!=t||r!=u[m+1]||"1"!=r&&"n"!=r||(u[m]=r),r=t;for(m=
0;m<p;++m)if(r=u[m],","==r)u[m]="N";else if("%"==r){r=void 0;for(r=m+1;r<p&&"%"==u[r];++r);for(t=m&&"!"==u[m-1]||r<p&&"1"==u[r]?"1":"N";m<r;++m)u[m]=t;m=r-1}m=0;for(r=q;m<p;++m)t=u[m],"L"==r&&"1"==t?u[m]="L":g.test(t)&&(r=t);for(r=0;r<p;++r)if(f.test(u[r])){m=void 0;for(m=r+1;m<p&&f.test(u[m]);++m);t="L"==(r?u[r-1]:q);for(t=t==("L"==(m<p?u[m]:q))?t?"L":"R":q;r<m;++r)u[r]=t;r=m-1}for(var v,q=[],m=0;m<p;)if(h.test(u[m])){r=m;for(++m;m<p&&h.test(u[m]);++m);q.push(new b(0,r,m))}else{var w=m,r=q.length;
for(++m;m<p&&"L"!=u[m];++m);for(t=w;t<m;)if(k.test(u[t])){w<t&&q.splice(r,0,new b(1,w,t));w=t;for(++t;t<m&&k.test(u[t]);++t);q.splice(r,0,new b(2,w,t));w=t}else++t;w<m&&q.splice(r,0,new b(1,w,m))}return 1==q[0].level&&(v=c.match(/^\s+/))&&(q[0].from=v[0].length,q.unshift(new b(0,0,v[0].length))),1==z(q).level&&(v=c.match(/\s+$/))&&(z(q).to-=v[0].length,q.push(new b(0,p-v[0].length,p))),"rtl"==d?q.reverse():q}}(),lc=[],t=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]||lc).concat(c))},Xg=function(){if(C&&9>B)return!1;var a=r("div");return"draggable"in a||"dragDrop"in a}(),Od=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/)},ih=window.getSelection?function(a){try{return a.selectionStart!=
a.selectionEnd}catch(b){return!1}}:function(a){var b;try{b=a.ownerDocument.selection.createRange()}catch(c){}return!(!b||b.parentElement()!=a)&&0!=b.compareEndPoints("StartToEnd",b)},Rg=function(){var a=r("div");return"oncopy"in a||(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),nd=null,cd={},bb={},cb={},H=function(a,b,c){this.pos=this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.lineOracle=c};H.prototype.eol=function(){return this.pos>=
this.string.length};H.prototype.sol=function(){return this.pos==this.lineStart};H.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};H.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)};H.prototype.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};H.prototype.eatWhile=function(a){for(var b=this.pos;this.eat(a););return this.pos>b};H.prototype.eatSpace=function(){for(var a=
this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};H.prototype.skipToEnd=function(){this.pos=this.string.length};H.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0};H.prototype.backUp=function(a){this.pos-=a};H.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ea(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-
(this.lineStart?ea(this.string,this.lineStart,this.tabSize):0)};H.prototype.indentation=function(){return ea(this.string,null,this.tabSize)-(this.lineStart?ea(this.string,this.lineStart,this.tabSize):0)};H.prototype.match=function(a,b,c){if("string"!=typeof a)return(a=this.string.slice(this.pos).match(a))&&0<a.index?null:(a&&!1!==b&&(this.pos+=a[0].length),a);var d=function(a){return c?a.toLowerCase():a};if(d(this.string.substr(this.pos,a.length))==d(a))return!1!==b&&(this.pos+=a.length),!0};H.prototype.current=
function(){return this.string.slice(this.start,this.pos)};H.prototype.hideFirstChars=function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}};H.prototype.lookAhead=function(a){var b=this.lineOracle;return b&&b.lookAhead(a)};var nc=function(a,b){this.state=a;this.lookAhead=b},sa=function(a,b,c,d){this.state=b;this.doc=a;this.line=c;this.maxLookAhead=d||0};sa.prototype.lookAhead=function(a){var b=this.doc.getLine(this.line+a);return null!=b&&a>this.maxLookAhead&&(this.maxLookAhead=
a),b};sa.prototype.nextLine=function(){this.line++;0<this.maxLookAhead&&this.maxLookAhead--};sa.fromSaved=function(a,b,c){return b instanceof nc?new sa(a,La(a.mode,b.state),c,b.lookAhead):new sa(a,La(a.mode,b),c)};sa.prototype.save=function(a){a=!1!==a?La(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new nc(a,this.maxLookAhead):a};var me=function(a,b,c){this.start=a.start;this.end=a.pos;this.string=a.current();this.type=b||null;this.state=c},hb=function(a,b,c){this.text=a;Yd(this,
b);this.height=c?c(this):1};hb.prototype.lineNo=function(){return D(this)};ab(hb);var Pa,og={},ng={},eb=null,xb=null,Ae={left:0,right:0,top:0,bottom:0},Ya=function(a,b,c){this.cm=c;var d=this.vert=r("div",[r("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=r("div",[r("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(d);a(e);t(d,"scroll",function(){d.clientHeight&&b(d.scrollTop,"vertical")});t(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")});
this.checkedZeroWidth=!1;C&&8>B&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ya.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;c?(this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0",this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight-(b?d:0)))+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0");b?(this.horiz.style.display="block",this.horiz.style.right=
c?d+"px":"0",this.horiz.style.left=a.barLeft+"px",this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(c?d:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0");return!this.checkedZeroWidth&&0<a.clientHeight&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:c?d:0,bottom:b?d:0}};Ya.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,
this.disableHoriz,"horiz")};Ya.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")};Ya.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=ha&&!gh?"12px":"18px";this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new Wa;this.disableVert=new Wa};Ya.prototype.enableZeroWidthBar=function(a,b,c){function d(){var e=a.getBoundingClientRect();
("vert"==c?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1))!=a?a.style.pointerEvents="none":b.set(1E3,d)}a.style.pointerEvents="auto";b.set(1E3,d)};Ya.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};var $b=function(){};$b.prototype.update=function(){return{bottom:0,right:0}};$b.prototype.setScrollLeft=function(){};$b.prototype.setScrollTop=function(){};$b.prototype.clear=function(){};
var Te={"native":Ya,"null":$b},xg=0,vc=function(a,b,c){var d=a.display;this.viewport=b;this.visible=td(d,a.doc,b);this.editorIsHidden=!d.wrapper.offsetWidth;this.wrapperHeight=d.wrapper.clientHeight;this.wrapperWidth=d.wrapper.clientWidth;this.oldDisplayWidth=Ma(a);this.force=c;this.dims=md(a);this.events=[]};vc.prototype.signal=function(a,b){fa(a,b)&&this.events.push(arguments)};vc.prototype.finish=function(){for(var a=0;a<this.events.length;a++)F.apply(null,this.events[a])};var xc=0,ba=null;C?ba=
-.53:wa?ba=15:pc?ba=-.7:Qf&&(ba=-1/3);var ca=function(a,b){this.ranges=a;this.primIndex=b};ca.prototype.primary=function(){return this.ranges[this.primIndex]};ca.prototype.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(!Rc(c.anchor,d.anchor)||!Rc(c.head,d.head))return!1}return!0};ca.prototype.deepCopy=function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=
new A(Sc(this.ranges[b].anchor),Sc(this.ranges[b].head));return new ca(a,this.primIndex)};ca.prototype.somethingSelected=function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1};ca.prototype.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};var A=function(a,b){this.anchor=a;this.head=b};A.prototype.from=function(){return ic(this.anchor,this.head)};A.prototype.to=function(){return hc(this.anchor,
this.head)};A.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};Lb.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;Xd(f);P(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}};Mb.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;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}25>this.size-b&&(1<this.children.length||!(this.children[0]instanceof
Lb))&&(c=[],this.collapse(c),this.children=[new Lb(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){if(e.insertInner(a,b,c),e.lines&&50<e.lines.length){for(b=a=e.lines.length%25+25;b<e.lines.length;)c=new Lb(e.lines.slice(b,b+=25)),e.height-=c.height,this.children.splice(++d,
0,c),c.parent=this;e.lines=e.lines.slice(0,a);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 Mb(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=N(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new Mb(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 Nb=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.doc=a;this.node=b};Nb.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,c=this.line,d=D(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=zb(this);la(c,Math.max(0,c.height-f));a&&(Y(a,function(){var b=-f;na(c)<(a.curOp&&a.curOp.scrollTop||
a.doc.scrollTop)&&tc(a,b);Aa(a,d,"widget")}),P(a,"lineWidgetCleared",a,this,d))}};Nb.prototype.changed=function(){var a=this,b=this.height,c=this.doc.cm,d=this.line;this.height=null;var e=zb(this)-b;e&&(la(d,d.height+e),c&&Y(c,function(){c.curOp.forceUpdate=!0;na(d)<(c.curOp&&c.curOp.scrollTop||c.doc.scrollTop)&&tc(c,e);P(c,"lineWidgetChanged",c,a,D(d))}))};ab(Nb);var vf=0,Ca=function(a,b){this.lines=[];this.type=b;this.doc=a;this.id=++vf};Ca.prototype.clear=function(){if(!this.explicitlyCleared){var a=
this.doc.cm,b=a&&!a.curOp;if(b&&Ta(a),fa(this,"clear")){var c=this.find();c&&P(this,"clear",c.from,c.to)}for(var d=c=null,e=0;e<this.lines.length;++e){var f=this.lines[e],g=tb(f.markedSpans,this);a&&!this.collapsed?Aa(a,D(f),"text"):a&&(null!=g.to&&(d=D(f)),null!=g.from&&(c=D(f)));for(var h=f,k=f.markedSpans,l=g,n=void 0,m=0;m<k.length;++m)k[m]!=l&&(n||(n=[])).push(k[m]);h.markedSpans=n;null==g.from&&this.collapsed&&!Ja(this.doc,f)&&a&&la(f,Oa(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=
0;e<this.lines.length;++e)f=ma(this.lines[e]),g=kc(f),g>a.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=c&&a&&this.collapsed&&V(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&mf(a.doc));a&&P(a,"markerCleared",a,this,c,d);b&&Ua(a);this.parent&&this.parent.clear()}};Ca.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=tb(f.markedSpans,this);if(null!=g.from&&(c=m(b?f:D(f),g.from),-1==a))return c;if(null!=g.to&&(d=m(b?f:D(f),g.to),1==a))return d}return c&&{from:c,to:d}};Ca.prototype.changed=function(){var a=this,b=this.find(-1,!0),c=this,d=this.doc.cm;b&&d&&Y(d,function(){var e=b.line,f=D(b.line),f=ld(d,f);(f&&(Be(f),d.curOp.selectionChanged=d.curOp.forceUpdate=!0),d.curOp.updateMaxLine=!0,Ja(c.doc,e)||null==c.height)||(f=c.height,c.height=null,(f=zb(c)-f)&&la(e,e.height+f));P(d,"markerChanged",d,
a)})};Ca.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=N(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};Ca.prototype.detachLine=function(a){if(this.lines.splice(N(this.lines,a),1),!this.lines.length&&this.doc.cm)a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this)};ab(Ca);var Ob=function(a,b){this.markers=a;this.primary=b;for(var c=
0;c<a.length;++c)a[c].parent=this};Ob.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();P(this,"clear")}};Ob.prototype.find=function(a,b){return this.primary.find(a,b)};ab(Ob);var jh=0,W=function(a,b,c,d,e){if(!(this instanceof W))return new W(a,b,c,d,e);null==c&&(c=0);Mb.call(this,[new Lb([new hb("",null)])]);this.first=c;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.modeFrontier=
this.highlightFrontier=c;c=m(c,0);this.sel=ua(c);this.history=new yc(null);this.id=++jh;this.modeOption=b;this.lineSep=d;this.direction="rtl"==e?"rtl":"ltr";this.extend=!1;"string"==typeof a&&(a=this.splitLines(a));Cd(this,{from:c,to:c,text:a});Q(this,ua(c),pa)};W.prototype=Rd(Mb.prototype,{constructor:W,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=Pc(this,this.first,this.first+this.size);return!1===a?b:b.join(a||this.lineSeparator())},setValue:M(function(a){var b=m(this.first,0),c=this.first+this.size-1;kb(this,{from:b,to:m(c,w(this,c).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0);this.cm&&Eb(this.cm,0,0);Q(this,ua(b),pa)}),replaceRange:function(a,b,c,d){b=v(this,b);c=c?v(this,c):b;lb(this,a,b,c,d)},getRange:function(a,b,c){a=Ga(this,
v(this,a),v(this,b));return!1===c?a:a.join(c||this.lineSeparator())},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(sb(this,a))return w(this,a)},getLineNumber:function(a){return D(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=w(this,a)),ma(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return v(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:M(function(a,b,c){a=v(this,"number"==typeof a?m(a,b||0):a);Q(this,ua(a,null),c)}),setSelection:M(function(a,b,c){var d=v(this,a);a=v(this,b||a);Q(this,ua(d,a),c)}),extendSelection:M(function(a,b,c){Ac(this,v(this,a),b&&v(this,b),c)}),extendSelections:M(function(a,
b){hf(this,Vd(this,a),b)}),extendSelectionsBy:M(function(a,b){hf(this,Vd(this,ec(this.sel.ranges,a)),b)}),setSelections:M(function(a,b,c){if(a.length){for(var d=[],e=0;e<a.length;e++)d[e]=new A(v(this,a[e].anchor),v(this,a[e].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));Q(this,ka(d,b),c)}}),addSelection:M(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new A(v(this,a),v(this,b||a)));Q(this,ka(d,d.length-1),c)}),getSelection:function(a){for(var b,c=this.sel.ranges,d=0;d<c.length;d++){var e=
Ga(this,c[d].from(),c[d].to());b=b?b.concat(e):e}return!1===a?b:b.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=Ga(this,c[d].from(),c[d].to());!1!==a&&(e=e.join(a||this.lineSeparator()));b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:M(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:this.splitLines(a[f]),origin:c}}if(a=b&&"end"!=b){a=[];e=c=m(this.first,0);for(f=0;f<d.length;f++){var h=d[f],g=$e(h.from,c,e),k=$e(Ba(h),c,e);(c=h.to,e=k,"around"==b)?(h=this.sel.ranges[f],h=0>x(h.head,h.anchor),a[f]=new A(h?k:g,h?g:k)):a[f]=new A(g,g)}a=new ca(a,this.sel.primIndex)}b=a;for(a=d.length-1;0<=a;a--)kb(this,d[a]);b?jf(this,b):this.cm&&fb(this.cm)}),undo:M(function(){Cc(this,"undo")}),redo:M(function(){Cc(this,"redo")}),undoSelection:M(function(){Cc(this,
"undo",!0)}),redoSelection:M(function(){Cc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},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 yc(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){return a&&
(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:ib(this.history.done),undone:ib(this.history.undone)}},setHistory:function(a){var b=this.history=new yc(this.history.maxGeneration);b.done=ib(a.done.slice(0),null,!0);b.undone=ib(a.undone.slice(0),null,!0)},setGutterMarker:M(function(a,b,c){return Kb(this,a,"gutter",function(a){var e=a.gutterMarkers||
(a.gutterMarkers={});return e[b]=c,!c&&Sd(e)&&(a.gutterMarkers=null),!0})}),clearGutter:M(function(a){var b=this;this.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&Kb(b,c,"gutter",function(){return c.gutterMarkers[a]=null,Sd(c.gutterMarkers)&&(c.gutterMarkers=null),!0})})}),lineInfo:function(a){var b;if("number"==typeof a){if(!(sb(this,a)&&(b=a,a=w(this,a))))return null}else if(null==(b=D(a)))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}},addLineClass:M(function(a,b,c){return Kb(this,a,"gutter"==b?"gutter":"class",function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";if(a[e]){if(ga(c).test(a[e]))return!1;a[e]+=" "+c}else a[e]=c;return!0})}),removeLineClass:M(function(a,b,c){return Kb(this,a,"gutter"==b?"gutter":"class",function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",f=
a[e];if(!f)return!1;if(null==c)a[e]=null;else{var g=f.match(ga(c));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}return!0})}),addLineWidget:M(function(a,b,c){return Gg(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return mb(this,v(this,a),v(this,b),c,c&&c.type||"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&
b.shared,handleMouseEvents:b&&b.handleMouseEvents};return a=v(this,a),mb(this,a,a,c,"bookmark")},findMarksAt:function(a){a=v(this,a);var b=[],c=w(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,c){a=v(this,a);b=v(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,function(f){if(f=f.markedSpans)for(var g=0;g<f.length;g++){var h=f[g];null!=h.to&&e==
a.line&&a.ch>=h.to||null==h.from&&e!=a.line||null!=h.from&&e==b.line&&h.from>=b.ch||c&&!c(h.marker)||d.push(h.marker.parent||h.marker)}++e}),d},getAllMarks:function(){var a=[];return 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)}),a},posFromIndex:function(a){var b,c=this.first,d=this.lineSeparator().length;return this.iter(function(e){e=e.text.length+d;if(e>a)return b=a,!0;a-=e;++c}),v(this,m(c,b))},indexFromPos:function(a){a=v(this,a);var b=
a.ch;if(a.line<this.first||0>a.ch)return 0;var c=this.lineSeparator().length;return this.iter(this.first,a.line,function(a){b+=a.text.length+c}),b},copy:function(a){var b=new W(Pc(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return 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())),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 W(Pc(this,b,c),a.mode||this.modeOption,b,this.lineSep,this.direction);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}];a=wf(this);for(c=0;c<a.length;c++){var d=a[c],e=d.find(),f=b.clipPos(e.from),e=b.clipPos(e.to);x(f,e)&&(f=mb(b,f,e,d.primary,d.primary.type),d.markers.push(f),f.parent=d)}return b},unlinkDoc:function(a){if(a instanceof
E&&(a=a.doc),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);Ig(wf(this));break}if(a.history==this.history){var c=[a.id];Va(a,function(a){return c.push(a.id)},!0);a.history=new yc(null);a.history.done=ib(this.history.done,c);a.history.undone=ib(this.history.undone,c)}},iterLinkedDocs:function(a){Va(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(a){return this.lineSep?a.split(this.lineSep):
Od(a)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:M(function(a){"rtl"!=a&&(a="ltr");a!=this.direction&&(this.direction=a,this.iter(function(a){return a.order=null}),this.cm&&Cg(this.cm))})});W.prototype.eachLine=W.prototype.iter;for(var yf=0,Pf=!1,Da={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:"\x3d",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"\x3d",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"\x3d",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"},ac=0;10>ac;ac++)Da[ac+48]=Da[ac+96]=String(ac);for(var Ic=65;90>=Ic;Ic++)Da[Ic]=String.fromCharCode(Ic);for(var bc=1;12>=bc;bc++)Da[bc+111]=Da[bc+63235]=
"F"+bc;var Pb={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"},pcDefault:{"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart",
"Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","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"},
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","Ctrl-O":"openLine"},macDefault:{"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo",
"Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","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":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight",
"Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]}};Pb["default"]=ha?Pb.macDefault:Pb.pcDefault;var Qb={selectAll:of,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),pa)},killLine:function(a){return ob(a,function(b){if(b.empty()){var c=w(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:m(b.head.line+1,0)}:{from:b.head,to:m(b.head.line,
c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return ob(a,function(b){return{from:m(b.from().line,0),to:v(a.doc,m(b.to().line+1,0))}})},delLineLeft:function(a){return ob(a,function(a){return{from:m(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return ob(a,function(b){var c=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,top:c},"div"),to:b.from()}})},delWrappedLineRight:function(a){return ob(a,function(b){var c=a.charCoords(b.head,"div").top+5,c=
a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:c}})},undo:function(a){return a.undo()},redo:function(a){return a.redo()},undoSelection:function(a){return a.undoSelection()},redoSelection:function(a){return a.redoSelection()},goDocStart:function(a){return a.extendSelection(m(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(m(a.lastLine()))},goLineStart:function(a){return a.extendSelectionsBy(function(b){return Ef(a,b.head.line)},{origin:"+move",
bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return Ff(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){b=b.head.line;var c=w(a.doc,b),d;d=c;for(var e;e=Ia(d,!1);)d=e.find(1,!0).line;return d!=c&&(b=D(d)),$c(!0,a,c,b,-1)},{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy(function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},
"div")},Zb)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},Zb)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5,c=a.coordsChar({left:0,top:c},"div");return c.ch<a.getLine(c.line).search(/\S/)?Ff(a,b.head):c},Zb)},goLineUp:function(a){return a.moveV(-1,"line")},goLineDown:function(a){return a.moveV(1,"line")},goPageUp:function(a){return a.moveV(-1,
"page")},goPageDown:function(a){return a.moveV(1,"page")},goCharLeft:function(a){return a.moveH(-1,"char")},goCharRight:function(a){return a.moveH(1,"char")},goColumnLeft:function(a){return a.moveH(-1,"column")},goColumnRight:function(a){return a.moveH(1,"column")},goWordLeft:function(a){return a.moveH(-1,"word")},goGroupRight:function(a){return a.moveH(1,"group")},goGroupLeft:function(a){return a.moveH(-1,"group")},goWordRight:function(a){return a.moveH(1,"word")},delCharBefore:function(a){return a.deleteH(-1,
"char")},delCharAfter:function(a){return a.deleteH(1,"char")},delWordBefore:function(a){return a.deleteH(-1,"word")},delWordAfter:function(a){return a.deleteH(1,"word")},delGroupBefore:function(a){return a.deleteH(-1,"group")},delGroupAfter:function(a){return a.deleteH(1,"group")},indentAuto:function(a){return a.indentSelection("smart")},indentMore:function(a){return a.indentSelection("add")},indentLess:function(a){return a.indentSelection("subtract")},insertTab:function(a){return a.replaceSelection("\t")},
insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from(),f=ea(a.getLine(f.line),f.ch,d);b.push(Mc(d-f%d))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return Y(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++)if(b[d].empty()){var e=b[d].head,f=w(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new m(e.line,e.ch-1)),0<e.ch)e=
new m(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),m(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=w(a.doc,e.line-1).text;g&&(e=new m(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),m(e.line-1,g.length-1),e,"+transpose"))}c.push(new A(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return Y(a,function(){for(var b=a.listSelections(),c=b.length-1;0<=c;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");
b=a.listSelections();for(c=0;c<b.length;c++)a.indentLine(b[c].from().line,null,!0);fb(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},Pg=new Wa,Hd=null,Id=function(a,b,c){this.time=a;this.pos=b;this.button=c};Id.prototype.compare=function(a,b,c){return this.time+400>a&&0==x(b,this.pos)&&c==this.button};var Tb,Sb,pb={toString:function(){return"CodeMirror.Init"}},Of={},Gc={};E.defaults=Of;E.optionHandlers=Gc;var Md=[];E.defineInitHook=
function(a){return Md.push(a)};var da=null,y=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Wa;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};y.prototype.init=function(a){function b(a){if(!K(e,a)){if(e.somethingSelected())Rf({lineWise:!1,text:e.getSelections()}),"cut"==a.type&&e.replaceSelection("",null,"cut");else{if(!e.options.lineWiseCopyCut)return;var b=Uf(e);Rf({lineWise:!0,text:b.text});"cut"==
a.type&&e.operation(function(){e.setSelections(b.ranges,0,pa);e.replaceSelection("",null,"cut")})}if(a.clipboardData){a.clipboardData.clearData();var c=da.text.join("\n");if(a.clipboardData.setData("Text",c),a.clipboardData.getData("Text")==c)return void a.preventDefault()}var l=Wf();a=l.firstChild;e.display.lineSpace.insertBefore(l,e.display.lineSpace.firstChild);a.value=da.text.join("\n");var n=document.activeElement;Yb(a);setTimeout(function(){e.display.lineSpace.removeChild(l);n.focus();n==f&&
d.showPrimarySelection()},50)}}var c=this,d=this,e=d.cm,f=d.div=a.lineDiv;Vf(f,e.options.spellcheck);t(f,"paste",function(a){K(e,a)||Tf(a,e)||11>=B&&setTimeout(L(e,function(){return c.updateFromDOM()}),20)});t(f,"compositionstart",function(a){c.composing={data:a.data,done:!1}});t(f,"compositionupdate",function(a){c.composing||(c.composing={data:a.data,done:!1})});t(f,"compositionend",function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)});t(f,"touchstart",function(){return d.forceCompositionEnd()});
t(f,"input",function(){c.composing||c.readFromDOMSoon()});t(f,"copy",b);t(f,"cut",b)};y.prototype.prepareSelection=function(){var a=Ie(this.cm,!1);return a.focus=this.cm.state.focused,a};y.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};y.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm,c=b.doc.sel.primary(),d=c.from(),c=c.to();if(b.display.viewTo==b.display.viewFrom||d.line>=
b.display.viewTo||c.line<b.display.viewFrom)return void a.removeAllRanges();var e=Hc(b,a.anchorNode,a.anchorOffset),f=Hc(b,a.focusNode,a.focusOffset);if(!e||e.bad||!f||f.bad||0!=x(ic(e,f),d)||0!=x(hc(e,f),c)){e=b.display.view;d=d.line>=b.display.viewFrom&&Yf(b,d)||{node:e[0].measure.map[2],offset:0};c=c.line<b.display.viewTo&&Yf(b,c);c||(c=e[e.length-1].measure,c=c.maps?c.maps[c.maps.length-1]:c.map,c={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]});if(!d||!c)return void a.removeAllRanges();
var g,e=a.rangeCount&&a.getRangeAt(0);try{g=db(d.node,d.offset,c.offset,c.node)}catch(h){}g&&(!wa&&b.state.focused?(a.collapse(d.node,d.offset),g.collapsed||(a.removeAllRanges(),a.addRange(g))):(a.removeAllRanges(),a.addRange(g)),e&&null==a.anchorNode?a.addRange(e):wa&&this.startGracePeriod());this.rememberSelection()}};y.prototype.startGracePeriod=function(){var a=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){a.gracePeriod=!1;a.selectionChanged()&&a.cm.operation(function(){return a.cm.curOp.selectionChanged=
!0})},20)};y.prototype.showMultipleSelections=function(a){Z(this.cm.display.cursorDiv,a.cursors);Z(this.cm.display.selectionDiv,a.selection)};y.prototype.rememberSelection=function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};y.prototype.selectionInEditor=function(){var a=window.getSelection();if(!a.rangeCount)return!1;a=a.getRangeAt(0).commonAncestorContainer;return va(this.div,
a)};y.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())};y.prototype.blur=function(){this.div.blur()};y.prototype.getField=function(){return this.div};y.prototype.supportsTouch=function(){return!0};y.prototype.receivedFocus=function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():Y(this.cm,
function(){return b.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,a)};y.prototype.selectionChanged=function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};y.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;if(qc&&pc&&this.cm.options.gutters.length&&
ch(a.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var c=Hc(b,a.anchorNode,a.anchorOffset),d=Hc(b,a.focusNode,a.focusOffset);c&&d&&Y(b,function(){Q(b.doc,ua(c,d),pa);(c.bad||d.bad)&&(b.curOp.selectionChanged=!0)})}}};y.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var a=this.cm,b=a.display,c=a.doc.sel.primary(),
d=c.from(),c=c.to();if(0==d.ch&&d.line>a.firstLine()&&(d=m(d.line-1,w(a.doc,d.line-1).length)),c.ch==w(a.doc,c.line).text.length&&c.line<a.lastLine()&&(c=m(c.line+1,0)),d.line<b.viewFrom||c.line>b.viewTo-1)return!1;var e,f,g;d.line==b.viewFrom||0==(e=Na(a,d.line))?(f=D(b.view[0].line),g=b.view[0].node):(f=D(b.view[e].line),g=b.view[e-1].node.nextSibling);var h,k;e=Na(a,c.line);if(e==b.view.length-1?(h=b.viewTo-1,k=b.lineDiv.lastChild):(h=D(b.view[e+1].line)-1,k=b.view[e+1].node.previousSibling),!g)return!1;
b=a.doc.splitLines(dh(a,g,k,f,h));for(g=Ga(a.doc,m(f,0),m(h,w(a.doc,h).text.length));1<b.length&&1<g.length;)if(z(b)==z(g))b.pop(),g.pop(),h--;else{if(b[0]!=g[0])break;b.shift();g.shift();f++}k=e=0;for(var c=b[0],l=g[0],n=Math.min(c.length,l.length);e<n&&c.charCodeAt(e)==l.charCodeAt(e);)++e;c=z(b);l=z(g);for(n=Math.min(c.length-(1==b.length?e:0),l.length-(1==g.length?e:0));k<n&&c.charCodeAt(c.length-k-1)==l.charCodeAt(l.length-k-1);)++k;if(1==b.length&&1==g.length&&f==d.line)for(;e&&e>d.ch&&c.charCodeAt(c.length-
k-1)==l.charCodeAt(l.length-k-1);)e--,k++;b[b.length-1]=c.slice(0,c.length-k).replace(/^\u200b+/,"");b[0]=b[0].slice(e).replace(/\u200b+$/,"");d=m(f,e);h=m(h,g.length?z(g).length-k:0);return 1<b.length||b[0]||x(d,h)?(lb(a.doc,b,d,h,"+input"),!0):void 0};y.prototype.ensurePolled=function(){this.forceCompositionEnd()};y.prototype.reset=function(){this.forceCompositionEnd()};y.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),
this.div.blur(),this.div.focus())};y.prototype.readFromDOMSoon=function(){var a=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(a.readDOMTimeout=null,a.composing){if(!a.composing.done)return;a.composing=null}a.updateFromDOM()},80))};y.prototype.updateFromDOM=function(){var a=this;!this.cm.isReadOnly()&&this.pollContent()||Y(this.cm,function(){return V(a.cm)})};y.prototype.setUneditable=function(a){a.contentEditable="false"};y.prototype.onKeyPress=function(a){0!=a.charCode&&
(a.preventDefault(),this.cm.isReadOnly()||L(this.cm,Nd)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0))};y.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)};y.prototype.onContextMenu=function(){};y.prototype.resetPosition=function(){};y.prototype.needsContentAttribute=!0;var I=function(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=new Wa;this.hasSelection=!1;this.composing=null};I.prototype.init=function(a){function b(a){if(!K(e,
a)){if(e.somethingSelected())da={lineWise:!1,text:e.getSelections()};else{if(!e.options.lineWiseCopyCut)return;var b=Uf(e);da={lineWise:!0,text:b.text};"cut"==a.type?e.setSelections(b.ranges,null,pa):(d.prevInput="",g.value=b.text.join("\n"),Yb(g))}"cut"==a.type&&(e.state.cutIncoming=!0)}}var c=this,d=this,e=this.cm,f=this.wrapper=Wf(),g=this.textarea=f.firstChild;a.wrapper.insertBefore(f,a.wrapper.firstChild);Wb&&(g.style.width="0px");t(g,"input",function(){C&&9<=B&&c.hasSelection&&(c.hasSelection=
null);d.poll()});t(g,"paste",function(a){K(e,a)||Tf(a,e)||(e.state.pasteIncoming=!0,d.fastPoll())});t(g,"cut",b);t(g,"copy",b);t(a.scroller,"paste",function(b){ta(a,b)||K(e,b)||(e.state.pasteIncoming=!0,d.focus())});t(a.lineSpace,"selectstart",function(b){ta(a,b)||S(b)});t(g,"compositionstart",function(){var a=e.getCursor("from");d.composing&&d.composing.range.clear();d.composing={start:a,range:e.markText(a,e.getCursor("to"),{className:"CodeMirror-composing"})}});t(g,"compositionend",function(){d.composing&&
(d.poll(),d.composing.range.clear(),d.composing=null)})};I.prototype.prepareSelection=function(){var a=this.cm,b=a.display,c=a.doc,d=Ie(a);if(a.options.moveInputWithCursor){var a=ia(a,c.sel.primary().head,"div"),c=b.wrapper.getBoundingClientRect(),e=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-c.top));d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+e.left-c.left))}return d};I.prototype.showSelection=function(a){var b=this.cm.display;
Z(b.cursorDiv,a.cursors);Z(b.selectionDiv,a.selection);null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")};I.prototype.reset=function(a){if(!this.contextMenuPending&&!this.composing){var b=this.cm;b.somethingSelected()?(this.prevInput="",a=b.getSelection(),this.textarea.value=a,b.state.focused&&Yb(this.textarea),C&&9<=B&&(this.hasSelection=a)):a||(this.prevInput=this.textarea.value="",C&&9<=B&&(this.hasSelection=null))}};I.prototype.getField=function(){return this.textarea};
I.prototype.supportsTouch=function(){return!1};I.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!rb||qa()!=this.textarea))try{this.textarea.focus()}catch(a){}};I.prototype.blur=function(){this.textarea.blur()};I.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};I.prototype.receivedFocus=function(){this.slowPoll()};I.prototype.slowPoll=function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){a.poll();a.cm.state.focused&&
a.slowPoll()})};I.prototype.fastPoll=function(){function a(){c.poll()||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0;c.polling.set(20,a)};I.prototype.poll=function(){var a=this,b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||ih(c)&&!d&&!this.composing||b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=c.value;if(e==d&&!b.somethingSelected())return!1;if(C&&9<=B&&this.hasSelection===e||ha&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),
!1;if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);if(8203!=f||d||(d="​"),8666==f)return this.reset(),this.cm.execCommand("undo")}for(var g=0,f=Math.min(d.length,e.length);g<f&&d.charCodeAt(g)==e.charCodeAt(g);)++g;return Y(b,function(){Nd(b,e.slice(g),d.length-g,null,a.composing?"*compose":null);1E3<e.length||-1<e.indexOf("\n")?c.value=a.prevInput="":a.prevInput=e;a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))}),
!0};I.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};I.prototype.onKeyPress=function(){C&&9<=B&&(this.hasSelection=null);this.fastPoll()};I.prototype.onContextMenu=function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b="​"+(a?g.value:"");g.value="⇚";g.value=b;d.prevInput=a?"":"​";g.selectionStart=1;g.selectionEnd=b.length;f.selForContextMenu=e.doc.sel}}function c(){if(d.contextMenuPending=!1,d.wrapper.style.cssText=n,g.style.cssText=
l,C&&9>B&&f.scrollbars.setScrollTop(f.scroller.scrollTop=k),null!=g.selectionStart){(!C||C&&9>B)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&0<g.selectionEnd&&"​"==d.prevInput?L(e,of)(e):10>a++?f.detectingSelectAll=setTimeout(c,500):(f.selForContextMenu=null,f.input.reset())};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=Qa(e,a),k=f.scroller.scrollTop;if(h&&!ja){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(h)&&
L(e,Q)(e.doc,ua(h),pa);var l=g.style.cssText,n=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";h=d.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(a.clientY-h.top-5)+"px; left: "+(a.clientX-h.left-5)+"px;\n      z-index: 1000; background: "+(C?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity\x3d5);";var m;if(R&&
(m=window.scrollY),f.input.focus(),R&&window.scrollTo(null,m),f.input.reset(),e.somethingSelected()||(g.value=d.prevInput=" "),d.contextMenuPending=!0,f.selForContextMenu=e.doc.sel,clearTimeout(f.detectingSelectAll),C&&9<=B&&b(),Kd){vb(a);var p=function(){aa(window,"mouseup",p);setTimeout(c,20)};t(window,"mouseup",p)}else setTimeout(c,50)}};I.prototype.readOnlyChanged=function(a){a||this.reset();this.textarea.disabled="nocursor"==a};I.prototype.setUneditable=function(){};I.prototype.needsContentAttribute=
!1;(function(a){function b(b,e,f,g){a.defaults[b]=e;f&&(c[b]=g?function(a,b,c){c!=pb&&f(a,b,c)}:f)}var c=a.optionHandlers;a.defineOption=b;a.Init=pb;b("value","",function(a,b){return a.setValue(b)},!0);b("mode",null,function(a,b){a.doc.modeOption=b;Bd(a)},!0);b("indentUnit",2,Bd,!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(a){Ib(a);Bb(a);V(a)},!0);b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b,b){var c=[],g=a.doc.first;a.doc.iter(function(a){for(var d=0;;){var h=
a.text.indexOf(b,d);if(-1==h)break;d=h+b.length;c.push(m(g,h))}g++});for(var h=c.length-1;0<=h;h--)lb(a.doc,b,c[h],m(c[h].line,c[h].ch+b.length))}});b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g");c!=pb&&a.refresh()});b("specialCharPlaceholder",rg,function(a){return a.refresh()},!0);b("electricChars",!0);b("inputStyle",rb?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor");
},!0);b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0);b("rtlMoveVisually",!hh);b("wholeLineUpdateBefore",!0);b("theme","default",function(a){Nf(a);Ub(a)},!0);b("keyMap","default",function(a,b,c){b=Dc(b);(c=c!=pb&&Dc(c))&&c.detach&&c.detach(a,b);b.attach&&b.attach(a,c||null)});b("extraKeys",null);b("configureMouse",null);b("lineWrapping",!1,ah,!0);b("gutters",[],function(a){zd(a.options);Ub(a)},!0);b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?pd(a.display)+
"px":"0";a.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(a){return gb(a)},!0);b("scrollbarStyle","native",function(a){Se(a);gb(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0);b("lineNumbers",!1,function(a){zd(a.options);Ub(a)},!0);b("firstLineNumber",1,Ub,!0);b("lineNumberFormatter",function(a){return a},Ub,!0);b("showCursorWhenSelecting",!1,Cb,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("pasteLinesPerSelection",
!0);b("readOnly",!1,function(a,b){"nocursor"==b&&(Db(a),a.display.input.blur());a.display.input.readOnlyChanged(b)});b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0);b("dragDrop",!0,$g);b("allowDropFileTypes",null);b("cursorBlinkRate",530);b("cursorScrollMargin",0);b("cursorHeight",1,Cb,!0);b("singleCursorHeightPerLine",!0,Cb,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,Ib,!0);b("addModeClass",!1,Ib,!0);b("pollInterval",100);b("undoDepth",200,function(a,b){return a.doc.history.undoDepth=
b});b("historyEventDelay",1250);b("viewportMargin",10,function(a){return a.refresh()},!0);b("maxHighlightLength",1E4,Ib,!0);b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()});b("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""});b("autofocus",null);b("direction","ltr",function(a,b){return a.doc.setDirection(b)},!0)})(E);(function(a){var b=a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},
setOption:function(a,c){var f=this.options,g=f[a];f[a]==c&&"mode"!=a||(f[a]=c,b.hasOwnProperty(a)&&L(this,b[a])(this,c,g),F(this,"optionChange",this,a))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](Dc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||b[c].name==a)return b.splice(c,1),!0},addOverlay:T(function(b,c){var f=b.token?b:a.getMode(this.options,b);if(f.startState)throw Error("Overlays may not be stateful.");
bg(this.state.overlays,{mode:f,modeSpec:b,opaque:c&&c.opaque,priority:c&&c.priority||0},function(a){return a.priority});this.state.modeGen++;V(this)}),removeOverlay:T(function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var g=b[c].modeSpec;if(g==a||"string"==typeof a&&g.name==a)return b.splice(c,1),this.state.modeGen++,void V(this)}}),indentLine:T(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");sb(this.doc,a)&&
Vb(this,a,b,c)}),indentSelection:T(function(a){for(var b=this.doc.sel.ranges,c=-1,g=0;g<b.length;g++){var h=b[g];if(h.empty())h.head.line>c&&(Vb(this,h.head.line,a,!0),c=h.head.line,g==this.doc.sel.primIndex&&fb(this));else{for(var k=h.from(),h=h.to(),l=Math.max(c,k.line),c=Math.min(this.lastLine(),h.line-(h.ch?0:1))+1,h=l;h<c;++h)Vb(this,h,a);h=this.doc.sel.ranges;0==k.ch&&b.length==h.length&&0<h[g].from().ch&&Fd(this.doc,g,new A(k,h[g].to()),pa)}}}),getTokenAt:function(a,b){return le(this,a,b)},
getLineTokens:function(a,b){return le(this,m(a),b,!0)},getTokenTypeAt:function(a){a=v(this.doc,a);var b;b=je(this,w(this.doc,a.line));var c=0,g=(b.length-1)/2;a=a.ch;if(0==a)b=b[2];else for(;;){var h=c+g>>1;if((h?b[2*h-1]:0)>=a)g=h;else{if(!(b[2*h+1]<a)){b=b[2*h+2];break}c=h+1}}c=b?b.indexOf("overlay "):-1;return 0>c?b:0==c?null:b.slice(0,c-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,
b)[0]},getHelpers:function(a,b){var f=[];if(!c.hasOwnProperty(b))return f;var g=c[b],h=this.getModeAt(a);if("string"==typeof h[b])g[h[b]]&&f.push(g[h[b]]);else if(h[b])for(var k=0;k<h[b].length;k++){var l=g[h[b][k]];l&&f.push(l)}else h.helperType&&g[h.helperType]?f.push(g[h.helperType]):g[h.name]&&f.push(g[h.name]);for(k=0;k<g._global.length;k++)l=g._global[k],l.pred(h,this)&&-1==N(f,l.val)&&f.push(l.val);return f},getStateAfter:function(a,b){var c=this.doc;return a=Math.max(c.first,Math.min(null==
a?c.first+c.size-1:a,c.first+c.size-1)),wb(this,a+1,b).state},cursorCoords:function(a,b){var c,g=this.doc.sel.primary();return c=null==a?g.head:"object"==typeof a?v(this.doc,a):a?g.from():g.to(),ia(this,c,b||"page")},charCoords:function(a,b){return rc(this,v(this.doc,a),b||"page")},coordsChar:function(a,b){return a=Fe(this,a,b||"page"),od(this,a.left,a.top)},lineAtHeight:function(a,b){return a=Fe(this,{top:a,left:0},b||"page").top,Ha(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,
c){var g=!1;if("number"==typeof a){var h=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>h&&(a=h,g=!0);a=w(this.doc,a)}return Ka(this,a,{top:0,left:0},b||"page",c||g).top+(g?this.doc.height-na(a):0)},defaultTextHeight:function(){return Oa(this.display)},defaultCharWidth:function(){return Ab(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,g,h){var k=this.display;a=ia(this,v(this.doc,a));var l=a.bottom,n=a.left;
if(b.style.position="absolute",b.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(b),k.sizer.appendChild(b),"over"==g)l=a.top;else if("above"==g||"near"==g){var m=Math.max(k.wrapper.clientHeight,this.doc.height),p=Math.max(k.sizer.clientWidth,k.lineSpace.clientWidth);("above"==g||a.bottom+b.offsetHeight>m)&&a.top>b.offsetHeight?l=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=m&&(l=a.bottom);n+b.offsetWidth>p&&(n=p-b.offsetWidth)}b.style.top=l+"px";b.style.left=b.style.right=
"";"right"==h?(n=k.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==h?n=0:"middle"==h&&(n=(k.sizer.clientWidth-b.offsetWidth)/2),b.style.left=n+"px");c&&(a=vd(this,{left:n,top:l,right:n+b.offsetWidth,bottom:l+b.offsetHeight}),null!=a.scrollTop&&Fb(this,a.scrollTop),null!=a.scrollLeft&&Sa(this,a.scrollLeft))},triggerOnKeyDown:T(Hf),triggerOnKeyPress:T(Jf),triggerOnKeyUp:If,triggerOnMouseDown:T(Kf),execCommand:function(a){if(Qb.hasOwnProperty(a))return Qb[a].call(null,this)},triggerElectric:T(function(a){Sf(this,
a)}),findPosH:function(a,b,c,g){var h=1;0>b&&(h=-1,b=-b);a=v(this.doc,a);for(var k=0;k<b&&(a=Pd(this.doc,a,h,c,g),!a.hitSide);++k);return a},moveH:T(function(a,b){var c=this;this.extendSelectionsBy(function(g){return c.display.shift||c.doc.extend||g.empty()?Pd(c.doc,g.head,a,b,c.options.rtlMoveVisually):0>a?g.from():g.to()},Zb)}),deleteH:T(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):ob(this,function(g){var h=Pd(c,g.head,a,b,!1);return 0>a?{from:h,
to:g.head}:{from:g.head,to:h}})}),findPosV:function(a,b,c,g){var h=1;0>b&&(h=-1,b=-b);a=v(this.doc,a);for(var k=0;k<b;++k){var l=ia(this,a,"div");if(null==g?g=l.left:l.left=g,a=Xf(this,l,h,c),a.hitSide)break}return a},moveV:T(function(a,b){var c=this,g=this.doc,h=[],k=!this.display.shift&&!g.extend&&g.sel.somethingSelected();if(g.extendSelectionsBy(function(l){if(k)return 0>a?l.from():l.to();var m=ia(c,l.head,"div");null!=l.goalColumn&&(m.left=l.goalColumn);h.push(m.left);var p=Xf(c,m,a,b);return"page"==
b&&l==g.sel.primary()&&tc(c,rc(c,p,"div").top-m.top),p},Zb),h.length)for(var l=0;l<g.sel.ranges.length;l++)g.sel.ranges[l].goalColumn=h[l]}),findWordAt:function(a){var b=w(this.doc,a.line).text,c=a.ch,g=a.ch;if(b){var h=this.getHelper(a,"wordChars");"before"!=a.sticky&&g!=b.length||!c?++g:--c;for(var k=b.charAt(c),k=fc(k,h)?function(a){return fc(a,h)}:/\s/.test(k)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!fc(a)};0<c&&k(b.charAt(c-1));)--c;for(;g<b.length&&k(b.charAt(g));)++g}return new A(m(a.line,
c),m(a.line,g))},toggleOverwrite:function(a){null!=a&&a==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?Ea(this.display.cursorDiv,"CodeMirror-overwrite"):Ra(this.display.cursorDiv,"CodeMirror-overwrite"),F(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==qa()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:T(function(a,b){Eb(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller;
return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-oa(this)-this.display.barHeight,width:a.scrollWidth-oa(this)-this.display.barWidth,clientHeight:kd(this),clientWidth:Ma(this)}},scrollIntoView:T(function(a,b){null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:m(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){var c=a;uc(this);this.curOp.scrollToPos=c}else Pe(this,
a.from,a.to,a.margin)}),setSize:T(function(a,b){var c=this,g=function(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a};null!=a&&(this.display.wrapper.style.width=g(a));null!=b&&(this.display.wrapper.style.height=g(b));this.options.lineWrapping&&Ce(this);var h=this.display.viewFrom;this.doc.iter(h,this.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){Aa(c,h,"widget");break}++h});this.curOp.forceUpdate=!0;F(this,"refresh",this)}),operation:function(a){return Y(this,
a)},startOperation:function(){return Ta(this)},endOperation:function(){return Ua(this)},refresh:T(function(){var a=this.display.cachedTextHeight;V(this);this.curOp.forceUpdate=!0;Bb(this);Eb(this,this.doc.scrollLeft,this.doc.scrollTop);ud(this);(null==a||.5<Math.abs(a-Oa(this.display)))&&qd(this);F(this,"refresh",this)}),swapDoc:T(function(a){var b=this.doc;return b.cm=null,bf(this,a),Bb(this),this.display.input.reset(),Eb(this,a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,P(this,"swapDoc",
this,b),b}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};ab(a);a.registerHelper=function(b,e,f){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]});c[b][e]=f};a.registerGlobalHelper=function(b,e,f,g){a.registerHelper(b,e,g);c[b]._global.push({pred:f,val:g})}})(E);var kh="iter insert remove copy getEditor constructor".split(" "),
cc;for(cc in W.prototype)W.prototype.hasOwnProperty(cc)&&0>N(kh,cc)&&(E.prototype[cc]=function(a){return function(){return a.apply(this.doc,arguments)}}(W.prototype[cc]));return ab(W),E.inputStyles={textarea:I,contenteditable:y},E.defineMode=function(a){E.defaults.mode||"null"==a||(E.defaults.mode=a);jg.apply(this,arguments)},E.defineMIME=function(a,b){bb[a]=b},E.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}}),E.defineMIME("text/plain","null"),E.defineExtension=function(a,
b){E.prototype[a]=b},E.defineDocExtension=function(a,b){W.prototype[a]=b},E.fromTextArea=function(a,b){function c(){a.value=k.getValue()}if(b=b?Fa(b):{},b.value=a.value,!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex),!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder),null==b.autofocus){var d=qa();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}var e;if(a.form&&(t(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var f=a.form;e=f.submit;try{var g=f.submit=function(){c();
f.submit=e;f.submit();f.submit=g}}catch(h){}}b.finishInit=function(b){b.save=c;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;c();a.parentNode.removeChild(b.getWrapperElement());a.style.display="";a.form&&(aa(a.form,"submit",c),"function"==typeof a.form.submit&&(a.form.submit=e))}};a.style.display="none";var k=E(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return k},function(a){a.off=aa;a.on=t;a.wheelEventPixels=Bg;a.Doc=W;a.splitLines=Od;a.countColumn=
ea;a.findColumn=Lc;a.isWordChar=Nc;a.Pass=Fc;a.signal=F;a.Line=hb;a.changeEnd=Ba;a.scrollbarModel=Te;a.Pos=m;a.cmpPos=x;a.modes=cd;a.mimeModes=bb;a.resolveMode=mc;a.getMode=dd;a.modeExtensions=cb;a.extendMode=kg;a.copyState=La;a.startState=ge;a.innerMode=ed;a.commands=Qb;a.keyMap=Pb;a.keyName=Df;a.isModifierKey=Af;a.lookupKey=nb;a.normalizeKeyMap=Ng;a.StringStream=H;a.SharedTextMarker=Ob;a.TextMarker=Ca;a.LineWidget=Nb;a.e_preventDefault=S;a.e_stopPropagation=ee;a.e_stop=vb;a.addClass=Ea;a.contains=
va;a.rmClass=Ra;a.keyNames=Da}(E),E.version="5.28.0",E});(function(ga){"function"==typeof ga.define&&ga.define("core",["codemirror.js"],function(X){ga.CodeMirror=X})})(this);