(function(Sa,ra){"object"===typeof exports&&"undefined"!==typeof module?module.exports=ra():"function"===typeof define&&define.amd?define(ra):Sa.CodeMirror=ra()})(this,function(){function Sa(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function ra(a){for(var b=a.childNodes.length;0f||f>=b)return e+ (b-c);e+=f-c;e+=d-e%d;c=f+1}}function aa(a,b){for(var d=0;d=b)return c+Math.min(g,b-e);e+=f-c;e+=d-e%d;c=f+1;if(e>=b)return c}}function dd(a){for(;uc.length<=a;)uc.push(G(uc)+" ");return uc[a]}function G(a){return a[a.length-1]}function vc(a,b){for(var d=[],c=0;cd?0d?-1:1;;){if(b==d)return b;var e=(b+d)/2;e=0>c?Math.ceil(e):Math.floor(e);if(e==b)return a(e)?b:d;a(e)?d=e:b=e+c}}function yg(a,b,d,c){if(!a)return c(b,d,"ltr",0);for(var e=!1,f=0;fb||b==d&&g.to==b)c(Math.max(g.from,b),Math.min(g.to,d),1==g.level?"rtl":"ltr",f),e=!0}e||c(b,d,"ltr")}function Hb(a,b,d){var c;Ib=null;for(var e=0;eb)return e;f.to==b&&(f.from!=f.to&&"before"== d?c=e:Ib=e);f.from==b&&(f.from!=f.to&&"before"!=d?c=e:Ib=e)}return null!=c?c:Ib}function Ga(a,b){var d=a.order;null==d&&(d=a.order=zg(a.text,b));return d}function na(a,b,d){if(a.removeEventListener)a.removeEventListener(b,d,!1);else if(a.detachEvent)a.detachEvent("on"+b,d);else{var c=(a=a._handlers)&&a[b];c&&(d=aa(c,d),-1=b.offsetWidth&&2P))}a=hd?x("span","\u200b"):x("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px");a.setAttribute("cm-text","");return a}function Bg(a,b){2b||b>=a.size)throw Error("There is no line "+ (b+a.first)+" in the document.");for(;!a.lines;)for(var d=0;;++d){var c=a.children[d],e=c.chunkSize();if(b=a.first&&bz(a,b)?b:a}function Ac(a,b){return 0>z(a,b)?a:b}function A(a,b){if(b.lined)return t(d,v(a,d).text.length);a=v(a,b.line).text.length;d=b.ch;b=null==d||d>a?t(b.line, a):0>d?t(b.line,0):b;return b}function te(a,b){for(var d=[],c=0;cn&&e.splice(m,1,n,e[m+1],u);m+=2;q=Math.min(n,u)}if(p)if(l.opaque)e.splice(r,m-r,n,"overlay "+p),m=r+2;else for(;ra.options.maxHighlightLength&&Va(a.doc.mode,c.state),f=ue(a,b,c);e&&(c.state=e);b.stateAfter=c.save(!e);b.styles=f.styles;f.classes?b.styleClasses=f.classes:b.styleClasses&&(b.styleClasses=null);d===a.doc.highlightFrontier&& (a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function Lb(a,b,d){var c=a.doc,e=a.display;if(!c.mode.startState)return new Aa(c,!0,b);var f=Dg(a,b,d),g=f>c.first&&v(c,f-1).stateAfter,h=g?Aa.fromSaved(c,g,f):new Aa(c,se(c.mode),f);c.iter(f,b,function(k){pd(a,k.text,h);var l=h.line;k.stateAfter=l==b-1||0==l%5||l>=e.viewFrom&&le;e++){c&&(c[0]=kd(a,d).mode);var f=a.token(b,d);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream.");}function ye(a,b,d,c){var e=a.doc,f=e.mode;b=A(e,b);var g=v(e,b.line);d=Lb(a,b.line,d);a=new S(g.text,a.options.tabSize, d);var h;for(c&&(h=[]);(c||a.posa.options.maxHighlightLength){h=!1;g&&pd(a,b,c,m.pos);m.pos=b.length;var n=null}else n=Ae(qd(d,m,c.state,q),f);if(q){var p=q[0].name;p&&(n="m-"+(n?p+" "+n:p))}if(!h||l!=n){for(;kg;--b){if(b<= f.first)return f.first;var h=v(f,b-1),k=h.stateAfter;if(k&&(!d||b+(k instanceof Bc?k.lookAhead:0)<=f.modeFrontier))return b;h=sa(h.text,null,a.options.tabSize);if(null==e||c>h)e=b-1,c=h}return e}function Eg(a,b){a.modeFrontier=Math.min(a.modeFrontier,b);if(!(a.highlightFrontierd;c--){var e=v(a,c).stateAfter;if(e&&(!(e instanceof Bc)||c+e.lookAhead=a:k.to>a);(g||(g=[])).push(new Cc(l,k.from,m?null:k.to))}}d=g;var q;if(c)for(g=0;g=e:h.to>e)||h.from==e&&"bookmark"==k.type&&(!f||h.marker.insertLeft))l=null==h.from||(k.inclusiveLeft?h.from<=e:h.fromz(g.to,e.from)||0k||!d.inclusiveLeft&&!k)&&h.push({from:g.from,to:e.from});(0sd(e,d.marker)))var e=d.marker;return e}function Ee(a,b,d,c,e){a=v(a,b);if(a=Ha&&a.markedSpans)for(b=0;b=k||0>=h&&0<=k)&&(0>=h&&(f.marker.inclusiveRight&& e.inclusiveLeft?0<=z(g.to,d):0=z(g.from,c):0>z(g.from,c))))return!0}}}function Ba(a){for(var b;b=qb(a,!0);)a=b.find(-1,!0).line;return a}function td(a,b){a=v(a,b);var d=Ba(a);return a==d?b:J(d)}function Fe(a,b){if(b>a.lastLine())return b;var d=v(a,b);if(!La(a,d))return b;for(;a=qb(d,!1);)d=a.find(1,!0).line;return J(d)+1}function La(a,b){var d=Ha&&b.markedSpans;if(d)for(var c,e=0;eb.maxLineLength&&(b.maxLineLength=c,b.maxLine=d)})}function Ge(a,b){if(!a||/^\s*$/.test(a))return null;b=b.addModeClass?Gg:Hg;return b[a]||(b[a]=a.replace(/\S+/g,"cm-$&"))}function He(a,b){var d=mb("span",null,null,ba?"padding-right: .1px":null);d={pre:mb("pre",[d],"CodeMirror-line"),content:d,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:a.getOption("lineWrapping")};b.measure={};for(var c=0;c<=(b.rest?b.rest.length:0);c++){var e=c?b.rest[c-1]: b.line,f=void 0;d.pos=0;d.addToken=Ig;var g=a.display.measure;if(null!=wd)g=wd;else{var h=ma(g,document.createTextNode("A\u062eA")),k=Nb(h,0,1).getBoundingClientRect();h=Nb(h,1,2).getBoundingClientRect();ra(g);g=k&&k.left!=k.right?wd=3>h.right-k.right:!1}g&&(f=Ga(e,a.doc.direction))&&(d.addToken=Jg(d.addToken,f));d.map=[];var l=b!=a.display.externalMeasured&&J(e);a:{var m=h=k=g=void 0,q=void 0,n=void 0,p=void 0;f=d;l=we(a,e,l);var r=e.markedSpans,u=e.text,B=0;if(r)for(var U=u.length,w=0,K=1,H="", M=0;;){if(M==w){q=m=h=n="";k=g=null;M=Infinity;for(var O=[],C=void 0,N=0;Nw||I.collapsed&&E.to==w&&E.from==w)){null!=E.to&&E.to!=w&&M>E.to&&(M=E.to,m="");I.className&&(q+=" "+I.className);I.css&&(n=(n?n+";":"")+I.css);I.startStyle&&E.from==w&&(h+=" "+I.startStyle);I.endStyle&&E.to==M&&(C||(C=[])).push(I.endStyle,E.to);I.title&&((g||(g={})).title=I.title);if(I.attributes)for(var ca in I.attributes)(g|| (g={}))[ca]=I.attributes[ca];I.collapsed&&(!k||0>sd(k.marker,I))&&(k=E)}else E.from>w&&M>E.from&&(M=E.from)}if(C)for(N=0;N=U)break;for(O=Math.min(U,M);;){if(H){C=w+H.length;k||(N=C>O?H.slice(0,O-w):H,f.addToken(f,N,p?p+q:q,h,w+N.length==M?m:"",n,g));if(C>=O){H=H.slice(O-w);w=O;break}w=C;h= ""}H=u.slice(B,B=l[K++]);p=Ge(l[K++],f.cm.options)}}else for(g=1;gP?h.appendChild(x("span",[r])):h.appendChild(r);a.map.push(a.pos,a.pos+p,r);a.col+=p;a.pos+=p}if(!n)break;q+= p+1;"\t"==n[0]?(n=a.cm.options.tabSize,n-=a.col%n,p=h.appendChild(x("span",dd(n),"cm-tab")),p.setAttribute("role","presentation"),p.setAttribute("cm-text","\t"),a.col+=n):("\r"==n[0]||"\n"==n[0]?(p=h.appendChild(x("span","\r"==n[0]?"\u240d":"\u2424","cm-invalidchar")),p.setAttribute("cm-text",n[0])):(p=a.cm.options.specialCharPlaceholder(n[0]),p.setAttribute("cm-text",n[0]),D&&9>P?h.appendChild(x("span",[p])):h.appendChild(p)),a.col+=1);a.map.push(a.pos,a.pos+1,p);a.pos++}}else a.col+=b.length,h= document.createTextNode(k),a.map.push(a.pos,a.pos+b.length,h),D&&9>P&&(m=!0),a.pos+=b.length;a.trailingSpace=32==k.charCodeAt(b.length-1);if(d||c||e||m||f){b=d||"";c&&(b+=c);e&&(b+=e);c=x("span",[h],b,f);if(g)for(var u in g)g.hasOwnProperty(u)&&"style"!=u&&"class"!=u&&c.setAttribute(u,g[u]);return a.content.appendChild(c)}a.content.appendChild(h)}}function Jg(a,b){return function(d,c,e,f,g,h,k){e=e?e+" cm-force-border":"cm-force-border";for(var l=d.pos,m=l+c.length;;){for(var q=void 0,n=0;nl&&q.from<=l);n++);if(q.to>=m)return a(d,c,e,f,g,h,k);a(d,c.slice(0,q.to-l),e,f,null,h,k);f=null;c=c.slice(q.to-l);l=q.to}}}function Ie(a,b,d,c){var e=!c&&d.widgetNode;e&&a.map.push(a.pos,a.pos+b,e);!c&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",d.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function Je(a,b,d){for(var c=this.line=b,e;c=qb(c,!1);)c= c.find(1,!0).line,(e||(e=[])).push(c);this.size=(this.rest=e)?J(G(this.rest))-d+1:1;this.node=this.text=null;this.hidden=La(a,b)}function Ec(a,b,d){var c=[],e;for(e=b;eP&&(a.node.style.zIndex=2));return a.node}function Le(a,b){var d=a.display.externalMeasured;return d&&d.line==b.line?(a.display.externalMeasured=null,b.measure=d.measure,d.built):He(a,b)}function xd(a,b){var d=b.bgClass?b.bgClass+" "+(b.line.bgClass||""):b.line.bgClass;d&&(d+=" CodeMirror-linebackground");if(b.background)d?b.background.className= d:(b.background.parentNode.removeChild(b.background),b.background=null);else if(d){var c=Pb(b);b.background=c.insertBefore(x("div",null,d),c.firstChild);a.display.input.setUneditable(b.background)}b.line.wrapClass?Pb(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 Me(a,b,d,c){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);b.gutterBackground&&(b.node.removeChild(b.gutterBackground), b.gutterBackground=null);if(b.line.gutterClass){var e=Pb(b);b.gutterBackground=x("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,"left: "+(a.options.fixedGutter?c.fixedPos:-c.gutterTotalWidth)+"px; width: "+c.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=Pb(b),g=b.gutter=x("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?c.fixedPos:-c.gutterTotalWidth)+ "px");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(x("div",md(a.options,d),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+c.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px")));if(e)for(b=0;bd)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}function Ad(a,b){if(b>=a.display.viewFrom&&b=a.lineN&&bn;n++){for(;h&& fd(b.line.text.charAt(g.coverStart+h));)--h;for(;g.coverStart+kP&&0==h&&k==g.coverEnd-g.coverStart)var p=c.parentNode.getBoundingClientRect();else{p=Nb(c,h,k).getClientRects();k=Se;if("left"==m)for(l=0;lP&&((n=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)|| (null!=Cd?n=Cd:(m=ma(a.display.measure,x("span","x")),n=m.getBoundingClientRect(),m=Nb(m,0,1).getBoundingClientRect(),n=Cd=1P)||h||p&&(p.left||p.right)||(p=(p=c.parentNode.getClientRects()[0])? {left:p.left,right:p.left+sb(a.display),top:p.top,bottom:p.bottom}:Se);c=p.top-b.rect.top;h=p.bottom-b.rect.top;n=(c+h)/2;m=b.view.measure.heights;for(g=0;gb)f=k-h,e=f-1,b>=k&&(g="right");if(null!=e){c=a[l+2];h==k&&d==(c.insertLeft?"left":"right")&&(g=d);if("left"==d&&0==e)for(;l&&a[l-2]==a[l-3]&&a[l-1].insertLeft;)c=a[(l-=3)+2],g="left";if("right"==d&&e==k-h)for(;l=c.text.length?(l=c.text.length,b="before"):0>=l&&(l=0,b="after");if(!k)return g("before"==b?l-1:l,"before"== b);var m=Hb(k,l,b),q=Ib;m=h(l,m,"before"==b);null!=q&&(m.other=h(l,q,"before"!=b));return m}function Ye(a,b){var d=0;b=A(a.doc,b);a.options.lineWrapping||(d=sb(a.display)*b.ch);b=v(a.doc,b.line);a=Ca(b)+a.display.lineSpace.offsetTop;return{left:d,right:d,top:a,bottom:a+b.height}}function Fd(a,b,d,c,e){a=t(a,b,d);a.xRel=e;c&&(a.outside=!0);return a}function Gd(a,b,d){var c=a.doc;d+=a.display.viewOffset;if(0>d)return Fd(c.first,0,null,!0,-1);var e=Xa(c,d),f=c.first+c.size-1;if(e>f)return Fd(c.first+ c.size-1,v(c,f).text.length,null,!0,1);0>b&&(b=0);for(var g=v(c,e);;){f=Og(a,g,e,b,d);var h=void 0;var k=f.ch+(0k)&&(!h||0>sd(h,m.marker))&&(h=m.marker)}if(!h)return f;f=h.find(1);if(f.line==e)return f;g=v(c,e=f.line)}}function Ze(a,b,d,c){c-=Dd(b);b=b.text.length;var e=Gb(function(f){return va(a,d,f-1).bottom<=c},b,0);b=Gb(function(f){return va(a,d,f).top>c}, e,b);return{begin:e,end:b}}function $e(a,b,d,c){d||(d=$a(a,b));c=Hc(a,b,va(a,d,c),"line").top;return Ze(a,b,d,c)}function Hd(a,b,d,c){return a.bottom<=d?!1:a.top>d?!0:(c?a.left:a.right)>b}function Og(a,b,d,c,e){e-=Ca(b);var f=$a(a,b),g=Dd(b),h=0,k=b.text.length,l=!0,m=Ga(b,a.doc.direction);m&&(m=(a.options.lineWrapping?Pg:Qg)(a,b,d,f,m,c,e),h=(l=1!=m.level)?m.from:m.to-1,k=l?m.to:m.from-1);var q=null,n=null;m=Gb(function(r){var u=va(a,f,r);u.top+=g;u.bottom+=g;if(!Hd(u,c,e,!1))return!1;u.top<=e&& u.left<=c&&(q=r,n=u);return!0},h,k);var p=!1;n?(h=c-n.left=p.bottom);m=oe(b.text,m,1);return Fd(d,m,l,p,c-h)}function Qg(a,b,d,c,e,f,g){var h=Gb(function(m){m=e[m];var q=1!=m.level;return Hd(wa(a,t(d,q?m.to:m.from,q?"before":"after"),"line",b,c),f,g,!0)},0,e.length-1), k=e[h];if(0g&&(k=e[h-1])}return k}function Pg(a,b,d,c,e,f,g){g=Ze(a,b,c,g);d=g.begin;g=g.end;/\s/.test(b.text.charAt(g-1))&&g--;for(var h=b=null,k=0;k=g||l.to<=d)){var m=va(a,c,1!=l.level?Math.min(g,l.to)-1:Math.max(d,l.from)).right;m=mm)b=l,h=m}}b||(b=e[e.length-1]);b.fromg&&(b={from:b.from,to:g, level:b.level});return b}function tb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==ab){ab=x("pre");for(var b=0;49>b;++b)ab.appendChild(document.createTextNode("x")),ab.appendChild(x("br"));ab.appendChild(document.createTextNode("x"))}ma(a.measure,ab);b=ab.offsetHeight/50;3=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var d=0;db)return d}function ha(a,b,d,c){null== b&&(b=a.doc.first);null==d&&(d=a.doc.first+a.doc.size);c||(c=0);var e=a.display;c&&db)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)Ha&&td(a.doc,b)e.viewFrom?Ma(a):(e.viewFrom+=c,e.viewTo+=c);else if(b<=e.viewFrom&&d>=e.viewTo)Ma(a);else if(b<=e.viewFrom){var f=Ic(a,d,d+c,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=c):Ma(a)}else if(d>=e.viewTo)(f= Ic(a,b,b,-1))?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Ma(a);else{f=Ic(a,b,b,-1);var g=Ic(a,d,d+c,1);f&&g?(e.view=e.view.slice(0,f.index).concat(Ec(a,f.lineN,g.lineN)).concat(e.view.slice(g.index)),e.viewTo+=c):Ma(a)}if(a=e.externalMeasured)d=e.lineN&&b=c.viewTo||(a=c.view[Za(a, b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==aa(a,d)&&a.push(d)))}function Ma(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function Ic(a,b,d,c){var e=Za(a,b),f=a.display.view;if(!Ha||d==a.doc.first+a.doc.size)return{index:e,lineN:d};for(var g=a.display.viewFrom,h=0;hc?0:f.length-1))return null;d+=c*f[e-(0>c?1:0)].size; e+=c}return{index:e,lineN:d}}function bf(a){a=a.display.view;for(var b=0,d=0;d=a.display.viewTo||h.to().line< a.display.viewFrom)){var k=h.empty();(k||a.options.showCursorWhenSelecting)&&df(a,h.head,e);k||Rg(a,h,f)}}return c}function df(a,b,d){b=wa(a,b,"div",null,null,!a.options.singleCursorHeightPerLine);var c=d.appendChild(x("div","\u00a0","CodeMirror-cursor"));c.style.left=b.left+"px";c.style.top=b.top+"px";c.style.height=Math.max(0,b.bottom-b.top)*a.options.cursorHeight+"px";b.other&&(a=d.appendChild(x("div","\u00a0","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 Jc(a,b){return a.top-b.top||a.left-b.left}function Rg(a,b,d){function c(p,r,u,B){0>r&&(r=0);r=Math.round(r);B=Math.round(B);h.appendChild(x("div",null,"CodeMirror-selected","position: absolute; left: "+p+"px;\n top: "+r+"px; width: "+(null==u?m-p:u)+"px;\n height: "+(B-r)+"px"))}function e(p,r,u){function B(C,N){return Ed(a,t(p,C),"div",w,N)}function U(C, N,E){C=$e(a,w,null,C);N="ltr"==N==("after"==E)?"left":"right";E="after"==E?C.begin:C.end-(/\s/.test(w.text.charAt(C.end-1))?2:1);return B(E,N)[N]}var w=v(g,p),K=w.text.length,H,M,O=Ga(w,g.direction);yg(O,r||0,null==u?K:u,function(C,N,E,I){var ca="ltr"==E,ia=B(C,ca?"left":"right"),oa=B(N-1,ca?"right":"left"),cb=null==r&&0==C,db=null==u&&N==K,Kd=0==I;I=!O||I==O.length-1;3>=oa.top-ia.top?(N=(q?cb:db)&&Kd?l:(ca?ia:oa).left,c(N,ia.top,((q?db:cb)&&I?m:(ca?oa:ia).right)-N,ia.bottom)):(ca?(ca=q&&cb&&Kd?l: ia.left,cb=q?m:U(C,E,"before"),C=q?l:U(N,E,"after"),db=q&&db&&I?m:oa.right):(ca=q?U(C,E,"before"):l,cb=!q&&cb&&Kd?m:ia.right,C=!q&&db&&I?l:oa.left,db=q?U(N,E,"after"):m),c(ca,ia.top,cb-ca,ia.bottom),ia.bottomJc(ia,H))H=ia;0>Jc(oa,H)&&(H=oa);if(!M||0>Jc(ia,M))M=ia;0>Jc(oa,M)&&(M=oa)});return{start:H,end:M}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),k=Pe(a.display),l=k.left,m=Math.max(f.sizerWidth,Ya(a)-f.sizer.offsetLeft)- k.right,q="ltr"==g.direction;f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var n=v(g,f.line);k=v(g,b.line);k=Ba(n)==Ba(k);f=e(f.line,f.ch,k?n.text.length+1:null).end;b=e(b.line,k?0:null,b.ch).start;k&&(f.topa.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function ef(a){a.state.focused||(a.display.input.focus(),Md(a))}function ff(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Tb(a))},100)}function Md(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);"nocursor"!= a.options.readOnly&&(a.state.focused||(R(a,"focus",a,b),a.state.focused=!0,Ta(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),ba&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),Ld(a))}function Tb(a,b){a.state.delayingBlurEvent||(a.state.focused&&(R(a,"blur",a,b),a.state.focused=!1,eb(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused|| (a.display.shift=!1)},150))}function Kc(a){for(var b=a.display,d=b.lineDiv.offsetTop,c=0;cP){f=e.node.offsetTop+e.node.offsetHeight;var h=f-d;d=f}else{var k=e.node.getBoundingClientRect();h=k.bottom-k.top;!f&&e.text.firstChild&&(g=e.text.firstChild.getBoundingClientRect().right-k.left-1)}f=e.line.height-h;if(.005f)if(za(e.line,h),gf(e.line),e.rest)for(h=0;ha.display.sizerWidth&& (g=Math.ceil(g/sb(a.display)),g>a.display.maxLineLength&&(a.display.maxLineLength=g,a.display.maxLine=e.line,a.display.maxLineChanged=!0))}}}function gf(a){if(a.widgets)for(var b=0;b=e&&(c=Xa(b,Ca(v(b,d))-a.wrapper.clientHeight),e=d)}return{from:c,to:Math.max(e,c+1)}}function Od(a,b){var d=a.display,c=tb(a.display);0>b.top&&(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:d.scroller.scrollTop,f=zd(a),g={};b.bottom-b.top>f&&(b.bottom=b.top+f);var h=a.doc.height+yd(d),k=b.toph-c;b.tope+f&&(f=Math.min(b.top,(c?h:b.bottom)- f),f!=e&&(g.scrollTop=f));e=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:d.scroller.scrollLeft;a=Ya(a)-(a.options.fixedGutter?d.gutters.offsetWidth:0);if(d=b.right-b.left>a)b.right=b.left+a;10>b.left?g.scrollLeft=0:b.lefta+e-3&&(g.scrollLeft=b.right+(d?0:10)-a);return g}function Lc(a,b){null!=b&&(Mc(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}function ub(a){Mc(a);var b=a.getCursor();a.curOp.scrollToPos= {from:b,to:b,margin:a.options.cursorScrollMargin}}function Ub(a,b,d){null==b&&null==d||Mc(a);null!=b&&(a.curOp.scrollLeft=b);null!=d&&(a.curOp.scrollTop=d)}function Mc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var d=Ye(a,b.from),c=Ye(a,b.to);hf(a,d,c,b.margin)}}function hf(a,b,d,c){b=Od(a,{left:Math.min(b.left,d.left),top:Math.min(b.top,d.top)-c,right:Math.max(b.right,d.right),bottom:Math.max(b.bottom,d.bottom)+c});Ub(a,b.scrollLeft,b.scrollTop)}function Vb(a,b){2>Math.abs(a.doc.scrollTop- b)||(Oa||Pd(a,{top:b}),jf(a,b,!0),Oa&&Pd(a),Wb(a,100))}function jf(a,b,d){b=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b);if(a.display.scroller.scrollTop!=b||d)a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b)}function fb(a,b,d,c){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);(d?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))&&!c||(a.doc.scrollLeft=b,kf(a),a.display.scroller.scrollLeft!= b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function Xb(a){var b=a.display,d=b.gutters.offsetWidth,c=Math.round(a.doc.height+yd(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?d:0,docHeight:c,scrollHeight:c+Da(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:d}}function vb(a,b){b||(b= Xb(a));var d=a.display.barWidth,c=a.display.barHeight;lf(a,b);for(b=0;4>b&&d!=a.display.barWidth||c!=a.display.barHeight;b++)d!=a.display.barWidth&&a.options.lineWrapping&&Kc(a),lf(a,Xb(a)),d=a.display.barWidth,c=a.display.barHeight}function lf(a,b){var d=a.display,c=d.scrollbars.update(b);d.sizer.style.paddingRight=(d.barWidth=c.right)+"px";d.sizer.style.paddingBottom=(d.barHeight=c.bottom)+"px";d.heightForcer.style.borderBottom=c.bottom+"px solid transparent";c.right&&c.bottom?(d.scrollbarFiller.style.display= "block",d.scrollbarFiller.style.height=c.bottom+"px",d.scrollbarFiller.style.width=c.right+"px"):d.scrollbarFiller.style.display="";c.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(d.gutterFiller.style.display="block",d.gutterFiller.style.height=c.bottom+"px",d.gutterFiller.style.width=b.gutterWidth+"px"):d.gutterFiller.style.display=""}function mf(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&eb(a.display.wrapper,a.display.scrollbars.addClass)); a.display.scrollbars=new nf[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);y(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});b.setAttribute("cm-not-content","true")},function(b,d){"horizontal"==d?fb(a,b):Vb(a,b)},a);a.display.scrollbars.addClass&&Ta(a.display.wrapper,a.display.scrollbars.addClass)}function gb(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:0, typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Sg};a=a.curOp;rb?rb.ops.push(a):a.ownsGroup=rb={ops:[a],delayedCallbacks:[]}}function hb(a){(a=a.curOp)&&Lg(a,function(b){for(var d=0;d=f.viewTo)||f.maxLineChanged&&e.options.lineWrapping;c.update=c.mustUpdate&&new Nc(e,c.mustUpdate&&{top:c.scrollTop,ensure:c.scrollToPos},c.forceUpdate)}for(d=0;dq;q++){var n=!1;h=wa(e,k);var p=l&&l!=k?wa(e,l):h;h={left:Math.min(h.left,p.left),top:Math.min(h.top,p.top)-m,right:Math.max(h.left,p.left),bottom:Math.max(h.bottom,p.bottom)+m};p=Od(e,h);var r=e.doc.scrollTop,u=e.doc.scrollLeft;null!=p.scrollTop&&(Vb(e,p.scrollTop),1l.top+q.top?k=!0:l.bottom+q.top>(window.innerHeight||document.documentElement.clientHeight)&&(k=!1),null==k||Tg||(l=x("div","\u200b",null,"position: absolute;\n top: "+(l.top-m.viewOffset-e.display.lineSpace.offsetTop)+"px;\n height: "+(l.bottom-l.top+Da(e)+m.barHeight)+"px;\n left: "+l.left+ "px; width: "+Math.max(2,l.right-l.left)+"px;"),e.display.lineSpace.appendChild(l),l.scrollIntoView(k),e.display.lineSpace.removeChild(l)))}l=c.maybeHiddenMarkers;k=c.maybeUnhiddenMarkers;if(l)for(m=0;m=a.display.viewTo)){var d=+new Date+a.options.workTime,c=Lb(a,b.highlightFrontier),e=[];b.iter(c.line,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(c.line>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength?Va(b.mode,c.state):null,k=ue(a,f,c,!0);h&&(c.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&&hd)return Wb(a,a.options.workDelay),!0});b.highlightFrontier=c.line;b.modeFrontier=Math.max(b.modeFrontier,c.line);e.length&&ka(a,function(){for(var f=0;f=d.viewFrom&&b.visible.to<=d.viewTo&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo)&&d.renderedView==d.view&&0==bf(a))return!1;pf(a)&&(Ma(a),b.dims=Bd(a));var e=c.first+c.size,f=Math.max(b.visible.from-a.options.viewportMargin,c.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);d.viewFromf-d.viewFrom&&(f=Math.max(c.first,d.viewFrom));d.viewTo>g&&20>d.viewTo-g&&(g=Math.min(e,d.viewTo));Ha&&(f=td(a.doc, f),g=Fe(a.doc,g));c=f!=d.viewFrom||g!=d.viewTo||d.lastWrapHeight!=b.wrapperHeight||d.lastWrapWidth!=b.wrapperWidth;e=a.display;0==e.view.length||f>=e.viewTo||g<=e.viewFrom?(e.view=Ec(a,f,g),e.viewFrom=f):(e.viewFrom>f?e.view=Ec(a,f,e.viewFrom).concat(e.view):e.viewFromg&&(e.view=e.view.slice(0,Za(a,g))));e.viewTo=g;d.viewOffset=Ca(v(a.doc,d.viewFrom));a.display.mover.style.top=d.viewOffset+"px"; g=bf(a);if(!c&&0==g&&!b.force&&d.renderedView==d.view&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo))return!1;a.hasFocus()?f=null:(f=Fa())&&Ka(a.display.lineDiv,f)?(f={activeElt:f},window.getSelection&&(e=window.getSelection(),e.anchorNode&&e.extend&&Ka(a.display.lineDiv,e.anchorNode)&&(f.anchorNode=e.anchorNode,f.anchorOffset=e.anchorOffset,f.focusNode=e.focusNode,f.focusOffset=e.focusOffset))):f=null;4=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!Qd(a,b))break;Kc(a);c=Xb(a);Sb(a);vb(a,c);Rd(a,c);b.force=!1}b.signal(a,"update",a);if(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 Pd(a,b){b=new Nc(a,b);if(Qd(a,b)){Kc(a);of(a,b);var d=Xb(a);Sb(a);vb(a,d);Rd(a,d);b.finish()}}function Vg(a,b,d){function c(n){var p=n.nextSibling;ba&&ua&&a.display.currentWheelTarget==n?n.style.display="none":n.parentNode.removeChild(n);return p}var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,k=e.view;e=e.viewFrom;for(var l=0;l< k.length;l++){var m=k[l];if(!m.hidden)if(m.node&&m.node.parentNode==g){for(;h!=m.node;)h=c(h);h=f&&null!=b&&b<=e&&m.lineNumber;m.changes&&(-1P&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight= 0);ba||Oa&&Zb||(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;this.gutterSpecs=Td(c.gutters,c.lineNumbers);qf(this);d.init(this)}function rf(a){var b=a.wheelDeltaX,d=a.wheelDeltaY;null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail);null==d&&a.detail&&a.axis==a.VERTICAL_AXIS?d=a.detail:null==d&&(d=a.wheelDelta);return{x:b, y:d}}function Xg(a){a=rf(a);a.x*=pa;a.y*=pa;return a}function sf(a,b){var d=rf(b),c=d.x;d=d.y;var e=a.display,f=e.scroller,g=f.scrollWidth>f.clientWidth,h=f.scrollHeight>f.clientHeight;if(c&&g||d&&h){if(d&&ua&&ba){g=b.target;var k=e.view;a:for(;g!=f;g=g.parentNode)for(var l=0;lb?h=Math.max(0,h+b-50):g=Math.min(a.doc.height,g+b+50),Pd(a,{top:h, bottom:g})),20>Oc&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=c,e.wheelDY=d,setTimeout(function(){if(null!=e.wheelStartX){var m=f.scrollLeft-e.wheelStartX,q=f.scrollTop-e.wheelStartY;m=q&&e.wheelDY&&q/e.wheelDY||m&&e.wheelDX&&m/e.wheelDX;e.wheelStartX=e.wheelStartY=null;m&&(pa=(pa*Oc+m)/(Oc+1),++Oc)}},200)):(e.wheelDX+=c,e.wheelDY+=d))):(d&&h&&Vb(a,Math.max(0,f.scrollTop+d*pa)),fb(a,Math.max(0,f.scrollLeft+c*pa)),(!d||d&&h)&&fa(b),e.wheelStartX=null)}}function ya(a, b,d){a=a&&a.options.selectionsMayTouch;d=b[d];b.sort(function(k,l){return z(k.from(),l.from())});d=aa(b,d);for(var c=1;cz(a,b.from))return a;if(0>=z(a,b.to))return Pa(b);var d=a.line+b.text.length-(b.to.line-b.from.line)-1,c=a.ch;a.line==b.to.line&&(c+=Pa(b).ch-b.to.ch);return t(d,c)}function Ud(a,b){for(var d=[],c=0;cf-(a.cm?a.cm.options.historyEventDelay:500)||"*"==b.origin.charAt(0))){if(e.lastOp==c){zf(e.done); var h=G(e.done)}else e.done.length&&!G(e.done).ranges?h=G(e.done):1e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(d);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime= f;e.lastOp=e.lastSelOp=c;e.lastOrigin=e.lastSelOrigin=b.origin;k||R(a,"historyAdded")}function Qc(a,b){var d=G(b);d&&d.ranges&&d.equals(a)||b.push(a)}function yf(a,b,d,c){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,d),Math.min(a.first+a.size,c),function(g){g.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=g.markedSpans);++f})}function Zg(a){if(!a)return null;for(var b,d=0;dz(b,a),c!=0>z(d,a)?(a=b,b=d):c!=0>z(b,d)&&(b=d)),new F(a,b)):new F(d||b,b)}function Rc(a,b,d,c,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend));Z(a,new qa([Yd(a.sel.primary(),b,d,e)],0),c)}function Cf(a,b,d){for(var c=[],e=a.cm&&(a.cm.display.shift||a.extend),f=0;fz(b.primary().head,a.sel.primary().head)?-1:1);Ef(a,Ff(a,b,c,!0));d&&!1===d.scroll||!a.cm||ub(a.cm)}function Ef(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=1,a.cm.curOp.selectionChanged=!0,pe(a.cm)),Y(a,"cursorActivity",a))}function Gf(a){Ef(a,Ff(a,a.sel,null,!1))} function Ff(a,b,d,c){for(var e,f=0;f=b.ch:h.to>b.ch))){if(e&&(R(k,"beforeCursorEnter"),k.explicitlyCleared))if(f.markedSpans){--g;continue}else break;if(k.atomic){if(d){g=k.find(0>c?1:-1);h=void 0;if(0>c?k.inclusiveRight:k.inclusiveLeft)g=Hf(a,g,-c,g&&g.line==b.line?f:null);if(g&&g.line==b.line&&(h=z(g,d))&&(0>c?0>h:0c?-1:1);if(0>c?k.inclusiveLeft:k.inclusiveRight)d=Hf(a,d,c,d.line==b.line?f:null);return d?yb(a,d,b,c,e):null}}}return b}function $d(a,b,d,c,e){c=c||1;b= yb(a,b,d,c,e)||!e&&yb(a,b,d,c,!0)||yb(a,b,d,-c,e)||!e&&yb(a,b,d,-c,!0);return b?b:(a.cantEdit=!0,t(a.first,0))}function Hf(a,b,d,c){return 0>d&&0==b.ch?b.line>a.first?A(a,t(b.line-1)):null:0a.lastLine())){if(b.from.linee&&(b={from:b.from,to:t(e,v(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=Wa(a,b.from,b.to);d||(d=Ud(a,b));a.cm?ah(a.cm, b,c):Wd(a,b,c);Sc(a,d,Ea)}}function ah(a,b,d){var c=a.doc,e=a.display,f=b.from,g=b.to,h=!1,k=f.line;a.options.lineWrapping||(k=J(Ba(v(c,f.line))),c.iter(k,g.line+1,function(l){if(l==e.maxLine)return h=!0}));-1e.maxLineLength&&(e.maxLine=l,e.maxLineLength=m,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0));Eg(c,f.line);Wb(a,400);d=b.text.length-(g.line-f.line)- 1;b.full?ha(a):f.line!=g.line||1!=b.text.length||vf(a.doc,b)?ha(a,f.line,g.line+1,d):Na(a,f.line,"text");d=ta(a,"changes");if((c=ta(a,"change"))||d)b={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin},c&&Y(a,"change",a,b),d&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function Ab(a,b,d,c,e){c||(c=d);0>z(c,d)&&(c=[c,d],d=c[0],c=c[1]);"string"==typeof b&&(b=a.splitLines(b));zb(a,{from:d,to:c,text:b,origin:e})}function Of(a,b,d,c){d=z(f.from,G(c).to);){var g=c.pop();if(0>z(g.from,f.from)){f.from=g.from;break}}c.push(f)}ka(a,function(){for(var h=c.length-1;0<=h;h--)Ab(a.doc,"",c[h].from,c[h].to,"+delete");ub(a)})}function ae(a,b,d){b=oe(a.text,b+d,d);return 0>b||b>a.text.length?null:b}function be(a,b,d){a= ae(a,b.ch,d);return null==a?null:new t(b.line,a,0>d?"after":"before")}function ce(a,b,d,c,e){if(a&&(a=Ga(d,b.doc.direction))){a=0>e?G(a):a[0];var f=0>e==(1==a.level)?"after":"before";if(0e?d.text.length-1:0;var k=va(b,g,h).top;h=Gb(function(l){return va(b,g,l).top==k},0>e==(1==a.level)?a.from:a.to-1,h);"before"==f&&(h=ae(d,h,1))}else h=0>e?a.to:a.from;return new t(c,h,f)}return new t(c,0>e?d.text.length:0,0>e?"before":"after")}function jh(a, b,d,c){var e=Ga(b,a.doc.direction);if(!e)return be(b,d,c);d.ch>=b.text.length?(d.ch=b.text.length,d.sticky="before"):0>=d.ch&&(d.ch=0,d.sticky="after");var f=Hb(e,d.ch,d.sticky),g=e[f];if("ltr"==a.doc.direction&&0==g.level%2&&(0d.ch:g.fromc,n=h(d,q?1:-1);if(null!=n&&(q?n<=g.to&&n<=m.end:n>=g.from&&n>=m.begin))return new t(d.line,n,q?"before":"after")}g=function(p,r,u){for(var B=function(H,M){return M?new t(d.line,h(H,1),"before"):new t(d.line,H,"after")};0<=p&&pP&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var d=bg(this,a);xa&&(de=d?b:null,!d&&88==b&&!mh&&(ua?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||nh(this)}}function nh(a){function b(c){18!=c.keyCode&&c.altKey||(eb(d,"CodeMirror-crosshair"),na(document,"keyup",b),na(document,"mouseover",b))}var d=a.display.lineDiv;Ta(d,"CodeMirror-crosshair");y(document,"keyup",b);y(document, "mouseover",b)}function dg(a){16==a.keyCode&&(this.doc.sel.shift=!1);V(this,a)}function eg(a){if(!(Ia(this.display,a)||V(this,a)||a.ctrlKey&&!a.altKey||ua&&a.metaKey)){var b=a.keyCode,d=a.charCode;if(xa&&b==de)de=null,fa(a);else if(!xa||a.which&&!(10>a.which)||!bg(this,a))if(b=String.fromCharCode(null==d?b:d),"\b"!=b&&!lh(this,a,b))this.display.input.onKeyPress(a)}}function oh(a,b){var d=+new Date;if(jc&&jc.compare(d,a,b))return kc=jc=null,"triple";if(kc&&kc.compare(d,a,b))return jc=new ee(d,a,b), kc=null,"double";kc=new ee(d,a,b);jc=null;return"single"}function fg(a){var b=this.display;if(!(V(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,Ia(b,a))ba||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!Xc(this,a,"gutterClick",!0)){var d=bb(this,a),c=re(a),e=d?oh(d,c):"single";window.focus();1==c&&this.state.selectingText&&this.state.selectingText(a);if(!d||!ph(this,c,d,e,a))if(1==c)d?qh(this,d,e,a):(a.target|| a.srcElement)==b.scroller&&fa(a);else if(2==c)d&&Rc(this.doc,d),setTimeout(function(){return b.input.focus()},20);else if(3==c)if(fe)this.display.input.onContextMenu(a);else ff(this)}}function ph(a,b,d,c,e){var f="Click";"double"==c?f="Double"+f:"triple"==c&&(f="Triple"+f);return ic(a,Wf((1==b?"Left":2==b?"Middle":"Right")+f,e),e,function(g){"string"==typeof g&&(g=hc[g]);if(!g)return!1;var h=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),h=g(a,d)!=Wc}finally{a.state.suppressEdits=!1}return h})} function qh(a,b,d,c){D?setTimeout(bd(ef,a),0):a.curOp.focus=Fa();var e=a.getOption("configureMouse");e=e?e(a,d,c):{};null==e.unit&&(e.unit=(rh?c.shiftKey&&c.metaKey:c.altKey)?"rectangle":"single"==d?"char":"double"==d?"word":"line");if(null==e.extend||a.doc.extend)e.extend=a.doc.extend||c.shiftKey;null==e.addNew&&(e.addNew=ua?c.metaKey:c.ctrlKey);null==e.moveOnDrag&&(e.moveOnDrag=!(ua?c.altKey:c.ctrlKey));var f=a.doc.sel,g;a.options.dragDrop&&sh&&!a.isReadOnly()&&"single"==d&&-1<(g=f.contains(b))&& (0>z((g=f.ranges[g]).from(),b)||0b.xRel)?th(a,c,b,e):uh(a,c,b,e)}function th(a,b,d,c){var e=a.display,f=!1,g=W(a,function(l){ba&&(e.scroller.draggable=!1);a.state.draggingText=!1;na(e.wrapper.ownerDocument,"mouseup",g);na(e.wrapper.ownerDocument,"mousemove",h);na(e.scroller,"dragstart",k);na(e.scroller,"drop",g);f||(fa(l),c.addNew||Rc(a.doc,d,null,null,c.extend),ba||D&&9==P?setTimeout(function(){e.wrapper.ownerDocument.body.focus();e.input.focus()},20):e.input.focus())}), h=function(l){f=f||10<=Math.abs(b.clientX-l.clientX)+Math.abs(b.clientY-l.clientY)},k=function(){return f=!0};ba&&(e.scroller.draggable=!0);a.state.draggingText=g;g.copy=!c.moveOnDrag;e.scroller.dragDrop&&e.scroller.dragDrop();y(e.wrapper.ownerDocument,"mouseup",g);y(e.wrapper.ownerDocument,"mousemove",h);y(e.scroller,"dragstart",k);y(e.scroller,"drop",g);ff(a);setTimeout(function(){return e.input.focus()},20)}function gg(a,b,d){if("char"==d)return new F(b,b);if("word"==d)return a.findWordAt(b);if("line"== d)return new F(t(b.line,0),A(a.doc,t(b.line+1,0)));a=d(a,b);return new F(a.from,a.to)}function uh(a,b,d,c){function e(w){if(0!=z(p,w))if(p=w,"rectangle"==c.unit){var K=[],H=a.options.tabSize,M=sa(v(k,d.line).text,d.ch,H),O=sa(v(k,w.line).text,w.ch,H),C=Math.min(M,O);M=Math.max(M,O);O=Math.min(d.line,w.line);for(var N=Math.min(a.lastLine(),Math.max(d.line,w.line));O<=N;O++){var E=v(k,O).text,I=cd(E,C,H);C==M?K.push(new F(t(O,I),t(O,I))):E.length>I&&K.push(new F(t(O,I),t(O,cd(E,M,H))))}K.length||K.push(new F(d, d));Z(k,ya(a,l.ranges.slice(0,q).concat(K),q),{origin:"*mouse",scroll:!1});a.scrollIntoView(w)}else K=n,C=gg(a,w,c.unit),w=K.anchor,0=M.to||H.liner.bottom?20:0;O&&setTimeout(W(a,function(){u==K&&(h.scroller.scrollTop+=O,f(w))}),50)}}function g(w){a.state.selectingText=!1;u=Infinity;w&&(fa(w),h.input.focus());na(h.wrapper.ownerDocument,"mousemove",B);na(h.wrapper.ownerDocument,"mouseup",U);k.history.lastSelOrigin=null}var h=a.display,k=a.doc;fa(b);var l=k.sel,m=l.ranges;if(c.addNew&&!c.extend){var q=k.sel.contains(d);var n=-1f:0=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;c&&fa(b);c=a.display;var g=c.lineDiv.getBoundingClientRect();if(f>g.bottom||!ta(a,d))return gd(b);f-=g.top-c.viewOffset;for(g=0;g=e)return e=Xa(a.doc,f),R(a,d,a,e,a.display.gutterSpecs[g].className,b),gd(b)}}function hg(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");Rb(a)}function wh(a,b,d){!b!=!(d&&d!=Eb)&&(d=a.display.dragFunctions,b=b?y:na,b(a.display.scroller,"dragstart",d.start),b(a.display.scroller,"dragenter",d.enter),b(a.display.scroller,"dragover",d.over),b(a.display.scroller,"dragleave",d.leave),b(a.display.scroller, "drop",d.drop))}function xh(a){a.options.lineWrapping?(Ta(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(eb(a.display.wrapper,"CodeMirror-wrap"),vd(a));Jd(a);ha(a);Rb(a);setTimeout(function(){return vb(a)},100)}function Q(a,b){var d=this;if(!(this instanceof Q))return new Q(a,b);this.options=b=b?Ua(b):{};Ua(ig,b,!1);var c=b.value;"string"==typeof c?c=new ja(c,b.mode,null,b.lineSeparator,b.direction):b.mode&&(c.modeOption=b.mode);this.doc=c;var e= new Q.inputStyles[b.inputStyle](this);a=this.display=new Wg(a,c,e,b);a.wrapper.CodeMirror=this;hg(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");mf(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 jb,keySeq:null,specialChars:null};b.autofocus&&!Zb&&a.input.focus();D&&11>P&&setTimeout(function(){return d.display.input.reset(!0)}, 20);yh(this);jg||(fh(),jg=!0);gb(this);this.curOp.forceUpdate=!0;wf(this,c);b.autofocus&&!Zb||this.hasFocus()?setTimeout(bd(Md,this),20):Tb(this);for(var f in Yc)if(Yc.hasOwnProperty(f))Yc[f](d,b[f],Eb);pf(this);b.finishInit&&b.finishInit(this);for(c=0;cP?y(c.scroller,"dblclick",W(a,function(h){if(!V(a,h)){var k=bb(a,h);!k||Xc(a,h,"gutterClick",!0)||Ia(a.display,h)||(fa(h),h=a.findWordAt(k),Rc(a.doc,h.anchor,h.head))}})):y(c.scroller,"dblclick",function(h){return V(a,h)||fa(h)});y(c.scroller,"contextmenu",function(h){var k;(k=Ia(a.display,h))||(k=ta(a,"gutterContextMenu")? Xc(a,h,"gutterContextMenu",!1):!1);if(!(k||V(a,h,"contextmenu")||fe))a.display.input.onContextMenu(h)});var e,f={end:0};y(c.scroller,"touchstart",function(h){var k;if(k=!V(a,h))1!=h.touches.length?k=!1:(k=h.touches[0],k=1>=k.radiusX&&1>=k.radiusY),k=!k;k&&!Xc(a,h,"gutterClick",!0)&&(c.input.ensurePolled(),clearTimeout(e),k=+new Date,c.activeTouch={start:k,moved:!1,prev:300>=k-f.end?f:null},1==h.touches.length&&(c.activeTouch.left=h.touches[0].pageX,c.activeTouch.top=h.touches[0].pageY))});y(c.scroller, "touchmove",function(){c.activeTouch&&(c.activeTouch.moved=!0)});y(c.scroller,"touchend",function(h){var k=c.activeTouch;if(k&&!Ia(c,h)&&null!=k.left&&!k.moved&&300>new Date-k.start){var l=a.coordsChar(c.activeTouch,"page");k=!k.prev||d(k,k.prev)?new F(l,l):!k.prev.prev||d(k,k.prev.prev)?a.findWordAt(l):new F(t(l.line,0),A(a.doc,t(l.line+1,0)));a.setSelection(k.anchor,k.head);a.focus();fa(h)}b()});y(c.scroller,"touchcancel",b);y(c.scroller,"scroll",function(){c.scroller.clientHeight&&(Vb(a,c.scroller.scrollTop), fb(a,c.scroller.scrollLeft,!0),R(a,"scroll",a))});y(c.scroller,"mousewheel",function(h){return sf(a,h)});y(c.scroller,"DOMMouseScroll",function(h){return sf(a,h)});y(c.wrapper,"scroll",function(){return c.wrapper.scrollTop=c.wrapper.scrollLeft=0});c.dragFunctions={enter:function(h){V(a,h)||Jb(h)},over:function(h){if(!V(a,h)){var k=bb(a,h);if(k){var l=document.createDocumentFragment();df(a,k,l);a.display.dragCursor||(a.display.dragCursor=x("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor, a.display.cursorDiv));ma(a.display.dragCursor,l)}Jb(h)}},start:function(h){if(D&&(!a.state.draggingText||100>+new Date-Tf))Jb(h);else if(!V(a,h)&&!Ia(a.display,h)&&(h.dataTransfer.setData("Text",a.getSelection()),h.dataTransfer.effectAllowed="copyMove",h.dataTransfer.setDragImage&&!kg)){var k=x("img",null,null,"position: fixed; left: 0; top: 0;");k.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";xa&&(k.width=k.height=1,a.display.wrapper.appendChild(k),k._top=k.offsetTop); h.dataTransfer.setDragImage(k,0,0);xa&&k.parentNode.removeChild(k)}},drop:W(a,eh),leave:function(h){V(a,h)||Sf(a)}};var g=c.input.getField();y(g,"keyup",function(h){return dg.call(a,h)});y(g,"keydown",W(a,cg));y(g,"keypress",W(a,eg));y(g,"focus",function(h){return Md(a,h)});y(g,"blur",function(h){return Tb(a,h)})}function lc(a,b,d,c){var e=a.doc,f;null==d&&(d="add");"smart"==d&&(e.mode.indent?f=Lb(a,b).state:d="prev");var g=a.options.tabSize,h=v(e,b),k=sa(h.text,null,g);h.stateAfter&&(h.stateAfter= null);var l=h.text.match(/^\s*/)[0];if(!c&&!/\S/.test(h.text)){var m=0;d="not"}else if("smart"==d&&(m=e.mode.indent(f,h.text.slice(l.length),h.text),m==Wc||150e.first?sa(v(e,b-1).text,null,g):0:"add"==d?m=k+a.options.indentUnit:"subtract"==d?m=k-a.options.indentUnit:"number"==typeof d&&(m=k+d);m=Math.max(0,m);d="";c=0;if(a.options.indentWithTabs)for(a=Math.floor(m/g);a;--a)c+=g,d+="\t";cg,k=je(b),l=null;if(h&&1g?"cut":"+input")};zb(a.doc,n);Y(a,"inputRead",a,n)}b&&!h&&lg(a,b);ub(a);2>a.curOp.updateInput&&(a.curOp.updateInput= m);a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=-1}function mg(a,b){var d=a.clipboardData&&a.clipboardData.getData("Text");if(d)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||ka(b,function(){return ie(b,d,0,null,"paste")}),!0}function lg(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var d=a.doc.sel,c=d.ranges.length-1;0<=c;c--){var e=d.ranges[c];if(!(100=a.first+a.size?p=!1:(b=new t(p,b.ch,b.sticky),p=k=v(a,p));if(p)b=ce(e,a.cm,k,b.line,d);else return!1}else b=r;return!0}var g=b,h=d,k=v(a,b.line);if("char"==c)f();else if("column"==c)f(!0);else if("word"==c||"group"==c){var l=null;c="group"==c;for(var m=a.cm&&a.cm.getHelper(b,"wordChars"),q=!0;!(0>d)||f(!q);q=!1){var n=k.text.charAt(b.ch)||"\n";n=wc(n,m)?"w":c&&"\n"==n?"n":!c||/\s/.test(n)?null:"p";!c||q||n||(n="s");if(l&&l!=n){0>d&&(d=1,f(),b.sticky="after");break}n&&(l= n);if(0d?0>=g:g>=e.height){b.hitSide=!0;break}g+=5*d}return b}function rg(a,b){var d=Ad(a,b.line);if(!d||d.hidden)return null;var c= v(a.doc,b.line);d=Qe(d,c,b.line);a=Ga(c,a.doc.direction);c="left";a&&(c=Hb(a,b.ch)%2?"right":"left");b=Re(d.map,b.ch,c);b.offset="right"==b.collapse?b.end:b.start;return b}function zh(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function Fb(a,b){b&&(a.bad=!0);return a}function Ah(a,b,d,c,e){function f(p){return function(r){return r.id==p}}function g(){m&&(l+=q,n&&(l+=q),m=n=!1)}function h(p){p&&(g(),l+=p)}function k(p){if(1==p.nodeType){var r=p.getAttribute("cm-text"); if(r)h(r);else{r=p.getAttribute("cm-marker");var u;if(r)p=a.findMarks(t(c,0),t(e+1,0),f(+r)),p.length&&(u=p[0].find(0))&&h(Wa(a.doc,u.from,u.to).join(q));else if("false"!=p.getAttribute("contenteditable")&&(u=/^(pre|div|p|li|table|br)$/i.test(p.nodeName),/^br$/i.test(p.nodeName)||0!=p.textContent.length)){u&&g();for(r=0;rp?k.map:l[p],u=0;up?a.line:a.rest[p]);p=r[u]+n;if(0>n||B!=m)p=r[u+(n?1:0)];return t(q,p)}}}var e=a.text.firstChild,f=!1;if(!b||!Ka(e,b))return Fb(t(J(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[d],d=0,!b))return d=a.rest?G(a.rest):a.line,Fb(t(J(d),d.text.length),f);var g=3==b.nodeType?b:null,h=b;g||1!=b.childNodes.length||3!=b.firstChild.nodeType||(g=b.firstChild,d&&(d=g.nodeValue.length));for(;h.parentNode!=e;)h= h.parentNode;var k=a.measure,l=k.maps;if(b=c(g,h,d))return Fb(b,f);e=h.nextSibling;for(g=g?g.nodeValue.length-d:0;e;e=e.nextSibling){if(b=c(e,e.firstChild,0))return Fb(t(b.line,b.ch-g),f);g+=e.textContent.length}for(h=h.previousSibling;h;h=h.previousSibling){if(b=c(h,h.firstChild,-1))return Fb(t(b.line,b.ch+d),f);d+=h.textContent.length}}var ea=navigator.userAgent,sg=navigator.platform,Oa=/gecko\/\d/i.test(ea),tg=/MSIE \d/.test(ea),ug=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ea),nc=/Edge\/(\d+)/.exec(ea), D=tg||ug||nc,P=D&&(tg?document.documentMode||6:+(nc||ug)[1]),ba=!nc&&/WebKit\//.test(ea),Ch=ba&&/Qt\/\d+\.\d+/.test(ea),Fc=!nc&&/Chrome\//.test(ea),xa=/Opera\//.test(ea),kg=/Apple Computer/.test(navigator.vendor),Dh=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ea),Tg=/PhantomJS/.test(ea),mc=!nc&&/AppleWebKit/.test(ea)&&/Mobile\/\w+/.test(ea),Gc=/Android/.test(ea),Zb=mc||Gc||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ea),ua=mc||/Mac/.test(sg),rh=/\bCrOS\b/.test(ea),Eh=/win/i.test(sg),kb=xa&&ea.match(/Version\/(\d*\.\d*)/); kb&&(kb=Number(kb[1]));kb&&15<=kb&&(xa=!1,ba=!0);var Xf=ua&&(Ch||xa&&(null==kb||12.11>kb)),fe=Oa||D&&9<=P,eb=function(a,b){var d=a.className;if(b=Sa(b).exec(d)){var c=d.slice(b.index+b[0].length);a.className=d.slice(0,b.index)+(c?b[1]+c:"")}};var Nb=document.createRange?function(a,b,d,c){var e=document.createRange();e.setEnd(c||a,d);e.setStart(a,b);return e}:function(a,b,d){var c=document.body.createTextRange();try{c.moveToElementText(a.parentNode)}catch(e){return c}c.collapse(!0);c.moveEnd("character", d);c.moveStart("character",b);return c};var oc=function(a){a.select()};mc?oc=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:D&&(oc=function(a){try{a.select()}catch(b){}});var jb=function(){this.id=null};jb.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var Wc={toString:function(){return"CodeMirror.Pass"}},Ea={scroll:!1},ge={origin:"*mouse"},pc={origin:"+move"},uc=[""],wg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/, xg=/[\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]/, Ib=null,zg=function(){function a(h){return 247>=h?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(h):1424<=h&&1524>=h?"R":1536<=h&&1785>=h?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(h- 1536):1774<=h&&2220>=h?"r":8192<=h&&8203>=h?"w":8204==h?"b":"L"}function b(h,k,l){this.level=h;this.from=k;this.to=l}var d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,c=/[stwN]/,e=/[LRr]/,f=/[Lb1n]/,g=/[1n]/;return function(h,k){var l="ltr"==k?"L":"R";if(0==h.length||"ltr"==k&&!d.test(h))return!1;for(var m=h.length,q=[],n=0;nP)return!1;var a=x("div");return"draggable"in a||"dragDrop"in a}(),hd,wd,je=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,d=[],c=a.length;b<=c;){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?(d.push(f.slice(0,g)),b+=g+ 1):(d.push(f),b=e+1)}return d}:function(a){return a.split(/\r\n?|\n/)},Fh=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(d){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},mh=function(){var a=x("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),Cd=null,id={},ob={},pb={},S=function(a,b,d){this.pos=this.start= 0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.lineOracle=d};S.prototype.eol=function(){return this.pos>=this.string.length};S.prototype.sol=function(){return this.pos==this.lineStart};S.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};S.prototype.next=function(){if(this.posb};S.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};S.prototype.skipToEnd=function(){this.pos=this.string.length};S.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1this.maxLookAhead&&(this.maxLookAhead=a);return b};Aa.prototype.baseToken=function(a){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=a;)this.baseTokenPos+=2;var b=this.baseTokens[this.baseTokenPos+ 1];return{type:b&&b.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-a}};Aa.prototype.nextLine=function(){this.line++;0P&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};lb.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,d=a.scrollHeight>a.clientHeight+1,c=a.nativeBarWidth;d?(this.vert.style.display="block",this.vert.style.bottom=b?c+"px":"0",this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight- (b?c:0)))+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0");b?(this.horiz.style.display="block",this.horiz.style.right=d?c+"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-(d?c:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0");!this.checkedZeroWidth&&0=z(a,c.to()))return d}return-1}; var F=function(a,b){this.anchor=a;this.head=b};F.prototype.from=function(){return Ac(this.anchor,this.head)};F.prototype.to=function(){return zc(this.anchor,this.head)};F.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};cc.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var d=a,c=a+b;dthis.size-b&&(1=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5);b=new dc(b);if(a.parent){a.size-=b.size;a.height-=b.height;var d=aa(a.parent.children,a);a.parent.children.splice(d+1,0,b)}else d=new dc(a.children),d.parent=a,a.children=[d,b],a=d;b.parent=a.parent}while(10< a.children.length);a.parent.maybeSpill()}},iterN:function(a,b,d){for(var c=0;ca.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=d&&a&&this.collapsed&&ha(a,d,c+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Gf(a.doc));a&&Y(a,"markerCleared",a,this,d,c); b&&hb(a);this.parent&&this.parent.clear()}};Qa.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var d,c,e=0;ez(h.head,h.anchor),a[f]=new F(h?k:g,h?g:k)):a[f]=new F(g,g)}a=new qa(a,this.sel.primIndex)}b=a;for(a=c.length-1;0<=a;a--)zb(this, c[a]);b?Df(this,b):this.cm&&ub(this.cm)}),undo:X(function(){Tc(this,"undo")}),redo:X(function(){Tc(this,"redo")}),undoSelection:X(function(){Tc(this,"undo",!0)}),redoSelection:X(function(){Tc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,d=0,c=0;c=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,d){a=A(this, a);b=A(this,b);var c=[],e=a.line;this.iter(a.line,b.line+1,function(f){if(f=f.markedSpans)for(var g=0;g=h.to||null==h.from&&e!=a.line||null!=h.from&&e==b.line&&h.from>=b.ch||d&&!d(h.marker)||c.push(h.marker.parent||h.marker)}++e});return c},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var d=0;da)return b=a,!0;a-=e;++d});return A(this,t(d,b))},indexFromPos:function(a){a=A(this,a);var b=a.ch;if(a.linea.ch)return 0;var d=this.lineSeparator().length;this.iter(this.first,a.line,function(c){b+=c.text.length+d});return b},copy:function(a){var b=new ja(ld(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth= this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||(a={});var b=this.first,d=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.torc;rc++)Ra[rc+48]=Ra[rc+96]=String(rc);for(var $c=65;90>=$c;$c++)Ra[$c]=String.fromCharCode($c);for(var sc=1;12>=sc;sc++)Ra[sc+111]=Ra[sc+63235]="F"+sc;var gc={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"]}};gc["default"]=ua?gc.macDefault:gc.pcDefault;var hc={selectAll:If,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Ea)},killLine:function(a){return Db(a,function(b){if(b.empty()){var d= v(a.doc,b.head.line).text.length;return b.head.ch==d&&b.head.linea.doc.first){var g=v(a.doc,e.line-1).text;g&&(e=new t(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),t(e.line-1,g.length-1),e,"+transpose"))}d.push(new F(e,e))}a.setSelections(d)})},newlineAndIndent:function(a){return ka(a,function(){for(var b=a.listSelections(), d=b.length-1;0<=d;d--)a.replaceRange(a.doc.lineSeparator(),b[d].anchor,b[d].head,"+input");b=a.listSelections();for(d=0;da&&0==z(b,this.pos)&&d==this.button};var kc,jc,Eb={toString:function(){return"CodeMirror.Init"}}, ig={},Yc={};Q.defaults=ig;Q.optionHandlers=Yc;var he=[];Q.defineInitHook=function(a){return he.push(a)};var la=null,L=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new jb;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};L.prototype.init=function(a){function b(g){if(!V(e,g)){if(e.somethingSelected())la={lineWise:!1,text:e.getSelections()},"cut"==g.type&&e.replaceSelection("",null,"cut");else if(e.options.lineWiseCopyCut){var h= ng(e);la={lineWise:!0,text:h.text};"cut"==g.type&&e.operation(function(){e.setSelections(h.ranges,0,Ea);e.replaceSelection("",null,"cut")})}else return;if(g.clipboardData){g.clipboardData.clearData();var k=la.text.join("\n");g.clipboardData.setData("Text",k);if(g.clipboardData.getData("Text")==k){g.preventDefault();return}}var l=pg();g=l.firstChild;e.display.lineSpace.insertBefore(l,e.display.lineSpace.firstChild);g.value=la.text.join("\n");var m=document.activeElement;oc(g);setTimeout(function(){e.display.lineSpace.removeChild(l); m.focus();m==f&&c.showPrimarySelection()},50)}}var d=this,c=this,e=c.cm,f=c.div=a.lineDiv;og(f,e.options.spellcheck,e.options.autocorrect,e.options.autocapitalize);y(f,"paste",function(g){V(e,g)||mg(g,e)||11>=P&&setTimeout(W(e,function(){return d.updateFromDOM()}),20)});y(f,"compositionstart",function(g){d.composing={data:g.data,done:!1}});y(f,"compositionupdate",function(g){d.composing||(d.composing={data:g.data,done:!1})});y(f,"compositionend",function(g){d.composing&&(g.data!=d.composing.data&& d.readFromDOMSoon(),d.composing.done=!0)});y(f,"touchstart",function(){return c.forceCompositionEnd()});y(f,"input",function(){d.composing||d.readFromDOMSoon()});y(f,"copy",b);y(f,"cut",b)};L.prototype.prepareSelection=function(){var a=cf(this.cm,!1);a.focus=this.cm.state.focused;return a};L.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};L.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()}; L.prototype.showPrimarySelection=function(){var a=this.getSelection(),b=this.cm,d=b.doc.sel.primary(),c=d.from();d=d.to();if(b.display.viewTo==b.display.viewFrom||c.line>=b.display.viewTo||d.line=b.display.viewFrom&&rg(b,c)||{node:e[0].measure.map[2],offset:0},d=d.linea.firstLine()&&(c=t(c.line-1,v(a.doc,c.line-1).length));e.ch==v(a.doc,e.line).text.length&&e.lineb.viewTo-1)return!1;var f;c.line==b.viewFrom||0==(f=Za(a,c.line))?(d=J(b.view[0].line),f=b.view[0].node):(d=J(b.view[f].line),f=b.view[f- 1].node.nextSibling);var g=Za(a,e.line);g==b.view.length-1?(e=b.viewTo-1,b=b.lineDiv.lastChild):(e=J(b.view[g+1].line)-1,b=b.view[g+1].node.previousSibling);if(!f)return!1;b=a.doc.splitLines(Ah(a,f,b,d,e));for(f=Wa(a.doc,t(d,0),t(e,v(a.doc,e).text.length));1c.ch&&k.charCodeAt(k.length-g-1)==l.charCodeAt(l.length-g-1);)h--,g++;b[b.length-1]=k.slice(0,k.length-g).replace(/^\u200b+/,"");b[0]=b[0].slice(h).replace(/\u200b+$/,"");c=t(d,h);d=t(e,f.length?G(f).length-g:0);if(1P&&f.scrollbars.setScrollTop(f.scroller.scrollTop=k),null!=g.selectionStart)){(!D||D&&9>P)&&b();var p=0,r=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&0p++?f.detectingSelectAll=setTimeout(r,500):(f.selForContextMenu=null,f.input.reset())};f.detectingSelectAll=setTimeout(r,200)}}var c=this,e=c.cm,f=e.display,g=c.textarea;c.contextMenuPending&&c.contextMenuPending();var h=bb(e, a),k=f.scroller.scrollTop;if(h&&!xa){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(h)&&W(e,Z)(e.doc,Ja(h),Ea);var l=g.style.cssText,m=c.wrapper.style.cssText;h=c.wrapper.offsetParent.getBoundingClientRect();c.wrapper.style.cssText="position: static";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: "+(D?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; if(ba)var q=window.scrollY;f.input.focus();ba&&window.scrollTo(null,q);f.input.reset();e.somethingSelected()||(g.value=c.prevInput=" ");c.contextMenuPending=d;f.selForContextMenu=e.doc.sel;clearTimeout(f.detectingSelectAll);D&&9<=P&&b();if(fe){Jb(a);var n=function(){na(window,"mouseup",n);setTimeout(d,20)};y(window,"mouseup",n)}else setTimeout(d,50)}};T.prototype.readOnlyChanged=function(a){a||this.reset();this.textarea.disabled="nocursor"==a};T.prototype.setUneditable=function(){};T.prototype.needsContentAttribute= !1;(function(a){function b(c,e,f,g){a.defaults[c]=e;f&&(d[c]=g?function(h,k,l){l!=Eb&&f(h,k,l)}:f)}var d=a.optionHandlers;a.defineOption=b;a.Init=Eb;b("value","",function(c,e){return c.setValue(e)},!0);b("mode",null,function(c,e){c.doc.modeOption=e;Vd(c)},!0);b("indentUnit",2,Vd,!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(c){$b(c);Rb(c);ha(c)},!0);b("lineSeparator",null,function(c,e){if(c.doc.lineSep=e){var f=[],g=c.doc.first;c.doc.iter(function(k){for(var l=0;;){var m=k.text.indexOf(e, l);if(-1==m)break;l=m+e.length;f.push(t(g,m))}g++});for(var h=f.length-1;0<=h;h--)Ab(c.doc,e,f[h],t(f[h].line,f[h].ch+e.length))}});b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(c,e,f){c.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g");f!=Eb&&c.refresh()});b("specialCharPlaceholder",Kg,function(c){return c.refresh()},!0);b("electricChars",!0);b("inputStyle",Zb?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor"); },!0);b("spellcheck",!1,function(c,e){return c.getInputField().spellcheck=e},!0);b("autocorrect",!1,function(c,e){return c.getInputField().autocorrect=e},!0);b("autocapitalize",!1,function(c,e){return c.getInputField().autocapitalize=e},!0);b("rtlMoveVisually",!Eh);b("wholeLineUpdateBefore",!0);b("theme","default",function(c){hg(c);Yb(c)},!0);b("keyMap","default",function(c,e,f){e=Uc(e);(f=f!=Eb&&Uc(f))&&f.detach&&f.detach(c,e);e.attach&&e.attach(c,f||null)});b("extraKeys",null);b("configureMouse", null);b("lineWrapping",!1,xh,!0);b("gutters",[],function(c,e){c.display.gutterSpecs=Td(e,c.options.lineNumbers);Yb(c)},!0);b("fixedGutter",!0,function(c,e){c.display.gutters.style.left=e?Id(c.display)+"px":"0";c.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(c){return vb(c)},!0);b("scrollbarStyle","native",function(c){mf(c);vb(c);c.display.scrollbars.setScrollTop(c.doc.scrollTop);c.display.scrollbars.setScrollLeft(c.doc.scrollLeft)},!0);b("lineNumbers",!1,function(c,e){c.display.gutterSpecs= Td(c.options.gutters,e);Yb(c)},!0);b("firstLineNumber",1,Yb,!0);b("lineNumberFormatter",function(c){return c},Yb,!0);b("showCursorWhenSelecting",!1,Sb,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("pasteLinesPerSelection",!0);b("selectionsMayTouch",!1);b("readOnly",!1,function(c,e){"nocursor"==e&&(Tb(c),c.display.input.blur());c.display.input.readOnlyChanged(e)});b("disableInput",!1,function(c,e){e||c.display.input.reset()},!0);b("dragDrop",!0,wh);b("allowDropFileTypes",null); b("cursorBlinkRate",530);b("cursorScrollMargin",0);b("cursorHeight",1,Sb,!0);b("singleCursorHeightPerLine",!0,Sb,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,$b,!0);b("addModeClass",!1,$b,!0);b("pollInterval",100);b("undoDepth",200,function(c,e){return c.doc.history.undoDepth=e});b("historyEventDelay",1250);b("viewportMargin",10,function(c){return c.refresh()},!0);b("maxHighlightLength",1E4,$b,!0);b("moveInputWithCursor",!0,function(c,e){e||c.display.input.resetPosition()});b("tabindex", null,function(c,e){return c.display.input.getField().tabIndex=e||""});b("autofocus",null);b("direction","ltr",function(c,e){return c.doc.setDirection(e)},!0);b("phrases",null)})(Q);(function(a){var b=a.optionHandlers,d=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(c,e){var f=this.options,g=f[c];if(f[c]!=e||"mode"==c)f[c]=e,b.hasOwnProperty(c)&&W(this,b[c])(this,e,g),R(this,"optionChange",this,c)},getOption:function(c){return this.options[c]}, getDoc:function(){return this.doc},addKeyMap:function(c,e){this.state.keyMaps[e?"push":"unshift"](Uc(c))},removeKeyMap:function(c){for(var e=this.state.keyMaps,f=0;ff&& (lc(this,h.head.line,c,!0),f=h.head.line,g==this.doc.sel.primIndex&&ub(this));else{var k=h.from();h=h.to();var l=Math.max(f,k.line);f=Math.min(this.lastLine(),h.line-(h.ch?0:1))+1;for(h=l;h>1;if((h?e[2*h-1]:0)>=c)g=h;else if(e[2*h+1]f?e:0==f?null:e.slice(0,f-1)},getModeAt:function(c){var e=this.doc.mode;return e.innerMode?a.innerMode(e,this.getTokenAt(c).state).mode:e},getHelper:function(c,e){return this.getHelpers(c,e)[0]},getHelpers:function(c,e){var f=[];if(!d.hasOwnProperty(e))return f;var g=d[e];c=this.getModeAt(c);if("string"==typeof c[e])g[c[e]]&& f.push(g[c[e]]);else if(c[e])for(var h=0;hh&&(c=h,g=!0);c=v(this.doc,c)}return Hc(this, c,{top:0,left:0},e||"page",f||g).top+(g?this.doc.height-Ca(c):0)},defaultTextHeight:function(){return tb(this.display)},defaultCharWidth:function(){return sb(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(c,e,f,g,h){var k=this.display;c=wa(this,A(this.doc,c));var l=c.bottom,m=c.left;e.style.position="absolute";e.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(e);k.sizer.appendChild(e);if("over"==g)l=c.top; else if("above"==g||"near"==g){var q=Math.max(k.wrapper.clientHeight,this.doc.height),n=Math.max(k.sizer.clientWidth,k.lineSpace.clientWidth);("above"==g||c.bottom+e.offsetHeight>q)&&c.top>e.offsetHeight?l=c.top-e.offsetHeight:c.bottom+e.offsetHeight<=q&&(l=c.bottom);m+e.offsetWidth>n&&(m=n-e.offsetWidth)}e.style.top=l+"px";e.style.left=e.style.right="";"right"==h?(m=k.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==h?m=0:"middle"==h&&(m=(k.sizer.clientWidth-e.offsetWidth)/2),e.style.left= m+"px");f&&(c=Od(this,{left:m,top:l,right:m+e.offsetWidth,bottom:l+e.offsetHeight}),null!=c.scrollTop&&Vb(this,c.scrollTop),null!=c.scrollLeft&&fb(this,c.scrollLeft))},triggerOnKeyDown:da(cg),triggerOnKeyPress:da(eg),triggerOnKeyUp:dg,triggerOnMouseDown:da(fg),execCommand:function(c){if(hc.hasOwnProperty(c))return hc[c].call(null,this)},triggerElectric:da(function(c){lg(this,c)}),findPosH:function(c,e,f,g){var h=1;0>e&&(h=-1,e=-e);c=A(this.doc,c);for(var k=0;kc?g.from():g.to()},pc)}),deleteH:da(function(c,e){var f=this.doc;this.doc.sel.somethingSelected()?f.replaceSelection("",null,"+delete"):Db(this,function(g){var h=ke(f,g.head,c,e,!1);return 0>c?{from:h,to:g.head}:{from:g.head,to:h}})}),findPosV:function(c,e,f,g){var h=1;0>e&&(h=-1,e=-e);var k=A(this.doc,c);for(c=0;cc?m.from():m.to();var q=wa(f,m.head,"div");null!=m.goalColumn&&(q.left=m.goalColumn);h.push(q.left);var n=qg(f,q,c,e);"page"==e&&m==g.sel.primary()&&Lc(f,Ed(f,n,"div").top-q.top);return n},pc);if(h.length)for(var l=0;laa(Hh,tc)&&(Q.prototype[tc]=function(a){return function(){return a.apply(this.doc,arguments)}}(ja.prototype[tc]));nb(ja);Q.inputStyles={textarea:T,contenteditable:L};Q.defineMode=function(a){Q.defaults.mode||"null"==a||(Q.defaults.mode=a);Bg.apply(this,arguments)};Q.defineMIME=function(a,b){ob[a]=b};Q.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}}); Q.defineMIME("text/plain","null");Q.defineExtension=function(a,b){Q.prototype[a]=b};Q.defineDocExtension=function(a,b){ja.prototype[a]=b};Q.fromTextArea=function(a,b){function d(){a.value=h.getValue()}b=b?Ua(b):{};b.value=a.value;!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex);!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder);if(null==b.autofocus){var c=Fa();b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(y(a.form,"submit",d),!b.leaveSubmitMethodAlone)){var e= a.form;var f=e.submit;try{var g=e.submit=function(){d();e.submit=f;e.submit();e.submit=g}}catch(k){}}b.finishInit=function(k){k.save=d;k.getTextArea=function(){return a};k.toTextArea=function(){k.toTextArea=isNaN;d();a.parentNode.removeChild(k.getWrapperElement());a.style.display="";a.form&&(na(a.form,"submit",d),"function"==typeof a.form.submit&&(a.form.submit=f))}};a.style.display="none";var h=Q(function(k){return a.parentNode.insertBefore(k,a.nextSibling)},b);return h};(function(a){a.off=na;a.on= y;a.wheelEventPixels=Xg;a.Doc=ja;a.splitLines=je;a.countColumn=sa;a.findColumn=cd;a.isWordChar=ed;a.Pass=Wc;a.signal=R;a.Line=wb;a.changeEnd=Pa;a.scrollbarModel=nf;a.Pos=t;a.cmpPos=z;a.modes=id;a.mimeModes=ob;a.resolveMode=yc;a.getMode=jd;a.modeExtensions=pb;a.extendMode=Cg;a.copyState=Va;a.startState=se;a.innerMode=kd;a.commands=hc;a.keyMap=gc;a.keyName=Yf;a.isModifierKey=Vf;a.lookupKey=Cb;a.normalizeKeyMap=ih;a.StringStream=S;a.SharedTextMarker=fc;a.TextMarker=Qa;a.LineWidget=ec;a.e_preventDefault= fa;a.e_stopPropagation=qe;a.e_stop=Jb;a.addClass=Ta;a.contains=Ka;a.rmClass=eb;a.keyNames=Ra})(Q);Q.version="5.46.0";return Q});