// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// codemirror.js
// addon/comment/comment.js
// addon/comment/continuecomment.js
// addon/edit/closebrackets.js
// addon/edit/matchbrackets.js
// addon/edit/closetag.js
// addon/hint/show-hint.js
// addon/lint/lint.js
// addon/search/search.js
// addon/search/searchcursor.js
// addon/scroll/simplescrollbars.js
// addon/scroll/annotatescrollbar.js
// addon/search/matchesonscrollbar.js
// addon/search/match-highlighter.js
// addon/fold/foldcode.js
// addon/fold/foldgutter.js
// addon/fold/brace-fold.js
// addon/fold/indent-fold.js
// addon/fold/comment-fold.js
// addon/dialog/dialog.js
// keymap/vim.js
// addon/mode/overlay.js
// addon/mode/simple.js
// mode/meta.js
// mode/clike/clike.js
// mode/dart/dart.js
// mode/markdown/markdown.js
// codemirror.js
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(y,E,D){y instanceof String&&(y=String(y));for(var v=y.length,M=0;M>>0,$jscomp.propertyToPolyfillSymbol[M]=
$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(M):$jscomp.POLYFILL_PREFIX+D+"$"+M),$jscomp.defineProperty(v,$jscomp.propertyToPolyfillSymbol[M],{configurable:!0,writable:!0,value:E})))};$jscomp.polyfill("Array.prototype.find",function(y){return y?y:function(E,D){return $jscomp.findInternal(this,E,D).v}},"es6","es3");
(function(y,E){"object"===typeof exports&&"undefined"!==typeof module?module.exports=E():"function"===typeof define&&define.amd?define(E):(y=y||self,y.CodeMirror=E())})(this,function(){function y(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function E(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 ea(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 jd(a){for(;wc.length<=a;)wc.push(J(wc)+" ");return wc[a]}function J(a){return a[a.length-
1]}function xc(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 Cg(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 Lb(a,
b,d){var c;Mb=null;for(var e=0;eb)return e;f.to==b&&(f.from!=f.to&&"before"==d?c=e:Mb=e);f.from==b&&(f.from!=f.to&&"before"!=d?c=e:Mb=e)}return null!=c?c:Mb}function Ja(a,b){var d=a.order;null==d&&(d=a.order=Dg(a.text,b));return d}function sa(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=ea(c,d),-1b||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&&bB(a,b)?b:a}function Cc(a,b){return 0>B(a,b)?a:b}function C(a,b){if(b.lined)return t(d,w(a,d).text.length);a=w(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 ze(a,b){for(var d=[],c=0;cp&&e.splice(m,1,p,e[m+1],u);m+=2;n=Math.min(p,u)}if(q)if(l.opaque)e.splice(r,m-r,p,"overlay "+q),m=r+2;else for(;ra.options.maxHighlightLength&&ab(a.doc.mode,c.state),f=Ae(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 Pb(a,b,d){var c=a.doc,e=a.display;if(!c.mode.startState)return new Fa(c,
!0,b);var f=Gg(a,b,d),g=f>c.first&&w(c,f-1).stateAfter,h=g?Fa.fromSaved(c,g,f):new Fa(c,ye(c.mode),f);c.iter(f,b,function(k){ud(a,k.text,h);var l=h.line;k.stateAfter=l==b-1||0==l%5||l>=e.viewFrom&≤e++){c&&(c[0]=pd(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 Ee(a,b,d,c){var e=a.doc,f=e.mode;b=C(e,b);var g=w(e,b.line);d=Pb(a,b.line,d);a=new X(g.text,a.options.tabSize,d);var h;for(c&&(h=[]);(c||a.posa.options.maxHighlightLength){h=
!1;g&&ud(a,b,c,m.pos);m.pos=b.length;var p=null}else p=Ge(vd(d,m,c.state,n),f);if(n){var q=n[0].name;q&&(p="m-"+(p?q+" "+p:q))}if(!h||l!=p){for(;kg;--b){if(b<=f.first)return f.first;var h=w(f,b-1),k=h.stateAfter;if(k&&(!d||b+(k instanceof Dc?k.lookAhead:0)<=f.modeFrontier))return b;h=wa(h.text,null,a.options.tabSize);
if(null==e||c>h)e=b-1,c=h}return e}function Hg(a,b){a.modeFrontier=Math.min(a.modeFrontier,b);if(!(a.highlightFrontierd;c--){var e=w(a,c).stateAfter;if(e&&(!(e instanceof Dc)||c+e.lookAhead=a:k.to>a);(g||(g=[])).push(new Ec(l,k.from,m?null:k.to))}}d=g;var n;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.fromB(g.to,e.from)||0k||!d.inclusiveLeft&&!k)&&h.push({from:g.from,to:e.from});(0xd(e,d.marker)))var e=
d.marker;return e}function Ke(a,b,d,c,e){a=w(a,b);if(a=Ka&&a.markedSpans)for(b=0;b=k||0>=h&&0<=k)&&(0>=h&&(f.marker.inclusiveRight&&e.inclusiveLeft?0<=B(g.to,d):0=B(g.from,c):0>B(g.from,c))))return!0}}}function za(a){for(var b;b=
tb(a,!0);)a=b.find(-1,!0).line;return a}function yd(a,b){a=w(a,b);var d=za(a);return a==d?b:N(d)}function Le(a,b){if(b>a.lastLine())return b;var d=w(a,b);if(!Qa(a,d))return b;for(;a=tb(d,!1);)d=a.find(1,!0).line;return N(d)+1}function Qa(a,b){var d=Ka&&b.markedSpans;if(d)for(var c,e=0;eb.maxLineLength&&(b.maxLineLength=c,b.maxLine=d)})}function Me(a,b){if(!a||/^\s*$/.test(a))return null;b=b.addModeClass?
Jg:Kg;return b[a]||(b[a]=a.replace(/\S+/g,"cm-$&"))}function Ne(a,b){var d=M("span",null,null,fa?"padding-right: .1px":null);d={pre:M("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=Lg;var g=a.display.measure;if(null!=Bd)g=Bd;else{var h=D(g,document.createTextNode("A\u062eA")),k=Rb(h,0,1).getBoundingClientRect();h=Rb(h,1,
2).getBoundingClientRect();E(g);g=k&&k.left!=k.right?Bd=3>h.right-k.right:!1}g&&(f=Ja(e,a.doc.direction))&&(d.addToken=Mg(d.addToken,f));d.map=[];var l=b!=a.display.externalMeasured&&N(e);a:{var m=h=k=g=void 0,n=void 0,p=void 0,q=void 0;f=d;l=Ce(a,e,l);var r=e.markedSpans,u=e.text,A=0;if(r)for(var Y=u.length,x=0,P=1,K="",Q=0;;){if(Q==x){n=m=h=p="";k=g=null;Q=Infinity;for(var S=[],F=void 0,R=0;Rx||L.collapsed&&H.to==x&&H.from==x)){null!=H.to&&H.to!=x&&Q>H.to&&(Q=H.to,m="");L.className&&(n+=" "+L.className);L.css&&(p=(p?p+";":"")+L.css);L.startStyle&&H.from==x&&(h+=" "+L.startStyle);L.endStyle&&H.to==Q&&(F||(F=[])).push(L.endStyle,H.to);L.title&&((g||(g={})).title=L.title);if(L.attributes)for(var ha in L.attributes)(g||(g={}))[ha]=L.attributes[ha];L.collapsed&&(!k||0>xd(k.marker,L))&&(k=H)}else H.from>x&&Q>H.from&&(Q=H.from)}if(F)for(R=0;R=Y)break;for(S=Math.min(Y,Q);;){if(K){F=x+K.length;k||(R=F>S?K.slice(0,S-x):K,f.addToken(f,R,q?q+n:n,h,x+R.length==Q?m:"",p,g));if(F>=S){K=K.slice(S-x);x=S;break}x=F;h=""}K=u.slice(A,A=l[P++]);q=Me(l[P++],f.cm.options)}}else for(g=1;g=m.offsetWidth&&2T))),h=Cd?v("span","\u200b"):v("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px"),
h.setAttribute("cm-text",""),f.call(e,0,0,k.call(g,h)));0==c?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}fa&&(ha=d.content.lastChild,/\bcm-tab\b/.test(ha.className)||ha.querySelector&&ha.querySelector(".cm-tab"))&&(d.content.className="cm-tab-wrap-hack");W(a,"renderLine",a,b.line,d.pre);d.pre.className&&(d.textClass=gd(d.pre.className,d.textClass||""));return d}function Ng(a){var b=v("span","\u2022",
"cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);b.setAttribute("aria-label",b.title);return b}function Lg(a,b,d,c,e,f,g){if(b){if(a.splitSpaces){var h=a.trailingSpace;if(1T?h.appendChild(v("span",[r])):h.appendChild(r);a.map.push(a.pos,a.pos+q,r);a.col+=q;a.pos+=q}if(!p)break;n+=q+1;"\t"==p[0]?(p=a.cm.options.tabSize,p-=a.col%p,q=h.appendChild(v("span",jd(p),"cm-tab")),q.setAttribute("role","presentation"),q.setAttribute("cm-text","\t"),a.col+=p):("\r"==p[0]||"\n"==p[0]?(q=h.appendChild(v("span","\r"==p[0]?"\u240d":"\u2424","cm-invalidchar")),q.setAttribute("cm-text",p[0])):(q=a.cm.options.specialCharPlaceholder(p[0]),
q.setAttribute("cm-text",p[0]),G&&9>T?h.appendChild(v("span",[q])):h.appendChild(q)),a.col+=1);a.map.push(a.pos,a.pos+1,q);a.pos++}}else a.col+=b.length,h=document.createTextNode(k),a.map.push(a.pos,a.pos+b.length,h),G&&9>T&&(m=!0),a.pos+=b.length;a.trailingSpace=32==k.charCodeAt(b.length-1);if(d||c||e||m||f||g){b=d||"";c&&(b+=c);e&&(b+=e);c=v("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 Mg(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 n=void 0,p=0;pl&&n.from<=l);p++);if(n.to>=m)return a(d,c,e,f,g,h,k);a(d,c.slice(0,n.to-l),e,f,null,h,k);f=null;c=c.slice(n.to-l);l=n.to}}}function Oe(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 Pe(a,b,d){for(var c=this.line=b,e;c=tb(c,!1);)c=c.find(1,!0).line,(e||(e=[])).push(c);this.size=(this.rest=e)?N(J(this.rest))-d+1:1;this.node=this.text=null;this.hidden=Qa(a,b)}function Gc(a,b,d){var c=[],e;for(e=b;eT&&(a.node.style.zIndex=2));return a.node}function Re(a,b){var d=a.display.externalMeasured;return d&&d.line==b.line?(a.display.externalMeasured=
null,b.measure=d.measure,d.built):Ne(a,b)}function Dd(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=Tb(b);b.background=c.insertBefore(v("div",null,d),c.firstChild);a.display.input.setUneditable(b.background)}b.line.wrapClass?Tb(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 Se(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=Tb(b);b.gutterBackground=v("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=Tb(b),g=b.gutter=v("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?c.fixedPos:-c.gutterTotalWidth)+"px");g.setAttribute("aria-hidden","true");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(v("div",rd(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 Gd(a,b){if(b>=a.display.viewFrom&&b=a.lineN&&bp;p++){for(;h&&ld(b.line.text.charAt(g.coverStart+h));)--h;for(;g.coverStart+kT&&0==h&&k==g.coverEnd-g.coverStart)var q=
c.parentNode.getBoundingClientRect();else{q=Rb(c,h,k).getClientRects();k=Ye;if("left"==m)for(l=0;lT&&((p=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=Id?p=Id:(m=D(a.display.measure,v("span","x")),p=m.getBoundingClientRect(),m=Rb(m,0,1).getBoundingClientRect(),p=Id=1T)||h||q&&(q.left||q.right)||(q=(q=c.parentNode.getClientRects()[0])?{left:q.left,right:q.left+vb(a.display),top:q.top,bottom:q.bottom}:Ye);c=q.top-b.rect.top;h=q.bottom-b.rect.top;p=(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=Lb(k,l,b),n=Mb;m=h(l,m,"before"==b);null!=n&&(m.other=h(l,n,"before"!=b));return m}function df(a,b){var d=0;b=C(a.doc,b);a.options.lineWrapping||(d=vb(a.display)*
b.ch);b=w(a.doc,b.line);a=Ga(b)+a.display.lineSpace.offsetTop;return{left:d,right:d,top:a,bottom:a+b.height}}function Kd(a,b,d,c,e){a=t(a,b,d);a.xRel=e;c&&(a.outside=c);return a}function Ld(a,b,d){var c=a.doc;d+=a.display.viewOffset;if(0>d)return Kd(c.first,0,null,-1,-1);var e=cb(c,d),f=c.first+c.size-1;if(e>f)return Kd(c.first+c.size-1,w(c,f).text.length,null,1,1);0>b&&(b=0);for(var g=w(c,e);;){f=Rg(a,g,e,b,d);var h=void 0;var k=f.ch+(0k)&&(!h||0>xd(h,m.marker))&&(h=m.marker)}if(!h)return f;f=h.find(1);if(f.line==e)return f;g=w(c,e=f.line)}}function ef(a,b,d,c){c-=Jd(b);b=b.text.length;var e=Kb(function(f){return Aa(a,d,f-1).bottom<=c},b,0);b=Kb(function(f){return Aa(a,d,f).top>c},e,b);return{begin:e,end:b}}function ff(a,b,d,c){d||(d=fb(a,b));c=Ic(a,b,Aa(a,d,c),"line").top;return ef(a,b,d,c)}function Md(a,b,d,c){return a.bottom<=d?!1:a.top>
d?!0:(c?a.left:a.right)>b}function Rg(a,b,d,c,e){e-=Ga(b);var f=fb(a,b),g=Jd(b),h=0,k=b.text.length,l=!0,m=Ja(b,a.doc.direction);m&&(m=(a.options.lineWrapping?Sg:Tg)(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 n=null,p=null;m=Kb(function(r){var u=Aa(a,f,r);u.top+=g;u.bottom+=g;if(!Md(u,c,e,!1))return!1;u.top<=e&&u.left<=c&&(n=r,p=u);return!0},h,k);var q=!1;p?(h=c-p.left=q.bottom?1:0);m=ue(b.text,m,1);return Kd(d,m,l,q,c-h)}function Tg(a,b,d,c,e,f,g){var h=Kb(function(m){m=e[m];var n=1!=m.level;return Md(Ba(a,t(d,n?m.to:m.from,n?"before":"after"),"line",b,c),f,g,!0)},0,e.length-1),k=e[h];if(0g&&(k=e[h-1])}return k}function Sg(a,b,d,c,e,f,g){g=
ef(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=Aa(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 wb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==gb){gb=v("pre",null,"CodeMirror-line-like");for(var b=0;49>
b;++b)gb.appendChild(document.createTextNode("x")),gb.appendChild(v("br"));gb.appendChild(document.createTextNode("x"))}D(a.measure,gb);b=gb.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 ma(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&&d
b)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)Ka&&yd(a.doc,b)e.viewFrom?Sa(a):(e.viewFrom+=c,e.viewTo+=c);else if(b<=e.viewFrom&&d>=e.viewTo)Sa(a);else if(b<=e.viewFrom){var f=Kc(a,d,d+c,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=c):Sa(a)}else if(d>=e.viewTo)(f=Kc(a,b,b,-1))?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Sa(a);else{f=Kc(a,b,b,-1);var g=Kc(a,d,d+c,1);f&&g?(e.view=e.view.slice(0,f.index).concat(Gc(a,
f.lineN,g.lineN)).concat(e.view.slice(g.index)),e.viewTo+=c):Sa(a)}if(a=e.externalMeasured)d=e.lineN&&b=c.viewTo||(a=c.view[eb(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==ea(a,d)&&a.push(d)))}function Sa(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=
0}function Kc(a,b,d,c){var e=eb(a,b),f=a.display.view;if(!Ka||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 hf(a){a=a.display.view;for(var b=0,d=0;d=a.display.viewTo||k.to().liner&&(r=0);r=Math.round(r);A=Math.round(A);h.appendChild(v("div",null,"CodeMirror-selected","position: absolute; left: "+q+"px;\n top: "+r+"px; width: "+(null==u?m-q:u)+"px;\n height: "+(A-r)+"px"))}function e(q,r,u){function A(F,R){return Jc(a,t(q,F),"div",
x,R)}function Y(F,R,H){F=ff(a,x,null,F);R="ltr"==R==("after"==H)?"left":"right";H="after"==H?F.begin:F.end-(/\s/.test(x.text.charAt(F.end-1))?2:1);return A(H,R)[R]}var x=w(g,q),P=x.text.length,K,Q,S=Ja(x,g.direction);Cg(S,r||0,null==u?P:u,function(F,R,H,L){var ha="ltr"==H,na=A(F,ha?"left":"right"),ta=A(R-1,ha?"right":"left"),ib=null==r&&0==F,jb=null==u&&R==P,Qd=0==L;L=!S||L==S.length-1;3>=ta.top-na.top?(R=(n?ib:jb)&&Qd?l:(ha?na:ta).left,c(R,na.top,((n?jb:ib)&&L?m:(ha?ta:na).right)-R,na.bottom)):(ha?
(ha=n&&ib&&Qd?l:na.left,ib=n?m:Y(F,H,"before"),F=n?l:Y(R,H,"after"),jb=n&&jb&&L?m:ta.right):(ha=n?Y(F,H,"before"):l,ib=!n&&ib&&Qd?m:na.right,F=!n&&jb&&L?l:ta.left,jb=n?Y(R,H,"after"):m),c(ha,na.top,ib-ha,na.bottom),na.bottomLc(na,K))K=na;0>Lc(ta,K)&&(K=ta);if(!Q||0>Lc(na,Q))Q=na;0>Lc(ta,Q)&&(Q=ta)});return{start:K,end:Q}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),k=Ve(a.display),l=k.left,m=Math.max(f.sizerWidth,
db(a)-f.sizer.offsetLeft)-k.right,n="ltr"==g.direction;f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var p=w(g,f.line);k=w(g,b.line);k=za(p)==za(k);f=e(f.line,f.ch,k?p.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 kf(a){a.hasFocus()||(a.display.input.focus(),a.state.focused||Sd(a))}function Td(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,a.state.focused&&xb(a))},100)}function Sd(a,
b){a.state.delayingBlurEvent&&!a.state.draggingText&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(W(a,"focus",a,b),a.state.focused=!0,Za(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),fa&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),Rd(a))}function xb(a,b){a.state.delayingBlurEvent||(a.state.focused&&(W(a,"blur",a,b),a.state.focused=!1,kb(a.display.wrapper,
"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function Mc(a){for(var b=a.display,d=b.lineDiv.offsetTop,c=Math.max(0,b.scroller.getBoundingClientRect().top),e=b.lineDiv.getBoundingClientRect().top,f=0,g=0;gT){k=h.node.offsetTop+h.node.offsetHeight;var m=k-d;d=k}else{var n=h.node.getBoundingClientRect();m=n.bottom-n.top;
!k&&h.text.firstChild&&(l=h.text.firstChild.getBoundingClientRect().right-n.left-1)}k=h.line.height-m;if(.005k)if(ea.display.sizerWidth&&(l=Math.ceil(l/vb(a.display)),l>a.display.maxLineLength&&(a.display.maxLineLength=l,a.display.maxLine=h.line,a.display.maxLineChanged=!0))}}2=e&&(c=cb(b,Ga(w(b,d))-a.wrapper.clientHeight),e=d)}return{from:c,to:Math.max(e,c+1)}}function Ud(a,b){var d=a.display,c=wb(a.display);0>b.top&&
(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:d.scroller.scrollTop,f=Fd(a),g={};b.bottom-b.top>f&&(b.bottom=b.top+f);var h=a.doc.height+Ed(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.options.fixedGutter?0:d.gutters.offsetWidth;f=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:d.scroller.scrollLeft-e;a=db(a)-d.gutters.offsetWidth;if(d=b.right-b.left>a)b.right=b.left+a;10>b.left?g.scrollLeft=
0:b.lefta+f-3&&(g.scrollLeft=b.right+(d?0:10)-a);return g}function Oc(a,b){null!=b&&(Pc(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}function yb(a){Pc(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}}function Xb(a,b,d){null==b&&null==d||Pc(a);null!=b&&(a.curOp.scrollLeft=b);null!=d&&(a.curOp.scrollTop=d)}function Pc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=
null;var d=df(a,b.from),c=df(a,b.to);mf(a,d,c,b.margin)}}function mf(a,b,d,c){b=Ud(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});Xb(a,b.scrollLeft,b.scrollTop)}function Yb(a,b){2>Math.abs(a.doc.scrollTop-b)||(Ma||Vd(a,{top:b}),nf(a,b,!0),Ma&&Vd(a),Zb(a,100))}function nf(a,b,d){b=Math.max(0,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 lb(a,b,d,c){b=Math.max(0,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,of(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function $b(a){var b=a.display,d=b.gutters.offsetWidth,c=Math.round(a.doc.height+Ed(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+Ha(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:d}}function zb(a,b){b||(b=$b(a));var d=a.display.barWidth,c=a.display.barHeight;pf(a,b);for(b=0;4>b&&d!=a.display.barWidth||c!=a.display.barHeight;b++)d!=a.display.barWidth&&a.options.lineWrapping&&
Mc(a),pf(a,$b(a)),d=a.display.barWidth,c=a.display.barHeight}function pf(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 qf(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&kb(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new rf[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);z(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?lb(a,b):Yb(a,b)},a);a.display.scrollbars.addClass&&Za(a.display.wrapper,a.display.scrollbars.addClass)}function mb(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:++Vg,markArrays:null};a=a.curOp;ub?ub.ops.push(a):a.ownsGroup=ub={ops:[a],delayedCallbacks:[]}}function nb(a){(a=a.curOp)&&Og(a,function(b){for(var d=0;d=f.viewTo)||f.maxLineChanged&&e.options.lineWrapping;c.update=c.mustUpdate&&new Qc(e,c.mustUpdate&&{top:c.scrollTop,ensure:c.scrollToPos},c.forceUpdate)}for(d=0;dn;n++){var p=!1;h=Ba(e,k);var q=l&&l!=k?Ba(e,l):h;h={left:Math.min(h.left,q.left),top:Math.min(h.top,q.top)-m,right:Math.max(h.left,q.left),bottom:Math.max(h.bottom,q.bottom)+m};q=Ud(e,h);var r=e.doc.scrollTop,u=e.doc.scrollLeft;null!=q.scrollTop&&(Yb(e,q.scrollTop),1l.top+n.top?k=!0:l.bottom+n.top>(p.defaultView.innerHeight||p.documentElement.clientHeight)&&(k=!1),null==k||Wg||(l=v("div","\u200b",null,"position: absolute;\n top: "+(l.top-m.viewOffset-e.display.lineSpace.offsetTop)+"px;\n height: "+(l.bottom-l.top+Ha(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=Pb(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?ab(b.mode,c.state):null,k=Ae(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 Zb(a,a.options.workDelay),!0});b.highlightFrontier=c.line;b.modeFrontier=Math.max(b.modeFrontier,c.line);e.length&&qa(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==hf(a))return!1;tf(a)&&(Sa(a),b.dims=Hd(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));Ka&&(f=yd(a.doc,f),g=Le(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=Gc(a,f,g),e.viewFrom=f):(e.viewFrom>f?e.view=Gc(a,f,e.viewFrom).concat(e.view):e.viewFromg&&(e.view=e.view.slice(0,eb(a,g))));e.viewTo=g;d.viewOffset=Ga(w(a.doc,d.viewFrom));a.display.mover.style.top=d.viewOffset+"px";g=hf(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=ka(va(a.display.wrapper)))&&ja(a.display.lineDiv,f)?(f={activeElt:f},window.getSelection&&(e=Pa(a).defaultView.getSelection(),e.anchorNode&&e.extend&&ja(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(!Wd(a,b))break;Mc(a);c=$b(a);Wb(a);zb(a,c);Xd(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 Vd(a,b){b=new Qc(a,b);if(Wd(a,b)){Mc(a);sf(a,b);var d=$b(a);Wb(a);zb(a,d);Xd(a,d);b.finish()}}function Yg(a,b,d){function c(p){var q=p.nextSibling;fa&&ya&&a.display.currentWheelTarget==p?p.style.display="none":p.parentNode.removeChild(p);return q}
var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,k=e.view;e=e.viewFrom;for(var l=0;lT&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);fa||Ma&&bc||(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=Zd(c.gutters,c.lineNumbers);uf(this);d.init(this)}
function wf(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 $g(a){a=wf(a);a.x*=Na;a.y*=Na;return a}function xf(a,b){Ra&&102==vf&&(null==a.display.chromeScrollHack?a.display.sizer.style.pointerEvents="none":clearTimeout(a.display.chromeScrollHack),a.display.chromeScrollHack=setTimeout(function(){a.display.chromeScrollHack=null;a.display.sizer.style.pointerEvents=
""},100));var d=wf(b),c=d.x;d=d.y;var e=Na;0===b.deltaMode&&(c=b.deltaX,d=b.deltaY,e=1);var f=a.display,g=f.scroller,h=g.scrollWidth>g.clientWidth,k=g.scrollHeight>g.clientHeight;if(c&&h||d&&k){if(d&&ya&&fa){h=b.target;var l=f.view;a:for(;h!=g;h=h.parentNode)for(var m=0;me?k=Math.max(0,k+e-50):h=Math.min(a.doc.height,h+e+50),Vd(a,{top:k,bottom:h})),
20>Rc&&0!==b.deltaMode&&(null==f.wheelStartX?(f.wheelStartX=g.scrollLeft,f.wheelStartY=g.scrollTop,f.wheelDX=c,f.wheelDY=d,setTimeout(function(){if(null!=f.wheelStartX){var n=g.scrollLeft-f.wheelStartX,p=g.scrollTop-f.wheelStartY;n=p&&f.wheelDY&&p/f.wheelDY||n&&f.wheelDX&&n/f.wheelDX;f.wheelStartX=f.wheelStartY=null;n&&(Na=(Na*Rc+n)/(Rc+1),++Rc)}},200)):(f.wheelDX+=c,f.wheelDY+=d))):(d&&k&&Yb(a,Math.max(0,g.scrollTop+d*e)),lb(a,Math.max(0,g.scrollLeft+c*e)),(!d||d&&k)&&la(b),f.wheelStartX=null)}}
function Da(a,b,d){a=a&&a.options.selectionsMayTouch;d=b[d];b.sort(function(k,l){return B(k.from(),l.from())});d=ea(b,d);for(var c=1;cB(a,b.from))return a;if(0>=B(a,b.to))return Ua(b);var d=a.line+b.text.length-(b.to.line-b.from.line)-1,c=a.ch;a.line==b.to.line&&(c+=Ua(b).ch-b.to.ch);return t(d,c)}function $d(a,b){for(var d=[],c=0;cf-(a.cm?a.cm.options.historyEventDelay:
500)||"*"==b.origin.charAt(0))){if(e.lastOp==c){Ef(e.done);var h=J(e.done)}else e.done.length&&!J(e.done).ranges?h=J(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||W(a,"historyAdded")}function Tc(a,b){var d=J(b);d&&d.ranges&&d.equals(a)||b.push(a)}function Df(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 Gf(a,b){var d;if(d=b["spans_"+a.id]){for(var c=[],e=0;eB(b,a),c!=0>B(d,a)?(a=b,b=d):c!=0>B(b,d)&&(b=d)),new I(a,b)):new I(d||b,b)}function Uc(a,b,d,c,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend));da(a,new ua([de(a.sel.primary(),b,d,e)],0),c)}function Hf(a,b,d){for(var c=
[],e=a.cm&&(a.cm.display.shift||a.extend),f=0;fB(b.primary().head,a.sel.primary().head)?-1:1);Jf(a,Kf(a,b,c,!0));d&&!1===d.scroll||!a.cm||"nocursor"==a.cm.getOption("readOnly")||yb(a.cm)}function Jf(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=
1,a.cm.curOp.selectionChanged=!0,ve(a.cm)),aa(a,"cursorActivity",a))}function Lf(a){Jf(a,Kf(a,a.sel,null,!1))}function Kf(a,b,d,c){for(var e,f=0;f=b.ch:h.to>b.ch))){if(e&&(W(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?m:l)g=Mf(a,g,-c,g&&g.line==b.line?f:null);if(g&&g.line==b.line&&(h=B(g,d))&&(0>c?0>h:0c?-1:1);if(0>c?l:m)d=Mf(a,d,c,d.line==b.line?f:null);return d?Cb(a,d,b,c,e):null}}}return b}function Wc(a,b,d,c,e){c=c||1;b=Cb(a,b,d,c,e)||!e&&Cb(a,b,d,c,!0)||Cb(a,b,d,-c,e)||!e&&Cb(a,b,d,-c,!0);return b?b:(a.cantEdit=!0,t(a.first,0))}function Mf(a,b,d,c){return 0>d&&0==b.ch?b.line>a.first?C(a,t(b.line-1)):null:0a.lastLine())){if(b.from.linee&&(b={from:b.from,to:t(e,
w(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=bb(a,b.from,b.to);d||(d=$d(a,b));a.cm?ch(a.cm,b,c):be(a,b,c);Vc(a,d,Ia);a.cantEdit&&Wc(a,t(a.firstLine(),0))&&(a.cantEdit=!1)}}function ch(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=N(za(w(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));Hg(c,f.line);Zb(a,400);d=b.text.length-(g.line-f.line)-1;b.full?ma(a):f.line!=g.line||1!=b.text.length||Af(a.doc,b)?ma(a,f.line,g.line+1,d):Ta(a,f.line,"text");d=xa(a,"changes");if((c=xa(a,"change"))||d)b={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin},c&&aa(a,"change",a,b),d&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function Eb(a,b,
d,c,e){c||(c=d);0>B(c,d)&&(c=[c,d],d=c[0],c=c[1]);"string"==typeof b&&(b=a.splitLines(b));Db(a,{from:d,to:c,text:b,origin:e})}function Tf(a,b,d,c){d=B(f.from,J(c).to);){var g=c.pop();if(0>B(g.from,f.from)){f.from=g.from;break}}c.push(f)}qa(a,function(){for(var h=c.length-1;0<=h;h--)Eb(a.doc,"",c[h].from,c[h].to,"+delete");yb(a)})}function fe(a,b,d){b=ue(a.text,b+d,d);return 0>b||b>a.text.length?null:b}function ge(a,b,d){a=
fe(a,b.ch,d);return null==a?null:new t(b.line,a,0>d?"after":"before")}function he(a,b,d,c,e){if(a&&("rtl"==b.doc.direction&&(e=-e),a=Ja(d,b.doc.direction))){a=0>e?J(a):a[0];var f=0>e==(1==a.level)?"after":"before";if(0e?d.text.length-1:0;var k=Aa(b,g,h).top;h=Kb(function(l){return Aa(b,g,l).top==k},0>e==(1==a.level)?a.from:a.to-1,h);"before"==f&&(h=fe(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 lh(a,b,d,c){var e=Ja(b,a.doc.direction);if(!e)return ge(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=Lb(e,d.ch,d.sticky),g=e[f];if("ltr"==a.doc.direction&&0==g.level%2&&(0d.ch:g.fromc,p=h(d,n?1:-1);if(null!=p&&(n?p<=g.to&&p<=m.end:p>=g.from&&p>=m.begin))return new t(d.line,p,n?"before":"after")}g=function(q,r,u){for(var A=function(K,Q){return Q?new t(d.line,h(K,1),"before"):new t(d.line,K,"after")};0<=q&&qT&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var d=gg(this,a);Ca&&(ie=d?b:null,!d&&88==b&&!oh&&(ya?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));Ma&&!ya&&!d&&46==b&&a.shiftKey&&!a.ctrlKey&&document.execCommand&&document.execCommand("cut");18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||ph(this)}}function ph(a){function b(c){18!=
c.keyCode&&c.altKey||(kb(d,"CodeMirror-crosshair"),sa(document,"keyup",b),sa(document,"mouseover",b))}var d=a.display.lineDiv;Za(d,"CodeMirror-crosshair");z(document,"keyup",b);z(document,"mouseover",b)}function ig(a){16==a.keyCode&&(this.doc.sel.shift=!1);Z(this,a)}function jg(a){if(!(a.target&&a.target!=this.display.input.getField()||La(this.display,a)||Z(this,a)||a.ctrlKey&&!a.altKey||ya&&a.metaKey)){var b=a.keyCode,d=a.charCode;if(Ca&&b==ie)ie=null,la(a);else if(!Ca||a.which&&!(10>a.which)||!gg(this,
a))if(b=String.fromCharCode(null==d?b:d),"\b"!=b&&!nh(this,a,b))this.display.input.onKeyPress(a)}}function qh(a,b){var d=+new Date;if(mc&&mc.compare(d,a,b))return nc=mc=null,"triple";if(nc&&nc.compare(d,a,b))return mc=new je(d,a,b),nc=null,"double";nc=new je(d,a,b);mc=null;return"single"}function kg(a){var b=this.display;if(!(Z(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,La(b,a))fa||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=
!0},100));else if(!ad(this,a,"gutterClick",!0)){var d=hb(this,a),c=xe(a),e=d?qh(d,c):"single";Pa(this).defaultView.focus();1==c&&this.state.selectingText&&this.state.selectingText(a);if(!d||!rh(this,c,d,e,a))if(1==c)d?sh(this,d,e,a):(a.target||a.srcElement)==b.scroller&&la(a);else if(2==c)d&&Uc(this.doc,d),setTimeout(function(){return b.input.focus()},20);else if(3==c)if(ke)this.display.input.onContextMenu(a);else Td(this)}}function rh(a,b,d,c,e){var f="Click";"double"==c?f="Double"+f:"triple"==c&&
(f="Triple"+f);return lc(a,ag((1==b?"Left":2==b?"Middle":"Right")+f,e),e,function(g){"string"==typeof g&&(g=kc[g]);if(!g)return!1;var h=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),h=g(a,d)!=$c}finally{a.state.suppressEdits=!1}return h})}function sh(a,b,d,c){G?setTimeout(hd(kf,a),0):a.curOp.focus=ka(va(a.display.wrapper));var e=a.getOption("configureMouse");e=e?e(a,d,c):{};null==e.unit&&(e.unit=(th?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=ya?c.metaKey:c.ctrlKey);null==e.moveOnDrag&&(e.moveOnDrag=!(ya?c.altKey:c.ctrlKey));var f=a.doc.sel,g;a.options.dragDrop&&uh&&!a.isReadOnly()&&"single"==d&&-1<(g=f.contains(b))&&(0>B((g=f.ranges[g]).from(),b)||0b.xRel)?vh(a,c,b,e):wh(a,c,b,e)}function vh(a,b,d,c){var e=a.display,f=!1,g=ba(a,function(l){fa&&(e.scroller.draggable=!1);a.state.draggingText=!1;a.state.delayingBlurEvent&&(a.hasFocus()?
a.state.delayingBlurEvent=!1:Td(a));sa(e.wrapper.ownerDocument,"mouseup",g);sa(e.wrapper.ownerDocument,"mousemove",h);sa(e.scroller,"dragstart",k);sa(e.scroller,"drop",g);f||(la(l),c.addNew||Uc(a.doc,d,null,null,c.extend),fa&&!bd||G&&9==T?setTimeout(function(){e.wrapper.ownerDocument.body.focus({preventScroll:!0});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};fa&&(e.scroller.draggable=!0);a.state.draggingText=
g;g.copy=!c.moveOnDrag;z(e.wrapper.ownerDocument,"mouseup",g);z(e.wrapper.ownerDocument,"mousemove",h);z(e.scroller,"dragstart",k);z(e.scroller,"drop",g);a.state.delayingBlurEvent=!0;setTimeout(function(){return e.input.focus()},20);e.scroller.dragDrop&&e.scroller.dragDrop()}function lg(a,b,d){if("char"==d)return new I(b,b);if("word"==d)return a.findWordAt(b);if("line"==d)return new I(t(b.line,0),C(a.doc,t(b.line+1,0)));a=d(a,b);return new I(a.from,a.to)}function wh(a,b,d,c){function e(x){if(0!=B(q,
x))if(q=x,"rectangle"==c.unit){var P=[],K=a.options.tabSize,Q=wa(w(k,d.line).text,d.ch,K),S=wa(w(k,x.line).text,x.ch,K),F=Math.min(Q,S);Q=Math.max(Q,S);S=Math.min(d.line,x.line);for(var R=Math.min(a.lastLine(),Math.max(d.line,x.line));S<=R;S++){var H=w(k,S).text,L=id(H,F,K);F==Q?P.push(new I(t(S,L),t(S,L))):H.length>L&&P.push(new I(t(S,L),t(S,id(H,Q,K))))}P.length||P.push(new I(d,d));da(k,Da(a,l.ranges.slice(0,n).concat(P),n),{origin:"*mouse",scroll:!1});a.scrollIntoView(x)}else P=p,F=lg(a,x,c.unit),
x=P.anchor,0=Q.to||K.liner.bottom?20:0;S&&setTimeout(ba(a,function(){u==P&&(h.scroller.scrollTop+=S,f(x))}),50)}}
function g(x){a.state.selectingText=!1;u=Infinity;x&&(la(x),h.input.focus());sa(h.wrapper.ownerDocument,"mousemove",A);sa(h.wrapper.ownerDocument,"mouseup",Y);k.history.lastSelOrigin=null}G&&Td(a);var h=a.display,k=a.doc;la(b);var l=k.sel,m=l.ranges;if(c.addNew&&!c.extend){var n=k.sel.contains(d);var p=-1f:0=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;c&&la(b);c=a.display;var g=c.lineDiv.getBoundingClientRect();if(f>g.bottom||!xa(a,d))return md(b);f-=g.top-c.viewOffset;for(g=0;g=e)return e=cb(a.doc,f),W(a,d,a,e,a.display.gutterSpecs[g].className,
b),md(b)}}function mg(a,b){var d;(d=La(a.display,b))||(d=xa(a,"gutterContextMenu")?ad(a,b,"gutterContextMenu",!1):!1);if(!d&&!Z(a,b,"contextmenu")&&!ke)a.display.input.onContextMenu(b)}function ng(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");Vb(a)}function yh(a,b,d){!b!=!(d&&d!=Ib)&&(d=a.display.dragFunctions,b=b?z:sa,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 zh(a){a.options.lineWrapping?(Za(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(kb(a.display.wrapper,"CodeMirror-wrap"),Ad(a));Od(a);ma(a);Vb(a);setTimeout(function(){return zb(a)},100)}function U(a,b){var d=this;if(!(this instanceof U))return new U(a,b);this.options=b=b?$a(b):{};$a(og,b,!1);var c=b.value;"string"==typeof c?c=new oa(c,b.mode,
null,b.lineSeparator,b.direction):b.mode&&(c.modeOption=b.mode);this.doc=c;var e=new U.inputStyles[b.inputStyle](this);a=this.display=new Zg(a,c,e,b);a.wrapper.CodeMirror=this;ng(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");qf(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 Ya,keySeq:null,specialChars:null};b.autofocus&&!bc&&
a.input.focus();G&&11>T&&setTimeout(function(){return d.display.input.reset(!0)},20);Ah(this);pg||(hh(),pg=!0);mb(this);this.curOp.forceUpdate=!0;Bf(this,c);b.autofocus&&!bc||this.hasFocus()?setTimeout(function(){d.hasFocus()&&!d.state.focused&&Sd(d)},20):xb(this);for(var f in cd)if(cd.hasOwnProperty(f))cd[f](this,b[f],Ib);tf(this);b.finishInit&&b.finishInit(this);for(c=0;cT?z(c.scroller,"dblclick",ba(a,function(h){if(!Z(a,h)){var k=hb(a,h);!k||ad(a,h,"gutterClick",!0)||La(a.display,h)||(la(h),h=a.findWordAt(k),Uc(a.doc,h.anchor,h.head))}})):z(c.scroller,"dblclick",function(h){return Z(a,
h)||la(h)});z(c.scroller,"contextmenu",function(h){return mg(a,h)});z(c.input.getField(),"contextmenu",function(h){c.scroller.contains(h.target)||mg(a,h)});var e,f={end:0};z(c.scroller,"touchstart",function(h){var k;if(k=!Z(a,h))1!=h.touches.length?k=!1:(k=h.touches[0],k=1>=k.radiusX&&1>=k.radiusY),k=!k;k&&!ad(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))});z(c.scroller,"touchmove",function(){c.activeTouch&&(c.activeTouch.moved=!0)});z(c.scroller,"touchend",function(h){var k=c.activeTouch;if(k&&!La(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 I(l,l):!k.prev.prev||d(k,k.prev.prev)?a.findWordAt(l):new I(t(l.line,0),C(a.doc,t(l.line+1,0)));a.setSelection(k.anchor,k.head);a.focus();la(h)}b()});z(c.scroller,"touchcancel",b);z(c.scroller,"scroll",
function(){c.scroller.clientHeight&&(Yb(a,c.scroller.scrollTop),lb(a,c.scroller.scrollLeft,!0),W(a,"scroll",a))});z(c.scroller,"mousewheel",function(h){return xf(a,h)});z(c.scroller,"DOMMouseScroll",function(h){return xf(a,h)});z(c.wrapper,"scroll",function(){return c.wrapper.scrollTop=c.wrapper.scrollLeft=0});c.dragFunctions={enter:function(h){Z(a,h)||Nb(h)},over:function(h){if(!Z(a,h)){var k=hb(a,h);if(k){var l=document.createDocumentFragment();Pd(a,k,l);a.display.dragCursor||(a.display.dragCursor=
v("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv));D(a.display.dragCursor,l)}Nb(h)}},start:function(h){if(G&&(!a.state.draggingText||100>+new Date-Yf))Nb(h);else if(!Z(a,h)&&!La(a.display,h)&&(h.dataTransfer.setData("Text",a.getSelection()),h.dataTransfer.effectAllowed="copyMove",h.dataTransfer.setDragImage&&!bd)){var k=v("img",null,null,"position: fixed; left: 0; top: 0;");k.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
Ca&&(k.width=k.height=1,a.display.wrapper.appendChild(k),k._top=k.offsetTop);h.dataTransfer.setDragImage(k,0,0);Ca&&k.parentNode.removeChild(k)}},drop:ba(a,gh),leave:function(h){Z(a,h)||Xf(a)}};var g=c.input.getField();z(g,"keyup",function(h){return ig.call(a,h)});z(g,"keydown",ba(a,hg));z(g,"keypress",ba(a,jg));z(g,"focus",function(h){return Sd(a,h)});z(g,"blur",function(h){return xb(a,h)})}function oc(a,b,d,c){var e=a.doc,f;null==d&&(d="add");"smart"==d&&(e.mode.indent?f=Pb(a,b).state:d="prev");
var g=a.options.tabSize,h=w(e,b),k=wa(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==$c||150e.first?wa(w(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=oe(b),l=null;if(h&&1g?"cut":"+input")};Db(a.doc,p);aa(a,"inputRead",
a,p)}b&&!h&&qg(a,b);yb(a);2>a.curOp.updateInput&&(a.curOp.updateInput=m);a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=-1}function rg(a,b){var d=a.clipboardData&&a.clipboardData.getData("Text");if(d)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||!b.hasFocus()||qa(b,function(){return ne(b,d,0,null,"paste")}),!0}function qg(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(!(100A:56320<=A&&57343>A)?2:1))),-d)}else A=e?lh(a.cm,k,b,d):ge(k,b,d);if(null==A){if(u=!u)u=b.line+l,u=a.first+a.size?u=!1:(b=new t(u,b.ch,b.sticky),u=k=w(a,u));if(u)b=he(e,a.cm,k,b.line,l);else return!1}else b=A;return!0}var g=b,h=d,k=w(a,b.line),l=e&&"rtl"==
a.direction?-d:d;if("char"==c||"codepoint"==c)f();else if("column"==c)f(!0);else if("word"==c||"group"==c)for(var m=null,n="group"==c,p=a.cm&&a.cm.getHelper(b,"wordChars"),q=!0;!(0>d)||f(!q);q=!1){var r=k.text.charAt(b.ch)||"\n";r=yc(r,p)?"w":n&&"\n"==r?"n":!n||/\s/.test(r)?null:"p";!n||q||r||(r="s");if(m&&m!=r){0>d&&(d=1,f(),b.sticky="after");break}r&&(m=r);if(0d?0>=g:g>=e.height){b.hitSide=!0;break}g+=5*d}return b}function vg(a,b){var d=Gd(a,b.line);if(!d||d.hidden)return null;var c=w(a.doc,b.line);d=We(d,c,b.line);a=Ja(c,a.doc.direction);c="left";a&&(c=Lb(a,b.ch)%2?"right":"left");b=Xe(d.map,b.ch,c);b.offset="right"==b.collapse?b.end:b.start;
return b}function Bh(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function Jb(a,b){b&&(a.bad=!0);return a}function Ch(a,b,d,c,e){function f(q){return function(r){return r.id==q}}function g(){m&&(l+=n,p&&(l+=n),m=p=!1)}function h(q){q&&(g(),l+=q)}function k(q){if(1==q.nodeType){var r=q.getAttribute("cm-text");if(r)h(r);else{r=q.getAttribute("cm-marker");var u;if(r)q=a.findMarks(t(c,0),t(e+1,0),f(+r)),q.length&&(u=q[0].find(0))&&h(bb(a.doc,u.from,u.to).join(n));
else if("false"!=q.getAttribute("contenteditable")&&(u=/^(pre|div|p|li|table|br)$/i.test(q.nodeName),/^br$/i.test(q.nodeName)||0!=q.textContent.length)){u&&g();for(r=0;rq?k.map:l[q],u=0;uq?a.line:a.rest[q]);q=r[u]+p;if(0>p||A!=m)q=r[u+(p?1:0)];return t(n,
q)}}}var e=a.text.firstChild,f=!1;if(!b||!ja(e,b))return Jb(t(N(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[d],d=0,!b))return d=a.rest?J(a.rest):a.line,Jb(t(N(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 Jb(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 Jb(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 Jb(t(b.line,b.ch+d),f);d+=h.textContent.length}}var pa=navigator.userAgent,wg=navigator.platform,Ma=/gecko\/\d/i.test(pa),xg=/MSIE \d/.test(pa),yg=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(pa),ed=/Edge\/(\d+)/.exec(pa),G=xg||yg||ed,T=G&&(xg?document.documentMode||6:+(ed||yg)[1]),fa=!ed&&/WebKit\//.test(pa),Eh=fa&&/Qt\/\d+\.\d+/.test(pa),Ra=!ed&&/Chrome\/(\d+)/.exec(pa),vf=Ra&&+Ra[1],
Ca=/Opera\//.test(pa),bd=/Apple Computer/.test(navigator.vendor),Fh=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(pa),Wg=/PhantomJS/.test(pa),pc=bd&&(/Mobile\/\w+/.test(pa)||2ob)),ke=Ma||G&&9<=T,kb=function(a,
b){var d=a.className;if(b=y(b).exec(d)){var c=d.slice(b.index+b[0].length);a.className=d.slice(0,b.index)+(c?b[1]+c:"")}};var Rb=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 qc=function(a){a.select()};pc?qc=function(a){a.selectionStart=0;a.selectionEnd=
a.value.length}:G&&(qc=function(a){try{a.select()}catch(b){}});var Ya=function(){this.f=this.id=null;this.time=0;this.handler=hd(this.onTimeout,this)};Ya.prototype.onTimeout=function(a){a.id=0;a.time<=+new Date?a.f():setTimeout(a.handler,a.time-+new Date)};Ya.prototype.set=function(a,b){this.f=b;b=+new Date+a;if(!this.id||b=r?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(r):
1424<=r&&1524>=r?"R":1536<=r&&1785>=r?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(r-1536):1774<=r&&2220>=r?"r":8192<=r&&8203>=r?"w":8204==r?"b":"L";q.call(p,r)}n=0;for(p=k;nT)return!1;var a=v("div");return"draggable"in a||"dragDrop"in a}(),Cd,Bd,oe=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/)},Hh=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},oh=function(){var a=v("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),Id=null,nd={},rb={},sb={},X=
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};X.prototype.eol=function(){return this.pos>=this.string.length};X.prototype.sol=function(){return this.pos==this.lineStart};X.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};X.prototype.next=function(){if(this.posb};X.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};X.prototype.skipToEnd=function(){this.pos=this.string.length};X.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1this.maxLookAhead&&(this.maxLookAhead=a);return b};Fa.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}};Fa.prototype.nextLine=function(){this.line++;0T&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};pb.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.scrollTop=0,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=B(a,c.to()))return d}return-1};
var I=function(a,b){this.anchor=a;this.head=b};I.prototype.from=function(){return Cc(this.anchor,this.head)};I.prototype.to=function(){return Bc(this.anchor,this.head)};I.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};fc.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 gc(b);if(a.parent){a.size-=b.size;a.height-=b.height;var d=ea(a.parent.children,a);a.parent.children.splice(d+1,0,b)}else d=new gc(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&&ma(a,d,c+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Lf(a.doc));a&&aa(a,"markerCleared",a,this,d,
c);b&&nb(a);this.parent&&this.parent.clear()}};Wa.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var d,c,e=0;eB(h.head,h.anchor),a[f]=new I(h?k:g,h?g:k)):a[f]=new I(g,g)}a=new ua(a,this.sel.primIndex)}b=
a;for(a=c.length-1;0<=a;a--)Db(this,c[a]);b?If(this,b):this.cm&&yb(this.cm)}),undo:ca(function(){Xc(this,"undo")}),redo:ca(function(){Xc(this,"redo")}),undoSelection:ca(function(){Xc(this,"undo",!0)}),redoSelection:ca(function(){Xc(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=C(this,a);b=C(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 C(this,t(d,b))},indexFromPos:function(a){a=C(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 oa(qd(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.totc;tc++)Xa[tc+48]=Xa[tc+96]=String(tc);for(var fd=65;90>=fd;fd++)Xa[fd]=String.fromCharCode(fd);for(var uc=1;12>=uc;uc++)Xa[uc+111]=Xa[uc+63235]="F"+uc;var jc={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","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","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"]}};jc["default"]=ya?jc.macDefault:jc.pcDefault;var kc={selectAll:Nf,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Ia)},killLine:function(a){return Hb(a,function(b){if(b.empty()){var d=
w(a.doc,b.head.line).text.length;return b.head.ch==d&&b.head.linea.doc.first){var g=w(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 I(e,e))}a.setSelections(d)})},newlineAndIndent:function(a){return qa(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==B(b,this.pos)&&d==this.button};var nc,mc,Ib={toString:function(){return"CodeMirror.Init"}},
og={},cd={};U.defaults=og;U.optionHandlers=cd;var me=[];U.defineInitHook=function(a){return me.push(a)};var ra=null,O=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Ya;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};O.prototype.init=function(a){function b(h){for(h=h.target;h;h=h.parentNode){if(h==g)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(h.className))break}return!1}function d(h){if(b(h)&&!Z(f,
h)){if(f.somethingSelected())ra={lineWise:!1,text:f.getSelections()},"cut"==h.type&&f.replaceSelection("",null,"cut");else if(f.options.lineWiseCopyCut){var k=sg(f);ra={lineWise:!0,text:k.text};"cut"==h.type&&f.operation(function(){f.setSelections(k.ranges,0,Ia);f.replaceSelection("",null,"cut")})}else return;if(h.clipboardData){h.clipboardData.clearData();var l=ra.text.join("\n");h.clipboardData.setData("Text",l);if(h.clipboardData.getData("Text")==l){h.preventDefault();return}}var m=tg();h=m.firstChild;
pe(h);f.display.lineSpace.insertBefore(m,f.display.lineSpace.firstChild);h.value=ra.text.join("\n");var n=ka(va(g));qc(h);setTimeout(function(){f.display.lineSpace.removeChild(m);n.focus();n==g&&e.showPrimarySelection()},50)}}var c=this,e=this,f=e.cm,g=e.div=a.lineDiv;g.contentEditable=!0;pe(g,f.options.spellcheck,f.options.autocorrect,f.options.autocapitalize);z(g,"paste",function(h){!b(h)||Z(f,h)||rg(h,f)||11>=T&&setTimeout(ba(f,function(){return c.updateFromDOM()}),20)});z(g,"compositionstart",
function(h){c.composing={data:h.data,done:!1}});z(g,"compositionupdate",function(h){c.composing||(c.composing={data:h.data,done:!1})});z(g,"compositionend",function(h){c.composing&&(h.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)});z(g,"touchstart",function(){return e.forceCompositionEnd()});z(g,"input",function(){c.composing||c.readFromDOMSoon()});z(g,"copy",d);z(g,"cut",d)};O.prototype.screenReaderLabelChanged=function(a){a?this.div.setAttribute("aria-label",a):this.div.removeAttribute("aria-label")};
O.prototype.prepareSelection=function(){var a=jf(this.cm,!1);a.focus=ka(va(this.div))==this.div;return a};O.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};O.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};O.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&&vg(b,c)||{node:e[0].measure.map[2],offset:0},d=d.linea.firstLine()&&(c=t(c.line-1,w(a.doc,c.line-1).length));e.ch==w(a.doc,e.line).text.length&&e.lineb.viewTo-1)return!1;var f;c.line==b.viewFrom||0==(f=eb(a,c.line))?(d=N(b.view[0].line),f=b.view[0].node):(d=N(b.view[f].line),f=b.view[f-1].node.nextSibling);var g=eb(a,e.line);g==b.view.length-1?(e=b.viewTo-1,b=b.lineDiv.lastChild):(e=N(b.view[g+1].line)-
1,b=b.view[g+1].node.previousSibling);if(!f)return!1;b=a.doc.splitLines(Ch(a,f,b,d,e));for(f=bb(a.doc,t(d,0),t(e,w(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?J(f).length-g:0);if(1T&&f.scrollbars.setScrollTop(f.scroller.scrollTop=k),null!=g.selectionStart)){(!G||G&&9>T)&&b();var q=0,r=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&0q++?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=hb(e,a),k=f.scroller.scrollTop;if(h&&!Ca){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(h)&&ba(e,da)(e.doc,Oa(h),Ia);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: "+(G?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(fa)var n=g.ownerDocument.defaultView.scrollY;f.input.focus();fa&&g.ownerDocument.defaultView.scrollTo(null,n);f.input.reset();e.somethingSelected()||(g.value=c.prevInput=" ");c.contextMenuPending=d;f.selForContextMenu=e.doc.sel;clearTimeout(f.detectingSelectAll);G&&9<=T&&b();if(ke){Nb(a);var p=
function(){sa(window,"mouseup",p);setTimeout(d,20)};z(window,"mouseup",p)}else setTimeout(d,50)}};V.prototype.readOnlyChanged=function(a){a||this.reset();this.textarea.disabled="nocursor"==a;this.textarea.readOnly=!!a};V.prototype.setUneditable=function(){};V.prototype.needsContentAttribute=!1;(function(a){function b(c,e,f,g){a.defaults[c]=e;f&&(d[c]=g?function(h,k,l){l!=Ib&&f(h,k,l)}:f)}var d=a.optionHandlers;a.defineOption=b;a.Init=Ib;b("value","",function(c,e){return c.setValue(e)},!0);b("mode",
null,function(c,e){c.doc.modeOption=e;ae(c)},!0);b("indentUnit",2,ae,!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(c){cc(c);Vb(c);ma(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--)Eb(c.doc,e,f[h],t(f[h].line,f[h].ch+e.length))}});b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,
function(c,e,f){c.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g");f!=Ib&&c.refresh()});b("specialCharPlaceholder",Ng,function(c){return c.refresh()},!0);b("electricChars",!0);b("inputStyle",bc?"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",!Gh);b("wholeLineUpdateBefore",!0);b("theme","default",function(c){ng(c);ac(c)},!0);b("keyMap","default",function(c,e,f){e=Yc(e);(f=f!=Ib&&Yc(f))&&f.detach&&f.detach(c,e);e.attach&&e.attach(c,f||null)});b("extraKeys",null);b("configureMouse",null);b("lineWrapping",!1,zh,!0);b("gutters",[],function(c,e){c.display.gutterSpecs=Zd(e,c.options.lineNumbers);ac(c)},!0);b("fixedGutter",!0,function(c,e){c.display.gutters.style.left=
e?Nd(c.display)+"px":"0";c.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(c){return zb(c)},!0);b("scrollbarStyle","native",function(c){qf(c);zb(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=Zd(c.options.gutters,e);ac(c)},!0);b("firstLineNumber",1,ac,!0);b("lineNumberFormatter",function(c){return c},ac,!0);b("showCursorWhenSelecting",!1,Wb,!0);b("resetSelectionOnContextMenu",
!0);b("lineWiseCopyCut",!0);b("pasteLinesPerSelection",!0);b("selectionsMayTouch",!1);b("readOnly",!1,function(c,e){"nocursor"==e&&(xb(c),c.display.input.blur());c.display.input.readOnlyChanged(e)});b("screenReaderLabel",null,function(c,e){c.display.input.screenReaderLabelChanged(""===e?null:e)});b("disableInput",!1,function(c,e){e||c.display.input.reset()},!0);b("dragDrop",!0,yh);b("allowDropFileTypes",null);b("cursorBlinkRate",530);b("cursorScrollMargin",0);b("cursorHeight",1,Wb,!0);b("singleCursorHeightPerLine",
!0,Wb,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,cc,!0);b("addModeClass",!1,cc,!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,cc,!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)})(U);(function(a){var b=a.optionHandlers,d=a.helpers={};a.prototype={constructor:a,focus:function(){Pa(this).defaultView.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)&&ba(this,b[c])(this,e,g),W(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"](Yc(c))},removeKeyMap:function(c){for(var e=this.state.keyMaps,f=0;ff&&(oc(this,h.head.line,c,!0),f=h.head.line,g==this.doc.sel.primIndex&&yb(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=w(this.doc,c)}return Ic(this,c,{top:0,left:0},e||"page",f||g).top+(g?this.doc.height-Ga(c):0)},defaultTextHeight:function(){return wb(this.display)},
defaultCharWidth:function(){return vb(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=Ba(this,C(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 n=Math.max(k.wrapper.clientHeight,this.doc.height),p=Math.max(k.sizer.clientWidth,k.lineSpace.clientWidth);
("above"==g||c.bottom+e.offsetHeight>n)&&c.top>e.offsetHeight?l=c.top-e.offsetHeight:c.bottom+e.offsetHeight<=n&&(l=c.bottom);m+e.offsetWidth>p&&(m=p-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=Ud(this,{left:m,top:l,right:m+e.offsetWidth,bottom:l+e.offsetHeight}),null!=c.scrollTop&&Yb(this,c.scrollTop),null!=c.scrollLeft&&
lb(this,c.scrollLeft))},triggerOnKeyDown:ia(hg),triggerOnKeyPress:ia(jg),triggerOnKeyUp:ig,triggerOnMouseDown:ia(kg),execCommand:function(c){if(kc.hasOwnProperty(c))return kc[c].call(null,this)},triggerElectric:ia(function(c){qg(this,c)}),findPosH:function(c,e,f,g){var h=1;0>e&&(h=-1,e=-e);c=C(this.doc,c);for(var k=0;kc?g.from():g.to()},rc)}),deleteH:ia(function(c,e){var f=this.doc;this.doc.sel.somethingSelected()?f.replaceSelection("",null,"+delete"):Hb(this,function(g){var h=qe(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=C(this.doc,c);for(c=0;cc?m.from():m.to();var n=Ba(f,m.head,"div");null!=m.goalColumn&&(n.left=m.goalColumn);h.push(n.left);var p=ug(f,n,c,e);"page"==e&&m==g.sel.primary()&&Oc(f,Jc(f,p,"div").top-n.top);return p},rc);if(h.length)for(var l=0;lea(Jh,vc)&&(U.prototype[vc]=function(a){return function(){return a.apply(this.doc,arguments)}}(oa.prototype[vc]));qb(oa);U.inputStyles={textarea:V,contenteditable:O};U.defineMode=function(a){U.defaults.mode||"null"==a||(U.defaults.mode=a);Eg.apply(this,arguments)};U.defineMIME=function(a,b){rb[a]=b};U.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}});U.defineMIME("text/plain","null");U.defineExtension=function(a,
b){U.prototype[a]=b};U.defineDocExtension=function(a,b){oa.prototype[a]=b};U.fromTextArea=function(a,b){function d(){a.value=h.getValue()}b=b?$a(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=ka(va(a));b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(z(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&&(sa(a.form,"submit",d),b.leaveSubmitMethodAlone||"function"!=typeof a.form.submit||(a.form.submit=f))}};a.style.display="none";var h=U(function(k){return a.parentNode.insertBefore(k,a.nextSibling)},b);return h};(function(a){a.off=sa;a.on=z;a.wheelEventPixels=$g;a.Doc=
oa;a.splitLines=oe;a.countColumn=wa;a.findColumn=id;a.isWordChar=kd;a.Pass=$c;a.signal=W;a.Line=Ab;a.changeEnd=Ua;a.scrollbarModel=rf;a.Pos=t;a.cmpPos=B;a.modes=nd;a.mimeModes=rb;a.resolveMode=Ac;a.getMode=od;a.modeExtensions=sb;a.extendMode=Fg;a.copyState=ab;a.startState=ye;a.innerMode=pd;a.commands=kc;a.keyMap=jc;a.keyName=cg;a.isModifierKey=$f;a.lookupKey=Gb;a.normalizeKeyMap=kh;a.StringStream=X;a.SharedTextMarker=ic;a.TextMarker=Wa;a.LineWidget=hc;a.e_preventDefault=la;a.e_stopPropagation=we;
a.e_stop=Nb;a.addClass=Za;a.contains=ja;a.rmClass=kb;a.keyNames=Xa})(U);U.version="5.65.18";return U});
// comment.js
(function(r){"object"==typeof exports&&"object"==typeof module?r(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})(function(r){function I(c){c=c.search(u);return-1==c?0:c}function J(c,d,a){return/\bstring\b/.test(c.getTokenTypeAt(l(d.line,0)))&&!/^['"`]/.test(a)}function G(c,d){var a=c.getMode();return!1!==a.useInnerComments&&a.innerMode?c.getModeAt(d):a}var E={},u=/[^\s\u00a0]/,l=r.Pos,K=r.cmpPos;r.commands.toggleComment=function(c){c.toggleComment()};
r.defineExtension("toggleComment",function(c){c||(c=E);for(var d=Infinity,a=this.listSelections(),b=null,e=a.length-1;0<=e;e--){var g=a[e].from(),f=a[e].to();g.line>=d||(f.line>=d&&(f=l(d,0)),d=g.line,null==b?this.uncomment(g,f,c)?b="un":(this.lineComment(g,f,c),b="line"):"un"==b?this.uncomment(g,f,c):this.lineComment(g,f,c))}});r.defineExtension("lineComment",function(c,d,a){a||(a=E);var b=this,e=G(b,c),g=b.getLine(c.line);if(null!=g&&!J(b,c,g)){var f=a.lineComment||e.lineComment;if(f){var m=Math.min(0!=
d.ch||d.line==c.line?d.line+1:d.line,b.lastLine()+1),v=null==a.padding?" ":a.padding,k=a.commentBlankLines||c.line==d.line;b.operation(function(){if(a.indent){for(var q=null,h=c.line;hn.length)q=n}for(h=c.line;hm||b.operation(function(){if(0!=
a.fullLines){var k=u.test(b.getLine(m));b.replaceRange(v+f,l(m));b.replaceRange(g+v,l(c.line,0));var q=a.blockCommentLead||e.blockCommentLead;if(null!=q)for(var h=c.line+1;h<=m;++h)(h!=m||k)&&b.replaceRange(q+v,l(h,0))}else k=0==K(b.getCursor("to"),d),q=!b.somethingSelected(),b.replaceRange(f,d),k&&b.setSelection(q?d:b.getCursor("from"),d),b.replaceRange(g,c)})}});r.defineExtension("uncomment",function(c,d,a){a||(a=E);var b=this,e=G(b,c),g=Math.min(0!=d.ch||d.line==c.line?d.line:d.line-1,b.lastLine()),
f=Math.min(c.line,g),m=a.lineComment||e.lineComment,v=[],k=null==a.padding?" ":a.padding,q;a:if(m){for(var h=f;h<=g;++h){var n=b.getLine(h),t=n.indexOf(m);-1x||(A.slice(w,w+k.length)==k&&(w+=k.length),q=!0,b.replaceRange("",l(p,x),l(p,w)))}});if(q)return!0}var y=a.blockCommentStart||
e.blockCommentStart,z=a.blockCommentEnd||e.blockCommentEnd;if(!y||!z)return!1;var H=a.blockCommentLead||e.blockCommentLead,C=b.getLine(f),D=C.indexOf(y);if(-1==D)return!1;var F=g==f?C:b.getLine(g),B=F.indexOf(z,g==f?D+y.length:0);a=l(f,D+1);e=l(g,B+1);if(-1==B||!/comment/.test(b.getTokenTypeAt(a))||!/comment/.test(b.getTokenTypeAt(e))||-1>>0,$jscomp.propertyToPolyfillSymbol[g]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(g):$jscomp.POLYFILL_PREFIX+b+"$"+g),$jscomp.defineProperty(e,$jscomp.propertyToPolyfillSymbol[g],{configurable:!0,writable:!0,value:c})))};$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(c){var b=$jscomp.checkStringArgs(this,null,"repeat");if(0>c||1342177279>>=1)b+=b;return e}},"es6","es3");
(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function c(d){if(d.getOption("disableInput"))return a.Pass;for(var k=d.listSelections(),h,w=[],u=0;u=q.length&&-1<(f=n.lastIndexOf(q,l.ch-q.length))&&f>v)if(b(0,n)>=f)m=n.slice(0,f);else{q=d.options.tabSize;var x;f=a.countColumn(n,f,q);m=d.options.indentWithTabs?r.call("\t",x=Math.floor(f/q))+r.call(" ",f-q*x):r.call(" ",f)}else-1<(f=
n.indexOf(h.blockCommentContinue))&&f<=l.ch&&f<=b(0,n)&&(m=n.slice(0,f));null!=m&&(m+=h.blockCommentContinue)}null==m&&p&&e(d)&&((null==n&&(n=d.getLine(l.line)),f=n.indexOf(p),l.ch||f)?-1=f&&(m=-1=m||null),m&&(m=n.slice(0,f)+p+n.slice(f+p.length).match(/^\s*/)[0])):m="");if(null==m)return a.Pass;w[u]="\n"+m}d.operation(function(){for(var t=k.length-1;0<=t;t--)d.replaceRange(w[t],k[t].from(),k[t].to(),"+insert")})}function b(d,
k){g.lastIndex=d;return(d=g.exec(k))?d.index:-1}function e(d){return(d=d.getOption("continueComments"))&&"object"==typeof d?!1!==d.continueLineComment:!0}var g=/\S/g,r=String.prototype.repeat||function(d){return Array(d+1).join(this)};a.defineOption("continueComments",null,function(d,k,h){h&&h!=a.Init&&d.removeKeyMap("continueComment");k&&(h="Enter","string"==typeof k?h=k:"object"==typeof k&&k.key&&(h=k.key),k={name:"continueComment"},k[h]=c,d.addKeyMap(k))})});
// closebrackets.js
(function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})(function(e){function u(a,b){return"pairs"==b&&"string"==typeof a?a:"object"==typeof a&&null!=a[b]?a[b]:C[b]}function D(a){for(var b=0;b",triples:"",explode:"[]{}"},
l=e.Pos;e.defineOption("autoCloseBrackets",!1,function(a,b,c){c&&c!=e.Init&&(a.removeKeyMap(x),a.state.closeBrackets=null);b&&(D(u(b,"pairs")),a.state.closeBrackets=b,a.addKeyMap(x))});var x={Backspace:function(a){var b=y(a);if(!b||a.getOption("disableInput"))return e.Pass;var c=u(b,"pairs");b=a.listSelections();for(var d=0;dg))for(e==c.line&&(l=c.ch-(0>b?1:0));l!=z;l+=b){var q=n.charAt(l);if(d.test(q)&&(void 0===f||(a.getTokenTypeAt(p(e,l+1))||"")==(f||""))){var x=t[q];if(x&&">"==x.charAt(1)==0document.documentMode),p=k.Pos,t={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<",
"<":">>",">":"<<"};k.defineOption("matchBrackets",!1,function(a,c,b){b&&b!=k.Init&&(a.off("cursorActivity",r),a.off("focus",r),a.off("blur",u),u(a));c&&(a.state.matchBrackets="object"==typeof c?c:{},a.on("cursorActivity",r),a.on("focus",r),a.on("blur",u))});k.defineExtension("matchBrackets",function(){y(this,!0)});k.defineExtension("findMatchingBracket",function(a,c,b){if(b||"boolean"==typeof c)b?(b.strict=c,c=b):c=c?{strict:!0}:null;return v(this,a,c)});k.defineExtension("scanForBracket",function(a,
c,b,f){return w(this,a,c,b,f)})});
// closetag.js
(function(g){"object"==typeof exports&&"object"==typeof module?g(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],g):g(CodeMirror)})(function(g){function w(b){if(b.getOption("disableInput"))return g.Pass;for(var f=b.listSelections(),d=[],c=b.getOption("autoCloseTags"),h=0;he.ch&&(l=l.slice(0,l.length-a.end+e.ch));var t=l.toLowerCase();if(!l||"string"==a.type&&(a.end!=e.ch||!/["']/.test(a.string.charAt(a.string.length-1))||1==a.string.length)||"tag"==a.type&&k.close||a.string.indexOf("/")==e.ch-a.start-1||r&&-1",newPos:g.Pos(e.line,e.ch+2)}:(a=p&&-1"+(a?"\n\n":"")+""+l+">",newPos:a?g.Pos(e.line+1,0):g.Pos(e.line,e.ch+1)})}c="object"==typeof c&&c.dontIndentOnAutoClose;for(h=f.length-1;0<=h;h--)e=d[h],b.replaceRange(e.text,f[h].head,f[h].anchor,"+insert"),l=b.listSelections().slice(0),l[h]={head:e.newPos,anchor:e.newPos},b.setSelections(l),!c&&e.indent&&(b.indentLine(e.newPos.line,null,!0),
b.indentLine(e.newPos.line+1,null,!0))}function v(b,f){var d=b.listSelections(),c=[],h=f?"/":"",e=b.getOption("autoCloseTags");e="object"==typeof e&&e.dontIndentOnSlash;for(var a=0;a"!=b.getLine(m.line).charAt(n.end)&&(k+=">");c[a]=k}b.replaceSelections(c);d=b.listSelections();if(!e)for(a=0;a'"]=function(c){return w(c)};b.addKeyMap(d)}});var x="area base br col command embed hr img input keygen link meta param source track wbr".split(" "),y="applet blockquote body button div dl fieldset form frameset h1 h2 h3 h4 h5 h6 head html iframe layer legend object ol p select table ul".split(" ");g.commands.closeTag=function(b){return v(b)}});
// show-hint.js
(function(h){"object"==typeof exports&&"object"==typeof module?h(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],h):h(CodeMirror)})(function(h){function B(a,b){this.cm=a;this.options=b;this.widget=null;this.tick=this.debounce=0;this.startPos=this.cm.getCursor("start");this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;if(this.options.updateOnCursorActivity){var c=this;a.on("cursorActivity",this.activityFunc=
function(){c.cursorActivity()})}}function K(a,b){function c(r,g){var m="string"!=typeof g?function(k){return g(k,b)}:d.hasOwnProperty(g)?d[g]:g;p[r]=m}var d={Up:function(){b.moveFocus(-1)},Down:function(){b.moveFocus(1)},PageUp:function(){b.moveFocus(-b.menuSize()+1,!0)},PageDown:function(){b.moveFocus(b.menuSize()-1,!0)},Home:function(){b.setFocus(0)},End:function(){b.setFocus(b.length-1)},Enter:b.pick,Tab:b.pick,Esc:b.close};/Mac/.test(navigator.platform)&&(d["Ctrl-P"]=function(){b.moveFocus(-1)},
d["Ctrl-N"]=function(){b.moveFocus(1)});var e=a.options.customKeys,p=e?{}:d;if(e)for(var f in e)e.hasOwnProperty(f)&&c(f,e[f]);if(a=a.options.extraKeys)for(f in a)a.hasOwnProperty(f)&&c(f,a[f]);return p}function C(a,b){for(;b&&b!=a;){if("LI"===b.nodeName.toUpperCase()&&b.parentNode==a)return b;b=b.parentNode}}function D(a,b){this.id="cm-complete-"+Math.floor(Math.random(1E6));this.completion=a;this.data=b;this.picked=!1;var c=this,d=a.cm,e=d.getInputField().ownerDocument,p=e.defaultView||e.parentWindow,
f=this.hints=e.createElement("ul");f.setAttribute("role","listbox");f.setAttribute("aria-expanded","true");f.id=this.id;f.className="CodeMirror-hints "+a.cm.options.theme;this.selectedHint=b.selectedHint||0;for(var r=b.list,g=0;g
f.clientHeight+1:!1,u;setTimeout(function(){u=d.getScrollInfo()});if(0z&&(f.style.height=(y=z)+"px"),f.style.top=(x=g.top-y)+q+"px",E=!1):f.style.height=t-n.top-2+"px"}q=n.right-k;F&&(q+=d.display.nativeBarWidth);0k&&(f.style.width=k-5+"px",q-=n.right-n.left-k),f.style.left=(w=Math.max(g.left-q-m,0))+"px");if(F)for(g=f.firstChild;g;g=g.nextSibling)g.style.paddingRight=d.display.nativeBarWidth+"px";d.addKeyMap(this.keyMap=
K(a,{moveFocus:function(l,v){c.changeActive(c.selectedHint+l,v)},setFocus:function(l){c.changeActive(l)},menuSize:function(){return c.screenAmount()},length:r.length,close:function(){a.close()},pick:function(){c.pick()},data:b}));if(a.options.closeOnUnfocus){var G;d.on("blur",this.onBlur=function(){G=setTimeout(function(){a.close()},100)});d.on("focus",this.onFocus=function(){clearTimeout(G)})}d.on("scroll",this.onScroll=function(){var l=d.getScrollInfo(),v=d.getWrapperElement().getBoundingClientRect();
u||(u=d.getScrollInfo());var H=x+u.top-l.top,A=H-(p.pageYOffset||(e.documentElement||e.body).scrollTop);E||(A+=f.offsetHeight);if(A<=v.top||A>=v.bottom)return a.close();f.style.top=H+"px";f.style.left=w+u.left-l.left+"px"});h.on(f,"dblclick",function(l){(l=C(f,l.target||l.srcElement))&&null!=l.hintId&&(c.changeActive(l.hintId),c.pick())});h.on(f,"click",function(l){(l=C(f,l.target||l.srcElement))&&null!=l.hintId&&(c.changeActive(l.hintId),a.options.completeOnSingleClick&&c.pick())});h.on(f,"mousedown",
function(){setTimeout(function(){d.focus()},20)});g=this.getSelectedHintRange();0===g.from&&0===g.to||this.scrollToActive();h.signal(b,"select",r[this.selectedHint],f.childNodes[this.selectedHint]);return!0}function L(a,b){if(!a.somethingSelected())return b;a=[];for(var c=0;c=this.data.list.length?a=b?this.data.list.length-1:0:0>a&&(a=b?0:this.data.list.length-1);if(this.selectedHint!=a){if(b=this.hints.childNodes[this.selectedHint])b.className=b.className.replace(" CodeMirror-hint-active",""),b.removeAttribute("aria-selected");b=this.hints.childNodes[this.selectedHint=a];b.className+=" CodeMirror-hint-active";b.setAttribute("aria-selected","true");this.completion.cm.getInputField().setAttribute("aria-activedescendant",
b.id);this.scrollToActive();h.signal(this.data,"select",this.data.list[this.selectedHint],b)}},scrollToActive:function(){var a=this.getSelectedHintRange(),b=this.hints.childNodes[a.from];a=this.hints.childNodes[a.to];var c=this.hints.firstChild;b.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=a.offsetTop+a.offsetHeight-this.hints.clientHeight+c.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/
this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var a=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-a),to:Math.min(this.data.list.length-1,this.selectedHint+a)}}};h.registerHelper("hint","auto",{resolve:function(a,b){var c=a.getHelpers(b,"hint"),d;return c.length?(a=function(e,p,f){function r(m){if(m==g.length)return p(null);I(g[m],e,f,function(k){k&&0,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};h.defineOption("hintOptions",null)});
// lint.js
(function(k){"object"==typeof exports&&"object"==typeof module?k(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],k):k(CodeMirror)})(function(k){function y(a,b,f){function e(d){if(!c.parentNode)return k.off(document,"mousemove",e);var h=Math.max(0,Math.min(d.clientX+5,c.ownerDocument.defaultView.innerWidth-c.offsetWidth));c.style.top=Math.max(0,d.clientY-c.offsetHeight-5)+"px";c.style.left=h+"px"}var c=document.createElement("div");c.className=
"CodeMirror-lint-tooltip cm-s-"+a.options.theme;c.appendChild(f.cloneNode(!0));a.state.lint.options.selfContain?a.getWrapperElement().appendChild(c):document.body.appendChild(c);k.on(document,"mousemove",e);e(b);null!=c.style.opacity&&(c.style.opacity=1);return c}function z(a){a.parentNode&&(null==a.style.opacity&&a.parentNode&&a.parentNode.removeChild(a),a.style.opacity=0,setTimeout(function(){a.parentNode&&a.parentNode.removeChild(a)},600))}function u(a,b,f,e){function c(){k.off(e,"mouseout",c);
d&&(z(d),d=null)}var d=y(a,b,f),h=setInterval(function(){if(d)for(var g=e;;g=g.parentNode){g&&11==g.nodeType&&(g=g.host);if(g==document.body)return;if(!g){c();break}}if(!d)return clearInterval(h)},400);k.on(e,"mouseout",c)}function A(a,b,f){this.marked=[];b instanceof Function&&(b={getAnnotations:b});b&&!0!==b||(b={});this.options={};this.linterOptions=b.options||{};for(var e in p)this.options[e]=p[e];for(e in b)p.hasOwnProperty(e)?null!=b[e]&&(this.options[e]=b[e]):b.options||(this.linterOptions[e]=
b[e]);this.timeout=null;this.hasGutter=f;this.onMouseOver=function(c){var d=c.target||c.srcElement;if(/\bCodeMirror-lint-mark-/.test(d.className)){d=d.getBoundingClientRect();var h=a.findMarksAt(a.coordsChar({left:(d.left+d.right)/2,top:(d.top+d.bottom)/2},"client"));d=[];for(var g=0;g>>0,$jscomp.propertyToPolyfillSymbol[k]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(k):$jscomp.POLYFILL_PREFIX+g+"$"+k),$jscomp.defineProperty(l,$jscomp.propertyToPolyfillSymbol[k],{configurable:!0,writable:!0,value:h})))};$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(h,g){return $jscomp.findInternal(this,h,g).v}},"es6","es3");
(function(b){"object"==typeof exports&&"object"==typeof module?b(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],b):b(CodeMirror)})(function(b){function h(a,c){"string"==typeof a?a=new RegExp(a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),c?"gi":"g"):a.global||(a=new RegExp(a.source,a.ignoreCase?"gi":"g"));return{token:function(e){a.lastIndex=e.pos;
var d=a.exec(e.string);if(d&&d.index==e.pos)return e.pos+=d[0].length||1,"searching";d?e.pos=d.index:e.skipToEnd()}}}function g(){this.overlay=this.posFrom=this.posTo=this.lastQuery=this.query=null}function l(a){return a.state.search||(a.state.search=new g)}function k(a){return"string"==typeof a&&a==a.toLowerCase()}function t(a,c,e){return a.getSearchCursor(c,e,{caseFold:k(c),multiline:!0})}function A(a,c,e,d,f){a.openDialog(c,d,{value:e,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){y(a)},
onKeyDown:f,bottom:a.options.search.bottom})}function D(a,c,e,d,f){a.openDialog?a.openDialog(c,f,{value:d,selectValueOnOpen:!0,bottom:a.options.search.bottom}):f(prompt(e,d))}function J(a,c,e,d){if(a.openConfirm)a.openConfirm(c,d);else if(confirm(e))d[0]()}function E(a){return a.replace(/\\([nrt\\])/g,function(c,e){return"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\"==e?"\\":c})}function F(a){var c=a.match(/^\/(.*)\/([a-z]*)$/);if(c)try{a=new RegExp(c[1],-1==c[2].indexOf("i")?"":"i")}catch(e){}else a=E(a);
if("string"==typeof a?""==a:a.test(""))a=/x^/;return a}function B(a,c,e){c.queryText=e;c.query=F(e);a.removeOverlay(c.overlay,k(c.query));c.overlay=h(c.query,k(c.query));a.addOverlay(c.overlay);a.showMatchesOnScrollbar&&(c.annotate&&(c.annotate.clear(),c.annotate=null),c.annotate=a.showMatchesOnScrollbar(c.query,k(c.query)))}function x(a,c,e,d){var f=l(a);if(f.query)return C(a,c);var n=a.getSelection()||f.lastQuery;n instanceof RegExp&&"x^"==n.source&&(n=null);if(e&&a.openDialog){var u=null,r=function(q,
w){b.e_stop(w);q&&(q!=f.queryText&&(B(a,f,q),f.posFrom=f.posTo=a.getCursor()),u&&(u.style.opacity=1),C(a,w.shiftKey,function(p,v){var z;3>v.line&&document.querySelector&&(z=a.display.wrapper.querySelector(".CodeMirror-dialog"))&&z.getBoundingClientRect().bottom-4>a.cursorCoords(v,"window").top&&((u=z).style.opacity=.4)}))};A(a,G(a),n,r,function(q,w){var p=b.keyName(q),v=a.getOption("extraKeys");p=v&&v[p]||b.keyMap[a.getOption("keyMap")][p];if("findNext"==p||"findPrev"==p||"findPersistentNext"==p||
"findPersistentPrev"==p)b.e_stop(q),B(a,l(a),w),a.execCommand(p);else if("find"==p||"findPersistent"==p)b.e_stop(q),r(w,q)});d&&n&&(B(a,f,n),C(a,c))}else D(a,G(a),"Search for:",n,function(q){q&&!f.query&&a.operation(function(){B(a,f,q);f.posFrom=f.posTo=a.getCursor();C(a,c)})})}function C(a,c,e){a.operation(function(){var d=l(a),f=t(a,d.query,c?d.posFrom:d.posTo);if(!f.find(c)&&(f=t(a,d.query,c?b.Pos(a.lastLine()):b.Pos(a.firstLine(),0)),!f.find(c)))return;a.setSelection(f.from(),f.to());a.scrollIntoView({from:f.from(),
to:f.to()},20);d.posFrom=f.from();d.posTo=f.to();e&&e(f.from(),f.to())})}function y(a){a.operation(function(){var c=l(a);if(c.lastQuery=c.query)c.query=c.queryText=null,a.removeOverlay(c.overlay),c.annotate&&(c.annotate.clear(),c.annotate=null)})}function m(a,c){var e=a?document.createElement(a):document.createDocumentFragment(),d;for(d in c)e[d]=c[d];for(d=2;d>>0,$jscomp.propertyToPolyfillSymbol[l]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(l):$jscomp.POLYFILL_PREFIX+h+"$"+l),$jscomp.defineProperty(p,$jscomp.propertyToPolyfillSymbol[l],{configurable:!0,writable:!0,value:g})))};$jscomp.polyfill("Array.prototype.find",function(f){return f?f:function(g,h){return $jscomp.findInternal(this,g,h).v}},"es6","es3");
(function(f){"object"==typeof exports&&"object"==typeof module?f(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],f):f(CodeMirror)})(function(f){function g(b,a){var c=b.flags;for(var e=c=null!=c?c:(b.ignoreCase?"i":"")+(b.global?"g":"")+(b.multiline?"m":""),d=0;dm);n++){var r=b.getLine(k++);e=null==e?r:e+"\n"+r}d*=2;a.lastIndex=c.ch;if(n=a.exec(e))return a=e.slice(0,n.index).split("\n"),b=n[0].split("\n"),c=c.line+a.length-1,a=a[a.length-1].length,{from:q(c,a),to:q(c+b.length-1,1==b.length?a+b[0].length:b[b.length-
1].length),match:n}}}function l(b,a,c){for(var e,d=0;d<=b.length;){a.lastIndex=d;d=a.exec(b);if(!d)break;var k=d.index+d[0].length;if(k>b.length-c)break;if(!e||k>e.index+e[0].length)e=d;d=d.index+1}return e}function u(b,a,c){a=g(a,"g");var e=c.line,d=c.ch;for(c=b.firstLine();e>=c;e--,d=-1){var k=b.getLine(e);if(d=l(k,a,0>d?0:k.length-d))return{from:q(e,d.index),to:q(e,d.index+d[0].length),match:d}}}function w(b,a,c){if(!/\\s|\\n|\n|\\W|\\D|\[\^/.test(a.source))return u(b,a,c);a=g(a,"gm");var e=1,
d=b.getLine(c.line).length-c.ch;c=c.line;for(var k=b.firstLine();c>=k;){for(var m=0;m=k;m++){var n=b.getLine(c--);var r=null==r?n:n+"\n"+r}e*=2;if(m=l(r,a,d))return a=r.slice(0,m.index).split("\n"),b=m[0].split("\n"),c+=a.length,a=a[a.length-1].length,{from:q(c,a),to:q(c+b.length-1,1==b.length?a+b[0].length:b[b.length-1].length),match:m}}}function v(b,a,c,e){if(b.length==a.length)return c;var d=0;for(a=c+Math.max(0,b.length-a.length);;){if(d==a)return d;var k=d+a>>1,m=e(b.slice(0,k)).length;
if(m==c)return k;m>c?a=k:d=k+1}}function C(b,a,c,e){if(!a.length)return null;e=e?x:y;a=e(a).split(/\r|\n\r?/);var d=c.line;c=c.ch;var k=b.lastLine()+1-a.length;a:for(;d<=k;d++,c=0){var m=b.getLine(d).slice(c),n=e(m);if(1==a.length){var r=n.indexOf(a[0]);if(-1==r)continue a;v(m,n,r,e);return{from:q(d,v(m,n,r,e)+c),to:q(d,v(m,n,r+a[0].length,e)+c)}}r=n.length-a[0].length;if(n.slice(r)!=a[0])continue a;for(var t=1;t=m;d--,k=-1){var n=b.getLine(d);-1a.ch&&(a.line--,a.ch=(this.doc.getLine(a.line)||"").length)):(a.ch++,a.ch>(this.doc.getLine(a.line)||"").length&&(a.ch=0,a.line++)),0!=f.cmpPos(a,this.doc.clipPos(a))))return this.atOccurrence=!1;this.afterEmptyMatch=(a=this.matches(b,a))&&0==f.cmpPos(a.from,a.to);if(a)return this.pos=a,this.atOccurrence=!0,this.pos.match||!0;b=q(b?this.doc.firstLine():this.doc.lastLine()+1,0);this.pos={from:b,to:b};return this.atOccurrence=
!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(b,a){this.atOccurrence&&(b=f.splitLines(b),this.doc.replaceRange(b,this.pos.from,this.pos.to,a),this.pos.to=q(this.pos.from.line+b.length-1,b[b.length-1].length+(1==b.length?this.pos.from.ch:0)))}};f.defineExtension("getSearchCursor",function(b,a,c){return new A(this.doc,b,a,c)});f.defineDocExtension("getSearchCursor",function(b,a,c){return new A(this,b,a,c)});f.defineExtension("selectMatches",
function(b,a){var c=[];for(b=this.getSearchCursor(b,this.getCursor("from"),a);b.findNext()&&!(0h.right?1:0:f.clientYh.bottom?1:0)*d.screen)});c.on(this.node,"mousewheel",g);c.on(this.node,"DOMMouseScroll",g)}function k(a,b,e){this.addClass=a;this.horiz=new l(a,"horizontal",e);b(this.horiz.node);this.vert=new l(a,"vertical",e);b(this.vert.node);this.width=null}l.prototype.setPos=function(a,b){0>a&&(a=0);a>this.total-this.screen&&(a=this.total-this.screen);if(!b&&a==this.pos)return!1;this.pos=a;this.inner.style["horizontal"==
this.orientation?"left":"top"]=this.size/this.total*a+"px";return!0};l.prototype.moveTo=function(a){this.setPos(a)&&this.scroll(a,this.orientation)};l.prototype.update=function(a,b,e){var g=this.screen!=b||this.total!=a||this.size!=e;g&&(this.screen=b,this.total=a,this.size=e);a=this.size/this.total*this.screen;10>a&&(this.size-=10-a,a=10);this.inner.style["horizontal"==this.orientation?"width":"height"]=a+"px";this.setPos(this.pos,g)};k.prototype.update=function(a){if(null==this.width){var b=window.getComputedStyle?
window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;b&&(this.width=parseInt(b.height))}b=this.width||0;var e=a.scrollWidth>a.clientWidth+1,g=a.scrollHeight>a.clientHeight+1;this.vert.node.style.display=g?"block":"none";this.horiz.node.style.display=e?"block":"none";g&&(this.vert.update(a.scrollHeight,a.clientHeight,a.viewHeight-(e?b:0)),this.vert.node.style.bottom=e?b+"px":"0");e&&(this.horiz.update(a.scrollWidth,a.clientWidth,a.viewWidth-(g?b:0)-a.barLeft),this.horiz.node.style.right=
g?b+"px":"0",this.horiz.node.style.left=a.barLeft+"px");return{right:g?b:0,bottom:e?b:0}};k.prototype.setScrollTop=function(a){this.vert.setPos(a)};k.prototype.setScrollLeft=function(a){this.horiz.setPos(a)};k.prototype.clear=function(){var a=this.horiz.node.parentNode;a.removeChild(this.horiz.node);a.removeChild(this.vert.node)};c.scrollbarModel.simple=function(a,b){return new k("CodeMirror-simplescroll",a,b)};c.scrollbarModel.overlay=function(a,b){return new k("CodeMirror-overlayscroll",a,b)}});
// annotatescrollbar.js
(function(k){"object"==typeof exports&&"object"==typeof module?k(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],k):k(CodeMirror)})(function(k){function m(a,e){function b(f){clearTimeout(c.doRedraw);c.doRedraw=setTimeout(function(){c.redraw()},f)}this.cm=a;this.options=e;this.buttonHeight=e.scrollButtonHeight||a.getOption("scrollButtonHeight");this.annotations=[];this.doRedraw=this.doUpdate=null;this.div=a.getWrapperElement().appendChild(document.createElement("div"));
this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none";this.computeScale();var c=this;a.on("refresh",this.resizeHandler=function(){clearTimeout(c.doUpdate);c.doUpdate=setTimeout(function(){c.computeScale()&&b(20)},100)});a.on("markerAdded",this.resizeHandler);a.on("markerCleared",this.resizeHandler);if(!1!==e.listenForChanges)a.on("changes",this.changeHandler=function(){b(250)})}k.defineExtension("annotateScrollbar",function(a){"string"==typeof a&&(a={className:a});
return new m(this,a)});k.defineOption("scrollButtonHeight",0);m.prototype.computeScale=function(){var a=this.cm;a=(a.getWrapperElement().clientHeight-a.display.barHeight-2*this.buttonHeight)/a.getScrollerElement().scrollHeight;if(a!=this.hScale)return this.hScale=a,!0};m.prototype.update=function(a){this.annotations=a;this.redraw()};m.prototype.redraw=function(a){function e(n,v){if(p!=n.line){p=n.line;d=b.getLineHandle(n.line);var q=b.getLineHandleVisualStart(d);q!=d&&(p=b.getLineNumber(q),d=q)}return d.widgets&&
d.widgets.length||w&&d.height>y?b.charCoords(n,"local")[v?"top":"bottom"]:b.heightAtLine(d,"local")+(v?0:d.height)}!1!==a&&this.computeScale();var b=this.cm;a=this.hScale;var c=document.createDocumentFragment(),f=this.annotations,w=b.getOption("lineWrapping"),y=w&&1.5*b.defaultTextHeight(),p=null,d=null,x=b.lastLine();if(b.display.barWidth)for(var g=0,r;gx)){for(var t=r||e(h.from,!0)*a,l=e(h.to,!1)*a;gx);){r=e(f[g+1].from,!0)*
a;if(r>l+.9)break;h=f[++g];l=e(h.to,!1)*a}if(l!=t){l=Math.max(l-t,3);var u=c.appendChild(document.createElement("div"));u.style.cssText="position: absolute; right: 0px; width: "+Math.max(b.display.barWidth-1,2)+"px; top: "+(t+this.buttonHeight)+"px; height: "+l+"px";u.className=this.options.className;h.id&&u.setAttribute("annotation-id",h.id)}}}this.div.textContent="";this.div.appendChild(c)};m.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler);this.cm.off("markerAdded",this.resizeHandler);
this.cm.off("markerCleared",this.resizeHandler);this.changeHandler&&this.cm.off("changes",this.changeHandler);this.div.parentNode.removeChild(this.div)}});
// matchesonscrollbar.js
(function(f){"object"==typeof exports&&"object"==typeof module?f(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],f):f(CodeMirror)})(function(f){function g(a,c,b,d){this.cm=a;this.options=d;var e={listenForChanges:!1},h;for(h in d)e[h]=d[h];e.className||(e.className="CodeMirror-search-match");this.annotation=a.annotateScrollbar(e);this.query=
c;this.caseFold=b;this.gap={from:a.firstLine(),to:a.lastLine()+1};this.matches=[];this.update=null;this.findMatches();this.annotation.update(this.matches);var l=this;a.on("change",this.changeHandler=function(n,m){l.onChange(m)})}function k(a,c,b){return a<=c?a:Math.max(c,a+b)}f.defineExtension("showMatchesOnScrollbar",function(a,c,b){"string"==typeof b&&(b={className:b});b||(b={});return new g(this,a,c,b)});g.prototype.findMatches=function(){if(this.gap){for(var a=0;a=this.gap.to)break;c.to.line>=this.gap.from&&this.matches.splice(a--,1)}for(var b=this.cm.getSearchCursor(this.query,f.Pos(this.gap.from,0),{caseFold:this.caseFold,multiline:this.options.multiline}),d=this.options&&this.options.maxMatches||1E3;b.findNext();){c={from:b.from(),to:b.to()};if(c.from.line>=this.gap.to)break;this.matches.splice(a++,0,c);if(this.matches.length>d)break}this.gap=null}};g.prototype.onChange=function(a){var c=a.from.line,b=f.changeEnd(a).line,
d=b-a.to.line;this.gap?(this.gap.from=Math.min(k(this.gap.from,c,d),a.from.line),this.gap.to=Math.max(k(this.gap.to,c,d),a.from.line)):this.gap={from:a.from.line,to:b+1};if(d)for(a=0;a=b.options.minChars&&p(a,d,!1,b.options.style))}})}function t(a,b,d){return{token:function(c){var e;
if(e=c.match(a))(e=!b)||(e=(!c.start||!b.test(c.string.charAt(c.start-1)))&&(c.pos==c.string.length||!b.test(c.string.charAt(c.pos))));if(e)return d;c.next();c.skipTo(a.charAt(0))||c.skipToEnd()}}}var h={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};f.defineOption("highlightSelectionMatches",!1,function(a,b,d){d&&d!=f.Init&&(q(a),clearTimeout(a.state.matchHighlighter.timeout),a.state.matchHighlighter=null,a.off("cursorActivity",k),a.off("focus",
m));if(b){b=a.state.matchHighlighter=new r(b);if(a.hasFocus())b.active=!0,n(a);else a.on("focus",m);a.on("cursorActivity",k)}})});
// foldcode.js
(function(d){"object"==typeof exports&&"object"==typeof module?d(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)})(function(d){function p(a,b,c,e){function h(l){var f=q(a,b);if(!f||f.to.line-f.from.linea.firstLine();)b=d.Pos(b.line-1,0),g=h(!1);if(g&&!g.cleared&&"unfold"!==e){var r=v(a,c,g);d.on(r,"mousedown",function(l){t.clear();d.e_preventDefault(l)});var t=a.markText(g.from,g.to,{replacedWith:r,clearOnEnter:k(a,c,"clearOnEnter"),__isFold:!0});t.on("clear",function(l,f){d.signal(a,"unfold",a,l,f)});d.signal(a,"fold",a,g.from,g.to)}}function v(a,b,c){a=k(a,b,"widget");"function"==typeof a&&(a=a(c.from,
c.to));"string"==typeof a?(c=document.createTextNode(a),a=document.createElement("span"),a.appendChild(c),a.className="CodeMirror-foldmarker"):a&&(a=a.cloneNode(!0));return a}function k(a,b,c){return b&&void 0!==b[c]?b[c]:(a=a.options.foldOptions)&&void 0!==a[c]?a[c]:w[c]}d.newFoldFunction=function(a,b){return function(c,e){p(c,e,{rangeFinder:a,widget:b})}};d.defineExtension("foldCode",function(a,b,c){p(this,a,b,c)});d.defineExtension("isFolded",function(a){a=this.findMarksAt(a);for(var b=0;b>>0,$jscomp.propertyToPolyfillSymbol[f]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(f):$jscomp.POLYFILL_PREFIX+d+"$"+f),$jscomp.defineProperty(k,$jscomp.propertyToPolyfillSymbol[f],{configurable:!0,writable:!0,value:e})))};$jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(e,d){return $jscomp.findInternal(this,e,d).v}},"es6","es3");
(function(c){"object"==typeof exports&&"object"==typeof module?c(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],c):c(CodeMirror)})(function(c){function e(a){this.options=a;this.from=this.to=0}function d(a,b){a=a.findMarks(q(b,0),q(b+1,0));for(var g=0;g=C){if(y&&m&&y.test(m.className))return;r=k(h.indicatorOpen)}}(r||m)&&a.setGutterMarker(z,h.gutter,r)})}function l(a){var b=a.getViewport(),g=a.state.foldGutter;g&&(a.operation(function(){f(a,b.from,b.to)}),g.from=b.from,g.to=b.to)}function n(a,b,g){var h=a.state.foldGutter;h&&(h=h.options,g==h.gutter&&((g=d(a,b))?g.clear():a.foldCode(q(b,0),h)))}function A(a,b){"mode"==b&&p(a)}function p(a){var b=a.state.foldGutter;if(b){var g=
b.options;b.from=b.to=0;clearTimeout(b.changeUpdate);b.changeUpdate=setTimeout(function(){l(a)},g.foldOnChangeTimeSpan||600)}}function B(a){var b=a.state.foldGutter;if(b){var g=b.options;clearTimeout(b.changeUpdate);b.changeUpdate=setTimeout(function(){var h=a.getViewport();b.from==b.to||20b.to&&(f(a,b.to,h.to),b.to=h.to)})},g.updateViewportTimeSpan||400)}}function u(a,b){var g=a.state.foldGutter;
g&&(b=b.line,b>=g.from&&b=g?-1:c.lastIndexOf(n[0],g-1);if(-1==q){if(1==u)break;u=1;g=c.length}else{if(1==u&&qw&&(w=v.length);0>k&&(k=v.length);k=Math.min(w,k);if(k==v.length)break;if(b.getTokenTypeAt(a.Pos(t,k+1))==n.tokenType)if(k==w)++g;else if(!--g){var x=t;var z=k;break a}++k}return null==x||e==x?null:{from:a.Pos(e,q),to:a.Pos(x,z)}}for(var e=f.line,c=b.getLine(e),m=[],l=0;ld.lastLine())return null;var m=d.getTokenAt(a.Pos(c,1));/\S/.test(m.string)||(m=d.getTokenAt(a.Pos(c,m.end+1)));if("keyword"!=m.type||"import"!=m.string)return null;var l=c;for(c=Math.min(d.lastLine(),c+10);l<=c;++l){var r=d.getLine(l).indexOf(";");
if(-1!=r)return{startCh:m.end,end:a.Pos(l,r)}}}b=b.line;var p=f(b),h;if(!p||f(b-1)||(h=f(b-2))&&h.end.line==b-1)return null;for(h=p.end;;){var e=f(h.line+1);if(null==e)break;h=e.end}return{from:d.clipPos(a.Pos(b,p.startCh+1)),to:h}});a.registerHelper("fold","include",function(d,b){function f(e){if(ed.lastLine())return null;var c=d.getTokenAt(a.Pos(e,1));/\S/.test(c.string)||(c=d.getTokenAt(a.Pos(e,c.end+1)));if("meta"==c.type&&"#include"==c.string.slice(0,8))return c.start+8}b=b.line;
var p=f(b);if(null==p||null!=f(b-1))return null;for(var h=b;null!=f(h+1);)++h;return{from:a.Pos(b,p+1),to:d.clipPos(a.Pos(h))}})});
// indent-fold.js
(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function g(b,c){var e=b.getLine(c),d=e.search(/\S/);return-1==d||/\bcomment\b/.test(b.getTokenTypeAt(a.Pos(c,d+1)))?-1:a.countColumn(e,null,b.getOption("tabSize"))}a.registerHelper("fold","indent",function(b,c){var e=g(b,c.line);if(!(0>e)){for(var d=null,f=c.line+1,k=b.lastLine();f<=k;++f){var h=g(b,f);
if(-1!=h)if(h>e)d=f;else break}if(d)return{from:a.Pos(c.line,b.getLine(c.line).length),to:a.Pos(d,b.getLine(d).length)}}})});
// comment-fold.js
(function(c){"object"==typeof exports&&"object"==typeof module?c(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],c):c(CodeMirror)})(function(c){c.registerGlobalHelper("fold","comment",function(d){return d.blockCommentStart&&d.blockCommentEnd},function(d,e){var f=d.getModeAt(e),m=f.blockCommentStart;f=f.blockCommentEnd;if(m&&f){for(var g=e.line,h=d.getLine(g),a=e.ch,k=0;;)if(a=0>=a?-1:h.lastIndexOf(m,a-1),-1==a){if(1==k)return;k=1;a=h.length}else{if(1==
k&&an&&(n=l.length);0>b&&(b=l.length);b=Math.min(n,b);if(b==l.length)break;if(b==n)++h;else if(!--h){var p=a;var q=b;break a}++b}if(null!=p&&(g!=p||q!=e))return{from:c.Pos(g,e),to:c.Pos(p,q)}}})});
// dialog.js
(function(c){"object"==typeof exports&&"object"==typeof module?c(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],c):c(CodeMirror)})(function(c){function m(b,g,a){b=b.getWrapperElement();var d=b.appendChild(document.createElement("div"));d.className=a?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top";"string"==typeof g?d.innerHTML=g:d.appendChild(g);c.addClass(b,"dialog-opened");return d}function n(b,g){b.state.currentNotificationClose&&
b.state.currentNotificationClose();b.state.currentNotificationClose=g}c.defineExtension("openDialog",function(b,g,a){function d(e){if("string"==typeof e)f.value=e;else if(!k&&(k=!0,c.rmClass(h.parentNode,"dialog-opened"),h.parentNode.removeChild(h),l.focus(),a.onClose))a.onClose(h)}a||(a={});n(this,null);var h=m(this,b,a.bottom),k=!1,l=this,f=h.getElementsByTagName("input")[0];if(f){f.focus();a.value&&(f.value=a.value,!1!==a.selectValueOnOpen&&f.select());if(a.onInput)c.on(f,"input",function(e){a.onInput(e,
f.value,d)});if(a.onKeyUp)c.on(f,"keyup",function(e){a.onKeyUp(e,f.value,d)});c.on(f,"keydown",function(e){if(!(a&&a.onKeyDown&&a.onKeyDown(e,f.value,d))){if(27==e.keyCode||!1!==a.closeOnEnter&&13==e.keyCode)f.blur(),c.e_stop(e),d();13==e.keyCode&&g(f.value,e)}});if(!1!==a.closeOnBlur)c.on(h,"focusout",function(e){null!==e.relatedTarget&&d()})}else if(b=h.getElementsByTagName("button")[0]){c.on(b,"click",function(){d();l.focus()});if(!1!==a.closeOnBlur)c.on(b,"blur",d);b.focus()}return d});c.defineExtension("openConfirm",
function(b,g,a){function d(){k||(k=!0,c.rmClass(h.parentNode,"dialog-opened"),h.parentNode.removeChild(h),l.focus())}n(this,null);var h=m(this,b,a&&a.bottom);b=h.getElementsByTagName("button");var k=!1,l=this,f=1;b[0].focus();for(a=0;a=f&&d()},200)});c.on(e,"focus",function(){++f})}});c.defineExtension("openNotification",function(b,g){function a(){h||
(h=!0,clearTimeout(k),c.rmClass(d.parentNode,"dialog-opened"),d.parentNode.removeChild(d))}n(this,a);var d=m(this,b,g&&g.bottom),h=!1,k;b=g&&"undefined"!==typeof g.duration?g.duration:5E3;c.on(d,"click",function(l){c.e_preventDefault(l);a()});b&&(k=setTimeout(a,b));return a})});
// vim.js
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(t,x,p){t instanceof String&&(t=String(t));for(var B=t.length,C=0;C>>0,$jscomp.propertyToPolyfillSymbol[C]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(C):$jscomp.POLYFILL_PREFIX+p+"$"+C),$jscomp.defineProperty(B,$jscomp.propertyToPolyfillSymbol[C],{configurable:!0,writable:!0,value:x})))};$jscomp.polyfill("Array.prototype.find",function(t){return t?t:function(x,p){return $jscomp.findInternal(this,x,p).v}},"es6","es3");$jscomp.arrayIteratorImpl=function(t){var x=0;return function(){return x>>0)+"_",B=0,C=function(K){if(this instanceof C)throw new TypeError("Symbol is not a constructor");return new x(p+(K||"")+"_"+B++,K)};return C},"es6","es3");
$jscomp.polyfill("Symbol.iterator",function(t){if(t)return t;t=Symbol("Symbol.iterator");for(var x="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),p=0;px||1342177279>>=1)p+=p;return B}},"es6","es3");
(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/dialog/dialog"),require("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],t):t(CodeMirror)})(function(t){function x(p){function B(a,b){a=a.state.vim;if(!a||a.insertMode)return b.head;var c=a.sel.head;if(!c)return b.head;
if(!a.visualBlock||b.head.line==c.line)return b.from()!=b.anchor||b.empty()||b.head.line!=c.line||b.head.ch==c.ch?b.head:new r(b.head.line,b.head.ch-1)}function C(a){a.setOption("disableInput",!0);a.setOption("showCursorWhenSelecting",!1);p.signal(a,"vim-mode-change",{mode:"normal"});a.on("cursorActivity",Na);pa(a);p.on(a.getInputField(),"paste",Oa(a))}function K(a,b){this==p.keyMap.vim&&(a.options.$customCursor=null,p.rmClass(a.getWrapperElement(),"cm-fat-cursor"));b&&b.attach==T||(a.setOption("disableInput",
!1),a.off("cursorActivity",Na),p.off(a.getInputField(),"paste",Oa(a)),a.state.vim=null,qa&&clearTimeout(qa))}function T(a,b){this==p.keyMap.vim&&(a.curOp&&(a.curOp.selectionChanged=!0),a.options.$customCursor=B,p.addClass(a.getWrapperElement(),"cm-fat-cursor"));b&&b.attach==T||C(a)}function ya(a,b){if(b){if(this[a])return this[a];a=Cb(a);if(!a)return!1;var c=Z.findKey(b,a);"function"==typeof c&&p.signal(b,"vim-keypress",a);return c}}function Cb(a){if("'"==a.charAt(0))return a.charAt(1);a=a.split(/-(?!$)/);
var b=a[a.length-1];if(1==a.length&&1==a[0].length||2==a.length&&"Shift"==a[0]&&1==b.length)return!1;for(var c=!1,d=0;d"}function Oa(a){var b=a.state.vim;b.onPasteFn||(b.onPasteFn=function(){b.insertMode||(a.setCursor(L(a.getCursor(),0,1)),ra.enterInsertMode(a,{},b))});return b.onPasteFn}function za(a,b){for(var c=[],d=a;d=a.firstLine()&&b<=a.lastLine()}function P(a){return/^\s*$/.test(a)}function ka(a){return-1!=".?!".indexOf(a)}function Ba(a,b){for(var c=0;ch?g:0;h=d[m].anchor;var n=Math.min(h.line,f.line);g=Math.max(h.line,f.line);l=h.ch;f=f.ch;d=d[m].head.ch-l;m=f-l;0=m?(l++,e||f--):0>d&&0<=m?(l--,k||f++):0>d&&-1==m&&(l--,f++);for(e=n;e<=g;e++)d={anchor:new r(e,l),head:new r(e,
f)},c.push(d);a.setSelections(c);b.ch=f;h.ch=l;return h}function Za(a,b,c){for(var d=[],f=0;fb&&(f.line=b),f.ch=J(a,f.line)),{ranges:[{anchor:e,head:f}],primary:0};if("block"==c){b=Math.min(e.line,f.line);a=e.ch;c=Math.max(e.line,f.line);e=f.ch;a=a.length)return null;d?f=Ga[0]:(f=wa[0],f(a.charAt(e))||(f=wa[1]));for(d=e;f(a.charAt(d))&&dk&&!d?d=!0:f=!1;for(g=b;g>h&&(f&&!a.getLine(g)!=d&&g!=b||!e(g,-1,!0));g--);return{start:new r(g,0),end:c}}function db(a,b,c,d,f){function e(g){0>g.pos+g.dir||g.pos+g.dir>=g.line.length?g.line=null:g.pos+=g.dir}function h(g,l,m,n){g={line:g.getLine(l),ln:l,pos:m,dir:n};if(""===g.line)return{ln:g.ln,pos:g.pos};l=g.pos;for(e(g);null!==g.line;){l=g.pos;if(ka(g.line[g.pos]))if(f){for(e(g);null!==g.line;)if(P(g.line[g.pos]))l=
g.pos,e(g);else break;break}else return{ln:g.ln,pos:g.pos+1};e(g)}return{ln:g.ln,pos:l+1}}function k(g,l,m,n){g=g.getLine(l);l={line:g,ln:l,pos:m,dir:n};if(""===l.line)return{ln:l.ln,pos:l.pos};m=l.pos;for(e(l);null!==l.line;){if(!P(l.line[l.pos])&&!ka(l.line[l.pos]))m=l.pos;else if(ka(l.line[l.pos]))return f?P(l.line[l.pos+1])?{ln:l.ln,pos:l.pos+1}:{ln:l.ln,pos:m}:{ln:l.ln,pos:m};e(l)}l.line=g;return f&&P(l.line[l.pos])?{ln:l.ln,pos:l.pos}:{ln:l.ln,pos:m}}for(b={ln:b.line,pos:b.ch};0d?k(a,
b.ln,b.pos,d):h(a,b.ln,b.pos,d),c--;return new r(b.ln,b.pos)}function Hb(a,b,c,d){function f(k,g){0>g.pos+g.dir||g.pos+g.dir>=g.line.length?(g.ln+=g.dir,Aa(k,g.ln)?(g.line=k.getLine(g.ln),g.pos=0d?h(a,b.ln,b.pos,d):e(a,b.ln,b.pos,d),c--;return new r(b.ln,b.pos)}function eb(){}function X(a){a=a.state.vim;return a.searchState_||(a.searchState_=new eb)}function fb(a,b){b=gb(a,b)||[];if(!b.length)return[];var c=[];if(0===b[0]){for(var d=0;d=b&&a<=c:a==b}function Ja(a){var b=a.getScrollInfo(),c=a.coordsChar({left:0,top:6+b.top},"local");a=a.coordsChar({left:0,top:b.clientHeight-10+b.top},"local");return{top:c.line,bottom:a.line}}function jb(a,b,c){return"'"==c||"`"==c?v.jumpList.find(a,-1)||new r(0,0):"."==c?kb(a):(a=b.marks[c])&&a.find()}function kb(a){a=a.doc.history.done;for(var b=a.length;b--;)if(a[b].changes)return H(a[b].changes[0].to)}function Lb(a,b,c,d,f,e,h,k,g){function l(){a.operation(function(){for(;!q;)m(),
u();w()})}function m(){var F=a.getRange(e.from(),e.to()).replace(h,k),z=e.to().line;e.replace(F);A=e.to().line;f+=A-z;D=A",ha(d,c))}else b.insertMode||(b.lastHPos=a.getCursor().ch)}function Ka(a){this.keyName=a}function mb(a){function b(){c.maybeReset&&(c.changes=[],c.maybeReset=!1);c.changes.push(new Ka(d));return!0}var c=v.macroModeState.lastInsertModeChanges,d=p.keyName(a);d&&(-1==d.indexOf("Delete")&&-1==d.indexOf("Backspace")||p.lookupKey(d,"vim-insert",b))}function nb(a,b,c,d){function f(){k?ea.processAction(a,
b,b.lastEditActionCommand):ea.evalInput(a,b)}function e(m){0",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"g",type:"keyToKey",toKeys:"gk"},{keys:"g",type:"keyToKey",toKeys:"gj"},
{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},
{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},
{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",
motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},
{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,
wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",
motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",
motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",
type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,
inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",
motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,
matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},
context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",
operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},
{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},
context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",
context:"insert"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"idle",context:"normal"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},
{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,
actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},
context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",
type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q