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