HTML Editor Syntax Highlighter - Version 1.4.6

Version Description

  • Fixed issue when "Add Media" button stopped working
  • Fixed editor resize bug in Visual mode.
Download this release

Release Info

Developer nixdns
Plugin Icon 128x128 HTML Editor Syntax Highlighter
Version 1.4.6
Comparing to
See all releases

Code changes from version 1.4.4 to 1.4.6

html-editor-syntax-highlighter.php CHANGED
@@ -5,10 +5,10 @@
5
  * Description: Syntax Highlighting in WordPress HTML Editor
6
  * Author: Petr Mukhortov
7
  * Author URI: http://mukhortov.com/
8
- * Version: 1.4.4
9
  * Requires at least: 3.3
10
- * Tested up to: 3.7.1
11
- * Stable tag: 1.4.4
12
  **/
13
 
14
  if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
@@ -18,12 +18,19 @@ define('HESH_LIBS',plugins_url('/lib/',__FILE__));
18
  class wp_html_editor_syntax {
19
  public function __construct(){
20
  add_action('admin_head',array(&$this,'admin_head'));
 
21
  }
22
  public function admin_head(){
23
  if (!$this->is_editor())
24
  return;
25
  ?>
26
  <link rel="stylesheet" href="<?php echo HESH_LIBS; ?>hesh.min.css">
 
 
 
 
 
 
27
  <script src="<?php echo HESH_LIBS; ?>hesh.min.js"></script>
28
  <?php
29
  }
5
  * Description: Syntax Highlighting in WordPress HTML Editor
6
  * Author: Petr Mukhortov
7
  * Author URI: http://mukhortov.com/
8
+ * Version: 1.4.6
9
  * Requires at least: 3.3
10
+ * Tested up to: 3.8.1
11
+ * Stable tag: 1.4.6
12
  **/
13
 
14
  if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
18
  class wp_html_editor_syntax {
19
  public function __construct(){
20
  add_action('admin_head',array(&$this,'admin_head'));
21
+ add_action('admin_footer',array(&$this,'admin_footer'));
22
  }
23
  public function admin_head(){
24
  if (!$this->is_editor())
25
  return;
26
  ?>
27
  <link rel="stylesheet" href="<?php echo HESH_LIBS; ?>hesh.min.css">
28
+ <?php
29
+ }
30
+ public function admin_footer(){
31
+ if (!$this->is_editor())
32
+ return;
33
+ ?>
34
  <script src="<?php echo HESH_LIBS; ?>hesh.min.js"></script>
35
  <?php
36
  }
lib/codemirror.min.dev.css DELETED
@@ -1 +0,0 @@
1
- .CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid black;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:black}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-property{color:black}.cm-s-default .cm-operator{color:black}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-error{color:red}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:blue}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:bold}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{line-height:1;position:relative;overflow:hidden;background:white;color:black}.CodeMirror-scroll{margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;padding-right:30px;height:100%;outline:0;position:relative;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-sizer{position:relative}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;-moz-box-sizing:content-box;box-sizing:content-box;padding-bottom:30px;margin-bottom:-32px;display:inline-block;*zoom:1;*display:inline}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-code pre{border-right:30px solid transparent;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.CodeMirror-wrap .CodeMirror-code pre{border-right:0;width:auto}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-right:0;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.CodeMirror span{*vertical-align:text-bottom}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}}
 
lib/codemirror.min.dev.js DELETED
@@ -1,6 +0,0 @@
1
- /* v3.19: codemirror.js, css.js, htmlmixed.js, javascript.js, xml.js, active-line.js, matchbrackets.js */
2
- window.CodeMirror=function(){"use strict";function x(a,c){if(!(this instanceof x))return new x(a,c);this.options=c=c||{};for(var d in _c)!c.hasOwnProperty(d)&&_c.hasOwnProperty(d)&&(c[d]=_c[d]);J(c);var e="string"==typeof c.value?0:c.value.first,f=this.display=y(a,e);f.wrapper.CodeMirror=this,G(this),c.autofocus&&!p&&Nb(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new Xe},E(this),c.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var g=c.value;"string"==typeof g&&(g=new ge(c.value,c.mode)),Fb(this,ke)(this,g),b&&setTimeout(ff(Mb,this,!0),20),Pb(this);var h;try{h=document.activeElement==f.input}catch(i){}h||c.autofocus&&!p?setTimeout(ff(mc,this),20):nc(this),Fb(this,function(){for(var a in $c)$c.propertyIsEnumerable(a)&&$c[a](this,c[a],bd);for(var b=0;b<fd.length;++b)fd[b](this)})()}function y(a,b){var d={},e=d.input=lf("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");return f?e.style.width="1000px":e.setAttribute("wrap","off"),o&&(e.style.border="1px solid black"),e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false"),d.inputDiv=lf("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),d.scrollbarH=lf("div",[lf("div",null,null,"height: 1px")],"CodeMirror-hscrollbar"),d.scrollbarV=lf("div",[lf("div",null,null,"width: 1px")],"CodeMirror-vscrollbar"),d.scrollbarFiller=lf("div",null,"CodeMirror-scrollbar-filler"),d.gutterFiller=lf("div",null,"CodeMirror-gutter-filler"),d.lineDiv=lf("div",null,"CodeMirror-code"),d.selectionDiv=lf("div",null,null,"position: relative; z-index: 1"),d.cursor=lf("div","\xa0","CodeMirror-cursor"),d.otherCursor=lf("div","\xa0","CodeMirror-cursor CodeMirror-secondarycursor"),d.measure=lf("div",null,"CodeMirror-measure"),d.lineSpace=lf("div",[d.measure,d.selectionDiv,d.lineDiv,d.cursor,d.otherCursor],null,"position: relative; outline: none"),d.mover=lf("div",[lf("div",[d.lineSpace],"CodeMirror-lines")],null,"position: relative"),d.sizer=lf("div",[d.mover],"CodeMirror-sizer"),d.heightForcer=lf("div",null,null,"position: absolute; height: "+Ve+"px; width: 1px;"),d.gutters=lf("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=lf("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=lf("div",[d.inputDiv,d.scrollbarH,d.scrollbarV,d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),c&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),a.appendChild?a.appendChild(d.wrapper):a(d.wrapper),o&&(e.style.width="0px"),f||(d.scroller.draggable=!0),k?(d.inputDiv.style.height="1px",d.inputDiv.style.position="absolute"):c&&(d.scrollbarH.style.minWidth=d.scrollbarV.style.minWidth="18px"),d.viewOffset=d.lastSizeC=0,d.showingFrom=d.showingTo=b,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.prevInput="",d.alignWidgets=!1,d.pollingFast=!1,d.poll=new Xe,d.cachedCharWidth=d.cachedTextHeight=null,d.measureLineCache=[],d.measureLineCachePos=0,d.inaccurateSelection=!1,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d}function z(a){a.doc.mode=x.getMode(a.options,a.doc.modeOption),a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,bb(a,100),a.state.modeGen++,a.curOp&&Ib(a)}function A(a){a.options.lineWrapping?(a.display.wrapper.className+=" CodeMirror-wrap",a.display.sizer.style.minWidth=""):(a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-wrap",""),I(a)),C(a),Ib(a),pb(a),setTimeout(function(){K(a)},100)}function B(a){var b=Ab(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/Bb(a.display)-3);return function(e){return Gd(a.doc,e)?0:c?(Math.ceil(e.text.length/d)||1)*b:b}}function C(a){var b=a.doc,c=B(a);b.iter(function(a){var b=c(a);b!=a.height&&oe(a,b)})}function D(a){var b=kd[a.options.keyMap],c=b.style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(c?" cm-keymap-"+c:""),a.state.disableInput=b.disableInput}function E(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),pb(a)}function F(a){G(a),Ib(a),setTimeout(function(){M(a)},20)}function G(a){var b=a.display.gutters,c=a.options.gutters;mf(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(lf("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none"}function H(a,b){if(0==b.height)return 0;for(var d,c=b.text.length,e=b;d=Dd(e);){var f=d.find();e=le(a,f.from.line),c+=f.from.ch-f.to.ch}for(e=b;d=Ed(e);){var f=d.find();c-=e.text.length-f.from.ch,e=le(a,f.to.line),c+=e.text.length-f.to.ch}return c}function I(a){var b=a.display,c=a.doc;b.maxLine=le(c,c.first),b.maxLineLength=H(c,b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var d=H(c,a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function J(a){var b=bf(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function K(a){var b=a.display,c=a.doc.height,d=c+gb(b);b.sizer.style.minHeight=b.heightForcer.style.top=d+"px",b.gutters.style.height=Math.max(d,b.scroller.clientHeight-Ve)+"px";var e=Math.max(d,b.scroller.scrollHeight),f=b.scroller.scrollWidth>b.scroller.clientWidth+1,g=e>b.scroller.clientHeight+1;g?(b.scrollbarV.style.display="block",b.scrollbarV.style.bottom=f?tf(b.measure)+"px":"0",b.scrollbarV.firstChild.style.height=e-b.scroller.clientHeight+b.scrollbarV.clientHeight+"px"):(b.scrollbarV.style.display="",b.scrollbarV.firstChild.style.height="0"),f?(b.scrollbarH.style.display="block",b.scrollbarH.style.right=g?tf(b.measure)+"px":"0",b.scrollbarH.firstChild.style.width=b.scroller.scrollWidth-b.scroller.clientWidth+b.scrollbarH.clientWidth+"px"):(b.scrollbarH.style.display="",b.scrollbarH.firstChild.style.width="0"),f&&g?(b.scrollbarFiller.style.display="block",b.scrollbarFiller.style.height=b.scrollbarFiller.style.width=tf(b.measure)+"px"):b.scrollbarFiller.style.display="",f&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(b.gutterFiller.style.display="block",b.gutterFiller.style.height=tf(b.measure)+"px",b.gutterFiller.style.width=b.gutters.offsetWidth+"px"):b.gutterFiller.style.display="",l&&0===tf(b.measure)&&(b.scrollbarV.style.minWidth=b.scrollbarH.style.minHeight=m?"18px":"12px",b.scrollbarV.style.pointerEvents=b.scrollbarH.style.pointerEvents="none")}function L(a,b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;"number"==typeof c?d=c:c&&(d=c.top,e=c.bottom-c.top),d=Math.floor(d-fb(a));var f=Math.ceil(d+e);return{from:qe(b,d),to:qe(b,f)}}function M(a){var b=a.display;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var c=P(b)-b.scroller.scrollLeft+a.doc.scrollLeft,d=b.gutters.offsetWidth,e=c+"px",f=b.lineDiv.firstChild;f;f=f.nextSibling)if(f.alignable)for(var g=0,h=f.alignable;g<h.length;++g)h[g].style.left=e;a.options.fixedGutter&&(b.gutters.style.left=c+d+"px")}}function N(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=O(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(lf("div",[lf("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),f=e.firstChild.offsetWidth,g=e.offsetWidth-f;return d.lineGutter.style.width="",d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-g),d.lineNumWidth=d.lineNumInnerWidth+g,d.lineNumChars=d.lineNumInnerWidth?c.length:-1,d.lineGutter.style.width=d.lineNumWidth+"px",!0}return!1}function O(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function P(a){return pf(a.scroller).left-pf(a.sizer).left}function Q(a,b,c,d){for(var g,e=a.display.showingFrom,f=a.display.showingTo,h=L(a.display,a.doc,c),i=!0;;i=!1){var j=a.display.scroller.clientWidth;if(!R(a,b,h,d))break;if(g=!0,b=[],Z(a),K(a),i&&a.options.lineWrapping&&j!=a.display.scroller.clientWidth)d=!0;else if(d=!1,c&&(c=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,"number"==typeof c?c:c.top)),h=L(a.display,a.doc,c),h.from>=a.display.showingFrom&&h.to<=a.display.showingTo)break}return g&&(Qe(a,"update",a),(a.display.showingFrom!=e||a.display.showingTo!=f)&&Qe(a,"viewportChange",a,a.display.showingFrom,a.display.showingTo)),g}function R(a,b,c,d){var e=a.display,f=a.doc;if(!e.wrapper.clientWidth)return e.showingFrom=e.showingTo=f.first,e.viewOffset=0,void 0;if(!(!d&&0==b.length&&c.from>e.showingFrom&&c.to<e.showingTo)){N(a)&&(b=[{from:f.first,to:f.first+f.size}]);var g=e.sizer.style.marginLeft=e.gutters.offsetWidth+"px";e.scrollbarH.style.left=a.options.fixedGutter?g:"0";var h=1/0;if(a.options.lineNumbers)for(var i=0;i<b.length;++i)b[i].diff&&b[i].from<h&&(h=b[i].from);var j=f.first+f.size,k=Math.max(c.from-a.options.viewportMargin,f.first),l=Math.min(j,c.to+a.options.viewportMargin);if(e.showingFrom<k&&k-e.showingFrom<20&&(k=Math.max(f.first,e.showingFrom)),e.showingTo>l&&e.showingTo-l<20&&(l=Math.min(j,e.showingTo)),w)for(k=pe(Fd(f,le(f,k)));j>l&&Gd(f,le(f,l));)++l;var m=[{from:Math.max(e.showingFrom,f.first),to:Math.min(e.showingTo,j)}];if(m=m[0].from>=m[0].to?[]:U(m,b),w)for(var i=0;i<m.length;++i)for(var o,n=m[i];o=Ed(le(f,n.to-1));){var p=o.find().from.line;if(!(p>n.from)){m.splice(i--,1);break}n.to=p}for(var q=0,i=0;i<m.length;++i){var n=m[i];n.from<k&&(n.from=k),n.to>l&&(n.to=l),n.from>=n.to?m.splice(i--,1):q+=n.to-n.from}if(!d&&q==l-k&&k==e.showingFrom&&l==e.showingTo)return T(a),void 0;m.sort(function(a,b){return a.from-b.from});try{var r=document.activeElement}catch(s){}.7*(l-k)>q&&(e.lineDiv.style.display="none"),W(a,k,l,m,h),e.lineDiv.style.display="",r&&document.activeElement!=r&&r.offsetHeight&&r.focus();var t=k!=e.showingFrom||l!=e.showingTo||e.lastSizeC!=e.wrapper.clientHeight;return t&&(e.lastSizeC=e.wrapper.clientHeight,bb(a,400)),e.showingFrom=k,e.showingTo=l,S(a),T(a),!0}}function S(a){for(var f,b=a.display,d=b.lineDiv.offsetTop,e=b.lineDiv.firstChild;e;e=e.nextSibling)if(e.lineObj){if(c){var g=e.offsetTop+e.offsetHeight;f=g-d,d=g}else{var h=pf(e);f=h.bottom-h.top}var i=e.lineObj.height-f;if(2>f&&(f=Ab(b)),i>.001||-.001>i){oe(e.lineObj,f);var j=e.lineObj.widgets;if(j)for(var k=0;k<j.length;++k)j[k].height=j[k].node.offsetHeight}}}function T(a){var b=a.display.viewOffset=re(a,le(a.doc,a.display.showingFrom));a.display.mover.style.top=b+"px"}function U(a,b){for(var c=0,d=b.length||0;d>c;++c){for(var e=b[c],f=[],g=e.diff||0,h=0,i=a.length;i>h;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g}))}a=f}return a}function V(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:P(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function W(a,b,c,d,e){function l(b){var c=b.nextSibling;return f&&q&&a.display.currentWheelTarget==b?(b.style.display="none",b.lineObj=null):b.parentNode.removeChild(b),c}var g=V(a),h=a.display,i=a.options.lineNumbers;d.length||f&&a.display.currentWheelTarget||mf(h.lineDiv);var j=h.lineDiv,k=j.firstChild,m=d.shift(),n=b;for(a.doc.iter(b,c,function(b){if(m&&m.to==n&&(m=d.shift()),Gd(a.doc,b)){if(0!=b.height&&oe(b,0),b.widgets&&k&&k.previousSibling)for(var c=0;c<b.widgets.length;++c){var f=b.widgets[c];if(f.showIfHidden){var h=k.previousSibling;if(/pre/i.test(h.nodeName)){var o=lf("div",null,null,"position: relative");h.parentNode.replaceChild(o,h),o.appendChild(h),h=o}var p=h.appendChild(lf("div",[f.node],"CodeMirror-linewidget"));f.handleMouseEvents||(p.ignoreEvents=!0),Y(f,p,h,g)}}}else if(m&&m.from<=n&&m.to>n){for(;k.lineObj!=b;)k=l(k);i&&n>=e&&k.lineNumber&&of(k.lineNumber,O(a.options,n)),k=k.nextSibling}else{if(b.widgets)for(var s,q=0,r=k;r&&20>q;++q,r=r.nextSibling)if(r.lineObj==b&&/div/i.test(r.nodeName)){s=r;break}var t=X(a,b,n,g,s);if(t!=s)j.insertBefore(t,k);else{for(;k!=s;)k=l(k);k=k.nextSibling}t.lineObj=b}++n});k;)k=l(k)}function X(a,b,d,e,f){var k,g=Xd(a,b),h=g.pre,i=b.gutterMarkers,j=a.display,l=g.bgClass?g.bgClass+" "+(b.bgClass||""):b.bgClass;if(!(a.options.lineNumbers||i||l||b.wrapClass||b.widgets))return h;if(f){f.alignable=null;for(var q,m=!0,n=0,o=null,p=f.firstChild;p;p=q)if(q=p.nextSibling,/\bCodeMirror-linewidget\b/.test(p.className)){for(var r=0;r<b.widgets.length;++r){var s=b.widgets[r];if(s.node==p.firstChild){s.above||o||(o=p),Y(s,p,f,e),++n;break}}if(r==b.widgets.length){m=!1;break}}else f.removeChild(p);f.insertBefore(h,o),m&&n==b.widgets.length&&(k=f,f.className=b.wrapClass||"")}if(k||(k=lf("div",null,b.wrapClass,"position: relative"),k.appendChild(h)),l&&k.insertBefore(lf("div",null,l+" CodeMirror-linebackground"),k.firstChild),a.options.lineNumbers||i){var t=k.insertBefore(lf("div",null,null,"position: absolute; left: "+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+"px"),k.firstChild);if(a.options.fixedGutter&&(k.alignable||(k.alignable=[])).push(t),!a.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(k.lineNumber=t.appendChild(lf("div",O(a.options,d),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+e.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+j.lineNumInnerWidth+"px"))),i)for(var u=0;u<a.options.gutters.length;++u){var v=a.options.gutters[u],w=i.hasOwnProperty(v)&&i[v];w&&t.appendChild(lf("div",[w],"CodeMirror-gutter-elt","left: "+e.gutterLeft[v]+"px; width: "+e.gutterWidth[v]+"px"))}}if(c&&(k.style.zIndex=2),b.widgets&&k!=f)for(var r=0,x=b.widgets;r<x.length;++r){var s=x[r],y=lf("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||(y.ignoreEvents=!0),Y(s,y,k,e),s.above?k.insertBefore(y,a.options.lineNumbers&&0!=b.height?t:h):k.appendChild(y),Qe(s,"redraw")}return k}function Y(a,b,c,d){if(a.noHScroll){(c.alignable||(c.alignable=[])).push(b);var e=d.wrapperWidth;b.style.left=d.fixedPos+"px",a.coverGutter||(e-=d.gutterTotalWidth,b.style.paddingLeft=d.gutterTotalWidth+"px"),b.style.width=e+"px"}a.coverGutter&&(b.style.zIndex=5,b.style.position="relative",a.noHScroll||(b.style.marginLeft=-d.gutterTotalWidth+"px"))}function Z(a){var b=a.display,c=Cc(a.doc.sel.from,a.doc.sel.to);if(c||a.options.showCursorWhenSelecting?$(a):b.cursor.style.display=b.otherCursor.style.display="none",c?b.selectionDiv.style.display="none":_(a),a.options.moveInputWithCursor){var d=vb(a,a.doc.sel.head,"div"),e=pf(b.wrapper),f=pf(b.lineDiv);b.inputDiv.style.top=Math.max(0,Math.min(b.wrapper.clientHeight-10,d.top+f.top-e.top))+"px",b.inputDiv.style.left=Math.max(0,Math.min(b.wrapper.clientWidth-10,d.left+f.left-e.left))+"px"}}function $(a){var b=a.display,c=vb(a,a.doc.sel.head,"div");b.cursor.style.left=c.left+"px",b.cursor.style.top=c.top+"px",b.cursor.style.height=Math.max(0,c.bottom-c.top)*a.options.cursorHeight+"px",b.cursor.style.display="",c.other?(b.otherCursor.style.display="",b.otherCursor.style.left=c.other.left+"px",b.otherCursor.style.top=c.other.top+"px",b.otherCursor.style.height=.85*(c.other.bottom-c.other.top)+"px"):b.otherCursor.style.display="none"}function _(a){function h(a,b,c,d){0>b&&(b=0),e.appendChild(lf("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?f-a:c)+"px; height: "+(d-b)+"px"))}function i(b,d,e){function m(c,d){return ub(a,Bc(b,c),"div",i,d)}var k,l,i=le(c,b),j=i.text.length;return Af(se(i),d||0,null==e?j:e,function(a,b,c){var n,o,p,i=m(a,"left");if(a==b)n=i,o=p=i.left;else{if(n=m(b-1,"right"),"rtl"==c){var q=i;i=n,n=q}o=i.left,p=n.right}null==d&&0==a&&(o=g),n.top-i.top>3&&(h(o,i.top,null,i.bottom),o=g,i.bottom<n.top&&h(o,i.bottom,null,n.top)),null==e&&b==j&&(p=f),(!k||i.top<k.top||i.top==k.top&&i.left<k.left)&&(k=i),(!l||n.bottom>l.bottom||n.bottom==l.bottom&&n.right>l.right)&&(l=n),g+1>o&&(o=g),h(o,n.top,p-o,n.bottom)}),{start:k,end:l}}var b=a.display,c=a.doc,d=a.doc.sel,e=document.createDocumentFragment(),f=b.lineSpace.offsetWidth,g=hb(a.display);if(d.from.line==d.to.line)i(d.from.line,d.from.ch,d.to.ch);else{var j=le(c,d.from.line),k=le(c,d.to.line),l=Fd(c,j)==Fd(c,k),m=i(d.from.line,d.from.ch,l?j.text.length:null).end,n=i(d.to.line,l?0:null,d.to.ch).start;l&&(m.top<n.top-2?(h(m.right,m.top,null,m.bottom),h(g,n.top,n.left,n.bottom)):h(m.right,m.top,n.left-m.right,m.bottom)),m.bottom<n.top&&h(g,m.bottom,null,n.top)}nf(b.selectionDiv,e),b.selectionDiv.style.display=""}function ab(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursor.style.visibility=b.otherCursor.style.visibility="",a.options.cursorBlinkRate>0&&(b.blinker=setInterval(function(){b.cursor.style.visibility=b.otherCursor.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate))}}function bb(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.showingTo&&a.state.highlight.set(b,ff(cb,a))}function cb(a){var b=a.doc;if(b.frontier<b.first&&(b.frontier=b.first),!(b.frontier>=a.display.showingTo)){var f,c=+new Date+a.options.workTime,d=hd(b.mode,eb(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.showingTo+500),function(g){if(b.frontier>=a.display.showingFrom){var h=g.styles;g.styles=Sd(a,g,d);for(var i=!h||h.length!=g.styles.length,j=0;!i&&j<h.length;++j)i=h[j]!=g.styles[j];i&&(f&&f.end==b.frontier?f.end++:e.push(f={start:b.frontier,end:b.frontier+1})),g.stateAfter=hd(b.mode,d)}else Ud(a,g,d),g.stateAfter=0==b.frontier%5?hd(b.mode,d):null;return++b.frontier,+new Date>c?(bb(a,a.options.workDelay),!0):void 0}),e.length&&Fb(a,function(){for(var a=0;a<e.length;++a)Ib(this,e[a].start,e[a].end)})()}}function db(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1e3:100),h=b;h>g;--h){if(h<=f.first)return f.first;var i=le(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=Ye(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function eb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=db(a,b,c),g=f>d.first&&le(d,f-1).stateAfter;return g=g?hd(d.mode,g):id(d.mode),d.iter(f,b,function(c){Ud(a,c,g);var h=f==b-1||0==f%5||f>=e.showingFrom&&f<e.showingTo;c.stateAfter=h?hd(d.mode,g):null,++f}),c&&(d.frontier=f),g}function fb(a){return a.lineSpace.offsetTop}function gb(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function hb(a){var b=nf(a.measure,lf("pre",null,null,"text-align: left")).appendChild(lf("span","x"));return b.offsetLeft}function ib(a,b,c,d,e){var f=-1;if(d=d||lb(a,b),d.crude){var g=d.left+c*d.width;return{left:g,right:g+d.width,top:d.top,bottom:d.bottom}}for(var h=c;;h+=f){var i=d[h];if(i)break;0>f&&0==h&&(f=1)}return e=h>c?"left":c>h?"right":e,"left"==e&&i.leftSide?i=i.leftSide:"right"==e&&i.rightSide&&(i=i.rightSide),{left:c>h?i.right:i.left,right:h>c?i.left:i.right,top:i.top,bottom:i.bottom}}function jb(a,b){for(var c=a.display.measureLineCache,d=0;d<c.length;++d){var e=c[d];if(e.text==b.text&&e.markedSpans==b.markedSpans&&a.display.scroller.clientWidth==e.width&&e.classes==b.textClass+"|"+b.wrapClass)return e}}function kb(a,b){var c=jb(a,b);c&&(c.text=c.measure=c.markedSpans=null)}function lb(a,b){var c=jb(a,b);if(c)return c.measure;var d=mb(a,b),e=a.display.measureLineCache,f={text:b.text,width:a.display.scroller.clientWidth,markedSpans:b.markedSpans,measure:d,classes:b.textClass+"|"+b.wrapClass};return 16==e.length?e[++a.display.measureLineCachePos%16]=f:e.push(f),d}function mb(a,e){function t(a){var b=a.top-p.top,c=a.bottom-p.top;c>s&&(c=s),0>b&&(b=0);for(var d=q.length-2;d>=0;d-=2){var e=q[d],f=q[d+1];if(!(e>c||b>f)&&(b>=e&&f>=c||e>=b&&c>=f||Math.min(c,f)-Math.max(b,e)>=c-b>>1)){q[d]=Math.min(b,e),q[d+1]=Math.max(c,f);break}}return 0>d&&(d=q.length,q.push(b,c)),{left:a.left-p.left,right:a.right-p.left,top:d,bottom:null}}function u(a){a.bottom=q[a.top+1],a.top=q[a.top]}if(!a.options.lineWrapping&&e.text.length>=a.options.crudeMeasuringFrom)return nb(a,e);var f=a.display,g=ef(e.text.length),h=Xd(a,e,g,!0).pre;if(b&&!c&&!a.options.lineWrapping&&h.childNodes.length>100){for(var i=document.createDocumentFragment(),j=10,k=h.childNodes.length,l=0,m=Math.ceil(k/j);m>l;++l){for(var n=lf("div",null,null,"display: inline-block"),o=0;j>o&&k;++o)n.appendChild(h.firstChild),--k;i.appendChild(n)}h.appendChild(i)}nf(f.measure,h);var p=pf(f.lineDiv),q=[],r=ef(e.text.length),s=h.offsetHeight;d&&f.measure.first!=h&&nf(f.measure,h);for(var v,l=0;l<g.length;++l)if(v=g[l]){var w=v,x=null;if(/\bCodeMirror-widget\b/.test(v.className)&&v.getClientRects){1==v.firstChild.nodeType&&(w=v.firstChild);var y=w.getClientRects();y.length>1&&(x=r[l]=t(y[0]),x.rightSide=t(y[y.length-1]))}x||(x=r[l]=t(pf(w))),v.measureRight&&(x.right=pf(v.measureRight).left),v.leftSide&&(x.leftSide=t(pf(v.leftSide)))}mf(a.display.measure);for(var v,l=0;l<r.length;++l)(v=r[l])&&(u(v),v.leftSide&&u(v.leftSide),v.rightSide&&u(v.rightSide));return r}function nb(a,b){var c=new Od(b.text.slice(0,100),null);b.textClass&&(c.textClass=b.textClass);var d=mb(a,c),e=ib(a,c,0,d,"left"),f=ib(a,c,99,d,"right");return{crude:!0,top:e.top,left:e.left,bottom:e.bottom,width:(f.right-e.left)/100}}function ob(a,b){var c=!1;if(b.markedSpans)for(var d=0;d<b.markedSpans;++d){var e=b.markedSpans[d];!e.collapsed||null!=e.to&&e.to!=b.text.length||(c=!0)}var f=!c&&jb(a,b);if(f||b.text.length>=a.options.crudeMeasuringFrom)return ib(a,b,b.text.length,f&&f.measure,"right").right;var g=Xd(a,b,null,!0).pre,h=g.appendChild(vf(a.display.measure));return nf(a.display.measure,g),pf(h).right-pf(a.display.lineDiv).left}function pb(a){a.display.measureLineCache.length=a.display.measureLineCachePos=0,a.display.cachedCharWidth=a.display.cachedTextHeight=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function qb(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function rb(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function sb(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Md(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=re(a,b);if("local"==d?g+=fb(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=pf(a.display.lineSpace);g+=h.top+("window"==d?0:rb());var i=h.left+("window"==d?0:qb());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function tb(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=qb(),e-=rb();else if("local"==c||!c){var f=pf(a.display.sizer);d+=f.left,e+=f.top}var g=pf(a.display.lineSpace);return{left:d-g.left,top:e-g.top}}function ub(a,b,c,d,e){return d||(d=le(a.doc,b.line)),sb(a,d,ib(a,d,b.ch,null,e),c)}function vb(a,b,c,d,e){function f(b,f){var g=ib(a,d,b,e,f?"right":"left");return f?g.left=g.right:g.right=g.left,sb(a,d,g,c)}function g(a,b){var c=h[b],d=c.level%2;return a==Bf(c)&&b&&c.level<h[b-1].level?(c=h[--b],a=Cf(c)-(c.level%2?0:1),d=!0):a==Cf(c)&&b<h.length-1&&c.level<h[b+1].level&&(c=h[++b],a=Bf(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?f(a-1):f(a,d)}d=d||le(a.doc,b.line),e||(e=lb(a,d));var h=se(d),i=b.ch;if(!h)return f(i);var j=Jf(h,i),k=g(i,j);return null!=If&&(k.other=g(i,If)),k}function wb(a,b,c,d){var e=new Bc(a,b);return e.xRel=d,c&&(e.outside=!0),e}function xb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return wb(d.first,0,!0,-1);var e=qe(d,c),f=d.first+d.size-1;if(e>f)return wb(d.first+d.size-1,le(d,f).text.length,!0,1);for(0>b&&(b=0);;){var g=le(d,e),h=yb(a,g,e,b,c),i=Ed(g),j=i&&i.find();if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=j.to.line}}function yb(a,b,c,d,e){function j(d){var e=vb(a,Bc(c,d),"line",b,i);return g=!0,f>e.bottom?e.left-h:f<e.top?e.left+h:(g=!1,e.left)}var f=e-re(a,b),g=!1,h=2*a.display.wrapper.clientWidth,i=lb(a,b),k=se(b),l=b.text.length,m=Df(b),n=Ef(b),o=j(m),p=g,q=j(n),r=g;if(d>q)return wb(c,n,r,1);for(;;){if(k?n==m||n==Lf(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);kf.test(b.text.charAt(s));)++s;var u=wb(c,s,s==m?p:r,0>t?-1:t?1:0);return u}var v=Math.ceil(l/2),w=m+v;if(k){w=m;for(var x=0;v>x;++x)w=Lf(b,w,1)}var y=j(w);y>d?(n=w,q=y,(r=g)&&(q+=1e3),l=v):(m=w,o=y,p=g,l-=v)}}function Ab(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==zb){zb=lf("pre");for(var b=0;49>b;++b)zb.appendChild(document.createTextNode("x")),zb.appendChild(lf("br"));zb.appendChild(document.createTextNode("x"))}nf(a.measure,zb);var c=zb.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),mf(a.measure),c||1}function Bb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=lf("span","x"),c=lf("pre",[b]);nf(a.measure,c);var d=b.offsetWidth;return d>2&&(a.cachedCharWidth=d),d||10}function Db(a){a.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Cb},Pe++||(Oe=[])}function Eb(a){var b=a.curOp,c=a.doc,d=a.display;if(a.curOp=null,b.updateMaxLine&&I(a),d.maxLineChanged&&!a.options.lineWrapping&&d.maxLine){var e=ob(a,d.maxLine);d.sizer.style.minWidth=Math.max(0,e+3+Ve)+"px",d.maxLineChanged=!1;var f=Math.max(0,d.sizer.offsetLeft+d.sizer.offsetWidth-d.scroller.clientWidth);f<c.scrollLeft&&!b.updateScrollPos&&ac(a,Math.min(d.scroller.scrollLeft,f),!0)}var g,h;if(b.updateScrollPos)g=b.updateScrollPos;else if(b.selectionChanged&&d.scroller.clientHeight){var i=vb(a,c.sel.head);g=Rc(a,i.left,i.top,i.left,i.bottom)}if((b.changes.length||b.forceUpdate||g&&null!=g.scrollTop)&&(h=Q(a,b.changes,g&&g.scrollTop,b.forceUpdate),a.display.scroller.offsetHeight&&(a.doc.scrollTop=a.display.scroller.scrollTop)),!h&&b.selectionChanged&&Z(a),b.updateScrollPos){var j=Math.max(0,Math.min(d.scroller.scrollHeight-d.scroller.clientHeight,g.scrollTop)),k=Math.max(0,Math.min(d.scroller.scrollWidth-d.scroller.clientWidth,g.scrollLeft));d.scroller.scrollTop=d.scrollbarV.scrollTop=c.scrollTop=j,d.scroller.scrollLeft=d.scrollbarH.scrollLeft=c.scrollLeft=k,M(a),b.scrollToPos&&Pc(a,Gc(a.doc,b.scrollToPos.from),Gc(a.doc,b.scrollToPos.to),b.scrollToPos.margin)}else g&&Oc(a);b.selectionChanged&&ab(a),a.state.focused&&b.updateInput&&Mb(a,b.userSelChange);var l=b.maybeHiddenMarkers,m=b.maybeUnhiddenMarkers;if(l)for(var n=0;n<l.length;++n)l[n].lines.length||Ne(l[n],"hide");if(m)for(var n=0;n<m.length;++n)m[n].lines.length&&Ne(m[n],"unhide");var o;if(--Pe||(o=Oe,Oe=null),b.textChanged&&Ne(a,"change",a,b.textChanged),b.cursorActivity&&Ne(a,"cursorActivity",a),o)for(var n=0;n<o.length;++n)o[n]()}function Fb(a,b){return function(){var c=a||this,d=!c.curOp;d&&Db(c);try{var e=b.apply(c,arguments)}finally{d&&Eb(c)}return e}}function Gb(a){return function(){var c,b=this.cm&&!this.cm.curOp;b&&Db(this.cm);try{c=a.apply(this,arguments)}finally{b&&Eb(this.cm)}return c}}function Hb(a,b){var d,c=!a.curOp;c&&Db(a);try{d=b()}finally{c&&Eb(a)}return d}function Ib(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),a.curOp.changes.push({from:b,to:c,diff:d})}function Jb(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){Lb(a),a.state.focused&&Jb(a)})}function Kb(a){function c(){var d=Lb(a);d||b?(a.display.pollingFast=!1,Jb(a)):(b=!0,a.display.poll.set(60,c))}var b=!1;a.display.pollingFast=!0,a.display.poll.set(20,c)}function Lb(a){var c=a.display.input,e=a.display.prevInput,f=a.doc,g=f.sel;if(!a.state.focused||xf(c)||Ob(a)||a.state.disableInput)return!1;a.state.pasteIncoming&&a.state.fakedLastChar&&(c.value=c.value.substring(0,c.value.length-1),a.state.fakedLastChar=!1);var h=c.value;if(h==e&&Cc(g.from,g.to))return!1;if(b&&!d&&a.display.inputHasSelection===h)return Mb(a,!0),!1;var i=!a.curOp;i&&Db(a),g.shift=!1;for(var j=0,k=Math.min(e.length,h.length);k>j&&e.charCodeAt(j)==h.charCodeAt(j);)++j;var l=g.from,m=g.to;j<e.length?l=Bc(l.line,l.ch-(e.length-j)):a.state.overwrite&&Cc(l,m)&&!a.state.pasteIncoming&&(m=Bc(m.line,Math.min(le(f,m.line).text.length,m.ch+(h.length-j))));var n=a.curOp.updateInput,o={from:l,to:m,text:wf(h.slice(j)),origin:a.state.pasteIncoming?"paste":"+input"};return uc(a.doc,o,"end"),a.curOp.updateInput=n,Qe(a,"inputRead",a,o),h.length>1e3||h.indexOf("\n")>-1?c.value=a.display.prevInput="":a.display.prevInput=h,i&&Eb(a),a.state.pasteIncoming=!1,!0}function Mb(a,c){var e,f,g=a.doc;if(Cc(g.sel.from,g.sel.to))c&&(a.display.prevInput=a.display.input.value="",b&&!d&&(a.display.inputHasSelection=null));else{a.display.prevInput="",e=yf&&(g.sel.to.line-g.sel.from.line>100||(f=a.getSelection()).length>1e3);var h=e?"-":f||a.getSelection();a.display.input.value=h,a.state.focused&&af(a.display.input),b&&!d&&(a.display.inputHasSelection=h)}a.display.inaccurateSelection=e}function Nb(a){"nocursor"==a.options.readOnly||p&&document.activeElement==a.display.input||a.display.input.focus()}function Ob(a){return a.options.readOnly||a.doc.cantEdit}function Pb(a){function e(){a.state.focused&&setTimeout(ff(Nb,a),0)}function h(){null==g&&(g=setTimeout(function(){g=null,c.cachedCharWidth=c.cachedTextHeight=sf=null,pb(a),Hb(a,ff(Ib,a))},100))}function i(){for(var a=c.wrapper.parentNode;a&&a!=document.body;a=a.parentNode);a?setTimeout(i,5e3):Me(window,"resize",h)}function j(b){Re(a,b)||a.options.onDragEvent&&a.options.onDragEvent(a,Ee(b))||Ie(b)}function l(){c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,c.input.value=a.getSelection(),af(c.input))}var c=a.display;Le(c.scroller,"mousedown",Fb(a,Ub)),b?Le(c.scroller,"dblclick",Fb(a,function(b){if(!Re(a,b)){var c=Rb(a,b);if(c&&!Xb(a,b)&&!Qb(a.display,b)){Fe(b);var d=Yc(le(a.doc,c.line).text,c);Jc(a.doc,d.from,d.to)}}})):Le(c.scroller,"dblclick",function(b){Re(a,b)||Fe(b)}),Le(c.lineSpace,"selectstart",function(a){Qb(c,a)||Fe(a)}),u||Le(c.scroller,"contextmenu",function(b){pc(a,b)}),Le(c.scroller,"scroll",function(){c.scroller.clientHeight&&(_b(a,c.scroller.scrollTop),ac(a,c.scroller.scrollLeft,!0),Ne(a,"scroll",a))}),Le(c.scrollbarV,"scroll",function(){c.scroller.clientHeight&&_b(a,c.scrollbarV.scrollTop)}),Le(c.scrollbarH,"scroll",function(){c.scroller.clientHeight&&ac(a,c.scrollbarH.scrollLeft)}),Le(c.scroller,"mousewheel",function(b){dc(a,b)}),Le(c.scroller,"DOMMouseScroll",function(b){dc(a,b)}),Le(c.scrollbarH,"mousedown",e),Le(c.scrollbarV,"mousedown",e),Le(c.wrapper,"scroll",function(){c.wrapper.scrollTop=c.wrapper.scrollLeft=0});var g;Le(window,"resize",h),setTimeout(i,5e3),Le(c.input,"keyup",Fb(a,function(b){Re(a,b)||a.options.onKeyEvent&&a.options.onKeyEvent(a,Ee(b))||16==b.keyCode&&(a.doc.sel.shift=!1)})),Le(c.input,"input",function(){b&&!d&&a.display.inputHasSelection&&(a.display.inputHasSelection=null),Kb(a)}),Le(c.input,"keydown",Fb(a,kc)),Le(c.input,"keypress",Fb(a,lc)),Le(c.input,"focus",ff(mc,a)),Le(c.input,"blur",ff(nc,a)),a.options.dragDrop&&(Le(c.scroller,"dragstart",function(b){$b(a,b)}),Le(c.scroller,"dragenter",j),Le(c.scroller,"dragover",j),Le(c.scroller,"drop",Fb(a,Zb))),Le(c.scroller,"paste",function(b){Qb(c,b)||(Nb(a),Kb(a))}),Le(c.input,"paste",function(){if(f&&!a.state.fakedLastChar&&!(new Date-a.state.lastMiddleDown<200)){var b=c.input.selectionStart,d=c.input.selectionEnd;c.input.value+="$",c.input.selectionStart=b,c.input.selectionEnd=d,a.state.fakedLastChar=!0}a.state.pasteIncoming=!0,Kb(a)}),Le(c.input,"cut",l),Le(c.input,"copy",l),k&&Le(c.sizer,"mouseup",function(){document.activeElement==c.input&&c.input.blur(),Nb(a)})}function Qb(a,b){for(var c=Je(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function Rb(a,b,c){var d=a.display;if(!c){var e=Je(b);if(e==d.scrollbarH||e==d.scrollbarH.firstChild||e==d.scrollbarV||e==d.scrollbarV.firstChild||e==d.scrollbarFiller||e==d.gutterFiller)return null}var f,g,h=pf(d.lineSpace);try{f=b.clientX,g=b.clientY}catch(b){return null}return xb(a,f-h.left,g-h.top)}function Ub(a){function q(a){if(!Cc(p,a)){if(p=a,"single"==j)return Jc(c.doc,Gc(e,h),a),void 0;
3
- if(n=Gc(e,n),o=Gc(e,o),"double"==j){var b=Yc(le(e,a.line).text,a);Dc(a,n)?Jc(c.doc,b.from,o):Jc(c.doc,n,b.to)}else"triple"==j&&(Dc(a,n)?Jc(c.doc,o,Gc(e,Bc(a.line,0))):Jc(c.doc,n,Gc(e,Bc(a.line+1,0))))}}function t(a){var b=++s,f=Rb(c,a,!0);if(f)if(Cc(f,l)){var h=a.clientY<r.top?-20:a.clientY>r.bottom?20:0;h&&setTimeout(Fb(c,function(){s==b&&(d.scroller.scrollTop+=h,t(a))}),50)}else{c.state.focused||mc(c),l=f,q(f);var g=L(d,e);(f.line>=g.to||f.line<g.from)&&setTimeout(Fb(c,function(){s==b&&t(a)}),150)}}function v(a){s=1/0,Fe(a),Nb(c),Me(document,"mousemove",w),Me(document,"mouseup",x)}if(!Re(this,a)){var c=this,d=c.display,e=c.doc,g=e.sel;if(g.shift=a.shiftKey,Qb(d,a))return f||(d.scroller.draggable=!1,setTimeout(function(){d.scroller.draggable=!0},100)),void 0;if(!Xb(c,a)){var h=Rb(c,a);switch(Ke(a)){case 3:return u&&pc.call(c,c,a),void 0;case 2:return f&&(c.state.lastMiddleDown=+new Date),h&&Jc(c.doc,h),setTimeout(ff(Nb,c),20),Fe(a),void 0}if(!h)return Je(a)==d.scroller&&Fe(a),void 0;c.state.focused||mc(c);var i=+new Date,j="single";if(Tb&&Tb.time>i-400&&Cc(Tb.pos,h))j="triple",Fe(a),setTimeout(ff(Nb,c),20),Zc(c,h.line);else if(Sb&&Sb.time>i-400&&Cc(Sb.pos,h)){j="double",Tb={time:i,pos:h},Fe(a);var k=Yc(le(e,h.line).text,h);Jc(c.doc,k.from,k.to)}else Sb={time:i,pos:h};var l=h;if(c.options.dragDrop&&qf&&!Ob(c)&&!Cc(g.from,g.to)&&!Dc(h,g.from)&&!Dc(g.to,h)&&"single"==j){var m=Fb(c,function(b){f&&(d.scroller.draggable=!1),c.state.draggingText=!1,Me(document,"mouseup",m),Me(d.scroller,"drop",m),Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10&&(Fe(b),Jc(c.doc,h),Nb(c))});return f&&(d.scroller.draggable=!0),c.state.draggingText=m,d.scroller.dragDrop&&d.scroller.dragDrop(),Le(document,"mouseup",m),Le(d.scroller,"drop",m),void 0}Fe(a),"single"==j&&Jc(c.doc,Gc(e,h));var n=g.from,o=g.to,p=h,r=pf(d.wrapper),s=0,w=Fb(c,function(a){b||Ke(a)?t(a):v(a)}),x=Fb(c,v);Le(document,"mousemove",w),Le(document,"mouseup",x)}}}function Vb(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(b){return!1}if(f>=Math.floor(pf(a.display.gutters).right))return!1;d&&Fe(b);var h=a.display,i=pf(h.lineDiv);if(g>i.bottom||!Te(a,c))return He(b);g-=i.top-h.viewOffset;for(var j=0;j<a.options.gutters.length;++j){var k=h.gutters.childNodes[j];if(k&&pf(k).right>=f){var l=qe(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),He(b)}}}function Wb(a,b){return Te(a,"gutterContextMenu")?Vb(a,b,"gutterContextMenu",!1,Ne):!1}function Xb(a,b){return Vb(a,b,"gutterClick",!0,Qe)}function Zb(a){var c=this;if(!(Re(c,a)||Qb(c.display,a)||c.options.onDragEvent&&c.options.onDragEvent(c,Ee(a)))){Fe(a),b&&(Yb=+new Date);var d=Rb(c,a,!0),e=a.dataTransfer.files;if(d&&!Ob(c))if(e&&e.length&&window.FileReader&&window.File)for(var f=e.length,g=Array(f),h=0,i=function(a,b){var e=new FileReader;e.onload=function(){g[b]=e.result,++h==f&&(d=Gc(c.doc,d),uc(c.doc,{from:d,to:d,text:wf(g.join("\n")),origin:"paste"},"around"))},e.readAsText(a)},j=0;f>j;++j)i(e[j],j);else{if(c.state.draggingText&&!Dc(d,c.doc.sel.from)&&!Dc(c.doc.sel.to,d))return c.state.draggingText(a),setTimeout(ff(Nb,c),20),void 0;try{var g=a.dataTransfer.getData("Text");if(g){var k=c.doc.sel.from,l=c.doc.sel.to;Lc(c.doc,d,d),c.state.draggingText&&Ac(c.doc,"",k,l,"paste"),c.replaceSelection(g,null,"paste"),Nb(c)}}catch(a){}}}}function $b(a,c){if(b&&(!a.state.draggingText||+new Date-Yb<100))return Ie(c),void 0;if(!Re(a,c)&&!Qb(a.display,c)){var d=a.getSelection();if(c.dataTransfer.setData("Text",d),c.dataTransfer.setDragImage&&!j){var e=lf("img",null,null,"position: fixed; left: 0; top: 0;");e.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",i&&(e.width=e.height=1,a.display.wrapper.appendChild(e),e._top=e.offsetTop),c.dataTransfer.setDragImage(e,0,0),i&&e.parentNode.removeChild(e)}}}function _b(b,c){Math.abs(b.doc.scrollTop-c)<2||(b.doc.scrollTop=c,a||Q(b,[],c),b.display.scroller.scrollTop!=c&&(b.display.scroller.scrollTop=c),b.display.scrollbarV.scrollTop!=c&&(b.display.scrollbarV.scrollTop=c),a&&Q(b,[]),bb(b,100))}function ac(a,b,c){(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,M(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function dc(b,c){var d=c.wheelDeltaX,e=c.wheelDeltaY;null==d&&c.detail&&c.axis==c.HORIZONTAL_AXIS&&(d=c.detail),null==e&&c.detail&&c.axis==c.VERTICAL_AXIS?e=c.detail:null==e&&(e=c.wheelDelta);var g=b.display,h=g.scroller;if(d&&h.scrollWidth>h.clientWidth||e&&h.scrollHeight>h.clientHeight){if(e&&q&&f)for(var j=c.target;j!=h;j=j.parentNode)if(j.lineObj){b.display.currentWheelTarget=j;break}if(d&&!a&&!i&&null!=cc)return e&&_b(b,Math.max(0,Math.min(h.scrollTop+e*cc,h.scrollHeight-h.clientHeight))),ac(b,Math.max(0,Math.min(h.scrollLeft+d*cc,h.scrollWidth-h.clientWidth))),Fe(c),g.wheelStartX=null,void 0;if(e&&null!=cc){var k=e*cc,l=b.doc.scrollTop,m=l+g.wrapper.clientHeight;0>k?l=Math.max(0,l+k-50):m=Math.min(b.doc.height,m+k+50),Q(b,[],{top:l,bottom:m})}20>bc&&(null==g.wheelStartX?(g.wheelStartX=h.scrollLeft,g.wheelStartY=h.scrollTop,g.wheelDX=d,g.wheelDY=e,setTimeout(function(){if(null!=g.wheelStartX){var a=h.scrollLeft-g.wheelStartX,b=h.scrollTop-g.wheelStartY,c=b&&g.wheelDY&&b/g.wheelDY||a&&g.wheelDX&&a/g.wheelDX;g.wheelStartX=g.wheelStartY=null,c&&(cc=(cc*bc+c)/(bc+1),++bc)}},200)):(g.wheelDX+=d,g.wheelDY+=e))}}function ec(a,b,c){if("string"==typeof b&&(b=jd[b],!b))return!1;a.display.pollingFast&&Lb(a)&&(a.display.pollingFast=!1);var d=a.doc,e=d.sel.shift,f=!1;try{Ob(a)&&(a.state.suppressEdits=!0),c&&(d.sel.shift=!1),f=b(a)!=We}finally{d.sel.shift=e,a.state.suppressEdits=!1}return f}function fc(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function hc(a,b){var c=ld(a.options.keyMap),e=c.auto;clearTimeout(gc),e&&!nd(b)&&(gc=setTimeout(function(){ld(a.options.keyMap)==c&&(a.options.keyMap=e.call?e.call(null,a):e,D(a))},50));var f=od(b,!0),g=!1;if(!f)return!1;var h=fc(a);return g=b.shiftKey?md("Shift-"+f,h,function(b){return ec(a,b,!0)})||md(f,h,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?ec(a,b):void 0}):md(f,h,function(b){return ec(a,b)}),g&&(Fe(b),ab(a),d&&(b.oldKeyCode=b.keyCode,b.keyCode=0),Qe(a,"keyHandled",a,f,b)),g}function ic(a,b,c){var d=md("'"+c+"'",fc(a),function(b){return ec(a,b,!0)});return d&&(Fe(b),ab(a),Qe(a,"keyHandled",a,"'"+c+"'",b)),d}function kc(a){var c=this;if(c.state.focused||mc(c),!(Re(c,a)||c.options.onKeyEvent&&c.options.onKeyEvent(c,Ee(a)))){b&&27==a.keyCode&&(a.returnValue=!1);var d=a.keyCode;c.doc.sel.shift=16==d||a.shiftKey;var e=hc(c,a);i&&(jc=e?d:null,!e&&88==d&&!yf&&(q?a.metaKey:a.ctrlKey)&&c.replaceSelection(""))}}function lc(a){var c=this;if(!(Re(c,a)||c.options.onKeyEvent&&c.options.onKeyEvent(c,Ee(a)))){var e=a.keyCode,f=a.charCode;if(i&&e==jc)return jc=null,Fe(a),void 0;if(!(i&&(!a.which||a.which<10)||k)||!hc(c,a)){var g=String.fromCharCode(null==f?e:f);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!Ob(this)&&this.doc.mode.electricChars.indexOf(g)>-1&&setTimeout(Fb(c,function(){Uc(c,c.doc.sel.to.line,"smart")}),75),ic(c,a,g)||(b&&!d&&(c.display.inputHasSelection=null),Kb(c))}}}function mc(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(Ne(a,"focus",a),a.state.focused=!0,-1==a.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(a.display.wrapper.className+=" CodeMirror-focused"),a.curOp||(Mb(a,!0),f&&setTimeout(ff(Mb,a,!0),0))),Jb(a),ab(a))}function nc(a){a.state.focused&&(Ne(a,"blur",a),a.state.focused=!1,a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.doc.sel.shift=!1)},150)}function pc(a,c){function l(){if(null!=e.input.selectionStart){var a=e.input.value="\u200b"+(Cc(f.from,f.to)?"":e.input.value);e.prevInput="\u200b",e.input.selectionStart=1,e.input.selectionEnd=a.length}}function m(){if(e.inputDiv.style.position="relative",e.input.style.cssText=k,d&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=h),Jb(a),null!=e.input.selectionStart){(!b||d)&&l(),clearTimeout(oc);var c=0,f=function(){" "==e.prevInput&&0==e.input.selectionStart?Fb(a,jd.selectAll)(a):c++<10?oc=setTimeout(f,500):Mb(a)};oc=setTimeout(f,200)}}if(!Re(a,c,"contextmenu")){var e=a.display,f=a.doc.sel;if(!Qb(e,c)&&!Wb(a,c)){var g=Rb(a,c),h=e.scroller.scrollTop;if(g&&!i){var j=a.options.resetSelectionOnContextMenu;j&&(Cc(f.from,f.to)||Dc(g,f.from)||!Dc(g,f.to))&&Fb(a,Lc)(a.doc,g,g);var k=e.input.style.cssText;if(e.inputDiv.style.position="absolute",e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(c.clientY-5)+"px; left: "+(c.clientX-5)+"px; z-index: 1000; background: white; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",Nb(a),Mb(a,!0),Cc(f.from,f.to)&&(e.input.value=e.prevInput=" "),b&&!d&&l(),u){Ie(c);var n=function(){Me(window,"mouseup",n),setTimeout(m,20)};Le(window,"mouseup",n)}else setTimeout(m,50)}}}}function rc(a,b,c){if(!Dc(b.from,c))return Gc(a,c);var d=b.text.length-1-(b.to.line-b.from.line);if(c.line>b.to.line+d){var e=c.line-d,f=a.first+a.size-1;return e>f?Bc(f,le(a,f).text.length):Hc(c,le(a,e).text.length)}if(c.line==b.to.line+d)return Hc(c,_e(b.text).length+(1==b.text.length?b.from.ch:0)+le(a,b.to.line).text.length-b.to.ch);var g=c.line-b.from.line;return Hc(c,b.text[g].length+(g?0:b.from.ch))}function sc(a,b,c){if(c&&"object"==typeof c)return{anchor:rc(a,b,c.anchor),head:rc(a,b,c.head)};if("start"==c)return{anchor:b.from,head:b.from};var d=qc(b);if("around"==c)return{anchor:b.from,head:d};if("end"==c)return{anchor:d,head:d};var e=function(a){if(Dc(a,b.from))return a;if(!Dc(b.to,a))return d;var c=a.line+b.text.length-(b.to.line-b.from.line)-1,e=a.ch;return a.line==b.to.line&&(e+=d.ch-b.to.ch),Bc(c,e)};return{anchor:e(a.sel.anchor),head:e(a.sel.head)}}function tc(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};return c&&(d.update=function(b,c,d,e){b&&(this.from=Gc(a,b)),c&&(this.to=Gc(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),Ne(a,"beforeChange",a,d),a.cm&&Ne(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function uc(a,b,c,d){if(a.cm){if(!a.cm.curOp)return Fb(a.cm,uc)(a,b,c,d);if(a.cm.state.suppressEdits)return}if(!(Te(a,"beforeChange")||a.cm&&Te(a.cm,"beforeChange"))||(b=tc(a,b,!0))){var e=v&&!d&&Bd(a,b.from,b.to);if(e){for(var f=e.length-1;f>=1;--f)vc(a,{from:e[f].from,to:e[f].to,text:[""]});e.length&&vc(a,{from:e[0].from,to:e[0].to,text:b.text},c)}else vc(a,b,c)}}function vc(a,b,c){if(1!=b.text.length||""!=b.text[0]||!Cc(b.from,b.to)){var d=sc(a,b,c);we(a,b,d,a.cm?a.cm.curOp.id:0/0),yc(a,b,d,zd(a,b));var e=[];je(a,function(a,c){c||-1!=bf(e,a.history)||(Ce(a.history,b),e.push(a.history)),yc(a,b,null,zd(a,b))})}}function wc(a,b){if(!a.cm||!a.cm.state.suppressEdits){var c=a.history,d=("undo"==b?c.done:c.undone).pop();if(d){var e={changes:[],anchorBefore:d.anchorAfter,headBefore:d.headAfter,anchorAfter:d.anchorBefore,headAfter:d.headBefore,generation:c.generation};("undo"==b?c.undone:c.done).push(e),c.generation=d.generation||++c.maxGeneration;for(var f=Te(a,"beforeChange")||a.cm&&Te(a.cm,"beforeChange"),g=d.changes.length-1;g>=0;--g){var h=d.changes[g];if(h.origin=b,f&&!tc(a,h,!1))return("undo"==b?c.done:c.undone).length=0,void 0;e.changes.push(ve(a,h));var i=g?sc(a,h,null):{anchor:d.anchorBefore,head:d.headBefore};yc(a,h,i,Ad(a,h));var j=[];je(a,function(a,b){b||-1!=bf(j,a.history)||(Ce(a.history,h),j.push(a.history)),yc(a,h,null,Ad(a,h))})}}}}function xc(a,b){function c(a){return Bc(a.line+b,a.ch)}a.first+=b,a.cm&&Ib(a.cm,a.first,a.first,b),a.sel.head=c(a.sel.head),a.sel.anchor=c(a.sel.anchor),a.sel.from=c(a.sel.from),a.sel.to=c(a.sel.to)}function yc(a,b,c,d){if(a.cm&&!a.cm.curOp)return Fb(a.cm,yc)(a,b,c,d);if(b.to.line<a.first)return xc(a,b.text.length-1-(b.to.line-b.from.line)),void 0;if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);xc(a,e),b={from:Bc(a.first,0),to:Bc(b.to.line+e,b.to.ch),text:[_e(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:Bc(f,le(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=me(a,b.from,b.to),c||(c=sc(a,b,null)),a.cm?zc(a.cm,b,d,c):ce(a,b,d,c)}}function zc(a,b,c,d){var e=a.doc,f=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=pe(Fd(e,le(e,g.line))),e.iter(j,h.line+1,function(a){return a==f.maxLine?(i=!0,!0):void 0})),Dc(e.sel.head,b.from)||Dc(b.to,e.sel.head)||(a.curOp.cursorActivity=!0),ce(e,b,c,d,B(a)),a.options.lineWrapping||(e.iter(j,g.line+b.text.length,function(a){var b=H(e,a);b>f.maxLineLength&&(f.maxLine=a,f.maxLineLength=b,f.maxLineChanged=!0,i=!1)}),i&&(a.curOp.updateMaxLine=!0)),e.frontier=Math.min(e.frontier,g.line),bb(a,400);var k=b.text.length-(h.line-g.line)-1;if(Ib(a,g.line,h.line+1,k),Te(a,"change")){var l={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};if(a.curOp.textChanged){for(var m=a.curOp.textChanged;m.next;m=m.next);m.next=l}else a.curOp.textChanged=l}}function Ac(a,b,c,d,e){if(d||(d=c),Dc(d,c)){var f=d;d=c,c=f}"string"==typeof b&&(b=wf(b)),uc(a,{from:c,to:d,text:b,origin:e},null)}function Bc(a,b){return this instanceof Bc?(this.line=a,this.ch=b,void 0):new Bc(a,b)}function Cc(a,b){return a.line==b.line&&a.ch==b.ch}function Dc(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function Ec(a){return Bc(a.line,a.ch)}function Fc(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function Gc(a,b){if(b.line<a.first)return Bc(a.first,0);var c=a.first+a.size-1;return b.line>c?Bc(c,le(a,c).text.length):Hc(b,le(a,b.line).text.length)}function Hc(a,b){var c=a.ch;return null==c||c>b?Bc(a.line,b):0>c?Bc(a.line,0):a}function Ic(a,b){return b>=a.first&&b<a.first+a.size}function Jc(a,b,c,d){if(a.sel.shift||a.sel.extend){var e=a.sel.anchor;if(c){var f=Dc(b,e);f!=Dc(c,e)?(e=b,b=c):f!=Dc(b,c)&&(b=c)}Lc(a,e,b,d)}else Lc(a,b,c||b,d);a.cm&&(a.cm.curOp.userSelChange=!0)}function Kc(a,b,c){var d={anchor:b,head:c};return Ne(a,"beforeSelectionChange",a,d),a.cm&&Ne(a.cm,"beforeSelectionChange",a.cm,d),d.anchor=Gc(a,d.anchor),d.head=Gc(a,d.head),d}function Lc(a,b,c,d,e){if(!e&&Te(a,"beforeSelectionChange")||a.cm&&Te(a.cm,"beforeSelectionChange")){var f=Kc(a,b,c);c=f.head,b=f.anchor}var g=a.sel;if(g.goalColumn=null,null==d&&(d=Dc(c,g.head)?-1:1),(e||!Cc(b,g.anchor))&&(b=Nc(a,b,d,"push"!=e)),(e||!Cc(c,g.head))&&(c=Nc(a,c,d,"push"!=e)),!Cc(g.anchor,b)||!Cc(g.head,c)){g.anchor=b,g.head=c;var h=Dc(c,b);g.from=h?c:b,g.to=h?b:c,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=a.cm.curOp.cursorActivity=!0),Qe(a,"cursorActivity",a)}}function Mc(a){Lc(a.doc,a.doc.sel.from,a.doc.sel.to,null,"push")}function Nc(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=le(a,f.line);if(h.markedSpans)for(var i=0;i<h.markedSpans.length;++i){var j=h.markedSpans[i],k=j.marker;if((null==j.from||(k.inclusiveLeft?j.from<=f.ch:j.from<f.ch))&&(null==j.to||(k.inclusiveRight?j.to>=f.ch:j.to>f.ch))){if(d&&(Ne(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find()[0>g?"from":"to"];if(Cc(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?Gc(a,Bc(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?Bc(l.line+1,0):null),!l)){if(e)return d?(a.cantEdit=!0,Bc(a.first,0)):Nc(a,b,c,!0);e=!0,l=b,g=-g}f=l;continue a}}return f}}function Oc(a){var b=Pc(a,a.doc.sel.head,null,a.options.cursorScrollMargin);if(a.state.focused){var c=a.display,d=pf(c.sizer),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!n){var f="none"==c.cursor.style.display;f&&(c.cursor.style.display="",c.cursor.style.left=b.left+"px",c.cursor.style.top=b.top-c.viewOffset+"px"),c.cursor.scrollIntoView(e),f&&(c.cursor.style.display="none")}}}function Pc(a,b,c,d){for(null==d&&(d=0);;){var e=!1,f=vb(a,b),g=c&&c!=b?vb(a,c):f,h=Rc(a,Math.min(f.left,g.left),Math.min(f.top,g.top)-d,Math.max(f.left,g.left),Math.max(f.bottom,g.bottom)+d),i=a.doc.scrollTop,j=a.doc.scrollLeft;if(null!=h.scrollTop&&(_b(a,h.scrollTop),Math.abs(a.doc.scrollTop-i)>1&&(e=!0)),null!=h.scrollLeft&&(ac(a,h.scrollLeft),Math.abs(a.doc.scrollLeft-j)>1&&(e=!0)),!e)return f}}function Qc(a,b,c,d,e){var f=Rc(a,b,c,d,e);null!=f.scrollTop&&_b(a,f.scrollTop),null!=f.scrollLeft&&ac(a,f.scrollLeft)}function Rc(a,b,c,d,e){var f=a.display,g=Ab(a.display);0>c&&(c=0);var h=f.scroller.clientHeight-Ve,i=f.scroller.scrollTop,j={},k=a.doc.height+gb(f),l=g>c,m=e>k-g;if(i>c)j.scrollTop=l?0:c;else if(e>i+h){var n=Math.min(c,(m?k:e)-h);n!=i&&(j.scrollTop=n)}var o=f.scroller.clientWidth-Ve,p=f.scroller.scrollLeft;b+=f.gutters.offsetWidth,d+=f.gutters.offsetWidth;var q=f.gutters.offsetWidth,r=q+10>b;return p+q>b||r?(r&&(b=0),j.scrollLeft=Math.max(0,b-10-q)):d>o+p-3&&(j.scrollLeft=d+10-o),j}function Sc(a,b,c){a.curOp.updateScrollPos={scrollLeft:null==b?a.doc.scrollLeft:b,scrollTop:null==c?a.doc.scrollTop:c}}function Tc(a,b,c){var d=a.curOp.updateScrollPos||(a.curOp.updateScrollPos={scrollLeft:a.doc.scrollLeft,scrollTop:a.doc.scrollTop}),e=a.display.scroller;d.scrollTop=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,d.scrollTop+c)),d.scrollLeft=Math.max(0,Math.min(e.scrollWidth-e.clientWidth,d.scrollLeft+b))}function Uc(a,b,c,d){var e=a.doc;if(null==c&&(c="add"),"smart"==c)if(a.doc.mode.indent)var f=eb(a,b);else c="prev";var k,g=a.options.tabSize,h=le(e,b),i=Ye(h.text,null,g),j=h.text.match(/^\s*/)[0];if("smart"==c&&(k=a.doc.mode.indent(f,h.text.slice(j.length),h.text),k==We)){if(!d)return;c="prev"}"prev"==c?k=b>e.first?Ye(le(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c?k=i-a.options.indentUnit:"number"==typeof c&&(k=i+c),k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(k/g);n;--n)m+=g,l+=" ";k>m&&(l+=$e(k-m)),l!=j?Ac(a.doc,l,Bc(b,0),Bc(b,j.length),"+input"):e.sel.head.line==b&&e.sel.head.ch<j.length&&Lc(e,Bc(b,j.length),Bc(b,j.length),1),h.stateAfter=null}function Vc(a,b,c){var d=b,e=b,f=a.doc;return"number"==typeof b?e=le(f,Fc(f,b)):d=pe(b),null==d?null:c(e,d)?(Ib(a,d,d+1),e):null}function Wc(a,b,c,d,e){function k(){var b=f+c;return b<a.first||b>=a.first+a.size?j=!1:(f=b,i=le(a,b))}function l(a){var b=(e?Lf:Mf)(i,g,c,!0);if(null==b){if(a||!k())return j=!1;g=e?(0>c?Ef:Df)(i):0>c?i.text.length:0}else g=b;return!0}var f=b.line,g=b.ch,h=c,i=le(a,f),j=!0;if("char"==d)l();else if("column"==d)l(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=!0;!(0>c)||l(!o);o=!1){var p=i.text.charAt(g)||"\n",q=hf(p)?"w":n?/\s/.test(p)?null:"p":null;if(m&&m!=q){0>c&&(c=1,l());break}if(q&&(m=q),c>0&&!l(!o))break}var r=Nc(a,Bc(f,g),h,!0);return j||(r.hitSide=!0),r}function Xc(a,b,c,d){var g,e=a.doc,f=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);g=b.top+c*(h-(0>c?1.5:.5)*Ab(a.display))}else"line"==d&&(g=c>0?b.bottom+3:b.top-3);for(;;){var i=xb(a,f,g);if(!i.outside)break;if(0>c?0>=g:g>=e.height){i.hitSide=!0;break}g+=5*c}return i}function Yc(a,b){var c=b.ch,d=b.ch;if(a){(b.xRel<0||d==a.length)&&c?--c:++d;for(var e=a.charAt(c),f=hf(e)?hf:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!hf(a)};c>0&&f(a.charAt(c-1));)--c;for(;d<a.length&&f(a.charAt(d));)++d}return{from:Bc(b.line,c),to:Bc(b.line,d)}}function Zc(a,b){Jc(a.doc,Bc(b,0),Gc(a.doc,Bc(b+1,0)))}function ad(a,b,c,d){x.defaults[a]=b,c&&($c[a]=d?function(a,b,d){d!=bd&&c(a,b,d)}:c)}function hd(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function id(a,b,c){return a.startState?a.startState(b,c):!0}function ld(a){return"string"==typeof a?kd[a]:a}function md(a,b,c){function d(b){b=ld(b);var e=b[a];if(e===!1)return"stop";if(null!=e&&c(e))return!0;if(b.nofallthrough)return"stop";var f=b.fallthrough;if(null==f)return!1;if("[object Array]"!=Object.prototype.toString.call(f))return d(f);for(var g=0,h=f.length;h>g;++g){var i=d(f[g]);if(i)return i}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return"stop"!=f}}function nd(a){var b=zf[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b}function od(a,b){if(i&&34==a.keyCode&&a["char"])return!1;var c=zf[a.keyCode];return null==c||a.altGraphKey?!1:(a.altKey&&(c="Alt-"+c),(t?a.metaKey:a.ctrlKey)&&(c="Ctrl-"+c),(t?a.ctrlKey:a.metaKey)&&(c="Cmd-"+c),!b&&a.shiftKey&&(c="Shift-"+c),c)}function pd(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0}function qd(a,b){this.lines=[],this.type=b,this.doc=a}function rd(a,b,c,d,e){if(d&&d.shared)return td(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return Fb(a.cm,rd)(a,b,c,d,e);var f=new qd(a,e);if(Dc(c,b)||Cc(b,c)&&"range"==e&&(!d.inclusiveLeft||!d.inclusiveRight))return f;d&&df(d,f),f.replacedWith&&(f.collapsed=!0,f.replacedWith=lf("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||(f.replacedWith.ignoreEvents=!0)),f.collapsed&&(w=!0),f.addToHistory&&we(a,{from:b,to:c,origin:"markText"},{head:a.sel.head,anchor:a.sel.anchor},0/0);var i,j,l,g=b.line,h=0,k=a.cm;if(a.iter(g,c.line+1,function(d){k&&f.collapsed&&!k.options.lineWrapping&&Fd(a,d)==k.display.maxLine&&(l=!0);var e={from:null,to:null,marker:f};h+=d.text.length,g==b.line&&(e.from=b.ch,h-=b.ch),g==c.line&&(e.to=c.ch,h-=d.text.length-c.ch),f.collapsed&&(g==c.line&&(j=Cd(d,c.ch)),g==b.line?i=Cd(d,b.ch):oe(d,0)),wd(d,e),++g}),f.collapsed&&a.iter(b.line,c.line+1,function(b){Gd(a,b)&&oe(b,0)}),f.clearOnEnter&&Le(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(v=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed){if(i!=j)throw new Error("Inserting collapsed marker overlapping an existing one");f.size=h,f.atomic=!0}return k&&(l&&(k.curOp.updateMaxLine=!0),(f.className||f.title||f.startStyle||f.endStyle||f.collapsed)&&Ib(k,b.line,c.line+1),f.atomic&&Mc(k)),f}function sd(a,b){this.markers=a,this.primary=b;for(var c=0,d=this;c<a.length;++c)a[c].parent=this,Le(a[c],"clear",function(){d.clear()})}function td(a,b,c,d,e){d=df(d),d.shared=!1;var f=[rd(a,b,c,d,e)],g=f[0],h=d.replacedWith;return je(a,function(a){h&&(d.replacedWith=h.cloneNode(!0)),f.push(rd(a,Gc(a,b),Gc(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=_e(f)}),new sd(f,g)}function ud(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function vd(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function wd(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function xd(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],g=f.marker,h=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||(g.inclusiveLeft&&g.inclusiveRight||"bookmark"==g.type)&&f.from==b&&(!c||!f.marker.insertLeft)){var i=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);(e||(e=[])).push({from:f.from,to:i?null:f.to,marker:g})}}return e}function yd(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);if(h||"bookmark"==g.type&&f.from==b&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);(e||(e=[])).push({from:i?null:f.from-b,to:null==f.to?null:f.to-b,marker:g})}}return e}function zd(a,b){var c=Ic(a,b.from.line)&&le(a,b.from.line).markedSpans,d=Ic(a,b.to.line)&&le(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=Cc(b.from,b.to),h=xd(c,e,g),i=yd(d,f,g),j=1==b.text.length,k=_e(b.text).length+(j?e:0);if(h)for(var l=0;l<h.length;++l){var m=h[l];if(null==m.to){var n=ud(i,m.marker);n?j&&(m.to=null==n.to?null:n.to+k):m.to=e}}if(i)for(var l=0;l<i.length;++l){var m=i[l];if(null!=m.to&&(m.to+=k),null==m.from){var n=ud(h,m.marker);n||(m.from=k,j&&(h||(h=[])).push(m))}else m.from+=k,j&&(h||(h=[])).push(m)}if(j&&h){for(var l=0;l<h.length;++l)null!=h[l].from&&h[l].from==h[l].to&&"bookmark"!=h[l].marker.type&&h.splice(l--,1);h.length||(h=null)}var o=[h];if(!j){var q,p=b.text.length-2;if(p>0&&h)for(var l=0;l<h.length;++l)null==h[l].to&&(q||(q=[])).push({from:null,to:null,marker:h[l].marker});for(var l=0;p>l;++l)o.push(q);o.push(i)}return o}function Ad(a,b){var c=ye(a,b),d=zd(a,b);if(!c)return d;if(!d)return c;for(var e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g)a:for(var h=0;h<g.length;++h){for(var i=g[h],j=0;j<f.length;++j)if(f[j].marker==i.marker)continue a;f.push(i)}else g&&(c[e]=g)}return c}function Bd(a,b,c){var d=null;if(a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=bf(d,c)||(d||(d=[])).push(c)}}),!d)return null;for(var e=[{from:b,to:c}],f=0;f<d.length;++f)for(var g=d[f],h=g.find(),i=0;i<e.length;++i){var j=e[i];if(!Dc(j.to,h.from)&&!Dc(h.to,j.from)){var k=[i,1];(Dc(j.from,h.from)||!g.inclusiveLeft&&Cc(j.from,h.from))&&k.push({from:j.from,to:h.from}),(Dc(h.to,j.to)||!g.inclusiveRight&&Cc(j.to,h.to))&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function Cd(a,b){var d,c=w&&a.markedSpans;if(c)for(var e,f=0;f<c.length;++f)e=c[f],e.marker.collapsed&&(null==e.from||e.from<b)&&(null==e.to||e.to>b)&&(!d||d.width<e.marker.width)&&(d=e.marker);return d}function Dd(a){return Cd(a,-1)}function Ed(a){return Cd(a,a.text.length+1)}function Fd(a,b){for(var c;c=Dd(b);)b=le(a,c.find().from.line);return b}function Gd(a,b){var c=w&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed){if(null==d.from)return!0;if(!d.marker.replacedWith&&0==d.from&&d.marker.inclusiveLeft&&Hd(a,b,d))return!0}}function Hd(a,b,c){if(null==c.to){var d=c.marker.find().to,e=le(a,d.line);return Hd(a,e,ud(e.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var f,g=0;g<b.markedSpans.length;++g)if(f=b.markedSpans[g],f.marker.collapsed&&!f.marker.replacedWith&&f.from==c.to&&(f.marker.inclusiveLeft||c.marker.inclusiveRight)&&Hd(a,b,f))return!0}function Id(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Jd(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Ld(a){return function(){var b=!this.cm.curOp;b&&Db(this.cm);try{var c=a.apply(this,arguments)}finally{b&&Eb(this.cm)}return c}}function Md(a){return null!=a.height?a.height:(a.node.parentNode&&1==a.node.parentNode.nodeType||nf(a.cm.display.measure,lf("div",[a.node],null,"position: relative")),a.height=a.node.offsetHeight)}function Nd(a,b,c,d){var e=new Kd(a,c,d);return e.noHScroll&&(a.display.alignWidgets=!0),Vc(a,b,function(b){var c=b.widgets||(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,!Gd(a.doc,b)||e.showIfHidden){var d=re(a,b)<a.doc.scrollTop;oe(b,b.height+Md(e)),d&&Tc(a,0,e.height)}return!0}),e}function Pd(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),Id(a),Jd(a,c);var e=d?d(a):1;e!=a.height&&oe(a,e)}function Qd(a){a.parent=null,Id(a)}function Rd(a,b,c,d,e){var f=c.flattenSpans;null==f&&(f=a.options.flattenSpans);var j,g=0,h=null,i=new pd(b,a.options.tabSize);for(""==b&&c.blankLine&&c.blankLine(d);!i.eol();)i.pos>a.options.maxHighlightLength?(f=!1,i.pos=b.length,j=null):j=c.token(i,d),f&&h==j||(g<i.start&&e(i.start,h),g=i.start,h=j),i.start=i.pos;for(;g<i.pos;){var k=Math.min(i.pos,g+5e4);e(k,h),g=k}}function Sd(a,b,c){var d=[a.state.modeGen];Rd(a,b.text,a.doc.mode,c,function(a,b){d.push(a,b)});for(var e=0;e<a.state.overlays.length;++e){var f=a.state.overlays[e],g=1,h=0;Rd(a,b.text,f.mode,!0,function(a,b){for(var c=g;a>h;){var e=d[g];e>a&&d.splice(g,1,a,d[g+1],e),g+=2,h=Math.min(a,e)}if(b)if(f.opaque)d.splice(c,g-c,a,b),g=c+2;else for(;g>c;c+=2){var i=d[c+1];d[c+1]=i?i+" "+b:b}})}return d}function Td(a,b){return b.styles&&b.styles[0]==a.state.modeGen||(b.styles=Sd(a,b,b.stateAfter=eb(a,pe(b)))),b.styles}function Ud(a,b,c){var d=a.doc.mode,e=new pd(b.text,a.options.tabSize);for(""==b.text&&d.blankLine&&d.blankLine(c);!e.eol()&&e.pos<=a.options.maxHighlightLength;)d.token(e,c),e.start=e.pos}function Wd(a,b){if(!a)return null;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 Vd[a]||(Vd[a]="cm-"+a.replace(/ +/g," cm-"))}function Xd(a,c,d,g){for(var h,i=c,j=!0;h=Dd(i);)i=le(a.doc,h.find().from.line);var k={pre:lf("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:a,copyWidgets:g};do{i.text&&(j=!1),k.measure=i==c&&d,k.pos=0,k.addToken=k.measure?$d:Zd,(b||f)&&a.getOption("lineWrapping")&&(k.addToken=_d(k.addToken));var l=be(i,k,Td(a,i));d&&i==c&&!k.measuredSomething&&(d[0]=k.pre.appendChild(vf(a.display.measure)),k.measuredSomething=!0),l&&(i=le(a.doc,l.to.line))}while(l);!d||k.measuredSomething||d[0]||(d[0]=k.pre.appendChild(j?lf("span","\xa0"):vf(a.display.measure))),k.pre.firstChild||Gd(a.doc,c)||k.pre.appendChild(document.createTextNode("\xa0"));var m;if(d&&(b||e)&&(m=se(i))){var n=m.length-1;m[n].from==m[n].to&&--n;var o=m[n],p=m[n-1];if(o.from+1==o.to&&p&&o.level<p.level){var q=d[k.pos-1];q&&q.parentNode.insertBefore(q.measureRight=vf(a.display.measure),q.nextSibling)}}var r=k.textClass?k.textClass+" "+(c.textClass||""):c.textClass;return r&&(k.pre.className=r),Ne(a,"renderLine",a,c,k.pre),k}function Zd(a,b,c,d,e,f){if(b){if(Yd.test(b))for(var g=document.createDocumentFragment(),h=0;;){Yd.lastIndex=h;var i=Yd.exec(b),j=i?i.index-h:b.length-h;if(j&&(g.appendChild(document.createTextNode(b.slice(h,h+j))),a.col+=j),!i)break;if(h+=j+1," "==i[0]){var k=a.cm.options.tabSize,l=k-a.col%k;g.appendChild(lf("span",$e(l),"cm-tab")),a.col+=l}else{var m=lf("span","\u2022","cm-invalidchar");m.title="\\u"+i[0].charCodeAt(0).toString(16),g.appendChild(m),a.col+=1}}else{a.col+=b.length;var g=document.createTextNode(b)}if(c||d||e||a.measure){var n=c||"";d&&(n+=d),e&&(n+=e);var m=lf("span",[g],n);return f&&(m.title=f),a.pre.appendChild(m)}a.pre.appendChild(g)}}function $d(a,c,d,e,f){for(var g=a.cm.options.lineWrapping,h=0;h<c.length;++h){var i=c.charAt(h),j=0==h;i>="\ud800"&&"\udbff">i&&h<c.length-1?(i=c.slice(h,h+2),++h):h&&g&&rf(c,h)&&a.pre.appendChild(lf("wbr"));var k=a.measure[a.pos],l=a.measure[a.pos]=Zd(a,i,d,j&&e,h==c.length-1&&f);k&&(l.leftSide=k.leftSide||k),b&&g&&" "==i&&h&&!/\s/.test(c.charAt(h-1))&&h<c.length-1&&!/\s/.test(c.charAt(h+1))&&(l.style.whiteSpace="normal"),a.pos+=i.length}c.length&&(a.measuredSomething=!0)}function _d(a){function b(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":"\xa0";return b+=" "}return function(c,d,e,f,g,h){return a(c,d.replace(/ {3,}/g,b),e,f,g,h)}}function ae(a,b,c,d){var e=!d&&c.replacedWith;if(e&&(a.copyWidgets&&(e=e.cloneNode(!0)),a.pre.appendChild(e),a.measure)){if(b)a.measure[a.pos]=e;else{var f=vf(a.cm.display.measure);if("bookmark"!=c.type||c.insertLeft){if(a.measure[a.pos])return;a.measure[a.pos]=a.pre.insertBefore(f,e)}else a.measure[a.pos]=a.pre.appendChild(f)}a.measuredSomething=!0}a.pos+=b}function be(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var k,m,n,o,p,q,h=e.length,i=0,g=1,j="",l=0;;){if(l==i){m=n=o=p="",q=null,l=1/0;for(var r=[],s=0;s<d.length;++s){var t=d[s],u=t.marker;t.from<=i&&(null==t.to||t.to>i)?(null!=t.to&&l>t.to&&(l=t.to,n=""),u.className&&(m+=" "+u.className),u.startStyle&&t.from==i&&(o+=" "+u.startStyle),u.endStyle&&t.to==l&&(n+=" "+u.endStyle),u.title&&!p&&(p=u.title),u.collapsed&&(!q||q.marker.size<u.size)&&(q=t)):t.from>i&&l>t.from&&(l=t.from),"bookmark"==u.type&&t.from==i&&u.replacedWith&&r.push(u)}if(q&&(q.from||0)==i&&(ae(b,(null==q.to?h:q.to)-i,q.marker,null==q.from),null==q.to))return q.marker.find();
4
- if(!q&&r.length)for(var s=0;s<r.length;++s)ae(b,0,r[s])}if(i>=h)break;for(var v=Math.min(h,l);;){if(j){var w=i+j.length;if(!q){var x=w>v?j.slice(0,v-i):j;b.addToken(b,x,k?k+m:m,o,i+x.length==l?n:"",p)}if(w>=v){j=j.slice(v-i),i=v;break}i=w,o=""}j=e.slice(f,f=c[g++]),k=Wd(c[g++],b)}}else for(var g=1;g<c.length;g+=2)b.addToken(b,e.slice(f,f=c[g]),Wd(c[g+1],b))}function ce(a,b,c,d,e){function f(a){return c?c[a]:null}function g(a,c,d){Pd(a,c,d,e),Qe(a,"change",a,b)}var h=b.from,i=b.to,j=b.text,k=le(a,h.line),l=le(a,i.line),m=_e(j),n=f(j.length-1),o=i.line-h.line;if(0==h.ch&&0==i.ch&&""==m){for(var p=0,q=j.length-1,r=[];q>p;++p)r.push(new Od(j[p],f(p),e));g(l,l.text,n),o&&a.remove(h.line,o),r.length&&a.insert(h.line,r)}else if(k==l)if(1==j.length)g(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{for(var r=[],p=1,q=j.length-1;q>p;++p)r.push(new Od(j[p],f(p),e));r.push(new Od(m+k.text.slice(i.ch),n,e)),g(k,k.text.slice(0,h.ch)+j[0],f(0)),a.insert(h.line+1,r)}else if(1==j.length)g(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),f(0)),a.remove(h.line+1,o);else{g(k,k.text.slice(0,h.ch)+j[0],f(0)),g(l,m+l.text.slice(i.ch),n);for(var p=1,q=j.length-1,r=[];q>p;++p)r.push(new Od(j[p],f(p),e));o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,r)}Qe(a,"change",a,b),Lc(a,d.anchor,d.head,null,!0)}function de(a){this.lines=a,this.parent=null;for(var b=0,c=a.length,d=0;c>b;++b)a[b].parent=this,d+=a[b].height;this.height=d}function ee(a){this.children=a;for(var b=0,c=0,d=0,e=a.length;e>d;++d){var f=a[d];b+=f.chunkSize(),c+=f.height,f.parent=this}this.size=b,this.height=c,this.parent=null}function je(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;g<a.linked.length;++g){var h=a.linked[g];if(h.doc!=e){var i=f&&h.sharedHist;(!c||i)&&(b(h.doc,i),d(h.doc,a,i))}}}d(a,null,!0)}function ke(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,C(a),z(a),a.options.lineWrapping||I(a),a.options.mode=b.modeOption,Ib(a)}function le(a,b){for(b-=a.first;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(e>b){a=d;break}b-=e}return a.lines[b]}function me(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function ne(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function oe(a,b){for(var c=b-a.height,d=a;d;d=d.parent)d.height+=c}function pe(a){if(null==a.parent)return null;for(var b=a.parent,c=bf(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c+b.first}function qe(a,b){var c=a.first;a:do{for(var d=0,e=a.children.length;e>d;++d){var f=a.children[d],g=f.height;if(g>b){a=f;continue a}b-=g,c+=f.chunkSize()}return c}while(!a.lines);for(var d=0,e=a.lines.length;e>d;++d){var h=a.lines[d],i=h.height;if(i>b)break;b-=i}return c+d}function re(a,b){b=Fd(a.doc,b);for(var c=0,d=b.parent,e=0;e<d.lines.length;++e){var f=d.lines[e];if(f==b)break;c+=f.height}for(var g=d.parent;g;d=g,g=d.parent)for(var e=0;e<g.children.length;++e){var h=g.children[e];if(h==d)break;c+=h.height}return c}function se(a){var b=a.order;return null==b&&(b=a.order=Nf(a.text)),b}function te(a){return{done:[],undone:[],undoDepth:1/0,lastTime:0,lastOp:null,lastOrigin:null,generation:a||1,maxGeneration:a||1}}function ue(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(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function ve(a,b){var c={line:b.from.line,ch:b.from.ch},d={from:c,to:qc(b),text:me(a,b.from,b.to)};return ue(a,d,b.from.line,b.to.line+1),je(a,function(a){ue(a,d,b.from.line,b.to.line+1)},!0),d}function we(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,g=_e(e.done);if(g&&(e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))){var h=_e(g.changes);Cc(b.from,b.to)&&Cc(b.from,h.to)?h.to=qc(b):g.changes.push(ve(a,b)),g.anchorAfter=c.anchor,g.headAfter=c.head}else for(g={changes:[ve(a,b)],generation:e.generation,anchorBefore:a.sel.anchor,headBefore:a.sel.head,anchorAfter:c.anchor,headAfter:c.head},e.done.push(g),e.generation=++e.maxGeneration;e.done.length>e.undoDepth;)e.done.shift();e.lastTime=f,e.lastOp=d,e.lastOrigin=b.origin}function xe(a){if(!a)return null;for(var c,b=0;b<a.length;++b)a[b].marker.explicitlyCleared?c||(c=a.slice(0,b)):c&&c.push(a[b]);return c?c.length?c:null:a}function ye(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=0,e=[];d<b.text.length;++d)e.push(xe(c[d]));return e}function ze(a,b){for(var c=0,d=[];c<a.length;++c){var e=a[c],f=e.changes,g=[];d.push({changes:g,anchorBefore:e.anchorBefore,headBefore:e.headBefore,anchorAfter:e.anchorAfter,headAfter:e.headAfter});for(var h=0;h<f.length;++h){var j,i=f[h];if(g.push({from:i.from,to:i.to,text:i.text}),b)for(var k in i)(j=k.match(/^spans_(\d+)$/))&&bf(b,Number(j[1]))>-1&&(_e(g)[k]=i[k],delete i[k])}}return d}function Ae(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Be(a,b,c,d){for(var e=0;e<a.length;++e){for(var f=a[e],g=!0,h=0;h<f.changes.length;++h){var i=f.changes[h];if(f.copied||(i.from=Ec(i.from),i.to=Ec(i.to)),c<i.from.line)i.from.line+=d,i.to.line+=d;else if(b<=i.to.line){g=!1;break}}f.copied||(f.anchorBefore=Ec(f.anchorBefore),f.headBefore=Ec(f.headBefore),f.anchorAfter=Ec(f.anchorAfter),f.readAfter=Ec(f.headAfter),f.copied=!0),g?(Ae(f.anchorBefore),Ae(f.headBefore),Ae(f.anchorAfter),Ae(f.headAfter)):(a.splice(0,e+1),e=0)}}function Ce(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Be(a.done,c,d,e),Be(a.undone,c,d,e)}function De(){Ie(this)}function Ee(a){return a.stop||(a.stop=De),a}function Fe(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Ge(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function He(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Ie(a){Fe(a),Ge(a)}function Je(a){return a.target||a.srcElement}function Ke(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),q&&a.ctrlKey&&1==b&&(b=3),b}function Le(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a._handlers||(a._handlers={}),e=d[b]||(d[b]=[]);e.push(c)}}function Me(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=a._handlers&&a._handlers[b];if(!d)return;for(var e=0;e<d.length;++e)if(d[e]==c){d.splice(e,1);break}}}function Ne(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function Qe(a,b){function e(a){return function(){a.apply(null,d)}}var c=a._handlers&&a._handlers[b];if(c){var d=Array.prototype.slice.call(arguments,2);Oe||(++Pe,Oe=[],setTimeout(Se,0));for(var f=0;f<c.length;++f)Oe.push(e(c[f]))}}function Re(a,b,c){return Ne(a,c||b.type,a,b),He(b)||b.codemirrorIgnore}function Se(){--Pe;var a=Oe;Oe=null;for(var b=0;b<a.length;++b)a[b]()}function Te(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function Ue(a){a.prototype.on=function(a,b){Le(this,a,b)},a.prototype.off=function(a,b){Me(this,a,b)}}function Xe(){this.id=null}function Ye(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var f=d||0,g=e||0;b>f;++f)" "==a.charAt(f)?g+=c-g%c:++g;return g}function $e(a){for(;Ze.length<=a;)Ze.push(_e(Ze)+" ");return Ze[a]}function _e(a){return a[a.length-1]}function af(a){if(o)a.selectionStart=0,a.selectionEnd=a.value.length;else try{a.select()}catch(b){}}function bf(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;d>c;++c)if(a[c]==b)return c;return-1}function cf(a,b){function c(){}c.prototype=a;var d=new c;return b&&df(b,d),d}function df(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function ef(a){for(var b=[],c=0;a>c;++c)b.push(void 0);return b}function ff(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function hf(a){return/\w/.test(a)||a>"\x80"&&(a.toUpperCase()!=a.toLowerCase()||gf.test(a))}function jf(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function lf(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)of(e,b);else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function mf(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function nf(a,b){return mf(a).appendChild(b)}function of(a,b){d?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function pf(a){return a.getBoundingClientRect()}function rf(){return!1}function tf(a){if(null!=sf)return sf;var b=lf("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return nf(a,b),b.offsetWidth&&(sf=b.offsetHeight-b.clientHeight),sf||0}function vf(a){if(null==uf){var b=lf("span","\u200b");nf(a,lf("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(uf=b.offsetWidth<=1&&b.offsetHeight>2&&!c)}return uf?lf("span","\u200b"):lf("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px")}function Af(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];(g.from<c&&g.to>b||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function Bf(a){return a.level%2?a.to:a.from}function Cf(a){return a.level%2?a.from:a.to}function Df(a){var b=se(a);return b?Bf(b[0]):0}function Ef(a){var b=se(a);return b?Cf(_e(b)):a.text.length}function Ff(a,b){var c=le(a.doc,b),d=Fd(a.doc,c);d!=c&&(b=pe(d));var e=se(d),f=e?e[0].level%2?Ef(d):Df(d):0;return Bc(b,f)}function Gf(a,b){for(var c,d;c=Ed(d=le(a.doc,b));)b=c.find().to.line;var e=se(d),f=e?e[0].level%2?Df(d):Ef(d):d.text.length;return Bc(b,f)}function Hf(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function Jf(a,b){for(var d,c=0;c<a.length;++c){var e=a[c];if(e.from<b&&e.to>b)return If=null,c;if(e.from==b||e.to==b){if(null!=d)return Hf(a,e.level,a[d].level)?(If=d,c):(If=c,d);d=c}}return If=null,d}function Kf(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&kf.test(a.text.charAt(b)));return b}function Lf(a,b,c,d){var e=se(a);if(!e)return Mf(a,b,c,d);for(var f=Jf(e,b),g=e[f],h=Kf(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h<g.to)return h;if(h==g.from||h==g.to)return Jf(e,h)==f?h:(g=e[f+=c],c>0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?Kf(a,g.to,-1,d):Kf(a,g.from,1,d)}}function Mf(a,b,c,d){var e=b+c;if(d)for(;e>0&&kf.test(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var a=/gecko\/\d/i.test(navigator.userAgent),b=/MSIE \d/.test(navigator.userAgent),c=b&&(null==document.documentMode||document.documentMode<8),d=b&&(null==document.documentMode||document.documentMode<9),e=/Trident\/([7-9]|\d{2,})\./,f=/WebKit\//.test(navigator.userAgent),g=f&&/Qt\/\d+\.\d+/.test(navigator.userAgent),h=/Chrome\//.test(navigator.userAgent),i=/Opera\//.test(navigator.userAgent),j=/Apple Computer/.test(navigator.vendor),k=/KHTML\//.test(navigator.userAgent),l=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),m=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),n=/PhantomJS/.test(navigator.userAgent),o=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),p=o||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),q=o||/Mac/.test(navigator.platform),r=/win/i.test(navigator.platform),s=i&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);s&&(s=Number(s[1])),s&&s>=15&&(i=!1,f=!0);var zb,Sb,Tb,t=q&&(g||i&&(null==s||12.11>s)),u=a||b&&!d,v=!1,w=!1,Cb=0,Yb=0,bc=0,cc=null;b?cc=-.53:a?cc=15:h?cc=-.7:j&&(cc=-1/3);var gc,oc,jc=null,qc=x.changeEnd=function(a){return a.text?Bc(a.from.line+a.text.length-1,_e(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};x.Pos=Bc,x.prototype={constructor:x,focus:function(){window.focus(),Nb(this),Kb(this)},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,$c.hasOwnProperty(a)&&Fb(this,$c[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||"string"!=typeof b[c]&&b[c].name==a)return b.splice(c,1),!0},addOverlay:Fb(null,function(a,b){var c=a.token?a:x.getMode(this.options,a);if(c.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque}),this.state.modeGen++,Ib(this)}),removeOverlay:Fb(null,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)return b.splice(c,1),this.state.modeGen++,Ib(this),void 0}}),indentLine:Fb(null,function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),Ic(this.doc,a)&&Uc(this,a,b,c)}),indentSelection:Fb(null,function(a){var b=this.doc.sel;if(Cc(b.from,b.to))return Uc(this,b.from.line,a);for(var c=b.to.line-(b.to.ch?0:1),d=b.from.line;c>=d;++d)Uc(this,d,a)}),getTokenAt:function(a,b){var c=this.doc;a=Gc(c,a);for(var d=eb(this,a.line,b),e=this.doc.mode,f=le(c,a.line),g=new pd(f.text,this.options.tabSize);g.pos<a.ch&&!g.eol();){g.start=g.pos;var h=e.token(g,d)}return{start:g.start,end:g.pos,string:g.current(),className:h||null,type:h||null,state:d}},getTokenTypeAt:function(a){a=Gc(this.doc,a);var b=Td(this,le(this.doc,a.line)),c=0,d=(b.length-1)/2,e=a.ch;if(0==e)return b[2];for(;;){var f=c+d>>1;if((f?b[2*f-1]:0)>=e)d=f;else{if(!(b[2*f+1]<e))return b[2*f+2];c=f+1}}},getModeAt:function(a){var b=this.doc.mode;return b.innerMode?x.innerMode(b,this.getTokenAt(a).state).mode:b},getHelper:function(a,b){if(gd.hasOwnProperty(b)){var c=gd[b],d=this.getModeAt(a);return d[b]&&c[d[b]]||d.helperType&&c[d.helperType]||c[d.name]}},getStateAfter:function(a,b){var c=this.doc;return a=Fc(c,null==a?c.first+c.size-1:a),eb(this,a+1,b)},cursorCoords:function(a,b){var c,d=this.doc.sel;return c=null==a?d.head:"object"==typeof a?Gc(this.doc,a):a?d.from:d.to,vb(this,c,b||"page")},charCoords:function(a,b){return ub(this,Gc(this.doc,a),b||"page")},coordsChar:function(a,b){return a=tb(this,a,b||"page"),xb(this,a.left,a.top)},lineAtHeight:function(a,b){return a=tb(this,{top:a,left:0},b||"page").top,qe(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=!1,d=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>d&&(a=d,c=!0);var e=le(this.doc,a);return sb(this,le(this.doc,a),{top:0,left:0},b||"page").top+(c?e.height:0)},defaultTextHeight:function(){return Ab(this.display)},defaultCharWidth:function(){return Bb(this.display)},setGutterMarker:Fb(null,function(a,b,c){return Vc(this,a,function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&jf(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Fb(null,function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Ib(b,d,d+1),jf(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineClass:Fb(null,function(a,b,c){return Vc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[d]){if(new RegExp("(?:^|\\s)"+c+"(?:$|\\s)").test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:Fb(null,function(a,b,c){return Vc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.match(new RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!f)return!1;var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(f.index&&g!=e.length?" ":"")+e.slice(g)||null}return!0})}),addLineWidget:Fb(null,function(a,b,c){return Nd(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!Ic(this.doc,a))return null;var b=a;if(a=le(this.doc,a),!a)return null}else{var b=pe(a);if(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}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=vb(this,Gc(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Qc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Fb(null,kc),execCommand:function(a){return jd[a](this)},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=Gc(this.doc,a);b>f&&(g=Wc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Fb(null,function(a,b){var d,c=this.doc.sel;d=c.shift||c.extend||Cc(c.from,c.to)?Wc(this.doc,c.head,a,b,this.options.rtlMoveVisually):0>a?c.from:c.to,Jc(this.doc,d,d,a)}),deleteH:Fb(null,function(a,b){var c=this.doc.sel;Cc(c.from,c.to)?Ac(this.doc,"",c.from,Wc(this.doc,c.head,a,b,!1),"+delete"):Ac(this.doc,"",c.from,c.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=Gc(this.doc,a);b>g;++g){var i=vb(this,h,"div");if(null==f?f=i.left:i.left=f,h=Xc(this,i,e,c),h.hitSide)break}return h},moveV:Fb(null,function(a,b){var c=this.doc.sel,d=vb(this,c.head,"div");null!=c.goalColumn&&(d.left=c.goalColumn);var e=Xc(this,d,a,b);"page"==b&&Tc(this,0,ub(this,e,"div").top-d.top),Jc(this.doc,e,e,a),c.goalColumn=d.left}),toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:Fb(null,function(a,b){Sc(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller,b=Ve;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:Fb(null,function(a,b){null==a?a={from:this.doc.sel.head,to:null}:"number"==typeof a?a={from:Bc(a,0),to:null}:null==a.from&&(a={from:a,to:null}),a.to||(a.to=a.from),b||(b=0);var c=a;null!=a.from.line&&(this.curOp.scrollToPos={from:a.from,to:a.to,margin:b},c={from:vb(this,a.from),to:vb(this,a.to)});var d=Rc(this,Math.min(c.from.left,c.to.left),Math.min(c.from.top,c.to.top)-b,Math.max(c.from.right,c.to.right),Math.max(c.from.bottom,c.to.bottom)+b);Sc(this,d.scrollLeft,d.scrollTop)}),setSize:Fb(null,function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a)),null!=b&&(this.display.wrapper.style.height=c(b)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(a){return Hb(this,a)},refresh:Fb(null,function(){var a=null==this.display.cachedTextHeight;pb(this),Sc(this,this.doc.scrollLeft,this.doc.scrollTop),Ib(this),a&&C(this)}),swapDoc:Fb(null,function(a){var b=this.doc;return b.cm=null,ke(this,a),pb(this),Mb(this,!0),Sc(this,a.scrollLeft,a.scrollTop),Qe(this,"swapDoc",this,b),b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ue(x);var $c=x.optionHandlers={},_c=x.defaults={},bd=x.Init={toString:function(){return"CodeMirror.Init"}};ad("value","",function(a,b){a.setValue(b)},!0),ad("mode",null,function(a,b){a.doc.modeOption=b,z(a)},!0),ad("indentUnit",2,z,!0),ad("indentWithTabs",!1),ad("smartIndent",!0),ad("tabSize",4,function(a){z(a),pb(a),Ib(a)},!0),ad("electricChars",!0),ad("rtlMoveVisually",!r),ad("theme","default",function(a){E(a),F(a)},!0),ad("keyMap","default",D),ad("extraKeys",null),ad("onKeyEvent",null),ad("onDragEvent",null),ad("lineWrapping",!1,A,!0),ad("gutters",[],function(a){J(a.options),F(a)},!0),ad("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?P(a.display)+"px":"0",a.refresh()},!0),ad("coverGutterNextToScrollbar",!1,K,!0),ad("lineNumbers",!1,function(a){J(a.options),F(a)},!0),ad("firstLineNumber",1,F,!0),ad("lineNumberFormatter",function(a){return a},F,!0),ad("showCursorWhenSelecting",!1,Z,!0),ad("resetSelectionOnContextMenu",!0),ad("readOnly",!1,function(a,b){"nocursor"==b?(nc(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||Mb(a,!0))}),ad("dragDrop",!0),ad("cursorBlinkRate",530),ad("cursorScrollMargin",0),ad("cursorHeight",1),ad("workTime",100),ad("workDelay",100),ad("flattenSpans",!0),ad("pollInterval",100),ad("undoDepth",40,function(a,b){a.doc.history.undoDepth=b}),ad("historyEventDelay",500),ad("viewportMargin",10,function(a){a.refresh()},!0),ad("maxHighlightLength",1e4,function(a){z(a),a.refresh()},!0),ad("crudeMeasuringFrom",1e4),ad("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),ad("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),ad("autofocus",null);var cd=x.modes={},dd=x.mimeModes={};x.defineMode=function(a,b){if(x.defaults.mode||"null"==a||(x.defaults.mode=a),arguments.length>2){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}cd[a]=b},x.defineMIME=function(a,b){dd[a]=b},x.resolveMode=function(a){if("string"==typeof a&&dd.hasOwnProperty(a))a=dd[a];else if(a&&"string"==typeof a.name&&dd.hasOwnProperty(a.name)){var b=dd[a.name];a=cf(b,a),a.name=b.name}else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return x.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}},x.getMode=function(a,b){var b=x.resolveMode(b),c=cd[b.name];if(!c)return x.getMode(a,"text/plain");var d=c(a,b);if(ed.hasOwnProperty(b.name)){var e=ed[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}return d.name=b.name,d},x.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),x.defineMIME("text/plain","null");var ed=x.modeExtensions={};x.extendMode=function(a,b){var c=ed.hasOwnProperty(a)?ed[a]:ed[a]={};df(b,c)},x.defineExtension=function(a,b){x.prototype[a]=b},x.defineDocExtension=function(a,b){ge.prototype[a]=b},x.defineOption=ad;var fd=[];x.defineInitHook=function(a){fd.push(a)};var gd=x.helpers={};x.registerHelper=function(a,b,c){gd.hasOwnProperty(a)||(gd[a]=x[a]={}),gd[a][b]=c},x.isWordChar=hf,x.copyState=hd,x.startState=id,x.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var jd=x.commands={selectAll:function(a){a.setSelection(Bc(a.firstLine(),0),Bc(a.lastLine()))},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),d=!Cc(b,c);d||a.getLine(b.line).length!=b.ch?a.replaceRange("",b,d?c:Bc(b.line),"+delete"):a.replaceRange("",b,Bc(b.line+1,0),"+delete")},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",Bc(b,0),Bc(b),"+delete")},delLineLeft:function(a){var b=a.getCursor();a.replaceRange("",Bc(b.line,0),b,"+delete")},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.extendSelection(Bc(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(Bc(a.lastLine()))},goLineStart:function(a){a.extendSelection(Ff(a,a.getCursor().line))},goLineStartSmart:function(a){var b=a.getCursor(),c=Ff(a,b.line),d=a.getLineHandle(c.line),e=se(d);if(e&&0!=e[0].level)a.extendSelection(c);else{var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;a.extendSelection(Bc(c.line,g?0:f))}},goLineEnd:function(a){a.extendSelection(Gf(a,a.getCursor().line))},goLineRight:function(a){var b=a.charCoords(a.getCursor(),"div").top+5;a.extendSelection(a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div"))},goLineLeft:function(a){var b=a.charCoords(a.getCursor(),"div").top+5;a.extendSelection(a.coordsChar({left:0,top:b},"div"))},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection(" ","end","+input")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.replaceSelection(" ","end","+input")},transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);b.ch>0&&b.ch<c.length-1&&a.replaceRange(c.charAt(b.ch)+c.charAt(b.ch-1),Bc(b.line,b.ch-1),Bc(b.line,b.ch+1))},newlineAndIndent:function(a){Fb(a,function(){a.replaceSelection("\n","end","+input"),a.indentLine(a.getCursor().line,null,!0)})()},toggleOverwrite:function(a){a.toggleOverwrite()}},kd=x.keyMap={};kd.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"},kd.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","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",fallthrough:"basic"},kd.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","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":"delLineLeft",fallthrough:["basic","emacsy"]},kd["default"]=q?kd.macDefault:kd.pcDefault,kd.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"},x.lookupKey=md,x.isModifierKey=nd,x.keyName=od,x.fromTextArea=function(a,b){function e(){a.value=i.getValue()}if(b||(b={}),b.value=a.value,!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex),!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder),null==b.autofocus){var c=document.body;try{c=document.activeElement}catch(d){}b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(Le(a.form,"submit",e),!b.leaveSubmitMethodAlone)){var f=a.form,g=f.submit;try{var h=f.submit=function(){e(),f.submit=g,f.submit(),f.submit=h}}catch(d){}}a.style.display="none";var i=x(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);return i.save=e,i.getTextArea=function(){return a},i.toTextArea=function(){e(),a.parentNode.removeChild(i.getWrapperElement()),a.style.display="",a.form&&(Me(a.form,"submit",e),"function"==typeof a.form.submit&&(a.form.submit=g))},i},pd.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a)var c=b==a;else var c=b&&(a.test?a.test(b):a(b));return c?(++this.pos,b):void 0},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Ye(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue},indentation:function(){return Ye(this.string,null,this.tabSize)},match:function(a,b,c){if("string"!=typeof a){var f=this.string.slice(this.pos).match(a);return f&&f.index>0?null:(f&&b!==!1&&(this.pos+=f[0].length),f)}var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);return d(e)==d(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},x.StringStream=pd,x.TextMarker=qd,Ue(qd),qd.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&Db(a),Te(this,"clear")){var c=this.find();c&&Qe(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;f<this.lines.length;++f){var g=this.lines[f],h=ud(g.markedSpans,this);null!=h.to&&(e=pe(g)),g.markedSpans=vd(g.markedSpans,h),null!=h.from?d=pe(g):this.collapsed&&!Gd(this.doc,g)&&a&&oe(g,Ab(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var i=Fd(a.doc,this.lines[f]),j=H(a.doc,i);j>a.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&Ib(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Mc(a)),b&&Eb(a)}},qd.prototype.find=function(){for(var a,b,c=0;c<this.lines.length;++c){var d=this.lines[c],e=ud(d.markedSpans,this);if(null!=e.from||null!=e.to){var f=pe(d);null!=e.from&&(a=Bc(f,e.from)),null!=e.to&&(b=Bc(f,e.to))}}return"bookmark"==this.type?a:a&&{from:a,to:b}},qd.prototype.changed=function(){var a=this.find(),b=this.doc.cm;if(a&&b){"bookmark"!=this.type&&(a=a.from);var c=le(this.doc,a.line);if(kb(b,c),a.line>=b.display.showingFrom&&a.line<b.display.showingTo){for(var d=b.display.lineDiv.firstChild;d;d=d.nextSibling)if(d.lineObj==c){d.offsetHeight!=c.height&&oe(c,d.offsetHeight);break}Hb(b,function(){b.curOp.selectionChanged=b.curOp.forceUpdate=b.curOp.updateMaxLine=!0})}}},qd.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=bf(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},qd.prototype.detachLine=function(a){if(this.lines.splice(bf(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;
5
- (b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}},x.SharedTextMarker=sd,Ue(sd),sd.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();Qe(this,"clear")}},sd.prototype.find=function(){return this.primary.find()};var Kd=x.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.cm=a,this.node=b};Ue(Kd),Kd.prototype.clear=Ld(function(){var a=this.line.widgets,b=pe(this.line);if(null!=b&&a){for(var c=0;c<a.length;++c)a[c]==this&&a.splice(c--,1);a.length||(this.line.widgets=null);var d=re(this.cm,this.line)<this.cm.doc.scrollTop;oe(this.line,Math.max(0,this.line.height-Md(this))),d&&Tc(this.cm,0,-this.height),Ib(this.cm,b,b+1)}}),Kd.prototype.changed=Ld(function(){var a=this.height;this.height=null;var b=Md(this)-a;if(b){oe(this.line,this.line.height+b);var c=pe(this.line);Ib(this.cm,c,c+1)}});var Od=x.Line=function(a,b,c){this.text=a,Jd(this,b),this.height=c?c(this):1};Ue(Od);var Vd={},Yd=/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\uFEFF]/g;de.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;d>c;++c){var e=this.lines[c];this.height-=e.height,Qd(e),Qe(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(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(var d=0,e=b.length;e>d;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;d>a;++a)if(c(this.lines[a]))return!0}},ee.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(e>a){var f=Math.min(b,e-a),g=d.height;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}if(this.size-b<25){var h=[];this.collapse(h),this.children=[new de(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0,c=this.children.length;c>b;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();if(g>=a){if(f.insertInner(a,b,c),f.lines&&f.lines.length>50){for(;f.lines.length>50;){var h=f.lines.splice(f.lines.length-25,25),i=new de(h);f.height-=i.height,this.children.splice(d+1,0,i),i.parent=this}this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new ee(b);if(a.parent){a.size-=c.size,a.height-=c.height;var e=bf(a.parent.children,a);a.parent.children.splice(e+1,0,c)}else{var d=new ee(a.children);d.parent=a,a.children=[d,c],a=d}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();if(g>a){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if(0==(b-=h))break;a=0}else a-=g}}};var fe=0,ge=x.Doc=function(a,b,c){if(!(this instanceof ge))return new ge(a,b,c);null==c&&(c=0),ee.call(this,[new de([new Od("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=te(),this.cleanGeneration=1,this.frontier=c;var d=Bc(c,0);this.sel={from:d,to:d,head:d,anchor:d,shift:!1,extend:!1,goalColumn:null},this.id=++fe,this.modeOption=b,"string"==typeof a&&(a=wf(a)),ce(this,{from:d,to:d,text:a},null,{head:d,anchor:d})};ge.prototype=cf(ee.prototype,{constructor:ge,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,e=b.length;e>d;++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=ne(this,this.first,this.first+this.size);return a===!1?b:b.join(a||"\n")},setValue:function(a){var b=Bc(this.first,0),c=this.first+this.size-1;uc(this,{from:b,to:Bc(c,le(this,c).text.length),text:wf(a),origin:"setValue"},{head:b,anchor:b},!0)},replaceRange:function(a,b,c,d){b=Gc(this,b),c=c?Gc(this,c):b,Ac(this,a,b,c,d)},getRange:function(a,b,c){var d=me(this,Gc(this,a),Gc(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},setLine:function(a,b){Ic(this,a)&&Ac(this,b,Bc(a,0),Gc(this,Bc(a)))},removeLine:function(a){a?Ac(this,"",Gc(this,Bc(a-1)),Gc(this,Bc(a))):Ac(this,"",Bc(0,0),Gc(this,Bc(1,0)))},getLineHandle:function(a){return Ic(this,a)?le(this,a):void 0},getLineNumber:function(a){return pe(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=le(this,a)),Fd(this,a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return Gc(this,a)},getCursor:function(a){var c,b=this.sel;return c=null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||a===!1?b.to:b.from,Ec(c)},somethingSelected:function(){return!Cc(this.sel.head,this.sel.anchor)},setCursor:Gb(function(a,b,c){var d=Gc(this,"number"==typeof a?Bc(a,b||0):a);c?Jc(this,d):Lc(this,d,d)}),setSelection:Gb(function(a,b,c){Lc(this,Gc(this,a),Gc(this,b||a),c)}),extendSelection:Gb(function(a,b,c){Jc(this,Gc(this,a),b&&Gc(this,b),c)}),getSelection:function(a){return this.getRange(this.sel.from,this.sel.to,a)},replaceSelection:function(a,b,c){uc(this,{from:this.sel.from,to:this.sel.to,text:wf(a),origin:c},b||"around")},undo:Gb(function(){wc(this,"undo")}),redo:Gb(function(){wc(this,"redo")}),setExtending:function(a){this.sel.extend=a},historySize:function(){var a=this.history;return{undo:a.done.length,redo:a.undone.length}},clearHistory:function(){this.history=te(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){return this.history.lastOp=this.history.lastOrigin=null,this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:ze(this.history.done),undone:ze(this.history.undone)}},setHistory:function(a){var b=this.history=te(this.history.maxGeneration);b.done=a.done.slice(0),b.undone=a.undone.slice(0)},markText:function(a,b,c){return rd(this,Gc(this,a),Gc(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft};return a=Gc(this,a),rd(this,a,a,c,"bookmark")},findMarksAt:function(a){a=Gc(this,a);var b=[],c=le(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},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;d<c.length;++d)null!=c[d].from&&a.push(c[d].marker)}),a},posFromIndex:function(a){var b,c=this.first;return this.iter(function(d){var e=d.text.length+1;return e>a?(b=a,!0):(a-=e,++c,void 0)}),Gc(this,Bc(c,b))},indexFromPos:function(a){a=Gc(this,a);var b=a.ch;return a.line<this.first||a.ch<0?0:(this.iter(this.first,a.line,function(a){b+=a.text.length+1}),b)},copy:function(a){var b=new ge(ne(this,this.first,this.first+this.size),this.modeOption,this.first);return b.scrollTop=this.scrollTop,b.scrollLeft=this.scrollLeft,b.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:!1,goalColumn:this.sel.goalColumn},a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory())),b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from),null!=a.to&&a.to<c&&(c=a.to);var d=new ge(ne(this,b,c),a.mode||this.modeOption,b);return a.sharedHist&&(d.history=this.history),(this.linked||(this.linked=[])).push({doc:d,sharedHist:a.sharedHist}),d.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}],d},unlinkDoc:function(a){if(a instanceof x&&(a=a.doc),this.linked)for(var b=0;b<this.linked.length;++b){var c=this.linked[b];if(c.doc==a){this.linked.splice(b,1),a.unlinkDoc(this);break}}if(a.history==this.history){var d=[a.id];je(a,function(a){d.push(a.id)},!0),a.history=te(),a.history.done=ze(this.history.done,d),a.history.undone=ze(this.history.undone,d)}},iterLinkedDocs:function(a){je(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),ge.prototype.eachLine=ge.prototype.iter;var he="iter insert remove copy getEditor".split(" ");for(var ie in ge.prototype)ge.prototype.hasOwnProperty(ie)&&bf(he,ie)<0&&(x.prototype[ie]=function(a){return function(){return a.apply(this.doc,arguments)}}(ge.prototype[ie]));Ue(ge),x.e_stop=Ie,x.e_preventDefault=Fe,x.e_stopPropagation=Ge;var Oe,Pe=0;x.on=Le,x.off=Me,x.signal=Ne;var Ve=30,We=x.Pass={toString:function(){return"CodeMirror.Pass"}};Xe.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}},x.countColumn=Ye;var Ze=[""],gf=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,kf=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\u1DC0\u2013\u1DFF\u20D0\u2013\u20FF\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff\uFE20\u2013\uFE2F]/;x.replaceGetRect=function(a){pf=a};var qf=function(){if(d)return!1;var a=lf("div");return"draggable"in a||"dragDrop"in a}();a?rf=function(a,b){return 36==a.charCodeAt(b-1)&&39==a.charCodeAt(b)}:j&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?rf=function(a,b){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(a.slice(b-1,b+1))}:f&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)?rf=function(a,b){var c=a.charCodeAt(b-1);return c>=8208&&8212>=c}:f&&(rf=function(a,b){if(b>1&&45==a.charCodeAt(b-1)){if(/\w/.test(a.charAt(b-2))&&/[^\-?\.]/.test(a.charAt(b)))return!0;if(b>2&&/[\d\.,]/.test(a.charAt(b-2))&&/[\d\.,]/.test(a.charAt(b)))return!1}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|\u2026[\w~`@#$%\^&*(_=+{[><]/.test(a.slice(b-1,b+1))});var sf,uf,wf=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;d>=b;){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/)};x.splitLines=wf;var xf=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},yf=function(){var a=lf("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),zf={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};x.keyNames=zf,function(){for(var a=0;10>a;a++)zf[a+48]=String(a);for(var a=65;90>=a;a++)zf[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)zf[a+111]=zf[a+63235]="F"+a}();var If,Nf=function(){function c(c){return 255>=c?a.charAt(c):c>=1424&&1524>=c?"R":c>=1536&&1791>=c?b.charAt(c-1536):c>=1792&&2220>=c?"r":"L"}var a="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",b="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/,i="L";return function(a){if(!d.test(a))return!1;for(var l,b=a.length,j=[],k=0;b>k;++k)j.push(l=c(a.charCodeAt(k)));for(var k=0,m=i;b>k;++k){var l=j[k];"m"==l?j[k]=m:m=l}for(var k=0,n=i;b>k;++k){var l=j[k];"1"==l&&"r"==n?j[k]="n":f.test(l)&&(n=l,"r"==l&&(j[k]="R"))}for(var k=1,m=j[0];b-1>k;++k){var l=j[k];"+"==l&&"1"==m&&"1"==j[k+1]?j[k]="1":","!=l||m!=j[k+1]||"1"!=m&&"n"!=m||(j[k]=m),m=l}for(var k=0;b>k;++k){var l=j[k];if(","==l)j[k]="N";else if("%"==l){for(var o=k+1;b>o&&"%"==j[o];++o);for(var p=k&&"!"==j[k-1]||b-1>o&&"1"==j[o]?"1":"N",q=k;o>q;++q)j[q]=p;k=o-1}}for(var k=0,n=i;b>k;++k){var l=j[k];"L"==n&&"1"==l?j[k]="L":f.test(l)&&(n=l)}for(var k=0;b>k;++k)if(e.test(j[k])){for(var o=k+1;b>o&&e.test(j[o]);++o);for(var r="L"==(k?j[k-1]:i),s="L"==(b-1>o?j[o]:i),p=r||s?"L":"R",q=k;o>q;++q)j[q]=p;k=o-1}for(var u,t=[],k=0;b>k;)if(g.test(j[k])){var v=k;for(++k;b>k&&g.test(j[k]);++k);t.push({from:v,to:k,level:0})}else{var w=k,x=t.length;for(++k;b>k&&"L"!=j[k];++k);for(var q=w;k>q;)if(h.test(j[q])){q>w&&t.splice(x,0,{from:w,to:q,level:1});var y=q;for(++q;k>q&&h.test(j[q]);++q);t.splice(x,0,{from:y,to:q,level:2}),w=q}else++q;k>w&&t.splice(x,0,{from:w,to:k,level:1})}return 1==t[0].level&&(u=a.match(/^\s+/))&&(t[0].from=u[0].length,t.unshift({from:0,to:u[0].length,level:0})),1==_e(t).level&&(u=a.match(/\s+$/))&&(_e(t).to-=u[0].length,t.push({from:b-u[0].length,to:b,level:0})),t[0].level!=_e(t).level&&t.push({from:b,to:b,level:t[0].level}),t}}();return x.version="3.19.1",x}(),CodeMirror.defineMode("css",function(a,b){"use strict";function l(a,b){return k=b,a}function m(a,b){var c=a.next();if(d[c]){var e=d[c](a,b);if(e!==!1)return e}if("@"==c)return a.eatWhile(/[\w\\\-]/),l("def",a.current());if("="==c)l(null,"compare");else{if(("~"==c||"|"==c)&&a.eat("="))return l(null,"compare");if('"'==c||"'"==c)return b.tokenize=n(c),b.tokenize(a,b);if("#"==c)return a.eatWhile(/[\w\\\-]/),l("atom","hash");if("!"==c)return a.match(/^\s*\w*/),l("keyword","important");if(/\d/.test(c)||"."==c&&a.eat(/\d/))return a.eatWhile(/[\w.%]/),l("number","unit");if("-"!==c)return/[,+>*\/]/.test(c)?l(null,"select-op"):"."==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?l("qualifier","qualifier"):":"==c?l("operator",c):/[;{}\[\]\(\)]/.test(c)?l(null,c):"u"==c&&a.match("rl(")?(a.backUp(1),b.tokenize=o,l("property","variable")):(a.eatWhile(/[\w\\\-]/),l("property","variable"));if(/\d/.test(a.peek()))return a.eatWhile(/[\w.%]/),l("number","unit");if(a.match(/^[^-]+-/))return l("meta","meta")}}function n(a,b){return function(c,d){for(var f,e=!1;null!=(f=c.next())&&(f!=a||e);)e=!e&&"\\"==f;return e||(b&&c.backUp(1),d.tokenize=m),l("string","string")}}function o(a,b){return a.next(),b.tokenize=a.match(/\s*[\"\']/,!1)?m:n(")",!0),l(null,"(")}b.propertyKeywords||(b=CodeMirror.resolveMode("text/css"));var c=a.indentUnit||a.tabSize||2,d=b.hooks||{},e=b.atMediaTypes||{},f=b.atMediaFeatures||{},g=b.propertyKeywords||{},h=b.colorKeywords||{},i=b.valueKeywords||{},j=!!b.allowNested,k=null;return{startState:function(a){return{tokenize:m,baseIndent:a||0,stack:[],lastToken:null}},token:function(a,b){if(b.tokenize=b.tokenize||m,b.tokenize==m&&a.eatSpace())return null;var c=b.tokenize(a,b);c&&"string"!=typeof c&&(c=l(c[0],c[1]));var d=b.stack[b.stack.length-1];if("variable"==c)return"variable-definition"==k&&b.stack.push("propertyValue"),b.lastToken="variable-2";if("property"==c){var n=a.current().toLowerCase();"propertyValue"==d?c=i.hasOwnProperty(n)?"string-2":h.hasOwnProperty(n)?"keyword":"variable-2":"rule"==d?g.hasOwnProperty(n)||(c+=" error"):"block"==d?c=g.hasOwnProperty(n)?"property":h.hasOwnProperty(n)?"keyword":i.hasOwnProperty(n)?"string-2":"tag":d&&"@media{"!=d?"@media"==d?c=e[a.current()]?"attribute":/^(only|not)$/.test(n)?"keyword":"and"==n?"error":f.hasOwnProperty(n)?"error":"attribute error":"@mediaType"==d?c=e.hasOwnProperty(n)?"attribute":"and"==n?"operator":/^(only|not)$/.test(n)?"error":"error":"@mediaType("==d?g.hasOwnProperty(n)||(e.hasOwnProperty(n)?c="error":"and"==n?c="operator":/^(only|not)$/.test(n)?c="error":c+=" error"):c="@import"==d?"tag":"error":c="tag"}else"atom"==c?d&&"@media{"!=d&&"block"!=d?"propertyValue"==d?/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(a.current())||(c+=" error"):c="error":c="builtin":"@media"==d&&"{"==k&&(c="error");if("{"==k)if("@media"==d||"@mediaType"==d)b.stack[b.stack.length-1]="@media{";else{var o=j?"block":"rule";b.stack.push(o)}else if("}"==k)for("interpolation"==d&&(c="operator");b.stack.length;){var p=b.stack.pop();if(p.indexOf("{")>-1||"block"==p||"rule"==p)break}else if("interpolation"==k)b.stack.push("interpolation");else if("@media"==k)b.stack.push("@media");else if("@import"==k)b.stack.push("@import");else if("@media"==d&&/\b(keyword|attribute)\b/.test(c))b.stack[b.stack.length-1]="@mediaType";else if("@mediaType"==d&&","==a.current())b.stack[b.stack.length-1]="@media";else if("("==k)"@media"==d||"@mediaType"==d?(b.stack[b.stack.length-1]="@mediaType",b.stack.push("@mediaType(")):b.stack.push("(");else if(")"==k)for(;b.stack.length;){var p=b.stack.pop();if(p.indexOf("(")>-1)break}else":"==k&&"property"==b.lastToken?b.stack.push("propertyValue"):"propertyValue"==d&&";"==k?b.stack.pop():"@import"==d&&";"==k&&b.stack.pop();return b.lastToken=c},indent:function(a,b){var d=a.stack.length;return/^\}/.test(b)&&(d-="propertyValue"==a.stack[d-1]?2:1),a.baseIndent+d*c},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}}),function(){function a(a){for(var b={},c=0;c<a.length;++c)b[a[c]]=!0;return b}function g(a,b){for(var d,c=!1;null!=(d=a.next());){if(c&&"/"==d){b.tokenize=null;break}c="*"==d}return["comment","comment"]}var b=a(["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"]),c=a(["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"]),d=a(["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid-cell","grid-column","grid-column-align","grid-column-sizing","grid-column-span","grid-columns","grid-flow","grid-row","grid-row-align","grid-row-sizing","grid-row-span","grid-rows","grid-template","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-inside","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","zoom","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-profile","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","kerning","text-anchor","writing-mode"]),e=a(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),f=a(["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"]);CodeMirror.defineMIME("text/css",{atMediaTypes:b,atMediaFeatures:c,propertyKeywords:d,colorKeywords:e,valueKeywords:f,hooks:{"<":function(a,b){function c(a,b){for(var d,c=0;null!=(d=a.next());){if(c>=2&&">"==d){b.tokenize=null;break}c="-"==d?c+1:0}return["comment","comment"]}return a.eat("!")?(b.tokenize=c,c(a,b)):void 0},"/":function(a,b){return a.eat("*")?(b.tokenize=g,g(a,b)):!1}},name:"css"}),CodeMirror.defineMIME("text/x-scss",{atMediaTypes:b,atMediaFeatures:c,propertyKeywords:d,colorKeywords:e,valueKeywords:f,allowNested:!0,hooks:{":":function(a){return a.match(/\s*{/)?[null,"{"]:!1},$:function(a){return a.match(/^[\w-]+/),":"==a.peek()?["variable","variable-definition"]:["variable","variable"]},",":function(a,b){return"propertyValue"==b.stack[b.stack.length-1]&&a.match(/^ *\$/,!1)?["operator",";"]:void 0
6
- },"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=g,g(a,b)):["operator","operator"]},"#":function(a){return a.eat("{")?["operator","interpolation"]:(a.eatWhile(/[\w\\\-]/),["atom","hash"])}},name:"css"})}(),CodeMirror.defineMode("htmlmixed",function(a,b){function i(a,b){var f=b.htmlState.tagName,g=c.token(a,b.htmlState);if("script"==f&&/\btag\b/.test(g)&&">"==a.current()){var h=a.string.slice(Math.max(0,a.pos-100),a.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);h=h?h[1]:"",h&&/[\"\']/.test(h.charAt(0))&&(h=h.slice(1,h.length-1));for(var i=0;i<e.length;++i){var j=e[i];if("string"==typeof j.matches?h==j.matches:j.matches.test(h)){j.mode&&(b.token=k,b.localMode=j.mode,b.localState=j.mode.startState&&j.mode.startState(c.indent(b.htmlState,"")));break}}}else"style"==f&&/\btag\b/.test(g)&&">"==a.current()&&(b.token=l,b.localMode=d,b.localState=d.startState(c.indent(b.htmlState,"")));return g}function j(a,b,c){var f,d=a.current(),e=d.search(b);return e>-1?a.backUp(d.length-e):(f=d.match(/<\/?$/))&&(a.backUp(d.length),a.match(b,!1)||a.match(d)),c}function k(a,b){return a.match(/^<\/\s*script\s*>/i,!1)?(b.token=i,b.localState=b.localMode=null,i(a,b)):j(a,/<\/\s*script\s*>/,b.localMode.token(a,b.localState))}function l(a,b){return a.match(/^<\/\s*style\s*>/i,!1)?(b.token=i,b.localState=b.localMode=null,i(a,b)):j(a,/<\/\s*style\s*>/,d.token(a,b.localState))}var c=CodeMirror.getMode(a,{name:"xml",htmlMode:!0}),d=CodeMirror.getMode(a,"css"),e=[],f=b&&b.scriptTypes;if(e.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:CodeMirror.getMode(a,"javascript")}),f)for(var g=0;g<f.length;++g){var h=f[g];e.push({matches:h.matches,mode:h.mode&&CodeMirror.getMode(a,h.mode)})}return e.push({matches:/./,mode:CodeMirror.getMode(a,"text/plain")}),{startState:function(){var a=c.startState();return{token:i,localMode:null,localState:null,htmlState:a}},copyState:function(a){if(a.localState)var b=CodeMirror.copyState(a.localMode,a.localState);return{token:a.token,localMode:a.localMode,localState:b,htmlState:CodeMirror.copyState(c,a.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(a,b){return!a.localMode||/^\s*<\//.test(b)?c.indent(a.htmlState,b):a.localMode.indent?a.localMode.indent(a.localState,b):CodeMirror.Pass},electricChars:"/{}:",innerMode:function(a){return{state:a.localState||a.htmlState,mode:a.localMode||c}}}},"xml","javascript","css"),CodeMirror.defineMIME("text/html","htmlmixed"),CodeMirror.defineMode("javascript",function(a,b){function i(a,b){for(var d,c=!1;null!=(d=a.next());){if(d==b&&!c)return!1;c=!c&&"\\"==d}return c}function l(a,b,c){return j=a,k=c,b}function m(a,b){var c=a.next();if('"'==c||"'"==c)return b.tokenize=n(c),b.tokenize(a,b);if("."==c&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return l("number","number");if("."==c&&a.match(".."))return l("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(c))return l(c);if("="==c&&a.eat(">"))return l("=>");if("0"==c&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),l("number","number");if(/\d/.test(c))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),l("number","number");if("/"==c)return a.eat("*")?(b.tokenize=o,o(a,b)):a.eat("/")?(a.skipToEnd(),l("comment","comment")):"operator"==b.lastType||"keyword c"==b.lastType||"sof"==b.lastType||/^[\[{}\(,;:]$/.test(b.lastType)?(i(a,"/"),a.eatWhile(/[gimy]/),l("regexp","string-2")):(a.eatWhile(h),l("operator",null,a.current()));if("`"==c)return b.tokenize=p,p(a,b);if("#"==c)return a.skipToEnd(),l("error","error");if(h.test(c))return a.eatWhile(h),l("operator",null,a.current());a.eatWhile(/[\w\$_]/);var d=a.current(),e=g.propertyIsEnumerable(d)&&g[d];return e&&"."!=b.lastType?l(e.type,e.style,d):l("variable","variable",d)}function n(a){return function(b,c){return i(b,a)||(c.tokenize=m),l("string","string")}}function o(a,b){for(var d,c=!1;d=a.next();){if("/"==d&&c){b.tokenize=m;break}c="*"==d}return l("comment","comment")}function p(a,b){for(var d,c=!1;null!=(d=a.next());){if(!c&&("`"==d||"$"==d&&a.eat("{"))){b.tokenize=m;break}c=!c&&"\\"==d}return l("quasi","string-2",a.current())}function r(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf("=>",a.start);if(!(0>c)){for(var d=0,e=!1,f=c-1;f>=0;--f){var g=a.string.charAt(f),h=q.indexOf(g);if(h>=0&&3>h){if(!d){++f;break}if(0==--d)break}else if(h>=3&&6>h)++d;else if(/[$\w]/.test(g))e=!0;else if(e&&!d){++f;break}}e&&!d&&(b.fatArrowAt=f)}}function t(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,null!=d&&(this.align=d)}function u(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0;for(var d=a.context;d;d=d.prev)for(var c=d.vars;c;c=c.next)if(c.name==b)return!0}function v(a,b,c,d,f){var g=a.cc;for(w.state=a,w.stream=f,w.marked=null,w.cc=g,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);;){var h=g.length?g.pop():e?H:G;if(h(c,d)){for(;g.length&&g[g.length-1].lex;)g.pop()();return w.marked?w.marked:"variable"==c&&u(a,d)?"variable-2":b}}}function x(){for(var a=arguments.length-1;a>=0;a--)w.cc.push(arguments[a])}function y(){return x.apply(null,arguments),!0}function z(a){function c(b){for(var c=b;c;c=c.next)if(c.name==a)return!0;return!1}var d=w.state;if(d.context){if(w.marked="def",c(d.localVars))return;d.localVars={name:a,next:d.localVars}}else{if(c(d.globalVars))return;b.globalVars&&(d.globalVars={name:a,next:d.globalVars})}}function B(){w.state.context={prev:w.state.context,vars:w.state.localVars},w.state.localVars=A}function C(){w.state.localVars=w.state.context.vars,w.state.context=w.state.context.prev}function D(a,b){var c=function(){var c=w.state,d=c.indented;"stat"==c.lexical.type&&(d=c.lexical.indented),c.lexical=new t(d,w.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function E(){var a=w.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function F(a){return function(b){return b==a?y():";"==a?x():y(arguments.callee)}}function G(a,b){return"var"==a?y(D("vardef",b.length),_,F(";"),E):"keyword a"==a?y(D("form"),H,G,E):"keyword b"==a?y(D("form"),G,E):"{"==a?y(D("}"),Y,E):";"==a?y():"if"==a?y(D("form"),H,G,E,eb):"function"==a?y(kb):"for"==a?y(D("form"),fb,E,G,E):"variable"==a?y(D("stat"),S):"switch"==a?y(D("form"),H,D("}","switch"),F("{"),Y,E,E):"case"==a?y(H,F(":")):"default"==a?y(F(":")):"catch"==a?y(D("form"),B,F("("),lb,F(")"),G,E,C):"module"==a?y(D("form"),B,pb,C,E):"class"==a?y(D("form"),mb,ob,E):"export"==a?y(D("form"),qb,E):"import"==a?y(D("form"),rb,E):x(D("stat"),H,F(";"),E)}function H(a){return J(a,!1)}function I(a){return J(a,!0)}function J(a,b){if(w.state.fatArrowAt==w.stream.start){var c=b?R:Q;if("("==a)return y(B,X(ab,")"),F("=>"),c,C);if("variable"==a)return x(B,ab,F("=>"),c,C)}var d=b?N:M;return s.hasOwnProperty(a)?y(d):"function"==a?y(kb):"keyword c"==a?y(b?L:K):"("==a?y(D(")"),K,vb,F(")"),E,d):"operator"==a||"spread"==a?y(b?I:H):"["==a?y(D("]"),I,ub,E,d):"{"==a?y(X(U,"}"),d):y()}function K(a){return a.match(/[;\}\)\],]/)?x():x(H)}function L(a){return a.match(/[;\}\)\],]/)?x():x(I)}function M(a,b){return","==a?y(H):N(a,b,!1)}function N(a,b,c){var d=0==c?M:N,e=0==c?H:I;return"=>"==b?y(B,c?R:Q,C):"operator"==a?/\+\+|--/.test(b)?y(d):"?"==b?y(H,F(":"),e):y(e):"quasi"==a?(w.cc.push(d),O(b)):";"!=a?"("==a?y(X(I,")","call"),d):"."==a?y(T,d):"["==a?y(D("]"),K,F("]"),E,d):void 0:void 0}function O(a){return"${"!=a.slice(a.length-2)?y():y(H,P)}function P(a){return"}"==a?(w.marked="string-2",w.state.tokenize=p,y()):void 0}function Q(a){return r(w.stream,w.state),"{"==a?x(G):x(H)}function R(a){return r(w.stream,w.state),"{"==a?x(G):x(I)}function S(a){return":"==a?y(E,G):x(M,F(";"),E)}function T(a){return"variable"==a?(w.marked="property",y()):void 0}function U(a,b){if("variable"==a){if(w.marked="property","get"==b||"set"==b)return y(V)}else if("number"==a||"string"==a)w.marked=a+" property";else if("["==a)return y(H,F("]"),W);return s.hasOwnProperty(a)?y(W):void 0}function V(a){return"variable"!=a?x(W):(w.marked="property",y(kb))}function W(a){return":"==a?y(I):"("==a?x(kb):void 0}function X(a,b,c){function d(c){if(","==c){var e=w.state.lexical;return"call"==e.info&&(e.pos=(e.pos||0)+1),y(a,d)}return c==b?y():y(F(b))}return function(e){return e==b?y():c===!1?x(a,d):x(D(b,c),a,d,E)}}function Y(a){return"}"==a?y():x(G,Y)}function Z(a){return f&&":"==a?y($):void 0}function $(a){return"variable"==a?(w.marked="variable-3",y()):void 0}function _(){return x(ab,Z,cb,db)}function ab(a,b){return"variable"==a?(z(b),y()):"["==a?y(X(ab,"]")):"{"==a?y(X(bb,"}")):void 0}function bb(a,b){return"variable"!=a||w.stream.match(/^\s*:/,!1)?("variable"==a&&(w.marked="property"),y(F(":"),ab,cb)):(z(b),y(cb))}function cb(a,b){return"="==b?y(I):void 0}function db(a){return","==a?y(_):void 0}function eb(a,b){return"keyword b"==a&&"else"==b?y(D("form"),G,E):void 0}function fb(a){return"("==a?y(D(")"),gb,F(")")):void 0}function gb(a){return"var"==a?y(_,F(";"),ib):";"==a?y(ib):"variable"==a?y(hb):x(H,F(";"),ib)}function hb(a,b){return"in"==b||"of"==b?(w.marked="keyword",y(H)):y(M,ib)}function ib(a,b){return";"==a?y(jb):"in"==b||"of"==b?(w.marked="keyword",y(H)):x(H,F(";"),jb)}function jb(a){")"!=a&&y(H)}function kb(a,b){return"*"==b?(w.marked="keyword",y(kb)):"variable"==a?(z(b),y(kb)):"("==a?y(B,X(lb,")"),G,C):void 0}function lb(a){return"spread"==a?y(lb):x(ab,Z)}function mb(a,b){return"variable"==a?(z(b),y(nb)):void 0}function nb(a,b){return"extends"==b?y(H):void 0}function ob(a){return"{"==a?y(X(U,"}")):void 0}function pb(a,b){return"string"==a?y(G):"variable"==a?(z(b),y(tb)):void 0}function qb(a,b){return"*"==b?(w.marked="keyword",y(tb,F(";"))):"default"==b?(w.marked="keyword",y(H,F(";"))):x(G)}function rb(a){return"string"==a?y():x(sb,tb)}function sb(a,b){return"{"==a?y(X(sb,"}")):("variable"==a&&z(b),y())}function tb(a,b){return"from"==b?(w.marked="keyword",y(H)):void 0}function ub(a){return"for"==a?x(vb):","==a?y(X(I,"]",!1)):x(X(I,"]",!1))}function vb(a){return"for"==a?y(fb,vb):"if"==a?y(H,vb):void 0}var j,k,c=a.indentUnit,d=b.statementIndent,e=b.json,f=b.typescript,g=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),g={type:"atom",style:"atom"},h={"if":a("if"),"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":d,"delete":d,"throw":d,"var":a("var"),"const":a("var"),let:a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":g,"false":g,"null":g,undefined:g,NaN:g,Infinity:g,"this":a("this"),module:a("module"),"class":a("class"),"super":a("atom"),yield:d,"export":a("export"),"import":a("import"),"extends":d};if(f){var i={type:"variable",style:"variable-3"},j={"interface":a("interface"),"extends":a("extends"),constructor:a("constructor"),"public":a("public"),"private":a("private"),"protected":a("protected"),"static":a("static"),string:i,number:i,bool:i,any:i};for(var k in j)h[k]=j[k]}return h}(),h=/[+\-*&%=<>!?|~^]/,q="([{}])",s={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0},w={state:null,column:null,marked:null,cc:null},A={name:"this",next:{name:"arguments"}};return E.lex=!0,{startState:function(a){var d={tokenize:m,lastType:"sof",cc:[],lexical:new t((a||0)-c,0,"block",!1),localVars:b.localVars,context:b.localVars&&{vars:b.localVars},indented:0};return b.globalVars&&(d.globalVars=b.globalVars),d},token:function(a,b){if(a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation(),r(a,b)),b.tokenize!=o&&a.eatSpace())return null;var c=b.tokenize(a,b);return"comment"==j?c:(b.lastType="operator"!=j||"++"!=k&&"--"!=k?j:"incdec",v(b,c,j,k,a))},indent:function(a,e){if(a.tokenize==o)return CodeMirror.Pass;if(a.tokenize!=m)return 0;for(var f=e&&e.charAt(0),g=a.lexical,h=a.cc.length-1;h>=0;--h){var i=a.cc[h];if(i==E)g=g.prev;else if(i!=eb||/^else\b/.test(e))break}"stat"==g.type&&"}"==f&&(g=g.prev),d&&")"==g.type&&"stat"==g.prev.type&&(g=g.prev);var j=g.type,k=f==j;return"vardef"==j?g.indented+("operator"==a.lastType||","==a.lastType?g.info+1:0):"form"==j&&"{"==f?g.indented:"form"==j?g.indented+c:"stat"==j?g.indented+("operator"==a.lastType||","==a.lastType?d||c:0):"switch"!=g.info||k||0==b.doubleIndentSwitch?g.align?g.column+(k?0:1):g.indented+(k?0:c):g.indented+(/^(?:case|default)\b/.test(e)?c:2*c)},electricChars:":{}",blockCommentStart:e?null:"/*",blockCommentEnd:e?null:"*/",lineComment:e?null:"//",fold:"brace",helperType:e?"json":"javascript",jsonMode:e}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("text/ecmascript","javascript"),CodeMirror.defineMIME("application/javascript","javascript"),CodeMirror.defineMIME("application/ecmascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMIME("application/x-json",{name:"javascript",json:!0}),CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:!0}),CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:!0}),CodeMirror.defineMode("xml",function(a,b){function j(a,b){function c(c){return b.tokenize=c,c(a,b)}var d=a.next();if("<"==d){if(a.eat("!"))return a.eat("[")?a.match("CDATA[")?c(m("atom","]]>")):null:a.match("--")?c(m("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(n(1))):null;if(a.eat("?"))return a.eatWhile(/[\w\._\-]/),b.tokenize=m("meta","?>"),"meta";var e=a.eat("/");h="";for(var f;f=a.eat(/[^\s\u00a0=<>\"\'\/?]/);)h+=f;return h?(i=e?"closeTag":"openTag",b.tokenize=k,"tag"):"tag error"}if("&"==d){var g;return g=a.eat("#")?a.eat("x")?a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):a.eatWhile(/[\d]/)&&a.eat(";"):a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),g?"atom":"error"}return a.eatWhile(/[^&<]/),null}function k(a,b){var c=a.next();if(">"==c||"/"==c&&a.eat(">"))return b.tokenize=j,i=">"==c?"endTag":"selfcloseTag","tag";if("="==c)return i="equals",null;if("<"==c){b.tokenize=j;var d=b.tokenize(a,b);return d?d+" error":"error"}return/[\'\"]/.test(c)?(b.tokenize=l(c),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.eatWhile(/[^\s\u00a0=<>\"\']/),"word")}function l(a){var b=function(b,c){for(;!b.eol();)if(b.next()==a){c.tokenize=k;break}return"string"};return b.isInAttribute=!0,b}function m(a,b){return function(c,d){for(;!c.eol();){if(c.match(b)){d.tokenize=j;break}c.next()}return a}}function n(a){return function(b,c){for(var d;null!=(d=b.next());){if("<"==d)return c.tokenize=n(a+1),c.tokenize(b,c);if(">"==d){if(1==a){c.tokenize=j;break}return c.tokenize=n(a-1),c.tokenize(b,c)}}return"meta"}}function r(){for(var a=arguments.length-1;a>=0;a--)o.cc.push(arguments[a])}function s(){return r.apply(null,arguments),!0}function t(a,b){var c=f.doNotIndent.hasOwnProperty(a)||o.context&&o.context.noIndent;o.context={prev:o.context,tagName:a,indent:o.indented,startOfLine:b,noIndent:c}}function u(){o.context&&(o.context=o.context.prev)}function v(a){if("openTag"==a)return o.tagName=h,o.tagStart=p.column(),s(z,w(o.startOfLine));if("closeTag"==a){var b=!1;return o.context?o.context.tagName!=h&&(f.implicitlyClosed.hasOwnProperty(o.context.tagName.toLowerCase())&&u(),b=!o.context||o.context.tagName!=h):b=!0,b&&(q="error"),s(x(b))}return s()}function w(a){return function(b){var c=o.tagName;return o.tagName=o.tagStart=null,"selfcloseTag"==b||"endTag"==b&&f.autoSelfClosers.hasOwnProperty(c.toLowerCase())?(y(c.toLowerCase()),s()):"endTag"==b?(y(c.toLowerCase()),t(c,a),s()):s()}}function x(a){return function(b){return a&&(q="error"),"endTag"==b?(u(),s()):(q="error",s(arguments.callee))}}function y(a){for(var b;;){if(!o.context)return;if(b=o.context.tagName.toLowerCase(),!f.contextGrabbers.hasOwnProperty(b)||!f.contextGrabbers[b].hasOwnProperty(a))return;u()}}function z(a){return"word"==a?(q="attribute",s(A,z)):"endTag"==a||"selfcloseTag"==a?r():(q="error",s(z))}function A(a){if("equals"==a)return s(B,z);if(f.allowMissing){if("word"==a)return q="attribute",s(A,z)}else q="error";return"endTag"==a||"selfcloseTag"==a?r():s()}function B(a){return"string"==a?s(C):"word"==a&&f.allowUnquoted?(q="string",s()):(q="error","endTag"==a||"selfCloseTag"==a?r():s())}function C(a){return"string"==a?s(C):r()}var h,i,o,p,q,c=a.indentUnit,d=b.multilineTagIndentFactor||1,e=b.multilineTagIndentPastTag||!0,f=b.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1},g=b.alignCDATA;return{startState:function(){return{tokenize:j,cc:[],indented:0,startOfLine:!0,tagName:null,tagStart:null,context:null}},token:function(a,b){if(!b.tagName&&a.sol()&&(b.startOfLine=!0,b.indented=a.indentation()),a.eatSpace())return null;q=i=h=null;var c=b.tokenize(a,b);if(b.type=i,(c||i)&&"comment"!=c)for(o=b,p=a;;){var d=b.cc.pop()||v;if(d(i||c))break}return b.startOfLine=!1,q&&(c="error"==q?c+" error":q),c},indent:function(a,b,f){var h=a.context;if(a.tokenize.isInAttribute)return a.stringStartCol+1;if(a.tokenize!=k&&a.tokenize!=j||h&&h.noIndent)return f?f.match(/^(\s*)/)[0].length:0;if(a.tagName)return e?a.tagStart+a.tagName.length+2:a.tagStart+c*d;if(g&&/<!\[CDATA\[/.test(b))return 0;for(h&&/^<\//.test(b)&&(h=h.prev);h&&!h.startOfLine;)h=h.prev;return h?h.indent+c:0},electricChars:"/",blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:b.htmlMode?"html":"xml",helperType:b.htmlMode?"html":"xml"}}),CodeMirror.defineMIME("text/xml","xml"),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.mimeModes.hasOwnProperty("text/html")||CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0}),function(){"use strict";function c(c){"activeLine"in c.state&&(c.removeLineClass(c.state.activeLine,"wrap",a),c.removeLineClass(c.state.activeLine,"background",b))}function d(d){var e=d.getLineHandleVisualStart(d.getCursor().line);d.state.activeLine!=e&&(c(d),d.addLineClass(e,"wrap",a),d.addLineClass(e,"background",b),d.state.activeLine=e)}var a="CodeMirror-activeline",b="CodeMirror-activeline-background";CodeMirror.defineOption("styleActiveLine",!1,function(a,b,e){var f=e&&e!=CodeMirror.Init;b&&!f?(d(a),a.on("cursorActivity",d)):!b&&f&&(a.off("cursorActivity",d),c(a),delete a.state.activeLine)})}(),function(){function d(a,d,e){function r(d,e,f){if(d.text){var h=m?0:d.text.length-1,i=m?d.text.length:-1;if(d.text.length>g)return null;for(null!=f&&(h=f+n);h!=i;h+=n){var j=d.text.charAt(h);if(q.test(j)&&a.getTokenTypeAt(b(e,h+1))==o){var k=c[j];if(">"==k.charAt(1)==m)p.push(j);else{if(p.pop()!=k.charAt(0))return{pos:h,match:!1};if(!p.length)return{pos:h,match:!0}}}}}}var f=a.state.matchBrackets,g=f&&f.maxScanLineLength||1e4,h=f&&f.maxScanLines||100,i=d||a.getCursor(),j=a.getLineHandle(i.line),k=i.ch-1,l=k>=0&&c[j.text.charAt(k)]||c[j.text.charAt(++k)];if(!l)return null;var m=">"==l.charAt(1),n=m?1:-1;if(e&&m!=(k==i.ch))return null;for(var t,o=a.getTokenTypeAt(b(i.line,k+1)),p=[j.text.charAt(k)],q=/[(){}[\]]/,s=i.line,u=m?Math.min(s+h,a.lineCount()):Math.max(-1,s-h);s!=u&&!(t=s==i.line?r(j,s,k):r(a.getLineHandle(s),s));s+=n);return{from:b(i.line,k),to:t&&b(s,t.pos),match:t&&t.match,forward:m}}function e(c,e){var f=c.state.matchBrackets.maxHighlightLineLength||1e3,g=d(c);if(!(!g||c.getLine(g.from.line).length>f||g.to&&c.getLine(g.to.line).length>f)){var h=g.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",i=c.markText(g.from,b(g.from.line,g.from.ch+1),{className:h}),j=g.to&&c.markText(g.to,b(g.to.line,g.to.ch+1),{className:h});a&&c.state.focused&&c.display.input.focus();var k=function(){c.operation(function(){i.clear(),j&&j.clear()})};return e?(setTimeout(k,800),void 0):k}}function g(a){a.operation(function(){f&&(f(),f=null),a.somethingSelected()||(f=e(a,!1))})}var a=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),b=CodeMirror.Pos,c={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},f=null;CodeMirror.defineOption("matchBrackets",!1,function(a,b,c){c&&c!=CodeMirror.Init&&a.off("cursorActivity",g),b&&(a.state.matchBrackets="object"==typeof b?b:{},a.on("cursorActivity",g))}),CodeMirror.defineExtension("matchBrackets",function(){e(this,!0)}),CodeMirror.defineExtension("findMatchingBracket",function(a,b){return d(this,a,b)})}();
 
 
 
 
 
 
lib/hesh.dev.css DELETED
@@ -1,73 +0,0 @@
1
- .CodeMirror {
2
- font-family: Menlo Regular,Consolas,Monaco,monospace;
3
- line-height: 150%;
4
- font-size: 12px;
5
- height: 500px;
6
- }
7
-
8
- .wp-fullscreen-both,
9
- #content-resize-handle,
10
- #wp-fullscreen-modes, /* fullscreen controls */
11
- .heshFullscreen #content_wp_fullscreen, /* fullscreen button in view mode */
12
- .quicktags-toolbar input.ed_button {
13
- display: none !important;
14
- }
15
-
16
- /* Fixing problems with hidden Textarea in IE */
17
- #content {
18
- display: block!important;
19
- position: absolute;
20
- left: -9000px;
21
- }
22
-
23
- .quicktags-toolbar input#cm_content_fullscreen,
24
- #ed_toolbar input.cm_ed_button {
25
- display: inline-block !important;
26
- }
27
- .CodeMirror-matchingbracket {
28
- background-color: #fff490;
29
- color: inherit !important;
30
- }
31
- .content-resize-handle {
32
- width: 12px;
33
- height: 19px;
34
- cursor: ns-resize;
35
- right: 2px;
36
- position: absolute;
37
- background: transparent url('../../../../wp-admin/images/resize-2x.gif') no-repeat scroll right bottom;
38
- background-image: url('../../../../wp-admin/images/resize.gif')\0; /* IE8 */
39
- background-size: 11px 11px;
40
- }
41
-
42
- #cm_content_fullscreen {
43
- float: right;
44
- }
45
- .heshFullscreen {
46
- z-index: 99999;
47
- position: fixed;
48
- top: 0;
49
- left: 0;
50
- right: 0;
51
- bottom: 0;
52
- height: 100%;
53
- background: #fff;
54
- padding: 2% 2% 0;
55
- }
56
- .heshFullscreen .CodeMirror,
57
- .heshFullscreen #ed_toolbar {
58
- border: 1px solid #ccc;
59
- }
60
- .heshFullscreen #ed_toolbar {
61
- border-bottom: 0;
62
- border-radius: 4px 4px 0 0;
63
- }
64
- .heshFullscreen .CodeMirror {
65
- border-radius: 0 0 4px 4px;
66
- height: 85%!important;
67
- }
68
-
69
- @media only screen and (max-height: 550px), only screen and (max-device-height: 550px) {
70
- .heshFullscreen .CodeMirror {
71
- height: 75%!important;
72
- }
73
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/hesh.dev.js DELETED
@@ -1,174 +0,0 @@
1
- function heshPlugin() {
2
- var editor = null,
3
- isOn = 0,
4
- buttonsAdded = 0,
5
- target = document.getElementById("content"),
6
- postID = document.getElementById("post_ID") != null ? document.getElementById("post_ID").value : 0,
7
- tab_html = document.getElementById("content-html"),
8
- tab_tmce = document.getElementById("content-tmce"),
9
- visualEditor = document.cookie.indexOf("editor%3Dtinymce") != -1 ? true : false,
10
- visualEditorEnabled = document.getElementById("content-tmce") != null ? true : false,
11
- fullscreenBox = document.getElementById("wp-content-editor-container"),
12
- fullscreenClass = "heshFullscreen",
13
- publishButton = document.getElementById('publish'),
14
- options = {
15
- mode: "text/html",
16
- tabMode: "indent",
17
- lineNumbers: true,
18
- matchBrackets: true,
19
- indentUnit: 4,
20
- indentWithTabs: true,
21
- enterMode: "keep",
22
- lineWrapping: true,
23
- autofocus: true,
24
- styleActiveLine: true,
25
- extraKeys: {
26
- "F11": function() {
27
- toggleFullscreen();
28
- },
29
- "Esc": function() {
30
- toggleFullscreen();
31
- },
32
- "Ctrl-S": function(){
33
- publishButton.click();
34
- },
35
- "Cmd-S": function(){
36
- publishButton.click();
37
- }
38
- }
39
- },
40
- addButtons = function() {
41
- var toolbar = document.getElementById("ed_toolbar");
42
- if (!buttonsAdded) {
43
- var toolbarVars = {
44
- more: ['<!--more-->',''],
45
- comment: ['<!-- ',' -->'],
46
- code: ['<code>','</code>'],
47
- li: ['<li>','</li>'],
48
- ol: ['<ol>','</ol>'],
49
- ul: ['<ul>','</ul>'],
50
- img: ['<img src="$" alt="','">','Enter the URL of the image'],
51
- ins: ['<ins>','</ins>'],
52
- del: ['<del>','</del>'],
53
- link: ['<a href="$">','</a>','Enter the destination URL'],
54
- blockquote: ['\r<blockquote>','</blockquote>\r'],
55
- h3: ['<h3>','</h3>'],
56
- h2: ['<h2>','</h2>'],
57
- h1: ['<h1>','</h1>'],
58
- i: ['<em>','</em>'],
59
- b: ['<strong>','</strong>']
60
- };
61
- for (key in toolbarVars) {
62
- var t = toolbarVars[key];
63
- var t3 = t[2] ? 'data-prompt="'+t[2]+'"' : '';
64
- toolbar.insertAdjacentHTML('afterbegin', '<input type="button" id="cm_content_'+key+'" data-start=\''+t[0]+'\' data-end=\''+t[1]+'\' '+t3+' class="ed_button cm_ed_button" value="'+key+'">');
65
- document.getElementById('cm_content_'+key).onclick = buttonClick;
66
- }
67
- fullscreen();
68
- buttonsAdded = 1;
69
- }
70
- },
71
- buttonClick = function() {
72
- var selStart = editor.getCursor("start"),
73
- start = this.getAttribute('data-start'),
74
- end = this.getAttribute('data-end'),
75
- cmPrompt = this.getAttribute('data-prompt'),
76
- selText = editor.getSelection();
77
- if (cmPrompt) start = start.replace('$',prompt(cmPrompt, ''));
78
- editor.replaceSelection(start+selText+end);
79
- editor.setSelection(selStart, editor.getCursor("end"));
80
- editor.setCursor(selStart.line, selStart.ch + start.length);
81
- editor.focus();
82
- },
83
- runEditor = function(target) {
84
- editor = CodeMirror.fromTextArea(target, options);
85
- //Save changes to the textarea on the fly
86
- editor.on("change", function() {
87
- editor.save();
88
- });
89
- //Saving cursor state
90
- editor.on("cursorActivity", function() {
91
- var curPos = editor.getCursor();
92
- window.name = postID + ',' + curPos.line + ',' + curPos.ch;
93
- });
94
- //Restoring cursor state
95
- var curPos = window.name.split(',');
96
- if (postID == curPos[0]) {
97
- editor.setCursor(parseFloat(curPos[1]),parseFloat(curPos[2]));
98
- }
99
- addButtons();
100
- resizeEditor();
101
- addMedia();
102
- isOn = 1;
103
- },
104
- toVisual = function() {
105
- if (isOn) {
106
- editor.toTextArea();
107
- tab_html.onclick = toHTML;
108
- switchEditors.switchto(this);
109
- isOn = 0;
110
- }
111
- },
112
- toHTML = function() {
113
- if (!isOn) {
114
- switchEditors.switchto(this);
115
- runEditor(target);
116
- tab_tmce.onclick = toVisual;
117
- }
118
- },
119
- resizeEditor = function() {
120
- var target = document.querySelector('.CodeMirror'),
121
- handle = document.createElement('div'),
122
- hwrap = document.getElementById('wp-content-wrap'),
123
- offsetTop = target.getBoundingClientRect().top,
124
- move = function(e) {
125
- e = e || window.event; // IE fix
126
- var height = (e.pageY || e.clientY + document.body.scrollTop + document.documentElement.scrollTop) - offsetTop;
127
- target.style.height = (height > 10 ? height : 10) + 'px';
128
- window.getSelection().removeAllRanges(); //disable selection on resize
129
- }
130
- handle.className = 'content-resize-handle';
131
- hwrap.appendChild(handle);
132
- handle.onmousedown = function() {
133
- document.onmousemove = move;
134
- }
135
- document.onmouseup = function() {
136
- document.onmousemove = null;
137
- //editor.focus();
138
- }
139
- },
140
- toggleFullscreen = function() {
141
- fullscreenBox.className = fullscreenBox.className.indexOf(fullscreenClass) == -1 ? fullscreenBox.className +' '+ fullscreenClass : fullscreenBox.className.replace(fullscreenClass, '');
142
- this.value = this.value == 'fullscreen' ? 'exit fullscreen' : 'fullscreen';
143
- editor.focus();
144
- },
145
- fullscreen = function() {
146
- document.getElementById("ed_toolbar").insertAdjacentHTML('afterbegin', '<input type="button" id="cm_content_fullscreen" class="ed_button" title="Toggle fullscreen mode" value="fullscreen">');
147
- document.getElementById('cm_content_fullscreen').onclick = toggleFullscreen;
148
- },
149
- addMedia = function() {
150
- // Dirty
151
- document.getElementById('insert-media-button').onclick = function(){
152
- target.value = '';
153
- target.className = 'IEtextarea';
154
- setTimeout(function(){
155
- document.querySelector('.media-button-insert').onclick = function(){
156
- setTimeout(function(){
157
- editor.replaceSelection(target.value);
158
- editor.save();
159
- },400);
160
- }
161
- },400);
162
- }
163
- };
164
-
165
- /* Initialise */
166
- if (visualEditor && visualEditorEnabled) {
167
- tab_html.onclick = toHTML;
168
- } else {
169
- runEditor(target);
170
- if (visualEditorEnabled) tab_tmce.onclick = toVisual;
171
- }
172
-
173
- };
174
- window.onload = heshPlugin;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/hesh.min.css CHANGED
@@ -1,4 +1 @@
1
- /*1.4.4*/
2
- .CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid black;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:black}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-property{color:black}.cm-s-default .cm-operator{color:black}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-error{color:red}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:blue}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:bold}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{line-height:1;position:relative;overflow:hidden;background:white;color:black}.CodeMirror-scroll{margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;padding-right:30px;height:100%;outline:0;position:relative;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-sizer{position:relative}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;-moz-box-sizing:content-box;box-sizing:content-box;padding-bottom:30px;margin-bottom:-32px;display:inline-block;*zoom:1;*display:inline}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-code pre{border-right:30px solid transparent;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.CodeMirror-wrap .CodeMirror-code pre{border-right:0;width:auto}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-right:0;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.CodeMirror span{*vertical-align:text-bottom}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}}
3
-
4
- .CodeMirror{font-family:Menlo Regular,Consolas,Monaco,monospace;line-height:150%;font-size:12px;height:500px}.wp-fullscreen-both,#content-resize-handle,#wp-fullscreen-modes,.heshFullscreen #content_wp_fullscreen,.quicktags-toolbar input.ed_button{display:none !important}#content{display:block !important;position:absolute;left:-9000px}.quicktags-toolbar input#cm_content_fullscreen,#ed_toolbar input.cm_ed_button{display:inline-block !important}.CodeMirror-matchingbracket{background-color:#fff490;color:inherit !important}.content-resize-handle{width:12px;height:19px;cursor:ns-resize;right:2px;position:absolute;background:transparent url('../../../../wp-admin/images/resize-2x.gif') no-repeat scroll right bottom;background-image:url('../../../../wp-admin/images/resize.gif')\0;background-size:11px 11px}#cm_content_fullscreen{float:right}.heshFullscreen{z-index:99999;position:fixed;top:0;left:0;right:0;bottom:0;height:100%;background:#fff;padding:2% 2% 0}.heshFullscreen .CodeMirror,.heshFullscreen #ed_toolbar{border:1px solid #ccc}.heshFullscreen #ed_toolbar{border-bottom:0;border-radius:4px 4px 0 0}.heshFullscreen .CodeMirror{border-radius:0 0 4px 4px;height:85% !important}@media only screen and (max-height:550px),only screen and (max-device-height:550px){.heshFullscreen .CodeMirror{height:75% !important}}
1
+ .CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid #000;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:#000}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-property{color:#000}.cm-s-default .cm-operator{color:#000}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-s-default .cm-error{color:red}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{line-height:1;position:relative;overflow:hidden;background:#fff;color:#000}.CodeMirror-scroll{margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;padding-right:30px;height:100%;outline:0;position:relative;-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-sizer{position:relative}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;-moz-box-sizing:content-box;box-sizing:content-box;padding-bottom:30px;margin-bottom:-32px;display:inline-block;*zoom:1;*display:inline}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-code pre{border-right:30px solid transparent;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.CodeMirror-wrap .CodeMirror-code pre{border-right:0;width:auto}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-right:0;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.CodeMirror span{*vertical-align:text-bottom}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}}.CodeMirror{font-family:Menlo Regular,Consolas,Monaco,monospace;line-height:150%;font-size:12px;height:500px}.wp-editor-area,.wp-fullscreen-both,#wp-fullscreen-modes,.heshFullscreen #content_wp_fullscreen,.quicktags-toolbar input.ed_button{display:none!important}.quicktags-toolbar input#cm_content_fullscreen,#ed_toolbar input.cm_ed_button{display:inline-block!important}.CodeMirror-matchingbracket{background-color:#fff490;color:inherit!important}.content-resize-handle{width:12px;height:19px;cursor:ns-resize;right:2px;position:absolute}.tmce-active .content-resize-handle{display:none}#cm_content_fullscreen{float:right}.heshFullscreen{z-index:99999;position:fixed;top:0;left:0;right:0;bottom:0;height:100%;background:#fff;padding:2% 2% 0}.heshFullscreen .CodeMirror,.heshFullscreen #ed_toolbar{border:1px solid #ccc}.heshFullscreen #ed_toolbar{border-bottom:0;border-radius:4px 4px 0 0}.heshFullscreen .CodeMirror{border-radius:0 0 4px 4px;height:85%!important}@media only screen and (max-height:550px),only screen and (max-device-height:550px){.heshFullscreen .CodeMirror{height:75%!important}}
 
 
 
lib/hesh.min.js CHANGED
@@ -1,6 +1,8 @@
1
- /*1.4.4*/
2
- function heshPlugin(){var a=null,b=0,c=0,d=document.getElementById("content"),e=null!=document.getElementById("post_ID")?document.getElementById("post_ID").value:0,f=document.getElementById("content-html"),g=document.getElementById("content-tmce"),h=-1!=document.cookie.indexOf("editor%3Dtinymce")?!0:!1,i=null!=document.getElementById("content-tmce")?!0:!1,j=document.getElementById("wp-content-editor-container"),k="heshFullscreen",l=document.getElementById("publish"),m={mode:"text/html",tabMode:"indent",lineNumbers:!0,matchBrackets:!0,indentUnit:4,indentWithTabs:!0,enterMode:"keep",lineWrapping:!0,autofocus:!0,styleActiveLine:!0,extraKeys:{F11:function(){toggleFullscreen()},Esc:function(){toggleFullscreen()},"Ctrl-S":function(){l.click()},"Cmd-S":function(){l.click()}}},n=function(){var a=document.getElementById("ed_toolbar");if(!c){var b={more:["<!--more-->",""],comment:["<!-- "," -->"],code:["<code>","</code>"],li:["<li>","</li>"],ol:["<ol>","</ol>"],ul:["<ul>","</ul>"],img:['<img src="$" alt="','">',"Enter the URL of the image"],ins:["<ins>","</ins>"],del:["<del>","</del>"],link:['<a href="$">',"</a>","Enter the destination URL"],blockquote:["\r<blockquote>","</blockquote>\r"],h3:["<h3>","</h3>"],h2:["<h2>","</h2>"],h1:["<h1>","</h1>"],i:["<em>","</em>"],b:["<strong>","</strong>"]};for(key in b){var d=b[key],e=d[2]?'data-prompt="'+d[2]+'"':"";a.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_content_'+key+"\" data-start='"+d[0]+"' data-end='"+d[1]+"' "+e+' class="ed_button cm_ed_button" value="'+key+'">'),document.getElementById("cm_content_"+key).onclick=o}fullscreen(),c=1}},o=function(){var b=a.getCursor("start"),c=this.getAttribute("data-start"),d=this.getAttribute("data-end"),e=this.getAttribute("data-prompt"),f=a.getSelection();e&&(c=c.replace("$",prompt(e,""))),a.replaceSelection(c+f+d),a.setSelection(b,a.getCursor("end")),a.setCursor(b.line,b.ch+c.length),a.focus()},p=function(c){a=CodeMirror.fromTextArea(c,m),a.on("change",function(){a.save()}),a.on("cursorActivity",function(){var b=a.getCursor();window.name=e+","+b.line+","+b.ch});var d=window.name.split(",");e==d[0]&&a.setCursor(parseFloat(d[1]),parseFloat(d[2])),n(),resizeEditor(),addMedia(),b=1},q=function(){b&&(a.toTextArea(),f.onclick=toHTML,switchEditors.switchto(this),b=0)};toHTML=function(){b||(switchEditors.switchto(this),p(d),g.onclick=q)},resizeEditor=function(){var a=document.querySelector(".CodeMirror"),b=document.createElement("div"),c=document.getElementById("wp-content-wrap"),d=a.getBoundingClientRect().top,e=function(b){b=b||window.event;var c=(b.pageY||b.clientY+document.body.scrollTop+document.documentElement.scrollTop)-d;a.style.height=(c>10?c:10)+"px",window.getSelection().removeAllRanges()};b.className="content-resize-handle",c.appendChild(b),b.onmousedown=function(){document.onmousemove=e},document.onmouseup=function(){document.onmousemove=null}},toggleFullscreen=function(){j.className=-1==j.className.indexOf(k)?j.className+" "+k:j.className.replace(k,""),this.value="fullscreen"==this.value?"exit fullscreen":"fullscreen",a.focus()},fullscreen=function(){document.getElementById("ed_toolbar").insertAdjacentHTML("afterbegin",'<input type="button" id="cm_content_fullscreen" class="ed_button" title="Toggle fullscreen mode" value="fullscreen">'),document.getElementById("cm_content_fullscreen").onclick=toggleFullscreen},addMedia=function(){document.getElementById("insert-media-button").onclick=function(){d.value="",d.className="IEtextarea",setTimeout(function(){document.querySelector(".media-button-insert").onclick=function(){setTimeout(function(){a.replaceSelection(d.value),a.save()},400)}},400)}},h&&i?f.onclick=toHTML:(p(d),i&&(g.onclick=q))}window.CodeMirror=function(){"use strict";function x(a,c){if(!(this instanceof x))return new x(a,c);this.options=c=c||{};for(var d in _c)!c.hasOwnProperty(d)&&_c.hasOwnProperty(d)&&(c[d]=_c[d]);J(c);var e="string"==typeof c.value?0:c.value.first,f=this.display=y(a,e);f.wrapper.CodeMirror=this,G(this),c.autofocus&&!p&&Nb(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new Xe},E(this),c.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var g=c.value;"string"==typeof g&&(g=new ge(c.value,c.mode)),Fb(this,ke)(this,g),b&&setTimeout(ff(Mb,this,!0),20),Pb(this);var h;try{h=document.activeElement==f.input}catch(i){}h||c.autofocus&&!p?setTimeout(ff(mc,this),20):nc(this),Fb(this,function(){for(var a in $c)$c.propertyIsEnumerable(a)&&$c[a](this,c[a],bd);for(var b=0;b<fd.length;++b)fd[b](this)})()}function y(a,b){var d={},e=d.input=lf("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");return f?e.style.width="1000px":e.setAttribute("wrap","off"),o&&(e.style.border="1px solid black"),e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false"),d.inputDiv=lf("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),d.scrollbarH=lf("div",[lf("div",null,null,"height: 1px")],"CodeMirror-hscrollbar"),d.scrollbarV=lf("div",[lf("div",null,null,"width: 1px")],"CodeMirror-vscrollbar"),d.scrollbarFiller=lf("div",null,"CodeMirror-scrollbar-filler"),d.gutterFiller=lf("div",null,"CodeMirror-gutter-filler"),d.lineDiv=lf("div",null,"CodeMirror-code"),d.selectionDiv=lf("div",null,null,"position: relative; z-index: 1"),d.cursor=lf("div","\xa0","CodeMirror-cursor"),d.otherCursor=lf("div","\xa0","CodeMirror-cursor CodeMirror-secondarycursor"),d.measure=lf("div",null,"CodeMirror-measure"),d.lineSpace=lf("div",[d.measure,d.selectionDiv,d.lineDiv,d.cursor,d.otherCursor],null,"position: relative; outline: none"),d.mover=lf("div",[lf("div",[d.lineSpace],"CodeMirror-lines")],null,"position: relative"),d.sizer=lf("div",[d.mover],"CodeMirror-sizer"),d.heightForcer=lf("div",null,null,"position: absolute; height: "+Ve+"px; width: 1px;"),d.gutters=lf("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=lf("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=lf("div",[d.inputDiv,d.scrollbarH,d.scrollbarV,d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),c&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),a.appendChild?a.appendChild(d.wrapper):a(d.wrapper),o&&(e.style.width="0px"),f||(d.scroller.draggable=!0),k?(d.inputDiv.style.height="1px",d.inputDiv.style.position="absolute"):c&&(d.scrollbarH.style.minWidth=d.scrollbarV.style.minWidth="18px"),d.viewOffset=d.lastSizeC=0,d.showingFrom=d.showingTo=b,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.prevInput="",d.alignWidgets=!1,d.pollingFast=!1,d.poll=new Xe,d.cachedCharWidth=d.cachedTextHeight=null,d.measureLineCache=[],d.measureLineCachePos=0,d.inaccurateSelection=!1,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d}function z(a){a.doc.mode=x.getMode(a.options,a.doc.modeOption),a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,bb(a,100),a.state.modeGen++,a.curOp&&Ib(a)}function A(a){a.options.lineWrapping?(a.display.wrapper.className+=" CodeMirror-wrap",a.display.sizer.style.minWidth=""):(a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-wrap",""),I(a)),C(a),Ib(a),pb(a),setTimeout(function(){K(a)},100)}function B(a){var b=Ab(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/Bb(a.display)-3);return function(e){return Gd(a.doc,e)?0:c?(Math.ceil(e.text.length/d)||1)*b:b}}function C(a){var b=a.doc,c=B(a);b.iter(function(a){var b=c(a);b!=a.height&&oe(a,b)})}function D(a){var b=kd[a.options.keyMap],c=b.style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(c?" cm-keymap-"+c:""),a.state.disableInput=b.disableInput}function E(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),pb(a)}function F(a){G(a),Ib(a),setTimeout(function(){M(a)},20)}function G(a){var b=a.display.gutters,c=a.options.gutters;mf(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(lf("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none"}function H(a,b){if(0==b.height)return 0;for(var d,c=b.text.length,e=b;d=Dd(e);){var f=d.find();e=le(a,f.from.line),c+=f.from.ch-f.to.ch}for(e=b;d=Ed(e);){var f=d.find();c-=e.text.length-f.from.ch,e=le(a,f.to.line),c+=e.text.length-f.to.ch}return c}function I(a){var b=a.display,c=a.doc;b.maxLine=le(c,c.first),b.maxLineLength=H(c,b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var d=H(c,a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function J(a){var b=bf(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function K(a){var b=a.display,c=a.doc.height,d=c+gb(b);b.sizer.style.minHeight=b.heightForcer.style.top=d+"px",b.gutters.style.height=Math.max(d,b.scroller.clientHeight-Ve)+"px";var e=Math.max(d,b.scroller.scrollHeight),f=b.scroller.scrollWidth>b.scroller.clientWidth+1,g=e>b.scroller.clientHeight+1;g?(b.scrollbarV.style.display="block",b.scrollbarV.style.bottom=f?tf(b.measure)+"px":"0",b.scrollbarV.firstChild.style.height=e-b.scroller.clientHeight+b.scrollbarV.clientHeight+"px"):(b.scrollbarV.style.display="",b.scrollbarV.firstChild.style.height="0"),f?(b.scrollbarH.style.display="block",b.scrollbarH.style.right=g?tf(b.measure)+"px":"0",b.scrollbarH.firstChild.style.width=b.scroller.scrollWidth-b.scroller.clientWidth+b.scrollbarH.clientWidth+"px"):(b.scrollbarH.style.display="",b.scrollbarH.firstChild.style.width="0"),f&&g?(b.scrollbarFiller.style.display="block",b.scrollbarFiller.style.height=b.scrollbarFiller.style.width=tf(b.measure)+"px"):b.scrollbarFiller.style.display="",f&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(b.gutterFiller.style.display="block",b.gutterFiller.style.height=tf(b.measure)+"px",b.gutterFiller.style.width=b.gutters.offsetWidth+"px"):b.gutterFiller.style.display="",l&&0===tf(b.measure)&&(b.scrollbarV.style.minWidth=b.scrollbarH.style.minHeight=m?"18px":"12px",b.scrollbarV.style.pointerEvents=b.scrollbarH.style.pointerEvents="none")}function L(a,b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;"number"==typeof c?d=c:c&&(d=c.top,e=c.bottom-c.top),d=Math.floor(d-fb(a));var f=Math.ceil(d+e);return{from:qe(b,d),to:qe(b,f)}}function M(a){var b=a.display;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var c=P(b)-b.scroller.scrollLeft+a.doc.scrollLeft,d=b.gutters.offsetWidth,e=c+"px",f=b.lineDiv.firstChild;f;f=f.nextSibling)if(f.alignable)for(var g=0,h=f.alignable;g<h.length;++g)h[g].style.left=e;a.options.fixedGutter&&(b.gutters.style.left=c+d+"px")}}function N(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=O(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(lf("div",[lf("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),f=e.firstChild.offsetWidth,g=e.offsetWidth-f;return d.lineGutter.style.width="",d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-g),d.lineNumWidth=d.lineNumInnerWidth+g,d.lineNumChars=d.lineNumInnerWidth?c.length:-1,d.lineGutter.style.width=d.lineNumWidth+"px",!0}return!1}function O(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function P(a){return pf(a.scroller).left-pf(a.sizer).left}function Q(a,b,c,d){for(var g,e=a.display.showingFrom,f=a.display.showingTo,h=L(a.display,a.doc,c),i=!0;;i=!1){var j=a.display.scroller.clientWidth;if(!R(a,b,h,d))break;if(g=!0,b=[],Z(a),K(a),i&&a.options.lineWrapping&&j!=a.display.scroller.clientWidth)d=!0;else if(d=!1,c&&(c=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,"number"==typeof c?c:c.top)),h=L(a.display,a.doc,c),h.from>=a.display.showingFrom&&h.to<=a.display.showingTo)break}return g&&(Qe(a,"update",a),(a.display.showingFrom!=e||a.display.showingTo!=f)&&Qe(a,"viewportChange",a,a.display.showingFrom,a.display.showingTo)),g}function R(a,b,c,d){var e=a.display,f=a.doc;if(!e.wrapper.clientWidth)return e.showingFrom=e.showingTo=f.first,e.viewOffset=0,void 0;if(!(!d&&0==b.length&&c.from>e.showingFrom&&c.to<e.showingTo)){N(a)&&(b=[{from:f.first,to:f.first+f.size}]);var g=e.sizer.style.marginLeft=e.gutters.offsetWidth+"px";e.scrollbarH.style.left=a.options.fixedGutter?g:"0";var h=1/0;if(a.options.lineNumbers)for(var i=0;i<b.length;++i)b[i].diff&&b[i].from<h&&(h=b[i].from);var j=f.first+f.size,k=Math.max(c.from-a.options.viewportMargin,f.first),l=Math.min(j,c.to+a.options.viewportMargin);if(e.showingFrom<k&&k-e.showingFrom<20&&(k=Math.max(f.first,e.showingFrom)),e.showingTo>l&&e.showingTo-l<20&&(l=Math.min(j,e.showingTo)),w)for(k=pe(Fd(f,le(f,k)));j>l&&Gd(f,le(f,l));)++l;var m=[{from:Math.max(e.showingFrom,f.first),to:Math.min(e.showingTo,j)}];if(m=m[0].from>=m[0].to?[]:U(m,b),w)for(var i=0;i<m.length;++i)for(var o,n=m[i];o=Ed(le(f,n.to-1));){var p=o.find().from.line;if(!(p>n.from)){m.splice(i--,1);break}n.to=p}for(var q=0,i=0;i<m.length;++i){var n=m[i];n.from<k&&(n.from=k),n.to>l&&(n.to=l),n.from>=n.to?m.splice(i--,1):q+=n.to-n.from}if(!d&&q==l-k&&k==e.showingFrom&&l==e.showingTo)return T(a),void 0;m.sort(function(a,b){return a.from-b.from});try{var r=document.activeElement}catch(s){}.7*(l-k)>q&&(e.lineDiv.style.display="none"),W(a,k,l,m,h),e.lineDiv.style.display="",r&&document.activeElement!=r&&r.offsetHeight&&r.focus();var t=k!=e.showingFrom||l!=e.showingTo||e.lastSizeC!=e.wrapper.clientHeight;return t&&(e.lastSizeC=e.wrapper.clientHeight,bb(a,400)),e.showingFrom=k,e.showingTo=l,S(a),T(a),!0}}function S(a){for(var f,b=a.display,d=b.lineDiv.offsetTop,e=b.lineDiv.firstChild;e;e=e.nextSibling)if(e.lineObj){if(c){var g=e.offsetTop+e.offsetHeight;f=g-d,d=g}else{var h=pf(e);f=h.bottom-h.top}var i=e.lineObj.height-f;if(2>f&&(f=Ab(b)),i>.001||-.001>i){oe(e.lineObj,f);var j=e.lineObj.widgets;if(j)for(var k=0;k<j.length;++k)j[k].height=j[k].node.offsetHeight}}}function T(a){var b=a.display.viewOffset=re(a,le(a.doc,a.display.showingFrom));a.display.mover.style.top=b+"px"}function U(a,b){for(var c=0,d=b.length||0;d>c;++c){for(var e=b[c],f=[],g=e.diff||0,h=0,i=a.length;i>h;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g}))}a=f}return a}function V(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:P(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function W(a,b,c,d,e){function l(b){var c=b.nextSibling;return f&&q&&a.display.currentWheelTarget==b?(b.style.display="none",b.lineObj=null):b.parentNode.removeChild(b),c}var g=V(a),h=a.display,i=a.options.lineNumbers;d.length||f&&a.display.currentWheelTarget||mf(h.lineDiv);var j=h.lineDiv,k=j.firstChild,m=d.shift(),n=b;for(a.doc.iter(b,c,function(b){if(m&&m.to==n&&(m=d.shift()),Gd(a.doc,b)){if(0!=b.height&&oe(b,0),b.widgets&&k&&k.previousSibling)for(var c=0;c<b.widgets.length;++c){var f=b.widgets[c];if(f.showIfHidden){var h=k.previousSibling;if(/pre/i.test(h.nodeName)){var o=lf("div",null,null,"position: relative");h.parentNode.replaceChild(o,h),o.appendChild(h),h=o}var p=h.appendChild(lf("div",[f.node],"CodeMirror-linewidget"));f.handleMouseEvents||(p.ignoreEvents=!0),Y(f,p,h,g)}}}else if(m&&m.from<=n&&m.to>n){for(;k.lineObj!=b;)k=l(k);i&&n>=e&&k.lineNumber&&of(k.lineNumber,O(a.options,n)),k=k.nextSibling}else{if(b.widgets)for(var s,q=0,r=k;r&&20>q;++q,r=r.nextSibling)if(r.lineObj==b&&/div/i.test(r.nodeName)){s=r;break}var t=X(a,b,n,g,s);if(t!=s)j.insertBefore(t,k);else{for(;k!=s;)k=l(k);k=k.nextSibling}t.lineObj=b}++n});k;)k=l(k)}function X(a,b,d,e,f){var k,g=Xd(a,b),h=g.pre,i=b.gutterMarkers,j=a.display,l=g.bgClass?g.bgClass+" "+(b.bgClass||""):b.bgClass;if(!(a.options.lineNumbers||i||l||b.wrapClass||b.widgets))return h;if(f){f.alignable=null;for(var q,m=!0,n=0,o=null,p=f.firstChild;p;p=q)if(q=p.nextSibling,/\bCodeMirror-linewidget\b/.test(p.className)){for(var r=0;r<b.widgets.length;++r){var s=b.widgets[r];if(s.node==p.firstChild){s.above||o||(o=p),Y(s,p,f,e),++n;break}}if(r==b.widgets.length){m=!1;break}}else f.removeChild(p);f.insertBefore(h,o),m&&n==b.widgets.length&&(k=f,f.className=b.wrapClass||"")}if(k||(k=lf("div",null,b.wrapClass,"position: relative"),k.appendChild(h)),l&&k.insertBefore(lf("div",null,l+" CodeMirror-linebackground"),k.firstChild),a.options.lineNumbers||i){var t=k.insertBefore(lf("div",null,null,"position: absolute; left: "+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+"px"),k.firstChild);if(a.options.fixedGutter&&(k.alignable||(k.alignable=[])).push(t),!a.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(k.lineNumber=t.appendChild(lf("div",O(a.options,d),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+e.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+j.lineNumInnerWidth+"px"))),i)for(var u=0;u<a.options.gutters.length;++u){var v=a.options.gutters[u],w=i.hasOwnProperty(v)&&i[v];w&&t.appendChild(lf("div",[w],"CodeMirror-gutter-elt","left: "+e.gutterLeft[v]+"px; width: "+e.gutterWidth[v]+"px"))}}if(c&&(k.style.zIndex=2),b.widgets&&k!=f)for(var r=0,x=b.widgets;r<x.length;++r){var s=x[r],y=lf("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||(y.ignoreEvents=!0),Y(s,y,k,e),s.above?k.insertBefore(y,a.options.lineNumbers&&0!=b.height?t:h):k.appendChild(y),Qe(s,"redraw")}return k}function Y(a,b,c,d){if(a.noHScroll){(c.alignable||(c.alignable=[])).push(b);var e=d.wrapperWidth;b.style.left=d.fixedPos+"px",a.coverGutter||(e-=d.gutterTotalWidth,b.style.paddingLeft=d.gutterTotalWidth+"px"),b.style.width=e+"px"}a.coverGutter&&(b.style.zIndex=5,b.style.position="relative",a.noHScroll||(b.style.marginLeft=-d.gutterTotalWidth+"px"))}function Z(a){var b=a.display,c=Cc(a.doc.sel.from,a.doc.sel.to);if(c||a.options.showCursorWhenSelecting?$(a):b.cursor.style.display=b.otherCursor.style.display="none",c?b.selectionDiv.style.display="none":_(a),a.options.moveInputWithCursor){var d=vb(a,a.doc.sel.head,"div"),e=pf(b.wrapper),f=pf(b.lineDiv);b.inputDiv.style.top=Math.max(0,Math.min(b.wrapper.clientHeight-10,d.top+f.top-e.top))+"px",b.inputDiv.style.left=Math.max(0,Math.min(b.wrapper.clientWidth-10,d.left+f.left-e.left))+"px"}}function $(a){var b=a.display,c=vb(a,a.doc.sel.head,"div");b.cursor.style.left=c.left+"px",b.cursor.style.top=c.top+"px",b.cursor.style.height=Math.max(0,c.bottom-c.top)*a.options.cursorHeight+"px",b.cursor.style.display="",c.other?(b.otherCursor.style.display="",b.otherCursor.style.left=c.other.left+"px",b.otherCursor.style.top=c.other.top+"px",b.otherCursor.style.height=.85*(c.other.bottom-c.other.top)+"px"):b.otherCursor.style.display="none"}function _(a){function h(a,b,c,d){0>b&&(b=0),e.appendChild(lf("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?f-a:c)+"px; height: "+(d-b)+"px"))}function i(b,d,e){function m(c,d){return ub(a,Bc(b,c),"div",i,d)}var k,l,i=le(c,b),j=i.text.length;return Af(se(i),d||0,null==e?j:e,function(a,b,c){var n,o,p,i=m(a,"left");if(a==b)n=i,o=p=i.left;else{if(n=m(b-1,"right"),"rtl"==c){var q=i;i=n,n=q}o=i.left,p=n.right}null==d&&0==a&&(o=g),n.top-i.top>3&&(h(o,i.top,null,i.bottom),o=g,i.bottom<n.top&&h(o,i.bottom,null,n.top)),null==e&&b==j&&(p=f),(!k||i.top<k.top||i.top==k.top&&i.left<k.left)&&(k=i),(!l||n.bottom>l.bottom||n.bottom==l.bottom&&n.right>l.right)&&(l=n),g+1>o&&(o=g),h(o,n.top,p-o,n.bottom)}),{start:k,end:l}}var b=a.display,c=a.doc,d=a.doc.sel,e=document.createDocumentFragment(),f=b.lineSpace.offsetWidth,g=hb(a.display);if(d.from.line==d.to.line)i(d.from.line,d.from.ch,d.to.ch);else{var j=le(c,d.from.line),k=le(c,d.to.line),l=Fd(c,j)==Fd(c,k),m=i(d.from.line,d.from.ch,l?j.text.length:null).end,n=i(d.to.line,l?0:null,d.to.ch).start;l&&(m.top<n.top-2?(h(m.right,m.top,null,m.bottom),h(g,n.top,n.left,n.bottom)):h(m.right,m.top,n.left-m.right,m.bottom)),m.bottom<n.top&&h(g,m.bottom,null,n.top)}nf(b.selectionDiv,e),b.selectionDiv.style.display=""}function ab(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursor.style.visibility=b.otherCursor.style.visibility="",a.options.cursorBlinkRate>0&&(b.blinker=setInterval(function(){b.cursor.style.visibility=b.otherCursor.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate))}}function bb(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.showingTo&&a.state.highlight.set(b,ff(cb,a))}function cb(a){var b=a.doc;if(b.frontier<b.first&&(b.frontier=b.first),!(b.frontier>=a.display.showingTo)){var f,c=+new Date+a.options.workTime,d=hd(b.mode,eb(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.showingTo+500),function(g){if(b.frontier>=a.display.showingFrom){var h=g.styles;g.styles=Sd(a,g,d);for(var i=!h||h.length!=g.styles.length,j=0;!i&&j<h.length;++j)i=h[j]!=g.styles[j];i&&(f&&f.end==b.frontier?f.end++:e.push(f={start:b.frontier,end:b.frontier+1})),g.stateAfter=hd(b.mode,d)}else Ud(a,g,d),g.stateAfter=0==b.frontier%5?hd(b.mode,d):null;return++b.frontier,+new Date>c?(bb(a,a.options.workDelay),!0):void 0}),e.length&&Fb(a,function(){for(var a=0;a<e.length;++a)Ib(this,e[a].start,e[a].end)})()}}function db(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1e3:100),h=b;h>g;--h){if(h<=f.first)return f.first;var i=le(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=Ye(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function eb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=db(a,b,c),g=f>d.first&&le(d,f-1).stateAfter;return g=g?hd(d.mode,g):id(d.mode),d.iter(f,b,function(c){Ud(a,c,g);var h=f==b-1||0==f%5||f>=e.showingFrom&&f<e.showingTo;c.stateAfter=h?hd(d.mode,g):null,++f}),c&&(d.frontier=f),g}function fb(a){return a.lineSpace.offsetTop}function gb(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function hb(a){var b=nf(a.measure,lf("pre",null,null,"text-align: left")).appendChild(lf("span","x"));return b.offsetLeft}function ib(a,b,c,d,e){var f=-1;if(d=d||lb(a,b),d.crude){var g=d.left+c*d.width;return{left:g,right:g+d.width,top:d.top,bottom:d.bottom}}for(var h=c;;h+=f){var i=d[h];if(i)break;0>f&&0==h&&(f=1)}return e=h>c?"left":c>h?"right":e,"left"==e&&i.leftSide?i=i.leftSide:"right"==e&&i.rightSide&&(i=i.rightSide),{left:c>h?i.right:i.left,right:h>c?i.left:i.right,top:i.top,bottom:i.bottom}}function jb(a,b){for(var c=a.display.measureLineCache,d=0;d<c.length;++d){var e=c[d];if(e.text==b.text&&e.markedSpans==b.markedSpans&&a.display.scroller.clientWidth==e.width&&e.classes==b.textClass+"|"+b.wrapClass)return e}}function kb(a,b){var c=jb(a,b);c&&(c.text=c.measure=c.markedSpans=null)}function lb(a,b){var c=jb(a,b);if(c)return c.measure;var d=mb(a,b),e=a.display.measureLineCache,f={text:b.text,width:a.display.scroller.clientWidth,markedSpans:b.markedSpans,measure:d,classes:b.textClass+"|"+b.wrapClass};return 16==e.length?e[++a.display.measureLineCachePos%16]=f:e.push(f),d}function mb(a,e){function t(a){var b=a.top-p.top,c=a.bottom-p.top;c>s&&(c=s),0>b&&(b=0);for(var d=q.length-2;d>=0;d-=2){var e=q[d],f=q[d+1];if(!(e>c||b>f)&&(b>=e&&f>=c||e>=b&&c>=f||Math.min(c,f)-Math.max(b,e)>=c-b>>1)){q[d]=Math.min(b,e),q[d+1]=Math.max(c,f);break}}return 0>d&&(d=q.length,q.push(b,c)),{left:a.left-p.left,right:a.right-p.left,top:d,bottom:null}}function u(a){a.bottom=q[a.top+1],a.top=q[a.top]}if(!a.options.lineWrapping&&e.text.length>=a.options.crudeMeasuringFrom)return nb(a,e);var f=a.display,g=ef(e.text.length),h=Xd(a,e,g,!0).pre;if(b&&!c&&!a.options.lineWrapping&&h.childNodes.length>100){for(var i=document.createDocumentFragment(),j=10,k=h.childNodes.length,l=0,m=Math.ceil(k/j);m>l;++l){for(var n=lf("div",null,null,"display: inline-block"),o=0;j>o&&k;++o)n.appendChild(h.firstChild),--k;i.appendChild(n)}h.appendChild(i)}nf(f.measure,h);var p=pf(f.lineDiv),q=[],r=ef(e.text.length),s=h.offsetHeight;d&&f.measure.first!=h&&nf(f.measure,h);for(var v,l=0;l<g.length;++l)if(v=g[l]){var w=v,x=null;if(/\bCodeMirror-widget\b/.test(v.className)&&v.getClientRects){1==v.firstChild.nodeType&&(w=v.firstChild);var y=w.getClientRects();y.length>1&&(x=r[l]=t(y[0]),x.rightSide=t(y[y.length-1]))}x||(x=r[l]=t(pf(w))),v.measureRight&&(x.right=pf(v.measureRight).left),v.leftSide&&(x.leftSide=t(pf(v.leftSide)))}mf(a.display.measure);for(var v,l=0;l<r.length;++l)(v=r[l])&&(u(v),v.leftSide&&u(v.leftSide),v.rightSide&&u(v.rightSide));return r}function nb(a,b){var c=new Od(b.text.slice(0,100),null);b.textClass&&(c.textClass=b.textClass);var d=mb(a,c),e=ib(a,c,0,d,"left"),f=ib(a,c,99,d,"right");return{crude:!0,top:e.top,left:e.left,bottom:e.bottom,width:(f.right-e.left)/100}}function ob(a,b){var c=!1;if(b.markedSpans)for(var d=0;d<b.markedSpans;++d){var e=b.markedSpans[d];!e.collapsed||null!=e.to&&e.to!=b.text.length||(c=!0)}var f=!c&&jb(a,b);if(f||b.text.length>=a.options.crudeMeasuringFrom)return ib(a,b,b.text.length,f&&f.measure,"right").right;var g=Xd(a,b,null,!0).pre,h=g.appendChild(vf(a.display.measure));return nf(a.display.measure,g),pf(h).right-pf(a.display.lineDiv).left}function pb(a){a.display.measureLineCache.length=a.display.measureLineCachePos=0,a.display.cachedCharWidth=a.display.cachedTextHeight=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function qb(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function rb(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function sb(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Md(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=re(a,b);if("local"==d?g+=fb(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=pf(a.display.lineSpace);g+=h.top+("window"==d?0:rb());var i=h.left+("window"==d?0:qb());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function tb(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=qb(),e-=rb();else if("local"==c||!c){var f=pf(a.display.sizer);d+=f.left,e+=f.top}var g=pf(a.display.lineSpace);return{left:d-g.left,top:e-g.top}}function ub(a,b,c,d,e){return d||(d=le(a.doc,b.line)),sb(a,d,ib(a,d,b.ch,null,e),c)}function vb(a,b,c,d,e){function f(b,f){var g=ib(a,d,b,e,f?"right":"left");return f?g.left=g.right:g.right=g.left,sb(a,d,g,c)}function g(a,b){var c=h[b],d=c.level%2;return a==Bf(c)&&b&&c.level<h[b-1].level?(c=h[--b],a=Cf(c)-(c.level%2?0:1),d=!0):a==Cf(c)&&b<h.length-1&&c.level<h[b+1].level&&(c=h[++b],a=Bf(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?f(a-1):f(a,d)}d=d||le(a.doc,b.line),e||(e=lb(a,d));var h=se(d),i=b.ch;if(!h)return f(i);var j=Jf(h,i),k=g(i,j);return null!=If&&(k.other=g(i,If)),k}function wb(a,b,c,d){var e=new Bc(a,b);return e.xRel=d,c&&(e.outside=!0),e}function xb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return wb(d.first,0,!0,-1);var e=qe(d,c),f=d.first+d.size-1;if(e>f)return wb(d.first+d.size-1,le(d,f).text.length,!0,1);for(0>b&&(b=0);;){var g=le(d,e),h=yb(a,g,e,b,c),i=Ed(g),j=i&&i.find();if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=j.to.line}}function yb(a,b,c,d,e){function j(d){var e=vb(a,Bc(c,d),"line",b,i);return g=!0,f>e.bottom?e.left-h:f<e.top?e.left+h:(g=!1,e.left)}var f=e-re(a,b),g=!1,h=2*a.display.wrapper.clientWidth,i=lb(a,b),k=se(b),l=b.text.length,m=Df(b),n=Ef(b),o=j(m),p=g,q=j(n),r=g;if(d>q)return wb(c,n,r,1);for(;;){if(k?n==m||n==Lf(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);kf.test(b.text.charAt(s));)++s;var u=wb(c,s,s==m?p:r,0>t?-1:t?1:0);return u}var v=Math.ceil(l/2),w=m+v;if(k){w=m;for(var x=0;v>x;++x)w=Lf(b,w,1)}var y=j(w);y>d?(n=w,q=y,(r=g)&&(q+=1e3),l=v):(m=w,o=y,p=g,l-=v)}}function Ab(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==zb){zb=lf("pre");for(var b=0;49>b;++b)zb.appendChild(document.createTextNode("x")),zb.appendChild(lf("br"));zb.appendChild(document.createTextNode("x"))}nf(a.measure,zb);var c=zb.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),mf(a.measure),c||1}function Bb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=lf("span","x"),c=lf("pre",[b]);nf(a.measure,c);var d=b.offsetWidth;return d>2&&(a.cachedCharWidth=d),d||10}function Db(a){a.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Cb},Pe++||(Oe=[])}function Eb(a){var b=a.curOp,c=a.doc,d=a.display;if(a.curOp=null,b.updateMaxLine&&I(a),d.maxLineChanged&&!a.options.lineWrapping&&d.maxLine){var e=ob(a,d.maxLine);d.sizer.style.minWidth=Math.max(0,e+3+Ve)+"px",d.maxLineChanged=!1;var f=Math.max(0,d.sizer.offsetLeft+d.sizer.offsetWidth-d.scroller.clientWidth);f<c.scrollLeft&&!b.updateScrollPos&&ac(a,Math.min(d.scroller.scrollLeft,f),!0)}var g,h;if(b.updateScrollPos)g=b.updateScrollPos;else if(b.selectionChanged&&d.scroller.clientHeight){var i=vb(a,c.sel.head);g=Rc(a,i.left,i.top,i.left,i.bottom)}if((b.changes.length||b.forceUpdate||g&&null!=g.scrollTop)&&(h=Q(a,b.changes,g&&g.scrollTop,b.forceUpdate),a.display.scroller.offsetHeight&&(a.doc.scrollTop=a.display.scroller.scrollTop)),!h&&b.selectionChanged&&Z(a),b.updateScrollPos){var j=Math.max(0,Math.min(d.scroller.scrollHeight-d.scroller.clientHeight,g.scrollTop)),k=Math.max(0,Math.min(d.scroller.scrollWidth-d.scroller.clientWidth,g.scrollLeft));d.scroller.scrollTop=d.scrollbarV.scrollTop=c.scrollTop=j,d.scroller.scrollLeft=d.scrollbarH.scrollLeft=c.scrollLeft=k,M(a),b.scrollToPos&&Pc(a,Gc(a.doc,b.scrollToPos.from),Gc(a.doc,b.scrollToPos.to),b.scrollToPos.margin)}else g&&Oc(a);b.selectionChanged&&ab(a),a.state.focused&&b.updateInput&&Mb(a,b.userSelChange);var l=b.maybeHiddenMarkers,m=b.maybeUnhiddenMarkers;if(l)for(var n=0;n<l.length;++n)l[n].lines.length||Ne(l[n],"hide");if(m)for(var n=0;n<m.length;++n)m[n].lines.length&&Ne(m[n],"unhide");var o;if(--Pe||(o=Oe,Oe=null),b.textChanged&&Ne(a,"change",a,b.textChanged),b.cursorActivity&&Ne(a,"cursorActivity",a),o)for(var n=0;n<o.length;++n)o[n]()}function Fb(a,b){return function(){var c=a||this,d=!c.curOp;d&&Db(c);try{var e=b.apply(c,arguments)}finally{d&&Eb(c)}return e}}function Gb(a){return function(){var c,b=this.cm&&!this.cm.curOp;b&&Db(this.cm);try{c=a.apply(this,arguments)}finally{b&&Eb(this.cm)}return c}}function Hb(a,b){var d,c=!a.curOp;c&&Db(a);try{d=b()}finally{c&&Eb(a)}return d}function Ib(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),a.curOp.changes.push({from:b,to:c,diff:d})}function Jb(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){Lb(a),a.state.focused&&Jb(a)})}function Kb(a){function c(){var d=Lb(a);d||b?(a.display.pollingFast=!1,Jb(a)):(b=!0,a.display.poll.set(60,c))}var b=!1;a.display.pollingFast=!0,a.display.poll.set(20,c)}function Lb(a){var c=a.display.input,e=a.display.prevInput,f=a.doc,g=f.sel;if(!a.state.focused||xf(c)||Ob(a)||a.state.disableInput)return!1;a.state.pasteIncoming&&a.state.fakedLastChar&&(c.value=c.value.substring(0,c.value.length-1),a.state.fakedLastChar=!1);var h=c.value;if(h==e&&Cc(g.from,g.to))return!1;if(b&&!d&&a.display.inputHasSelection===h)return Mb(a,!0),!1;var i=!a.curOp;i&&Db(a),g.shift=!1;for(var j=0,k=Math.min(e.length,h.length);k>j&&e.charCodeAt(j)==h.charCodeAt(j);)++j;var l=g.from,m=g.to;j<e.length?l=Bc(l.line,l.ch-(e.length-j)):a.state.overwrite&&Cc(l,m)&&!a.state.pasteIncoming&&(m=Bc(m.line,Math.min(le(f,m.line).text.length,m.ch+(h.length-j))));var n=a.curOp.updateInput,o={from:l,to:m,text:wf(h.slice(j)),origin:a.state.pasteIncoming?"paste":"+input"};return uc(a.doc,o,"end"),a.curOp.updateInput=n,Qe(a,"inputRead",a,o),h.length>1e3||h.indexOf("\n")>-1?c.value=a.display.prevInput="":a.display.prevInput=h,i&&Eb(a),a.state.pasteIncoming=!1,!0
3
- }function Mb(a,c){var e,f,g=a.doc;if(Cc(g.sel.from,g.sel.to))c&&(a.display.prevInput=a.display.input.value="",b&&!d&&(a.display.inputHasSelection=null));else{a.display.prevInput="",e=yf&&(g.sel.to.line-g.sel.from.line>100||(f=a.getSelection()).length>1e3);var h=e?"-":f||a.getSelection();a.display.input.value=h,a.state.focused&&af(a.display.input),b&&!d&&(a.display.inputHasSelection=h)}a.display.inaccurateSelection=e}function Nb(a){"nocursor"==a.options.readOnly||p&&document.activeElement==a.display.input||a.display.input.focus()}function Ob(a){return a.options.readOnly||a.doc.cantEdit}function Pb(a){function e(){a.state.focused&&setTimeout(ff(Nb,a),0)}function h(){null==g&&(g=setTimeout(function(){g=null,c.cachedCharWidth=c.cachedTextHeight=sf=null,pb(a),Hb(a,ff(Ib,a))},100))}function i(){for(var a=c.wrapper.parentNode;a&&a!=document.body;a=a.parentNode);a?setTimeout(i,5e3):Me(window,"resize",h)}function j(b){Re(a,b)||a.options.onDragEvent&&a.options.onDragEvent(a,Ee(b))||Ie(b)}function l(){c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,c.input.value=a.getSelection(),af(c.input))}var c=a.display;Le(c.scroller,"mousedown",Fb(a,Ub)),b?Le(c.scroller,"dblclick",Fb(a,function(b){if(!Re(a,b)){var c=Rb(a,b);if(c&&!Xb(a,b)&&!Qb(a.display,b)){Fe(b);var d=Yc(le(a.doc,c.line).text,c);Jc(a.doc,d.from,d.to)}}})):Le(c.scroller,"dblclick",function(b){Re(a,b)||Fe(b)}),Le(c.lineSpace,"selectstart",function(a){Qb(c,a)||Fe(a)}),u||Le(c.scroller,"contextmenu",function(b){pc(a,b)}),Le(c.scroller,"scroll",function(){c.scroller.clientHeight&&(_b(a,c.scroller.scrollTop),ac(a,c.scroller.scrollLeft,!0),Ne(a,"scroll",a))}),Le(c.scrollbarV,"scroll",function(){c.scroller.clientHeight&&_b(a,c.scrollbarV.scrollTop)}),Le(c.scrollbarH,"scroll",function(){c.scroller.clientHeight&&ac(a,c.scrollbarH.scrollLeft)}),Le(c.scroller,"mousewheel",function(b){dc(a,b)}),Le(c.scroller,"DOMMouseScroll",function(b){dc(a,b)}),Le(c.scrollbarH,"mousedown",e),Le(c.scrollbarV,"mousedown",e),Le(c.wrapper,"scroll",function(){c.wrapper.scrollTop=c.wrapper.scrollLeft=0});var g;Le(window,"resize",h),setTimeout(i,5e3),Le(c.input,"keyup",Fb(a,function(b){Re(a,b)||a.options.onKeyEvent&&a.options.onKeyEvent(a,Ee(b))||16==b.keyCode&&(a.doc.sel.shift=!1)})),Le(c.input,"input",function(){b&&!d&&a.display.inputHasSelection&&(a.display.inputHasSelection=null),Kb(a)}),Le(c.input,"keydown",Fb(a,kc)),Le(c.input,"keypress",Fb(a,lc)),Le(c.input,"focus",ff(mc,a)),Le(c.input,"blur",ff(nc,a)),a.options.dragDrop&&(Le(c.scroller,"dragstart",function(b){$b(a,b)}),Le(c.scroller,"dragenter",j),Le(c.scroller,"dragover",j),Le(c.scroller,"drop",Fb(a,Zb))),Le(c.scroller,"paste",function(b){Qb(c,b)||(Nb(a),Kb(a))}),Le(c.input,"paste",function(){if(f&&!a.state.fakedLastChar&&!(new Date-a.state.lastMiddleDown<200)){var b=c.input.selectionStart,d=c.input.selectionEnd;c.input.value+="$",c.input.selectionStart=b,c.input.selectionEnd=d,a.state.fakedLastChar=!0}a.state.pasteIncoming=!0,Kb(a)}),Le(c.input,"cut",l),Le(c.input,"copy",l),k&&Le(c.sizer,"mouseup",function(){document.activeElement==c.input&&c.input.blur(),Nb(a)})}function Qb(a,b){for(var c=Je(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function Rb(a,b,c){var d=a.display;if(!c){var e=Je(b);if(e==d.scrollbarH||e==d.scrollbarH.firstChild||e==d.scrollbarV||e==d.scrollbarV.firstChild||e==d.scrollbarFiller||e==d.gutterFiller)return null}var f,g,h=pf(d.lineSpace);try{f=b.clientX,g=b.clientY}catch(b){return null}return xb(a,f-h.left,g-h.top)}function Ub(a){function q(a){if(!Cc(p,a)){if(p=a,"single"==j)return Jc(c.doc,Gc(e,h),a),void 0;if(n=Gc(e,n),o=Gc(e,o),"double"==j){var b=Yc(le(e,a.line).text,a);Dc(a,n)?Jc(c.doc,b.from,o):Jc(c.doc,n,b.to)}else"triple"==j&&(Dc(a,n)?Jc(c.doc,o,Gc(e,Bc(a.line,0))):Jc(c.doc,n,Gc(e,Bc(a.line+1,0))))}}function t(a){var b=++s,f=Rb(c,a,!0);if(f)if(Cc(f,l)){var h=a.clientY<r.top?-20:a.clientY>r.bottom?20:0;h&&setTimeout(Fb(c,function(){s==b&&(d.scroller.scrollTop+=h,t(a))}),50)}else{c.state.focused||mc(c),l=f,q(f);var g=L(d,e);(f.line>=g.to||f.line<g.from)&&setTimeout(Fb(c,function(){s==b&&t(a)}),150)}}function v(a){s=1/0,Fe(a),Nb(c),Me(document,"mousemove",w),Me(document,"mouseup",x)}if(!Re(this,a)){var c=this,d=c.display,e=c.doc,g=e.sel;if(g.shift=a.shiftKey,Qb(d,a))return f||(d.scroller.draggable=!1,setTimeout(function(){d.scroller.draggable=!0},100)),void 0;if(!Xb(c,a)){var h=Rb(c,a);switch(Ke(a)){case 3:return u&&pc.call(c,c,a),void 0;case 2:return f&&(c.state.lastMiddleDown=+new Date),h&&Jc(c.doc,h),setTimeout(ff(Nb,c),20),Fe(a),void 0}if(!h)return Je(a)==d.scroller&&Fe(a),void 0;c.state.focused||mc(c);var i=+new Date,j="single";if(Tb&&Tb.time>i-400&&Cc(Tb.pos,h))j="triple",Fe(a),setTimeout(ff(Nb,c),20),Zc(c,h.line);else if(Sb&&Sb.time>i-400&&Cc(Sb.pos,h)){j="double",Tb={time:i,pos:h},Fe(a);var k=Yc(le(e,h.line).text,h);Jc(c.doc,k.from,k.to)}else Sb={time:i,pos:h};var l=h;if(c.options.dragDrop&&qf&&!Ob(c)&&!Cc(g.from,g.to)&&!Dc(h,g.from)&&!Dc(g.to,h)&&"single"==j){var m=Fb(c,function(b){f&&(d.scroller.draggable=!1),c.state.draggingText=!1,Me(document,"mouseup",m),Me(d.scroller,"drop",m),Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10&&(Fe(b),Jc(c.doc,h),Nb(c))});return f&&(d.scroller.draggable=!0),c.state.draggingText=m,d.scroller.dragDrop&&d.scroller.dragDrop(),Le(document,"mouseup",m),Le(d.scroller,"drop",m),void 0}Fe(a),"single"==j&&Jc(c.doc,Gc(e,h));var n=g.from,o=g.to,p=h,r=pf(d.wrapper),s=0,w=Fb(c,function(a){b||Ke(a)?t(a):v(a)}),x=Fb(c,v);Le(document,"mousemove",w),Le(document,"mouseup",x)}}}function Vb(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(b){return!1}if(f>=Math.floor(pf(a.display.gutters).right))return!1;d&&Fe(b);var h=a.display,i=pf(h.lineDiv);if(g>i.bottom||!Te(a,c))return He(b);g-=i.top-h.viewOffset;for(var j=0;j<a.options.gutters.length;++j){var k=h.gutters.childNodes[j];if(k&&pf(k).right>=f){var l=qe(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),He(b)}}}function Wb(a,b){return Te(a,"gutterContextMenu")?Vb(a,b,"gutterContextMenu",!1,Ne):!1}function Xb(a,b){return Vb(a,b,"gutterClick",!0,Qe)}function Zb(a){var c=this;if(!(Re(c,a)||Qb(c.display,a)||c.options.onDragEvent&&c.options.onDragEvent(c,Ee(a)))){Fe(a),b&&(Yb=+new Date);var d=Rb(c,a,!0),e=a.dataTransfer.files;if(d&&!Ob(c))if(e&&e.length&&window.FileReader&&window.File)for(var f=e.length,g=Array(f),h=0,i=function(a,b){var e=new FileReader;e.onload=function(){g[b]=e.result,++h==f&&(d=Gc(c.doc,d),uc(c.doc,{from:d,to:d,text:wf(g.join("\n")),origin:"paste"},"around"))},e.readAsText(a)},j=0;f>j;++j)i(e[j],j);else{if(c.state.draggingText&&!Dc(d,c.doc.sel.from)&&!Dc(c.doc.sel.to,d))return c.state.draggingText(a),setTimeout(ff(Nb,c),20),void 0;try{var g=a.dataTransfer.getData("Text");if(g){var k=c.doc.sel.from,l=c.doc.sel.to;Lc(c.doc,d,d),c.state.draggingText&&Ac(c.doc,"",k,l,"paste"),c.replaceSelection(g,null,"paste"),Nb(c)}}catch(a){}}}}function $b(a,c){if(b&&(!a.state.draggingText||+new Date-Yb<100))return Ie(c),void 0;if(!Re(a,c)&&!Qb(a.display,c)){var d=a.getSelection();if(c.dataTransfer.setData("Text",d),c.dataTransfer.setDragImage&&!j){var e=lf("img",null,null,"position: fixed; left: 0; top: 0;");e.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",i&&(e.width=e.height=1,a.display.wrapper.appendChild(e),e._top=e.offsetTop),c.dataTransfer.setDragImage(e,0,0),i&&e.parentNode.removeChild(e)}}}function _b(b,c){Math.abs(b.doc.scrollTop-c)<2||(b.doc.scrollTop=c,a||Q(b,[],c),b.display.scroller.scrollTop!=c&&(b.display.scroller.scrollTop=c),b.display.scrollbarV.scrollTop!=c&&(b.display.scrollbarV.scrollTop=c),a&&Q(b,[]),bb(b,100))}function ac(a,b,c){(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,M(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function dc(b,c){var d=c.wheelDeltaX,e=c.wheelDeltaY;null==d&&c.detail&&c.axis==c.HORIZONTAL_AXIS&&(d=c.detail),null==e&&c.detail&&c.axis==c.VERTICAL_AXIS?e=c.detail:null==e&&(e=c.wheelDelta);var g=b.display,h=g.scroller;if(d&&h.scrollWidth>h.clientWidth||e&&h.scrollHeight>h.clientHeight){if(e&&q&&f)for(var j=c.target;j!=h;j=j.parentNode)if(j.lineObj){b.display.currentWheelTarget=j;break}if(d&&!a&&!i&&null!=cc)return e&&_b(b,Math.max(0,Math.min(h.scrollTop+e*cc,h.scrollHeight-h.clientHeight))),ac(b,Math.max(0,Math.min(h.scrollLeft+d*cc,h.scrollWidth-h.clientWidth))),Fe(c),g.wheelStartX=null,void 0;if(e&&null!=cc){var k=e*cc,l=b.doc.scrollTop,m=l+g.wrapper.clientHeight;0>k?l=Math.max(0,l+k-50):m=Math.min(b.doc.height,m+k+50),Q(b,[],{top:l,bottom:m})}20>bc&&(null==g.wheelStartX?(g.wheelStartX=h.scrollLeft,g.wheelStartY=h.scrollTop,g.wheelDX=d,g.wheelDY=e,setTimeout(function(){if(null!=g.wheelStartX){var a=h.scrollLeft-g.wheelStartX,b=h.scrollTop-g.wheelStartY,c=b&&g.wheelDY&&b/g.wheelDY||a&&g.wheelDX&&a/g.wheelDX;g.wheelStartX=g.wheelStartY=null,c&&(cc=(cc*bc+c)/(bc+1),++bc)}},200)):(g.wheelDX+=d,g.wheelDY+=e))}}function ec(a,b,c){if("string"==typeof b&&(b=jd[b],!b))return!1;a.display.pollingFast&&Lb(a)&&(a.display.pollingFast=!1);var d=a.doc,e=d.sel.shift,f=!1;try{Ob(a)&&(a.state.suppressEdits=!0),c&&(d.sel.shift=!1),f=b(a)!=We}finally{d.sel.shift=e,a.state.suppressEdits=!1}return f}function fc(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function hc(a,b){var c=ld(a.options.keyMap),e=c.auto;clearTimeout(gc),e&&!nd(b)&&(gc=setTimeout(function(){ld(a.options.keyMap)==c&&(a.options.keyMap=e.call?e.call(null,a):e,D(a))},50));var f=od(b,!0),g=!1;if(!f)return!1;var h=fc(a);return g=b.shiftKey?md("Shift-"+f,h,function(b){return ec(a,b,!0)})||md(f,h,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?ec(a,b):void 0}):md(f,h,function(b){return ec(a,b)}),g&&(Fe(b),ab(a),d&&(b.oldKeyCode=b.keyCode,b.keyCode=0),Qe(a,"keyHandled",a,f,b)),g}function ic(a,b,c){var d=md("'"+c+"'",fc(a),function(b){return ec(a,b,!0)});return d&&(Fe(b),ab(a),Qe(a,"keyHandled",a,"'"+c+"'",b)),d}function kc(a){var c=this;if(c.state.focused||mc(c),!(Re(c,a)||c.options.onKeyEvent&&c.options.onKeyEvent(c,Ee(a)))){b&&27==a.keyCode&&(a.returnValue=!1);var d=a.keyCode;c.doc.sel.shift=16==d||a.shiftKey;var e=hc(c,a);i&&(jc=e?d:null,!e&&88==d&&!yf&&(q?a.metaKey:a.ctrlKey)&&c.replaceSelection(""))}}function lc(a){var c=this;if(!(Re(c,a)||c.options.onKeyEvent&&c.options.onKeyEvent(c,Ee(a)))){var e=a.keyCode,f=a.charCode;if(i&&e==jc)return jc=null,Fe(a),void 0;if(!(i&&(!a.which||a.which<10)||k)||!hc(c,a)){var g=String.fromCharCode(null==f?e:f);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!Ob(this)&&this.doc.mode.electricChars.indexOf(g)>-1&&setTimeout(Fb(c,function(){Uc(c,c.doc.sel.to.line,"smart")}),75),ic(c,a,g)||(b&&!d&&(c.display.inputHasSelection=null),Kb(c))}}}function mc(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(Ne(a,"focus",a),a.state.focused=!0,-1==a.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(a.display.wrapper.className+=" CodeMirror-focused"),a.curOp||(Mb(a,!0),f&&setTimeout(ff(Mb,a,!0),0))),Jb(a),ab(a))}function nc(a){a.state.focused&&(Ne(a,"blur",a),a.state.focused=!1,a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.doc.sel.shift=!1)},150)}function pc(a,c){function l(){if(null!=e.input.selectionStart){var a=e.input.value="\u200b"+(Cc(f.from,f.to)?"":e.input.value);e.prevInput="\u200b",e.input.selectionStart=1,e.input.selectionEnd=a.length}}function m(){if(e.inputDiv.style.position="relative",e.input.style.cssText=k,d&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=h),Jb(a),null!=e.input.selectionStart){(!b||d)&&l(),clearTimeout(oc);var c=0,f=function(){" "==e.prevInput&&0==e.input.selectionStart?Fb(a,jd.selectAll)(a):c++<10?oc=setTimeout(f,500):Mb(a)};oc=setTimeout(f,200)}}if(!Re(a,c,"contextmenu")){var e=a.display,f=a.doc.sel;if(!Qb(e,c)&&!Wb(a,c)){var g=Rb(a,c),h=e.scroller.scrollTop;if(g&&!i){var j=a.options.resetSelectionOnContextMenu;j&&(Cc(f.from,f.to)||Dc(g,f.from)||!Dc(g,f.to))&&Fb(a,Lc)(a.doc,g,g);var k=e.input.style.cssText;if(e.inputDiv.style.position="absolute",e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(c.clientY-5)+"px; left: "+(c.clientX-5)+"px; z-index: 1000; background: white; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",Nb(a),Mb(a,!0),Cc(f.from,f.to)&&(e.input.value=e.prevInput=" "),b&&!d&&l(),u){Ie(c);var n=function(){Me(window,"mouseup",n),setTimeout(m,20)};Le(window,"mouseup",n)}else setTimeout(m,50)}}}}function rc(a,b,c){if(!Dc(b.from,c))return Gc(a,c);var d=b.text.length-1-(b.to.line-b.from.line);if(c.line>b.to.line+d){var e=c.line-d,f=a.first+a.size-1;return e>f?Bc(f,le(a,f).text.length):Hc(c,le(a,e).text.length)}if(c.line==b.to.line+d)return Hc(c,_e(b.text).length+(1==b.text.length?b.from.ch:0)+le(a,b.to.line).text.length-b.to.ch);var g=c.line-b.from.line;return Hc(c,b.text[g].length+(g?0:b.from.ch))}function sc(a,b,c){if(c&&"object"==typeof c)return{anchor:rc(a,b,c.anchor),head:rc(a,b,c.head)};if("start"==c)return{anchor:b.from,head:b.from};var d=qc(b);if("around"==c)return{anchor:b.from,head:d};if("end"==c)return{anchor:d,head:d};var e=function(a){if(Dc(a,b.from))return a;if(!Dc(b.to,a))return d;var c=a.line+b.text.length-(b.to.line-b.from.line)-1,e=a.ch;return a.line==b.to.line&&(e+=d.ch-b.to.ch),Bc(c,e)};return{anchor:e(a.sel.anchor),head:e(a.sel.head)}}function tc(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};return c&&(d.update=function(b,c,d,e){b&&(this.from=Gc(a,b)),c&&(this.to=Gc(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),Ne(a,"beforeChange",a,d),a.cm&&Ne(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function uc(a,b,c,d){if(a.cm){if(!a.cm.curOp)return Fb(a.cm,uc)(a,b,c,d);if(a.cm.state.suppressEdits)return}if(!(Te(a,"beforeChange")||a.cm&&Te(a.cm,"beforeChange"))||(b=tc(a,b,!0))){var e=v&&!d&&Bd(a,b.from,b.to);if(e){for(var f=e.length-1;f>=1;--f)vc(a,{from:e[f].from,to:e[f].to,text:[""]});e.length&&vc(a,{from:e[0].from,to:e[0].to,text:b.text},c)}else vc(a,b,c)}}function vc(a,b,c){if(1!=b.text.length||""!=b.text[0]||!Cc(b.from,b.to)){var d=sc(a,b,c);we(a,b,d,a.cm?a.cm.curOp.id:0/0),yc(a,b,d,zd(a,b));var e=[];je(a,function(a,c){c||-1!=bf(e,a.history)||(Ce(a.history,b),e.push(a.history)),yc(a,b,null,zd(a,b))})}}function wc(a,b){if(!a.cm||!a.cm.state.suppressEdits){var c=a.history,d=("undo"==b?c.done:c.undone).pop();if(d){var e={changes:[],anchorBefore:d.anchorAfter,headBefore:d.headAfter,anchorAfter:d.anchorBefore,headAfter:d.headBefore,generation:c.generation};("undo"==b?c.undone:c.done).push(e),c.generation=d.generation||++c.maxGeneration;for(var f=Te(a,"beforeChange")||a.cm&&Te(a.cm,"beforeChange"),g=d.changes.length-1;g>=0;--g){var h=d.changes[g];if(h.origin=b,f&&!tc(a,h,!1))return("undo"==b?c.done:c.undone).length=0,void 0;e.changes.push(ve(a,h));var i=g?sc(a,h,null):{anchor:d.anchorBefore,head:d.headBefore};yc(a,h,i,Ad(a,h));var j=[];je(a,function(a,b){b||-1!=bf(j,a.history)||(Ce(a.history,h),j.push(a.history)),yc(a,h,null,Ad(a,h))})}}}}function xc(a,b){function c(a){return Bc(a.line+b,a.ch)}a.first+=b,a.cm&&Ib(a.cm,a.first,a.first,b),a.sel.head=c(a.sel.head),a.sel.anchor=c(a.sel.anchor),a.sel.from=c(a.sel.from),a.sel.to=c(a.sel.to)}function yc(a,b,c,d){if(a.cm&&!a.cm.curOp)return Fb(a.cm,yc)(a,b,c,d);if(b.to.line<a.first)return xc(a,b.text.length-1-(b.to.line-b.from.line)),void 0;if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);xc(a,e),b={from:Bc(a.first,0),to:Bc(b.to.line+e,b.to.ch),text:[_e(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:Bc(f,le(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=me(a,b.from,b.to),c||(c=sc(a,b,null)),a.cm?zc(a.cm,b,d,c):ce(a,b,d,c)}}function zc(a,b,c,d){var e=a.doc,f=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=pe(Fd(e,le(e,g.line))),e.iter(j,h.line+1,function(a){return a==f.maxLine?(i=!0,!0):void 0})),Dc(e.sel.head,b.from)||Dc(b.to,e.sel.head)||(a.curOp.cursorActivity=!0),ce(e,b,c,d,B(a)),a.options.lineWrapping||(e.iter(j,g.line+b.text.length,function(a){var b=H(e,a);b>f.maxLineLength&&(f.maxLine=a,f.maxLineLength=b,f.maxLineChanged=!0,i=!1)}),i&&(a.curOp.updateMaxLine=!0)),e.frontier=Math.min(e.frontier,g.line),bb(a,400);var k=b.text.length-(h.line-g.line)-1;if(Ib(a,g.line,h.line+1,k),Te(a,"change")){var l={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};if(a.curOp.textChanged){for(var m=a.curOp.textChanged;m.next;m=m.next);m.next=l}else a.curOp.textChanged=l}}function Ac(a,b,c,d,e){if(d||(d=c),Dc(d,c)){var f=d;d=c,c=f}"string"==typeof b&&(b=wf(b)),uc(a,{from:c,to:d,text:b,origin:e},null)}function Bc(a,b){return this instanceof Bc?(this.line=a,this.ch=b,void 0):new Bc(a,b)}function Cc(a,b){return a.line==b.line&&a.ch==b.ch}function Dc(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function Ec(a){return Bc(a.line,a.ch)}function Fc(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function Gc(a,b){if(b.line<a.first)return Bc(a.first,0);var c=a.first+a.size-1;return b.line>c?Bc(c,le(a,c).text.length):Hc(b,le(a,b.line).text.length)}function Hc(a,b){var c=a.ch;return null==c||c>b?Bc(a.line,b):0>c?Bc(a.line,0):a}function Ic(a,b){return b>=a.first&&b<a.first+a.size}function Jc(a,b,c,d){if(a.sel.shift||a.sel.extend){var e=a.sel.anchor;if(c){var f=Dc(b,e);f!=Dc(c,e)?(e=b,b=c):f!=Dc(b,c)&&(b=c)}Lc(a,e,b,d)}else Lc(a,b,c||b,d);a.cm&&(a.cm.curOp.userSelChange=!0)}function Kc(a,b,c){var d={anchor:b,head:c};return Ne(a,"beforeSelectionChange",a,d),a.cm&&Ne(a.cm,"beforeSelectionChange",a.cm,d),d.anchor=Gc(a,d.anchor),d.head=Gc(a,d.head),d}function Lc(a,b,c,d,e){if(!e&&Te(a,"beforeSelectionChange")||a.cm&&Te(a.cm,"beforeSelectionChange")){var f=Kc(a,b,c);c=f.head,b=f.anchor}var g=a.sel;if(g.goalColumn=null,null==d&&(d=Dc(c,g.head)?-1:1),(e||!Cc(b,g.anchor))&&(b=Nc(a,b,d,"push"!=e)),(e||!Cc(c,g.head))&&(c=Nc(a,c,d,"push"!=e)),!Cc(g.anchor,b)||!Cc(g.head,c)){g.anchor=b,g.head=c;var h=Dc(c,b);g.from=h?c:b,g.to=h?b:c,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=a.cm.curOp.cursorActivity=!0),Qe(a,"cursorActivity",a)}}function Mc(a){Lc(a.doc,a.doc.sel.from,a.doc.sel.to,null,"push")}function Nc(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=le(a,f.line);if(h.markedSpans)for(var i=0;i<h.markedSpans.length;++i){var j=h.markedSpans[i],k=j.marker;if((null==j.from||(k.inclusiveLeft?j.from<=f.ch:j.from<f.ch))&&(null==j.to||(k.inclusiveRight?j.to>=f.ch:j.to>f.ch))){if(d&&(Ne(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find()[0>g?"from":"to"];if(Cc(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?Gc(a,Bc(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?Bc(l.line+1,0):null),!l)){if(e)return d?(a.cantEdit=!0,Bc(a.first,0)):Nc(a,b,c,!0);e=!0,l=b,g=-g}f=l;continue a}}return f}}function Oc(a){var b=Pc(a,a.doc.sel.head,null,a.options.cursorScrollMargin);if(a.state.focused){var c=a.display,d=pf(c.sizer),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!n){var f="none"==c.cursor.style.display;f&&(c.cursor.style.display="",c.cursor.style.left=b.left+"px",c.cursor.style.top=b.top-c.viewOffset+"px"),c.cursor.scrollIntoView(e),f&&(c.cursor.style.display="none")}}}function Pc(a,b,c,d){for(null==d&&(d=0);;){var e=!1,f=vb(a,b),g=c&&c!=b?vb(a,c):f,h=Rc(a,Math.min(f.left,g.left),Math.min(f.top,g.top)-d,Math.max(f.left,g.left),Math.max(f.bottom,g.bottom)+d),i=a.doc.scrollTop,j=a.doc.scrollLeft;if(null!=h.scrollTop&&(_b(a,h.scrollTop),Math.abs(a.doc.scrollTop-i)>1&&(e=!0)),null!=h.scrollLeft&&(ac(a,h.scrollLeft),Math.abs(a.doc.scrollLeft-j)>1&&(e=!0)),!e)return f}}function Qc(a,b,c,d,e){var f=Rc(a,b,c,d,e);null!=f.scrollTop&&_b(a,f.scrollTop),null!=f.scrollLeft&&ac(a,f.scrollLeft)}function Rc(a,b,c,d,e){var f=a.display,g=Ab(a.display);0>c&&(c=0);var h=f.scroller.clientHeight-Ve,i=f.scroller.scrollTop,j={},k=a.doc.height+gb(f),l=g>c,m=e>k-g;if(i>c)j.scrollTop=l?0:c;else if(e>i+h){var n=Math.min(c,(m?k:e)-h);n!=i&&(j.scrollTop=n)}var o=f.scroller.clientWidth-Ve,p=f.scroller.scrollLeft;b+=f.gutters.offsetWidth,d+=f.gutters.offsetWidth;var q=f.gutters.offsetWidth,r=q+10>b;return p+q>b||r?(r&&(b=0),j.scrollLeft=Math.max(0,b-10-q)):d>o+p-3&&(j.scrollLeft=d+10-o),j}function Sc(a,b,c){a.curOp.updateScrollPos={scrollLeft:null==b?a.doc.scrollLeft:b,scrollTop:null==c?a.doc.scrollTop:c}}function Tc(a,b,c){var d=a.curOp.updateScrollPos||(a.curOp.updateScrollPos={scrollLeft:a.doc.scrollLeft,scrollTop:a.doc.scrollTop}),e=a.display.scroller;d.scrollTop=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,d.scrollTop+c)),d.scrollLeft=Math.max(0,Math.min(e.scrollWidth-e.clientWidth,d.scrollLeft+b))}function Uc(a,b,c,d){var e=a.doc;if(null==c&&(c="add"),"smart"==c)if(a.doc.mode.indent)var f=eb(a,b);else c="prev";var k,g=a.options.tabSize,h=le(e,b),i=Ye(h.text,null,g),j=h.text.match(/^\s*/)[0];if("smart"==c&&(k=a.doc.mode.indent(f,h.text.slice(j.length),h.text),k==We)){if(!d)return;c="prev"}"prev"==c?k=b>e.first?Ye(le(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c?k=i-a.options.indentUnit:"number"==typeof c&&(k=i+c),k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(k/g);n;--n)m+=g,l+=" ";k>m&&(l+=$e(k-m)),l!=j?Ac(a.doc,l,Bc(b,0),Bc(b,j.length),"+input"):e.sel.head.line==b&&e.sel.head.ch<j.length&&Lc(e,Bc(b,j.length),Bc(b,j.length),1),h.stateAfter=null}function Vc(a,b,c){var d=b,e=b,f=a.doc;return"number"==typeof b?e=le(f,Fc(f,b)):d=pe(b),null==d?null:c(e,d)?(Ib(a,d,d+1),e):null}function Wc(a,b,c,d,e){function k(){var b=f+c;return b<a.first||b>=a.first+a.size?j=!1:(f=b,i=le(a,b))}function l(a){var b=(e?Lf:Mf)(i,g,c,!0);if(null==b){if(a||!k())return j=!1;g=e?(0>c?Ef:Df)(i):0>c?i.text.length:0}else g=b;return!0}var f=b.line,g=b.ch,h=c,i=le(a,f),j=!0;if("char"==d)l();else if("column"==d)l(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=!0;!(0>c)||l(!o);o=!1){var p=i.text.charAt(g)||"\n",q=hf(p)?"w":n?/\s/.test(p)?null:"p":null;if(m&&m!=q){0>c&&(c=1,l());break}if(q&&(m=q),c>0&&!l(!o))break}var r=Nc(a,Bc(f,g),h,!0);return j||(r.hitSide=!0),r}function Xc(a,b,c,d){var g,e=a.doc,f=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);g=b.top+c*(h-(0>c?1.5:.5)*Ab(a.display))}else"line"==d&&(g=c>0?b.bottom+3:b.top-3);for(;;){var i=xb(a,f,g);if(!i.outside)break;if(0>c?0>=g:g>=e.height){i.hitSide=!0;break}g+=5*c}return i}function Yc(a,b){var c=b.ch,d=b.ch;if(a){(b.xRel<0||d==a.length)&&c?--c:++d;for(var e=a.charAt(c),f=hf(e)?hf:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!hf(a)};c>0&&f(a.charAt(c-1));)--c;for(;d<a.length&&f(a.charAt(d));)++d}return{from:Bc(b.line,c),to:Bc(b.line,d)}}function Zc(a,b){Jc(a.doc,Bc(b,0),Gc(a.doc,Bc(b+1,0)))}function ad(a,b,c,d){x.defaults[a]=b,c&&($c[a]=d?function(a,b,d){d!=bd&&c(a,b,d)}:c)}function hd(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function id(a,b,c){return a.startState?a.startState(b,c):!0}function ld(a){return"string"==typeof a?kd[a]:a}function md(a,b,c){function d(b){b=ld(b);var e=b[a];if(e===!1)return"stop";if(null!=e&&c(e))return!0;if(b.nofallthrough)return"stop";var f=b.fallthrough;if(null==f)return!1;if("[object Array]"!=Object.prototype.toString.call(f))return d(f);for(var g=0,h=f.length;h>g;++g){var i=d(f[g]);if(i)return i}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return"stop"!=f}}function nd(a){var b=zf[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b}function od(a,b){if(i&&34==a.keyCode&&a["char"])return!1;var c=zf[a.keyCode];return null==c||a.altGraphKey?!1:(a.altKey&&(c="Alt-"+c),(t?a.metaKey:a.ctrlKey)&&(c="Ctrl-"+c),(t?a.ctrlKey:a.metaKey)&&(c="Cmd-"+c),!b&&a.shiftKey&&(c="Shift-"+c),c)}function pd(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0}function qd(a,b){this.lines=[],this.type=b,this.doc=a}function rd(a,b,c,d,e){if(d&&d.shared)return td(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return Fb(a.cm,rd)(a,b,c,d,e);var f=new qd(a,e);if(Dc(c,b)||Cc(b,c)&&"range"==e&&(!d.inclusiveLeft||!d.inclusiveRight))return f;d&&df(d,f),f.replacedWith&&(f.collapsed=!0,f.replacedWith=lf("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||(f.replacedWith.ignoreEvents=!0)),f.collapsed&&(w=!0),f.addToHistory&&we(a,{from:b,to:c,origin:"markText"},{head:a.sel.head,anchor:a.sel.anchor},0/0);var i,j,l,g=b.line,h=0,k=a.cm;if(a.iter(g,c.line+1,function(d){k&&f.collapsed&&!k.options.lineWrapping&&Fd(a,d)==k.display.maxLine&&(l=!0);var e={from:null,to:null,marker:f};h+=d.text.length,g==b.line&&(e.from=b.ch,h-=b.ch),g==c.line&&(e.to=c.ch,h-=d.text.length-c.ch),f.collapsed&&(g==c.line&&(j=Cd(d,c.ch)),g==b.line?i=Cd(d,b.ch):oe(d,0)),wd(d,e),++g}),f.collapsed&&a.iter(b.line,c.line+1,function(b){Gd(a,b)&&oe(b,0)}),f.clearOnEnter&&Le(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(v=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed){if(i!=j)throw new Error("Inserting collapsed marker overlapping an existing one");f.size=h,f.atomic=!0}return k&&(l&&(k.curOp.updateMaxLine=!0),(f.className||f.title||f.startStyle||f.endStyle||f.collapsed)&&Ib(k,b.line,c.line+1),f.atomic&&Mc(k)),f}function sd(a,b){this.markers=a,this.primary=b;for(var c=0,d=this;c<a.length;++c)a[c].parent=this,Le(a[c],"clear",function(){d.clear()})}function td(a,b,c,d,e){d=df(d),d.shared=!1;var f=[rd(a,b,c,d,e)],g=f[0],h=d.replacedWith;return je(a,function(a){h&&(d.replacedWith=h.cloneNode(!0)),f.push(rd(a,Gc(a,b),Gc(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=_e(f)}),new sd(f,g)}function ud(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function vd(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function wd(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function xd(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],g=f.marker,h=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||(g.inclusiveLeft&&g.inclusiveRight||"bookmark"==g.type)&&f.from==b&&(!c||!f.marker.insertLeft)){var i=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);(e||(e=[])).push({from:f.from,to:i?null:f.to,marker:g})}}return e}function yd(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);if(h||"bookmark"==g.type&&f.from==b&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);(e||(e=[])).push({from:i?null:f.from-b,to:null==f.to?null:f.to-b,marker:g})}}return e}function zd(a,b){var c=Ic(a,b.from.line)&&le(a,b.from.line).markedSpans,d=Ic(a,b.to.line)&&le(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=Cc(b.from,b.to),h=xd(c,e,g),i=yd(d,f,g),j=1==b.text.length,k=_e(b.text).length+(j?e:0);if(h)for(var l=0;l<h.length;++l){var m=h[l];if(null==m.to){var n=ud(i,m.marker);n?j&&(m.to=null==n.to?null:n.to+k):m.to=e}}if(i)for(var l=0;l<i.length;++l){var m=i[l];if(null!=m.to&&(m.to+=k),null==m.from){var n=ud(h,m.marker);n||(m.from=k,j&&(h||(h=[])).push(m))}else m.from+=k,j&&(h||(h=[])).push(m)}if(j&&h){for(var l=0;l<h.length;++l)null!=h[l].from&&h[l].from==h[l].to&&"bookmark"!=h[l].marker.type&&h.splice(l--,1);h.length||(h=null)}var o=[h];if(!j){var q,p=b.text.length-2;if(p>0&&h)for(var l=0;l<h.length;++l)null==h[l].to&&(q||(q=[])).push({from:null,to:null,marker:h[l].marker});for(var l=0;p>l;++l)o.push(q);o.push(i)}return o}function Ad(a,b){var c=ye(a,b),d=zd(a,b);if(!c)return d;if(!d)return c;for(var e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g)a:for(var h=0;h<g.length;++h){for(var i=g[h],j=0;j<f.length;++j)if(f[j].marker==i.marker)continue a;f.push(i)}else g&&(c[e]=g)}return c}function Bd(a,b,c){var d=null;if(a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=bf(d,c)||(d||(d=[])).push(c)}}),!d)return null;for(var e=[{from:b,to:c}],f=0;f<d.length;++f)for(var g=d[f],h=g.find(),i=0;i<e.length;++i){var j=e[i];if(!Dc(j.to,h.from)&&!Dc(h.to,j.from)){var k=[i,1];(Dc(j.from,h.from)||!g.inclusiveLeft&&Cc(j.from,h.from))&&k.push({from:j.from,to:h.from}),(Dc(h.to,j.to)||!g.inclusiveRight&&Cc(j.to,h.to))&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function Cd(a,b){var d,c=w&&a.markedSpans;if(c)for(var e,f=0;f<c.length;++f)e=c[f],e.marker.collapsed&&(null==e.from||e.from<b)&&(null==e.to||e.to>b)&&(!d||d.width<e.marker.width)&&(d=e.marker);return d}function Dd(a){return Cd(a,-1)}function Ed(a){return Cd(a,a.text.length+1)}function Fd(a,b){for(var c;c=Dd(b);)b=le(a,c.find().from.line);return b}function Gd(a,b){var c=w&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed){if(null==d.from)return!0;if(!d.marker.replacedWith&&0==d.from&&d.marker.inclusiveLeft&&Hd(a,b,d))return!0}}function Hd(a,b,c){if(null==c.to){var d=c.marker.find().to,e=le(a,d.line);return Hd(a,e,ud(e.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var f,g=0;g<b.markedSpans.length;++g)if(f=b.markedSpans[g],f.marker.collapsed&&!f.marker.replacedWith&&f.from==c.to&&(f.marker.inclusiveLeft||c.marker.inclusiveRight)&&Hd(a,b,f))return!0}function Id(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Jd(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Ld(a){return function(){var b=!this.cm.curOp;b&&Db(this.cm);try{var c=a.apply(this,arguments)}finally{b&&Eb(this.cm)}return c}}function Md(a){return null!=a.height?a.height:(a.node.parentNode&&1==a.node.parentNode.nodeType||nf(a.cm.display.measure,lf("div",[a.node],null,"position: relative")),a.height=a.node.offsetHeight)}function Nd(a,b,c,d){var e=new Kd(a,c,d);return e.noHScroll&&(a.display.alignWidgets=!0),Vc(a,b,function(b){var c=b.widgets||(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,!Gd(a.doc,b)||e.showIfHidden){var d=re(a,b)<a.doc.scrollTop;oe(b,b.height+Md(e)),d&&Tc(a,0,e.height)}return!0}),e}function Pd(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),Id(a),Jd(a,c);var e=d?d(a):1;e!=a.height&&oe(a,e)}function Qd(a){a.parent=null,Id(a)}function Rd(a,b,c,d,e){var f=c.flattenSpans;null==f&&(f=a.options.flattenSpans);var j,g=0,h=null,i=new pd(b,a.options.tabSize);for(""==b&&c.blankLine&&c.blankLine(d);!i.eol();)i.pos>a.options.maxHighlightLength?(f=!1,i.pos=b.length,j=null):j=c.token(i,d),f&&h==j||(g<i.start&&e(i.start,h),g=i.start,h=j),i.start=i.pos;for(;g<i.pos;){var k=Math.min(i.pos,g+5e4);e(k,h),g=k}}function Sd(a,b,c){var d=[a.state.modeGen];Rd(a,b.text,a.doc.mode,c,function(a,b){d.push(a,b)});for(var e=0;e<a.state.overlays.length;++e){var f=a.state.overlays[e],g=1,h=0;Rd(a,b.text,f.mode,!0,function(a,b){for(var c=g;a>h;){var e=d[g];e>a&&d.splice(g,1,a,d[g+1],e),g+=2,h=Math.min(a,e)}if(b)if(f.opaque)d.splice(c,g-c,a,b),g=c+2;else for(;g>c;c+=2){var i=d[c+1];d[c+1]=i?i+" "+b:b}})}return d}function Td(a,b){return b.styles&&b.styles[0]==a.state.modeGen||(b.styles=Sd(a,b,b.stateAfter=eb(a,pe(b)))),b.styles}function Ud(a,b,c){var d=a.doc.mode,e=new pd(b.text,a.options.tabSize);for(""==b.text&&d.blankLine&&d.blankLine(c);!e.eol()&&e.pos<=a.options.maxHighlightLength;)d.token(e,c),e.start=e.pos
4
- }function Wd(a,b){if(!a)return null;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 Vd[a]||(Vd[a]="cm-"+a.replace(/ +/g," cm-"))}function Xd(a,c,d,g){for(var h,i=c,j=!0;h=Dd(i);)i=le(a.doc,h.find().from.line);var k={pre:lf("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:a,copyWidgets:g};do{i.text&&(j=!1),k.measure=i==c&&d,k.pos=0,k.addToken=k.measure?$d:Zd,(b||f)&&a.getOption("lineWrapping")&&(k.addToken=_d(k.addToken));var l=be(i,k,Td(a,i));d&&i==c&&!k.measuredSomething&&(d[0]=k.pre.appendChild(vf(a.display.measure)),k.measuredSomething=!0),l&&(i=le(a.doc,l.to.line))}while(l);!d||k.measuredSomething||d[0]||(d[0]=k.pre.appendChild(j?lf("span","\xa0"):vf(a.display.measure))),k.pre.firstChild||Gd(a.doc,c)||k.pre.appendChild(document.createTextNode("\xa0"));var m;if(d&&(b||e)&&(m=se(i))){var n=m.length-1;m[n].from==m[n].to&&--n;var o=m[n],p=m[n-1];if(o.from+1==o.to&&p&&o.level<p.level){var q=d[k.pos-1];q&&q.parentNode.insertBefore(q.measureRight=vf(a.display.measure),q.nextSibling)}}var r=k.textClass?k.textClass+" "+(c.textClass||""):c.textClass;return r&&(k.pre.className=r),Ne(a,"renderLine",a,c,k.pre),k}function Zd(a,b,c,d,e,f){if(b){if(Yd.test(b))for(var g=document.createDocumentFragment(),h=0;;){Yd.lastIndex=h;var i=Yd.exec(b),j=i?i.index-h:b.length-h;if(j&&(g.appendChild(document.createTextNode(b.slice(h,h+j))),a.col+=j),!i)break;if(h+=j+1," "==i[0]){var k=a.cm.options.tabSize,l=k-a.col%k;g.appendChild(lf("span",$e(l),"cm-tab")),a.col+=l}else{var m=lf("span","\u2022","cm-invalidchar");m.title="\\u"+i[0].charCodeAt(0).toString(16),g.appendChild(m),a.col+=1}}else{a.col+=b.length;var g=document.createTextNode(b)}if(c||d||e||a.measure){var n=c||"";d&&(n+=d),e&&(n+=e);var m=lf("span",[g],n);return f&&(m.title=f),a.pre.appendChild(m)}a.pre.appendChild(g)}}function $d(a,c,d,e,f){for(var g=a.cm.options.lineWrapping,h=0;h<c.length;++h){var i=c.charAt(h),j=0==h;i>="\ud800"&&"\udbff">i&&h<c.length-1?(i=c.slice(h,h+2),++h):h&&g&&rf(c,h)&&a.pre.appendChild(lf("wbr"));var k=a.measure[a.pos],l=a.measure[a.pos]=Zd(a,i,d,j&&e,h==c.length-1&&f);k&&(l.leftSide=k.leftSide||k),b&&g&&" "==i&&h&&!/\s/.test(c.charAt(h-1))&&h<c.length-1&&!/\s/.test(c.charAt(h+1))&&(l.style.whiteSpace="normal"),a.pos+=i.length}c.length&&(a.measuredSomething=!0)}function _d(a){function b(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":"\xa0";return b+=" "}return function(c,d,e,f,g,h){return a(c,d.replace(/ {3,}/g,b),e,f,g,h)}}function ae(a,b,c,d){var e=!d&&c.replacedWith;if(e&&(a.copyWidgets&&(e=e.cloneNode(!0)),a.pre.appendChild(e),a.measure)){if(b)a.measure[a.pos]=e;else{var f=vf(a.cm.display.measure);if("bookmark"!=c.type||c.insertLeft){if(a.measure[a.pos])return;a.measure[a.pos]=a.pre.insertBefore(f,e)}else a.measure[a.pos]=a.pre.appendChild(f)}a.measuredSomething=!0}a.pos+=b}function be(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var k,m,n,o,p,q,h=e.length,i=0,g=1,j="",l=0;;){if(l==i){m=n=o=p="",q=null,l=1/0;for(var r=[],s=0;s<d.length;++s){var t=d[s],u=t.marker;t.from<=i&&(null==t.to||t.to>i)?(null!=t.to&&l>t.to&&(l=t.to,n=""),u.className&&(m+=" "+u.className),u.startStyle&&t.from==i&&(o+=" "+u.startStyle),u.endStyle&&t.to==l&&(n+=" "+u.endStyle),u.title&&!p&&(p=u.title),u.collapsed&&(!q||q.marker.size<u.size)&&(q=t)):t.from>i&&l>t.from&&(l=t.from),"bookmark"==u.type&&t.from==i&&u.replacedWith&&r.push(u)}if(q&&(q.from||0)==i&&(ae(b,(null==q.to?h:q.to)-i,q.marker,null==q.from),null==q.to))return q.marker.find();if(!q&&r.length)for(var s=0;s<r.length;++s)ae(b,0,r[s])}if(i>=h)break;for(var v=Math.min(h,l);;){if(j){var w=i+j.length;if(!q){var x=w>v?j.slice(0,v-i):j;b.addToken(b,x,k?k+m:m,o,i+x.length==l?n:"",p)}if(w>=v){j=j.slice(v-i),i=v;break}i=w,o=""}j=e.slice(f,f=c[g++]),k=Wd(c[g++],b)}}else for(var g=1;g<c.length;g+=2)b.addToken(b,e.slice(f,f=c[g]),Wd(c[g+1],b))}function ce(a,b,c,d,e){function f(a){return c?c[a]:null}function g(a,c,d){Pd(a,c,d,e),Qe(a,"change",a,b)}var h=b.from,i=b.to,j=b.text,k=le(a,h.line),l=le(a,i.line),m=_e(j),n=f(j.length-1),o=i.line-h.line;if(0==h.ch&&0==i.ch&&""==m){for(var p=0,q=j.length-1,r=[];q>p;++p)r.push(new Od(j[p],f(p),e));g(l,l.text,n),o&&a.remove(h.line,o),r.length&&a.insert(h.line,r)}else if(k==l)if(1==j.length)g(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{for(var r=[],p=1,q=j.length-1;q>p;++p)r.push(new Od(j[p],f(p),e));r.push(new Od(m+k.text.slice(i.ch),n,e)),g(k,k.text.slice(0,h.ch)+j[0],f(0)),a.insert(h.line+1,r)}else if(1==j.length)g(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),f(0)),a.remove(h.line+1,o);else{g(k,k.text.slice(0,h.ch)+j[0],f(0)),g(l,m+l.text.slice(i.ch),n);for(var p=1,q=j.length-1,r=[];q>p;++p)r.push(new Od(j[p],f(p),e));o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,r)}Qe(a,"change",a,b),Lc(a,d.anchor,d.head,null,!0)}function de(a){this.lines=a,this.parent=null;for(var b=0,c=a.length,d=0;c>b;++b)a[b].parent=this,d+=a[b].height;this.height=d}function ee(a){this.children=a;for(var b=0,c=0,d=0,e=a.length;e>d;++d){var f=a[d];b+=f.chunkSize(),c+=f.height,f.parent=this}this.size=b,this.height=c,this.parent=null}function je(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;g<a.linked.length;++g){var h=a.linked[g];if(h.doc!=e){var i=f&&h.sharedHist;(!c||i)&&(b(h.doc,i),d(h.doc,a,i))}}}d(a,null,!0)}function ke(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,C(a),z(a),a.options.lineWrapping||I(a),a.options.mode=b.modeOption,Ib(a)}function le(a,b){for(b-=a.first;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(e>b){a=d;break}b-=e}return a.lines[b]}function me(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function ne(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function oe(a,b){for(var c=b-a.height,d=a;d;d=d.parent)d.height+=c}function pe(a){if(null==a.parent)return null;for(var b=a.parent,c=bf(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c+b.first}function qe(a,b){var c=a.first;a:do{for(var d=0,e=a.children.length;e>d;++d){var f=a.children[d],g=f.height;if(g>b){a=f;continue a}b-=g,c+=f.chunkSize()}return c}while(!a.lines);for(var d=0,e=a.lines.length;e>d;++d){var h=a.lines[d],i=h.height;if(i>b)break;b-=i}return c+d}function re(a,b){b=Fd(a.doc,b);for(var c=0,d=b.parent,e=0;e<d.lines.length;++e){var f=d.lines[e];if(f==b)break;c+=f.height}for(var g=d.parent;g;d=g,g=d.parent)for(var e=0;e<g.children.length;++e){var h=g.children[e];if(h==d)break;c+=h.height}return c}function se(a){var b=a.order;return null==b&&(b=a.order=Nf(a.text)),b}function te(a){return{done:[],undone:[],undoDepth:1/0,lastTime:0,lastOp:null,lastOrigin:null,generation:a||1,maxGeneration:a||1}}function ue(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(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function ve(a,b){var c={line:b.from.line,ch:b.from.ch},d={from:c,to:qc(b),text:me(a,b.from,b.to)};return ue(a,d,b.from.line,b.to.line+1),je(a,function(a){ue(a,d,b.from.line,b.to.line+1)},!0),d}function we(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,g=_e(e.done);if(g&&(e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))){var h=_e(g.changes);Cc(b.from,b.to)&&Cc(b.from,h.to)?h.to=qc(b):g.changes.push(ve(a,b)),g.anchorAfter=c.anchor,g.headAfter=c.head}else for(g={changes:[ve(a,b)],generation:e.generation,anchorBefore:a.sel.anchor,headBefore:a.sel.head,anchorAfter:c.anchor,headAfter:c.head},e.done.push(g),e.generation=++e.maxGeneration;e.done.length>e.undoDepth;)e.done.shift();e.lastTime=f,e.lastOp=d,e.lastOrigin=b.origin}function xe(a){if(!a)return null;for(var c,b=0;b<a.length;++b)a[b].marker.explicitlyCleared?c||(c=a.slice(0,b)):c&&c.push(a[b]);return c?c.length?c:null:a}function ye(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=0,e=[];d<b.text.length;++d)e.push(xe(c[d]));return e}function ze(a,b){for(var c=0,d=[];c<a.length;++c){var e=a[c],f=e.changes,g=[];d.push({changes:g,anchorBefore:e.anchorBefore,headBefore:e.headBefore,anchorAfter:e.anchorAfter,headAfter:e.headAfter});for(var h=0;h<f.length;++h){var j,i=f[h];if(g.push({from:i.from,to:i.to,text:i.text}),b)for(var k in i)(j=k.match(/^spans_(\d+)$/))&&bf(b,Number(j[1]))>-1&&(_e(g)[k]=i[k],delete i[k])}}return d}function Ae(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Be(a,b,c,d){for(var e=0;e<a.length;++e){for(var f=a[e],g=!0,h=0;h<f.changes.length;++h){var i=f.changes[h];if(f.copied||(i.from=Ec(i.from),i.to=Ec(i.to)),c<i.from.line)i.from.line+=d,i.to.line+=d;else if(b<=i.to.line){g=!1;break}}f.copied||(f.anchorBefore=Ec(f.anchorBefore),f.headBefore=Ec(f.headBefore),f.anchorAfter=Ec(f.anchorAfter),f.readAfter=Ec(f.headAfter),f.copied=!0),g?(Ae(f.anchorBefore),Ae(f.headBefore),Ae(f.anchorAfter),Ae(f.headAfter)):(a.splice(0,e+1),e=0)}}function Ce(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Be(a.done,c,d,e),Be(a.undone,c,d,e)}function De(){Ie(this)}function Ee(a){return a.stop||(a.stop=De),a}function Fe(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Ge(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function He(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Ie(a){Fe(a),Ge(a)}function Je(a){return a.target||a.srcElement}function Ke(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),q&&a.ctrlKey&&1==b&&(b=3),b}function Le(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a._handlers||(a._handlers={}),e=d[b]||(d[b]=[]);e.push(c)}}function Me(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=a._handlers&&a._handlers[b];if(!d)return;for(var e=0;e<d.length;++e)if(d[e]==c){d.splice(e,1);break}}}function Ne(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function Qe(a,b){function e(a){return function(){a.apply(null,d)}}var c=a._handlers&&a._handlers[b];if(c){var d=Array.prototype.slice.call(arguments,2);Oe||(++Pe,Oe=[],setTimeout(Se,0));for(var f=0;f<c.length;++f)Oe.push(e(c[f]))}}function Re(a,b,c){return Ne(a,c||b.type,a,b),He(b)||b.codemirrorIgnore}function Se(){--Pe;var a=Oe;Oe=null;for(var b=0;b<a.length;++b)a[b]()}function Te(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function Ue(a){a.prototype.on=function(a,b){Le(this,a,b)},a.prototype.off=function(a,b){Me(this,a,b)}}function Xe(){this.id=null}function Ye(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var f=d||0,g=e||0;b>f;++f)" "==a.charAt(f)?g+=c-g%c:++g;return g}function $e(a){for(;Ze.length<=a;)Ze.push(_e(Ze)+" ");return Ze[a]}function _e(a){return a[a.length-1]}function af(a){if(o)a.selectionStart=0,a.selectionEnd=a.value.length;else try{a.select()}catch(b){}}function bf(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;d>c;++c)if(a[c]==b)return c;return-1}function cf(a,b){function c(){}c.prototype=a;var d=new c;return b&&df(b,d),d}function df(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function ef(a){for(var b=[],c=0;a>c;++c)b.push(void 0);return b}function ff(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function hf(a){return/\w/.test(a)||a>"\x80"&&(a.toUpperCase()!=a.toLowerCase()||gf.test(a))}function jf(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function lf(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)of(e,b);else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function mf(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function nf(a,b){return mf(a).appendChild(b)}function of(a,b){d?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function pf(a){return a.getBoundingClientRect()}function rf(){return!1}function tf(a){if(null!=sf)return sf;var b=lf("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return nf(a,b),b.offsetWidth&&(sf=b.offsetHeight-b.clientHeight),sf||0}function vf(a){if(null==uf){var b=lf("span","\u200b");nf(a,lf("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(uf=b.offsetWidth<=1&&b.offsetHeight>2&&!c)}return uf?lf("span","\u200b"):lf("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px")}function Af(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];(g.from<c&&g.to>b||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function Bf(a){return a.level%2?a.to:a.from}function Cf(a){return a.level%2?a.from:a.to}function Df(a){var b=se(a);return b?Bf(b[0]):0}function Ef(a){var b=se(a);return b?Cf(_e(b)):a.text.length}function Ff(a,b){var c=le(a.doc,b),d=Fd(a.doc,c);d!=c&&(b=pe(d));var e=se(d),f=e?e[0].level%2?Ef(d):Df(d):0;return Bc(b,f)}function Gf(a,b){for(var c,d;c=Ed(d=le(a.doc,b));)b=c.find().to.line;var e=se(d),f=e?e[0].level%2?Df(d):Ef(d):d.text.length;return Bc(b,f)}function Hf(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function Jf(a,b){for(var d,c=0;c<a.length;++c){var e=a[c];if(e.from<b&&e.to>b)return If=null,c;if(e.from==b||e.to==b){if(null!=d)return Hf(a,e.level,a[d].level)?(If=d,c):(If=c,d);d=c}}return If=null,d}function Kf(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&kf.test(a.text.charAt(b)));return b}function Lf(a,b,c,d){var e=se(a);if(!e)return Mf(a,b,c,d);for(var f=Jf(e,b),g=e[f],h=Kf(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h<g.to)return h;if(h==g.from||h==g.to)return Jf(e,h)==f?h:(g=e[f+=c],c>0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?Kf(a,g.to,-1,d):Kf(a,g.from,1,d)}}function Mf(a,b,c,d){var e=b+c;if(d)for(;e>0&&kf.test(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var a=/gecko\/\d/i.test(navigator.userAgent),b=/MSIE \d/.test(navigator.userAgent),c=b&&(null==document.documentMode||document.documentMode<8),d=b&&(null==document.documentMode||document.documentMode<9),e=/Trident\/([7-9]|\d{2,})\./,f=/WebKit\//.test(navigator.userAgent),g=f&&/Qt\/\d+\.\d+/.test(navigator.userAgent),h=/Chrome\//.test(navigator.userAgent),i=/Opera\//.test(navigator.userAgent),j=/Apple Computer/.test(navigator.vendor),k=/KHTML\//.test(navigator.userAgent),l=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),m=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),n=/PhantomJS/.test(navigator.userAgent),o=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),p=o||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),q=o||/Mac/.test(navigator.platform),r=/win/i.test(navigator.platform),s=i&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);s&&(s=Number(s[1])),s&&s>=15&&(i=!1,f=!0);var zb,Sb,Tb,t=q&&(g||i&&(null==s||12.11>s)),u=a||b&&!d,v=!1,w=!1,Cb=0,Yb=0,bc=0,cc=null;b?cc=-.53:a?cc=15:h?cc=-.7:j&&(cc=-1/3);var gc,oc,jc=null,qc=x.changeEnd=function(a){return a.text?Bc(a.from.line+a.text.length-1,_e(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};x.Pos=Bc,x.prototype={constructor:x,focus:function(){window.focus(),Nb(this),Kb(this)},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,$c.hasOwnProperty(a)&&Fb(this,$c[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||"string"!=typeof b[c]&&b[c].name==a)return b.splice(c,1),!0},addOverlay:Fb(null,function(a,b){var c=a.token?a:x.getMode(this.options,a);if(c.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque}),this.state.modeGen++,Ib(this)}),removeOverlay:Fb(null,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)return b.splice(c,1),this.state.modeGen++,Ib(this),void 0}}),indentLine:Fb(null,function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),Ic(this.doc,a)&&Uc(this,a,b,c)}),indentSelection:Fb(null,function(a){var b=this.doc.sel;if(Cc(b.from,b.to))return Uc(this,b.from.line,a);for(var c=b.to.line-(b.to.ch?0:1),d=b.from.line;c>=d;++d)Uc(this,d,a)}),getTokenAt:function(a,b){var c=this.doc;a=Gc(c,a);for(var d=eb(this,a.line,b),e=this.doc.mode,f=le(c,a.line),g=new pd(f.text,this.options.tabSize);g.pos<a.ch&&!g.eol();){g.start=g.pos;var h=e.token(g,d)}return{start:g.start,end:g.pos,string:g.current(),className:h||null,type:h||null,state:d}},getTokenTypeAt:function(a){a=Gc(this.doc,a);var b=Td(this,le(this.doc,a.line)),c=0,d=(b.length-1)/2,e=a.ch;if(0==e)return b[2];for(;;){var f=c+d>>1;if((f?b[2*f-1]:0)>=e)d=f;else{if(!(b[2*f+1]<e))return b[2*f+2];c=f+1}}},getModeAt:function(a){var b=this.doc.mode;return b.innerMode?x.innerMode(b,this.getTokenAt(a).state).mode:b},getHelper:function(a,b){if(gd.hasOwnProperty(b)){var c=gd[b],d=this.getModeAt(a);return d[b]&&c[d[b]]||d.helperType&&c[d.helperType]||c[d.name]}},getStateAfter:function(a,b){var c=this.doc;return a=Fc(c,null==a?c.first+c.size-1:a),eb(this,a+1,b)},cursorCoords:function(a,b){var c,d=this.doc.sel;return c=null==a?d.head:"object"==typeof a?Gc(this.doc,a):a?d.from:d.to,vb(this,c,b||"page")},charCoords:function(a,b){return ub(this,Gc(this.doc,a),b||"page")},coordsChar:function(a,b){return a=tb(this,a,b||"page"),xb(this,a.left,a.top)},lineAtHeight:function(a,b){return a=tb(this,{top:a,left:0},b||"page").top,qe(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=!1,d=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>d&&(a=d,c=!0);var e=le(this.doc,a);return sb(this,le(this.doc,a),{top:0,left:0},b||"page").top+(c?e.height:0)},defaultTextHeight:function(){return Ab(this.display)},defaultCharWidth:function(){return Bb(this.display)},setGutterMarker:Fb(null,function(a,b,c){return Vc(this,a,function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&jf(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Fb(null,function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Ib(b,d,d+1),jf(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineClass:Fb(null,function(a,b,c){return Vc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[d]){if(new RegExp("(?:^|\\s)"+c+"(?:$|\\s)").test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:Fb(null,function(a,b,c){return Vc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.match(new RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!f)return!1;var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(f.index&&g!=e.length?" ":"")+e.slice(g)||null}return!0})}),addLineWidget:Fb(null,function(a,b,c){return Nd(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!Ic(this.doc,a))return null;var b=a;if(a=le(this.doc,a),!a)return null}else{var b=pe(a);if(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}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=vb(this,Gc(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Qc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Fb(null,kc),execCommand:function(a){return jd[a](this)},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=Gc(this.doc,a);b>f&&(g=Wc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Fb(null,function(a,b){var d,c=this.doc.sel;d=c.shift||c.extend||Cc(c.from,c.to)?Wc(this.doc,c.head,a,b,this.options.rtlMoveVisually):0>a?c.from:c.to,Jc(this.doc,d,d,a)}),deleteH:Fb(null,function(a,b){var c=this.doc.sel;Cc(c.from,c.to)?Ac(this.doc,"",c.from,Wc(this.doc,c.head,a,b,!1),"+delete"):Ac(this.doc,"",c.from,c.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=Gc(this.doc,a);b>g;++g){var i=vb(this,h,"div");if(null==f?f=i.left:i.left=f,h=Xc(this,i,e,c),h.hitSide)break}return h},moveV:Fb(null,function(a,b){var c=this.doc.sel,d=vb(this,c.head,"div");null!=c.goalColumn&&(d.left=c.goalColumn);var e=Xc(this,d,a,b);"page"==b&&Tc(this,0,ub(this,e,"div").top-d.top),Jc(this.doc,e,e,a),c.goalColumn=d.left}),toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:Fb(null,function(a,b){Sc(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller,b=Ve;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:Fb(null,function(a,b){null==a?a={from:this.doc.sel.head,to:null}:"number"==typeof a?a={from:Bc(a,0),to:null}:null==a.from&&(a={from:a,to:null}),a.to||(a.to=a.from),b||(b=0);var c=a;null!=a.from.line&&(this.curOp.scrollToPos={from:a.from,to:a.to,margin:b},c={from:vb(this,a.from),to:vb(this,a.to)});var d=Rc(this,Math.min(c.from.left,c.to.left),Math.min(c.from.top,c.to.top)-b,Math.max(c.from.right,c.to.right),Math.max(c.from.bottom,c.to.bottom)+b);Sc(this,d.scrollLeft,d.scrollTop)}),setSize:Fb(null,function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a)),null!=b&&(this.display.wrapper.style.height=c(b)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(a){return Hb(this,a)},refresh:Fb(null,function(){var a=null==this.display.cachedTextHeight;pb(this),Sc(this,this.doc.scrollLeft,this.doc.scrollTop),Ib(this),a&&C(this)}),swapDoc:Fb(null,function(a){var b=this.doc;return b.cm=null,ke(this,a),pb(this),Mb(this,!0),Sc(this,a.scrollLeft,a.scrollTop),Qe(this,"swapDoc",this,b),b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ue(x);var $c=x.optionHandlers={},_c=x.defaults={},bd=x.Init={toString:function(){return"CodeMirror.Init"}};ad("value","",function(a,b){a.setValue(b)},!0),ad("mode",null,function(a,b){a.doc.modeOption=b,z(a)},!0),ad("indentUnit",2,z,!0),ad("indentWithTabs",!1),ad("smartIndent",!0),ad("tabSize",4,function(a){z(a),pb(a),Ib(a)},!0),ad("electricChars",!0),ad("rtlMoveVisually",!r),ad("theme","default",function(a){E(a),F(a)},!0),ad("keyMap","default",D),ad("extraKeys",null),ad("onKeyEvent",null),ad("onDragEvent",null),ad("lineWrapping",!1,A,!0),ad("gutters",[],function(a){J(a.options),F(a)},!0),ad("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?P(a.display)+"px":"0",a.refresh()},!0),ad("coverGutterNextToScrollbar",!1,K,!0),ad("lineNumbers",!1,function(a){J(a.options),F(a)},!0),ad("firstLineNumber",1,F,!0),ad("lineNumberFormatter",function(a){return a},F,!0),ad("showCursorWhenSelecting",!1,Z,!0),ad("resetSelectionOnContextMenu",!0),ad("readOnly",!1,function(a,b){"nocursor"==b?(nc(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||Mb(a,!0))}),ad("dragDrop",!0),ad("cursorBlinkRate",530),ad("cursorScrollMargin",0),ad("cursorHeight",1),ad("workTime",100),ad("workDelay",100),ad("flattenSpans",!0),ad("pollInterval",100),ad("undoDepth",40,function(a,b){a.doc.history.undoDepth=b}),ad("historyEventDelay",500),ad("viewportMargin",10,function(a){a.refresh()},!0),ad("maxHighlightLength",1e4,function(a){z(a),a.refresh()},!0),ad("crudeMeasuringFrom",1e4),ad("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),ad("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),ad("autofocus",null);var cd=x.modes={},dd=x.mimeModes={};x.defineMode=function(a,b){if(x.defaults.mode||"null"==a||(x.defaults.mode=a),arguments.length>2){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}cd[a]=b},x.defineMIME=function(a,b){dd[a]=b},x.resolveMode=function(a){if("string"==typeof a&&dd.hasOwnProperty(a))a=dd[a];else if(a&&"string"==typeof a.name&&dd.hasOwnProperty(a.name)){var b=dd[a.name];a=cf(b,a),a.name=b.name}else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return x.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}},x.getMode=function(a,b){var b=x.resolveMode(b),c=cd[b.name];if(!c)return x.getMode(a,"text/plain");var d=c(a,b);if(ed.hasOwnProperty(b.name)){var e=ed[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}return d.name=b.name,d},x.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),x.defineMIME("text/plain","null");var ed=x.modeExtensions={};x.extendMode=function(a,b){var c=ed.hasOwnProperty(a)?ed[a]:ed[a]={};df(b,c)},x.defineExtension=function(a,b){x.prototype[a]=b},x.defineDocExtension=function(a,b){ge.prototype[a]=b},x.defineOption=ad;var fd=[];x.defineInitHook=function(a){fd.push(a)};var gd=x.helpers={};x.registerHelper=function(a,b,c){gd.hasOwnProperty(a)||(gd[a]=x[a]={}),gd[a][b]=c},x.isWordChar=hf,x.copyState=hd,x.startState=id,x.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var jd=x.commands={selectAll:function(a){a.setSelection(Bc(a.firstLine(),0),Bc(a.lastLine()))},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),d=!Cc(b,c);d||a.getLine(b.line).length!=b.ch?a.replaceRange("",b,d?c:Bc(b.line),"+delete"):a.replaceRange("",b,Bc(b.line+1,0),"+delete")},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",Bc(b,0),Bc(b),"+delete")},delLineLeft:function(a){var b=a.getCursor();a.replaceRange("",Bc(b.line,0),b,"+delete")},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.extendSelection(Bc(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(Bc(a.lastLine()))},goLineStart:function(a){a.extendSelection(Ff(a,a.getCursor().line))},goLineStartSmart:function(a){var b=a.getCursor(),c=Ff(a,b.line),d=a.getLineHandle(c.line),e=se(d);if(e&&0!=e[0].level)a.extendSelection(c);else{var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;a.extendSelection(Bc(c.line,g?0:f))}},goLineEnd:function(a){a.extendSelection(Gf(a,a.getCursor().line))},goLineRight:function(a){var b=a.charCoords(a.getCursor(),"div").top+5;a.extendSelection(a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div"))},goLineLeft:function(a){var b=a.charCoords(a.getCursor(),"div").top+5;a.extendSelection(a.coordsChar({left:0,top:b},"div"))},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection(" ","end","+input")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.replaceSelection(" ","end","+input")},transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);b.ch>0&&b.ch<c.length-1&&a.replaceRange(c.charAt(b.ch)+c.charAt(b.ch-1),Bc(b.line,b.ch-1),Bc(b.line,b.ch+1))},newlineAndIndent:function(a){Fb(a,function(){a.replaceSelection("\n","end","+input"),a.indentLine(a.getCursor().line,null,!0)})()},toggleOverwrite:function(a){a.toggleOverwrite()}},kd=x.keyMap={};kd.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"},kd.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","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",fallthrough:"basic"},kd.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","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":"delLineLeft",fallthrough:["basic","emacsy"]},kd["default"]=q?kd.macDefault:kd.pcDefault,kd.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"},x.lookupKey=md,x.isModifierKey=nd,x.keyName=od,x.fromTextArea=function(a,b){function e(){a.value=i.getValue()}if(b||(b={}),b.value=a.value,!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex),!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder),null==b.autofocus){var c=document.body;try{c=document.activeElement}catch(d){}b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(Le(a.form,"submit",e),!b.leaveSubmitMethodAlone)){var f=a.form,g=f.submit;
5
- try{var h=f.submit=function(){e(),f.submit=g,f.submit(),f.submit=h}}catch(d){}}a.style.display="none";var i=x(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);return i.save=e,i.getTextArea=function(){return a},i.toTextArea=function(){e(),a.parentNode.removeChild(i.getWrapperElement()),a.style.display="",a.form&&(Me(a.form,"submit",e),"function"==typeof a.form.submit&&(a.form.submit=g))},i},pd.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a)var c=b==a;else var c=b&&(a.test?a.test(b):a(b));return c?(++this.pos,b):void 0},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Ye(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue},indentation:function(){return Ye(this.string,null,this.tabSize)},match:function(a,b,c){if("string"!=typeof a){var f=this.string.slice(this.pos).match(a);return f&&f.index>0?null:(f&&b!==!1&&(this.pos+=f[0].length),f)}var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);return d(e)==d(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},x.StringStream=pd,x.TextMarker=qd,Ue(qd),qd.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&Db(a),Te(this,"clear")){var c=this.find();c&&Qe(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;f<this.lines.length;++f){var g=this.lines[f],h=ud(g.markedSpans,this);null!=h.to&&(e=pe(g)),g.markedSpans=vd(g.markedSpans,h),null!=h.from?d=pe(g):this.collapsed&&!Gd(this.doc,g)&&a&&oe(g,Ab(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var i=Fd(a.doc,this.lines[f]),j=H(a.doc,i);j>a.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&Ib(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Mc(a)),b&&Eb(a)}},qd.prototype.find=function(){for(var a,b,c=0;c<this.lines.length;++c){var d=this.lines[c],e=ud(d.markedSpans,this);if(null!=e.from||null!=e.to){var f=pe(d);null!=e.from&&(a=Bc(f,e.from)),null!=e.to&&(b=Bc(f,e.to))}}return"bookmark"==this.type?a:a&&{from:a,to:b}},qd.prototype.changed=function(){var a=this.find(),b=this.doc.cm;if(a&&b){"bookmark"!=this.type&&(a=a.from);var c=le(this.doc,a.line);if(kb(b,c),a.line>=b.display.showingFrom&&a.line<b.display.showingTo){for(var d=b.display.lineDiv.firstChild;d;d=d.nextSibling)if(d.lineObj==c){d.offsetHeight!=c.height&&oe(c,d.offsetHeight);break}Hb(b,function(){b.curOp.selectionChanged=b.curOp.forceUpdate=b.curOp.updateMaxLine=!0})}}},qd.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=bf(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},qd.prototype.detachLine=function(a){if(this.lines.splice(bf(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}},x.SharedTextMarker=sd,Ue(sd),sd.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();Qe(this,"clear")}},sd.prototype.find=function(){return this.primary.find()};var Kd=x.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.cm=a,this.node=b};Ue(Kd),Kd.prototype.clear=Ld(function(){var a=this.line.widgets,b=pe(this.line);if(null!=b&&a){for(var c=0;c<a.length;++c)a[c]==this&&a.splice(c--,1);a.length||(this.line.widgets=null);var d=re(this.cm,this.line)<this.cm.doc.scrollTop;oe(this.line,Math.max(0,this.line.height-Md(this))),d&&Tc(this.cm,0,-this.height),Ib(this.cm,b,b+1)}}),Kd.prototype.changed=Ld(function(){var a=this.height;this.height=null;var b=Md(this)-a;if(b){oe(this.line,this.line.height+b);var c=pe(this.line);Ib(this.cm,c,c+1)}});var Od=x.Line=function(a,b,c){this.text=a,Jd(this,b),this.height=c?c(this):1};Ue(Od);var Vd={},Yd=/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\uFEFF]/g;de.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;d>c;++c){var e=this.lines[c];this.height-=e.height,Qd(e),Qe(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(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(var d=0,e=b.length;e>d;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;d>a;++a)if(c(this.lines[a]))return!0}},ee.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(e>a){var f=Math.min(b,e-a),g=d.height;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}if(this.size-b<25){var h=[];this.collapse(h),this.children=[new de(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0,c=this.children.length;c>b;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();if(g>=a){if(f.insertInner(a,b,c),f.lines&&f.lines.length>50){for(;f.lines.length>50;){var h=f.lines.splice(f.lines.length-25,25),i=new de(h);f.height-=i.height,this.children.splice(d+1,0,i),i.parent=this}this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new ee(b);if(a.parent){a.size-=c.size,a.height-=c.height;var e=bf(a.parent.children,a);a.parent.children.splice(e+1,0,c)}else{var d=new ee(a.children);d.parent=a,a.children=[d,c],a=d}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();if(g>a){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if(0==(b-=h))break;a=0}else a-=g}}};var fe=0,ge=x.Doc=function(a,b,c){if(!(this instanceof ge))return new ge(a,b,c);null==c&&(c=0),ee.call(this,[new de([new Od("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=te(),this.cleanGeneration=1,this.frontier=c;var d=Bc(c,0);this.sel={from:d,to:d,head:d,anchor:d,shift:!1,extend:!1,goalColumn:null},this.id=++fe,this.modeOption=b,"string"==typeof a&&(a=wf(a)),ce(this,{from:d,to:d,text:a},null,{head:d,anchor:d})};ge.prototype=cf(ee.prototype,{constructor:ge,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,e=b.length;e>d;++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=ne(this,this.first,this.first+this.size);return a===!1?b:b.join(a||"\n")},setValue:function(a){var b=Bc(this.first,0),c=this.first+this.size-1;uc(this,{from:b,to:Bc(c,le(this,c).text.length),text:wf(a),origin:"setValue"},{head:b,anchor:b},!0)},replaceRange:function(a,b,c,d){b=Gc(this,b),c=c?Gc(this,c):b,Ac(this,a,b,c,d)},getRange:function(a,b,c){var d=me(this,Gc(this,a),Gc(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},setLine:function(a,b){Ic(this,a)&&Ac(this,b,Bc(a,0),Gc(this,Bc(a)))},removeLine:function(a){a?Ac(this,"",Gc(this,Bc(a-1)),Gc(this,Bc(a))):Ac(this,"",Bc(0,0),Gc(this,Bc(1,0)))},getLineHandle:function(a){return Ic(this,a)?le(this,a):void 0},getLineNumber:function(a){return pe(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=le(this,a)),Fd(this,a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return Gc(this,a)},getCursor:function(a){var c,b=this.sel;return c=null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||a===!1?b.to:b.from,Ec(c)},somethingSelected:function(){return!Cc(this.sel.head,this.sel.anchor)},setCursor:Gb(function(a,b,c){var d=Gc(this,"number"==typeof a?Bc(a,b||0):a);c?Jc(this,d):Lc(this,d,d)}),setSelection:Gb(function(a,b,c){Lc(this,Gc(this,a),Gc(this,b||a),c)}),extendSelection:Gb(function(a,b,c){Jc(this,Gc(this,a),b&&Gc(this,b),c)}),getSelection:function(a){return this.getRange(this.sel.from,this.sel.to,a)},replaceSelection:function(a,b,c){uc(this,{from:this.sel.from,to:this.sel.to,text:wf(a),origin:c},b||"around")},undo:Gb(function(){wc(this,"undo")}),redo:Gb(function(){wc(this,"redo")}),setExtending:function(a){this.sel.extend=a},historySize:function(){var a=this.history;return{undo:a.done.length,redo:a.undone.length}},clearHistory:function(){this.history=te(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){return this.history.lastOp=this.history.lastOrigin=null,this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:ze(this.history.done),undone:ze(this.history.undone)}},setHistory:function(a){var b=this.history=te(this.history.maxGeneration);b.done=a.done.slice(0),b.undone=a.undone.slice(0)},markText:function(a,b,c){return rd(this,Gc(this,a),Gc(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft};return a=Gc(this,a),rd(this,a,a,c,"bookmark")},findMarksAt:function(a){a=Gc(this,a);var b=[],c=le(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},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;d<c.length;++d)null!=c[d].from&&a.push(c[d].marker)}),a},posFromIndex:function(a){var b,c=this.first;return this.iter(function(d){var e=d.text.length+1;return e>a?(b=a,!0):(a-=e,++c,void 0)}),Gc(this,Bc(c,b))},indexFromPos:function(a){a=Gc(this,a);var b=a.ch;return a.line<this.first||a.ch<0?0:(this.iter(this.first,a.line,function(a){b+=a.text.length+1}),b)},copy:function(a){var b=new ge(ne(this,this.first,this.first+this.size),this.modeOption,this.first);return b.scrollTop=this.scrollTop,b.scrollLeft=this.scrollLeft,b.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:!1,goalColumn:this.sel.goalColumn},a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory())),b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from),null!=a.to&&a.to<c&&(c=a.to);var d=new ge(ne(this,b,c),a.mode||this.modeOption,b);return a.sharedHist&&(d.history=this.history),(this.linked||(this.linked=[])).push({doc:d,sharedHist:a.sharedHist}),d.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}],d},unlinkDoc:function(a){if(a instanceof x&&(a=a.doc),this.linked)for(var b=0;b<this.linked.length;++b){var c=this.linked[b];if(c.doc==a){this.linked.splice(b,1),a.unlinkDoc(this);break}}if(a.history==this.history){var d=[a.id];je(a,function(a){d.push(a.id)},!0),a.history=te(),a.history.done=ze(this.history.done,d),a.history.undone=ze(this.history.undone,d)}},iterLinkedDocs:function(a){je(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),ge.prototype.eachLine=ge.prototype.iter;var he="iter insert remove copy getEditor".split(" ");for(var ie in ge.prototype)ge.prototype.hasOwnProperty(ie)&&bf(he,ie)<0&&(x.prototype[ie]=function(a){return function(){return a.apply(this.doc,arguments)}}(ge.prototype[ie]));Ue(ge),x.e_stop=Ie,x.e_preventDefault=Fe,x.e_stopPropagation=Ge;var Oe,Pe=0;x.on=Le,x.off=Me,x.signal=Ne;var Ve=30,We=x.Pass={toString:function(){return"CodeMirror.Pass"}};Xe.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}},x.countColumn=Ye;var Ze=[""],gf=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,kf=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\u1DC0\u2013\u1DFF\u20D0\u2013\u20FF\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff\uFE20\u2013\uFE2F]/;x.replaceGetRect=function(a){pf=a};var qf=function(){if(d)return!1;var a=lf("div");return"draggable"in a||"dragDrop"in a}();a?rf=function(a,b){return 36==a.charCodeAt(b-1)&&39==a.charCodeAt(b)}:j&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?rf=function(a,b){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(a.slice(b-1,b+1))}:f&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)?rf=function(a,b){var c=a.charCodeAt(b-1);return c>=8208&&8212>=c}:f&&(rf=function(a,b){if(b>1&&45==a.charCodeAt(b-1)){if(/\w/.test(a.charAt(b-2))&&/[^\-?\.]/.test(a.charAt(b)))return!0;if(b>2&&/[\d\.,]/.test(a.charAt(b-2))&&/[\d\.,]/.test(a.charAt(b)))return!1}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|\u2026[\w~`@#$%\^&*(_=+{[><]/.test(a.slice(b-1,b+1))});var sf,uf,wf=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;d>=b;){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/)};x.splitLines=wf;var xf=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},yf=function(){var a=lf("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),zf={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};x.keyNames=zf,function(){for(var a=0;10>a;a++)zf[a+48]=String(a);for(var a=65;90>=a;a++)zf[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)zf[a+111]=zf[a+63235]="F"+a}();var If,Nf=function(){function c(c){return 255>=c?a.charAt(c):c>=1424&&1524>=c?"R":c>=1536&&1791>=c?b.charAt(c-1536):c>=1792&&2220>=c?"r":"L"}var a="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",b="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/,i="L";return function(a){if(!d.test(a))return!1;for(var l,b=a.length,j=[],k=0;b>k;++k)j.push(l=c(a.charCodeAt(k)));for(var k=0,m=i;b>k;++k){var l=j[k];"m"==l?j[k]=m:m=l}for(var k=0,n=i;b>k;++k){var l=j[k];"1"==l&&"r"==n?j[k]="n":f.test(l)&&(n=l,"r"==l&&(j[k]="R"))}for(var k=1,m=j[0];b-1>k;++k){var l=j[k];"+"==l&&"1"==m&&"1"==j[k+1]?j[k]="1":","!=l||m!=j[k+1]||"1"!=m&&"n"!=m||(j[k]=m),m=l}for(var k=0;b>k;++k){var l=j[k];if(","==l)j[k]="N";else if("%"==l){for(var o=k+1;b>o&&"%"==j[o];++o);for(var p=k&&"!"==j[k-1]||b-1>o&&"1"==j[o]?"1":"N",q=k;o>q;++q)j[q]=p;k=o-1}}for(var k=0,n=i;b>k;++k){var l=j[k];"L"==n&&"1"==l?j[k]="L":f.test(l)&&(n=l)}for(var k=0;b>k;++k)if(e.test(j[k])){for(var o=k+1;b>o&&e.test(j[o]);++o);for(var r="L"==(k?j[k-1]:i),s="L"==(b-1>o?j[o]:i),p=r||s?"L":"R",q=k;o>q;++q)j[q]=p;k=o-1}for(var u,t=[],k=0;b>k;)if(g.test(j[k])){var v=k;for(++k;b>k&&g.test(j[k]);++k);t.push({from:v,to:k,level:0})}else{var w=k,x=t.length;for(++k;b>k&&"L"!=j[k];++k);for(var q=w;k>q;)if(h.test(j[q])){q>w&&t.splice(x,0,{from:w,to:q,level:1});var y=q;for(++q;k>q&&h.test(j[q]);++q);t.splice(x,0,{from:y,to:q,level:2}),w=q}else++q;k>w&&t.splice(x,0,{from:w,to:k,level:1})}return 1==t[0].level&&(u=a.match(/^\s+/))&&(t[0].from=u[0].length,t.unshift({from:0,to:u[0].length,level:0})),1==_e(t).level&&(u=a.match(/\s+$/))&&(_e(t).to-=u[0].length,t.push({from:b-u[0].length,to:b,level:0})),t[0].level!=_e(t).level&&t.push({from:b,to:b,level:t[0].level}),t}}();return x.version="3.19.1",x}(),CodeMirror.defineMode("css",function(a,b){"use strict";function l(a,b){return k=b,a}function m(a,b){var c=a.next();if(d[c]){var e=d[c](a,b);if(e!==!1)return e}if("@"==c)return a.eatWhile(/[\w\\\-]/),l("def",a.current());if("="==c)l(null,"compare");else{if(("~"==c||"|"==c)&&a.eat("="))return l(null,"compare");if('"'==c||"'"==c)return b.tokenize=n(c),b.tokenize(a,b);if("#"==c)return a.eatWhile(/[\w\\\-]/),l("atom","hash");if("!"==c)return a.match(/^\s*\w*/),l("keyword","important");if(/\d/.test(c)||"."==c&&a.eat(/\d/))return a.eatWhile(/[\w.%]/),l("number","unit");if("-"!==c)return/[,+>*\/]/.test(c)?l(null,"select-op"):"."==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?l("qualifier","qualifier"):":"==c?l("operator",c):/[;{}\[\]\(\)]/.test(c)?l(null,c):"u"==c&&a.match("rl(")?(a.backUp(1),b.tokenize=o,l("property","variable")):(a.eatWhile(/[\w\\\-]/),l("property","variable"));if(/\d/.test(a.peek()))return a.eatWhile(/[\w.%]/),l("number","unit");if(a.match(/^[^-]+-/))return l("meta","meta")}}function n(a,b){return function(c,d){for(var f,e=!1;null!=(f=c.next())&&(f!=a||e);)e=!e&&"\\"==f;return e||(b&&c.backUp(1),d.tokenize=m),l("string","string")}}function o(a,b){return a.next(),b.tokenize=a.match(/\s*[\"\']/,!1)?m:n(")",!0),l(null,"(")}b.propertyKeywords||(b=CodeMirror.resolveMode("text/css"));var c=a.indentUnit||a.tabSize||2,d=b.hooks||{},e=b.atMediaTypes||{},f=b.atMediaFeatures||{},g=b.propertyKeywords||{},h=b.colorKeywords||{},i=b.valueKeywords||{},j=!!b.allowNested,k=null;return{startState:function(a){return{tokenize:m,baseIndent:a||0,stack:[],lastToken:null}},token:function(a,b){if(b.tokenize=b.tokenize||m,b.tokenize==m&&a.eatSpace())return null;var c=b.tokenize(a,b);c&&"string"!=typeof c&&(c=l(c[0],c[1]));var d=b.stack[b.stack.length-1];if("variable"==c)return"variable-definition"==k&&b.stack.push("propertyValue"),b.lastToken="variable-2";if("property"==c){var n=a.current().toLowerCase();"propertyValue"==d?c=i.hasOwnProperty(n)?"string-2":h.hasOwnProperty(n)?"keyword":"variable-2":"rule"==d?g.hasOwnProperty(n)||(c+=" error"):"block"==d?c=g.hasOwnProperty(n)?"property":h.hasOwnProperty(n)?"keyword":i.hasOwnProperty(n)?"string-2":"tag":d&&"@media{"!=d?"@media"==d?c=e[a.current()]?"attribute":/^(only|not)$/.test(n)?"keyword":"and"==n?"error":f.hasOwnProperty(n)?"error":"attribute error":"@mediaType"==d?c=e.hasOwnProperty(n)?"attribute":"and"==n?"operator":/^(only|not)$/.test(n)?"error":"error":"@mediaType("==d?g.hasOwnProperty(n)||(e.hasOwnProperty(n)?c="error":"and"==n?c="operator":/^(only|not)$/.test(n)?c="error":c+=" error"):c="@import"==d?"tag":"error":c="tag"}else"atom"==c?d&&"@media{"!=d&&"block"!=d?"propertyValue"==d?/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(a.current())||(c+=" error"):c="error":c="builtin":"@media"==d&&"{"==k&&(c="error");if("{"==k)if("@media"==d||"@mediaType"==d)b.stack[b.stack.length-1]="@media{";else{var o=j?"block":"rule";b.stack.push(o)}else if("}"==k)for("interpolation"==d&&(c="operator");b.stack.length;){var p=b.stack.pop();if(p.indexOf("{")>-1||"block"==p||"rule"==p)break}else if("interpolation"==k)b.stack.push("interpolation");else if("@media"==k)b.stack.push("@media");else if("@import"==k)b.stack.push("@import");else if("@media"==d&&/\b(keyword|attribute)\b/.test(c))b.stack[b.stack.length-1]="@mediaType";else if("@mediaType"==d&&","==a.current())b.stack[b.stack.length-1]="@media";else if("("==k)"@media"==d||"@mediaType"==d?(b.stack[b.stack.length-1]="@mediaType",b.stack.push("@mediaType(")):b.stack.push("(");else if(")"==k)for(;b.stack.length;){var p=b.stack.pop();if(p.indexOf("(")>-1)break}else":"==k&&"property"==b.lastToken?b.stack.push("propertyValue"):"propertyValue"==d&&";"==k?b.stack.pop():"@import"==d&&";"==k&&b.stack.pop();return b.lastToken=c},indent:function(a,b){var d=a.stack.length;return/^\}/.test(b)&&(d-="propertyValue"==a.stack[d-1]?2:1),a.baseIndent+d*c},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}}),function(){function a(a){for(var b={},c=0;c<a.length;++c)b[a[c]]=!0;return b}function g(a,b){for(var d,c=!1;null!=(d=a.next());){if(c&&"/"==d){b.tokenize=null;break}c="*"==d}return["comment","comment"]}var b=a(["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"]),c=a(["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"]),d=a(["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid-cell","grid-column","grid-column-align","grid-column-sizing","grid-column-span","grid-columns","grid-flow","grid-row","grid-row-align","grid-row-sizing","grid-row-span","grid-rows","grid-template","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-inside","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","zoom","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-profile","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","kerning","text-anchor","writing-mode"]),e=a(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),f=a(["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"]);
6
- CodeMirror.defineMIME("text/css",{atMediaTypes:b,atMediaFeatures:c,propertyKeywords:d,colorKeywords:e,valueKeywords:f,hooks:{"<":function(a,b){function c(a,b){for(var d,c=0;null!=(d=a.next());){if(c>=2&&">"==d){b.tokenize=null;break}c="-"==d?c+1:0}return["comment","comment"]}return a.eat("!")?(b.tokenize=c,c(a,b)):void 0},"/":function(a,b){return a.eat("*")?(b.tokenize=g,g(a,b)):!1}},name:"css"}),CodeMirror.defineMIME("text/x-scss",{atMediaTypes:b,atMediaFeatures:c,propertyKeywords:d,colorKeywords:e,valueKeywords:f,allowNested:!0,hooks:{":":function(a){return a.match(/\s*{/)?[null,"{"]:!1},$:function(a){return a.match(/^[\w-]+/),":"==a.peek()?["variable","variable-definition"]:["variable","variable"]},",":function(a,b){return"propertyValue"==b.stack[b.stack.length-1]&&a.match(/^ *\$/,!1)?["operator",";"]:void 0},"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=g,g(a,b)):["operator","operator"]},"#":function(a){return a.eat("{")?["operator","interpolation"]:(a.eatWhile(/[\w\\\-]/),["atom","hash"])}},name:"css"})}(),CodeMirror.defineMode("htmlmixed",function(a,b){function i(a,b){var f=b.htmlState.tagName,g=c.token(a,b.htmlState);if("script"==f&&/\btag\b/.test(g)&&">"==a.current()){var h=a.string.slice(Math.max(0,a.pos-100),a.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);h=h?h[1]:"",h&&/[\"\']/.test(h.charAt(0))&&(h=h.slice(1,h.length-1));for(var i=0;i<e.length;++i){var j=e[i];if("string"==typeof j.matches?h==j.matches:j.matches.test(h)){j.mode&&(b.token=k,b.localMode=j.mode,b.localState=j.mode.startState&&j.mode.startState(c.indent(b.htmlState,"")));break}}}else"style"==f&&/\btag\b/.test(g)&&">"==a.current()&&(b.token=l,b.localMode=d,b.localState=d.startState(c.indent(b.htmlState,"")));return g}function j(a,b,c){var f,d=a.current(),e=d.search(b);return e>-1?a.backUp(d.length-e):(f=d.match(/<\/?$/))&&(a.backUp(d.length),a.match(b,!1)||a.match(d)),c}function k(a,b){return a.match(/^<\/\s*script\s*>/i,!1)?(b.token=i,b.localState=b.localMode=null,i(a,b)):j(a,/<\/\s*script\s*>/,b.localMode.token(a,b.localState))}function l(a,b){return a.match(/^<\/\s*style\s*>/i,!1)?(b.token=i,b.localState=b.localMode=null,i(a,b)):j(a,/<\/\s*style\s*>/,d.token(a,b.localState))}var c=CodeMirror.getMode(a,{name:"xml",htmlMode:!0}),d=CodeMirror.getMode(a,"css"),e=[],f=b&&b.scriptTypes;if(e.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:CodeMirror.getMode(a,"javascript")}),f)for(var g=0;g<f.length;++g){var h=f[g];e.push({matches:h.matches,mode:h.mode&&CodeMirror.getMode(a,h.mode)})}return e.push({matches:/./,mode:CodeMirror.getMode(a,"text/plain")}),{startState:function(){var a=c.startState();return{token:i,localMode:null,localState:null,htmlState:a}},copyState:function(a){if(a.localState)var b=CodeMirror.copyState(a.localMode,a.localState);return{token:a.token,localMode:a.localMode,localState:b,htmlState:CodeMirror.copyState(c,a.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(a,b){return!a.localMode||/^\s*<\//.test(b)?c.indent(a.htmlState,b):a.localMode.indent?a.localMode.indent(a.localState,b):CodeMirror.Pass},electricChars:"",innerMode:function(a){return{state:a.localState||a.htmlState,mode:a.localMode||c}}}},"xml","javascript","css"),CodeMirror.defineMIME("text/html","htmlmixed"),CodeMirror.defineMode("javascript",function(a,b){function i(a,b){for(var d,c=!1;null!=(d=a.next());){if(d==b&&!c)return!1;c=!c&&"\\"==d}return c}function l(a,b,c){return j=a,k=c,b}function m(a,b){var c=a.next();if('"'==c||"'"==c)return b.tokenize=n(c),b.tokenize(a,b);if("."==c&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return l("number","number");if("."==c&&a.match(".."))return l("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(c))return l(c);if("="==c&&a.eat(">"))return l("=>");if("0"==c&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),l("number","number");if(/\d/.test(c))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),l("number","number");if("/"==c)return a.eat("*")?(b.tokenize=o,o(a,b)):a.eat("/")?(a.skipToEnd(),l("comment","comment")):"operator"==b.lastType||"keyword c"==b.lastType||"sof"==b.lastType||/^[\[{}\(,;:]$/.test(b.lastType)?(i(a,"/"),a.eatWhile(/[gimy]/),l("regexp","string-2")):(a.eatWhile(h),l("operator",null,a.current()));if("`"==c)return b.tokenize=p,p(a,b);if("#"==c)return a.skipToEnd(),l("error","error");if(h.test(c))return a.eatWhile(h),l("operator",null,a.current());a.eatWhile(/[\w\$_]/);var d=a.current(),e=g.propertyIsEnumerable(d)&&g[d];return e&&"."!=b.lastType?l(e.type,e.style,d):l("variable","variable",d)}function n(a){return function(b,c){return i(b,a)||(c.tokenize=m),l("string","string")}}function o(a,b){for(var d,c=!1;d=a.next();){if("/"==d&&c){b.tokenize=m;break}c="*"==d}return l("comment","comment")}function p(a,b){for(var d,c=!1;null!=(d=a.next());){if(!c&&("`"==d||"$"==d&&a.eat("{"))){b.tokenize=m;break}c=!c&&"\\"==d}return l("quasi","string-2",a.current())}function r(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf("=>",a.start);if(!(0>c)){for(var d=0,e=!1,f=c-1;f>=0;--f){var g=a.string.charAt(f),h=q.indexOf(g);if(h>=0&&3>h){if(!d){++f;break}if(0==--d)break}else if(h>=3&&6>h)++d;else if(/[$\w]/.test(g))e=!0;else if(e&&!d){++f;break}}e&&!d&&(b.fatArrowAt=f)}}function t(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,null!=d&&(this.align=d)}function u(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0;for(var d=a.context;d;d=d.prev)for(var c=d.vars;c;c=c.next)if(c.name==b)return!0}function v(a,b,c,d,f){var g=a.cc;for(w.state=a,w.stream=f,w.marked=null,w.cc=g,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);;){var h=g.length?g.pop():e?H:G;if(h(c,d)){for(;g.length&&g[g.length-1].lex;)g.pop()();return w.marked?w.marked:"variable"==c&&u(a,d)?"variable-2":b}}}function x(){for(var a=arguments.length-1;a>=0;a--)w.cc.push(arguments[a])}function y(){return x.apply(null,arguments),!0}function z(a){function c(b){for(var c=b;c;c=c.next)if(c.name==a)return!0;return!1}var d=w.state;if(d.context){if(w.marked="def",c(d.localVars))return;d.localVars={name:a,next:d.localVars}}else{if(c(d.globalVars))return;b.globalVars&&(d.globalVars={name:a,next:d.globalVars})}}function B(){w.state.context={prev:w.state.context,vars:w.state.localVars},w.state.localVars=A}function C(){w.state.localVars=w.state.context.vars,w.state.context=w.state.context.prev}function D(a,b){var c=function(){var c=w.state,d=c.indented;"stat"==c.lexical.type&&(d=c.lexical.indented),c.lexical=new t(d,w.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function E(){var a=w.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function F(a){return function(b){return b==a?y():";"==a?x():y(arguments.callee)}}function G(a,b){return"var"==a?y(D("vardef",b.length),_,F(";"),E):"keyword a"==a?y(D("form"),H,G,E):"keyword b"==a?y(D("form"),G,E):"{"==a?y(D("}"),Y,E):";"==a?y():"if"==a?y(D("form"),H,G,E,eb):"function"==a?y(kb):"for"==a?y(D("form"),fb,E,G,E):"variable"==a?y(D("stat"),S):"switch"==a?y(D("form"),H,D("}","switch"),F("{"),Y,E,E):"case"==a?y(H,F(":")):"default"==a?y(F(":")):"catch"==a?y(D("form"),B,F("("),lb,F(")"),G,E,C):"module"==a?y(D("form"),B,pb,C,E):"class"==a?y(D("form"),mb,ob,E):"export"==a?y(D("form"),qb,E):"import"==a?y(D("form"),rb,E):x(D("stat"),H,F(";"),E)}function H(a){return J(a,!1)}function I(a){return J(a,!0)}function J(a,b){if(w.state.fatArrowAt==w.stream.start){var c=b?R:Q;if("("==a)return y(B,X(ab,")"),F("=>"),c,C);if("variable"==a)return x(B,ab,F("=>"),c,C)}var d=b?N:M;return s.hasOwnProperty(a)?y(d):"function"==a?y(kb):"keyword c"==a?y(b?L:K):"("==a?y(D(")"),K,vb,F(")"),E,d):"operator"==a||"spread"==a?y(b?I:H):"["==a?y(D("]"),I,ub,E,d):"{"==a?y(X(U,"}"),d):y()}function K(a){return a.match(/[;\}\)\],]/)?x():x(H)}function L(a){return a.match(/[;\}\)\],]/)?x():x(I)}function M(a,b){return","==a?y(H):N(a,b,!1)}function N(a,b,c){var d=0==c?M:N,e=0==c?H:I;return"=>"==b?y(B,c?R:Q,C):"operator"==a?/\+\+|--/.test(b)?y(d):"?"==b?y(H,F(":"),e):y(e):"quasi"==a?(w.cc.push(d),O(b)):";"!=a?"("==a?y(X(I,")","call"),d):"."==a?y(T,d):"["==a?y(D("]"),K,F("]"),E,d):void 0:void 0}function O(a){return"${"!=a.slice(a.length-2)?y():y(H,P)}function P(a){return"}"==a?(w.marked="string-2",w.state.tokenize=p,y()):void 0}function Q(a){return r(w.stream,w.state),"{"==a?x(G):x(H)}function R(a){return r(w.stream,w.state),"{"==a?x(G):x(I)}function S(a){return":"==a?y(E,G):x(M,F(";"),E)}function T(a){return"variable"==a?(w.marked="property",y()):void 0}function U(a,b){if("variable"==a){if(w.marked="property","get"==b||"set"==b)return y(V)}else if("number"==a||"string"==a)w.marked=a+" property";else if("["==a)return y(H,F("]"),W);return s.hasOwnProperty(a)?y(W):void 0}function V(a){return"variable"!=a?x(W):(w.marked="property",y(kb))}function W(a){return":"==a?y(I):"("==a?x(kb):void 0}function X(a,b,c){function d(c){if(","==c){var e=w.state.lexical;return"call"==e.info&&(e.pos=(e.pos||0)+1),y(a,d)}return c==b?y():y(F(b))}return function(e){return e==b?y():c===!1?x(a,d):x(D(b,c),a,d,E)}}function Y(a){return"}"==a?y():x(G,Y)}function Z(a){return f&&":"==a?y($):void 0}function $(a){return"variable"==a?(w.marked="variable-3",y()):void 0}function _(){return x(ab,Z,cb,db)}function ab(a,b){return"variable"==a?(z(b),y()):"["==a?y(X(ab,"]")):"{"==a?y(X(bb,"}")):void 0}function bb(a,b){return"variable"!=a||w.stream.match(/^\s*:/,!1)?("variable"==a&&(w.marked="property"),y(F(":"),ab,cb)):(z(b),y(cb))}function cb(a,b){return"="==b?y(I):void 0}function db(a){return","==a?y(_):void 0}function eb(a,b){return"keyword b"==a&&"else"==b?y(D("form"),G,E):void 0}function fb(a){return"("==a?y(D(")"),gb,F(")")):void 0}function gb(a){return"var"==a?y(_,F(";"),ib):";"==a?y(ib):"variable"==a?y(hb):x(H,F(";"),ib)}function hb(a,b){return"in"==b||"of"==b?(w.marked="keyword",y(H)):y(M,ib)}function ib(a,b){return";"==a?y(jb):"in"==b||"of"==b?(w.marked="keyword",y(H)):x(H,F(";"),jb)}function jb(a){")"!=a&&y(H)}function kb(a,b){return"*"==b?(w.marked="keyword",y(kb)):"variable"==a?(z(b),y(kb)):"("==a?y(B,X(lb,")"),G,C):void 0}function lb(a){return"spread"==a?y(lb):x(ab,Z)}function mb(a,b){return"variable"==a?(z(b),y(nb)):void 0}function nb(a,b){return"extends"==b?y(H):void 0}function ob(a){return"{"==a?y(X(U,"}")):void 0}function pb(a,b){return"string"==a?y(G):"variable"==a?(z(b),y(tb)):void 0}function qb(a,b){return"*"==b?(w.marked="keyword",y(tb,F(";"))):"default"==b?(w.marked="keyword",y(H,F(";"))):x(G)}function rb(a){return"string"==a?y():x(sb,tb)}function sb(a,b){return"{"==a?y(X(sb,"}")):("variable"==a&&z(b),y())}function tb(a,b){return"from"==b?(w.marked="keyword",y(H)):void 0}function ub(a){return"for"==a?x(vb):","==a?y(X(I,"]",!1)):x(X(I,"]",!1))}function vb(a){return"for"==a?y(fb,vb):"if"==a?y(H,vb):void 0}var j,k,c=a.indentUnit,d=b.statementIndent,e=b.json,f=b.typescript,g=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),g={type:"atom",style:"atom"},h={"if":a("if"),"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":d,"delete":d,"throw":d,"var":a("var"),"const":a("var"),let:a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":g,"false":g,"null":g,undefined:g,NaN:g,Infinity:g,"this":a("this"),module:a("module"),"class":a("class"),"super":a("atom"),yield:d,"export":a("export"),"import":a("import"),"extends":d};if(f){var i={type:"variable",style:"variable-3"},j={"interface":a("interface"),"extends":a("extends"),constructor:a("constructor"),"public":a("public"),"private":a("private"),"protected":a("protected"),"static":a("static"),string:i,number:i,bool:i,any:i};for(var k in j)h[k]=j[k]}return h}(),h=/[+\-*&%=<>!?|~^]/,q="([{}])",s={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0},w={state:null,column:null,marked:null,cc:null},A={name:"this",next:{name:"arguments"}};return E.lex=!0,{startState:function(a){var d={tokenize:m,lastType:"sof",cc:[],lexical:new t((a||0)-c,0,"block",!1),localVars:b.localVars,context:b.localVars&&{vars:b.localVars},indented:0};return b.globalVars&&(d.globalVars=b.globalVars),d},token:function(a,b){if(a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation(),r(a,b)),b.tokenize!=o&&a.eatSpace())return null;var c=b.tokenize(a,b);return"comment"==j?c:(b.lastType="operator"!=j||"++"!=k&&"--"!=k?j:"incdec",v(b,c,j,k,a))},indent:function(a,e){if(a.tokenize==o)return CodeMirror.Pass;if(a.tokenize!=m)return 0;for(var f=e&&e.charAt(0),g=a.lexical,h=a.cc.length-1;h>=0;--h){var i=a.cc[h];if(i==E)g=g.prev;else if(i!=eb||/^else\b/.test(e))break}"stat"==g.type&&"}"==f&&(g=g.prev),d&&")"==g.type&&"stat"==g.prev.type&&(g=g.prev);var j=g.type,k=f==j;return"vardef"==j?g.indented+("operator"==a.lastType||","==a.lastType?g.info+1:0):"form"==j&&"{"==f?g.indented:"form"==j?g.indented+c:"stat"==j?g.indented+("operator"==a.lastType||","==a.lastType?d||c:0):"switch"!=g.info||k||0==b.doubleIndentSwitch?g.align?g.column+(k?0:1):g.indented+(k?0:c):g.indented+(/^(?:case|default)\b/.test(e)?c:2*c)},electricChars:":{}",blockCommentStart:e?null:"/*",blockCommentEnd:e?null:"*/",lineComment:e?null:"//",fold:"brace",helperType:e?"json":"javascript",jsonMode:e}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("text/ecmascript","javascript"),CodeMirror.defineMIME("application/javascript","javascript"),CodeMirror.defineMIME("application/ecmascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMIME("application/x-json",{name:"javascript",json:!0}),CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:!0}),CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:!0}),CodeMirror.defineMode("xml",function(a,b){function j(a,b){function c(c){return b.tokenize=c,c(a,b)}var d=a.next();if("<"==d){if(a.eat("!"))return a.eat("[")?a.match("CDATA[")?c(m("atom","]]>")):null:a.match("--")?c(m("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(n(1))):null;if(a.eat("?"))return a.eatWhile(/[\w\._\-]/),b.tokenize=m("meta","?>"),"meta";var e=a.eat("/");h="";for(var f;f=a.eat(/[^\s\u00a0=<>\"\'\/?]/);)h+=f;return h?(i=e?"closeTag":"openTag",b.tokenize=k,"tag"):"tag error"}if("&"==d){var g;return g=a.eat("#")?a.eat("x")?a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):a.eatWhile(/[\d]/)&&a.eat(";"):a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),g?"atom":"error"}return a.eatWhile(/[^&<]/),null}function k(a,b){var c=a.next();if(">"==c||"/"==c&&a.eat(">"))return b.tokenize=j,i=">"==c?"endTag":"selfcloseTag","tag";if("="==c)return i="equals",null;if("<"==c){b.tokenize=j;var d=b.tokenize(a,b);return d?d+" error":"error"}return/[\'\"]/.test(c)?(b.tokenize=l(c),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.eatWhile(/[^\s\u00a0=<>\"\']/),"word")}function l(a){var b=function(b,c){for(;!b.eol();)if(b.next()==a){c.tokenize=k;break}return"string"};return b.isInAttribute=!0,b}function m(a,b){return function(c,d){for(;!c.eol();){if(c.match(b)){d.tokenize=j;break}c.next()}return a}}function n(a){return function(b,c){for(var d;null!=(d=b.next());){if("<"==d)return c.tokenize=n(a+1),c.tokenize(b,c);if(">"==d){if(1==a){c.tokenize=j;break}return c.tokenize=n(a-1),c.tokenize(b,c)}}return"meta"}}function r(){for(var a=arguments.length-1;a>=0;a--)o.cc.push(arguments[a])}function s(){return r.apply(null,arguments),!0}function t(a,b){var c=f.doNotIndent.hasOwnProperty(a)||o.context&&o.context.noIndent;o.context={prev:o.context,tagName:a,indent:o.indented,startOfLine:b,noIndent:c}}function u(){o.context&&(o.context=o.context.prev)}function v(a){if("openTag"==a)return o.tagName=h,o.tagStart=p.column(),s(z,w(o.startOfLine));if("closeTag"==a){var b=!1;return o.context?o.context.tagName!=h&&(f.implicitlyClosed.hasOwnProperty(o.context.tagName.toLowerCase())&&u(),b=!o.context||o.context.tagName!=h):b=!0,b&&(q="error"),s(x(b))}return s()}function w(a){return function(b){var c=o.tagName;return o.tagName=o.tagStart=null,"selfcloseTag"==b||"endTag"==b&&f.autoSelfClosers.hasOwnProperty(c.toLowerCase())?(y(c.toLowerCase()),s()):"endTag"==b?(y(c.toLowerCase()),t(c,a),s()):s()}}function x(a){return function(b){return a&&(q="error"),"endTag"==b?(u(),s()):(q="error",s(arguments.callee))}}function y(a){for(var b;;){if(!o.context)return;if(b=o.context.tagName.toLowerCase(),!f.contextGrabbers.hasOwnProperty(b)||!f.contextGrabbers[b].hasOwnProperty(a))return;u()}}function z(a){return"word"==a?(q="attribute",s(A,z)):"endTag"==a||"selfcloseTag"==a?r():(q="error",s(z))}function A(a){if("equals"==a)return s(B,z);if(f.allowMissing){if("word"==a)return q="attribute",s(A,z)}else q="error";return"endTag"==a||"selfcloseTag"==a?r():s()}function B(a){return"string"==a?s(C):"word"==a&&f.allowUnquoted?(q="string",s()):(q="error","endTag"==a||"selfCloseTag"==a?r():s())}function C(a){return"string"==a?s(C):r()}var h,i,o,p,q,c=a.indentUnit,d=b.multilineTagIndentFactor||1,e=b.multilineTagIndentPastTag||!0,f=b.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1},g=b.alignCDATA;return{startState:function(){return{tokenize:j,cc:[],indented:0,startOfLine:!0,tagName:null,tagStart:null,context:null}},token:function(a,b){if(!b.tagName&&a.sol()&&(b.startOfLine=!0,b.indented=a.indentation()),a.eatSpace())return null;q=i=h=null;var c=b.tokenize(a,b);if(b.type=i,(c||i)&&"comment"!=c)for(o=b,p=a;;){var d=b.cc.pop()||v;if(d(i||c))break}return b.startOfLine=!1,q&&(c="error"==q?c+" error":q),c},indent:function(a,b,f){var h=a.context;if(a.tokenize.isInAttribute)return a.stringStartCol+1;if(a.tokenize!=k&&a.tokenize!=j||h&&h.noIndent)return f?f.match(/^(\s*)/)[0].length:0;if(a.tagName)return e?a.tagStart+a.tagName.length+2:a.tagStart+c*d;if(g&&/<!\[CDATA\[/.test(b))return 0;for(h&&/^<\//.test(b)&&(h=h.prev);h&&!h.startOfLine;)h=h.prev;return h?h.indent+c:0},electricChars:"/",blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:b.htmlMode?"html":"xml",helperType:b.htmlMode?"html":"xml"}}),CodeMirror.defineMIME("text/xml","xml"),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.mimeModes.hasOwnProperty("text/html")||CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0}),function(){"use strict";function c(c){"activeLine"in c.state&&(c.removeLineClass(c.state.activeLine,"wrap",a),c.removeLineClass(c.state.activeLine,"background",b))}function d(d){var e=d.getLineHandleVisualStart(d.getCursor().line);d.state.activeLine!=e&&(c(d),d.addLineClass(e,"wrap",a),d.addLineClass(e,"background",b),d.state.activeLine=e)}var a="CodeMirror-activeline",b="CodeMirror-activeline-background";CodeMirror.defineOption("styleActiveLine",!1,function(a,b,e){var f=e&&e!=CodeMirror.Init;b&&!f?(d(a),a.on("cursorActivity",d)):!b&&f&&(a.off("cursorActivity",d),c(a),delete a.state.activeLine)})}(),function(){function d(a,d,e){function r(d,e,f){if(d.text){var h=m?0:d.text.length-1,i=m?d.text.length:-1;if(d.text.length>g)return null;for(null!=f&&(h=f+n);h!=i;h+=n){var j=d.text.charAt(h);if(q.test(j)&&a.getTokenTypeAt(b(e,h+1))==o){var k=c[j];if(">"==k.charAt(1)==m)p.push(j);else{if(p.pop()!=k.charAt(0))return{pos:h,match:!1};if(!p.length)return{pos:h,match:!0}}}}}}var f=a.state.matchBrackets,g=f&&f.maxScanLineLength||1e4,h=f&&f.maxScanLines||100,i=d||a.getCursor(),j=a.getLineHandle(i.line),k=i.ch-1,l=k>=0&&c[j.text.charAt(k)]||c[j.text.charAt(++k)];if(!l)return null;var m=">"==l.charAt(1),n=m?1:-1;if(e&&m!=(k==i.ch))return null;for(var t,o=a.getTokenTypeAt(b(i.line,k+1)),p=[j.text.charAt(k)],q=/[(){}[\]]/,s=i.line,u=m?Math.min(s+h,a.lineCount()):Math.max(-1,s-h);s!=u&&!(t=s==i.line?r(j,s,k):r(a.getLineHandle(s),s));s+=n);return{from:b(i.line,k),to:t&&b(s,t.pos),match:t&&t.match,forward:m}}function e(c,e){var f=c.state.matchBrackets.maxHighlightLineLength||1e3,g=d(c);if(!(!g||c.getLine(g.from.line).length>f||g.to&&c.getLine(g.to.line).length>f)){var h=g.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",i=c.markText(g.from,b(g.from.line,g.from.ch+1),{className:h}),j=g.to&&c.markText(g.to,b(g.to.line,g.to.ch+1),{className:h});a&&c.state.focused&&c.display.input.focus();var k=function(){c.operation(function(){i.clear(),j&&j.clear()})};return e?(setTimeout(k,800),void 0):k}}function g(a){a.operation(function(){f&&(f(),f=null),a.somethingSelected()||(f=e(a,!1))})}var a=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),b=CodeMirror.Pos,c={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},f=null;CodeMirror.defineOption("matchBrackets",!1,function(a,b,c){c&&c!=CodeMirror.Init&&a.off("cursorActivity",g),b&&(a.state.matchBrackets="object"==typeof b?b:{},a.on("cursorActivity",g))}),CodeMirror.defineExtension("matchBrackets",function(){e(this,!0)}),CodeMirror.defineExtension("findMatchingBracket",function(a,b){return d(this,a,b)})}(),window.onload=heshPlugin;
 
 
1
+ // CodeMirror version 3.20
2
+ //
3
+ // CodeMirror is the only global var we claim
4
+ function heshPlugin(){var e=null,t=0,n=0,r=document.getElementById("content"),i=document.getElementById("post_ID")!==null?document.getElementById("post_ID").value:0,s=document.getElementById("content-html"),o=document.getElementById("content-tmce"),u=document.cookie.indexOf("editor%3Dtinymce")!==-1?!0:!1,a=document.getElementById("content-tmce")!==null?!0:!1,f=document.getElementById("wp-content-editor-container"),l="heshFullscreen",c=document.getElementById("publish"),h={mode:"text/html",tabMode:"indent",lineNumbers:!0,matchBrackets:!0,indentUnit:4,indentWithTabs:!0,enterMode:"keep",lineWrapping:!0,autofocus:!0,styleActiveLine:!0,electricChars:!1,extraKeys:{F11:function(){b()},Esc:function(){b()},"Ctrl-S":function(){c.click()},"Cmd-S":function(){c.click()}}},p=function(){var e=document.getElementById("ed_toolbar");if(!n){var t={more:["<!--more-->",""],comment:["<!-- "," -->"],code:["<code>","</code>"],li:["<li>","</li>"],ol:["<ol>","</ol>"],ul:["<ul>","</ul>"],img:['<img src="$" alt="','">',"Enter the URL of the image"],ins:["<ins>","</ins>"],del:["<del>","</del>"],link:['<a href="$">',"</a>","Enter the destination URL"],blockquote:["\r<blockquote>","</blockquote>\r"],h3:["<h3>","</h3>"],h2:["<h2>","</h2>"],h1:["<h1>","</h1>"],i:["<em>","</em>"],b:["<strong>","</strong>"]};for(var r in t){var i=t[r],s=i[2]?'data-prompt="'+i[2]+'"':"";e.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_content_'+r+"\" data-start='"+i[0]+"' data-end='"+i[1]+"' "+s+' class="ed_button cm_ed_button" value="'+r+'">');document.getElementById("cm_content_"+r).onclick=d}w();n=1}},d=function(){var t=e.getCursor("start"),n=this.getAttribute("data-start"),r=this.getAttribute("data-end"),i=this.getAttribute("data-prompt")||null,s=e.getSelection();i&&(n=n.replace("$",prompt(i,"")));e.replaceSelection(n+s+r);e.setSelection(t,e.getCursor("end"));e.setCursor(t.line,t.ch+n.length);e.focus()},v=function(n){e=CodeMirror.fromTextArea(n,h);e.on("change",function(){e.save()});e.on("cursorActivity",function(){var t=e.getCursor();window.name=i+","+t.line+","+t.ch});var r=window.name.split(",");i===r[0]&&e.setCursor(parseFloat(r[1]),parseFloat(r[2]));p();y();E();t=1},m=function(){if(t){e.toTextArea();s.onclick=g;switchEditors.switchto(this);t=0}},g=function(){if(!t){switchEditors.switchto(this);v(r);o.onclick=m}},y=function(){var e=document.querySelector(".CodeMirror"),t=document.createElement("div"),n=document.getElementById("wp-content-wrap"),r=e.getBoundingClientRect().top,i=function(t){t=t||window.event;var n=(t.pageY||t.clientY+document.body.scrollTop+document.documentElement.scrollTop)-r;e.style.height=(n>10?n:10)+"px";window.getSelection().removeAllRanges()};t.className="content-resize-handle";n.appendChild(t);t.onmousedown=function(){document.onmousemove=i};document.onmouseup=function(){document.onmousemove=null}},b=function(){f.className=f.className.indexOf(l)===-1?f.className+" "+l:f.className.replace(l,"");var t=document.getElementById("cm_content_fullscreen");t.value=t.value==="fullscreen"?"exit fullscreen":"fullscreen";e.focus()},w=function(){document.getElementById("ed_toolbar").insertAdjacentHTML("afterbegin",'<input type="button" id="cm_content_fullscreen" class="ed_button" title="Toggle fullscreen mode" value="fullscreen">');document.getElementById("cm_content_fullscreen").onclick=b},E=function(){if(!window.send_to_editor_wp){window.send_to_editor_wp=window.send_to_editor;window.send_to_editor=function(n){if(t){e.replaceSelection(n);e.save()}else window.send_to_editor_wp(n)}}};if(u&&a)s.onclick=g;else{v(r);a&&(o.onclick=m)}}window.CodeMirror=function(){"use strict";function x(e,n){if(!(this instanceof x))return new x(e,n);this.options=n=n||{};for(var r in er)!n.hasOwnProperty(r)&&er.hasOwnProperty(r)&&(n[r]=er[r]);H(n);var i=typeof n.value=="string"?0:n.value.first,s=this.display=T(e,i);s.wrapper.CodeMirror=this;_(this);n.autofocus&&!v&&It(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new Qi};O(this);n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var o=n.value;typeof o=="string"&&(o=new ui(n.value,n.mode));Mt(this,ci)(this,o);t&&setTimeout(os(Ft,this,!0),20);Rt(this);var u;try{u=document.activeElement==s.input}catch(a){}u||n.autofocus&&!v?setTimeout(os(pn,this),20):dn(this);Mt(this,function(){for(var e in Zn)Zn.propertyIsEnumerable(e)&&Zn[e](this,n[e],nr);for(var t=0;t<or.length;++t)or[t](this)})()}function T(e,t){var r={},i=r.input=cs("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");s?i.style.width="1000px":i.setAttribute("wrap","off");d&&(i.style.border="1px solid black");i.setAttribute("autocorrect","off");i.setAttribute("autocapitalize","off");i.setAttribute("spellcheck","false");r.inputDiv=cs("div",[i],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");r.scrollbarH=cs("div",[cs("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");r.scrollbarV=cs("div",[cs("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");r.scrollbarFiller=cs("div",null,"CodeMirror-scrollbar-filler");r.gutterFiller=cs("div",null,"CodeMirror-gutter-filler");r.lineDiv=cs("div",null,"CodeMirror-code");r.selectionDiv=cs("div",null,null,"position: relative; z-index: 1");r.cursor=cs("div"," ","CodeMirror-cursor");r.otherCursor=cs("div"," ","CodeMirror-cursor CodeMirror-secondarycursor");r.measure=cs("div",null,"CodeMirror-measure");r.lineSpace=cs("div",[r.measure,r.selectionDiv,r.lineDiv,r.cursor,r.otherCursor],null,"position: relative; outline: none");r.mover=cs("div",[cs("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative");r.sizer=cs("div",[r.mover],"CodeMirror-sizer");r.heightForcer=cs("div",null,null,"position: absolute; height: "+Ji+"px; width: 1px;");r.gutters=cs("div",null,"CodeMirror-gutters");r.lineGutter=null;r.scroller=cs("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll");r.scroller.setAttribute("tabIndex","-1");r.wrapper=cs("div",[r.inputDiv,r.scrollbarH,r.scrollbarV,r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror");if(n){r.gutters.style.zIndex=-1;r.scroller.style.paddingRight=0}e.appendChild?e.appendChild(r.wrapper):e(r.wrapper);d&&(i.style.width="0px");s||(r.scroller.draggable=!0);if(l){r.inputDiv.style.height="1px";r.inputDiv.style.position="absolute"}else n&&(r.scrollbarH.style.minWidth=r.scrollbarV.style.minWidth="18px");r.viewOffset=r.lastSizeC=0;r.showingFrom=r.showingTo=t;r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null;r.prevInput="";r.alignWidgets=!1;r.pollingFast=!1;r.poll=new Qi;r.cachedCharWidth=r.cachedTextHeight=null;r.measureLineCache=[];r.measureLineCachePos=0;r.inaccurateSelection=!1;r.maxLine=null;r.maxLineLength=0;r.maxLineChanged=!1;r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null;return r}function N(e){e.doc.mode=x.getMode(e.options,e.doc.modeOption);e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null);e.styles&&(e.styles=null)});e.doc.frontier=e.doc.first;tt(e,100);e.state.modeGen++;e.curOp&&Pt(e)}function C(e){if(e.options.lineWrapping){e.display.wrapper.className+=" CodeMirror-wrap";e.display.sizer.style.minWidth=""}else{e.display.wrapper.className=e.display.wrapper.className.replace(" CodeMirror-wrap","");P(e)}L(e);Pt(e);vt(e);setTimeout(function(){B(e)},100)}function k(e){var t=Ct(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/kt(e.display)-3);return function(i){return Dr(e.doc,i)?0:n?(Math.ceil(i.text.length/r)||1)*t:t}}function L(e){var t=e.doc,n=k(e);t.iter(function(e){var t=n(e);t!=e.height&&vi(e,t)})}function A(e){var t=cr[e.options.keyMap],n=t.style;e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(n?" cm-keymap-"+n:"");e.state.disableInput=t.disableInput}function O(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-");vt(e)}function M(e){_(e);Pt(e);setTimeout(function(){F(e)},20)}function _(e){var t=e.display.gutters,n=e.options.gutters;hs(t);for(var r=0;r<n.length;++r){var i=n[r],s=t.appendChild(cs("div",null,"CodeMirror-gutter "+i));if(i=="CodeMirror-linenumbers"){e.display.lineGutter=s;s.style.width=(e.display.lineNumWidth||1)+"px"}}t.style.display=r?"":"none"}function D(e,t){if(t.height==0)return 0;var n=t.text.length,r,i=t;while(r=Or(i)){var s=r.find();i=hi(e,s.from.line);n+=s.from.ch-s.to.ch}i=t;while(r=Mr(i)){var s=r.find();n-=i.text.length-s.from.ch;i=hi(e,s.to.line);n+=i.text.length-s.to.ch}return n}function P(e){var t=e.display,n=e.doc;t.maxLine=hi(n,n.first);t.maxLineLength=D(n,t.maxLine);t.maxLineChanged=!0;n.iter(function(e){var r=D(n,e);if(r>t.maxLineLength){t.maxLineLength=r;t.maxLine=e}})}function H(e){var t=ns(e.gutters,"CodeMirror-linenumbers");if(t==-1&&e.lineNumbers)e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]);else if(t>-1&&!e.lineNumbers){e.gutters=e.gutters.slice(0);e.gutters.splice(t,1)}}function B(e){var t=e.display,n=e.doc.height,r=n+ot(t);t.sizer.style.minHeight=t.heightForcer.style.top=r+"px";t.gutters.style.height=Math.max(r,t.scroller.clientHeight-Ji)+"px";var i=Math.max(r,t.scroller.scrollHeight),s=t.scroller.scrollWidth>t.scroller.clientWidth+1,o=i>t.scroller.clientHeight+1;if(o){t.scrollbarV.style.display="block";t.scrollbarV.style.bottom=s?bs(t.measure)+"px":"0";t.scrollbarV.firstChild.style.height=i-t.scroller.clientHeight+t.scrollbarV.clientHeight+"px"}else{t.scrollbarV.style.display="";t.scrollbarV.firstChild.style.height="0"}if(s){t.scrollbarH.style.display="block";t.scrollbarH.style.right=o?bs(t.measure)+"px":"0";t.scrollbarH.firstChild.style.width=t.scroller.scrollWidth-t.scroller.clientWidth+t.scrollbarH.clientWidth+"px"}else{t.scrollbarH.style.display="";t.scrollbarH.firstChild.style.width="0"}if(s&&o){t.scrollbarFiller.style.display="block";t.scrollbarFiller.style.height=t.scrollbarFiller.style.width=bs(t.measure)+"px"}else t.scrollbarFiller.style.display="";if(s&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter){t.gutterFiller.style.display="block";t.gutterFiller.style.height=bs(t.measure)+"px";t.gutterFiller.style.width=t.gutters.offsetWidth+"px"}else t.gutterFiller.style.display="";if(c&&bs(t.measure)===0){t.scrollbarV.style.minWidth=t.scrollbarH.style.minHeight=h?"18px":"12px";t.scrollbarV.style.pointerEvents=t.scrollbarH.style.pointerEvents="none"}}function j(e,t,n){var r=e.scroller.scrollTop,i=e.wrapper.clientHeight;if(typeof n=="number")r=n;else if(n){r=n.top;i=n.bottom-n.top}r=Math.floor(r-st(e));var s=Math.ceil(r+i);return{from:gi(t,r),to:gi(t,s)}}function F(e){var t=e.display;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;var n=R(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,i=n+"px";for(var s=t.lineDiv.firstChild;s;s=s.nextSibling)if(s.alignable)for(var o=0,u=s.alignable;o<u.length;++o)u[o].style.left=i;e.options.fixedGutter&&(t.gutters.style.left=n+r+"px")}function I(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=q(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(cs("div",[cs("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),s=i.firstChild.offsetWidth,o=i.offsetWidth-s;r.lineGutter.style.width="";r.lineNumInnerWidth=Math.max(s,r.lineGutter.offsetWidth-o);r.lineNumWidth=r.lineNumInnerWidth+o;r.lineNumChars=r.lineNumInnerWidth?n.length:-1;r.lineGutter.style.width=r.lineNumWidth+"px";return!0}return!1}function q(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function R(e){return vs(e.scroller).left-vs(e.sizer).left}function U(e,t,n,r){var i=e.display.showingFrom,s=e.display.showingTo,o,u=j(e.display,e.doc,n);for(var a=!0;;a=!1){var f=e.display.scroller.clientWidth;if(!z(e,t,u,r))break;o=!0;t=[];G(e);B(e);if(a&&e.options.lineWrapping&&f!=e.display.scroller.clientWidth){r=!0;continue}r=!1;n&&(n=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,typeof n=="number"?n:n.top));u=j(e.display,e.doc,n);if(u.from>=e.display.showingFrom&&u.to<=e.display.showingTo)break}if(o){zi(e,"update",e);(e.display.showingFrom!=i||e.display.showingTo!=s)&&zi(e,"viewportChange",e,e.display.showingFrom,e.display.showingTo)}return o}function z(e,t,n,r){var i=e.display,s=e.doc;if(!i.wrapper.clientWidth){i.showingFrom=i.showingTo=s.first;i.viewOffset=0;return}if(!r&&t.length==0&&n.from>i.showingFrom&&n.to<i.showingTo)return;I(e)&&(t=[{from:s.first,to:s.first+s.size}]);var o=i.sizer.style.marginLeft=i.gutters.offsetWidth+"px";i.scrollbarH.style.left=e.options.fixedGutter?o:"0";var u=Infinity;if(e.options.lineNumbers)for(var a=0;a<t.length;++a)t[a].diff&&t[a].from<u&&(u=t[a].from);var f=s.first+s.size,l=Math.max(n.from-e.options.viewportMargin,s.first),c=Math.min(f,n.to+e.options.viewportMargin);i.showingFrom<l&&l-i.showingFrom<20&&(l=Math.max(s.first,i.showingFrom));i.showingTo>c&&i.showingTo-c<20&&(c=Math.min(f,i.showingTo));if(S){l=mi(_r(s,hi(s,l)));while(c<f&&Dr(s,hi(s,c)))++c}var h=[{from:Math.max(i.showingFrom,s.first),to:Math.min(i.showingTo,f)}];h[0].from>=h[0].to?h=[]:h=V(h,t);if(S)for(var a=0;a<h.length;++a){var p=h[a],d;while(d=Mr(hi(s,p.to-1))){var v=d.find().from.line;if(!(v>p.from)){h.splice(a--,1);break}p.to=v}}var m=0;for(var a=0;a<h.length;++a){var p=h[a];p.from<l&&(p.from=l);p.to>c&&(p.to=c);p.from>=p.to?h.splice(a--,1):m+=p.to-p.from}if(!r&&m==c-l&&l==i.showingFrom&&c==i.showingTo){X(e);return}h.sort(function(e,t){return e.from-t.from});try{var g=document.activeElement}catch(y){}m<(c-l)*.7&&(i.lineDiv.style.display="none");J(e,l,c,h,u);i.lineDiv.style.display="";g&&document.activeElement!=g&&g.offsetHeight&&g.focus();var b=l!=i.showingFrom||c!=i.showingTo||i.lastSizeC!=i.wrapper.clientHeight;if(b){i.lastSizeC=i.wrapper.clientHeight;tt(e,400)}i.showingFrom=l;i.showingTo=c;W(e);X(e);return!0}function W(e){var t=e.display,r=t.lineDiv.offsetTop;for(var i=t.lineDiv.firstChild,s;i;i=i.nextSibling)if(i.lineObj){if(n){var o=i.offsetTop+i.offsetHeight;s=o-r;r=o}else{var u=vs(i);s=u.bottom-u.top}var a=i.lineObj.height-s;s<2&&(s=Ct(t));if(a>.001||a<-0.001){vi(i.lineObj,s);var f=i.lineObj.widgets;if(f)for(var l=0;l<f.length;++l)f[l].height=f[l].node.offsetHeight}}}function X(e){var t=e.display.viewOffset=yi(e,hi(e.doc,e.display.showingFrom));e.display.mover.style.top=t+"px"}function V(e,t){for(var n=0,r=t.length||0;n<r;++n){var i=t[n],s=[],o=i.diff||0;for(var u=0,a=e.length;u<a;++u){var f=e[u];if(i.to<=f.from&&i.diff)s.push({from:f.from+o,to:f.to+o});else if(i.to<=f.from||i.from>=f.to)s.push(f);else{i.from>f.from&&s.push({from:f.from,to:i.from});i.to<f.to&&s.push({from:i.to+o,to:f.to+o})}}e=s}return e}function $(e){var t=e.display,n={},r={};for(var i=t.gutters.firstChild,s=0;i;i=i.nextSibling,++s){n[e.options.gutters[s]]=i.offsetLeft;r[e.options.gutters[s]]=i.offsetWidth}return{fixedPos:R(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function J(e,t,n,r,i){function c(t){var n=t.nextSibling;if(s&&m&&e.display.currentWheelTarget==t){t.style.display="none";t.lineObj=null}else t.parentNode.removeChild(t);return n}var o=$(e),u=e.display,a=e.options.lineNumbers;!r.length&&(!s||!e.display.currentWheelTarget)&&hs(u.lineDiv);var f=u.lineDiv,l=f.firstChild,h=r.shift(),p=t;e.doc.iter(t,n,function(t){h&&h.to==p&&(h=r.shift());if(Dr(e.doc,t)){t.height!=0&&vi(t,0);if(t.widgets&&l&&l.previousSibling)for(var n=0;n<t.widgets.length;++n){var s=t.widgets[n];if(s.showIfHidden){var u=l.previousSibling;if(/pre/i.test(u.nodeName)){var d=cs("div",null,null,"position: relative");u.parentNode.replaceChild(d,u);d.appendChild(u);u=d}var v=u.appendChild(cs("div",[s.node],"CodeMirror-linewidget"));s.handleMouseEvents||(v.ignoreEvents=!0);Q(s,v,u,o)}}}else if(h&&h.from<=p&&h.to>p){while(l.lineObj!=t)l=c(l);a&&i<=p&&l.lineNumber&&ds(l.lineNumber,q(e.options,p));l=l.nextSibling}else{if(t.widgets)for(var m=0,g=l,y;g&&m<20;++m,g=g.nextSibling)if(g.lineObj==t&&/div/i.test(g.nodeName)){y=g;break}var b=K(e,t,p,o,y);if(b!=y)f.insertBefore(b,l);else{while(l!=y)l=c(l);l=l.nextSibling}b.lineObj=t}++p});while(l)l=c(l)}function K(e,t,r,i,s){var o=Qr(e,t),u=o.pre,a=t.gutterMarkers,f=e.display,l,c=o.bgClass?o.bgClass+" "+(t.bgClass||""):t.bgClass;if(!e.options.lineNumbers&&!a&&!c&&!t.wrapClass&&!t.widgets)return u;if(s){s.alignable=null;var h=!0,p=0,d=null;for(var v=s.firstChild,m;v;v=m){m=v.nextSibling;if(!/\bCodeMirror-linewidget\b/.test(v.className))s.removeChild(v);else{for(var g=0;g<t.widgets.length;++g){var y=t.widgets[g];if(y.node==v.firstChild){!y.above&&!d&&(d=v);Q(y,v,s,i);++p;break}}if(g==t.widgets.length){h=!1;break}}}s.insertBefore(u,d);if(h&&p==t.widgets.length){l=s;s.className=t.wrapClass||""}}if(!l){l=cs("div",null,t.wrapClass,"position: relative");l.appendChild(u)}c&&l.insertBefore(cs("div",null,c+" CodeMirror-linebackground"),l.firstChild);if(e.options.lineNumbers||a){var b=l.insertBefore(cs("div",null,null,"position: absolute; left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px"),l.firstChild);e.options.fixedGutter&&(l.alignable||(l.alignable=[])).push(b);e.options.lineNumbers&&(!a||!a["CodeMirror-linenumbers"])&&(l.lineNumber=b.appendChild(cs("div",q(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+f.lineNumInnerWidth+"px")));if(a)for(var w=0;w<e.options.gutters.length;++w){var E=e.options.gutters[w],S=a.hasOwnProperty(E)&&a[E];S&&b.appendChild(cs("div",[S],"CodeMirror-gutter-elt","left: "+i.gutterLeft[E]+"px; width: "+i.gutterWidth[E]+"px"))}}n&&(l.style.zIndex=2);if(t.widgets&&l!=s)for(var g=0,x=t.widgets;g<x.length;++g){var y=x[g],T=cs("div",[y.node],"CodeMirror-linewidget");y.handleMouseEvents||(T.ignoreEvents=!0);Q(y,T,l,i);y.above?l.insertBefore(T,e.options.lineNumbers&&t.height!=0?b:u):l.appendChild(T);zi(y,"redraw")}return l}function Q(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px";if(!e.coverGutter){i-=r.gutterTotalWidth;t.style.paddingLeft=r.gutterTotalWidth+"px"}t.style.width=i+"px"}if(e.coverGutter){t.style.zIndex=5;t.style.position="relative";e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px")}}function G(e){var t=e.display,n=An(e.doc.sel.from,e.doc.sel.to);n||e.options.showCursorWhenSelecting?Y(e):t.cursor.style.display=t.otherCursor.style.display="none";n?t.selectionDiv.style.display="none":Z(e);if(e.options.moveInputWithCursor){var r=Et(e,e.doc.sel.head,"div"),i=vs(t.wrapper),s=vs(t.lineDiv);t.inputDiv.style.top=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+s.top-i.top))+"px";t.inputDiv.style.left=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+s.left-i.left))+"px"}}function Y(e){var t=e.display,n=Et(e,e.doc.sel.head,"div");t.cursor.style.left=n.left+"px";t.cursor.style.top=n.top+"px";t.cursor.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px";t.cursor.style.display="";if(n.other){t.otherCursor.style.display="";t.otherCursor.style.left=n.other.left+"px";t.otherCursor.style.top=n.other.top+"px";t.otherCursor.style.height=(n.other.bottom-n.other.top)*.85+"px"}else t.otherCursor.style.display="none"}function Z(e){function u(e,t,n,r){t<0&&(t=0);i.appendChild(cs("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(n==null?s-e:n)+"px; height: "+(r-t)+"px"))}function a(t,r,i){function h(n,r){return wt(e,Ln(t,n),"div",a,r)}var a=hi(n,t),f=a.text.length,l,c;Cs(bi(a),r||0,i==null?f:i,function(e,t,n){var a=h(e,"left"),p,d,v;if(e==t){p=a;d=v=a.left}else{p=h(t-1,"right");if(n=="rtl"){var m=a;a=p;p=m}d=a.left;v=p.right}r==null&&e==0&&(d=o);if(p.top-a.top>3){u(d,a.top,null,a.bottom);d=o;a.bottom<p.top&&u(d,a.bottom,null,p.top)}i==null&&t==f&&(v=s);if(!l||a.top<l.top||a.top==l.top&&a.left<l.left)l=a;if(!c||p.bottom>c.bottom||p.bottom==c.bottom&&p.right>c.right)c=p;d<o+1&&(d=o);u(d,p.top,v-d,p.bottom)});return{start:l,end:c}}var t=e.display,n=e.doc,r=e.doc.sel,i=document.createDocumentFragment(),s=t.lineSpace.offsetWidth,o=ut(e.display);if(r.from.line==r.to.line)a(r.from.line,r.from.ch,r.to.ch);else{var f=hi(n,r.from.line),l=hi(n,r.to.line),c=_r(n,f)==_r(n,l),h=a(r.from.line,r.from.ch,c?f.text.length:null).end,p=a(r.to.line,c?0:null,r.to.ch).start;if(c)if(h.top<p.top-2){u(h.right,h.top,null,h.bottom);u(o,p.top,p.left,p.bottom)}else u(h.right,h.top,p.left-h.right,h.bottom);h.bottom<p.top&&u(o,h.bottom,null,p.top)}ps(t.selectionDiv,i);t.selectionDiv.style.display=""}function et(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursor.style.visibility=t.otherCursor.style.visibility="";e.options.cursorBlinkRate>0&&(t.blinker=setInterval(function(){t.cursor.style.visibility=t.otherCursor.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate))}function tt(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.showingTo&&e.state.highlight.set(t,os(nt,e))}function nt(e){var t=e.doc;t.frontier<t.first&&(t.frontier=t.first);if(t.frontier>=e.display.showingTo)return;var n=+(new Date)+e.options.workTime,r=ar(t.mode,it(e,t.frontier)),i=[],s;t.iter(t.frontier,Math.min(t.first+t.size,e.display.showingTo+500),function(o){if(t.frontier>=e.display.showingFrom){var u=o.styles;o.styles=Xr(e,o,r,!0);var a=!u||u.length!=o.styles.length;for(var f=0;!a&&f<u.length;++f)a=u[f]!=o.styles[f];a&&(s&&s.end==t.frontier?s.end++:i.push(s={start:t.frontier,end:t.frontier+1}));o.stateAfter=ar(t.mode,r)}else{$r(e,o.text,r);o.stateAfter=t.frontier%5==0?ar(t.mode,r):null}++t.frontier;if(+(new Date)>n){tt(e,e.options.workDelay);return!0}});i.length&&Mt(e,function(){for(var e=0;e<i.length;++e)Pt(this,i[e].start,i[e].end)})()}function rt(e,t,n){var r,i,s=e.doc,o=n?-1:t-(e.doc.mode.innerMode?1e3:100);for(var u=t;u>o;--u){if(u<=s.first)return s.first;var a=hi(s,u-1);if(a.stateAfter&&(!n||u<=s.frontier))return u;var f=Gi(a.text,null,e.options.tabSize);if(i==null||r>f){i=u-1;r=f}}return i}function it(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var s=rt(e,t,n),o=s>r.first&&hi(r,s-1).stateAfter;o?o=ar(r.mode,o):o=fr(r.mode);r.iter(s,t,function(n){$r(e,n.text,o);var u=s==t-1||s%5==0||s>=i.showingFrom&&s<i.showingTo;n.stateAfter=u?ar(r.mode,o):null;++s});n&&(r.frontier=s);return o}function st(e){return e.lineSpace.offsetTop}function ot(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ut(e){var t=ps(e.measure,cs("pre",null,null,"text-align: left")).appendChild(cs("span","x"));return t.offsetLeft}function at(e,t,n,r,i){var s=-1;r=r||ct(e,t);if(r.crude){var o=r.left+n*r.width;return{left:o,right:o+r.width,top:r.top,bottom:r.bottom}}for(var u=n;;u+=s){var a=r[u];if(a)break;s<0&&u==0&&(s=1)}i=u>n?"left":u<n?"right":i;i=="left"&&a.leftSide?a=a.leftSide:i=="right"&&a.rightSide&&(a=a.rightSide);return{left:u<n?a.right:a.left,right:u>n?a.left:a.right,top:a.top,bottom:a.bottom}}function ft(e,t){var n=e.display.measureLineCache;for(var r=0;r<n.length;++r){var i=n[r];if(i.text==t.text&&i.markedSpans==t.markedSpans&&e.display.scroller.clientWidth==i.width&&i.classes==t.textClass+"|"+t.wrapClass)return i}}function lt(e,t){var n=ft(e,t);n&&(n.text=n.measure=n.markedSpans=null)}function ct(e,t){var n=ft(e,t);if(n)return n.measure;var r=ht(e,t),i=e.display.measureLineCache,s={text:t.text,width:e.display.scroller.clientWidth,markedSpans:t.markedSpans,measure:r,classes:t.textClass+"|"+t.wrapClass};i.length==16?i[++e.display.measureLineCachePos%16]=s:i.push(s);return r}function ht(e,i){function b(e){var t=e.top-v.top,n=e.bottom-v.top;n>y&&(n=y);t<0&&(t=0);for(var r=m.length-2;r>=0;r-=2){var i=m[r],s=m[r+1];if(i>n||s<t)continue;if(i<=t&&s>=n||t<=i&&n>=s||Math.min(n,s)-Math.max(t,i)>=n-t>>1){m[r]=Math.min(t,i);m[r+1]=Math.max(n,s);break}}if(r<0){r=m.length;m.push(t,n)}return{left:e.left-v.left,right:e.right-v.left,top:r,bottom:null}}function w(e){e.bottom=m[e.top+1];e.top=m[e.top]}if(!e.options.lineWrapping&&i.text.length>=e.options.crudeMeasuringFrom)return pt(e,i);var s=e.display,o=ss(i.text.length),u=Qr(e,i,o,!0).pre;if(t&&!n&&!e.options.lineWrapping&&u.childNodes.length>100){var a=document.createDocumentFragment(),f=10,l=u.childNodes.length;for(var c=0,h=Math.ceil(l/f);c<h;++c){var p=cs("div",null,null,"display: inline-block");for(var d=0;d<f&&l;++d){p.appendChild(u.firstChild);--l}a.appendChild(p)}u.appendChild(a)}ps(s.measure,u);var v=vs(s.lineDiv),m=[],g=ss(i.text.length),y=u.offsetHeight;r&&s.measure.first!=u&&ps(s.measure,u);for(var c=0,E;c<o.length;++c)if(E=o[c]){var S=E,x=null;if(/\bCodeMirror-widget\b/.test(E.className)&&E.getClientRects){E.firstChild.nodeType==1&&(S=E.firstChild);var T=S.getClientRects();if(T.length>1){x=g[c]=b(T[0]);x.rightSide=b(T[T.length-1])}}x||(x=g[c]=b(vs(S)));E.measureRight&&(x.right=vs(E.measureRight).left);E.leftSide&&(x.leftSide=b(vs(E.leftSide)))}hs(e.display.measure);for(var c=0,E;c<g.length;++c)if(E=g[c]){w(E);E.leftSide&&w(E.leftSide);E.rightSide&&w(E.rightSide)}return g}function pt(e,t){var n=new Rr(t.text.slice(0,100),null);t.textClass&&(n.textClass=t.textClass);var r=ht(e,n),i=at(e,n,0,r,"left"),s=at(e,n,99,r,"right");return{crude:!0,top:i.top,left:i.left,bottom:i.bottom,width:(s.right-i.left)/100}}function dt(e,t){var n=!1;if(t.markedSpans)for(var r=0;r<t.markedSpans;++r){var i=t.markedSpans[r];i.collapsed&&(i.to==null||i.to==t.text.length)&&(n=!0)}var s=!n&&ft(e,t);if(s||t.text.length>=e.options.crudeMeasuringFrom)return at(e,t,t.text.length,s&&s.measure,"right").right;var o=Qr(e,t,null,!0).pre,u=o.appendChild(Es(e.display.measure));ps(e.display.measure,o);return vs(u).right-vs(e.display.lineDiv).left}function vt(e){e.display.measureLineCache.length=e.display.measureLineCachePos=0;e.display.cachedCharWidth=e.display.cachedTextHeight=null;e.options.lineWrapping||(e.display.maxLineChanged=!0);e.display.lineNumChars=null}function mt(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function gt(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function yt(e,t,n,r){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var s=Ir(t.widgets[i]);n.top+=s;n.bottom+=s}if(r=="line")return n;r||(r="local");var o=yi(e,t);r=="local"?o+=st(e.display):o-=e.display.viewOffset;if(r=="page"||r=="window"){var u=vs(e.display.lineSpace);o+=u.top+(r=="window"?0:gt());var a=u.left+(r=="window"?0:mt());n.left+=a;n.right+=a}n.top+=o;n.bottom+=o;return n}function bt(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page"){r-=mt();i-=gt()}else if(n=="local"||!n){var s=vs(e.display.sizer);r+=s.left;i+=s.top}var o=vs(e.display.lineSpace);return{left:r-o.left,top:i-o.top}}function wt(e,t,n,r,i){r||(r=hi(e.doc,t.line));return yt(e,r,at(e,r,t.ch,null,i),n)}function Et(e,t,n,r,i){function s(t,s){var o=at(e,r,t,i,s?"right":"left");s?o.left=o.right:o.right=o.left;return yt(e,r,o,n)}function o(e,t){var n=u[t],r=n.level%2;if(e==ks(n)&&t&&n.level<u[t-1].level){n=u[--t];e=Ls(n)-(n.level%2?0:1);r=!0}else if(e==Ls(n)&&t<u.length-1&&n.level<u[t+1].level){n=u[++t];e=ks(n)-n.level%2;r=!1}return r&&e==n.to&&e>n.from?s(e-1):s(e,r)}r=r||hi(e.doc,t.line);i||(i=ct(e,r));var u=bi(r),a=t.ch;if(!u)return s(a);var f=Hs(u,a),l=o(a,f);Ps!=null&&(l.other=o(a,Ps));return l}function St(e,t,n,r){var i=new Ln(e,t);i.xRel=r;n&&(i.outside=!0);return i}function xt(e,t,n){var r=e.doc;n+=e.display.viewOffset;if(n<0)return St(r.first,0,!0,-1);var i=gi(r,n),s=r.first+r.size-1;if(i>s)return St(r.first+r.size-1,hi(r,s).text.length,!0,1);t<0&&(t=0);for(;;){var o=hi(r,i),u=Tt(e,o,i,t,n),a=Mr(o),f=a&&a.find();if(!a||!(u.ch>f.from.ch||u.ch==f.from.ch&&u.xRel>0))return u;i=f.to.line}}function Tt(e,t,n,r,i){function f(r){var i=Et(e,Ln(n,r),"line",t,a);o=!0;if(s>i.bottom)return i.left-u;if(s<i.top)return i.left+u;o=!1;return i.left}var s=i-yi(e,t),o=!1,u=2*e.display.wrapper.clientWidth,a=ct(e,t),l=bi(t),c=t.text.length,h=As(t),p=Os(t),d=f(h),v=o,m=f(p),g=o;if(r>m)return St(n,p,g,1);for(;;){if(l?p==h||p==js(t,h,1):p-h<=1){var y=r<d||r-d<=m-r?h:p,b=r-(y==h?d:m);while(ls.test(t.text.charAt(y)))++y;var w=St(n,y,y==h?v:g,b<0?-1:b?1:0);return w}var E=Math.ceil(c/2),S=h+E;if(l){S=h;for(var x=0;x<E;++x)S=js(t,S,1)}var T=f(S);if(T>r){p=S;m=T;if(g=o)m+=1e3;c=E}else{h=S;d=T;v=o;c-=E}}}function Ct(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Nt==null){Nt=cs("pre");for(var t=0;t<49;++t){Nt.appendChild(document.createTextNode("x"));Nt.appendChild(cs("br"))}Nt.appendChild(document.createTextNode("x"))}ps(e.measure,Nt);var n=Nt.offsetHeight/50;n>3&&(e.cachedTextHeight=n);hs(e.measure);return n||1}function kt(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=cs("span","x"),n=cs("pre",[t]);ps(e.measure,n);var r=t.offsetWidth;r>2&&(e.cachedCharWidth=r);return r||10}function At(e){e.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Lt};Ui++||(Ri=[])}function Ot(e){var t=e.curOp,n=e.doc,r=e.display;e.curOp=null;t.updateMaxLine&&P(e);if(r.maxLineChanged&&!e.options.lineWrapping&&r.maxLine){var i=dt(e,r.maxLine);r.sizer.style.minWidth=Math.max(0,i+3+Ji)+"px";r.maxLineChanged=!1;var s=Math.max(0,r.sizer.offsetLeft+r.sizer.offsetWidth-r.scroller.clientWidth);s<n.scrollLeft&&!t.updateScrollPos&&en(e,Math.min(r.scroller.scrollLeft,s),!0)}var o,u;if(t.updateScrollPos)o=t.updateScrollPos;else if(t.selectionChanged&&r.scroller.clientHeight){var a=Et(e,n.sel.head);o=Wn(e,a.left,a.top,a.left,a.bottom)}if(t.changes.length||t.forceUpdate||o&&o.scrollTop!=null){u=U(e,t.changes,o&&o.scrollTop,t.forceUpdate);e.display.scroller.offsetHeight&&(e.doc.scrollTop=e.display.scroller.scrollTop)}!u&&t.selectionChanged&&G(e);if(t.updateScrollPos){var f=Math.max(0,Math.min(r.scroller.scrollHeight-r.scroller.clientHeight,o.scrollTop)),l=Math.max(0,Math.min(r.scroller.scrollWidth-r.scroller.clientWidth,o.scrollLeft));r.scroller.scrollTop=r.scrollbarV.scrollTop=n.scrollTop=f;r.scroller.scrollLeft=r.scrollbarH.scrollLeft=n.scrollLeft=l;F(e);t.scrollToPos&&Un(e,Dn(e.doc,t.scrollToPos.from),Dn(e.doc,t.scrollToPos.to),t.scrollToPos.margin)}else o&&Rn(e);t.selectionChanged&&et(e);e.state.focused&&t.updateInput&&Ft(e,t.userSelChange);var c=t.maybeHiddenMarkers,h=t.maybeUnhiddenMarkers;if(c)for(var p=0;p<c.length;++p)c[p].lines.length||qi(c[p],"hide");if(h)for(var p=0;p<h.length;++p)h[p].lines.length&&qi(h[p],"unhide");var d;if(!--Ui){d=Ri;Ri=null}t.textChanged&&qi(e,"change",e,t.textChanged);t.cursorActivity&&qi(e,"cursorActivity",e);if(d)for(var p=0;p<d.length;++p)d[p]()}function Mt(e,t){return function(){var n=e||this,r=!n.curOp;r&&At(n);try{var i=t.apply(n,arguments)}finally{r&&Ot(n)}return i}}function _t(e){return function(){var t=this.cm&&!this.cm.curOp,n;t&&At(this.cm);try{n=e.apply(this,arguments)}finally{t&&Ot(this.cm)}return n}}function Dt(e,t){var n=!e.curOp,r;n&&At(e);try{r=t()}finally{n&&Ot(e)}return r}function Pt(e,t,n,r){t==null&&(t=e.doc.first);n==null&&(n=e.doc.first+e.doc.size);e.curOp.changes.push({from:t,to:n,diff:r})}function Ht(e){if(e.display.pollingFast)return;e.display.poll.set(e.options.pollInterval,function(){jt(e);e.state.focused&&Ht(e)})}function Bt(e){function n(){var r=jt(e);if(!r&&!t){t=!0;e.display.poll.set(60,n)}else{e.display.pollingFast=!1;Ht(e)}}var t=!1;e.display.pollingFast=!0;e.display.poll.set(20,n)}function jt(e){var n=e.display.input,i=e.display.prevInput,s=e.doc,o=s.sel;if(!e.state.focused||xs(n)||qt(e)||e.state.disableInput)return!1;if(e.state.pasteIncoming&&e.state.fakedLastChar){n.value=n.value.substring(0,n.value.length-1);e.state.fakedLastChar=!1}var u=n.value;if(u==i&&An(o.from,o.to))return!1;if(t&&!r&&e.display.inputHasSelection===u){Ft(e,!0);return!1}var a=!e.curOp;a&&At(e);o.shift=!1;var f=0,l=Math.min(i.length,u.length);while(f<l&&i.charCodeAt(f)==u.charCodeAt(f))++f;var c=o.from,h=o.to;f<i.length?c=Ln(c.line,c.ch-(i.length-f)):e.state.overwrite&&An(c,h)&&!e.state.pasteIncoming&&(h=Ln(h.line,Math.min(hi(s,h.line).text.length,h.ch+(u.length-f))));var p=e.curOp.updateInput,d={from:c,to:h,text:Ss(u.slice(f)),origin:e.state.pasteIncoming?"paste":"+input"};En(e.doc,d,"end");e.curOp.updateInput=p;zi(e,"inputRead",e,d);u.length>1e3||u.indexOf("\n")>-1?n.value=e.display.prevInput="":e.display.prevInput=u;a&&Ot(e);e.state.pasteIncoming=!1;return!0}function Ft(e,n){var i,s,o=e.doc;if(!An(o.sel.from,o.sel.to)){e.display.prevInput="";i=Ts&&(o.sel.to.line-o.sel.from.line>100||(s=e.getSelection()).length>1e3);var u=i?"-":s||e.getSelection();e.display.input.value=u;e.state.focused&&ts(e.display.input);t&&!r&&(e.display.inputHasSelection=u)}else if(n){e.display.prevInput=e.display.input.value="";t&&!r&&(e.display.inputHasSelection=null)}e.
5
+ display.inaccurateSelection=i}function It(e){e.options.readOnly!="nocursor"&&(!v||document.activeElement!=e.display.input)&&e.display.input.focus()}function qt(e){return e.options.readOnly||e.doc.cantEdit}function Rt(e){function i(){e.state.focused&&setTimeout(os(It,e),0)}function u(){o==null&&(o=setTimeout(function(){o=null;n.cachedCharWidth=n.cachedTextHeight=ys=null;vt(e);Dt(e,os(Pt,e))},100))}function a(){for(var e=n.wrapper.parentNode;e&&e!=document.body;e=e.parentNode);e?setTimeout(a,5e3):Ii(window,"resize",u)}function f(t){if(Wi(e,t)||e.options.onDragEvent&&e.options.onDragEvent(e,Mi(t)))return;Hi(t)}function c(){if(n.inaccurateSelection){n.prevInput="";n.inaccurateSelection=!1;n.input.value=e.getSelection();ts(n.input)}}var n=e.display;Fi(n.scroller,"mousedown",Mt(e,Vt));t?Fi(n.scroller,"dblclick",Mt(e,function(t){if(Wi(e,t))return;var n=zt(e,t);if(!n||Kt(e,t)||Ut(e.display,t))return;_i(t);var r=Gn(hi(e.doc,n.line).text,n);Bn(e.doc,r.from,r.to)})):Fi(n.scroller,"dblclick",function(t){Wi(e,t)||_i(t)});Fi(n.lineSpace,"selectstart",function(e){Ut(n,e)||_i(e)});w||Fi(n.scroller,"contextmenu",function(t){mn(e,t)});Fi(n.scroller,"scroll",function(){if(n.scroller.clientHeight){Zt(e,n.scroller.scrollTop);en(e,n.scroller.scrollLeft,!0);qi(e,"scroll",e)}});Fi(n.scrollbarV,"scroll",function(){n.scroller.clientHeight&&Zt(e,n.scrollbarV.scrollTop)});Fi(n.scrollbarH,"scroll",function(){n.scroller.clientHeight&&en(e,n.scrollbarH.scrollLeft)});Fi(n.scroller,"mousewheel",function(t){rn(e,t)});Fi(n.scroller,"DOMMouseScroll",function(t){rn(e,t)});Fi(n.scrollbarH,"mousedown",i);Fi(n.scrollbarV,"mousedown",i);Fi(n.wrapper,"scroll",function(){n.wrapper.scrollTop=n.wrapper.scrollLeft=0});var o;Fi(window,"resize",u);setTimeout(a,5e3);Fi(n.input,"keyup",Mt(e,function(t){if(Wi(e,t)||e.options.onKeyEvent&&e.options.onKeyEvent(e,Mi(t)))return;t.keyCode==16&&(e.doc.sel.shift=!1)}));Fi(n.input,"input",function(){t&&!r&&e.display.inputHasSelection&&(e.display.inputHasSelection=null);Bt(e)});Fi(n.input,"keydown",Mt(e,cn));Fi(n.input,"keypress",Mt(e,hn));Fi(n.input,"focus",os(pn,e));Fi(n.input,"blur",os(dn,e));if(e.options.dragDrop){Fi(n.scroller,"dragstart",function(t){Yt(e,t)});Fi(n.scroller,"dragenter",f);Fi(n.scroller,"dragover",f);Fi(n.scroller,"drop",Mt(e,Gt))}Fi(n.scroller,"paste",function(t){if(Ut(n,t))return;It(e);Bt(e)});Fi(n.input,"paste",function(){if(s&&!e.state.fakedLastChar&&!(new Date-e.state.lastMiddleDown<200)){var t=n.input.selectionStart,r=n.input.selectionEnd;n.input.value+="$";n.input.selectionStart=t;n.input.selectionEnd=r;e.state.fakedLastChar=!0}e.state.pasteIncoming=!0;Bt(e)});Fi(n.input,"cut",c);Fi(n.input,"copy",c);l&&Fi(n.sizer,"mouseup",function(){document.activeElement==n.input&&n.input.blur();It(e)})}function Ut(e,t){for(var n=Bi(t);n!=e.wrapper;n=n.parentNode)if(!n||n.ignoreEvents||n.parentNode==e.sizer&&n!=e.mover)return!0}function zt(e,t,n){var r=e.display;if(!n){var i=Bi(t);if(i==r.scrollbarH||i==r.scrollbarH.firstChild||i==r.scrollbarV||i==r.scrollbarV.firstChild||i==r.scrollbarFiller||i==r.gutterFiller)return null}var s,o,u=vs(r.lineSpace);try{s=t.clientX;o=t.clientY}catch(t){return null}return xt(e,s-u.left,o-u.top)}function Vt(e){function m(e){if(An(v,e))return;v=e;if(f=="single"){Bn(n.doc,Dn(i,u),e);return}p=Dn(i,p);d=Dn(i,d);if(f=="double"){var t=Gn(hi(i,e.line).text,e);On(e,p)?Bn(n.doc,t.from,d):Bn(n.doc,p,t.to)}else f=="triple"&&(On(e,p)?Bn(n.doc,d,Dn(i,Ln(e.line,0))):Bn(n.doc,p,Dn(i,Ln(e.line+1,0))))}function b(e){var t=++y,s=zt(n,e,!0);if(!s)return;if(!An(s,c)){n.state.focused||pn(n);c=s;m(s);var o=j(r,i);(s.line>=o.to||s.line<o.from)&&setTimeout(Mt(n,function(){y==t&&b(e)}),150)}else{var u=e.clientY<g.top?-20:e.clientY>g.bottom?20:0;u&&setTimeout(Mt(n,function(){if(y!=t)return;r.scroller.scrollTop+=u;b(e)}),50)}}function E(e){y=Infinity;_i(e);It(n);Ii(document,"mousemove",S);Ii(document,"mouseup",x)}if(Wi(this,e))return;var n=this,r=n.display,i=n.doc,o=i.sel;o.shift=e.shiftKey;if(Ut(r,e)){if(!s){r.scroller.draggable=!1;setTimeout(function(){r.scroller.draggable=!0},100)}return}if(Kt(n,e))return;var u=zt(n,e);switch(ji(e)){case 3:w&&mn.call(n,n,e);return;case 2:s&&(n.state.lastMiddleDown=+(new Date));u&&Bn(n.doc,u);setTimeout(os(It,n),20);_i(e);return}if(!u){Bi(e)==r.scroller&&_i(e);return}n.state.focused||pn(n);var a=+(new Date),f="single";if(Xt&&Xt.time>a-400&&An(Xt.pos,u)){f="triple";_i(e);setTimeout(os(It,n),20);Yn(n,u.line)}else if(Wt&&Wt.time>a-400&&An(Wt.pos,u)){f="double";Xt={time:a,pos:u};_i(e);var l=Gn(hi(i,u.line).text,u);Bn(n.doc,l.from,l.to)}else Wt={time:a,pos:u};var c=u;if(n.options.dragDrop&&ms&&!qt(n)&&!An(o.from,o.to)&&!On(u,o.from)&&!On(o.to,u)&&f=="single"){var h=Mt(n,function(t){s&&(r.scroller.draggable=!1);n.state.draggingText=!1;Ii(document,"mouseup",h);Ii(r.scroller,"drop",h);if(Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)<10){_i(t);Bn(n.doc,u);It(n)}});s&&(r.scroller.draggable=!0);n.state.draggingText=h;r.scroller.dragDrop&&r.scroller.dragDrop();Fi(document,"mouseup",h);Fi(r.scroller,"drop",h);return}_i(e);f=="single"&&Bn(n.doc,Dn(i,u));var p=o.from,d=o.to,v=u,g=vs(r.wrapper),y=0,S=Mt(n,function(e){!t&&!ji(e)?E(e):b(e)}),x=Mt(n,E);Fi(document,"mousemove",S);Fi(document,"mouseup",x)}function $t(e,t,n,r,i){try{var s=t.clientX,o=t.clientY}catch(t){return!1}if(s>=Math.floor(vs(e.display.gutters).right))return!1;r&&_i(t);var u=e.display,a=vs(u.lineDiv);if(o>a.bottom||!Vi(e,n))return Pi(t);o-=a.top-u.viewOffset;for(var f=0;f<e.options.gutters.length;++f){var l=u.gutters.childNodes[f];if(l&&vs(l).right>=s){var c=gi(e.doc,o),h=e.options.gutters[f];i(e,n,e,c,h,t);return Pi(t)}}}function Jt(e,t){return Vi(e,"gutterContextMenu")?$t(e,t,"gutterContextMenu",!1,qi):!1}function Kt(e,t){return $t(e,t,"gutterClick",!0,zi)}function Gt(e){var n=this;if(Wi(n,e)||Ut(n.display,e)||n.options.onDragEvent&&n.options.onDragEvent(n,Mi(e)))return;_i(e);t&&(Qt=+(new Date));var r=zt(n,e,!0),i=e.dataTransfer.files;if(!r||qt(n))return;if(i&&i.length&&window.FileReader&&window.File){var s=i.length,o=Array(s),u=0,a=function(e,t){var i=new FileReader;i.onload=function(){o[t]=i.result;if(++u==s){r=Dn(n.doc,r);En(n.doc,{from:r,to:r,text:Ss(o.join("\n")),origin:"paste"},"around")}};i.readAsText(e)};for(var f=0;f<s;++f)a(i[f],f)}else{if(n.state.draggingText&&!On(r,n.doc.sel.from)&&!On(n.doc.sel.to,r)){n.state.draggingText(e);setTimeout(os(It,n),20);return}try{var o=e.dataTransfer.getData("Text");if(o){var l=n.doc.sel.from,c=n.doc.sel.to;Fn(n.doc,r,r);n.state.draggingText&&kn(n.doc,"",l,c,"paste");n.replaceSelection(o,null,"paste");It(n)}}catch(e){}}}function Yt(e,n){if(t&&(!e.state.draggingText||+(new Date)-Qt<100)){Hi(n);return}if(Wi(e,n)||Ut(e.display,n))return;var r=e.getSelection();n.dataTransfer.setData("Text",r);if(n.dataTransfer.setDragImage&&!f){var i=cs("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(a){i.width=i.height=1;e.display.wrapper.appendChild(i);i._top=i.offsetTop}n.dataTransfer.setDragImage(i,0,0);a&&i.parentNode.removeChild(i)}}function Zt(t,n){if(Math.abs(t.doc.scrollTop-n)<2)return;t.doc.scrollTop=n;e||U(t,[],n);t.display.scroller.scrollTop!=n&&(t.display.scroller.scrollTop=n);t.display.scrollbarV.scrollTop!=n&&(t.display.scrollbarV.scrollTop=n);e&&U(t,[]);tt(t,100)}function en(e,t,n){if(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)return;t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth);e.doc.scrollLeft=t;F(e);e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t);e.display.scrollbarH.scrollLeft!=t&&(e.display.scrollbarH.scrollLeft=t)}function rn(t,n){var r=n.wheelDeltaX,i=n.wheelDeltaY;r==null&&n.detail&&n.axis==n.HORIZONTAL_AXIS&&(r=n.detail);i==null&&n.detail&&n.axis==n.VERTICAL_AXIS?i=n.detail:i==null&&(i=n.wheelDelta);var o=t.display,u=o.scroller;if(!(r&&u.scrollWidth>u.clientWidth||i&&u.scrollHeight>u.clientHeight))return;if(i&&m&&s)for(var f=n.target;f!=u;f=f.parentNode)if(f.lineObj){t.display.currentWheelTarget=f;break}if(r&&!e&&!a&&nn!=null){i&&Zt(t,Math.max(0,Math.min(u.scrollTop+i*nn,u.scrollHeight-u.clientHeight)));en(t,Math.max(0,Math.min(u.scrollLeft+r*nn,u.scrollWidth-u.clientWidth)));_i(n);o.wheelStartX=null;return}if(i&&nn!=null){var l=i*nn,c=t.doc.scrollTop,h=c+o.wrapper.clientHeight;l<0?c=Math.max(0,c+l-50):h=Math.min(t.doc.height,h+l+50);U(t,[],{top:c,bottom:h})}if(tn<20)if(o.wheelStartX==null){o.wheelStartX=u.scrollLeft;o.wheelStartY=u.scrollTop;o.wheelDX=r;o.wheelDY=i;setTimeout(function(){if(o.wheelStartX==null)return;var e=u.scrollLeft-o.wheelStartX,t=u.scrollTop-o.wheelStartY,n=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null;if(!n)return;nn=(nn*tn+n)/(tn+1);++tn},200)}else{o.wheelDX+=r;o.wheelDY+=i}}function sn(e,t,n){if(typeof t=="string"){t=lr[t];if(!t)return!1}e.display.pollingFast&&jt(e)&&(e.display.pollingFast=!1);var r=e.doc,i=r.sel.shift,s=!1;try{qt(e)&&(e.state.suppressEdits=!0);n&&(r.sel.shift=!1);s=t(e)!=Ki}finally{r.sel.shift=i;e.state.suppressEdits=!1}return s}function on(e){var t=e.state.keyMaps.slice(0);e.options.extraKeys&&t.push(e.options.extraKeys);t.push(e.options.keyMap);return t}function an(e,t){var n=hr(e.options.keyMap),i=n.auto;clearTimeout(un);i&&!dr(t)&&(un=setTimeout(function(){if(hr(e.options.keyMap)==n){e.options.keyMap=i.call?i.call(null,e):i;A(e)}},50));var s=vr(t,!0),o=!1;if(!s)return!1;var u=on(e);t.shiftKey?o=pr("Shift-"+s,u,function(t){return sn(e,t,!0)})||pr(s,u,function(t){if(typeof t=="string"?/^go[A-Z]/.test(t):t.motion)return sn(e,t)}):o=pr(s,u,function(t){return sn(e,t)});if(o){_i(t);et(e);if(r){t.oldKeyCode=t.keyCode;t.keyCode=0}zi(e,"keyHandled",e,s,t)}return o}function fn(e,t,n){var r=pr("'"+n+"'",on(e),function(t){return sn(e,t,!0)});if(r){_i(t);et(e);zi(e,"keyHandled",e,"'"+n+"'",t)}return r}function cn(e){var n=this;n.state.focused||pn(n);if(Wi(n,e)||n.options.onKeyEvent&&n.options.onKeyEvent(n,Mi(e)))return;t&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;n.doc.sel.shift=r==16||e.shiftKey;var i=an(n,e);if(a){ln=i?r:null;!i&&r==88&&!Ts&&(m?e.metaKey:e.ctrlKey)&&n.replaceSelection("")}}function hn(e){var n=this;if(Wi(n,e)||n.options.onKeyEvent&&n.options.onKeyEvent(n,Mi(e)))return;var i=e.keyCode,s=e.charCode;if(a&&i==ln){ln=null;_i(e);return}if((a&&(!e.which||e.which<10)||l)&&an(n,e))return;var o=String.fromCharCode(s==null?i:s);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!qt(this)&&this.doc.mode.electricChars.indexOf(o)>-1&&setTimeout(Mt(n,function(){$n(n,n.doc.sel.to.line,"smart")}),75);if(fn(n,e,o))return;t&&!r&&(n.display.inputHasSelection=null);Bt(n)}function pn(e){if(e.options.readOnly=="nocursor")return;if(!e.state.focused){qi(e,"focus",e);e.state.focused=!0;e.display.wrapper.className.search(/\bCodeMirror-focused\b/)==-1&&(e.display.wrapper.className+=" CodeMirror-focused");if(!e.curOp){Ft(e,!0);s&&setTimeout(os(Ft,e,!0),0)}}Ht(e);et(e)}function dn(e){if(e.state.focused){qi(e,"blur",e);e.state.focused=!1;e.display.wrapper.className=e.display.wrapper.className.replace(" CodeMirror-focused","")}clearInterval(e.display.blinker);setTimeout(function(){e.state.focused||(e.doc.sel.shift=!1)},150)}function mn(e,n){function c(){if(i.input.selectionStart!=null){var e=i.input.value="​"+(An(s.from,s.to)?"":i.input.value);i.prevInput="​";i.input.selectionStart=1;i.input.selectionEnd=e.length}}function h(){i.inputDiv.style.position="relative";i.input.style.cssText=l;r&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=u);Ht(e);if(i.input.selectionStart!=null){(!t||r)&&c();clearTimeout(vn);var n=0,s=function(){i.prevInput==" "&&i.input.selectionStart==0?Mt(e,lr.selectAll)(e):n++<10?vn=setTimeout(s,500):Ft(e)};vn=setTimeout(s,200)}}if(Wi(e,n,"contextmenu"))return;var i=e.display,s=e.doc.sel;if(Ut(i,n)||Jt(e,n))return;var o=zt(e,n),u=i.scroller.scrollTop;if(!o||a)return;var f=e.options.resetSelectionOnContextMenu;f&&(An(s.from,s.to)||On(o,s.from)||!On(o,s.to))&&Mt(e,Fn)(e.doc,o,o);var l=i.input.style.cssText;i.inputDiv.style.position="absolute";i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(n.clientY-5)+"px; left: "+(n.clientX-5)+"px; z-index: 1000; background: white; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);";It(e);Ft(e,!0);An(s.from,s.to)&&(i.input.value=i.prevInput=" ");t&&!r&&c();if(w){Hi(n);var p=function(){Ii(window,"mouseup",p);setTimeout(h,20)};Fi(window,"mouseup",p)}else setTimeout(h,50)}function yn(e,t,n){if(!On(t.from,n))return Dn(e,n);var r=t.text.length-1-(t.to.line-t.from.line);if(n.line>t.to.line+r){var i=n.line-r,s=e.first+e.size-1;return i>s?Ln(s,hi(e,s).text.length):Pn(n,hi(e,i).text.length)}if(n.line==t.to.line+r)return Pn(n,es(t.text).length+(t.text.length==1?t.from.ch:0)+hi(e,t.to.line).text.length-t.to.ch);var o=n.line-t.from.line;return Pn(n,t.text[o].length+(o?0:t.from.ch))}function bn(e,t,n){if(n&&typeof n=="object")return{anchor:yn(e,t,n.anchor),head:yn(e,t,n.head)};if(n=="start")return{anchor:t.from,head:t.from};var r=gn(t);if(n=="around")return{anchor:t.from,head:r};if(n=="end")return{anchor:r,head:r};var i=function(e){if(On(e,t.from))return e;if(!On(t.to,e))return r;var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;e.line==t.to.line&&(i+=r.ch-t.to.ch);return Ln(n,i)};return{anchor:i(e.sel.anchor),head:i(e.sel.head)}}function wn(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};n&&(r.update=function(t,n,r,i){t&&(this.from=Dn(e,t));n&&(this.to=Dn(e,n));r&&(this.text=r);i!==undefined&&(this.origin=i)});qi(e,"beforeChange",e,r);e.cm&&qi(e.cm,"beforeChange",e.cm,r);return r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function En(e,t,n,r){if(e.cm){if(!e.cm.curOp)return Mt(e.cm,En)(e,t,n,r);if(e.cm.state.suppressEdits)return}if(Vi(e,"beforeChange")||e.cm&&Vi(e.cm,"beforeChange")){t=wn(e,t,!0);if(!t)return}var i=E&&!r&&Lr(e,t.from,t.to);if(i){for(var s=i.length-1;s>=1;--s)Sn(e,{from:i[s].from,to:i[s].to,text:[""]});i.length&&Sn(e,{from:i[0].from,to:i[0].to,text:t.text},n)}else Sn(e,t,n)}function Sn(e,t,n){if(t.text.length==1&&t.text[0]==""&&An(t.from,t.to))return;var r=bn(e,t,n);xi(e,t,r,e.cm?e.cm.curOp.id:NaN);Nn(e,t,r,Cr(e,t));var i=[];li(e,function(e,n){if(!n&&ns(i,e.history)==-1){Ai(e.history,t);i.push(e.history)}Nn(e,t,null,Cr(e,t))})}function xn(e,t){if(e.cm&&e.cm.state.suppressEdits)return;var n=e.history,r=(t=="undo"?n.done:n.undone).pop();if(!r)return;var i={changes:[],anchorBefore:r.anchorAfter,headBefore:r.headAfter,anchorAfter:r.anchorBefore,headAfter:r.headBefore,generation:n.generation};(t=="undo"?n.undone:n.done).push(i);n.generation=r.generation||++n.maxGeneration;var s=Vi(e,"beforeChange")||e.cm&&Vi(e.cm,"beforeChange");for(var o=r.changes.length-1;o>=0;--o){var u=r.changes[o];u.origin=t;if(s&&!wn(e,u,!1)){(t=="undo"?n.done:n.undone).length=0;return}i.changes.push(Si(e,u));var a=o?bn(e,u,null):{anchor:r.anchorBefore,head:r.headBefore};Nn(e,u,a,kr(e,u));var f=[];li(e,function(e,t){if(!t&&ns(f,e.history)==-1){Ai(e.history,u);f.push(e.history)}Nn(e,u,null,kr(e,u))})}}function Tn(e,t){function n(e){return Ln(e.line+t,e.ch)}e.first+=t;e.cm&&Pt(e.cm,e.first,e.first,t);e.sel.head=n(e.sel.head);e.sel.anchor=n(e.sel.anchor);e.sel.from=n(e.sel.from);e.sel.to=n(e.sel.to)}function Nn(e,t,n,r){if(e.cm&&!e.cm.curOp)return Mt(e.cm,Nn)(e,t,n,r);if(t.to.line<e.first){Tn(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Tn(e,i);t={from:Ln(e.first,0),to:Ln(t.to.line+i,t.to.ch),text:[es(t.text)],origin:t.origin}}var s=e.lastLine();t.to.line>s&&(t={from:t.from,to:Ln(s,hi(e,s).text.length),text:[t.text[0]],origin:t.origin});t.removed=pi(e,t.from,t.to);n||(n=bn(e,t,null));e.cm?Cn(e.cm,t,r,n):ri(e,t,r,n)}function Cn(e,t,n,r){var i=e.doc,s=e.display,o=t.from,u=t.to,a=!1,f=o.line;if(!e.options.lineWrapping){f=mi(_r(i,hi(i,o.line)));i.iter(f,u.line+1,function(e){if(e==s.maxLine){a=!0;return!0}})}!On(i.sel.head,t.from)&&!On(t.to,i.sel.head)&&(e.curOp.cursorActivity=!0);ri(i,t,n,r,k(e));if(!e.options.lineWrapping){i.iter(f,o.line+t.text.length,function(e){var t=D(i,e);if(t>s.maxLineLength){s.maxLine=e;s.maxLineLength=t;s.maxLineChanged=!0;a=!1}});a&&(e.curOp.updateMaxLine=!0)}i.frontier=Math.min(i.frontier,o.line);tt(e,400);var l=t.text.length-(u.line-o.line)-1;Pt(e,o.line,u.line+1,l);if(Vi(e,"change")){var c={from:o,to:u,text:t.text,removed:t.removed,origin:t.origin};if(e.curOp.textChanged){for(var h=e.curOp.textChanged;h.next;h=h.next);h.next=c}else e.curOp.textChanged=c}}function kn(e,t,n,r,i){r||(r=n);if(On(r,n)){var s=r;r=n;n=s}typeof t=="string"&&(t=Ss(t));En(e,{from:n,to:r,text:t,origin:i},null)}function Ln(e,t){if(!(this instanceof Ln))return new Ln(e,t);this.line=e;this.ch=t}function An(e,t){return e.line==t.line&&e.ch==t.ch}function On(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function Mn(e){return Ln(e.line,e.ch)}function _n(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Dn(e,t){if(t.line<e.first)return Ln(e.first,0);var n=e.first+e.size-1;return t.line>n?Ln(n,hi(e,n).text.length):Pn(t,hi(e,t.line).text.length)}function Pn(e,t){var n=e.ch;return n==null||n>t?Ln(e.line,t):n<0?Ln(e.line,0):e}function Hn(e,t){return t>=e.first&&t<e.first+e.size}function Bn(e,t,n,r){if(e.sel.shift||e.sel.extend){var i=e.sel.anchor;if(n){var s=On(t,i);if(s!=On(n,i)){i=t;t=n}else s!=On(t,n)&&(t=n)}Fn(e,i,t,r)}else Fn(e,t,n||t,r);e.cm&&(e.cm.curOp.userSelChange=!0)}function jn(e,t,n){var r={anchor:t,head:n};qi(e,"beforeSelectionChange",e,r);e.cm&&qi(e.cm,"beforeSelectionChange",e.cm,r);r.anchor=Dn(e,r.anchor);r.head=Dn(e,r.head);return r}function Fn(e,t,n,r,i){if(!i&&Vi(e,"beforeSelectionChange")||e.cm&&Vi(e.cm,"beforeSelectionChange")){var s=jn(e,t,n);n=s.head;t=s.anchor}var o=e.sel;o.goalColumn=null;r==null&&(r=On(n,o.head)?-1:1);if(i||!An(t,o.anchor))t=qn(e,t,r,i!="push");if(i||!An(n,o.head))n=qn(e,n,r,i!="push");if(An(o.anchor,t)&&An(o.head,n))return;o.anchor=t;o.head=n;var u=On(n,t);o.from=u?n:t;o.to=u?t:n;e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=e.cm.curOp.cursorActivity=!0);zi(e,"cursorActivity",e)}function In(e){Fn(e.doc,e.doc.sel.from,e.doc.sel.to,null,"push")}function qn(e,t,n,r){var i=!1,s=t,o=n||1;e.cantEdit=!1;e:for(;;){var u=hi(e,s.line);if(u.markedSpans)for(var a=0;a<u.markedSpans.length;++a){var f=u.markedSpans[a],l=f.marker;if((f.from==null||(l.inclusiveLeft?f.from<=s.ch:f.from<s.ch))&&(f.to==null||(l.inclusiveRight?f.to>=s.ch:f.to>s.ch))){if(r){qi(l,"beforeCursorEnter");if(l.explicitlyCleared){if(!u.markedSpans)break;--a;continue}}if(!l.atomic)continue;var c=l.find()[o<0?"from":"to"];if(An(c,s)){c.ch+=o;c.ch<0?c.line>e.first?c=Dn(e,Ln(c.line-1)):c=null:c.ch>u.text.length&&(c.line<e.first+e.size-1?c=Ln(c.line+1,0):c=null);if(!c){if(i){if(!r)return qn(e,t,n,!0);e.cantEdit=!0;return Ln(e.first,0)}i=!0;c=t;o=-o}}s=c;continue e}}return s}}function Rn(e){var t=Un(e,e.doc.sel.head,null,e.options.cursorScrollMargin);if(!e.state.focused)return;var n=e.display,r=vs(n.sizer),i=null;t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1);if(i!=null&&!p){var s=n.cursor.style.display=="none";if(s){n.cursor.style.display="";n.cursor.style.left=t.left+"px";n.cursor.style.top=t.top-n.viewOffset+"px"}n.cursor.scrollIntoView(i);s&&(n.cursor.style.display="none")}}function Un(e,t,n,r){r==null&&(r=0);for(;;){var i=!1,s=Et(e,t),o=!n||n==t?s:Et(e,n),u=Wn(e,Math.min(s.left,o.left),Math.min(s.top,o.top)-r,Math.max(s.left,o.left),Math.max(s.bottom,o.bottom)+r),a=e.doc.scrollTop,f=e.doc.scrollLeft;if(u.scrollTop!=null){Zt(e,u.scrollTop);Math.abs(e.doc.scrollTop-a)>1&&(i=!0)}if(u.scrollLeft!=null){en(e,u.scrollLeft);Math.abs(e.doc.scrollLeft-f)>1&&(i=!0)}if(!i)return s}}function zn(e,t,n,r,i){var s=Wn(e,t,n,r,i);s.scrollTop!=null&&Zt(e,s.scrollTop);s.scrollLeft!=null&&en(e,s.scrollLeft)}function Wn(e,t,n,r,i){var s=e.display,o=Ct(e.display);n<0&&(n=0);var u=s.scroller.clientHeight-Ji,a=s.scroller.scrollTop,f={},l=e.doc.height+ot(s),c=n<o,h=i>l-o;if(n<a)f.scrollTop=c?0:n;else if(i>a+u){var p=Math.min(n,(h?l:i)-u);p!=a&&(f.scrollTop=p)}var d=s.scroller.clientWidth-Ji,v=s.scroller.scrollLeft;t+=s.gutters.offsetWidth;r+=s.gutters.offsetWidth;var m=s.gutters.offsetWidth,g=t<m+10;if(t<v+m||g){g&&(t=0);f.scrollLeft=Math.max(0,t-10-m)}else r>d+v-3&&(f.scrollLeft=r+10-d);return f}function Xn(e,t,n){e.curOp.updateScrollPos={scrollLeft:t==null?e.doc.scrollLeft:t,scrollTop:n==null?e.doc.scrollTop:n}}function Vn(e,t,n){var r=e.curOp.updateScrollPos||(e.curOp.updateScrollPos={scrollLeft:e.doc.scrollLeft,scrollTop:e.doc.scrollTop}),i=e.display.scroller;r.scrollTop=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,r.scrollTop+n));r.scrollLeft=Math.max(0,Math.min(i.scrollWidth-i.clientWidth,r.scrollLeft+t))}function $n(e,t,n,r){var i=e.doc;n==null&&(n="add");if(n=="smart")if(!e.doc.mode.indent)n="prev";else var s=it(e,t);var o=e.options.tabSize,u=hi(i,t),a=Gi(u.text,null,o),f=u.text.match(/^\s*/)[0],l;if(n=="smart"){l=e.doc.mode.indent(s,u.text.slice(f.length),u.text);if(l==Ki){if(!r)return;n="prev"}}n=="prev"?t>i.first?l=Gi(hi(i,t-1).text,null,o):l=0:n=="add"?l=a+e.options.indentUnit:n=="subtract"?l=a-e.options.indentUnit:typeof n=="number"&&(l=a+n);l=Math.max(0,l);var c="",h=0;if(e.options.indentWithTabs)for(var p=Math.floor(l/o);p;--p){h+=o;c+=" "}h<l&&(c+=Zi(l-h));c!=f?kn(e.doc,c,Ln(t,0),Ln(t,f.length),"+input"):i.sel.head.line==t&&i.sel.head.ch<f.length&&Fn(i,Ln(t,f.length),Ln(t,f.length),1);u.stateAfter=null}function Jn(e,t,n){var r=t,i=t,s=e.doc;typeof t=="number"?i=hi(s,_n(s,t)):r=mi(t);if(r==null)return null;if(!n(i,r))return null;Pt(e,r,r+1);return i}function Kn(e,t,n,r,i){function l(){var t=s+n;if(t<e.first||t>=e.first+e.size)return f=!1;s=t;return a=hi(e,t)}function c(e){var t=(i?js:Fs)(a,o,n,!0);if(t==null){if(!!e||!l())return f=!1;i?o=(n<0?Os:As)(a):o=n<0?a.text.length:0}else o=t;return!0}var s=t.line,o=t.ch,u=n,a=hi(e,s),f=!0;if(r=="char")c();else if(r=="column")c(!0);else if(r=="word"||r=="group"){var h=null,p=r=="group";for(var d=!0;;d=!1){if(n<0&&!c(!d))break;var v=a.text.charAt(o)||"\n",m=as(v)?"w":p?/\s/.test(v)?null:"p":null;if(h&&h!=m){if(n<0){n=1;c()}break}m&&(h=m);if(n>0&&!c(!d))break}}var g=qn(e,Ln(s,o),u,!0);f||(g.hitSide=!0);return g}function Qn(e,t,n,r){var i=e.doc,s=t.left,o;if(r=="page"){var u=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);o=t.top+n*(u-(n<0?1.5:.5)*Ct(e.display))}else r=="line"&&(o=n>0?t.bottom+3:t.top-3);for(;;){var a=xt(e,s,o);if(!a.outside)break;if(n<0?o<=0:o>=i.height){a.hitSide=!0;break}o+=n*5}return a}function Gn(e,t){var n=t.ch,r=t.ch;if(e){(t.xRel<0||r==e.length)&&n?--n:++r;var i=e.charAt(n),s=as(i)?as:/\s/.test(i)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!as(e)};while(n>0&&s(e.charAt(n-1)))--n;while(r<e.length&&s(e.charAt(r)))++r}return{from:Ln(t.line,n),to:Ln(t.line,r)}}function Yn(e,t){Bn(e.doc,Ln(t,0),Dn(e.doc,Ln(t+1,0)))}function tr(e,t,n,r){x.defaults[e]=t;n&&(Zn[e]=r?function(e,t,r){r!=nr&&n(e,t,r)}:n)}function ar(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([]));n[r]=i}return n}function fr(e,t,n){return e.startState?e.startState(t,n):!0}function hr(e){return typeof e=="string"?cr[e]:e}function pr(e,t,n){function r(t){t=hr(t);var i=t[e];if(i===!1)return"stop";if(i!=null&&n(i))return!0;if(t.nofallthrough)return"stop";var s=t.fallthrough;if(s==null)return!1;if(Object.prototype.toString.call(s)!="[object Array]")return r(s);for(var o=0,u=s.length;o<u;++o){var a=r(s[o]);if(a)return a}return!1}for(var i=0;i<t.length;++i){var s=r(t[i]);if(s)return s!="stop"}}function dr(e){var t=Ns[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function vr(e,t){if(a&&e.keyCode==34&&e["char"])return!1;var n=Ns[e.keyCode];if(n==null||e.altGraphKey)return!1;e.altKey&&(n="Alt-"+n);if(b?e.metaKey:e.ctrlKey)n="Ctrl-"+n;if(b?e.ctrlKey:e.metaKey)n="Cmd-"+n;!t&&e.shiftKey&&(n="Shift-"+n);return n}function mr(e,t){this.pos=this.start=0;this.string=e;this.tabSize=t||8;this.lastColumnPos=this.lastColumnValue=0}function gr(e,t){this.lines=[];this.type=t;this.doc=e}function yr(e,t,n,r,i){if(r&&r.shared)return wr(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Mt(e.cm,yr)(e,t,n,r,i);var s=new gr(e,i);if(On(n,t)||An(t,n)&&i=="range"&&(!r.inclusiveLeft||!r.inclusiveRight))return s;r&&is(r,s);if(s.replacedWith){s.collapsed=!0;s.replacedWith=cs("span",[s.replacedWith],"CodeMirror-widget");r.handleMouseEvents||(s.replacedWith.ignoreEvents=!0)}s.collapsed&&(S=!0);s.addToHistory&&xi(e,{from:t,to:n,origin:"markText"},{head:e.sel.head,anchor:e.sel.anchor},NaN);var o=t.line,u=0,a,f,l=e.cm,c;e.iter(o,n.line+1,function(r){l&&s.collapsed&&!l.options.lineWrapping&&_r(e,r)==l.display.maxLine&&(c=!0);var i={from:null,to:null,marker:s};u+=r.text.length;if(o==t.line){i.from=t.ch;u-=t.ch}if(o==n.line){i.to=n.ch;u-=r.text.length-n.ch}if(s.collapsed){o==n.line&&(f=Ar(r,n.ch));o==t.line?a=Ar(r,t.ch):vi(r,0)}xr(r,i);++o});s.collapsed&&e.iter(t.line,n.line+1,function(t){Dr(e,t)&&vi(t,0)});s.clearOnEnter&&Fi(s,"beforeCursorEnter",function(){s.clear()});if(s.readOnly){E=!0;(e.history.done.length||e.history.undone.length)&&e.clearHistory()}if(s.collapsed){if(a!=f)throw new Error("Inserting collapsed marker overlapping an existing one");s.size=u;s.atomic=!0}if(l){c&&(l.curOp.updateMaxLine=!0);(s.className||s.title||s.startStyle||s.endStyle||s.collapsed)&&Pt(l,t.line,n.line+1);s.atomic&&In(l)}return s}function br(e,t){this.markers=e;this.primary=t;for(var n=0,r=this;n<e.length;++n){e[n].parent=this;Fi(e[n],"clear",function(){r.clear()})}}function wr(e,t,n,r,i){r=is(r);r.shared=!1;var s=[yr(e,t,n,r,i)],o=s[0],u=r.replacedWith;li(e,function(e){u&&(r.replacedWith=u.cloneNode(!0));s.push(yr(e,Dn(e,t),Dn(e,n),r,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;o=es(s)});return new br(s,o)}function Er(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Sr(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function xr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t];t.marker.attachLine(e)}function Tr(e,t,n){if(e)for(var r=0,i;r<e.length;++r){var s=e[r],o=s.marker,u=s.from==null||(o.inclusiveLeft?s.from<=t:s.from<t);if(u||(o.inclusiveLeft&&o.inclusiveRight||o.type=="bookmark")&&s.from==t&&(!n||!s.marker.insertLeft)){var a=s.to==null||(o.inclusiveRight?s.to>=t:s.to>t);(i||(i=[])).push({from:s.from,to:a?null:s.to,marker:o})}}return i}function Nr(e,t,n){if(e)for(var r=0,i;r<e.length;++r){var s=e[r],o=s.marker,u=s.to==null||(o.inclusiveRight?s.to>=t:s.to>t);if(u||o.type=="bookmark"&&s.from==t&&(!n||s.marker.insertLeft)){var a=s.from==null||(o.inclusiveLeft?s.from<=t:s.from<t);(i||(i=[])).push({from:a?null:s.from-t,to:s.to==null?null:s.to-t,marker:o})}}return i}function Cr(e,t){var n=Hn(e,t.from.line)&&hi(e,t.from.line).markedSpans,r=Hn(e,t.to.line)&&hi(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,s=t.to.ch,o=An(t.from,t.to),u=Tr(n,i,o),a=Nr(r,s,o),f=t.text.length==1,l=es(t.text).length+(f?i:0);if(u)for(var c=0;c<u.length;++c){var h=u[c];if(h.to==null){var p=Er(a,h.marker);p?f&&(h.to=p.to==null?null:p.to+l):h.to=i}}if(a)for(var c=0;c<a.length;++c){var h=a[c];h.to!=null&&(h.to+=l);if(h.from==null){var p=Er(u,h.marker);if(!p){h.from=l;f&&(u||(u=[])).push(h)}}else{h.from+=l;f&&(u||(u=[])).push(h)}}if(f&&u){for(var c=0;c<u.length;++c)u[c].from!=null&&u[c].from==u[c].to&&u[c].marker.type!="bookmark"&&u.splice(c--,1);u.length||(u=null)}var d=[u];if(!f){var v=t.text.length-2,m;if(v>0&&u)for(var c=0;c<u.length;++c)u[c].to==null&&(m||(m=[])).push({from:null,to:null,marker:u[c].marker});for(var c=0;c<v;++c)d.push(m);d.push(a)}return d}function kr(e,t){var n=Ni(e,t),r=Cr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var s=n[i],o=r[i];if(s&&o)e:for(var u=0;u<o.length;++u){var a=o[u];for(var f=0;f<s.length;++f)if(s[f].marker==a.marker)continue e;s.push(a)}else o&&(n[i]=o)}return n}function Lr(e,t,n){var r=null;e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;n.readOnly&&(!r||ns(r,n)==-1)&&(r||(r=[])).push(n)}});if(!r)return null;var i=[{from:t,to:n}];for(var s=0;s<r.length;++s){var o=r[s],u=o.find();for(var a=0;a<i.length;++a){var f=i[a];if(On(f.to,u.from)||On(u.to,f.from))continue;var l=[a,1];(On(f.from,u.from)||!o.inclusiveLeft&&An(f.from,u.from))&&l.push({from:f.from,to:u.from});(On(u.to,f.to)||!o.inclusiveRight&&An(f.to,u.to))&&l.push({from:u.to,to:f.to});i.splice.apply(i,l);a+=l.length-1}}return i}function Ar(e,t){var n=S&&e.markedSpans,r;if(n)for(var i,s=0;s<n.length;++s){i=n[s];if(!i.marker.collapsed)continue;(i.from==null||i.from<t)&&(i.to==null||i.to>t)&&(!r||r.width<i.marker.width)&&(r=i.marker)}return r}function Or(e){return Ar(e,-1)}function Mr(e){return Ar(e,e.text.length+1)}function _r(e,t){var n;while(n=Or(t))t=hi(e,n.find().from.line);return t}function Dr(e,t){var n=S&&t.markedSpans;if(n)for(var r,i=0;i<n.length;++i){r=n[i];if(!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.replacedWith)continue;if(r.from==0&&r.marker.inclusiveLeft&&Pr(e,t,r))return!0}}function Pr(e,t,n){if(n.to==null){var r=n.marker.find().to,i=hi(e,r.line);return Pr(e,i,Er(i.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var s,o=0;o<t.markedSpans.length;++o){s=t.markedSpans[o];if(s.marker.collapsed&&!s.marker.replacedWith&&s.from==n.to&&(s.marker.inclusiveLeft||n.marker.inclusiveRight)&&Pr(e,t,s))return!0}}function Hr(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function Br(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function Fr(e){return function(){var t=!this.cm.curOp;t&&At(this.cm);try{var n=e.apply(this,arguments)}finally{t&&Ot(this.cm)}return n}}function Ir(e){if(e.height!=null)return e.height;(!e.node.parentNode||e.node.parentNode.nodeType!=1)&&ps(e.cm.display.measure,cs("div",[e.node],null,"position: relative"));return e.height=e.node.offsetHeight}function qr(e,t,n,r){var i=new jr(e,n,r);i.noHScroll&&(e.display.alignWidgets=!0);Jn(e,t,function(t){var n=t.widgets||(t.widgets=[]);i.insertAt==null?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i);i.line=t;if(!Dr(e.doc,t)||i.showIfHidden){var r=yi(e,t)<e.doc.scrollTop;vi(t,t.height+Ir(i));r&&Vn(e,0,i.height)}return!0});return i}function Ur(e,t,n,r){e.text=t;e.stateAfter&&(e.stateAfter=null);e.styles&&(e.styles=null);e.order!=null&&(e.order=null);Hr(e);Br(e,n);var i=r?r(e):1;i!=e.height&&vi(e,i)}function zr(e){e.parent=null;Hr(e)}function Wr(e,t,n,r,i,s){var o=n.flattenSpans;o==null&&(o=e.options.flattenSpans);var u=0,a=null,f=new mr(t,e.options.tabSize),l;t==""&&n.blankLine&&n.blankLine(r);while(!f.eol()){if(f.pos>e.options.maxHighlightLength){o=!1;s&&$r(e,t,r,f.pos);f.pos=t.length;l=null}else l=n.token(f,r);if(!o||a!=l){u<f.start&&i(f.start,a);u=f.start;a=l}f.start=f.pos}while(u<f.pos){var c=Math.min(f.pos,u+5e4);i(c,a);u=c}}function Xr(e,t,n,r){var i=[e.state.modeGen];Wr(e,t.text,e.doc.mode,n,function(e,t){i.push(e,t)},r);for(var s=0;s<e.state.overlays.length;++s){var o=e.state.overlays[s],u=1,a=0;Wr(e,t.text,o.mode,!0,function(e,t){var n=u;while(a<e){var r=i[u];r>e&&i.splice(u,1,e,i[u+1],r);u+=2;a=Math.min(e,r)}if(!t)return;if(o.opaque){i.splice(n,u-n,e,t);u=n+2}else for(;n<u;n+=2){var s=i[n+1];i[n+1]=s?s+" "+t:t}})}return i}function Vr(e,t){if(!t.styles||t.styles[0]!=e.state.modeGen)t.styles=Xr(e,t,t.stateAfter=it(e,mi(t)));return t.styles}function $r(e,t,n,r){var i=e.doc.mode,s=new mr(t,e.options.tabSize);s.start=s.pos=r||0;t==""&&i.blankLine&&i.blankLine(n);while(!s.eol()&&s.pos<=e.options.maxHighlightLength){i.token(s,n);s.start=s.pos}}function Kr(e,t){if(!e)return null;for(;;){var n=e.match(/(?:^|\s)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:(new RegExp("(?:^|s)"+n[2]+"(?:$|s)")).test(t[r])||(t[r]+=" "+n[2])}return Jr[e]||(Jr[e]="cm-"+e.replace(/ +/g," cm-"))}function Qr(e,n,r,o){var u,a=n,f=!0;while(u=Or(a))a=hi(e.doc,u.find().from.line);var l={pre:cs("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:e,copyWidgets:o};do{a.text&&(f=!1);l.measure=a==n&&r;l.pos=0;l.addToken=l.measure?Zr:Yr;(t||s)&&e.getOption("lineWrapping")&&(l.addToken=ei(l.addToken));var c=ni(a,l,Vr(e,a));if(r&&a==n&&!l.measuredSomething){r
6
+ [0]=l.pre.appendChild(Es(e.display.measure));l.measuredSomething=!0}c&&(a=hi(e.doc,c.to.line))}while(c);r&&!l.measuredSomething&&!r[0]&&(r[0]=l.pre.appendChild(f?cs("span"," "):Es(e.display.measure)));!l.pre.firstChild&&!Dr(e.doc,n)&&l.pre.appendChild(document.createTextNode(" "));var h;if(r&&(t||i)&&(h=bi(a))){var p=h.length-1;h[p].from==h[p].to&&--p;var d=h[p],v=h[p-1];if(d.from+1==d.to&&v&&d.level<v.level){var m=r[l.pos-1];m&&m.parentNode.insertBefore(m.measureRight=Es(e.display.measure),m.nextSibling)}}var g=l.textClass?l.textClass+" "+(n.textClass||""):n.textClass;g&&(l.pre.className=g);qi(e,"renderLine",e,n,l.pre);return l}function Gr(e){var t=cs("span","•","cm-invalidchar");t.title="\\u"+e.charCodeAt(0).toString(16);return t}function Yr(e,t,n,r,i,s){if(!t)return;var o=e.cm.options.specialChars;if(!o.test(t)){e.col+=t.length;var u=document.createTextNode(t)}else{var u=document.createDocumentFragment(),a=0;for(;;){o.lastIndex=a;var f=o.exec(t),l=f?f.index-a:t.length-a;if(l){u.appendChild(document.createTextNode(t.slice(a,a+l)));e.col+=l}if(!f)break;a+=l+1;if(f[0]==" "){var c=e.cm.options.tabSize,h=c-e.col%c;u.appendChild(cs("span",Zi(h),"cm-tab"));e.col+=h}else{var p=e.cm.options.specialCharPlaceholder(f[0]);u.appendChild(p);e.col+=1}}}if(n||r||i||e.measure){var d=n||"";r&&(d+=r);i&&(d+=i);var p=cs("span",[u],d);s&&(p.title=s);return e.pre.appendChild(p)}e.pre.appendChild(u)}function Zr(e,n,r,i,s){var o=e.cm.options.lineWrapping;for(var u=0;u<n.length;++u){var a=n.charAt(u),f=u==0;if(a>="���"&&a<"���"&&u<n.length-1){a=n.slice(u,u+2);++u}else u&&o&&gs(n,u)&&e.pre.appendChild(cs("wbr"));var l=e.measure[e.pos],c=e.measure[e.pos]=Yr(e,a,r,f&&i,u==n.length-1&&s);l&&(c.leftSide=l.leftSide||l);t&&o&&a==" "&&u&&!/\s/.test(n.charAt(u-1))&&u<n.length-1&&!/\s/.test(n.charAt(u+1))&&(c.style.whiteSpace="normal");e.pos+=a.length}n.length&&(e.measuredSomething=!0)}function ei(e){function t(e){var t=" ";for(var n=0;n<e.length-2;++n)t+=n%2?" ":" ";t+=" ";return t}return function(n,r,i,s,o,u){return e(n,r.replace(/ {3,}/g,t),i,s,o,u)}}function ti(e,t,n,r){var i=!r&&n.replacedWith;if(i){e.copyWidgets&&(i=i.cloneNode(!0));e.pre.appendChild(i);if(e.measure){if(t)e.measure[e.pos]=i;else{var s=Es(e.cm.display.measure);if(n.type=="bookmark"&&!n.insertLeft)e.measure[e.pos]=e.pre.appendChild(s);else{if(e.measure[e.pos])return;e.measure[e.pos]=e.pre.insertBefore(s,i)}}e.measuredSomething=!0}}e.pos+=t}function ni(e,t,n){var r=e.markedSpans,i=e.text,s=0;if(!r){for(var o=1;o<n.length;o+=2)t.addToken(t,i.slice(s,s=n[o]),Kr(n[o+1],t));return}var u=i.length,a=0,o=1,f="",l,c=0,h,p,d,v,m;for(;;){if(c==a){h=p=d=v="";m=null;c=Infinity;var g=[];for(var y=0;y<r.length;++y){var b=r[y],w=b.marker;if(b.from<=a&&(b.to==null||b.to>a)){if(b.to!=null&&c>b.to){c=b.to;p=""}w.className&&(h+=" "+w.className);w.startStyle&&b.from==a&&(d+=" "+w.startStyle);w.endStyle&&b.to==c&&(p+=" "+w.endStyle);w.title&&!v&&(v=w.title);w.collapsed&&(!m||m.marker.size<w.size)&&(m=b)}else b.from>a&&c>b.from&&(c=b.from);w.type=="bookmark"&&b.from==a&&w.replacedWith&&g.push(w)}if(m&&(m.from||0)==a){ti(t,(m.to==null?u:m.to)-a,m.marker,m.from==null);if(m.to==null)return m.marker.find()}if(!m&&g.length)for(var y=0;y<g.length;++y)ti(t,0,g[y])}if(a>=u)break;var E=Math.min(u,c);for(;;){if(f){var S=a+f.length;if(!m){var x=S>E?f.slice(0,E-a):f;t.addToken(t,x,l?l+h:h,d,a+x.length==c?p:"",v)}if(S>=E){f=f.slice(E-a);a=E;break}a=S;d=""}f=i.slice(s,s=n[o++]);l=Kr(n[o++],t)}}}function ri(e,t,n,r,i){function s(e){return n?n[e]:null}function o(e,n,r){Ur(e,n,r,i);zi(e,"change",e,t)}var u=t.from,a=t.to,f=t.text,l=hi(e,u.line),c=hi(e,a.line),h=es(f),p=s(f.length-1),d=a.line-u.line;if(u.ch==0&&a.ch==0&&h==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)){for(var v=0,m=f.length-1,g=[];v<m;++v)g.push(new Rr(f[v],s(v),i));o(c,c.text,p);d&&e.remove(u.line,d);g.length&&e.insert(u.line,g)}else if(l==c)if(f.length==1)o(l,l.text.slice(0,u.ch)+h+l.text.slice(a.ch),p);else{for(var g=[],v=1,m=f.length-1;v<m;++v)g.push(new Rr(f[v],s(v),i));g.push(new Rr(h+l.text.slice(a.ch),p,i));o(l,l.text.slice(0,u.ch)+f[0],s(0));e.insert(u.line+1,g)}else if(f.length==1){o(l,l.text.slice(0,u.ch)+f[0]+c.text.slice(a.ch),s(0));e.remove(u.line+1,d)}else{o(l,l.text.slice(0,u.ch)+f[0],s(0));o(c,h+c.text.slice(a.ch),p);for(var v=1,m=f.length-1,g=[];v<m;++v)g.push(new Rr(f[v],s(v),i));d>1&&e.remove(u.line+1,d-1);e.insert(u.line+1,g)}zi(e,"change",e,t);Fn(e,r.anchor,r.head,null,!0)}function ii(e){this.lines=e;this.parent=null;for(var t=0,n=e.length,r=0;t<n;++t){e[t].parent=this;r+=e[t].height}this.height=r}function si(e){this.children=e;var t=0,n=0;for(var r=0,i=e.length;r<i;++r){var s=e[r];t+=s.chunkSize();n+=s.height;s.parent=this}this.size=t;this.height=n;this.parent=null}function li(e,t,n){function r(e,i,s){if(e.linked)for(var o=0;o<e.linked.length;++o){var u=e.linked[o];if(u.doc==i)continue;var a=s&&u.sharedHist;if(n&&!a)continue;t(u.doc,a);r(u.doc,e,a)}}r(e,null,!0)}function ci(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t;t.cm=e;L(e);N(e);e.options.lineWrapping||P(e);e.options.mode=t.modeOption;Pt(e)}function hi(e,t){t-=e.first;while(!e.lines)for(var n=0;;++n){var r=e.children[n],i=r.chunkSize();if(t<i){e=r;break}t-=i}return e.lines[t]}function pi(e,t,n){var r=[],i=t.line;e.iter(t.line,n.line+1,function(e){var s=e.text;i==n.line&&(s=s.slice(0,n.ch));i==t.line&&(s=s.slice(t.ch));r.push(s);++i});return r}function di(e,t,n){var r=[];e.iter(t,n,function(e){r.push(e.text)});return r}function vi(e,t){var n=t-e.height;for(var r=e;r;r=r.parent)r.height+=n}function mi(e){if(e.parent==null)return null;var t=e.parent,n=ns(t.lines,e);for(var r=t.parent;r;t=r,r=r.parent)for(var i=0;;++i){if(r.children[i]==t)break;n+=r.children[i].chunkSize()}return n+t.first}function gi(e,t){var n=e.first;e:do{for(var r=0,i=e.children.length;r<i;++r){var s=e.children[r],o=s.height;if(t<o){e=s;continue e}t-=o;n+=s.chunkSize()}return n}while(!e.lines);for(var r=0,i=e.lines.length;r<i;++r){var u=e.lines[r],a=u.height;if(t<a)break;t-=a}return n+r}function yi(e,t){t=_r(e.doc,t);var n=0,r=t.parent;for(var i=0;i<r.lines.length;++i){var s=r.lines[i];if(s==t)break;n+=s.height}for(var o=r.parent;o;r=o,o=r.parent)for(var i=0;i<o.children.length;++i){var u=o.children[i];if(u==r)break;n+=u.height}return n}function bi(e){var t=e.order;t==null&&(t=e.order=Is(e.text));return t}function wi(e){return{done:[],undone:[],undoDepth:Infinity,lastTime:0,lastOp:null,lastOrigin:null,generation:e||1,maxGeneration:e||1}}function Ei(e,t,n,r){var i=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[s]=n.markedSpans);++s})}function Si(e,t){var n={line:t.from.line,ch:t.from.ch},r={from:n,to:gn(t),text:pi(e,t.from,t.to)};Ei(e,r,t.from.line,t.to.line+1);li(e,function(e){Ei(e,r,t.from.line,t.to.line+1)},!0);return r}function xi(e,t,n,r){var i=e.history;i.undone.length=0;var s=+(new Date),o=es(i.done);if(o&&(i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&e.cm&&i.lastTime>s-e.cm.options.historyEventDelay||t.origin.charAt(0)=="*"))){var u=es(o.changes);An(t.from,t.to)&&An(t.from,u.to)?u.to=gn(t):o.changes.push(Si(e,t));o.anchorAfter=n.anchor;o.headAfter=n.head}else{o={changes:[Si(e,t)],generation:i.generation,anchorBefore:e.sel.anchor,headBefore:e.sel.head,anchorAfter:n.anchor,headAfter:n.head};i.done.push(o);i.generation=++i.maxGeneration;while(i.done.length>i.undoDepth)i.done.shift()}i.lastTime=s;i.lastOp=r;i.lastOrigin=t.origin}function Ti(e){if(!e)return null;for(var t=0,n;t<e.length;++t)e[t].marker.explicitlyCleared?n||(n=e.slice(0,t)):n&&n.push(e[t]);return n?n.length?n:null:e}function Ni(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=0,i=[];r<t.text.length;++r)i.push(Ti(n[r]));return i}function Ci(e,t){for(var n=0,r=[];n<e.length;++n){var i=e[n],s=i.changes,o=[];r.push({changes:o,anchorBefore:i.anchorBefore,headBefore:i.headBefore,anchorAfter:i.anchorAfter,headAfter:i.headAfter});for(var u=0;u<s.length;++u){var a=s[u],f;o.push({from:a.from,to:a.to,text:a.text});if(t)for(var l in a)if(f=l.match(/^spans_(\d+)$/))if(ns(t,Number(f[1]))>-1){es(o)[l]=a[l];delete a[l]}}}return r}function ki(e,t,n,r){if(n<e.line)e.line+=r;else if(t<e.line){e.line=t;e.ch=0}}function Li(e,t,n,r){for(var i=0;i<e.length;++i){var s=e[i],o=!0;for(var u=0;u<s.changes.length;++u){var a=s.changes[u];if(!s.copied){a.from=Mn(a.from);a.to=Mn(a.to)}if(n<a.from.line){a.from.line+=r;a.to.line+=r}else if(t<=a.to.line){o=!1;break}}if(!s.copied){s.anchorBefore=Mn(s.anchorBefore);s.headBefore=Mn(s.headBefore);s.anchorAfter=Mn(s.anchorAfter);s.readAfter=Mn(s.headAfter);s.copied=!0}if(!o){e.splice(0,i+1);i=0}else{ki(s.anchorBefore);ki(s.headBefore);ki(s.anchorAfter);ki(s.headAfter)}}}function Ai(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Li(e.done,n,r,i);Li(e.undone,n,r,i)}function Oi(){Hi(this)}function Mi(e){e.stop||(e.stop=Oi);return e}function _i(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Di(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Pi(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==0}function Hi(e){_i(e);Di(e)}function Bi(e){return e.target||e.srcElement}function ji(e){var t=e.which;t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2));m&&e.ctrlKey&&t==1&&(t=3);return t}function Fi(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={}),i=r[t]||(r[t]=[]);i.push(n)}}function Ii(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers&&e._handlers[t];if(!r)return;for(var i=0;i<r.length;++i)if(r[i]==n){r.splice(i,1);break}}}function qi(e,t){var n=e._handlers&&e._handlers[t];if(!n)return;var r=Array.prototype.slice.call(arguments,2);for(var i=0;i<n.length;++i)n[i].apply(null,r)}function zi(e,t){function i(e){return function(){e.apply(null,r)}}var n=e._handlers&&e._handlers[t];if(!n)return;var r=Array.prototype.slice.call(arguments,2);if(!Ri){++Ui;Ri=[];setTimeout(Xi,0)}for(var s=0;s<n.length;++s)Ri.push(i(n[s]))}function Wi(e,t,n){qi(e,n||t.type,e,t);return Pi(t)||t.codemirrorIgnore}function Xi(){--Ui;var e=Ri;Ri=null;for(var t=0;t<e.length;++t)e[t]()}function Vi(e,t){var n=e._handlers&&e._handlers[t];return n&&n.length>0}function $i(e){e.prototype.on=function(e,t){Fi(this,e,t)};e.prototype.off=function(e,t){Ii(this,e,t)}}function Qi(){this.id=null}function Gi(e,t,n,r,i){if(t==null){t=e.search(/[^\s\u00a0]/);t==-1&&(t=e.length)}for(var s=r||0,o=i||0;s<t;++s)e.charAt(s)==" "?o+=n-o%n:++o;return o}function Zi(e){while(Yi.length<=e)Yi.push(es(Yi)+" ");return Yi[e]}function es(e){return e[e.length-1]}function ts(e){if(d){e.selectionStart=0;e.selectionEnd=e.value.length}else try{e.select()}catch(t){}}function ns(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;++n)if(e[n]==t)return n;return-1}function rs(e,t){function n(){}n.prototype=e;var r=new n;t&&is(t,r);return r}function is(e,t){t||(t={});for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function ss(e){for(var t=[],n=0;n<e;++n)t.push(undefined);return t}function os(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function as(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||us.test(e))}function fs(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function cs(e,t,n,r){var i=document.createElement(e);n&&(i.className=n);r&&(i.style.cssText=r);if(typeof t=="string")ds(i,t);else if(t)for(var s=0;s<t.length;++s)i.appendChild(t[s]);return i}function hs(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function ps(e,t){return hs(e).appendChild(t)}function ds(e,t){if(r){e.innerHTML="";e.appendChild(document.createTextNode(t))}else e.textContent=t}function vs(e){return e.getBoundingClientRect()}function gs(){return!1}function bs(e){if(ys!=null)return ys;var t=cs("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");ps(e,t);t.offsetWidth&&(ys=t.offsetHeight-t.clientHeight);return ys||0}function Es(e){if(ws==null){var t=cs("span","​");ps(e,cs("span",[t,document.createTextNode("x")]));e.firstChild.offsetHeight!=0&&(ws=t.offsetWidth<=1&&t.offsetHeight>2&&!n)}return ws?cs("span","​"):cs("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function Cs(e,t,n,r){if(!e)return r(t,n,"ltr");var i=!1;for(var s=0;s<e.length;++s){var o=e[s];if(o.from<n&&o.to>t||t==n&&o.to==t){r(Math.max(o.from,t),Math.min(o.to,n),o.level==1?"rtl":"ltr");i=!0}}i||r(t,n,"ltr")}function ks(e){return e.level%2?e.to:e.from}function Ls(e){return e.level%2?e.from:e.to}function As(e){var t=bi(e);return t?ks(t[0]):0}function Os(e){var t=bi(e);return t?Ls(es(t)):e.text.length}function Ms(e,t){var n=hi(e.doc,t),r=_r(e.doc,n);r!=n&&(t=mi(r));var i=bi(r),s=i?i[0].level%2?Os(r):As(r):0;return Ln(t,s)}function _s(e,t){var n,r;while(n=Mr(r=hi(e.doc,t)))t=n.find().to.line;var i=bi(r),s=i?i[0].level%2?As(r):Os(r):r.text.length;return Ln(t,s)}function Ds(e,t,n){var r=e[0].level;return t==r?!0:n==r?!1:t<n}function Hs(e,t){for(var n=0,r;n<e.length;++n){var i=e[n];if(i.from<t&&i.to>t){Ps=null;return n}if(i.from==t||i.to==t){if(r!=null){if(Ds(e,i.level,e[r].level)){Ps=r;return n}Ps=n;return r}r=n}}Ps=null;return r}function Bs(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&ls.test(e.text.charAt(t)));return t}function js(e,t,n,r){var i=bi(e);if(!i)return Fs(e,t,n,r);var s=Hs(i,t),o=i[s],u=Bs(e,t,o.level%2?-n:n,r);for(;;){if(u>o.from&&u<o.to)return u;if(u==o.from||u==o.to){if(Hs(i,u)==s)return u;o=i[s+=n];return n>0==o.level%2?o.to:o.from}o=i[s+=n];if(!o)return null;n>0==o.level%2?u=Bs(e,o.to,-1,r):u=Bs(e,o.from,1,r)}}function Fs(e,t,n,r){var i=t+n;if(r)while(i>0&&ls.test(e.text.charAt(i)))i+=n;return i<0||i>e.text.length?null:i}var e=/gecko\/\d/i.test(navigator.userAgent),t=/MSIE \d/.test(navigator.userAgent),n=t&&(document.documentMode==null||document.documentMode<8),r=t&&(document.documentMode==null||document.documentMode<9),i=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),s=/WebKit\//.test(navigator.userAgent),o=s&&/Qt\/\d+\.\d+/.test(navigator.userAgent),u=/Chrome\//.test(navigator.userAgent),a=/Opera\//.test(navigator.userAgent),f=/Apple Computer/.test(navigator.vendor),l=/KHTML\//.test(navigator.userAgent),c=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),p=/PhantomJS/.test(navigator.userAgent),d=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),v=d||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),m=d||/Mac/.test(navigator.platform),g=/win/i.test(navigator.platform),y=a&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);y&&(y=Number(y[1]));if(y&&y>=15){a=!1;s=!0}var b=m&&(o||a&&(y==null||y<12.11)),w=e||t&&!r,E=!1,S=!1,Nt,Lt=0,Wt,Xt,Qt=0,tn=0,nn=null;t?nn=-0.53:e?nn=15:u?nn=-0.7:f&&(nn=-1/3);var un,ln=null,vn,gn=x.changeEnd=function(e){return e.text?Ln(e.from.line+e.text.length-1,es(e.text).length+(e.text.length==1?e.from.ch:0)):e.to};x.Pos=Ln;x.prototype={constructor:x,focus:function(){window.focus();It(this);Bt(this)},setOption:function(e,t){var n=this.options,r=n[e];if(n[e]==t&&e!="mode")return;n[e]=t;Zn.hasOwnProperty(e)&&Mt(this,Zn[e])(this,t,r)},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](e)},removeKeyMap:function(e){var t=this.state.keyMaps;for(var n=0;n<t.length;++n)if(t[n]==e||typeof t[n]!="string"&&t[n].name==e){t.splice(n,1);return!0}},addOverlay:Mt(null,function(e,t){var n=e.token?e:x.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:e,opaque:t&&t.opaque});this.state.modeGen++;Pt(this)}),removeOverlay:Mt(null,function(e){var t=this.state.overlays;for(var n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||typeof e=="string"&&r.name==e){t.splice(n,1);this.state.modeGen++;Pt(this);return}}}),indentLine:Mt(null,function(e,t,n){typeof t!="string"&&typeof t!="number"&&(t==null?t=this.options.smartIndent?"smart":"prev":t=t?"add":"subtract");Hn(this.doc,e)&&$n(this,e,t,n)}),indentSelection:Mt(null,function(e){var t=this.doc.sel;if(An(t.from,t.to))return $n(this,t.from.line,e);var n=t.to.line-(t.to.ch?0:1);for(var r=t.from.line;r<=n;++r)$n(this,r,e)}),getTokenAt:function(e,t){var n=this.doc;e=Dn(n,e);var r=it(this,e.line,t),i=this.doc.mode,s=hi(n,e.line),o=new mr(s.text,this.options.tabSize);while(o.pos<e.ch&&!o.eol()){o.start=o.pos;var u=i.token(o,r)}return{start:o.start,end:o.pos,string:o.current(),className:u||null,type:u||null,state:r}},getTokenTypeAt:function(e){e=Dn(this.doc,e);var t=Vr(this,hi(this.doc,e.line)),n=0,r=(t.length-1)/2,i=e.ch;if(i==0)return t[2];for(;;){var s=n+r>>1;if((s?t[s*2-1]:0)>=i)r=s;else{if(!(t[s*2+1]<i))return t[s*2+2];n=s+1}}},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?x.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){if(!ur.hasOwnProperty(t))return;var n=ur[t],r=this.getModeAt(e);return r[t]&&n[r[t]]||r.helperType&&n[r.helperType]||n[r.name]},getStateAfter:function(e,t){var n=this.doc;e=_n(n,e==null?n.first+n.size-1:e);return it(this,e+1,t)},cursorCoords:function(e,t){var n,r=this.doc.sel;e==null?n=r.head:typeof e=="object"?n=Dn(this.doc,e):n=e?r.from:r.to;return Et(this,n,t||"page")},charCoords:function(e,t){return wt(this,Dn(this.doc,e),t||"page")},coordsChar:function(e,t){e=bt(this,e,t||"page");return xt(this,e.left,e.top)},lineAtHeight:function(e,t){e=bt(this,{top:e,left:0},t||"page").top;return gi(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var n=!1,r=this.doc.first+this.doc.size-1;if(e<this.doc.first)e=this.doc.first;else if(e>r){e=r;n=!0}var i=hi(this.doc,e);return yt(this,hi(this.doc,e),{top:0,left:0},t||"page").top+(n?i.height:0)},defaultTextHeight:function(){return Ct(this.display)},defaultCharWidth:function(){return kt(this.display)},setGutterMarker:Mt(null,function(e,t,n){return Jn(this,e,function(e){var r=e.gutterMarkers||(e.gutterMarkers={});r[t]=n;!n&&fs(r)&&(e.gutterMarkers=null);return!0})}),clearGutter:Mt(null,function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){if(n.gutterMarkers&&n.gutterMarkers[e]){n.gutterMarkers[e]=null;Pt(t,r,r+1);fs(n.gutterMarkers)&&(n.gutterMarkers=null)}++r})}),addLineClass:Mt(null,function(e,t,n){return Jn(this,e,function(e){var r=t=="text"?"textClass":t=="background"?"bgClass":"wrapClass";if(!e[r])e[r]=n;else{if((new RegExp("(?:^|\\s)"+n+"(?:$|\\s)")).test(e[r]))return!1;e[r]+=" "+n}return!0})}),removeLineClass:Mt(null,function(e,t,n){return Jn(this,e,function(e){var r=t=="text"?"textClass":t=="background"?"bgClass":"wrapClass",i=e[r];if(!i)return!1;if(n==null)e[r]=null;else{var s=i.match(new RegExp("(?:^|\\s+)"+n+"(?:$|\\s+)"));if(!s)return!1;var o=s.index+s[0].length;e[r]=i.slice(0,s.index)+(!s.index||o==i.length?"":" ")+i.slice(o)||null}return!0})}),addLineWidget:Mt(null,function(e,t,n){return qr(this,e,t,n)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if(typeof e=="number"){if(!Hn(this.doc,e))return null;var t=e;e=hi(this.doc,e);if(!e)return null}else{var t=mi(e);if(t==null)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(e,t,n,r,i){var s=this.display;e=Et(this,Dn(this.doc,e));var o=e.bottom,u=e.left;t.style.position="absolute";s.sizer.appendChild(t);if(r=="over")o=e.top;else if(r=="above"||r=="near"){var a=Math.max(s.wrapper.clientHeight,this.doc.height),f=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(r=="above"||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?o=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(o=e.bottom);u+t.offsetWidth>f&&(u=f-t.offsetWidth)}t.style.top=o+"px";t.style.left=t.style.right="";if(i=="right"){u=s.sizer.clientWidth-t.offsetWidth;t.style.right="0px"}else{i=="left"?u=0:i=="middle"&&(u=(s.sizer.clientWidth-t.offsetWidth)/2);t.style.left=u+"px"}n&&zn(this,u,o,u+t.offsetWidth,o+t.offsetHeight)},triggerOnKeyDown:Mt(null,cn),execCommand:function(e){return lr[e](this)},findPosH:function(e,t,n,r){var i=1;if(t<0){i=-1;t=-t}for(var s=0,o=Dn(this.doc,e);s<t;++s){o=Kn(this.doc,o,i,n,r);if(o.hitSide)break}return o},moveH:Mt(null,function(e,t){var n=this.doc.sel,r;n.shift||n.extend||An(n.from,n.to)?r=Kn(this.doc,n.head,e,t,this.options.rtlMoveVisually):r=e<0?n.from:n.to;Bn(this.doc,r,r,e)}),deleteH:Mt(null,function(e,t){var n=this.doc.sel;An(n.from,n.to)?kn(this.doc,"",n.from,Kn(this.doc,n.head,e,t,!1),"+delete"):kn(this.doc,"",n.from,n.to,"+delete");this.curOp.userSelChange=!0}),findPosV:function(e,t,n,r){var i=1,s=r;if(t<0){i=-1;t=-t}for(var o=0,u=Dn(this.doc,e);o<t;++o){var a=Et(this,u,"div");s==null?s=a.left:a.left=s;u=Qn(this,a,i,n);if(u.hitSide)break}return u},moveV:Mt(null,function(e,t){var n=this.doc.sel,r=Et(this,n.head,"div");n.goalColumn!=null&&(r.left=n.goalColumn);var i=Qn(this,r,e,t);t=="page"&&Vn(this,0,wt(this,i,"div").top-r.top);Bn(this.doc,i,i,e);n.goalColumn=r.left}),toggleOverwrite:function(e){if(e!=null&&e==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite","")},hasFocus:function(){return this.state.focused},scrollTo:Mt(null,function(e,t){Xn(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller,t=Ji;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-t,width:e.scrollWidth-t,clientHeight:e.clientHeight-t,clientWidth:e.clientWidth-t}},scrollIntoView:Mt(null,function(e,t){e==null?e={from:this.doc.sel.head,to:null}:typeof e=="number"?e={from:Ln(e,0),to:null}:e.from==null&&(e={from:e,to:null});e.to||(e.to=e.from);t||(t=0);var n=e;if(e.from.line!=null){this.curOp.scrollToPos={from:e.from,to:e.to,margin:t};n={from:Et(this,e.from),to:Et(this,e.to)}}var r=Wn(this,Math.min(n.from.left,n.to.left),Math.min(n.from.top,n.to.top)-t,Math.max(n.from.right,n.to.right),Math.max(n.from.bottom,n.to.bottom)+t);Xn(this,r.scrollLeft,r.scrollTop)}),setSize:Mt(null,function(e,t){function n(e){return typeof e=="number"||/^\d+$/.test(String(e))?e+"px":e}e!=null&&(this.display.wrapper.style.width=n(e));t!=null&&(this.display.wrapper.style.height=n(t));this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0);this.curOp.forceUpdate=!0}),operation:function(e){return Dt(this,e)},refresh:Mt(null,function(){var e=this.display.cachedTextHeight==null;vt(this);Xn(this,this.doc.scrollLeft,this.doc.scrollTop);Pt(this);e&&L(this)}),swapDoc:Mt(null,function(e){var t=this.doc;t.cm=null;ci(this,e);vt(this);Ft(this,!0);Xn(this,e.scrollLeft,e.scrollTop);zi(this,"swapDoc",this,t);return t}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};$i(x);var Zn=x.optionHandlers={},er=x.defaults={},nr=x.Init={toString:function(){return"CodeMirror.Init"}};tr("value","",function(e,t){e.setValue(t)},!0);tr("mode",null,function(e,t){e.doc.modeOption=t;N(e)},!0);tr("indentUnit",2,N,!0);tr("indentWithTabs",!1);tr("smartIndent",!0);tr("tabSize",4,function(e){N(e);vt(e);Pt(e)},!0);tr("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(e,t){e.options.specialChars=new RegExp(t.source+(t.test(" ")?"":"| "),"g");e.refresh()},!0);tr("specialCharPlaceholder",Gr,function(e){e.refresh()},!0);tr("electricChars",!0);tr("rtlMoveVisually",!g);tr("wholeLineUpdateBefore",!0);tr("theme","default",function(e){O(e);M(e)},!0);tr("keyMap","default",A);tr("extraKeys",null);tr("onKeyEvent",null);tr("onDragEvent",null);tr("lineWrapping",!1,C,!0);tr("gutters",[],function(e){H(e.options);M(e)},!0);tr("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?R(e.display)+"px":"0";e.refresh()},!0);tr("coverGutterNextToScrollbar",!1,B,!0);tr("lineNumbers",!1,function(e){H(e.options);M(e)},!0);tr("firstLineNumber",1,M,!0);tr("lineNumberFormatter",function(e){return e},M,!0);tr("showCursorWhenSelecting",!1,G,!0);tr("resetSelectionOnContextMenu",!0);tr("readOnly",!1,function(e,t){if(t=="nocursor"){dn(e);e.display.input.blur();e.display.disabled=!0}else{e.display.disabled=!1;t||Ft(e,!0)}});tr("dragDrop",!0);tr("cursorBlinkRate",530);tr("cursorScrollMargin",0);tr("cursorHeight",1);tr("workTime",100);tr("workDelay",100);tr("flattenSpans",!0);tr("pollInterval",100);tr("undoDepth",40,function(e,t){e.doc.history.undoDepth=t});tr("historyEventDelay",500);tr("viewportMargin",10,function(e){e.refresh()},!0);tr("maxHighlightLength",1e4,function(e){N(e);e.refresh()},!0);tr("crudeMeasuringFrom",1e4);tr("moveInputWithCursor",!0,function(e,t){t||(e.display.inputDiv.style.top=e.display.inputDiv.style.left=0)});tr("tabindex",null,function(e,t){e.display.input.tabIndex=t||""});tr("autofocus",null);var rr=x.modes={},ir=x.mimeModes={};x.defineMode=function(e,t){!x.defaults.mode&&e!="null"&&(x.defaults.mode=e);if(arguments.length>2){t.dependencies=[];for(var n=2;n<arguments.length;++n)t.dependencies.push(arguments[n])}rr[e]=t};x.defineMIME=function(e,t){ir[e]=t};x.resolveMode=function(e){if(typeof e=="string"&&ir.hasOwnProperty(e))e=ir[e];else if(e&&typeof e.name=="string"&&ir.hasOwnProperty(e.name)){var t=ir[e.name];e=rs(t,e);e.name=t.name}else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return x.resolveMode("application/xml");return typeof e=="string"?{name:e}:e||{name:"null"}};x.getMode=function(e,t){var t=x.resolveMode(t),n=rr[t.name];if(!n)return x.getMode(e,"text/plain");var r=n(e,t);if(sr.hasOwnProperty(t.name)){var i=sr[t.name];for(var s in i){if(!i.hasOwnProperty(s))continue;r.hasOwnProperty(s)&&(r["_"+s]=r[s]);r[s]=i[s]}}r.name=t.name;return r};x.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}});x.defineMIME("text/plain","null");var sr=x.modeExtensions={};x.extendMode=function(e,t){var n=sr.hasOwnProperty(e)?sr[e]:sr[e]={};is(t,n)};x.defineExtension=function(e,t){x.prototype[e]=t};x.defineDocExtension=function(e,t){ui.prototype[e]=t};x.defineOption=tr;var or=[];x.defineInitHook=function(e){or.push(e)};var ur=x.helpers={};x.registerHelper=function(e,t,n){ur.hasOwnProperty(e)||(ur[e]=x[e]={});ur[e][t]=n};x.isWordChar=as;x.copyState=ar;x.startState=fr;x.innerMode=function(e,t){while(e.innerMode){var n=e.innerMode(t);if(!n||n.mode==e)break;t=n.state;e=n.mode}return n||{mode:e,state:t}};var lr=x.commands={selectAll:function(e){e.setSelection(Ln(e.firstLine(),0),Ln(e.lastLine()))},killLine:function(e){var t=e.getCursor(!0),n=e.getCursor(!1),r=!An(t,n);!r&&e.getLine(t.line).length==t.ch?e.replaceRange("",t,Ln(t.line+1,0),"+delete"):e.replaceRange("",t,r?n:Ln(t.line),"+delete")},deleteLine:function(e){var t=e.getCursor().line;e.replaceRange("",Ln(t,0),Ln(t),"+delete")},delLineLeft:function(e){var t=e.getCursor();e.replaceRange("",Ln(t.line,0),t,"+delete")},undo:function(e){e.undo()},redo:function(e){e.redo()},goDocStart:function(e){e.extendSelection(Ln(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Ln(e.lastLine()))},goLineStart:function(e){e.extendSelection(Ms(e,e.getCursor().line))},goLineStartSmart:function(e){var t=e.getCursor(),n=Ms(e,t.line),r=e.getLineHandle(n.line),i=bi(r);if(!i||i[0].level==0){var s=Math.max(0,r.text.search(/\S/)),o=t.line==n.line&&t.ch<=s&&t.ch;e.extendSelection(Ln(n.line,o?0:s))}else e.extendSelection(n)},goLineEnd:function(e){e.extendSelection(_s(e,e.getCursor().line))},goLineRight:function(e){var t=e.charCoords(e.getCursor(),"div").top+5;e.extendSelection(e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:t},"div"))},goLineLeft:function(e){var t=e.charCoords(e.getCursor(),"div").top+5;e.extendSelection(e.coordsChar({left:0,top:t},"div"))},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ","end","+input")},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.replaceSelection(" ","end","+input")},transposeChars:function(e){var t=e.getCursor(),n=e.getLine(t.line);t.ch>0&&t.ch<n.length-1&&e.replaceRange(n.charAt(t.ch)+n.charAt(t.ch-1),Ln(t.line,t.ch-1),Ln(t.line,t.ch+1))},newlineAndIndent:function(e){Mt(e,function(){e.replaceSelection("\n","end","+input");e.indentLine(e.getCursor().line,null,!0)})()},toggleOverwrite:function(e){e.toggleOverwrite()}},cr=x.keyMap={};cr.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"};cr.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","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",fallthrough:"basic"};cr.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","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":"delLineLeft",fallthrough:["basic","emacsy"]};cr["default"]=m?cr.macDefault:cr.pcDefault;cr.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"};x.lookupKey=pr;x.isModifierKey=dr;x.keyName=vr;x.fromTextArea=function(e,t){function i(){e.value=a.getValue()}t||(t={});t.value=e.value;!t.tabindex&&e.tabindex&&(t.tabindex=e.tabindex);!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder);if(t.autofocus==null){var n=document.body;try{n=document.activeElement}catch(r){}t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}if(e.form){Fi(e.form,"submit",i);if(!t.leaveSubmitMethodAlone){var s=e.form,o=s.submit;try{var u=s.submit=function(){i();s.submit=o;s.submit();s.submit=u}}catch(r){}}}e.style.display="none";var a=x(function(t){e.parentNode.insertBefore(t,e.nextSibling)},t);a.save=i;a.getTextArea=function(){return e};a.toTextArea=function(){i();e.parentNode.removeChild(a.getWrapperElement());e.style.display="";if(e.form){Ii(e.form,"submit",i);typeof e.form.submit=="function"&&(e.form.submit=o)}};return a};mr.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var t=this.string.charAt(this.pos);if(typeof
7
+ e=="string")var n=t==e;else var n=t&&(e.test?e.test(t):e(t));if(n){++this.pos;return t}},eatWhile:function(e){var t=this.pos;while(this.eat(e));return this.pos>t},eatSpace:function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1){this.pos=t;return!0}},backUp:function(e){this.pos-=e},column:function(){if(this.lastColumnPos<this.start){this.lastColumnValue=Gi(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue},indentation:function(){return Gi(this.string,null,this.tabSize)},match:function(e,t,n){if(typeof e!="string"){var s=this.string.slice(this.pos).match(e);if(s&&s.index>0)return null;s&&t!==!1&&(this.pos+=s[0].length);return s}var r=function(e){return n?e.toLowerCase():e},i=this.string.substr(this.pos,e.length);if(r(i)==r(e)){t!==!1&&(this.pos+=e.length);return!0}},current:function(){return this.string.slice(this.start,this.pos)}};x.StringStream=mr;x.TextMarker=gr;$i(gr);gr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;t&&At(e);if(Vi(this,"clear")){var n=this.find();n&&zi(this,"clear",n.from,n.to)}var r=null,i=null;for(var s=0;s<this.lines.length;++s){var o=this.lines[s],u=Er(o.markedSpans,this);u.to!=null&&(i=mi(o));o.markedSpans=Sr(o.markedSpans,u);u.from!=null?r=mi(o):this.collapsed&&!Dr(this.doc,o)&&e&&vi(o,Ct(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var a=_r(e.doc,this.lines[s]),f=D(e.doc,a);if(f>e.display.maxLineLength){e.display.maxLine=a;e.display.maxLineLength=f;e.display.maxLineChanged=!0}}r!=null&&e&&Pt(e,r,i+1);this.lines.length=0;this.explicitlyCleared=!0;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=!1;e&&In(e)}t&&Ot(e)};gr.prototype.find=function(){var e,t;for(var n=0;n<this.lines.length;++n){var r=this.lines[n],i=Er(r.markedSpans,this);if(i.from!=null||i.to!=null){var s=mi(r);i.from!=null&&(e=Ln(s,i.from));i.to!=null&&(t=Ln(s,i.to))}}return this.type=="bookmark"?e:e&&{from:e,to:t}};gr.prototype.changed=function(){var e=this.find(),t=this.doc.cm;if(!e||!t)return;this.type!="bookmark"&&(e=e.from);var n=hi(this.doc,e.line);lt(t,n);if(e.line>=t.display.showingFrom&&e.line<t.display.showingTo){for(var r=t.display.lineDiv.firstChild;r;r=r.nextSibling)if(r.lineObj==n){r.offsetHeight!=n.height&&vi(n,r.offsetHeight);break}Dt(t,function(){t.curOp.selectionChanged=t.curOp.forceUpdate=t.curOp.updateMaxLine=!0})}};gr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ns(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)};gr.prototype.detachLine=function(e){this.lines.splice(ns(this.lines,e),1);if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};x.SharedTextMarker=br;$i(br);br.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();zi(this,"clear")};br.prototype.find=function(){return this.primary.find()};var jr=x.LineWidget=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.cm=e;this.node=t};$i(jr);jr.prototype.clear=Fr(function(){var e=this.line.widgets,t=mi(this.line);if(t==null||!e)return;for(var n=0;n<e.length;++n)e[n]==this&&e.splice(n--,1);e.length||(this.line.widgets=null);var r=yi(this.cm,this.line)<this.cm.doc.scrollTop;vi(this.line,Math.max(0,this.line.height-Ir(this)));r&&Vn(this.cm,0,-this.height);Pt(this.cm,t,t+1)});jr.prototype.changed=Fr(function(){var e=this.height;this.height=null;var t=Ir(this)-e;if(!t)return;vi(this.line,this.line.height+t);var n=mi(this.line);Pt(this.cm,n,n+1)});var Rr=x.Line=function(e,t,n){this.text=e;Br(this,t);this.height=n?n(this):1};$i(Rr);Rr.prototype.lineNo=function(){return mi(this)};var Jr={};ii.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height;zr(i);zi(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.splice.apply(e,[e.length,0].concat(this.lines))},insertInner:function(e,t,n){this.height+=n;this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0,i=t.length;r<i;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};si.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var s=Math.min(t,i-e),o=r.height;r.removeInner(e,s);this.height-=o-r.height;if(i==s){this.children.splice(n--,1);r.parent=null}if((t-=s)==0)break;e=0}else e-=i}if(this.size-t<25){var u=[];this.collapse(u);this.children=[new ii(u)];this.children[0].parent=this}},collapse:function(e){for(var t=0,n=this.children.length;t<n;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length;this.height+=n;for(var r=0,i=this.children.length;r<i;++r){var s=this.children[r],o=s.chunkSize();if(e<=o){s.insertInner(e,t,n);if(s.lines&&s.lines.length>50){while(s.lines.length>50){var u=s.lines.splice(s.lines.length-25,25),a=new ii(u);s.height-=a.height;this.children.splice(r+1,0,a);a.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new si(t);if(!e.parent){var r=new si(e.children);r.parent=e;e.children=[r,n];e=r}else{e.size-=n.size;e.height-=n.height;var i=ns(e.parent.children,e);e.parent.children.splice(i+1,0,n)}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0,i=this.children.length;r<i;++r){var s=this.children[r],o=s.chunkSize();if(e<o){var u=Math.min(t,o-e);if(s.iterN(e,u,n))return!0;if((t-=u)==0)break;e=0}else e-=o}}};var oi=0,ui=x.Doc=function(e,t,n){if(!(this instanceof ui))return new ui(e,t,n);n==null&&(n=0);si.call(this,[new ii([new Rr("",null)])]);this.first=n;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.history=wi();this.cleanGeneration=1;this.frontier=n;var r=Ln(n,0);this.sel={from:r,to:r,head:r,anchor:r,shift:!1,extend:!1,goalColumn:null};this.id=++oi;this.modeOption=t;typeof e=="string"&&(e=Ss(e));ri(this,{from:r,to:r,text:e},null,{head:r,anchor:r})};ui.prototype=rs(si.prototype,{constructor:ui,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){var n=0;for(var r=0,i=t.length;r<i;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=di(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:function(e){var t=Ln(this.first,0),n=this.first+this.size-1;En(this,{from:t,to:Ln(n,hi(this,n).text.length),text:Ss(e),origin:"setValue"},{head:t,anchor:t},!0)},replaceRange:function(e,t,n,r){t=Dn(this,t);n=n?Dn(this,n):t;kn(this,e,t,n,r)},getRange:function(e,t,n){var r=pi(this,Dn(this,e),Dn(this,t));return n===!1?r:r.join(n||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},setLine:function(e,t){Hn(this,e)&&kn(this,t,Ln(e,0),Dn(this,Ln(e)))},removeLine:function(e){e?kn(this,"",Dn(this,Ln(e-1)),Dn(this,Ln(e))):kn(this,"",Ln(0,0),Dn(this,Ln(1,0)))},getLineHandle:function(e){if(Hn(this,e))return hi(this,e)},getLineNumber:function(e){return mi(e)},getLineHandleVisualStart:function(e){typeof e=="number"&&(e=hi(this,e));return _r(this,e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Dn(this,e)},getCursor:function(e){var t=this.sel,n;e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e===!1?n=t.to:n=t.from;return Mn(n)},somethingSelected:function(){return!An(this.sel.head,this.sel.anchor)},setCursor:_t(function(e,t,n){var r=Dn(this,typeof e=="number"?Ln(e,t||0):e);n?Bn(this,r):Fn(this,r,r)}),setSelection:_t(function(e,t,n){Fn(this,Dn(this,e),Dn(this,t||e),n)}),extendSelection:_t(function(e,t,n){Bn(this,Dn(this,e),t&&Dn(this,t),n)}),getSelection:function(e){return this.getRange(this.sel.from,this.sel.to,e)},replaceSelection:function(e,t,n){En(this,{from:this.sel.from,to:this.sel.to,text:Ss(e),origin:n},t||"around")},undo:_t(function(){xn(this,"undo")}),redo:_t(function(){xn(this,"redo")}),setExtending:function(e){this.sel.extend=e},historySize:function(){var e=this.history;return{undo:e.done.length,redo:e.undone.length}},clearHistory:function(){this.history=wi(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){this.history.lastOp=this.history.lastOrigin=null;return this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Ci(this.history.done),undone:Ci(this.history.undone)}},setHistory:function(e){var t=this.history=wi(this.history.maxGeneration);t.done=e.done.slice(0);t.undone=e.undone.slice(0)},markText:function(e,t,n){return yr(this,Dn(this,e),Dn(this,t),n,"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft};e=Dn(this,e);return yr(this,e,e,n,"bookmark")},findMarksAt:function(e){e=Dn(this,e);var t=[],n=hi(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},getAllMarks:function(){var e=[];this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)});return e},posFromIndex:function(e){var t,n=this.first;this.iter(function(r){var i=r.text.length+1;if(i>e){t=e;return!0}e-=i;++n});return Dn(this,Ln(n,t))},indexFromPos:function(e){e=Dn(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;this.iter(this.first,e.line,function(e){t+=e.text.length+1});return t},copy:function(e){var t=new ui(di(this,this.first,this.first+this.size),this.modeOption,this.first);t.scrollTop=this.scrollTop;t.scrollLeft=this.scrollLeft;t.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:!1,goalColumn:this.sel.goalColumn};if(e){t.history.undoDepth=this.history.undoDepth;t.setHistory(this.getHistory())}return t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from);e.to!=null&&e.to<n&&(n=e.to);var r=new ui(di(this,t,n),e.mode||this.modeOption,t);e.sharedHist&&(r.history=this.history);(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist});r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}];return r},unlinkDoc:function(e){e instanceof x&&(e=e.doc);if(this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1);e.unlinkDoc(this);break}if(e.history==this.history){var r=[e.id];li(e,function(e){r.push(e.id)},!0);e.history=wi();e.history.done=Ci(this.history.done,r);e.history.undone=Ci(this.history.undone,r)}},iterLinkedDocs:function(e){li(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});ui.prototype.eachLine=ui.prototype.iter;var ai="iter insert remove copy getEditor".split(" ");for(var fi in ui.prototype)ui.prototype.hasOwnProperty(fi)&&ns(ai,fi)<0&&(x.prototype[fi]=function(e){return function(){return e.apply(this.doc,arguments)}}(ui.prototype[fi]));$i(ui);x.e_stop=Hi;x.e_preventDefault=_i;x.e_stopPropagation=Di;var Ri,Ui=0;x.on=Fi;x.off=Ii;x.signal=qi;var Ji=30,Ki=x.Pass={toString:function(){return"CodeMirror.Pass"}};Qi.prototype={set:function(e,t){clearTimeout(this.id);this.id=setTimeout(t,e)}};x.countColumn=Gi;var Yi=[""],us=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,ls=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\u1DC0–\u1DFF\u20D0–\u20FF\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff\uFE20–\uFE2F]/;x.replaceGetRect=function(e){vs=e};var ms=function(){if(r)return!1;var e=cs("div");return"draggable"in e||"dragDrop"in e}();e?gs=function(e,t){return e.charCodeAt(t-1)==36&&e.charCodeAt(t)==39}:f&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?gs=function(e,t){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(e.slice(t-1,t+1))}:s&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)?gs=function(e,t){var n=e.charCodeAt(t-1);return n>=8208&&n<=8212}:s&&(gs=function(e,t){if(t>1&&e.charCodeAt(t-1)==45){if(/\w/.test(e.charAt(t-2))&&/[^\-?\.]/.test(e.charAt(t)))return!0;if(t>2&&/[\d\.,]/.test(e.charAt(t-2))&&/[\d\.,]/.test(e.charAt(t)))return!1}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(e.slice(t-1,t+1))});var ys,ws,Ss="\n\nb".split(/\n/).length!=3?function(e){var t=0,n=[],r=e.length;while(t<=r){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var s=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),o=s.indexOf("\r");if(o!=-1){n.push(s.slice(0,o));t+=o+1}else{n.push(s);t=i+1}}return n}:function(e){return e.split(/\r\n?|\n/)};x.splitLines=Ss;var xs=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ts=function(){var e=cs("div");if("oncopy"in e)return!0;e.setAttribute("oncopy","return;");return typeof e.oncopy=="function"}(),Ns={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};x.keyNames=Ns;(function(){for(var e=0;e<10;e++)Ns[e+48]=String(e);for(var e=65;e<=90;e++)Ns[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)Ns[e+111]=Ns[e+63235]="F"+e})();var Ps,Is=function(){function n(n){return n<=255?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1791?t.charAt(n-1536):1792<=n&&n<=2220?"r":"L"}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",t="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,s=/[LRr]/,o=/[Lb1n]/,u=/[1n]/,a="L";return function(e){if(!r.test(e))return!1;var t=e.length,f=[];for(var l=0,c;l<t;++l)f.push(c=n(e.charCodeAt(l)));for(var l=0,h=a;l<t;++l){var c=f[l];c=="m"?f[l]=h:h=c}for(var l=0,p=a;l<t;++l){var c=f[l];if(c=="1"&&p=="r")f[l]="n";else if(s.test(c)){p=c;c=="r"&&(f[l]="R")}}for(var l=1,h=f[0];l<t-1;++l){var c=f[l];c=="+"&&h=="1"&&f[l+1]=="1"?f[l]="1":c==","&&h==f[l+1]&&(h=="1"||h=="n")&&(f[l]=h);h=c}for(var l=0;l<t;++l){var c=f[l];if(c==",")f[l]="N";else if(c=="%"){for(var d=l+1;d<t&&f[d]=="%";++d);var v=l&&f[l-1]=="!"||d<t-1&&f[d]=="1"?"1":"N";for(var m=l;m<d;++m)f[m]=v;l=d-1}}for(var l=0,p=a;l<t;++l){var c=f[l];p=="L"&&c=="1"?f[l]="L":s.test(c)&&(p=c)}for(var l=0;l<t;++l)if(i.test(f[l])){for(var d=l+1;d<t&&i.test(f[d]);++d);var g=(l?f[l-1]:a)=="L",y=(d<t-1?f[d]:a)=="L",v=g||y?"L":"R";for(var m=l;m<d;++m)f[m]=v;l=d-1}var b=[],w;for(var l=0;l<t;)if(o.test(f[l])){var E=l;for(++l;l<t&&o.test(f[l]);++l);b.push({from:E,to:l,level:0})}else{var S=l,x=b.length;for(++l;l<t&&f[l]!="L";++l);for(var m=S;m<l;)if(u.test(f[m])){S<m&&b.splice(x,0,{from:S,to:m,level:1});var T=m;for(++m;m<l&&u.test(f[m]);++m);b.splice(x,0,{from:T,to:m,level:2});S=m}else++m;S<l&&b.splice(x,0,{from:S,to:l,level:1})}if(b[0].level==1&&(w=e.match(/^\s+/))){b[0].from=w[0].length;b.unshift({from:0,to:w[0].length,level:0})}if(es(b).level==1&&(w=e.match(/\s+$/))){es(b).to-=w[0].length;b.push({from:t-w[0].length,to:t,level:0})}b[0].level!=es(b).level&&b.push({from:t,to:t,level:b[0].level});return b}}();x.version="3.20.0";return x}();CodeMirror.defineMode("css",function(e,t){"use strict";function c(e,t){l=t;return e}function h(e,t){var n=e.next();if(r[n]){var i=r[n](e,t);if(i!==!1)return i}if(n=="@"){e.eatWhile(/[\w\\\-]/);return c("def",e.current())}if(n=="=")c(null,"compare");else{if(!(n!="~"&&n!="|"||!e.eat("=")))return c(null,"compare");if(n=='"'||n=="'"){t.tokenize=p(n);return t.tokenize(e,t)}if(n=="#"){e.eatWhile(/[\w\\\-]/);return c("atom","hash")}if(n=="!"){e.match(/^\s*\w*/);return c("keyword","important")}if(/\d/.test(n)||n=="."&&e.eat(/\d/)){e.eatWhile(/[\w.%]/);return c("number","unit")}if(n!=="-"){if(/[,+>*\/]/.test(n))return c(null,"select-op");if(n=="."&&e.match(/^-?[_a-z][_a-z0-9-]*/i))return c("qualifier","qualifier");if(n==":")return c("operator",n);if(/[;{}\[\]\(\)]/.test(n))return c(null,n);if(n=="u"&&e.match("rl(")){e.backUp(1);t.tokenize=d;return c("property","variable")}e.eatWhile(/[\w\\\-]/);return c("property","variable")}if(/\d/.test(e.peek())){e.eatWhile(/[\w.%]/);return c("number","unit")}if(e.match(/^[^-]+-/))return c("meta","meta")}}function p(e,t){return function(n,r){var i=!1,s;while((s=n.next())!=null){if(s==e&&!i)break;i=!i&&s=="\\"}if(!i){t&&n.backUp(1);r.tokenize=h}return c("string","string")}}function d(e,t){e.next();e.match(/\s*[\"\']/,!1)?t.tokenize=h:t.tokenize=p(")",!0);return c(null,"(")}t.propertyKeywords||(t=CodeMirror.resolveMode("text/css"));var n=e.indentUnit||e.tabSize||2,r=t.hooks||{},i=t.atMediaTypes||{},s=t.atMediaFeatures||{},o=t.propertyKeywords||{},u=t.colorKeywords||{},a=t.valueKeywords||{},f=!!t.allowNested,l=null;return{startState:function(e){return{tokenize:h,baseIndent:e||0,stack:[],lastToken:null}},token:function(e,t){t.tokenize=t.tokenize||h;if(t.tokenize==h&&e.eatSpace())return null;var n=t.tokenize(e,t);n&&typeof n!="string"&&(n=c(n[0],n[1]));var r=t.stack[t.stack.length-1];if(n=="variable"){l=="variable-definition"&&t.stack.push("propertyValue");return t.lastToken="variable-2"}if(n=="property"){var p=e.current().toLowerCase();r=="propertyValue"?a.hasOwnProperty(p)?n="string-2":u.hasOwnProperty(p)?n="keyword":n="variable-2":r=="rule"?o.hasOwnProperty(p)||(n+=" error"):r=="block"?o.hasOwnProperty(p)?n="property":u.hasOwnProperty(p)?n="keyword":a.hasOwnProperty(p)?n="string-2":n="tag":!r||r=="@media{"?n="tag":r=="@media"?i[e.current()]?n="attribute":/^(only|not)$/.test(p)?n="keyword":p=="and"?n="error":s.hasOwnProperty(p)?n="error":n="attribute error":r=="@mediaType"?i.hasOwnProperty(p)?n="attribute":p=="and"?n="operator":/^(only|not)$/.test(p)?n="error":n="error":r=="@mediaType("?o.hasOwnProperty(p)||(i.hasOwnProperty(p)?n="error":p=="and"?n="operator":/^(only|not)$/.test(p)?n="error":n+=" error"):r=="@import"?n="tag":n="error"}else n=="atom"?!r||r=="@media{"||r=="block"?n="builtin":r=="propertyValue"?/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e.current())||(n+=" error"):n="error":r=="@media"&&l=="{"&&(n="error");if(l=="{")if(r=="@media"||r=="@mediaType")t.stack[t.stack.length-1]="@media{";else{var d=f?"block":"rule";t.stack.push(d)}else if(l=="}"){r=="interpolation"&&(n="operator");while(t.stack.length){var v=t.stack.pop();if(v.indexOf("{")>-1||v=="block"||v=="rule")break}}else if(l=="interpolation")t.stack.push("interpolation");else if(l=="@media")t.stack.push("@media");else if(l=="@import")t.stack.push("@import");else if(r=="@media"&&/\b(keyword|attribute)\b/.test(n))t.stack[t.stack.length-1]="@mediaType";else if(r=="@mediaType"&&e.current()==",")t.stack[t.stack.length-1]="@media";else if(l=="(")if(r=="@media"||r=="@mediaType"){t.stack[t.stack.length-1]="@mediaType";t.stack.push("@mediaType(")}else t.stack.push("(");else if(l==")")while(t.stack.length){var v=t.stack.pop();if(v.indexOf("(")>-1)break}else l==":"&&t.lastToken=="property"?t.stack.push("propertyValue"):r=="propertyValue"&&l==";"?t.stack.pop():r=="@import"&&l==";"&&t.stack.pop();return t.lastToken=n},indent:function(e,t){var r=e.stack.length;/^\}/.test(t)&&(r-=e.stack[r-1]=="propertyValue"?2:1);return e.baseIndent+r*n},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});(function(){function e(e){var t={};for(var n=0;n<e.length;++n)t[e[n]]=!0;return t}function o(e,t){var n=!1,r;while((r=e.next())!=null){if(n&&r=="/"){t.tokenize=null;break}n=r=="*"}return["comment","comment"]}var t=e(["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"]),n=e(["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"]),r=e(["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid-cell","grid-column","grid-column-align","grid-column-sizing","grid-column-span","grid-columns","grid-flow","grid-row","grid-row-align","grid-row-sizing","grid-row-span","grid-rows","grid-template","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-inside","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","zoom","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-profile","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","kerning","text-anchor","writing-mode"]),i=e(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),s=e(["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only"
8
+ ,"rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"]);CodeMirror.defineMIME("text/css",{atMediaTypes:t,atMediaFeatures:n,propertyKeywords:r,colorKeywords:i,valueKeywords:s,hooks:{"<":function(e,t){function n(e,t){var n=0,r;while((r=e.next())!=null){if(n>=2&&r==">"){t.tokenize=null;break}n=r=="-"?n+1:0}return["comment","comment"]}if(e.eat("!")){t.tokenize=n;return n(e,t)}},"/":function(e,t){if(e.eat("*")){t.tokenize=o;return o(e,t)}return!1}},name:"css"});CodeMirror.defineMIME("text/x-scss",{atMediaTypes:t,atMediaFeatures:n,propertyKeywords:r,colorKeywords:i,valueKeywords:s,allowNested:!0,hooks:{":":function(e){return e.match(/\s*{/)?[null,"{"]:!1},$:function(e){e.match(/^[\w-]+/);return e.peek()==":"?["variable","variable-definition"]:["variable","variable"]},",":function(e,t){if(t.stack[t.stack.length-1]=="propertyValue"&&e.match(/^ *\$/,!1))return["operator",";"]},"/":function(e,t){if(e.eat("/")){e.skipToEnd();return["comment","comment"]}if(e.eat("*")){t.tokenize=o;return o(e,t)}return["operator","operator"]},"#":function(e){if(e.eat("{"))return["operator","interpolation"];e.eatWhile(/[\w\\\-]/);return["atom","hash"]}},name:"css"})})();CodeMirror.defineMode("htmlmixed",function(e,t){function a(e,t){var s=t.htmlState.tagName,o=n.token(e,t.htmlState);if(s=="script"&&/\btag\b/.test(o)&&e.current()==">"){var u=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);u=u?u[1]:"";u&&/[\"\']/.test(u.charAt(0))&&(u=u.slice(1,u.length-1));for(var a=0;a<i.length;++a){var f=i[a];if(typeof f.matches=="string"?u==f.matches:f.matches.test(u)){if(f.mode){t.token=l;t.localMode=f.mode;t.localState=f.mode.startState&&f.mode.startState(n.indent(t.htmlState,""))}break}}}else if(s=="style"&&/\btag\b/.test(o)&&e.current()==">"){t.token=c;t.localMode=r;t.localState=r.startState(n.indent(t.htmlState,""))}return o}function f(e,t,n){var r=e.current(),i=r.search(t),s;if(i>-1)e.backUp(r.length-i);else if(s=r.match(/<\/?$/)){e.backUp(r.length);e.match(t,!1)||e.match(r)}return n}function l(e,t){if(e.match(/^<\/\s*script\s*>/i,!1)){t.token=a;t.localState=t.localMode=null;return a(e,t)}return f(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function c(e,t){if(e.match(/^<\/\s*style\s*>/i,!1)){t.token=a;t.localState=t.localMode=null;return a(e,t)}return f(e,/<\/\s*style\s*>/,r.token(e,t.localState))}var n=CodeMirror.getMode(e,{name:"xml",htmlMode:!0}),r=CodeMirror.getMode(e,"css"),i=[],s=t&&t.scriptTypes;i.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:CodeMirror.getMode(e,"javascript")});if(s)for(var o=0;o<s.length;++o){var u=s[o];i.push({matches:u.matches,mode:u.mode&&CodeMirror.getMode(e,u.mode)})}i.push({matches:/./,mode:CodeMirror.getMode(e,"text/plain")});return{startState:function(){var e=n.startState();return{token:a,localMode:null,localState:null,htmlState:e}},copyState:function(e){if(e.localState)var t=CodeMirror.copyState(e.localMode,e.localState);return{token:e.token,localMode:e.localMode,localState:t,htmlState:CodeMirror.copyState(n,e.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(e,t){return!e.localMode||/^\s*<\//.test(t)?n.indent(e.htmlState,t):e.localMode.indent?e.localMode.indent(e.localState,t):CodeMirror.Pass},electricChars:"/{}:",innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||n}}}},"xml","javascript","css");CodeMirror.defineMIME("text/html","htmlmixed");CodeMirror.defineMode("javascript",function(e,t){function a(e,t){var n=!1,r;while((r=e.next())!=null){if(r==t&&!n)return!1;n=!n&&r=="\\"}return n}function c(e,t,n){f=e;l=n;return t}function h(e,t){var n=e.next();if(n=='"'||n=="'"){t.tokenize=p(n);return t.tokenize(e,t)}if(n=="."&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return c("number","number");if(n=="."&&e.match(".."))return c("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return c(n);if(n=="="&&e.eat(">"))return c("=>");if(n=="0"&&e.eat(/x/i)){e.eatWhile(/[\da-f]/i);return c("number","number")}if(/\d/.test(n)){e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);return c("number","number")}if(n=="/"){if(e.eat("*")){t.tokenize=d;return d(e,t)}if(e.eat("/")){e.skipToEnd();return c("comment","comment")}if(t.lastType=="operator"||t.lastType=="keyword c"||t.lastType=="sof"||/^[\[{}\(,;:]$/.test(t.lastType)){a(e,"/");e.eatWhile(/[gimy]/);return c("regexp","string-2")}e.eatWhile(u);return c("operator",null,e.current())}if(n=="`"){t.tokenize=v;return v(e,t)}if(n=="#"){e.skipToEnd();return c("error","error")}if(u.test(n)){e.eatWhile(u);return c("operator",null,e.current())}e.eatWhile(/[\w\$_]/);var r=e.current(),i=o.propertyIsEnumerable(r)&&o[r];return i&&t.lastType!="."?c(i.type,i.style,r):c("variable","variable",r)}function p(e){return function(t,n){a(t,e)||(n.tokenize=h);return c("string","string")}}function d(e,t){var n=!1,r;while(r=e.next()){if(r=="/"&&n){t.tokenize=h;break}n=r=="*"}return c("comment","comment")}function v(e,t){var n=!1,r;while((r=e.next())!=null){if(!n&&(r=="`"||r=="$"&&e.eat("{"))){t.tokenize=h;break}n=!n&&r=="\\"}return c("quasi","string-2",e.current())}function g(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(n<0)return;var r=0,i=!1;for(var s=n-1;s>=0;--s){var o=e.string.charAt(s),u=m.indexOf(o);if(u>=0&&u<3){if(!r){++s;break}if(--r==0)break}else if(u>=3&&u<6)++r;else if(/[$\w]/.test(o))i=!0;else if(i&&!r){++s;break}}i&&!r&&(t.fatArrowAt=s)}function b(e,t,n,r,i,s){this.indented=e;this.column=t;this.type=n;this.prev=i;this.info=s;r!=null&&(this.align=r)}function w(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(var n=r.vars;n;n=n.next)if(n.name==t)return!0}function E(e,t,n,r,s){var o=e.cc;S.state=e;S.stream=s;S.marked=null,S.cc=o;e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);for(;;){var u=o.length?o.pop():i?D:_;if(u(n,r)){while(o.length&&o[o.length-1].lex)o.pop()();return S.marked?S.marked:n=="variable"&&w(e,r)?"variable-2":t}}}function x(){for(var e=arguments.length-1;e>=0;e--)S.cc.push(arguments[e])}function T(){x.apply(null,arguments);return!0}function N(e){function n(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var r=S.state;if(r.context){S.marked="def";if(n(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(n(r.globalVars))return;t.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function k(){S.state.context={prev:S.state.context,vars:S.state.localVars};S.state.localVars=C}function L(){S.state.localVars=S.state.context.vars;S.state.context=S.state.context.prev}function A(e,t){var n=function(){var n=S.state,r=n.indented;n.lexical.type=="stat"&&(r=n.lexical.indented);n.lexical=new b(r,S.stream.column(),e,null,n.lexical,t)};n.lex=!0;return n}function O(){var e=S.state;if(e.lexical.prev){e.lexical.type==")"&&(e.indented=e.lexical.indented);e.lexical=e.lexical.prev}}function M(e){return function(t){return t==e?T():e==";"?x():T(arguments.callee)}}function _(e,t){return e=="var"?T(A("vardef",t.length),Z,M(";"),O):e=="keyword a"?T(A("form"),D,_,O):e=="keyword b"?T(A("form"),_,O):e=="{"?T(A("}"),Q,O):e==";"?T():e=="if"?T(A("form"),D,_,O,it):e=="function"?T(lt):e=="for"?T(A("form"),st,O,_,O):e=="variable"?T(A("stat"),W):e=="switch"?T(A("form"),D,A("}","switch"),M("{"),Q,O,O):e=="case"?T(D,M(":")):e=="default"?T(M(":")):e=="catch"?T(A("form"),k,M("("),ct,M(")"),_,O,L):e=="module"?T(A("form"),k,vt,L,O):e=="class"?T(A("form"),ht,dt,O):e=="export"?T(A("form"),mt,O):e=="import"?T(A("form"),gt,O):x(A("stat"),D,M(";"),O)}function D(e){return H(e,!1)}function P(e){return H(e,!0)}function H(e,t){if(S.state.fatArrowAt==S.stream.start){var n=t?z:U;if(e=="(")return T(k,K(et,")"),M("=>"),n,L);if(e=="variable")return x(k,et,M("=>"),n,L)}var r=t?I:F;return y.hasOwnProperty(e)?T(r):e=="function"?T(lt):e=="keyword c"?T(t?j:B):e=="("?T(A(")"),B,Et,M(")"),O,r):e=="operator"||e=="spread"?T(t?P:D):e=="["?T(A("]"),P,wt,O,r):e=="{"?T(K(V,"}"),r):T()}function B(e){return e.match(/[;\}\)\],]/)?x():x(D)}function j(e){return e.match(/[;\}\)\],]/)?x():x(P)}function F(e,t){return e==","?T(D):I(e,t,!1)}function I(e,t,n){var r=n==0?F:I,i=n==0?D:P;if(t=="=>")return T(k,n?z:U,L);if(e=="operator")return/\+\+|--/.test(t)?T(r):t=="?"?T(D,M(":"),i):T(i);if(e=="quasi"){S.cc.push(r);return q(t)}if(e==";")return;if(e=="(")return T(K(P,")","call"),r);if(e==".")return T(X,r);if(e=="[")return T(A("]"),B,M("]"),O,r)}function q(e){if(!e)debugger;return e.slice(e.length-2)!="${"?T():T(D,R)}function R(e){if(e=="}"){S.marked="string-2";S.state.tokenize=v;return T()}}function U(e){g(S.stream,S.state);return e=="{"?x(_):x(D)}function z(e){g(S.stream,S.state);return e=="{"?x(_):x(P)}function W(e){return e==":"?T(O,_):x(F,M(";"),O)}function X(e){if(e=="variable"){S.marked="property";return T()}}function V(e,t){if(e=="variable"){S.marked="property";if(t=="get"||t=="set")return T($)}else if(e=="number"||e=="string")S.marked=e+" property";else if(e=="[")return T(D,M("]"),J);if(y.hasOwnProperty(e))return T(J)}function $(e){if(e!="variable")return x(J);S.marked="property";return T(lt)}function J(e){if(e==":")return T(P);if(e=="(")return x(lt)}function K(e,t,n){function r(n){if(n==","){var i=S.state.lexical;i.info=="call"&&(i.pos=(i.pos||0)+1);return T(e,r)}return n==t?T():T(M(t))}return function(i){return i==t?T():n===!1?x(e,r):x(A(t,n),e,r,O)}}function Q(e){return e=="}"?T():x(_,Q)}function G(e){if(s&&e==":")return T(Y)}function Y(e){if(e=="variable"){S.marked="variable-3";return T()}}function Z(){return x(et,G,nt,rt)}function et(e,t){if(e=="variable"){N(t);return T()}if(e=="[")return T(K(et,"]"));if(e=="{")return T(K(tt,"}"))}function tt(e,t){if(e=="variable"&&!S.stream.match(/^\s*:/,!1)){N(t);return T(nt)}e=="variable"&&(S.marked="property");return T(M(":"),et,nt)}function nt(e,t){if(t=="=")return T(P)}function rt(e){if(e==",")return T(Z)}function it(e,t){if(e=="keyword b"&&t=="else")return T(A("form"),_,O)}function st(e){if(e=="(")return T(A(")"),ot,M(")"))}function ot(e){return e=="var"?T(Z,M(";"),at):e==";"?T(at):e=="variable"?T(ut):x(D,M(";"),at)}function ut(e,t){if(t=="in"||t=="of"){S.marked="keyword";return T(D)}return T(F,at)}function at(e,t){if(e==";")return T(ft);if(t=="in"||t=="of"){S.marked="keyword";return T(D)}return x(D,M(";"),ft)}function ft(e){e!=")"&&T(D)}function lt(e,t){if(t=="*"){S.marked="keyword";return T(lt)}if(e=="variable"){N(t);return T(lt)}if(e=="(")return T(k,K(ct,")"),_,L)}function ct(e){return e=="spread"?T(ct):x(et,G)}function ht(e,t){if(e=="variable"){N(t);return T(pt)}}function pt(e,t){if(t=="extends")return T(D)}function dt(e){if(e=="{")return T(K(V,"}"))}function vt(e,t){if(e=="string")return T(_);if(e=="variable"){N(t);return T(bt)}}function mt(e,t){if(t=="*"){S.marked="keyword";return T(bt,M(";"))}if(t=="default"){S.marked="keyword";return T(D,M(";"))}return x(_)}function gt(e){return e=="string"?T():x(yt,bt)}function yt(e,t){if(e=="{")return T(K(yt,"}"));e=="variable"&&N(t);return T()}function bt(e,t){if(t=="from"){S.marked="keyword";return T(D)}}function wt(e){return e=="for"?x(Et):e==","?T(K(P,"]",!1)):x(K(P,"]",!1))}function Et(e){if(e=="for")return T(st,Et);if(e=="if")return T(D,Et)}var n=e.indentUnit,r=t.statementIndent,i=t.json,s=t.typescript,o=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),r=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},u={"if":e("if"),"while":t,"with":t,"else":n,"do":n,"try":n,"finally":n,"return":r,"break":r,"continue":r,"new":r,"delete":r,"throw":r,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,"undefined":o,NaN:o,Infinity:o,"this":e("this"),module:e("module"),"class":e("class"),"super":e("atom"),yield:r,"export":e("export"),"import":e("import"),"extends":r};if(s){var a={type:"variable",style:"variable-3"},f={"interface":e("interface"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),string:a,number:a,bool:a,any:a};for(var l in f)u[l]=f[l]}return u}(),u=/[+\-*&%=<>!?|~^]/,f,l,m="([{}])",y={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0},S={state:null,column:null,marked:null,cc:null},C={name:"this",next:{name:"arguments"}};O.lex=!0;return{startState:function(e){var r={tokenize:h,lastType:"sof",cc:[],lexical:new b((e||0)-n,0,"block",!1),localVars:t.localVars,context:t.localVars&&{vars:t.localVars},indented:0};t.globalVars&&(r.globalVars=t.globalVars);return r},token:function(e,t){if(e.sol()){t.lexical.hasOwnProperty("align")||(t.lexical.align=!1);t.indented=e.indentation();g(e,t)}if(t.tokenize!=d&&e.eatSpace())return null;var n=t.tokenize(e,t);if(f=="comment")return n;t.lastType=f!="operator"||l!="++"&&l!="--"?f:"incdec";return E(t,n,f,l,e)},indent:function(e,i){if(e.tokenize==d)return CodeMirror.Pass;if(e.tokenize!=h)return 0;var s=i&&i.charAt(0),o=e.lexical;for(var u=e.cc.length-1;u>=0;--u){var a=e.cc[u];if(a==O)o=o.prev;else if(a!=it)break}o.type=="stat"&&s=="}"&&(o=o.prev);r&&o.type==")"&&o.prev.type=="stat"&&(o=o.prev);var f=o.type,l=s==f;return f=="vardef"?o.indented+(e.lastType=="operator"||e.lastType==","?o.info+1:0):f=="form"&&s=="{"?o.indented:f=="form"?o.indented+n:f=="stat"?o.indented+(e.lastType=="operator"||e.lastType==","?r||n:0):o.info=="switch"&&!l&&t.doubleIndentSwitch!=0?o.indented+(/^(?:case|default)\b/.test(i)?n:2*n):o.align?o.column+(l?0:1):o.indented+(l?0:n)},electricChars:":{}",blockCommentStart:i?null:"/*",blockCommentEnd:i?null:"*/",lineComment:i?null:"//",fold:"brace",helperType:i?"json":"javascript",jsonMode:i}});CodeMirror.defineMIME("text/javascript","javascript");CodeMirror.defineMIME("text/ecmascript","javascript");CodeMirror.defineMIME("application/javascript","javascript");CodeMirror.defineMIME("application/ecmascript","javascript");CodeMirror.defineMIME("application/json",{name:"javascript",json:!0});CodeMirror.defineMIME("application/x-json",{name:"javascript",json:!0});CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:!0});CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:!0});CodeMirror.defineMode("xml",function(e,t){function f(e,t){function n(n){t.tokenize=n;return n(e,t)}var r=e.next();if(r=="<"){if(e.eat("!")){if(e.eat("["))return e.match("CDATA[")?n(h("atom","]]>")):null;if(e.match("--"))return n(h("comment","-->"));if(e.match("DOCTYPE",!0,!0)){e.eatWhile(/[\w\._\-]/);return n(p(1))}return null}if(e.eat("?")){e.eatWhile(/[\w\._\-]/);t.tokenize=h("meta","?>");return"meta"}var i=e.eat("/");u="";var s;while(s=e.eat(/[^\s\u00a0=<>\"\'\/?]/))u+=s;if(!u)return"tag error";a=i?"closeTag":"openTag";t.tokenize=l;return"tag"}if(r=="&"){var o;e.eat("#")?e.eat("x")?o=e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):o=e.eatWhile(/[\d]/)&&e.eat(";"):o=e.eatWhile(/[\w\.\-:]/)&&e.eat(";");return o?"atom":"error"}e.eatWhile(/[^&<]/);return null}function l(e,t){var n=e.next();if(n==">"||n=="/"&&e.eat(">")){t.tokenize=f;a=n==">"?"endTag":"selfcloseTag";return"tag"}if(n=="="){a="equals";return null}if(n=="<"){t.tokenize=f;var r=t.tokenize(e,t);return r?r+" error":"error"}if(/[\'\"]/.test(n)){t.tokenize=c(n);t.stringStartCol=e.column();return t.tokenize(e,t)}e.eatWhile(/[^\s\u00a0=<>\"\']/);return"word"}function c(e){var t=function(t,n){while(!t.eol())if(t.next()==e){n.tokenize=l;break}return"string"};t.isInAttribute=!0;return t}function h(e,t){return function(n,r){while(!n.eol()){if(n.match(t)){r.tokenize=f;break}n.next()}return e}}function p(e){return function(t,n){var r;while((r=t.next())!=null){if(r=="<"){n.tokenize=p(e+1);return n.tokenize(t,n)}if(r==">"){if(e==1){n.tokenize=f;break}n.tokenize=p(e-1);return n.tokenize(t,n)}}return"meta"}}function g(){for(var e=arguments.length-1;e>=0;e--)d.cc.push(arguments[e])}function y(){g.apply(null,arguments);return!0}function b(e,t){var n=s.doNotIndent.hasOwnProperty(e)||d.context&&d.context.noIndent;d.context={prev:d.context,tagName:e,indent:d.indented,startOfLine:t,noIndent:n}}function w(){d.context&&(d.context=d.context.prev)}function E(e){if(e=="openTag"){d.tagName=u;d.tagStart=v.column();return y(N,S(d.startOfLine))}if(e=="closeTag"){var t=!1;if(d.context){if(d.context.tagName!=u){s.implicitlyClosed.hasOwnProperty(d.context.tagName.toLowerCase())&&w();t=!d.context||d.context.tagName!=u}}else t=!0;t&&(m="error");return y(x(t))}return y()}function S(e){return function(t){var n=d.tagName;d.tagName=d.tagStart=null;if(t=="selfcloseTag"||t=="endTag"&&s.autoSelfClosers.hasOwnProperty(n.toLowerCase())){T(n.toLowerCase());return y()}if(t=="endTag"){T(n.toLowerCase());b(n,e);return y()}return y()}}function x(e){return function(t){e&&(m="error");if(t=="endTag"){w();return y()}m="error";return y(arguments.callee)}}function T(e){var t;for(;;){if(!d.context)return;t=d.context.tagName.toLowerCase();if(!s.contextGrabbers.hasOwnProperty(t)||!s.contextGrabbers[t].hasOwnProperty(e))return;w()}}function N(e){if(e=="word"){m="attribute";return y(C,N)}if(e=="endTag"||e=="selfcloseTag")return g();m="error";return y(N)}function C(e){if(e=="equals")return y(k,N);if(!s.allowMissing)m="error";else if(e=="word"){m="attribute";return y(C,N)}return e=="endTag"||e=="selfcloseTag"?g():y()}function k(e){if(e=="string")return y(L);if(e=="word"&&s.allowUnquoted){m="string";return y()}m="error";return e=="endTag"||e=="selfCloseTag"?g():y()}function L(e){return e=="string"?y(L):g()}var n=e.indentUnit,r=t.multilineTagIndentFactor||1,i=t.multilineTagIndentPastTag||!0,s=t.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1},o=t.alignCDATA,u,a,d,v,m;return{startState:function(){return{tokenize:f,cc:[],indented:0,startOfLine:!0,tagName:null,tagStart:null,context:null}},token:function(e,t){if(!t.tagName&&e.sol()){t.startOfLine=!0;t.indented=e.indentation()}if(e.eatSpace())return null;m=a=u=null;var n=t.tokenize(e,t);t.type=a;if((n||a)&&n!="comment"){d=t;v=e;for(;;){var r=t.cc.pop()||E;if(r(a||n))break}}t.startOfLine=!1;m&&(n=m=="error"?n+" error":m);return n},indent:function(e,t,s){var u=e.context;if(e.tokenize.isInAttribute)return e.stringStartCol+1;if(e.tokenize!=l&&e.tokenize!=f||u&&u.noIndent)return s?s.match(/^(\s*)/)[0].length:0;if(e.tagName)return i?e.tagStart+e.tagName.length+2:e.tagStart+n*r;if(o&&/<!\[CDATA\[/.test(t))return 0;u&&/^<\//.test(t)&&(u=u.prev);while(u&&!u.startOfLine)u=u.prev;return u?u.indent+n:0},electricChars:"/",blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:t.htmlMode?"html":"xml",helperType:t.htmlMode?"html":"xml"}});CodeMirror.defineMIME("text/xml","xml");CodeMirror.defineMIME("application/xml","xml");CodeMirror.mimeModes.hasOwnProperty("text/html")||CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0});(function(){"use strict";function n(n){if("activeLine"in n.state){n.removeLineClass(n.state.activeLine,"wrap",e);n.removeLineClass(n.state.activeLine,"background",t)}}function r(r){var i=r.getLineHandleVisualStart(r.getCursor().line);if(r.state.activeLine==i)return;n(r);r.addLineClass(i,"wrap",e);r.addLineClass(i,"background",t);r.state.activeLine=i}var e="CodeMirror-activeline",t="CodeMirror-activeline-background";CodeMirror.defineOption("styleActiveLine",!1,function(e,t,i){var s=i&&i!=CodeMirror.Init;if(t&&!s){r(e);e.on("cursorActivity",r)}else if(!t&&s){e.off("cursorActivity",r);n(e);delete e.state.activeLine}})})();(function(){function r(e,r,i){function g(r,i,s){if(!r.text)return;var u=h?0:r.text.length-1,a=h?r.text.length:-1;if(r.text.length>o)return null;s!=null&&(u=s+p);for(;u!=a;u+=p){var f=r.text.charAt(u);if(m.test(f)&&e.getTokenTypeAt(t(i,u+1))==d){var l=n[f];if(l.charAt(1)==">"==h)v.push(f);else{if(v.pop()!=l.charAt(0))return{pos:u,match:!1};if(!v.length)return{pos:u,match:!0}}}}}var s=e.state.matchBrackets,o=s&&s.maxScanLineLength||1e4,u=s&&s.maxScanLines||100,a=r||e.getCursor(),f=e.getLineHandle(a.line),l=a.ch-1,c=l>=0&&n[f.text.charAt(l)]||n[f.text.charAt(++l)];if(!c)return null;var h=c.charAt(1)==">",p=h?1:-1;if(i&&h!=(l==a.ch))return null;var d=e.getTokenTypeAt(t(a.line,l+1)),v=[f.text.charAt(l)],m=/[(){}[\]]/;for(var y=a.line,b,w=h?Math.min(y+u,e.lineCount()):Math.max(-1,y-u);y!=w;y+=p){y==a.line?b=g(f,y,l):b=g(e.getLineHandle(y),y);if(b)break}return{from:t(a.line,l),to:b&&t(y,b.pos),match:b&&b.match,forward:h}}function i(n,i){var s=n.state.matchBrackets.maxHighlightLineLength||1e3,o=r(n);if(!o||n.getLine(o.from.line).length>s||o.to&&n.getLine(o.to.line).length>s)return;var u=o.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",a=n.markText(o.from,t(o.from.line,o.from.ch+1),{className:u}),f=o.to&&n.markText(o.to,t(o.to.line,o.to.ch+1),{className:u});e&&n.state.focused&&n.display.input.focus();var l=function(){n.operation(function(){a.clear();f&&f.clear()})};if(!i)return l;setTimeout(l,800)}function o(e){e.operation(function(){if(s){s();s=null}e.somethingSelected()||(s=i(e,!1))})}var e=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),t=CodeMirror.Pos,n={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},s=null;CodeMirror.defineOption("matchBrackets",!1,function(e,t,n){n&&n!=CodeMirror.Init&&e.off("cursorActivity",o);if(t){e.state.matchBrackets=typeof t=="object"?t:{};e.on("cursorActivity",o)}});CodeMirror.defineExtension("matchBrackets",function(){i(this,!0)});CodeMirror.defineExtension("findMatchingBracket",function(e,t){return r(this,e,t)})})();window.onload=heshPlugin;
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: nixdns
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DC9K7UMY8AGUJ
4
  Tags: html editor, syntax highlighter, plugin editor, syntax, highlighting, syntax highlighting, text editor, editor, text editor syntax, editor, editor syntax
5
  Requires at least: 3.3
6
- Tested up to: 3.7.1
7
- Stable tag: 1.4.4
8
 
9
  Add syntax highlighting to the HTML editor.
10
 
@@ -27,6 +27,13 @@ Add syntax highlighting to the HTML editor.
27
 
28
  == Changelog ==
29
 
 
 
 
 
 
 
 
30
  = 1.4.4 =
31
  * Add Media button now works correctly in Text mode
32
  * Fixed jumping cursor issue when ‘:’, '{', '}' keys are pressed
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DC9K7UMY8AGUJ
4
  Tags: html editor, syntax highlighter, plugin editor, syntax, highlighting, syntax highlighting, text editor, editor, text editor syntax, editor, editor syntax
5
  Requires at least: 3.3
6
+ Tested up to: 3.8.1
7
+ Stable tag: 1.4.6
8
 
9
  Add syntax highlighting to the HTML editor.
10
 
27
 
28
  == Changelog ==
29
 
30
+ = 1.4.6 =
31
+ * Fixed issue when "Add Media" button stopped working
32
+ * Fixed editor resize bug in Visual mode.
33
+
34
+ = 1.4.5 =
35
+ * Bug fixing
36
+
37
  = 1.4.4 =
38
  * Add Media button now works correctly in Text mode
39
  * Fixed jumping cursor issue when ‘:’, '{', '}' keys are pressed