www/codemirror/*: updated: codemirror & addons version to 5.22.0 (minified)

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@13088 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rapster 2017-01-15 14:19:48 +00:00
parent dc17b837ad
commit f455e009f7
21 changed files with 572 additions and 643 deletions

View File

@ -1,6 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- updated: codemirror version to 5.22.2 (minified)
- updated: codemirror & addons version to 5.22.0 (minified)
- bugfix: 93_DbLog.pm: Version is now 2.9.1, "MySQL Server has gone",
new commands purgeCache, commitCache
- bugfix: 74_XiaomiFlowerSens: fix disableForInterval Bug

View File

@ -1,4 +1,7 @@
Copyright (C) 2015 by Marijn Haverbeke <marijnh@gmail.com> and others
The MIT License (MIT)
Copyright (c) 2016 Marijn Haverbeke <marijnh@gmail.com> and others
Copyright (c) 2016 Michael Zhou <zhoumotongxue008@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -7,13 +10,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,2 +1,2 @@
(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 f(b,a){function d(){b.display.wrapper.offsetHeight?(e(b,a),b.display.lastWrapHeight!=b.display.wrapper.clientHeight&&b.refresh()):a.timeout=setTimeout(d,a.delay)}a.timeout=setTimeout(d,a.delay);a.hurry=function(){clearTimeout(a.timeout);a.timeout=setTimeout(d,50)};c.on(window,"mouseup",a.hurry);
c.on(window,"keyup",a.hurry)}function e(b,a){clearTimeout(a.timeout);c.off(window,"mouseup",a.hurry);c.off(window,"keyup",a.hurry)}c.defineOption("autoRefresh",!1,function(b,a){b.state.autoRefresh&&(e(b,b.state.autoRefresh),b.state.autoRefresh=null);a&&0==b.display.wrapper.offsetHeight&&f(b,b.state.autoRefresh={delay:a.delay||250})})});
'use strict';(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 f(b,a){function d(){b.display.wrapper.offsetHeight?(e(b,a),b.display.lastWrapHeight!=b.display.wrapper.clientHeight&&b.refresh()):a.timeout=setTimeout(d,a.delay)}a.timeout=setTimeout(d,a.delay);a.hurry=function(){clearTimeout(a.timeout);a.timeout=setTimeout(d,50)};c.on(window,"mouseup",
a.hurry);c.on(window,"keyup",a.hurry)}function e(b,a){clearTimeout(a.timeout);c.off(window,"mouseup",a.hurry);c.off(window,"keyup",a.hurry)}c.defineOption("autoRefresh",!1,function(b,a){b.state.autoRefresh&&(e(b,b.state.autoRefresh),b.state.autoRefresh=null);a&&0==b.display.wrapper.offsetHeight&&f(b,b.state.autoRefresh={delay:a.delay||250})})});

View File

@ -1,7 +1,7 @@
(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 r(b,a){return"pairs"==a&&"string"==typeof b?b:"object"==typeof b&&null!=b[a]?b[a]:w[a]}function z(b){return function(a){return A(a,b)}}function t(b){var a=b.state.closeBrackets;return a?b.getModeAt(b.getCursor()).closeBrackets||a:null}function A(b,a){var c=t(b);if(!c||b.getOption("disableInput"))return f.Pass;
var e=r(c,"pairs"),d=e.indexOf(a);if(-1==d)return f.Pass;for(var c=r(c,"triples"),u=e.charAt(d+1)==a,x=b.listSelections(),m=0==d%2,l,h,p=0;p<x.length;p++){var q=x[p],g=q.head;h=b.getRange(g,k(g.line,g.ch+1));if(m&&!q.empty())h="surround";else if(!u&&m||h!=a)if(u&&1<g.ch&&0<=c.indexOf(a)&&b.getRange(k(g.line,g.ch-2),g)==a+a&&(2>=g.ch||b.getRange(k(g.line,g.ch-3),k(g.line,g.ch-2))!=a))h="addFour";else if(u)if(!f.isWordChar(h)&&B(b,g,a))h="both";else return f.Pass;else if(m&&(b.getLine(g.line).length==
g.ch||C(h,e)||/\s/.test(h)))h="both";else return f.Pass;else h=0<=c.indexOf(a)&&b.getRange(g,k(g.line,g.ch+3))==a+a+a?"skipThree":"skip";if(!l)l=h;else if(l!=h)return f.Pass}var n=d%2?e.charAt(d-1):a,v=d%2?a:e.charAt(d+1);b.operation(function(){if("skip"==l)b.execCommand("goCharRight");else if("skipThree"==l)for(var a=0;3>a;a++)b.execCommand("goCharRight");else if("surround"==l){for(var c=b.getSelections(),a=0;a<c.length;a++)c[a]=n+c[a]+v;b.replaceSelections(c,"around");c=b.listSelections().slice();
for(a=0;a<c.length;a++){var e=c,g=a,d;d=c[a];var h=0<f.cmpPos(d.anchor,d.head);d={anchor:new k(d.anchor.line,d.anchor.ch+(h?-1:1)),head:new k(d.head.line,d.head.ch+(h?1:-1))};e[g]=d}b.setSelections(c)}else"both"==l?(b.replaceSelection(n+v,null),b.triggerElectric(n+v),b.execCommand("goCharLeft")):"addFour"==l&&(b.replaceSelection(n+n+n+n,"before"),b.execCommand("goCharRight"))})}function C(b,a){var c=a.lastIndexOf(b);return-1<c&&1==c%2}function y(b,a){var c=b.getRange(k(a.line,a.ch-1),k(a.line,a.ch+
1));return 2==c.length?c:null}function B(b,a,c){var e=b.getLine(a.line),d=b.getTokenAt(a);if(/\bstring2?\b/.test(d.type))return!1;c=new f.StringStream(e.slice(0,a.ch)+c+e.slice(a.ch),4);for(c.pos=c.start=d.start;;){e=b.getMode().token(c,d.state);if(c.pos>=a.ch+1)return/\bstring2?\b/.test(e);c.start=c.pos}}var w={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},k=f.Pos;f.defineOption("autoCloseBrackets",!1,function(b,a,c){c&&c!=f.Init&&(b.removeKeyMap(p),b.state.closeBrackets=null);a&&(b.state.closeBrackets=
a,b.addKeyMap(p))});for(var q=w.pairs+"`",p={Backspace:function(b){var a=t(b);if(!a||b.getOption("disableInput"))return f.Pass;for(var c=r(a,"pairs"),a=b.listSelections(),e=0;e<a.length;e++){if(!a[e].empty())return f.Pass;var d=y(b,a[e].head);if(!d||0!=c.indexOf(d)%2)return f.Pass}for(e=a.length-1;0<=e;e--)c=a[e].head,b.replaceRange("",k(c.line,c.ch-1),k(c.line,c.ch+1))},Enter:function(b){var a=t(b),a=a&&r(a,"explode");if(!a||b.getOption("disableInput"))return f.Pass;for(var c=b.listSelections(),
e=0;e<c.length;e++){if(!c[e].empty())return f.Pass;var d=y(b,c[e].head);if(!d||0!=a.indexOf(d)%2)return f.Pass}b.operation(function(){b.replaceSelection("\n\n",null);b.execCommand("goCharLeft");c=b.listSelections();for(var a=0;a<c.length;a++){var d=c[a].head.line;b.indentLine(d,null,!0);b.indentLine(d+1,null,!0)}})}},m=0;m<q.length;m++)p["'"+q.charAt(m)+"'"]=z(q.charAt(m))});
'use strict';(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 r(b,a){return"pairs"==a&&"string"==typeof b?b:"object"==typeof b&&null!=b[a]?b[a]:w[a]}function z(b){return function(a){return A(a,b)}}function v(b){var a=b.state.closeBrackets;return a?b.getModeAt(b.getCursor()).closeBrackets||a:null}function A(b,a){var c=v(b);if(!c||b.getOption("disableInput"))return f.Pass;
var e=r(c,"pairs"),d=e.indexOf(a);if(-1==d)return f.Pass;for(var c=r(c,"triples"),t=e.charAt(d+1)==a,x=b.listSelections(),m=0==d%2,l,p=0;p<x.length;p++){var h=x[p],g=h.head,u=b.getRange(g,k(g.line,g.ch+1));if(m&&!h.empty())h="surround";else if(!t&&m||u!=a)if(t&&1<g.ch&&0<=c.indexOf(a)&&b.getRange(k(g.line,g.ch-2),g)==a+a&&(2>=g.ch||b.getRange(k(g.line,g.ch-3),k(g.line,g.ch-2))!=a))h="addFour";else if(t)if(!f.isWordChar(u)&&B(b,g,a))h="both";else return f.Pass;else if(m&&(b.getLine(g.line).length==
g.ch||C(u,e)||/\s/.test(u)))h="both";else return f.Pass;else h=t&&D(b,g)?"both":0<=c.indexOf(a)&&b.getRange(g,k(g.line,g.ch+3))==a+a+a?"skipThree":"skip";if(!l)l=h;else if(l!=h)return f.Pass}var n=d%2?e.charAt(d-1):a,q=d%2?a:e.charAt(d+1);b.operation(function(){if("skip"==l)b.execCommand("goCharRight");else if("skipThree"==l)for(var a=0;3>a;a++)b.execCommand("goCharRight");else if("surround"==l){for(var c=b.getSelections(),a=0;a<c.length;a++)c[a]=n+c[a]+q;b.replaceSelections(c,"around");c=b.listSelections().slice();
for(a=0;a<c.length;a++){var e=c,g=a,d;d=c[a];var h=0<f.cmpPos(d.anchor,d.head);d={anchor:new k(d.anchor.line,d.anchor.ch+(h?-1:1)),head:new k(d.head.line,d.head.ch+(h?1:-1))};e[g]=d}b.setSelections(c)}else"both"==l?(b.replaceSelection(n+q,null),b.triggerElectric(n+q),b.execCommand("goCharLeft")):"addFour"==l&&(b.replaceSelection(n+n+n+n,"before"),b.execCommand("goCharRight"))})}function C(b,a){b=a.lastIndexOf(b);return-1<b&&1==b%2}function y(b,a){b=b.getRange(k(a.line,a.ch-1),k(a.line,a.ch+1));return 2==
b.length?b:null}function B(b,a,c){var e=b.getLine(a.line),d=b.getTokenAt(a);if(/\bstring2?\b/.test(d.type))return!1;c=new f.StringStream(e.slice(0,a.ch)+c+e.slice(a.ch),4);for(c.pos=c.start=d.start;;){e=b.getMode().token(c,d.state);if(c.pos>=a.ch+1)return/\bstring2?\b/.test(e);c.start=c.pos}}function D(b,a){b=b.getTokenAt(k(a.line,a.ch+1));return/\bstring/.test(b.type)&&b.start==a.ch}var w={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},k=f.Pos;f.defineOption("autoCloseBrackets",!1,function(b,a,
c){c&&c!=f.Init&&(b.removeKeyMap(p),b.state.closeBrackets=null);a&&(b.state.closeBrackets=a,b.addKeyMap(p))});for(var q=w.pairs+"`",p={Backspace:function(b){var a=v(b);if(!a||b.getOption("disableInput"))return f.Pass;for(var c=r(a,"pairs"),a=b.listSelections(),e=0;e<a.length;e++){if(!a[e].empty())return f.Pass;var d=y(b,a[e].head);if(!d||0!=c.indexOf(d)%2)return f.Pass}for(e=a.length-1;0<=e;e--)c=a[e].head,b.replaceRange("",k(c.line,c.ch-1),k(c.line,c.ch+1),"+delete")},Enter:function(b){var a=v(b),
a=a&&r(a,"explode");if(!a||b.getOption("disableInput"))return f.Pass;for(var c=b.listSelections(),e=0;e<c.length;e++){if(!c[e].empty())return f.Pass;var d=y(b,c[e].head);if(!d||0!=a.indexOf(d)%2)return f.Pass}b.operation(function(){b.replaceSelection("\n\n",null);b.execCommand("goCharLeft");c=b.listSelections();for(var a=0;a<c.length;a++){var d=c[a].head.line;b.indentLine(d,null,!0);b.indentLine(d+1,null,!0)}})}},m=0;m<q.length;m++)p["'"+q.charAt(m)+"'"]=z(q.charAt(m))});

File diff suppressed because one or more lines are too long

View File

@ -1,303 +1,305 @@
/* $Id$ */
(function(Ba,Y){"object"===typeof exports&&"undefined"!==typeof module?module.exports=Y():"function"===typeof define&&define.amd?define(Y):Ba.CodeMirror=Y()})(this,function(){function Ba(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function Y(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function V(a,b){return Y(a).appendChild(b)}function v(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)a.appendChild(document.createTextNode(b));
else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function Wb(a,b){3==b.nodeType&&(b=b.parentNode);if(a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)}function na(){var a;try{a=document.activeElement}catch(b){a=document.body||null}for(;a&&a.root&&a.root.activeElement;)a=a.root.activeElement;return a}function Ra(a,b){var c=a.className;Ba(b).test(c)||(a.className+=(c?" ":"")+b)}function Ic(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)c[d]&&
!Ba(c[d]).test(b)&&(b+=" "+c[d]);return b}function Jc(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Ca(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||!1===c&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function Z(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));d=d||0;for(e=e||0;;){var f=a.indexOf("\t",d);if(0>f||f>=b)return e+(b-d);e+=f-d;e+=c-e%c;d=f+1}}function Da(){this.id=null}function J(a,b){for(var c=0;c<a.length;++c)if(a[c]==
b)return c;return-1}function Kc(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);e+=f-d;e+=c-e%c;d=f+1;if(e>=b)return d}}function Lc(a){for(;Xb.length<=a;)Xb.push(y(Xb)+" ");return Xb[a]}function y(a){return a[a.length-1]}function Yb(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function Nf(a,b,c){for(var d=0,e=c(b);d<a.length&&c(a[d])<=e;)d++;a.splice(d,0,b)}function Od(){}function Pd(a,b){var c;Object.create?
c=Object.create(a):(Od.prototype=a,c=new Od);b&&Ca(b,c);return c}function Mc(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||Of.test(a))}function Zb(a,b){return b?-1<b.source.indexOf("\\w")&&Mc(a)?!0:b.test(a):Mc(a)}function Qd(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function nb(a){return 768<=a.charCodeAt(0)&&Pf.test(a)}function Qf(a,b,c){this.input=c;this.scrollbarFiller=v("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("cm-not-content",
"true");this.gutterFiller=v("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content","true");this.lineDiv=v("div",null,"CodeMirror-code");this.selectionDiv=v("div",null,null,"position: relative; z-index: 1");this.cursorDiv=v("div",null,"CodeMirror-cursors");this.measure=v("div",null,"CodeMirror-measure");this.lineMeasure=v("div",null,"CodeMirror-measure");this.lineSpace=v("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");
this.mover=v("div",[v("div",[this.lineSpace],"CodeMirror-lines")],null,"position: relative");this.sizer=v("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=v("div",null,null,"position: absolute; height: 30px; width: 1px;");this.gutters=v("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=v("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=v("div",[this.scrollbarFiller,this.gutterFiller,
this.scroller],"CodeMirror");B&&8>D&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);K||ua&&ob||(this.scroller.draggable=!0);a&&(a.appendChild?a.appendChild(this.wrapper):a(this.wrapper));this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=b.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;
this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine=this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;c.init(this)}function u(a,b){b-=a.first;if(0>b||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=
c.children[d],f=e.chunkSize();if(b<f){c=e;break}b-=f}return c.lines[b]}function Ea(a,b,c){var d=[],e=b.line;a.iter(b.line,c.line+1,function(a){a=a.text;e==c.line&&(a=a.slice(0,c.ch));e==b.line&&(a=a.slice(b.ch));d.push(a);++e});return d}function Nc(a,b,c){var d=[];a.iter(b,c,function(a){d.push(a.text)});return d}function ga(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function C(a){if(null==a.parent)return null;var b=a.parent;a=J(b.lines,a);for(var c=b.parent;c;b=c,c=c.parent)for(var d=
0;c.children[d]!=b;++d)a+=c.children[d].chunkSize();return a+b.first}function Fa(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(b<f){a=e;continue a}b-=f;c+=e.chunkSize()}return c}while(!a.lines);for(d=0;d<a.lines.length;++d){e=a.lines[d].height;if(b<e)break;b-=e}return c+d}function pb(a,b){return b>=a.first&&b<a.first+a.size}function Oc(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function q(a,b){if(!(this instanceof q))return new q(a,
b);this.line=a;this.ch=b}function t(a,b){return a.line-b.line||a.ch-b.ch}function Pc(a){return q(a.line,a.ch)}function $b(a,b){return 0>t(a,b)?b:a}function ac(a,b){return 0>t(a,b)?a:b}function x(a,b){if(b.line<a.first)return q(a.first,0);var c=a.first+a.size-1;if(b.line>c)return q(c,u(a,c).text.length);var c=u(a,b.line).text.length,d=b.ch,c=null==d||d>c?q(b.line,c):0>d?q(b.line,0):b;return c}function Rd(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=x(a,b[d]);return c}function bc(a,b,c){this.marker=a;
this.from=b;this.to=c}function qb(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Qc(a,b){if(b.full)return null;var c=pb(a,b.from.line)&&u(a,b.from.line).markedSpans,d=pb(a,b.to.line)&&u(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==t(b.from,b.to),h;if(c)for(var k=0;k<c.length;++k){var l=c[k],m=l.marker;if(null==l.from||(m.inclusiveLeft?l.from<=e:l.from<e)||!(l.from!=e||"bookmark"!=m.type||g&&l.marker.insertLeft)){var n=null==l.to||
(m.inclusiveRight?l.to>=e:l.to>e);(h||(h=[])).push(new bc(m,l.from,n?null:l.to))}}var c=h,p;if(d)for(h=0;h<d.length;++h)if(k=d[h],l=k.marker,null==k.to||(l.inclusiveRight?k.to>=f:k.to>f)||k.from==f&&"bookmark"==l.type&&(!g||k.marker.insertLeft))m=null==k.from||(l.inclusiveLeft?k.from<=f:k.from<f),(p||(p=[])).push(new bc(l,m?null:k.from-f,null==k.to?null:k.to-f));d=p;f=1==b.text.length;g=y(b.text).length+(f?e:0);if(c)for(p=0;p<c.length;++p)if(h=c[p],null==h.to)(k=qb(d,h.marker),k)?f&&(h.to=null==k.to?
null:k.to+g):h.to=e;if(d)for(e=0;e<d.length;++e)p=d[e],null!=p.to&&(p.to+=g),null==p.from?qb(c,p.marker)||(p.from=g,f&&(c||(c=[])).push(p)):(p.from+=g,f&&(c||(c=[])).push(p));c&&(c=Sd(c));d&&d!=c&&(d=Sd(d));e=[c];if(!f){var f=b.text.length-2,r;if(0<f&&c)for(g=0;g<c.length;++g)null==c[g].to&&(r||(r=[])).push(new bc(c[g].marker,null,null));for(c=0;c<f;++c)e.push(r);e.push(d)}return e}function Sd(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&!1!==c.marker.clearWhenEmpty&&a.splice(b--,
1)}return a.length?a:null}function Rf(a,b,c){var d=null;a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=J(d,c)||(d||(d=[])).push(c)}});if(!d)return null;a=[{from:b,to:c}];for(b=0;b<d.length;++b){c=d[b];for(var e=c.find(0),f=0;f<a.length;++f){var g=a[f];if(!(0>t(g.to,e.from)||0<t(g.from,e.to))){var h=[f,1],k=t(g.from,e.from),l=t(g.to,e.to);(0>k||!c.inclusiveLeft&&!k)&&h.push({from:g.from,to:e.from});(0<l||
!c.inclusiveRight&&!l)&&h.push({from:e.to,to:g.to});a.splice.apply(a,h);f+=h.length-1}}}return a}function Td(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Ud(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Vd(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var c=a.find(),d=b.find(),e=t(c.from,d.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return e?-e:(c=t(c.to,d.to)||(a.inclusiveRight?
1:0)-(b.inclusiveRight?1:0))?c:b.id-a.id}function Ga(a,b){var c=va&&a.markedSpans,d;if(c)for(var e,f=0;f<c.length;++f)e=c[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!d||0>Vd(d,e.marker))&&(d=e.marker);return d}function Wd(a,b,c,d,e){a=u(a,b);if(a=va&&a.markedSpans)for(b=0;b<a.length;++b){var f=a[b];if(f.marker.collapsed){var g=f.marker.find(0),h=t(g.from,c)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),k=t(g.to,d)||(f.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:0);if(!(0<=h&&0>=k||
0>=h&&0<=k)&&(0>=h&&(f.marker.inclusiveRight&&e.inclusiveLeft?0<=t(g.to,c):0<t(g.to,c))||0<=h&&(f.marker.inclusiveRight&&e.inclusiveLeft?0>=t(g.from,d):0>t(g.from,d))))return!0}}}function ha(a){for(var b;b=Ga(a,!0);)a=b.find(-1,!0).line;return a}function Rc(a,b){var c=u(a,b),d=ha(c);return c==d?b:C(d)}function Xd(a,b){if(b>a.lastLine())return b;var c=u(a,b),d;if(!Ha(a,c))return b;for(;d=Ga(c,!1);)c=d.find(1,!0).line;return C(c)+1}function Ha(a,b){var c=va&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=
c[e],d.marker.collapsed&&(null==d.from||!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&Sc(a,b,d)))return!0}function Sc(a,b,c){if(null==c.to)return b=c.marker.find(1,!0),Sc(a,b.line,qb(b.line.markedSpans,c.marker));if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var d,e=0;e<b.markedSpans.length;++e)if(d=b.markedSpans[e],d.marker.collapsed&&!d.marker.widgetNode&&d.from==c.to&&(null==d.to||d.to!=c.from)&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&Sc(a,b,d))return!0}function ia(a){a=
ha(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;else b+=e.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length&&(e=a.children[d],e!=c);++d)b+=e.height;return b}function cc(a){if(0==a.height)return 0;for(var b=a.text.length,c,d=a;c=Ga(d,!0);)c=c.find(0,!0),d=c.from.line,b+=c.from.ch-c.to.ch;for(d=a;c=Ga(d,!1);)a=c.find(0,!0),b-=d.text.length-a.from.ch,d=a.to.line,b+=d.text.length-a.to.ch;return b}function Tc(a){var b=a.display;a=a.doc;b.maxLine=u(a,
a.first);b.maxLineLength=cc(b.maxLine);b.maxLineChanged=!0;a.iter(function(a){var d=cc(a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function Sf(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];if(g.from<c&&g.to>b||b==c&&g.to==b)d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0}e||d(b,c,"ltr")}function Uc(a){return a.level%2?a.to:a.from}function Vc(a){return a.level%2?a.from:a.to}function dc(a){return(a=ba(a))?Uc(a[0]):0}function ec(a){var b=
ba(a);return b?Vc(y(b)):a.text.length}function fc(a,b){var c;rb=null;for(var d=0;d<a.length;++d){var e=a[d];if(e.from<b&&e.to>b)return d;if(e.from==b||e.to==b)if(null==c)c=d;else{var f;f=e.level;var g=a[c].level,h=a[0].level;f=f==h?!0:g==h?!1:f<g;if(f)return e.from!=e.to&&(rb=c),d;e.from!=e.to&&(rb=d);break}}return c}function Wc(a,b,c,d){if(!d)return b+c;do b+=c;while(0<b&&nb(a.text.charAt(b)));return b}function Xc(a,b,c,d){var e=ba(a);if(!e)return Yd(a,b,c,d);var f=fc(e,b),g=e[f];for(b=Wc(a,b,g.level%
2?-c:c,d);;){if(b>g.from&&b<g.to)return b;if(b==g.from||b==g.to){if(fc(e,b)==f)return b;g=e[f+c];return 0<c==g.level%2?g.to:g.from}g=e[f+=c];if(!g)return null;b=0<c==g.level%2?Wc(a,g.to,-1,d):Wc(a,g.from,1,d)}}function Yd(a,b,c,d){b+=c;if(d)for(;0<b&&nb(a.text.charAt(b));)b+=c;return 0>b||b>a.text.length?null:b}function ba(a){var b=a.order;null==b&&(b=a.order=Tf(a.text));return b}function ca(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);
else{var d=(a=a._handlers)&&a[b];d&&(c=J(d,c),-1<c&&(a[b]=d.slice(0,c).concat(d.slice(c+1))))}}function F(a,b){var c=a._handlers&&a._handlers[b]||gc;if(c.length)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function H(a,b,c){"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}});F(a,c||b.type,a,b);return Yc(b)||b.codemirrorIgnore}function Zd(a){var b=a._handlers&&a._handlers.cursorActivity;if(b){a=a.curOp.cursorActivityHandlers||
(a.curOp.cursorActivityHandlers=[]);for(var c=0;c<b.length;++c)-1==J(a,b[c])&&a.push(b[c])}}function aa(a,b){return 0<(a._handlers&&a._handlers[b]||gc).length}function Sa(a){a.prototype.on=function(a,c){w(this,a,c)};a.prototype.off=function(a,c){ca(this,a,c)}}function N(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function $d(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function Yc(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function sb(a){N(a);
$d(a)}function ae(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));da&&a.ctrlKey&&1==b&&(b=3);return b}function Uf(a){if(null==Zc){var b=v("span","\u200b");V(a,v("span",[b,document.createTextNode("x")]));0!=a.firstChild.offsetHeight&&(Zc=1>=b.offsetWidth&&2<b.offsetHeight&&!(B&&8>D))}a=Zc?v("span","\u200b"):v("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px");a.setAttribute("cm-text","");return a}function Vf(a,b){2<arguments.length&&(b.dependencies=
Array.prototype.slice.call(arguments,2));$c[a]=b}function hc(a){if("string"==typeof a&&Ta.hasOwnProperty(a))a=Ta[a];else if(a&&"string"==typeof a.name&&Ta.hasOwnProperty(a.name)){var b=Ta[a.name];"string"==typeof b&&(b={name:b});a=Pd(b,a);a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return hc("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return hc("application/json")}return"string"==typeof a?{name:a}:a||{name:"null"}}function ad(a,b){b=
hc(b);var c=$c[b.name];if(!c)return ad(a,"text/plain");c=c(a,b);if(Ua.hasOwnProperty(b.name)){var d=Ua[b.name],e;for(e in d)d.hasOwnProperty(e)&&(c.hasOwnProperty(e)&&(c["_"+e]=c[e]),c[e]=d[e])}c.name=b.name;b.helperType&&(c.helperType=b.helperType);if(b.modeProps)for(var f in b.modeProps)c[f]=b.modeProps[f];return c}function Wf(a,b){var c=Ua.hasOwnProperty(a)?Ua[a]:Ua[a]={};Ca(b,c)}function oa(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);var c={},d;for(d in b){var e=b[d];e instanceof
Array&&(e=e.concat([]));c[d]=e}return c}function bd(a,b){for(var c;a.innerMode;){c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state;a=c.mode}return c||{mode:a,state:b}}function be(a,b,c){return a.startState?a.startState(b,c):!0}function ce(a,b,c,d){var e=[a.state.modeGen],f={};de(a,b.text,a.doc.mode,c,function(a,b){return e.push(a,b)},f,d);c=function(d){var c=a.state.overlays[d],g=1,l=0;de(a,b.text,c.mode,!0,function(a,b){for(var d=g;l<a;){var f=e[g];f>a&&e.splice(g,1,a,e[g+1],f);g+=2;l=Math.min(a,
f)}if(b)if(c.opaque)e.splice(d,g-d,a,"overlay "+b),g=d+2;else for(;d<g;d+=2)f=e[d+1],e[d+1]=(f?f+" ":"")+"overlay "+b},f)};for(d=0;d<a.state.overlays.length;++d)c(d);return{styles:e,classes:f.bgClass||f.textClass?f:null}}function ee(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=tb(a,C(b)),e=ce(a,b,b.text.length>a.options.maxHighlightLength?oa(a.doc.mode,d):d);b.stateAfter=d;b.styles=e.styles;e.classes?b.styleClasses=e.classes:b.styleClasses&&(b.styleClasses=null);c===a.doc.frontier&&a.doc.frontier++}return b.styles}
function tb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=Xf(a,b,c),g=f>d.first&&u(d,f-1).stateAfter,g=g?oa(d.mode,g):be(d.mode);d.iter(f,b,function(c){cd(a,c.text,g);c.stateAfter=f==b-1||0==f%5||f>=e.viewFrom&&f<e.viewTo?oa(d.mode,g):null;++f});c&&(d.frontier=f);return g}function cd(a,b,c,d){var e=a.doc.mode;a=new ub(b,a.options.tabSize);a.start=a.pos=d||0;for(""==b&&fe(e,c);!a.eol();)dd(e,a,c),a.start=a.pos}function fe(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode){var c=
bd(a,b);if(c.mode.blankLine)return c.mode.blankLine(c.state)}}function dd(a,b,c,d){for(var e=0;10>e;e++){d&&(d[0]=bd(a,c).mode);var f=a.token(b,c);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream.");}function ge(a,b,c,d){var e=function(a){return{start:m.start,end:m.pos,string:m.current(),type:h||null,state:a?oa(f.mode,l):l}},f=a.doc,g=f.mode,h;b=x(f,b);var k=u(f,b.line),l=tb(a,b.line,c),m=new ub(k.text,a.options.tabSize),n;for(d&&(n=[]);(d||m.pos<b.ch)&&!m.eol();)m.start=
m.pos,h=dd(g,m,l),d&&n.push(e(!0));return d?n:e()}function he(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:(new RegExp("(?:^|s)"+c[2]+"(?:$|s)")).test(b[d])||(b[d]+=" "+c[2])}return a}function de(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var k=0,l=null,m=new ub(b,a.options.tabSize),n,p=a.options.addModeClass&&[null];for(""==b&&he(fe(c,
d),f);!m.eol();){m.pos>a.options.maxHighlightLength?(h=!1,g&&cd(a,b,d,m.pos),m.pos=b.length,n=null):n=he(dd(c,m,d,p),f);if(p){var r=p[0].name;r&&(n="m-"+(n?r+" "+n:r))}if(!h||l!=n){for(;k<m.start;)k=Math.min(m.start,k+5E3),e(k,l);l=n}m.start=m.pos}for(;k<m.pos;)a=Math.min(m.pos,k+5E3),e(a,l),k=a}function Xf(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>g;--b){if(b<=f.first)return f.first;var h=u(f,b-1);if(h.stateAfter&&(!c||b<=f.frontier))return b;h=Z(h.text,null,a.options.tabSize);
if(null==e||d>h)e=b-1,d=h}return e}function Va(a,b,c){this.text=a;Ud(this,b);this.height=c?c(this):1}function ie(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?Yf:Zf;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function je(a,b){var c=v("span",null,null,K?"padding-right: .1px":null),c={pre:v("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:(B||K)&&a.getOption("lineWrapping")};b.measure={};for(var d=0;d<=(b.rest?b.rest.length:0);d++){var e=d?b.rest[d-
1]:b.line,f=void 0;c.pos=0;c.addToken=$f;var g;g=a.display.measure;if(null!=ed)g=ed;else{var h=V(g,document.createTextNode("A\u062eA")),k=Wa(h,0,1).getBoundingClientRect(),h=Wa(h,1,2).getBoundingClientRect();Y(g);g=k&&k.left!=k.right?ed=3>h.right-k.right:!1}g&&(f=ba(e))&&(c.addToken=ag(c.addToken,f));c.map=[];var l=b!=a.display.externalMeasured&&C(e);a:{var m=h=k=g=void 0,n=void 0,p=void 0,r=void 0,f=c,l=ee(a,e,l),q=e.markedSpans,fd=e.text,u=0;if(q)for(var w=fd.length,t=0,x=1,Ia="",ka=0;;){if(ka==
t){n=m=h=k=p="";g=null;for(var ka=Infinity,pa=[],S=void 0,y=0;y<q.length;++y){var z=q[y],A=z.marker;"bookmark"==A.type&&z.from==t&&A.widgetNode?pa.push(A):z.from<=t&&(null==z.to||z.to>t||A.collapsed&&z.to==t&&z.from==t)?(null!=z.to&&z.to!=t&&ka>z.to&&(ka=z.to,m=""),A.className&&(n+=" "+A.className),A.css&&(p=(p?p+";":"")+A.css),A.startStyle&&z.from==t&&(h+=" "+A.startStyle),A.endStyle&&z.to==ka&&(S||(S=[])).push(A.endStyle,z.to),A.title&&!k&&(k=A.title),A.collapsed&&(!g||0>Vd(g.marker,A))&&(g=z)):
z.from>t&&ka>z.from&&(ka=z.from)}if(S)for(y=0;y<S.length;y+=2)S[y+1]==ka&&(m+=" "+S[y]);if(!g||g.from==t)for(S=0;S<pa.length;++S)ke(f,0,pa[S]);if(g&&(g.from||0)==t){ke(f,(null==g.to?w+1:g.to)-t,g.marker,null==g.from);if(null==g.to)break a;g.to==t&&(g=!1)}}if(t>=w)break;for(pa=Math.min(w,ka);;){if(Ia){S=t+Ia.length;g||(y=S>pa?Ia.slice(0,pa-t):Ia,f.addToken(f,y,r?r+n:n,h,t+y.length==ka?m:"",k,p));if(S>=pa){Ia=Ia.slice(pa-t);t=pa;break}t=S;h=""}Ia=fd.slice(u,u=l[x++]);r=ie(l[x++],f.cm.options)}}else for(g=
1;g<l.length;g+=2)f.addToken(f,fd.slice(u,u=l[g]),ie(l[g+1],f.cm.options))}e.styleClasses&&(e.styleClasses.bgClass&&(c.bgClass=Ic(e.styleClasses.bgClass,c.bgClass||"")),e.styleClasses.textClass&&(c.textClass=Ic(e.styleClasses.textClass,c.textClass||"")));0==c.map.length&&c.map.push(0,0,c.content.appendChild(Uf(a.display.measure)));0==d?(b.measure.map=c.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(c.map),(b.measure.caches||(b.measure.caches=[])).push({}))}K&&(d=c.content.lastChild,
/\bcm-tab\b/.test(d.className)||d.querySelector&&d.querySelector(".cm-tab"))&&(c.content.className="cm-tab-wrap-hack");F(a,"renderLine",a,b.line,c.pre);c.pre.className&&(c.textClass=Ic(c.pre.className,c.textClass||""));return c}function bg(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 $f(a,b,c,d,e,f,g){if(b){var h;if(a.splitSpaces)if(h=a.trailingSpace,1<b.length&&!/ /.test(b))h=b;else{for(var k="",l=
0;l<b.length;l++){var m=b.charAt(l);" "!=m||!h||l!=b.length-1&&32!=b.charCodeAt(l+1)||(m="\u00a0");k+=m;h=" "==m}h=k}else h=b;k=h;l=a.cm.state.specialChars;m=!1;if(l.test(b)){h=document.createDocumentFragment();for(var n=0;;){l.lastIndex=n;var p=l.exec(b),r=p?p.index-n:b.length-n;if(r){var q=document.createTextNode(k.slice(n,n+r));B&&9>D?h.appendChild(v("span",[q])):h.appendChild(q);a.map.push(a.pos,a.pos+r,q);a.col+=r;a.pos+=r}if(!p)break;n+=r+1;"\t"==p[0]?(p=a.cm.options.tabSize,p-=a.col%p,r=h.appendChild(v("span",
Lc(p),"cm-tab")),r.setAttribute("role","presentation"),r.setAttribute("cm-text","\t"),a.col+=p):("\r"==p[0]||"\n"==p[0]?(r=h.appendChild(v("span","\r"==p[0]?"\u240d":"\u2424","cm-invalidchar")),r.setAttribute("cm-text",p[0])):(r=a.cm.options.specialCharPlaceholder(p[0]),r.setAttribute("cm-text",p[0]),B&&9>D?h.appendChild(v("span",[r])):h.appendChild(r)),a.col+=1);a.map.push(a.pos,a.pos+1,r);a.pos++}}else a.col+=b.length,h=document.createTextNode(k),a.map.push(a.pos,a.pos+b.length,h),B&&9>D&&(m=!0),
a.pos+=b.length;a.trailingSpace=32==k.charCodeAt(b.length-1);if(c||d||e||m||g)return b=c||"",d&&(b+=d),e&&(b+=e),d=v("span",[h],b,g),f&&(d.title=f),a.content.appendChild(d);a.content.appendChild(h)}}function ag(a,b){return function(c,d,e,f,g,h,k){e=e?e+" cm-force-border":"cm-force-border";for(var l=c.pos,m=l+d.length;;){for(var n=void 0,p=0;p<b.length&&!(n=b[p],n.to>l&&n.from<=l);p++);if(n.to>=m)return a(c,d,e,f,g,h,k);a(c,d.slice(0,n.to-l),e,f,null,h,k);f=null;d=d.slice(n.to-l);l=n.to}}}function ke(a,
b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e);!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function le(a,b,c){for(var d=this.line=b,e;d=Ga(d,!1);)d=d.find(1,!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?C(y(this.rest))-c+1:1;this.node=this.text=null;this.hidden=Ha(a,b)}function ic(a,b,c){var d=
[],e;for(e=b;e<c;)b=new le(a.doc,u(a.doc,e),e),e+=b.size,d.push(b);return d}function cg(a,b){var c=a.ownsGroup;if(c)try{var d=c.delayedCallbacks,e=0;do{for(;e<d.length;e++)d[e].call(null);for(var f=0;f<c.ops.length;f++){var g=c.ops[f];if(g.cursorActivityHandlers)for(;g.cursorActivityCalled<g.cursorActivityHandlers.length;)g.cursorActivityHandlers[g.cursorActivityCalled++].call(null,g.cm)}}while(e<d.length)}finally{Xa=null,b(c)}}function T(a,b){var c=a._handlers&&a._handlers[b]||gc;if(c.length){var d=
Array.prototype.slice.call(arguments,2),e;Xa?e=Xa.delayedCallbacks:vb?e=vb:(e=vb=[],setTimeout(dg,0));for(var f=function(a){e.push(function(){return c[a].apply(null,d)})},g=0;g<c.length;++g)f(g)}}function dg(){var a=vb;vb=null;for(var b=0;b<a.length;++b)a[b]()}function me(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];if("text"==f){var f=b,g=f.text.className,h=ne(a,f);f.text==f.node&&(f.node=h.pre);f.text.parentNode.replaceChild(h.pre,f.text);f.text=h.pre;h.bgClass!=f.bgClass||h.textClass!=
f.textClass?(f.bgClass=h.bgClass,f.textClass=h.textClass,gd(f)):g&&(f.text.className=g)}else if("gutter"==f)oe(a,b,c,d);else if("class"==f)gd(b);else if("widget"==f){f=a;g=b;h=d;g.alignable&&(g.alignable=null);for(var k=g.node.firstChild,l;k;k=l)l=k.nextSibling,"CodeMirror-linewidget"==k.className&&g.node.removeChild(k);pe(f,g,h)}}b.changes=null}function wb(a){a.node==a.text&&(a.node=v("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),
B&&8>D&&(a.node.style.zIndex=2));return a.node}function ne(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):je(a,b)}function gd(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;b&&(b+=" CodeMirror-linebackground");if(a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=wb(a);a.background=c.insertBefore(v("div",null,b),c.firstChild)}a.line.wrapClass?
wb(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");a.text.className=(a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass)||""}function oe(a,b,c,d){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=wb(b);b.gutterBackground=v("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,"left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+
"px; width: "+d.gutterTotalWidth+"px");e.insertBefore(b.gutterBackground,b.text)}e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=wb(b),g=b.gutter=v("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px");a.display.input.setUneditable(g);f.insertBefore(g,b.text);b.line.gutterClass&&(g.className+=" "+b.line.gutterClass);!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(v("div",Oc(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt",
"left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px")));if(e)for(b=0;b<a.options.gutters.length;++b)c=a.options.gutters[b],(f=e.hasOwnProperty(c)&&e[c])&&g.appendChild(v("div",[f],"CodeMirror-gutter-elt","left: "+d.gutterLeft[c]+"px; width: "+d.gutterWidth[c]+"px"))}}function eg(a,b,c,d){var e=ne(a,b);b.text=b.node=e.pre;e.bgClass&&(b.bgClass=e.bgClass);e.textClass&&(b.textClass=e.textClass);gd(b);oe(a,b,c,d);pe(a,b,d);return b.node}function pe(a,b,c){qe(a,
b.line,b,c,!0);if(b.rest)for(var d=0;d<b.rest.length;d++)qe(a,b.rest[d],b,c,!1)}function qe(a,b,c,d,e){if(b.widgets){var f=wb(c),g=0;for(b=b.widgets;g<b.length;++g){var h=b[g],k=v("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||k.setAttribute("cm-ignore-events","true");var l=h,m=k,n=d;if(l.noHScroll){(c.alignable||(c.alignable=[])).push(m);var p=n.wrapperWidth;m.style.left=n.fixedPos+"px";l.coverGutter||(p-=n.gutterTotalWidth,m.style.paddingLeft=n.gutterTotalWidth+"px");m.style.width=
p+"px"}l.coverGutter&&(m.style.zIndex=5,m.style.position="relative",l.noHScroll||(m.style.marginLeft=-n.gutterTotalWidth+"px"));a.display.input.setUneditable(k);e&&h.above?f.insertBefore(k,c.gutter||c.text):f.appendChild(k);T(h,"redraw")}}}function xb(a){if(null!=a.height)return a.height;var b=a.doc.cm;if(!b)return 0;if(!Wb(document.body,a.node)){var c="position: relative;";a.coverGutter&&(c+="margin-left: -"+b.display.gutters.offsetWidth+"px;");a.noHScroll&&(c+="width: "+b.display.wrapper.clientWidth+
"px;");V(b.display.measure,v("div",[a.node],null,c))}return a.height=a.node.parentNode.offsetHeight}function qa(a,b){for(var c=b.target||b.srcElement;c!=a.wrapper;c=c.parentNode)if(!c||1==c.nodeType&&"true"==c.getAttribute("cm-ignore-events")||c.parentNode==a.sizer&&c!=a.mover)return!0}function hd(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function re(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=V(a.measure,v("pre","x")),b=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,
b={left:parseInt(b.paddingLeft),right:parseInt(b.paddingRight)};isNaN(b.left)||isNaN(b.right)||(a.cachedPaddingH=b);return b}function la(a){return 30-a.display.nativeBarWidth}function Ja(a){return a.display.scroller.clientWidth-la(a)-a.display.barWidth}function id(a){return a.display.scroller.clientHeight-la(a)-a.display.barHeight}function se(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};
for(b=0;b<a.rest.length;b++)if(C(a.rest[b])>c)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}function jd(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[Ka(a,b)];var c=a.display.externalMeasured;if(c&&b>=c.lineN&&b<c.lineN+c.size)return c}function jc(a,b){var c=C(b),d=jd(a,c);d&&!d.text?d=null:d&&d.changes&&(me(a,d,c,kd(a)),a.curOp.forceUpdate=!0);if(!d){var e;e=ha(b);d=C(e);e=a.display.externalMeasured=new le(a.doc,e,d);e.lineN=d;d=e.built=je(a,e);e.text=
d.pre;V(a.display.lineMeasure,d.pre);d=e}c=se(d,b,c);return{line:b,view:d,rect:null,map:c.map,cache:c.cache,before:c.before,hasHeights:!1}}function kc(a,b,c,d,e){b.before&&(c=-1);var f=c+(d||"");if(b.cache.hasOwnProperty(f))a=b.cache[f];else{b.rect||(b.rect=b.view.text.getBoundingClientRect());if(!b.hasHeights){var g=b.view,h=b.rect,k=a.options.lineWrapping,l=k&&Ja(a);if(!g.measure.heights||k&&g.measure.width!=l){var m=g.measure.heights=[];if(k)for(g.measure.width=l,g=g.text.firstChild.getClientRects(),
k=0;k<g.length-1;k++){var l=g[k],n=g[k+1];2<Math.abs(l.bottom-n.bottom)&&m.push((l.bottom+n.top)/2-h.top)}m.push(h.bottom-h.top)}b.hasHeights=!0}m=d;g=te(b.map,c,m);d=g.node;h=g.start;k=g.end;c=g.collapse;var p;if(3==d.nodeType){for(var r=0;4>r;r++){for(;h&&nb(b.line.text.charAt(g.coverStart+h));)--h;for(;g.coverStart+k<g.coverEnd&&nb(b.line.text.charAt(g.coverStart+k));)++k;if(B&&9>D&&0==h&&k==g.coverEnd-g.coverStart)p=d.parentNode.getBoundingClientRect();else{p=Wa(d,h,k).getClientRects();k=ue;if("left"==
m)for(l=0;l<p.length&&(k=p[l]).left==k.right;l++);else for(l=p.length-1;0<=l&&(k=p[l]).left==k.right;l--);p=k}if(p.left||p.right||0==h)break;k=h;--h;c="right"}B&&11>D&&((r=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=ld?r=ld:(m=V(a.display.measure,v("span","x")),r=m.getBoundingClientRect(),m=Wa(m,0,1).getBoundingClientRect(),r=ld=1<Math.abs(r.left-m.left)),r=!r),r||(r=screen.logicalXDPI/screen.deviceXDPI,m=screen.logicalYDPI/screen.deviceYDPI,p={left:p.left*
r,right:p.right*r,top:p.top*m,bottom:p.bottom*m}))}else 0<h&&(c=m="right"),p=a.options.lineWrapping&&1<(r=d.getClientRects()).length?r["right"==m?r.length-1:0]:d.getBoundingClientRect();!(B&&9>D)||h||p&&(p.left||p.right)||(p=(p=d.parentNode.getClientRects()[0])?{left:p.left,right:p.left+yb(a.display),top:p.top,bottom:p.bottom}:ue);d=p.top-b.rect.top;h=p.bottom-b.rect.top;r=(d+h)/2;m=b.view.measure.heights;for(g=0;g<m.length-1&&!(r<m[g]);g++);c={left:("right"==c?p.right:p.left)-b.rect.left,right:("left"==
c?p.left:p.right)-b.rect.left,top:g?m[g-1]:0,bottom:m[g]};p.left||p.right||(c.bogus=!0);a.options.singleCursorHeightPerLine||(c.rtop=d,c.rbottom=h);a=c;a.bogus||(b.cache[f]=a)}return{left:a.left,right:a.right,top:e?a.rtop:a.top,bottom:e?a.rbottom:a.bottom}}function te(a,b,c){for(var d,e,f,g,h,k,l=0;l<a.length;l+=3){h=a[l];k=a[l+1];if(b<h)e=0,f=1,g="left";else if(b<k)e=b-h,f=e+1;else if(l==a.length-3||b==k&&a[l+3]>b)f=k-h,e=f-1,b>=k&&(g="right");if(null!=e){d=a[l+2];h==k&&c==(d.insertLeft?"left":"right")&&
(g=c);if("left"==c&&0==e)for(;l&&a[l-2]==a[l-3]&&a[l-1].insertLeft;)d=a[(l-=3)+2],g="left";if("right"==c&&e==k-h)for(;l<a.length-3&&a[l+3]==a[l+4]&&!a[l+5].insertLeft;)d=a[(l+=3)+2],g="right";break}}return{node:d,start:e,end:f,collapse:g,coverStart:h,coverEnd:k}}function ve(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function we(a){a.display.externalMeasure=null;Y(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)ve(a.display.view[b])}
function zb(a){we(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function md(a,b,c,d,e){if(!e&&b.widgets)for(e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=xb(b.widgets[e]);c.top+=f;c.bottom+=f}if("line"==d)return c;d||(d="local");b=ia(b);b="local"==d?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;if("page"==d||"window"==d)a=a.display.lineSpace.getBoundingClientRect(),
b+=a.top+("window"==d?0:window.pageYOffset||(document.documentElement||document.body).scrollTop),d=a.left+("window"==d?0:window.pageXOffset||(document.documentElement||document.body).scrollLeft),c.left+=d,c.right+=d;c.top+=b;c.bottom+=b;return c}function xe(a,b,c){if("div"==c)return b;var d=b.left;b=b.top;"page"==c?(d-=window.pageXOffset||(document.documentElement||document.body).scrollLeft,b-=window.pageYOffset||(document.documentElement||document.body).scrollTop):"local"!=c&&c||(c=a.display.sizer.getBoundingClientRect(),
d+=c.left,b+=c.top);a=a.display.lineSpace.getBoundingClientRect();return{left:d-a.left,top:b-a.top}}function lc(a,b,c,d,e){d||(d=u(a.doc,b.line));var f=d;b=b.ch;d=kc(a,jc(a,d),b,e);return md(a,f,d,c)}function ra(a,b,c,d,e,f){function g(b,g){var h=kc(a,e,b,g?"right":"left",f);g?h.left=h.right:h.right=h.left;return md(a,d,h,c)}function h(a,b){var d=k[b],c=d.level%2;a==Uc(d)&&b&&d.level<k[b-1].level?(d=k[--b],a=Vc(d)-(d.level%2?0:1),c=!0):a==Vc(d)&&b<k.length-1&&d.level<k[b+1].level&&(d=k[++b],a=Uc(d)-
d.level%2,c=!1);return c&&a==d.to&&a>d.from?g(a-1):g(a,c)}d=d||u(a.doc,b.line);e||(e=jc(a,d));var k=ba(d);b=b.ch;if(!k)return g(b);var l=fc(k,b),l=h(b,l);null!=rb&&(l.other=h(b,rb));return l}function ye(a,b){var c=0;b=x(a.doc,b);a.options.lineWrapping||(c=yb(a.display)*b.ch);var d=u(a.doc,b.line),e=ia(d)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:e,bottom:e+d.height}}function mc(a,b,c,d){a=q(a,b);a.xRel=d;c&&(a.outside=!0);return a}function nd(a,b,c){var d=a.doc;c+=a.display.viewOffset;
if(0>c)return mc(d.first,0,!0,-1);var e=Fa(d,c),f=d.first+d.size-1;if(e>f)return mc(d.first+d.size-1,u(d,f).text.length,!0,1);0>b&&(b=0);for(d=u(d,e);;)if(e=fg(a,d,e,b,c),f=(d=Ga(d,!1))&&d.find(0,!0),d&&(e.ch>f.from.ch||e.ch==f.from.ch&&0<e.xRel))e=C(d=f.to.line);else return e}function fg(a,b,c,d,e){function f(d){d=ra(a,q(c,d),"line",b,l);h=!0;if(g>d.bottom)return d.left-k;if(g<d.top)return d.left+k;h=!1;return d.left}var g=e-ia(b),h=!1,k=2*a.display.wrapper.clientWidth,l=jc(a,b);e=ba(b);var m=b.text.length,
n=dc(b),p=ec(b),r=f(n),ja=h,t=f(p),u=h;if(d>t)return mc(c,p,u,1);for(;;){if(e?p==n||p==Xc(b,n,1):1>=p-n){m=d<r||d-r<=t-d?n:p;ja=m==n?ja:u;n=d-(m==n?r:t);u&&!e&&!/\s/.test(b.text.charAt(m))&&0<n&&m<b.text.length&&1<l.view.measure.heights.length&&(e=kc(a,l,m,"right"),g<=e.bottom&&g>=e.top&&Math.abs(d-e.right)<n&&(ja=!1,m++,n=d-e.right));for(;nb(b.text.charAt(m));)++m;return mc(c,m,ja,-1>n?-1:1<n?1:0)}var v=Math.ceil(m/2),w=n+v;if(e)for(var w=n,x=0;x<v;++x)w=Xc(b,w,1);x=f(w);if(x>d){p=w;t=x;if(u=h)t+=
1E3;m=v}else n=w,r=x,ja=h,m-=v}}function La(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Ma){Ma=v("pre");for(var b=0;49>b;++b)Ma.appendChild(document.createTextNode("x")),Ma.appendChild(v("br"));Ma.appendChild(document.createTextNode("x"))}V(a.measure,Ma);b=Ma.offsetHeight/50;3<b&&(a.cachedTextHeight=b);Y(a.measure);return b||1}function yb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=v("span","xxxxxxxxxx"),c=v("pre",[b]);V(a.measure,c);b=b.getBoundingClientRect();
b=(b.right-b.left)/10;2<b&&(a.cachedCharWidth=b);return b||10}function kd(a){for(var b=a.display,c={},d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g)c[a.options.gutters[g]]=f.offsetLeft+f.clientLeft+e,d[a.options.gutters[g]]=f.clientWidth;return{fixedPos:od(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function od(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function ze(a){var b=
La(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/yb(a.display)-3);return function(e){if(Ha(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function pd(a){var b=a.doc,c=ze(a);b.iter(function(a){var b=c(a);b!=a.height&&ga(a,b)})}function Na(a,b,c,d){var e=a.display;if(!c&&"true"==(b.target||b.srcElement).getAttribute("cm-not-content"))return null;
var f,g;c=e.lineSpace.getBoundingClientRect();try{f=b.clientX-c.left,g=b.clientY-c.top}catch(k){return null}b=nd(a,f,g);var h;d&&1==b.xRel&&(h=u(a.doc,b.line).text).length==b.ch&&(d=Z(h,h.length,a.options.tabSize)-h.length,b=q(b.line,Math.max(0,Math.round((f-re(a.display).left)/yb(a.display))-d)));return b}function Ka(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,0>b)return d}function Ab(a){a.display.input.showSelection(a.display.input.prepareSelection())}
function Ae(a,b){for(var c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g<c.sel.ranges.length;g++)if(!1!==b||g!=c.sel.primIndex){var h=c.sel.ranges[g];if(!(h.from().line>=a.display.viewTo||h.to().line<a.display.viewFrom)){var k=h.empty();(k||a.options.showCursorWhenSelecting)&&Be(a,h.head,e);k||gg(a,h,f)}}return d}function Be(a,b,c){b=ra(a,b,"div",null,null,!a.options.singleCursorHeightPerLine);var d=c.appendChild(v("div","\u00a0","CodeMirror-cursor"));
d.style.left=b.left+"px";d.style.top=b.top+"px";d.style.height=Math.max(0,b.bottom-b.top)*a.options.cursorHeight+"px";b.other&&(a=c.appendChild(v("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor")),a.style.display="",a.style.left=b.other.left+"px",a.style.top=b.other.top+"px",a.style.height=.85*(b.other.bottom-b.other.top)+"px")}function gg(a,b,c){function d(a,b,d,c){0>b&&(b=0);b=Math.round(b);c=Math.round(c);h.appendChild(v("div",null,"CodeMirror-selected","position: absolute; left: "+
a+"px;\n top: "+b+"px; width: "+(null==d?m-a:d)+"px;\n height: "+(c-b)+"px"))}function e(b,c,e){var f=u(g,b),h=f.text.length,k,n;Sf(ba(f),c||0,null==e?h:e,function(g,p,r){var t=lc(a,q(b,g),"div",f,"left"),u,ja;g==p?(u=t,r=ja=t.left):(u=lc(a,q(b,p-1),"div",f,"right"),"rtl"==r&&(r=t,t=u,u=r),r=t.left,ja=u.right);null==c&&0==g&&(r=l);3<u.top-t.top&&(d(r,t.top,null,t.bottom),r=l,t.bottom<u.top&&d(r,t.bottom,null,u.top));null==e&&p==h&&(ja=m);if(!k||
t.top<k.top||t.top==k.top&&t.left<k.left)k=t;if(!n||u.bottom>n.bottom||u.bottom==n.bottom&&u.right>n.right)n=u;r<l+1&&(r=l);d(r,u.top,ja-r,u.bottom)});return{start:k,end:n}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),k=re(a.display),l=k.left,m=Math.max(f.sizerWidth,Ja(a)-f.sizer.offsetLeft)-k.right,f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var n=u(g,f.line),k=u(g,b.line),k=ha(n)==ha(k),f=e(f.line,f.ch,k?n.text.length+1:null).end;b=e(b.line,k?0:null,b.ch).start;
k&&(f.top<b.top-2?(d(f.right,f.top,null,f.bottom),d(l,b.top,b.left,b.bottom)):d(f.right,f.top,b.left-f.right,f.bottom));f.bottom<b.top&&d(l,f.bottom,null,b.top)}c.appendChild(h)}function qd(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="";0<a.options.cursorBlinkRate?b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}
function Ce(a){a.state.focused||(a.display.input.focus(),rd(a))}function hg(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Bb(a))},100)}function rd(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(F(a,"focus",a,b),a.state.focused=!0,Ra(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),K&&setTimeout(function(){return a.display.input.reset(!0)},
20)),a.display.input.receivedFocus()),qd(a))}function Bb(a,b){a.state.delayingBlurEvent||(a.state.focused&&(F(a,"blur",a,b),a.state.focused=!1,Ya(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function sd(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=od(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&
(c[g].gutter&&(c[g].gutter.style.left=f),c[g].gutterBackground&&(c[g].gutterBackground.style.left=f));var h=c[g].alignable;if(h)for(var k=0;k<h.length;k++)h[k].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function De(a){if(!a.options.lineNumbers)return!1;var b=a.doc,b=Oc(a.options,b.first+b.size-1),c=a.display;if(b.length!=c.lineNumChars){var d=c.measure.appendChild(v("div",[v("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=d.firstChild.offsetWidth,d=d.offsetWidth-
e;c.lineGutter.style.width="";c.lineNumInnerWidth=Math.max(e,c.lineGutter.offsetWidth-d)+1;c.lineNumWidth=c.lineNumInnerWidth+d;c.lineNumChars=c.lineNumInnerWidth?b.length:-1;c.lineGutter.style.width=c.lineNumWidth+"px";td(a);return!0}return!1}function nc(a){a=a.display;for(var b=a.lineDiv.offsetTop,c=0;c<a.view.length;c++){var d=a.view[c],e;if(!d.hidden){if(B&&8>D){var f=d.node.offsetTop+d.node.offsetHeight;e=f-b;b=f}else e=d.node.getBoundingClientRect(),e=e.bottom-e.top;f=d.line.height-e;2>e&&(e=
La(a));if(.001<f||-.001>f)if(ga(d.line,e),Ee(d.line),d.rest)for(e=0;e<d.rest.length;e++)Ee(d.rest[e])}}}function Ee(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.parentNode.offsetHeight}function ud(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop,d=Math.floor(d-a.lineSpace.offsetTop),e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,d=Fa(b,d),e=Fa(b,e);if(c&&c.ensure){var f=c.ensure.from.line;c=c.ensure.to.line;f<d?(d=f,e=Fa(b,ia(u(b,
f))+a.wrapper.clientHeight)):Math.min(c,b.lastLine())>=e&&(d=Fa(b,ia(u(b,c))-a.wrapper.clientHeight),e=c)}return{from:d,to:Math.max(e,d+1)}}function Cb(a,b){2>Math.abs(a.doc.scrollTop-b)||(a.doc.scrollTop=b,ua||vd(a,{top:b}),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbars.setScrollTop(b),ua&&vd(a),Db(a,100))}function Za(a,b,c){(c?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),
a.doc.scrollLeft=b,sd(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function Fe(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail);null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta);return{x:b,y:c}}function ig(a){a=Fe(a);a.x*=W;a.y*=W;return a}function Ge(a,b){var c=Fe(b),d=c.x,c=c.y,e=a.display,f=e.scroller,g=f.scrollWidth>f.clientWidth,h=f.scrollHeight>f.clientHeight;
if(d&&g||c&&h){if(c&&da&&K){var g=b.target,k=e.view;a:for(;g!=f;g=g.parentNode)for(var l=0;l<k.length;l++)if(k[l].node==g){a.display.currentWheelTarget=g;break a}}!d||ua||ea||null==W?(c&&null!=W&&(h=c*W,g=a.doc.scrollTop,k=g+e.wrapper.clientHeight,0>h?g=Math.max(0,g+h-50):k=Math.min(a.doc.height,k+h+50),vd(a,{top:g,bottom:k})),20>oc&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=d,e.wheelDY=c,setTimeout(function(){if(null!=e.wheelStartX){var a=f.scrollLeft-e.wheelStartX,
b=f.scrollTop-e.wheelStartY,a=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null;a&&(W=(W*oc+a)/(oc+1),++oc)}},200)):(e.wheelDX+=d,e.wheelDY+=c))):(c&&h&&Cb(a,Math.max(0,Math.min(f.scrollTop+c*W,f.scrollHeight-f.clientHeight))),Za(a,Math.max(0,Math.min(f.scrollLeft+d*W,f.scrollWidth-f.clientWidth))),(!c||c&&h)&&N(b),e.wheelStartX=null)}}function Eb(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+hd(a.display));return{clientHeight:b.scroller.clientHeight,
viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+la(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function $a(a,b){b||(b=Eb(a));var c=a.display.barWidth,d=a.display.barHeight;He(a,b);for(var e=0;4>e&&c!=a.display.barWidth||d!=a.display.barHeight;e++)c!=a.display.barWidth&&a.options.lineWrapping&&nc(a),He(a,Eb(a)),c=a.display.barWidth,d=
a.display.barHeight}function He(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px";c.heightForcer.style.borderBottom=d.bottom+"px solid transparent";d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="";d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?
(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function Ie(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&Ya(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new Je[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);w(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},
0)});b.setAttribute("cm-not-content","true")},function(b,c){"horizontal"==c?Za(a,b):Cb(a,b)},a);a.display.scrollbars.addClass&&Ra(a.display.wrapper,a.display.scrollbars.addClass)}function pc(a,b,c,d,e){var f=a.display,g=La(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,k=id(a),l={};e-c>k&&(e=c+k);var m=a.doc.height+hd(f),n=c<g,g=e>m-g;c<h?l.scrollTop=n?0:c:e>h+k&&(c=Math.min(c,(g?m:e)-k),c!=h&&(l.scrollTop=c));h=a.curOp&&null!=a.curOp.scrollLeft?
a.curOp.scrollLeft:f.scroller.scrollLeft;a=Ja(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0);(f=d-b>a)&&(d=b+a);10>b?l.scrollLeft=0:b<h?l.scrollLeft=Math.max(0,b-(f?0:10)):d>a+h-3&&(l.scrollLeft=d+(f?0:10)-a);return l}function qc(a,b,c){null==b&&null==c||rc(a);null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b);null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function ab(a){rc(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||
(c=b.ch?q(b.line,b.ch-1):b,d=q(b.line,b.ch+1));a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function rc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=ye(a,b.from),d=ye(a,b.to),b=pc(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(b.scrollLeft,b.scrollTop)}}function bb(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,
changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++jg};a=a.curOp;Xa?Xa.ops.push(a):a.ownsGroup=Xa={ops:[a],delayedCallbacks:[]}}function cb(a){cg(a.curOp,function(a){for(var b=0;b<a.ops.length;b++)a.ops[b].cm.curOp=null;a=a.ops;for(b=0;b<a.length;b++){var d=a[b],e=d.cm,f=e.display,g=e.display;!g.scrollbarsClipped&&g.scroller.offsetWidth&&(g.nativeBarWidth=g.scroller.offsetWidth-g.scroller.clientWidth,
g.heightForcer.style.height=la(e)+"px",g.sizer.style.marginBottom=-g.nativeBarWidth+"px",g.sizer.style.borderRightWidth=la(e)+"px",g.scrollbarsClipped=!0);d.updateMaxLine&&Tc(e);d.mustUpdate=d.viewChanged||d.forceUpdate||null!=d.scrollTop||d.scrollToPos&&(d.scrollToPos.from.line<f.viewFrom||d.scrollToPos.to.line>=f.viewTo)||f.maxLineChanged&&e.options.lineWrapping;d.update=d.mustUpdate&&new sc(e,d.mustUpdate&&{top:d.scrollTop,ensure:d.scrollToPos},d.forceUpdate)}for(b=0;b<a.length;b++)d=a[b],d.updatedDisplay=
d.mustUpdate&&wd(d.cm,d.update);for(b=0;b<a.length;b++)if(d=a[b],e=d.cm,f=e.display,d.updatedDisplay&&nc(e),d.barMeasure=Eb(e),f.maxLineChanged&&!e.options.lineWrapping&&(g=f.maxLine.text.length,g=kc(e,jc(e,f.maxLine),g,void 0),d.adjustWidthTo=g.left+3,e.display.sizerWidth=d.adjustWidthTo,d.barMeasure.scrollWidth=Math.max(f.scroller.clientWidth,f.sizer.offsetLeft+d.adjustWidthTo+la(e)+e.display.barWidth),d.maxScrollLeft=Math.max(0,f.sizer.offsetLeft+d.adjustWidthTo-Ja(e))),d.updatedDisplay||d.selectionChanged)d.preparedSelection=
f.input.prepareSelection(d.focus);for(b=0;b<a.length;b++)d=a[b],e=d.cm,null!=d.adjustWidthTo&&(e.display.sizer.style.minWidth=d.adjustWidthTo+"px",d.maxScrollLeft<e.doc.scrollLeft&&Za(e,Math.min(e.display.scroller.scrollLeft,d.maxScrollLeft),!0),e.display.maxLineChanged=!1),f=d.focus&&d.focus==na()&&(!document.hasFocus||document.hasFocus()),d.preparedSelection&&e.display.input.showSelection(d.preparedSelection,f),(d.updatedDisplay||d.startHeight!=e.doc.height)&&$a(e,d.barMeasure),d.updatedDisplay&&
'use strict';var $jscomp={scope:{},findInternal:function(y,H,D){y instanceof String&&(y=String(y));for(var r=y.length,V=0;V<r;V++){var ba=y[V];if(H.call(D,ba,V,y))return{i:V,v:ba}}return{i:-1,v:void 0}}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(y,H,D){if(D.get||D.set)throw new TypeError("ES3 does not support getters and setters.");y!=Array.prototype&&y!=Object.prototype&&(y[H]=D.value)};
$jscomp.getGlobal=function(y){return"undefined"!=typeof window&&window===y?y:"undefined"!=typeof global&&null!=global?global:y};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(y,H,D,r){if(H){D=$jscomp.global;y=y.split(".");for(r=0;r<y.length-1;r++){var V=y[r];V in D||(D[V]={});D=D[V]}y=y[y.length-1];r=D[y];H=H(r);H!=r&&null!=H&&$jscomp.defineProperty(D,y,{configurable:!0,writable:!0,value:H})}};
$jscomp.polyfill("Array.prototype.find",function(y){return y?y:function(y,D){return $jscomp.findInternal(this,y,D).v}},"es6-impl","es3");
(function(y,H){"object"===typeof exports&&"undefined"!==typeof module?module.exports=H():"function"===typeof define&&define.amd?define(H):y.CodeMirror=H()})(this,function(){function y(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function H(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function D(a,b){return H(a).appendChild(b)}function r(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)a.appendChild(document.createTextNode(b));
else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function V(a,b){3==b.nodeType&&(b=b.parentNode);if(a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)}function ba(){var a;try{a=document.activeElement}catch(b){a=document.body||null}for(;a&&a.root&&a.root.activeElement;)a=a.root.activeElement;return a}function Sa(a,b){var c=a.className;y(b).test(c)||(a.className+=(c?" ":"")+b)}function Ic(a,b){a=a.split(" ");for(var c=0;c<a.length;c++)a[c]&&
!y(a[c]).test(b)&&(b+=" "+a[c]);return b}function Jc(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Da(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||!1===c&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function ca(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));d=d||0;for(e=e||0;;){var f=a.indexOf("\t",d);if(0>f||f>=b)return e+(b-d);e+=f-d;e+=c-e%c;d=f+1}}function Ea(){this.id=null}function M(a,b){for(var c=0;c<a.length;++c)if(a[c]==
b)return c;return-1}function Kc(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);e+=f-d;e+=c-e%c;d=f+1;if(e>=b)return d}}function Lc(a){for(;Xb.length<=a;)Xb.push(x(Xb)+" ");return Xb[a]}function x(a){return a[a.length-1]}function Yb(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function Nf(a,b,c){for(var d=0,e=c(b);d<a.length&&c(a[d])<=e;)d++;a.splice(d,0,b)}function Od(){}function Pd(a,b){Object.create?
a=Object.create(a):(Od.prototype=a,a=new Od);b&&Da(b,a);return a}function Mc(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||Of.test(a))}function Zb(a,b){return b?-1<b.source.indexOf("\\w")&&Mc(a)?!0:b.test(a):Mc(a)}function Qd(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function ob(a){return 768<=a.charCodeAt(0)&&Pf.test(a)}function Qf(a,b,c){this.input=c;this.scrollbarFiller=r("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("cm-not-content",
"true");this.gutterFiller=r("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content","true");this.lineDiv=r("div",null,"CodeMirror-code");this.selectionDiv=r("div",null,null,"position: relative; z-index: 1");this.cursorDiv=r("div",null,"CodeMirror-cursors");this.measure=r("div",null,"CodeMirror-measure");this.lineMeasure=r("div",null,"CodeMirror-measure");this.lineSpace=r("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");
this.mover=r("div",[r("div",[this.lineSpace],"CodeMirror-lines")],null,"position: relative");this.sizer=r("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=r("div",null,null,"position: absolute; height: 30px; width: 1px;");this.gutters=r("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=r("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=r("div",[this.scrollbarFiller,this.gutterFiller,
this.scroller],"CodeMirror");B&&8>F&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);N||wa&&pb||(this.scroller.draggable=!0);a&&(a.appendChild?a.appendChild(this.wrapper):a(this.wrapper));this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=b.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;
this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine=this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;c.init(this)}function v(a,b){b-=a.first;if(0>b||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(;!a.lines;)for(var c=0;;++c){var d=a.children[c],
e=d.chunkSize();if(b<e){a=d;break}b-=e}return a.lines[b]}function Fa(a,b,c){var d=[],e=b.line;a.iter(b.line,c.line+1,function(a){a=a.text;e==c.line&&(a=a.slice(0,c.ch));e==b.line&&(a=a.slice(b.ch));d.push(a);++e});return d}function Nc(a,b,c){var d=[];a.iter(b,c,function(a){d.push(a.text)});return d}function ja(a,b){if(b-=a.height)for(;a;a=a.parent)a.height+=b}function C(a){if(null==a.parent)return null;var b=a.parent;a=M(b.lines,a);for(var c=b.parent;c;b=c,c=c.parent)for(var d=0;c.children[d]!=b;++d)a+=
c.children[d].chunkSize();return a+b.first}function Ga(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(b<f){a=e;continue a}b-=f;c+=e.chunkSize()}return c}while(!a.lines);for(d=0;d<a.lines.length;++d){e=a.lines[d].height;if(b<e)break;b-=e}return c+d}function qb(a,b){return b>=a.first&&b<a.first+a.size}function Oc(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function q(a,b){if(!(this instanceof q))return new q(a,b);this.line=a;this.ch=
b}function u(a,b){return a.line-b.line||a.ch-b.ch}function Pc(a){return q(a.line,a.ch)}function $b(a,b){return 0>u(a,b)?b:a}function ac(a,b){return 0>u(a,b)?a:b}function z(a,b){if(b.line<a.first)return q(a.first,0);var c=a.first+a.size-1;if(b.line>c)return q(c,v(a,c).text.length);a=v(a,b.line).text.length;c=b.ch;b=null==c||c>a?q(b.line,a):0>c?q(b.line,0):b;return b}function Rd(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=z(a,b[d]);return c}function bc(a,b,c){this.marker=a;this.from=b;this.to=c}function rb(a,
b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Qc(a,b){if(b.full)return null;var c=qb(a,b.from.line)&&v(a,b.from.line).markedSpans,d=qb(a,b.to.line)&&v(a,b.to.line).markedSpans;if(!c&&!d)return null;a=b.from.ch;var e=b.to.ch,f=0==u(b.from,b.to),g;if(c)for(var h=0;h<c.length;++h){var k=c[h],l=k.marker;if(null==k.from||(l.inclusiveLeft?k.from<=a:k.from<a)||!(k.from!=a||"bookmark"!=l.type||f&&k.marker.insertLeft)){var m=null==k.to||(l.inclusiveRight?k.to>=a:k.to>a);
(g||(g=[])).push(new bc(l,k.from,m?null:k.to))}}var c=g,n;if(d)for(g=0;g<d.length;++g)if(h=d[g],k=h.marker,null==h.to||(k.inclusiveRight?h.to>=e:h.to>e)||h.from==e&&"bookmark"==k.type&&(!f||h.marker.insertLeft))l=null==h.from||(k.inclusiveLeft?h.from<=e:h.from<e),(n||(n=[])).push(new bc(k,l?null:h.from-e,null==h.to?null:h.to-e));d=1==b.text.length;e=x(b.text).length+(d?a:0);if(c)for(f=0;f<c.length;++f)if(g=c[f],null==g.to)(h=rb(n,g.marker),h)?d&&(g.to=null==h.to?null:h.to+e):g.to=a;if(n)for(a=0;a<
n.length;++a)f=n[a],null!=f.to&&(f.to+=e),null==f.from?rb(c,f.marker)||(f.from=e,d&&(c||(c=[])).push(f)):(f.from+=e,d&&(c||(c=[])).push(f));c&&(c=Sd(c));n&&n!=c&&(n=Sd(n));a=[c];if(!d){b=b.text.length-2;var p;if(0<b&&c)for(d=0;d<c.length;++d)null==c[d].to&&(p||(p=[])).push(new bc(c[d].marker,null,null));for(c=0;c<b;++c)a.push(p);a.push(n)}return a}function Sd(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&!1!==c.marker.clearWhenEmpty&&a.splice(b--,1)}return a.length?a:null}
function Rf(a,b,c){var d=null;a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=M(d,c)||(d||(d=[])).push(c)}});if(!d)return null;a=[{from:b,to:c}];for(b=0;b<d.length;++b){c=d[b];for(var e=c.find(0),f=0;f<a.length;++f){var g=a[f];if(!(0>u(g.to,e.from)||0<u(g.from,e.to))){var h=[f,1],k=u(g.from,e.from),l=u(g.to,e.to);(0>k||!c.inclusiveLeft&&!k)&&h.push({from:g.from,to:e.from});(0<l||!c.inclusiveRight&&!l)&&h.push({from:e.to,
to:g.to});a.splice.apply(a,h);f+=h.length-1}}}return a}function Td(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Ud(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Vd(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var c=a.find(),d=b.find(),e=u(c.from,d.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return e?-e:(c=u(c.to,d.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?c:
b.id-a.id}function Ha(a,b){a=xa&&a.markedSpans;var c;if(a)for(var d,e=0;e<a.length;++e)d=a[e],d.marker.collapsed&&null==(b?d.from:d.to)&&(!c||0>Vd(c,d.marker))&&(c=d.marker);return c}function Wd(a,b,c,d,e){a=v(a,b);if(a=xa&&a.markedSpans)for(b=0;b<a.length;++b){var f=a[b];if(f.marker.collapsed){var g=f.marker.find(0),h=u(g.from,c)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),k=u(g.to,d)||(f.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:0);if(!(0<=h&&0>=k||0>=h&&0<=k)&&(0>=h&&(f.marker.inclusiveRight&&
e.inclusiveLeft?0<=u(g.to,c):0<u(g.to,c))||0<=h&&(f.marker.inclusiveRight&&e.inclusiveLeft?0>=u(g.from,d):0>u(g.from,d))))return!0}}}function ka(a){for(var b;b=Ha(a,!0);)a=b.find(-1,!0).line;return a}function Rc(a,b){a=v(a,b);var c=ka(a);return a==c?b:C(c)}function Xd(a,b){if(b>a.lastLine())return b;var c=v(a,b);if(!Ia(a,c))return b;for(;a=Ha(c,!1);)c=a.find(1,!0).line;return C(c)+1}function Ia(a,b){var c=xa&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed&&(null==d.from||
!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&Sc(a,b,d)))return!0}function Sc(a,b,c){if(null==c.to)return b=c.marker.find(1,!0),Sc(a,b.line,rb(b.line.markedSpans,c.marker));if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var d,e=0;e<b.markedSpans.length;++e)if(d=b.markedSpans[e],d.marker.collapsed&&!d.marker.widgetNode&&d.from==c.to&&(null==d.to||d.to!=c.from)&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&Sc(a,b,d))return!0}function la(a){a=ka(a);for(var b=0,c=a.parent,
d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;else b+=e.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length&&(e=a.children[d],e!=c);++d)b+=e.height;return b}function cc(a){if(0==a.height)return 0;for(var b=a.text.length,c,d=a;c=Ha(d,!0);)c=c.find(0,!0),d=c.from.line,b+=c.from.ch-c.to.ch;for(d=a;c=Ha(d,!1);)a=c.find(0,!0),b-=d.text.length-a.from.ch,d=a.to.line,b+=d.text.length-a.to.ch;return b}function Tc(a){var b=a.display;a=a.doc;b.maxLine=v(a,a.first);b.maxLineLength=cc(b.maxLine);
b.maxLineChanged=!0;a.iter(function(a){var d=cc(a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function Sf(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];if(g.from<c&&g.to>b||b==c&&g.to==b)d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0}e||d(b,c,"ltr")}function Uc(a){return a.level%2?a.to:a.from}function Vc(a){return a.level%2?a.from:a.to}function dc(a){return(a=ea(a))?Uc(a[0]):0}function ec(a){var b=ea(a);return b?Vc(x(b)):a.text.length}
function fc(a,b){var c;sb=null;for(var d=0;d<a.length;++d){var e=a[d];if(e.from<b&&e.to>b)return d;if(e.from==b||e.to==b)if(null==c)c=d;else{b=e.level;var f=a[c].level;a=a[0].level;a=b==a?!0:f==a?!1:b<f;if(a)return e.from!=e.to&&(sb=c),d;e.from!=e.to&&(sb=d);break}}return c}function Wc(a,b,c,d){if(!d)return b+c;do b+=c;while(0<b&&ob(a.text.charAt(b)));return b}function Xc(a,b,c,d){var e=ea(a);if(!e)return Yd(a,b,c,d);var f=fc(e,b),g=e[f];for(b=Wc(a,b,g.level%2?-c:c,d);;){if(b>g.from&&b<g.to)return b;
if(b==g.from||b==g.to){if(fc(e,b)==f)return b;g=e[f+c];return 0<c==g.level%2?g.to:g.from}g=e[f+=c];if(!g)return null;b=0<c==g.level%2?Wc(a,g.to,-1,d):Wc(a,g.from,1,d)}}function Yd(a,b,c,d){b+=c;if(d)for(;0<b&&ob(a.text.charAt(b));)b+=c;return 0>b||b>a.text.length?null:b}function ea(a){var b=a.order;null==b&&(b=a.order=Tf(a.text));return b}function fa(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=(a=a._handlers)&&a[b];d&&(c=M(d,
c),-1<c&&(a[b]=d.slice(0,c).concat(d.slice(c+1))))}}function I(a,b){var c=a._handlers&&a._handlers[b]||gc;if(c.length)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function K(a,b,c){"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}});I(a,c||b.type,a,b);return Yc(b)||b.codemirrorIgnore}function Zd(a){var b=a._handlers&&a._handlers.cursorActivity;if(b){a=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var c=
0;c<b.length;++c)-1==M(a,b[c])&&a.push(b[c])}}function da(a,b){return 0<(a._handlers&&a._handlers[b]||gc).length}function Ta(a){a.prototype.on=function(a,c){w(this,a,c)};a.prototype.off=function(a,c){fa(this,a,c)}}function Q(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function $d(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function Yc(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function tb(a){Q(a);$d(a)}function ae(a){var b=a.which;null==b&&(a.button&
1?b=1:a.button&2?b=3:a.button&4&&(b=2));ga&&a.ctrlKey&&1==b&&(b=3);return b}function Uf(a){if(null==Zc){var b=r("span","\u200b");D(a,r("span",[b,document.createTextNode("x")]));0!=a.firstChild.offsetHeight&&(Zc=1>=b.offsetWidth&&2<b.offsetHeight&&!(B&&8>F))}a=Zc?r("span","\u200b"):r("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px");a.setAttribute("cm-text","");return a}function Vf(a,b){2<arguments.length&&(b.dependencies=Array.prototype.slice.call(arguments,2));$c[a]=b}
function hc(a){if("string"==typeof a&&Ua.hasOwnProperty(a))a=Ua[a];else if(a&&"string"==typeof a.name&&Ua.hasOwnProperty(a.name)){var b=Ua[a.name];"string"==typeof b&&(b={name:b});a=Pd(b,a);a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return hc("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return hc("application/json")}return"string"==typeof a?{name:a}:a||{name:"null"}}function ad(a,b){b=hc(b);var c=$c[b.name];if(!c)return ad(a,"text/plain");
a=c(a,b);if(Va.hasOwnProperty(b.name)){var c=Va[b.name],d;for(d in c)c.hasOwnProperty(d)&&(a.hasOwnProperty(d)&&(a["_"+d]=a[d]),a[d]=c[d])}a.name=b.name;b.helperType&&(a.helperType=b.helperType);if(b.modeProps)for(var e in b.modeProps)a[e]=b.modeProps[e];return a}function Wf(a,b){a=Va.hasOwnProperty(a)?Va[a]:Va[a]={};Da(b,a)}function qa(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);a={};for(var c in b){var d=b[c];d instanceof Array&&(d=d.concat([]));a[c]=d}return a}function bd(a,b){for(var c;a.innerMode;){c=
a.innerMode(b);if(!c||c.mode==a)break;b=c.state;a=c.mode}return c||{mode:a,state:b}}function be(a,b,c){return a.startState?a.startState(b,c):!0}function ce(a,b,c,d){var e=[a.state.modeGen],f={};de(a,b.text,a.doc.mode,c,function(a,b){return e.push(a,b)},f,d);c=function(d){var c=a.state.overlays[d],g=1,l=0;de(a,b.text,c.mode,!0,function(a,b){for(var d=g;l<a;){var f=e[g];f>a&&e.splice(g,1,a,e[g+1],f);g+=2;l=Math.min(a,f)}if(b)if(c.opaque)e.splice(d,g-d,a,"overlay "+b),g=d+2;else for(;d<g;d+=2)a=e[d+
1],e[d+1]=(a?a+" ":"")+"overlay "+b},f)};for(d=0;d<a.state.overlays.length;++d)c(d);return{styles:e,classes:f.bgClass||f.textClass?f:null}}function ee(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=ub(a,C(b)),e=ce(a,b,b.text.length>a.options.maxHighlightLength?qa(a.doc.mode,d):d);b.stateAfter=d;b.styles=e.styles;e.classes?b.styleClasses=e.classes:b.styleClasses&&(b.styleClasses=null);c===a.doc.frontier&&a.doc.frontier++}return b.styles}function ub(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;
var f=Xf(a,b,c),g=f>d.first&&v(d,f-1).stateAfter,g=g?qa(d.mode,g):be(d.mode);d.iter(f,b,function(c){cd(a,c.text,g);c.stateAfter=f==b-1||0==f%5||f>=e.viewFrom&&f<e.viewTo?qa(d.mode,g):null;++f});c&&(d.frontier=f);return g}function cd(a,b,c,d){var e=a.doc.mode;a=new vb(b,a.options.tabSize);a.start=a.pos=d||0;for(""==b&&fe(e,c);!a.eol();)dd(e,a,c),a.start=a.pos}function fe(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode&&(a=bd(a,b),a.mode.blankLine))return a.mode.blankLine(a.state)}function dd(a,
b,c,d){for(var e=0;10>e;e++){d&&(d[0]=bd(a,c).mode);var f=a.token(b,c);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream.");}function ge(a,b,c,d){var e=function(a){return{start:m.start,end:m.pos,string:m.current(),type:h||null,state:a?qa(f.mode,l):l}},f=a.doc,g=f.mode,h;b=z(f,b);var k=v(f,b.line),l=ub(a,b.line,c),m=new vb(k.text,a.options.tabSize),n;for(d&&(n=[]);(d||m.pos<b.ch)&&!m.eol();)m.start=m.pos,h=dd(g,m,l),d&&n.push(e(!0));return d?n:e()}function he(a,b){if(a)for(;;){var c=
a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:(new RegExp("(?:^|s)"+c[2]+"(?:$|s)")).test(b[d])||(b[d]+=" "+c[2])}return a}function de(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var k=0,l=null,m=new vb(b,a.options.tabSize),n,p=a.options.addModeClass&&[null];for(""==b&&he(fe(c,d),f);!m.eol();){m.pos>a.options.maxHighlightLength?(h=!1,g&&cd(a,b,d,m.pos),m.pos=
b.length,n=null):n=he(dd(c,m,d,p),f);if(p){var t=p[0].name;t&&(n="m-"+(n?t+" "+n:t))}if(!h||l!=n){for(;k<m.start;)k=Math.min(m.start,k+5E3),e(k,l);l=n}m.start=m.pos}for(;k<m.pos;)a=Math.min(m.pos,k+5E3),e(a,l),k=a}function Xf(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>g;--b){if(b<=f.first)return f.first;var h=v(f,b-1);if(h.stateAfter&&(!c||b<=f.frontier))return b;h=ca(h.text,null,a.options.tabSize);if(null==e||d>h)e=b-1,d=h}return e}function Wa(a,b,c){this.text=a;Ud(this,
b);this.height=c?c(this):1}function ie(a,b){if(!a||/^\s*$/.test(a))return null;b=b.addModeClass?Yf:Zf;return b[a]||(b[a]=a.replace(/\S+/g,"cm-$&"))}function je(a,b){var c=r("span",null,null,N?"padding-right: .1px":null),c={pre:r("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:(B||N)&&a.getOption("lineWrapping")};b.measure={};for(var d=0;d<=(b.rest?b.rest.length:0);d++){var e=d?b.rest[d-1]:b.line,f=void 0;c.pos=0;c.addToken=$f;var g;g=a.display.measure;if(null!=
ed)g=ed;else{var h=D(g,document.createTextNode("A\u062eA")),k=Xa(h,0,1).getBoundingClientRect(),h=Xa(h,1,2).getBoundingClientRect();H(g);g=k&&k.left!=k.right?ed=3>h.right-k.right:!1}g&&(f=ea(e))&&(c.addToken=ag(c.addToken,f));c.map=[];var l=b!=a.display.externalMeasured&&C(e);a:{var m=h=k=g=void 0,n=void 0,p=void 0,t=void 0,f=c,l=ee(a,e,l),q=e.markedSpans,fd=e.text,v=0;if(q)for(var w=fd.length,u=0,z=1,Ja="",na=0;;){if(na==u){n=m=h=k=p="";g=null;for(var na=Infinity,ra=[],W=void 0,y=0;y<q.length;++y){var x=
q[y],A=x.marker;"bookmark"==A.type&&x.from==u&&A.widgetNode?ra.push(A):x.from<=u&&(null==x.to||x.to>u||A.collapsed&&x.to==u&&x.from==u)?(null!=x.to&&x.to!=u&&na>x.to&&(na=x.to,m=""),A.className&&(n+=" "+A.className),A.css&&(p=(p?p+";":"")+A.css),A.startStyle&&x.from==u&&(h+=" "+A.startStyle),A.endStyle&&x.to==na&&(W||(W=[])).push(A.endStyle,x.to),A.title&&!k&&(k=A.title),A.collapsed&&(!g||0>Vd(g.marker,A))&&(g=x)):x.from>u&&na>x.from&&(na=x.from)}if(W)for(y=0;y<W.length;y+=2)W[y+1]==na&&(m+=" "+W[y]);
if(!g||g.from==u)for(W=0;W<ra.length;++W)ke(f,0,ra[W]);if(g&&(g.from||0)==u){ke(f,(null==g.to?w+1:g.to)-u,g.marker,null==g.from);if(null==g.to)break a;g.to==u&&(g=!1)}}if(u>=w)break;for(ra=Math.min(w,na);;){if(Ja){W=u+Ja.length;g||(y=W>ra?Ja.slice(0,ra-u):Ja,f.addToken(f,y,t?t+n:n,h,u+y.length==na?m:"",k,p));if(W>=ra){Ja=Ja.slice(ra-u);u=ra;break}u=W;h=""}Ja=fd.slice(v,v=l[z++]);t=ie(l[z++],f.cm.options)}}else for(g=1;g<l.length;g+=2)f.addToken(f,fd.slice(v,v=l[g]),ie(l[g+1],f.cm.options))}e.styleClasses&&
(e.styleClasses.bgClass&&(c.bgClass=Ic(e.styleClasses.bgClass,c.bgClass||"")),e.styleClasses.textClass&&(c.textClass=Ic(e.styleClasses.textClass,c.textClass||"")));0==c.map.length&&c.map.push(0,0,c.content.appendChild(Uf(a.display.measure)));0==d?(b.measure.map=c.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(c.map),(b.measure.caches||(b.measure.caches=[])).push({}))}N&&(d=c.content.lastChild,/\bcm-tab\b/.test(d.className)||d.querySelector&&d.querySelector(".cm-tab"))&&(c.content.className=
"cm-tab-wrap-hack");I(a,"renderLine",a,b.line,c.pre);c.pre.className&&(c.textClass=Ic(c.pre.className,c.textClass||""));return c}function bg(a){var b=r("span","\u2022","cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);b.setAttribute("aria-label",b.title);return b}function $f(a,b,c,d,e,f,g){if(b){var h;if(a.splitSpaces)if(h=a.trailingSpace,1<b.length&&!/ /.test(b))h=b;else{for(var k="",l=0;l<b.length;l++){var m=b.charAt(l);" "!=m||!h||l!=b.length-1&&32!=b.charCodeAt(l+1)||(m="\u00a0");
k+=m;h=" "==m}h=k}else h=b;k=h;l=a.cm.state.specialChars;m=!1;if(l.test(b)){h=document.createDocumentFragment();for(var n=0;;){l.lastIndex=n;var p=l.exec(b),t=p?p.index-n:b.length-n;if(t){var q=document.createTextNode(k.slice(n,n+t));B&&9>F?h.appendChild(r("span",[q])):h.appendChild(q);a.map.push(a.pos,a.pos+t,q);a.col+=t;a.pos+=t}if(!p)break;n+=t+1;"\t"==p[0]?(p=a.cm.options.tabSize,p-=a.col%p,t=h.appendChild(r("span",Lc(p),"cm-tab")),t.setAttribute("role","presentation"),t.setAttribute("cm-text",
"\t"),a.col+=p):("\r"==p[0]||"\n"==p[0]?(t=h.appendChild(r("span","\r"==p[0]?"\u240d":"\u2424","cm-invalidchar")),t.setAttribute("cm-text",p[0])):(t=a.cm.options.specialCharPlaceholder(p[0]),t.setAttribute("cm-text",p[0]),B&&9>F?h.appendChild(r("span",[t])):h.appendChild(t)),a.col+=1);a.map.push(a.pos,a.pos+1,t);a.pos++}}else a.col+=b.length,h=document.createTextNode(k),a.map.push(a.pos,a.pos+b.length,h),B&&9>F&&(m=!0),a.pos+=b.length;a.trailingSpace=32==k.charCodeAt(b.length-1);if(c||d||e||m||g)return b=
c||"",d&&(b+=d),e&&(b+=e),d=r("span",[h],b,g),f&&(d.title=f),a.content.appendChild(d);a.content.appendChild(h)}}function ag(a,b){return function(c,d,e,f,g,h,k){e=e?e+" cm-force-border":"cm-force-border";for(var l=c.pos,m=l+d.length;;){for(var n=void 0,p=0;p<b.length&&!(n=b[p],n.to>l&&n.from<=l);p++);if(n.to>=m)return a(c,d,e,f,g,h,k);a(c,d.slice(0,n.to-l),e,f,null,h,k);f=null;d=d.slice(n.to-l);l=n.to}}}function ke(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e);!d&&a.cm.display.input.needsContentAttribute&&
(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function le(a,b,c){for(var d=this.line=b,e;d=Ha(d,!1);)d=d.find(1,!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?C(x(this.rest))-c+1:1;this.node=this.text=null;this.hidden=Ia(a,b)}function ic(a,b,c){var d=[],e;for(e=b;e<c;)b=new le(a.doc,v(a.doc,e),e),e+=b.size,d.push(b);return d}function cg(a,b){if(a=a.ownsGroup)try{var c=
a.delayedCallbacks,d=0;do{for(;d<c.length;d++)c[d].call(null);for(var e=0;e<a.ops.length;e++){var f=a.ops[e];if(f.cursorActivityHandlers)for(;f.cursorActivityCalled<f.cursorActivityHandlers.length;)f.cursorActivityHandlers[f.cursorActivityCalled++].call(null,f.cm)}}while(d<c.length)}finally{Ya=null,b(a)}}function X(a,b){var c=a._handlers&&a._handlers[b]||gc;if(c.length){var d=Array.prototype.slice.call(arguments,2),e;Ya?e=Ya.delayedCallbacks:wb?e=wb:(e=wb=[],setTimeout(dg,0));for(var f=function(a){e.push(function(){return c[a].apply(null,
d)})},g=0;g<c.length;++g)f(g)}}function dg(){var a=wb;wb=null;for(var b=0;b<a.length;++b)a[b]()}function me(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];if("text"==f){var f=b,g=f.text.className,h=ne(a,f);f.text==f.node&&(f.node=h.pre);f.text.parentNode.replaceChild(h.pre,f.text);f.text=h.pre;h.bgClass!=f.bgClass||h.textClass!=f.textClass?(f.bgClass=h.bgClass,f.textClass=h.textClass,gd(f)):g&&(f.text.className=g)}else if("gutter"==f)oe(a,b,c,d);else if("class"==f)gd(b);else if("widget"==
f){f=a;g=b;h=d;g.alignable&&(g.alignable=null);for(var k=g.node.firstChild,l;k;k=l)l=k.nextSibling,"CodeMirror-linewidget"==k.className&&g.node.removeChild(k);pe(f,g,h)}}b.changes=null}function xb(a){a.node==a.text&&(a.node=r("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),B&&8>F&&(a.node.style.zIndex=2));return a.node}function ne(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=
null,b.measure=c.measure,c.built):je(a,b)}function gd(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;b&&(b+=" CodeMirror-linebackground");if(a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=xb(a);a.background=c.insertBefore(r("div",null,b),c.firstChild)}a.line.wrapClass?xb(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");a.text.className=(a.textClass?a.textClass+" "+(a.line.textClass||
""):a.line.textClass)||""}function oe(a,b,c,d){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=xb(b);b.gutterBackground=r("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,"left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px");e.insertBefore(b.gutterBackground,b.text)}e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=
xb(b),g=b.gutter=r("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px");a.display.input.setUneditable(g);f.insertBefore(g,b.text);b.line.gutterClass&&(g.className+=" "+b.line.gutterClass);!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(r("div",Oc(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px")));if(e)for(b=
0;b<a.options.gutters.length;++b)c=a.options.gutters[b],(f=e.hasOwnProperty(c)&&e[c])&&g.appendChild(r("div",[f],"CodeMirror-gutter-elt","left: "+d.gutterLeft[c]+"px; width: "+d.gutterWidth[c]+"px"))}}function eg(a,b,c,d){var e=ne(a,b);b.text=b.node=e.pre;e.bgClass&&(b.bgClass=e.bgClass);e.textClass&&(b.textClass=e.textClass);gd(b);oe(a,b,c,d);pe(a,b,d);return b.node}function pe(a,b,c){qe(a,b.line,b,c,!0);if(b.rest)for(var d=0;d<b.rest.length;d++)qe(a,b.rest[d],b,c,!1)}function qe(a,b,c,d,e){if(b.widgets){var f=
xb(c),g=0;for(b=b.widgets;g<b.length;++g){var h=b[g],k=r("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||k.setAttribute("cm-ignore-events","true");var l=h,m=k,n=d;if(l.noHScroll){(c.alignable||(c.alignable=[])).push(m);var p=n.wrapperWidth;m.style.left=n.fixedPos+"px";l.coverGutter||(p-=n.gutterTotalWidth,m.style.paddingLeft=n.gutterTotalWidth+"px");m.style.width=p+"px"}l.coverGutter&&(m.style.zIndex=5,m.style.position="relative",l.noHScroll||(m.style.marginLeft=-n.gutterTotalWidth+"px"));
a.display.input.setUneditable(k);e&&h.above?f.insertBefore(k,c.gutter||c.text):f.appendChild(k);X(h,"redraw")}}}function yb(a){if(null!=a.height)return a.height;var b=a.doc.cm;if(!b)return 0;if(!V(document.body,a.node)){var c="position: relative;";a.coverGutter&&(c+="margin-left: -"+b.display.gutters.offsetWidth+"px;");a.noHScroll&&(c+="width: "+b.display.wrapper.clientWidth+"px;");D(b.display.measure,r("div",[a.node],null,c))}return a.height=a.node.parentNode.offsetHeight}function sa(a,b){for(b=
b.target||b.srcElement;b!=a.wrapper;b=b.parentNode)if(!b||1==b.nodeType&&"true"==b.getAttribute("cm-ignore-events")||b.parentNode==a.sizer&&b!=a.mover)return!0}function hd(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function re(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=D(a.measure,r("pre","x")),b=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,b={left:parseInt(b.paddingLeft),right:parseInt(b.paddingRight)};isNaN(b.left)||isNaN(b.right)||(a.cachedPaddingH=b);
return b}function oa(a){return 30-a.display.nativeBarWidth}function Ka(a){return a.display.scroller.clientWidth-oa(a)-a.display.barWidth}function id(a){return a.display.scroller.clientHeight-oa(a)-a.display.barHeight}function se(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(b=0;b<a.rest.length;b++)if(C(a.rest[b])>c)return{map:a.measure.maps[b],cache:a.measure.caches[b],
before:!0}}function jd(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[La(a,b)];if((a=a.display.externalMeasured)&&b>=a.lineN&&b<a.lineN+a.size)return a}function jc(a,b){var c=C(b),d=jd(a,c);d&&!d.text?d=null:d&&d.changes&&(me(a,d,c,kd(a)),a.curOp.forceUpdate=!0);if(!d){var e;e=ka(b);d=C(e);e=a.display.externalMeasured=new le(a.doc,e,d);e.lineN=d;d=e.built=je(a,e);e.text=d.pre;D(a.display.lineMeasure,d.pre);d=e}a=se(d,b,c);return{line:b,view:d,rect:null,map:a.map,cache:a.cache,
before:a.before,hasHeights:!1}}function kc(a,b,c,d,e){b.before&&(c=-1);var f=c+(d||"");if(b.cache.hasOwnProperty(f))a=b.cache[f];else{b.rect||(b.rect=b.view.text.getBoundingClientRect());if(!b.hasHeights){var g=b.view,h=b.rect,k=a.options.lineWrapping,l=k&&Ka(a);if(!g.measure.heights||k&&g.measure.width!=l){var m=g.measure.heights=[];if(k)for(g.measure.width=l,g=g.text.firstChild.getClientRects(),k=0;k<g.length-1;k++){var l=g[k],n=g[k+1];2<Math.abs(l.bottom-n.bottom)&&m.push((l.bottom+n.top)/2-h.top)}m.push(h.bottom-
h.top)}b.hasHeights=!0}m=d;g=te(b.map,c,m);d=g.node;h=g.start;k=g.end;c=g.collapse;var p;if(3==d.nodeType){for(var t=0;4>t;t++){for(;h&&ob(b.line.text.charAt(g.coverStart+h));)--h;for(;g.coverStart+k<g.coverEnd&&ob(b.line.text.charAt(g.coverStart+k));)++k;if(B&&9>F&&0==h&&k==g.coverEnd-g.coverStart)p=d.parentNode.getBoundingClientRect();else{p=Xa(d,h,k).getClientRects();k=ue;if("left"==m)for(l=0;l<p.length&&(k=p[l]).left==k.right;l++);else for(l=p.length-1;0<=l&&(k=p[l]).left==k.right;l--);p=k}if(p.left||
p.right||0==h)break;k=h;--h;c="right"}B&&11>F&&((t=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=ld?t=ld:(m=D(a.display.measure,r("span","x")),t=m.getBoundingClientRect(),m=Xa(m,0,1).getBoundingClientRect(),t=ld=1<Math.abs(t.left-m.left)),t=!t),t||(t=screen.logicalXDPI/screen.deviceXDPI,m=screen.logicalYDPI/screen.deviceYDPI,p={left:p.left*t,right:p.right*t,top:p.top*m,bottom:p.bottom*m}))}else 0<h&&(c=m="right"),p=a.options.lineWrapping&&1<(t=d.getClientRects()).length?
t["right"==m?t.length-1:0]:d.getBoundingClientRect();!(B&&9>F)||h||p&&(p.left||p.right)||(p=(p=d.parentNode.getClientRects()[0])?{left:p.left,right:p.left+zb(a.display),top:p.top,bottom:p.bottom}:ue);d=p.top-b.rect.top;h=p.bottom-b.rect.top;t=(d+h)/2;m=b.view.measure.heights;for(g=0;g<m.length-1&&!(t<m[g]);g++);c={left:("right"==c?p.right:p.left)-b.rect.left,right:("left"==c?p.left:p.right)-b.rect.left,top:g?m[g-1]:0,bottom:m[g]};p.left||p.right||(c.bogus=!0);a.options.singleCursorHeightPerLine||
(c.rtop=d,c.rbottom=h);a=c;a.bogus||(b.cache[f]=a)}return{left:a.left,right:a.right,top:e?a.rtop:a.top,bottom:e?a.rbottom:a.bottom}}function te(a,b,c){for(var d,e,f,g,h,k,l=0;l<a.length;l+=3){h=a[l];k=a[l+1];if(b<h)e=0,f=1,g="left";else if(b<k)e=b-h,f=e+1;else if(l==a.length-3||b==k&&a[l+3]>b)f=k-h,e=f-1,b>=k&&(g="right");if(null!=e){d=a[l+2];h==k&&c==(d.insertLeft?"left":"right")&&(g=c);if("left"==c&&0==e)for(;l&&a[l-2]==a[l-3]&&a[l-1].insertLeft;)d=a[(l-=3)+2],g="left";if("right"==c&&e==k-h)for(;l<
a.length-3&&a[l+3]==a[l+4]&&!a[l+5].insertLeft;)d=a[(l+=3)+2],g="right";break}}return{node:d,start:e,end:f,collapse:g,coverStart:h,coverEnd:k}}function ve(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function we(a){a.display.externalMeasure=null;H(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)ve(a.display.view[b])}function Ab(a){we(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=
null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function md(a,b,c,d,e){if(!e&&b.widgets)for(e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=yb(b.widgets[e]);c.top+=f;c.bottom+=f}if("line"==d)return c;d||(d="local");b=la(b);b="local"==d?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;if("page"==d||"window"==d)a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+("window"==d?0:window.pageYOffset||(document.documentElement||document.body).scrollTop),
d=a.left+("window"==d?0:window.pageXOffset||(document.documentElement||document.body).scrollLeft),c.left+=d,c.right+=d;c.top+=b;c.bottom+=b;return c}function xe(a,b,c){if("div"==c)return b;var d=b.left;b=b.top;"page"==c?(d-=window.pageXOffset||(document.documentElement||document.body).scrollLeft,b-=window.pageYOffset||(document.documentElement||document.body).scrollTop):"local"!=c&&c||(c=a.display.sizer.getBoundingClientRect(),d+=c.left,b+=c.top);a=a.display.lineSpace.getBoundingClientRect();return{left:d-
a.left,top:b-a.top}}function lc(a,b,c,d,e){d||(d=v(a.doc,b.line));var f=d;b=b.ch;d=kc(a,jc(a,d),b,e);return md(a,f,d,c)}function ta(a,b,c,d,e,f){function g(b,g){b=kc(a,e,b,g?"right":"left",f);g?b.left=b.right:b.right=b.left;return md(a,d,b,c)}function h(a,b){var d=k[b],c=d.level%2;a==Uc(d)&&b&&d.level<k[b-1].level?(d=k[--b],a=Vc(d)-(d.level%2?0:1),c=!0):a==Vc(d)&&b<k.length-1&&d.level<k[b+1].level&&(d=k[++b],a=Uc(d)-d.level%2,c=!1);return c&&a==d.to&&a>d.from?g(a-1):g(a,c)}d=d||v(a.doc,b.line);e||
(e=jc(a,d));var k=ea(d);b=b.ch;if(!k)return g(b);var l=fc(k,b),l=h(b,l);null!=sb&&(l.other=h(b,sb));return l}function ye(a,b){var c=0;b=z(a.doc,b);a.options.lineWrapping||(c=zb(a.display)*b.ch);b=v(a.doc,b.line);a=la(b)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:a,bottom:a+b.height}}function mc(a,b,c,d){a=q(a,b);a.xRel=d;c&&(a.outside=!0);return a}function nd(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(0>c)return mc(d.first,0,!0,-1);var e=Ga(d,c),f=d.first+d.size-1;if(e>f)return mc(d.first+
d.size-1,v(d,f).text.length,!0,1);0>b&&(b=0);for(d=v(d,e);;)if(e=fg(a,d,e,b,c),f=(d=Ha(d,!1))&&d.find(0,!0),d&&(e.ch>f.from.ch||e.ch==f.from.ch&&0<e.xRel))e=C(d=f.to.line);else return e}function fg(a,b,c,d,e){function f(d){d=ta(a,q(c,d),"line",b,l);h=!0;if(g>d.bottom)return d.left-k;if(g<d.top)return d.left+k;h=!1;return d.left}var g=e-la(b),h=!1,k=2*a.display.wrapper.clientWidth,l=jc(a,b);e=ea(b);var m=b.text.length,n=dc(b),p=ec(b),t=f(n),ma=h,u=f(p),r=h;if(d>u)return mc(c,p,r,1);for(;;){if(e?p==
n||p==Xc(b,n,1):1>=p-n){m=d<t||d-t<=u-d?n:p;ma=m==n?ma:r;n=d-(m==n?t:u);r&&!e&&!/\s/.test(b.text.charAt(m))&&0<n&&m<b.text.length&&1<l.view.measure.heights.length&&(e=kc(a,l,m,"right"),g<=e.bottom&&g>=e.top&&Math.abs(d-e.right)<n&&(ma=!1,m++,n=d-e.right));for(;ob(b.text.charAt(m));)++m;return mc(c,m,ma,-1>n?-1:1<n?1:0)}var v=Math.ceil(m/2),w=n+v;if(e)for(var w=n,x=0;x<v;++x)w=Xc(b,w,1);x=f(w);if(x>d){p=w;u=x;if(r=h)u+=1E3;m=v}else n=w,t=x,ma=h,m-=v}}function Ma(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;
if(null==Na){Na=r("pre");for(var b=0;49>b;++b)Na.appendChild(document.createTextNode("x")),Na.appendChild(r("br"));Na.appendChild(document.createTextNode("x"))}D(a.measure,Na);b=Na.offsetHeight/50;3<b&&(a.cachedTextHeight=b);H(a.measure);return b||1}function zb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=r("span","xxxxxxxxxx"),c=r("pre",[b]);D(a.measure,c);b=b.getBoundingClientRect();b=(b.right-b.left)/10;2<b&&(a.cachedCharWidth=b);return b||10}function kd(a){for(var b=a.display,
c={},d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g)c[a.options.gutters[g]]=f.offsetLeft+f.clientLeft+e,d[a.options.gutters[g]]=f.clientWidth;return{fixedPos:od(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function od(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function ze(a){var b=Ma(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/
zb(a.display)-3);return function(e){if(Ia(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function pd(a){var b=a.doc,c=ze(a);b.iter(function(a){var b=c(a);b!=a.height&&ja(a,b)})}function Oa(a,b,c,d){var e=a.display;if(!c&&"true"==(b.target||b.srcElement).getAttribute("cm-not-content"))return null;var f,g;c=e.lineSpace.getBoundingClientRect();try{f=b.clientX-c.left,g=b.clientY-
c.top}catch(k){return null}b=nd(a,f,g);var h;d&&1==b.xRel&&(h=v(a.doc,b.line).text).length==b.ch&&(d=ca(h,h.length,a.options.tabSize)-h.length,b=q(b.line,Math.max(0,Math.round((f-re(a.display).left)/zb(a.display))-d)));return b}function La(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var c=0;c<a.length;c++)if(b-=a[c].size,0>b)return c}function Bb(a){a.display.input.showSelection(a.display.input.prepareSelection())}function Ae(a,b){for(var c=
a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g<c.sel.ranges.length;g++)if(!1!==b||g!=c.sel.primIndex){var h=c.sel.ranges[g];if(!(h.from().line>=a.display.viewTo||h.to().line<a.display.viewFrom)){var k=h.empty();(k||a.options.showCursorWhenSelecting)&&Be(a,h.head,e);k||gg(a,h,f)}}return d}function Be(a,b,c){b=ta(a,b,"div",null,null,!a.options.singleCursorHeightPerLine);var d=c.appendChild(r("div","\u00a0","CodeMirror-cursor"));d.style.left=
b.left+"px";d.style.top=b.top+"px";d.style.height=Math.max(0,b.bottom-b.top)*a.options.cursorHeight+"px";b.other&&(a=c.appendChild(r("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor")),a.style.display="",a.style.left=b.other.left+"px",a.style.top=b.other.top+"px",a.style.height=.85*(b.other.bottom-b.other.top)+"px")}function gg(a,b,c){function d(a,b,d,c){0>b&&(b=0);b=Math.round(b);c=Math.round(c);h.appendChild(r("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px;\n top: "+
b+"px; width: "+(null==d?m-a:d)+"px;\n height: "+(c-b)+"px"))}function e(b,c,e){var f=v(g,b),h=f.text.length,k,n;Sf(ea(f),c||0,null==e?h:e,function(g,p,t){var u=lc(a,q(b,g),"div",f,"left"),r,ma;g==p?(r=u,t=ma=u.left):(r=lc(a,q(b,p-1),"div",f,"right"),"rtl"==t&&(t=u,u=r,r=t),t=u.left,ma=r.right);null==c&&0==g&&(t=l);3<r.top-u.top&&(d(t,u.top,null,u.bottom),t=l,u.bottom<r.top&&d(t,u.bottom,null,r.top));null==e&&p==h&&(ma=m);if(!k||u.top<k.top||u.top==k.top&&u.left<k.left)k=
u;if(!n||r.bottom>n.bottom||r.bottom==n.bottom&&r.right>n.right)n=r;t<l+1&&(t=l);d(t,r.top,ma-t,r.bottom)});return{start:k,end:n}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),k=re(a.display),l=k.left,m=Math.max(f.sizerWidth,Ka(a)-f.sizer.offsetLeft)-k.right,f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var n=v(g,f.line),k=v(g,b.line),k=ka(n)==ka(k),f=e(f.line,f.ch,k?n.text.length+1:null).end;b=e(b.line,k?0:null,b.ch).start;k&&(f.top<b.top-2?(d(f.right,f.top,null,f.bottom),
d(l,b.top,b.left,b.bottom)):d(f.right,f.top,b.left-f.right,f.bottom));f.bottom<b.top&&d(l,f.bottom,null,b.top)}c.appendChild(h)}function qd(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="";0<a.options.cursorBlinkRate?b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function Ce(a){a.state.focused||(a.display.input.focus(),
rd(a))}function hg(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Cb(a))},100)}function rd(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(I(a,"focus",a,b),a.state.focused=!0,Sa(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),N&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),
qd(a))}function Cb(a,b){a.state.delayingBlurEvent||(a.state.focused&&(I(a,"blur",a,b),a.state.focused=!1,Za(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function sd(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=od(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&(c[g].gutter&&
(c[g].gutter.style.left=f),c[g].gutterBackground&&(c[g].gutterBackground.style.left=f));var h=c[g].alignable;if(h)for(var k=0;k<h.length;k++)h[k].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function De(a){if(!a.options.lineNumbers)return!1;var b=a.doc,b=Oc(a.options,b.first+b.size-1),c=a.display;if(b.length!=c.lineNumChars){var d=c.measure.appendChild(r("div",[r("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=d.firstChild.offsetWidth,d=d.offsetWidth-e;c.lineGutter.style.width=
"";c.lineNumInnerWidth=Math.max(e,c.lineGutter.offsetWidth-d)+1;c.lineNumWidth=c.lineNumInnerWidth+d;c.lineNumChars=c.lineNumInnerWidth?b.length:-1;c.lineGutter.style.width=c.lineNumWidth+"px";td(a);return!0}return!1}function nc(a){a=a.display;for(var b=a.lineDiv.offsetTop,c=0;c<a.view.length;c++){var d=a.view[c],e;if(!d.hidden){if(B&&8>F){var f=d.node.offsetTop+d.node.offsetHeight;e=f-b;b=f}else e=d.node.getBoundingClientRect(),e=e.bottom-e.top;f=d.line.height-e;2>e&&(e=Ma(a));if(.001<f||-.001>f)if(ja(d.line,
e),Ee(d.line),d.rest)for(e=0;e<d.rest.length;e++)Ee(d.rest[e])}}}function Ee(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.parentNode.offsetHeight}function ud(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop,d=Math.floor(d-a.lineSpace.offsetTop),e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,d=Ga(b,d),e=Ga(b,e);if(c&&c.ensure){var f=c.ensure.from.line;c=c.ensure.to.line;f<d?(d=f,e=Ga(b,la(v(b,f))+a.wrapper.clientHeight)):Math.min(c,
b.lastLine())>=e&&(d=Ga(b,la(v(b,c))-a.wrapper.clientHeight),e=c)}return{from:d,to:Math.max(e,d+1)}}function Db(a,b){2>Math.abs(a.doc.scrollTop-b)||(a.doc.scrollTop=b,wa||vd(a,{top:b}),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbars.setScrollTop(b),wa&&vd(a),Eb(a,100))}function $a(a,b,c){(c?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,sd(a),a.display.scroller.scrollLeft!=
b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function Fe(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail);null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta);return{x:b,y:c}}function ig(a){a=Fe(a);a.x*=Z;a.y*=Z;return a}function Ge(a,b){var c=Fe(b),d=c.x,c=c.y,e=a.display,f=e.scroller,g=f.scrollWidth>f.clientWidth,h=f.scrollHeight>f.clientHeight;if(d&&g||c&&h){if(c&&ga&&N){var g=b.target,k=
e.view;a:for(;g!=f;g=g.parentNode)for(var l=0;l<k.length;l++)if(k[l].node==g){a.display.currentWheelTarget=g;break a}}!d||wa||ha||null==Z?(c&&null!=Z&&(b=c*Z,h=a.doc.scrollTop,g=h+e.wrapper.clientHeight,0>b?h=Math.max(0,h+b-50):g=Math.min(a.doc.height,g+b+50),vd(a,{top:h,bottom:g})),20>oc&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=d,e.wheelDY=c,setTimeout(function(){if(null!=e.wheelStartX){var a=f.scrollLeft-e.wheelStartX,b=f.scrollTop-e.wheelStartY,a=b&&
e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null;a&&(Z=(Z*oc+a)/(oc+1),++oc)}},200)):(e.wheelDX+=d,e.wheelDY+=c))):(c&&h&&Db(a,Math.max(0,Math.min(f.scrollTop+c*Z,f.scrollHeight-f.clientHeight))),$a(a,Math.max(0,Math.min(f.scrollLeft+d*Z,f.scrollWidth-f.clientWidth))),(!c||c&&h)&&Q(b),e.wheelStartX=null)}}function Fb(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+hd(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,
scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+oa(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function ab(a,b){b||(b=Fb(a));var c=a.display.barWidth,d=a.display.barHeight;He(a,b);for(b=0;4>b&&c!=a.display.barWidth||d!=a.display.barHeight;b++)c!=a.display.barWidth&&a.options.lineWrapping&&nc(a),He(a,Fb(a)),c=a.display.barWidth,d=a.display.barHeight}function He(a,b){var c=
a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px";c.heightForcer.style.borderBottom=d.bottom+"px solid transparent";d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="";d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",
c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function Ie(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&Za(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new Je[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);w(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});
b.setAttribute("cm-not-content","true")},function(b,c){"horizontal"==c?$a(a,b):Db(a,b)},a);a.display.scrollbars.addClass&&Sa(a.display.wrapper,a.display.scrollbars.addClass)}function pc(a,b,c,d,e){var f=a.display,g=Ma(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,k=id(a),l={};e-c>k&&(e=c+k);var m=a.doc.height+hd(f),n=c<g,g=e>m-g;c<h?l.scrollTop=n?0:c:e>h+k&&(c=Math.min(c,(g?m:e)-k),c!=h&&(l.scrollTop=c));h=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:
f.scroller.scrollLeft;a=Ka(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0);(f=d-b>a)&&(d=b+a);10>b?l.scrollLeft=0:b<h?l.scrollLeft=Math.max(0,b-(f?0:10)):d>a+h-3&&(l.scrollLeft=d+(f?0:10)-a);return l}function qc(a,b,c){null==b&&null==c||rc(a);null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b);null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function bb(a){rc(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||
(c=b.ch?q(b.line,b.ch-1):b,d=q(b.line,b.ch+1));a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function rc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=ye(a,b.from),d=ye(a,b.to),b=pc(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(b.scrollLeft,b.scrollTop)}}function cb(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,
changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++jg};a=a.curOp;Ya?Ya.ops.push(a):a.ownsGroup=Ya={ops:[a],delayedCallbacks:[]}}function db(a){cg(a.curOp,function(a){for(var b=0;b<a.ops.length;b++)a.ops[b].cm.curOp=null;a=a.ops;for(b=0;b<a.length;b++){var d=a[b],e=d.cm,f=e.display,g=e.display;!g.scrollbarsClipped&&g.scroller.offsetWidth&&(g.nativeBarWidth=g.scroller.offsetWidth-g.scroller.clientWidth,
g.heightForcer.style.height=oa(e)+"px",g.sizer.style.marginBottom=-g.nativeBarWidth+"px",g.sizer.style.borderRightWidth=oa(e)+"px",g.scrollbarsClipped=!0);d.updateMaxLine&&Tc(e);d.mustUpdate=d.viewChanged||d.forceUpdate||null!=d.scrollTop||d.scrollToPos&&(d.scrollToPos.from.line<f.viewFrom||d.scrollToPos.to.line>=f.viewTo)||f.maxLineChanged&&e.options.lineWrapping;d.update=d.mustUpdate&&new sc(e,d.mustUpdate&&{top:d.scrollTop,ensure:d.scrollToPos},d.forceUpdate)}for(b=0;b<a.length;b++)d=a[b],d.updatedDisplay=
d.mustUpdate&&wd(d.cm,d.update);for(b=0;b<a.length;b++)if(d=a[b],e=d.cm,f=e.display,d.updatedDisplay&&nc(e),d.barMeasure=Fb(e),f.maxLineChanged&&!e.options.lineWrapping&&(g=f.maxLine.text.length,g=kc(e,jc(e,f.maxLine),g,void 0),d.adjustWidthTo=g.left+3,e.display.sizerWidth=d.adjustWidthTo,d.barMeasure.scrollWidth=Math.max(f.scroller.clientWidth,f.sizer.offsetLeft+d.adjustWidthTo+oa(e)+e.display.barWidth),d.maxScrollLeft=Math.max(0,f.sizer.offsetLeft+d.adjustWidthTo-Ka(e))),d.updatedDisplay||d.selectionChanged)d.preparedSelection=
f.input.prepareSelection(d.focus);for(b=0;b<a.length;b++)d=a[b],e=d.cm,null!=d.adjustWidthTo&&(e.display.sizer.style.minWidth=d.adjustWidthTo+"px",d.maxScrollLeft<e.doc.scrollLeft&&$a(e,Math.min(e.display.scroller.scrollLeft,d.maxScrollLeft),!0),e.display.maxLineChanged=!1),f=d.focus&&d.focus==ba()&&(!document.hasFocus||document.hasFocus()),d.preparedSelection&&e.display.input.showSelection(d.preparedSelection,f),(d.updatedDisplay||d.startHeight!=e.doc.height)&&ab(e,d.barMeasure),d.updatedDisplay&&
xd(e,d.barMeasure),d.selectionChanged&&qd(e),e.state.focused&&d.updateInput&&e.display.input.reset(d.typing),f&&Ce(d.cm);for(b=0;b<a.length;b++){var h=void 0,k,d=a[b],e=d.cm,f=e.display,g=e.doc;d.updatedDisplay&&Ke(e,d.update);null==f.wheelStartX||null==d.scrollTop&&null==d.scrollLeft&&!d.scrollToPos||(f.wheelStartX=f.wheelStartY=null);null==d.scrollTop||f.scroller.scrollTop==d.scrollTop&&!d.forceScroll||(g.scrollTop=Math.max(0,Math.min(f.scroller.scrollHeight-f.scroller.clientHeight,d.scrollTop)),
f.scrollbars.setScrollTop(g.scrollTop),f.scroller.scrollTop=g.scrollTop);null==d.scrollLeft||f.scroller.scrollLeft==d.scrollLeft&&!d.forceScroll||(g.scrollLeft=Math.max(0,Math.min(f.scroller.scrollWidth-f.scroller.clientWidth,d.scrollLeft)),f.scrollbars.setScrollLeft(g.scrollLeft),f.scroller.scrollLeft=g.scrollLeft,sd(e));if(d.scrollToPos){k=x(g,d.scrollToPos.from);var l=x(g,d.scrollToPos.to),m=d.scrollToPos.margin;null==m&&(m=0);for(var n=0;5>n;n++){var p=!1,h=ra(e,k),r=l&&l!=k?ra(e,l):h,r=pc(e,
Math.min(h.left,r.left),Math.min(h.top,r.top)-m,Math.max(h.left,r.left),Math.max(h.bottom,r.bottom)+m),q=e.doc.scrollTop,t=e.doc.scrollLeft;null!=r.scrollTop&&(Cb(e,r.scrollTop),1<Math.abs(e.doc.scrollTop-q)&&(p=!0));null!=r.scrollLeft&&(Za(e,r.scrollLeft),1<Math.abs(e.doc.scrollLeft-t)&&(p=!0));if(!p)break}k=h;d.scrollToPos.isCursor&&e.state.focused&&(H(e,"scrollCursorIntoView")||(l=e.display,m=l.sizer.getBoundingClientRect(),h=null,0>k.top+m.top?h=!0:k.bottom+m.top>(window.innerHeight||document.documentElement.clientHeight)&&
(h=!1),null==h||kg||(k=v("div","\u200b",null,"position: absolute;\n top: "+(k.top-l.viewOffset-e.display.lineSpace.offsetTop)+"px;\n height: "+(k.bottom-k.top+la(e)+l.barHeight)+"px;\n left: "+k.left+"px; width: 2px;"),e.display.lineSpace.appendChild(k),k.scrollIntoView(h),e.display.lineSpace.removeChild(k))))}k=d.maybeHiddenMarkers;h=d.maybeUnhiddenMarkers;if(k)for(l=0;l<k.length;++l)k[l].lines.length||F(k[l],"hide");if(h)for(k=
0;k<h.length;++k)h[k].lines.length&&F(h[k],"unhide");f.wrapper.offsetHeight&&(g.scrollTop=e.display.scroller.scrollTop);d.changeObjs&&F(e,"changes",e,d.changeObjs);d.update&&d.update.finish()}})}function X(a,b){if(a.curOp)return b();bb(a);try{return b()}finally{cb(a)}}function I(a,b){return function(){if(a.curOp)return b.apply(a,arguments);bb(a);try{return b.apply(a,arguments)}finally{cb(a)}}}function P(a){return function(){if(this.curOp)return a.apply(this,arguments);bb(this);try{return a.apply(this,
arguments)}finally{cb(this)}}}function L(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);bb(b);try{return a.apply(this,arguments)}finally{cb(b)}}}function O(a,b,c,d){null==b&&(b=a.doc.first);null==c&&(c=a.doc.first+a.doc.size);d||(d=0);var e=a.display;d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)va&&Rc(a.doc,b)<e.viewTo&&wa(a);else if(c<=e.viewFrom)va&&Xd(a.doc,c+d)>e.viewFrom?wa(a):
(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)wa(a);else if(b<=e.viewFrom){var f=tc(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):wa(a)}else if(c>=e.viewTo)(f=tc(a,b,b,-1))?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):wa(a);else{var f=tc(a,b,b,-1),g=tc(a,c,c+d,1);f&&g?(e.view=e.view.slice(0,f.index).concat(ic(a,f.lineN,g.lineN)).concat(e.view.slice(g.index)),e.viewTo+=d):wa(a)}if(a=e.externalMeasured)c<a.lineN?a.lineN+=d:b<a.lineN+a.size&&(e.externalMeasured=
null)}function xa(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null);b<d.viewFrom||b>=d.viewTo||(a=d.view[Ka(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==J(a,c)&&a.push(c)))}function wa(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function tc(a,b,c,d){var e=Ka(a,b),f=a.display.view;if(!va||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var g=a.display.viewFrom,
h=0;h<e;h++)g+=f[h].size;if(g!=b){if(0<d){if(e==f.length-1)return null;b=g+f[e].size-b;e++}else b=g-b;c+=b}for(;Rc(a.doc,c)!=c;){if(e==(0>d?0:f.length-1))return null;c+=d*f[e-(0>d?1:0)].size;e+=d}return{index:e,lineN:c}}function Le(a){a=a.display.view;for(var b=0,c=0;c<a.length;c++){var d=a[c];d.hidden||d.node&&!d.changes||++b}return b}function Db(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,Jc(lg,a))}function lg(a){var b=a.doc;b.frontier<b.first&&(b.frontier=
b.first);if(!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=oa(b.mode,tb(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(b.frontier>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength,k=ce(a,f,h?oa(b.mode,d):d,!0);f.styles=k.styles;var l=f.styleClasses;(k=k.classes)?f.styleClasses=k:l&&(f.styleClasses=null);l=!g||g.length!=f.styles.length||l!=k&&(!l||!k||l.bgClass!=k.bgClass||l.textClass!=k.textClass);
for(k=0;!l&&k<g.length;++k)l=g[k]!=f.styles[k];l&&e.push(b.frontier);f.stateAfter=h?d:oa(b.mode,d)}else f.text.length<=a.options.maxHighlightLength&&cd(a,f.text,d),f.stateAfter=0==b.frontier%5?oa(b.mode,d):null;++b.frontier;if(+new Date>c)return Db(a,a.options.workDelay),!0});e.length&&X(a,function(){for(var b=0;b<e.length;b++)xa(a,e[b],"text")})}}function wd(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden)return wa(a),!1;if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||
c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&0==Le(a))return!1;De(a)&&(wa(a),b.dims=kd(a));var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFrom<f&&20>f-c.viewFrom&&(f=Math.max(d.first,c.viewFrom));c.viewTo>g&&20>c.viewTo-g&&(g=Math.min(e,c.viewTo));va&&(f=Rc(a.doc,f),g=Xd(a.doc,g));d=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;e=a.display;0==e.view.length||
f>=e.viewTo||g<=e.viewFrom?(e.view=ic(a,f,g),e.viewFrom=f):(e.viewFrom>f?e.view=ic(a,f,e.viewFrom).concat(e.view):e.viewFrom<f&&(e.view=e.view.slice(Ka(a,f))),e.viewFrom=f,e.viewTo<g?e.view=e.view.concat(ic(a,e.viewTo,g)):e.viewTo>g&&(e.view=e.view.slice(0,Ka(a,g))));e.viewTo=g;c.viewOffset=ia(u(a.doc,c.viewFrom));a.display.mover.style.top=c.viewOffset+"px";g=Le(a);if(!d&&0==g&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;f=na();4<g&&(c.lineDiv.style.display=
"none");mg(a,c.updateLineNumbers,b.dims);4<g&&(c.lineDiv.style.display="");c.renderedView=c.view;f&&na()!=f&&f.offsetHeight&&f.focus();Y(c.cursorDiv);Y(c.selectionDiv);c.gutters.style.height=c.sizer.style.minHeight=0;d&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth,Db(a,400));c.updateLineNumbers=null;return!0}function Ke(a,b){for(var c=b.viewport,d=!0;;d=!1){if(!d||!a.options.lineWrapping||b.oldDisplayWidth==Ja(a))if(c&&null!=c.top&&(c={top:Math.min(a.doc.height+hd(a.display)-id(a),
c.top)}),b.visible=ud(a.display,a.doc,c),b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!wd(a,b))break;nc(a);d=Eb(a);Ab(a);$a(a,d);xd(a,d)}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){var c=new sc(a,b);if(wd(a,c)){nc(a);Ke(a,c);
var d=Eb(a);Ab(a);$a(a,d);xd(a,d);c.finish()}}function mg(a,b,c){function d(b){var d=b.nextSibling;K&&da&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return d}for(var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,k=e.view,e=e.viewFrom,l=0;l<k.length;l++){var m=k[l];if(!m.hidden)if(m.node&&m.node.parentNode==g){for(;h!=m.node;)h=d(h);h=f&&null!=b&&b<=e&&m.lineNumber;m.changes&&(-1<J(m.changes,"gutter")&&(h=!1),me(a,m,e,c));h&&(Y(m.lineNumber),
m.lineNumber.appendChild(document.createTextNode(Oc(a.options,e))));h=m.node.nextSibling}else{var n=eg(a,m,e,c);g.insertBefore(n,h)}e+=m.size}for(;h;)h=d(h)}function td(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function xd(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";a.display.heightForcer.style.top=b.docHeight+"px";a.display.gutters.style.height=b.docHeight+a.display.barHeight+la(a)+"px"}function Me(a){var b=a.display.gutters,c=a.options.gutters;Y(b);for(var d=
0;d<c.length;++d){var e=c[d],f=b.appendChild(v("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none";td(a)}function yd(a){var b=J(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1<b&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function sa(a,b){this.ranges=a;this.primIndex=b}function z(a,b){this.anchor=
a;this.head=b}function fa(a,b){var c=a[b];a.sort(function(a,b){return t(a.from(),b.from())});b=J(a,c);for(c=1;c<a.length;c++){var d=a[c],e=a[c-1];if(0<=t(e.to(),d.from())){var f=ac(e.from(),d.from()),g=$b(e.to(),d.to()),d=e.empty()?d.from()==d.head:e.from()==e.head;c<=b&&--b;a.splice(--c,2,new z(d?g:f,d?f:g))}}return new sa(a,b)}function ta(a,b){return new sa([new z(a,b||a)],0)}function ya(a){return a.text?q(a.from.line+a.text.length-1,y(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Ne(a,
b){if(0>t(a,b.from))return a;if(0>=t(a,b.to))return ya(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&&(d+=ya(b).ch-b.to.ch);return q(c,d)}function zd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new z(Ne(e.anchor,b),Ne(e.head,b)))}return fa(c,a.sel.primIndex)}function Oe(a,b,c){return a.line==b.line?q(c.line,a.ch-b.ch+c.ch):q(c.line+(a.line-b.line),a.ch)}function Ad(a){a.doc.mode=ad(a.options,a.doc.modeOption);Fb(a)}function Fb(a){a.doc.iter(function(a){a.stateAfter&&
(a.stateAfter=null);a.styles&&(a.styles=null)});a.doc.frontier=a.doc.first;Db(a,100);a.state.modeGen++;a.curOp&&O(a)}function Pe(a,b){return 0==b.from.ch&&0==b.to.ch&&""==y(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Bd(a,b,c,d){function e(a,c,e){a.text=c;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null);null!=a.order&&(a.order=null);Td(a);Ud(a,e);c=d?d(a):1;c!=a.height&&ga(a,c);T(a,"change",a,b)}function f(a,b){for(var e=[],f=a;f<b;++f)e.push(new Va(k[f],c?c[f]:null,d));
return e}var g=b.from,h=b.to,k=b.text,l=u(a,g.line),m=u(a,h.line),n=y(k),p=c?c[k.length-1]:null,r=h.line-g.line;b.full?(a.insert(0,f(0,k.length)),a.remove(k.length,a.size-k.length)):Pe(a,b)?(h=f(0,k.length-1),e(m,m.text,p),r&&a.remove(g.line,r),h.length&&a.insert(g.line,h)):l==m?1==k.length?e(l,l.text.slice(0,g.ch)+n+l.text.slice(h.ch),p):(r=f(1,k.length-1),r.push(new Va(n+l.text.slice(h.ch),p,d)),e(l,l.text.slice(0,g.ch)+k[0],c?c[0]:null),a.insert(g.line+1,r)):1==k.length?(e(l,l.text.slice(0,g.ch)+
k[0]+m.text.slice(h.ch),c?c[0]:null),a.remove(g.line+1,r)):(e(l,l.text.slice(0,g.ch)+k[0],c?c[0]:null),e(m,n+m.text.slice(h.ch),p),p=f(1,k.length-1),1<r&&a.remove(g.line+1,r-1),a.insert(g.line+1,p));T(a,"change",a,b)}function Oa(a,b,c){function d(a,f,g){if(a.linked)for(var e=0;e<a.linked.length;++e){var k=a.linked[e];if(k.doc!=f){var l=g&&k.sharedHist;if(!c||l)b(k.doc,l),d(k.doc,a,l)}}}d(a,null,!0)}function Qe(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;pd(a);Ad(a);
a.options.lineWrapping||Tc(a);a.options.mode=b.modeOption;O(a)}function uc(a){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=this.lastSelOp=null;this.generation=this.maxGeneration=a||1}function Cd(a,b){var c={from:Pc(b.from),to:ya(b),text:Ea(a,b.from,b.to)};Re(a,c,b.from.line,b.to.line+1);Oa(a,function(a){return Re(a,c,b.from.line,b.to.line+1)},!0);return c}function Se(a){for(;a.length;)if(y(a).ranges)a.pop();
else break}function Te(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,g,h,k;if(k=e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))e.lastOp==d?(Se(e.done),g=y(e.done)):e.done.length&&!y(e.done).ranges?g=y(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),g=y(e.done)):g=void 0,k=g;if(k)h=y(g.changes),0==t(b.from,b.to)&&0==t(b.from,h.to)?h.to=ya(b):g.changes.push(Cd(a,
b));else for((g=y(e.done))&&g.ranges||vc(a.sel,e.done),g={changes:[Cd(a,b)],generation:e.generation},e.done.push(g);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=f;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;h||F(a,"historyAdded")}function vc(a,b){var c=y(b);c&&c.ranges&&c.equals(a)||b.push(a)}function Re(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+
a.size,d),function(d){d.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=d.markedSpans);++f})}function ng(a){if(!a)return null;for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function Ue(a,b){var c;if(c=b["spans_"+a.id]){for(var d=[],e=0;e<b.text.length;++e)d.push(ng(c[e]));c=d}else c=null;d=Qc(a,b);if(!c)return d;if(!d)return c;for(e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g){var h=0;a:for(;h<g.length;++h){for(var k=g[h],l=
0;l<f.length;++l)if(f[l].marker==k.marker)continue a;f.push(k)}}else g&&(c[e]=g)}return c}function db(a,b,c){for(var d=[],e=0;e<a.length;++e){var f=a[e];if(f.ranges)d.push(c?sa.prototype.deepCopy.call(f):f);else{var f=f.changes,g=[];d.push({changes:g});for(var h=0;h<f.length;++h){var k=f[h],l;g.push({from:k.from,to:k.to,text:k.text});if(b)for(var m in k)(l=m.match(/^spans_(\d+)$/))&&-1<J(b,Number(l[1]))&&(y(g)[m]=k[m],delete k[m])}}}return d}function Gb(a,b,c,d){return a.cm&&a.cm.display.shift||a.extend?
(a=b.anchor,d&&(b=0>t(c,a),b!=0>t(d,a)?(a=c,c=d):b!=0>t(c,d)&&(c=d)),new z(a,c)):new z(d||c,c)}function wc(a,b,c,d){M(a,new sa([Gb(a,a.sel.primary(),b,c)],0),d)}function Ve(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=Gb(a,a.sel.ranges[e],b[e],null);b=fa(d,a.sel.primIndex);M(a,b,c)}function Dd(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c;M(a,fa(e,a.sel.primIndex),d)}function og(a,b,c){c={ranges:b.ranges,update:function(b){this.ranges=[];for(var d=0;d<b.length;d++)this.ranges[d]=new z(x(a,
b[d].anchor),x(a,b[d].head))},origin:c&&c.origin};F(a,"beforeSelectionChange",a,c);a.cm&&F(a.cm,"beforeSelectionChange",a.cm,c);return c.ranges!=b.ranges?fa(c.ranges,c.ranges.length-1):b}function We(a,b,c){var d=a.history.done,e=y(d);e&&e.ranges?(d[d.length-1]=b,xc(a,b,c)):M(a,b,c)}function M(a,b,c){xc(a,b,c);b=a.sel;var d=a.cm?a.cm.curOp.id:NaN,e=a.history,f=c&&c.origin,g;if(!(g=d==e.lastSelOp)&&(g=f&&e.lastSelOrigin==f)&&!(g=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){g=y(e.done);var h=f.charAt(0);
g="*"==h||"+"==h&&g.ranges.length==b.ranges.length&&g.somethingSelected()==b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}g?e.done[e.done.length-1]=b:vc(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=d;c&&!1!==c.clearRedo&&Se(e.undone)}function xc(a,b,c){if(aa(a,"beforeSelectionChange")||a.cm&&aa(a.cm,"beforeSelectionChange"))b=og(a,b,c);var d=c&&c.bias||(0>t(b.primary().head,a.sel.primary().head)?-1:1);Xe(a,Ye(a,b,d,!0));c&&!1===
c.scroll||!a.cm||ab(a.cm)}function Xe(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,Zd(a.cm)),T(a,"cursorActivity",a))}function Ze(a){Xe(a,Ye(a,a.sel,null,!1),ma)}function Ye(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=b.ranges.length==a.sel.ranges.length&&a.sel.ranges[f],k=Ed(a,g.anchor,h&&h.anchor,c,d),h=Ed(a,g.head,h&&h.head,c,d);if(e||k!=g.anchor||h!=g.head)e||(e=b.ranges.slice(0,f)),e[f]=new z(k,h)}return e?fa(e,b.primIndex):
b}function eb(a,b,c,d,e){var f=u(a,b.line);if(f.markedSpans)for(var g=0;g<f.markedSpans.length;++g){var h=f.markedSpans[g],k=h.marker;if((null==h.from||(k.inclusiveLeft?h.from<=b.ch:h.from<b.ch))&&(null==h.to||(k.inclusiveRight?h.to>=b.ch:h.to>b.ch))){if(e&&(F(k,"beforeCursorEnter"),k.explicitlyCleared))if(f.markedSpans){--g;continue}else break;if(k.atomic){if(c){g=k.find(0>d?1:-1);h=void 0;if(0>d?k.inclusiveRight:k.inclusiveLeft)g=$e(a,g,-d,g&&g.line==b.line?f:null);if(g&&g.line==b.line&&(h=t(g,
c))&&(0>d?0>h:0<h))return eb(a,g,b,d,e)}c=k.find(0>d?-1:1);if(0>d?k.inclusiveLeft:k.inclusiveRight)c=$e(a,c,d,c.line==b.line?f:null);return c?eb(a,c,b,d,e):null}}}return b}function Ed(a,b,c,d,e){d=d||1;b=eb(a,b,c,d,e)||!e&&eb(a,b,c,d,!0)||eb(a,b,c,-d,e)||!e&&eb(a,b,c,-d,!0);return b?b:(a.cantEdit=!0,q(a.first,0))}function $e(a,b,c,d){return 0>c&&0==b.ch?b.line>a.first?x(a,q(b.line-1)):null:0<c&&b.ch==(d||u(a,b.line)).text.length?b.line<a.first+a.size-1?q(b.line+1,0):null:new q(b.line,b.ch+c)}function af(a){a.setSelection(q(a.firstLine(),
0),q(a.lastLine()),ma)}function bf(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return d.canceled=!0}};c&&(d.update=function(b,c,g,h){b&&(d.from=x(a,b));c&&(d.to=x(a,c));g&&(d.text=g);void 0!==h&&(d.origin=h)});F(a,"beforeChange",a,d);a.cm&&F(a.cm,"beforeChange",a.cm,d);return d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function fb(a,b,c){if(a.cm){if(!a.cm.curOp)return I(a.cm,fb)(a,b,c);if(a.cm.state.suppressEdits)return}if(aa(a,
"beforeChange")||a.cm&&aa(a.cm,"beforeChange"))if(b=bf(a,b,!0),!b)return;if(c=cf&&!c&&Rf(a,b.from,b.to))for(var d=c.length-1;0<=d;--d)df(a,{from:c[d].from,to:c[d].to,text:d?[""]:b.text});else df(a,b)}function df(a,b){if(1!=b.text.length||""!=b.text[0]||0!=t(b.from,b.to)){var c=zd(a,b);Te(a,b,c,a.cm?a.cm.curOp.id:NaN);Hb(a,b,c,Qc(a,b));var d=[];Oa(a,function(a,c){c||-1!=J(d,a.history)||(ef(a.history,b),d.push(a.history));Hb(a,b,null,Qc(a,b))})}}function yc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits||
c){for(var d=a.history,e,f=a.sel,g="undo"==b?d.done:d.undone,h="undo"==b?d.undone:d.done,k=0;k<g.length&&(e=g[k],c?!e.ranges||e.equals(a.sel):e.ranges);k++);if(k!=g.length){for(d.lastOrigin=d.lastSelOrigin=null;;)if(e=g.pop(),e.ranges){vc(e,h);if(c&&!e.equals(a.sel)){M(a,e,{clearRedo:!1});return}f=e}else break;var l=[];vc(f,h);h.push({changes:l,generation:d.generation});d.generation=e.generation||++d.maxGeneration;var m=aa(a,"beforeChange")||a.cm&&aa(a.cm,"beforeChange");c=function(d){var c=e.changes[d];
c.origin=b;if(m&&!bf(a,c,!1))return g.length=0,{};l.push(Cd(a,c));var f=d?zd(a,c):y(g);Hb(a,c,f,Ue(a,c));!d&&a.cm&&a.cm.scrollIntoView({from:c.from,to:ya(c)});var h=[];Oa(a,function(a,b){b||-1!=J(h,a.history)||(ef(a.history,c),h.push(a.history));Hb(a,c,null,Ue(a,c))})};for(d=e.changes.length-1;0<=d;--d)if(f=c(d))return f.v}}}function ff(a,b){if(0!=b&&(a.first+=b,a.sel=new sa(Yb(a.sel.ranges,function(a){return new z(q(a.anchor.line+b,a.anchor.ch),q(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){O(a.cm,
a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)xa(a.cm,d,"gutter")}}function Hb(a,b,c,d){if(a.cm&&!a.cm.curOp)return I(a.cm,Hb)(a,b,c,d);if(b.to.line<a.first)ff(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);ff(a,e);b={from:q(a.first,0),to:q(b.to.line+e,b.to.ch),text:[y(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:q(e,u(a,e).text.length),text:[b.text[0]],
origin:b.origin});b.removed=Ea(a,b.from,b.to);c||(c=zd(a,b));a.cm?pg(a.cm,b,d):Bd(a,b,d);xc(a,c,ma)}}function pg(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,k=f.line;a.options.lineWrapping||(k=C(ha(u(d,f.line))),d.iter(k,g.line+1,function(a){if(a==e.maxLine)return h=!0}));-1<d.sel.contains(b.from,b.to)&&Zd(a);Bd(d,b,c,ze(a));a.options.lineWrapping||(d.iter(k,f.line+b.text.length,function(a){var b=cc(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=
!0));d.frontier=Math.min(d.frontier,f.line);Db(a,400);c=b.text.length-(g.line-f.line)-1;b.full?O(a):f.line!=g.line||1!=b.text.length||Pe(a.doc,b)?O(a,f.line,g.line+1,c):xa(a,f.line,"text");c=aa(a,"changes");if((d=aa(a,"change"))||c)b={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin},d&&T(a,"change",a,b),c&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function gb(a,b,c,d,e){d||(d=c);if(0>t(d,c)){var f=d;d=c;c=f}"string"==typeof b&&(b=a.splitLines(b));
fb(a,{from:c,to:d,text:b,origin:e})}function gf(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function hf(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges)for(f.copied||(f=a[e]=f.deepCopy(),f.copied=!0),g=0;g<f.ranges.length;g++)gf(f.ranges[g].anchor,b,c,d),gf(f.ranges[g].head,b,c,d);else{for(var h=0;h<f.changes.length;++h){var k=f.changes[h];if(c<k.from.line)k.from=q(k.from.line+d,k.from.ch),k.to=q(k.to.line+d,k.to.ch);else if(b<=k.to.line){g=!1;break}}g||(a.splice(0,e+
1),e=0)}}}function ef(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;hf(a.done,c,d,e);hf(a.undone,c,d,e)}function Ib(a,b,c,d){var e=b,f=b;"number"==typeof b?f=u(a,Math.max(a.first,Math.min(b,a.first+a.size-1))):e=C(b);if(null==e)return null;d(f,e)&&a.cm&&xa(a.cm,e,c);return f}function Jb(a){this.lines=a;this.parent=null;for(var b=0,c=0;c<a.length;++c)a[c].parent=this,b+=a[c].height;this.height=b}function Kb(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d],b=b+e.chunkSize(),
c=c+e.height;e.parent=this}this.size=b;this.height=c;this.parent=null}function Lb(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.doc=a;this.node=b}function qg(a,b,c,d){var e=new Lb(a,c,d),f=a.cm;f&&e.noHScroll&&(f.display.alignWidgets=!0);Ib(a,b,"widget",function(b){var d=b.widgets||(b.widgets=[]);null==e.insertAt?d.push(e):d.splice(Math.min(d.length-1,Math.max(0,e.insertAt)),0,e);e.line=b;f&&!Ha(a,b)&&(d=ia(b)<a.scrollTop,ga(b,b.height+xb(e)),d&&qc(f,null,e.height),f.curOp.forceUpdate=
!0);return!0});return e}function za(a,b){this.lines=[];this.type=b;this.doc=a;this.id=++jf}function hb(a,b,c,d,e){if(d&&d.shared)return rg(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return I(a.cm,hb)(a,b,c,d,e);var f=new za(a,e);e=t(b,c);d&&Ca(d,f,!1);if(0<e||0==e&&!1!==f.clearWhenEmpty)return f;f.replacedWith&&(f.collapsed=!0,f.widgetNode=v("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0));if(f.collapsed){if(Wd(a,
b.line,b,c,f)||b.line!=c.line&&Wd(a,c.line,b,c,f))throw Error("Inserting collapsed marker partially overlapping an existing one");va=!0}f.addToHistory&&Te(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var g=b.line,h=a.cm,k;a.iter(g,c.line+1,function(a){h&&f.collapsed&&!h.options.lineWrapping&&ha(a)==h.display.maxLine&&(k=!0);f.collapsed&&g!=b.line&&ga(a,0);var d=new bc(f,g==b.line?b.ch:null,g==c.line?c.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([d]):[d];d.marker.attachLine(a);++g});
f.collapsed&&a.iter(b.line,c.line+1,function(b){Ha(a,b)&&ga(b,0)});f.clearOnEnter&&w(f,"beforeCursorEnter",function(){return f.clear()});f.readOnly&&(cf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());f.collapsed&&(f.id=++jf,f.atomic=!0);if(h){k&&(h.curOp.updateMaxLine=!0);if(f.collapsed)O(h,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(d=b.line;d<=c.line;d++)xa(h,d,"text");f.atomic&&Ze(h.doc);T(h,"markerAdded",h,f)}return f}function Mb(a,
b){this.markers=a;this.primary=b;for(var c=0;c<a.length;++c)a[c].parent=this}function rg(a,b,c,d,e){d=Ca(d);d.shared=!1;var f=[hb(a,b,c,d,e)],g=f[0],h=d.widgetNode;Oa(a,function(a){h&&(d.widgetNode=h.cloneNode(!0));f.push(hb(a,x(a,b),x(a,c),d,e));for(var k=0;k<a.linked.length;++k)if(a.linked[k].isParent)return;g=y(f)});return new Mb(f,g)}function kf(a){return a.findMarks(q(a.first,0),a.clipPos(q(a.lastLine())),function(a){return a.parent})}function sg(a){for(var b=function(b){b=a[b];var d=[b.primary.doc];
Oa(b.primary.doc,function(a){return d.push(a)});for(var c=0;c<b.markers.length;c++){var g=b.markers[c];-1==J(d,g.doc)&&(g.parent=null,b.markers.splice(c--,1))}},c=0;c<a.length;c++)b(c)}function tg(a){var b=this;lf(b);if(!H(b,a)&&!qa(b.display,a)){N(a);B&&(mf=+new Date);var c=Na(b,a,!0),d=a.dataTransfer.files;if(c&&!b.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){if(!b.options.allowDropFileTypes||-1!=J(b.options.allowDropFileTypes,a.type)){var h=
new FileReader;h.onload=I(b,function(){var a=h.result;/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a="");f[d]=a;++g==e&&(c=x(b.doc,c),a={from:c,to:c,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"},fb(b.doc,a),We(b.doc,ta(c,ya(a))))});h.readAsText(a)}},k=0;k<e;++k)h(d[k],k);else if(b.state.draggingText&&-1<b.doc.sel.contains(c))b.state.draggingText(a),setTimeout(function(){return b.display.input.focus()},20);else try{if(h=a.dataTransfer.getData("Text")){b.state.draggingText&&!b.state.draggingText.copy&&
(k=b.listSelections());xc(b.doc,ta(c,c));if(k)for(d=0;d<k.length;++d)gb(b.doc,"",k[d].anchor,k[d].head,"drag");b.replaceSelection(h,"around","paste");b.display.input.focus()}}catch(l){}}}function lf(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function nf(a){if(document.body.getElementsByClassName)for(var b=document.body.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function ug(){var a;w(window,
"resize",function(){null==a&&(a=setTimeout(function(){a=null;nf(vg)},100))});w(window,"blur",function(){return nf(Bb)})}function vg(a){var b=a.display;if(b.lastWrapHeight!=b.wrapper.clientHeight||b.lastWrapWidth!=b.wrapper.clientWidth)b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize()}function wg(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,f,g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))c=!0;else if(/^(c|ctrl|control)$/i.test(h))d=
f.scrollbars.setScrollTop(g.scrollTop),f.scroller.scrollTop=g.scrollTop);null==d.scrollLeft||f.scroller.scrollLeft==d.scrollLeft&&!d.forceScroll||(g.scrollLeft=Math.max(0,Math.min(f.scroller.scrollWidth-f.scroller.clientWidth,d.scrollLeft)),f.scrollbars.setScrollLeft(g.scrollLeft),f.scroller.scrollLeft=g.scrollLeft,sd(e));if(d.scrollToPos){k=z(g,d.scrollToPos.from);var l=z(g,d.scrollToPos.to),m=d.scrollToPos.margin;null==m&&(m=0);for(var n=0;5>n;n++){var p=!1,h=ta(e,k),t=l&&l!=k?ta(e,l):h,t=pc(e,
Math.min(h.left,t.left),Math.min(h.top,t.top)-m,Math.max(h.left,t.left),Math.max(h.bottom,t.bottom)+m),q=e.doc.scrollTop,u=e.doc.scrollLeft;null!=t.scrollTop&&(Db(e,t.scrollTop),1<Math.abs(e.doc.scrollTop-q)&&(p=!0));null!=t.scrollLeft&&($a(e,t.scrollLeft),1<Math.abs(e.doc.scrollLeft-u)&&(p=!0));if(!p)break}k=h;d.scrollToPos.isCursor&&e.state.focused&&(K(e,"scrollCursorIntoView")||(l=e.display,m=l.sizer.getBoundingClientRect(),h=null,0>k.top+m.top?h=!0:k.bottom+m.top>(window.innerHeight||document.documentElement.clientHeight)&&
(h=!1),null==h||kg||(k=r("div","\u200b",null,"position: absolute;\n top: "+(k.top-l.viewOffset-e.display.lineSpace.offsetTop)+"px;\n height: "+(k.bottom-k.top+oa(e)+l.barHeight)+"px;\n left: "+k.left+"px; width: 2px;"),e.display.lineSpace.appendChild(k),k.scrollIntoView(h),e.display.lineSpace.removeChild(k))))}k=d.maybeHiddenMarkers;h=d.maybeUnhiddenMarkers;if(k)for(l=0;l<k.length;++l)k[l].lines.length||I(k[l],"hide");if(h)for(k=
0;k<h.length;++k)h[k].lines.length&&I(h[k],"unhide");f.wrapper.offsetHeight&&(g.scrollTop=e.display.scroller.scrollTop);d.changeObjs&&I(e,"changes",e,d.changeObjs);d.update&&d.update.finish()}})}function aa(a,b){if(a.curOp)return b();cb(a);try{return b()}finally{db(a)}}function L(a,b){return function(){if(a.curOp)return b.apply(a,arguments);cb(a);try{return b.apply(a,arguments)}finally{db(a)}}}function S(a){return function(){if(this.curOp)return a.apply(this,arguments);cb(this);try{return a.apply(this,
arguments)}finally{db(this)}}}function O(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);cb(b);try{return a.apply(this,arguments)}finally{db(b)}}}function R(a,b,c,d){null==b&&(b=a.doc.first);null==c&&(c=a.doc.first+a.doc.size);d||(d=0);var e=a.display;d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)xa&&Rc(a.doc,b)<e.viewTo&&ya(a);else if(c<=e.viewFrom)xa&&Xd(a.doc,c+d)>e.viewFrom?ya(a):
(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)ya(a);else if(b<=e.viewFrom){var f=tc(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):ya(a)}else if(c>=e.viewTo)(f=tc(a,b,b,-1))?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):ya(a);else{var f=tc(a,b,b,-1),g=tc(a,c,c+d,1);f&&g?(e.view=e.view.slice(0,f.index).concat(ic(a,f.lineN,g.lineN)).concat(e.view.slice(g.index)),e.viewTo+=d):ya(a)}if(a=e.externalMeasured)c<a.lineN?a.lineN+=d:b<a.lineN+a.size&&(e.externalMeasured=
null)}function za(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null);b<d.viewFrom||b>=d.viewTo||(a=d.view[La(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==M(a,c)&&a.push(c)))}function ya(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function tc(a,b,c,d){var e=La(a,b),f=a.display.view;if(!xa||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var g=a.display.viewFrom,
h=0;h<e;h++)g+=f[h].size;if(g!=b){if(0<d){if(e==f.length-1)return null;b=g+f[e].size-b;e++}else b=g-b;c+=b}for(;Rc(a.doc,c)!=c;){if(e==(0>d?0:f.length-1))return null;c+=d*f[e-(0>d?1:0)].size;e+=d}return{index:e,lineN:c}}function Le(a){a=a.display.view;for(var b=0,c=0;c<a.length;c++){var d=a[c];d.hidden||d.node&&!d.changes||++b}return b}function Eb(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,Jc(lg,a))}function lg(a){var b=a.doc;b.frontier<b.first&&(b.frontier=
b.first);if(!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=qa(b.mode,ub(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(b.frontier>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength,k=ce(a,f,h?qa(b.mode,d):d,!0);f.styles=k.styles;var l=f.styleClasses;(k=k.classes)?f.styleClasses=k:l&&(f.styleClasses=null);l=!g||g.length!=f.styles.length||l!=k&&(!l||!k||l.bgClass!=k.bgClass||l.textClass!=k.textClass);
for(k=0;!l&&k<g.length;++k)l=g[k]!=f.styles[k];l&&e.push(b.frontier);f.stateAfter=h?d:qa(b.mode,d)}else f.text.length<=a.options.maxHighlightLength&&cd(a,f.text,d),f.stateAfter=0==b.frontier%5?qa(b.mode,d):null;++b.frontier;if(+new Date>c)return Eb(a,a.options.workDelay),!0});e.length&&aa(a,function(){for(var b=0;b<e.length;b++)za(a,e[b],"text")})}}function wd(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden)return ya(a),!1;if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||
c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&0==Le(a))return!1;De(a)&&(ya(a),b.dims=kd(a));var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFrom<f&&20>f-c.viewFrom&&(f=Math.max(d.first,c.viewFrom));c.viewTo>g&&20>c.viewTo-g&&(g=Math.min(e,c.viewTo));xa&&(f=Rc(a.doc,f),g=Xd(a.doc,g));d=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;e=a.display;0==e.view.length||
f>=e.viewTo||g<=e.viewFrom?(e.view=ic(a,f,g),e.viewFrom=f):(e.viewFrom>f?e.view=ic(a,f,e.viewFrom).concat(e.view):e.viewFrom<f&&(e.view=e.view.slice(La(a,f))),e.viewFrom=f,e.viewTo<g?e.view=e.view.concat(ic(a,e.viewTo,g)):e.viewTo>g&&(e.view=e.view.slice(0,La(a,g))));e.viewTo=g;c.viewOffset=la(v(a.doc,c.viewFrom));a.display.mover.style.top=c.viewOffset+"px";g=Le(a);if(!d&&0==g&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;f=ba();4<g&&(c.lineDiv.style.display=
"none");mg(a,c.updateLineNumbers,b.dims);4<g&&(c.lineDiv.style.display="");c.renderedView=c.view;f&&ba()!=f&&f.offsetHeight&&f.focus();H(c.cursorDiv);H(c.selectionDiv);c.gutters.style.height=c.sizer.style.minHeight=0;d&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth,Eb(a,400));c.updateLineNumbers=null;return!0}function Ke(a,b){for(var c=b.viewport,d=!0;;d=!1){if(!d||!a.options.lineWrapping||b.oldDisplayWidth==Ka(a))if(c&&null!=c.top&&(c={top:Math.min(a.doc.height+hd(a.display)-id(a),
c.top)}),b.visible=ud(a.display,a.doc,c),b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!wd(a,b))break;nc(a);d=Fb(a);Bb(a);ab(a,d);xd(a,d)}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 sc(a,b);if(wd(a,b)){nc(a);Ke(a,b);var c=
Fb(a);Bb(a);ab(a,c);xd(a,c);b.finish()}}function mg(a,b,c){function d(b){var d=b.nextSibling;N&&ga&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return d}for(var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,k=e.view,e=e.viewFrom,l=0;l<k.length;l++){var m=k[l];if(!m.hidden)if(m.node&&m.node.parentNode==g){for(;h!=m.node;)h=d(h);h=f&&null!=b&&b<=e&&m.lineNumber;m.changes&&(-1<M(m.changes,"gutter")&&(h=!1),me(a,m,e,c));h&&(H(m.lineNumber),m.lineNumber.appendChild(document.createTextNode(Oc(a.options,
e))));h=m.node.nextSibling}else{var n=eg(a,m,e,c);g.insertBefore(n,h)}e+=m.size}for(;h;)h=d(h)}function td(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function xd(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";a.display.heightForcer.style.top=b.docHeight+"px";a.display.gutters.style.height=b.docHeight+a.display.barHeight+oa(a)+"px"}function Me(a){var b=a.display.gutters,c=a.options.gutters;H(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(r("div",null,"CodeMirror-gutter "+
e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none";td(a)}function yd(a){var b=M(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1<b&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function ua(a,b){this.ranges=a;this.primIndex=b}function A(a,b){this.anchor=a;this.head=b}function ia(a,b){b=a[b];a.sort(function(a,b){return u(a.from(),
b.from())});b=M(a,b);for(var c=1;c<a.length;c++){var d=a[c],e=a[c-1];if(0<=u(e.to(),d.from())){var f=ac(e.from(),d.from()),g=$b(e.to(),d.to()),d=e.empty()?d.from()==d.head:e.from()==e.head;c<=b&&--b;a.splice(--c,2,new A(d?g:f,d?f:g))}}return new ua(a,b)}function va(a,b){return new ua([new A(a,b||a)],0)}function Aa(a){return a.text?q(a.from.line+a.text.length-1,x(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Ne(a,b){if(0>u(a,b.from))return a;if(0>=u(a,b.to))return Aa(b);var c=a.line+
b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&&(d+=Aa(b).ch-b.to.ch);return q(c,d)}function zd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new A(Ne(e.anchor,b),Ne(e.head,b)))}return ia(c,a.sel.primIndex)}function Oe(a,b,c){return a.line==b.line?q(c.line,a.ch-b.ch+c.ch):q(c.line+(a.line-b.line),a.ch)}function Ad(a){a.doc.mode=ad(a.options,a.doc.modeOption);Gb(a)}function Gb(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=
null)});a.doc.frontier=a.doc.first;Eb(a,100);a.state.modeGen++;a.curOp&&R(a)}function Pe(a,b){return 0==b.from.ch&&0==b.to.ch&&""==x(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Bd(a,b,c,d){function e(a,c,e){a.text=c;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null);null!=a.order&&(a.order=null);Td(a);Ud(a,e);c=d?d(a):1;c!=a.height&&ja(a,c);X(a,"change",a,b)}function f(a,b){for(var e=[];a<b;++a)e.push(new Wa(k[a],c?c[a]:null,d));return e}var g=b.from,h=b.to,k=b.text,l=v(a,
g.line),m=v(a,h.line),n=x(k),p=c?c[k.length-1]:null,t=h.line-g.line;b.full?(a.insert(0,f(0,k.length)),a.remove(k.length,a.size-k.length)):Pe(a,b)?(h=f(0,k.length-1),e(m,m.text,p),t&&a.remove(g.line,t),h.length&&a.insert(g.line,h)):l==m?1==k.length?e(l,l.text.slice(0,g.ch)+n+l.text.slice(h.ch),p):(t=f(1,k.length-1),t.push(new Wa(n+l.text.slice(h.ch),p,d)),e(l,l.text.slice(0,g.ch)+k[0],c?c[0]:null),a.insert(g.line+1,t)):1==k.length?(e(l,l.text.slice(0,g.ch)+k[0]+m.text.slice(h.ch),c?c[0]:null),a.remove(g.line+
1,t)):(e(l,l.text.slice(0,g.ch)+k[0],c?c[0]:null),e(m,n+m.text.slice(h.ch),p),p=f(1,k.length-1),1<t&&a.remove(g.line+1,t-1),a.insert(g.line+1,p));X(a,"change",a,b)}function Pa(a,b,c){function d(a,f,g){if(a.linked)for(var e=0;e<a.linked.length;++e){var k=a.linked[e];if(k.doc!=f){var l=g&&k.sharedHist;if(!c||l)b(k.doc,l),d(k.doc,a,l)}}}d(a,null,!0)}function Qe(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;pd(a);Ad(a);a.options.lineWrapping||Tc(a);a.options.mode=b.modeOption;
R(a)}function uc(a){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=this.lastSelOp=null;this.generation=this.maxGeneration=a||1}function Cd(a,b){var c={from:Pc(b.from),to:Aa(b),text:Fa(a,b.from,b.to)};Re(a,c,b.from.line,b.to.line+1);Pa(a,function(a){return Re(a,c,b.from.line,b.to.line+1)},!0);return c}function Se(a){for(;a.length;)if(x(a).ranges)a.pop();else break}function Te(a,b,c,d){var e=a.history;e.undone.length=
0;var f=+new Date,g,h,k;if(k=e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))e.lastOp==d?(Se(e.done),g=x(e.done)):e.done.length&&!x(e.done).ranges?g=x(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),g=x(e.done)):g=void 0,k=g;if(k)h=x(g.changes),0==u(b.from,b.to)&&0==u(b.from,h.to)?h.to=Aa(b):g.changes.push(Cd(a,b));else for((g=x(e.done))&&g.ranges||vc(a.sel,e.done),g={changes:[Cd(a,
b)],generation:e.generation},e.done.push(g);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=f;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;h||I(a,"historyAdded")}function vc(a,b){var c=x(b);c&&c.ranges&&c.equals(a)||b.push(a)}function Re(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(d){d.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=
d.markedSpans);++f})}function ng(a){if(!a)return null;for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function Ue(a,b){var c;if(c=b["spans_"+a.id]){for(var d=[],e=0;e<b.text.length;++e)d.push(ng(c[e]));c=d}else c=null;a=Qc(a,b);if(!c)return a;if(!a)return c;for(b=0;b<c.length;++b)if(d=c[b],e=a[b],d&&e){var f=0;a:for(;f<e.length;++f){for(var g=e[f],h=0;h<d.length;++h)if(d[h].marker==g.marker)continue a;d.push(g)}}else e&&(c[b]=
e);return c}function eb(a,b,c){for(var d=[],e=0;e<a.length;++e){var f=a[e];if(f.ranges)d.push(c?ua.prototype.deepCopy.call(f):f);else{var f=f.changes,g=[];d.push({changes:g});for(var h=0;h<f.length;++h){var k=f[h],l;g.push({from:k.from,to:k.to,text:k.text});if(b)for(var m in k)(l=m.match(/^spans_(\d+)$/))&&-1<M(b,Number(l[1]))&&(x(g)[m]=k[m],delete k[m])}}}return d}function Hb(a,b,c,d){return a.cm&&a.cm.display.shift||a.extend?(a=b.anchor,d&&(b=0>u(c,a),b!=0>u(d,a)?(a=c,c=d):b!=0>u(c,d)&&(c=d)),new A(a,
c)):new A(d||c,c)}function wc(a,b,c,d){P(a,new ua([Hb(a,a.sel.primary(),b,c)],0),d)}function Ve(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=Hb(a,a.sel.ranges[e],b[e],null);b=ia(d,a.sel.primIndex);P(a,b,c)}function Dd(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c;P(a,ia(e,a.sel.primIndex),d)}function og(a,b,c){c={ranges:b.ranges,update:function(b){this.ranges=[];for(var d=0;d<b.length;d++)this.ranges[d]=new A(z(a,b[d].anchor),z(a,b[d].head))},origin:c&&c.origin};I(a,"beforeSelectionChange",
a,c);a.cm&&I(a.cm,"beforeSelectionChange",a.cm,c);return c.ranges!=b.ranges?ia(c.ranges,c.ranges.length-1):b}function We(a,b,c){var d=a.history.done,e=x(d);e&&e.ranges?(d[d.length-1]=b,xc(a,b,c)):P(a,b,c)}function P(a,b,c){xc(a,b,c);b=a.sel;var d=a.cm?a.cm.curOp.id:NaN,e=a.history,f=c&&c.origin,g;if(!(g=d==e.lastSelOp)&&(g=f&&e.lastSelOrigin==f)&&!(g=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){g=x(e.done);var h=f.charAt(0);g="*"==h||"+"==h&&g.ranges.length==b.ranges.length&&g.somethingSelected()==
b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}g?e.done[e.done.length-1]=b:vc(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=d;c&&!1!==c.clearRedo&&Se(e.undone)}function xc(a,b,c){if(da(a,"beforeSelectionChange")||a.cm&&da(a.cm,"beforeSelectionChange"))b=og(a,b,c);var d=c&&c.bias||(0>u(b.primary().head,a.sel.primary().head)?-1:1);Xe(a,Ye(a,b,d,!0));c&&!1===c.scroll||!a.cm||bb(a.cm)}function Xe(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&
(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,Zd(a.cm)),X(a,"cursorActivity",a))}function Ze(a){Xe(a,Ye(a,a.sel,null,!1),pa)}function Ye(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=b.ranges.length==a.sel.ranges.length&&a.sel.ranges[f],k=Ed(a,g.anchor,h&&h.anchor,c,d),h=Ed(a,g.head,h&&h.head,c,d);if(e||k!=g.anchor||h!=g.head)e||(e=b.ranges.slice(0,f)),e[f]=new A(k,h)}return e?ia(e,b.primIndex):b}function fb(a,b,c,d,e){var f=v(a,b.line);if(f.markedSpans)for(var g=0;g<
f.markedSpans.length;++g){var h=f.markedSpans[g],k=h.marker;if((null==h.from||(k.inclusiveLeft?h.from<=b.ch:h.from<b.ch))&&(null==h.to||(k.inclusiveRight?h.to>=b.ch:h.to>b.ch))){if(e&&(I(k,"beforeCursorEnter"),k.explicitlyCleared))if(f.markedSpans){--g;continue}else break;if(k.atomic){if(c){g=k.find(0>d?1:-1);h=void 0;if(0>d?k.inclusiveRight:k.inclusiveLeft)g=$e(a,g,-d,g&&g.line==b.line?f:null);if(g&&g.line==b.line&&(h=u(g,c))&&(0>d?0>h:0<h))return fb(a,g,b,d,e)}c=k.find(0>d?-1:1);if(0>d?k.inclusiveLeft:
k.inclusiveRight)c=$e(a,c,d,c.line==b.line?f:null);return c?fb(a,c,b,d,e):null}}}return b}function Ed(a,b,c,d,e){d=d||1;b=fb(a,b,c,d,e)||!e&&fb(a,b,c,d,!0)||fb(a,b,c,-d,e)||!e&&fb(a,b,c,-d,!0);return b?b:(a.cantEdit=!0,q(a.first,0))}function $e(a,b,c,d){return 0>c&&0==b.ch?b.line>a.first?z(a,q(b.line-1)):null:0<c&&b.ch==(d||v(a,b.line)).text.length?b.line<a.first+a.size-1?q(b.line+1,0):null:new q(b.line,b.ch+c)}function af(a){a.setSelection(q(a.firstLine(),0),q(a.lastLine()),pa)}function bf(a,b,c){var d=
{canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return d.canceled=!0}};c&&(d.update=function(b,c,g,h){b&&(d.from=z(a,b));c&&(d.to=z(a,c));g&&(d.text=g);void 0!==h&&(d.origin=h)});I(a,"beforeChange",a,d);a.cm&&I(a.cm,"beforeChange",a.cm,d);return d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function gb(a,b,c){if(a.cm){if(!a.cm.curOp)return L(a.cm,gb)(a,b,c);if(a.cm.state.suppressEdits)return}if(da(a,"beforeChange")||a.cm&&da(a.cm,"beforeChange"))if(b=
bf(a,b,!0),!b)return;if(c=cf&&!c&&Rf(a,b.from,b.to))for(var d=c.length-1;0<=d;--d)df(a,{from:c[d].from,to:c[d].to,text:d?[""]:b.text});else df(a,b)}function df(a,b){if(1!=b.text.length||""!=b.text[0]||0!=u(b.from,b.to)){var c=zd(a,b);Te(a,b,c,a.cm?a.cm.curOp.id:NaN);Ib(a,b,c,Qc(a,b));var d=[];Pa(a,function(a,c){c||-1!=M(d,a.history)||(ef(a.history,b),d.push(a.history));Ib(a,b,null,Qc(a,b))})}}function yc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits||c){for(var d=a.history,e,f=a.sel,g="undo"==b?d.done:
d.undone,h="undo"==b?d.undone:d.done,k=0;k<g.length&&(e=g[k],c?!e.ranges||e.equals(a.sel):e.ranges);k++);if(k!=g.length){for(d.lastOrigin=d.lastSelOrigin=null;;)if(e=g.pop(),e.ranges){vc(e,h);if(c&&!e.equals(a.sel)){P(a,e,{clearRedo:!1});return}f=e}else break;var l=[];vc(f,h);h.push({changes:l,generation:d.generation});d.generation=e.generation||++d.maxGeneration;var m=da(a,"beforeChange")||a.cm&&da(a.cm,"beforeChange");c=function(d){var c=e.changes[d];c.origin=b;if(m&&!bf(a,c,!1))return g.length=
0,{};l.push(Cd(a,c));var f=d?zd(a,c):x(g);Ib(a,c,f,Ue(a,c));!d&&a.cm&&a.cm.scrollIntoView({from:c.from,to:Aa(c)});var h=[];Pa(a,function(a,b){b||-1!=M(h,a.history)||(ef(a.history,c),h.push(a.history));Ib(a,c,null,Ue(a,c))})};for(d=e.changes.length-1;0<=d;--d)if(f=c(d))return f.v}}}function ff(a,b){if(0!=b&&(a.first+=b,a.sel=new ua(Yb(a.sel.ranges,function(a){return new A(q(a.anchor.line+b,a.anchor.ch),q(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){R(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,
d=c.viewFrom;d<c.viewTo;d++)za(a.cm,d,"gutter")}}function Ib(a,b,c,d){if(a.cm&&!a.cm.curOp)return L(a.cm,Ib)(a,b,c,d);if(b.to.line<a.first)ff(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);ff(a,e);b={from:q(a.first,0),to:q(b.to.line+e,b.to.ch),text:[x(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:q(e,v(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=Fa(a,b.from,
b.to);c||(c=zd(a,b));a.cm?pg(a.cm,b,d):Bd(a,b,d);xc(a,c,pa)}}function pg(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,k=f.line;a.options.lineWrapping||(k=C(ka(v(d,f.line))),d.iter(k,g.line+1,function(a){if(a==e.maxLine)return h=!0}));-1<d.sel.contains(b.from,b.to)&&Zd(a);Bd(d,b,c,ze(a));a.options.lineWrapping||(d.iter(k,f.line+b.text.length,function(a){var b=cc(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0));d.frontier=Math.min(d.frontier,
f.line);Eb(a,400);c=b.text.length-(g.line-f.line)-1;b.full?R(a):f.line!=g.line||1!=b.text.length||Pe(a.doc,b)?R(a,f.line,g.line+1,c):za(a,f.line,"text");c=da(a,"changes");if((d=da(a,"change"))||c)b={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin},d&&X(a,"change",a,b),c&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function hb(a,b,c,d,e){d||(d=c);if(0>u(d,c)){var f=d;d=c;c=f}"string"==typeof b&&(b=a.splitLines(b));gb(a,{from:c,to:d,text:b,origin:e})}
function gf(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function hf(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges)for(f.copied||(f=a[e]=f.deepCopy(),f.copied=!0),g=0;g<f.ranges.length;g++)gf(f.ranges[g].anchor,b,c,d),gf(f.ranges[g].head,b,c,d);else{for(var h=0;h<f.changes.length;++h){var k=f.changes[h];if(c<k.from.line)k.from=q(k.from.line+d,k.from.ch),k.to=q(k.to.line+d,k.to.ch);else if(b<=k.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function ef(a,b){var c=b.from.line,
d=b.to.line;b=b.text.length-(d-c)-1;hf(a.done,c,d,b);hf(a.undone,c,d,b)}function Jb(a,b,c,d){var e=b,f=b;"number"==typeof b?f=v(a,Math.max(a.first,Math.min(b,a.first+a.size-1))):e=C(b);if(null==e)return null;d(f,e)&&a.cm&&za(a.cm,e,c);return f}function Kb(a){this.lines=a;this.parent=null;for(var b=0,c=0;c<a.length;++c)a[c].parent=this,b+=a[c].height;this.height=b}function Lb(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d],b=b+e.chunkSize(),c=c+e.height;e.parent=this}this.size=b;
this.height=c;this.parent=null}function Mb(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.doc=a;this.node=b}function qg(a,b,c,d){var e=new Mb(a,c,d),f=a.cm;f&&e.noHScroll&&(f.display.alignWidgets=!0);Jb(a,b,"widget",function(b){var d=b.widgets||(b.widgets=[]);null==e.insertAt?d.push(e):d.splice(Math.min(d.length-1,Math.max(0,e.insertAt)),0,e);e.line=b;f&&!Ia(a,b)&&(d=la(b)<a.scrollTop,ja(b,b.height+yb(e)),d&&qc(f,null,e.height),f.curOp.forceUpdate=!0);return!0});return e}function Ba(a,
b){this.lines=[];this.type=b;this.doc=a;this.id=++jf}function ib(a,b,c,d,e){if(d&&d.shared)return rg(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return L(a.cm,ib)(a,b,c,d,e);var f=new Ba(a,e);e=u(b,c);d&&Da(d,f,!1);if(0<e||0==e&&!1!==f.clearWhenEmpty)return f;f.replacedWith&&(f.collapsed=!0,f.widgetNode=r("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0));if(f.collapsed){if(Wd(a,b.line,b,c,f)||b.line!=
c.line&&Wd(a,c.line,b,c,f))throw Error("Inserting collapsed marker partially overlapping an existing one");xa=!0}f.addToHistory&&Te(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var g=b.line,h=a.cm,k;a.iter(g,c.line+1,function(a){h&&f.collapsed&&!h.options.lineWrapping&&ka(a)==h.display.maxLine&&(k=!0);f.collapsed&&g!=b.line&&ja(a,0);var d=new bc(f,g==b.line?b.ch:null,g==c.line?c.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([d]):[d];d.marker.attachLine(a);++g});f.collapsed&&a.iter(b.line,
c.line+1,function(b){Ia(a,b)&&ja(b,0)});f.clearOnEnter&&w(f,"beforeCursorEnter",function(){return f.clear()});f.readOnly&&(cf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());f.collapsed&&(f.id=++jf,f.atomic=!0);if(h){k&&(h.curOp.updateMaxLine=!0);if(f.collapsed)R(h,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(d=b.line;d<=c.line;d++)za(h,d,"text");f.atomic&&Ze(h.doc);X(h,"markerAdded",h,f)}return f}function Nb(a,b){this.markers=a;this.primary=
b;for(b=0;b<a.length;++b)a[b].parent=this}function rg(a,b,c,d,e){d=Da(d);d.shared=!1;var f=[ib(a,b,c,d,e)],g=f[0],h=d.widgetNode;Pa(a,function(a){h&&(d.widgetNode=h.cloneNode(!0));f.push(ib(a,z(a,b),z(a,c),d,e));for(var k=0;k<a.linked.length;++k)if(a.linked[k].isParent)return;g=x(f)});return new Nb(f,g)}function kf(a){return a.findMarks(q(a.first,0),a.clipPos(q(a.lastLine())),function(a){return a.parent})}function sg(a){for(var b=function(b){b=a[b];var d=[b.primary.doc];Pa(b.primary.doc,function(a){return d.push(a)});
for(var c=0;c<b.markers.length;c++){var g=b.markers[c];-1==M(d,g.doc)&&(g.parent=null,b.markers.splice(c--,1))}},c=0;c<a.length;c++)b(c)}function tg(a){var b=this;lf(b);if(!K(b,a)&&!sa(b.display,a)){Q(a);B&&(mf=+new Date);var c=Oa(b,a,!0),d=a.dataTransfer.files;if(c&&!b.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){if(!b.options.allowDropFileTypes||-1!=M(b.options.allowDropFileTypes,a.type)){var h=new FileReader;h.onload=L(b,function(){var a=
h.result;/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a="");f[d]=a;++g==e&&(c=z(b.doc,c),a={from:c,to:c,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"},gb(b.doc,a),We(b.doc,va(c,Aa(a))))});h.readAsText(a)}},k=0;k<e;++k)h(d[k],k);else if(b.state.draggingText&&-1<b.doc.sel.contains(c))b.state.draggingText(a),setTimeout(function(){return b.display.input.focus()},20);else try{if(h=a.dataTransfer.getData("Text")){b.state.draggingText&&!b.state.draggingText.copy&&(k=b.listSelections());xc(b.doc,
va(c,c));if(k)for(d=0;d<k.length;++d)hb(b.doc,"",k[d].anchor,k[d].head,"drag");b.replaceSelection(h,"around","paste");b.display.input.focus()}}catch(l){}}}function lf(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function nf(a){if(document.body.getElementsByClassName)for(var b=document.body.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function ug(){var a;w(window,"resize",function(){null==a&&(a=
setTimeout(function(){a=null;nf(vg)},100))});w(window,"blur",function(){return nf(Cb)})}function vg(a){var b=a.display;if(b.lastWrapHeight!=b.wrapper.clientHeight||b.lastWrapWidth!=b.wrapper.clientWidth)b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize()}function wg(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,f,g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))c=!0;else if(/^(c|ctrl|control)$/i.test(h))d=
!0;else if(/^s(hift)?$/i.test(h))e=!0;else throw Error("Unrecognized modifier name: "+h);}c&&(a="Alt-"+a);d&&(a="Ctrl-"+a);f&&(a="Cmd-"+a);e&&(a="Shift-"+a);return a}function xg(a){var b={},c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];if(!/^(name|fallthrough|(de|at)tach)$/.test(c)){if("..."!=d)for(var e=Yb(c.split(" "),wg),f=0;f<e.length;f++){var g,h;f==e.length-1?(h=e.join(" "),g=d):(h=e.slice(0,f+1).join(" "),g="...");var k=b[h];if(!k)b[h]=g;else if(k!=g)throw Error("Inconsistent bindings for "+
h);}delete a[c]}}for(var l in b)a[l]=b[l];return a}function ib(a,b,c,d){b=zc(b);var e=b.call?b.call(a,d):b[a];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return ib(a,b.fallthrough,c,d);for(e=0;e<b.fallthrough.length;e++){var f=ib(a,b.fallthrough[e],c,d);if(f)return f}}}function of(a){a="string"==typeof a?a:Aa[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function pf(a,
b){if(ea&&34==a.keyCode&&a["char"])return!1;var c=Aa[a.keyCode],d=c;if(null==d||a.altGraphKey)return!1;a.altKey&&"Alt"!=c&&(d="Alt-"+d);(qf?a.metaKey:a.ctrlKey)&&"Ctrl"!=c&&(d="Ctrl-"+d);(qf?a.ctrlKey:a.metaKey)&&"Cmd"!=c&&(d="Cmd-"+d);!b&&a.shiftKey&&"Shift"!=c&&(d="Shift-"+d);return d}function zc(a){return"string"==typeof a?Nb[a]:a}function jb(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&0>=t(f.from,y(d).to);){var g=d.pop();if(0>t(g.from,f.from)){f.from=g.from;
break}}d.push(f)}X(a,function(){for(var b=d.length-1;0<=b;b--)gb(a.doc,"",d[b].from,d[b].to,"+delete");ab(a)})}function rf(a,b){var c=u(a.doc,b),d=ha(c);d!=c&&(b=C(d));d=(c=ba(d))?c[0].level%2?ec(d):dc(d):0;return q(b,d)}function sf(a,b){var c=rf(a,b.line),d=u(a.doc,c.line),e=ba(d);return e&&0!=e[0].level?c:(d=Math.max(0,d.text.search(/\S/)),q(c.line,b.line==c.line&&b.ch<=d&&b.ch?0:d))}function Ac(a,b,c){if("string"==typeof b&&(b=Bc[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,
e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Fd}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function yg(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=ib(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&ib(b,a.options.extraKeys,c,a)||ib(b,a.options.keyMap,c,a)}function Cc(a,b,c,d){var e=a.state.keySeq;if(e){if(of(b))return"handled";zg.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())});
b=e+" "+b}d=yg(a,b,d);"multi"==d&&(a.state.keySeq=b);"handled"==d&&T(a,"keyHandled",a,b,c);if("handled"==d||"multi"==d)N(c),qd(a);return e&&!d&&/\'$/.test(b)?(N(c),!0):!!d}function tf(a,b){var c=pf(b,!0);return c?b.shiftKey&&!a.state.keySeq?Cc(a,"Shift-"+c,b,function(b){return Ac(a,b,!0)})||Cc(a,c,b,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return Ac(a,b)}):Cc(a,c,b,function(b){return Ac(a,b)}):!1}function Ag(a,b,c){return Cc(a,"'"+c+"'",b,function(b){return Ac(a,b,!0)})}function uf(a){this.curOp.focus=
na();if(!H(this,a)){B&&11>D&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=tf(this,a);ea&&(Gd=c?b:null,!c&&88==b&&!vf&&(da?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||Bg(this)}}function Bg(a){function b(a){18!=a.keyCode&&a.altKey||(Ya(c,"CodeMirror-crosshair"),ca(document,"keyup",b),ca(document,"mouseover",b))}var c=a.display.lineDiv;Ra(c,"CodeMirror-crosshair");w(document,
"keyup",b);w(document,"mouseover",b)}function wf(a){16==a.keyCode&&(this.doc.sel.shift=!1);H(this,a)}function xf(a){if(!(qa(this.display,a)||H(this,a)||a.ctrlKey&&!a.altKey||da&&a.metaKey)){var b=a.keyCode,c=a.charCode;if(ea&&b==Gd)Gd=null,N(a);else if(!ea||a.which&&!(10>a.which)||!tf(this,a))if(b=String.fromCharCode(null==c?b:c),"\b"!=b&&!Ag(this,a,b))this.display.input.onKeyPress(a)}}function Cg(a){var b=this.display;if(!(H(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),
b.shift=a.shiftKey,qa(b,a))K||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!Hd(this,a,"gutterClick",!0)){var c=Na(this,a);window.focus();switch(ae(a)){case 1:this.state.selectingText?this.state.selectingText(a):c?Dg(this,a,c):(a.target||a.srcElement)==b.scroller&&N(a);break;case 2:K&&(this.state.lastMiddleDown=+new Date);c&&wc(this.doc,c);setTimeout(function(){return b.input.focus()},20);N(a);break;case 3:Id?yf(this,a):hg(this)}}}function Dg(a,b,c){B?
setTimeout(Jc(Ce,a),0):a.curOp.focus=na();var d=+new Date,e;Dc&&Dc.time>d-400&&0==t(Dc.pos,c)?e="triple":Ec&&Ec.time>d-400&&0==t(Ec.pos,c)?(e="double",Dc={time:d,pos:c}):(e="single",Ec={time:d,pos:c});var d=a.doc.sel,f=da?b.metaKey:b.ctrlKey,g;a.options.dragDrop&&Eg&&!a.isReadOnly()&&"single"==e&&-1<(g=d.contains(c))&&(0>t((g=d.ranges[g]).from(),c)||0<c.xRel)&&(0<t(g.to(),c)||0>c.xRel)?Fg(a,b,c,f):Gg(a,b,c,e,f)}function Fg(a,b,c,d){var e=a.display,f=+new Date,g=I(a,function(h){K&&(e.scroller.draggable=
!1);a.state.draggingText=!1;ca(document,"mouseup",g);ca(e.scroller,"drop",g);10>Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)&&(N(h),!d&&+new Date-200<f&&wc(a.doc,c),K||B&&9==D?setTimeout(function(){document.body.focus();e.input.focus()},20):e.input.focus())});K&&(e.scroller.draggable=!0);a.state.draggingText=g;g.copy=da?b.altKey:b.ctrlKey;e.scroller.dragDrop&&e.scroller.dragDrop();w(document,"mouseup",g);w(e.scroller,"drop",g)}function Gg(a,b,c,d,e){function f(b){if(0!=t(y,b))if(y=
b,"rect"==d){for(var e=[],f=a.options.tabSize,g=Z(u(l,c.line).text,c.ch,f),h=Z(u(l,b.line).text,b.ch,f),k=Math.min(g,h),g=Math.max(g,h),h=Math.min(c.line,b.line),r=Math.min(a.lastLine(),Math.max(c.line,b.line));h<=r;h++){var v=u(l,h).text,w=Kc(v,k,f);k==g?e.push(new z(q(h,w),q(h,w))):v.length>w&&e.push(new z(q(h,w),q(h,Kc(v,g,f))))}e.length||e.push(new z(c,c));M(l,fa(p.ranges.slice(0,n).concat(e),n),{origin:"*mouse",scroll:!1});a.scrollIntoView(b)}else k=m,e=k.anchor,f=b,"single"!=d&&(b="double"==
d?a.findWordAt(b):new z(q(b.line,0),x(l,q(b.line+1,0))),0<t(b.anchor,e)?(f=b.head,e=ac(k.from(),b.anchor)):(f=b.anchor,e=$b(k.to(),b.head))),b=p.ranges.slice(0),b[n]=new z(x(l,e),f),M(l,fa(b,n),Jd)}function g(b){var c=++B,e=Na(a,b,!0,"rect"==d);if(e)if(0!=t(e,y)){a.curOp.focus=na();f(e);var h=ud(k,l);(e.line>=h.to||e.line<h.from)&&setTimeout(I(a,function(){B==c&&g(b)}),150)}else{var m=b.clientY<A.top?-20:b.clientY>A.bottom?20:0;m&&setTimeout(I(a,function(){B==c&&(k.scroller.scrollTop+=m,g(b))}),50)}}
function h(b){a.state.selectingText=!1;B=Infinity;N(b);k.input.focus();ca(document,"mousemove",C);ca(document,"mouseup",D);l.history.lastSelOrigin=null}var k=a.display,l=a.doc;N(b);var m,n,p=l.sel,r=p.ranges;e&&!b.shiftKey?(n=l.sel.contains(c),m=-1<n?r[n]:new z(c,c)):(m=l.sel.primary(),n=l.sel.primIndex);if(Hg?b.shiftKey&&b.metaKey:b.altKey)d="rect",e||(m=new z(c,c)),c=Na(a,b,!0,!0),n=-1;else if("double"==d){var v=a.findWordAt(c);m=a.display.shift||l.extend?Gb(l,m,v.anchor,v.head):v}else"triple"==
d?(v=new z(q(c.line,0),x(l,q(c.line+1,0))),m=a.display.shift||l.extend?Gb(l,m,v.anchor,v.head):v):m=Gb(l,m,c);e?-1==n?(n=r.length,M(l,fa(r.concat([m]),n),{scroll:!1,origin:"*mouse"})):1<r.length&&r[n].empty()&&"single"==d&&!b.shiftKey?(M(l,fa(r.slice(0,n).concat(r.slice(n+1)),0),{scroll:!1,origin:"*mouse"}),p=l.sel):Dd(l,n,m,Jd):(n=0,M(l,new sa([m],0),Jd),p=l.sel);var y=c,A=k.wrapper.getBoundingClientRect(),B=0,C=I(a,function(a){ae(a)?g(a):h(a)}),D=I(a,h);a.state.selectingText=D;w(document,"mousemove",
C);w(document,"mouseup",D)}function Hd(a,b,c,d){var e,f;try{e=b.clientX,f=b.clientY}catch(k){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&N(b);d=a.display;var g=d.lineDiv.getBoundingClientRect();if(f>g.bottom||!aa(a,c))return Yc(b);f-=g.top-d.viewOffset;for(g=0;g<a.options.gutters.length;++g){var h=d.gutters.childNodes[g];if(h&&h.getBoundingClientRect().right>=e)return e=Fa(a.doc,f),F(a,c,a,e,a.options.gutters[g],b),Yc(b)}}function yf(a,b){var c;(c=qa(a.display,
b))||(c=aa(a,"gutterContextMenu")?Hd(a,b,"gutterContextMenu",!1):!1);if(!c&&!H(a,b,"contextmenu"))a.display.input.onContextMenu(b)}function zf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");zb(a)}function Ob(a){Me(a);O(a);sd(a)}function Ig(a,b,c){!b!=!(c&&c!=kb)&&(c=a.display.dragFunctions,b=b?w:ca,b(a.display.scroller,"dragstart",c.start),b(a.display.scroller,"dragenter",c.enter),b(a.display.scroller,"dragover",
c.over),b(a.display.scroller,"dragleave",c.leave),b(a.display.scroller,"drop",c.drop))}function Jg(a){a.options.lineWrapping?(Ra(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Ya(a.display.wrapper,"CodeMirror-wrap"),Tc(a));pd(a);O(a);zb(a);setTimeout(function(){return $a(a)},100)}function E(a,b){var c=this;if(!(this instanceof E))return new E(a,b);this.options=b=b?Ca(b):{};Ca(Af,b,!1);yd(b);var d=b.value;"string"==typeof d&&(d=new Q(d,b.mode,null,
b.lineSeparator));this.doc=d;var e=new E.inputStyles[b.inputStyle](this),e=this.display=new Qf(a,d,e);e.wrapper.CodeMirror=this;Me(this);zf(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");Ie(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 Da,keySeq:null,specialChars:null};b.autofocus&&!ob&&e.input.focus();B&&11>D&&setTimeout(function(){return c.display.input.reset(!0)},
20);Kg(this);Bf||(ug(),Bf=!0);bb(this);this.curOp.forceUpdate=!0;Qe(this,d);b.autofocus&&!ob||this.hasFocus()?setTimeout(Jc(rd,this),20):Bb(this);for(var f in Fc)if(Fc.hasOwnProperty(f))Fc[f](c,b[f],kb);De(this);b.finishInit&&b.finishInit(this);for(d=0;d<Kd.length;++d)Kd[d](c);cb(this);K&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(e.lineDiv).textRendering&&(e.lineDiv.style.textRendering="auto")}function Kg(a){function b(){d.activeTouch&&(e=setTimeout(function(){return d.activeTouch=null},
1E3),f=d.activeTouch,f.end=+new Date)}function c(a,b){if(null==b.left)return!0;var d=b.left-a.left,c=b.top-a.top;return 400<d*d+c*c}var d=a.display;w(d.scroller,"mousedown",I(a,Cg));B&&11>D?w(d.scroller,"dblclick",I(a,function(b){if(!H(a,b)){var d=Na(a,b);!d||Hd(a,b,"gutterClick",!0)||qa(a.display,b)||(N(b),b=a.findWordAt(d),wc(a.doc,b.anchor,b.head))}})):w(d.scroller,"dblclick",function(b){return H(a,b)||N(b)});Id||w(d.scroller,"contextmenu",function(b){return yf(a,b)});var e,f={end:0};w(d.scroller,
"touchstart",function(b){var c;if(c=!H(a,b))1!=b.touches.length?c=!1:(c=b.touches[0],c=1>=c.radiusX&&1>=c.radiusY),c=!c;c&&(d.input.ensurePolled(),clearTimeout(e),c=+new Date,d.activeTouch={start:c,moved:!1,prev:300>=c-f.end?f:null},1==b.touches.length&&(d.activeTouch.left=b.touches[0].pageX,d.activeTouch.top=b.touches[0].pageY))});w(d.scroller,"touchmove",function(){d.activeTouch&&(d.activeTouch.moved=!0)});w(d.scroller,"touchend",function(e){var f=d.activeTouch;if(f&&!qa(d,e)&&null!=f.left&&!f.moved&&
300>new Date-f.start){var g=a.coordsChar(d.activeTouch,"page"),f=!f.prev||c(f,f.prev)?new z(g,g):!f.prev.prev||c(f,f.prev.prev)?a.findWordAt(g):new z(q(g.line,0),x(a.doc,q(g.line+1,0)));a.setSelection(f.anchor,f.head);a.focus();N(e)}b()});w(d.scroller,"touchcancel",b);w(d.scroller,"scroll",function(){d.scroller.clientHeight&&(Cb(a,d.scroller.scrollTop),Za(a,d.scroller.scrollLeft,!0),F(a,"scroll",a))});w(d.scroller,"mousewheel",function(b){return Ge(a,b)});w(d.scroller,"DOMMouseScroll",function(b){return Ge(a,
b)});w(d.wrapper,"scroll",function(){return d.wrapper.scrollTop=d.wrapper.scrollLeft=0});d.dragFunctions={enter:function(b){H(a,b)||sb(b)},over:function(b){if(!H(a,b)){var d=Na(a,b);if(d){var c=document.createDocumentFragment();Be(a,d,c);a.display.dragCursor||(a.display.dragCursor=v("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv));V(a.display.dragCursor,c)}sb(b)}},start:function(b){if(B&&(!a.state.draggingText||100>
+new Date-mf))sb(b);else if(!H(a,b)&&!qa(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.effectAllowed="copyMove",b.dataTransfer.setDragImage&&!Cf)){var d=v("img",null,null,"position: fixed; left: 0; top: 0;");d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";ea&&(d.width=d.height=1,a.display.wrapper.appendChild(d),d._top=d.offsetTop);b.dataTransfer.setDragImage(d,0,0);ea&&d.parentNode.removeChild(d)}},drop:I(a,tg),leave:function(b){H(a,
b)||lf(a)}};var g=d.input.getField();w(g,"keyup",function(b){return wf.call(a,b)});w(g,"keydown",I(a,uf));w(g,"keypress",I(a,xf));w(g,"focus",function(b){return rd(a,b)});w(g,"blur",function(b){return Bb(a,b)})}function Pb(a,b,c,d){var e=a.doc,f;null==c&&(c="add");"smart"==c&&(e.mode.indent?f=tb(a,b):c="prev");var g=a.options.tabSize,h=u(e,b),k=Z(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var l=h.text.match(/^\s*/)[0],m;if(!d&&!/\S/.test(h.text))m=0,c="not";else if("smart"==c&&(m=e.mode.indent(f,
h.text.slice(l.length),h.text),m==Fd||150<m)){if(!d)return;c="prev"}"prev"==c?m=b>e.first?Z(u(e,b-1).text,null,g):0:"add"==c?m=k+a.options.indentUnit:"subtract"==c?m=k-a.options.indentUnit:"number"==typeof c&&(m=k+c);m=Math.max(0,m);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(m/g);a;--a)d+=g,c+="\t";d<m&&(c+=Lc(m-d));if(c!=l)return gb(e,c,q(b,0),q(b,l.length),"+input"),h.stateAfter=null,!0;for(g=0;g<e.sel.ranges.length;g++)if(h=e.sel.ranges[g],h.head.line==b&&h.head.ch<l.length){b=q(b,l.length);
Dd(e,g,new z(b,b));break}}function Ld(a,b,c,d,e){var f=a.doc;a.display.shift=!1;d||(d=f.sel);var g=a.state.pasteIncoming||"paste"==e,h=Md(b),k=null;if(g&&1<d.ranges.length)if(R&&R.text.join("\n")==b){if(0==d.ranges.length%R.text.length)for(var k=[],l=0;l<R.text.length;l++)k.push(f.splitLines(R.text[l]))}else h.length==d.ranges.length&&(k=Yb(h,function(a){return[a]}));for(var m,l=d.ranges.length-1;0<=l;l--){m=d.ranges[l];var n=m.from(),p=m.to();m.empty()&&(c&&0<c?n=q(n.line,n.ch-c):a.state.overwrite&&
!g?p=q(p.line,Math.min(u(f,p.line).text.length,p.ch+y(h).length)):R&&R.lineWise&&R.text.join("\n")==b&&(n=p=q(n.line,0)));m=a.curOp.updateInput;n={from:n,to:p,text:k?k[l%k.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};fb(a.doc,n);T(a,"inputRead",a,n)}b&&!g&&Df(a,b);ab(a);a.curOp.updateInput=m;a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=!1}function Ef(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||
X(b,function(){return Ld(b,c,0,null,"paste")}),!0}function Df(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;0<=d;d--){var e=c.ranges[d];if(!(100<e.head.ch||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars)for(var h=0;h<f.electricChars.length;h++){if(-1<b.indexOf(f.electricChars.charAt(h))){g=Pb(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(u(a.doc,e.head.line).text.slice(0,e.head.ch))&&
(g=Pb(a,e.head.line,"smart"));g&&T(a,"electricInput",a,e.head.line)}}}function Ff(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line,e={anchor:q(e,0),head:q(e+1,0)};c.push(e);b.push(a.getRange(e.anchor,e.head))}return{text:b,ranges:c}}function Gf(a,b){a.setAttribute("autocorrect","off");a.setAttribute("autocapitalize","off");a.setAttribute("spellcheck",!!b)}function Hf(){var a=v("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),
b=v("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");K?a.style.width="1000px":a.setAttribute("wrap","off");Qb&&(a.style.border="1px solid black");Gf(a);return b}function Nd(a,b,c,d,e){function f(b){var d=(e?Xc:Yd)(l,h,c,!0);if(null==d){if(b=!b)b=g+c,b<a.first||b>=a.first+a.size?b=!1:(g=b,b=l=u(a,b));if(b)h=e?(0>c?ec:dc)(l):0>c?l.text.length:0;else return!1}else h=d;return!0}var g=b.line,h=b.ch,k=c,l=u(a,g);if("char"==d)f();else if("column"==d)f(!0);else if("word"==
d||"group"==d){var m=null;d="group"==d;for(var n=a.cm&&a.cm.getHelper(b,"wordChars"),p=!0;!(0>c)||f(!p);p=!1){var r=l.text.charAt(h)||"\n",r=Zb(r,n)?"w":d&&"\n"==r?"n":!d||/\s/.test(r)?null:"p";!d||p||r||(r="s");if(m&&m!=r){0>c&&(c=1,f());break}r&&(m=r);if(0<c&&!f(!p))break}}k=Ed(a,q(g,h),b,k,!0);t(b,k)||(k.hitSide=!0);return k}function If(a,b,c,d){var e=a.doc,f=b.left,g;"page"==d?(g=Math.max(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-.5*La(a.display),
3),g=(0<c?b.bottom:b.top)+c*g):"line"==d&&(g=0<c?b.bottom+3:b.top-3);for(;;){b=nd(a,f,g);if(!b.outside)break;if(0>c?0>=g:g>=e.height){b.hitSide=!0;break}g+=5*c}return b}function Jf(a,b){var c=jd(a,b.line);if(!c||c.hidden)return null;var d=u(a.doc,b.line),c=se(c,d,b.line),d=ba(d),e="left";d&&(e=fc(d,b.ch)%2?"right":"left");c=te(c.map,b.ch,e);c.offset="right"==c.collapse?c.end:c.start;return c}function lb(a,b){b&&(a.bad=!0);return a}function Lg(a,b,c,d,e){function f(a){return function(b){return b.id==
a}}function g(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)h=""==c?h+b.textContent.replace(/\u200b/g,""):h+c;else{var c=b.getAttribute("cm-marker"),m;if(c)b=a.findMarks(q(d,0),q(e+1,0),f(+c)),b.length&&(m=b[0].find())&&(h+=Ea(a.doc,m.from,m.to).join(l));else if("false"!=b.getAttribute("contenteditable")){for(m=0;m<b.childNodes.length;m++)g(b.childNodes[m]);/^(pre|div|p)$/i.test(b.nodeName)&&(k=!0)}}}else 3==b.nodeType&&(b=b.nodeValue)&&(k&&(h+=l,k=!1),h+=b)}for(var h="",k=!1,l=
a.doc.lineSeparator();;){g(b);if(b==c)break;b=b.nextSibling}return h}function Gc(a,b,c){var d;if(b==a.display.lineDiv){d=a.display.lineDiv.childNodes[c];if(!d)return lb(a.clipPos(q(a.display.viewTo-1)),!0);b=null;c=0}else for(d=b;;d=d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==d)return Mg(f,b,c)}}function Mg(a,b,c){function d(b,d,c){for(var e=-1;e<(l?l.length:
0);e++)for(var f=0>e?k.map:l[e],g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==d){d=C(0>e?a.line:a.rest[e]);e=f[g]+c;if(0>c||h!=b)e=f[g+(c?1:0)];return q(d,e)}}}var e=a.text.firstChild,f=!1;if(!b||!Wb(e,b))return lb(q(C(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[c],c=0,!b))return c=a.rest?y(a.rest):a.line,lb(q(C(c),c.text.length),f);var g=3==b.nodeType?b:null,h=b;g||1!=b.childNodes.length||3!=b.firstChild.nodeType||(g=b.firstChild,c&&(c=g.nodeValue.length));for(;h.parentNode!=e;)h=h.parentNode;var k=
a.measure,l=k.maps;if(b=d(g,h,c))return lb(b,f);e=h.nextSibling;for(g=g?g.nodeValue.length-c:0;e;e=e.nextSibling){if(b=d(e,e.firstChild,0))return lb(q(b.line,b.ch-g),f);g+=e.textContent.length}for(h=h.previousSibling;h;h=h.previousSibling){if(b=d(h,h.firstChild,-1))return lb(q(b.line,b.ch+c),f);c+=h.textContent.length}}var U=navigator.userAgent,Kf=navigator.platform,ua=/gecko\/\d/i.test(U),Lf=/MSIE \d/.test(U),Mf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(U),B=Lf||Mf,D=B&&(Lf?document.documentMode||
6:Mf[1]),K=/WebKit\//.test(U),Ng=K&&/Qt\/\d+\.\d+/.test(U),Og=/Chrome\//.test(U),ea=/Opera\//.test(U),Cf=/Apple Computer/.test(navigator.vendor),Pg=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(U),kg=/PhantomJS/.test(U),Qb=/AppleWebKit/.test(U)&&/Mobile\/\w+/.test(U),ob=Qb||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(U),da=Qb||/Mac/.test(Kf),Hg=/\bCrOS\b/.test(U),Qg=/win/i.test(Kf),Pa=ea&&U.match(/Version\/(\d*\.\d*)/);Pa&&(Pa=Number(Pa[1]));Pa&&15<=Pa&&(ea=!1,K=!0);var qf=da&&(Ng||ea&&
(null==Pa||12.11>Pa)),Id=ua||B&&9<=D,Ya=function(a,b){var c=a.className,d=Ba(b).exec(c);if(d){var e=c.slice(d.index+d[0].length);a.className=c.slice(0,d.index)+(e?d[1]+e:"")}},Wa;Wa=document.createRange?function(a,b,c,d){var e=document.createRange();e.setEnd(d||a,c);e.setStart(a,b);return e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}d.collapse(!0);d.moveEnd("character",c);d.moveStart("character",b);return d};var mb=function(a){a.select()};
Qb?mb=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:B&&(mb=function(a){try{a.select()}catch(b){}});Da.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var Fd={toString:function(){return"CodeMirror.Pass"}},ma={scroll:!1},Jd={origin:"*mouse"},Rb={origin:"+move"},Xb=[""],Of=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Pf=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,
cf=!1,va=!1,rb=null,Tf=function(){function a(a){return 247>=a?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1785>=a?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(a-
h);}delete a[c]}}for(var l in b)a[l]=b[l];return a}function jb(a,b,c,d){b=zc(b);var e=b.call?b.call(a,d):b[a];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return jb(a,b.fallthrough,c,d);for(e=0;e<b.fallthrough.length;e++){var f=jb(a,b.fallthrough[e],c,d);if(f)return f}}}function of(a){a="string"==typeof a?a:Ca[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function pf(a,
b){if(ha&&34==a.keyCode&&a["char"])return!1;var c=Ca[a.keyCode],d=c;if(null==d||a.altGraphKey)return!1;a.altKey&&"Alt"!=c&&(d="Alt-"+d);(qf?a.metaKey:a.ctrlKey)&&"Ctrl"!=c&&(d="Ctrl-"+d);(qf?a.ctrlKey:a.metaKey)&&"Cmd"!=c&&(d="Cmd-"+d);!b&&a.shiftKey&&"Shift"!=c&&(d="Shift-"+d);return d}function zc(a){return"string"==typeof a?Ob[a]:a}function kb(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&0>=u(f.from,x(d).to);){var g=d.pop();if(0>u(g.from,f.from)){f.from=g.from;
break}}d.push(f)}aa(a,function(){for(var b=d.length-1;0<=b;b--)hb(a.doc,"",d[b].from,d[b].to,"+delete");bb(a)})}function rf(a,b){var c=v(a.doc,b);a=ka(c);a!=c&&(b=C(a));a=(c=ea(a))?c[0].level%2?ec(a):dc(a):0;return q(b,a)}function sf(a,b){var c=rf(a,b.line);a=v(a.doc,c.line);var d=ea(a);return d&&0!=d[0].level?c:(a=Math.max(0,a.text.search(/\S/)),q(c.line,b.line==c.line&&b.ch<=a&&b.ch?0:a))}function Ac(a,b,c){if("string"==typeof b&&(b=Bc[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,
e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Fd}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function yg(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=jb(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&jb(b,a.options.extraKeys,c,a)||jb(b,a.options.keyMap,c,a)}function Cc(a,b,c,d){var e=a.state.keySeq;if(e){if(of(b))return"handled";zg.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())});
b=e+" "+b}d=yg(a,b,d);"multi"==d&&(a.state.keySeq=b);"handled"==d&&X(a,"keyHandled",a,b,c);if("handled"==d||"multi"==d)Q(c),qd(a);return e&&!d&&/\'$/.test(b)?(Q(c),!0):!!d}function tf(a,b){var c=pf(b,!0);return c?b.shiftKey&&!a.state.keySeq?Cc(a,"Shift-"+c,b,function(b){return Ac(a,b,!0)})||Cc(a,c,b,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return Ac(a,b)}):Cc(a,c,b,function(b){return Ac(a,b)}):!1}function Ag(a,b,c){return Cc(a,"'"+c+"'",b,function(b){return Ac(a,b,!0)})}function uf(a){this.curOp.focus=
ba();if(!K(this,a)){B&&11>F&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=tf(this,a);ha&&(Gd=c?b:null,!c&&88==b&&!vf&&(ga?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||Bg(this)}}function Bg(a){function b(a){18!=a.keyCode&&a.altKey||(Za(c,"CodeMirror-crosshair"),fa(document,"keyup",b),fa(document,"mouseover",b))}var c=a.display.lineDiv;Sa(c,"CodeMirror-crosshair");w(document,
"keyup",b);w(document,"mouseover",b)}function wf(a){16==a.keyCode&&(this.doc.sel.shift=!1);K(this,a)}function xf(a){if(!(sa(this.display,a)||K(this,a)||a.ctrlKey&&!a.altKey||ga&&a.metaKey)){var b=a.keyCode,c=a.charCode;if(ha&&b==Gd)Gd=null,Q(a);else if(!ha||a.which&&!(10>a.which)||!tf(this,a))if(b=String.fromCharCode(null==c?b:c),"\b"!=b&&!Ag(this,a,b))this.display.input.onKeyPress(a)}}function Cg(a){var b=this.display;if(!(K(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),
b.shift=a.shiftKey,sa(b,a))N||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!Hd(this,a,"gutterClick",!0)){var c=Oa(this,a);window.focus();switch(ae(a)){case 1:this.state.selectingText?this.state.selectingText(a):c?Dg(this,a,c):(a.target||a.srcElement)==b.scroller&&Q(a);break;case 2:N&&(this.state.lastMiddleDown=+new Date);c&&wc(this.doc,c);setTimeout(function(){return b.input.focus()},20);Q(a);break;case 3:Id?yf(this,a):hg(this)}}}function Dg(a,b,c){B?
setTimeout(Jc(Ce,a),0):a.curOp.focus=ba();var d=+new Date,e;Dc&&Dc.time>d-400&&0==u(Dc.pos,c)?e="triple":Ec&&Ec.time>d-400&&0==u(Ec.pos,c)?(e="double",Dc={time:d,pos:c}):(e="single",Ec={time:d,pos:c});var d=a.doc.sel,f=ga?b.metaKey:b.ctrlKey,g;a.options.dragDrop&&Eg&&!a.isReadOnly()&&"single"==e&&-1<(g=d.contains(c))&&(0>u((g=d.ranges[g]).from(),c)||0<c.xRel)&&(0<u(g.to(),c)||0>c.xRel)?Fg(a,b,c,f):Gg(a,b,c,e,f)}function Fg(a,b,c,d){var e=a.display,f=+new Date,g=L(a,function(h){N&&(e.scroller.draggable=
!1);a.state.draggingText=!1;fa(document,"mouseup",g);fa(e.scroller,"drop",g);10>Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)&&(Q(h),!d&&+new Date-200<f&&wc(a.doc,c),N||B&&9==F?setTimeout(function(){document.body.focus();e.input.focus()},20):e.input.focus())});N&&(e.scroller.draggable=!0);a.state.draggingText=g;g.copy=ga?b.altKey:b.ctrlKey;e.scroller.dragDrop&&e.scroller.dragDrop();w(document,"mouseup",g);w(e.scroller,"drop",g)}function Gg(a,b,c,d,e){function f(b){if(0!=u(x,b))if(x=
b,"rect"==d){for(var e=[],f=a.options.tabSize,g=ca(v(l,c.line).text,c.ch,f),h=ca(v(l,b.line).text,b.ch,f),k=Math.min(g,h),g=Math.max(g,h),h=Math.min(c.line,b.line),t=Math.min(a.lastLine(),Math.max(c.line,b.line));h<=t;h++){var r=v(l,h).text,w=Kc(r,k,f);k==g?e.push(new A(q(h,w),q(h,w))):r.length>w&&e.push(new A(q(h,w),q(h,Kc(r,g,f))))}e.length||e.push(new A(c,c));P(l,ia(p.ranges.slice(0,n).concat(e),n),{origin:"*mouse",scroll:!1});a.scrollIntoView(b)}else k=m,e=k.anchor,f=b,"single"!=d&&(b="double"==
d?a.findWordAt(b):new A(q(b.line,0),z(l,q(b.line+1,0))),0<u(b.anchor,e)?(f=b.head,e=ac(k.from(),b.anchor)):(f=b.anchor,e=$b(k.to(),b.head))),b=p.ranges.slice(0),b[n]=new A(z(l,e),f),P(l,ia(b,n),Jd)}function g(b){var c=++B,e=Oa(a,b,!0,"rect"==d);if(e)if(0!=u(e,x)){a.curOp.focus=ba();f(e);var h=ud(k,l);(e.line>=h.to||e.line<h.from)&&setTimeout(L(a,function(){B==c&&g(b)}),150)}else{var m=b.clientY<y.top?-20:b.clientY>y.bottom?20:0;m&&setTimeout(L(a,function(){B==c&&(k.scroller.scrollTop+=m,g(b))}),50)}}
function h(b){a.state.selectingText=!1;B=Infinity;Q(b);k.input.focus();fa(document,"mousemove",D);fa(document,"mouseup",C);l.history.lastSelOrigin=null}var k=a.display,l=a.doc;Q(b);var m,n,p=l.sel,t=p.ranges;e&&!b.shiftKey?(n=l.sel.contains(c),m=-1<n?t[n]:new A(c,c)):(m=l.sel.primary(),n=l.sel.primIndex);if(Hg?b.shiftKey&&b.metaKey:b.altKey)d="rect",e||(m=new A(c,c)),c=Oa(a,b,!0,!0),n=-1;else if("double"==d){var r=a.findWordAt(c);m=a.display.shift||l.extend?Hb(l,m,r.anchor,r.head):r}else"triple"==
d?(r=new A(q(c.line,0),z(l,q(c.line+1,0))),m=a.display.shift||l.extend?Hb(l,m,r.anchor,r.head):r):m=Hb(l,m,c);e?-1==n?(n=t.length,P(l,ia(t.concat([m]),n),{scroll:!1,origin:"*mouse"})):1<t.length&&t[n].empty()&&"single"==d&&!b.shiftKey?(P(l,ia(t.slice(0,n).concat(t.slice(n+1)),0),{scroll:!1,origin:"*mouse"}),p=l.sel):Dd(l,n,m,Jd):(n=0,P(l,new ua([m],0),Jd),p=l.sel);var x=c,y=k.wrapper.getBoundingClientRect(),B=0,D=L(a,function(a){ae(a)?g(a):h(a)}),C=L(a,h);a.state.selectingText=C;w(document,"mousemove",
D);w(document,"mouseup",C)}function Hd(a,b,c,d){var e,f;try{e=b.clientX,f=b.clientY}catch(k){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&Q(b);d=a.display;var g=d.lineDiv.getBoundingClientRect();if(f>g.bottom||!da(a,c))return Yc(b);f-=g.top-d.viewOffset;for(g=0;g<a.options.gutters.length;++g){var h=d.gutters.childNodes[g];if(h&&h.getBoundingClientRect().right>=e)return e=Ga(a.doc,f),I(a,c,a,e,a.options.gutters[g],b),Yc(b)}}function yf(a,b){var c;(c=sa(a.display,
b))||(c=da(a,"gutterContextMenu")?Hd(a,b,"gutterContextMenu",!1):!1);if(!c&&!K(a,b,"contextmenu"))a.display.input.onContextMenu(b)}function zf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");Ab(a)}function Pb(a){Me(a);R(a);sd(a)}function Ig(a,b,c){!b!=!(c&&c!=lb)&&(c=a.display.dragFunctions,b=b?w:fa,b(a.display.scroller,"dragstart",c.start),b(a.display.scroller,"dragenter",c.enter),b(a.display.scroller,"dragover",
c.over),b(a.display.scroller,"dragleave",c.leave),b(a.display.scroller,"drop",c.drop))}function Jg(a){a.options.lineWrapping?(Sa(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Za(a.display.wrapper,"CodeMirror-wrap"),Tc(a));pd(a);R(a);Ab(a);setTimeout(function(){return ab(a)},100)}function G(a,b){var c=this;if(!(this instanceof G))return new G(a,b);this.options=b=b?Da(b):{};Da(Af,b,!1);yd(b);var d=b.value;"string"==typeof d&&(d=new T(d,b.mode,null,
b.lineSeparator));this.doc=d;var e=new G.inputStyles[b.inputStyle](this);a=this.display=new Qf(a,d,e);a.wrapper.CodeMirror=this;Me(this);zf(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");Ie(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 Ea,keySeq:null,specialChars:null};b.autofocus&&!pb&&a.input.focus();B&&11>F&&setTimeout(function(){return c.display.input.reset(!0)},
20);Kg(this);Bf||(ug(),Bf=!0);cb(this);this.curOp.forceUpdate=!0;Qe(this,d);b.autofocus&&!pb||this.hasFocus()?setTimeout(Jc(rd,this),20):Cb(this);for(var f in Fc)if(Fc.hasOwnProperty(f))Fc[f](c,b[f],lb);De(this);b.finishInit&&b.finishInit(this);for(d=0;d<Kd.length;++d)Kd[d](c);db(this);N&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function Kg(a){function b(){d.activeTouch&&(e=setTimeout(function(){return d.activeTouch=null},
1E3),f=d.activeTouch,f.end=+new Date)}function c(a,b){if(null==b.left)return!0;var d=b.left-a.left;a=b.top-a.top;return 400<d*d+a*a}var d=a.display;w(d.scroller,"mousedown",L(a,Cg));B&&11>F?w(d.scroller,"dblclick",L(a,function(b){if(!K(a,b)){var d=Oa(a,b);!d||Hd(a,b,"gutterClick",!0)||sa(a.display,b)||(Q(b),b=a.findWordAt(d),wc(a.doc,b.anchor,b.head))}})):w(d.scroller,"dblclick",function(b){return K(a,b)||Q(b)});Id||w(d.scroller,"contextmenu",function(b){return yf(a,b)});var e,f={end:0};w(d.scroller,
"touchstart",function(b){var c;if(c=!K(a,b))1!=b.touches.length?c=!1:(c=b.touches[0],c=1>=c.radiusX&&1>=c.radiusY),c=!c;c&&(d.input.ensurePolled(),clearTimeout(e),c=+new Date,d.activeTouch={start:c,moved:!1,prev:300>=c-f.end?f:null},1==b.touches.length&&(d.activeTouch.left=b.touches[0].pageX,d.activeTouch.top=b.touches[0].pageY))});w(d.scroller,"touchmove",function(){d.activeTouch&&(d.activeTouch.moved=!0)});w(d.scroller,"touchend",function(e){var f=d.activeTouch;if(f&&!sa(d,e)&&null!=f.left&&!f.moved&&
300>new Date-f.start){var g=a.coordsChar(d.activeTouch,"page"),f=!f.prev||c(f,f.prev)?new A(g,g):!f.prev.prev||c(f,f.prev.prev)?a.findWordAt(g):new A(q(g.line,0),z(a.doc,q(g.line+1,0)));a.setSelection(f.anchor,f.head);a.focus();Q(e)}b()});w(d.scroller,"touchcancel",b);w(d.scroller,"scroll",function(){d.scroller.clientHeight&&(Db(a,d.scroller.scrollTop),$a(a,d.scroller.scrollLeft,!0),I(a,"scroll",a))});w(d.scroller,"mousewheel",function(b){return Ge(a,b)});w(d.scroller,"DOMMouseScroll",function(b){return Ge(a,
b)});w(d.wrapper,"scroll",function(){return d.wrapper.scrollTop=d.wrapper.scrollLeft=0});d.dragFunctions={enter:function(b){K(a,b)||tb(b)},over:function(b){if(!K(a,b)){var d=Oa(a,b);if(d){var c=document.createDocumentFragment();Be(a,d,c);a.display.dragCursor||(a.display.dragCursor=r("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv));D(a.display.dragCursor,c)}tb(b)}},start:function(b){if(B&&(!a.state.draggingText||100>
+new Date-mf))tb(b);else if(!K(a,b)&&!sa(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.effectAllowed="copyMove",b.dataTransfer.setDragImage&&!Cf)){var d=r("img",null,null,"position: fixed; left: 0; top: 0;");d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";ha&&(d.width=d.height=1,a.display.wrapper.appendChild(d),d._top=d.offsetTop);b.dataTransfer.setDragImage(d,0,0);ha&&d.parentNode.removeChild(d)}},drop:L(a,tg),leave:function(b){K(a,
b)||lf(a)}};var g=d.input.getField();w(g,"keyup",function(b){return wf.call(a,b)});w(g,"keydown",L(a,uf));w(g,"keypress",L(a,xf));w(g,"focus",function(b){return rd(a,b)});w(g,"blur",function(b){return Cb(a,b)})}function Qb(a,b,c,d){var e=a.doc,f;null==c&&(c="add");"smart"==c&&(e.mode.indent?f=ub(a,b):c="prev");var g=a.options.tabSize,h=v(e,b),k=ca(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var l=h.text.match(/^\s*/)[0],m;if(!d&&!/\S/.test(h.text))m=0,c="not";else if("smart"==c&&(m=e.mode.indent(f,
h.text.slice(l.length),h.text),m==Fd||150<m)){if(!d)return;c="prev"}"prev"==c?m=b>e.first?ca(v(e,b-1).text,null,g):0:"add"==c?m=k+a.options.indentUnit:"subtract"==c?m=k-a.options.indentUnit:"number"==typeof c&&(m=k+c);m=Math.max(0,m);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(m/g);a;--a)d+=g,c+="\t";d<m&&(c+=Lc(m-d));if(c!=l)return hb(e,c,q(b,0),q(b,l.length),"+input"),h.stateAfter=null,!0;for(g=0;g<e.sel.ranges.length;g++)if(h=e.sel.ranges[g],h.head.line==b&&h.head.ch<l.length){b=q(b,
l.length);Dd(e,g,new A(b,b));break}}function Ld(a,b,c,d,e){var f=a.doc;a.display.shift=!1;d||(d=f.sel);var g=a.state.pasteIncoming||"paste"==e,h=Md(b),k=null;if(g&&1<d.ranges.length)if(U&&U.text.join("\n")==b){if(0==d.ranges.length%U.text.length)for(var k=[],l=0;l<U.text.length;l++)k.push(f.splitLines(U.text[l]))}else h.length==d.ranges.length&&(k=Yb(h,function(a){return[a]}));for(var m,l=d.ranges.length-1;0<=l;l--){m=d.ranges[l];var n=m.from(),p=m.to();m.empty()&&(c&&0<c?n=q(n.line,n.ch-c):a.state.overwrite&&
!g?p=q(p.line,Math.min(v(f,p.line).text.length,p.ch+x(h).length)):U&&U.lineWise&&U.text.join("\n")==b&&(n=p=q(n.line,0)));m=a.curOp.updateInput;n={from:n,to:p,text:k?k[l%k.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};gb(a.doc,n);X(a,"inputRead",a,n)}b&&!g&&Df(a,b);bb(a);a.curOp.updateInput=m;a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=!1}function Ef(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||
aa(b,function(){return Ld(b,c,0,null,"paste")}),!0}function Df(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;0<=d;d--){var e=c.ranges[d];if(!(100<e.head.ch||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars)for(var h=0;h<f.electricChars.length;h++){if(-1<b.indexOf(f.electricChars.charAt(h))){g=Qb(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(v(a.doc,e.head.line).text.slice(0,e.head.ch))&&
(g=Qb(a,e.head.line,"smart"));g&&X(a,"electricInput",a,e.head.line)}}}function Ff(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line,e={anchor:q(e,0),head:q(e+1,0)};c.push(e);b.push(a.getRange(e.anchor,e.head))}return{text:b,ranges:c}}function Gf(a,b){a.setAttribute("autocorrect","off");a.setAttribute("autocapitalize","off");a.setAttribute("spellcheck",!!b)}function Hf(){var a=r("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),
b=r("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");N?a.style.width="1000px":a.setAttribute("wrap","off");Rb&&(a.style.border="1px solid black");Gf(a);return b}function Nd(a,b,c,d,e){function f(b){var d=(e?Xc:Yd)(l,h,c,!0);if(null==d){if(b=!b)b=g+c,b<a.first||b>=a.first+a.size?b=!1:(g=b,b=l=v(a,b));if(b)h=e?(0>c?ec:dc)(l):0>c?l.text.length:0;else return!1}else h=d;return!0}var g=b.line,h=b.ch,k=c,l=v(a,g);if("char"==d)f();else if("column"==d)f(!0);else if("word"==
d||"group"==d){var m=null;d="group"==d;for(var n=a.cm&&a.cm.getHelper(b,"wordChars"),p=!0;!(0>c)||f(!p);p=!1){var t=l.text.charAt(h)||"\n",t=Zb(t,n)?"w":d&&"\n"==t?"n":!d||/\s/.test(t)?null:"p";!d||p||t||(t="s");if(m&&m!=t){0>c&&(c=1,f());break}t&&(m=t);if(0<c&&!f(!p))break}}k=Ed(a,q(g,h),b,k,!0);u(b,k)||(k.hitSide=!0);return k}function If(a,b,c,d){var e=a.doc,f=b.left,g;"page"==d?(g=Math.max(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-.5*Ma(a.display),
3),g=(0<c?b.bottom:b.top)+c*g):"line"==d&&(g=0<c?b.bottom+3:b.top-3);for(;;){b=nd(a,f,g);if(!b.outside)break;if(0>c?0>=g:g>=e.height){b.hitSide=!0;break}g+=5*c}return b}function Jf(a,b){var c=jd(a,b.line);if(!c||c.hidden)return null;a=v(a.doc,b.line);c=se(c,a,b.line);a=ea(a);var d="left";a&&(d=fc(a,b.ch)%2?"right":"left");b=te(c.map,b.ch,d);b.offset="right"==b.collapse?b.end:b.start;return b}function mb(a,b){b&&(a.bad=!0);return a}function Lg(a,b,c,d,e){function f(a){return function(b){return b.id==
a}}function g(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)h=""==c?h+b.textContent.replace(/\u200b/g,""):h+c;else{var c=b.getAttribute("cm-marker"),m;if(c)b=a.findMarks(q(d,0),q(e+1,0),f(+c)),b.length&&(m=b[0].find())&&(h+=Fa(a.doc,m.from,m.to).join(l));else if("false"!=b.getAttribute("contenteditable")){for(m=0;m<b.childNodes.length;m++)g(b.childNodes[m]);/^(pre|div|p)$/i.test(b.nodeName)&&(k=!0)}}}else 3==b.nodeType&&(b=b.nodeValue)&&(k&&(h+=l,k=!1),h+=b)}for(var h="",k=!1,l=
a.doc.lineSeparator();;){g(b);if(b==c)break;b=b.nextSibling}return h}function Gc(a,b,c){var d;if(b==a.display.lineDiv){d=a.display.lineDiv.childNodes[c];if(!d)return mb(a.clipPos(q(a.display.viewTo-1)),!0);b=null;c=0}else for(d=b;;d=d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==d)return Mg(f,b,c)}}function Mg(a,b,c){function d(b,d,c){for(var e=-1;e<(l?l.length:
0);e++)for(var f=0>e?k.map:l[e],g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==d){d=C(0>e?a.line:a.rest[e]);e=f[g]+c;if(0>c||h!=b)e=f[g+(c?1:0)];return q(d,e)}}}var e=a.text.firstChild,f=!1;if(!b||!V(e,b))return mb(q(C(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[c],c=0,!b))return c=a.rest?x(a.rest):a.line,mb(q(C(c),c.text.length),f);var g=3==b.nodeType?b:null,h=b;g||1!=b.childNodes.length||3!=b.firstChild.nodeType||(g=b.firstChild,c&&(c=g.nodeValue.length));for(;h.parentNode!=e;)h=h.parentNode;var k=
a.measure,l=k.maps;if(b=d(g,h,c))return mb(b,f);e=h.nextSibling;for(g=g?g.nodeValue.length-c:0;e;e=e.nextSibling){if(b=d(e,e.firstChild,0))return mb(q(b.line,b.ch-g),f);g+=e.textContent.length}for(h=h.previousSibling;h;h=h.previousSibling){if(b=d(h,h.firstChild,-1))return mb(q(b.line,b.ch+c),f);c+=h.textContent.length}}var Y=navigator.userAgent,Kf=navigator.platform,wa=/gecko\/\d/i.test(Y),Lf=/MSIE \d/.test(Y),Mf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Y),B=Lf||Mf,F=B&&(Lf?document.documentMode||
6:Mf[1]),N=/WebKit\//.test(Y),Ng=N&&/Qt\/\d+\.\d+/.test(Y),Og=/Chrome\//.test(Y),ha=/Opera\//.test(Y),Cf=/Apple Computer/.test(navigator.vendor),Pg=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Y),kg=/PhantomJS/.test(Y),Rb=/AppleWebKit/.test(Y)&&/Mobile\/\w+/.test(Y),pb=Rb||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Y),ga=Rb||/Mac/.test(Kf),Hg=/\bCrOS\b/.test(Y),Qg=/win/i.test(Kf),Qa=ha&&Y.match(/Version\/(\d*\.\d*)/);Qa&&(Qa=Number(Qa[1]));Qa&&15<=Qa&&(ha=!1,N=!0);var qf=ga&&(Ng||ha&&
(null==Qa||12.11>Qa)),Id=wa||B&&9<=F,Za=function(a,b){var c=a.className;if(b=y(b).exec(c)){var d=c.slice(b.index+b[0].length);a.className=c.slice(0,b.index)+(d?b[1]+d:"")}},Xa;Xa=document.createRange?function(a,b,c,d){var e=document.createRange();e.setEnd(d||a,c);e.setStart(a,b);return e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}d.collapse(!0);d.moveEnd("character",c);d.moveStart("character",b);return d};var nb=function(a){a.select()};
Rb?nb=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:B&&(nb=function(a){try{a.select()}catch(b){}});Ea.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var Fd={toString:function(){return"CodeMirror.Pass"}},pa={scroll:!1},Jd={origin:"*mouse"},Sb={origin:"+move"},Xb=[""],Of=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Pf=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,
cf=!1,xa=!1,sb=null,Tf=function(){function a(a){return 247>=a?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1785>=a?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(a-
1536):1774<=a&&2220>=a?"r":8192<=a&&8203>=a?"w":8204==a?"b":"L"}function b(a,b,d){this.level=a;this.from=b;this.to=d}var c=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,e=/[LRr]/,f=/[Lb1n]/,g=/[1n]/;return function(h){if(!c.test(h))return!1;for(var k=h.length,l=[],m=0;m<k;++m)l.push(a(h.charCodeAt(m)));for(var m=0,n="L";m<k;++m){var p=l[m];"m"==p?l[m]=n:n=p}m=0;for(n="L";m<k;++m)p=l[m],"1"==p&&"r"==n?l[m]="n":e.test(p)&&(n=p,"r"==p&&(l[m]="R"));m=1;for(n=l[0];m<k-1;++m)p=l[m],"+"==p&&"1"==
n&&"1"==l[m+1]?l[m]="1":","!=p||n!=l[m+1]||"1"!=n&&"n"!=n||(l[m]=n),n=p;for(m=0;m<k;++m)if(n=l[m],","==n)l[m]="N";else if("%"==n){for(n=m+1;n<k&&"%"==l[n];++n);for(p=m&&"!"==l[m-1]||n<k&&"1"==l[n]?"1":"N";m<n;++m)l[m]=p;m=n-1}m=0;for(n="L";m<k;++m)p=l[m],"L"==n&&"1"==p?l[m]="L":e.test(p)&&(n=p);for(n=0;n<k;++n)if(d.test(l[n])){for(m=n+1;m<k&&d.test(l[m]);++m);p="L"==(m<k?l[m]:"L");for(p="L"==(n?l[n-1]:"L")||p?"L":"R";n<m;++n)l[n]=p;n=m-1}for(var m=[],r,n=0;n<k;)if(f.test(l[n])){p=n;for(++n;n<k&&f.test(l[n]);++n);
m.push(new b(0,p,n))}else{var q=n,p=m.length;for(++n;n<k&&"L"!=l[n];++n);for(var t=q;t<n;)if(g.test(l[t])){q<t&&m.splice(p,0,new b(1,q,t));q=t;for(++t;t<n&&g.test(l[t]);++t);m.splice(p,0,new b(2,q,t));q=t}else++t;q<n&&m.splice(p,0,new b(1,q,n))}1==m[0].level&&(r=h.match(/^\s+/))&&(m[0].from=r[0].length,m.unshift(new b(0,0,r[0].length)));1==y(m).level&&(r=h.match(/\s+$/))&&(y(m).to-=r[0].length,m.push(new b(0,k-r[0].length,k)));2==m[0].level&&m.unshift(new b(1,m[0].to,m[0].to));m[0].level!=y(m).level&&
m.push(new b(m[0].level,k,k));return m}}(),gc=[],w=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),a[b]=(a[b]||gc).concat(c))},Eg=function(){if(B&&9>D)return!1;var a=v("div");return"draggable"in a||"dragDrop"in a}(),Zc,ed,Md=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,
g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},Rg=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){var b;try{b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},vf=function(){var a=v("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),ld=null,$c={},Ta={},Ua={},ub=function(a,b){this.pos=
this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0};ub.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&(a.test?a.test(b):a(b)))return++this.pos,b},eatWhile:function(a){for(var b=
this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0},backUp:function(a){this.pos-=a},column:function(){this.lastColumnPos<this.start&&(this.lastColumnValue=Z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);
return this.lastColumnValue-(this.lineStart?Z(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Z(this.string,null,this.tabSize)-(this.lineStart?Z(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if("string"==typeof a){var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);if(d(e)==d(a))return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);
return a}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};Sa(Va);Va.prototype.lineNo=function(){return C(this)};var Zf={},Yf={},Xa=null,vb=null,ue={left:0,right:0,top:0,bottom:0},Ma,oc=0,W=null;B?W=-.53:ua?W=15:Og?W=-.7:Cf&&(W=-1/3);var Qa=function(a,b,c){this.cm=c;var d=this.vert=v("div",[v("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=v("div",[v("div",null,null,
"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(d);a(e);w(d,"scroll",function(){d.clientHeight&&b(d.scrollTop,"vertical")});w(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;B&&8>D&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Qa.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;c?(this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0",this.vert.firstChild.style.height=
n&&"1"==l[m+1]?l[m]="1":","!=p||n!=l[m+1]||"1"!=n&&"n"!=n||(l[m]=n),n=p;for(m=0;m<k;++m)if(n=l[m],","==n)l[m]="N";else if("%"==n){for(n=m+1;n<k&&"%"==l[n];++n);for(p=m&&"!"==l[m-1]||n<k&&"1"==l[n]?"1":"N";m<n;++m)l[m]=p;m=n-1}m=0;for(n="L";m<k;++m)p=l[m],"L"==n&&"1"==p?l[m]="L":e.test(p)&&(n=p);for(n=0;n<k;++n)if(d.test(l[n])){for(m=n+1;m<k&&d.test(l[m]);++m);p="L"==(m<k?l[m]:"L");for(p="L"==(n?l[n-1]:"L")||p?"L":"R";n<m;++n)l[n]=p;n=m-1}for(var m=[],t,n=0;n<k;)if(f.test(l[n])){p=n;for(++n;n<k&&f.test(l[n]);++n);
m.push(new b(0,p,n))}else{var q=n,p=m.length;for(++n;n<k&&"L"!=l[n];++n);for(var r=q;r<n;)if(g.test(l[r])){q<r&&m.splice(p,0,new b(1,q,r));q=r;for(++r;r<n&&g.test(l[r]);++r);m.splice(p,0,new b(2,q,r));q=r}else++r;q<n&&m.splice(p,0,new b(1,q,n))}1==m[0].level&&(t=h.match(/^\s+/))&&(m[0].from=t[0].length,m.unshift(new b(0,0,t[0].length)));1==x(m).level&&(t=h.match(/\s+$/))&&(x(m).to-=t[0].length,m.push(new b(0,k-t[0].length,k)));2==m[0].level&&m.unshift(new b(1,m[0].to,m[0].to));m[0].level!=x(m).level&&
m.push(new b(m[0].level,k,k));return m}}(),gc=[],w=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),a[b]=(a[b]||gc).concat(c))},Eg=function(){if(B&&9>F)return!1;var a=r("div");return"draggable"in a||"dragDrop"in a}(),Zc,ed,Md=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,
g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},Rg=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){var b;try{b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},vf=function(){var a=r("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),ld=null,$c={},Ua={},Va={},vb=function(a,b){this.pos=
this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0};vb.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&(a.test?a.test(b):a(b)))return++this.pos,b},eatWhile:function(a){for(var b=
this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0},backUp:function(a){this.pos-=a},column:function(){this.lastColumnPos<this.start&&(this.lastColumnValue=ca(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);
return this.lastColumnValue-(this.lineStart?ca(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return ca(this.string,null,this.tabSize)-(this.lineStart?ca(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if("string"==typeof a){var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);if(d(e)==d(a))return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);
return a}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};Ta(Wa);Wa.prototype.lineNo=function(){return C(this)};var Zf={},Yf={},Ya=null,wb=null,ue={left:0,right:0,top:0,bottom:0},Na,oc=0,Z=null;B?Z=-.53:wa?Z=15:Og?Z=-.7:Cf&&(Z=-1/3);var Ra=function(a,b,c){this.cm=c;var d=this.vert=r("div",[r("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=r("div",[r("div",null,null,
"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(d);a(e);w(d,"scroll",function(){d.clientHeight&&b(d.scrollTop,"vertical")});w(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;B&&8>F&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ra.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;c?(this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0",this.vert.firstChild.style.height=
Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight-(b?d:0)))+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0");b?(this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px",this.horiz.firstChild.style.width=a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(c?d:0))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0");!this.checkedZeroWidth&&0<a.clientHeight&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=
!0);return{right:c?d:0,bottom:b?d:0}};Qa.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)};Qa.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)};Qa.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=da&&!Pg?"12px":"18px";this.horiz.style.pointerEvents=this.vert.style.pointerEvents=
"none";this.disableHoriz=new Da;this.disableVert=new Da};Qa.prototype.enableZeroWidthBar=function(a,b){function c(){var d=a.getBoundingClientRect();document.elementFromPoint(d.left+1,d.bottom-1)!=a?a.style.pointerEvents="none":b.set(1E3,c)}a.style.pointerEvents="auto";b.set(1E3,c)};Qa.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};var Sb=function(){};Sb.prototype.update=function(){return{bottom:0,right:0}};Sb.prototype.setScrollLeft=function(){};
Sb.prototype.setScrollTop=function(){};Sb.prototype.clear=function(){};var Je={"native":Qa,"null":Sb},jg=0,sc=function(a,b,c){var d=a.display;this.viewport=b;this.visible=ud(d,a.doc,b);this.editorIsHidden=!d.wrapper.offsetWidth;this.wrapperHeight=d.wrapper.clientHeight;this.wrapperWidth=d.wrapper.clientWidth;this.oldDisplayWidth=Ja(a);this.force=c;this.dims=kd(a);this.events=[]};sc.prototype.signal=function(a,b){aa(a,b)&&this.events.push(arguments)};sc.prototype.finish=function(){for(var a=0;a<this.events.length;a++)F.apply(null,
this.events[a])};sa.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(0!=t(c.anchor,d.anchor)||0!=t(c.head,d.head))return!1}return!0},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new z(Pc(this.ranges[b].anchor),Pc(this.ranges[b].head));return new sa(a,this.primIndex)},somethingSelected:function(){for(var a=
0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(0<=t(b,d.from())&&0>=t(a,d.to()))return c}return-1}};z.prototype={from:function(){return ac(this.anchor,this.head)},to:function(){return $b(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};Jb.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,
b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height;var f=e;f.parent=null;Td(f);T(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};Kb.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=
b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,e-a),g=d.height;d.removeInner(a,f);this.height-=g-d.height;e==f&&(this.children.splice(c--,1),d.parent=null);if(0==(b-=f))break;a=0}else a-=e}25>this.size-b&&(1<this.children.length||!(this.children[0]instanceof Jb))&&(c=[],this.collapse(c),this.children=[new Jb(c)],this.children[0].parent=this)},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,
b,c){this.size+=b.length;this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<=f){e.insertInner(a,b,c);if(e.lines&&50<e.lines.length){for(b=a=e.lines.length%25+25;b<e.lines.length;)c=new Jb(e.lines.slice(b,b+=25)),e.height-=c.height,this.children.splice(++d,0,c),c.parent=this;e.lines=e.lines.slice(0,a);this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new Kb(b);
if(a.parent){a.size-=b.size;a.height-=b.height;var c=J(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new Kb(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,c))return!0;if(0==(b-=f))break;a=0}else a-=f}}};Sa(Lb);Lb.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,
c=this.line,d=C(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=xb(this);ga(c,Math.max(0,c.height-f));a&&X(a,function(){var b=-f;ia(c)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&qc(a,null,b);xa(a,d,"widget")})}};Lb.prototype.changed=function(){var a=this.height,b=this.doc.cm,c=this.line;this.height=null;var d=xb(this)-a;d&&(ga(c,c.height+d),b&&X(b,function(){b.curOp.forceUpdate=!0;ia(c)<(b.curOp&&b.curOp.scrollTop||b.doc.scrollTop)&&qc(b,
null,d)}))};var jf=0;Sa(za);za.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&bb(a);if(aa(this,"clear")){var c=this.find();c&&T(this,"clear",c.from,c.to)}for(var d=c=null,e=0;e<this.lines.length;++e){var f=this.lines[e],g=qb(f.markedSpans,this);a&&!this.collapsed?xa(a,C(f),"text"):a&&(null!=g.to&&(d=C(f)),null!=g.from&&(c=C(f)));for(var h=f,k=void 0,l=f.markedSpans,m=g,n=0;n<l.length;++n)l[n]!=m&&(k||(k=[])).push(l[n]);h.markedSpans=k;null==g.from&&this.collapsed&&
!Ha(this.doc,f)&&a&&ga(f,La(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e)f=ha(this.lines[e]),g=cc(f),g>a.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=c&&a&&this.collapsed&&O(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Ze(a.doc));a&&T(a,"markerCleared",a,this);b&&cb(a);this.parent&&this.parent.clear()}};za.prototype.find=function(a,
b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=qb(f.markedSpans,this);if(null!=g.from&&(c=q(b?f:C(f),g.from),-1==a))return c;if(null!=g.to&&(d=q(b?f:C(f),g.to),1==a))return d}return c&&{from:c,to:d}};za.prototype.changed=function(){var a=this.find(-1,!0),b=this,c=this.doc.cm;a&&c&&X(c,function(){var d=a.line,e=C(a.line);if(e=jd(c,e))ve(e),c.curOp.selectionChanged=c.curOp.forceUpdate=!0;c.curOp.updateMaxLine=!0;Ha(b.doc,d)||null==b.height||(e=
b.height,b.height=null,(e=xb(b)-e)&&ga(d,d.height+e))})};za.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=J(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};za.prototype.detachLine=function(a){this.lines.splice(J(this.lines,a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};Sa(Mb);Mb.prototype.clear=
function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();T(this,"clear")}};Mb.prototype.find=function(a,b){return this.primary.find(a,b)};var Sg=0,Q=function(a,b,c,d){if(!(this instanceof Q))return new Q(a,b,c,d);null==c&&(c=0);Kb.call(this,[new Jb([new Va("",null)])]);this.first=c;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.frontier=c;c=q(c,0);this.sel=ta(c);this.history=new uc(null);this.id=++Sg;
this.modeOption=b;this.lineSep=d;this.extend=!1;"string"==typeof a&&(a=this.splitLines(a));Bd(this,{from:c,to:c,text:a});M(this,ta(c),ma)};Q.prototype=Pd(Kb.prototype,{constructor:Q,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=Nc(this,this.first,this.first+this.size);
return!1===a?b:b.join(a||this.lineSeparator())},setValue:L(function(a){var b=q(this.first,0),c=this.first+this.size-1;fb(this,{from:b,to:q(c,u(this,c).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0);M(this,ta(b))}),replaceRange:function(a,b,c,d){b=x(this,b);c=c?x(this,c):b;gb(this,a,b,c,d)},getRange:function(a,b,c){a=Ea(this,x(this,a),x(this,b));return!1===c?a:a.join(c||this.lineSeparator())},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(pb(this,
a))return u(this,a)},getLineNumber:function(a){return C(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=u(this,a));return ha(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return x(this,a)},getCursor:function(a){var b=this.sel.primary();return null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||!1===a?b.to():b.from()},listSelections:function(){return this.sel.ranges},
somethingSelected:function(){return this.sel.somethingSelected()},setCursor:L(function(a,b,c){a=x(this,"number"==typeof a?q(a,b||0):a);M(this,ta(a,null),c)}),setSelection:L(function(a,b,c){var d=x(this,a);a=x(this,b||a);M(this,ta(d,a),c)}),extendSelection:L(function(a,b,c){wc(this,x(this,a),b&&x(this,b),c)}),extendSelections:L(function(a,b){Ve(this,Rd(this,a),b)}),extendSelectionsBy:L(function(a,b){var c=Yb(this.sel.ranges,a);Ve(this,Rd(this,c),b)}),setSelections:L(function(a,b,c){if(a.length){for(var d=
[],e=0;e<a.length;e++)d[e]=new z(x(this,a[e].anchor),x(this,a[e].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));M(this,fa(d,b),c)}}),addSelection:L(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new z(x(this,a),x(this,b||a)));M(this,fa(d,d.length-1),c)}),getSelection:function(a){for(var b=this.sel.ranges,c,d=0;d<b.length;d++){var e=Ea(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return!1===a?c:c.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],c=this.sel.ranges,
d=0;d<c.length;d++){var e=Ea(this,c[d].from(),c[d].to());!1!==a&&(e=e.join(a||this.lineSeparator()));b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:L(function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:this.splitLines(a[f]),origin:c}}if(a=b&&"end"!=b){a=[];e=c=q(this.first,0);for(f=0;f<d.length;f++){var h=d[f],g=Oe(h.from,
c,e),k=Oe(ya(h),c,e);c=h.to;e=k;"around"==b?(h=this.sel.ranges[f],h=0>t(h.head,h.anchor),a[f]=new z(h?k:g,h?g:k)):a[f]=new z(g,g)}a=new sa(a,this.sel.primIndex)}b=a;for(a=d.length-1;0<=a;a--)fb(this,d[a]);b?We(this,b):this.cm&&ab(this.cm)}),undo:L(function(){yc(this,"undo")}),redo:L(function(){yc(this,"redo")}),undoSelection:L(function(){yc(this,"undo",!0)}),redoSelection:L(function(){yc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=
!0);return{right:c?d:0,bottom:b?d:0}};Ra.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)};Ra.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)};Ra.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=ga&&!Pg?"12px":"18px";this.horiz.style.pointerEvents=this.vert.style.pointerEvents=
"none";this.disableHoriz=new Ea;this.disableVert=new Ea};Ra.prototype.enableZeroWidthBar=function(a,b){function c(){var d=a.getBoundingClientRect();document.elementFromPoint(d.left+1,d.bottom-1)!=a?a.style.pointerEvents="none":b.set(1E3,c)}a.style.pointerEvents="auto";b.set(1E3,c)};Ra.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};var Tb=function(){};Tb.prototype.update=function(){return{bottom:0,right:0}};Tb.prototype.setScrollLeft=function(){};
Tb.prototype.setScrollTop=function(){};Tb.prototype.clear=function(){};var Je={"native":Ra,"null":Tb},jg=0,sc=function(a,b,c){var d=a.display;this.viewport=b;this.visible=ud(d,a.doc,b);this.editorIsHidden=!d.wrapper.offsetWidth;this.wrapperHeight=d.wrapper.clientHeight;this.wrapperWidth=d.wrapper.clientWidth;this.oldDisplayWidth=Ka(a);this.force=c;this.dims=kd(a);this.events=[]};sc.prototype.signal=function(a,b){da(a,b)&&this.events.push(arguments)};sc.prototype.finish=function(){for(var a=0;a<this.events.length;a++)I.apply(null,
this.events[a])};ua.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(0!=u(c.anchor,d.anchor)||0!=u(c.head,d.head))return!1}return!0},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new A(Pc(this.ranges[b].anchor),Pc(this.ranges[b].head));return new ua(a,this.primIndex)},somethingSelected:function(){for(var a=
0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(0<=u(b,d.from())&&0>=u(a,d.to()))return c}return-1}};A.prototype={from:function(){return ac(this.anchor,this.head)},to:function(){return $b(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};Kb.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,
b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height;var f=e;f.parent=null;Td(f);X(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};Lb.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=
b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,e-a),g=d.height;d.removeInner(a,f);this.height-=g-d.height;e==f&&(this.children.splice(c--,1),d.parent=null);if(0==(b-=f))break;a=0}else a-=e}25>this.size-b&&(1<this.children.length||!(this.children[0]instanceof Kb))&&(a=[],this.collapse(a),this.children=[new Kb(a)],this.children[0].parent=this)},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,
b,c){this.size+=b.length;this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<=f){e.insertInner(a,b,c);if(e.lines&&50<e.lines.length){for(b=a=e.lines.length%25+25;b<e.lines.length;)c=new Kb(e.lines.slice(b,b+=25)),e.height-=c.height,this.children.splice(++d,0,c),c.parent=this;e.lines=e.lines.slice(0,a);this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new Lb(b);
if(a.parent){a.size-=b.size;a.height-=b.height;var c=M(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new Lb(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,c))return!0;if(0==(b-=f))break;a=0}else a-=f}}};Ta(Mb);Mb.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,
c=this.line,d=C(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=yb(this);ja(c,Math.max(0,c.height-f));a&&aa(a,function(){var b=-f;la(c)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&qc(a,null,b);za(a,d,"widget")})}};Mb.prototype.changed=function(){var a=this.height,b=this.doc.cm,c=this.line;this.height=null;var d=yb(this)-a;d&&(ja(c,c.height+d),b&&aa(b,function(){b.curOp.forceUpdate=!0;la(c)<(b.curOp&&b.curOp.scrollTop||b.doc.scrollTop)&&
qc(b,null,d)}))};var jf=0;Ta(Ba);Ba.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&cb(a);if(da(this,"clear")){var c=this.find();c&&X(this,"clear",c.from,c.to)}for(var d=c=null,e=0;e<this.lines.length;++e){var f=this.lines[e],g=rb(f.markedSpans,this);a&&!this.collapsed?za(a,C(f),"text"):a&&(null!=g.to&&(d=C(f)),null!=g.from&&(c=C(f)));for(var h=f,k=void 0,l=f.markedSpans,m=g,n=0;n<l.length;++n)l[n]!=m&&(k||(k=[])).push(l[n]);h.markedSpans=k;null==g.from&&
this.collapsed&&!Ia(this.doc,f)&&a&&ja(f,Ma(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e)f=ka(this.lines[e]),g=cc(f),g>a.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=c&&a&&this.collapsed&&R(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Ze(a.doc));a&&X(a,"markerCleared",a,this);b&&db(a);this.parent&&this.parent.clear()}};Ba.prototype.find=
function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=rb(f.markedSpans,this);if(null!=g.from&&(c=q(b?f:C(f),g.from),-1==a))return c;if(null!=g.to&&(d=q(b?f:C(f),g.to),1==a))return d}return c&&{from:c,to:d}};Ba.prototype.changed=function(){var a=this.find(-1,!0),b=this,c=this.doc.cm;a&&c&&aa(c,function(){var d=a.line,e=C(a.line);if(e=jd(c,e))ve(e),c.curOp.selectionChanged=c.curOp.forceUpdate=!0;c.curOp.updateMaxLine=!0;Ia(b.doc,d)||null==
b.height||(e=b.height,b.height=null,(e=yb(b)-e)&&ja(d,d.height+e))})};Ba.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=M(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};Ba.prototype.detachLine=function(a){this.lines.splice(M(this.lines,a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};Ta(Nb);
Nb.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();X(this,"clear")}};Nb.prototype.find=function(a,b){return this.primary.find(a,b)};var Sg=0,T=function(a,b,c,d){if(!(this instanceof T))return new T(a,b,c,d);null==c&&(c=0);Lb.call(this,[new Kb([new Wa("",null)])]);this.first=c;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.frontier=c;c=q(c,0);this.sel=va(c);this.history=new uc(null);
this.id=++Sg;this.modeOption=b;this.lineSep=d;this.extend=!1;"string"==typeof a&&(a=this.splitLines(a));Bd(this,{from:c,to:c,text:a});P(this,va(c),pa)};T.prototype=Pd(Lb.prototype,{constructor:T,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=Nc(this,this.first,this.first+
this.size);return!1===a?b:b.join(a||this.lineSeparator())},setValue:O(function(a){var b=q(this.first,0),c=this.first+this.size-1;gb(this,{from:b,to:q(c,v(this,c).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0);P(this,va(b))}),replaceRange:function(a,b,c,d){b=z(this,b);c=c?z(this,c):b;hb(this,a,b,c,d)},getRange:function(a,b,c){a=Fa(this,z(this,a),z(this,b));return!1===c?a:a.join(c||this.lineSeparator())},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(qb(this,
a))return v(this,a)},getLineNumber:function(a){return C(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=v(this,a));return ka(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return z(this,a)},getCursor:function(a){var b=this.sel.primary();return null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||!1===a?b.to():b.from()},listSelections:function(){return this.sel.ranges},
somethingSelected:function(){return this.sel.somethingSelected()},setCursor:O(function(a,b,c){a=z(this,"number"==typeof a?q(a,b||0):a);P(this,va(a,null),c)}),setSelection:O(function(a,b,c){var d=z(this,a);a=z(this,b||a);P(this,va(d,a),c)}),extendSelection:O(function(a,b,c){wc(this,z(this,a),b&&z(this,b),c)}),extendSelections:O(function(a,b){Ve(this,Rd(this,a),b)}),extendSelectionsBy:O(function(a,b){a=Yb(this.sel.ranges,a);Ve(this,Rd(this,a),b)}),setSelections:O(function(a,b,c){if(a.length){for(var d=
[],e=0;e<a.length;e++)d[e]=new A(z(this,a[e].anchor),z(this,a[e].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));P(this,ia(d,b),c)}}),addSelection:O(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new A(z(this,a),z(this,b||a)));P(this,ia(d,d.length-1),c)}),getSelection:function(a){for(var b=this.sel.ranges,c,d=0;d<b.length;d++){var e=Fa(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return!1===a?c:c.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],c=this.sel.ranges,
d=0;d<c.length;d++){var e=Fa(this,c[d].from(),c[d].to());!1!==a&&(e=e.join(a||this.lineSeparator()));b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:O(function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:this.splitLines(a[f]),origin:c}}if(a=b&&"end"!=b){a=[];e=c=q(this.first,0);for(f=0;f<d.length;f++){var h=d[f],g=Oe(h.from,
c,e),k=Oe(Aa(h),c,e);c=h.to;e=k;"around"==b?(h=this.sel.ranges[f],h=0>u(h.head,h.anchor),a[f]=new A(h?k:g,h?g:k)):a[f]=new A(g,g)}a=new ua(a,this.sel.primIndex)}b=a;for(a=d.length-1;0<=a;a--)gb(this,d[a]);b?We(this,b):this.cm&&bb(this.cm)}),undo:O(function(){yc(this,"undo")}),redo:O(function(){yc(this,"redo")}),undoSelection:O(function(){yc(this,"undo",!0)}),redoSelection:O(function(){yc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=
this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new uc(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){a&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null);return this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},
getHistory:function(){return{done:db(this.history.done),undone:db(this.history.undone)}},setHistory:function(a){var b=this.history=new uc(this.history.maxGeneration);b.done=db(a.done.slice(0),null,!0);b.undone=db(a.undone.slice(0),null,!0)},setGutterMarker:L(function(a,b,c){return Ib(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});d[b]=c;!c&&Qd(d)&&(a.gutterMarkers=null);return!0})}),clearGutter:L(function(a){var b=this,c=this.first;this.iter(function(d){d.gutterMarkers&&d.gutterMarkers[a]&&
Ib(b,d,"gutter",function(){d.gutterMarkers[a]=null;Qd(d.gutterMarkers)&&(d.gutterMarkers=null);return!0});++c})}),lineInfo:function(a){var b;if("number"==typeof a){if(!pb(this,a))return null;b=a;a=u(this,a);if(!a)return null}else if(b=C(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},addLineClass:L(function(a,b,c){return Ib(this,a,"gutter"==b?"gutter":"class",function(a){var d=
"text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";if(a[d]){if(Ba(c).test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:L(function(a,b,c){return Ib(this,a,"gutter"==b?"gutter":"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",f=a[d];if(f)if(null==c)a[d]=null;else{var g=f.match(Ba(c));if(!g)return!1;var h=g.index+g[0].length;a[d]=f.slice(0,g.index)+(g.index&&h!=f.length?" ":"")+f.slice(h)||
null}else return!1;return!0})}),addLineWidget:L(function(a,b,c){return qg(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return hb(this,x(this,a),x(this,b),c,c&&c.type||"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};a=x(this,a);return hb(this,a,a,c,"bookmark")},findMarksAt:function(a){a=x(this,a);var b=[],c=u(this,a.line).markedSpans;
if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=x(this,a);b=x(this,b);var d=[],e=a.line;this.iter(a.line,b.line+1,function(f){if(f=f.markedSpans)for(var g=0;g<f.length;g++){var h=f[g];null!=h.to&&e==a.line&&a.ch>=h.to||null==h.from&&e!=a.line||null!=h.from&&e==b.line&&h.from>=b.ch||c&&!c(h.marker)||d.push(h.marker.parent||h.marker)}++e});return d},getAllMarks:function(){var a=
[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)null!=b[c].from&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,c=this.first,d=this.lineSeparator().length;this.iter(function(e){e=e.text.length+d;if(e>a)return b=a,!0;a-=e;++c});return x(this,q(c,b))},indexFromPos:function(a){a=x(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;var c=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+c});return b},copy:function(a){var b=
new Q(Nc(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<c&&(c=a.to);b=new Q(Nc(this,b,c),a.mode||this.modeOption,b,this.lineSep);a.sharedHist&&(b.history=this.history);(this.linked||
(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}];a=kf(this);for(c=0;c<a.length;c++){var d=a[c],e=d.find(),f=b.clipPos(e.from),e=b.clipPos(e.to);t(f,e)&&(f=hb(b,f,e,d.primary,d.primary.type),d.markers.push(f),f.parent=d)}return b},unlinkDoc:function(a){a instanceof E&&(a=a.doc);if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);sg(kf(this));break}if(a.history==this.history){var c=
[a.id];Oa(a,function(a){return c.push(a.id)},!0);a.history=new uc(null);a.history.done=db(this.history.done,c);a.history.undone=db(this.history.undone,c)}},iterLinkedDocs:function(a){Oa(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(a){return this.lineSep?a.split(this.lineSep):Md(a)},lineSeparator:function(){return this.lineSep||"\n"}});Q.prototype.eachLine=Q.prototype.iter;for(var mf=0,Bf=!1,Aa={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",
getHistory:function(){return{done:eb(this.history.done),undone:eb(this.history.undone)}},setHistory:function(a){var b=this.history=new uc(this.history.maxGeneration);b.done=eb(a.done.slice(0),null,!0);b.undone=eb(a.undone.slice(0),null,!0)},setGutterMarker:O(function(a,b,c){return Jb(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});d[b]=c;!c&&Qd(d)&&(a.gutterMarkers=null);return!0})}),clearGutter:O(function(a){var b=this,c=this.first;this.iter(function(d){d.gutterMarkers&&d.gutterMarkers[a]&&
Jb(b,d,"gutter",function(){d.gutterMarkers[a]=null;Qd(d.gutterMarkers)&&(d.gutterMarkers=null);return!0});++c})}),lineInfo:function(a){var b;if("number"==typeof a){if(!qb(this,a))return null;b=a;a=v(this,a);if(!a)return null}else if(b=C(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},addLineClass:O(function(a,b,c){return Jb(this,a,"gutter"==b?"gutter":"class",function(a){var d=
"text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";if(a[d]){if(y(c).test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:O(function(a,b,c){return Jb(this,a,"gutter"==b?"gutter":"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",f=a[d];if(f)if(null==c)a[d]=null;else{var g=f.match(y(c));if(!g)return!1;var h=g.index+g[0].length;a[d]=f.slice(0,g.index)+(g.index&&h!=f.length?" ":"")+f.slice(h)||
null}else return!1;return!0})}),addLineWidget:O(function(a,b,c){return qg(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return ib(this,z(this,a),z(this,b),c,c&&c.type||"range")},setBookmark:function(a,b){b={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};a=z(this,a);return ib(this,a,a,b,"bookmark")},findMarksAt:function(a){a=z(this,a);var b=[],c=v(this,a.line).markedSpans;
if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=z(this,a);b=z(this,b);var d=[],e=a.line;this.iter(a.line,b.line+1,function(f){if(f=f.markedSpans)for(var g=0;g<f.length;g++){var h=f[g];null!=h.to&&e==a.line&&a.ch>=h.to||null==h.from&&e!=a.line||null!=h.from&&e==b.line&&h.from>=b.ch||c&&!c(h.marker)||d.push(h.marker.parent||h.marker)}++e});return d},getAllMarks:function(){var a=
[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)null!=b[c].from&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,c=this.first,d=this.lineSeparator().length;this.iter(function(e){e=e.text.length+d;if(e>a)return b=a,!0;a-=e;++c});return z(this,q(c,b))},indexFromPos:function(a){a=z(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;var c=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+c});return b},copy:function(a){var b=
new T(Nc(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<c&&(c=a.to);b=new T(Nc(this,b,c),a.mode||this.modeOption,b,this.lineSep);a.sharedHist&&(b.history=this.history);(this.linked||
(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}];a=kf(this);for(c=0;c<a.length;c++){var d=a[c],e=d.find(),f=b.clipPos(e.from),e=b.clipPos(e.to);u(f,e)&&(f=ib(b,f,e,d.primary,d.primary.type),d.markers.push(f),f.parent=d)}return b},unlinkDoc:function(a){a instanceof G&&(a=a.doc);if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);sg(kf(this));break}if(a.history==this.history){var c=
[a.id];Pa(a,function(a){return c.push(a.id)},!0);a.history=new uc(null);a.history.done=eb(this.history.done,c);a.history.undone=eb(this.history.undone,c)}},iterLinkedDocs:function(a){Pa(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(a){return this.lineSep?a.split(this.lineSep):Md(a)},lineSeparator:function(){return this.lineSep||"\n"}});T.prototype.eachLine=T.prototype.iter;for(var mf=0,Bf=!1,Ca={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",
17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",
63302:"Insert"},Tb=0;10>Tb;Tb++)Aa[Tb+48]=Aa[Tb+96]=String(Tb);for(var Hc=65;90>=Hc;Hc++)Aa[Hc]=String.fromCharCode(Hc);for(var Ub=1;12>=Ub;Ub++)Aa[Ub+111]=Aa[Ub+63235]="F"+Ub;var Nb={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",
63302:"Insert"},Ub=0;10>Ub;Ub++)Ca[Ub+48]=Ca[Ub+96]=String(Ub);for(var Hc=65;90>=Hc;Hc++)Ca[Hc]=String.fromCharCode(Hc);for(var Vb=1;12>=Vb;Vb++)Ca[Vb+111]=Ca[Vb+63235]="F"+Vb;var Ob={basic:{Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",
Esc:"singleSelection"},pcDefault:{"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll",
"Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},emacsy:{"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars",
"Ctrl-O":"openLine"},macDefault:{"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace",
"Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]}};Nb["default"]=da?Nb.macDefault:Nb.pcDefault;var Bc={selectAll:af,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),ma)},killLine:function(a){return jb(a,function(b){if(b.empty()){var c=
u(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:q(b.head.line+1,0)}:{from:b.head,to:q(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return jb(a,function(b){return{from:q(b.from().line,0),to:x(a.doc,q(b.to().line+1,0))}})},delLineLeft:function(a){return jb(a,function(a){return{from:q(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return jb(a,function(b){var c=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,
top:c},"div"),to:b.from()}})},delWrappedLineRight:function(a){return jb(a,function(b){var c=a.charCoords(b.head,"div").top+5,c=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:c}})},undo:function(a){return a.undo()},redo:function(a){return a.redo()},undoSelection:function(a){return a.undoSelection()},redoSelection:function(a){return a.redoSelection()},goDocStart:function(a){return a.extendSelection(q(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(q(a.lastLine()))},
goLineStart:function(a){return a.extendSelectionsBy(function(b){return rf(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return sf(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){b=b.head.line;for(var c,d=u(a.doc,b);c=Ga(d,!1);)d=c.find(1,!0).line,b=null;c=(c=ba(d))?c[0].level%2?dc(d):ec(d):d.text.length;return q(null==b?C(d):b,c)},{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy(function(b){b=
a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div")},Rb)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},Rb)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5,c=a.coordsChar({left:0,top:c},"div");return c.ch<a.getLine(c.line).search(/\S/)?sf(a,b.head):c},Rb)},goLineUp:function(a){return a.moveV(-1,
"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"]}};Ob["default"]=ga?Ob.macDefault:Ob.pcDefault;var Bc={selectAll:af,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),pa)},killLine:function(a){return kb(a,function(b){if(b.empty()){var c=
v(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:q(b.head.line+1,0)}:{from:b.head,to:q(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return kb(a,function(b){return{from:q(b.from().line,0),to:z(a.doc,q(b.to().line+1,0))}})},delLineLeft:function(a){return kb(a,function(a){return{from:q(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return kb(a,function(b){var c=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,
top:c},"div"),to:b.from()}})},delWrappedLineRight:function(a){return kb(a,function(b){var c=a.charCoords(b.head,"div").top+5,c=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:c}})},undo:function(a){return a.undo()},redo:function(a){return a.redo()},undoSelection:function(a){return a.undoSelection()},redoSelection:function(a){return a.redoSelection()},goDocStart:function(a){return a.extendSelection(q(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(q(a.lastLine()))},
goLineStart:function(a){return a.extendSelectionsBy(function(b){return rf(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return sf(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){b=b.head.line;for(var c,d=v(a.doc,b);c=Ha(d,!1);)d=c.find(1,!0).line,b=null;c=(c=ea(d))?c[0].level%2?dc(d):ec(d):d.text.length;return q(null==b?C(d):b,c)},{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy(function(b){b=
a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div")},Sb)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},Sb)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5,c=a.coordsChar({left:0,top:c},"div");return c.ch<a.getLine(c.line).search(/\S/)?sf(a,b.head):c},Sb)},goLineUp:function(a){return a.moveV(-1,
"line")},goLineDown:function(a){return a.moveV(1,"line")},goPageUp:function(a){return a.moveV(-1,"page")},goPageDown:function(a){return a.moveV(1,"page")},goCharLeft:function(a){return a.moveH(-1,"char")},goCharRight:function(a){return a.moveH(1,"char")},goColumnLeft:function(a){return a.moveH(-1,"column")},goColumnRight:function(a){return a.moveH(1,"column")},goWordLeft:function(a){return a.moveH(-1,"word")},goGroupRight:function(a){return a.moveH(1,"group")},goGroupLeft:function(a){return a.moveH(-1,
"group")},goWordRight:function(a){return a.moveH(1,"word")},delCharBefore:function(a){return a.deleteH(-1,"char")},delCharAfter:function(a){return a.deleteH(1,"char")},delWordBefore:function(a){return a.deleteH(-1,"word")},delWordAfter:function(a){return a.deleteH(1,"word")},delGroupBefore:function(a){return a.deleteH(-1,"group")},delGroupAfter:function(a){return a.deleteH(1,"group")},indentAuto:function(a){return a.indentSelection("smart")},indentMore:function(a){return a.indentSelection("add")},
indentLess:function(a){return a.indentSelection("subtract")},insertTab:function(a){return a.replaceSelection("\t")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from(),f=Z(a.getLine(f.line),f.ch,d);b.push(Lc(d-f%d))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return X(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++)if(b[d].empty()){var e=
b[d].head,f=u(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new q(e.line,e.ch-1)),0<e.ch)e=new q(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),q(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=u(a.doc,e.line-1).text;g&&(e=new q(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),q(e.line-1,g.length-1),e,"+transpose"))}c.push(new z(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return X(a,function(){for(var b=a.listSelections(),
c=b.length-1;0<=c;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");b=a.listSelections();for(c=0;c<b.length;c++)a.indentLine(b[c].from().line,null,!0);ab(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},zg=new Da,Gd=null,Ec,Dc,kb={toString:function(){return"CodeMirror.Init"}},Af={},Fc={};E.defaults=Af;E.optionHandlers=Fc;var Kd=[];E.defineInitHook=function(a){return Kd.push(a)};var R=null,A=function(a){this.cm=
a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Da;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};A.prototype.init=function(a){function b(a){if(!H(e,a)){if(e.somethingSelected())R={lineWise:!1,text:e.getSelections()},"cut"==a.type&&e.replaceSelection("",null,"cut");else if(e.options.lineWiseCopyCut){var b=Ff(e);R={lineWise:!0,text:b.text};"cut"==a.type&&e.operation(function(){e.setSelections(b.ranges,0,ma);e.replaceSelection("",
null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var c=R.text.join("\n");a.clipboardData.setData("Text",c);if(a.clipboardData.getData("Text")==c){a.preventDefault();return}}var g=Hf();a=g.firstChild;e.display.lineSpace.insertBefore(g,e.display.lineSpace.firstChild);a.value=R.text.join("\n");var m=document.activeElement;mb(a);setTimeout(function(){e.display.lineSpace.removeChild(g);m.focus();m==f&&d.showPrimarySelection()},50)}}var c=this,d=this,e=d.cm,f=d.div=a.lineDiv;Gf(f,
e.options.spellcheck);w(f,"paste",function(a){H(e,a)||Ef(a,e)||11>=D&&setTimeout(I(e,function(){d.pollContent()||O(e)}),20)});w(f,"compositionstart",function(a){c.composing={data:a.data,done:!1}});w(f,"compositionupdate",function(a){c.composing||(c.composing={data:a.data,done:!1})});w(f,"compositionend",function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)});w(f,"touchstart",function(){return d.forceCompositionEnd()});w(f,"input",function(){c.composing||c.readFromDOMSoon()});
w(f,"copy",b);w(f,"cut",b)};A.prototype.prepareSelection=function(){var a=Ae(this.cm,!1);a.focus=this.cm.state.focused;return a};A.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};A.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm.doc.sel.primary(),c=Gc(this.cm,a.anchorNode,a.anchorOffset),d=Gc(this.cm,a.focusNode,a.focusOffset);if(!c||c.bad||!d||d.bad||0!=t(ac(c,d),b.from())||
0!=t($b(c,d),b.to()))if(c=Jf(this.cm,b.from()),d=Jf(this.cm,b.to()),c||d){var e=this.cm.display.view,b=a.rangeCount&&a.getRangeAt(0);c?d||(d=e[e.length-1].measure,d=d.maps?d.maps[d.maps.length-1]:d.map,d={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}):c={node:e[0].measure.map[2],offset:0};var f;try{f=Wa(c.node,c.offset,d.offset,d.node)}catch(g){}f&&(!ua&&this.cm.state.focused?(a.collapse(c.node,c.offset),f.collapsed||(a.removeAllRanges(),a.addRange(f))):(a.removeAllRanges(),a.addRange(f)),
b&&null==a.anchorNode?a.addRange(b):ua&&this.startGracePeriod());this.rememberSelection()}};A.prototype.startGracePeriod=function(){var a=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){a.gracePeriod=!1;a.selectionChanged()&&a.cm.operation(function(){return a.cm.curOp.selectionChanged=!0})},20)};A.prototype.showMultipleSelections=function(a){V(this.cm.display.cursorDiv,a.cursors);V(this.cm.display.selectionDiv,a.selection)};A.prototype.rememberSelection=function(){var a=
window.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};A.prototype.selectionInEditor=function(){var a=window.getSelection();if(!a.rangeCount)return!1;a=a.getRangeAt(0).commonAncestorContainer;return Wb(this.div,a)};A.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())};A.prototype.blur=function(){this.div.blur()};
A.prototype.getField=function(){return this.div};A.prototype.supportsTouch=function(){return!0};A.prototype.receivedFocus=function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():X(this.cm,function(){return b.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,a)};A.prototype.selectionChanged=function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||
a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};A.prototype.pollSelection=function(){if(!this.composing&&null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;this.rememberSelection();var c=Gc(b,a.anchorNode,a.anchorOffset),d=Gc(b,a.focusNode,a.focusOffset);c&&d&&X(b,function(){M(b.doc,ta(c,d),ma);if(c.bad||d.bad)b.curOp.selectionChanged=!0})}};A.prototype.pollContent=function(){null!=
this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),c=c.to();0==d.ch&&d.line>a.firstLine()&&(d=q(d.line-1,u(a.doc,d.line-1).length));c.ch==u(a.doc,c.line).text.length&&c.line<a.lastLine()&&(c=q(c.line+1,0));if(d.line<b.viewFrom||c.line>b.viewTo-1)return!1;var e;d.line==b.viewFrom||0==(e=Ka(a,d.line))?(d=C(b.view[0].line),e=b.view[0].node):(d=C(b.view[e].line),e=b.view[e-1].node.nextSibling);var f=Ka(a,c.line);
f==b.view.length-1?(c=b.viewTo-1,b=b.lineDiv.lastChild):(c=C(b.view[f+1].line)-1,b=b.view[f+1].node.previousSibling);if(!e)return!1;b=a.doc.splitLines(Lg(a,e,b,d,c));for(e=Ea(a.doc,q(d,0),q(c,u(a.doc,c).text.length));1<b.length&&1<e.length;)if(y(b)==y(e))b.pop(),e.pop(),c--;else if(b[0]==e[0])b.shift(),e.shift(),d++;else break;for(var g=0,f=0,h=b[0],k=e[0],l=Math.min(h.length,k.length);g<l&&h.charCodeAt(g)==k.charCodeAt(g);)++g;h=y(b);k=y(e);for(l=Math.min(h.length-(1==b.length?g:0),k.length-(1==
e.length?g:0));f<l&&h.charCodeAt(h.length-f-1)==k.charCodeAt(k.length-f-1);)++f;b[b.length-1]=h.slice(0,h.length-f).replace(/^\u200b+/,"");b[0]=b[0].slice(g).replace(/\u200b+$/,"");d=q(d,g);c=q(c,e.length?y(e).length-f:0);if(1<b.length||b[0]||t(d,c))return gb(a.doc,b,d,c,"+input"),!0};A.prototype.ensurePolled=function(){this.forceCompositionEnd()};A.prototype.reset=function(){this.forceCompositionEnd()};A.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),
this.composing=null,this.pollContent()||O(this.cm),this.div.blur(),this.div.focus())};A.prototype.readFromDOMSoon=function(){var a=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){a.readDOMTimeout=null;if(a.composing)if(a.composing.done)a.composing=null;else return;!a.cm.isReadOnly()&&a.pollContent()||X(a.cm,function(){return O(a.cm)})},80))};A.prototype.setUneditable=function(a){a.contentEditable="false"};A.prototype.onKeyPress=function(a){a.preventDefault();this.cm.isReadOnly()||
I(this.cm,Ld)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0)};A.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)};A.prototype.onContextMenu=function(){};A.prototype.resetPosition=function(){};A.prototype.needsContentAttribute=!0;var G=function(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=new Da;this.hasSelection=this.inaccurateSelection=!1;this.composing=null};G.prototype.init=function(a){function b(a){if(!H(e,a)){if(e.somethingSelected())R=
{lineWise:!1,text:e.getSelections()},d.inaccurateSelection&&(d.prevInput="",d.inaccurateSelection=!1,g.value=R.text.join("\n"),mb(g));else if(e.options.lineWiseCopyCut){var b=Ff(e);R={lineWise:!0,text:b.text};"cut"==a.type?e.setSelections(b.ranges,null,ma):(d.prevInput="",g.value=b.text.join("\n"),mb(g))}else return;"cut"==a.type&&(e.state.cutIncoming=!0)}}var c=this,d=this,e=this.cm,f=this.wrapper=Hf(),g=this.textarea=f.firstChild;a.wrapper.insertBefore(f,a.wrapper.firstChild);Qb&&(g.style.width=
"0px");w(g,"input",function(){B&&9<=D&&c.hasSelection&&(c.hasSelection=null);d.poll()});w(g,"paste",function(a){H(e,a)||Ef(a,e)||(e.state.pasteIncoming=!0,d.fastPoll())});w(g,"cut",b);w(g,"copy",b);w(a.scroller,"paste",function(b){qa(a,b)||H(e,b)||(e.state.pasteIncoming=!0,d.focus())});w(a.lineSpace,"selectstart",function(b){qa(a,b)||N(b)});w(g,"compositionstart",function(){var a=e.getCursor("from");d.composing&&d.composing.range.clear();d.composing={start:a,range:e.markText(a,e.getCursor("to"),{className:"CodeMirror-composing"})}});
w(g,"compositionend",function(){d.composing&&(d.poll(),d.composing.range.clear(),d.composing=null)})};G.prototype.prepareSelection=function(){var a=this.cm,b=a.display,c=a.doc,d=Ae(a);if(a.options.moveInputWithCursor){var a=ra(a,c.sel.primary().head,"div"),c=b.wrapper.getBoundingClientRect(),e=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-c.top));d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+e.left-c.left))}return d};G.prototype.showSelection=
function(a){var b=this.cm.display;V(b.cursorDiv,a.cursors);V(b.selectionDiv,a.selection);null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")};G.prototype.reset=function(a){if(!this.contextMenuPending){var b,c,d=this.cm,e=d.doc;d.somethingSelected()?(this.prevInput="",b=e.sel.primary(),c=(b=vf&&(100<b.to().line-b.from().line||1E3<(c=d.getSelection()).length))?"-":c||d.getSelection(),this.textarea.value=c,d.state.focused&&mb(this.textarea),B&&9<=D&&(this.hasSelection=
c)):a||(this.prevInput=this.textarea.value="",B&&9<=D&&(this.hasSelection=null));this.inaccurateSelection=b}};G.prototype.getField=function(){return this.textarea};G.prototype.supportsTouch=function(){return!1};G.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!ob||na()!=this.textarea))try{this.textarea.focus()}catch(a){}};G.prototype.blur=function(){this.textarea.blur()};G.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};G.prototype.receivedFocus=
function(){this.slowPoll()};G.prototype.slowPoll=function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){a.poll();a.cm.state.focused&&a.slowPoll()})};G.prototype.fastPoll=function(){function a(){c.poll()||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0;c.polling.set(20,a)};G.prototype.poll=function(){var a=this,b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||Rg(c)&&!d&&!this.composing||
b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=c.value;if(e==d&&!b.somethingSelected())return!1;if(B&&9<=D&&this.hasSelection===e||da&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);8203!=f||d||(d="\u200b");if(8666==f)return this.reset(),this.cm.execCommand("undo")}for(var g=0,f=Math.min(d.length,e.length);g<f&&d.charCodeAt(g)==e.charCodeAt(g);)++g;X(b,function(){Ld(b,e.slice(g),d.length-g,null,a.composing?
"*compose":null);1E3<e.length||-1<e.indexOf("\n")?c.value=a.prevInput="":a.prevInput=e;a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))});return!0};G.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};G.prototype.onKeyPress=function(){B&&9<=D&&(this.hasSelection=null);this.fastPoll()};G.prototype.onContextMenu=function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),
b="\u200b"+(a?g.value:"");g.value="\u21da";g.value=b;d.prevInput=a?"":"\u200b";g.selectionStart=1;g.selectionEnd=b.length;f.selForContextMenu=e.doc.sel}}function c(){d.contextMenuPending=!1;d.wrapper.style.cssText=m;g.style.cssText=l;B&&9>D&&f.scrollbars.setScrollTop(f.scroller.scrollTop=k);if(null!=g.selectionStart){(!B||B&&9>D)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&0<g.selectionEnd&&"\u200b"==d.prevInput?I(e,af)(e):10>a++?f.detectingSelectAll=setTimeout(c,
500):f.input.reset()};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=Na(e,a),k=f.scroller.scrollTop;if(h&&!ea){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(h)&&I(e,M)(e.doc,ta(h),ma);var l=g.style.cssText,m=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";h=d.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(a.clientY-h.top-5)+"px; left: "+(a.clientX-h.left-5)+"px;\n z-index: 1000; background: "+
(B?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var n;K&&(n=window.scrollY);f.input.focus();K&&window.scrollTo(null,n);f.input.reset();e.somethingSelected()||(g.value=d.prevInput=" ");d.contextMenuPending=!0;f.selForContextMenu=e.doc.sel;clearTimeout(f.detectingSelectAll);B&&9<=D&&b();if(Id){sb(a);var p=function(){ca(window,"mouseup",p);setTimeout(c,20)};w(window,"mouseup",p)}else setTimeout(c,
50)}};G.prototype.readOnlyChanged=function(a){a||this.reset()};G.prototype.setUneditable=function(){};G.prototype.needsContentAttribute=!1;(function(a){function b(b,e,f,g){a.defaults[b]=e;f&&(c[b]=g?function(a,b,d){d!=kb&&f(a,b,d)}:f)}var c=a.optionHandlers;a.defineOption=b;a.Init=kb;b("value","",function(a,b){return a.setValue(b)},!0);b("mode",null,function(a,b){a.doc.modeOption=b;Ad(a)},!0);b("indentUnit",2,Ad,!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(a){Fb(a);zb(a);
O(a)},!0);b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b){var d=[],c=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(-1==f)break;e=f+b.length;d.push(q(c,f))}c++});for(var e=d.length-1;0<=e;e--)gb(a.doc,b,d[e],q(d[e].line,d[e].ch+b.length))}});b("specialChars",/[\u0000-\u001f\u007f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g");c!=kb&&a.refresh()});b("specialCharPlaceholder",
bg,function(a){return a.refresh()},!0);b("electricChars",!0);b("inputStyle",ob?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor");},!0);b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0);b("rtlMoveVisually",!Qg);b("wholeLineUpdateBefore",!0);b("theme","default",function(a){zf(a);Ob(a)},!0);b("keyMap","default",function(a,b,c){b=zc(b);(c=c!=kb&&zc(c))&&c.detach&&c.detach(a,b);b.attach&&b.attach(a,c||null)});b("extraKeys",
null);b("lineWrapping",!1,Jg,!0);b("gutters",[],function(a){yd(a.options);Ob(a)},!0);b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?od(a.display)+"px":"0";a.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(a){return $a(a)},!0);b("scrollbarStyle","native",function(a){Ie(a);$a(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0);b("lineNumbers",!1,function(a){yd(a.options);Ob(a)},!0);b("firstLineNumber",1,Ob,!0);b("lineNumberFormatter",
function(a){return a},Ob,!0);b("showCursorWhenSelecting",!1,Ab,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("readOnly",!1,function(a,b){"nocursor"==b?(Bb(a),a.display.input.blur(),a.display.disabled=!0):a.display.disabled=!1;a.display.input.readOnlyChanged(b)});b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0);b("dragDrop",!0,Ig);b("allowDropFileTypes",null);b("cursorBlinkRate",530);b("cursorScrollMargin",0);b("cursorHeight",1,Ab,!0);b("singleCursorHeightPerLine",
!0,Ab,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,Fb,!0);b("addModeClass",!1,Fb,!0);b("pollInterval",100);b("undoDepth",200,function(a,b){return a.doc.history.undoDepth=b});b("historyEventDelay",1250);b("viewportMargin",10,function(a){return a.refresh()},!0);b("maxHighlightLength",1E4,Fb,!0);b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()});b("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""});b("autofocus",null)})(E);(function(a){var b=
a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(a,c){var d=this.options,e=d[a];if(d[a]!=c||"mode"==a)d[a]=c,b.hasOwnProperty(a)&&I(this,b[a])(this,c,e),F(this,"optionChange",this,a)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](zc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,d=0;d<b.length;++d)if(b[d]==
a||b[d].name==a)return b.splice(d,1),!0},addOverlay:P(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw Error("Overlays may not be stateful.");Nf(this.state.overlays,{mode:d,modeSpec:b,opaque:c&&c.opaque,priority:c&&c.priority||0},function(a){return a.priority});this.state.modeGen++;O(this)}),removeOverlay:P(function(a){for(var b=this.state.overlays,d=0;d<b.length;++d){var c=b[d].modeSpec;if(c==a||"string"==typeof a&&c.name==a){b.splice(d,1);this.state.modeGen++;O(this);
break}}}),indentLine:P(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");pb(this.doc,a)&&Pb(this,a,b,c)}),indentSelection:P(function(a){for(var b=this.doc.sel.ranges,d=-1,c=0;c<b.length;c++){var h=b[c];if(h.empty())h.head.line>d&&(Pb(this,h.head.line,a,!0),d=h.head.line,c==this.doc.sel.primIndex&&ab(this));else{for(var k=h.from(),h=h.to(),l=Math.max(d,k.line),d=Math.min(this.lastLine(),h.line-(h.ch?0:1))+1,h=l;h<d;++h)Pb(this,
h,a);h=this.doc.sel.ranges;0==k.ch&&b.length==h.length&&0<h[c].from().ch&&Dd(this.doc,c,new z(k,h[c].to()),ma)}}}),getTokenAt:function(a,b){return ge(this,a,b)},getLineTokens:function(a,b){return ge(this,q(a),b,!0)},getTokenTypeAt:function(a){a=x(this.doc,a);var b=ee(this,u(this.doc,a.line)),c=0,d=(b.length-1)/2;a=a.ch;if(0==a)b=b[2];else for(;;){var h=c+d>>1;if((h?b[2*h-1]:0)>=a)d=h;else if(b[2*h+1]<a)c=h+1;else{b=b[2*h+2];break}}c=b?b.indexOf("overlay "):-1;return 0>c?b:0==c?null:b.slice(0,c-1)},
getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var d=[];if(!c.hasOwnProperty(b))return d;var e=c[b],h=this.getModeAt(a);if("string"==typeof h[b])e[h[b]]&&d.push(e[h[b]]);else if(h[b])for(var k=0;k<h[b].length;k++){var l=e[h[b][k]];l&&d.push(l)}else h.helperType&&e[h.helperType]?d.push(e[h.helperType]):e[h.name]&&d.push(e[h.name]);for(k=0;k<e._global.length;k++)l=
e._global[k],l.pred(h,this)&&-1==J(d,l.val)&&d.push(l.val);return d},getStateAfter:function(a,b){var c=this.doc;a=Math.max(c.first,Math.min(null==a?c.first+c.size-1:a,c.first+c.size-1));return tb(this,a+1,b)},cursorCoords:function(a,b){var c;c=this.doc.sel.primary();c=null==a?c.head:"object"==typeof a?x(this.doc,a):a?c.from():c.to();return ra(this,c,b||"page")},charCoords:function(a,b){return lc(this,x(this.doc,a),b||"page")},coordsChar:function(a,b){a=xe(this,a,b||"page");return nd(this,a.left,a.top)},
lineAtHeight:function(a,b){a=xe(this,{top:a,left:0},b||"page").top;return Fa(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,c){var d=!1;if("number"==typeof a){var e=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>e&&(a=e,d=!0);a=u(this.doc,a)}return md(this,a,{top:0,left:0},b||"page",c).top+(d?this.doc.height-ia(a):0)},defaultTextHeight:function(){return La(this.display)},defaultCharWidth:function(){return yb(this.display)},getViewport:function(){return{from:this.display.viewFrom,
to:this.display.viewTo}},addWidget:function(a,b,c,g,h){var d=this.display;a=ra(this,x(this.doc,a));var e=a.bottom,f=a.left;b.style.position="absolute";b.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(b);d.sizer.appendChild(b);if("over"==g)e=a.top;else if("above"==g||"near"==g){var n=Math.max(d.wrapper.clientHeight,this.doc.height),p=Math.max(d.sizer.clientWidth,d.lineSpace.clientWidth);("above"==g||a.bottom+b.offsetHeight>n)&&a.top>b.offsetHeight?e=a.top-b.offsetHeight:a.bottom+
b.offsetHeight<=n&&(e=a.bottom);f+b.offsetWidth>p&&(f=p-b.offsetWidth)}b.style.top=e+"px";b.style.left=b.style.right="";"right"==h?(f=d.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==h?f=0:"middle"==h&&(f=(d.sizer.clientWidth-b.offsetWidth)/2),b.style.left=f+"px");c&&(a=pc(this,f,e,f+b.offsetWidth,e+b.offsetHeight),null!=a.scrollTop&&Cb(this,a.scrollTop),null!=a.scrollLeft&&Za(this,a.scrollLeft))},triggerOnKeyDown:P(uf),triggerOnKeyPress:P(xf),triggerOnKeyUp:wf,execCommand:function(a){if(Bc.hasOwnProperty(a))return Bc[a].call(null,
this)},triggerElectric:P(function(a){Df(this,a)}),findPosH:function(a,b,c,g){var d=1;0>b&&(d=-1,b=-b);a=x(this.doc,a);for(var e=0;e<b&&(a=Nd(this.doc,a,d,c,g),!a.hitSide);++e);return a},moveH:P(function(a,b){var c=this;this.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Nd(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},Rb)}),deleteH:P(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):jb(this,function(d){var e=
Nd(c,d.head,a,b,!1);return 0>a?{from:e,to:d.head}:{from:d.head,to:e}})}),findPosV:function(a,b,c,g){var d=1;0>b&&(d=-1,b=-b);var e=x(this.doc,a);for(a=0;a<b&&(e=ra(this,e,"div"),null==g?g=e.left:e.left=g,e=If(this,e,d,c),!e.hitSide);++a);return e},moveV:P(function(a,b){var c=this,d=this.doc,e=[],k=!this.display.shift&&!d.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(f){if(k)return 0>a?f.from():f.to();var g=ra(c,f.head,"div");null!=f.goalColumn&&(g.left=f.goalColumn);e.push(g.left);
var h=If(c,g,a,b);"page"==b&&f==d.sel.primary()&&qc(c,null,lc(c,h,"div").top-g.top);return h},Rb);if(e.length)for(var l=0;l<d.sel.ranges.length;l++)d.sel.ranges[l].goalColumn=e[l]}),findWordAt:function(a){var b=u(this.doc,a.line).text,c=a.ch,d=a.ch;if(b){var h=this.getHelper(a,"wordChars");(0>a.xRel||d==b.length)&&c?--c:++d;for(var k=b.charAt(c),k=Zb(k,h)?function(a){return Zb(a,h)}:/\s/.test(k)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!Zb(a)};0<c&&k(b.charAt(c-1));)--c;for(;d<
b.length&&k(b.charAt(d));)++d}return new z(q(a.line,c),q(a.line,d))},toggleOverwrite:function(a){if(null==a||a!=this.state.overwrite)(this.state.overwrite=!this.state.overwrite)?Ra(this.display.cursorDiv,"CodeMirror-overwrite"):Ya(this.display.cursorDiv,"CodeMirror-overwrite"),F(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==na()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:P(function(a,b){null==
a&&null==b||rc(this);null!=a&&(this.curOp.scrollLeft=a);null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-la(this)-this.display.barHeight,width:a.scrollWidth-la(this)-this.display.barWidth,clientHeight:id(this),clientWidth:Ja(this)}},scrollIntoView:P(function(a,b){null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:q(a,0),
to:null}:null==a.from&&(a={from:a,to:null});a.to||(a.to=a.from);a.margin=b||0;if(null!=a.from.line)rc(this),this.curOp.scrollToPos=a;else{var c=pc(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin);this.scrollTo(c.scrollLeft,c.scrollTop)}}),setSize:P(function(a,b){var c=this,d=function(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a};null!=a&&(this.display.wrapper.style.width=d(a));
null!=b&&(this.display.wrapper.style.height=d(b));this.options.lineWrapping&&we(this);var e=this.display.viewFrom;this.doc.iter(e,this.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){xa(c,e,"widget");break}++e});this.curOp.forceUpdate=!0;F(this,"refresh",this)}),operation:function(a){return X(this,a)},refresh:P(function(){var a=this.display.cachedTextHeight;O(this);this.curOp.forceUpdate=!0;zb(this);this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop);
td(this);(null==a||.5<Math.abs(a-La(this.display)))&&pd(this);F(this,"refresh",this)}),swapDoc:P(function(a){var b=this.doc;b.cm=null;Qe(this,a);zb(this);this.display.input.reset();this.scrollTo(a.scrollLeft,a.scrollTop);this.curOp.forceScroll=!0;T(this,"swapDoc",this,b);return b}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};
Sa(a);a.registerHelper=function(b,e,f){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]});c[b][e]=f};a.registerGlobalHelper=function(b,e,f,g){a.registerHelper(b,e,g);c[b]._global.push({pred:f,val:g})}})(E);var Tg="iter insert remove copy getEditor constructor".split(" "),Vb;for(Vb in Q.prototype)Q.prototype.hasOwnProperty(Vb)&&0>J(Tg,Vb)&&(E.prototype[Vb]=function(a){return function(){return a.apply(this.doc,arguments)}}(Q.prototype[Vb]));Sa(Q);E.inputStyles={textarea:G,contenteditable:A};E.defineMode=
function(a){E.defaults.mode||"null"==a||(E.defaults.mode=a);Vf.apply(this,arguments)};E.defineMIME=function(a,b){Ta[a]=b};E.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}});E.defineMIME("text/plain","null");E.defineExtension=function(a,b){E.prototype[a]=b};E.defineDocExtension=function(a,b){Q.prototype[a]=b};E.fromTextArea=function(a,b){function c(){a.value=h.getValue()}b=b?Ca(b):{};b.value=a.value;!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex);!b.placeholder&&a.placeholder&&
(b.placeholder=a.placeholder);if(null==b.autofocus){var d=na();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}var e;if(a.form&&(w(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var f=a.form;e=f.submit;try{var g=f.submit=function(){c();f.submit=e;f.submit();f.submit=g}}catch(k){}}b.finishInit=function(b){b.save=c;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;c();a.parentNode.removeChild(b.getWrapperElement());a.style.display="";a.form&&(ca(a.form,
"submit",c),"function"==typeof a.form.submit&&(a.form.submit=e))}};a.style.display="none";var h=E(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return h};(function(a){a.off=ca;a.on=w;a.wheelEventPixels=ig;a.Doc=Q;a.splitLines=Md;a.countColumn=Z;a.findColumn=Kc;a.isWordChar=Mc;a.Pass=Fd;a.signal=F;a.Line=Va;a.changeEnd=ya;a.scrollbarModel=Je;a.Pos=q;a.cmpPos=t;a.modes=$c;a.mimeModes=Ta;a.resolveMode=hc;a.getMode=ad;a.modeExtensions=Ua;a.extendMode=Wf;a.copyState=oa;a.startState=
be;a.innerMode=bd;a.commands=Bc;a.keyMap=Nb;a.keyName=pf;a.isModifierKey=of;a.lookupKey=ib;a.normalizeKeyMap=xg;a.StringStream=ub;a.SharedTextMarker=Mb;a.TextMarker=za;a.LineWidget=Lb;a.e_preventDefault=N;a.e_stopPropagation=$d;a.e_stop=sb;a.addClass=Ra;a.contains=Wb;a.rmClass=Ya;a.keyNames=Aa})(E);E.version="5.22.2";return E});
indentLess:function(a){return a.indentSelection("subtract")},insertTab:function(a){return a.replaceSelection("\t")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from(),f=ca(a.getLine(f.line),f.ch,d);b.push(Lc(d-f%d))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return aa(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++)if(b[d].empty()){var e=
b[d].head,f=v(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new q(e.line,e.ch-1)),0<e.ch)e=new q(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),q(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=v(a.doc,e.line-1).text;g&&(e=new q(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),q(e.line-1,g.length-1),e,"+transpose"))}c.push(new A(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return aa(a,function(){for(var b=a.listSelections(),
c=b.length-1;0<=c;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");b=a.listSelections();for(c=0;c<b.length;c++)a.indentLine(b[c].from().line,null,!0);bb(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},zg=new Ea,Gd=null,Ec,Dc,lb={toString:function(){return"CodeMirror.Init"}},Af={},Fc={};G.defaults=Af;G.optionHandlers=Fc;var Kd=[];G.defineInitHook=function(a){return Kd.push(a)};var U=null,E=function(a){this.cm=
a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Ea;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};E.prototype.init=function(a){function b(a){if(!K(e,a)){if(e.somethingSelected())U={lineWise:!1,text:e.getSelections()},"cut"==a.type&&e.replaceSelection("",null,"cut");else if(e.options.lineWiseCopyCut){var b=Ff(e);U={lineWise:!0,text:b.text};"cut"==a.type&&e.operation(function(){e.setSelections(b.ranges,0,pa);e.replaceSelection("",
null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var c=U.text.join("\n");a.clipboardData.setData("Text",c);if(a.clipboardData.getData("Text")==c){a.preventDefault();return}}var g=Hf();a=g.firstChild;e.display.lineSpace.insertBefore(g,e.display.lineSpace.firstChild);a.value=U.text.join("\n");var m=document.activeElement;nb(a);setTimeout(function(){e.display.lineSpace.removeChild(g);m.focus();m==f&&d.showPrimarySelection()},50)}}var c=this,d=this,e=d.cm,f=d.div=a.lineDiv;Gf(f,
e.options.spellcheck);w(f,"paste",function(a){K(e,a)||Ef(a,e)||11>=F&&setTimeout(L(e,function(){d.pollContent()||R(e)}),20)});w(f,"compositionstart",function(a){c.composing={data:a.data,done:!1}});w(f,"compositionupdate",function(a){c.composing||(c.composing={data:a.data,done:!1})});w(f,"compositionend",function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)});w(f,"touchstart",function(){return d.forceCompositionEnd()});w(f,"input",function(){c.composing||c.readFromDOMSoon()});
w(f,"copy",b);w(f,"cut",b)};E.prototype.prepareSelection=function(){var a=Ae(this.cm,!1);a.focus=this.cm.state.focused;return a};E.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};E.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm.doc.sel.primary(),c=Gc(this.cm,a.anchorNode,a.anchorOffset),d=Gc(this.cm,a.focusNode,a.focusOffset);if(!c||c.bad||!d||d.bad||0!=u(ac(c,d),b.from())||
0!=u($b(c,d),b.to()))if(c=Jf(this.cm,b.from()),d=Jf(this.cm,b.to()),c||d){var e=this.cm.display.view,b=a.rangeCount&&a.getRangeAt(0);c?d||(d=e[e.length-1].measure,d=d.maps?d.maps[d.maps.length-1]:d.map,d={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}):c={node:e[0].measure.map[2],offset:0};var f;try{f=Xa(c.node,c.offset,d.offset,d.node)}catch(g){}f&&(!wa&&this.cm.state.focused?(a.collapse(c.node,c.offset),f.collapsed||(a.removeAllRanges(),a.addRange(f))):(a.removeAllRanges(),a.addRange(f)),
b&&null==a.anchorNode?a.addRange(b):wa&&this.startGracePeriod());this.rememberSelection()}};E.prototype.startGracePeriod=function(){var a=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){a.gracePeriod=!1;a.selectionChanged()&&a.cm.operation(function(){return a.cm.curOp.selectionChanged=!0})},20)};E.prototype.showMultipleSelections=function(a){D(this.cm.display.cursorDiv,a.cursors);D(this.cm.display.selectionDiv,a.selection)};E.prototype.rememberSelection=function(){var a=
window.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};E.prototype.selectionInEditor=function(){var a=window.getSelection();if(!a.rangeCount)return!1;a=a.getRangeAt(0).commonAncestorContainer;return V(this.div,a)};E.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())};E.prototype.blur=function(){this.div.blur()};
E.prototype.getField=function(){return this.div};E.prototype.supportsTouch=function(){return!0};E.prototype.receivedFocus=function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():aa(this.cm,function(){return b.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,a)};E.prototype.selectionChanged=function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||
a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};E.prototype.pollSelection=function(){if(!this.composing&&null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;this.rememberSelection();var c=Gc(b,a.anchorNode,a.anchorOffset),d=Gc(b,a.focusNode,a.focusOffset);c&&d&&aa(b,function(){P(b.doc,va(c,d),pa);if(c.bad||d.bad)b.curOp.selectionChanged=!0})}};E.prototype.pollContent=function(){null!=
this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),c=c.to();0==d.ch&&d.line>a.firstLine()&&(d=q(d.line-1,v(a.doc,d.line-1).length));c.ch==v(a.doc,c.line).text.length&&c.line<a.lastLine()&&(c=q(c.line+1,0));if(d.line<b.viewFrom||c.line>b.viewTo-1)return!1;var e;d.line==b.viewFrom||0==(e=La(a,d.line))?(d=C(b.view[0].line),e=b.view[0].node):(d=C(b.view[e].line),e=b.view[e-1].node.nextSibling);var f=La(a,c.line);
f==b.view.length-1?(c=b.viewTo-1,b=b.lineDiv.lastChild):(c=C(b.view[f+1].line)-1,b=b.view[f+1].node.previousSibling);if(!e)return!1;b=a.doc.splitLines(Lg(a,e,b,d,c));for(e=Fa(a.doc,q(d,0),q(c,v(a.doc,c).text.length));1<b.length&&1<e.length;)if(x(b)==x(e))b.pop(),e.pop(),c--;else if(b[0]==e[0])b.shift(),e.shift(),d++;else break;for(var g=0,f=0,h=b[0],k=e[0],l=Math.min(h.length,k.length);g<l&&h.charCodeAt(g)==k.charCodeAt(g);)++g;h=x(b);k=x(e);for(l=Math.min(h.length-(1==b.length?g:0),k.length-(1==
e.length?g:0));f<l&&h.charCodeAt(h.length-f-1)==k.charCodeAt(k.length-f-1);)++f;b[b.length-1]=h.slice(0,h.length-f).replace(/^\u200b+/,"");b[0]=b[0].slice(g).replace(/\u200b+$/,"");d=q(d,g);c=q(c,e.length?x(e).length-f:0);if(1<b.length||b[0]||u(d,c))return hb(a.doc,b,d,c,"+input"),!0};E.prototype.ensurePolled=function(){this.forceCompositionEnd()};E.prototype.reset=function(){this.forceCompositionEnd()};E.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),
this.composing=null,this.pollContent()||R(this.cm),this.div.blur(),this.div.focus())};E.prototype.readFromDOMSoon=function(){var a=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){a.readDOMTimeout=null;if(a.composing)if(a.composing.done)a.composing=null;else return;!a.cm.isReadOnly()&&a.pollContent()||aa(a.cm,function(){return R(a.cm)})},80))};E.prototype.setUneditable=function(a){a.contentEditable="false"};E.prototype.onKeyPress=function(a){a.preventDefault();this.cm.isReadOnly()||
L(this.cm,Ld)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0)};E.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)};E.prototype.onContextMenu=function(){};E.prototype.resetPosition=function(){};E.prototype.needsContentAttribute=!0;var J=function(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=new Ea;this.hasSelection=this.inaccurateSelection=!1;this.composing=null};J.prototype.init=function(a){function b(a){if(!K(e,a)){if(e.somethingSelected())U=
{lineWise:!1,text:e.getSelections()},d.inaccurateSelection&&(d.prevInput="",d.inaccurateSelection=!1,g.value=U.text.join("\n"),nb(g));else if(e.options.lineWiseCopyCut){var b=Ff(e);U={lineWise:!0,text:b.text};"cut"==a.type?e.setSelections(b.ranges,null,pa):(d.prevInput="",g.value=b.text.join("\n"),nb(g))}else return;"cut"==a.type&&(e.state.cutIncoming=!0)}}var c=this,d=this,e=this.cm,f=this.wrapper=Hf(),g=this.textarea=f.firstChild;a.wrapper.insertBefore(f,a.wrapper.firstChild);Rb&&(g.style.width=
"0px");w(g,"input",function(){B&&9<=F&&c.hasSelection&&(c.hasSelection=null);d.poll()});w(g,"paste",function(a){K(e,a)||Ef(a,e)||(e.state.pasteIncoming=!0,d.fastPoll())});w(g,"cut",b);w(g,"copy",b);w(a.scroller,"paste",function(b){sa(a,b)||K(e,b)||(e.state.pasteIncoming=!0,d.focus())});w(a.lineSpace,"selectstart",function(b){sa(a,b)||Q(b)});w(g,"compositionstart",function(){var a=e.getCursor("from");d.composing&&d.composing.range.clear();d.composing={start:a,range:e.markText(a,e.getCursor("to"),{className:"CodeMirror-composing"})}});
w(g,"compositionend",function(){d.composing&&(d.poll(),d.composing.range.clear(),d.composing=null)})};J.prototype.prepareSelection=function(){var a=this.cm,b=a.display,c=a.doc,d=Ae(a);if(a.options.moveInputWithCursor){var a=ta(a,c.sel.primary().head,"div"),c=b.wrapper.getBoundingClientRect(),e=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-c.top));d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+e.left-c.left))}return d};J.prototype.showSelection=
function(a){var b=this.cm.display;D(b.cursorDiv,a.cursors);D(b.selectionDiv,a.selection);null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")};J.prototype.reset=function(a){if(!this.contextMenuPending){var b,c,d=this.cm,e=d.doc;d.somethingSelected()?(this.prevInput="",b=e.sel.primary(),c=(b=vf&&(100<b.to().line-b.from().line||1E3<(c=d.getSelection()).length))?"-":c||d.getSelection(),this.textarea.value=c,d.state.focused&&nb(this.textarea),B&&9<=F&&(this.hasSelection=
c)):a||(this.prevInput=this.textarea.value="",B&&9<=F&&(this.hasSelection=null));this.inaccurateSelection=b}};J.prototype.getField=function(){return this.textarea};J.prototype.supportsTouch=function(){return!1};J.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!pb||ba()!=this.textarea))try{this.textarea.focus()}catch(a){}};J.prototype.blur=function(){this.textarea.blur()};J.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};J.prototype.receivedFocus=
function(){this.slowPoll()};J.prototype.slowPoll=function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){a.poll();a.cm.state.focused&&a.slowPoll()})};J.prototype.fastPoll=function(){function a(){c.poll()||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0;c.polling.set(20,a)};J.prototype.poll=function(){var a=this,b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||Rg(c)&&!d&&!this.composing||
b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=c.value;if(e==d&&!b.somethingSelected())return!1;if(B&&9<=F&&this.hasSelection===e||ga&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);8203!=f||d||(d="\u200b");if(8666==f)return this.reset(),this.cm.execCommand("undo")}for(var g=0,f=Math.min(d.length,e.length);g<f&&d.charCodeAt(g)==e.charCodeAt(g);)++g;aa(b,function(){Ld(b,e.slice(g),d.length-g,null,a.composing?
"*compose":null);1E3<e.length||-1<e.indexOf("\n")?c.value=a.prevInput="":a.prevInput=e;a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))});return!0};J.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};J.prototype.onKeyPress=function(){B&&9<=F&&(this.hasSelection=null);this.fastPoll()};J.prototype.onContextMenu=function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),
b="\u200b"+(a?g.value:"");g.value="\u21da";g.value=b;d.prevInput=a?"":"\u200b";g.selectionStart=1;g.selectionEnd=b.length;f.selForContextMenu=e.doc.sel}}function c(){d.contextMenuPending=!1;d.wrapper.style.cssText=m;g.style.cssText=l;B&&9>F&&f.scrollbars.setScrollTop(f.scroller.scrollTop=k);if(null!=g.selectionStart){(!B||B&&9>F)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&0<g.selectionEnd&&"\u200b"==d.prevInput?L(e,af)(e):10>a++?f.detectingSelectAll=setTimeout(c,
500):f.input.reset()};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=Oa(e,a),k=f.scroller.scrollTop;if(h&&!ha){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(h)&&L(e,P)(e.doc,va(h),pa);var l=g.style.cssText,m=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";h=d.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(a.clientY-h.top-5)+"px; left: "+(a.clientX-h.left-5)+"px;\n z-index: 1000; background: "+
(B?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var n;N&&(n=window.scrollY);f.input.focus();N&&window.scrollTo(null,n);f.input.reset();e.somethingSelected()||(g.value=d.prevInput=" ");d.contextMenuPending=!0;f.selForContextMenu=e.doc.sel;clearTimeout(f.detectingSelectAll);B&&9<=F&&b();if(Id){tb(a);var p=function(){fa(window,"mouseup",p);setTimeout(c,20)};w(window,"mouseup",p)}else setTimeout(c,
50)}};J.prototype.readOnlyChanged=function(a){a||this.reset()};J.prototype.setUneditable=function(){};J.prototype.needsContentAttribute=!1;(function(a){function b(b,e,f,g){a.defaults[b]=e;f&&(c[b]=g?function(a,b,d){d!=lb&&f(a,b,d)}:f)}var c=a.optionHandlers;a.defineOption=b;a.Init=lb;b("value","",function(a,b){return a.setValue(b)},!0);b("mode",null,function(a,b){a.doc.modeOption=b;Ad(a)},!0);b("indentUnit",2,Ad,!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(a){Gb(a);Ab(a);
R(a)},!0);b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b){var d=[],c=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(-1==f)break;e=f+b.length;d.push(q(c,f))}c++});for(var e=d.length-1;0<=e;e--)hb(a.doc,b,d[e],q(d[e].line,d[e].ch+b.length))}});b("specialChars",/[\u0000-\u001f\u007f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g");c!=lb&&a.refresh()});b("specialCharPlaceholder",
bg,function(a){return a.refresh()},!0);b("electricChars",!0);b("inputStyle",pb?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor");},!0);b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0);b("rtlMoveVisually",!Qg);b("wholeLineUpdateBefore",!0);b("theme","default",function(a){zf(a);Pb(a)},!0);b("keyMap","default",function(a,b,c){b=zc(b);(c=c!=lb&&zc(c))&&c.detach&&c.detach(a,b);b.attach&&b.attach(a,c||null)});b("extraKeys",
null);b("lineWrapping",!1,Jg,!0);b("gutters",[],function(a){yd(a.options);Pb(a)},!0);b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?od(a.display)+"px":"0";a.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(a){return ab(a)},!0);b("scrollbarStyle","native",function(a){Ie(a);ab(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0);b("lineNumbers",!1,function(a){yd(a.options);Pb(a)},!0);b("firstLineNumber",1,Pb,!0);b("lineNumberFormatter",
function(a){return a},Pb,!0);b("showCursorWhenSelecting",!1,Bb,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("readOnly",!1,function(a,b){"nocursor"==b?(Cb(a),a.display.input.blur(),a.display.disabled=!0):a.display.disabled=!1;a.display.input.readOnlyChanged(b)});b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0);b("dragDrop",!0,Ig);b("allowDropFileTypes",null);b("cursorBlinkRate",530);b("cursorScrollMargin",0);b("cursorHeight",1,Bb,!0);b("singleCursorHeightPerLine",
!0,Bb,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,Gb,!0);b("addModeClass",!1,Gb,!0);b("pollInterval",100);b("undoDepth",200,function(a,b){return a.doc.history.undoDepth=b});b("historyEventDelay",1250);b("viewportMargin",10,function(a){return a.refresh()},!0);b("maxHighlightLength",1E4,Gb,!0);b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()});b("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""});b("autofocus",null)})(G);(function(a){var b=
a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(a,c){var d=this.options,e=d[a];if(d[a]!=c||"mode"==a)d[a]=c,b.hasOwnProperty(a)&&L(this,b[a])(this,c,e),I(this,"optionChange",this,a)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](zc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,d=0;d<b.length;++d)if(b[d]==
a||b[d].name==a)return b.splice(d,1),!0},addOverlay:S(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw Error("Overlays may not be stateful.");Nf(this.state.overlays,{mode:d,modeSpec:b,opaque:c&&c.opaque,priority:c&&c.priority||0},function(a){return a.priority});this.state.modeGen++;R(this)}),removeOverlay:S(function(a){for(var b=this.state.overlays,d=0;d<b.length;++d){var c=b[d].modeSpec;if(c==a||"string"==typeof a&&c.name==a){b.splice(d,1);this.state.modeGen++;R(this);
break}}}),indentLine:S(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");qb(this.doc,a)&&Qb(this,a,b,c)}),indentSelection:S(function(a){for(var b=this.doc.sel.ranges,d=-1,c=0;c<b.length;c++){var h=b[c];if(h.empty())h.head.line>d&&(Qb(this,h.head.line,a,!0),d=h.head.line,c==this.doc.sel.primIndex&&bb(this));else{for(var k=h.from(),h=h.to(),l=Math.max(d,k.line),d=Math.min(this.lastLine(),h.line-(h.ch?0:1))+1,h=l;h<d;++h)Qb(this,
h,a);h=this.doc.sel.ranges;0==k.ch&&b.length==h.length&&0<h[c].from().ch&&Dd(this.doc,c,new A(k,h[c].to()),pa)}}}),getTokenAt:function(a,b){return ge(this,a,b)},getLineTokens:function(a,b){return ge(this,q(a),b,!0)},getTokenTypeAt:function(a){a=z(this.doc,a);var b=ee(this,v(this.doc,a.line)),d=0,c=(b.length-1)/2;a=a.ch;if(0==a)b=b[2];else for(;;){var h=d+c>>1;if((h?b[2*h-1]:0)>=a)c=h;else if(b[2*h+1]<a)d=h+1;else{b=b[2*h+2];break}}d=b?b.indexOf("overlay "):-1;return 0>d?b:0==d?null:b.slice(0,d-1)},
getModeAt:function(b){var d=this.doc.mode;return d.innerMode?a.innerMode(d,this.getTokenAt(b).state).mode:d},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var d=[];if(!c.hasOwnProperty(b))return d;var e=c[b];a=this.getModeAt(a);if("string"==typeof a[b])e[a[b]]&&d.push(e[a[b]]);else if(a[b])for(var h=0;h<a[b].length;h++){var k=e[a[b][h]];k&&d.push(k)}else a.helperType&&e[a.helperType]?d.push(e[a.helperType]):e[a.name]&&d.push(e[a.name]);for(b=0;b<e._global.length;b++)h=
e._global[b],h.pred(a,this)&&-1==M(d,h.val)&&d.push(h.val);return d},getStateAfter:function(a,b){var d=this.doc;a=Math.max(d.first,Math.min(null==a?d.first+d.size-1:a,d.first+d.size-1));return ub(this,a+1,b)},cursorCoords:function(a,b){var d=this.doc.sel.primary();a=null==a?d.head:"object"==typeof a?z(this.doc,a):a?d.from():d.to();return ta(this,a,b||"page")},charCoords:function(a,b){return lc(this,z(this.doc,a),b||"page")},coordsChar:function(a,b){a=xe(this,a,b||"page");return nd(this,a.left,a.top)},
lineAtHeight:function(a,b){a=xe(this,{top:a,left:0},b||"page").top;return Ga(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,c){var d=!1;if("number"==typeof a){var e=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>e&&(a=e,d=!0);a=v(this.doc,a)}return md(this,a,{top:0,left:0},b||"page",c).top+(d?this.doc.height-la(a):0)},defaultTextHeight:function(){return Ma(this.display)},defaultCharWidth:function(){return zb(this.display)},getViewport:function(){return{from:this.display.viewFrom,
to:this.display.viewTo}},addWidget:function(a,b,c,g,h){var d=this.display;a=ta(this,z(this.doc,a));var e=a.bottom,f=a.left;b.style.position="absolute";b.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(b);d.sizer.appendChild(b);if("over"==g)e=a.top;else if("above"==g||"near"==g){var n=Math.max(d.wrapper.clientHeight,this.doc.height),p=Math.max(d.sizer.clientWidth,d.lineSpace.clientWidth);("above"==g||a.bottom+b.offsetHeight>n)&&a.top>b.offsetHeight?e=a.top-b.offsetHeight:a.bottom+
b.offsetHeight<=n&&(e=a.bottom);f+b.offsetWidth>p&&(f=p-b.offsetWidth)}b.style.top=e+"px";b.style.left=b.style.right="";"right"==h?(f=d.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==h?f=0:"middle"==h&&(f=(d.sizer.clientWidth-b.offsetWidth)/2),b.style.left=f+"px");c&&(a=pc(this,f,e,f+b.offsetWidth,e+b.offsetHeight),null!=a.scrollTop&&Db(this,a.scrollTop),null!=a.scrollLeft&&$a(this,a.scrollLeft))},triggerOnKeyDown:S(uf),triggerOnKeyPress:S(xf),triggerOnKeyUp:wf,execCommand:function(a){if(Bc.hasOwnProperty(a))return Bc[a].call(null,
this)},triggerElectric:S(function(a){Df(this,a)}),findPosH:function(a,b,c,g){var d=1;0>b&&(d=-1,b=-b);a=z(this.doc,a);for(var e=0;e<b&&(a=Nd(this.doc,a,d,c,g),!a.hitSide);++e);return a},moveH:S(function(a,b){var c=this;this.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Nd(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},Sb)}),deleteH:S(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):kb(this,function(d){var e=
Nd(c,d.head,a,b,!1);return 0>a?{from:e,to:d.head}:{from:d.head,to:e}})}),findPosV:function(a,b,c,g){var d=1;0>b&&(d=-1,b=-b);var e=z(this.doc,a);for(a=0;a<b&&(e=ta(this,e,"div"),null==g?g=e.left:e.left=g,e=If(this,e,d,c),!e.hitSide);++a);return e},moveV:S(function(a,b){var c=this,d=this.doc,e=[],k=!this.display.shift&&!d.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(f){if(k)return 0>a?f.from():f.to();var g=ta(c,f.head,"div");null!=f.goalColumn&&(g.left=f.goalColumn);e.push(g.left);
var h=If(c,g,a,b);"page"==b&&f==d.sel.primary()&&qc(c,null,lc(c,h,"div").top-g.top);return h},Sb);if(e.length)for(var l=0;l<d.sel.ranges.length;l++)d.sel.ranges[l].goalColumn=e[l]}),findWordAt:function(a){var b=v(this.doc,a.line).text,c=a.ch,d=a.ch;if(b){var h=this.getHelper(a,"wordChars");(0>a.xRel||d==b.length)&&c?--c:++d;for(var k=b.charAt(c),k=Zb(k,h)?function(a){return Zb(a,h)}:/\s/.test(k)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!Zb(a)};0<c&&k(b.charAt(c-1));)--c;for(;d<
b.length&&k(b.charAt(d));)++d}return new A(q(a.line,c),q(a.line,d))},toggleOverwrite:function(a){if(null==a||a!=this.state.overwrite)(this.state.overwrite=!this.state.overwrite)?Sa(this.display.cursorDiv,"CodeMirror-overwrite"):Za(this.display.cursorDiv,"CodeMirror-overwrite"),I(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==ba()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:S(function(a,b){null==
a&&null==b||rc(this);null!=a&&(this.curOp.scrollLeft=a);null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-oa(this)-this.display.barHeight,width:a.scrollWidth-oa(this)-this.display.barWidth,clientHeight:id(this),clientWidth:Ka(this)}},scrollIntoView:S(function(a,b){null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:q(a,0),
to:null}:null==a.from&&(a={from:a,to:null});a.to||(a.to=a.from);a.margin=b||0;null!=a.from.line?(rc(this),this.curOp.scrollToPos=a):(a=pc(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin),this.scrollTo(a.scrollLeft,a.scrollTop))}),setSize:S(function(a,b){var c=this,d=function(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a};null!=a&&(this.display.wrapper.style.width=d(a));null!=
b&&(this.display.wrapper.style.height=d(b));this.options.lineWrapping&&we(this);var e=this.display.viewFrom;this.doc.iter(e,this.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){za(c,e,"widget");break}++e});this.curOp.forceUpdate=!0;I(this,"refresh",this)}),operation:function(a){return aa(this,a)},refresh:S(function(){var a=this.display.cachedTextHeight;R(this);this.curOp.forceUpdate=!0;Ab(this);this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop);
td(this);(null==a||.5<Math.abs(a-Ma(this.display)))&&pd(this);I(this,"refresh",this)}),swapDoc:S(function(a){var b=this.doc;b.cm=null;Qe(this,a);Ab(this);this.display.input.reset();this.scrollTo(a.scrollLeft,a.scrollTop);this.curOp.forceScroll=!0;X(this,"swapDoc",this,b);return b}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};
Ta(a);a.registerHelper=function(b,e,f){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]});c[b][e]=f};a.registerGlobalHelper=function(b,e,f,g){a.registerHelper(b,e,g);c[b]._global.push({pred:f,val:g})}})(G);var Tg="iter insert remove copy getEditor constructor".split(" "),Wb;for(Wb in T.prototype)T.prototype.hasOwnProperty(Wb)&&0>M(Tg,Wb)&&(G.prototype[Wb]=function(a){return function(){return a.apply(this.doc,arguments)}}(T.prototype[Wb]));Ta(T);G.inputStyles={textarea:J,contenteditable:E};G.defineMode=
function(a){G.defaults.mode||"null"==a||(G.defaults.mode=a);Vf.apply(this,arguments)};G.defineMIME=function(a,b){Ua[a]=b};G.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}});G.defineMIME("text/plain","null");G.defineExtension=function(a,b){G.prototype[a]=b};G.defineDocExtension=function(a,b){T.prototype[a]=b};G.fromTextArea=function(a,b){function c(){a.value=h.getValue()}b=b?Da(b):{};b.value=a.value;!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex);!b.placeholder&&a.placeholder&&
(b.placeholder=a.placeholder);if(null==b.autofocus){var d=ba();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}var e;if(a.form&&(w(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var f=a.form;e=f.submit;try{var g=f.submit=function(){c();f.submit=e;f.submit();f.submit=g}}catch(k){}}b.finishInit=function(b){b.save=c;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;c();a.parentNode.removeChild(b.getWrapperElement());a.style.display="";a.form&&(fa(a.form,
"submit",c),"function"==typeof a.form.submit&&(a.form.submit=e))}};a.style.display="none";var h=G(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return h};(function(a){a.off=fa;a.on=w;a.wheelEventPixels=ig;a.Doc=T;a.splitLines=Md;a.countColumn=ca;a.findColumn=Kc;a.isWordChar=Mc;a.Pass=Fd;a.signal=I;a.Line=Wa;a.changeEnd=Aa;a.scrollbarModel=Je;a.Pos=q;a.cmpPos=u;a.modes=$c;a.mimeModes=Ua;a.resolveMode=hc;a.getMode=ad;a.modeExtensions=Va;a.extendMode=Wf;a.copyState=qa;a.startState=
be;a.innerMode=bd;a.commands=Bc;a.keyMap=Ob;a.keyName=pf;a.isModifierKey=of;a.lookupKey=jb;a.normalizeKeyMap=xg;a.StringStream=vb;a.SharedTextMarker=Nb;a.TextMarker=Ba;a.LineWidget=Mb;a.e_preventDefault=Q;a.e_stopPropagation=$d;a.e_stop=tb;a.addClass=Sa;a.contains=V;a.rmClass=Za;a.keyNames=Ca})(G);G.version="5.22.0";return G});

View File

@ -1,8 +1,8 @@
(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 x(c){c=c.search(p);return-1==c?0:c}var A={},p=/[^\s\u00a0]/,l=h.Pos;h.commands.toggleComment=function(c){c.toggleComment()};h.defineExtension("toggleComment",function(c){c||(c=A);for(var d=Infinity,a=this.listSelections(),e=null,b=a.length-1;0<=b;b--){var f=a[b].from(),g=a[b].to();f.line>=d||
(g.line>=d&&(g=l(d,0)),d=f.line,null==e?this.uncomment(f,g,c)?e="un":(this.lineComment(f,g,c),e="line"):"un"==e?this.uncomment(f,g,c):this.lineComment(f,g,c))}});h.defineExtension("lineComment",function(c,d,a){a||(a=A);var e=this,b=e.getModeAt(c),f=a.lineComment||b.lineComment;if(!f){if(a.blockCommentStart||b.blockCommentStart)a.fullLines=!0,e.blockComment(c,d,a)}else if(null!=e.getLine(c.line)){var g=Math.min(0!=d.ch||d.line==c.line?d.line+1:d.line,e.lastLine()+1),n=null==a.padding?" ":a.padding,
h=a.commentBlankLines||c.line==d.line;e.operation(function(){if(a.indent){for(var d=null,b=c.line;b<g;++b){var k=e.getLine(b),k=k.slice(0,x(k));if(null==d||d.length>k.length)d=k}for(b=c.line;b<g;++b){var k=e.getLine(b),q=d.length;if(h||p.test(k))k.slice(0,q)!=d&&(q=x(k)),e.replaceRange(d+f+n,l(b,0),l(b,q))}}else for(b=c.line;b<g;++b)(h||p.test(e.getLine(b)))&&e.replaceRange(f+n,l(b,0))})}});h.defineExtension("blockComment",function(c,d,a){a||(a=A);var e=this,b=e.getModeAt(c),f=a.blockCommentStart||
b.blockCommentStart,g=a.blockCommentEnd||b.blockCommentEnd;if(f&&g){var n=Math.min(d.line,e.lastLine());n!=c.line&&0==d.ch&&p.test(e.getLine(n))&&--n;var h=null==a.padding?" ":a.padding;c.line>n||e.operation(function(){if(0!=a.fullLines){var m=p.test(e.getLine(n));e.replaceRange(h+g,l(n));e.replaceRange(f+h,l(c.line,0));var y=a.blockCommentLead||b.blockCommentLead;if(null!=y)for(var k=c.line+1;k<=n;++k)(k!=n||m)&&e.replaceRange(y+h,l(k,0))}else e.replaceRange(g,d),e.replaceRange(f,c)})}else(a.lineComment||
b.lineComment)&&0!=a.fullLines&&e.lineComment(c,d,a)});h.defineExtension("uncomment",function(c,d,a){a||(a=A);var e=this,b=e.getModeAt(c),f=Math.min(0!=d.ch||d.line==c.line?d.line:d.line-1,e.lastLine()),g=Math.min(c.line,f),h=a.lineComment||b.lineComment,x=[],m=null==a.padding?" ":a.padding,y;a:if(h){for(var k=g;k<=f;++k){var q=e.getLine(k),u=q.indexOf(h);-1<u&&!/comment/.test(e.getTokenTypeAt(l(k,u+1)))&&(u=-1);if(-1==u&&(k!=f||k==g)&&p.test(q))break a;if(-1<u&&p.test(q.slice(0,u)))break a;x.push(q)}e.operation(function(){for(var a=
g;a<=f;++a){var c=x[a-g],b=c.indexOf(h),d=b+h.length;0>b||(c.slice(d,d+m.length)==m&&(d+=m.length),y=!0,e.replaceRange("",l(a,b),l(a,d)))}});if(y)return!0}var v=a.blockCommentStart||b.blockCommentStart,t=a.blockCommentEnd||b.blockCommentEnd;if(!v||!t)return!1;var C=a.blockCommentLead||b.blockCommentLead,z=e.getLine(g),w=f==g?z:e.getLine(f),B=z.indexOf(v),r=w.lastIndexOf(t);-1==r&&g!=f&&(w=e.getLine(--f),r=w.lastIndexOf(t));if(-1==B||-1==r||!/comment/.test(e.getTokenTypeAt(l(g,B+1)))||!/comment/.test(e.getTokenTypeAt(l(f,
r+1))))return!1;b=z.lastIndexOf(v,c.ch);a=-1==b?-1:z.slice(0,c.ch).indexOf(t,b+v.length);if(-1!=b&&-1!=a&&a+t.length!=c.ch)return!1;a=w.indexOf(t,d.ch);c=w.slice(d.ch).lastIndexOf(v,a-d.ch);b=-1==a||-1==c?-1:d.ch+c;if(-1!=a&&-1!=b&&b!=d.ch)return!1;e.operation(function(){e.replaceRange("",l(f,r-(m&&w.slice(r-m.length,r)==m?m.length:0)),l(f,r+t.length));var a=B+v.length;m&&z.slice(a,a+m.length)==m&&(a+=m.length);e.replaceRange("",l(g,B),l(g,a));if(C)for(a=g+1;a<=f;++a){var c=e.getLine(a),b=c.indexOf(C);
if(-1!=b&&!p.test(c.slice(0,b))){var d=b+C.length;m&&c.slice(d,d+m.length)==m&&(d+=m.length);e.replaceRange("",l(a,b),l(a,d))}}});return!0})});
'use strict';(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 w(a){a=a.search(q);return-1==a?0:a}function D(a,d,b){return/\bstring\b/.test(a.getTokenTypeAt(k(d.line,0)))&&!/^[\'\"`]/.test(b)}var A={},q=/[^\s\u00a0]/,k=h.Pos;h.commands.toggleComment=function(a){a.toggleComment()};h.defineExtension("toggleComment",function(a){a||(a=A);for(var d=
Infinity,b=this.listSelections(),c=null,e=b.length-1;0<=e;e--){var f=b[e].from(),g=b[e].to();f.line>=d||(g.line>=d&&(g=k(d,0)),d=f.line,null==c?this.uncomment(f,g,a)?c="un":(this.lineComment(f,g,a),c="line"):"un"==c?this.uncomment(f,g,a):this.lineComment(f,g,a))}});h.defineExtension("lineComment",function(a,d,b){b||(b=A);var c=this,e=c.getModeAt(a),f=c.getLine(a.line);if(null!=f&&!D(c,a,f)){var g=b.lineComment||e.lineComment;if(g){var m=Math.min(0!=d.ch||d.line==a.line?d.line+1:d.line,c.lastLine()+
1),h=null==b.padding?" ":b.padding,l=b.commentBlankLines||a.line==d.line;c.operation(function(){if(b.indent){for(var d=null,f=a.line;f<m;++f){var e=c.getLine(f),e=e.slice(0,w(e));if(null==d||d.length>e.length)d=e}for(f=a.line;f<m;++f){var e=c.getLine(f),n=d.length;if(l||q.test(e))e.slice(0,n)!=d&&(n=w(e)),c.replaceRange(d+g+h,k(f,0),k(f,n))}}else for(f=a.line;f<m;++f)(l||q.test(c.getLine(f)))&&c.replaceRange(g+h,k(f,0))})}else if(b.blockCommentStart||e.blockCommentStart)b.fullLines=!0,c.blockComment(a,
d,b)}});h.defineExtension("blockComment",function(a,d,b){b||(b=A);var c=this,e=c.getModeAt(a),f=b.blockCommentStart||e.blockCommentStart,g=b.blockCommentEnd||e.blockCommentEnd;if(!f||!g)(b.lineComment||e.lineComment)&&0!=b.fullLines&&c.lineComment(a,d,b);else if(!/\bcomment\b/.test(c.getTokenTypeAt(k(a.line,0)))){var m=Math.min(d.line,c.lastLine());m!=a.line&&0==d.ch&&q.test(c.getLine(m))&&--m;var h=null==b.padding?" ":b.padding;a.line>m||c.operation(function(){if(0!=b.fullLines){var l=q.test(c.getLine(m));
c.replaceRange(h+g,k(m));c.replaceRange(f+h,k(a.line,0));var x=b.blockCommentLead||e.blockCommentLead;if(null!=x)for(var p=a.line+1;p<=m;++p)(p!=m||l)&&c.replaceRange(x+h,k(p,0))}else c.replaceRange(g,d),c.replaceRange(f,a)})}});h.defineExtension("uncomment",function(a,d,b){b||(b=A);var c=this,e=c.getModeAt(a),f=Math.min(0!=d.ch||d.line==a.line?d.line:d.line-1,c.lastLine()),g=Math.min(a.line,f),h=b.lineComment||e.lineComment,w=[],l=null==b.padding?" ":b.padding,x;a:if(h){for(var p=g;p<=f;++p){var B=
c.getLine(p),n=B.indexOf(h);-1<n&&!/comment/.test(c.getTokenTypeAt(k(p,n+1)))&&(n=-1);if(-1==n&&q.test(B))break a;if(-1<n&&q.test(B.slice(0,n)))break a;w.push(B)}c.operation(function(){for(var a=g;a<=f;++a){var b=w[a-g],d=b.indexOf(h),e=d+h.length;0>d||(b.slice(e,e+l.length)==l&&(e+=l.length),x=!0,c.replaceRange("",k(a,d),k(a,e)))}});if(x)return!0}var t=b.blockCommentStart||e.blockCommentStart,u=b.blockCommentEnd||e.blockCommentEnd;if(!t||!u)return!1;var C=b.blockCommentLead||e.blockCommentLead,y=
c.getLine(g),z=y.indexOf(t);if(-1==z)return!1;var v=f==g?y:c.getLine(f),r=v.indexOf(u,f==g?z+t.length:0);-1==r&&g!=f&&(v=c.getLine(--f),r=v.indexOf(u));if(-1==r||!/comment/.test(c.getTokenTypeAt(k(g,z+1)))||!/comment/.test(c.getTokenTypeAt(k(f,r+1))))return!1;e=y.lastIndexOf(t,a.ch);b=-1==e?-1:y.slice(0,a.ch).indexOf(u,e+t.length);if(-1!=e&&-1!=b&&b+u.length!=a.ch)return!1;b=v.indexOf(u,d.ch);a=v.slice(d.ch).lastIndexOf(t,b-d.ch);e=-1==b||-1==a?-1:d.ch+a;if(-1!=b&&-1!=e&&e!=d.ch)return!1;c.operation(function(){c.replaceRange("",
k(f,r-(l&&v.slice(r-l.length,r)==l?l.length:0)),k(f,r+u.length));var a=z+t.length;l&&y.slice(a,a+l.length)==l&&(a+=l.length);c.replaceRange("",k(g,z),k(g,a));if(C)for(a=g+1;a<=f;++a){var b=c.getLine(a),d=b.indexOf(C);if(-1!=d&&!q.test(b.slice(0,d))){var e=d+C.length;l&&b.slice(e,e+l.length)==l&&(e+=l.length);c.replaceRange("",k(a,d),k(a,e))}}});return!0})});

File diff suppressed because one or more lines are too long

View File

@ -1,32 +1 @@
.CodeMirror-dialog {
position: absolute;
left: 0; right: 0;
background: inherit;
z-index: 15;
padding: .1em .8em;
overflow: hidden;
color: inherit;
}
.CodeMirror-dialog-top {
border-bottom: 1px solid #eee;
top: 0;
}
.CodeMirror-dialog-bottom {
border-top: 1px solid #eee;
bottom: 0;
}
.CodeMirror-dialog input {
border: none;
outline: none;
background: transparent;
width: 20em;
color: inherit;
font-family: monospace;
}
.CodeMirror-dialog button {
font-size: 70%;
}
.CodeMirror-dialog{position:absolute;left:0;right:0;background:inherit;z-index:15;padding:.1em .8em;overflow:hidden;color:inherit}.CodeMirror-dialog-top{border-bottom:1px solid #eee;top:0}.CodeMirror-dialog-bottom{border-top:1px solid #eee;bottom:0}.CodeMirror-dialog input{border:none;outline:0;background:0 0;width:20em;color:inherit;font-family:monospace}.CodeMirror-dialog button{font-size:70%}

View File

@ -1,5 +1,5 @@
(function(b){"object"==typeof exports&&"object"==typeof module?b(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],b):b(CodeMirror)})(function(b){function l(c,b,a){c=c.getWrapperElement().appendChild(document.createElement("div"));c.className=a?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top";"string"==typeof b?c.innerHTML=b:c.appendChild(b);return c}function m(b,g){b.state.currentNotificationClose&&b.state.currentNotificationClose();
b.state.currentNotificationClose=g}b.defineExtension("openDialog",function(c,g,a){function e(b){if("string"==typeof b)d.value=b;else if(!h&&(h=!0,f.parentNode.removeChild(f),k.focus(),a.onClose))a.onClose(f)}a||(a={});m(this,null);var f=l(this,c,a.bottom),h=!1,k=this,d=f.getElementsByTagName("input")[0];if(d){a.value&&(d.value=a.value,!1!==a.selectValueOnOpen&&d.select());if(a.onInput)b.on(d,"input",function(b){a.onInput(b,d.value,e)});if(a.onKeyUp)b.on(d,"keyup",function(b){a.onKeyUp(b,d.value,e)});
b.on(d,"keydown",function(c){if(!(a&&a.onKeyDown&&a.onKeyDown(c,d.value,e))){if(27==c.keyCode||!1!==a.closeOnEnter&&13==c.keyCode)d.blur(),b.e_stop(c),e();13==c.keyCode&&g(d.value,c)}});if(!1!==a.closeOnBlur)b.on(d,"blur",e);d.focus()}else if(c=f.getElementsByTagName("button")[0]){b.on(c,"click",function(){e();k.focus()});if(!1!==a.closeOnBlur)b.on(c,"blur",e);c.focus()}return e});b.defineExtension("openConfirm",function(c,g,a){function e(){h||(h=!0,f.parentNode.removeChild(f),k.focus())}m(this,null);
var f=l(this,c,a&&a.bottom);c=f.getElementsByTagName("button");var h=!1,k=this,d=1;c[0].focus();for(a=0;a<c.length;++a){var n=c[a];(function(a){b.on(n,"click",function(c){b.e_preventDefault(c);e();a&&a(k)})})(g[a]);b.on(n,"blur",function(){--d;setTimeout(function(){0>=d&&e()},200)});b.on(n,"focus",function(){++d})}});b.defineExtension("openNotification",function(c,g){function a(){f||(f=!0,clearTimeout(h),e.parentNode.removeChild(e))}m(this,a);var e=l(this,c,g&&g.bottom),f=!1,h,k=g&&"undefined"!==
typeof g.duration?g.duration:5E3;b.on(e,"click",function(c){b.e_preventDefault(c);a()});k&&(h=setTimeout(a,k));return a})});
'use strict';(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 l(a,c,b){a=a.getWrapperElement().appendChild(document.createElement("div"));a.className=b?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top";"string"==typeof c?a.innerHTML=c:a.appendChild(c);return a}function m(a,c){a.state.currentNotificationClose&&
a.state.currentNotificationClose();a.state.currentNotificationClose=c}c.defineExtension("openDialog",function(a,g,b){function e(a){if("string"==typeof a)d.value=a;else if(!h&&(h=!0,f.parentNode.removeChild(f),k.focus(),b.onClose))b.onClose(f)}b||(b={});m(this,null);var f=l(this,a,b.bottom),h=!1,k=this,d=f.getElementsByTagName("input")[0];if(d){d.focus();b.value&&(d.value=b.value,!1!==b.selectValueOnOpen&&d.select());if(b.onInput)c.on(d,"input",function(a){b.onInput(a,d.value,e)});if(b.onKeyUp)c.on(d,
"keyup",function(a){b.onKeyUp(a,d.value,e)});c.on(d,"keydown",function(a){if(!(b&&b.onKeyDown&&b.onKeyDown(a,d.value,e))){if(27==a.keyCode||!1!==b.closeOnEnter&&13==a.keyCode)d.blur(),c.e_stop(a),e();13==a.keyCode&&g(d.value,a)}});if(!1!==b.closeOnBlur)c.on(d,"blur",e)}else if(a=f.getElementsByTagName("button")[0]){c.on(a,"click",function(){e();k.focus()});if(!1!==b.closeOnBlur)c.on(a,"blur",e);a.focus()}return e});c.defineExtension("openConfirm",function(a,g,b){function e(){h||(h=!0,f.parentNode.removeChild(f),
k.focus())}m(this,null);var f=l(this,a,b&&b.bottom);a=f.getElementsByTagName("button");var h=!1,k=this,d=1;a[0].focus();for(b=0;b<a.length;++b){var n=a[b];(function(a){c.on(n,"click",function(b){c.e_preventDefault(b);e();a&&a(k)})})(g[b]);c.on(n,"blur",function(){--d;setTimeout(function(){0>=d&&e()},200)});c.on(n,"focus",function(){++d})}});c.defineExtension("openNotification",function(a,g){function b(){f||(f=!0,clearTimeout(h),e.parentNode.removeChild(e))}m(this,b);var e=l(this,a,g&&g.bottom),f=
!1,h;a=g&&"undefined"!==typeof g.duration?g.duration:5E3;c.on(e,"click",function(a){c.e_preventDefault(a);b()});a&&(h=setTimeout(b,a));return b})});

View File

@ -1,23 +1 @@
.cm-s-eclipse span.cm-meta { color: #FF1717; }
.cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; }
.cm-s-eclipse span.cm-atom { color: #219; }
.cm-s-eclipse span.cm-number { color: #164; }
.cm-s-eclipse span.cm-def { color: #00f; }
.cm-s-eclipse span.cm-variable { color: black; }
.cm-s-eclipse span.cm-variable-2 { color: #0000C0; }
.cm-s-eclipse span.cm-variable-3 { color: #0000C0; }
.cm-s-eclipse span.cm-property { color: black; }
.cm-s-eclipse span.cm-operator { color: black; }
.cm-s-eclipse span.cm-comment { color: #3F7F5F; }
.cm-s-eclipse span.cm-string { color: #2A00FF; }
.cm-s-eclipse span.cm-string-2 { color: #f50; }
.cm-s-eclipse span.cm-qualifier { color: #555; }
.cm-s-eclipse span.cm-builtin { color: #30a; }
.cm-s-eclipse span.cm-bracket { color: #cc7; }
.cm-s-eclipse span.cm-tag { color: #170; }
.cm-s-eclipse span.cm-attribute { color: #00c; }
.cm-s-eclipse span.cm-link { color: #219; }
.cm-s-eclipse span.cm-error { color: #f00; }
.cm-s-eclipse .CodeMirror-activeline-background { background: #e8f2ff; }
.cm-s-eclipse .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }
.cm-s-eclipse span.cm-meta{color:#FF1717}.cm-s-eclipse span.cm-keyword{line-height:1em;font-weight:700;color:#7F0055}.cm-s-eclipse span.cm-atom{color:#219}.cm-s-eclipse span.cm-number{color:#164}.cm-s-eclipse span.cm-def{color:#00f}.cm-s-eclipse span.cm-variable{color:#000}.cm-s-eclipse span.cm-variable-2,.cm-s-eclipse span.cm-variable-3{color:#0000C0}.cm-s-eclipse span.cm-operator,.cm-s-eclipse span.cm-property{color:#000}.cm-s-eclipse span.cm-comment{color:#3F7F5F}.cm-s-eclipse span.cm-string{color:#2A00FF}.cm-s-eclipse span.cm-string-2{color:#f50}.cm-s-eclipse span.cm-qualifier{color:#555}.cm-s-eclipse span.cm-builtin{color:#30a}.cm-s-eclipse span.cm-bracket{color:#cc7}.cm-s-eclipse span.cm-tag{color:#170}.cm-s-eclipse span.cm-attribute{color:#00c}.cm-s-eclipse span.cm-link{color:#219}.cm-s-eclipse span.cm-error{color:red}.cm-s-eclipse .CodeMirror-activeline-background{background:#e8f2ff}.cm-s-eclipse .CodeMirror-matchingbracket{outline:grey solid 1px;color:#000!important}

View File

@ -1,2 +1,2 @@
(function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],e):e(CodeMirror)})(function(e){function g(a,d,b,c,e){a.openDialog?a.openDialog(d,e,{value:c,selectValueOnOpen:!0}):e(prompt(b,c))}function f(a,d){var b=Number(d);return/^[-+]/.test(d)?a.getCursor().line+b:b-1}e.commands.jumpToLine=function(a){var d=a.getCursor();g(a,'Jump to line: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use line:column or scroll% syntax)</span>',
"Jump to line:",d.line+1+":"+d.ch,function(b){if(b){var c;(c=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(b))?a.setCursor(f(a,c[1]),Number(c[2])):(c=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(b))?(b=Math.round(a.lineCount()*Number(c[1])/100),/^[-+]/.test(c[1])&&(b=d.line+b+1),a.setCursor(b-1,d.ch)):(c=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(b))&&a.setCursor(f(a,c[1]),d.ch)}})};e.keyMap["default"]["Alt-G"]="jumpToLine"});
'use strict';(function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],e):e(CodeMirror)})(function(e){function g(a,d,b,c,e){a.openDialog?a.openDialog(d,e,{value:c,selectValueOnOpen:!0}):e(prompt(b,c))}function f(a,d){var b=Number(d);return/^[-+]/.test(d)?a.getCursor().line+b:b-1}e.commands.jumpToLine=function(a){var d=a.getCursor();g(a,'Jump to line: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use line:column or scroll% syntax)</span>',
"Jump to line:",d.line+1+":"+d.ch,function(b){if(b){var c;(c=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(b))?a.setCursor(f(a,c[1]),Number(c[2])):(c=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(b))?(b=Math.round(a.lineCount()*Number(c[1])/100),/^[-+]/.test(c[1])&&(b=d.line+b+1),a.setCursor(b-1,d.ch)):(c=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(b))&&a.setCursor(f(a,c[1]),d.ch)}})};e.keyMap["default"]["Alt-G"]="jumpToLine"});

View File

@ -1,5 +1,6 @@
(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 l(a){"object"==typeof a&&(this.minChars=a.minChars,this.style=a.style,this.showToken=a.showToken,this.delay=a.delay,this.wordsOnly=a.wordsOnly);null==this.style&&(this.style="matchhighlight");null==this.minChars&&(this.minChars=2);null==this.delay&&(this.delay=100);null==this.wordsOnly&&(this.wordsOnly=
!1);this.overlay=this.timeout=null}function g(a){var c=a.state.matchHighlighter;clearTimeout(c.timeout);c.timeout=setTimeout(function(){h(a)},c.delay)}function h(a){a.operation(function(){var c=a.state.matchHighlighter;c.overlay&&(a.removeOverlay(c.overlay),c.overlay=null);if(!a.somethingSelected()&&c.showToken){for(var d=!0===c.showToken?/[\w$]/:c.showToken,b=a.getCursor(),e=a.getLine(b.line),f=b=b.ch;b&&d.test(e.charAt(b-1));)--b;for(;f<e.length&&d.test(e.charAt(f));)++f;b<f&&a.addOverlay(c.overlay=
k(e.slice(b,f),d,c.style))}else if(d=a.getCursor("from"),e=a.getCursor("to"),d.line==e.line){if(b=c.wordsOnly){a:if(null!==a.getRange(d,e).match(/^\w+$/)){if(0<d.ch&&(b={line:d.line,ch:d.ch-1},b=a.getRange(b,d),null===b.match(/\W/))){b=!1;break a}if(e.ch<a.getLine(d.line).length&&(b={line:e.line,ch:e.ch+1},b=a.getRange(e,b),null===b.match(/\W/))){b=!1;break a}b=!0}else b=!1;b=!b}b||(d=a.getRange(d,e).replace(/^\s+|\s+$/g,""),d.length>=c.minChars&&a.addOverlay(c.overlay=k(d,!1,c.style)))}})}function k(a,
c,d){return{token:function(b){var e;if(e=b.match(a))(e=!c)||(e=(!b.start||!c.test(b.string.charAt(b.start-1)))&&(b.pos==b.string.length||!c.test(b.string.charAt(b.pos))));if(e)return d;b.next();b.skipTo(a.charAt(0))||b.skipToEnd()}}}f.defineOption("highlightSelectionMatches",!1,function(a,c,d){d&&d!=f.Init&&((d=a.state.matchHighlighter.overlay)&&a.removeOverlay(d),clearTimeout(a.state.matchHighlighter.timeout),a.state.matchHighlighter=null,a.off("cursorActivity",g));c&&(a.state.matchHighlighter=new l(c),
h(a),a.on("cursorActivity",g))})});
'use strict';(function(f){"object"==typeof exports&&"object"==typeof module?f(require("../../lib/codemirror"),require("./matchesonscrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./matchesonscrollbar"],f):f(CodeMirror)})(function(f){function q(a){this.options={};for(var b in g)this.options[b]=(a&&a.hasOwnProperty(b)?a:g)[b];this.matchesonscroll=this.overlay=this.timeout=null;this.active=!1}function h(a){var b=a.state.matchHighlighter;(b.active||a.hasFocus())&&k(a,
b)}function l(a){var b=a.state.matchHighlighter;b.active||(b.active=!0,k(a,b))}function k(a,b){clearTimeout(b.timeout);b.timeout=setTimeout(function(){m(a)},b.options.delay)}function n(a,b,d,c){var e=a.state.matchHighlighter;a.addOverlay(e.overlay=r(b,d,c));e.options.annotateScrollbar&&a.showMatchesOnScrollbar&&(e.matchesonscroll=a.showMatchesOnScrollbar(d?new RegExp("\\b"+b+"\\b"):b,!1,{className:"CodeMirror-selection-highlight-scrollbar"}))}function p(a){var b=a.state.matchHighlighter;b.overlay&&
(a.removeOverlay(b.overlay),b.overlay=null,b.matchesonscroll&&(b.matchesonscroll.clear(),b.matchesonscroll=null))}function m(a){a.operation(function(){var b=a.state.matchHighlighter;p(a);if(!a.somethingSelected()&&b.options.showToken){for(var d=!0===b.options.showToken?/[\w$]/:b.options.showToken,c=a.getCursor(),e=a.getLine(c.line),f=c=c.ch;c&&d.test(e.charAt(c-1));)--c;for(;f<e.length&&d.test(e.charAt(f));)++f;c<f&&n(a,e.slice(c,f),d,b.options.style)}else if(d=a.getCursor("from"),e=a.getCursor("to"),
d.line==e.line){if(c=b.options.wordsOnly){a:if(null!==a.getRange(d,e).match(/^\w+$/)){if(0<d.ch&&(c={line:d.line,ch:d.ch-1},c=a.getRange(c,d),null===c.match(/\W/))){c=!1;break a}if(e.ch<a.getLine(d.line).length&&(c={line:e.line,ch:e.ch+1},c=a.getRange(e,c),null===c.match(/\W/))){c=!1;break a}c=!0}else c=!1;c=!c}c||(d=a.getRange(d,e),b.options.trim&&(d=d.replace(/^\s+|\s+$/g,"")),d.length>=b.options.minChars&&n(a,d,!1,b.options.style))}})}function r(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 g={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&&(p(a),clearTimeout(a.state.matchHighlighter.timeout),a.state.matchHighlighter=null,a.off("cursorActivity",h),a.off("focus",l));if(b){b=a.state.matchHighlighter=
new q(b);if(a.hasFocus())b.active=!0,m(a);else a.on("focus",l);a.on("cursorActivity",h)}})});

View File

@ -1,5 +1,5 @@
(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 t(a,c,b,e){var d=a.getLineHandle(c.line),h=c.ch-1,d=0<=h&&r[d.text.charAt(h)]||r[d.text.charAt(++h)];if(!d)return null;var g=">"==d.charAt(1)?1:-1;if(b&&0<g!=(h==c.ch))return null;b=a.getTokenTypeAt(l(c.line,h+1));a=u(a,l(c.line,h+(0<g?1:0)),g,b||null,e);return null==a?null:{from:l(c.line,h),
to:a&&a.pos,match:a&&a.ch==d.charAt(0),forward:0<g}}function u(a,c,b,e,d){var h=d&&d.maxScanLineLength||1E4,g=d&&d.maxScanLines||1E3,f=[];d=d&&d.bracketRegex?d.bracketRegex:/[(){}[\]]/;for(var g=0<b?Math.min(c.line+g,a.lastLine()+1):Math.max(a.firstLine()-1,c.line-g),k=c.line;k!=g;k+=b){var p=a.getLine(k);if(p){var m=0<b?0:p.length-1,n=0<b?p.length:-1;if(!(p.length>h))for(k==c.line&&(m=c.ch-(0>b?1:0));m!=n;m+=b){var q=p.charAt(m);if(d.test(q)&&(void 0===e||a.getTokenTypeAt(l(k,m+1))==e))if(">"==r[q].charAt(1)==
0<b)f.push(q);else if(f.length)f.pop();else return{pos:l(k,m),ch:q}}}}return k-b==(0<b?a.lastLine():a.firstLine())?!1:null}function v(a,c,b){for(var e=a.state.matchBrackets.maxHighlightLineLength||1E3,d=[],h=a.listSelections(),g=0;g<h.length;g++){var f=h[g].empty()&&t(a,h[g].head,!1,b);if(f&&a.getLine(f.from.line).length<=e){var k=f.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";d.push(a.markText(f.from,l(f.from.line,f.from.ch+1),{className:k}));f.to&&a.getLine(f.to.line).length<=
e&&d.push(a.markText(f.to,l(f.to.line,f.to.ch+1),{className:k}))}}if(d.length)if(x&&a.state.focused&&a.focus(),b=function(){a.operation(function(){for(var a=0;a<d.length;a++)d[a].clear()})},c)setTimeout(b,800);else return b}function w(a){a.operation(function(){n&&(n(),n=null);n=v(a,!1,a.state.matchBrackets)})}var x=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||8>document.documentMode),l=e.Pos,r={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},n=null;e.defineOption("matchBrackets",
!1,function(a,c,b){b&&b!=e.Init&&a.off("cursorActivity",w);c&&(a.state.matchBrackets="object"==typeof c?c:{},a.on("cursorActivity",w))});e.defineExtension("matchBrackets",function(){v(this,!0)});e.defineExtension("findMatchingBracket",function(a,c,b){return t(this,a,c,b)});e.defineExtension("scanForBracket",function(a,c,b,e){return u(this,a,c,b,e)})});
'use strict';(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 r(a,c,b,e){var d=a.getLineHandle(c.line),l=c.ch-1,d=0<=l&&q[d.text.charAt(l)]||q[d.text.charAt(++l)];if(!d)return null;var h=">"==d.charAt(1)?1:-1;if(b&&0<h!=(l==c.ch))return null;b=a.getTokenTypeAt(m(c.line,l+1));a=t(a,m(c.line,l+(0<h?1:0)),h,b||null,e);return null==a?null:{from:m(c.line,
l),to:a&&a.pos,match:a&&a.ch==d.charAt(0),forward:0<h}}function t(a,c,b,e,d){var l=d&&d.maxScanLineLength||1E4,h=d&&d.maxScanLines||1E3,g=[];d=d&&d.bracketRegex?d.bracketRegex:/[(){}[\]]/;for(var h=0<b?Math.min(c.line+h,a.lastLine()+1):Math.max(a.firstLine()-1,c.line-h),k=c.line;k!=h;k+=b){var n=a.getLine(k);if(n){var f=0<b?0:n.length-1,w=0<b?n.length:-1;if(!(n.length>l))for(k==c.line&&(f=c.ch-(0>b?1:0));f!=w;f+=b){var p=n.charAt(f);if(d.test(p)&&(void 0===e||a.getTokenTypeAt(m(k,f+1))==e))if(">"==
q[p].charAt(1)==0<b)g.push(p);else if(g.length)g.pop();else return{pos:m(k,f),ch:p}}}}return k-b==(0<b?a.lastLine():a.firstLine())?!1:null}function u(a,c,b){for(var e=a.state.matchBrackets.maxHighlightLineLength||1E3,d=[],f=a.listSelections(),h=0;h<f.length;h++){var g=f[h].empty()&&r(a,f[h].head,!1,b);if(g&&a.getLine(g.from.line).length<=e){var k=g.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";d.push(a.markText(g.from,m(g.from.line,g.from.ch+1),{className:k}));g.to&&a.getLine(g.to.line).length<=
e&&d.push(a.markText(g.to,m(g.to.line,g.to.ch+1),{className:k}))}}if(d.length)if(x&&a.state.focused&&a.focus(),b=function(){a.operation(function(){for(var a=0;a<d.length;a++)d[a].clear()})},c)setTimeout(b,800);else return b}function v(a){a.operation(function(){f&&(f(),f=null);f=u(a,!1,a.state.matchBrackets)})}var x=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||8>document.documentMode),m=e.Pos,q={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},f=null;e.defineOption("matchBrackets",
!1,function(a,c,b){b&&b!=e.Init&&(a.off("cursorActivity",v),f&&(f(),f=null));c&&(a.state.matchBrackets="object"==typeof c?c:{},a.on("cursorActivity",v))});e.defineExtension("matchBrackets",function(){u(this,!0)});e.defineExtension("findMatchingBracket",function(a,c,b){return r(this,a,c,b)});e.defineExtension("scanForBracket",function(a,c,b,e){return t(this,a,c,b,e)})});

View File

@ -1,20 +1,20 @@
(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 g(d,e){return d.string.charAt(d.pos+(e||0))}function q(d,e){if(e){var g=d.pos-e;return d.string.substr(0<=g?g:0,e)}return d.string.substr(0,d.pos-1)}function p(d,e){var g=d.string.length,m=g-d.pos+1;return d.string.substr(d.pos,e&&e<g?e:m)}function e(d,e){var g=d.pos+e,m;0>=g?d.pos=0:g>=(m=d.string.length-
1)?d.pos=m:d.pos=g}k.defineMode("perl",function(){function d(a,c,d,e,b){c.chain=null;c.style=null;c.tail=null;c.tokenize=function(a,c){for(var f=!1,g,k=0;g=a.next();){if(g===d[k]&&!f){void 0!==d[++k]?(c.chain=d[k],c.style=e,c.tail=b):b&&a.eatWhile(b);c.tokenize=n;break}f=!f&&"\\"==g}return e};return c.tokenize(a,c)}function k(a,c,d){c.tokenize=function(a,b){a.string==d&&(b.tokenize=n);a.skipToEnd();return"string"};return c.tokenize(a,c)}function n(a,c){if(a.eatSpace())return null;if(c.chain)return d(a,
c,c.chain,c.style,c.tail);if(a.match(/^\-?[\d\.]/,!1)&&a.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))return"number";if(a.match(/^<<(?=\w)/))return a.eatWhile(/\w/),k(a,c,a.current().substr(2));if(a.sol()&&a.match(/^\=item(?!\w)/))return k(a,c,"=cut");var h=a.next();if('"'==h||"'"==h){if(q(a,3)=="<<"+h){var l=a.pos;a.eatWhile(/\w/);var b=a.current().substr(1);if(b&&a.eat(h))return k(a,c,b);a.pos=l}return d(a,c,[h],"string")}if("q"==h&&(b=g(a,-2),!b||!/\w/.test(b)))if(b=
g(a,0),"x"==b){b=g(a,1);if("("==b)return e(a,2),d(a,c,[")"],"string-2",f);if("["==b)return e(a,2),d(a,c,["]"],"string-2",f);if("{"==b)return e(a,2),d(a,c,["}"],"string-2",f);if("<"==b)return e(a,2),d(a,c,[">"],"string-2",f);if(/[\^'"!~\/]/.test(b))return e(a,1),d(a,c,[a.eat(b)],"string-2",f)}else if("q"==b){b=g(a,1);if("("==b)return e(a,2),d(a,c,[")"],"string");if("["==b)return e(a,2),d(a,c,["]"],"string");if("{"==b)return e(a,2),d(a,c,["}"],"string");if("<"==b)return e(a,2),d(a,c,[">"],"string");
if(/[\^'"!~\/]/.test(b))return e(a,1),d(a,c,[a.eat(b)],"string")}else if("w"==b){b=g(a,1);if("("==b)return e(a,2),d(a,c,[")"],"bracket");if("["==b)return e(a,2),d(a,c,["]"],"bracket");if("{"==b)return e(a,2),d(a,c,["}"],"bracket");if("<"==b)return e(a,2),d(a,c,[">"],"bracket");if(/[\^'"!~\/]/.test(b))return e(a,1),d(a,c,[a.eat(b)],"bracket")}else if("r"==b){b=g(a,1);if("("==b)return e(a,2),d(a,c,[")"],"string-2",f);if("["==b)return e(a,2),d(a,c,["]"],"string-2",f);if("{"==b)return e(a,2),d(a,c,["}"],
"string-2",f);if("<"==b)return e(a,2),d(a,c,[">"],"string-2",f);if(/[\^'"!~\/]/.test(b))return e(a,1),d(a,c,[a.eat(b)],"string-2",f)}else if(/[\^'"!~\/(\[{<]/.test(b)){if("("==b)return e(a,1),d(a,c,[")"],"string");if("["==b)return e(a,1),d(a,c,["]"],"string");if("{"==b)return e(a,1),d(a,c,["}"],"string");if("<"==b)return e(a,1),d(a,c,[">"],"string");if(/[\^'"!~\/]/.test(b))return d(a,c,[a.eat(b)],"string")}if("m"==h&&(b=g(a,-2),!b||!/\w/.test(b))&&(b=a.eat(/[(\[{<\^'"!~\/]/))){if(/[\^'"!~\/]/.test(b))return d(a,
'use strict';(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 g(d,e){return d.string.charAt(d.pos+(e||0))}function q(d,e){if(e){var g=d.pos-e;return d.string.substr(0<=g?g:0,e)}return d.string.substr(0,d.pos-1)}function p(d,e){var g=d.string.length,r=g-d.pos+1;return d.string.substr(d.pos,e&&e<g?e:r)}function e(d,e){e=d.pos+e;var g;0>=e?d.pos=
0:e>=(g=d.string.length-1)?d.pos=g:d.pos=e}k.defineMode("perl",function(){function d(a,c,d,e,b){c.chain=null;c.style=null;c.tail=null;c.tokenize=function(a,c){for(var f=!1,g,h=0;g=a.next();){if(g===d[h]&&!f){void 0!==d[++h]?(c.chain=d[h],c.style=e,c.tail=b):b&&a.eatWhile(b);c.tokenize=n;break}f=!f&&"\\"==g}return e};return c.tokenize(a,c)}function k(a,c,d){c.tokenize=function(a,b){a.string==d&&(b.tokenize=n);a.skipToEnd();return"string"};return c.tokenize(a,c)}function n(a,c){if(a.eatSpace())return null;
if(c.chain)return d(a,c,c.chain,c.style,c.tail);if(a.match(/^\-?[\d\.]/,!1)&&a.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))return"number";if(a.match(/^<<(?=\w)/))return a.eatWhile(/\w/),k(a,c,a.current().substr(2));if(a.sol()&&a.match(/^\=item(?!\w)/))return k(a,c,"=cut");var h=a.next();if('"'==h||"'"==h){if(q(a,3)=="<<"+h){var l=a.pos;a.eatWhile(/\w/);var b=a.current().substr(1);if(b&&a.eat(h))return k(a,c,b);a.pos=l}return d(a,c,[h],"string")}if("q"==h&&
(b=g(a,-2),!b||!/\w/.test(b)))if(b=g(a,0),"x"==b){b=g(a,1);if("("==b)return e(a,2),d(a,c,[")"],"string-2",f);if("["==b)return e(a,2),d(a,c,["]"],"string-2",f);if("{"==b)return e(a,2),d(a,c,["}"],"string-2",f);if("<"==b)return e(a,2),d(a,c,[">"],"string-2",f);if(/[\^'"!~\/]/.test(b))return e(a,1),d(a,c,[a.eat(b)],"string-2",f)}else if("q"==b){b=g(a,1);if("("==b)return e(a,2),d(a,c,[")"],"string");if("["==b)return e(a,2),d(a,c,["]"],"string");if("{"==b)return e(a,2),d(a,c,["}"],"string");if("<"==b)return e(a,
2),d(a,c,[">"],"string");if(/[\^'"!~\/]/.test(b))return e(a,1),d(a,c,[a.eat(b)],"string")}else if("w"==b){b=g(a,1);if("("==b)return e(a,2),d(a,c,[")"],"bracket");if("["==b)return e(a,2),d(a,c,["]"],"bracket");if("{"==b)return e(a,2),d(a,c,["}"],"bracket");if("<"==b)return e(a,2),d(a,c,[">"],"bracket");if(/[\^'"!~\/]/.test(b))return e(a,1),d(a,c,[a.eat(b)],"bracket")}else if("r"==b){b=g(a,1);if("("==b)return e(a,2),d(a,c,[")"],"string-2",f);if("["==b)return e(a,2),d(a,c,["]"],"string-2",f);if("{"==
b)return e(a,2),d(a,c,["}"],"string-2",f);if("<"==b)return e(a,2),d(a,c,[">"],"string-2",f);if(/[\^'"!~\/]/.test(b))return e(a,1),d(a,c,[a.eat(b)],"string-2",f)}else if(/[\^'"!~\/(\[{<]/.test(b)){if("("==b)return e(a,1),d(a,c,[")"],"string");if("["==b)return e(a,1),d(a,c,["]"],"string");if("{"==b)return e(a,1),d(a,c,["}"],"string");if("<"==b)return e(a,1),d(a,c,[">"],"string");if(/[\^'"!~\/]/.test(b))return d(a,c,[a.eat(b)],"string")}if("m"==h&&(b=g(a,-2),!b||!/\w/.test(b))&&(b=a.eat(/[(\[{<\^'"!~\/]/))){if(/[\^'"!~\/]/.test(b))return d(a,
c,[b],"string-2",f);if("("==b)return d(a,c,[")"],"string-2",f);if("["==b)return d(a,c,["]"],"string-2",f);if("{"==b)return d(a,c,["}"],"string-2",f);if("<"==b)return d(a,c,[">"],"string-2",f)}if("s"==h&&(b=/[\/>\]})\w]/.test(g(a,-2)),!b&&(b=a.eat(/[(\[{<\^'"!~\/]/)))||"y"==h&&(b=/[\/>\]})\w]/.test(g(a,-2)),!b&&(b=a.eat(/[(\[{<\^'"!~\/]/)))||"t"==h&&(b=/[\/>\]})\w]/.test(g(a,-2)),!b&&(b=a.eat("r")))&&(b=a.eat(/[(\[{<\^'"!~\/]/)))return"["==b?d(a,c,["]","]"],"string-2",f):"{"==b?d(a,c,["}","}"],"string-2",
f):"<"==b?d(a,c,[">",">"],"string-2",f):"("==b?d(a,c,[")",")"],"string-2",f):d(a,c,[b,b],"string-2",f);if("`"==h)return d(a,c,[h],"variable-2");if("/"==h)return/~\s*$/.test(q(a))?d(a,c,[h],"string-2",f):"operator";if("$"==h){l=a.pos;if(a.eatWhile(/\d/)||a.eat("{")&&a.eatWhile(/\d/)&&a.eat("}"))return"variable-2";a.pos=l}if(/[$@%]/.test(h)){l=a.pos;if(a.eat("^")&&a.eat(/[A-Z]/)||!/[@$%&]/.test(g(a,-2))&&a.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/))if(b=a.current(),m[b])return"variable-2";a.pos=l}if(/[$@%&]/.test(h)&&
(a.eatWhile(/[\w$\[\]]/)||a.eat("{")&&a.eatWhile(/[\w$\[\]]/)&&a.eat("}")))return b=a.current(),m[b]?"variable-2":"variable";if("#"==h&&"$"!=g(a,-2))return a.skipToEnd(),"comment";if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(h)){l=a.pos;a.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/);if(m[a.current()])return"operator";a.pos=l}if("_"==h&&1==a.pos){if("_END__"==p(a,6))return d(a,c,["\x00"],"comment");if("_DATA__"==p(a,7))return d(a,c,["\x00"],"variable-2");if("_C__"==p(a,7))return d(a,c,["\x00"],"string")}if(/\w/.test(h)){l=
a.pos;if("{"==g(a,-2)&&("}"==g(a,0)||a.eatWhile(/\w/)&&"}"==g(a,0)))return"string";a.pos=l}if(/[A-Z]/.test(h)){var n=g(a,-2),l=a.pos;a.eatWhile(/[A-Z_]/);if(/[\da-z]/.test(g(a,0)))a.pos=l;else{b=m[a.current()];if(!b)return"meta";b[1]&&(b=b[0]);return":"!=n?1==b?"keyword":2==b?"def":3==b?"atom":4==b?"operator":5==b?"variable-2":"meta":"meta"}}if(/[a-zA-Z_]/.test(h)){n=g(a,-2);a.eatWhile(/\w/);b=m[a.current()];if(!b)return"meta";b[1]&&(b=b[0]);return":"!=n?1==b?"keyword":2==b?"def":3==b?"atom":4==b?
"operator":5==b?"variable-2":"meta":"meta"}return null}var m={"->":4,"++":4,"--":4,"**":4,"=~":4,"!~":4,"*":4,"/":4,"%":4,x:4,"+":4,"-":4,".":4,"<<":4,">>":4,"<":4,">":4,"<=":4,">=":4,lt:4,gt:4,le:4,ge:4,"==":4,"!=":4,"<=>":4,eq:4,ne:4,cmp:4,"~~":4,"&":4,"|":4,"^":4,"&&":4,"||":4,"//":4,"..":4,"...":4,"?":4,":":4,"=":4,"+=":4,"-=":4,"*=":4,",":4,"=>":4,"::":4,not:4,and:4,or:4,xor:4,BEGIN:[5,1],END:[5,1],PRINT:[5,1],PRINTF:[5,1],GETC:[5,1],READ:[5,1],READLINE:[5,1],DESTROY:[5,1],TIE:[5,1],TIEHANDLE:[5,
1],UNTIE:[5,1],STDIN:5,STDIN_TOP:5,STDOUT:5,STDOUT_TOP:5,STDERR:5,STDERR_TOP:5,$ARG:5,$_:5,"@ARG":5,"@_":5,$LIST_SEPARATOR:5,'$"':5,$PROCESS_ID:5,$PID:5,$$:5,$REAL_GROUP_ID:5,$GID:5,"$(":5,$EFFECTIVE_GROUP_ID:5,$EGID:5,"$)":5,$PROGRAM_NAME:5,$0:5,$SUBSCRIPT_SEPARATOR:5,$SUBSEP:5,"$;":5,$REAL_USER_ID:5,$UID:5,"$<":5,$EFFECTIVE_USER_ID:5,$EUID:5,"$>":5,$a:5,$b:5,$COMPILING:5,"$^C":5,$DEBUGGING:5,"$^D":5,"${^ENCODING}":5,$ENV:5,"%ENV":5,$SYSTEM_FD_MAX:5,"$^F":5,"@F":5,"${^GLOBAL_PHASE}":5,"$^H":5,"%^H":5,
"@INC":5,"%INC":5,$INPLACE_EDIT:5,"$^I":5,"$^M":5,$OSNAME:5,"$^O":5,"${^OPEN}":5,$PERLDB:5,"$^P":5,$SIG:5,"%SIG":5,$BASETIME:5,"$^T":5,"${^TAINT}":5,"${^UNICODE}":5,"${^UTF8CACHE}":5,"${^UTF8LOCALE}":5,$PERL_VERSION:5,"$^V":5,"${^WIN32_SLOPPY_STAT}":5,$EXECUTABLE_NAME:5,"$^X":5,$1:5,$MATCH:5,"$&":5,"${^MATCH}":5,$PREMATCH:5,"$`":5,"${^PREMATCH}":5,$POSTMATCH:5,"$'":5,"${^POSTMATCH}":5,$LAST_PAREN_MATCH:5,"$+":5,$LAST_SUBMATCH_RESULT:5,"$^N":5,"@LAST_MATCH_END":5,"@+":5,"%LAST_PAREN_MATCH":5,"%+":5,
"@LAST_MATCH_START":5,"@-":5,"%LAST_MATCH_START":5,"%-":5,$LAST_REGEXP_CODE_RESULT:5,"$^R":5,"${^RE_DEBUG_FLAGS}":5,"${^RE_TRIE_MAXBUF}":5,$ARGV:5,"@ARGV":5,ARGV:5,ARGVOUT:5,$OUTPUT_FIELD_SEPARATOR:5,$OFS:5,"$,":5,$INPUT_LINE_NUMBER:5,$NR:5,"$.":5,$INPUT_RECORD_SEPARATOR:5,$RS:5,"$/":5,$OUTPUT_RECORD_SEPARATOR:5,$ORS:5,"$\\":5,$OUTPUT_AUTOFLUSH:5,"$|":5,$ACCUMULATOR:5,"$^A":5,$FORMAT_FORMFEED:5,"$^L":5,$FORMAT_PAGE_NUMBER:5,"$%":5,$FORMAT_LINES_LEFT:5,"$-":5,$FORMAT_LINE_BREAK_CHARACTERS:5,"$:":5,
$FORMAT_LINES_PER_PAGE:5,"$=":5,$FORMAT_TOP_NAME:5,"$^":5,$FORMAT_NAME:5,"$~":5,"${^CHILD_ERROR_NATIVE}":5,$EXTENDED_OS_ERROR:5,"$^E":5,$EXCEPTIONS_BEING_CAUGHT:5,"$^S":5,$WARNING:5,"$^W":5,"${^WARNING_BITS}":5,$OS_ERROR:5,$ERRNO:5,"$!":5,"%OS_ERROR":5,"%ERRNO":5,"%!":5,$CHILD_ERROR:5,"$?":5,$EVAL_ERROR:5,"$@":5,$OFMT:5,"$#":5,"$*":5,$ARRAY_BASE:5,"$[":5,$OLD_PERL_VERSION:5,"$]":5,"if":[1,1],elsif:[1,1],"else":[1,1],"while":[1,1],unless:[1,1],"for":[1,1],foreach:[1,1],abs:1,accept:1,alarm:1,atan2:1,
bind:1,binmode:1,bless:1,bootstrap:1,"break":1,caller:1,chdir:1,chmod:1,chomp:1,chop:1,chown:1,chr:1,chroot:1,close:1,closedir:1,connect:1,"continue":[1,1],cos:1,crypt:1,dbmclose:1,dbmopen:1,"default":1,defined:1,"delete":1,die:1,"do":1,dump:1,each:1,endgrent:1,endhostent:1,endnetent:1,endprotoent:1,endpwent:1,endservent:1,eof:1,eval:1,exec:1,exists:1,exit:1,exp:1,fcntl:1,fileno:1,flock:1,fork:1,format:1,formline:1,getc:1,getgrent:1,getgrgid:1,getgrnam:1,gethostbyaddr:1,gethostbyname:1,gethostent:1,
getlogin:1,getnetbyaddr:1,getnetbyname:1,getnetent:1,getpeername:1,getpgrp:1,getppid:1,getpriority:1,getprotobyname:1,getprotobynumber:1,getprotoent:1,getpwent:1,getpwnam:1,getpwuid:1,getservbyname:1,getservbyport:1,getservent:1,getsockname:1,getsockopt:1,given:1,glob:1,gmtime:1,"goto":1,grep:1,hex:1,"import":1,index:1,"int":1,ioctl:1,join:1,keys:1,kill:1,last:1,lc:1,lcfirst:1,length:1,link:1,listen:1,local:2,localtime:1,lock:1,log:1,lstat:1,m:null,map:1,mkdir:1,msgctl:1,msgget:1,msgrcv:1,msgsnd:1,
my:2,"new":1,next:1,no:1,oct:1,open:1,opendir:1,ord:1,our:2,pack:1,"package":1,pipe:1,pop:1,pos:1,print:1,printf:1,prototype:1,push:1,q:null,qq:null,qr:null,quotemeta:null,qw:null,qx:null,rand:1,read:1,readdir:1,readline:1,readlink:1,readpipe:1,recv:1,redo:1,ref:1,rename:1,require:1,reset:1,"return":1,reverse:1,rewinddir:1,rindex:1,rmdir:1,s:null,say:1,scalar:1,seek:1,seekdir:1,select:1,semctl:1,semget:1,semop:1,send:1,setgrent:1,sethostent:1,setnetent:1,setpgrp:1,setpriority:1,setprotoent:1,setpwent:1,
setservent:1,setsockopt:1,shift:1,shmctl:1,shmget:1,shmread:1,shmwrite:1,shutdown:1,sin:1,sleep:1,socket:1,socketpair:1,sort:1,splice:1,split:1,sprintf:1,sqrt:1,srand:1,stat:1,state:1,study:1,sub:1,substr:1,symlink:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,tell:1,telldir:1,tie:1,tied:1,time:1,times:1,tr:null,truncate:1,uc:1,ucfirst:1,umask:1,undef:1,unlink:1,unpack:1,unshift:1,untie:1,use:1,utime:1,values:1,vec:1,wait:1,waitpid:1,wantarray:1,warn:1,when:1,write:1,y:null},f=/[goseximacplud]/;
return{startState:function(){return{tokenize:n,chain:null,style:null,tail:null}},token:function(a,c){return(c.tokenize||n)(a,c)},lineComment:"#"}});k.registerHelper("wordChars","perl",/[\w$]/);k.defineMIME("text/x-perl","perl")});
a.pos;if("{"==g(a,-2)&&("}"==g(a,0)||a.eatWhile(/\w/)&&"}"==g(a,0)))return"string";a.pos=l}if(/[A-Z]/.test(h))if(c=g(a,-2),l=a.pos,a.eatWhile(/[A-Z_]/),/[\da-z]/.test(g(a,0)))a.pos=l;else{b=m[a.current()];if(!b)return"meta";b[1]&&(b=b[0]);return":"!=c?1==b?"keyword":2==b?"def":3==b?"atom":4==b?"operator":5==b?"variable-2":"meta":"meta"}if(/[a-zA-Z_]/.test(h)){c=g(a,-2);a.eatWhile(/\w/);b=m[a.current()];if(!b)return"meta";b[1]&&(b=b[0]);return":"!=c?1==b?"keyword":2==b?"def":3==b?"atom":4==b?"operator":
5==b?"variable-2":"meta":"meta"}return null}var m={"->":4,"++":4,"--":4,"**":4,"=~":4,"!~":4,"*":4,"/":4,"%":4,x:4,"+":4,"-":4,".":4,"<<":4,">>":4,"<":4,">":4,"<=":4,">=":4,lt:4,gt:4,le:4,ge:4,"==":4,"!=":4,"<=>":4,eq:4,ne:4,cmp:4,"~~":4,"&":4,"|":4,"^":4,"&&":4,"||":4,"//":4,"..":4,"...":4,"?":4,":":4,"=":4,"+=":4,"-=":4,"*=":4,",":4,"=>":4,"::":4,not:4,and:4,or:4,xor:4,BEGIN:[5,1],END:[5,1],PRINT:[5,1],PRINTF:[5,1],GETC:[5,1],READ:[5,1],READLINE:[5,1],DESTROY:[5,1],TIE:[5,1],TIEHANDLE:[5,1],UNTIE:[5,
1],STDIN:5,STDIN_TOP:5,STDOUT:5,STDOUT_TOP:5,STDERR:5,STDERR_TOP:5,$ARG:5,$_:5,"@ARG":5,"@_":5,$LIST_SEPARATOR:5,'$"':5,$PROCESS_ID:5,$PID:5,$$:5,$REAL_GROUP_ID:5,$GID:5,"$(":5,$EFFECTIVE_GROUP_ID:5,$EGID:5,"$)":5,$PROGRAM_NAME:5,$0:5,$SUBSCRIPT_SEPARATOR:5,$SUBSEP:5,"$;":5,$REAL_USER_ID:5,$UID:5,"$<":5,$EFFECTIVE_USER_ID:5,$EUID:5,"$>":5,$a:5,$b:5,$COMPILING:5,"$^C":5,$DEBUGGING:5,"$^D":5,"${^ENCODING}":5,$ENV:5,"%ENV":5,$SYSTEM_FD_MAX:5,"$^F":5,"@F":5,"${^GLOBAL_PHASE}":5,"$^H":5,"%^H":5,"@INC":5,
"%INC":5,$INPLACE_EDIT:5,"$^I":5,"$^M":5,$OSNAME:5,"$^O":5,"${^OPEN}":5,$PERLDB:5,"$^P":5,$SIG:5,"%SIG":5,$BASETIME:5,"$^T":5,"${^TAINT}":5,"${^UNICODE}":5,"${^UTF8CACHE}":5,"${^UTF8LOCALE}":5,$PERL_VERSION:5,"$^V":5,"${^WIN32_SLOPPY_STAT}":5,$EXECUTABLE_NAME:5,"$^X":5,$1:5,$MATCH:5,"$&":5,"${^MATCH}":5,$PREMATCH:5,"$`":5,"${^PREMATCH}":5,$POSTMATCH:5,"$'":5,"${^POSTMATCH}":5,$LAST_PAREN_MATCH:5,"$+":5,$LAST_SUBMATCH_RESULT:5,"$^N":5,"@LAST_MATCH_END":5,"@+":5,"%LAST_PAREN_MATCH":5,"%+":5,"@LAST_MATCH_START":5,
"@-":5,"%LAST_MATCH_START":5,"%-":5,$LAST_REGEXP_CODE_RESULT:5,"$^R":5,"${^RE_DEBUG_FLAGS}":5,"${^RE_TRIE_MAXBUF}":5,$ARGV:5,"@ARGV":5,ARGV:5,ARGVOUT:5,$OUTPUT_FIELD_SEPARATOR:5,$OFS:5,"$,":5,$INPUT_LINE_NUMBER:5,$NR:5,"$.":5,$INPUT_RECORD_SEPARATOR:5,$RS:5,"$/":5,$OUTPUT_RECORD_SEPARATOR:5,$ORS:5,"$\\":5,$OUTPUT_AUTOFLUSH:5,"$|":5,$ACCUMULATOR:5,"$^A":5,$FORMAT_FORMFEED:5,"$^L":5,$FORMAT_PAGE_NUMBER:5,"$%":5,$FORMAT_LINES_LEFT:5,"$-":5,$FORMAT_LINE_BREAK_CHARACTERS:5,"$:":5,$FORMAT_LINES_PER_PAGE:5,
"$=":5,$FORMAT_TOP_NAME:5,"$^":5,$FORMAT_NAME:5,"$~":5,"${^CHILD_ERROR_NATIVE}":5,$EXTENDED_OS_ERROR:5,"$^E":5,$EXCEPTIONS_BEING_CAUGHT:5,"$^S":5,$WARNING:5,"$^W":5,"${^WARNING_BITS}":5,$OS_ERROR:5,$ERRNO:5,"$!":5,"%OS_ERROR":5,"%ERRNO":5,"%!":5,$CHILD_ERROR:5,"$?":5,$EVAL_ERROR:5,"$@":5,$OFMT:5,"$#":5,"$*":5,$ARRAY_BASE:5,"$[":5,$OLD_PERL_VERSION:5,"$]":5,"if":[1,1],elsif:[1,1],"else":[1,1],"while":[1,1],unless:[1,1],"for":[1,1],foreach:[1,1],abs:1,accept:1,alarm:1,atan2:1,bind:1,binmode:1,bless:1,
bootstrap:1,"break":1,caller:1,chdir:1,chmod:1,chomp:1,chop:1,chown:1,chr:1,chroot:1,close:1,closedir:1,connect:1,"continue":[1,1],cos:1,crypt:1,dbmclose:1,dbmopen:1,"default":1,defined:1,"delete":1,die:1,"do":1,dump:1,each:1,endgrent:1,endhostent:1,endnetent:1,endprotoent:1,endpwent:1,endservent:1,eof:1,eval:1,exec:1,exists:1,exit:1,exp:1,fcntl:1,fileno:1,flock:1,fork:1,format:1,formline:1,getc:1,getgrent:1,getgrgid:1,getgrnam:1,gethostbyaddr:1,gethostbyname:1,gethostent:1,getlogin:1,getnetbyaddr:1,
getnetbyname:1,getnetent:1,getpeername:1,getpgrp:1,getppid:1,getpriority:1,getprotobyname:1,getprotobynumber:1,getprotoent:1,getpwent:1,getpwnam:1,getpwuid:1,getservbyname:1,getservbyport:1,getservent:1,getsockname:1,getsockopt:1,given:1,glob:1,gmtime:1,"goto":1,grep:1,hex:1,"import":1,index:1,"int":1,ioctl:1,join:1,keys:1,kill:1,last:1,lc:1,lcfirst:1,length:1,link:1,listen:1,local:2,localtime:1,lock:1,log:1,lstat:1,m:null,map:1,mkdir:1,msgctl:1,msgget:1,msgrcv:1,msgsnd:1,my:2,"new":1,next:1,no:1,
oct:1,open:1,opendir:1,ord:1,our:2,pack:1,"package":1,pipe:1,pop:1,pos:1,print:1,printf:1,prototype:1,push:1,q:null,qq:null,qr:null,quotemeta:null,qw:null,qx:null,rand:1,read:1,readdir:1,readline:1,readlink:1,readpipe:1,recv:1,redo:1,ref:1,rename:1,require:1,reset:1,"return":1,reverse:1,rewinddir:1,rindex:1,rmdir:1,s:null,say:1,scalar:1,seek:1,seekdir:1,select:1,semctl:1,semget:1,semop:1,send:1,setgrent:1,sethostent:1,setnetent:1,setpgrp:1,setpriority:1,setprotoent:1,setpwent:1,setservent:1,setsockopt:1,
shift:1,shmctl:1,shmget:1,shmread:1,shmwrite:1,shutdown:1,sin:1,sleep:1,socket:1,socketpair:1,sort:1,splice:1,split:1,sprintf:1,sqrt:1,srand:1,stat:1,state:1,study:1,sub:1,substr:1,symlink:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,tell:1,telldir:1,tie:1,tied:1,time:1,times:1,tr:null,truncate:1,uc:1,ucfirst:1,umask:1,undef:1,unlink:1,unpack:1,unshift:1,untie:1,use:1,utime:1,values:1,vec:1,wait:1,waitpid:1,wantarray:1,warn:1,when:1,write:1,y:null},f=/[goseximacplud]/;return{startState:function(){return{tokenize:n,
chain:null,style:null,tail:null}},token:function(a,c){return(c.tokenize||n)(a,c)},lineComment:"#"}});k.registerHelper("wordChars","perl",/[\w$]/);k.defineMIME("text/x-perl","perl")});

View File

@ -1,9 +1,13 @@
(function(f){"object"==typeof exports&&"object"==typeof module?f(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],f):f(CodeMirror)})(function(f){function x(a,b){"string"==typeof a?a=new RegExp(a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),b?"gi":"g"):a.global||(a=new RegExp(a.source,a.ignoreCase?"gi":"g"));return{token:function(b){a.lastIndex=b.pos;
var c=a.exec(b.string);if(c&&c.index==b.pos)return b.pos+=c[0].length,"searching";c?b.pos=c.index:b.skipToEnd()}}}function y(){this.overlay=this.posFrom=this.posTo=this.lastQuery=this.query=null}function h(a){return a.state.search||(a.state.search=new y)}function k(a){return"string"==typeof a&&a==a.toLowerCase()}function l(a,b,d){return a.getSearchCursor(b,d,k(b))}function z(a,b,d,c){a.openDialog(b,c,{value:d,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){g(a)}})}function n(a,b,d,c,e){a.openDialog?
a.openDialog(b,e,{value:c,selectValueOnOpen:!0}):e(prompt(d,c))}function A(a,b,d,c){if(a.openConfirm)a.openConfirm(b,c);else if(confirm(d))c[0]()}function r(a){return a.replace(/\\(.)/g,function(a,d){return"n"==d?"\n":"r"==d?"\r":d})}function t(a){var b=a.match(/^\/(.*)\/([a-z]*)$/);if(b)try{a=new RegExp(b[1],-1==b[2].indexOf("i")?"":"i")}catch(d){}else a=r(a);if("string"==typeof a?""==a:a.test(""))a=/x^/;return a}function u(a,b,d){b.queryText=d;b.query=t(d);a.removeOverlay(b.overlay,k(b.query));
b.overlay=x(b.query,k(b.query));a.addOverlay(b.overlay);a.showMatchesOnScrollbar&&(b.annotate&&(b.annotate.clear(),b.annotate=null),b.annotate=a.showMatchesOnScrollbar(b.query,k(b.query)))}function m(a,b,d){var c=h(a);if(c.query)return p(a,b);var e=a.getSelection()||c.lastQuery;if(d&&a.openDialog){var q=null;z(a,'Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',e,function(b,
e){f.e_stop(e);b&&(b!=c.queryText&&u(a,c,b),q&&(q.style.opacity=1),p(a,e.shiftKey,function(b,c){var e;3>c.line&&document.querySelector&&(e=a.display.wrapper.querySelector(".CodeMirror-dialog"))&&e.getBoundingClientRect().bottom-4>a.cursorCoords(c,"window").top&&((q=e).style.opacity=.4)}))})}else n(a,'Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',"Search for:",e,function(e){e&&
!c.query&&a.operation(function(){u(a,c,e);c.posFrom=c.posTo=a.getCursor();p(a,b)})})}function p(a,b,d){a.operation(function(){var c=h(a),e=l(a,c.query,b?c.posFrom:c.posTo);if(!e.find(b)&&(e=l(a,c.query,b?f.Pos(a.lastLine()):f.Pos(a.firstLine(),0)),!e.find(b)))return;a.setSelection(e.from(),e.to());a.scrollIntoView({from:e.from(),to:e.to()},20);c.posFrom=e.from();c.posTo=e.to();d&&d(e.from(),e.to())})}function g(a){a.operation(function(){var b=h(a);if(b.lastQuery=b.query)b.query=b.queryText=null,a.removeOverlay(b.overlay),
b.annotate&&(b.annotate.clear(),b.annotate=null)})}function v(a,b,d){a.operation(function(){for(var c=l(a,b);c.findNext();)if("string"!=typeof b){var e=a.getRange(c.from(),c.to()).match(b);c.replace(d.replace(/\$(\d)/g,function(a,b){return e[b]}))}else c.replace(d)})}function w(a,b){if(!a.getOption("readOnly")){var d=a.getSelection()||h(a).lastQuery,c=b?"Replace all:":"Replace:";n(a,c+' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',
c,d,function(c){c&&(c=t(c),n(a,'With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',"Replace with:","",function(d){d=r(d);if(b)v(a,c,d);else{g(a);var f=l(a,c,a.getCursor()),h=function(){var b=f.from(),g;if(!(g=f.findNext())&&(f=l(a,c),!(g=f.findNext())||b&&f.from().line==b.line&&f.from().ch==b.ch))return;a.setSelection(f.from(),f.to());a.scrollIntoView({from:f.from(),to:f.to()});A(a,"Replace? <button>Yes</button> <button>No</button> <button>All</button> <button>Stop</button>",
"Replace?",[function(){k(g)},h,function(){v(a,c,d)}])},k=function(a){f.replace("string"==typeof c?d:d.replace(/\$(\d)/g,function(b,c){return a[c]}));h()};h()}}))})}}f.commands.find=function(a){g(a);m(a)};f.commands.findPersistent=function(a){g(a);m(a,!1,!0)};f.commands.findNext=m;f.commands.findPrev=function(a){m(a,!0)};f.commands.clearSearch=g;f.commands.replace=w;f.commands.replaceAll=function(a){w(a,!0)}});
'use strict';var $jscomp={scope:{},findInternal:function(b,h,e){b instanceof String&&(b=String(b));for(var k=b.length,g=0;g<k;g++){var l=b[g];if(h.call(e,l,g,b))return{i:g,v:l}}return{i:-1,v:void 0}}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(b,h,e){if(e.get||e.set)throw new TypeError("ES3 does not support getters and setters.");b!=Array.prototype&&b!=Object.prototype&&(b[h]=e.value)};
$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(b,h,e,k){if(h){e=$jscomp.global;b=b.split(".");for(k=0;k<b.length-1;k++){var g=b[k];g in e||(e[g]={});e=e[g]}b=b[b.length-1];k=e[b];h=h(k);h!=k&&null!=h&&$jscomp.defineProperty(e,b,{configurable:!0,writable:!0,value:h})}};
$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(b,e){return $jscomp.findInternal(this,b,e).v}},"es6-impl","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(c){a.lastIndex=c.pos;
var b=a.exec(c.string);if(b&&b.index==c.pos)return c.pos+=b[0].length||1,"searching";b?c.pos=b.index:c.skipToEnd()}}}function e(){this.overlay=this.posFrom=this.posTo=this.lastQuery=this.query=null}function k(a){return a.state.search||(a.state.search=new e)}function g(a){return"string"==typeof a&&a==a.toLowerCase()}function l(a,c,b){return a.getSearchCursor(c,b,g(c))}function y(a,c,b,f,d){a.openDialog(c,f,{value:b,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){n(a)},onKeyDown:d})}function r(a,
c,b,f,d){a.openDialog?a.openDialog(c,d,{value:f,selectValueOnOpen:!0}):d(prompt(b,f))}function z(a,c,b,f){if(a.openConfirm)a.openConfirm(c,f);else if(confirm(b))f[0]()}function u(a){return a.replace(/\\(.)/g,function(a,b){return"n"==b?"\n":"r"==b?"\r":b})}function v(a){var b=a.match(/^\/(.*)\/([a-z]*)$/);if(b)try{a=new RegExp(b[1],-1==b[2].indexOf("i")?"":"i")}catch(A){}else a=u(a);if("string"==typeof a?""==a:a.test(""))a=/x^/;return a}function p(a,b,e){b.queryText=e;b.query=v(e);a.removeOverlay(b.overlay,
g(b.query));b.overlay=h(b.query,g(b.query));a.addOverlay(b.overlay);a.showMatchesOnScrollbar&&(b.annotate&&(b.annotate.clear(),b.annotate=null),b.annotate=a.showMatchesOnScrollbar(b.query,g(b.query)))}function m(a,c,e,f){var d=k(a);if(d.query)return q(a,c);var g=a.getSelection()||d.lastQuery;if(e&&a.openDialog){var t=null,h=function(c,f){b.e_stop(f);c&&(c!=d.queryText&&(p(a,d,c),d.posFrom=d.posTo=a.getCursor()),t&&(t.style.opacity=1),q(a,f.shiftKey,function(b,c){var d;3>c.line&&document.querySelector&&
(d=a.display.wrapper.querySelector(".CodeMirror-dialog"))&&d.getBoundingClientRect().bottom-4>a.cursorCoords(c,"window").top&&((t=d).style.opacity=.4)}))};y(a,'Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',g,h,function(c,d){var f=b.keyName(c),e=b.keyMap[a.getOption("keyMap")][f];e||(e=a.getOption("extraKeys")[f]);if("findNext"==e||"findPrev"==e||"findPersistentNext"==
e||"findPersistentPrev"==e)b.e_stop(c),p(a,k(a),d),a.execCommand(e);else if("find"==e||"findPersistent"==e)b.e_stop(c),h(d,c)});f&&g&&(p(a,d,g),q(a,c))}else r(a,'Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',"Search for:",g,function(b){b&&!d.query&&a.operation(function(){p(a,d,b);d.posFrom=d.posTo=a.getCursor();q(a,c)})})}function q(a,c,e){a.operation(function(){var f=
k(a),d=l(a,f.query,c?f.posFrom:f.posTo);if(!d.find(c)&&(d=l(a,f.query,c?b.Pos(a.lastLine()):b.Pos(a.firstLine(),0)),!d.find(c)))return;a.setSelection(d.from(),d.to());a.scrollIntoView({from:d.from(),to:d.to()},20);f.posFrom=d.from();f.posTo=d.to();e&&e(d.from(),d.to())})}function n(a){a.operation(function(){var b=k(a);if(b.lastQuery=b.query)b.query=b.queryText=null,a.removeOverlay(b.overlay),b.annotate&&(b.annotate.clear(),b.annotate=null)})}function w(a,b,e){a.operation(function(){for(var c=l(a,
b);c.findNext();)if("string"!=typeof b){var d=a.getRange(c.from(),c.to()).match(b);c.replace(e.replace(/\$(\d)/g,function(a,b){return d[b]}))}else c.replace(e)})}function x(a,b){if(!a.getOption("readOnly")){var c=a.getSelection()||k(a).lastQuery,e=b?"Replace all:":"Replace:";r(a,e+' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',e,c,function(c){c&&(c=v(c),r(a,'With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',
"Replace with:","",function(e){e=u(e);if(b)w(a,c,e);else{n(a);var d=l(a,c,a.getCursor("from")),f=function(){var b=d.from(),h;if(!(h=d.findNext())&&(d=l(a,c),!(h=d.findNext())||b&&d.from().line==b.line&&d.from().ch==b.ch))return;a.setSelection(d.from(),d.to());a.scrollIntoView({from:d.from(),to:d.to()});z(a,"Replace? <button>Yes</button> <button>No</button> <button>All</button> <button>Stop</button>","Replace?",[function(){g(h)},f,function(){w(a,c,e)}])},g=function(a){d.replace("string"==typeof c?
e:e.replace(/\$(\d)/g,function(b,c){return a[c]}));f()};f()}}))})}}b.commands.find=function(a){n(a);m(a)};b.commands.findPersistent=function(a){n(a);m(a,!1,!0)};b.commands.findPersistentNext=function(a){m(a,!1,!0,!0)};b.commands.findPersistentPrev=function(a){m(a,!0,!0,!0)};b.commands.findNext=m;b.commands.findPrev=function(a){m(a,!0)};b.commands.clearSearch=n;b.commands.replace=x;b.commands.replaceAll=function(a){x(a,!0)}});

View File

@ -1,7 +1,10 @@
(function(g){"object"==typeof exports&&"object"==typeof module?g(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){function r(e,b,c,a){this.atOccurrence=!1;this.doc=e;null==a&&"string"==typeof b&&(a=!1);c=c?e.clipPos(c):k(0,0);this.pos={from:c,to:c};if("string"!=typeof b)b.global||(b=new RegExp(b.source,b.ignoreCase?"ig":"g")),this.matches=function(c,n){if(c){b.lastIndex=0;for(var a=e.getLine(n.line).slice(0,n.ch),
f=0,d,h;;){b.lastIndex=f;f=b.exec(a);if(!f)break;d=f;h=d.index;f=d.index+(d[0].length||1);if(f==a.length)break}(f=d&&d[0].length||0)||(0==h&&0==a.length?d=void 0:h!=e.getLine(n.line).length&&f++)}else b.lastIndex=n.ch,a=e.getLine(n.line),f=(d=b.exec(a))&&d[0].length||0,h=d&&d.index,h+f==a.length||f||(f=1);if(d&&f)return{from:k(n.line,h),to:k(n.line,h+f),match:d}};else{var g=b;a&&(b=b.toLowerCase());var m=a?function(b){return b.toLowerCase()}:function(b){return b},l=b.split("\n");if(1==l.length)this.matches=
b.length?function(c,a){if(c){var q=e.getLine(a.line).slice(0,a.ch),f=m(q),d=f.lastIndexOf(b);if(-1<d)return d=t(q,f,d),{from:k(a.line,d),to:k(a.line,d+g.length)}}else if(q=e.getLine(a.line).slice(a.ch),f=m(q),d=f.indexOf(b),-1<d)return d=t(q,f,d)+a.ch,{from:k(a.line,d),to:k(a.line,d+g.length)}}:function(){};else{var p=g.split("\n");this.matches=function(b,a){var c=l.length-1;if(b){if(!(a.line-(l.length-1)<e.firstLine())&&m(e.getLine(a.line).slice(0,p[c].length))==l[l.length-1]){for(var f=k(a.line,
p[c].length),d=a.line-1,h=c-1;1<=h;--h,--d)if(l[h]!=m(e.getLine(d)))return;var h=e.getLine(d),g=h.length-p[0].length;if(m(h.slice(g))==l[0])return{from:k(d,g),to:f}}}else if(!(a.line+(l.length-1)>e.lastLine())&&(h=e.getLine(a.line),g=h.length-p[0].length,m(h.slice(g))==l[0])){f=k(a.line,g);d=a.line+1;for(h=1;h<c;++h,++d)if(l[h]!=m(e.getLine(d)))return;if(m(e.getLine(d).slice(0,p[c].length))==l[c])return{from:f,to:k(d,p[c].length)}}}}}}function t(e,b,c){if(e.length==b.length)return c;for(b=Math.min(c,
e.length);;){var a=e.slice(0,b).toLowerCase().length;if(a<c)++b;else if(a>c)--b;else return b}}var k=g.Pos;r.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function b(a){a=k(a,0);c.pos={from:a,to:a};return c.atOccurrence=!1}for(var c=this,a=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,a))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!a.line)return b(0);a=k(a.line-1,this.doc.getLine(a.line-
1).length)}else{var g=this.doc.lineCount();if(a.line==g-1)return b(g);a=k(a.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(e,b){if(this.atOccurrence){var c=g.splitLines(e);this.doc.replaceRange(c,this.pos.from,this.pos.to,b);this.pos.to=k(this.pos.from.line+c.length-1,c[c.length-1].length+(1==c.length?this.pos.from.ch:0))}}};g.defineExtension("getSearchCursor",function(e,b,c){return new r(this.doc,e,b,
c)});g.defineDocExtension("getSearchCursor",function(e,b,c){return new r(this,e,b,c)});g.defineExtension("selectMatches",function(e,b){for(var c=[],a=this.getSearchCursor(e,this.getCursor("from"),b);a.findNext()&&!(0<g.cmpPos(a.to(),this.getCursor("to")));)c.push({anchor:a.from(),head:a.to()});c.length&&this.setSelections(c,0)})});
'use strict';var $jscomp={scope:{},findInternal:function(a,e,k){a instanceof String&&(a=String(a));for(var g=a.length,b=0;b<g;b++){var d=a[b];if(e.call(k,d,b,a))return{i:b,v:d}}return{i:-1,v:void 0}}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,k){if(k.get||k.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[e]=k.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,e,k,g){if(e){k=$jscomp.global;a=a.split(".");for(g=0;g<a.length-1;g++){var b=a[g];b in k||(k[b]={});k=k[b]}a=a[a.length-1];g=k[a];e=e(g);e!=g&&null!=e&&$jscomp.defineProperty(k,a,{configurable:!0,writable:!0,value:e})}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,k){return $jscomp.findInternal(this,a,k).v}},"es6-impl","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 e(b,a,h,q){this.atOccurrence=!1;this.doc=b;null==q&&"string"==typeof a&&(q=!1);h=h?b.clipPos(h):g(0,0);this.pos={from:h,to:h};if("string"!=typeof a)a.global||(a=new RegExp(a.source,a.ignoreCase?"ig":"g")),this.matches=function(m,f){if(m){a.lastIndex=0;m=b.getLine(f.line).slice(0,f.ch);for(var l=
0,c,d;;){a.lastIndex=l;l=a.exec(m);if(!l)break;c=l;d=c.index;l=c.index+(c[0].length||1);if(l==m.length)break}(l=c&&c[0].length||0)||(0==d&&0==m.length?c=void 0:d!=b.getLine(f.line).length&&l++)}else a.lastIndex=f.ch,m=b.getLine(f.line),l=(c=a.exec(m))&&c[0].length||0,d=c&&c.index,d+l==m.length||l||(l=1);if(c&&l)return{from:g(f.line,d),to:g(f.line,d+l),match:c}};else{var d=a;q&&(a=a.toLowerCase());var e=q?function(a){return a.toLowerCase()}:function(a){return a},n=a.split("\n");if(1==n.length)this.matches=
a.length?function(m,f){if(m){m=b.getLine(f.line).slice(0,f.ch);var l=e(m),c=l.lastIndexOf(a);if(-1<c)return c=k(m,l,c),{from:g(f.line,c),to:g(f.line,c+d.length)}}else if(m=b.getLine(f.line).slice(f.ch),l=e(m),c=l.indexOf(a),-1<c)return c=k(m,l,c)+f.ch,{from:g(f.line,c),to:g(f.line,c+d.length)}}:function(){};else{var p=d.split("\n");this.matches=function(a,f){var d=n.length-1;if(a){if(!(f.line-(n.length-1)<b.firstLine()||e(b.getLine(f.line).slice(0,p[d].length))!=n[n.length-1])){a=g(f.line,p[d].length);
f=f.line-1;for(var c=d-1;1<=c;--c,--f)if(n[c]!=e(b.getLine(f)))return;var c=b.getLine(f),h=c.length-p[0].length;return e(c.slice(h))!=n[0]?void 0:{from:g(f,h),to:a}}}else if(!(f.line+(n.length-1)>b.lastLine())&&(c=b.getLine(f.line),h=c.length-p[0].length,e(c.slice(h))==n[0])){a=g(f.line,h);f=f.line+1;for(c=1;c<d;++c,++f)if(n[c]!=e(b.getLine(f)))return;return e(b.getLine(f).slice(0,p[d].length))!=n[d]?void 0:{from:a,to:g(f,p[d].length)}}}}}}function k(a,d,h){if(a.length==d.length)return h;for(d=Math.min(h,
a.length);;){var b=a.slice(0,d).toLowerCase().length;if(b<h)++d;else if(b>h)--d;else return d}}var g=a.Pos;e.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function b(a){a=g(a,0);h.pos={from:a,to:a};return h.atOccurrence=!1}for(var h=this,e=this.doc.clipPos(a?this.pos.from:this.pos.to);;){if(this.pos=this.matches(a,e))return this.atOccurrence=!0,this.pos.match||!0;if(a){if(!e.line)return b(0);e=g(e.line-1,this.doc.getLine(e.line-
1).length)}else{var k=this.doc.lineCount();if(e.line==k-1)return b(k);e=g(e.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(b,d){this.atOccurrence&&(b=a.splitLines(b),this.doc.replaceRange(b,this.pos.from,this.pos.to,d),this.pos.to=g(this.pos.from.line+b.length-1,b[b.length-1].length+(1==b.length?this.pos.from.ch:0)))}};a.defineExtension("getSearchCursor",function(a,d,h){return new e(this.doc,a,d,h)});
a.defineDocExtension("getSearchCursor",function(a,d,h){return new e(this,a,d,h)});a.defineExtension("selectMatches",function(b,d){var e=[];for(b=this.getSearchCursor(b,this.getCursor("from"),d);b.findNext()&&!(0<a.cmpPos(b.to(),this.getCursor("to")));)e.push({anchor:b.from(),head:b.to()});e.length&&this.setSelections(e,0)})});

View File

@ -1,38 +1 @@
.CodeMirror-hints {
position: absolute;
z-index: 10;
overflow: hidden;
list-style: none;
margin: 0;
padding: 2px;
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
border-radius: 3px;
border: 1px solid silver;
background: white;
font-size: 90%;
font-family: monospace;
max-height: 20em;
overflow-y: auto;
}
.CodeMirror-hint {
margin: 0;
padding: 0 4px;
border-radius: 2px;
max-width: 19em;
overflow: hidden;
white-space: pre;
color: black;
cursor: pointer;
}
li.CodeMirror-hint-active {
background: #08f;
color: white;
}
.CodeMirror-hints{position:absolute;z-index:10;overflow:hidden;list-style:none;margin:0;padding:2px;-webkit-box-shadow:2px 3px 5px rgba(0,0,0,.2);-moz-box-shadow:2px 3px 5px rgba(0,0,0,.2);box-shadow:2px 3px 5px rgba(0,0,0,.2);border-radius:3px;border:1px solid silver;background:#fff;font-size:90%;font-family:monospace;max-height:20em;overflow-y:auto}.CodeMirror-hint{margin:0;padding:0 4px;border-radius:2px;white-space:pre;color:#000;cursor:pointer}li.CodeMirror-hint-active{background:#08f;color:#fff}

View File

@ -1,18 +1,17 @@
(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 p(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;var c=this;a.on("cursorActivity",this.activityFunc=function(){c.cursorActivity()})}function z(a,
b){function c(a,c){var d;d="string"!=typeof c?function(a){return c(a,b)}:e.hasOwnProperty(c)?e[c]:c;f[a]=d}var e={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},d=a.options.customKeys,f=d?{}:e;if(d)for(var g in d)d.hasOwnProperty(g)&&c(g,d[g]);if(d=a.options.extraKeys)for(g in d)d.hasOwnProperty(g)&&
c(g,d[g]);return f}function t(a,b){for(;b&&b!=a;){if("LI"===b.nodeName.toUpperCase()&&b.parentNode==a)return b;b=b.parentNode}}function u(a,b){this.completion=a;this.data=b;this.picked=!1;var c=this,e=a.cm,d=this.hints=document.createElement("ul");d.className="CodeMirror-hints";this.selectedHint=b.selectedHint||0;for(var l=b.list,g=0;g<l.length;++g){var m=d.appendChild(document.createElement("li")),h=l[g],k="CodeMirror-hint"+(g!=this.selectedHint?"":" CodeMirror-hint-active");null!=h.className&&(k=
h.className+" "+k);m.className=k;h.render?h.render(m,b,h):m.appendChild(document.createTextNode(h.displayText||("string"==typeof h?h:h.text)));m.hintId=g}var g=e.cursorCoords(a.options.alignWithWord?b.from:null),q=g.left,r=g.bottom,v=!0;d.style.left=q+"px";d.style.top=r+"px";m=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth);k=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(a.options.container||document.body).appendChild(d);
h=d.getBoundingClientRect();if(0<h.bottom-k){var n=h.bottom-h.top;0<g.top-(g.bottom-h.top)-n?(d.style.top=(r=g.top-n)+"px",v=!1):n>k&&(d.style.height=k-5+"px",d.style.top=(r=g.bottom-h.top)+"px",k=e.getCursor(),b.from.ch!=k.ch&&(g=e.cursorCoords(k),d.style.left=(q=g.left)+"px",h=d.getBoundingClientRect()))}k=h.right-m;0<k&&(h.right-h.left>m&&(d.style.width=m-5+"px",k-=h.right-h.left-m),d.style.left=(q=g.left-k)+"px");e.addKeyMap(this.keyMap=z(a,{moveFocus:function(a,b){c.changeActive(c.selectedHint+
a,b)},setFocus:function(a){c.changeActive(a)},menuSize:function(){return c.screenAmount()},length:l.length,close:function(){a.close()},pick:function(){c.pick()},data:b}));if(a.options.closeOnUnfocus){var w;e.on("blur",this.onBlur=function(){w=setTimeout(function(){a.close()},100)});e.on("focus",this.onFocus=function(){clearTimeout(w)})}var p=e.getScrollInfo();e.on("scroll",this.onScroll=function(){var c=e.getScrollInfo(),b=e.getWrapperElement().getBoundingClientRect(),g=r+p.top-c.top,f=g-(window.pageYOffset||
(document.documentElement||document.body).scrollTop);v||(f+=d.offsetHeight);if(f<=b.top||f>=b.bottom)return a.close();d.style.top=g+"px";d.style.left=q+p.left-c.left+"px"});f.on(d,"dblclick",function(a){(a=t(d,a.target||a.srcElement))&&null!=a.hintId&&(c.changeActive(a.hintId),c.pick())});f.on(d,"click",function(b){(b=t(d,b.target||b.srcElement))&&null!=b.hintId&&(c.changeActive(b.hintId),a.options.completeOnSingleClick&&c.pick())});f.on(d,"mousedown",function(){setTimeout(function(){e.focus()},20)});
f.signal(b,"select",l[0],d.firstChild);return!0}function x(a,b){if(!a.somethingSelected())return b;for(var c=[],e=0;e<b.length;e++)b[e].supportsSelection&&c.push(b[e]);return c}f.showHint=function(a,b,c){if(!b)return a.showHint(c);c&&c.async&&(b.async=!0);b={hint:b};if(c)for(var e in c)b[e]=c[e];return a.showHint(b)};f.defineExtension("showHint",function(a){var b=this.getCursor("start"),c=this.options.hintOptions,e={},d;for(d in y)e[d]=y[d];if(c)for(d in c)void 0!==c[d]&&(e[d]=c[d]);if(a)for(d in a)void 0!==
a[d]&&(e[d]=a[d]);e.hint.resolve&&(e.hint=e.hint.resolve(this,b));a=e;b=this.listSelections();if(!(1<b.length)){if(this.somethingSelected()){if(!a.hint.supportsSelection)return;for(d=0;d<b.length;d++)if(b[d].head.line!=b[d].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();b=this.state.completionActive=new p(this,a);b.options.hint&&(f.signal(this,"startCompletion",this),b.update(!0))}});var A=window.requestAnimationFrame||function(a){return setTimeout(a,1E3/60)},
B=window.cancelAnimationFrame||clearTimeout;p.prototype={close:function(){this.active()&&(this.tick=this.cm.state.completionActive=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&f.signal(this.data,"close"),this.widget&&this.widget.close(),f.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(a,b){var c=a.list[b];c.hint?c.hint(this.cm,a,c):this.cm.replaceRange("string"==typeof c?c:c.text,c.from||a.from,
c.to||a.to,"complete");f.signal(a,"pick",c);this.close()},cursorActivity:function(){this.debounce&&(B(this.debounce),this.debounce=0);var a=this.cm.getCursor(),b=this.cm.getLine(a.line);if(a.line!=this.startPos.line||b.length-a.ch!=this.startLen-this.startPos.ch||a.ch<this.startPos.ch||this.cm.somethingSelected()||a.ch&&this.options.closeCharacters.test(b.charAt(a.ch-1)))this.close();else{var c=this;this.debounce=A(function(){c.update()});this.widget&&this.widget.disable()}},update:function(a){if(null!=
this.tick)if(this.options.hint.async){var b=++this.tick,c=this;this.options.hint(this.cm,function(e){c.tick==b&&c.finishUpdate(e,a)},this.options)}else this.finishUpdate(this.options.hint(this.cm,this.options),a)},finishUpdate:function(a,b){this.data&&f.signal(this.data,"update");a&&this.data&&f.cmpPos(a.from,this.data.from)&&(a=null);this.data=a;var c=this.widget&&this.widget.picked||b&&this.options.completeSingle;this.widget&&this.widget.close();a&&a.list.length&&(c&&1==a.list.length?this.pick(a,
0):(this.widget=new u(this,a),f.signal(a,"shown")))}};u.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null;this.hints.parentNode.removeChild(this.hints);this.completion.cm.removeKeyMap(this.keyMap);var a=this.completion.cm;this.completion.options.closeOnUnfocus&&(a.off("blur",this.onBlur),a.off("focus",this.onFocus));a.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var a=this;this.keyMap={Enter:function(){a.picked=
!0}};this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(a,b){a>=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){var c=this.hints.childNodes[this.selectedHint];c.className=c.className.replace(" CodeMirror-hint-active","");c=this.hints.childNodes[this.selectedHint=a];c.className+=" CodeMirror-hint-active";c.offsetTop<this.hints.scrollTop?this.hints.scrollTop=
c.offsetTop-3:c.offsetTop+c.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=c.offsetTop+c.offsetHeight-this.hints.clientHeight+3);f.signal(this.data,"select",this.data.list[this.selectedHint],c)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}};f.registerHelper("hint","auto",{resolve:function(a,b){var c=a.getHelpers(b,"hint"),e;if(c.length){for(var d=!1,l=0;l<c.length;l++)c[l].async&&(d=!0);d?(d=function(a,
b,d){function e(c,l){if(c==f.length)return b(null);var n=f[c];n.async?n(a,function(a){a?b(a):e(c+1)},d):(l=n(a,d))?b(l):e(c+1)}var f=x(a,c);e(0)},d.async=!0):d=function(a,b){for(var d=x(a,c),e=0;e<d.length;e++){var f=d[e](a,b);if(f&&f.list.length)return f}};d.supportsSelection=!0;return d}return(e=a.getHelper(a.getCursor(),"hintWords"))?function(a){return f.hint.fromList(a,{words:e})}:f.hint.anyword?function(a,b){return f.hint.anyword(a,b)}:function(){}}});f.registerHelper("hint","fromList",function(a,
b){var c=a.getCursor(),e=a.getTokenAt(c),d=f.Pos(c.line,e.end);if(e.string&&/\w/.test(e.string[e.string.length-1]))var l=e.string,c=f.Pos(c.line,e.start);else l="",c=d;for(var e=[],g=0;g<b.words.length;g++){var m=b.words[g];m.slice(0,l.length)==l&&e.push(m)}if(e.length)return{list:e,from:c,to:d}});f.commands.autocomplete=f.showHint;var y={hint:f.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,
extraKeys:null};f.defineOption("hintOptions",null)});
'use strict';(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 n(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;var c=this;a.on("cursorActivity",this.activityFunc=function(){c.cursorActivity()})}
function y(a,b){function c(a,d){var c;c="string"!=typeof d?function(a){return d(a,b)}:e.hasOwnProperty(d)?e[d]:d;f[a]=c}var e={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},d=a.options.customKeys,f=d?{}:e;if(d)for(var g in d)d.hasOwnProperty(g)&&c(g,d[g]);if(a=a.options.extraKeys)for(g in a)a.hasOwnProperty(g)&&
c(g,a[g]);return f}function w(a,b){for(;b&&b!=a;){if("LI"===b.nodeName.toUpperCase()&&b.parentNode==a)return b;b=b.parentNode}}function q(a,b){this.completion=a;this.data=b;this.picked=!1;var c=this,e=a.cm,d=this.hints=document.createElement("ul");d.className="CodeMirror-hints";this.selectedHint=b.selectedHint||0;for(var m=b.list,g=0;g<m.length;++g){var l=d.appendChild(document.createElement("li")),h=m[g],p="CodeMirror-hint"+(g!=this.selectedHint?"":" CodeMirror-hint-active");null!=h.className&&(p=
h.className+" "+p);l.className=p;h.render?h.render(l,b,h):l.appendChild(document.createTextNode(h.displayText||("string"==typeof h?h:h.text)));l.hintId=g}var g=e.cursorCoords(a.options.alignWithWord?b.from:null),u=g.left,v=g.bottom,n=!0;d.style.left=u+"px";d.style.top=v+"px";var l=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),k=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(a.options.container||document.body).appendChild(d);
var h=d.getBoundingClientRect(),r=h.bottom-k,p=d.scrollHeight>d.clientHeight+1,q=e.getScrollInfo();0<r&&(r=h.bottom-h.top,0<g.top-(g.bottom-h.top)-r?(d.style.top=(v=g.top-r)+"px",n=!1):r>k&&(d.style.height=k-5+"px",d.style.top=(v=g.bottom-h.top)+"px",k=e.getCursor(),b.from.ch!=k.ch&&(g=e.cursorCoords(k),d.style.left=(u=g.left)+"px",h=d.getBoundingClientRect())));k=h.right-l;0<k&&(h.right-h.left>l&&(d.style.width=l-5+"px",k-=h.right-h.left-l),d.style.left=(u=g.left-k)+"px");if(p)for(g=d.firstChild;g;g=
g.nextSibling)g.style.paddingRight=e.display.nativeBarWidth+"px";e.addKeyMap(this.keyMap=y(a,{moveFocus:function(a,b){c.changeActive(c.selectedHint+a,b)},setFocus:function(a){c.changeActive(a)},menuSize:function(){return c.screenAmount()},length:m.length,close:function(){a.close()},pick:function(){c.pick()},data:b}));if(a.options.closeOnUnfocus){var t;e.on("blur",this.onBlur=function(){t=setTimeout(function(){a.close()},100)});e.on("focus",this.onFocus=function(){clearTimeout(t)})}e.on("scroll",this.onScroll=
function(){var b=e.getScrollInfo(),c=e.getWrapperElement().getBoundingClientRect(),g=v+q.top-b.top,f=g-(window.pageYOffset||(document.documentElement||document.body).scrollTop);n||(f+=d.offsetHeight);if(f<=c.top||f>=c.bottom)return a.close();d.style.top=g+"px";d.style.left=u+q.left-b.left+"px"});f.on(d,"dblclick",function(a){(a=w(d,a.target||a.srcElement))&&null!=a.hintId&&(c.changeActive(a.hintId),c.pick())});f.on(d,"click",function(b){(b=w(d,b.target||b.srcElement))&&null!=b.hintId&&(c.changeActive(b.hintId),
a.options.completeOnSingleClick&&c.pick())});f.on(d,"mousedown",function(){setTimeout(function(){e.focus()},20)});f.signal(b,"select",m[0],d.firstChild);return!0}function z(a,b){if(!a.somethingSelected())return b;a=[];for(var c=0;c<b.length;c++)b[c].supportsSelection&&a.push(b[c]);return a}function t(a,b,c,e){a.async?a(b,e,c):(a=a(b,c))&&a.then?a.then(e):e(a)}f.showHint=function(a,b,c){if(!b)return a.showHint(c);c&&c.async&&(b.async=!0);b={hint:b};if(c)for(var e in c)b[e]=c[e];return a.showHint(b)};
f.defineExtension("showHint",function(a){var b=this.getCursor("start"),c=this.options.hintOptions,e={},d;for(d in x)e[d]=x[d];if(c)for(d in c)void 0!==c[d]&&(e[d]=c[d]);if(a)for(d in a)void 0!==a[d]&&(e[d]=a[d]);e.hint.resolve&&(e.hint=e.hint.resolve(this,b));a=e;b=this.listSelections();if(!(1<b.length)){if(this.somethingSelected()){if(!a.hint.supportsSelection)return;for(d=0;d<b.length;d++)if(b[d].head.line!=b[d].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();
b=this.state.completionActive=new n(this,a);b.options.hint&&(f.signal(this,"startCompletion",this),b.update(!0))}});var A=window.requestAnimationFrame||function(a){return setTimeout(a,1E3/60)},B=window.cancelAnimationFrame||clearTimeout;n.prototype={close:function(){this.active()&&(this.tick=this.cm.state.completionActive=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&f.signal(this.data,"close"),this.widget&&this.widget.close(),f.signal(this.cm,"endCompletion",this.cm))},
active:function(){return this.cm.state.completionActive==this},pick:function(a,b){b=a.list[b];b.hint?b.hint(this.cm,a,b):this.cm.replaceRange("string"==typeof b?b:b.text,b.from||a.from,b.to||a.to,"complete");f.signal(a,"pick",b);this.close()},cursorActivity:function(){this.debounce&&(B(this.debounce),this.debounce=0);var a=this.cm.getCursor(),b=this.cm.getLine(a.line);if(a.line!=this.startPos.line||b.length-a.ch!=this.startLen-this.startPos.ch||a.ch<this.startPos.ch||this.cm.somethingSelected()||
a.ch&&this.options.closeCharacters.test(b.charAt(a.ch-1)))this.close();else{var c=this;this.debounce=A(function(){c.update()});this.widget&&this.widget.disable()}},update:function(a){if(null!=this.tick){var b=this,c=++this.tick;t(this.options.hint,this.cm,this.options,function(e){b.tick==c&&b.finishUpdate(e,a)})}},finishUpdate:function(a,b){this.data&&f.signal(this.data,"update");b=this.widget&&this.widget.picked||b&&this.options.completeSingle;this.widget&&this.widget.close();var c;if(c=a&&this.data)c=
this.data,c=0<f.cmpPos(a.from,c.from)&&c.to.ch-c.from.ch!=a.to.ch-a.from.ch;c||(this.data=a)&&a.list.length&&(b&&1==a.list.length?this.pick(a,0):(this.widget=new q(this,a),f.signal(a,"shown")))}};q.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null;this.hints.parentNode.removeChild(this.hints);this.completion.cm.removeKeyMap(this.keyMap);var a=this.completion.cm;this.completion.options.closeOnUnfocus&&(a.off("blur",this.onBlur),a.off("focus",this.onFocus));a.off("scroll",
this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var a=this;this.keyMap={Enter:function(){a.picked=!0}};this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(a,b){a>=this.data.list.length?a=b?this.data.list.length-1:0:0>a&&(a=b?0:this.data.list.length-1);this.selectedHint!=a&&(b=this.hints.childNodes[this.selectedHint],b.className=b.className.replace(" CodeMirror-hint-active",""),b=this.hints.childNodes[this.selectedHint=
a],b.className+=" CodeMirror-hint-active",b.offsetTop<this.hints.scrollTop?this.hints.scrollTop=b.offsetTop-3:b.offsetTop+b.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=b.offsetTop+b.offsetHeight-this.hints.clientHeight+3),f.signal(this.data,"select",this.data.list[this.selectedHint],b))},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}};f.registerHelper("hint","auto",{resolve:function(a,b){var c=a.getHelpers(b,
"hint"),e;return c.length?(a=function(a,b,e){function d(c){if(c==f.length)return b(null);t(f[c],a,e,function(a){a&&0<a.list.length?b(a):d(c+1)})}var f=z(a,c);d(0)},a.async=!0,a.supportsSelection=!0,a):(e=a.getHelper(a.getCursor(),"hintWords"))?function(a){return f.hint.fromList(a,{words:e})}:f.hint.anyword?function(a,b){return f.hint.anyword(a,b)}:function(){}}});f.registerHelper("hint","fromList",function(a,b){var c=a.getCursor(),e=a.getTokenAt(c);a=f.Pos(c.line,e.end);if(e.string&&/\w/.test(e.string[e.string.length-
1]))var d=e.string,c=f.Pos(c.line,e.start);else d="",c=a;for(var e=[],m=0;m<b.words.length;m++){var g=b.words[m];g.slice(0,d.length)==d&&e.push(g)}if(e.length)return{list:e,from:c,to:a}});f.commands.autocomplete=f.showHint;var x={hint:f.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};f.defineOption("hintOptions",null)});

View File

@ -1,139 +1,146 @@
(function(q){"object"==typeof exports&&"object"==typeof module?q(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"],q):q(CodeMirror)})(function(q){var D=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",
'use strict';var $jscomp={scope:{},findInternal:function(h,r,u){h instanceof String&&(h=String(h));for(var m=h.length,A=0;A<m;A++){var P=h[A];if(r.call(u,P,A,h))return{i:A,v:P}}return{i:-1,v:void 0}}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(h,r,u){if(u.get||u.set)throw new TypeError("ES3 does not support getters and setters.");h!=Array.prototype&&h!=Object.prototype&&(h[r]=u.value)};
$jscomp.getGlobal=function(h){return"undefined"!=typeof window&&window===h?h:"undefined"!=typeof global&&null!=global?global:h};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(h,r,u,m){if(r){u=$jscomp.global;h=h.split(".");for(m=0;m<h.length-1;m++){var A=h[m];A in u||(u[A]={});u=u[A]}h=h[h.length-1];m=u[h];r=r(m);r!=m&&null!=r&&$jscomp.defineProperty(u,h,{configurable:!0,writable:!0,value:r})}};
$jscomp.polyfill("Array.prototype.find",function(h){return h?h:function(h,u){return $jscomp.findInternal(this,h,u).v}},"es6-impl","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(h){return $jscomp.SYMBOL_PREFIX+(h||"")+$jscomp.symbolCounter_++};
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var h=$jscomp.global.Symbol.iterator;h||(h=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[h]&&$jscomp.defineProperty(Array.prototype,h,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(h){var r=0;return $jscomp.iteratorPrototype(function(){return r<h.length?{done:!1,value:h[r++]}:{done:!0}})};
$jscomp.iteratorPrototype=function(h){$jscomp.initSymbolIterator();h={next:h};h[$jscomp.global.Symbol.iterator]=function(){return this};return h};$jscomp.array=$jscomp.array||{};$jscomp.iteratorFromArray=function(h,r){$jscomp.initSymbolIterator();h instanceof String&&(h+="");var u=0,m={next:function(){if(u<h.length){var A=u++;return{value:r(A,h[A]),done:!1}}m.next=function(){return{done:!0,value:void 0}};return m.next()}};m[Symbol.iterator]=function(){return m};return m};
$jscomp.polyfill("Array.prototype.keys",function(h){return h?h:function(){return $jscomp.iteratorFromArray(this,function(h){return h})}},"es6-impl","es3");$jscomp.checkStringArgs=function(h,r,u){if(null==h)throw new TypeError("The 'this' value for String.prototype."+u+" must not be null or undefined");if(r instanceof RegExp)throw new TypeError("First argument to String.prototype."+u+" must not be a regular expression");return h+""};
$jscomp.polyfill("String.prototype.repeat",function(h){return h?h:function(h){var r=$jscomp.checkStringArgs(this,null,"repeat");if(0>h||1342177279<h)throw new RangeError("Invalid count value");h|=0;for(var m="";h;)if(h&1&&(m+=r),h>>>=1)r+=r;return m}},"es6-impl","es3");
(function(h){"object"==typeof exports&&"object"==typeof module?h(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"],h):h(CodeMirror)})(function(h){var r=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",
type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},
{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",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:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",
toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{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:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",
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:"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<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",
type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},
{keys:"`<character>",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:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",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:"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:"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:"moveToEol",motionArgs:{inclusive:!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:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},
toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",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:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",
motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",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:"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<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,
inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",
motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",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:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",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:"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:"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:"moveToEol",motionArgs:{inclusive:!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:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},
{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",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:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},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:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",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<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<character>",type:"action",action:"replayMacro"},{keys:"q<character>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},
context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<character>",type:"action",action:"setMark"},{keys:'"<character>',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",
action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,
backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",
wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],wa=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},
{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],m=q.Pos;q.Vim=
function(){function ka(a,b){this==q.keyMap.vim&&q.rmClass(a.getWrapperElement(),"cm-fat-cursor");b&&b.attach==S||(a.setOption("disableInput",!1),a.off("cursorActivity",xa),q.off(a.getInputField(),"paste",ya(a)),a.state.vim=null)}function S(a,b){this==q.keyMap.vim&&q.addClass(a.getWrapperElement(),"cm-fat-cursor");b&&b.attach==S||(a.setOption("disableInput",!0),a.setOption("showCursorWhenSelecting",!1),q.signal(a,"vim-mode-change",{mode:"normal"}),a.on("cursorActivity",xa),aa(a),q.on(a.getInputField(),
"paste",ya(a)))}function la(a,b){if(b){var c=fb(a);if(!c)return!1;var d=q.Vim.findKey(b,c);"function"==typeof d&&q.signal(b,"vim-keypress",c);return d}}function fb(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<a.length;d++){var f=a[d];f in za?a[d]=za[f]:c=!0;f in Aa&&(a[d]=Aa[f])}if(!c)return!1;T(b)&&(a[a.length-1]=b.toLowerCase());return"<"+a.join("-")+">"}function ya(a){var b=
a.state.vim;b.onPasteFn||(b.onPasteFn=function(){b.insertMode||(a.setCursor(y(a.getCursor(),0,1)),ba.enterInsertMode(a,{},b))});return b.onPasteFn}function ma(a,b){for(var c=[],d=a;d<a+b;d++)c.push(String.fromCharCode(d));return c}function Ba(a,b){return b>=a.firstLine()&&b<=a.lastLine()}function T(a){return/^[A-Z]$/.test(a)}function na(a,b){for(var c=0;c<b.length;c++)if(b[c]==a)return!0;return!1}function ca(a,b,c,d,f){if(void 0===b&&!f)throw Error("defaultValue is required unless callback is provided");
c||(c="string");J[a]={type:c,defaultValue:b,callback:f};if(d)for(c=0;c<d.length;c++)J[d[c]]=J[a];b&&oa(a,b)}function oa(a,b,c,d){var f=J[a];d=d||{};d=d.scope;if(!f)throw Error("Unknown option: "+a);if("boolean"==f.type){if(b&&!0!==b)throw Error("Invalid argument: "+a+"="+b);!1!==b&&(b=!0)}f.callback?("local"!==d&&f.callback(b,void 0),"global"!==d&&c&&f.callback(b,c)):("local"!==d&&(f.value="boolean"==f.type?!!b:b),"global"!==d&&c&&(c.state.vim.options[a]={value:b}))}function U(a,b,c){var d=J[a];c=
c||{};c=c.scope;if(!d)throw Error("Unknown option: "+a);if(d.callback){a=b&&d.callback(void 0,b);if("global"!==c&&void 0!==a)return a;if("local"!==c)return d.callback()}else return a="global"!==c&&b&&b.state.vim.options[a],(a||"local"!==c&&d||{}).value}function Ca(){this.latestRegister=void 0;this.isRecording=this.isPlaying=!1;this.replaySearchQueries=[];this.onRecordingDone=void 0;this.lastInsertModeChanges=Da()}function aa(a){a.state.vim||(a.state.vim={inputState:new da,lastEditInputState:void 0,
lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}});return a.state.vim}function Ea(){r={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:gb(),macroModeState:new Ca,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new Fa({}),searchHistoryController:new pa({}),
exCommandHistoryController:new pa({})};for(var a in J){var b=J[a];b.value=b.defaultValue}}function da(){this.prefixRepeat=[];this.motionRepeat=[];this.motionArgs=this.motion=this.operatorArgs=this.operator=null;this.keyBuffer=[];this.registerName=null}function z(a,b){a.state.vim.inputState=new da;q.signal(a,"vim-command-done",b)}function E(a,b,c){this.clear();this.keyBuffer=[a||""];this.insertModeChanges=[];this.searchQueries=[];this.linewise=!!b;this.blockwise=!!c}function Fa(a){this.registers=a;
this.unnamedRegister=a['"']=new E;a["."]=new E;a[":"]=new E;a["/"]=new E}function pa(){this.historyBuffer=[];this.iterator=0;this.initialPrefix=null}function Ga(a,b){for(var c=[],d=0;d<b;d++)c.push(a);return c}function A(a,b,c){var d=Math.min(Math.max(a.firstLine(),b.line),a.lastLine());a=B(a,d)-1;return m(d,Math.min(Math.max(0,b.ch),c?a+1:a))}function ea(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function y(a,b,c){"object"===typeof b&&(c=b.ch,b=b.line);return m(a.line+b,a.ch+
c)}function hb(a,b){return{line:b.line-a.line,ch:b.line-a.line}}function Ha(a,b,c){return function(){for(var d=0;d<c;d++)b(a)}}function x(a){return m(a.line,a.ch)}function F(a,b){return a.ch==b.ch&&a.line==b.line}function w(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch?!0:!1}function C(a,b){2<arguments.length&&(b=C.apply(void 0,Array.prototype.slice.call(arguments,1)));return w(a,b)?a:b}function P(a,b){2<arguments.length&&(b=P.apply(void 0,Array.prototype.slice.call(arguments,1)));return w(a,
b)?b:a}function Ia(a,b,c){a=w(a,b);b=w(b,c);return a&&b}function B(a,b){return a.getLine(b).length}function qa(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function ib(a,b,c){var d=B(a,b);c=Array(c-d+1).join(" ");a.setCursor(m(b,d));a.replaceRange(c,a.getCursor())}function Ja(a,b){var c=[],d=a.listSelections(),f=x(a.clipPos(b)),e=!F(b,f),g;a:{var k=a.getCursor("head");for(g=0;g<d.length;g++){var h=F(d[g].anchor,k),l=F(d[g].head,k);if(h||l)break a}g=-1}var k=F(d[g].head,d[g].anchor),h=d.length-
1,n=h-g>g?h:0;g=d[n].anchor;var q=Math.min(g.line,f.line),h=Math.max(g.line,f.line),l=g.ch,f=f.ch,d=d[n].head.ch-l,n=f-l;0<d&&0>=n?(l++,e||f--):0>d&&0<=n?(l--,k||f++):0>d&&-1==n&&(l--,f++);for(e=q;e<=h;e++)d={anchor:new m(e,l),head:new m(e,f)},c.push(d);a.setSelections(c);b.ch=f;g.ch=l;return g}function Ka(a,b,c){for(var d=[],f=0;f<c;f++){var e=y(b,f,0);d.push({anchor:e,head:e})}a.setSelections(d,0)}function jb(a,b){var c=b.lastSelection,d=function(){var b=a.getCursor(),d=a.getCursor(),g=c.visualBlock;
if(g){for(var d=m(b.line+g.height,b.ch+g.width),g=[],k=b.line;k<d.line;k++){var h=m(k,b.ch),l=m(k,d.ch);g.push({anchor:h,head:l})}a.setSelections(g)}else k=c.anchorMark.find(),h=c.headMark.find(),g=h.line-k.line,k=h.ch-k.ch,d={line:d.line+g,ch:g?d.ch:k+d.ch},c.visualLine&&(b=m(b.line,0),d=m(d.line,B(a,d.line))),a.setSelection(b,d);return[b,d]};return b.visualMode?function(){var b=a.listSelections(),c=b[0],b=b[b.length-1],c=w(c.anchor,c.head)?c.anchor:c.head,b=w(b.anchor,b.head)?b.head:b.anchor;return[c,
b]}():d()}function La(a,b){var c=b.sel.anchor,d=b.sel.head;b.lastPastedText&&(d=a.posFromIndex(a.indexFromPos(c)+b.lastPastedText.length),b.lastPastedText=null);b.lastSelection={anchorMark:a.setBookmark(c),headMark:a.setBookmark(d),anchor:x(c),head:x(d),visualMode:b.visualMode,visualLine:b.visualLine,visualBlock:b.visualBlock}}function V(a,b,c){var d=a.state.vim;b=b||d.sel;c=c||d.visualLine?"line":d.visualBlock?"block":"char";b=ra(a,b,c);a.setSelections(b.ranges,b.primary);Ma(a)}function ra(a,b,c,
d){var f=x(b.head),e=x(b.anchor);if("char"==c)return f=d||w(b.head,b.anchor)?0:1,e=w(b.head,b.anchor)?1:0,f=y(b.head,0,f),e=y(b.anchor,0,e),{ranges:[{anchor:e,head:f}],primary:0};if("line"==c)return w(b.head,b.anchor)?(f.ch=0,e.ch=B(a,e.line)):(e.ch=0,b=a.lastLine(),f.line>b&&(f.line=b),f.ch=B(a,f.line)),{ranges:[{anchor:e,head:f}],primary:0};if("block"==c){b=Math.min(e.line,f.line);a=Math.min(e.ch,f.ch);c=Math.max(e.ch,f.ch)+1;e=Math.max(e.line,f.line)-b+1;f=f.line==b?0:e-1;d=[];for(var g=0;g<e;g++)d.push({anchor:m(b+
g,a),head:m(b+g,c)});return{ranges:d,primary:f}}}function G(a,b){var c=a.state.vim;!1!==b&&a.setCursor(A(a,c.sel.head));La(a,c);c.visualMode=!1;c.visualLine=!1;c.visualBlock=!1;q.signal(a,"vim-mode-change",{mode:"normal"});c.fakeCursor&&c.fakeCursor.clear()}function H(a){if(!a)return 0;var b=a.search(/\S/);return-1==b?a.length:b}function fa(a,b,c,d,f){c=a.getCursor("head");1==a.getSelection().length&&(c=C(c,a.getCursor("anchor")));a=a.getLine(c.line);var e=c.ch;for(f=f?ga[0]:sa[0];!f(a.charAt(e));)if(e++,
e>=a.length)return null;d?f=sa[0]:(f=ga[0],f(a.charAt(e))||(f=ga[1]));for(d=e;f(a.charAt(d))&&d<a.length;)d++;for(;f(a.charAt(e))&&0<=e;)e--;e++;if(b){for(b=d;/\s/.test(a.charAt(d))&&d<a.length;)d++;if(b==d){for(b=e;/\s/.test(a.charAt(e-1))&&0<e;)e--;e||(e=b)}}return{start:m(c.line,e),end:m(c.line,d)}}function Na(a,b){r.lastCharacterSearch.increment=a;r.lastCharacterSearch.forward=b.forward;r.lastCharacterSearch.selectedCharacter=b.selectedCharacter}function ta(a,b,c,d){for(var f=a.getCursor(),e=
f.ch,g,k=0;k<b;k++){g=a.getLine(f.line);var h=d;g=c?g.indexOf(h,e+1):g.lastIndexOf(h,e-1);if(-1==g)return null;e=g}return m(a.getCursor().line,g)}function K(a,b,c,d){na(c,kb)&&(b.marks[c]&&b.marks[c].clear(),b.marks[c]=a.setBookmark(d))}function Oa(a,b,c,d,f){function e(b,c,d){return d?!a.getLine(b)!=!a.getLine(b+c):!!a.getLine(b)&&!a.getLine(b+c)}b=b.line;var g=a.firstLine(),k=a.lastLine(),h=b;if(d){for(;g<=h&&h<=k&&0<c;)e(h,d)&&c--,h+=d;return new m(h,0)}h=a.state.vim;h.visualLine&&e(b,1,!0)&&(h=
h.sel.anchor,e(h.line,-1,!0)&&(f&&h.line==b||(b+=1)));d=!a.getLine(b);for(h=b;h<=k&&c;h++)e(h,1,!0)&&(f&&!a.getLine(h)==d||c--);c=new m(h,0);h>k&&!d?d=!0:f=!1;for(h=b;h>g&&(f&&!a.getLine(h)!=d&&h!=b||!e(h,-1,!0));h--);return{start:new m(h,0),end:c}}function Pa(){}function L(a){a=a.state.vim;return a.searchState_||(a.searchState_=new Pa)}function Qa(a){var b=Ra(a)||[];if(!b.length)return[];var c=[];if(0===b[0]){for(var d=0;d<b.length;d++)"number"==typeof b[d]&&c.push(a.substring(b[d]+1,b[d+1]));return c}}
function Ra(a){for(var b=!1,c=[],d=0;d<a.length;d++){var f=a.charAt(d);b||"/"!=f||c.push(d);b=!b&&"\\"==f}return c}function u(a,b){a.openNotification?a.openNotification('<span style="color: red">'+b+"</span>",{bottom:!0,duration:5E3}):alert(b)}function ha(a,b){var c=(b.prefix||"")+" "+(b.desc||""),d=b.desc,f='<span style="font-family: monospace; white-space: pre">'+(b.prefix||"")+'<input type="text"></span>';d&&(f+=' <span style="color: #888">'+d+"</span>");d=b.onClose;a.openDialog?a.openDialog(f,
d,{bottom:!0,value:b.value,onKeyDown:b.onKeyDown,onKeyUp:b.onKeyUp,selectValueOnOpen:!1}):d(prompt(c,""))}function W(a,b,c,d){if(b){var f=L(a),e;c=!!c;d=!!d;r.registerController.getRegister("/").setText(b);if(b instanceof RegExp)e=b;else{var g=Ra(b),k;g.length?(k=b.substring(0,g[0]),e=-1!=b.substring(g[0]).indexOf("i")):k=b;if(k){if(!U("pcre")){b=k;g=!1;k=[];for(var h=-1;h<b.length;h++){var l=b.charAt(h)||"",n=b.charAt(h+1)||"",m=n&&-1!="|(){".indexOf(n);g?("\\"===l&&m||k.push(l),g=!1):"\\"===l?(g=
!0,n&&-1!="}".indexOf(n)&&(m=!0),m&&"\\"!==n||k.push(l)):(k.push(l),m&&"\\"!==n&&k.push("\\"))}k=k.join("")}d&&(c=/^[^A-Z]*$/.test(k));e=new RegExp(k,c||e?"i":void 0)}else e=null}if(e){Sa(a,e);a:if(a=f.getQuery(),e instanceof RegExp&&a instanceof RegExp){c=["global","multiline","ignoreCase","source"];for(d=0;d<c.length;d++)if(b=c[d],e[b]!==a[b]){a=!1;break a}a=!0}else a=!1;if(a)return e;f.setQuery(e);return e}}}function lb(a){if("^"==a.source.charAt(0))var b=!0;return{token:function(c){if(b&&!c.sol())c.skipToEnd();
else{var d=c.match(a,!1);if(d){if(0==d[0].length)return c.next(),"searching";if(!c.sol()&&(c.backUp(1),!a.exec(c.next()+d[0])))return c.next(),null;c.match(a);return"searching"}for(;!c.eol()&&(c.next(),!c.match(a,!1)););}},query:a}}function Sa(a,b){var c=L(a),d=c.getOverlay();d&&b==d.query||(d&&a.removeOverlay(d),d=lb(b),a.addOverlay(d),a.showMatchesOnScrollbar&&(c.getScrollbarAnnotate()&&c.getScrollbarAnnotate().clear(),c.setScrollbarAnnotate(a.showMatchesOnScrollbar(b))),c.setOverlay(d))}function Ta(a,
b,c,d){void 0===d&&(d=1);return a.operation(function(){for(var f=a.getCursor(),e=a.getSearchCursor(c,f),g=0;g<d;g++){var k=e.find(b);0==g&&k&&F(e.from(),f)&&(k=e.find(b));if(!k&&(e=a.getSearchCursor(c,b?m(a.lastLine()):m(a.firstLine(),0)),!e.find(b)))return}return e.from()})}function ua(a){var b=L(a);a.removeOverlay(L(a).getOverlay());b.setOverlay(null);b.getScrollbarAnnotate()&&(b.getScrollbarAnnotate().clear(),b.setScrollbarAnnotate(null))}function mb(a,b,c){"number"!=typeof a&&(a=a.line);return b instanceof
Array?na(a,b):c?a>=b&&a<=c:a==b}function va(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 nb(a,b,c,d,f,e,g,k,h){function l(){a.operation(function(){for(;!v;)n(),m();p()})}function n(){var b=a.getRange(e.from(),e.to()).replace(g,k);e.replace(b)}function m(){for(;e.findNext()&&mb(e.from(),d,f);)if(c||!R||e.from().line!=R.line){a.scrollIntoView(e.from(),30);a.setSelection(e.from(),
e.to());R=e.from();v=!1;return}v=!0}function p(b){b&&b();a.focus();R&&(a.setCursor(R),b=a.state.vim,b.exMode=!1,b.lastHPos=b.lastHSPos=R.ch);h&&h()}function r(b,c,d){q.e_stop(b);switch(q.keyName(b)){case "Y":n();m();break;case "N":m();break;case "A":b=h;h=void 0;a.operation(l);h=b;break;case "L":n();case "Q":case "Esc":case "Ctrl-C":case "Ctrl-[":p(d)}v&&p(d);return!0}a.state.vim.exMode=!0;var v=!1,R=e.from();m();v?u(a,"No matches for "+g.source):b?ha(a,{prefix:"replace with <strong>"+k+"</strong> (y/n/a/q/l)",
onKeyDown:r}):(l(),h&&h())}function X(a){var b=a.state.vim,c=r.macroModeState,d=r.registerController.getRegister("."),f=c.isPlaying,e=c.lastInsertModeChanges,g;if(!f){var k=e.inVisualBlock?b.lastSelection.visualBlock.height:1,h=e.changes;g=[];for(var l=0;l<h.length;)g.push(h[l]),h[l]instanceof ia?l++:l+=k;e.changes=g;a.off("change",Ua);q.off(a.getInputField(),"keydown",Va)}!f&&1<b.insertModeRepeat&&(Wa(a,b,b.insertModeRepeat-1,!0),b.lastEditInputState.repeatOverride=b.insertModeRepeat);delete b.insertModeRepeat;
b.insertMode=!1;a.setCursor(a.getCursor().line,a.getCursor().ch-1);a.setOption("keyMap","vim");a.setOption("disableInput",!0);a.toggleOverwrite(!1);d.setText(e.changes.join(""));q.signal(a,"vim-mode-change",{mode:"normal"});c.isRecording&&(c.isPlaying||(a=r.registerController.getRegister(c.latestRegister))&&a.pushInsertModeChanges&&a.pushInsertModeChanges(c.lastInsertModeChanges))}function Xa(a){D.unshift(a)}function Ua(a,b){var c=r.macroModeState,d=c.lastInsertModeChanges;if(!c.isPlaying)for(;b;){d.expectCursorActivityForChange=
!0;if("+input"==b.origin||"paste"==b.origin||void 0===b.origin)c=b.text.join("\n"),d.changes.push(c);b=b.next}}function xa(a){var b=a.state.vim;if(b.insertMode){var c=r.macroModeState;if(c.isPlaying)return;c=c.lastInsertModeChanges;c.expectCursorActivityForChange?c.expectCursorActivityForChange=!1:c.changes=[]}else if(!a.curOp.isVimOp){var c=a.getCursor("anchor"),d=a.getCursor("head");b.visualMode&&!a.somethingSelected()?G(a,!1):b.visualMode||b.insertMode||!a.somethingSelected()||(b.visualMode=!0,
b.visualLine=!1,q.signal(a,"vim-mode-change",{mode:"visual"}));if(b.visualMode){var f=w(d,c)?0:-1,e=w(d,c)?-1:0,d=y(d,0,f),c=y(c,0,e);b.sel={anchor:c,head:d};K(a,b,"<",C(d,c));K(a,b,">",P(d,c))}else b.insertMode||(b.lastHPos=a.getCursor().ch)}b.visualMode&&Ma(a)}function Ma(a){var b=a.state.vim,c=A(a,x(b.sel.head)),d=y(c,0,1);b.fakeCursor&&b.fakeCursor.clear();b.fakeCursor=a.markText(c,d,{className:"cm-animate-fat-cursor"})}function ia(a){this.keyName=a}function Va(a){function b(){c.changes.push(new ia(d));
return!0}var c=r.macroModeState.lastInsertModeChanges,d=q.keyName(a);d&&(-1==d.indexOf("Delete")&&-1==d.indexOf("Backspace")||q.lookupKey(d,"vim-insert",b))}function Wa(a,b,c,d){function f(){k?N.processAction(a,b,b.lastEditActionCommand):N.evalInput(a,b)}function e(c){0<g.lastInsertModeChanges.changes.length&&(c=b.lastEditActionCommand?c:1,Ya(a,g.lastInsertModeChanges.changes,c))}var g=r.macroModeState;g.isPlaying=!0;var k=!!b.lastEditActionCommand,h=b.inputState;b.inputState=b.lastEditInputState;
if(k&&b.lastEditActionCommand.interlaceInsertRepeat)for(var l=0;l<c;l++)f(),e(1);else d||f(),e(c);b.inputState=h;b.insertMode&&!d&&X(a);g.isPlaying=!1}function Ya(a,b,c){function d(b){if("string"==typeof b)q.commands[b](a);else b(a);return!0}var f=a.getCursor("head"),e=r.macroModeState.lastInsertModeChanges.inVisualBlock;e&&(c=a.state.vim.lastSelection,c=hb(c.anchor,c.head),Ka(a,f,c.line+1),c=a.listSelections().length,a.setCursor(f));for(var g=0;g<c;g++){e&&a.setCursor(y(f,g,0));for(var k=0;k<b.length;k++){var h=
b[k];if(h instanceof ia)q.lookupKey(h.keyName,"vim-insert",d);else{var l=a.getCursor();a.replaceRange(h,l,l)}}}e&&a.setCursor(y(f,0,1))}q.defineOption("vimMode",!1,function(a,b,c){b&&"vim"!=a.getOption("keyMap")?a.setOption("keyMap","vim"):!b&&c!=q.Init&&/^vim/.test(a.getOption("keyMap"))&&a.setOption("keyMap","default")});var za={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A"},Aa={Enter:"CR",Backspace:"BS",Delete:"Del"},ob=/[\d]/,ga=[q.isWordChar,function(a){return a&&!q.isWordChar(a)&&!/\s/.test(a)}],
sa=[function(a){return/\S/.test(a)}],ja=ma(65,26),Y=ma(97,26),Za=ma(48,10),kb=[].concat(ja,Y,Za,["<",">"]),$a=[].concat(ja,Y,Za,["-",'"',".",":","/"]),J={};ca("filetype",void 0,"string",["ft"],function(a,b){if(void 0!==b){if(void 0===a){var c=b.getOption("mode");return"null"==c?"":c}b.setOption("mode",""==a?"null":a)}});var gb=function(){var a=-1,b=0,c=0,d=Array(100);return{cachedCursor:void 0,add:function(f,e,g){function k(b){var c=++a%100,e=d[c];e&&e.clear();d[c]=f.setBookmark(b)}var h=d[a%100];
h?(h=h.find())&&!F(h,e)&&k(e):k(e);k(g);b=a;c=a-100+1;0>c&&(c=0)},move:function(f,e){a+=e;a>b?a=b:a<c&&(a=c);var g=d[(100+a)%100];if(g&&!g.find()){var k=0<e?1:-1,h,l=f.getCursor();do if(a+=k,(g=d[(100+a)%100])&&(h=g.find())&&!F(l,h))break;while(a<b&&a>c)}return g}}},Da=function(a){return a?{changes:a.changes,expectCursorActivityForChange:a.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};Ca.prototype={exitMacroRecordMode:function(){var a=r.macroModeState;if(a.onRecordingDone)a.onRecordingDone();
a.onRecordingDone=void 0;a.isRecording=!1},enterMacroRecordMode:function(a,b){var c=r.registerController.getRegister(b);c&&(c.clear(),this.latestRegister=b,a.openDialog&&(this.onRecordingDone=a.openDialog("(recording)["+b+"]",null,{bottom:!0})),this.isRecording=!0)}};var r,Z,ja={buildKeyMap:function(){},getRegisterController:function(){return r.registerController},resetVimGlobalState_:Ea,getVimGlobalState_:function(){return r},maybeInitVimState_:aa,suppressErrorLogging:!1,InsertModeKey:ia,map:function(a,
b,c){I.map(a,b,c)},unmap:function(a,b){I.unmap(a,b)},setOption:oa,getOption:U,defineOption:ca,defineEx:function(a,b,c){if(!b)b=a;else if(0!==a.indexOf(b))throw Error('(Vim.defineEx) "'+b+'" is not a prefix of "'+a+'", command not registered');ab[a]=c;I.commandMap_[b]={name:a,shortName:b,type:"api"}},handleKey:function(a,b,c){a=this.findKey(a,b,c);if("function"===typeof a)return a()},findKey:function(a,b,c){function d(){if("<Esc>"==b)return z(a),g.visualMode?G(a):g.insertMode&&X(a),!0}function f(){if(d())return!0;
for(var c=g.inputState.keyBuffer+=b,e=1==b.length,f=N.matchCommand(c,D,g.inputState,"insert");1<c.length&&"full"!=f.type;){var c=g.inputState.keyBuffer=c.slice(1),k=N.matchCommand(c,D,g.inputState,"insert");"none"!=k.type&&(f=k)}if("none"==f.type)return z(a),!1;if("partial"==f.type)return Z&&window.clearTimeout(Z),Z=window.setTimeout(function(){g.insertMode&&g.inputState.keyBuffer&&z(a)},U("insertModeEscKeysTimeout")),!e;Z&&window.clearTimeout(Z);e&&(e=a.getCursor(),a.replaceRange("",y(e,0,-(c.length-
1)),e,"+input"));z(a);return f.command}function e(){var e;a:{var f=r.macroModeState;if(f.isRecording){if("q"==b){f.exitMacroRecordMode();z(a);e=!0;break a}"mapping"!=c&&(e=b,f.isPlaying||(f=r.registerController.getRegister(f.latestRegister))&&f.pushText(e))}e=void 0}if(e||d())return!0;e=g.inputState.keyBuffer+=b;if(/^[1-9]\d*$/.test(e))return!0;f=/^(\d*)(.*)$/.exec(e);if(!f)return z(a),!1;var k=N.matchCommand(f[2]||f[1],D,g.inputState,g.visualMode?"visual":"normal");if("none"==k.type)return z(a),
!1;if("partial"==k.type)return!0;g.inputState.keyBuffer="";f=/^(\d*)(.*)$/.exec(e);f[1]&&"0"!=f[1]&&g.inputState.pushRepeatDigit(f[1]);return k.command}var g=aa(a),k;k=g.insertMode?f():e();return!1===k?void 0:!0===k?function(){}:function(){return a.operation(function(){a.curOp.isVimOp=!0;try{if("keyToKey"==k.type)for(var c=k.toKeys,d;c;)d=/<\w+-.+?>|<\w+>|./.exec(c),b=d[0],c=c.substring(d.index+b.length),q.Vim.handleKey(a,b,"mapping");else N.processCommand(a,g,k)}catch(e){throw a.state.vim=void 0,
aa(a),q.Vim.suppressErrorLogging||console.log(e),e;}return!0})}},handleEx:function(a,b){I.processCommand(a,b)},defineMotion:function(a,b){O[a]=b},defineAction:function(a,b){ba[a]=b},defineOperator:function(a,b){bb[a]=b},mapCommand:function(a,b,c,d,f){a={keys:a,type:b};a[b]=c;a[b+"Args"]=d;for(var e in f)a[e]=f[e];Xa(a)},_mapCommand:Xa,defineRegister:function(a,b){var c=r.registerController.registers[a];if(!a||1!=a.length)throw Error("Register name must be 1 character");if(c[a])throw Error("Register already defined "+
a);c[a]=b;$a.push(a)},exitVisualMode:G,exitInsertMode:X};da.prototype.pushRepeatDigit=function(a){this.operator?this.motionRepeat=this.motionRepeat.concat(a):this.prefixRepeat=this.prefixRepeat.concat(a)};da.prototype.getRepeat=function(){var a=0;if(0<this.prefixRepeat.length||0<this.motionRepeat.length)a=1,0<this.prefixRepeat.length&&(a*=parseInt(this.prefixRepeat.join(""),10)),0<this.motionRepeat.length&&(a*=parseInt(this.motionRepeat.join(""),10));return a};E.prototype={setText:function(a,b,c){this.keyBuffer=
[a||""];this.linewise=!!b;this.blockwise=!!c},pushText:function(a,b){b&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0);this.keyBuffer.push(a)},pushInsertModeChanges:function(a){this.insertModeChanges.push(Da(a))},pushSearchQuery:function(a){this.searchQueries.push(a)},clear:function(){this.keyBuffer=[];this.insertModeChanges=[];this.searchQueries=[];this.linewise=!1},toString:function(){return this.keyBuffer.join("")}};Fa.prototype={pushText:function(a,b,c,d,f){d&&"\n"==c.charAt(0)&&
(c=c.slice(1)+"\n");d&&"\n"!==c.charAt(c.length-1)&&(c+="\n");var e=this.isValidRegister(a)?this.getRegister(a):null;if(e)T(a)?e.pushText(c,d):e.setText(c,d,f),this.unnamedRegister.setText(e.toString(),d);else{switch(b){case "yank":this.registers["0"]=new E(c,d,f);break;case "delete":case "change":-1==c.indexOf("\n")?this.registers["-"]=new E(c,d):(this.shiftNumericRegisters_(),this.registers["1"]=new E(c,d))}this.unnamedRegister.setText(c,d,f)}},getRegister:function(a){if(!this.isValidRegister(a))return this.unnamedRegister;
a=a.toLowerCase();this.registers[a]||(this.registers[a]=new E);return this.registers[a]},isValidRegister:function(a){return a&&na(a,$a)},shiftNumericRegisters_:function(){for(var a=9;2<=a;a--)this.registers[a]=this.getRegister(""+(a-1))}};pa.prototype={nextMatch:function(a,b){var c=this.historyBuffer,d=b?-1:1;null===this.initialPrefix&&(this.initialPrefix=a);for(var f=this.iterator+d;b?0<=f:f<c.length;f+=d)for(var e=c[f],g=0;g<=e.length;g++)if(this.initialPrefix==e.substring(0,g))return this.iterator=
f,e;if(f>=c.length)return this.iterator=c.length,this.initialPrefix;if(0>f)return a},pushInput:function(a){var b=this.historyBuffer.indexOf(a);-1<b&&this.historyBuffer.splice(b,1);a.length&&this.historyBuffer.push(a)},reset:function(){this.initialPrefix=null;this.iterator=this.historyBuffer.length}};var N={matchCommand:function(a,b,c,d){var f,e,g=[];f=[];for(var k=0;k<b.length;k++){var h=b[k],l;if(l=!("insert"==d&&"insert"!=h.context||h.context&&h.context!=d||c.operator&&"action"==h.type)){e=a;var n=
h.keys;if("<character>"==n.slice(-11)){l=n.length-11;var m=e.slice(0,l),n=n.slice(0,l);e=m==n&&e.length>l?"full":0==n.indexOf(m)?"partial":!1}else e=e==n?"full":0==n.indexOf(e)?"partial":!1;l=e}l&&("partial"==e&&g.push(h),"full"==e&&f.push(h))}b=g.length&&g;f=f.length&&f;if(!f&&!b)return{type:"none"};if(!f&&b)return{type:"partial"};var p;for(b=0;b<f.length;b++)d=f[b],p||(p=d);if("<character>"==p.keys.slice(-11)){a=(f=/^.*(<[\w\-]+>)$/.exec(a))?f[1]:a.slice(-1);if(1<a.length)switch(a){case "<CR>":a=
"\n";break;case "<Space>":a=" "}c.selectedCharacter=a}return{type:"full",command:p}},processCommand:function(a,b,c){b.inputState.repeatOverride=c.repeatOverride;switch(c.type){case "motion":this.processMotion(a,b,c);break;case "operator":this.processOperator(a,b,c);break;case "operatorMotion":this.processOperatorMotion(a,b,c);break;case "action":this.processAction(a,b,c);break;case "search":this.processSearch(a,b,c);break;case "ex":case "keyToEx":this.processEx(a,b,c)}},processMotion:function(a,b,
c){b.inputState.motion=c.motion;b.inputState.motionArgs=ea(c.motionArgs);this.evalInput(a,b)},processOperator:function(a,b,c){var d=b.inputState;if(d.operator){if(d.operator==c.operator){d.motion="expandToLine";d.motionArgs={linewise:!0};this.evalInput(a,b);return}z(a)}d.operator=c.operator;d.operatorArgs=ea(c.operatorArgs);b.visualMode&&this.evalInput(a,b)},processOperatorMotion:function(a,b,c){var d=b.visualMode,f=ea(c.operatorMotionArgs);f&&d&&f.visualLine&&(b.visualLine=!0);this.processOperator(a,
b,c);d||this.processMotion(a,b,c)},processAction:function(a,b,c){var d=b.inputState,f=d.getRepeat(),e=!!f,g=ea(c.actionArgs)||{};d.selectedCharacter&&(g.selectedCharacter=d.selectedCharacter);c.operator&&this.processOperator(a,b,c);c.motion&&this.processMotion(a,b,c);(c.motion||c.operator)&&this.evalInput(a,b);g.repeat=f||1;g.repeatIsExplicit=e;g.registerName=d.registerName;z(a);b.lastMotion=null;c.isEdit&&this.recordLastEdit(b,d,c);ba[c.action](a,g,b)},processSearch:function(a,b,c){function d(d,
e,f){r.searchHistoryController.pushInput(d);r.searchHistoryController.reset();try{W(a,d,e,f)}catch(g){u(a,"Invalid regex: "+d);z(a);return}N.processMotion(a,b,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:c.searchArgs.toJumplist}})}function f(b){a.scrollTo(m.left,m.top);d(b,!0,!0);var c=r.macroModeState;c.isRecording&&(c.isPlaying||(c=r.registerController.getRegister(c.latestRegister))&&c.pushSearchQuery&&c.pushSearchQuery(b))}function e(b,c,d){b=q.keyName(b);"Up"==b||"Down"==
b?(c=r.searchHistoryController.nextMatch(c,"Up"==b?!0:!1)||"",d(c)):"Left"!=b&&"Right"!=b&&"Ctrl"!=b&&"Alt"!=b&&"Shift"!=b&&r.searchHistoryController.reset();var e;try{e=W(a,c,!0,!0)}catch(f){}e?a.scrollIntoView(Ta(a,!k,e),30):(ua(a),a.scrollTo(m.left,m.top))}function g(b,c,d){var e=q.keyName(b);"Esc"==e||"Ctrl-C"==e||"Ctrl-["==e||"Backspace"==e&&""==c?(r.searchHistoryController.pushInput(c),r.searchHistoryController.reset(),W(a,n),ua(a),a.scrollTo(m.left,m.top),q.e_stop(b),z(a),d(),a.focus()):"Ctrl-U"==
e&&(q.e_stop(b),d(""))}if(a.getSearchCursor){var k=c.searchArgs.forward,h=c.searchArgs.wholeWordOnly;L(a).setReversed(!k);var l=k?"/":"?",n=L(a).getQuery(),m=a.getScrollInfo();switch(c.searchArgs.querySrc){case "prompt":h=r.macroModeState;h.isPlaying?(l=h.replaySearchQueries.shift(),d(l,!0,!1)):ha(a,{onClose:f,prefix:l,desc:pb,onKeyUp:e,onKeyDown:g});break;case "wordUnderCursor":var p=fa(a,!1,!0,!1,!0),t=!0;p||(p=fa(a,!1,!0,!1,!1),t=!1);p&&(l=a.getLine(p.start.line).substring(p.start.ch,p.end.ch),
l=t&&h?"\\b"+l+"\\b":l.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),r.jumpList.cachedCursor=a.getCursor(),a.setCursor(p.start),d(l,!0,!1))}}},processEx:function(a,b,c){function d(b){r.exCommandHistoryController.pushInput(b);r.exCommandHistoryController.reset();I.processCommand(a,b)}function f(b,c,d){var f=q.keyName(b);if("Esc"==f||"Ctrl-C"==f||"Ctrl-["==f||"Backspace"==f&&""==c)r.exCommandHistoryController.pushInput(c),r.exCommandHistoryController.reset(),q.e_stop(b),z(a),d(),a.focus();"Up"==f||"Down"==
f?(c=r.exCommandHistoryController.nextMatch(c,"Up"==f?!0:!1)||"",d(c)):"Ctrl-U"==f?(q.e_stop(b),d("")):"Left"!=f&&"Right"!=f&&"Ctrl"!=f&&"Alt"!=f&&"Shift"!=f&&r.exCommandHistoryController.reset()}"keyToEx"==c.type?I.processCommand(a,c.exArgs.input):b.visualMode?ha(a,{onClose:d,prefix:":",value:"'<,'>",onKeyDown:f}):ha(a,{onClose:d,prefix:":",onKeyDown:f})},evalInput:function(a,b){var c=b.inputState,d=c.motion,f=c.motionArgs||{},e=c.operator,g=c.operatorArgs||{},k=c.registerName,h=b.sel,l=x(b.visualMode?
A(a,h.head):a.getCursor("head")),n=x(b.visualMode?A(a,h.anchor):a.getCursor("anchor")),q=x(l),n=x(n),p,t,v;e&&this.recordLastEdit(b,c);v=void 0!==c.repeatOverride?c.repeatOverride:c.getRepeat();if(0<v&&f.explicitRepeat)f.repeatIsExplicit=!0;else if(f.noRepeat||!f.explicitRepeat&&0===v)v=1,f.repeatIsExplicit=!1;c.selectedCharacter&&(f.selectedCharacter=g.selectedCharacter=c.selectedCharacter);f.repeat=v;z(a);if(d){p=O[d](a,l,f,b);b.lastMotion=O[d];if(!p)return;f.toJumplist&&(d=r.jumpList,(c=d.cachedCursor)?
(F(c,p)||r.jumpList.add(a,c,p),delete d.cachedCursor):F(l,p)||r.jumpList.add(a,l,p));p instanceof Array&&(t=p[0],p=p[1]);p||(p=x(l));b.visualMode?(b.visualBlock&&Infinity===p.ch||(p=A(a,p,b.visualBlock)),t&&(t=A(a,t,!0)),t=t||n,h.anchor=t,h.head=p,V(a),K(a,b,"<",w(t,p)?t:p),K(a,b,">",w(t,p)?p:t)):e||(p=A(a,p),a.setCursor(p.line,p.ch))}if(e){g.lastSel?(t=n,h=g.lastSel,p=Math.abs(h.head.line-h.anchor.line),l=Math.abs(h.head.ch-h.anchor.ch),p=h.visualLine?m(n.line+p,n.ch):h.visualBlock?m(n.line+p,n.ch+
l):h.head.line==h.anchor.line?m(n.line,n.ch+l):m(n.line+p,n.ch),b.visualMode=!0,b.visualLine=h.visualLine,b.visualBlock=h.visualBlock,h=b.sel={anchor:t,head:p},V(a)):b.visualMode&&(g.lastSel={anchor:x(h.anchor),head:x(h.head),visualBlock:b.visualBlock,visualLine:b.visualLine});if(b.visualMode){if(t=C(h.head,h.anchor),h=P(h.head,h.anchor),q=b.visualLine||g.linewise,f=b.visualBlock?"block":q?"line":"char",t=ra(a,{anchor:t,head:h},f),q)if(h=t.ranges,"block"==f)for(f=0;f<h.length;f++)h[f].head.ch=B(a,
h[f].head.line);else"line"==f&&(h[0].head=m(h[0].head.line+1,0))}else{t=x(t||n);h=x(p||q);w(h,t)&&(q=t,t=h,h=q);if(q=f.linewise||g.linewise)l=h,t.ch=0,l.ch=0,l.line++;else if(f.forward&&(l=h,d=a.getRange(t,l),/\n\s*$/.test(d))){d=d.split("\n");d.pop();for(c=d.pop();0<d.length&&c&&/^\s*$/.test(c);c=d.pop())l.line--,l.ch=0;c?(l.line--,l.ch=B(a,l.line)):l.ch=0}t=ra(a,{anchor:t,head:h},"char",!f.inclusive||q)}a.setSelections(t.ranges,t.primary);b.lastMotion=null;g.repeat=v;g.registerName=k;g.linewise=
q;e=bb[e](a,g,t.ranges,n,p);b.visualMode&&G(a,null!=e);e&&a.setCursor(e)}},recordLastEdit:function(a,b,c){var d=r.macroModeState;d.isPlaying||(a.lastEditInputState=b,a.lastEditActionCommand=c,d.lastInsertModeChanges.changes=[],d.lastInsertModeChanges.expectCursorActivityForChange=!1)}},O={moveToTopLine:function(a,b,c){b=va(a).top+c.repeat-1;return m(b,H(a.getLine(b)))},moveToMiddleLine:function(a){var b=va(a),b=Math.floor(.5*(b.top+b.bottom));return m(b,H(a.getLine(b)))},moveToBottomLine:function(a,
b,c){b=va(a).bottom-c.repeat+1;return m(b,H(a.getLine(b)))},expandToLine:function(a,b,c){return m(b.line+c.repeat-1,Infinity)},findNext:function(a,b,c){b=L(a);var d=b.getQuery();if(d){var f=!c.forward,f=b.isReversed()?!f:f;Sa(a,d);return Ta(a,f,d,c.repeat)}},goToMark:function(a,b,c,d){return(b=d.marks[c.selectedCharacter])?(b=b.find(),c.linewise?{line:b.line,ch:H(a.getLine(b.line))}:b):null},moveToOtherHighlightedEnd:function(a,b,c,d){return d.visualBlock&&c.sameLine?(b=d.sel,[A(a,m(b.anchor.line,
b.head.ch)),A(a,m(b.head.line,b.anchor.ch))]):[d.sel.head,d.sel.anchor]},jumpToMark:function(a,b,c,d){for(var f=0;f<c.repeat;f++){var e=b,g;for(g in d.marks)if(/^[a-z]$/.test(g)){var k=d.marks[g].find();if(c.forward?!w(k,e):!w(e,k))if(!c.linewise||k.line!=e.line){var h=F(e,b),l=c.forward?Ia(e,k,b):Ia(b,k,e);if(h||l)b=k}}}c.linewise&&(b=m(b.line,H(a.getLine(b.line))));return b},moveByCharacters:function(a,b,c){a=c.repeat;return m(b.line,c.forward?b.ch+a:b.ch-a)},moveByLines:function(a,b,c,d){var f=
b.ch;switch(d.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:f=d.lastHPos;break;default:d.lastHPos=f}var e=c.repeat+(c.repeatOffset||0),e=c.forward?b.line+e:b.line-e,g=a.firstLine(),k=a.lastLine();if(e<g&&b.line==g)return this.moveToStartOfLine(a,b,c,d);if(e>k&&b.line==k)return this.moveToEol(a,b,c,d);c.toFirstChar&&(f=H(a.getLine(e)),d.lastHPos=f);d.lastHSPos=a.charCoords(m(e,f),"div").left;return m(e,f)},moveByDisplayLines:function(a,
b,c,d){switch(d.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:d.lastHSPos=a.charCoords(b,"div").left}var f=c.repeat;b=a.findPosV(b,c.forward?f:-f,"line",d.lastHSPos);b.hitSide&&(c.forward?c={top:a.charCoords(b,"div").top+8,left:d.lastHSPos}:(c=a.charCoords(m(a.firstLine(),0),"div"),c.left=d.lastHSPos),b=a.coordsChar(c,"div"));d.lastHPos=b.ch;return b},moveByPage:function(a,b,c){var d=c.repeat;return a.findPosV(b,
c.forward?d:-d,"page")},moveByParagraph:function(a,b,c){return Oa(a,b,c.repeat,c.forward?1:-1)},moveByScroll:function(a,b,c,d){var f=a.getScrollInfo(),e=c.repeat;e||(e=f.clientHeight/(2*a.defaultTextHeight()));var g=a.charCoords(b,"local");c.repeat=e;b=O.moveByDisplayLines(a,b,c,d);if(!b)return null;c=a.charCoords(b,"local");a.scrollTo(null,f.top+c.top-g.top);return b},moveByWords:function(a,b,c){var d=b,f=c.repeat;b=!!c.forward;var e=!!c.wordEnd,g=!!c.bigWord;c=x(d);var k=[];(b&&!e||!b&&e)&&f++;
for(var h=!(b&&e),l=0;l<f;l++){var n;b:{n=a;var q=b,p=g,r=h,v=d.line,u=d.ch,M=n.getLine(v),Q=q?1:-1,p=p?sa:ga;if(r&&""==M){v+=Q;M=n.getLine(v);if(!Ba(n,v)){n=null;break b}u=q?0:M.length}for(;;){if(r&&""==M){n={from:0,to:0,line:v};break b}for(var q=0<Q?M.length:-1,w,y;u!=q;){for(var A=!1,z=0;z<p.length&&!A;++z)if(p[z](M.charAt(u))){for(w=u;u!=q&&p[z](M.charAt(u));)u+=Q;y=u;A=w!=y;if(w!=d.ch||v!=d.line||y!=w+Q){n={from:Math.min(w,y+1),to:Math.max(w,y),line:v};break b}}A||(u+=Q)}v+=Q;if(!Ba(n,v)){n=
null;break b}M=n.getLine(v);u=0<Q?0:M.length}}if(!n){g=B(a,a.lastLine());k.push(b?{line:a.lastLine(),from:g,to:g}:{line:0,from:0,to:0});break}k.push(n);d=m(n.line,b?n.to-1:n.from)}a=k.length!=f;f=k[0];g=k.pop();b&&!e?(a||f.from==c.ch&&f.line==c.line||(g=k.pop()),b=m(g.line,g.from)):b&&e?b=m(g.line,g.to-1):!b&&e?(a||f.to==c.ch&&f.line==c.line||(g=k.pop()),b=m(g.line,g.to)):b=m(g.line,g.from);return b},moveTillCharacter:function(a,b,c){a=ta(a,c.repeat,c.forward,c.selectedCharacter);b=c.forward?-1:1;
Na(b,c);if(!a)return null;a.ch+=b;return a},moveToCharacter:function(a,b,c){var d=c.repeat;Na(0,c);return ta(a,d,c.forward,c.selectedCharacter)||b},moveToSymbol:function(a,b,c){var d=c.repeat,f=c.forward,e=c.selectedCharacter;c=x(a.getCursor());var g=f?1:-1,k=f?a.lineCount():-1,h=c.ch,l=c.line,n=a.getLine(l),f={lineText:n,nextCh:n.charAt(h),lastCh:null,index:h,symb:e,reverseSymb:(f?{")":"(","}":"{"}:{"(":")","{":"}"})[e],forward:f,depth:0,curMoveThrough:!1};if(h=qb[e]){e=cb[h].init;h=cb[h].isComplete;
for(e&&e(f);l!==k&&d;)f.index+=g,f.nextCh=f.lineText.charAt(f.index),f.nextCh||(l+=g,f.lineText=a.getLine(l)||"",0<g?f.index=0:(e=f.lineText.length,f.index=0<e?e-1:0),f.nextCh=f.lineText.charAt(f.index)),h(f)&&(c.line=l,c.ch=f.index,d--);a=f.nextCh||f.curMoveThrough?m(l,f.index):c}else a=c;return a||b},moveToColumn:function(a,b,c,d){c=c.repeat;d.lastHPos=c-1;d.lastHSPos=a.charCoords(b,"div").left;b=a.getCursor().line;return A(a,m(b,c-1))},moveToEol:function(a,b,c,d){d.lastHPos=Infinity;b=m(b.line+
c.repeat-1,Infinity);c=a.clipPos(b);c.ch--;d.lastHSPos=a.charCoords(c,"div").left;return b},moveToFirstNonWhiteSpaceCharacter:function(a,b){return m(b.line,H(a.getLine(b.line)))},moveToMatchedSymbol:function(a,b){var c=b.line,d=b.ch,f=a.getLine(c),e;do if((e=f.charAt(d++))&&-1!="()[]{}".indexOf(e)){var g=a.getTokenTypeAt(m(c,d));if("string"!==g&&"comment"!==g)break}while(e);return e?a.findMatchingBracket(m(c,d)).to:b},moveToStartOfLine:function(a,b){return m(b.line,0)},moveToLineOrEdgeOfDocument:function(a,
b,c){b=c.forward?a.lastLine():a.firstLine();c.repeatIsExplicit&&(b=c.repeat-a.getOption("firstLineNumber"));return m(b,H(a.getLine(b)))},textObjectManipulation:function(a,b,c,d){var f={"'":!0,'"':!0},e=c.selectedCharacter;"b"==e?e="(":"B"==e&&(e="{");var g=!c.textObjectInner;if({"(":")",")":"(","{":"}","}":"{","[":"]","]":"["}[e]){var k,h;h={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[e];k={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[e];c=a.getLine(b.line).charAt(b.ch)===
k?1:0;k=a.scanForBracket(m(b.line,b.ch+c),-1,null,{bracketRegex:h});h=a.scanForBracket(m(b.line,b.ch+c),1,null,{bracketRegex:h});if(k&&h){k=k.pos;h=h.pos;if(k.line==h.line&&k.ch>h.ch||k.line>h.line)b=k,k=h,h=b;g?h.ch+=1:k.ch+=1;b={start:k,end:h}}else b={start:b,end:b}}else if(f[e]){c=e;b=x(b);d=a.getLine(b.line).split("");e=d.indexOf(c);b.ch<e?b.ch=e:e<b.ch&&d[b.ch]==c&&(h=b.ch,--b.ch);if(d[b.ch]!=c||h)for(e=b.ch;-1<e&&!k;e--)d[e]==c&&(k=e+1);else k=b.ch+1;if(k&&!h)for(e=k,f=d.length;e<f&&!h;e++)d[e]==
c&&(h=e);k&&h?(g&&(--k,++h),b={start:m(b.line,k),end:m(b.line,h)}):b={start:b,end:b}}else if("W"===e)b=fa(a,g,!0,!0);else if("w"===e)b=fa(a,g,!0,!1);else if("p"===e)if(b=Oa(a,b,c.repeat,0,g),c.linewise=!0,d.visualMode)d.visualLine||(d.visualLine=!0);else{if(g=d.inputState.operatorArgs)g.linewise=!0;b.end.line--}else return null;return a.state.vim.visualMode?(g=b.start,b=b.end,h=a.state.vim.sel,k=h.head,h=h.anchor,w(b,g)&&(c=b,b=g,g=c),w(k,h)?(k=C(g,k),h=P(h,b)):(h=C(g,h),k=P(k,b),k=y(k,0,-1),-1==
k.ch&&k.line!=a.firstLine()&&(k=m(k.line-1,B(a,k.line-1)))),[h,k]):[b.start,b.end]},repeatLastCharacterSearch:function(a,b,c){var d=r.lastCharacterSearch,f=c.repeat,e=c.forward===d.forward,g=(d.increment?1:0)*(e?-1:1);a.moveH(-g,"char");c.inclusive=e?!0:!1;c=ta(a,f,e,d.selectedCharacter);if(!c)return a.moveH(g,"char"),b;c.ch+=g;return c}},bb={change:function(a,b,c){var d,f,e=a.state.vim;r.macroModeState.lastInsertModeChanges.inVisualBlock=e.visualBlock;if(e.visualMode)f=a.getSelection(),d=Ga("",c.length),
a.replaceSelections(d),d=C(c[0].head,c[0].anchor);else{d=c[0].anchor;var g=c[0].head;f=a.getRange(d,g);e=e.lastEditInputState||{};if("moveByWords"==e.motion&&!/^\s*$/.test(f)){var k=/\s+$/.exec(f);k&&e.motionArgs&&e.motionArgs.forward&&(g=y(g,0,-k[0].length),f=f.slice(0,-k[0].length))}e=new m(d.line-1,Number.MAX_VALUE);k=a.firstLine()==a.lastLine();g.line>a.lastLine()&&b.linewise&&!k?a.replaceRange("",e,g):a.replaceRange("",d,g);b.linewise&&(k||(a.setCursor(e),q.commands.newlineAndIndent(a)),d.ch=
Number.MAX_VALUE)}r.registerController.pushText(b.registerName,"change",f,b.linewise,1<c.length);ba.enterInsertMode(a,{head:d},a.state.vim)},"delete":function(a,b,c){var d,f=a.state.vim;if(f.visualBlock){d=a.getSelection();var e=Ga("",c.length);a.replaceSelections(e);c=c[0].anchor}else e=c[0].anchor,c=c[0].head,b.linewise&&c.line!=a.firstLine()&&e.line==a.lastLine()&&e.line==c.line-1&&(e.line==a.firstLine()?e.ch=0:e=m(e.line-1,B(a,e.line-1))),d=a.getRange(e,c),a.replaceRange("",e,c),c=e,b.linewise&&
(c=O.moveToFirstNonWhiteSpaceCharacter(a,e));r.registerController.pushText(b.registerName,"delete",d,b.linewise,f.visualBlock);return A(a,c)},indent:function(a,b,c){var d=a.state.vim,f=c[0].anchor.line,e=d.visualBlock?c[c.length-1].anchor.line:c[0].head.line,d=d.visualMode?b.repeat:1;for(b.linewise&&e--;f<=e;f++)for(var g=0;g<d;g++)a.indentLine(f,b.indentRight);return O.moveToFirstNonWhiteSpaceCharacter(a,c[0].anchor)},changeCase:function(a,b,c,d,f){for(var e=a.getSelections(),g=[],k=b.toLower,h=
0;h<e.length;h++){var l=e[h],n="";if(!0===k)n=l.toLowerCase();else if(!1===k)n=l.toUpperCase();else for(var m=0;m<l.length;m++)var p=l.charAt(m),n=n+(T(p)?p.toLowerCase():p.toUpperCase());g.push(n)}a.replaceSelections(g);return b.shouldMoveCursor?f:!a.state.vim.visualMode&&b.linewise&&c[0].anchor.line+1==c[0].head.line?O.moveToFirstNonWhiteSpaceCharacter(a,d):b.linewise?d:C(c[0].anchor,c[0].head)},yank:function(a,b,c,d){var f=a.state.vim;a=a.getSelection();c=f.visualMode?C(f.sel.anchor,f.sel.head,
c[0].head,c[0].anchor):d;r.registerController.pushText(b.registerName,"yank",a,b.linewise,f.visualBlock);return c}},ba={jumpListWalk:function(a,b,c){c.visualMode||(c=b.repeat,b=(b=(b=r.jumpList.move(a,b.forward?c:-c))?b.find():void 0)?b:a.getCursor(),a.setCursor(b))},scroll:function(a,b,c){if(!c.visualMode){var d=b.repeat||1;c=a.defaultTextHeight();var f=a.getScrollInfo().top,d=c*d,f=b.forward?f+d:f-d,d=x(a.getCursor()),e=a.charCoords(d,"local");b.forward?f>e.top?(d.line+=(f-e.top)/c,d.line=Math.ceil(d.line),
a.setCursor(d),e=a.charCoords(d,"local"),a.scrollTo(null,e.top)):a.scrollTo(null,f):(b=f+a.getScrollInfo().clientHeight,b<e.bottom?(d.line-=(e.bottom-b)/c,d.line=Math.floor(d.line),a.setCursor(d),e=a.charCoords(d,"local"),a.scrollTo(null,e.bottom-a.getScrollInfo().clientHeight)):a.scrollTo(null,f))}},scrollToCursor:function(a,b){var c=a.getCursor().line,d=a.charCoords(m(c,0),"local"),c=a.getScrollInfo().clientHeight,f=d.top,d=d.bottom-f;switch(b.position){case "center":f=f-c/2+d;break;case "bottom":f=
f-c+d}a.scrollTo(null,f)},replayMacro:function(a,b,c){var d=b.selectedCharacter;b=b.repeat;var f=r.macroModeState;"@"==d&&(d=f.latestRegister);for(;b--;){var e=a,g=c,k=f,h=d,l=r.registerController.getRegister(h);if(":"==h)l.keyBuffer[0]&&I.processCommand(e,l.keyBuffer[0]);else{var h=l.keyBuffer,m=0;k.isPlaying=!0;k.replaySearchQueries=l.searchQueries.slice(0);for(var u=0;u<h.length;u++)for(var p=h[u],t,v;p;)t=/<\w+-.+?>|<\w+>|./.exec(p),v=t[0],p=p.substring(t.index+v.length),q.Vim.handleKey(e,v,"macro"),
g.insertMode&&(t=l.insertModeChanges[m++].changes,r.macroModeState.lastInsertModeChanges.changes=t,Ya(e,t,1),X(e))}k.isPlaying=!1}},enterMacroRecordMode:function(a,b){r.macroModeState.enterMacroRecordMode(a,b.selectedCharacter)},enterInsertMode:function(a,b,c){if(!a.getOption("readOnly")){c.insertMode=!0;c.insertModeRepeat=b&&b.repeat||1;var d=b?b.insertAt:null,f=c.sel,e=b.head||a.getCursor("head"),g=a.listSelections().length;if("eol"==d)e=m(e.line,B(a,e.line));else if("charAfter"==d)e=y(e,0,1);else if("firstNonBlank"==
d)e=O.moveToFirstNonWhiteSpaceCharacter(a,e);else if("startOfSelectedArea"==d)c.visualBlock?(e=m(Math.min(f.head.line,f.anchor.line),Math.min(f.head.ch,f.anchor.ch)),g=Math.abs(f.head.line-f.anchor.line)+1):e=f.head.line<f.anchor.line?f.head:m(f.anchor.line,0);else if("endOfSelectedArea"==d)c.visualBlock?(e=m(Math.min(f.head.line,f.anchor.line),Math.max(f.head.ch+1,f.anchor.ch)),g=Math.abs(f.head.line-f.anchor.line)+1):e=f.head.line>=f.anchor.line?y(f.head,0,1):m(f.anchor.line,0);else if("inplace"==
d&&c.visualMode)return;a.setOption("keyMap","vim-insert");a.setOption("disableInput",!1);b&&b.replace?(a.toggleOverwrite(!0),a.setOption("keyMap","vim-replace"),q.signal(a,"vim-mode-change",{mode:"replace"})):(a.setOption("keyMap","vim-insert"),q.signal(a,"vim-mode-change",{mode:"insert"}));r.macroModeState.isPlaying||(a.on("change",Ua),q.on(a.getInputField(),"keydown",Va));c.visualMode&&G(a);Ka(a,e,g)}},toggleVisualMode:function(a,b,c){var d=b.repeat,f=a.getCursor();c.visualMode?c.visualLine^b.linewise||
c.visualBlock^b.blockwise?(c.visualLine=!!b.linewise,c.visualBlock=!!b.blockwise,q.signal(a,"vim-mode-change",{mode:"visual",subMode:c.visualLine?"linewise":c.visualBlock?"blockwise":""}),V(a)):G(a):(c.visualMode=!0,c.visualLine=!!b.linewise,c.visualBlock=!!b.blockwise,b=A(a,m(f.line,f.ch+d-1),!0),c.sel={anchor:f,head:b},q.signal(a,"vim-mode-change",{mode:"visual",subMode:c.visualLine?"linewise":c.visualBlock?"blockwise":""}),V(a),K(a,c,"<",C(f,b)),K(a,c,">",P(f,b)))},reselectLastSelection:function(a,
b,c){b=c.lastSelection;c.visualMode&&La(a,c);if(b){var d=b.anchorMark.find(),f=b.headMark.find();d&&f&&(c.sel={anchor:d,head:f},c.visualMode=!0,c.visualLine=b.visualLine,c.visualBlock=b.visualBlock,V(a),K(a,c,"<",C(d,f)),K(a,c,">",P(d,f)),q.signal(a,"vim-mode-change",{mode:"visual",subMode:c.visualLine?"linewise":c.visualBlock?"blockwise":""}))}},joinLines:function(a,b,c){var d;if(c.visualMode){b=a.getCursor("anchor");d=a.getCursor("head");if(w(d,b)){var f=d;d=b;b=f}d.ch=B(a,d.line)-1}else d=Math.max(b.repeat,
2),b=a.getCursor(),d=A(a,m(b.line+d-1,Infinity));for(var e=0,g=b.line;g<d.line;g++){var e=B(a,b.line),f=m(b.line+1,B(a,b.line+1)),k=a.getRange(b,f),k=k.replace(/\n\s*/g," ");a.replaceRange(k,b,f)}b=m(b.line,e);c.visualMode&&G(a,!1);a.setCursor(b)},newLineAndEnterInsertMode:function(a,b,c){c.insertMode=!0;var d=x(a.getCursor());d.line!==a.firstLine()||b.after?(d.line=b.after?d.line:d.line-1,d.ch=B(a,d.line),a.setCursor(d),(q.commands.newlineAndIndentContinueComment||q.commands.newlineAndIndent)(a)):
(a.replaceRange("\n",m(a.firstLine(),0)),a.setCursor(a.firstLine(),0));this.enterInsertMode(a,{repeat:b.repeat},c)},paste:function(a,b,c){var d=x(a.getCursor()),f=r.registerController.getRegister(b.registerName),e=f.toString();if(e){if(b.matchIndent)var g=a.getOption("tabSize"),k=function(a){var b=a.split("\t").length-1;a=a.split(" ").length-1;return b*g+1*a},h=a.getLine(a.getCursor().line),l=k(h.match(/^\s*/)[0]),h=e.replace(/\n$/,""),n=e!==h,q=k(e.match(/^\s*/)[0]),e=h.replace(/^\s*/gm,function(b){b=
l+(k(b)-q);return 0>b?"":a.getOption("indentWithTabs")?Array(Math.floor(b/g)+1).join("\t"):Array(b+1).join(" ")}),e=e+(n?"\n":"");1<b.repeat&&(e=Array(b.repeat+1).join(e));h=f.linewise;f=f.blockwise;if(h)c.visualMode?e=c.visualLine?e.slice(0,-1):"\n"+e.slice(0,e.length-1)+"\n":b.after?(e="\n"+e.slice(0,e.length-1),d.ch=B(a,d.line)):d.ch=0;else{if(f)for(e=e.split("\n"),n=0;n<e.length;n++)e[n]=""==e[n]?" ":e[n];d.ch+=b.after?1:0}var p;if(c.visualMode){c.lastPastedText=e;b=jb(a,c);d=b[0];b=b[1];var n=
a.getSelection(),t=a.listSelections(),t=Array(t.length).join("1").split("1");c.lastSelection&&(p=c.lastSelection.headMark.find());r.registerController.unnamedRegister.setText(n);f?(a.replaceSelections(t),b=m(d.line+e.length-1,d.ch),a.setCursor(d),Ja(a,b),a.replaceSelections(e),e=d):c.visualBlock?(a.replaceSelections(t),a.setCursor(d),a.replaceRange(e,d,d),e=d):(a.replaceRange(e,d,b),e=a.posFromIndex(a.indexFromPos(d)+e.length-1));p&&(c.lastSelection.headMark=a.setBookmark(p));h&&(e.ch=0)}else if(f){a.setCursor(d);
for(n=0;n<e.length;n++)p=d.line+n,p>a.lastLine()&&a.replaceRange("\n",m(p,0)),B(a,p)<d.ch&&ib(a,p,d.ch);a.setCursor(d);Ja(a,m(d.line+e.length-1,d.ch));a.replaceSelections(e);e=d}else a.replaceRange(e,d),h&&b.after?e=m(d.line+1,H(a.getLine(d.line+1))):h&&!b.after?e=m(d.line,H(a.getLine(d.line))):!h&&b.after?(p=a.indexFromPos(d),e=a.posFromIndex(p+e.length-1)):(p=a.indexFromPos(d),e=a.posFromIndex(p+e.length));c.visualMode&&G(a,!1);a.setCursor(e)}},undo:function(a,b){a.operation(function(){Ha(a,q.commands.undo,
b.repeat)();a.setCursor(a.getCursor("anchor"))})},redo:function(a,b){Ha(a,q.commands.redo,b.repeat)()},setRegister:function(a,b,c){c.inputState.registerName=b.selectedCharacter},setMark:function(a,b,c){K(a,c,b.selectedCharacter,a.getCursor())},replace:function(a,b,c){var d=b.selectedCharacter,f=a.getCursor(),e,g=a.listSelections();c.visualMode?(f=a.getCursor("start"),e=a.getCursor("end")):(e=a.getLine(f.line),b=f.ch+b.repeat,b>e.length&&(b=e.length),e=m(f.line,b));"\n"==d?(c.visualMode||a.replaceRange("",
f,e),(q.commands.newlineAndIndentContinueComment||q.commands.newlineAndIndent)(a)):(b=a.getRange(f,e),b=b.replace(/[^\n]/g,d),c.visualBlock?(f=Array(a.getOption("tabSize")+1).join(" "),b=a.getSelection(),b=b.replace(/\t/g,f).replace(/[^\n]/g,d).split("\n"),a.replaceSelections(b)):a.replaceRange(b,f,e),c.visualMode?(f=w(g[0].anchor,g[0].head)?g[0].anchor:g[0].head,a.setCursor(f),G(a,!1)):a.setCursor(y(e,0,-1)))},incrementNumberToken:function(a,b){for(var c=a.getCursor(),d=a.getLine(c.line),f=/-?\d+/g,
e,g,k,h;null!==(e=f.exec(d))&&!(h=e[0],g=e.index,k=g+h.length,c.ch<k););!b.backtrack&&k<=c.ch||!h||(d=b.increase?1:-1,d=parseInt(h)+d*b.repeat,h=m(c.line,g),k=m(c.line,k),d=d.toString(),a.replaceRange(d,h,k),a.setCursor(m(c.line,g+d.length-1)))},repeatLastEdit:function(a,b,c){if(c.lastEditInputState){var d=b.repeat;d&&b.repeatIsExplicit?c.lastEditInputState.repeatOverride=d:d=c.lastEditInputState.repeatOverride||d;Wa(a,c,d,!1)}},exitInsertMode:X},qb={"(":"bracket",")":"bracket","{":"bracket","}":"bracket",
"[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},cb={bracket:{isComplete:function(a){if(a.nextCh===a.symb){if(a.depth++,1<=a.depth)return!0}else a.nextCh===a.reverseSymb&&a.depth--;return!1}},section:{init:function(a){a.curMoveThrough=!0;a.symb=(a.forward?"]":"[")===a.symb?"{":"}"},isComplete:function(a){return 0===a.index&&a.nextCh===a.symb}},comment:{isComplete:function(a){var b="*"===a.lastCh&&"/"===a.nextCh;a.lastCh=a.nextCh;return b}},method:{init:function(a){a.symb=
"m"===a.symb?"{":"}";a.reverseSymb="{"===a.symb?"}":"{"},isComplete:function(a){return a.nextCh===a.symb?!0:!1}},preprocess:{init:function(a){a.index=0},isComplete:function(a){if("#"===a.nextCh){var b=a.lineText.match(/#(\w+)/)[1];if("endif"===b){if(a.forward&&0===a.depth)return!0;a.depth++}else if("if"===b){if(!a.forward&&0===a.depth)return!0;a.depth--}if("else"===b&&0===a.depth)return!0}return!1}}};ca("pcre",!0,"boolean");Pa.prototype={getQuery:function(){return r.query},setQuery:function(a){r.query=
a},getOverlay:function(){return this.searchOverlay},setOverlay:function(a){this.searchOverlay=a},isReversed:function(){return r.isReversed},setReversed:function(a){r.isReversed=a},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(a){this.annotate=a}};var db={"\\n":"\n","\\r":"\r","\\t":"\t"},eb={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t"},pb="(Javascript regexp)",Y=function(){this.buildCommandMap_()};Y.prototype={processCommand:function(a,b,c){var d=this;
a.operation(function(){a.curOp.isVimOp=!0;d._processCommand(a,b,c)})},_processCommand:function(a,b,c){var d=a.state.vim,f=r.registerController.getRegister(":"),e=f.toString();d.visualMode&&G(a);d=new q.StringStream(b);f.setText(b);c=c||{};c.input=b;try{this.parseInput_(a,d,c)}catch(h){throw u(a,h),h;}var g,k;if(c.commandName){if(g=this.matchCommand_(c.commandName)){k=g.name;g.excludeFromCommandHistory&&f.setText(e);this.parseCommandArgs_(d,c,g);if("exToKey"==g.type){for(b=0;b<g.toKeys.length;b++)q.Vim.handleKey(a,
g.toKeys[b],"mapping");return}if("exToEx"==g.type){this.processCommand(a,g.toInput);return}}}else void 0!==c.line&&(k="move");if(k)try{ab[k](a,c),g&&g.possiblyAsync||!c.callback||c.callback()}catch(h){throw u(a,h),h;}else u(a,'Not an editor command ":'+b+'"')},parseInput_:function(a,b,c){b.eatWhile(":");b.eat("%")?(c.line=a.firstLine(),c.lineEnd=a.lastLine()):(c.line=this.parseLineSpec_(a,b),void 0!==c.line&&b.eat(",")&&(c.lineEnd=this.parseLineSpec_(a,b)));a=b.match(/^(\w+)/);c.commandName=a?a[1]:
b.match(/.*/)[0];return c},parseLineSpec_:function(a,b){var c=b.match(/^(\d+)/);if(c)return parseInt(c[1],10)-1;switch(b.next()){case ".":return a.getCursor().line;case "$":return a.lastLine();case "'":if((c=a.state.vim.marks[b.next()])&&c.find())return c.find().line;throw Error("Mark not set");default:b.backUp(1)}},parseCommandArgs_:function(a,b,c){a.eol()||(b.argString=a.match(/.*/)[0],a=c.argDelimiter||/\s+/,a=qa(b.argString).split(a),a.length&&a[0]&&(b.args=a))},matchCommand_:function(a){for(var b=
a.length;0<b;b--){var c=a.substring(0,b);if(this.commandMap_[c]&&(c=this.commandMap_[c],0===c.name.indexOf(a)))return c}return null},buildCommandMap_:function(){this.commandMap_={};for(var a=0;a<wa.length;a++){var b=wa[a];this.commandMap_[b.shortName||b.name]=b}},map:function(a,b,c){if(":"!=a&&":"==a.charAt(0)){if(c)throw Error("Mode not supported for ex mappings");c=a.substring(1);":"!=b&&":"==b.charAt(0)?this.commandMap_[c]={name:c,type:"exToEx",toInput:b.substring(1),user:!0}:this.commandMap_[c]=
{name:c,type:"exToKey",toKeys:b,user:!0}}else b=":"!=b&&":"==b.charAt(0)?{keys:a,type:"keyToEx",exArgs:{input:b.substring(1)},user:!0}:{keys:a,type:"keyToKey",toKeys:b,user:!0},c&&(b.context=c),D.unshift(b)},unmap:function(a,b){if(":"!=a&&":"==a.charAt(0)){if(b)throw Error("Mode not supported for ex mappings");var c=a.substring(1);if(this.commandMap_[c]&&this.commandMap_[c].user){delete this.commandMap_[c];return}}else for(c=0;c<D.length;c++)if(a==D[c].keys&&D[c].context===b&&D[c].user){D.splice(c,
1);return}throw Error("No such mapping.");}};var ab={colorscheme:function(a,b){!b.args||1>b.args.length?u(a,a.getOption("theme")):a.setOption("theme",b.args[0])},map:function(a,b,c){var d=b.args;!d||2>d.length?a&&u(a,"Invalid mapping: "+b.input):I.map(d[0],d[1],c)},imap:function(a,b){this.map(a,b,"insert")},nmap:function(a,b){this.map(a,b,"normal")},vmap:function(a,b){this.map(a,b,"visual")},unmap:function(a,b,c){var d=b.args;!d||1>d.length?a&&u(a,"No such mapping: "+b.input):I.unmap(d[0],c)},move:function(a,
b){N.processCommand(a,a.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:b.line+1})},set:function(a,b){var c=b.args,d=b.setCfg||{};if(!c||1>c.length)a&&u(a,"Invalid mapping: "+b.input);else{var f=c[0].split("="),c=f[0],f=f[1],e=!1;if("?"==c.charAt(c.length-1)){if(f)throw Error("Trailing characters: "+b.argString);c=c.substring(0,c.length-1);e=!0}void 0===f&&"no"==c.substring(0,2)&&(c=c.substring(2),f=!1);var g=J[c]&&
"boolean"==J[c].type;g&&void 0==f&&(f=!0);!g&&void 0===f||e?(d=U(c,a,d),!0===d||!1===d?u(a," "+(d?"":"no")+c):u(a," "+c+"="+d)):oa(c,f,a,d)}},setlocal:function(a,b){b.setCfg={scope:"local"};this.set(a,b)},setglobal:function(a,b){b.setCfg={scope:"global"};this.set(a,b)},registers:function(a,b){var c=b.args,d=r.registerController.registers,f="----------Registers----------<br><br>";if(c)for(var c=c.join(""),e=0;e<c.length;e++){if(k=c.charAt(e),r.registerController.isValidRegister(k))var g=d[k]||new E,
f=f+('"'+k+" "+g.toString()+"<br>")}else for(var k in d)c=d[k].toString(),c.length&&(f+='"'+k+" "+c+"<br>");u(a,f)},sort:function(a,b){function c(a,b){if(d){var c;c=a;a=b;b=c}f&&(a=a.toLowerCase(),b=b.toLowerCase());c=g&&n.exec(a);var e=g&&n.exec(b);if(!c)return a<b?-1:1;c=parseInt((c[1]+c[2]).toLowerCase(),r);e=parseInt((e[1]+e[2]).toLowerCase(),r);return c-e}var d,f,e,g,k=function(){if(b.argString){var a=new q.StringStream(b.argString);a.eat("!")&&(d=!0);if(!a.eol()){if(!a.eatSpace())return"Invalid arguments";
var c=a.match(/[a-z]+/);if(c){c=c[0];f=-1!=c.indexOf("i");e=-1!=c.indexOf("u");var h=-1!=c.indexOf("d")&&1,k=-1!=c.indexOf("x")&&1,c=-1!=c.indexOf("o")&&1;if(1<h+k+c)return"Invalid arguments";g=h&&"decimal"||k&&"hex"||c&&"octal"}if(a.match(/\/.*\//))return"patterns not supported"}}}();if(k)u(a,k+": "+b.argString);else{var k=b.line||a.firstLine(),h=b.lineEnd||b.line||a.lastLine();if(k!=h){var k=m(k,0),h=m(h,B(a,h)),l=a.getRange(k,h).split("\n"),n="decimal"==g?/(-?)([\d]+)/:"hex"==g?/(-?)(?:0x)?([0-9a-f]+)/i:
"octal"==g?/([0-7]+)/:null,r="decimal"==g?10:"hex"==g?16:"octal"==g?8:null,p=[],t=[];if(g)for(var v=0;v<l.length;v++)n.exec(l[v])?p.push(l[v]):t.push(l[v]);else t=l;p.sort(c);t.sort(c);l=d?p.concat(t):t.concat(p);if(e)for(var p=l,w,l=[],v=0;v<p.length;v++)p[v]!=w&&l.push(p[v]),w=p[v];a.replaceRange(l.join("\n"),k,h)}}},global:function(a,b){var c=b.argString;if(c){var d=void 0!==b.line?b.line:a.firstLine(),f=b.lineEnd||b.line||a.lastLine(),e=Qa(c),g;e.length&&(c=e[0],g=e.slice(1,e.length).join("/"));
if(c)try{W(a,c,!0,!0)}catch(m){u(a,"Invalid regex: "+c);return}for(var e=L(a).getQuery(),k=[],c="";d<=f;d++)e.test(a.getLine(d))&&(k.push(d+1),c+=a.getLine(d)+"<br>");if(g){var h=0,l=function(){h<k.length&&I.processCommand(a,k[h]+g,{callback:l});h++};l()}else u(a,c)}else u(a,"Regular Expression missing from global")},substitute:function(a,b){if(!a.getSearchCursor)throw Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var c=b.argString,d=
c?Qa(c):[],f,e="",g,k,h=!1,l=!1;if(d.length){f=d[0];e=d[1];if(void 0!==e){if(U("pcre"))for(e=new q.StringStream(e),g=[];!e.eol();){for(;e.peek()&&"\\"!=e.peek();)g.push(e.next());var c=!1,n;for(n in eb)if(e.match(n,!0)){c=!0;g.push(eb[n]);break}c||g.push(e.next())}else for(n=!1,g=[],c=-1;c<e.length;c++){var w=e.charAt(c)||"",p=e.charAt(c+1)||"";db[w+p]?(g.push(db[w+p]),c++):n?(g.push(w),n=!1):"\\"===w?(n=!0,ob.test(p)||"$"===p?g.push("$"):"/"!==p&&"\\"!==p&&g.push("\\")):("$"===w&&g.push("$"),g.push(w),
"/"===p&&g.push("\\"))}e=g.join("");r.lastSubstituteReplacePart=e}g=d[2]?d[2].split(" "):[]}else if(c&&c.length){u(a,"Substitutions should be of the form :s/pattern/replace/");return}g&&(d=g[0],k=parseInt(g[1]),d&&(-1!=d.indexOf("c")&&(h=!0,d.replace("c","")),-1!=d.indexOf("g")&&(l=!0,d.replace("g","")),f=f+"/"+d));if(f)try{W(a,f,!0,!0)}catch(t){u(a,"Invalid regex: "+f);return}e=e||r.lastSubstituteReplacePart;void 0===e?u(a,"No previous substitute regular expression"):(f=L(a).getQuery(),d=void 0!==
b.line?b.line:a.getCursor().line,n=b.lineEnd||d,d==a.firstLine()&&n==a.lastLine()&&(n=Infinity),k&&(d=n,n=d+k-1),k=A(a,m(d,0)),k=a.getSearchCursor(f,k),nb(a,h,l,d,n,k,f,e,b.callback))},redo:q.commands.redo,undo:q.commands.undo,write:function(a){q.commands.save?q.commands.save(a):a.save&&a.save()},nohlsearch:function(a){ua(a)},yank:function(a){var b=x(a.getCursor()).line;a=a.getLine(b);r.registerController.pushText("0","yank",a,!0,!0)},delmarks:function(a,b){if(b.argString&&qa(b.argString))for(var c=
a.state.vim,d=new q.StringStream(qa(b.argString));!d.eol();){d.eatSpace();var f=d.pos;if(!d.match(/[a-zA-Z]/,!1)){u(a,"Invalid argument: "+b.argString.substring(f));break}var e=d.next();if(d.match("-",!0)){if(!d.match(/[a-zA-Z]/,!1)){u(a,"Invalid argument: "+b.argString.substring(f));break}var g=d.next();if(/^[a-z]$/.test(e)&&/^[a-z]$/.test(g)||T(e)&&T(g)){e=e.charCodeAt(0);g=g.charCodeAt(0);if(e>=g){u(a,"Invalid argument: "+b.argString.substring(f));break}for(f=0;f<=g-e;f++){var k=String.fromCharCode(e+
f);delete c.marks[k]}}else{u(a,"Invalid argument: "+e+"-");break}}else delete c.marks[e]}else u(a,"Argument required")}},I=new Y;q.keyMap.vim={attach:S,detach:ka,call:la};ca("insertModeEscKeysTimeout",200,"number");q.keyMap["vim-insert"]={"Ctrl-N":"autocomplete","Ctrl-P":"autocomplete",Enter:function(a){(q.commands.newlineAndIndentContinueComment||q.commands.newlineAndIndent)(a)},fallthrough:["default"],attach:S,detach:ka,call:la};q.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],
attach:S,detach:ka,call:la};Ea();return ja}()});
backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,
querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},
{keys:":",type:"ex"}],u=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},
{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],m=h.Pos;h.Vim=function(){function A(a,b){this==h.keyMap.vim&&h.rmClass(a.getWrapperElement(),"cm-fat-cursor");b&&b.attach==P||(a.setOption("disableInput",!1),a.off("cursorActivity",wa),h.off(a.getInputField(),"paste",xa(a)),a.state.vim=null)}function P(a,b){this==h.keyMap.vim&&h.addClass(a.getWrapperElement(),"cm-fat-cursor");b&&b.attach==P||
(a.setOption("disableInput",!0),a.setOption("showCursorWhenSelecting",!1),h.signal(a,"vim-mode-change",{mode:"normal"}),a.on("cursorActivity",wa),ba(a),h.on(a.getInputField(),"paste",xa(a)))}function la(a,b){if(b){if(this[a])return this[a];a=eb(a);if(!a)return!1;var c=h.Vim.findKey(b,a);"function"==typeof c&&h.signal(b,"vim-keypress",a);return c}}function eb(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<a.length;d++){var f=a[d];f in ya?a[d]=ya[f]:c=!0;f in za&&(a[d]=za[f])}if(!c)return!1;U(b)&&(a[a.length-1]=b.toLowerCase());return"<"+a.join("-")+">"}function xa(a){var b=a.state.vim;b.onPasteFn||(b.onPasteFn=function(){b.insertMode||(a.setCursor(B(a.getCursor(),0,1)),ca.enterInsertMode(a,{},b))});return b.onPasteFn}function ma(a,b){for(var c=[],d=a;d<a+b;d++)c.push(String.fromCharCode(d));return c}function Aa(a,b){return b>=a.firstLine()&&b<=a.lastLine()}function U(a){return/^[A-Z]$/.test(a)}
function na(a,b){for(var c=0;c<b.length;c++)if(b[c]==a)return!0;return!1}function da(a,b,c,d,f){if(void 0===b&&!f)throw Error("defaultValue is required unless callback is provided");c||(c="string");M[a]={type:c,defaultValue:b,callback:f};if(d)for(c=0;c<d.length;c++)M[d[c]]=M[a];b&&oa(a,b)}function oa(a,b,c,d){var f=M[a];d=d||{};d=d.scope;if(!f)throw Error("Unknown option: "+a);if("boolean"==f.type){if(b&&!0!==b)throw Error("Invalid argument: "+a+"="+b);!1!==b&&(b=!0)}f.callback?("local"!==d&&f.callback(b,
void 0),"global"!==d&&c&&f.callback(b,c)):("local"!==d&&(f.value="boolean"==f.type?!!b:b),"global"!==d&&c&&(c.state.vim.options[a]={value:b}))}function V(a,b,c){var d=M[a];c=c||{};c=c.scope;if(!d)throw Error("Unknown option: "+a);if(d.callback){a=b&&d.callback(void 0,b);if("global"!==c&&void 0!==a)return a;if("local"!==c)return d.callback()}else return a="global"!==c&&b&&b.state.vim.options[a],(a||"local"!==c&&d||{}).value}function Ba(){this.latestRegister=void 0;this.isRecording=this.isPlaying=!1;
this.replaySearchQueries=[];this.onRecordingDone=void 0;this.lastInsertModeChanges=Ca()}function ba(a){a.state.vim||(a.state.vim={inputState:new ea,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}});return a.state.vim}function Da(){p={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,
jumpList:fb(),macroModeState:new Ba,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new Ea({}),searchHistoryController:new pa({}),exCommandHistoryController:new pa({})};for(var a in M){var b=M[a];b.value=b.defaultValue}}function ea(){this.prefixRepeat=[];this.motionRepeat=[];this.motionArgs=this.motion=this.operatorArgs=this.operator=null;this.keyBuffer=[];this.registerName=null}function F(a,b){a.state.vim.inputState=new ea;h.signal(a,"vim-command-done",b)}function H(a,
b,c){this.clear();this.keyBuffer=[a||""];this.insertModeChanges=[];this.searchQueries=[];this.linewise=!!b;this.blockwise=!!c}function Ea(a){this.registers=a;this.unnamedRegister=a['"']=new H;a["."]=new H;a[":"]=new H;a["/"]=new H}function pa(){this.historyBuffer=[];this.iterator=0;this.initialPrefix=null}function Fa(a,b){for(var c=[],d=0;d<b;d++)c.push(a);return c}function E(a,b,c){var d=Math.min(Math.max(a.firstLine(),b.line),a.lastLine());a=C(a,d)-1;return m(d,Math.min(Math.max(0,b.ch),c?a+1:a))}
function fa(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function B(a,b,c){"object"===typeof b&&(c=b.ch,b=b.line);return m(a.line+b,a.ch+c)}function gb(a,b){return{line:b.line-a.line,ch:b.line-a.line}}function Ga(a,b,c){return function(){for(var d=0;d<c;d++)b(a)}}function y(a){return m(a.line,a.ch)}function I(a,b){return a.ch==b.ch&&a.line==b.line}function x(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch?!0:!1}function G(a,b){2<arguments.length&&(b=G.apply(void 0,Array.prototype.slice.call(arguments,
1)));return x(a,b)?a:b}function T(a,b){2<arguments.length&&(b=T.apply(void 0,Array.prototype.slice.call(arguments,1)));return x(a,b)?b:a}function Ha(a,b,c){a=x(a,b);b=x(b,c);return a&&b}function C(a,b){return a.getLine(b).length}function qa(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function hb(a,b,c){var d=C(a,b);c=Array(c-d+1).join(" ");a.setCursor(m(b,d));a.replaceRange(c,a.getCursor())}function Ia(a,b){var c=[],d=a.listSelections(),f=y(a.clipPos(b)),e=!I(b,f),g;a:{var l=a.getCursor("head");
for(g=0;g<d.length;g++){var k=I(d[g].anchor,l),z=I(d[g].head,l);if(k||z)break a}g=-1}var l=I(d[g].head,d[g].anchor),k=d.length-1,h=k-g>g?k:0;g=d[h].anchor;var D=Math.min(g.line,f.line),k=Math.max(g.line,f.line),z=g.ch,f=f.ch,d=d[h].head.ch-z,h=f-z;0<d&&0>=h?(z++,e||f--):0>d&&0<=h?(z--,l||f++):0>d&&-1==h&&(z--,f++);for(e=D;e<=k;e++)d={anchor:new m(e,z),head:new m(e,f)},c.push(d);a.setSelections(c);b.ch=f;g.ch=z;return g}function Ja(a,b,c){for(var d=[],f=0;f<c;f++){var e=B(b,f,0);d.push({anchor:e,head:e})}a.setSelections(d,
0)}function ib(a,b){var c=b.lastSelection,d=function(){var b=a.getCursor(),d=a.getCursor(),g=c.visualBlock;if(g){for(var d=m(b.line+g.height,b.ch+g.width),g=[],l=b.line;l<d.line;l++){var k=m(l,b.ch),h=m(l,d.ch);g.push({anchor:k,head:h})}a.setSelections(g)}else l=c.anchorMark.find(),k=c.headMark.find(),g=k.line-l.line,l=k.ch-l.ch,d={line:d.line+g,ch:g?d.ch:l+d.ch},c.visualLine&&(b=m(b.line,0),d=m(d.line,C(a,d.line))),a.setSelection(b,d);return[b,d]};return b.visualMode?function(){var b=a.listSelections(),
c=b[0],b=b[b.length-1],c=x(c.anchor,c.head)?c.anchor:c.head,b=x(b.anchor,b.head)?b.head:b.anchor;return[c,b]}():d()}function Ka(a,b){var c=b.sel.anchor,d=b.sel.head;b.lastPastedText&&(d=a.posFromIndex(a.indexFromPos(c)+b.lastPastedText.length),b.lastPastedText=null);b.lastSelection={anchorMark:a.setBookmark(c),headMark:a.setBookmark(d),anchor:y(c),head:y(d),visualMode:b.visualMode,visualLine:b.visualLine,visualBlock:b.visualBlock}}function W(a,b,c){var d=a.state.vim;b=b||d.sel;c=c||d.visualLine?"line":
d.visualBlock?"block":"char";b=ra(a,b,c);a.setSelections(b.ranges,b.primary);La(a)}function ra(a,b,c,d){var f=y(b.head),e=y(b.anchor);if("char"==c)return f=d||x(b.head,b.anchor)?0:1,e=x(b.head,b.anchor)?1:0,f=B(b.head,0,f),e=B(b.anchor,0,e),{ranges:[{anchor:e,head:f}],primary:0};if("line"==c)return x(b.head,b.anchor)?(f.ch=0,e.ch=C(a,e.line)):(e.ch=0,b=a.lastLine(),f.line>b&&(f.line=b),f.ch=C(a,f.line)),{ranges:[{anchor:e,head:f}],primary:0};if("block"==c){b=Math.min(e.line,f.line);a=Math.min(e.ch,
f.ch);c=Math.max(e.ch,f.ch)+1;e=Math.max(e.line,f.line)-b+1;f=f.line==b?0:e-1;d=[];for(var g=0;g<e;g++)d.push({anchor:m(b+g,a),head:m(b+g,c)});return{ranges:d,primary:f}}}function J(a,b){var c=a.state.vim;!1!==b&&a.setCursor(E(a,c.sel.head));Ka(a,c);c.visualMode=!1;c.visualLine=!1;c.visualBlock=!1;h.signal(a,"vim-mode-change",{mode:"normal"});c.fakeCursor&&c.fakeCursor.clear()}function K(a){if(!a)return 0;var b=a.search(/\S/);return-1==b?a.length:b}function ga(a,b,c,d,f){c=a.getCursor("head");1==
a.getSelection().length&&(c=G(c,a.getCursor("anchor")));a=a.getLine(c.line);var e=c.ch;for(f=f?ha[0]:sa[0];!f(a.charAt(e));)if(e++,e>=a.length)return null;d?f=sa[0]:(f=ha[0],f(a.charAt(e))||(f=ha[1]));for(d=e;f(a.charAt(d))&&d<a.length;)d++;for(;f(a.charAt(e))&&0<=e;)e--;e++;if(b){for(b=d;/\s/.test(a.charAt(d))&&d<a.length;)d++;if(b==d){for(b=e;/\s/.test(a.charAt(e-1))&&0<e;)e--;e||(e=b)}}return{start:m(c.line,e),end:m(c.line,d)}}function Ma(a,b){p.lastCharacterSearch.increment=a;p.lastCharacterSearch.forward=
b.forward;p.lastCharacterSearch.selectedCharacter=b.selectedCharacter}function ta(a,b,c,d){for(var f=a.getCursor(),e=f.ch,g,l=0;l<b;l++){g=a.getLine(f.line);var k=d;g=c?g.indexOf(k,e+1):g.lastIndexOf(k,e-1);if(-1==g)return null;e=g}return m(a.getCursor().line,g)}function N(a,b,c,d){na(c,jb)&&(b.marks[c]&&b.marks[c].clear(),b.marks[c]=a.setBookmark(d))}function Na(a,b,c,d,f){function e(b,c,d){return d?!a.getLine(b)!=!a.getLine(b+c):!!a.getLine(b)&&!a.getLine(b+c)}b=b.line;var g=a.firstLine(),l=a.lastLine(),
k=b;if(d){for(;g<=k&&k<=l&&0<c;)e(k,d)&&c--,k+=d;return new m(k,0)}k=a.state.vim;k.visualLine&&e(b,1,!0)&&(k=k.sel.anchor,e(k.line,-1,!0)&&(f&&k.line==b||(b+=1)));d=!a.getLine(b);for(k=b;k<=l&&c;k++)e(k,1,!0)&&(f&&!a.getLine(k)==d||c--);c=new m(k,0);k>l&&!d?d=!0:f=!1;for(k=b;k>g&&(f&&!a.getLine(k)!=d&&k!=b||!e(k,-1,!0));k--);return{start:new m(k,0),end:c}}function Oa(){}function O(a){a=a.state.vim;return a.searchState_||(a.searchState_=new Oa)}function Pa(a){var b=Qa(a)||[];if(!b.length)return[];
var c=[];if(0===b[0]){for(var d=0;d<b.length;d++)"number"==typeof b[d]&&c.push(a.substring(b[d]+1,b[d+1]));return c}}function Qa(a){for(var b=!1,c=[],d=0;d<a.length;d++){var f=a.charAt(d);b||"/"!=f||c.push(d);b=!b&&"\\"==f}return c}function w(a,b){a.openNotification?a.openNotification('<span style="color: red">'+b+"</span>",{bottom:!0,duration:5E3}):alert(b)}function ia(a,b){var c=(b.prefix||"")+" "+(b.desc||""),d=b.desc,f='<span style="font-family: monospace; white-space: pre">'+(b.prefix||"")+'<input type="text"></span>';
d&&(f+=' <span style="color: #888">'+d+"</span>");d=b.onClose;a.openDialog?a.openDialog(f,d,{bottom:!0,value:b.value,onKeyDown:b.onKeyDown,onKeyUp:b.onKeyUp,selectValueOnOpen:!1}):d(prompt(c,""))}function X(a,b,c,d){if(b){var f=O(a),e;c=!!c;d=!!d;p.registerController.getRegister("/").setText(b);if(b instanceof RegExp)e=b;else{var g=Qa(b),l;g.length?(l=b.substring(0,g[0]),e=-1!=b.substring(g[0]).indexOf("i")):l=b;if(l){if(!V("pcre")){b=l;g=!1;l=[];for(var k=-1;k<b.length;k++){var h=b.charAt(k)||"",
q=b.charAt(k+1)||"",m=q&&-1!="|(){".indexOf(q);g?("\\"===h&&m||l.push(h),g=!1):"\\"===h?(g=!0,q&&-1!="}".indexOf(q)&&(m=!0),m&&"\\"!==q||l.push(h)):(l.push(h),m&&"\\"!==q&&l.push("\\"))}l=l.join("")}d&&(c=/^[^A-Z]*$/.test(l));e=new RegExp(l,c||e?"i":void 0)}else e=null}if(e){Ra(a,e);a:if(a=f.getQuery(),e instanceof RegExp&&a instanceof RegExp){c=["global","multiline","ignoreCase","source"];for(d=0;d<c.length;d++)if(b=c[d],e[b]!==a[b]){a=!1;break a}a=!0}else a=!1;if(a)return e;f.setQuery(e);return e}}}
function kb(a){if("^"==a.source.charAt(0))var b=!0;return{token:function(c){if(b&&!c.sol())c.skipToEnd();else{var d=c.match(a,!1);if(d){if(0==d[0].length)return c.next(),"searching";if(!c.sol()&&(c.backUp(1),!a.exec(c.next()+d[0])))return c.next(),null;c.match(a);return"searching"}for(;!c.eol()&&(c.next(),!c.match(a,!1)););}},query:a}}function Ra(a,b){var c=O(a),d=c.getOverlay();d&&b==d.query||(d&&a.removeOverlay(d),d=kb(b),a.addOverlay(d),a.showMatchesOnScrollbar&&(c.getScrollbarAnnotate()&&c.getScrollbarAnnotate().clear(),
c.setScrollbarAnnotate(a.showMatchesOnScrollbar(b))),c.setOverlay(d))}function Sa(a,b,c,d){void 0===d&&(d=1);return a.operation(function(){for(var f=a.getCursor(),e=a.getSearchCursor(c,f),g=0;g<d;g++){var l=e.find(b);0==g&&l&&I(e.from(),f)&&(l=e.find(b));if(!l&&(e=a.getSearchCursor(c,b?m(a.lastLine()):m(a.firstLine(),0)),!e.find(b)))return}return e.from()})}function ua(a){var b=O(a);a.removeOverlay(O(a).getOverlay());b.setOverlay(null);b.getScrollbarAnnotate()&&(b.getScrollbarAnnotate().clear(),b.setScrollbarAnnotate(null))}
function lb(a,b,c){"number"!=typeof a&&(a=a.line);return b instanceof Array?na(a,b):c?a>=b&&a<=c:a==b}function va(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 mb(a,b,c,d,f,e,g,l,k){function z(){a.operation(function(){for(;!p;)q(),m();n()})}function q(){var b=a.getRange(e.from(),e.to()).replace(g,l);e.replace(b)}function m(){for(;e.findNext()&&lb(e.from(),d,f);)if(c||!v||
e.from().line!=v.line){a.scrollIntoView(e.from(),30);a.setSelection(e.from(),e.to());v=e.from();p=!1;return}p=!0}function n(b){b&&b();a.focus();v&&(a.setCursor(v),b=a.state.vim,b.exMode=!1,b.lastHPos=b.lastHSPos=v.ch);k&&k()}a.state.vim.exMode=!0;var p=!1,v=e.from();m();p?w(a,"No matches for "+g.source):b?ia(a,{prefix:"replace with <strong>"+l+"</strong> (y/n/a/q/l)",onKeyDown:function(b,c,d){h.e_stop(b);switch(h.keyName(b)){case "Y":q();m();break;case "N":m();break;case "A":b=k;k=void 0;a.operation(z);
k=b;break;case "L":q();case "Q":case "Esc":case "Ctrl-C":case "Ctrl-[":n(d)}p&&n(d);return!0}}):(z(),k&&k())}function Y(a){var b=a.state.vim,c=p.macroModeState,d=p.registerController.getRegister("."),f=c.isPlaying,e=c.lastInsertModeChanges,g;if(!f){var l=e.inVisualBlock?b.lastSelection.visualBlock.height:1,k=e.changes;g=[];for(var z=0;z<k.length;)g.push(k[z]),k[z]instanceof ja?z++:z+=l;e.changes=g;a.off("change",Ta);h.off(a.getInputField(),"keydown",Ua)}!f&&1<b.insertModeRepeat&&(Va(a,b,b.insertModeRepeat-
1,!0),b.lastEditInputState.repeatOverride=b.insertModeRepeat);delete b.insertModeRepeat;b.insertMode=!1;a.setCursor(a.getCursor().line,a.getCursor().ch-1);a.setOption("keyMap","vim");a.setOption("disableInput",!0);a.toggleOverwrite(!1);d.setText(e.changes.join(""));h.signal(a,"vim-mode-change",{mode:"normal"});c.isRecording&&(c.isPlaying||(a=p.registerController.getRegister(c.latestRegister))&&a.pushInsertModeChanges&&a.pushInsertModeChanges(c.lastInsertModeChanges))}function Wa(a){r.unshift(a)}function Ta(a,
b){var c=p.macroModeState;a=c.lastInsertModeChanges;if(!c.isPlaying)for(;b;){a.expectCursorActivityForChange=!0;if("+input"==b.origin||"paste"==b.origin||void 0===b.origin)c=b.text.join("\n"),a.maybeReset&&(a.changes=[],a.maybeReset=!1),a.changes.push(c);b=b.next}}function wa(a){var b=a.state.vim;if(b.insertMode){var c=p.macroModeState;if(c.isPlaying)return;c=c.lastInsertModeChanges;c.expectCursorActivityForChange?c.expectCursorActivityForChange=!1:c.maybeReset=!0}else if(!a.curOp.isVimOp){var c=
a.getCursor("anchor"),d=a.getCursor("head");b.visualMode&&!a.somethingSelected()?J(a,!1):b.visualMode||b.insertMode||!a.somethingSelected()||(b.visualMode=!0,b.visualLine=!1,h.signal(a,"vim-mode-change",{mode:"visual"}));if(b.visualMode){var f=x(d,c)?0:-1,e=x(d,c)?-1:0,d=B(d,0,f),c=B(c,0,e);b.sel={anchor:c,head:d};N(a,b,"<",G(d,c));N(a,b,">",T(d,c))}else b.insertMode||(b.lastHPos=a.getCursor().ch)}b.visualMode&&La(a)}function La(a){var b=a.state.vim,c=E(a,y(b.sel.head)),d=B(c,0,1);b.fakeCursor&&b.fakeCursor.clear();
b.fakeCursor=a.markText(c,d,{className:"cm-animate-fat-cursor"})}function ja(a){this.keyName=a}function Ua(a){function b(){c.maybeReset&&(c.changes=[],c.maybeReset=!1);c.changes.push(new ja(d));return!0}var c=p.macroModeState.lastInsertModeChanges,d=h.keyName(a);d&&(-1==d.indexOf("Delete")&&-1==d.indexOf("Backspace")||h.lookupKey(d,"vim-insert",b))}function Va(a,b,c,d){function f(){l?R.processAction(a,b,b.lastEditActionCommand):R.evalInput(a,b)}function e(c){0<g.lastInsertModeChanges.changes.length&&
(c=b.lastEditActionCommand?c:1,Xa(a,g.lastInsertModeChanges.changes,c))}var g=p.macroModeState;g.isPlaying=!0;var l=!!b.lastEditActionCommand,k=b.inputState;b.inputState=b.lastEditInputState;if(l&&b.lastEditActionCommand.interlaceInsertRepeat)for(var h=0;h<c;h++)f(),e(1);else d||f(),e(c);b.inputState=k;b.insertMode&&!d&&Y(a);g.isPlaying=!1}function Xa(a,b,c){function d(b){if("string"==typeof b)h.commands[b](a);else b(a);return!0}var f=a.getCursor("head"),e=p.macroModeState.lastInsertModeChanges.inVisualBlock;
e&&(c=a.state.vim.lastSelection,c=gb(c.anchor,c.head),Ja(a,f,c.line+1),c=a.listSelections().length,a.setCursor(f));for(var g=0;g<c;g++){e&&a.setCursor(B(f,g,0));for(var l=0;l<b.length;l++){var k=b[l];if(k instanceof ja)h.lookupKey(k.keyName,"vim-insert",d);else{var z=a.getCursor();a.replaceRange(k,z,z)}}}e&&a.setCursor(B(f,0,1))}h.defineOption("vimMode",!1,function(a,b,c){b&&"vim"!=a.getOption("keyMap")?a.setOption("keyMap","vim"):!b&&c!=h.Init&&/^vim/.test(a.getOption("keyMap"))&&a.setOption("keyMap",
"default")});var ya={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A"},za={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"},nb=/[\d]/,ha=[h.isWordChar,function(a){return a&&!h.isWordChar(a)&&!/\s/.test(a)}],sa=[function(a){return/\S/.test(a)}],ka=ma(65,26),Z=ma(97,26),Ya=ma(48,10),jb=[].concat(ka,Z,Ya,["<",">"]),Za=[].concat(ka,Z,Ya,["-",'"',".",":","/"]),M={};da("filetype",void 0,"string",["ft"],function(a,b){if(void 0!==b){if(void 0===a)return a=b.getOption("mode"),"null"==a?"":a;b.setOption("mode",
""==a?"null":a)}});var fb=function(){var a=-1,b=0,c=0,d=Array(100);return{cachedCursor:void 0,add:function(f,e,g){function l(b){var c=++a%100,e=d[c];e&&e.clear();d[c]=f.setBookmark(b)}var k=d[a%100];k?(k=k.find())&&!I(k,e)&&l(e):l(e);l(g);b=a;c=a-100+1;0>c&&(c=0)},move:function(f,e){a+=e;a>b?a=b:a<c&&(a=c);var g=d[(100+a)%100];if(g&&!g.find()){e=0<e?1:-1;var l;f=f.getCursor();do if(a+=e,(g=d[(100+a)%100])&&(l=g.find())&&!I(f,l))break;while(a<b&&a>c)}return g}}},Ca=function(a){return a?{changes:a.changes,
expectCursorActivityForChange:a.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};Ba.prototype={exitMacroRecordMode:function(){var a=p.macroModeState;if(a.onRecordingDone)a.onRecordingDone();a.onRecordingDone=void 0;a.isRecording=!1},enterMacroRecordMode:function(a,b){var c=p.registerController.getRegister(b);c&&(c.clear(),this.latestRegister=b,a.openDialog&&(this.onRecordingDone=a.openDialog("(recording)["+b+"]",null,{bottom:!0})),this.isRecording=!0)}};var p,aa,ka={buildKeyMap:function(){},
getRegisterController:function(){return p.registerController},resetVimGlobalState_:Da,getVimGlobalState_:function(){return p},maybeInitVimState_:ba,suppressErrorLogging:!1,InsertModeKey:ja,map:function(a,b,c){L.map(a,b,c)},unmap:function(a,b){L.unmap(a,b)},setOption:oa,getOption:V,defineOption:da,defineEx:function(a,b,c){if(!b)b=a;else if(0!==a.indexOf(b))throw Error('(Vim.defineEx) "'+b+'" is not a prefix of "'+a+'", command not registered');$a[a]=c;L.commandMap_[b]={name:a,shortName:b,type:"api"}},
handleKey:function(a,b,c){a=this.findKey(a,b,c);if("function"===typeof a)return a()},findKey:function(a,b,c){function d(){if("<Esc>"==b)return F(a),g.visualMode?J(a):g.insertMode&&Y(a),!0}function f(){if(d())return!0;for(var c=g.inputState.keyBuffer+=b,e=1==b.length,f=R.matchCommand(c,r,g.inputState,"insert");1<c.length&&"full"!=f.type;){var c=g.inputState.keyBuffer=c.slice(1),l=R.matchCommand(c,r,g.inputState,"insert");"none"!=l.type&&(f=l)}if("none"==f.type)return F(a),!1;if("partial"==f.type)return aa&&
window.clearTimeout(aa),aa=window.setTimeout(function(){g.insertMode&&g.inputState.keyBuffer&&F(a)},V("insertModeEscKeysTimeout")),!e;aa&&window.clearTimeout(aa);if(e){e=a.listSelections();for(l=0;l<e.length;l++){var h=e[l].head;a.replaceRange("",B(h,0,-(c.length-1)),h,"+input")}p.macroModeState.lastInsertModeChanges.changes.pop()}F(a);return f.command}function e(){var e;a:{var f=p.macroModeState;if(f.isRecording){if("q"==b){f.exitMacroRecordMode();F(a);e=!0;break a}"mapping"!=c&&(e=b,f.isPlaying||
(f=p.registerController.getRegister(f.latestRegister))&&f.pushText(e))}e=void 0}if(e||d())return!0;e=g.inputState.keyBuffer+=b;if(/^[1-9]\d*$/.test(e))return!0;f=/^(\d*)(.*)$/.exec(e);if(!f)return F(a),!1;var l=R.matchCommand(f[2]||f[1],r,g.inputState,g.visualMode?"visual":"normal");if("none"==l.type)return F(a),!1;if("partial"==l.type)return!0;g.inputState.keyBuffer="";f=/^(\d*)(.*)$/.exec(e);f[1]&&"0"!=f[1]&&g.inputState.pushRepeatDigit(f[1]);return l.command}var g=ba(a),l;l=g.insertMode?f():e();
if(!1!==l)return!0===l?function(){return!0}:function(){return a.operation(function(){a.curOp.isVimOp=!0;try{if("keyToKey"==l.type)for(var c=l.toKeys,d;c;)d=/<\w+-.+?>|<\w+>|./.exec(c),b=d[0],c=c.substring(d.index+b.length),h.Vim.handleKey(a,b,"mapping");else R.processCommand(a,g,l)}catch(q){throw a.state.vim=void 0,ba(a),h.Vim.suppressErrorLogging||console.log(q),q;}return!0})}},handleEx:function(a,b){L.processCommand(a,b)},defineMotion:function(a,b){S[a]=b},defineAction:function(a,b){ca[a]=b},defineOperator:function(a,
b){ab[a]=b},mapCommand:function(a,b,c,d,f){a={keys:a,type:b};a[b]=c;a[b+"Args"]=d;for(var e in f)a[e]=f[e];Wa(a)},_mapCommand:Wa,defineRegister:function(a,b){var c=p.registerController.registers[a];if(!a||1!=a.length)throw Error("Register name must be 1 character");if(c[a])throw Error("Register already defined "+a);c[a]=b;Za.push(a)},exitVisualMode:J,exitInsertMode:Y};ea.prototype.pushRepeatDigit=function(a){this.operator?this.motionRepeat=this.motionRepeat.concat(a):this.prefixRepeat=this.prefixRepeat.concat(a)};
ea.prototype.getRepeat=function(){var a=0;if(0<this.prefixRepeat.length||0<this.motionRepeat.length)a=1,0<this.prefixRepeat.length&&(a*=parseInt(this.prefixRepeat.join(""),10)),0<this.motionRepeat.length&&(a*=parseInt(this.motionRepeat.join(""),10));return a};H.prototype={setText:function(a,b,c){this.keyBuffer=[a||""];this.linewise=!!b;this.blockwise=!!c},pushText:function(a,b){b&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0);this.keyBuffer.push(a)},pushInsertModeChanges:function(a){this.insertModeChanges.push(Ca(a))},
pushSearchQuery:function(a){this.searchQueries.push(a)},clear:function(){this.keyBuffer=[];this.insertModeChanges=[];this.searchQueries=[];this.linewise=!1},toString:function(){return this.keyBuffer.join("")}};Ea.prototype={pushText:function(a,b,c,d,f){d&&"\n"==c.charAt(0)&&(c=c.slice(1)+"\n");d&&"\n"!==c.charAt(c.length-1)&&(c+="\n");var e=this.isValidRegister(a)?this.getRegister(a):null;if(e)U(a)?e.pushText(c,d):e.setText(c,d,f),this.unnamedRegister.setText(e.toString(),d);else{switch(b){case "yank":this.registers["0"]=
new H(c,d,f);break;case "delete":case "change":-1==c.indexOf("\n")?this.registers["-"]=new H(c,d):(this.shiftNumericRegisters_(),this.registers["1"]=new H(c,d))}this.unnamedRegister.setText(c,d,f)}},getRegister:function(a){if(!this.isValidRegister(a))return this.unnamedRegister;a=a.toLowerCase();this.registers[a]||(this.registers[a]=new H);return this.registers[a]},isValidRegister:function(a){return a&&na(a,Za)},shiftNumericRegisters_:function(){for(var a=9;2<=a;a--)this.registers[a]=this.getRegister(""+
(a-1))}};pa.prototype={nextMatch:function(a,b){var c=this.historyBuffer,d=b?-1:1;null===this.initialPrefix&&(this.initialPrefix=a);for(var f=this.iterator+d;b?0<=f:f<c.length;f+=d)for(var e=c[f],g=0;g<=e.length;g++)if(this.initialPrefix==e.substring(0,g))return this.iterator=f,e;if(f>=c.length)return this.iterator=c.length,this.initialPrefix;if(0>f)return a},pushInput:function(a){var b=this.historyBuffer.indexOf(a);-1<b&&this.historyBuffer.splice(b,1);a.length&&this.historyBuffer.push(a)},reset:function(){this.initialPrefix=
null;this.iterator=this.historyBuffer.length}};var R={matchCommand:function(a,b,c,d){var f,e,g=[];f=[];for(var l=0;l<b.length;l++){var k=b[l],h;if(h=!("insert"==d&&"insert"!=k.context||k.context&&k.context!=d||c.operator&&"action"==k.type)){e=a;var m=k.keys;if("<character>"==m.slice(-11)){h=m.length-11;var p=e.slice(0,h),m=m.slice(0,h);e=p==m&&e.length>h?"full":0==m.indexOf(p)?"partial":!1}else e=e==m?"full":0==m.indexOf(e)?"partial":!1;h=e}h&&("partial"==e&&g.push(k),"full"==e&&f.push(k))}b=g.length&&
g;f=f.length&&f;if(!f&&!b)return{type:"none"};if(!f&&b)return{type:"partial"};var n;for(b=0;b<f.length;b++)d=f[b],n||(n=d);if("<character>"==n.keys.slice(-11)){a=(f=/^.*(<[\w\-]+>)$/.exec(a))?f[1]:a.slice(-1);if(1<a.length)switch(a){case "<CR>":a="\n";break;case "<Space>":a=" "}c.selectedCharacter=a}return{type:"full",command:n}},processCommand:function(a,b,c){b.inputState.repeatOverride=c.repeatOverride;switch(c.type){case "motion":this.processMotion(a,b,c);break;case "operator":this.processOperator(a,
b,c);break;case "operatorMotion":this.processOperatorMotion(a,b,c);break;case "action":this.processAction(a,b,c);break;case "search":this.processSearch(a,b,c);break;case "ex":case "keyToEx":this.processEx(a,b,c)}},processMotion:function(a,b,c){b.inputState.motion=c.motion;b.inputState.motionArgs=fa(c.motionArgs);this.evalInput(a,b)},processOperator:function(a,b,c){var d=b.inputState;if(d.operator){if(d.operator==c.operator){d.motion="expandToLine";d.motionArgs={linewise:!0};this.evalInput(a,b);return}F(a)}d.operator=
c.operator;d.operatorArgs=fa(c.operatorArgs);b.visualMode&&this.evalInput(a,b)},processOperatorMotion:function(a,b,c){var d=b.visualMode,f=fa(c.operatorMotionArgs);f&&d&&f.visualLine&&(b.visualLine=!0);this.processOperator(a,b,c);d||this.processMotion(a,b,c)},processAction:function(a,b,c){var d=b.inputState,f=d.getRepeat(),e=!!f,g=fa(c.actionArgs)||{};d.selectedCharacter&&(g.selectedCharacter=d.selectedCharacter);c.operator&&this.processOperator(a,b,c);c.motion&&this.processMotion(a,b,c);(c.motion||
c.operator)&&this.evalInput(a,b);g.repeat=f||1;g.repeatIsExplicit=e;g.registerName=d.registerName;F(a);b.lastMotion=null;c.isEdit&&this.recordLastEdit(b,d,c);ca[c.action](a,g,b)},processSearch:function(a,b,c){function d(d,e,f){p.searchHistoryController.pushInput(d);p.searchHistoryController.reset();try{X(a,d,e,f)}catch(Q){w(a,"Invalid regex: "+d);F(a);return}R.processMotion(a,b,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:c.searchArgs.toJumplist}})}function f(b){a.scrollTo(D.left,
D.top);d(b,!0,!0);var c=p.macroModeState;c.isRecording&&(c.isPlaying||(c=p.registerController.getRegister(c.latestRegister))&&c.pushSearchQuery&&c.pushSearchQuery(b))}function e(b,c,d){b=h.keyName(b);"Up"==b||"Down"==b?(c=p.searchHistoryController.nextMatch(c,"Up"==b?!0:!1)||"",d(c)):"Left"!=b&&"Right"!=b&&"Ctrl"!=b&&"Alt"!=b&&"Shift"!=b&&p.searchHistoryController.reset();var e;try{e=X(a,c,!0,!0)}catch(qb){}e?a.scrollIntoView(Sa(a,!l,e),30):(ua(a),a.scrollTo(D.left,D.top))}function g(b,c,d){var e=
h.keyName(b);"Esc"==e||"Ctrl-C"==e||"Ctrl-["==e||"Backspace"==e&&""==c?(p.searchHistoryController.pushInput(c),p.searchHistoryController.reset(),X(a,q),ua(a),a.scrollTo(D.left,D.top),h.e_stop(b),F(a),d(),a.focus()):"Ctrl-U"==e&&(h.e_stop(b),d(""))}if(a.getSearchCursor){var l=c.searchArgs.forward,k=c.searchArgs.wholeWordOnly;O(a).setReversed(!l);var m=l?"/":"?",q=O(a).getQuery(),D=a.getScrollInfo();switch(c.searchArgs.querySrc){case "prompt":k=p.macroModeState;k.isPlaying?(m=k.replaySearchQueries.shift(),
d(m,!0,!1)):ia(a,{onClose:f,prefix:m,desc:ob,onKeyUp:e,onKeyDown:g});break;case "wordUnderCursor":var n=ga(a,!1,!0,!1,!0),t=!0;n||(n=ga(a,!1,!0,!1,!1),t=!1);n&&(m=a.getLine(n.start.line).substring(n.start.ch,n.end.ch),m=t&&k?"\\b"+m+"\\b":m.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),p.jumpList.cachedCursor=a.getCursor(),a.setCursor(n.start),d(m,!0,!1))}}},processEx:function(a,b,c){function d(b){p.exCommandHistoryController.pushInput(b);p.exCommandHistoryController.reset();L.processCommand(a,b)}function f(b,
c,d){var e=h.keyName(b);if("Esc"==e||"Ctrl-C"==e||"Ctrl-["==e||"Backspace"==e&&""==c)p.exCommandHistoryController.pushInput(c),p.exCommandHistoryController.reset(),h.e_stop(b),F(a),d(),a.focus();"Up"==e||"Down"==e?(c=p.exCommandHistoryController.nextMatch(c,"Up"==e?!0:!1)||"",d(c)):"Ctrl-U"==e?(h.e_stop(b),d("")):"Left"!=e&&"Right"!=e&&"Ctrl"!=e&&"Alt"!=e&&"Shift"!=e&&p.exCommandHistoryController.reset()}"keyToEx"==c.type?L.processCommand(a,c.exArgs.input):b.visualMode?ia(a,{onClose:d,prefix:":",
value:"'<,'>",onKeyDown:f}):ia(a,{onClose:d,prefix:":",onKeyDown:f})},evalInput:function(a,b){var c=b.inputState,d=c.motion,f=c.motionArgs||{},e=c.operator,g=c.operatorArgs||{},l=c.registerName,k=b.sel,h=y(b.visualMode?E(a,k.head):a.getCursor("head")),q=y(b.visualMode?E(a,k.anchor):a.getCursor("anchor")),D=y(h),q=y(q),n,t,v;e&&this.recordLastEdit(b,c);v=void 0!==c.repeatOverride?c.repeatOverride:c.getRepeat();if(0<v&&f.explicitRepeat)f.repeatIsExplicit=!0;else if(f.noRepeat||!f.explicitRepeat&&0===
v)v=1,f.repeatIsExplicit=!1;c.selectedCharacter&&(f.selectedCharacter=g.selectedCharacter=c.selectedCharacter);f.repeat=v;F(a);if(d){n=S[d](a,h,f,b);b.lastMotion=S[d];if(!n)return;f.toJumplist&&(d=p.jumpList,(c=d.cachedCursor)?(I(c,n)||p.jumpList.add(a,c,n),delete d.cachedCursor):I(h,n)||p.jumpList.add(a,h,n));n instanceof Array&&(t=n[0],n=n[1]);n||(n=y(h));b.visualMode?(b.visualBlock&&Infinity===n.ch||(n=E(a,n,b.visualBlock)),t&&(t=E(a,t,!0)),t=t||q,k.anchor=t,k.head=n,W(a),N(a,b,"<",x(t,n)?t:n),
N(a,b,">",x(t,n)?n:t)):e||(n=E(a,n),a.setCursor(n.line,n.ch))}if(e){g.lastSel?(t=q,k=g.lastSel,n=Math.abs(k.head.line-k.anchor.line),h=Math.abs(k.head.ch-k.anchor.ch),n=k.visualLine?m(q.line+n,q.ch):k.visualBlock?m(q.line+n,q.ch+h):k.head.line==k.anchor.line?m(q.line,q.ch+h):m(q.line+n,q.ch),b.visualMode=!0,b.visualLine=k.visualLine,b.visualBlock=k.visualBlock,k=b.sel={anchor:t,head:n},W(a)):b.visualMode&&(g.lastSel={anchor:y(k.anchor),head:y(k.head),visualBlock:b.visualBlock,visualLine:b.visualLine});
if(b.visualMode){if(t=G(k.head,k.anchor),k=T(k.head,k.anchor),D=b.visualLine||g.linewise,f=b.visualBlock?"block":D?"line":"char",t=ra(a,{anchor:t,head:k},f),D)if(k=t.ranges,"block"==f)for(f=0;f<k.length;f++)k[f].head.ch=C(a,k[f].head.line);else"line"==f&&(k[0].head=m(k[0].head.line+1,0))}else{t=y(t||q);k=y(n||D);x(k,t)&&(D=t,t=k,k=D);if(D=f.linewise||g.linewise)h=k,t.ch=0,h.ch=0,h.line++;else if(f.forward&&(h=k,d=a.getRange(t,h),/\n\s*$/.test(d))){d=d.split("\n");d.pop();for(c=d.pop();0<d.length&&
c&&/^\s*$/.test(c);c=d.pop())h.line--,h.ch=0;c?(h.line--,h.ch=C(a,h.line)):h.ch=0}t=ra(a,{anchor:t,head:k},"char",!f.inclusive||D)}a.setSelections(t.ranges,t.primary);b.lastMotion=null;g.repeat=v;g.registerName=l;g.linewise=D;e=ab[e](a,g,t.ranges,q,n);b.visualMode&&J(a,null!=e);e&&a.setCursor(e)}},recordLastEdit:function(a,b,c){var d=p.macroModeState;d.isPlaying||(a.lastEditInputState=b,a.lastEditActionCommand=c,d.lastInsertModeChanges.changes=[],d.lastInsertModeChanges.expectCursorActivityForChange=
!1)}},S={moveToTopLine:function(a,b,c){b=va(a).top+c.repeat-1;return m(b,K(a.getLine(b)))},moveToMiddleLine:function(a){var b=va(a),b=Math.floor(.5*(b.top+b.bottom));return m(b,K(a.getLine(b)))},moveToBottomLine:function(a,b,c){b=va(a).bottom-c.repeat+1;return m(b,K(a.getLine(b)))},expandToLine:function(a,b,c){return m(b.line+c.repeat-1,Infinity)},findNext:function(a,b,c){b=O(a);var d=b.getQuery();if(d){var f=!c.forward,f=b.isReversed()?!f:f;Ra(a,d);return Sa(a,f,d,c.repeat)}},goToMark:function(a,
b,c,d){return(b=d.marks[c.selectedCharacter])?(b=b.find(),c.linewise?{line:b.line,ch:K(a.getLine(b.line))}:b):null},moveToOtherHighlightedEnd:function(a,b,c,d){return d.visualBlock&&c.sameLine?(b=d.sel,[E(a,m(b.anchor.line,b.head.ch)),E(a,m(b.head.line,b.anchor.ch))]):[d.sel.head,d.sel.anchor]},jumpToMark:function(a,b,c,d){for(var f=0;f<c.repeat;f++){var e=b,g;for(g in d.marks)if(/^[a-z]$/.test(g)){var l=d.marks[g].find();if(c.forward?!x(l,e):!x(e,l))if(!c.linewise||l.line!=e.line){var k=I(e,b),h=
c.forward?Ha(e,l,b):Ha(b,l,e);if(k||h)b=l}}}c.linewise&&(b=m(b.line,K(a.getLine(b.line))));return b},moveByCharacters:function(a,b,c){a=c.repeat;return m(b.line,c.forward?b.ch+a:b.ch-a)},moveByLines:function(a,b,c,d){var f=b.ch;switch(d.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:f=d.lastHPos;break;default:d.lastHPos=f}var e=c.repeat+(c.repeatOffset||0),e=c.forward?b.line+e:b.line-e,g=a.firstLine(),l=a.lastLine();
if(e<g&&b.line==g)return this.moveToStartOfLine(a,b,c,d);if(e>l&&b.line==l)return this.moveToEol(a,b,c,d);c.toFirstChar&&(f=K(a.getLine(e)),d.lastHPos=f);d.lastHSPos=a.charCoords(m(e,f),"div").left;return m(e,f)},moveByDisplayLines:function(a,b,c,d){switch(d.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:d.lastHSPos=a.charCoords(b,"div").left}var f=c.repeat;b=a.findPosV(b,c.forward?f:-f,"line",d.lastHSPos);
b.hitSide&&(c.forward?c={top:a.charCoords(b,"div").top+8,left:d.lastHSPos}:(c=a.charCoords(m(a.firstLine(),0),"div"),c.left=d.lastHSPos),b=a.coordsChar(c,"div"));d.lastHPos=b.ch;return b},moveByPage:function(a,b,c){var d=c.repeat;return a.findPosV(b,c.forward?d:-d,"page")},moveByParagraph:function(a,b,c){return Na(a,b,c.repeat,c.forward?1:-1)},moveByScroll:function(a,b,c,d){var f=a.getScrollInfo(),e=c.repeat;e||(e=f.clientHeight/(2*a.defaultTextHeight()));var g=a.charCoords(b,"local");c.repeat=e;
b=S.moveByDisplayLines(a,b,c,d);if(!b)return null;c=a.charCoords(b,"local");a.scrollTo(null,f.top+c.top-g.top);return b},moveByWords:function(a,b,c){var d=b,f=c.repeat;b=!!c.forward;var e=!!c.wordEnd,g=!!c.bigWord;c=y(d);var l=[];(b&&!e||!b&&e)&&f++;for(var k=!(b&&e),h=0;h<f;h++){var q;b:{q=a;var p=b,n=g,t=k,v=d.line,r=d.ch,u=q.getLine(v),Q=p?1:-1,n=n?sa:ha;if(t&&""==u){v+=Q;u=q.getLine(v);if(!Aa(q,v)){q=null;break b}r=p?0:u.length}for(;;){if(t&&""==u){q={from:0,to:0,line:v};break b}for(var p=0<Q?
u.length:-1,w,x;r!=p;){for(var A=!1,B=0;B<n.length&&!A;++B)if(n[B](u.charAt(r))){for(w=r;r!=p&&n[B](u.charAt(r));)r+=Q;x=r;A=w!=x;if(w!=d.ch||v!=d.line||x!=w+Q){q={from:Math.min(w,x+1),to:Math.max(w,x),line:v};break b}}A||(r+=Q)}v+=Q;if(!Aa(q,v)){q=null;break b}u=q.getLine(v);r=0<Q?0:u.length}}if(!q){g=C(a,a.lastLine());l.push(b?{line:a.lastLine(),from:g,to:g}:{line:0,from:0,to:0});break}l.push(q);d=m(q.line,b?q.to-1:q.from)}a=l.length!=f;f=l[0];g=l.pop();b&&!e?(a||f.from==c.ch&&f.line==c.line||(g=
l.pop()),b=m(g.line,g.from)):b&&e?b=m(g.line,g.to-1):!b&&e?(a||f.to==c.ch&&f.line==c.line||(g=l.pop()),b=m(g.line,g.to)):b=m(g.line,g.from);return b},moveTillCharacter:function(a,b,c){a=ta(a,c.repeat,c.forward,c.selectedCharacter);b=c.forward?-1:1;Ma(b,c);if(!a)return null;a.ch+=b;return a},moveToCharacter:function(a,b,c){var d=c.repeat;Ma(0,c);return ta(a,d,c.forward,c.selectedCharacter)||b},moveToSymbol:function(a,b,c){var d=c.repeat,f=c.forward,e=c.selectedCharacter;c=y(a.getCursor());var g=f?
1:-1,l=f?a.lineCount():-1,k=c.ch,h=c.line,q=a.getLine(h),f={lineText:q,nextCh:q.charAt(k),lastCh:null,index:k,symb:e,reverseSymb:(f?{")":"(","}":"{"}:{"(":")","{":"}"})[e],forward:f,depth:0,curMoveThrough:!1};if(k=pb[e]){e=bb[k].init;k=bb[k].isComplete;for(e&&e(f);h!==l&&d;)f.index+=g,f.nextCh=f.lineText.charAt(f.index),f.nextCh||(h+=g,f.lineText=a.getLine(h)||"",0<g?f.index=0:(e=f.lineText.length,f.index=0<e?e-1:0),f.nextCh=f.lineText.charAt(f.index)),k(f)&&(c.line=h,c.ch=f.index,d--);a=f.nextCh||
f.curMoveThrough?m(h,f.index):c}else a=c;return a||b},moveToColumn:function(a,b,c,d){c=c.repeat;d.lastHPos=c-1;d.lastHSPos=a.charCoords(b,"div").left;b=a.getCursor().line;return E(a,m(b,c-1))},moveToEol:function(a,b,c,d){d.lastHPos=Infinity;b=m(b.line+c.repeat-1,Infinity);c=a.clipPos(b);c.ch--;d.lastHSPos=a.charCoords(c,"div").left;return b},moveToFirstNonWhiteSpaceCharacter:function(a,b){return m(b.line,K(a.getLine(b.line)))},moveToMatchedSymbol:function(a,b){var c=b.line,d=b.ch,f=a.getLine(c),e;
do if((e=f.charAt(d++))&&-1!="()[]{}".indexOf(e)){var g=a.getTokenTypeAt(m(c,d));if("string"!==g&&"comment"!==g)break}while(e);return e?a.findMatchingBracket(m(c,d)).to:b},moveToStartOfLine:function(a,b){return m(b.line,0)},moveToLineOrEdgeOfDocument:function(a,b,c){b=c.forward?a.lastLine():a.firstLine();c.repeatIsExplicit&&(b=c.repeat-a.getOption("firstLineNumber"));return m(b,K(a.getLine(b)))},textObjectManipulation:function(a,b,c,d){var f={"'":!0,'"':!0},e=c.selectedCharacter;"b"==e?e="(":"B"==
e&&(e="{");var g=!c.textObjectInner;if({"(":")",")":"(","{":"}","}":"{","[":"]","]":"["}[e]){var l,k;k={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[e];l={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[e];c=a.getLine(b.line).charAt(b.ch)===l?1:0;l=a.scanForBracket(m(b.line,b.ch+c),-1,null,{bracketRegex:k});k=a.scanForBracket(m(b.line,b.ch+c),1,null,{bracketRegex:k});if(l&&k){l=l.pos;k=k.pos;if(l.line==k.line&&l.ch>k.ch||l.line>k.line)b=l,l=k,k=b;g?k.ch+=1:l.ch+=1;b={start:l,
end:k}}else b={start:b,end:b}}else if(f[e]){c=e;b=y(b);d=a.getLine(b.line).split("");e=d.indexOf(c);b.ch<e?b.ch=e:e<b.ch&&d[b.ch]==c&&(k=b.ch,--b.ch);if(d[b.ch]!=c||k)for(e=b.ch;-1<e&&!l;e--)d[e]==c&&(l=e+1);else l=b.ch+1;if(l&&!k)for(e=l,f=d.length;e<f&&!k;e++)d[e]==c&&(k=e);l&&k?(g&&(--l,++k),b={start:m(b.line,l),end:m(b.line,k)}):b={start:b,end:b}}else if("W"===e)b=ga(a,g,!0,!0);else if("w"===e)b=ga(a,g,!0,!1);else if("p"===e)if(b=Na(a,b,c.repeat,0,g),c.linewise=!0,d.visualMode)d.visualLine||(d.visualLine=
!0);else{if(g=d.inputState.operatorArgs)g.linewise=!0;b.end.line--}else return null;return a.state.vim.visualMode?(g=b.start,b=b.end,k=a.state.vim.sel,l=k.head,k=k.anchor,x(b,g)&&(c=b,b=g,g=c),x(l,k)?(l=G(g,l),k=T(k,b)):(k=G(g,k),l=T(l,b),l=B(l,0,-1),-1==l.ch&&l.line!=a.firstLine()&&(l=m(l.line-1,C(a,l.line-1)))),[k,l]):[b.start,b.end]},repeatLastCharacterSearch:function(a,b,c){var d=p.lastCharacterSearch,f=c.repeat,e=c.forward===d.forward,g=(d.increment?1:0)*(e?-1:1);a.moveH(-g,"char");c.inclusive=
e?!0:!1;c=ta(a,f,e,d.selectedCharacter);if(!c)return a.moveH(g,"char"),b;c.ch+=g;return c}},ab={change:function(a,b,c){var d,f,e=a.state.vim;p.macroModeState.lastInsertModeChanges.inVisualBlock=e.visualBlock;if(e.visualMode)f=a.getSelection(),d=Fa("",c.length),a.replaceSelections(d),d=G(c[0].head,c[0].anchor);else{d=c[0].anchor;var g=c[0].head;f=a.getRange(d,g);e=e.lastEditInputState||{};if("moveByWords"==e.motion&&!/^\s*$/.test(f)){var l=/\s+$/.exec(f);l&&e.motionArgs&&e.motionArgs.forward&&(g=B(g,
0,-l[0].length),f=f.slice(0,-l[0].length))}e=new m(d.line-1,Number.MAX_VALUE);l=a.firstLine()==a.lastLine();g.line>a.lastLine()&&b.linewise&&!l?a.replaceRange("",e,g):a.replaceRange("",d,g);b.linewise&&(l||(a.setCursor(e),h.commands.newlineAndIndent(a)),d.ch=Number.MAX_VALUE)}p.registerController.pushText(b.registerName,"change",f,b.linewise,1<c.length);ca.enterInsertMode(a,{head:d},a.state.vim)},"delete":function(a,b,c){var d,f=a.state.vim;if(f.visualBlock){d=a.getSelection();var e=Fa("",c.length);
a.replaceSelections(e);c=c[0].anchor}else e=c[0].anchor,c=c[0].head,b.linewise&&c.line!=a.firstLine()&&e.line==a.lastLine()&&e.line==c.line-1&&(e.line==a.firstLine()?e.ch=0:e=m(e.line-1,C(a,e.line-1))),d=a.getRange(e,c),a.replaceRange("",e,c),c=e,b.linewise&&(c=S.moveToFirstNonWhiteSpaceCharacter(a,e));p.registerController.pushText(b.registerName,"delete",d,b.linewise,f.visualBlock);return E(a,c)},indent:function(a,b,c){var d=a.state.vim,f=c[0].anchor.line,e=d.visualBlock?c[c.length-1].anchor.line:
c[0].head.line,d=d.visualMode?b.repeat:1;for(b.linewise&&e--;f<=e;f++)for(var g=0;g<d;g++)a.indentLine(f,b.indentRight);return S.moveToFirstNonWhiteSpaceCharacter(a,c[0].anchor)},changeCase:function(a,b,c,d,f){for(var e=a.getSelections(),g=[],l=b.toLower,k=0;k<e.length;k++){var h=e[k],m="";if(!0===l)m=h.toLowerCase();else if(!1===l)m=h.toUpperCase();else for(var p=0;p<h.length;p++)var n=h.charAt(p),m=m+(U(n)?n.toLowerCase():n.toUpperCase());g.push(m)}a.replaceSelections(g);return b.shouldMoveCursor?
f:!a.state.vim.visualMode&&b.linewise&&c[0].anchor.line+1==c[0].head.line?S.moveToFirstNonWhiteSpaceCharacter(a,d):b.linewise?d:G(c[0].anchor,c[0].head)},yank:function(a,b,c,d){var f=a.state.vim;a=a.getSelection();c=f.visualMode?G(f.sel.anchor,f.sel.head,c[0].head,c[0].anchor):d;p.registerController.pushText(b.registerName,"yank",a,b.linewise,f.visualBlock);return c}},ca={jumpListWalk:function(a,b,c){c.visualMode||(c=b.repeat,b=(b=(b=p.jumpList.move(a,b.forward?c:-c))?b.find():void 0)?b:a.getCursor(),
a.setCursor(b))},scroll:function(a,b,c){if(!c.visualMode){var d=b.repeat||1;c=a.defaultTextHeight();var f=a.getScrollInfo().top,d=c*d,f=b.forward?f+d:f-d,d=y(a.getCursor()),e=a.charCoords(d,"local");b.forward?f>e.top?(d.line+=(f-e.top)/c,d.line=Math.ceil(d.line),a.setCursor(d),e=a.charCoords(d,"local"),a.scrollTo(null,e.top)):a.scrollTo(null,f):(b=f+a.getScrollInfo().clientHeight,b<e.bottom?(d.line-=(e.bottom-b)/c,d.line=Math.floor(d.line),a.setCursor(d),e=a.charCoords(d,"local"),a.scrollTo(null,
e.bottom-a.getScrollInfo().clientHeight)):a.scrollTo(null,f))}},scrollToCursor:function(a,b){var c=a.getCursor().line,d=a.charCoords(m(c,0),"local"),c=a.getScrollInfo().clientHeight,f=d.top,d=d.bottom-f;switch(b.position){case "center":f=f-c/2+d;break;case "bottom":f=f-c+d}a.scrollTo(null,f)},replayMacro:function(a,b,c){var d=b.selectedCharacter;b=b.repeat;var f=p.macroModeState;"@"==d&&(d=f.latestRegister);for(;b--;){var e=a,g=c,l=f,k=d,m=p.registerController.getRegister(k);if(":"==k)m.keyBuffer[0]&&
L.processCommand(e,m.keyBuffer[0]);else{var k=m.keyBuffer,q=0;l.isPlaying=!0;l.replaySearchQueries=m.searchQueries.slice(0);for(var r=0;r<k.length;r++)for(var n=k[r],t,v;n;)t=/<\w+-.+?>|<\w+>|./.exec(n),v=t[0],n=n.substring(t.index+v.length),h.Vim.handleKey(e,v,"macro"),g.insertMode&&(t=m.insertModeChanges[q++].changes,p.macroModeState.lastInsertModeChanges.changes=t,Xa(e,t,1),Y(e))}l.isPlaying=!1}},enterMacroRecordMode:function(a,b){p.macroModeState.enterMacroRecordMode(a,b.selectedCharacter)},toggleOverwrite:function(a){a.state.overwrite?
(a.toggleOverwrite(!1),a.setOption("keyMap","vim-insert"),h.signal(a,"vim-mode-change",{mode:"insert"})):(a.toggleOverwrite(!0),a.setOption("keyMap","vim-replace"),h.signal(a,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(a,b,c){if(!a.getOption("readOnly")){c.insertMode=!0;c.insertModeRepeat=b&&b.repeat||1;var d=b?b.insertAt:null,f=c.sel,e=b.head||a.getCursor("head"),g=a.listSelections().length;if("eol"==d)e=m(e.line,C(a,e.line));else if("charAfter"==d)e=B(e,0,1);else if("firstNonBlank"==
d)e=S.moveToFirstNonWhiteSpaceCharacter(a,e);else if("startOfSelectedArea"==d)c.visualBlock?(e=m(Math.min(f.head.line,f.anchor.line),Math.min(f.head.ch,f.anchor.ch)),g=Math.abs(f.head.line-f.anchor.line)+1):e=f.head.line<f.anchor.line?f.head:m(f.anchor.line,0);else if("endOfSelectedArea"==d)c.visualBlock?(e=m(Math.min(f.head.line,f.anchor.line),Math.max(f.head.ch+1,f.anchor.ch)),g=Math.abs(f.head.line-f.anchor.line)+1):e=f.head.line>=f.anchor.line?B(f.head,0,1):m(f.anchor.line,0);else if("inplace"==
d&&c.visualMode)return;a.setOption("disableInput",!1);b&&b.replace?(a.toggleOverwrite(!0),a.setOption("keyMap","vim-replace"),h.signal(a,"vim-mode-change",{mode:"replace"})):(a.toggleOverwrite(!1),a.setOption("keyMap","vim-insert"),h.signal(a,"vim-mode-change",{mode:"insert"}));p.macroModeState.isPlaying||(a.on("change",Ta),h.on(a.getInputField(),"keydown",Ua));c.visualMode&&J(a);Ja(a,e,g)}},toggleVisualMode:function(a,b,c){var d=b.repeat,f=a.getCursor();c.visualMode?c.visualLine^b.linewise||c.visualBlock^
b.blockwise?(c.visualLine=!!b.linewise,c.visualBlock=!!b.blockwise,h.signal(a,"vim-mode-change",{mode:"visual",subMode:c.visualLine?"linewise":c.visualBlock?"blockwise":""}),W(a)):J(a):(c.visualMode=!0,c.visualLine=!!b.linewise,c.visualBlock=!!b.blockwise,b=E(a,m(f.line,f.ch+d-1),!0),c.sel={anchor:f,head:b},h.signal(a,"vim-mode-change",{mode:"visual",subMode:c.visualLine?"linewise":c.visualBlock?"blockwise":""}),W(a),N(a,c,"<",G(f,b)),N(a,c,">",T(f,b)))},reselectLastSelection:function(a,b,c){b=c.lastSelection;
c.visualMode&&Ka(a,c);if(b){var d=b.anchorMark.find(),f=b.headMark.find();d&&f&&(c.sel={anchor:d,head:f},c.visualMode=!0,c.visualLine=b.visualLine,c.visualBlock=b.visualBlock,W(a),N(a,c,"<",G(d,f)),N(a,c,">",T(d,f)),h.signal(a,"vim-mode-change",{mode:"visual",subMode:c.visualLine?"linewise":c.visualBlock?"blockwise":""}))}},joinLines:function(a,b,c){var d;if(c.visualMode){b=a.getCursor("anchor");d=a.getCursor("head");if(x(d,b)){var f=d;d=b;b=f}d.ch=C(a,d.line)-1}else d=Math.max(b.repeat,2),b=a.getCursor(),
d=E(a,m(b.line+d-1,Infinity));for(var e=0,g=b.line;g<d.line;g++){var e=C(a,b.line),f=m(b.line+1,C(a,b.line+1)),h=a.getRange(b,f),h=h.replace(/\n\s*/g," ");a.replaceRange(h,b,f)}b=m(b.line,e);c.visualMode&&J(a,!1);a.setCursor(b)},newLineAndEnterInsertMode:function(a,b,c){c.insertMode=!0;var d=y(a.getCursor());d.line!==a.firstLine()||b.after?(d.line=b.after?d.line:d.line-1,d.ch=C(a,d.line),a.setCursor(d),(h.commands.newlineAndIndentContinueComment||h.commands.newlineAndIndent)(a)):(a.replaceRange("\n",
m(a.firstLine(),0)),a.setCursor(a.firstLine(),0));this.enterInsertMode(a,{repeat:b.repeat},c)},paste:function(a,b,c){var d=y(a.getCursor()),f=p.registerController.getRegister(b.registerName),e=f.toString();if(e){if(b.matchIndent)var g=a.getOption("tabSize"),h=function(a){var b=a.split("\t").length-1;a=a.split(" ").length-1;return b*g+1*a},k=a.getLine(a.getCursor().line),r=h(k.match(/^\s*/)[0]),k=e.replace(/\n$/,""),q=e!==k,u=h(e.match(/^\s*/)[0]),e=k.replace(/^\s*/gm,function(b){b=r+(h(b)-u);return 0>
b?"":a.getOption("indentWithTabs")?Array(Math.floor(b/g)+1).join("\t"):Array(b+1).join(" ")}),e=e+(q?"\n":"");1<b.repeat&&(e=Array(b.repeat+1).join(e));k=f.linewise;f=f.blockwise;if(k)c.visualMode?e=c.visualLine?e.slice(0,-1):"\n"+e.slice(0,e.length-1)+"\n":b.after?(e="\n"+e.slice(0,e.length-1),d.ch=C(a,d.line)):d.ch=0;else{if(f)for(e=e.split("\n"),q=0;q<e.length;q++)e[q]=""==e[q]?" ":e[q];d.ch+=b.after?1:0}var n;if(c.visualMode){c.lastPastedText=e;b=ib(a,c);d=b[0];b=b[1];var q=a.getSelection(),t=
a.listSelections(),t=Array(t.length).join("1").split("1");c.lastSelection&&(n=c.lastSelection.headMark.find());p.registerController.unnamedRegister.setText(q);f?(a.replaceSelections(t),b=m(d.line+e.length-1,d.ch),a.setCursor(d),Ia(a,b),a.replaceSelections(e),e=d):c.visualBlock?(a.replaceSelections(t),a.setCursor(d),a.replaceRange(e,d,d),e=d):(a.replaceRange(e,d,b),e=a.posFromIndex(a.indexFromPos(d)+e.length-1));n&&(c.lastSelection.headMark=a.setBookmark(n));k&&(e.ch=0)}else if(f){a.setCursor(d);for(q=
0;q<e.length;q++)n=d.line+q,n>a.lastLine()&&a.replaceRange("\n",m(n,0)),C(a,n)<d.ch&&hb(a,n,d.ch);a.setCursor(d);Ia(a,m(d.line+e.length-1,d.ch));a.replaceSelections(e);e=d}else a.replaceRange(e,d),k&&b.after?e=m(d.line+1,K(a.getLine(d.line+1))):k&&!b.after?e=m(d.line,K(a.getLine(d.line))):!k&&b.after?(n=a.indexFromPos(d),e=a.posFromIndex(n+e.length-1)):(n=a.indexFromPos(d),e=a.posFromIndex(n+e.length));c.visualMode&&J(a,!1);a.setCursor(e)}},undo:function(a,b){a.operation(function(){Ga(a,h.commands.undo,
b.repeat)();a.setCursor(a.getCursor("anchor"))})},redo:function(a,b){Ga(a,h.commands.redo,b.repeat)()},setRegister:function(a,b,c){c.inputState.registerName=b.selectedCharacter},setMark:function(a,b,c){N(a,c,b.selectedCharacter,a.getCursor())},replace:function(a,b,c){var d=b.selectedCharacter,f=a.getCursor(),e,g=a.listSelections();c.visualMode?(f=a.getCursor("start"),e=a.getCursor("end")):(e=a.getLine(f.line),b=f.ch+b.repeat,b>e.length&&(b=e.length),e=m(f.line,b));"\n"==d?(c.visualMode||a.replaceRange("",
f,e),(h.commands.newlineAndIndentContinueComment||h.commands.newlineAndIndent)(a)):(b=a.getRange(f,e),b=b.replace(/[^\n]/g,d),c.visualBlock?(f=Array(a.getOption("tabSize")+1).join(" "),b=a.getSelection(),b=b.replace(/\t/g,f).replace(/[^\n]/g,d).split("\n"),a.replaceSelections(b)):a.replaceRange(b,f,e),c.visualMode?(f=x(g[0].anchor,g[0].head)?g[0].anchor:g[0].head,a.setCursor(f),J(a,!1)):a.setCursor(B(e,0,-1)))},incrementNumberToken:function(a,b){for(var c=a.getCursor(),d=a.getLine(c.line),f=/-?\d+/g,
e,g,h,k;null!==(e=f.exec(d))&&!(k=e[0],g=e.index,h=g+k.length,c.ch<h););!b.backtrack&&h<=c.ch||!k||(d=b.increase?1:-1,k=parseInt(k)+d*b.repeat,b=m(c.line,g),h=m(c.line,h),k=k.toString(),a.replaceRange(k,b,h),a.setCursor(m(c.line,g+k.length-1)))},repeatLastEdit:function(a,b,c){if(c.lastEditInputState){var d=b.repeat;d&&b.repeatIsExplicit?c.lastEditInputState.repeatOverride=d:d=c.lastEditInputState.repeatOverride||d;Va(a,c,d,!1)}},indent:function(a,b){a.indentLine(a.getCursor().line,b.indentRight)},
exitInsertMode:Y},pb={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},bb={bracket:{isComplete:function(a){if(a.nextCh===a.symb){if(a.depth++,1<=a.depth)return!0}else a.nextCh===a.reverseSymb&&a.depth--;return!1}},section:{init:function(a){a.curMoveThrough=!0;a.symb=(a.forward?"]":"[")===a.symb?"{":"}"},isComplete:function(a){return 0===a.index&&a.nextCh===a.symb}},comment:{isComplete:function(a){var b=
"*"===a.lastCh&&"/"===a.nextCh;a.lastCh=a.nextCh;return b}},method:{init:function(a){a.symb="m"===a.symb?"{":"}";a.reverseSymb="{"===a.symb?"}":"{"},isComplete:function(a){return a.nextCh===a.symb?!0:!1}},preprocess:{init:function(a){a.index=0},isComplete:function(a){if("#"===a.nextCh){var b=a.lineText.match(/#(\w+)/)[1];if("endif"===b){if(a.forward&&0===a.depth)return!0;a.depth++}else if("if"===b){if(!a.forward&&0===a.depth)return!0;a.depth--}if("else"===b&&0===a.depth)return!0}return!1}}};da("pcre",
!0,"boolean");Oa.prototype={getQuery:function(){return p.query},setQuery:function(a){p.query=a},getOverlay:function(){return this.searchOverlay},setOverlay:function(a){this.searchOverlay=a},isReversed:function(){return p.isReversed},setReversed:function(a){p.isReversed=a},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(a){this.annotate=a}};var cb={"\\n":"\n","\\r":"\r","\\t":"\t"},db={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t"},ob="(Javascript regexp)",
Z=function(){this.buildCommandMap_()};Z.prototype={processCommand:function(a,b,c){var d=this;a.operation(function(){a.curOp.isVimOp=!0;d._processCommand(a,b,c)})},_processCommand:function(a,b,c){var d=a.state.vim,f=p.registerController.getRegister(":"),e=f.toString();d.visualMode&&J(a);d=new h.StringStream(b);f.setText(b);c=c||{};c.input=b;try{this.parseInput_(a,d,c)}catch(k){throw w(a,k),k;}var g,l;if(c.commandName){if(g=this.matchCommand_(c.commandName)){l=g.name;g.excludeFromCommandHistory&&f.setText(e);
this.parseCommandArgs_(d,c,g);if("exToKey"==g.type){for(b=0;b<g.toKeys.length;b++)h.Vim.handleKey(a,g.toKeys[b],"mapping");return}if("exToEx"==g.type){this.processCommand(a,g.toInput);return}}}else void 0!==c.line&&(l="move");if(l)try{$a[l](a,c),g&&g.possiblyAsync||!c.callback||c.callback()}catch(k){throw w(a,k),k;}else w(a,'Not an editor command ":'+b+'"')},parseInput_:function(a,b,c){b.eatWhile(":");b.eat("%")?(c.line=a.firstLine(),c.lineEnd=a.lastLine()):(c.line=this.parseLineSpec_(a,b),void 0!==
c.line&&b.eat(",")&&(c.lineEnd=this.parseLineSpec_(a,b)));a=b.match(/^(\w+)/);c.commandName=a?a[1]:b.match(/.*/)[0];return c},parseLineSpec_:function(a,b){var c=b.match(/^(\d+)/);if(c)return parseInt(c[1],10)-1;switch(b.next()){case ".":return a.getCursor().line;case "$":return a.lastLine();case "'":if((a=a.state.vim.marks[b.next()])&&a.find())return a.find().line;throw Error("Mark not set");default:b.backUp(1)}},parseCommandArgs_:function(a,b,c){a.eol()||(b.argString=a.match(/.*/)[0],a=c.argDelimiter||
/\s+/,a=qa(b.argString).split(a),a.length&&a[0]&&(b.args=a))},matchCommand_:function(a){for(var b=a.length;0<b;b--){var c=a.substring(0,b);if(this.commandMap_[c]&&(c=this.commandMap_[c],0===c.name.indexOf(a)))return c}return null},buildCommandMap_:function(){this.commandMap_={};for(var a=0;a<u.length;a++){var b=u[a];this.commandMap_[b.shortName||b.name]=b}},map:function(a,b,c){if(":"!=a&&":"==a.charAt(0)){if(c)throw Error("Mode not supported for ex mappings");c=a.substring(1);":"!=b&&":"==b.charAt(0)?
this.commandMap_[c]={name:c,type:"exToEx",toInput:b.substring(1),user:!0}:this.commandMap_[c]={name:c,type:"exToKey",toKeys:b,user:!0}}else b=":"!=b&&":"==b.charAt(0)?{keys:a,type:"keyToEx",exArgs:{input:b.substring(1)},user:!0}:{keys:a,type:"keyToKey",toKeys:b,user:!0},c&&(b.context=c),r.unshift(b)},unmap:function(a,b){if(":"!=a&&":"==a.charAt(0)){if(b)throw Error("Mode not supported for ex mappings");a=a.substring(1);if(this.commandMap_[a]&&this.commandMap_[a].user){delete this.commandMap_[a];return}}else for(var c=
0;c<r.length;c++)if(a==r[c].keys&&r[c].context===b&&r[c].user){r.splice(c,1);return}throw Error("No such mapping.");}};var $a={colorscheme:function(a,b){!b.args||1>b.args.length?w(a,a.getOption("theme")):a.setOption("theme",b.args[0])},map:function(a,b,c){var d=b.args;!d||2>d.length?a&&w(a,"Invalid mapping: "+b.input):L.map(d[0],d[1],c)},imap:function(a,b){this.map(a,b,"insert")},nmap:function(a,b){this.map(a,b,"normal")},vmap:function(a,b){this.map(a,b,"visual")},unmap:function(a,b,c){var d=b.args;
!d||1>d.length?a&&w(a,"No such mapping: "+b.input):L.unmap(d[0],c)},move:function(a,b){R.processCommand(a,a.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:b.line+1})},set:function(a,b){var c=b.args,d=b.setCfg||{};if(!c||1>c.length)a&&w(a,"Invalid mapping: "+b.input);else{var f=c[0].split("="),c=f[0],f=f[1],e=!1;if("?"==c.charAt(c.length-1)){if(f)throw Error("Trailing characters: "+b.argString);c=c.substring(0,c.length-
1);e=!0}void 0===f&&"no"==c.substring(0,2)&&(c=c.substring(2),f=!1);(b=M[c]&&"boolean"==M[c].type)&&void 0==f&&(f=!0);!b&&void 0===f||e?(d=V(c,a,d),!0===d||!1===d?w(a," "+(d?"":"no")+c):w(a," "+c+"="+d)):oa(c,f,a,d)}},setlocal:function(a,b){b.setCfg={scope:"local"};this.set(a,b)},setglobal:function(a,b){b.setCfg={scope:"global"};this.set(a,b)},registers:function(a,b){var c=b.args;b=p.registerController.registers;var d="----------Registers----------<br><br>";if(c)for(var c=c.join(""),f=0;f<c.length;f++){if(g=
c.charAt(f),p.registerController.isValidRegister(g))var e=b[g]||new H,d=d+('"'+g+" "+e.toString()+"<br>")}else for(var g in b)c=b[g].toString(),c.length&&(d+='"'+g+" "+c+"<br>");w(a,d)},sort:function(a,b){function c(a,b){if(d){var c;c=a;a=b;b=c}f&&(a=a.toLowerCase(),b=b.toLowerCase());c=g&&q.exec(a);var e=g&&q.exec(b);if(!c)return a<b?-1:1;c=parseInt((c[1]+c[2]).toLowerCase(),r);e=parseInt((e[1]+e[2]).toLowerCase(),r);return c-e}var d,f,e,g,l=function(){if(b.argString){var a=new h.StringStream(b.argString);
a.eat("!")&&(d=!0);if(!a.eol()){if(!a.eatSpace())return"Invalid arguments";var c=a.match(/[a-z]+/);if(c){c=c[0];f=-1!=c.indexOf("i");e=-1!=c.indexOf("u");var k=-1!=c.indexOf("d")&&1,l=-1!=c.indexOf("x")&&1,c=-1!=c.indexOf("o")&&1;if(1<k+l+c)return"Invalid arguments";g=k&&"decimal"||l&&"hex"||c&&"octal"}if(a.match(/\/.*\//))return"patterns not supported"}}}();if(l)w(a,l+": "+b.argString);else{var l=b.line||a.firstLine(),k=b.lineEnd||b.line||a.lastLine();if(l!=k){var l=m(l,0),k=m(k,C(a,k)),p=a.getRange(l,
k).split("\n"),q="decimal"==g?/(-?)([\d]+)/:"hex"==g?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==g?/([0-7]+)/:null,r="decimal"==g?10:"hex"==g?16:"octal"==g?8:null,n=[],t=[];if(g)for(var v=0;v<p.length;v++)q.exec(p[v])?n.push(p[v]):t.push(p[v]);else t=p;n.sort(c);t.sort(c);p=d?n.concat(t):t.concat(n);if(e)for(var n=p,u,p=[],v=0;v<n.length;v++)n[v]!=u&&p.push(n[v]),u=n[v];a.replaceRange(p.join("\n"),l,k)}}},global:function(a,b){var c=b.argString;if(c){var d=void 0!==b.line?b.line:a.firstLine();b=b.lineEnd||
b.line||a.lastLine();var f=Pa(c),e;f.length&&(c=f[0],e=f.slice(1,f.length).join("/"));if(c)try{X(a,c,!0,!0)}catch(z){w(a,"Invalid regex: "+c);return}for(var c=O(a).getQuery(),g=[],f="";d<=b;d++)c.test(a.getLine(d))&&(g.push(d+1),f+=a.getLine(d)+"<br>");if(e){var h=0,k=function(){h<g.length&&L.processCommand(a,g[h]+e,{callback:k});h++};k()}else w(a,f)}else w(a,"Regular Expression missing from global")},substitute:function(a,b){if(!a.getSearchCursor)throw Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");
var c=b.argString,d=c?Pa(c):[],f,e="",g,l,k=!1,r=!1;if(d.length){f=d[0];e=d[1];if(void 0!==e){if(V("pcre"))for(e=new h.StringStream(e),g=[];!e.eol();){for(;e.peek()&&"\\"!=e.peek();)g.push(e.next());var c=!1,q;for(q in db)if(e.match(q,!0)){c=!0;g.push(db[q]);break}c||g.push(e.next())}else for(q=!1,g=[],c=-1;c<e.length;c++){var u=e.charAt(c)||"",n=e.charAt(c+1)||"";cb[u+n]?(g.push(cb[u+n]),c++):q?(g.push(u),q=!1):"\\"===u?(q=!0,nb.test(n)||"$"===n?g.push("$"):"/"!==n&&"\\"!==n&&g.push("\\")):("$"===
u&&g.push("$"),g.push(u),"/"===n&&g.push("\\"))}e=g.join("");p.lastSubstituteReplacePart=e}g=d[2]?d[2].split(" "):[]}else if(c&&c.length){w(a,"Substitutions should be of the form :s/pattern/replace/");return}g&&(d=g[0],l=parseInt(g[1]),d&&(-1!=d.indexOf("c")&&(k=!0,d.replace("c","")),-1!=d.indexOf("g")&&(r=!0,d.replace("g","")),f=f+"/"+d));if(f)try{X(a,f,!0,!0)}catch(t){w(a,"Invalid regex: "+f);return}e=e||p.lastSubstituteReplacePart;void 0===e?w(a,"No previous substitute regular expression"):(f=
O(a).getQuery(),d=void 0!==b.line?b.line:a.getCursor().line,q=b.lineEnd||d,d==a.firstLine()&&q==a.lastLine()&&(q=Infinity),l&&(d=q,q=d+l-1),l=E(a,m(d,0)),l=a.getSearchCursor(f,l),mb(a,k,r,d,q,l,f,e,b.callback))},redo:h.commands.redo,undo:h.commands.undo,write:function(a){h.commands.save?h.commands.save(a):a.save&&a.save()},nohlsearch:function(a){ua(a)},yank:function(a){var b=y(a.getCursor()).line;a=a.getLine(b);p.registerController.pushText("0","yank",a,!0,!0)},delmarks:function(a,b){if(b.argString&&
qa(b.argString))for(var c=a.state.vim,d=new h.StringStream(qa(b.argString));!d.eol();){d.eatSpace();var f=d.pos;if(!d.match(/[a-zA-Z]/,!1)){w(a,"Invalid argument: "+b.argString.substring(f));break}var e=d.next();if(d.match("-",!0)){if(!d.match(/[a-zA-Z]/,!1)){w(a,"Invalid argument: "+b.argString.substring(f));break}var g=d.next();if(/^[a-z]$/.test(e)&&/^[a-z]$/.test(g)||U(e)&&U(g)){e=e.charCodeAt(0);g=g.charCodeAt(0);if(e>=g){w(a,"Invalid argument: "+b.argString.substring(f));break}for(f=0;f<=g-e;f++){var l=
String.fromCharCode(e+f);delete c.marks[l]}}else{w(a,"Invalid argument: "+e+"-");break}}else delete c.marks[e]}else w(a,"Argument required")}},L=new Z;h.keyMap.vim={attach:P,detach:A,call:la};da("insertModeEscKeysTimeout",200,"number");h.keyMap["vim-insert"]={fallthrough:["default"],attach:P,detach:A,call:la};h.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:P,detach:A,call:la};Da();return ka}()});

View File

@ -1,11 +1,12 @@
(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){f.defineMode("xml",function(B,k){function h(a,c){function b(b){c.tokenize=b;return b(a,c)}var d=a.next();if("<"==d){if(a.eat("!"))return a.eat("[")?a.match("CDATA[")?b(p("atom","]]\x3e")):null:a.match("--")?b(p("comment","--\x3e")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),b(q(1))):null;if(a.eat("?"))return a.eatWhile(/[\w\._\-]/),
c.tokenize=p("meta","?>"),"meta";l=a.eat("/")?"closeTag":"openTag";c.tokenize=r;return"tag bracket"}if("&"==d)return(a.eat("#")?a.eat("x")?a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):a.eatWhile(/[\d]/)&&a.eat(";"):a.eatWhile(/[\w\.\-:]/)&&a.eat(";"))?"atom":"error";a.eatWhile(/[^&<]/);return null}function r(a,c){var b=a.next();if(">"==b||"/"==b&&a.eat(">"))return c.tokenize=h,l=">"==b?"endTag":"selfcloseTag","tag bracket";if("="==b)return l="equals",null;if("<"==b)return c.tokenize=h,c.state=n,c.tagName=
c.tagStart=null,(b=c.tokenize(a,c))?b+" tag error":"tag error";if(/[\'\"]/.test(b))return c.tokenize=C(b),c.stringStartCol=a.column(),c.tokenize(a,c);a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);return"word"}function C(a){var c=function(b,c){for(;!b.eol();)if(b.next()==a){c.tokenize=r;break}return"string"};c.isInAttribute=!0;return c}function p(a,c){return function(b,d){for(;!b.eol();){if(b.match(c)){d.tokenize=h;break}b.next()}return a}}function q(a){return function(c,b){for(var d;null!=(d=
c.next());){if("<"==d)return b.tokenize=q(a+1),b.tokenize(c,b);if(">"==d)if(1==a){b.tokenize=h;break}else return b.tokenize=q(a-1),b.tokenize(c,b)}return"meta"}}function D(a,c,b){this.prev=a.context;this.tagName=c;this.indent=a.indented;this.startOfLine=b;if(g.doNotIndent.hasOwnProperty(c)||a.context&&a.context.noIndent)this.noIndent=!0}function t(a){a.context&&(a.context=a.context.prev)}function x(a,c){for(var b;a.context;){b=a.context.tagName;if(!g.contextGrabbers.hasOwnProperty(b)||!g.contextGrabbers[b].hasOwnProperty(c))break;
t(a)}}function n(a,c,b){return"openTag"==a?(b.tagStart=c.column(),y):"closeTag"==a?E:n}function y(a,c,b){if("word"==a)return b.tagName=c.current(),e="tag",m;e="error";return y}function E(a,c,b){if("word"==a){a=c.current();b.context&&b.context.tagName!=a&&g.implicitlyClosed.hasOwnProperty(b.context.tagName)&&t(b);if(b.context&&b.context.tagName==a)return e="tag",u;e="tag error";return z}e="error";return z}function u(a,c,b){if("endTag"!=a)return e="error",u;t(b);return n}function z(a,c,b){e="error";
return u(a,c,b)}function m(a,c,b){if("word"==a)return e="attribute",F;if("endTag"==a||"selfcloseTag"==a){c=b.tagName;var d=b.tagStart;b.tagName=b.tagStart=null;"selfcloseTag"==a||g.autoSelfClosers.hasOwnProperty(c)?x(b,c):(x(b,c),b.context=new D(b,c,d==b.indented));return n}e="error";return m}function F(a,c,b){if("equals"==a)return G;g.allowMissing||(e="error");return m(a,c,b)}function G(a,c,b){if("string"==a)return A;if("word"==a&&g.allowUnquoted)return e="string",m;e="error";return m(a,c,b)}function A(a,
c,b){return"string"==a?A:m(a,c,b)}var v=B.indentUnit,H=k.multilineTagIndentFactor||1,w=k.multilineTagIndentPastTag;null==w&&(w=!0);var g=k.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,
optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},
contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},I=k.alignCDATA,l,e;h.isInText=!0;return{startState:function(){return{tokenize:h,state:n,indented:0,tagName:null,tagStart:null,context:null}},token:function(a,c){!c.tagName&&a.sol()&&(c.indented=a.indentation());if(a.eatSpace())return null;l=null;var b=c.tokenize(a,c);(b||l)&&"comment"!=b&&(e=null,c.state=c.state(l||b,a,c),e&&(b="error"==e?b+" error":e));return b},indent:function(a,c,b){var d=a.context;if(a.tokenize.isInAttribute)return a.tagStart==
a.indented?a.stringStartCol+1:a.indented+v;if(d&&d.noIndent)return f.Pass;if(a.tokenize!=r&&a.tokenize!=h)return b?b.match(/^(\s*)/)[0].length:0;if(a.tagName)return w?a.tagStart+a.tagName.length+2:a.tagStart+v*H;if(I&&/<!\[CDATA\[/.test(c))return 0;if((a=c&&/^<(\/)?([\w_:\.-]*)/.exec(c))&&a[1])for(;d;)if(d.tagName==a[2]){d=d.prev;break}else if(g.implicitlyClosed.hasOwnProperty(d.tagName))d=d.prev;else break;else if(a)for(;d;)if((c=g.contextGrabbers[d.tagName])&&c.hasOwnProperty(a[2]))d=d.prev;else break;
for(;d&&!d.startOfLine;)d=d.prev;return d?d.indent+v:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:k.htmlMode?"html":"xml",helperType:k.htmlMode?"html":"xml"}});f.defineMIME("text/xml","xml");f.defineMIME("application/xml","xml");f.mimeModes.hasOwnProperty("text/html")||f.defineMIME("text/html",{name:"xml",htmlMode:!0})});
'use strict';(function(g){"object"==typeof exports&&"object"==typeof module?g(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],g):g(CodeMirror)})(function(g){var D={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,
dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,
caseFold:!0},E={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};g.defineMode("xml",function(p,q){function h(a,c){function b(b){c.tokenize=b;return b(a,c)}var d=a.next();if("<"==d){if(a.eat("!"))return a.eat("[")?a.match("CDATA[")?b(r("atom","]]\x3e")):null:a.match("--")?b(r("comment","--\x3e")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),b(t(1))):null;if(a.eat("?"))return a.eatWhile(/[\w\._\-]/),c.tokenize=r("meta","?>"),
"meta";l=a.eat("/")?"closeTag":"openTag";c.tokenize=u;return"tag bracket"}if("&"==d)return(a.eat("#")?a.eat("x")?a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):a.eatWhile(/[\d]/)&&a.eat(";"):a.eatWhile(/[\w\.\-:]/)&&a.eat(";"))?"atom":"error";a.eatWhile(/[^&<]/);return null}function u(a,c){var b=a.next();if(">"==b||"/"==b&&a.eat(">"))return c.tokenize=h,l=">"==b?"endTag":"selfcloseTag","tag bracket";if("="==b)return l="equals",null;if("<"==b)return c.tokenize=h,c.state=m,c.tagName=c.tagStart=null,(a=c.tokenize(a,
c))?a+" tag error":"tag error";if(/[\'\"]/.test(b))return c.tokenize=F(b),c.stringStartCol=a.column(),c.tokenize(a,c);a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);return"word"}function F(a){var c=function(b,c){for(;!b.eol();)if(b.next()==a){c.tokenize=u;break}return"string"};c.isInAttribute=!0;return c}function r(a,c){return function(b,d){for(;!b.eol();){if(b.match(c)){d.tokenize=h;break}b.next()}return a}}function t(a){return function(c,b){for(var d;null!=(d=c.next());){if("<"==d)return b.tokenize=
t(a+1),b.tokenize(c,b);if(">"==d)if(1==a){b.tokenize=h;break}else return b.tokenize=t(a-1),b.tokenize(c,b)}return"meta"}}function G(a,c,b){this.prev=a.context;this.tagName=c;this.indent=a.indented;this.startOfLine=b;if(e.doNotIndent.hasOwnProperty(c)||a.context&&a.context.noIndent)this.noIndent=!0}function v(a){a.context&&(a.context=a.context.prev)}function y(a,c){for(var b;a.context;){b=a.context.tagName;if(!e.contextGrabbers.hasOwnProperty(b)||!e.contextGrabbers[b].hasOwnProperty(c))break;v(a)}}
function m(a,c,b){return"openTag"==a?(b.tagStart=c.column(),z):"closeTag"==a?H:m}function z(a,c,b){if("word"==a)return b.tagName=c.current(),f="tag",k;f="error";return z}function H(a,c,b){if("word"==a){a=c.current();b.context&&b.context.tagName!=a&&e.implicitlyClosed.hasOwnProperty(b.context.tagName)&&v(b);if(b.context&&b.context.tagName==a||!1===e.matchClosing)return f="tag",w;f="tag error";return A}f="error";return A}function w(a,c,b){if("endTag"!=a)return f="error",w;v(b);return m}function A(a,
c,b){f="error";return w(a,c,b)}function k(a,c,b){if("word"==a)return f="attribute",I;if("endTag"==a||"selfcloseTag"==a){c=b.tagName;var d=b.tagStart;b.tagName=b.tagStart=null;"selfcloseTag"==a||e.autoSelfClosers.hasOwnProperty(c)?y(b,c):(y(b,c),b.context=new G(b,c,d==b.indented));return m}f="error";return k}function I(a,c,b){if("equals"==a)return B;e.allowMissing||(f="error");return k(a,c,b)}function B(a,c,b){if("string"==a)return C;if("word"==a&&e.allowUnquoted)return f="string",k;f="error";return k(a,
c,b)}function C(a,c,b){return"string"==a?C:k(a,c,b)}var x=p.indentUnit,e={};p=q.htmlMode?D:E;for(var n in p)e[n]=p[n];for(n in q)e[n]=q[n];var l,f;h.isInText=!0;return{startState:function(a){var c={tokenize:h,state:m,indented:a||0,tagName:null,tagStart:null,context:null};null!=a&&(c.baseIndent=a);return c},token:function(a,c){!c.tagName&&a.sol()&&(c.indented=a.indentation());if(a.eatSpace())return null;l=null;var b=c.tokenize(a,c);(b||l)&&"comment"!=b&&(f=null,c.state=c.state(l||b,a,c),f&&(b="error"==
f?b+" error":f));return b},indent:function(a,c,b){var d=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+x;if(d&&d.noIndent)return g.Pass;if(a.tokenize!=u&&a.tokenize!=h)return b?b.match(/^(\s*)/)[0].length:0;if(a.tagName)return!1!==e.multilineTagIndentPastTag?a.tagStart+a.tagName.length+2:a.tagStart+x*(e.multilineTagIndentFactor||1);if(e.alignCDATA&&/<!\[CDATA\[/.test(c))return 0;if((c=c&&/^<(\/)?([\w_:\.-]*)/.exec(c))&&c[1])for(;d;)if(d.tagName==
c[2]){d=d.prev;break}else if(e.implicitlyClosed.hasOwnProperty(d.tagName))d=d.prev;else break;else if(c)for(;d;)if((b=e.contextGrabbers[d.tagName])&&b.hasOwnProperty(c[2]))d=d.prev;else break;for(;d&&d.prev&&!d.startOfLine;)d=d.prev;return d?d.indent+x:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:e.htmlMode?"html":"xml",helperType:e.htmlMode?"html":"xml",skipAttribute:function(a){a.state==B&&(a.state=k)}}});g.defineMIME("text/xml",
"xml");g.defineMIME("application/xml","xml");g.mimeModes.hasOwnProperty("text/html")||g.defineMIME("text/html",{name:"xml",htmlMode:!0})});