Version Description
- Updated CodeMirror library
- Some minor improvements
Download this release
Release Info
Developer | nixdns |
Plugin | HTML Editor Syntax Highlighter |
Version | 1.5.0 |
Comparing to | |
See all releases |
Code changes from version 1.4.8 to 1.5.0
- html-editor-syntax-highlighter.php +2 -2
- lib/hesh.min.js +6 -5
- readme.txt +5 -1
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.
|
9 |
* Requires at least: 3.3
|
10 |
* Tested up to: 3.9
|
11 |
-
* Stable tag: 1.
|
12 |
**/
|
13 |
|
14 |
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
5 |
* Description: Syntax Highlighting in WordPress HTML Editor
|
6 |
* Author: Petr Mukhortov
|
7 |
* Author URI: http://mukhortov.com/
|
8 |
+
* Version: 1.5.0
|
9 |
* Requires at least: 3.3
|
10 |
* Tested up to: 3.9
|
11 |
+
* Stable tag: 1.5.0
|
12 |
**/
|
13 |
|
14 |
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
lib/hesh.min.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
-
function heshPlugin(){var e=null,t=0,r=0,n=document.getElementById("content"),i=null!==document.getElementById("post_ID")?document.getElementById("post_ID").value:0,o=document.getElementById("content-html"),l=document.getElementById("content-tmce"),a=-1!==document.cookie.indexOf("theme=mbo")?"mbo":"default",s=-1!==document.cookie.indexOf("editor%3Dtinymce")?!0:!1,c=null!==document.getElementById("content-tmce")?!0:!1,u=document.getElementById("ed_toolbar"),f=document.getElementById("wp-content-editor-container"),d="heshFullscreen",h=document.getElementById("publish"),p={mode:"text/html",tabMode:"indent",theme:a,lineNumbers:!0,matchBrackets:!0,indentUnit:4,indentWithTabs:!0,enterMode:"keep",lineWrapping:!0,autofocus:!0,styleActiveLine:!0,electricChars:!1,extraKeys:{F11:function(){w()},Esc:function(){w()},"Ctrl-S":function(){h.click()},"Cmd-S":function(){h.click()}}},m=function(){if(!r){var e={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 t in e){var n=e[t],i=n[2]?'data-prompt="'+n[2]+'"':"";u.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_content_'+t+"\" data-start='"+n[0]+"' data-end='"+n[1]+"' "+i+' class="ed_button cm_ed_button" value="'+t+'">'),document.getElementById("cm_content_"+t).onclick=g}C(),k(),r=1}},g=function(){var t=e.getCursor("start"),r=this.getAttribute("data-start"),n=this.getAttribute("data-end"),i=this.getAttribute("data-prompt")||null,o=e.getSelection();"cm_content_link"===this.id&&wpLink?(wpLink.open(),document.getElementById("wp-link-submit").onclick=function(){var t=wpLink.getAttrs();e.replaceSelection('<a href="'+t.href+'" title="'+t.title+'" target="'+t.target+'">'+o+"</a>"),wpLink.close()}):(i&&(r=r.replace("$",prompt(i,""))),e.replaceSelection(r+o+n)),e.setSelection(t,e.getCursor("end")),e.setCursor(t.line,t.ch+r.length),e.focus()},v=function(r){e=CodeMirror.fromTextArea(r,p),e.on("change",function(){e.save()}),e.on("cursorActivity",function(){var t=e.getCursor();window.name=i+","+t.line+","+t.ch});var n=window.name.split(",");i===n[0]&&e.setCursor(parseFloat(n[1]),parseFloat(n[2])),m(),x(),L(),t=1},y=function(){t&&(e.toTextArea(),o.onclick=b,switchEditors.switchto(this),t=0)},b=function(){t||(switchEditors.switchto(this),v(n),l.onclick=y)},x=function(){var e=document.querySelector(".CodeMirror"),t=document.createElement("div"),r=document.getElementById("wp-content-wrap"),n=e.getBoundingClientRect().top,i=function(t){t=t||window.event;var r=(t.pageY||t.clientY+document.body.scrollTop+document.documentElement.scrollTop)-n;e.style.height=(r>10?r:10)+"px",window.getSelection().removeAllRanges()};t.className="content-resize-handle",r.appendChild(t),t.onmousedown=function(){document.onmousemove=i},document.onmouseup=function(){document.onmousemove=null}},w=function(){f.className=-1===f.className.indexOf(d)?f.className+" "+d:f.className.replace(d,"");var t=document.getElementById("cm_content_fullscreen");t.value="fullscreen"===t.value?"exit fullscreen":"fullscreen",e.focus()},k=function(){u.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_content_fullscreen" class="ed_button" title="Toggle fullscreen mode" value="fullscreen">'),document.getElementById("cm_content_fullscreen").onclick=w},C=function(){var t=function(){return"mbo"===a?"light":"dark"};u.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_select_theme" class="ed_button" title="Change editor colour scheme" value="'+t()+'">'),document.getElementById("cm_select_theme").onclick=function(){a="mbo"===a?"default":"mbo",e.setOption("theme",a),document.cookie="hesh_plugin=theme="+a,this.value=t()}},L=function(){window.send_to_editor_wp||(window.send_to_editor_wp=send_to_editor,send_to_editor=function(r){t&&"content"===wpActiveEditor?(e.replaceSelection(r),e.save()):window.send_to_editor_wp(r)})};s&&c?o.onclick=b:(v(n),c&&(l.onclick=y))}window.CodeMirror=function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n||{};for(var i in so)!n.hasOwnProperty(i)&&so.hasOwnProperty(i)&&(n[i]=so[i]);d(n);var o="string"==typeof n.value?0:n.value.first,l=this.display=t(r,o);l.wrapper.CodeMirror=this,c(this),n.autofocus&&!_i&&pt(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new Xn},a(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var s=n.value;"string"==typeof s&&(s=new ko(n.value,n.mode)),lt(this,pn)(this,s),Ai&&setTimeout(ii(ht,this,!0),20),gt(this);var u;try{u=document.activeElement==l.input}catch(f){}u||n.autofocus&&!_i?setTimeout(ii(Ht,this),20):Dt(this),lt(this,function(){for(var e in ao)ao.propertyIsEnumerable(e)&&ao[e](this,n[e],co);for(var t=0;t<po.length;++t)po[t](this)})()}function t(e,t){var r={},n=r.input=ai("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");return Oi?n.style.width="1000px":n.setAttribute("wrap","off"),Ri&&(n.style.border="1px solid black"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck","false"),r.inputDiv=ai("div",[n],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),r.scrollbarH=ai("div",[ai("div",null,null,"height: 1px")],"CodeMirror-hscrollbar"),r.scrollbarV=ai("div",[ai("div",null,null,"width: 1px")],"CodeMirror-vscrollbar"),r.scrollbarFiller=ai("div",null,"CodeMirror-scrollbar-filler"),r.gutterFiller=ai("div",null,"CodeMirror-gutter-filler"),r.lineDiv=ai("div",null,"CodeMirror-code"),r.selectionDiv=ai("div",null,null,"position: relative; z-index: 1"),r.cursor=ai("div"," ","CodeMirror-cursor"),r.otherCursor=ai("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"),r.measure=ai("div",null,"CodeMirror-measure"),r.lineSpace=ai("div",[r.measure,r.selectionDiv,r.lineDiv,r.cursor,r.otherCursor],null,"position: relative; outline: none"),r.mover=ai("div",[ai("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=ai("div",[r.mover],"CodeMirror-sizer"),r.heightForcer=ai("div",null,null,"position: absolute; height: "+To+"px; width: 1px;"),r.gutters=ai("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=ai("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=ai("div",[r.inputDiv,r.scrollbarH,r.scrollbarV,r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),Ni&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),e.appendChild?e.appendChild(r.wrapper):e(r.wrapper),Ri&&(n.style.width="0px"),Oi||(r.scroller.draggable=!0),Pi?(r.inputDiv.style.height="1px",r.inputDiv.style.position="absolute"):Ni&&(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 Xn,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,r}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),t.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),t.doc.frontier=t.doc.first,O(t,100),t.state.modeGen++,t.curOp&&ct(t)}function n(e){e.options.lineWrapping?(e.display.wrapper.className+=" CodeMirror-wrap",e.display.sizer.style.minWidth=""):(e.display.wrapper.className=e.display.wrapper.className.replace(" CodeMirror-wrap",""),f(e)),o(e),ct(e),U(e),setTimeout(function(){h(e)},100)}function i(e){var t=rt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/nt(e.display)-3);return function(i){return _r(e.doc,i)?0:r?(Math.ceil(i.text.length/n)||1)*t:t}}function o(e){var t=e.doc,r=i(e);t.iter(function(e){var t=r(e);t!=e.height&&yn(e,t)})}function l(e){var t=vo[e.options.keyMap],r=t.style;e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(r?" cm-keymap-"+r:""),e.state.disableInput=t.disableInput}function a(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),U(e)}function s(e){c(e),ct(e),setTimeout(function(){m(e)},20)}function c(e){var t=e.display.gutters,r=e.options.gutters;si(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(ai("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none"}function u(e,t){if(0==t.height)return 0;for(var r=t.text.length,n,i=t;n=Br(i);){var o=n.find();i=mn(e,o.from.line),r+=o.from.ch-o.to.ch}for(i=t;n=Vr(i);){var o=n.find();r-=i.text.length-o.from.ch,i=mn(e,o.to.line),r+=i.text.length-o.to.ch}return r}function f(e){var t=e.display,r=e.doc;t.maxLine=mn(r,r.first),t.maxLineLength=u(r,t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var n=u(r,e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function d(e){var t=ei(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function h(e){var t=e.display,r=e.doc.height,n=r+P(t);t.sizer.style.minHeight=t.heightForcer.style.top=n+"px",t.gutters.style.height=Math.max(n,t.scroller.clientHeight-To)+"px";var i=Math.max(n,t.scroller.scrollHeight),o=t.scroller.scrollWidth>t.scroller.clientWidth+1,l=i>t.scroller.clientHeight+1;l?(t.scrollbarV.style.display="block",t.scrollbarV.style.bottom=o?hi(t.measure)+"px":"0",t.scrollbarV.firstChild.style.height=i-t.scroller.clientHeight+t.scrollbarV.clientHeight+"px"):(t.scrollbarV.style.display="",t.scrollbarV.firstChild.style.height="0"),o?(t.scrollbarH.style.display="block",t.scrollbarH.style.right=l?hi(t.measure)+"px":"0",t.scrollbarH.firstChild.style.width=t.scroller.scrollWidth-t.scroller.clientWidth+t.scrollbarH.clientWidth+"px"):(t.scrollbarH.style.display="",t.scrollbarH.firstChild.style.width="0"),o&&l?(t.scrollbarFiller.style.display="block",t.scrollbarFiller.style.height=t.scrollbarFiller.style.width=hi(t.measure)+"px"):t.scrollbarFiller.style.display="",o&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(t.gutterFiller.style.display="block",t.gutterFiller.style.height=hi(t.measure)+"px",t.gutterFiller.style.width=t.gutters.offsetWidth+"px"):t.gutterFiller.style.display="",Fi&&0===hi(t.measure)&&(t.scrollbarV.style.minWidth=t.scrollbarH.style.minHeight=Bi?"18px":"12px",t.scrollbarV.style.pointerEvents=t.scrollbarH.style.pointerEvents="none")}function p(e,t,r){var n=e.scroller.scrollTop,i=e.wrapper.clientHeight;"number"==typeof r?n=r:r&&(n=r.top,i=r.bottom-r.top),n=Math.floor(n-I(e));var o=Math.ceil(n+i);return{from:xn(t,n),to:xn(t,o)}}function m(e){var t=e.display;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=y(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,i=r+"px",o=t.lineDiv.firstChild;o;o=o.nextSibling)if(o.alignable)for(var l=0,a=o.alignable;l<a.length;++l)a[l].style.left=i;e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}}function g(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=v(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(ai("div",[ai("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-l),n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",!0}return!1}function v(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function y(e){return fi(e.scroller).left-fi(e.sizer).left}function b(e,t,r,n){for(var i=e.display.showingFrom,o=e.display.showingTo,l,a=p(e.display,e.doc,r),s=!0;;s=!1){var c=e.display.scroller.clientWidth;if(!x(e,t,a,n))break;if(l=!0,t=[],A(e),h(e),s&&e.options.lineWrapping&&c!=e.display.scroller.clientWidth)n=!0;else if(n=!1,r&&(r=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,"number"==typeof r?r:r.top)),a=p(e.display,e.doc,r),a.from>=e.display.showingFrom&&a.to<=e.display.showingTo)break}return l&&(jn(e,"update",e),(e.display.showingFrom!=i||e.display.showingTo!=o)&&jn(e,"viewportChange",e,e.display.showingFrom,e.display.showingTo)),l}function x(e,t,r,n){var i=e.display,o=e.doc;if(!i.wrapper.clientWidth)return i.showingFrom=i.showingTo=o.first,void(i.viewOffset=0);if(!(!n&&0==t.length&&r.from>i.showingFrom&&r.to<i.showingTo)){g(e)&&(t=[{from:o.first,to:o.first+o.size}]);var l=i.sizer.style.marginLeft=i.gutters.offsetWidth+"px";i.scrollbarH.style.left=e.options.fixedGutter?l:"0";var a=1/0;if(e.options.lineNumbers)for(var s=0;s<t.length;++s)t[s].diff&&t[s].from<a&&(a=t[s].from);var c=o.first+o.size,u=Math.max(r.from-e.options.viewportMargin,o.first),f=Math.min(c,r.to+e.options.viewportMargin);if(i.showingFrom<u&&u-i.showingFrom<20&&(u=Math.max(o.first,i.showingFrom)),i.showingTo>f&&i.showingTo-f<20&&(f=Math.min(c,i.showingTo)),Xi)for(u=bn(Rr(o,mn(o,u)));c>f&&_r(o,mn(o,f));)++f;var d=[{from:Math.max(i.showingFrom,o.first),to:Math.min(i.showingTo,c)}];if(d=d[0].from>=d[0].to?[]:C(d,t),Xi)for(var s=0;s<d.length;++s)for(var h=d[s],p;p=Vr(mn(o,h.to-1));){var m=p.find().from.line;if(!(m>h.from)){d.splice(s--,1);break}h.to=m}for(var v=0,s=0;s<d.length;++s){var h=d[s];h.from<u&&(h.from=u),h.to>f&&(h.to=f),h.from>=h.to?d.splice(s--,1):v+=h.to-h.from}if(!n&&v==f-u&&u==i.showingFrom&&f==i.showingTo)return void k(e);d.sort(function(e,t){return e.from-t.from});try{var y=document.activeElement}catch(b){}.7*(f-u)>v&&(i.lineDiv.style.display="none"),M(e,u,f,d,a),i.lineDiv.style.display="",y&&document.activeElement!=y&&y.offsetHeight&&y.focus();var x=u!=i.showingFrom||f!=i.showingTo||i.lastSizeC!=i.wrapper.clientHeight;return x&&(i.lastSizeC=i.wrapper.clientHeight,O(e,400)),i.showingFrom=u,i.showingTo=f,w(e),k(e),!0}}function w(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=t.lineDiv.firstChild,i;n;n=n.nextSibling)if(n.lineObj){if(Ni){var o=n.offsetTop+n.offsetHeight;i=o-r,r=o}else{var l=fi(n);i=l.bottom-l.top}var a=n.lineObj.height-i;if(2>i&&(i=rt(t)),a>.001||-.001>a){yn(n.lineObj,i);var s=n.lineObj.widgets;if(s)for(var c=0;c<s.length;++c)s[c].height=s[c].node.offsetHeight}}}function k(e){var t=e.display.viewOffset=wn(e,mn(e.doc,e.display.showingFrom));e.display.mover.style.top=t+"px"}function C(e,t){for(var r=0,n=t.length||0;n>r;++r){for(var i=t[r],o=[],l=i.diff||0,a=0,s=e.length;s>a;++a){var c=e[a];i.to<=c.from&&i.diff?o.push({from:c.from+l,to:c.to+l}):i.to<=c.from||i.from>=c.to?o.push(c):(i.from>c.from&&o.push({from:c.from,to:i.from}),i.to<c.to&&o.push({from:i.to+l,to:c.to+l}))}e=o}return e}function L(e){for(var t=e.display,r={},n={},i=t.gutters.firstChild,o=0;i;i=i.nextSibling,++o)r[e.options.gutters[o]]=i.offsetLeft,n[e.options.gutters[o]]=i.offsetWidth;return{fixedPos:y(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function M(e,t,r,n,i){function o(t){var r=t.nextSibling;return Oi&&Gi&&e.display.currentWheelTarget==t?(t.style.display="none",t.lineObj=null):t.parentNode.removeChild(t),r}var l=L(e),a=e.display,s=e.options.lineNumbers;n.length||Oi&&e.display.currentWheelTarget||si(a.lineDiv);var c=a.lineDiv,u=c.firstChild,f=n.shift(),d=t;for(e.doc.iter(t,r,function(t){if(f&&f.to==d&&(f=n.shift()),_r(e.doc,t)){if(0!=t.height&&yn(t,0),t.widgets&&u&&u.previousSibling)for(var r=0;r<t.widgets.length;++r){var a=t.widgets[r];if(a.showIfHidden){var h=u.previousSibling;if(/pre/i.test(h.nodeName)){var p=ai("div",null,null,"position: relative");h.parentNode.replaceChild(p,h),p.appendChild(h),h=p}var m=h.appendChild(ai("div",[a.node],"CodeMirror-linewidget"));a.handleMouseEvents||(m.ignoreEvents=!0),T(a,m,h,l)}}}else if(f&&f.from<=d&&f.to>d){for(;u.lineObj!=t;)u=o(u);s&&d>=i&&u.lineNumber&&ui(u.lineNumber,v(e.options,d)),u=u.nextSibling}else{if(t.widgets)for(var g=0,y=u,b;y&&20>g;++g,y=y.nextSibling)if(y.lineObj==t&&/div/i.test(y.nodeName)){b=y;break}var x=S(e,t,d,l,b);if(x!=b)c.insertBefore(x,u);else{for(;u!=b;)u=o(u);u=u.nextSibling}x.lineObj=t}++d});u;)u=o(u)}function S(e,t,r,n,i){var o=rn(e,t),l=o.pre,a=t.gutterMarkers,s=e.display,c,u=o.bgClass?o.bgClass+" "+(t.bgClass||""):t.bgClass;if(!(e.options.lineNumbers||a||u||t.wrapClass||t.widgets))return l;if(i){i.alignable=null;for(var f=!0,d=0,h=null,p=i.firstChild,m;p;p=m)if(m=p.nextSibling,/\bCodeMirror-linewidget\b/.test(p.className)){for(var g=0;g<t.widgets.length;++g){var y=t.widgets[g];if(y.node==p.firstChild){y.above||h||(h=p),T(y,p,i,n),++d;break}}if(g==t.widgets.length){f=!1;break}}else i.removeChild(p);i.insertBefore(l,h),f&&d==t.widgets.length&&(c=i,i.className=t.wrapClass||"")}if(c||(c=ai("div",null,t.wrapClass,"position: relative"),c.appendChild(l)),u&&c.insertBefore(ai("div",null,u+" CodeMirror-linebackground"),c.firstChild),e.options.lineNumbers||a){var b=c.insertBefore(ai("div",null,null,"position: absolute; left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px"),c.firstChild);if(e.options.fixedGutter&&(c.alignable||(c.alignable=[])).push(b),!e.options.lineNumbers||a&&a["CodeMirror-linenumbers"]||(c.lineNumber=b.appendChild(ai("div",v(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+s.lineNumInnerWidth+"px"))),a)for(var x=0;x<e.options.gutters.length;++x){var w=e.options.gutters[x],k=a.hasOwnProperty(w)&&a[w];k&&b.appendChild(ai("div",[k],"CodeMirror-gutter-elt","left: "+n.gutterLeft[w]+"px; width: "+n.gutterWidth[w]+"px"))}}if(Ni&&(c.style.zIndex=2),t.widgets&&c!=i)for(var g=0,C=t.widgets;g<C.length;++g){var y=C[g],L=ai("div",[y.node],"CodeMirror-linewidget");y.handleMouseEvents||(L.ignoreEvents=!0),T(y,L,c,n),y.above?c.insertBefore(L,e.options.lineNumbers&&0!=t.height?b:l):c.appendChild(L),jn(y,"redraw")}return c}function T(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function A(e){var t=e.display,r=$t(e.doc.sel.from,e.doc.sel.to);if(r||e.options.showCursorWhenSelecting?N(e):t.cursor.style.display=t.otherCursor.style.display="none",r?t.selectionDiv.style.display="none":z(e),e.options.moveInputWithCursor){var n=Q(e,e.doc.sel.head,"div"),i=fi(t.wrapper),o=fi(t.lineDiv);t.inputDiv.style.top=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+o.top-i.top))+"px",t.inputDiv.style.left=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+o.left-i.left))+"px"}}function N(e){var t=e.display,r=Q(e,e.doc.sel.head,"div");t.cursor.style.left=r.left+"px",t.cursor.style.top=r.top+"px",t.cursor.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",t.cursor.style.display="",r.other?(t.otherCursor.style.display="",t.otherCursor.style.left=r.other.left+"px",t.otherCursor.style.top=r.other.top+"px",t.otherCursor.style.height=.85*(r.other.bottom-r.other.top)+"px"):t.otherCursor.style.display="none"}function z(e){function t(e,t,r,n){0>t&&(t=0),l.appendChild(ai("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?a-e:r)+"px; height: "+(n-t)+"px"))}function r(r,n,o){function l(t,n){return Z(e,qt(r,t),"div",c,n)}var c=mn(i,r),u=c.text.length,f,d;return mi(kn(c),n||0,null==o?u:o,function(e,r,i){var c=l(e,"left"),h,p,m;if(e==r)h=c,p=m=c.left;else{if(h=l(r-1,"right"),"rtl"==i){var g=c;c=h,h=g}p=c.left,m=h.right}null==n&&0==e&&(p=s),h.top-c.top>3&&(t(p,c.top,null,c.bottom),p=s,c.bottom<h.top&&t(p,c.bottom,null,h.top)),null==o&&r==u&&(m=a),(!f||c.top<f.top||c.top==f.top&&c.left<f.left)&&(f=c),(!d||h.bottom>d.bottom||h.bottom==d.bottom&&h.right>d.right)&&(d=h),s+1>p&&(p=s),t(p,h.top,m-p,h.bottom)}),{start:f,end:d}}var n=e.display,i=e.doc,o=e.doc.sel,l=document.createDocumentFragment(),a=n.lineSpace.offsetWidth,s=F(e.display);if(o.from.line==o.to.line)r(o.from.line,o.from.ch,o.to.ch);else{var c=mn(i,o.from.line),u=mn(i,o.to.line),f=Rr(i,c)==Rr(i,u),d=r(o.from.line,o.from.ch,f?c.text.length:null).end,h=r(o.to.line,f?0:null,o.to.ch).start;f&&(d.top<h.top-2?(t(d.right,d.top,null,d.bottom),t(s,h.top,h.left,h.bottom)):t(d.right,d.top,h.left-d.right,d.bottom)),d.bottom<h.top&&t(s,d.bottom,null,h.top)}ci(n.selectionDiv,l),n.selectionDiv.style.display=""}function E(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!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=(r=!r)?"":"hidden"},e.options.cursorBlinkRate))}}function O(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.showingTo&&e.state.highlight.set(t,ii(W,e))}function W(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.showingTo)){var r=+new Date+e.options.workTime,n=br(t.mode,D(e,t.frontier)),i=[],o;t.iter(t.frontier,Math.min(t.first+t.size,e.display.showingTo+500),function(l){if(t.frontier>=e.display.showingFrom){var a=l.styles;l.styles=Qr(e,l,n,!0);for(var s=!a||a.length!=l.styles.length,c=0;!s&&c<a.length;++c)s=a[c]!=l.styles[c];s&&(o&&o.end==t.frontier?o.end++:i.push(o={start:t.frontier,end:t.frontier+1})),l.stateAfter=br(t.mode,n)}else en(e,l.text,n),l.stateAfter=t.frontier%5==0?br(t.mode,n):null;return++t.frontier,+new Date>r?(O(e,e.options.workDelay),!0):void 0}),i.length&<(e,function(){for(var e=0;e<i.length;++e)ct(this,i[e].start,i[e].end)})()}}function H(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>l;--a){if(a<=o.first)return o.first;var s=mn(o,a-1);if(s.stateAfter&&(!r||a<=o.frontier))return a;var c=Yn(s.text,null,e.options.tabSize);(null==i||n>c)&&(i=a-1,n=c)}return i}function D(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=H(e,t,r),l=o>n.first&&mn(n,o-1).stateAfter;return l=l?br(n.mode,l):xr(n.mode),n.iter(o,t,function(r){en(e,r.text,l);var a=o==t-1||o%5==0||o>=i.showingFrom&&o<i.showingTo;r.stateAfter=a?br(n.mode,l):null,++o}),r&&(n.frontier=o),l}function I(e){return e.lineSpace.offsetTop}function P(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function F(e){var t=ci(e.measure,ai("pre",null,null,"text-align: left")).appendChild(ai("span","x"));return t.offsetLeft}function B(e,t,r,n,i){var o=-1;if(n=n||_(e,t),n.crude){var l=n.left+r*n.width;return{left:l,right:l+n.width,top:n.top,bottom:n.bottom}}for(var a=r;;a+=o){var s=n[a];if(s)break;0>o&&0==a&&(o=1)}return i=a>r?"left":r>a?"right":i,"left"==i&&s.leftSide?s=s.leftSide:"right"==i&&s.rightSide&&(s=s.rightSide),{left:r>a?s.right:s.left,right:a>r?s.left:s.right,top:s.top,bottom:s.bottom}}function V(e,t){for(var r=e.display.measureLineCache,n=0;n<r.length;++n){var i=r[n];if(i.text==t.text&&i.markedSpans==t.markedSpans&&e.display.scroller.clientWidth==i.width&&i.classes==t.textClass+"|"+t.wrapClass)return i}}function R(e,t){var r=V(e,t);r&&(r.text=r.measure=r.markedSpans=null)}function _(e,t){var r=V(e,t);if(r)return r.measure;var n=G(e,t),i=e.display.measureLineCache,o={text:t.text,width:e.display.scroller.clientWidth,markedSpans:t.markedSpans,measure:n,classes:t.textClass+"|"+t.wrapClass};return 16==i.length?i[++e.display.measureLineCachePos%16]=o:i.push(o),n}function G(e,t){function r(e){var t=e.top-p.top,r=e.bottom-p.top;r>v&&(r=v),0>t&&(t=0);for(var n=m.length-2;n>=0;n-=2){var i=m[n],o=m[n+1];if(!(i>r||t>o)&&(t>=i&&o>=r||i>=t&&r>=o||Math.min(r,o)-Math.max(t,i)>=r-t>>1)){m[n]=Math.min(t,i),m[n+1]=Math.max(r,o);break}}return 0>n&&(n=m.length,m.push(t,r)),{left:e.left-p.left,right:e.right-p.left,top:n,bottom:null}}function n(e){e.bottom=m[e.top+1],e.top=m[e.top]}if(!e.options.lineWrapping&&t.text.length>=e.options.crudeMeasuringFrom)return j(e,t);var i=e.display,o=ni(t.text.length),l=rn(e,t,o,!0).pre;if(Ai&&!Ni&&!e.options.lineWrapping&&l.childNodes.length>100){for(var a=document.createDocumentFragment(),s=10,c=l.childNodes.length,u=0,f=Math.ceil(c/s);f>u;++u){for(var d=ai("div",null,null,"display: inline-block"),h=0;s>h&&c;++h)d.appendChild(l.firstChild),--c;a.appendChild(d)}l.appendChild(a)}ci(i.measure,l);var p=fi(i.lineDiv),m=[],g=ni(t.text.length),v=l.offsetHeight;zi&&i.measure.first!=l&&ci(i.measure,l);for(var u=0,y;u<o.length;++u)if(y=o[u]){var b=y,x=null;if(/\bCodeMirror-widget\b/.test(y.className)&&y.getClientRects){1==y.firstChild.nodeType&&(b=y.firstChild);var w=b.getClientRects();w.length>1&&(x=g[u]=r(w[0]),x.rightSide=r(w[w.length-1]))}x||(x=g[u]=r(fi(b))),y.measureRight&&(x.right=fi(y.measureRight).left),y.leftSide&&(x.leftSide=r(fi(y.leftSide)))}si(e.display.measure);for(var u=0,y;u<g.length;++u)(y=g[u])&&(n(y),y.leftSide&&n(y.leftSide),y.rightSide&&n(y.rightSide));return g}function j(e,t){var r=new bo(t.text.slice(0,100),null);t.textClass&&(r.textClass=t.textClass);var n=G(e,r),i=B(e,r,0,n,"left"),o=B(e,r,99,n,"right");return{crude:!0,top:i.top,left:i.left,bottom:i.bottom,width:(o.right-i.left)/100}}function K(e,t){var r=!1;if(t.markedSpans)for(var n=0;n<t.markedSpans;++n){var i=t.markedSpans[n];!i.collapsed||null!=i.to&&i.to!=t.text.length||(r=!0)}var o=!r&&V(e,t);if(o||t.text.length>=e.options.crudeMeasuringFrom)return B(e,t,t.text.length,o&&o.measure,"right").right;var l=rn(e,t,null,!0).pre,a=l.appendChild(pi(e.display.measure));return ci(e.display.measure,l),fi(a).right-fi(e.display.lineDiv).left}function U(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 q(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function $(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function X(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=qr(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=wn(e,t);if("local"==n?l+=I(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var a=fi(e.display.lineSpace);l+=a.top+("window"==n?0:$());var s=a.left+("window"==n?0:q());r.left+=s,r.right+=s}return r.top+=l,r.bottom+=l,r}function Y(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=q(),i-=$();else if("local"==r||!r){var o=fi(e.display.sizer);n+=o.left,i+=o.top}var l=fi(e.display.lineSpace);return{left:n-l.left,top:i-l.top}}function Z(e,t,r,n,i){return n||(n=mn(e.doc,t.line)),X(e,n,B(e,n,t.ch,null,i),r)}function Q(e,t,r,n,i){function o(t,o){var l=B(e,n,t,i,o?"right":"left");return o?l.left=l.right:l.right=l.left,X(e,n,l,r)}function l(e,t){var r=a[t],n=r.level%2;return e==gi(r)&&t&&r.level<a[t-1].level?(r=a[--t],e=vi(r)-(r.level%2?0:1),n=!0):e==vi(r)&&t<a.length-1&&r.level<a[t+1].level&&(r=a[++t],e=gi(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?o(e-1):o(e,n)}n=n||mn(e.doc,t.line),i||(i=_(e,n));var a=kn(n),s=t.ch;if(!a)return o(s);var c=Ci(a,s),u=l(s,c);return null!=Bo&&(u.other=l(s,Bo)),u}function J(e,t,r,n){var i=new qt(e,t);return i.xRel=n,r&&(i.outside=!0),i}function et(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return J(n.first,0,!0,-1);var i=xn(n,r),o=n.first+n.size-1;if(i>o)return J(n.first+n.size-1,mn(n,o).text.length,!0,1);for(0>t&&(t=0);;){var l=mn(n,i),a=tt(e,l,i,t,r),s=Vr(l),c=s&&s.find();if(!s||!(a.ch>c.from.ch||a.ch==c.from.ch&&a.xRel>0))return a;i=c.to.line}}function tt(e,t,r,n,i){function o(n){var i=Q(e,qt(r,n),"line",t,c);return a=!0,l>i.bottom?i.left-s:l<i.top?i.left+s:(a=!1,i.left)}var l=i-wn(e,t),a=!1,s=2*e.display.wrapper.clientWidth,c=_(e,t),u=kn(t),f=t.text.length,d=yi(t),h=bi(t),p=o(d),m=a,g=o(h),v=a;if(n>g)return J(r,h,v,1);for(;;){if(u?h==d||h==Mi(t,d,1):1>=h-d){for(var y=p>n||g-n>=n-p?d:h,b=n-(y==d?p:g);Eo.test(t.text.charAt(y));)++y;var x=J(r,y,y==d?m:v,0>b?-1:b?1:0);return x}var w=Math.ceil(f/2),k=d+w;if(u){k=d;for(var C=0;w>C;++C)k=Mi(t,k,1)}var L=o(k);L>n?(h=k,g=L,(v=a)&&(g+=1e3),f=w):(d=k,p=L,m=a,f-=w)}}function rt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Yi){Yi=ai("pre");for(var t=0;49>t;++t)Yi.appendChild(document.createTextNode("x")),Yi.appendChild(ai("br"));Yi.appendChild(document.createTextNode("x"))}ci(e.measure,Yi);var r=Yi.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),si(e.measure),r||1}function nt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=ai("span","x"),r=ai("pre",[t]);ci(e.measure,r);var n=t.offsetWidth;return n>2&&(e.cachedCharWidth=n),n||10}function it(e){e.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Zi},So++||(Mo=[])}function ot(e){var t=e.curOp,r=e.doc,n=e.display;if(e.curOp=null,t.updateMaxLine&&f(e),n.maxLineChanged&&!e.options.lineWrapping&&n.maxLine){var i=K(e,n.maxLine);n.sizer.style.minWidth=Math.max(0,i+3+To)+"px",n.maxLineChanged=!1;var o=Math.max(0,n.sizer.offsetLeft+n.sizer.offsetWidth-n.scroller.clientWidth);o<r.scrollLeft&&!t.updateScrollPos&&St(e,Math.min(n.scroller.scrollLeft,o),!0)}var l,a;if(t.updateScrollPos)l=t.updateScrollPos;else if(t.selectionChanged&&n.scroller.clientHeight){var s=Q(e,r.sel.head);l=cr(e,s.left,s.top,s.left,s.bottom)}if((t.changes.length||t.forceUpdate||l&&null!=l.scrollTop)&&(a=b(e,t.changes,l&&l.scrollTop,t.forceUpdate),e.display.scroller.offsetHeight&&(e.doc.scrollTop=e.display.scroller.scrollTop)),!a&&t.selectionChanged&&A(e),t.updateScrollPos){var c=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,l.scrollTop)),u=Math.max(0,Math.min(n.scroller.scrollWidth-n.scroller.clientWidth,l.scrollLeft));n.scroller.scrollTop=n.scrollbarV.scrollTop=r.scrollTop=c,n.scroller.scrollLeft=n.scrollbarH.scrollLeft=r.scrollLeft=u,m(e),t.scrollToPos&&ar(e,Qt(e.doc,t.scrollToPos.from),Qt(e.doc,t.scrollToPos.to),t.scrollToPos.margin)}else l&&lr(e);t.selectionChanged&&E(e),e.state.focused&&t.updateInput&&ht(e,t.userSelChange);var d=t.maybeHiddenMarkers,h=t.maybeUnhiddenMarkers;if(d)for(var p=0;p<d.length;++p)d[p].lines.length||Gn(d[p],"hide");if(h)for(var p=0;p<h.length;++p)h[p].lines.length&&Gn(h[p],"unhide");var g;if(--So||(g=Mo,Mo=null),t.textChanged&&Gn(e,"change",e,t.textChanged),t.cursorActivity&&Gn(e,"cursorActivity",e),g)for(var p=0;p<g.length;++p)g[p]()}function lt(e,t){return function(){var r=e||this,n=!r.curOp;n&&it(r);try{var i=t.apply(r,arguments)}finally{n&&ot(r)}return i}}function at(e){return function(){var t=this.cm&&!this.cm.curOp,r;t&&it(this.cm);try{r=e.apply(this,arguments)}finally{t&&ot(this.cm)}return r}}function st(e,t){var r=!e.curOp,n;r&&it(e);try{n=t()}finally{r&&ot(e)}return n}function ct(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),e.curOp.changes.push({from:t,to:r,diff:n})}function ut(e){e.display.pollingFast||e.display.poll.set(e.options.pollInterval,function(){dt(e),e.state.focused&&ut(e)})}function ft(e){function t(){var n=dt(e);n||r?(e.display.pollingFast=!1,ut(e)):(r=!0,e.display.poll.set(60,t))}var r=!1;e.display.pollingFast=!0,e.display.poll.set(20,t)}function dt(e){var t=e.display.input,r=e.display.prevInput,n=e.doc,i=n.sel;if(!e.state.focused||Io(t)||mt(e)||e.state.disableInput)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var o=t.value;if(o==r&&$t(i.from,i.to))return!1;if(Ai&&!zi&&e.display.inputHasSelection===o)return ht(e,!0),!1;
|
2 |
-
var l=!e.curOp;l&&it(e),i.shift=!1;for(var a=0,s=Math.min(r.length,o.length);s>a&&r.charCodeAt(a)==o.charCodeAt(a);)++a;var c=i.from,u=i.to;a<r.length?c=qt(c.line,c.ch-(r.length-a)):e.state.overwrite&&$t(c,u)&&!e.state.pasteIncoming&&(u=qt(u.line,Math.min(mn(n,u.line).text.length,u.ch+(o.length-a))));var f=e.curOp.updateInput,d={from:c,to:u,text:Do(o.slice(a)),origin:e.state.pasteIncoming?"paste":"+input"};return Vt(e.doc,d,"end"),e.curOp.updateInput=f,jn(e,"inputRead",e,d),o.length>1e3||o.indexOf("\n")>-1?t.value=e.display.prevInput="":e.display.prevInput=o,l&&ot(e),e.state.pasteIncoming=!1,!0}function ht(e,t){var r,n,i=e.doc;if($t(i.sel.from,i.sel.to))t&&(e.display.prevInput=e.display.input.value="",Ai&&!zi&&(e.display.inputHasSelection=null));else{e.display.prevInput="",r=Po&&(i.sel.to.line-i.sel.from.line>100||(n=e.getSelection()).length>1e3);var o=r?"-":n||e.getSelection();e.display.input.value=o,e.state.focused&&Jn(e.display.input),Ai&&!zi&&(e.display.inputHasSelection=o)}e.display.inaccurateSelection=r}function pt(e){"nocursor"==e.options.readOnly||_i&&document.activeElement==e.display.input||e.display.input.focus()}function mt(e){return e.options.readOnly||e.doc.cantEdit}function gt(e){function t(){e.state.focused&&setTimeout(ii(pt,e),0)}function r(){null==a&&(a=setTimeout(function(){a=null,l.cachedCharWidth=l.cachedTextHeight=Wo=null,U(e),st(e,ii(ct,e))},100))}function n(){for(var e=l.wrapper.parentNode;e&&e!=document.body;e=e.parentNode);e?setTimeout(n,5e3):_n(window,"resize",r)}function i(t){Kn(e,t)||e.options.onDragEvent&&e.options.onDragEvent(e,Hn(t))||Fn(t)}function o(){l.inaccurateSelection&&(l.prevInput="",l.inaccurateSelection=!1,l.input.value=e.getSelection(),Jn(l.input))}var l=e.display;Rn(l.scroller,"mousedown",lt(e,bt)),Ai?Rn(l.scroller,"dblclick",lt(e,function(t){if(!Kn(e,t)){var r=yt(e,t);if(r&&!kt(e,t)&&!vt(e.display,t)){Dn(t);var n=gr(mn(e.doc,r.line).text,r);tr(e.doc,n.from,n.to)}}})):Rn(l.scroller,"dblclick",function(t){Kn(e,t)||Dn(t)}),Rn(l.lineSpace,"selectstart",function(e){vt(l,e)||Dn(e)}),qi||Rn(l.scroller,"contextmenu",function(t){It(e,t)}),Rn(l.scroller,"scroll",function(){l.scroller.clientHeight&&(Mt(e,l.scroller.scrollTop),St(e,l.scroller.scrollLeft,!0),Gn(e,"scroll",e))}),Rn(l.scrollbarV,"scroll",function(){l.scroller.clientHeight&&Mt(e,l.scrollbarV.scrollTop)}),Rn(l.scrollbarH,"scroll",function(){l.scroller.clientHeight&&St(e,l.scrollbarH.scrollLeft)}),Rn(l.scroller,"mousewheel",function(t){Tt(e,t)}),Rn(l.scroller,"DOMMouseScroll",function(t){Tt(e,t)}),Rn(l.scrollbarH,"mousedown",t),Rn(l.scrollbarV,"mousedown",t),Rn(l.wrapper,"scroll",function(){l.wrapper.scrollTop=l.wrapper.scrollLeft=0});var a;Rn(window,"resize",r),setTimeout(n,5e3),Rn(l.input,"keyup",lt(e,function(t){Kn(e,t)||e.options.onKeyEvent&&e.options.onKeyEvent(e,Hn(t))||16==t.keyCode&&(e.doc.sel.shift=!1)})),Rn(l.input,"input",function(){Ai&&!zi&&e.display.inputHasSelection&&(e.display.inputHasSelection=null),ft(e)}),Rn(l.input,"keydown",lt(e,Ot)),Rn(l.input,"keypress",lt(e,Wt)),Rn(l.input,"focus",ii(Ht,e)),Rn(l.input,"blur",ii(Dt,e)),e.options.dragDrop&&(Rn(l.scroller,"dragstart",function(t){Lt(e,t)}),Rn(l.scroller,"dragenter",i),Rn(l.scroller,"dragover",i),Rn(l.scroller,"drop",lt(e,Ct))),Rn(l.scroller,"paste",function(t){vt(l,t)||(pt(e),ft(e))}),Rn(l.input,"paste",function(){if(Oi&&!e.state.fakedLastChar&&!(new Date-e.state.lastMiddleDown<200)){var t=l.input.selectionStart,r=l.input.selectionEnd;l.input.value+="$",l.input.selectionStart=t,l.input.selectionEnd=r,e.state.fakedLastChar=!0}e.state.pasteIncoming=!0,ft(e)}),Rn(l.input,"cut",o),Rn(l.input,"copy",o),Pi&&Rn(l.sizer,"mouseup",function(){document.activeElement==l.input&&l.input.blur(),pt(e)})}function vt(e,t){for(var r=Bn(t);r!=e.wrapper;r=r.parentNode)if(!r||r.ignoreEvents||r.parentNode==e.sizer&&r!=e.mover)return!0}function yt(e,t,r){var n=e.display;if(!r){var i=Bn(t);if(i==n.scrollbarH||i==n.scrollbarH.firstChild||i==n.scrollbarV||i==n.scrollbarV.firstChild||i==n.scrollbarFiller||i==n.gutterFiller)return null}var o,l,a=fi(n.lineSpace);try{o=t.clientX,l=t.clientY}catch(t){return null}return et(e,o-a.left,l-a.top)}function bt(e){function t(e){if(!$t(v,e)){if(v=e,"single"==u)return void tr(i.doc,Qt(l,s),e);if(m=Qt(l,m),g=Qt(l,g),"double"==u){var t=gr(mn(l,e.line).text,e);Xt(e,m)?tr(i.doc,t.from,g):tr(i.doc,m,t.to)}else"triple"==u&&(Xt(e,m)?tr(i.doc,g,Qt(l,qt(e.line,0))):tr(i.doc,m,Qt(l,qt(e.line+1,0))))}}function r(e){var n=++b,a=yt(i,e,!0);if(a)if($t(a,d)){var s=e.clientY<y.top?-20:e.clientY>y.bottom?20:0;s&&setTimeout(lt(i,function(){b==n&&(o.scroller.scrollTop+=s,r(e))}),50)}else{i.state.focused||Ht(i),d=a,t(a);var c=p(o,l);(a.line>=c.to||a.line<c.from)&&setTimeout(lt(i,function(){b==n&&r(e)}),150)}}function n(e){b=1/0,Dn(e),pt(i),_n(document,"mousemove",x),_n(document,"mouseup",w)}if(!Kn(this,e)){var i=this,o=i.display,l=i.doc,a=l.sel;if(a.shift=e.shiftKey,vt(o,e))return void(Oi||(o.scroller.draggable=!1,setTimeout(function(){o.scroller.draggable=!0},100)));if(!kt(i,e)){var s=yt(i,e);switch(Vn(e)){case 3:return void(qi&&It.call(i,i,e));case 2:return Oi&&(i.state.lastMiddleDown=+new Date),s&&tr(i.doc,s),setTimeout(ii(pt,i),20),void Dn(e)}if(!s)return void(Bn(e)==o.scroller&&Dn(e));i.state.focused||Ht(i);var c=+new Date,u="single";if(Ji&&Ji.time>c-400&&$t(Ji.pos,s))u="triple",Dn(e),setTimeout(ii(pt,i),20),vr(i,s.line);else if(Qi&&Qi.time>c-400&&$t(Qi.pos,s)){u="double",Ji={time:c,pos:s},Dn(e);var f=gr(mn(l,s.line).text,s);tr(i.doc,f.from,f.to)}else Qi={time:c,pos:s};var d=s;if(i.options.dragDrop&&Oo&&!mt(i)&&!$t(a.from,a.to)&&!Xt(s,a.from)&&!Xt(a.to,s)&&"single"==u){var h=lt(i,function(t){Oi&&(o.scroller.draggable=!1),i.state.draggingText=!1,_n(document,"mouseup",h),_n(o.scroller,"drop",h),Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)<10&&(Dn(t),tr(i.doc,s),pt(i))});return Oi&&(o.scroller.draggable=!0),i.state.draggingText=h,o.scroller.dragDrop&&o.scroller.dragDrop(),Rn(document,"mouseup",h),void Rn(o.scroller,"drop",h)}Dn(e),"single"==u&&tr(i.doc,Qt(l,s));var m=a.from,g=a.to,v=s,y=fi(o.wrapper),b=0,x=lt(i,function(e){Ai||Vn(e)?r(e):n(e)}),w=lt(i,n);Rn(document,"mousemove",x),Rn(document,"mouseup",w)}}}function xt(e,t,r,n,i){try{var o=t.clientX,l=t.clientY}catch(t){return!1}if(o>=Math.floor(fi(e.display.gutters).right))return!1;n&&Dn(t);var a=e.display,s=fi(a.lineDiv);if(l>s.bottom||!qn(e,r))return Pn(t);l-=s.top-a.viewOffset;for(var c=0;c<e.options.gutters.length;++c){var u=a.gutters.childNodes[c];if(u&&fi(u).right>=o){var f=xn(e.doc,l),d=e.options.gutters[c];return i(e,r,e,f,d,t),Pn(t)}}}function wt(e,t){return qn(e,"gutterContextMenu")?xt(e,t,"gutterContextMenu",!1,Gn):!1}function kt(e,t){return xt(e,t,"gutterClick",!0,jn)}function Ct(e){var t=this;if(!(Kn(t,e)||vt(t.display,e)||t.options.onDragEvent&&t.options.onDragEvent(t,Hn(e)))){Dn(e),Ai&&(eo=+new Date);var r=yt(t,e,!0),n=e.dataTransfer.files;if(r&&!mt(t))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,a=function(e,n){var a=new FileReader;a.onload=function(){o[n]=a.result,++l==i&&(r=Qt(t.doc,r),Vt(t.doc,{from:r,to:r,text:Do(o.join("\n")),origin:"paste"},"around"))},a.readAsText(e)},s=0;i>s;++s)a(n[s],s);else{if(t.state.draggingText&&!Xt(r,t.doc.sel.from)&&!Xt(t.doc.sel.to,r))return t.state.draggingText(e),void setTimeout(ii(pt,t),20);try{var o=e.dataTransfer.getData("Text");if(o){var c=t.doc.sel.from,u=t.doc.sel.to;nr(t.doc,r,r),t.state.draggingText&&Ut(t.doc,"",c,u,"paste"),t.replaceSelection(o,null,"paste"),pt(t)}}catch(e){}}}}function Lt(e,t){if(Ai&&(!e.state.draggingText||+new Date-eo<100))return void Fn(t);if(!Kn(e,t)&&!vt(e.display,t)){var r=e.getSelection();if(t.dataTransfer.setData("Text",r),t.dataTransfer.setDragImage&&!Ii){var n=ai("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",Di&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),Di&&n.parentNode.removeChild(n)}}}function Mt(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,Ti||b(e,[],t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbarV.scrollTop!=t&&(e.display.scrollbarV.scrollTop=t),Ti&&b(e,[]),O(e,100))}function St(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,m(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbarH.scrollLeft!=t&&(e.display.scrollbarH.scrollLeft=t))}function Tt(e,t){var r=t.wheelDeltaX,n=t.wheelDeltaY;null==r&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(r=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta);var i=e.display,o=i.scroller;if(r&&o.scrollWidth>o.clientWidth||n&&o.scrollHeight>o.clientHeight){if(n&&Gi&&Oi)for(var l=t.target;l!=o;l=l.parentNode)if(l.lineObj){e.display.currentWheelTarget=l;break}if(r&&!Ti&&!Di&&null!=ro)return n&&Mt(e,Math.max(0,Math.min(o.scrollTop+n*ro,o.scrollHeight-o.clientHeight))),St(e,Math.max(0,Math.min(o.scrollLeft+r*ro,o.scrollWidth-o.clientWidth))),Dn(t),void(i.wheelStartX=null);if(n&&null!=ro){var a=n*ro,s=e.doc.scrollTop,c=s+i.wrapper.clientHeight;0>a?s=Math.max(0,s+a-50):c=Math.min(e.doc.height,c+a+50),b(e,[],{top:s,bottom:c})}20>to&&(null==i.wheelStartX?(i.wheelStartX=o.scrollLeft,i.wheelStartY=o.scrollTop,i.wheelDX=r,i.wheelDY=n,setTimeout(function(){if(null!=i.wheelStartX){var e=o.scrollLeft-i.wheelStartX,t=o.scrollTop-i.wheelStartY,r=t&&i.wheelDY&&t/i.wheelDY||e&&i.wheelDX&&e/i.wheelDX;i.wheelStartX=i.wheelStartY=null,r&&(ro=(ro*to+r)/(to+1),++to)}},200)):(i.wheelDX+=r,i.wheelDY+=n))}}function At(e,t,r){if("string"==typeof t&&(t=go[t],!t))return!1;e.display.pollingFast&&dt(e)&&(e.display.pollingFast=!1);var n=e.doc,i=n.sel.shift,o=!1;try{mt(e)&&(e.state.suppressEdits=!0),r&&(n.sel.shift=!1),o=t(e)!=Ao}finally{n.sel.shift=i,e.state.suppressEdits=!1}return o}function Nt(e){var t=e.state.keyMaps.slice(0);return e.options.extraKeys&&t.push(e.options.extraKeys),t.push(e.options.keyMap),t}function zt(e,t){var r=wr(e.options.keyMap),n=r.auto;clearTimeout(no),n&&!Cr(t)&&(no=setTimeout(function(){wr(e.options.keyMap)==r&&(e.options.keyMap=n.call?n.call(null,e):n,l(e))},50));var i=Lr(t,!0),o=!1;if(!i)return!1;var a=Nt(e);return o=t.shiftKey?kr("Shift-"+i,a,function(t){return At(e,t,!0)})||kr(i,a,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?At(e,t):void 0}):kr(i,a,function(t){return At(e,t)}),o&&(Dn(t),E(e),zi&&(t.oldKeyCode=t.keyCode,t.keyCode=0),jn(e,"keyHandled",e,i,t)),o}function Et(e,t,r){var n=kr("'"+r+"'",Nt(e),function(t){return At(e,t,!0)});return n&&(Dn(t),E(e),jn(e,"keyHandled",e,"'"+r+"'",t)),n}function Ot(e){var t=this;if(t.state.focused||Ht(t),!(Kn(t,e)||t.options.onKeyEvent&&t.options.onKeyEvent(t,Hn(e)))){Ai&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.doc.sel.shift=16==r||e.shiftKey;var n=zt(t,e);Di&&(io=n?r:null,!n&&88==r&&!Po&&(Gi?e.metaKey:e.ctrlKey)&&t.replaceSelection(""))}}function Wt(e){var t=this;if(!(Kn(t,e)||t.options.onKeyEvent&&t.options.onKeyEvent(t,Hn(e)))){var r=e.keyCode,n=e.charCode;if(Di&&r==io)return io=null,void Dn(e);if(!(Di&&(!e.which||e.which<10)||Pi)||!zt(t,e)){var i=String.fromCharCode(null==n?r:n);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!mt(this)&&this.doc.mode.electricChars.indexOf(i)>-1&&setTimeout(lt(t,function(){dr(t,t.doc.sel.to.line,"smart")}),75),Et(t,e,i)||(Ai&&!zi&&(t.display.inputHasSelection=null),ft(t))}}}function Ht(e){"nocursor"!=e.options.readOnly&&(e.state.focused||(Gn(e,"focus",e),e.state.focused=!0,-1==e.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(e.display.wrapper.className+=" CodeMirror-focused"),e.curOp||(ht(e,!0),Oi&&setTimeout(ii(ht,e,!0),0))),ut(e),E(e))}function Dt(e){e.state.focused&&(Gn(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 It(e,t){function r(){if(null!=i.input.selectionStart){var e=i.input.value=""+($t(o.from,o.to)?"":i.input.value);i.prevInput="",i.input.selectionStart=1,i.input.selectionEnd=e.length}}function n(){if(i.inputDiv.style.position="relative",i.input.style.cssText=c,zi&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=a),ut(e),null!=i.input.selectionStart){(!Ai||zi)&&r(),clearTimeout(oo);var t=0,n=function(){" "==i.prevInput&&0==i.input.selectionStart?lt(e,go.selectAll)(e):t++<10?oo=setTimeout(n,500):ht(e)};oo=setTimeout(n,200)}}if(!Kn(e,t,"contextmenu")){var i=e.display,o=e.doc.sel;if(!vt(i,t)&&!wt(e,t)){var l=yt(e,t),a=i.scroller.scrollTop;if(l&&!Di){var s=e.options.resetSelectionOnContextMenu;s&&($t(o.from,o.to)||Xt(l,o.from)||!Xt(l,o.to))&<(e,nr)(e.doc,l,l);var c=i.input.style.cssText;if(i.inputDiv.style.position="absolute",i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(t.clientY-5)+"px; left: "+(t.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);",pt(e),ht(e,!0),$t(o.from,o.to)&&(i.input.value=i.prevInput=" "),Ai&&!zi&&r(),qi){Fn(t);var u=function(){_n(window,"mouseup",u),setTimeout(n,20)};Rn(window,"mouseup",u)}else setTimeout(n,50)}}}}function Pt(e,t,r){if(!Xt(t.from,r))return Qt(e,r);var n=t.text.length-1-(t.to.line-t.from.line);if(r.line>t.to.line+n){var i=r.line-n,o=e.first+e.size-1;return i>o?qt(o,mn(e,o).text.length):Jt(r,mn(e,i).text.length)}if(r.line==t.to.line+n)return Jt(r,Qn(t.text).length+(1==t.text.length?t.from.ch:0)+mn(e,t.to.line).text.length-t.to.ch);var l=r.line-t.from.line;return Jt(r,t.text[l].length+(l?0:t.from.ch))}function Ft(e,t,r){if(r&&"object"==typeof r)return{anchor:Pt(e,t,r.anchor),head:Pt(e,t,r.head)};if("start"==r)return{anchor:t.from,head:t.from};var n=lo(t);if("around"==r)return{anchor:t.from,head:n};if("end"==r)return{anchor:n,head:n};var i=function(e){if(Xt(e,t.from))return e;if(!Xt(t.to,e))return n;var r=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=n.ch-t.to.ch),qt(r,i)};return{anchor:i(e.sel.anchor),head:i(e.sel.head)}}function Bt(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(t,r,n,i){t&&(this.from=Qt(e,t)),r&&(this.to=Qt(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),Gn(e,"beforeChange",e,n),e.cm&&Gn(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Vt(e,t,r,n){if(e.cm){if(!e.cm.curOp)return lt(e.cm,Vt)(e,t,r,n);if(e.cm.state.suppressEdits)return}if(!(qn(e,"beforeChange")||e.cm&&qn(e.cm,"beforeChange"))||(t=Bt(e,t,!0))){var i=$i&&!n&&Pr(e,t.from,t.to);if(i){for(var o=i.length-1;o>=1;--o)Rt(e,{from:i[o].from,to:i[o].to,text:[""]});i.length&&Rt(e,{from:i[0].from,to:i[0].to,text:t.text},r)}else Rt(e,t,r)}}function Rt(e,t,r){if(1!=t.text.length||""!=t.text[0]||!$t(t.from,t.to)){var n=Ft(e,t,r);Sn(e,t,n,e.cm?e.cm.curOp.id:0/0),jt(e,t,n,Dr(e,t));var i=[];hn(e,function(e,r){r||-1!=ei(i,e.history)||(On(e.history,t),i.push(e.history)),jt(e,t,null,Dr(e,t))})}}function _t(e,t){if(!e.cm||!e.cm.state.suppressEdits){var r=e.history,n=("undo"==t?r.done:r.undone).pop();if(n){var i={changes:[],anchorBefore:n.anchorAfter,headBefore:n.headAfter,anchorAfter:n.anchorBefore,headAfter:n.headBefore,generation:r.generation};("undo"==t?r.undone:r.done).push(i),r.generation=n.generation||++r.maxGeneration;for(var o=qn(e,"beforeChange")||e.cm&&qn(e.cm,"beforeChange"),l=n.changes.length-1;l>=0;--l){var a=n.changes[l];if(a.origin=t,o&&!Bt(e,a,!1))return void(("undo"==t?r.done:r.undone).length=0);i.changes.push(Mn(e,a));var s=l?Ft(e,a,null):{anchor:n.anchorBefore,head:n.headBefore};jt(e,a,s,Ir(e,a));var c=[];hn(e,function(e,t){t||-1!=ei(c,e.history)||(On(e.history,a),c.push(e.history)),jt(e,a,null,Ir(e,a))})}}}}function Gt(e,t){function r(e){return qt(e.line+t,e.ch)}e.first+=t,e.cm&&ct(e.cm,e.first,e.first,t),e.sel.head=r(e.sel.head),e.sel.anchor=r(e.sel.anchor),e.sel.from=r(e.sel.from),e.sel.to=r(e.sel.to)}function jt(e,t,r,n){if(e.cm&&!e.cm.curOp)return lt(e.cm,jt)(e,t,r,n);if(t.to.line<e.first)return void Gt(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Gt(e,i),t={from:qt(e.first,0),to:qt(t.to.line+i,t.to.ch),text:[Qn(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:qt(o,mn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=gn(e,t.from,t.to),r||(r=Ft(e,t,null)),e.cm?Kt(e.cm,t,n,r):un(e,t,n,r)}}function Kt(e,t,r,n){var o=e.doc,l=e.display,a=t.from,s=t.to,c=!1,f=a.line;e.options.lineWrapping||(f=bn(Rr(o,mn(o,a.line))),o.iter(f,s.line+1,function(e){return e==l.maxLine?(c=!0,!0):void 0})),Xt(o.sel.head,t.from)||Xt(t.to,o.sel.head)||(e.curOp.cursorActivity=!0),un(o,t,r,n,i(e)),e.options.lineWrapping||(o.iter(f,a.line+t.text.length,function(e){var t=u(o,e);t>l.maxLineLength&&(l.maxLine=e,l.maxLineLength=t,l.maxLineChanged=!0,c=!1)}),c&&(e.curOp.updateMaxLine=!0)),o.frontier=Math.min(o.frontier,a.line),O(e,400);var d=t.text.length-(s.line-a.line)-1;if(ct(e,a.line,s.line+1,d),qn(e,"change")){var h={from:a,to:s,text:t.text,removed:t.removed,origin:t.origin};if(e.curOp.textChanged){for(var p=e.curOp.textChanged;p.next;p=p.next);p.next=h}else e.curOp.textChanged=h}}function Ut(e,t,r,n,i){if(n||(n=r),Xt(n,r)){var o=n;n=r,r=o}"string"==typeof t&&(t=Do(t)),Vt(e,{from:r,to:n,text:t,origin:i},null)}function qt(e,t){return this instanceof qt?(this.line=e,void(this.ch=t)):new qt(e,t)}function $t(e,t){return e.line==t.line&&e.ch==t.ch}function Xt(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function Yt(e){return qt(e.line,e.ch)}function Zt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Qt(e,t){if(t.line<e.first)return qt(e.first,0);var r=e.first+e.size-1;return t.line>r?qt(r,mn(e,r).text.length):Jt(t,mn(e,t.line).text.length)}function Jt(e,t){var r=e.ch;return null==r||r>t?qt(e.line,t):0>r?qt(e.line,0):e}function er(e,t){return t>=e.first&&t<e.first+e.size}function tr(e,t,r,n){if(e.sel.shift||e.sel.extend){var i=e.sel.anchor;if(r){var o=Xt(t,i);o!=Xt(r,i)?(i=t,t=r):o!=Xt(t,r)&&(t=r)}nr(e,i,t,n)}else nr(e,t,r||t,n);e.cm&&(e.cm.curOp.userSelChange=!0)}function rr(e,t,r){var n={anchor:t,head:r};return Gn(e,"beforeSelectionChange",e,n),e.cm&&Gn(e.cm,"beforeSelectionChange",e.cm,n),n.anchor=Qt(e,n.anchor),n.head=Qt(e,n.head),n}function nr(e,t,r,n,i){if(!i&&qn(e,"beforeSelectionChange")||e.cm&&qn(e.cm,"beforeSelectionChange")){var o=rr(e,t,r);r=o.head,t=o.anchor}var l=e.sel;if(l.goalColumn=null,null==n&&(n=Xt(r,l.head)?-1:1),(i||!$t(t,l.anchor))&&(t=or(e,t,n,"push"!=i)),(i||!$t(r,l.head))&&(r=or(e,r,n,"push"!=i)),!$t(l.anchor,t)||!$t(l.head,r)){l.anchor=t,l.head=r;var a=Xt(r,t);l.from=a?r:t,l.to=a?t:r,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=e.cm.curOp.cursorActivity=!0),jn(e,"cursorActivity",e)}}function ir(e){nr(e.doc,e.doc.sel.from,e.doc.sel.to,null,"push")}function or(e,t,r,n){var i=!1,o=t,l=r||1;e.cantEdit=!1;e:for(;;){var a=mn(e,o.line);if(a.markedSpans)for(var s=0;s<a.markedSpans.length;++s){var c=a.markedSpans[s],u=c.marker;if((null==c.from||(u.inclusiveLeft?c.from<=o.ch:c.from<o.ch))&&(null==c.to||(u.inclusiveRight?c.to>=o.ch:c.to>o.ch))){if(n&&(Gn(u,"beforeCursorEnter"),u.explicitlyCleared)){if(a.markedSpans){--s;continue}break}if(!u.atomic)continue;var f=u.find()[0>l?"from":"to"];if($t(f,o)&&(f.ch+=l,f.ch<0?f=f.line>e.first?Qt(e,qt(f.line-1)):null:f.ch>a.text.length&&(f=f.line<e.first+e.size-1?qt(f.line+1,0):null),!f)){if(i)return n?(e.cantEdit=!0,qt(e.first,0)):or(e,t,r,!0);i=!0,f=t,l=-l}o=f;continue e}}return o}}function lr(e){var t=ar(e,e.doc.sel.head,null,e.options.cursorScrollMargin);if(e.state.focused){var r=e.display,n=fi(r.sizer),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!Vi){var o="none"==r.cursor.style.display;o&&(r.cursor.style.display="",r.cursor.style.left=t.left+"px",r.cursor.style.top=t.top-r.viewOffset+"px"),r.cursor.scrollIntoView(i),o&&(r.cursor.style.display="none")}}}function ar(e,t,r,n){for(null==n&&(n=0);;){var i=!1,o=Q(e,t),l=r&&r!=t?Q(e,r):o,a=cr(e,Math.min(o.left,l.left),Math.min(o.top,l.top)-n,Math.max(o.left,l.left),Math.max(o.bottom,l.bottom)+n),s=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=a.scrollTop&&(Mt(e,a.scrollTop),Math.abs(e.doc.scrollTop-s)>1&&(i=!0)),null!=a.scrollLeft&&(St(e,a.scrollLeft),Math.abs(e.doc.scrollLeft-c)>1&&(i=!0)),!i)return o}}function sr(e,t,r,n,i){var o=cr(e,t,r,n,i);null!=o.scrollTop&&Mt(e,o.scrollTop),null!=o.scrollLeft&&St(e,o.scrollLeft)}function cr(e,t,r,n,i){var o=e.display,l=rt(e.display);0>r&&(r=0);var a=o.scroller.clientHeight-To,s=o.scroller.scrollTop,c={},u=e.doc.height+P(o),f=l>r,d=i>u-l;if(s>r)c.scrollTop=f?0:r;else if(i>s+a){var h=Math.min(r,(d?u:i)-a);h!=s&&(c.scrollTop=h)}var p=o.scroller.clientWidth-To,m=o.scroller.scrollLeft;t+=o.gutters.offsetWidth,n+=o.gutters.offsetWidth;var g=o.gutters.offsetWidth,v=g+10>t;return m+g>t||v?(v&&(t=0),c.scrollLeft=Math.max(0,t-10-g)):n>p+m-3&&(c.scrollLeft=n+10-p),c}function ur(e,t,r){e.curOp.updateScrollPos={scrollLeft:null==t?e.doc.scrollLeft:t,scrollTop:null==r?e.doc.scrollTop:r}}function fr(e,t,r){var n=e.curOp.updateScrollPos||(e.curOp.updateScrollPos={scrollLeft:e.doc.scrollLeft,scrollTop:e.doc.scrollTop}),i=e.display.scroller;n.scrollTop=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,n.scrollTop+r)),n.scrollLeft=Math.max(0,Math.min(i.scrollWidth-i.clientWidth,n.scrollLeft+t))}function dr(e,t,r,n){var i=e.doc;if(null==r&&(r="add"),"smart"==r)if(e.doc.mode.indent)var o=D(e,t);else r="prev";var l=e.options.tabSize,a=mn(i,t),s=Yn(a.text,null,l),c=a.text.match(/^\s*/)[0],u;if("smart"==r&&(u=e.doc.mode.indent(o,a.text.slice(c.length),a.text),u==Ao)){if(!n)return;r="prev"}"prev"==r?u=t>i.first?Yn(mn(i,t-1).text,null,l):0:"add"==r?u=s+e.options.indentUnit:"subtract"==r?u=s-e.options.indentUnit:"number"==typeof r&&(u=s+r),u=Math.max(0,u);var f="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(u/l);h;--h)d+=l,f+=" ";u>d&&(f+=Zn(u-d)),f!=c?Ut(e.doc,f,qt(t,0),qt(t,c.length),"+input"):i.sel.head.line==t&&i.sel.head.ch<c.length&&nr(i,qt(t,c.length),qt(t,c.length),1),a.stateAfter=null}function hr(e,t,r){var n=t,i=t,o=e.doc;return"number"==typeof t?i=mn(o,Zt(o,t)):n=bn(t),null==n?null:r(i,n)?(ct(e,n,n+1),i):null}function pr(e,t,r,n,i){function o(){var t=a+r;return t<e.first||t>=e.first+e.size?f=!1:(a=t,u=mn(e,t))}function l(e){var t=(i?Mi:Si)(u,s,r,!0);if(null==t){if(e||!o())return f=!1;s=i?(0>r?bi:yi)(u):0>r?u.text.length:0}else s=t;return!0}var a=t.line,s=t.ch,c=r,u=mn(e,a),f=!0;if("char"==n)l();else if("column"==n)l(!0);else if("word"==n||"group"==n)for(var d=null,h="group"==n,p=!0;!(0>r)||l(!p);p=!1){var m=u.text.charAt(s)||"\n",g=oi(m)?"w":h?/\s/.test(m)?null:"p":null;if(d&&d!=g){0>r&&(r=1,l());break}if(g&&(d=g),r>0&&!l(!p))break}var v=or(e,qt(a,s),c,!0);return f||(v.hitSide=!0),v}function mr(e,t,r,n){var i=e.doc,o=t.left,l;if("page"==n){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);l=t.top+r*(a-(0>r?1.5:.5)*rt(e.display))}else"line"==n&&(l=r>0?t.bottom+3:t.top-3);for(;;){var s=et(e,o,l);if(!s.outside)break;if(0>r?0>=l:l>=i.height){s.hitSide=!0;break}l+=5*r}return s}function gr(e,t){var r=t.ch,n=t.ch;if(e){(t.xRel<0||n==e.length)&&r?--r:++n;for(var i=e.charAt(r),o=oi(i)?oi:/\s/.test(i)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!oi(e)};r>0&&o(e.charAt(r-1));)--r;for(;n<e.length&&o(e.charAt(n));)++n}return{from:qt(t.line,r),to:qt(t.line,n)}}function vr(e,t){tr(e.doc,qt(t,0),Qt(e.doc,qt(t+1,0)))}function yr(t,r,n,i){e.defaults[t]=r,n&&(ao[t]=i?function(e,t,r){r!=co&&n(e,t,r)}:n)}function br(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function xr(e,t,r){return e.startState?e.startState(t,r):!0}function wr(e){return"string"==typeof e?vo[e]:e}function kr(e,t,r){function n(t){t=wr(t);var i=t[e];if(i===!1)return"stop";if(null!=i&&r(i))return!0;if(t.nofallthrough)return"stop";var o=t.fallthrough;if(null==o)return!1;if("[object Array]"!=Object.prototype.toString.call(o))return n(o);for(var l=0,a=o.length;a>l;++l){var s=n(o[l]);if(s)return s}return!1}for(var i=0;i<t.length;++i){var o=n(t[i]);if(o)return"stop"!=o}}function Cr(e){var t=Fo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Lr(e,t){if(Di&&34==e.keyCode&&e["char"])return!1;var r=Fo[e.keyCode];return null==r||e.altGraphKey?!1:(e.altKey&&(r="Alt-"+r),(Ui?e.metaKey:e.ctrlKey)&&(r="Ctrl-"+r),(Ui?e.ctrlKey:e.metaKey)&&(r="Cmd-"+r),!t&&e.shiftKey&&(r="Shift-"+r),r)}function Mr(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0}function Sr(e,t){this.lines=[],this.type=t,this.doc=e}function Tr(e,t,r,n,i){if(n&&n.shared)return Nr(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return lt(e.cm,Tr)(e,t,r,n,i);var o=new Sr(e,i);if(Xt(r,t)||$t(t,r)&&"range"==i&&(!n.inclusiveLeft||!n.inclusiveRight))return o;n&&ri(n,o),o.replacedWith&&(o.collapsed=!0,o.replacedWith=ai("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||(o.replacedWith.ignoreEvents=!0)),o.collapsed&&(Xi=!0),o.addToHistory&&Sn(e,{from:t,to:r,origin:"markText"},{head:e.sel.head,anchor:e.sel.anchor},0/0);var l=t.line,a=0,s,c,u=e.cm,f;if(e.iter(l,r.line+1,function(n){u&&o.collapsed&&!u.options.lineWrapping&&Rr(e,n)==u.display.maxLine&&(f=!0);var i={from:null,to:null,marker:o};a+=n.text.length,l==t.line&&(i.from=t.ch,a-=t.ch),l==r.line&&(i.to=r.ch,a-=n.text.length-r.ch),o.collapsed&&(l==r.line&&(c=Fr(n,r.ch)),l==t.line?s=Fr(n,t.ch):yn(n,0)),Or(n,i),++l}),o.collapsed&&e.iter(t.line,r.line+1,function(t){_r(e,t)&&yn(t,0)}),o.clearOnEnter&&Rn(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&($i=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed){if(s!=c)throw new Error("Inserting collapsed marker overlapping an existing one");o.size=a,o.atomic=!0}return u&&(f&&(u.curOp.updateMaxLine=!0),(o.className||o.title||o.startStyle||o.endStyle||o.collapsed)&&ct(u,t.line,r.line+1),o.atomic&&ir(u)),o}function Ar(e,t){this.markers=e,this.primary=t;for(var r=0,n=this;r<e.length;++r)e[r].parent=this,Rn(e[r],"clear",function(){n.clear()})}function Nr(e,t,r,n,i){n=ri(n),n.shared=!1;var o=[Tr(e,t,r,n,i)],l=o[0],a=n.replacedWith;return hn(e,function(e){a&&(n.replacedWith=a.cloneNode(!0)),o.push(Tr(e,Qt(e,t),Qt(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;l=Qn(o)}),new Ar(o,l)}function zr(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Er(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Or(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Wr(e,t,r){if(e)for(var n=0,i;n<e.length;++n){var o=e[n],l=o.marker,a=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);if(a||(l.inclusiveLeft&&l.inclusiveRight||"bookmark"==l.type)&&o.from==t&&(!r||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(i||(i=[])).push({from:o.from,to:s?null:o.to,marker:l})}}return i}function Hr(e,t,r){if(e)for(var n=0,i;n<e.length;++n){var o=e[n],l=o.marker,a=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);if(a||"bookmark"==l.type&&o.from==t&&(!r||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(i||(i=[])).push({from:s?null:o.from-t,to:null==o.to?null:o.to-t,marker:l})}}return i}function Dr(e,t){var r=er(e,t.from.line)&&mn(e,t.from.line).markedSpans,n=er(e,t.to.line)&&mn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=$t(t.from,t.to),a=Wr(r,i,l),s=Hr(n,o,l),c=1==t.text.length,u=Qn(t.text).length+(c?i:0);if(a)for(var f=0;f<a.length;++f){var d=a[f];if(null==d.to){var h=zr(s,d.marker);h?c&&(d.to=null==h.to?null:h.to+u):d.to=i}}if(s)for(var f=0;f<s.length;++f){var d=s[f];if(null!=d.to&&(d.to+=u),null==d.from){var h=zr(a,d.marker);h||(d.from=u,c&&(a||(a=[])).push(d))}else d.from+=u,c&&(a||(a=[])).push(d)}if(c&&a){for(var f=0;f<a.length;++f)null!=a[f].from&&a[f].from==a[f].to&&"bookmark"!=a[f].marker.type&&a.splice(f--,1);a.length||(a=null)}var p=[a];if(!c){var m=t.text.length-2,g;if(m>0&&a)for(var f=0;f<a.length;++f)null==a[f].to&&(g||(g=[])).push({from:null,to:null,marker:a[f].marker});for(var f=0;m>f;++f)p.push(g);p.push(s)}return p}function Ir(e,t){var r=An(e,t),n=Dr(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)e:for(var a=0;a<l.length;++a){for(var s=l[a],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else l&&(r[i]=l)}return r}function Pr(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=ei(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var l=n[o],a=l.find(),s=0;s<i.length;++s){var c=i[s];if(!Xt(c.to,a.from)&&!Xt(a.to,c.from)){var u=[s,1];(Xt(c.from,a.from)||!l.inclusiveLeft&&$t(c.from,a.from))&&u.push({from:c.from,to:a.from}),(Xt(a.to,c.to)||!l.inclusiveRight&&$t(c.to,a.to))&&u.push({from:a.to,to:c.to}),i.splice.apply(i,u),s+=u.length-1}}return i}function Fr(e,t){var r=Xi&&e.markedSpans,n;if(r)for(var i,o=0;o<r.length;++o)i=r[o],i.marker.collapsed&&(null==i.from||i.from<t)&&(null==i.to||i.to>t)&&(!n||n.width<i.marker.width)&&(n=i.marker);return n}function Br(e){return Fr(e,-1)}function Vr(e){return Fr(e,e.text.length+1)}function Rr(e,t){for(var r;r=Br(t);)t=mn(e,r.find().from.line);return t}function _r(e,t){var r=Xi&&t.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.replacedWith&&0==n.from&&n.marker.inclusiveLeft&&Gr(e,t,n))return!0}}function Gr(e,t,r){if(null==r.to){var n=r.marker.find().to,i=mn(e,n.line);return Gr(e,i,zr(i.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var o,l=0;l<t.markedSpans.length;++l)if(o=t.markedSpans[l],o.marker.collapsed&&!o.marker.replacedWith&&o.from==r.to&&(o.marker.inclusiveLeft||r.marker.inclusiveRight)&&Gr(e,t,o))return!0}function jr(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function Kr(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Ur(e){return function(){var t=!this.cm.curOp;t&&it(this.cm);try{var r=e.apply(this,arguments)}finally{t&&ot(this.cm)}return r}}function qr(e){return null!=e.height?e.height:(e.node.parentNode&&1==e.node.parentNode.nodeType||ci(e.cm.display.measure,ai("div",[e.node],null,"position: relative")),e.height=e.node.offsetHeight)}function $r(e,t,r,n){var i=new yo(e,r,n);return i.noHScroll&&(e.display.alignWidgets=!0),hr(e,t,function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,!_r(e.doc,t)||i.showIfHidden){var n=wn(e,t)<e.doc.scrollTop;yn(t,t.height+qr(i)),n&&fr(e,0,i.height)}return!0}),i}function Xr(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),jr(e),Kr(e,r);var i=n?n(e):1;i!=e.height&&yn(e,i)}function Yr(e){e.parent=null,jr(e)}function Zr(e,t,r,n,i,o){var l=r.flattenSpans;null==l&&(l=e.options.flattenSpans);var a=0,s=null,c=new Mr(t,e.options.tabSize),u;for(""==t&&r.blankLine&&r.blankLine(n);!c.eol();)c.pos>e.options.maxHighlightLength?(l=!1,o&&en(e,t,n,c.pos),c.pos=t.length,u=null):u=r.token(c,n),l&&s==u||(a<c.start&&i(c.start,s),a=c.start,s=u),c.start=c.pos;for(;a<c.pos;){var f=Math.min(c.pos,a+5e4);i(f,s),a=f
|
3 |
-
}}function Qr(e,t,r,n){var i=[e.state.modeGen];Zr(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},n);for(var o=0;o<e.state.overlays.length;++o){var l=e.state.overlays[o],a=1,s=0;Zr(e,t.text,l.mode,!0,function(e,t){for(var r=a;e>s;){var n=i[a];n>e&&i.splice(a,1,e,i[a+1],n),a+=2,s=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,a-r,e,t),a=r+2;else for(;a>r;r+=2){var o=i[r+1];i[r+1]=o?o+" "+t:t}})}return i}function Jr(e,t){return t.styles&&t.styles[0]==e.state.modeGen||(t.styles=Qr(e,t,t.stateAfter=D(e,bn(t)))),t.styles}function en(e,t,r,n){var i=e.doc.mode,o=new Mr(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&i.blankLine&&i.blankLine(r);!o.eol()&&o.pos<=e.options.maxHighlightLength;)i.token(o,r),o.start=o.pos}function tn(e,t){if(!e)return null;for(;;){var r=e.match(/(?:^|\s)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return xo[e]||(xo[e]="cm-"+e.replace(/ +/g," cm-"))}function rn(e,t,r,n){for(var i,o=t,l=!0;i=Br(o);)o=mn(e.doc,i.find().from.line);var a={pre:ai("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:e,copyWidgets:n};do{o.text&&(l=!1),a.measure=o==t&&r,a.pos=0,a.addToken=a.measure?ln:on,(Ai||Oi)&&e.getOption("lineWrapping")&&(a.addToken=an(a.addToken));var s=cn(o,a,Jr(e,o));r&&o==t&&!a.measuredSomething&&(r[0]=a.pre.appendChild(pi(e.display.measure)),a.measuredSomething=!0),s&&(o=mn(e.doc,s.to.line))}while(s);!r||a.measuredSomething||r[0]||(r[0]=a.pre.appendChild(l?ai("span"," "):pi(e.display.measure))),a.pre.firstChild||_r(e.doc,t)||a.pre.appendChild(document.createTextNode(" "));var c;if(r&&(Ai||Ei)&&(c=kn(o))){var u=c.length-1;c[u].from==c[u].to&&--u;var f=c[u],d=c[u-1];if(f.from+1==f.to&&d&&f.level<d.level){var h=r[a.pos-1];h&&h.parentNode.insertBefore(h.measureRight=pi(e.display.measure),h.nextSibling)}}var p=a.textClass?a.textClass+" "+(t.textClass||""):t.textClass;return p&&(a.pre.className=p),Gn(e,"renderLine",e,t,a.pre),a}function nn(e){var t=ai("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t}function on(e,t,r,n,i,o){if(t){var l=e.cm.options.specialChars;if(l.test(t))for(var a=document.createDocumentFragment(),s=0;;){l.lastIndex=s;var c=l.exec(t),u=c?c.index-s:t.length-s;if(u&&(a.appendChild(document.createTextNode(t.slice(s,s+u))),e.col+=u),!c)break;if(s+=u+1," "==c[0]){var f=e.cm.options.tabSize,d=f-e.col%f;a.appendChild(ai("span",Zn(d),"cm-tab")),e.col+=d}else{var h=e.cm.options.specialCharPlaceholder(c[0]);a.appendChild(h),e.col+=1}}else{e.col+=t.length;var a=document.createTextNode(t)}if(r||n||i||e.measure){var p=r||"";n&&(p+=n),i&&(p+=i);var h=ai("span",[a],p);return o&&(h.title=o),e.pre.appendChild(h)}e.pre.appendChild(a)}}function ln(e,t,r,n,i){for(var o=e.cm.options.lineWrapping,l=0;l<t.length;++l){var a=t.charAt(l),s=0==l;a>="���"&&"���">a&&l<t.length-1?(a=t.slice(l,l+2),++l):l&&o&&di(t,l)&&e.pre.appendChild(ai("wbr"));var c=e.measure[e.pos],u=e.measure[e.pos]=on(e,a,r,s&&n,l==t.length-1&&i);c&&(u.leftSide=c.leftSide||c),Ai&&o&&" "==a&&l&&!/\s/.test(t.charAt(l-1))&&l<t.length-1&&!/\s/.test(t.charAt(l+1))&&(u.style.whiteSpace="normal"),e.pos+=a.length}t.length&&(e.measuredSomething=!0)}function an(e){function t(e){for(var t=" ",r=0;r<e.length-2;++r)t+=r%2?" ":" ";return t+=" "}return function(r,n,i,o,l,a){return e(r,n.replace(/ {3,}/g,t),i,o,l,a)}}function sn(e,t,r,n){var i=!n&&r.replacedWith;if(i&&(e.copyWidgets&&(i=i.cloneNode(!0)),e.pre.appendChild(i),e.measure)){if(t)e.measure[e.pos]=i;else{var o=pi(e.cm.display.measure);if("bookmark"!=r.type||r.insertLeft){if(e.measure[e.pos])return;e.measure[e.pos]=e.pre.insertBefore(o,i)}else e.measure[e.pos]=e.pre.appendChild(o)}e.measuredSomething=!0}e.pos+=t}function cn(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l=i.length,a=0,s=1,c="",u,f=0,d,h,p,m,g;;){if(f==a){d=h=p=m="",g=null,f=1/0;for(var v=[],y=0;y<n.length;++y){var b=n[y],x=b.marker;b.from<=a&&(null==b.to||b.to>a)?(null!=b.to&&f>b.to&&(f=b.to,h=""),x.className&&(d+=" "+x.className),x.startStyle&&b.from==a&&(p+=" "+x.startStyle),x.endStyle&&b.to==f&&(h+=" "+x.endStyle),x.title&&!m&&(m=x.title),x.collapsed&&(!g||g.marker.size<x.size)&&(g=b)):b.from>a&&f>b.from&&(f=b.from),"bookmark"==x.type&&b.from==a&&x.replacedWith&&v.push(x)}if(g&&(g.from||0)==a&&(sn(t,(null==g.to?l:g.to)-a,g.marker,null==g.from),null==g.to))return g.marker.find();if(!g&&v.length)for(var y=0;y<v.length;++y)sn(t,0,v[y])}if(a>=l)break;for(var w=Math.min(l,f);;){if(c){var k=a+c.length;if(!g){var C=k>w?c.slice(0,w-a):c;t.addToken(t,C,u?u+d:d,p,a+C.length==f?h:"",m)}if(k>=w){c=c.slice(w-a),a=w;break}a=k,p=""}c=i.slice(o,o=r[s++]),u=tn(r[s++],t)}}else for(var s=1;s<r.length;s+=2)t.addToken(t,i.slice(o,o=r[s]),tn(r[s+1],t))}function un(e,t,r,n,i){function o(e){return r?r[e]:null}function l(e,r,n){Xr(e,r,n,i),jn(e,"change",e,t)}var a=t.from,s=t.to,c=t.text,u=mn(e,a.line),f=mn(e,s.line),d=Qn(c),h=o(c.length-1),p=s.line-a.line;if(0!=a.ch||0!=s.ch||""!=d||e.cm&&!e.cm.options.wholeLineUpdateBefore)if(u==f)if(1==c.length)l(u,u.text.slice(0,a.ch)+d+u.text.slice(s.ch),h);else{for(var m=[],g=1,v=c.length-1;v>g;++g)m.push(new bo(c[g],o(g),i));m.push(new bo(d+u.text.slice(s.ch),h,i)),l(u,u.text.slice(0,a.ch)+c[0],o(0)),e.insert(a.line+1,m)}else if(1==c.length)l(u,u.text.slice(0,a.ch)+c[0]+f.text.slice(s.ch),o(0)),e.remove(a.line+1,p);else{l(u,u.text.slice(0,a.ch)+c[0],o(0)),l(f,d+f.text.slice(s.ch),h);for(var g=1,v=c.length-1,m=[];v>g;++g)m.push(new bo(c[g],o(g),i));p>1&&e.remove(a.line+1,p-1),e.insert(a.line+1,m)}else{for(var g=0,v=c.length-1,m=[];v>g;++g)m.push(new bo(c[g],o(g),i));l(f,f.text,h),p&&e.remove(a.line,p),m.length&&e.insert(a.line,m)}jn(e,"change",e,t),nr(e,n.anchor,n.head,null,!0)}function fn(e){this.lines=e,this.parent=null;for(var t=0,r=e.length,n=0;r>t;++t)e[t].parent=this,n+=e[t].height;this.height=n}function dn(e){this.children=e;for(var t=0,r=0,n=0,i=e.length;i>n;++n){var o=e[n];t+=o.chunkSize(),r+=o.height,o.parent=this}this.size=t,this.height=r,this.parent=null}function hn(e,t,r){function n(e,i,o){if(e.linked)for(var l=0;l<e.linked.length;++l){var a=e.linked[l];if(a.doc!=i){var s=o&&a.sharedHist;(!r||s)&&(t(a.doc,s),n(a.doc,e,s))}}}n(e,null,!0)}function pn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,o(e),r(e),e.options.lineWrapping||f(e),e.options.mode=t.modeOption,ct(e)}function mn(e,t){for(t-=e.first;!e.lines;)for(var r=0;;++r){var n=e.children[r],i=n.chunkSize();if(i>t){e=n;break}t-=i}return e.lines[t]}function gn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function vn(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function yn(e,t){for(var r=t-e.height,n=e;n;n=n.parent)n.height+=r}function bn(e){if(null==e.parent)return null;for(var t=e.parent,r=ei(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function xn(e,t){var r=e.first;e:do{for(var n=0,i=e.children.length;i>n;++n){var o=e.children[n],l=o.height;if(l>t){e=o;continue e}t-=l,r+=o.chunkSize()}return r}while(!e.lines);for(var n=0,i=e.lines.length;i>n;++n){var a=e.lines[n],s=a.height;if(s>t)break;t-=s}return r+n}function wn(e,t){t=Rr(e.doc,t);for(var r=0,n=t.parent,i=0;i<n.lines.length;++i){var o=n.lines[i];if(o==t)break;r+=o.height}for(var l=n.parent;l;n=l,l=n.parent)for(var i=0;i<l.children.length;++i){var a=l.children[i];if(a==n)break;r+=a.height}return r}function kn(e){var t=e.order;return null==t&&(t=e.order=Vo(e.text)),t}function Cn(e){return{done:[],undone:[],undoDepth:1/0,lastTime:0,lastOp:null,lastOrigin:null,generation:e||1,maxGeneration:e||1}}function Ln(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function Mn(e,t){var r={line:t.from.line,ch:t.from.ch},n={from:r,to:lo(t),text:gn(e,t.from,t.to)};return Ln(e,n,t.from.line,t.to.line+1),hn(e,function(e){Ln(e,n,t.from.line,t.to.line+1)},!0),n}function Sn(e,t,r,n){var i=e.history;i.undone.length=0;var o=+new Date,l=Qn(i.done);if(l&&(i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastTime>o-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))){var a=Qn(l.changes);$t(t.from,t.to)&&$t(t.from,a.to)?a.to=lo(t):l.changes.push(Mn(e,t)),l.anchorAfter=r.anchor,l.headAfter=r.head}else for(l={changes:[Mn(e,t)],generation:i.generation,anchorBefore:e.sel.anchor,headBefore:e.sel.head,anchorAfter:r.anchor,headAfter:r.head},i.done.push(l),i.generation=++i.maxGeneration;i.done.length>i.undoDepth;)i.done.shift();i.lastTime=o,i.lastOp=n,i.lastOrigin=t.origin}function Tn(e){if(!e)return null;for(var t=0,r;t<e.length;++t)e[t].marker.explicitlyCleared?r||(r=e.slice(0,t)):r&&r.push(e[t]);return r?r.length?r:null:e}function An(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(Tn(r[n]));return i}function Nn(e,t){for(var r=0,n=[];r<e.length;++r){var i=e[r],o=i.changes,l=[];n.push({changes:l,anchorBefore:i.anchorBefore,headBefore:i.headBefore,anchorAfter:i.anchorAfter,headAfter:i.headAfter});for(var a=0;a<o.length;++a){var s=o[a],c;if(l.push({from:s.from,to:s.to,text:s.text}),t)for(var u in s)(c=u.match(/^spans_(\d+)$/))&&ei(t,Number(c[1]))>-1&&(Qn(l)[u]=s[u],delete s[u])}}return n}function zn(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function En(e,t,r,n){for(var i=0;i<e.length;++i){for(var o=e[i],l=!0,a=0;a<o.changes.length;++a){var s=o.changes[a];if(o.copied||(s.from=Yt(s.from),s.to=Yt(s.to)),r<s.from.line)s.from.line+=n,s.to.line+=n;else if(t<=s.to.line){l=!1;break}}o.copied||(o.anchorBefore=Yt(o.anchorBefore),o.headBefore=Yt(o.headBefore),o.anchorAfter=Yt(o.anchorAfter),o.readAfter=Yt(o.headAfter),o.copied=!0),l?(zn(o.anchorBefore),zn(o.headBefore),zn(o.anchorAfter),zn(o.headAfter)):(e.splice(0,i+1),i=0)}}function On(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;En(e.done,r,n,i),En(e.undone,r,n,i)}function Wn(){Fn(this)}function Hn(e){return e.stop||(e.stop=Wn),e}function Dn(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function In(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Pn(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Fn(e){Dn(e),In(e)}function Bn(e){return e.target||e.srcElement}function Vn(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Gi&&e.ctrlKey&&1==t&&(t=3),t}function Rn(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={}),i=n[t]||(n[t]=[]);i.push(r)}}function _n(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers&&e._handlers[t];if(!n)return;for(var i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}}}function Gn(e,t){var r=e._handlers&&e._handlers[t];if(r)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function jn(e,t){function r(e){return function(){e.apply(null,i)}}var n=e._handlers&&e._handlers[t];if(n){var i=Array.prototype.slice.call(arguments,2);Mo||(++So,Mo=[],setTimeout(Un,0));for(var o=0;o<n.length;++o)Mo.push(r(n[o]))}}function Kn(e,t,r){return Gn(e,r||t.type,e,t),Pn(t)||t.codemirrorIgnore}function Un(){--So;var e=Mo;Mo=null;for(var t=0;t<e.length;++t)e[t]()}function qn(e,t){var r=e._handlers&&e._handlers[t];return r&&r.length>0}function $n(e){e.prototype.on=function(e,t){Rn(this,e,t)},e.prototype.off=function(e,t){_n(this,e,t)}}function Xn(){this.id=null}function Yn(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=n||0,l=i||0;t>o;++o)" "==e.charAt(o)?l+=r-l%r:++l;return l}function Zn(e){for(;No.length<=e;)No.push(Qn(No)+" ");return No[e]}function Qn(e){return e[e.length-1]}function Jn(e){if(Ri)e.selectionStart=0,e.selectionEnd=e.value.length;else try{e.select()}catch(t){}}function ei(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;n>r;++r)if(e[r]==t)return r;return-1}function ti(e,t){function r(){}r.prototype=e;var n=new r;return t&&ri(t,n),n}function ri(e,t){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function ni(e){for(var t=[],r=0;e>r;++r)t.push(void 0);return t}function ii(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function oi(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||zo.test(e))}function li(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function ai(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)ui(i,t);else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function si(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function ci(e,t){return si(e).appendChild(t)}function ui(e,t){zi?(e.innerHTML="",e.appendChild(document.createTextNode(t))):e.textContent=t}function fi(e){return e.getBoundingClientRect()}function di(){return!1}function hi(e){if(null!=Wo)return Wo;var t=ai("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return ci(e,t),t.offsetWidth&&(Wo=t.offsetHeight-t.clientHeight),Wo||0}function pi(e){if(null==Ho){var t=ai("span","");ci(e,ai("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Ho=t.offsetWidth<=1&&t.offsetHeight>2&&!Ni)}return Ho?ai("span",""):ai("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function mi(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<r&&l.to>t||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function gi(e){return e.level%2?e.to:e.from}function vi(e){return e.level%2?e.from:e.to}function yi(e){var t=kn(e);return t?gi(t[0]):0}function bi(e){var t=kn(e);return t?vi(Qn(t)):e.text.length}function xi(e,t){var r=mn(e.doc,t),n=Rr(e.doc,r);n!=r&&(t=bn(n));var i=kn(n),o=i?i[0].level%2?bi(n):yi(n):0;return qt(t,o)}function wi(e,t){for(var r,n;r=Vr(n=mn(e.doc,t));)t=r.find().to.line;var i=kn(n),o=i?i[0].level%2?yi(n):bi(n):n.text.length;return qt(t,o)}function ki(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function Ci(e,t){for(var r=0,n;r<e.length;++r){var i=e[r];if(i.from<t&&i.to>t)return Bo=null,r;if(i.from==t||i.to==t){if(null!=n)return ki(e,i.level,e[n].level)?(Bo=n,r):(Bo=r,n);n=r}}return Bo=null,n}function Li(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Eo.test(e.text.charAt(t)));return t}function Mi(e,t,r,n){var i=kn(e);if(!i)return Si(e,t,r,n);for(var o=Ci(i,t),l=i[o],a=Li(e,t,l.level%2?-r:r,n);;){if(a>l.from&&a<l.to)return a;if(a==l.from||a==l.to)return Ci(i,a)==o?a:(l=i[o+=r],r>0==l.level%2?l.to:l.from);if(l=i[o+=r],!l)return null;a=r>0==l.level%2?Li(e,l.to,-1,n):Li(e,l.from,1,n)}}function Si(e,t,r,n){var i=t+r;if(n)for(;i>0&&Eo.test(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var Ti=/gecko\/\d/i.test(navigator.userAgent),Ai=/MSIE \d/.test(navigator.userAgent),Ni=Ai&&(null==document.documentMode||document.documentMode<8),zi=Ai&&(null==document.documentMode||document.documentMode<9),Ei=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),Oi=/WebKit\//.test(navigator.userAgent),Wi=Oi&&/Qt\/\d+\.\d+/.test(navigator.userAgent),Hi=/Chrome\//.test(navigator.userAgent),Di=/Opera\//.test(navigator.userAgent),Ii=/Apple Computer/.test(navigator.vendor),Pi=/KHTML\//.test(navigator.userAgent),Fi=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),Bi=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Vi=/PhantomJS/.test(navigator.userAgent),Ri=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),_i=Ri||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Gi=Ri||/Mac/.test(navigator.platform),ji=/win/i.test(navigator.platform),Ki=Di&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Ki&&(Ki=Number(Ki[1])),Ki&&Ki>=15&&(Di=!1,Oi=!0);var Ui=Gi&&(Wi||Di&&(null==Ki||12.11>Ki)),qi=Ti||Ai&&!zi,$i=!1,Xi=!1,Yi,Zi=0,Qi,Ji,eo=0,to=0,ro=null;Ai?ro=-.53:Ti?ro=15:Hi?ro=-.7:Ii&&(ro=-1/3);var no,io=null,oo,lo=e.changeEnd=function(e){return e.text?qt(e.from.line+e.text.length-1,Qn(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.Pos=qt,e.prototype={constructor:e,focus:function(){window.focus(),pt(this),ft(this)},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,ao.hasOwnProperty(e)&<(this,ao[e])(this,t,n))},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){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||"string"!=typeof t[r]&&t[r].name==e)return t.splice(r,1),!0},addOverlay:lt(null,function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:t,opaque:r&&r.opaque}),this.state.modeGen++,ct(this)}),removeOverlay:lt(null,function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void ct(this)}}),indentLine:lt(null,function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),er(this.doc,e)&&dr(this,e,t,r)}),indentSelection:lt(null,function(e){var t=this.doc.sel;if($t(t.from,t.to))return dr(this,t.from.line,e);for(var r=t.to.line-(t.to.ch?0:1),n=t.from.line;r>=n;++n)dr(this,n,e)}),getTokenAt:function(e,t){var r=this.doc;e=Qt(r,e);for(var n=D(this,e.line,t),i=this.doc.mode,o=mn(r,e.line),l=new Mr(o.text,this.options.tabSize);l.pos<e.ch&&!l.eol();){l.start=l.pos;var a=i.token(l,n)}return{start:l.start,end:l.pos,string:l.current(),className:a||null,type:a||null,state:n}},getTokenTypeAt:function(e){e=Qt(this.doc,e);var t=Jr(this,mn(this.doc,e.line)),r=0,n=(t.length-1)/2,i=e.ch;if(0==i)return t[2];for(;;){var o=r+n>>1;if((o?t[2*o-1]:0)>=i)n=o;else{if(!(t[2*o+1]<i))return t[2*o+2];r=o+1}}},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){if(mo.hasOwnProperty(t)){var r=mo[t],n=this.getModeAt(e);return n[t]&&r[n[t]]||n.helperType&&r[n.helperType]||r[n.name]}},getStateAfter:function(e,t){var r=this.doc;return e=Zt(r,null==e?r.first+r.size-1:e),D(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel;return r=null==e?n.head:"object"==typeof e?Qt(this.doc,e):e?n.from:n.to,Q(this,r,t||"page")},charCoords:function(e,t){return Z(this,Qt(this.doc,e),t||"page")},coordsChar:function(e,t){return e=Y(this,e,t||"page"),et(this,e.left,e.top)},lineAtHeight:function(e,t){return e=Y(this,{top:e,left:0},t||"page").top,xn(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r=!1,n=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>n&&(e=n,r=!0);var i=mn(this.doc,e);return X(this,mn(this.doc,e),{top:0,left:0},t||"page").top+(r?i.height:0)},defaultTextHeight:function(){return rt(this.display)},defaultCharWidth:function(){return nt(this.display)},setGutterMarker:lt(null,function(e,t,r){return hr(this,e,function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&li(n)&&(e.gutterMarkers=null),!0})}),clearGutter:lt(null,function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,ct(t,n,n+1),li(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),addLineClass:lt(null,function(e,t,r){return hr(this,e,function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"wrapClass";if(e[n]){if(new RegExp("(?:^|\\s)"+r+"(?:$|\\s)").test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:lt(null,function(e,t,r){return hr(this,e,function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(new RegExp("(?:^|\\s+)"+r+"(?:$|\\s+)"));if(!o)return!1;var l=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0})}),addLineWidget:lt(null,function(e,t,r){return $r(this,e,t,r)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if("number"==typeof e){if(!er(this.doc,e))return null;var t=e;if(e=mn(this.doc,e),!e)return null}else{var t=bn(e);if(null==t)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,r,n,i){var o=this.display;e=Q(this,Qt(this.doc,e));var l=e.bottom,a=e.left;if(t.style.position="absolute",o.sizer.appendChild(t),"over"==n)l=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(l=e.bottom),a+t.offsetWidth>c&&(a=c-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(a=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?a=0:"middle"==i&&(a=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=a+"px"),r&&sr(this,a,l,a+t.offsetWidth,l+t.offsetHeight)},triggerOnKeyDown:lt(null,Ot),execCommand:function(e){return go[e](this)},findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,l=Qt(this.doc,e);t>o&&(l=pr(this.doc,l,i,r,n),!l.hitSide);++o);return l},moveH:lt(null,function(e,t){var r=this.doc.sel,n;n=r.shift||r.extend||$t(r.from,r.to)?pr(this.doc,r.head,e,t,this.options.rtlMoveVisually):0>e?r.from:r.to,tr(this.doc,n,n,e)}),deleteH:lt(null,function(e,t){var r=this.doc.sel;$t(r.from,r.to)?Ut(this.doc,"",r.from,pr(this.doc,r.head,e,t,!1),"+delete"):Ut(this.doc,"",r.from,r.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var l=0,a=Qt(this.doc,e);t>l;++l){var s=Q(this,a,"div");if(null==o?o=s.left:s.left=o,a=mr(this,s,i,r),a.hitSide)break}return a},moveV:lt(null,function(e,t){var r=this.doc.sel,n=Q(this,r.head,"div");null!=r.goalColumn&&(n.left=r.goalColumn);var i=mr(this,n,e,t);"page"==t&&fr(this,0,Z(this,i,"div").top-n.top),tr(this.doc,i,i,e),r.goalColumn=n.left}),toggleOverwrite:function(e){(null==e||e!=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:lt(null,function(e,t){ur(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller,t=To;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-t,width:e.scrollWidth-t,clientHeight:e.clientHeight-t,clientWidth:e.clientWidth-t}},scrollIntoView:lt(null,function(e,t){null==e?e={from:this.doc.sel.head,to:null}:"number"==typeof e?e={from:qt(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),t||(t=0);var r=e;null!=e.from.line&&(this.curOp.scrollToPos={from:e.from,to:e.to,margin:t},r={from:Q(this,e.from),to:Q(this,e.to)});var n=cr(this,Math.min(r.from.left,r.to.left),Math.min(r.from.top,r.to.top)-t,Math.max(r.from.right,r.to.right),Math.max(r.from.bottom,r.to.bottom)+t);ur(this,n.scrollLeft,n.scrollTop)}),setSize:lt(null,function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(e){return st(this,e)},refresh:lt(null,function(){var e=null==this.display.cachedTextHeight;U(this),ur(this,this.doc.scrollLeft,this.doc.scrollTop),ct(this),e&&o(this)}),swapDoc:lt(null,function(e){var t=this.doc;return t.cm=null,pn(this,e),U(this),ht(this,!0),ur(this,e.scrollLeft,e.scrollTop),jn(this,"swapDoc",this,t),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}},$n(e);var ao=e.optionHandlers={},so=e.defaults={},co=e.Init={toString:function(){return"CodeMirror.Init"}};yr("value","",function(e,t){e.setValue(t)},!0),yr("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),yr("indentUnit",2,r,!0),yr("indentWithTabs",!1),yr("smartIndent",!0),yr("tabSize",4,function(e){r(e),U(e),ct(e)},!0),yr("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),yr("specialCharPlaceholder",nn,function(e){e.refresh()},!0),yr("electricChars",!0),yr("rtlMoveVisually",!ji),yr("wholeLineUpdateBefore",!0),yr("theme","default",function(e){a(e),s(e)},!0),yr("keyMap","default",l),yr("extraKeys",null),yr("onKeyEvent",null),yr("onDragEvent",null),yr("lineWrapping",!1,n,!0),yr("gutters",[],function(e){d(e.options),s(e)},!0),yr("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?y(e.display)+"px":"0",e.refresh()},!0),yr("coverGutterNextToScrollbar",!1,h,!0),yr("lineNumbers",!1,function(e){d(e.options),s(e)},!0),yr("firstLineNumber",1,s,!0),yr("lineNumberFormatter",function(e){return e},s,!0),yr("showCursorWhenSelecting",!1,A,!0),yr("resetSelectionOnContextMenu",!0),yr("readOnly",!1,function(e,t){"nocursor"==t?(Dt(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||ht(e,!0))}),yr("dragDrop",!0),yr("cursorBlinkRate",530),yr("cursorScrollMargin",0),yr("cursorHeight",1),yr("workTime",100),yr("workDelay",100),yr("flattenSpans",!0),yr("pollInterval",100),yr("undoDepth",40,function(e,t){e.doc.history.undoDepth=t}),yr("historyEventDelay",500),yr("viewportMargin",10,function(e){e.refresh()},!0),yr("maxHighlightLength",1e4,function(e){r(e),e.refresh()},!0),yr("crudeMeasuringFrom",1e4),yr("moveInputWithCursor",!0,function(e,t){t||(e.display.inputDiv.style.top=e.display.inputDiv.style.left=0)}),yr("tabindex",null,function(e,t){e.display.input.tabIndex=t||""}),yr("autofocus",null);var uo=e.modes={},fo=e.mimeModes={};e.defineMode=function(t,r){if(e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2){r.dependencies=[];for(var n=2;n<arguments.length;++n)r.dependencies.push(arguments[n])}uo[t]=r},e.defineMIME=function(e,t){fo[e]=t},e.resolveMode=function(t){if("string"==typeof t&&fo.hasOwnProperty(t))t=fo[t];else if(t&&"string"==typeof t.name&&fo.hasOwnProperty(t.name)){var r=fo[t.name];t=ti(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=uo[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(ho.hasOwnProperty(r.name)){var o=ho[r.name];for(var l in o)o.hasOwnProperty(l)&&(i.hasOwnProperty(l)&&(i["_"+l]=i[l]),i[l]=o[l])}return i.name=r.name,i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var ho=e.modeExtensions={};e.extendMode=function(e,t){var r=ho.hasOwnProperty(e)?ho[e]:ho[e]={};ri(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){ko.prototype[e]=t},e.defineOption=yr;var po=[];e.defineInitHook=function(e){po.push(e)};var mo=e.helpers={};e.registerHelper=function(t,r,n){mo.hasOwnProperty(t)||(mo[t]=e[t]={}),mo[t][r]=n},e.isWordChar=oi,e.copyState=br,e.startState=xr,e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var go=e.commands={selectAll:function(e){e.setSelection(qt(e.firstLine(),0),qt(e.lastLine()))},killLine:function(e){var t=e.getCursor(!0),r=e.getCursor(!1),n=!$t(t,r);n||e.getLine(t.line).length!=t.ch?e.replaceRange("",t,n?r:qt(t.line),"+delete"):e.replaceRange("",t,qt(t.line+1,0),"+delete")},deleteLine:function(e){var t=e.getCursor().line;e.replaceRange("",qt(t,0),qt(t),"+delete")},delLineLeft:function(e){var t=e.getCursor();e.replaceRange("",qt(t.line,0),t,"+delete")},undo:function(e){e.undo()},redo:function(e){e.redo()},goDocStart:function(e){e.extendSelection(qt(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(qt(e.lastLine()))},goLineStart:function(e){e.extendSelection(xi(e,e.getCursor().line))},goLineStartSmart:function(e){var t=e.getCursor(),r=xi(e,t.line),n=e.getLineHandle(r.line),i=kn(n);if(i&&0!=i[0].level)e.extendSelection(r);else{var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;e.extendSelection(qt(r.line,l?0:o))}},goLineEnd:function(e){e.extendSelection(wi(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(),r=e.getLine(t.line);t.ch>0&&t.ch<r.length-1&&e.replaceRange(r.charAt(t.ch)+r.charAt(t.ch-1),qt(t.line,t.ch-1),qt(t.line,t.ch+1))},newlineAndIndent:function(e){lt(e,function(){e.replaceSelection("\n","end","+input"),e.indentLine(e.getCursor().line,null,!0)})()},toggleOverwrite:function(e){e.toggleOverwrite()}},vo=e.keyMap={};vo.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"},vo.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"},vo.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"]},vo["default"]=Gi?vo.macDefault:vo.pcDefault,vo.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"},e.lookupKey=kr,e.isModifierKey=Cr,e.keyName=Lr,e.fromTextArea=function(t,r){function n(){t.value=c.getValue()
|
4 |
-
}if(r||(r={}),r.value=t.value,!r.tabindex&&t.tabindex&&(r.tabindex=t.tabindex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus){var i=document.body;try{i=document.activeElement}catch(o){}r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Rn(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var l=t.form,a=l.submit;try{var s=l.submit=function(){n(),l.submit=a,l.submit(),l.submit=s}}catch(o){}}t.style.display="none";var c=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return c.save=n,c.getTextArea=function(){return t},c.toTextArea=function(){n(),t.parentNode.removeChild(c.getWrapperElement()),t.style.display="",t.form&&(_n(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=a))},c},Mr.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(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var r=t==e;else var r=t&&(e.test?e.test(t):e(t));return r?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\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);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Yn(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue},indentation:function(){return Yn(this.string,null,this.tabSize)},match:function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},e.StringStream=Mr,e.TextMarker=Sr,$n(Sr),Sr.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&it(e),qn(this,"clear")){var r=this.find();r&&jn(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var l=this.lines[o],a=zr(l.markedSpans,this);null!=a.to&&(i=bn(l)),l.markedSpans=Er(l.markedSpans,a),null!=a.from?n=bn(l):this.collapsed&&!_r(this.doc,l)&&e&&yn(l,rt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var s=Rr(e.doc,this.lines[o]),c=u(e.doc,s);c>e.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&ct(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ir(e)),t&&ot(e)}},Sr.prototype.find=function(){for(var e,t,r=0;r<this.lines.length;++r){var n=this.lines[r],i=zr(n.markedSpans,this);if(null!=i.from||null!=i.to){var o=bn(n);null!=i.from&&(e=qt(o,i.from)),null!=i.to&&(t=qt(o,i.to))}}return"bookmark"==this.type?e:e&&{from:e,to:t}},Sr.prototype.changed=function(){var e=this.find(),t=this.doc.cm;if(e&&t){"bookmark"!=this.type&&(e=e.from);var r=mn(this.doc,e.line);if(R(t,r),e.line>=t.display.showingFrom&&e.line<t.display.showingTo){for(var n=t.display.lineDiv.firstChild;n;n=n.nextSibling)if(n.lineObj==r){n.offsetHeight!=r.height&&yn(r,n.offsetHeight);break}st(t,function(){t.curOp.selectionChanged=t.curOp.forceUpdate=t.curOp.updateMaxLine=!0})}}},Sr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=ei(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Sr.prototype.detachLine=function(e){if(this.lines.splice(ei(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},e.SharedTextMarker=Ar,$n(Ar),Ar.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();jn(this,"clear")}},Ar.prototype.find=function(){return this.primary.find()};var yo=e.LineWidget=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.cm=e,this.node=t};$n(yo),yo.prototype.clear=Ur(function(){var e=this.line.widgets,t=bn(this.line);if(null!=t&&e){for(var r=0;r<e.length;++r)e[r]==this&&e.splice(r--,1);e.length||(this.line.widgets=null);var n=wn(this.cm,this.line)<this.cm.doc.scrollTop;yn(this.line,Math.max(0,this.line.height-qr(this))),n&&fr(this.cm,0,-this.height),ct(this.cm,t,t+1)}}),yo.prototype.changed=Ur(function(){var e=this.height;this.height=null;var t=qr(this)-e;if(t){yn(this.line,this.line.height+t);var r=bn(this.line);ct(this.cm,r,r+1)}});var bo=e.Line=function(e,t,r){this.text=e,Kr(this,t),this.height=r?r(this):1};$n(bo),bo.prototype.lineNo=function(){return bn(this)};var xo={};fn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;n>r;++r){var i=this.lines[r];this.height-=i.height,Yr(i),jn(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.splice.apply(e,[e.length,0].concat(this.lines))},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0,i=t.length;i>n;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;n>e;++e)if(r(this.lines[e]))return!0}},dn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(i>e){var o=Math.min(t,i-e),l=n.height;if(n.removeInner(e,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25){var a=[];this.collapse(a),this.children=[new fn(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0,r=this.children.length;r>t;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0,i=this.children.length;i>n;++n){var o=this.children[n],l=o.chunkSize();if(l>=e){if(o.insertInner(e,t,r),o.lines&&o.lines.length>50){for(;o.lines.length>50;){var a=o.lines.splice(o.lines.length-25,25),s=new fn(a);o.height-=s.height,this.children.splice(n+1,0,s),s.parent=this}this.maybeSpill()}break}e-=l}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new dn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=ei(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new dn(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0,i=this.children.length;i>n;++n){var o=this.children[n],l=o.chunkSize();if(l>e){var a=Math.min(t,l-e);if(o.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=l}}};var wo=0,ko=e.Doc=function(e,t,r){if(!(this instanceof ko))return new ko(e,t,r);null==r&&(r=0),dn.call(this,[new fn([new bo("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=Cn(),this.cleanGeneration=1,this.frontier=r;var n=qt(r,0);this.sel={from:n,to:n,head:n,anchor:n,shift:!1,extend:!1,goalColumn:null},this.id=++wo,this.modeOption=t,"string"==typeof e&&(e=Do(e)),un(this,{from:n,to:n,text:e},null,{head:n,anchor:n})};ko.prototype=ti(dn.prototype,{constructor:ko,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0,i=t.length;i>n;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=vn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:function(e){var t=qt(this.first,0),r=this.first+this.size-1;Vt(this,{from:t,to:qt(r,mn(this,r).text.length),text:Do(e),origin:"setValue"},{head:t,anchor:t},!0)},replaceRange:function(e,t,r,n){t=Qt(this,t),r=r?Qt(this,r):t,Ut(this,e,t,r,n)},getRange:function(e,t,r){var n=gn(this,Qt(this,e),Qt(this,t));return r===!1?n:n.join(r||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},setLine:function(e,t){er(this,e)&&Ut(this,t,qt(e,0),Qt(this,qt(e)))},removeLine:function(e){e?Ut(this,"",Qt(this,qt(e-1)),Qt(this,qt(e))):Ut(this,"",qt(0,0),Qt(this,qt(1,0)))},getLineHandle:function(e){return er(this,e)?mn(this,e):void 0},getLineNumber:function(e){return bn(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=mn(this,e)),Rr(this,e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Qt(this,e)},getCursor:function(e){var t=this.sel,r;return r=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||e===!1?t.to:t.from,Yt(r)},somethingSelected:function(){return!$t(this.sel.head,this.sel.anchor)},setCursor:at(function(e,t,r){var n=Qt(this,"number"==typeof e?qt(e,t||0):e);r?tr(this,n):nr(this,n,n)}),setSelection:at(function(e,t,r){nr(this,Qt(this,e),Qt(this,t||e),r)}),extendSelection:at(function(e,t,r){tr(this,Qt(this,e),t&&Qt(this,t),r)}),getSelection:function(e){return this.getRange(this.sel.from,this.sel.to,e)},replaceSelection:function(e,t,r){Vt(this,{from:this.sel.from,to:this.sel.to,text:Do(e),origin:r},t||"around")},undo:at(function(){_t(this,"undo")}),redo:at(function(){_t(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=Cn(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){return this.history.lastOp=this.history.lastOrigin=null,this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Nn(this.history.done),undone:Nn(this.history.undone)}},setHistory:function(e){var t=this.history=Cn(this.history.maxGeneration);t.done=e.done.slice(0),t.undone=e.undone.slice(0)},markText:function(e,t,r){return Tr(this,Qt(this,e),Qt(this,t),r,"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft};return e=Qt(this,e),Tr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=Qt(this,e);var t=[],r=mn(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first;return this.iter(function(n){var i=n.text.length+1;return i>e?(t=e,!0):(e-=i,void++r)}),Qt(this,qt(r,t))},indexFromPos:function(e){e=Qt(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new ko(vn(this,this.first,this.first+this.size),this.modeOption,this.first);return 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},e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new ko(vn(this,t,r),e.mode||this.modeOption,t);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],n},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=this.linked[r];if(n.doc==t){this.linked.splice(r,1),t.unlinkDoc(this);break}}if(t.history==this.history){var i=[t.id];hn(t,function(e){i.push(e.id)},!0),t.history=Cn(),t.history.done=Nn(this.history.done,i),t.history.undone=Nn(this.history.undone,i)}},iterLinkedDocs:function(e){hn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),ko.prototype.eachLine=ko.prototype.iter;var Co="iter insert remove copy getEditor".split(" ");for(var Lo in ko.prototype)ko.prototype.hasOwnProperty(Lo)&&ei(Co,Lo)<0&&(e.prototype[Lo]=function(e){return function(){return e.apply(this.doc,arguments)}}(ko.prototype[Lo]));$n(ko),e.e_stop=Fn,e.e_preventDefault=Dn,e.e_stopPropagation=In;var Mo,So=0;e.on=Rn,e.off=_n,e.signal=Gn;var To=30,Ao=e.Pass={toString:function(){return"CodeMirror.Pass"}};Xn.prototype={set:function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)}},e.countColumn=Yn;var No=[""],zo=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Eo=/[\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]/;e.replaceGetRect=function(e){fi=e};var Oo=function(){if(zi)return!1;var e=ai("div");return"draggable"in e||"dragDrop"in e}();Ti?di=function(e,t){return 36==e.charCodeAt(t-1)&&39==e.charCodeAt(t)}:Ii&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?di=function(e,t){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(e.slice(t-1,t+1))}:Oi&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)?di=function(e,t){var r=e.charCodeAt(t-1);return r>=8208&&8212>=r}:Oi&&(di=function(e,t){if(t>1&&45==e.charCodeAt(t-1)){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 Wo,Ho,Do=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)};e.splitLines=Do;var Io=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},Po=function(){var e=ai("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Fo={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"};e.keyNames=Fo,function(){for(var e=0;10>e;e++)Fo[e+48]=String(e);for(var e=65;90>=e;e++)Fo[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)Fo[e+111]=Fo[e+63235]="F"+e}();var Bo,Vo=function(){function e(e){return 255>=e?t.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1791>=e?r.charAt(e-1536):e>=1792&&2220>=e?"r":"L"}var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/,s="L";return function(t){if(!n.test(t))return!1;for(var r=t.length,c=[],u=0,f;r>u;++u)c.push(f=e(t.charCodeAt(u)));for(var u=0,d=s;r>u;++u){var f=c[u];"m"==f?c[u]=d:d=f}for(var u=0,h=s;r>u;++u){var f=c[u];"1"==f&&"r"==h?c[u]="n":o.test(f)&&(h=f,"r"==f&&(c[u]="R"))}for(var u=1,d=c[0];r-1>u;++u){var f=c[u];"+"==f&&"1"==d&&"1"==c[u+1]?c[u]="1":","!=f||d!=c[u+1]||"1"!=d&&"n"!=d||(c[u]=d),d=f}for(var u=0;r>u;++u){var f=c[u];if(","==f)c[u]="N";else if("%"==f){for(var p=u+1;r>p&&"%"==c[p];++p);for(var m=u&&"!"==c[u-1]||r-1>p&&"1"==c[p]?"1":"N",g=u;p>g;++g)c[g]=m;u=p-1}}for(var u=0,h=s;r>u;++u){var f=c[u];"L"==h&&"1"==f?c[u]="L":o.test(f)&&(h=f)}for(var u=0;r>u;++u)if(i.test(c[u])){for(var p=u+1;r>p&&i.test(c[p]);++p);for(var v="L"==(u?c[u-1]:s),y="L"==(r-1>p?c[p]:s),m=v||y?"L":"R",g=u;p>g;++g)c[g]=m;u=p-1}for(var b=[],x,u=0;r>u;)if(l.test(c[u])){var w=u;for(++u;r>u&&l.test(c[u]);++u);b.push({from:w,to:u,level:0})}else{var k=u,C=b.length;for(++u;r>u&&"L"!=c[u];++u);for(var g=k;u>g;)if(a.test(c[g])){g>k&&b.splice(C,0,{from:k,to:g,level:1});var L=g;for(++g;u>g&&a.test(c[g]);++g);b.splice(C,0,{from:L,to:g,level:2}),k=g}else++g;u>k&&b.splice(C,0,{from:k,to:u,level:1})}return 1==b[0].level&&(x=t.match(/^\s+/))&&(b[0].from=x[0].length,b.unshift({from:0,to:x[0].length,level:0})),1==Qn(b).level&&(x=t.match(/\s+$/))&&(Qn(b).to-=x[0].length,b.push({from:r-x[0].length,to:r,level:0})),b[0].level!=Qn(b).level&&b.push({from:r,to:r,level:b[0].level}),b}}();return e.version="3.20.0",e}(),CodeMirror.defineMode("css",function(e,t){"use strict";function r(e,t){return p=t,e}function n(e,t){var n=e.next();if(a[n]){var l=a[n](e,t);if(l!==!1)return l}if("@"==n)return e.eatWhile(/[\w\\\-]/),r("def",e.current());if("="==n)r(null,"compare");else{if(("~"==n||"|"==n)&&e.eat("="))return r(null,"compare");if('"'==n||"'"==n)return t.tokenize=i(n),t.tokenize(e,t);if("#"==n)return e.eatWhile(/[\w\\\-]/),r("atom","hash");if("!"==n)return e.match(/^\s*\w*/),r("keyword","important");if(/\d/.test(n)||"."==n&&e.eat(/\d/))return e.eatWhile(/[\w.%]/),r("number","unit");if("-"!==n)return/[,+>*\/]/.test(n)?r(null,"select-op"):"."==n&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?r("qualifier","qualifier"):":"==n?r("operator",n):/[;{}\[\]\(\)]/.test(n)?r(null,n):"u"==n&&e.match("rl(")?(e.backUp(1),t.tokenize=o,r("property","variable")):(e.eatWhile(/[\w\\\-]/),r("property","variable"));if(/\d/.test(e.peek()))return e.eatWhile(/[\w.%]/),r("number","unit");if(e.match(/^[^-]+-/))return r("meta","meta")}}function i(e,t){return function(i,o){for(var l=!1,a;null!=(a=i.next())&&(a!=e||l);)l=!l&&"\\"==a;return l||(t&&i.backUp(1),o.tokenize=n),r("string","string")}}function o(e,t){return e.next(),t.tokenize=e.match(/\s*[\"\']/,!1)?n:i(")",!0),r(null,"(")}t.propertyKeywords||(t=CodeMirror.resolveMode("text/css"));var l=e.indentUnit||e.tabSize||2,a=t.hooks||{},s=t.atMediaTypes||{},c=t.atMediaFeatures||{},u=t.propertyKeywords||{},f=t.colorKeywords||{},d=t.valueKeywords||{},h=!!t.allowNested,p=null;return{startState:function(e){return{tokenize:n,baseIndent:e||0,stack:[],lastToken:null}},token:function(e,t){if(t.tokenize=t.tokenize||n,t.tokenize==n&&e.eatSpace())return null;var i=t.tokenize(e,t);i&&"string"!=typeof i&&(i=r(i[0],i[1]));var o=t.stack[t.stack.length-1];if("variable"==i)return"variable-definition"==p&&t.stack.push("propertyValue"),t.lastToken="variable-2";if("property"==i){var l=e.current().toLowerCase();"propertyValue"==o?i=d.hasOwnProperty(l)?"string-2":f.hasOwnProperty(l)?"keyword":"variable-2":"rule"==o?u.hasOwnProperty(l)||(i+=" error"):"block"==o?i=u.hasOwnProperty(l)?"property":f.hasOwnProperty(l)?"keyword":d.hasOwnProperty(l)?"string-2":"tag":o&&"@media{"!=o?"@media"==o?i=s[e.current()]?"attribute":/^(only|not)$/.test(l)?"keyword":"and"==l?"error":c.hasOwnProperty(l)?"error":"attribute error":"@mediaType"==o?i=s.hasOwnProperty(l)?"attribute":"and"==l?"operator":/^(only|not)$/.test(l)?"error":"error":"@mediaType("==o?u.hasOwnProperty(l)||(s.hasOwnProperty(l)?i="error":"and"==l?i="operator":/^(only|not)$/.test(l)?i="error":i+=" error"):i="@import"==o?"tag":"error":i="tag"}else"atom"==i?o&&"@media{"!=o&&"block"!=o?"propertyValue"==o?/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e.current())||(i+=" error"):i="error":i="builtin":"@media"==o&&"{"==p&&(i="error");if("{"==p)if("@media"==o||"@mediaType"==o)t.stack[t.stack.length-1]="@media{";else{var a=h?"block":"rule";t.stack.push(a)}else if("}"==p)for("interpolation"==o&&(i="operator");t.stack.length;){var m=t.stack.pop();if(m.indexOf("{")>-1||"block"==m||"rule"==m)break}else if("interpolation"==p)t.stack.push("interpolation");else if("@media"==p)t.stack.push("@media");else if("@import"==p)t.stack.push("@import");else if("@media"==o&&/\b(keyword|attribute)\b/.test(i))t.stack[t.stack.length-1]="@mediaType";else if("@mediaType"==o&&","==e.current())t.stack[t.stack.length-1]="@media";else if("("==p)"@media"==o||"@mediaType"==o?(t.stack[t.stack.length-1]="@mediaType",t.stack.push("@mediaType(")):t.stack.push("(");else if(")"==p)for(;t.stack.length;){var m=t.stack.pop();if(m.indexOf("(")>-1)break}else":"==p&&"property"==t.lastToken?t.stack.push("propertyValue"):"propertyValue"==o&&";"==p?t.stack.pop():"@import"==o&&";"==p&&t.stack.pop();return t.lastToken=i},indent:function(e,t){var r=e.stack.length;return/^\}/.test(t)&&(r-="propertyValue"==e.stack[r-1]?2:1),e.baseIndent+r*l},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}}),function(){function e(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=!0;return t}function t(e,t){for(var r=!1,n;null!=(n=e.next());){if(r&&"/"==n){t.tokenize=null;break}r="*"==n}return["comment","comment"]}var r=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"]),i=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"]),o=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"]),l=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","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"]);
|
5 |
-
CodeMirror.defineMIME("text/css",{atMediaTypes:r,atMediaFeatures:n,propertyKeywords:i,colorKeywords:o,valueKeywords:l,hooks:{"<":function(e,t){function r(e,t){for(var r=0,n;null!=(n=e.next());){if(r>=2&&">"==n){t.tokenize=null;break}r="-"==n?r+1:0}return["comment","comment"]}return e.eat("!")?(t.tokenize=r,r(e,t)):void 0},"/":function(e,r){return e.eat("*")?(r.tokenize=t,t(e,r)):!1}},name:"css"}),CodeMirror.defineMIME("text/x-scss",{atMediaTypes:r,atMediaFeatures:n,propertyKeywords:i,colorKeywords:o,valueKeywords:l,allowNested:!0,hooks:{":":function(e){return e.match(/\s*{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),":"==e.peek()?["variable","variable-definition"]:["variable","variable"]},",":function(e,t){return"propertyValue"==t.stack[t.stack.length-1]&&e.match(/^ *\$/,!1)?["operator",";"]:void 0},"/":function(e,r){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(r.tokenize=t,t(e,r)):["operator","operator"]},"#":function(e){return e.eat("{")?["operator","interpolation"]:(e.eatWhile(/[\w\\\-]/),["atom","hash"])}},name:"css"})}(),CodeMirror.defineMode("htmlmixed",function(e,t){function r(e,t){var r=t.htmlState.tagName,n=l.token(e,t.htmlState);if("script"==r&&/\btag\b/.test(n)&&">"==e.current()){var c=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);c=c?c[1]:"",c&&/[\"\']/.test(c.charAt(0))&&(c=c.slice(1,c.length-1));for(var u=0;u<s.length;++u){var f=s[u];if("string"==typeof f.matches?c==f.matches:f.matches.test(c)){f.mode&&(t.token=i,t.localMode=f.mode,t.localState=f.mode.startState&&f.mode.startState(l.indent(t.htmlState,"")));break}}}else"style"==r&&/\btag\b/.test(n)&&">"==e.current()&&(t.token=o,t.localMode=a,t.localState=a.startState(l.indent(t.htmlState,"")));return n}function n(e,t,r){var n=e.current(),i=n.search(t),o;return i>-1?e.backUp(n.length-i):(o=n.match(/<\/?$/))&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}function i(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=r,t.localState=t.localMode=null,r(e,t)):n(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function o(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=r,t.localState=t.localMode=null,r(e,t)):n(e,/<\/\s*style\s*>/,a.token(e,t.localState))}var l=CodeMirror.getMode(e,{name:"xml",htmlMode:!0}),a=CodeMirror.getMode(e,"css"),s=[],c=t&&t.scriptTypes;if(s.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:CodeMirror.getMode(e,"javascript")}),c)for(var u=0;u<c.length;++u){var f=c[u];s.push({matches:f.matches,mode:f.mode&&CodeMirror.getMode(e,f.mode)})}return s.push({matches:/./,mode:CodeMirror.getMode(e,"text/plain")}),{startState:function(){var e=l.startState();return{token:r,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(l,e.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(e,t){return!e.localMode||/^\s*<\//.test(t)?l.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||l}}}},"xml","javascript","css"),CodeMirror.defineMIME("text/html","htmlmixed"),CodeMirror.defineMode("javascript",function(e,t){function r(e,t){for(var r=!1,n;null!=(n=e.next());){if(n==t&&!r)return!1;r=!r&&"\\"==n}return r}function n(e,t,r){return gt=e,vt=r,t}function i(e,t){var i=e.next();if('"'==i||"'"==i)return t.tokenize=o(i),t.tokenize(e,t);if("."==i&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return n("number","number");if("."==i&&e.match(".."))return n("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(i))return n(i);if("="==i&&e.eat(">"))return n("=>");if("0"==i&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),n("number","number");if(/\d/.test(i))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),n("number","number");if("/"==i)return e.eat("*")?(t.tokenize=l,l(e,t)):e.eat("/")?(e.skipToEnd(),n("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(r(e,"/"),e.eatWhile(/[gimy]/),n("regexp","string-2")):(e.eatWhile(mt),n("operator",null,e.current()));if("`"==i)return t.tokenize=a,a(e,t);if("#"==i)return e.skipToEnd(),n("error","error");if(mt.test(i))return e.eatWhile(mt),n("operator",null,e.current());e.eatWhile(/[\w\$_]/);var s=e.current(),c=pt.propertyIsEnumerable(s)&&pt[s];return c&&"."!=t.lastType?n(c.type,c.style,s):n("variable","variable",s)}function o(e){return function(t,o){return r(t,e)||(o.tokenize=i),n("string","string")}}function l(e,t){for(var r=!1,o;o=e.next();){if("/"==o&&r){t.tokenize=i;break}r="*"==o}return n("comment","comment")}function a(e,t){for(var r=!1,o;null!=(o=e.next());){if(!r&&("`"==o||"$"==o&&e.eat("{"))){t.tokenize=i;break}r=!r&&"\\"==o}return n("quasi","string-2",e.current())}function s(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var l=e.string.charAt(o),a=yt.indexOf(l);if(a>=0&&3>a){if(!n){++o;break}if(0==--n)break}else if(a>=3&&6>a)++n;else if(/[$\w]/.test(l))i=!0;else if(i&&!n){++o;break}}i&&!n&&(t.fatArrowAt=o)}}function c(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function u(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function f(e,t,r,n,i){var o=e.cc;for(xt.state=e,xt.stream=i,xt.marked=null,xt.cc=o,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var l=o.length?o.pop():dt?w:x;if(l(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return xt.marked?xt.marked:"variable"==r&&u(e,n)?"variable-2":t}}}function d(){for(var e=arguments.length-1;e>=0;e--)xt.cc.push(arguments[e])}function h(){return d.apply(null,arguments),!0}function p(e){function r(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var n=xt.state;if(n.context){if(xt.marked="def",r(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(r(n.globalVars))return;t.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function m(){xt.state.context={prev:xt.state.context,vars:xt.state.localVars},xt.state.localVars=wt}function g(){xt.state.localVars=xt.state.context.vars,xt.state.context=xt.state.context.prev}function v(e,t){var r=function(){var r=xt.state,n=r.indented;"stat"==r.lexical.type&&(n=r.lexical.indented),r.lexical=new c(n,xt.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function y(){var e=xt.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function b(e){return function(t){return t==e?h():";"==e?d():h(arguments.callee)}}function x(e,t){return"var"==e?h(v("vardef",t.length),R,b(";"),y):"keyword a"==e?h(v("form"),w,x,y):"keyword b"==e?h(v("form"),x,y):"{"==e?h(v("}"),F,y):";"==e?h():"if"==e?h(v("form"),w,x,y,U):"function"==e?h(Q):"for"==e?h(v("form"),q,y,x,y):"variable"==e?h(v("stat"),O):"switch"==e?h(v("form"),w,v("}","switch"),b("{"),F,y,y):"case"==e?h(w,b(":")):"default"==e?h(b(":")):"catch"==e?h(v("form"),m,b("("),J,b(")"),x,y,g):"module"==e?h(v("form"),m,nt,g,y):"class"==e?h(v("form"),et,rt,y):"export"==e?h(v("form"),it,y):"import"==e?h(v("form"),ot,y):d(v("stat"),w,b(";"),y)}function w(e){return C(e,!1)}function k(e){return C(e,!0)}function C(e,t){if(xt.state.fatArrowAt==xt.stream.start){var r=t?E:z;if("("==e)return h(m,P(_,")"),b("=>"),r,g);if("variable"==e)return d(m,_,b("=>"),r,g)}var n=t?T:S;return bt.hasOwnProperty(e)?h(n):"function"==e?h(Q):"keyword c"==e?h(t?M:L):"("==e?h(v(")"),L,ct,b(")"),y,n):"operator"==e||"spread"==e?h(t?k:w):"["==e?h(v("]"),k,st,y,n):"{"==e?h(P(H,"}"),n):h()}function L(e){return e.match(/[;\}\)\],]/)?d():d(w)}function M(e){return e.match(/[;\}\)\],]/)?d():d(k)}function S(e,t){return","==e?h(w):T(e,t,!1)}function T(e,t,r){var n=0==r?S:T,i=0==r?w:k;return"=>"==t?h(m,r?E:z,g):"operator"==e?/\+\+|--/.test(t)?h(n):"?"==t?h(w,b(":"),i):h(i):"quasi"==e?(xt.cc.push(n),A(t)):";"!=e?"("==e?h(P(k,")","call"),n):"."==e?h(W,n):"["==e?h(v("]"),L,b("]"),y,n):void 0:void 0}function A(e){return"${"!=e.slice(e.length-2)?h():h(w,N)}function N(e){return"}"==e?(xt.marked="string-2",xt.state.tokenize=a,h()):void 0}function z(e){return s(xt.stream,xt.state),d("{"==e?x:w)}function E(e){return s(xt.stream,xt.state),d("{"==e?x:k)}function O(e){return":"==e?h(y,x):d(S,b(";"),y)}function W(e){return"variable"==e?(xt.marked="property",h()):void 0}function H(e,t){if("variable"==e){if(xt.marked="property","get"==t||"set"==t)return h(D)}else if("number"==e||"string"==e)xt.marked=e+" property";else if("["==e)return h(w,b("]"),I);return bt.hasOwnProperty(e)?h(I):void 0}function D(e){return"variable"!=e?d(I):(xt.marked="property",h(Q))}function I(e){return":"==e?h(k):"("==e?d(Q):void 0}function P(e,t,r){function n(r){if(","==r){var i=xt.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),h(e,n)}return r==t?h():h(b(t))}return function(i){return i==t?h():r===!1?d(e,n):d(v(t,r),e,n,y)}}function F(e){return"}"==e?h():d(x,F)}function B(e){return ht&&":"==e?h(V):void 0}function V(e){return"variable"==e?(xt.marked="variable-3",h()):void 0}function R(){return d(_,B,j,K)}function _(e,t){return"variable"==e?(p(t),h()):"["==e?h(P(_,"]")):"{"==e?h(P(G,"}")):void 0}function G(e,t){return"variable"!=e||xt.stream.match(/^\s*:/,!1)?("variable"==e&&(xt.marked="property"),h(b(":"),_,j)):(p(t),h(j))}function j(e,t){return"="==t?h(k):void 0}function K(e){return","==e?h(R):void 0}function U(e,t){return"keyword b"==e&&"else"==t?h(v("form"),x,y):void 0}function q(e){return"("==e?h(v(")"),$,b(")")):void 0}function $(e){return"var"==e?h(R,b(";"),Y):";"==e?h(Y):"variable"==e?h(X):d(w,b(";"),Y)}function X(e,t){return"in"==t||"of"==t?(xt.marked="keyword",h(w)):h(S,Y)}function Y(e,t){return";"==e?h(Z):"in"==t||"of"==t?(xt.marked="keyword",h(w)):d(w,b(";"),Z)}function Z(e){")"!=e&&h(w)}function Q(e,t){return"*"==t?(xt.marked="keyword",h(Q)):"variable"==e?(p(t),h(Q)):"("==e?h(m,P(J,")"),x,g):void 0}function J(e){return"spread"==e?h(J):d(_,B)}function et(e,t){return"variable"==e?(p(t),h(tt)):void 0}function tt(e,t){return"extends"==t?h(w):void 0}function rt(e){return"{"==e?h(P(H,"}")):void 0}function nt(e,t){return"string"==e?h(x):"variable"==e?(p(t),h(at)):void 0}function it(e,t){return"*"==t?(xt.marked="keyword",h(at,b(";"))):"default"==t?(xt.marked="keyword",h(w,b(";"))):d(x)}function ot(e){return"string"==e?h():d(lt,at)}function lt(e,t){return"{"==e?h(P(lt,"}")):("variable"==e&&p(t),h())}function at(e,t){return"from"==t?(xt.marked="keyword",h(w)):void 0}function st(e){return"for"==e?d(ct):","==e?h(P(k,"]",!1)):d(P(k,"]",!1))}function ct(e){return"for"==e?h(q,ct):"if"==e?h(w,ct):void 0}var ut=e.indentUnit,ft=t.statementIndent,dt=t.json,ht=t.typescript,pt=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},l={"if":e("if"),"while":t,"with":t,"else":r,"do":r,"try":r,"finally":r,"return":n,"break":n,"continue":n,"new":n,"delete":n,"throw":n,"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":n,"export":e("export"),"import":e("import"),"extends":n};if(ht){var a={type:"variable",style:"variable-3"},s={"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 c in s)l[c]=s[c]}return l}(),mt=/[+\-*&%=<>!?|~^]/,gt,vt,yt="([{}])",bt={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0},xt={state:null,column:null,marked:null,cc:null},wt={name:"this",next:{name:"arguments"}};return y.lex=!0,{startState:function(e){var r={tokenize:i,lastType:"sof",cc:[],lexical:new c((e||0)-ut,0,"block",!1),localVars:t.localVars,context:t.localVars&&{vars:t.localVars},indented:0};return t.globalVars&&(r.globalVars=t.globalVars),r},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),s(e,t)),t.tokenize!=l&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==gt?r:(t.lastType="operator"!=gt||"++"!=vt&&"--"!=vt?gt:"incdec",f(t,r,gt,vt,e))},indent:function(e,r){if(e.tokenize==l)return CodeMirror.Pass;if(e.tokenize!=i)return 0;for(var n=r&&r.charAt(0),o=e.lexical,a=e.cc.length-1;a>=0;--a){var s=e.cc[a];if(s==y)o=o.prev;else if(s!=U)break}"stat"==o.type&&"}"==n&&(o=o.prev),ft&&")"==o.type&&"stat"==o.prev.type&&(o=o.prev);var c=o.type,u=n==c;return"vardef"==c?o.indented+("operator"==e.lastType||","==e.lastType?o.info+1:0):"form"==c&&"{"==n?o.indented:"form"==c?o.indented+ut:"stat"==c?o.indented+("operator"==e.lastType||","==e.lastType?ft||ut:0):"switch"!=o.info||u||0==t.doubleIndentSwitch?o.align?o.column+(u?0:1):o.indented+(u?0:ut):o.indented+(/^(?:case|default)\b/.test(r)?ut:2*ut)},electricChars:":{}",blockCommentStart:dt?null:"/*",blockCommentEnd:dt?null:"*/",lineComment:dt?null:"//",fold:"brace",helperType:dt?"json":"javascript",jsonMode:dt}}),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 r(e,t){function r(r){return t.tokenize=r,r(e,t)}var i=e.next();if("<"==i){if(e.eat("!"))return e.eat("[")?e.match("CDATA[")?r(o("atom","]]>")):null:e.match("--")?r(o("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(l(1))):null;if(e.eat("?"))return e.eatWhile(/[\w\._\-]/),t.tokenize=o("meta","?>"),"meta";var a=e.eat("/");L="";for(var s;s=e.eat(/[^\s\u00a0=<>\"\'\/?]/);)L+=s;return L?(M=a?"closeTag":"openTag",t.tokenize=n,"tag"):"tag error"}if("&"==i){var c;return c=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),c?"atom":"error"}return e.eatWhile(/[^&<]/),null}function n(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=r,M=">"==n?"endTag":"selfcloseTag","tag";if("="==n)return M="equals",null;if("<"==n){t.tokenize=r;var o=t.tokenize(e,t);return o?o+" error":"error"}return/[\'\"]/.test(n)?(t.tokenize=i(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.eatWhile(/[^\s\u00a0=<>\"\']/),"word")}function i(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=n;break}return"string"};return t.isInAttribute=!0,t}function o(e,t){return function(n,i){for(;!n.eol();){if(n.match(t)){i.tokenize=r;break}n.next()}return e}}function l(e){return function(t,n){for(var i;null!=(i=t.next());){if("<"==i)return n.tokenize=l(e+1),n.tokenize(t,n);if(">"==i){if(1==e){n.tokenize=r;break}return n.tokenize=l(e-1),n.tokenize(t,n)}}return"meta"}}function a(){for(var e=arguments.length-1;e>=0;e--)S.cc.push(arguments[e])}function s(){return a.apply(null,arguments),!0}function c(e,t){var r=k.doNotIndent.hasOwnProperty(e)||S.context&&S.context.noIndent;S.context={prev:S.context,tagName:e,indent:S.indented,startOfLine:t,noIndent:r}}function u(){S.context&&(S.context=S.context.prev)}function f(e){if("openTag"==e)return S.tagName=L,S.tagStart=T.column(),s(m,d(S.startOfLine));if("closeTag"==e){var t=!1;return S.context?S.context.tagName!=L&&(k.implicitlyClosed.hasOwnProperty(S.context.tagName.toLowerCase())&&u(),t=!S.context||S.context.tagName!=L):t=!0,t&&(A="error"),s(h(t))}return s()}function d(e){return function(t){var r=S.tagName;return S.tagName=S.tagStart=null,"selfcloseTag"==t||"endTag"==t&&k.autoSelfClosers.hasOwnProperty(r.toLowerCase())?(p(r.toLowerCase()),s()):"endTag"==t?(p(r.toLowerCase()),c(r,e),s()):s()}}function h(e){return function(t){return e&&(A="error"),"endTag"==t?(u(),s()):(A="error",s(arguments.callee))}}function p(e){for(var t;;){if(!S.context)return;if(t=S.context.tagName.toLowerCase(),!k.contextGrabbers.hasOwnProperty(t)||!k.contextGrabbers[t].hasOwnProperty(e))return;u()}}function m(e){return"word"==e?(A="attribute",s(g,m)):"endTag"==e||"selfcloseTag"==e?a():(A="error",s(m))}function g(e){if("equals"==e)return s(v,m);if(k.allowMissing){if("word"==e)return A="attribute",s(g,m)}else A="error";return"endTag"==e||"selfcloseTag"==e?a():s()}function v(e){return"string"==e?s(y):"word"==e&&k.allowUnquoted?(A="string",s()):(A="error","endTag"==e||"selfCloseTag"==e?a():s())}function y(e){return"string"==e?s(y):a()}var b=e.indentUnit,x=t.multilineTagIndentFactor||1,w=t.multilineTagIndentPastTag||!0,k=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},C=t.alignCDATA,L,M,S,T,A;return{startState:function(){return{tokenize:r,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()),e.eatSpace())return null;A=M=L=null;var r=t.tokenize(e,t);if(t.type=M,(r||M)&&"comment"!=r)for(S=t,T=e;;){var n=t.cc.pop()||f;if(n(M||r))break}return t.startOfLine=!1,A&&(r="error"==A?r+" error":A),r},indent:function(e,t,i){var o=e.context;if(e.tokenize.isInAttribute)return e.stringStartCol+1;if(e.tokenize!=n&&e.tokenize!=r||o&&o.noIndent)return i?i.match(/^(\s*)/)[0].length:0;if(e.tagName)return w?e.tagStart+e.tagName.length+2:e.tagStart+b*x;if(C&&/<!\[CDATA\[/.test(t))return 0;for(o&&/^<\//.test(t)&&(o=o.prev);o&&!o.startOfLine;)o=o.prev;return o?o.indent+b: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 e(e){"activeLine"in e.state&&(e.removeLineClass(e.state.activeLine,"wrap",r),e.removeLineClass(e.state.activeLine,"background",n))}function t(t){var i=t.getLineHandleVisualStart(t.getCursor().line);t.state.activeLine!=i&&(e(t),t.addLineClass(i,"wrap",r),t.addLineClass(i,"background",n),t.state.activeLine=i)}var r="CodeMirror-activeline",n="CodeMirror-activeline-background";CodeMirror.defineOption("styleActiveLine",!1,function(r,n,i){var o=i&&i!=CodeMirror.Init;n&&!o?(t(r),r.on("cursorActivity",t)):!n&&o&&(r.off("cursorActivity",t),e(r),delete r.state.activeLine)})}(),function(){function e(e,t,r){function n(t,r,n){if(t.text){var l=h?0:t.text.length-1,s=h?t.text.length:-1;if(t.text.length>a)return null;for(null!=n&&(l=n+p);l!=s;l+=p){var c=t.text.charAt(l);if(v.test(c)&&e.getTokenTypeAt(i(r,l+1))==m){var u=o[c];if(">"==u.charAt(1)==h)g.push(c);else{if(g.pop()!=u.charAt(0))return{pos:l,match:!1};if(!g.length)return{pos:l,match:!0}}}}}}var l=e.state.matchBrackets,a=l&&l.maxScanLineLength||1e4,s=l&&l.maxScanLines||100,c=t||e.getCursor(),u=e.getLineHandle(c.line),f=c.ch-1,d=f>=0&&o[u.text.charAt(f)]||o[u.text.charAt(++f)];if(!d)return null;var h=">"==d.charAt(1),p=h?1:-1;if(r&&h!=(f==c.ch))return null;for(var m=e.getTokenTypeAt(i(c.line,f+1)),g=[u.text.charAt(f)],v=/[(){}[\]]/,y=c.line,b,x=h?Math.min(y+s,e.lineCount()):Math.max(-1,y-s);y!=x&&!(b=y==c.line?n(u,y,f):n(e.getLineHandle(y),y));y+=p);return{from:i(c.line,f),to:b&&i(y,b.pos),match:b&&b.match,forward:h}}function t(t,r){var o=t.state.matchBrackets.maxHighlightLineLength||1e3,l=e(t);if(!(!l||t.getLine(l.from.line).length>o||l.to&&t.getLine(l.to.line).length>o)){var a=l.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",s=t.markText(l.from,i(l.from.line,l.from.ch+1),{className:a}),c=l.to&&t.markText(l.to,i(l.to.line,l.to.ch+1),{className:a});n&&t.state.focused&&t.display.input.focus();var u=function(){t.operation(function(){s.clear(),c&&c.clear()})};return r?void setTimeout(u,800):u}}function r(e){e.operation(function(){l&&(l(),l=null),e.somethingSelected()||(l=t(e,!1))})}var n=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),i=CodeMirror.Pos,o={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;CodeMirror.defineOption("matchBrackets",!1,function(e,t,n){n&&n!=CodeMirror.Init&&e.off("cursorActivity",r),t&&(e.state.matchBrackets="object"==typeof t?t:{},e.on("cursorActivity",r))}),CodeMirror.defineExtension("matchBrackets",function(){t(this,!0)}),CodeMirror.defineExtension("findMatchingBracket",function(t,r){return e(this,t,r)})}(),window.onload=heshPlugin;
|
|
1 |
+
function heshPlugin(){var e=null,t=0,r=0,n=document.getElementById("content"),i=null!==document.getElementById("post_ID")?document.getElementById("post_ID").value:0,o=document.getElementById("content-html"),a=document.getElementById("content-tmce"),l=-1!==document.cookie.indexOf("theme=mbo")?"mbo":"default",s=-1!==document.cookie.indexOf("editor%3Dtinymce")?!0:!1,u=null!==document.getElementById("content-tmce")?!0:!1,c=document.getElementById("ed_toolbar"),f=document.getElementById("wp-content-editor-container"),d="heshFullscreen",h=document.getElementById("publish"),p={mode:"text/html",tabMode:"indent",theme:l,lineNumbers:!0,matchBrackets:!0,indentUnit:4,indentWithTabs:!0,enterMode:"keep",lineWrapping:!0,autofocus:!0,styleActiveLine:!0,electricChars:!1,extraKeys:{F11:function(){x()},Esc:function(){x()},"Ctrl-S":function(){h.click()},"Cmd-S":function(){h.click()}}},m=function(){if(!r){var e={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 t in e){var n=e[t],i=n[2]?'data-prompt="'+n[2]+'"':"";c.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_content_'+t+"\" data-start='"+n[0]+"' data-end='"+n[1]+"' "+i+' class="ed_button cm_ed_button" value="'+t+'">'),document.getElementById("cm_content_"+t).onclick=g}C(),k(),r=1}},g=function(){var t=e.getCursor("start"),r=this.getAttribute("data-start"),n=this.getAttribute("data-end"),i=this.getAttribute("data-prompt")||null,o=e.getSelection();"cm_content_link"===this.id&&wpLink?(wpLink.open(),document.getElementById("wp-link-submit").onclick=function(){var n=wpLink.getAttrs();r='<a href="'+n.href+'" title="'+n.title+'" target="'+n.target+'">',e.replaceSelection(r+o+"</a>"),wpLink.close(),e.setCursor(t.line,t.ch+r.length),e.focus()}):(i&&(r=r.replace("$",prompt(i,""))),e.replaceSelection(r+o+n),e.setCursor(t.line,t.ch+r.length),e.focus())},v=function(r){e=CodeMirror.fromTextArea(r,p),e.on("change",function(){e.save()}),e.on("cursorActivity",function(){var t=e.getCursor();window.name=i+","+t.line+","+t.ch});var n=window.name.split(",");i===n[0]&&e.setCursor(parseFloat(n[1]),parseFloat(n[2])),m(),w(),L(),t=1},y=function(){t&&(e.toTextArea(),o.onclick=b,switchEditors.switchto(this),t=0)},b=function(){t||(switchEditors.switchto(this),v(n),a.onclick=y)},w=function(){var e=document.querySelector(".CodeMirror"),t=document.createElement("div"),r=document.getElementById("wp-content-wrap"),n=e.getBoundingClientRect().top,i=function(t){t=t||window.event;var r=(t.pageY||t.clientY+document.body.scrollTop+document.documentElement.scrollTop)-n;e.style.height=(r>10?r:10)+"px",window.getSelection().removeAllRanges()};t.className="content-resize-handle",r.appendChild(t),t.onmousedown=function(){document.onmousemove=i},document.onmouseup=function(){document.onmousemove=null}},x=function(){f.className=-1===f.className.indexOf(d)?f.className+" "+d:f.className.replace(d,"");var t=document.getElementById("cm_content_fullscreen");t.value="fullscreen"===t.value?"exit fullscreen":"fullscreen",e.focus()},k=function(){c.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_content_fullscreen" class="ed_button" title="Toggle fullscreen mode" value="fullscreen">'),document.getElementById("cm_content_fullscreen").onclick=x},C=function(){var t=function(){return"mbo"===l?"light":"dark"};c.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_select_theme" class="ed_button" title="Change editor colour scheme" value="'+t()+'">'),document.getElementById("cm_select_theme").onclick=function(){l="mbo"===l?"default":"mbo",e.setOption("theme",l),document.cookie="hesh_plugin=theme="+l,this.value=t()}},L=function(){window.send_to_editor_wp||(window.send_to_editor_wp=send_to_editor,send_to_editor=function(r){t&&"content"===wpActiveEditor?(e.replaceSelection(r),e.save()):window.send_to_editor_wp(r)})};s&&u?o.onclick=b:(v(n),u&&(a.onclick=y))}!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);this.CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n||{};for(var i in na)n.hasOwnProperty(i)||(n[i]=na[i]);h(n);var o=n.value;"string"==typeof o&&(o=new Ta(o,n.mode)),this.doc=o;var a=this.display=new t(r,o);a.wrapper.CodeMirror=this,c(this),s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!Io&&fr(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Ri},bo&&setTimeout($i(cr,this,!0),20),pr(this);var l=this;$t(this,function(){l.curOp.forceUpdate=!0,si(l,o),n.autofocus&&!Io||to()==a.input?setTimeout($i(Ir,l),20):Dr(l);for(var e in ia)ia.hasOwnProperty(e)&&ia[e](l,n[e],oa);for(var t=0;t<ua.length;++t)ua[t](l)})}function t(e,t){var r=this,n=r.input=Zi("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");So?n.style.width="1000px":n.setAttribute("wrap","off"),Eo&&(n.style.border="1px solid black"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck","false"),r.inputDiv=Zi("div",[n],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),r.scrollbarH=Zi("div",[Zi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),r.scrollbarV=Zi("div",[Zi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r.scrollbarFiller=Zi("div",null,"CodeMirror-scrollbar-filler"),r.gutterFiller=Zi("div",null,"CodeMirror-gutter-filler"),r.lineDiv=Zi("div",null,"CodeMirror-code"),r.selectionDiv=Zi("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=Zi("div",null,"CodeMirror-cursors"),r.measure=Zi("div",null,"CodeMirror-measure"),r.lineMeasure=Zi("div",null,"CodeMirror-measure"),r.lineSpace=Zi("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none"),r.mover=Zi("div",[Zi("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=Zi("div",[r.mover],"CodeMirror-sizer"),r.heightForcer=Zi("div",null,null,"position: absolute; height: "+Fa+"px; width: 1px;"),r.gutters=Zi("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=Zi("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=Zi("div",[r.inputDiv,r.scrollbarH,r.scrollbarV,r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),wo&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),Eo&&(n.style.width="0px"),So||(r.scroller.draggable=!0),Oo&&(r.inputDiv.style.height="1px",r.inputDiv.style.position="absolute"),wo&&(r.scrollbarH.style.minHeight=r.scrollbarV.style.minWidth="18px"),e.appendChild?e.appendChild(r.wrapper):e(r.wrapper),r.viewFrom=r.viewTo=t.first,r.view=[],r.externalMeasured=null,r.viewOffset=0,r.lastSizeC=0,r.updateLineNumbers=null,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.prevInput="",r.alignWidgets=!1,r.pollingFast=!1,r.poll=new Ri,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.inaccurateSelection=!1,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,gt(e,100),e.state.modeGen++,e.curOp&&er(e)}function i(e){e.options.lineWrapping?(e.display.wrapper.className+=" CodeMirror-wrap",e.display.sizer.style.minWidth=""):(e.display.wrapper.className=e.display.wrapper.className.replace(" CodeMirror-wrap",""),d(e)),a(e),er(e),Wt(e),setTimeout(function(){m(e)},100)}function o(e){var t=Gt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/qt(e.display)-3);return function(i){if(Fn(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function a(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&di(e,t)})}function l(e){var t=pa[e.options.keyMap],r=t.style;e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(r?" cm-keymap-"+r:"")}function s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Wt(e)}function u(e){c(e),er(e),setTimeout(function(){v(e)},20)}function c(e){var t=e.display.gutters,r=e.options.gutters;Qi(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(Zi("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none";var a=t.offsetWidth;e.display.sizer.style.marginLeft=a+"px",n&&(e.display.scrollbarH.style.left=e.options.fixedGutter?a+"px":0)}function f(e){if(0==e.height)return 0;for(var t=e.text.length,r,n=e;r=Hn(n);){var i=r.find(0,!0);n=i.from.line,t+=i.from.ch-i.to.ch}for(n=e;r=zn(n);){var i=r.find(0,!0);t-=n.text.length-i.from.ch,n=i.to.line,t+=n.text.length-i.to.ch}return t}function d(e){var t=e.display,r=e.doc;t.maxLine=ui(r,r.first),t.maxLineLength=f(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=f(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function h(e){var t=Gi(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function p(e){var t=e.display.scroller;return{clientHeight:t.clientHeight,barHeight:e.display.scrollbarV.clientHeight,scrollWidth:t.scrollWidth,clientWidth:t.clientWidth,barWidth:e.display.scrollbarH.clientWidth,docHeight:Math.round(e.doc.height+xt(e.display))}}function m(e,t){t||(t=p(e));var r=e.display,n=t.docHeight+Fa,i=t.scrollWidth>t.clientWidth,o=n>t.clientHeight;if(o?(r.scrollbarV.style.display="block",r.scrollbarV.style.bottom=i?ro(r.measure)+"px":"0",r.scrollbarV.firstChild.style.height=Math.max(0,n-t.clientHeight+(t.barHeight||r.scrollbarV.clientHeight))+"px"):(r.scrollbarV.style.display="",r.scrollbarV.firstChild.style.height="0"),i?(r.scrollbarH.style.display="block",r.scrollbarH.style.right=o?ro(r.measure)+"px":"0",r.scrollbarH.firstChild.style.width=t.scrollWidth-t.clientWidth+(t.barWidth||r.scrollbarH.clientWidth)+"px"):(r.scrollbarH.style.display="",r.scrollbarH.firstChild.style.width="0"),i&&o?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=r.scrollbarFiller.style.width=ro(r.measure)+"px"):r.scrollbarFiller.style.display="",i&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=ro(r.measure)+"px",r.gutterFiller.style.width=r.gutters.offsetWidth+"px"):r.gutterFiller.style.display="",Ho&&0===ro(r.measure)){r.scrollbarV.style.minWidth=r.scrollbarH.style.minHeight=zo?"18px":"12px";var a=function(t){Wi(t)!=r.scrollbarV&&Wi(t)!=r.scrollbarH&&Xt(e,vr)(t)};Wa(r.scrollbarV,"mousedown",a),Wa(r.scrollbarH,"mousedown",a)}}function g(e,t,r){var n=r&&null!=r.top?r.top:e.scroller.scrollTop;n=Math.floor(n-wt(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=pi(t,n),a=pi(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;if(o>l)return{from:l,to:pi(t,mi(ui(t,l))+e.wrapper.clientHeight)};if(Math.min(s,t.lastLine())>=a)return{from:pi(t,mi(ui(t,s))-e.wrapper.clientHeight),to:s}}return{from:o,to:a}}function v(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=w(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&r[a].gutter&&(r[a].gutter.style.left=o);var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function y(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=b(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(Zi("div",[Zi("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a),n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px";var l=n.gutters.offsetWidth;return n.scrollbarH.style.left=e.options.fixedGutter?l+"px":0,n.sizer.style.marginLeft=l+"px",!0}return!1}function b(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function w(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function x(e,t,r){for(var n=e.display.viewFrom,i=e.display.viewTo,o,a=g(e.display,e.doc,t),l=!0;;l=!1){var s=e.display.scroller.clientWidth;if(!k(e,a,r))break;o=!0,e.display.maxLineChanged&&!e.options.lineWrapping&&C(e);var u=p(e);if(dt(e),L(e,u),m(e,u),l&&e.options.lineWrapping&&s!=e.display.scroller.clientWidth)r=!0;else if(r=!1,t&&null!=t.top&&(t={top:Math.min(u.docHeight-Fa-u.clientHeight,t.top)}),a=g(e.display,e.doc,t),a.from>=e.display.viewFrom&&a.to<=e.display.viewTo)break}return e.display.updateLineNumbers=null,o&&(Ii(e,"update",e),(e.display.viewFrom!=n||e.display.viewTo!=i)&&Ii(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo)),o}function k(e,t,r){var n=e.display,i=e.doc;if(!n.wrapper.offsetWidth)return void rr(e);if(!(!r&&t.from>=n.viewFrom&&t.to<=n.viewTo&&0==ar(e))){y(e)&&rr(e);var o=T(e),a=i.first+i.size,l=Math.max(t.from-e.options.viewportMargin,i.first),s=Math.min(a,t.to+e.options.viewportMargin);n.viewFrom<l&&l-n.viewFrom<20&&(l=Math.max(i.first,n.viewFrom)),n.viewTo>s&&n.viewTo-s<20&&(s=Math.min(a,n.viewTo)),_o&&(l=Dn(e.doc,l),s=Pn(e.doc,s));var u=l!=n.viewFrom||s!=n.viewTo||n.lastSizeC!=n.wrapper.clientHeight;or(e,l,s),n.viewOffset=mi(ui(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var c=ar(e);if(u||0!=c||r){var f=to();return c>4&&(n.lineDiv.style.display="none"),A(e,n.updateLineNumbers,o),c>4&&(n.lineDiv.style.display=""),f&&to()!=f&&f.offsetHeight&&f.focus(),Qi(n.cursorDiv),Qi(n.selectionDiv),u&&(n.lastSizeC=n.wrapper.clientHeight,gt(e,400)),S(e),!0}}}function C(e){var t=e.display,r=Mt(e,t.maxLine,t.maxLine.text.length).left;t.maxLineChanged=!1;var n=Math.max(0,r+3),i=Math.max(0,t.sizer.offsetLeft+n+Fa-t.scroller.clientWidth);t.sizer.style.minWidth=n+"px",i<e.doc.scrollLeft&&Mr(e,Math.min(t.scroller.scrollLeft,i),!0)}function L(e,t){e.display.sizer.style.minHeight=e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=Math.max(t.docHeight,t.clientHeight-Fa)+"px"}function S(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o;if(!i.hidden){if(wo){var a=i.node.offsetTop+i.node.offsetHeight;o=a-r,r=a}else{var l=i.node.getBoundingClientRect();o=l.bottom-l.top}var s=i.line.height-o;if(2>o&&(o=Gt(t)),(s>.001||-.001>s)&&(di(i.line,o),M(i.line),i.rest))for(var u=0;u<i.rest.length;u++)M(i.rest[u])}}}function M(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function T(e){for(var t=e.display,r={},n={},i=t.gutters.firstChild,o=0;i;i=i.nextSibling,++o)r[e.options.gutters[o]]=i.offsetLeft,n[e.options.gutters[o]]=i.offsetWidth;return{fixedPos:w(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function A(e,t,r){function n(t){var r=t.nextSibling;return So&&Do&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var i=e.display,o=e.options.lineNumbers,a=i.lineDiv,l=a.firstChild,s=i.view,u=i.viewFrom,c=0;c<s.length;c++){var f=s[c];if(f.hidden);else if(f.node){for(;l!=f.node;)l=n(l);var d=o&&null!=t&&u>=t&&f.lineNumber;f.changes&&(Gi(f.changes,"gutter")>-1&&(d=!1),N(e,f,u,r)),d&&(Qi(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(b(e.options,u)))),l=f.node.nextSibling}else{var h=P(e,f,u,r);a.insertBefore(h,l)}u+=f.size}for(;l;)l=n(l)}function N(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?W(e,t):"gutter"==o?I(e,t,r,n):"class"==o?E(t):"widget"==o&&D(t,n)}t.changes=null}function O(e){return e.node==e.text&&(e.node=Zi("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),wo&&(e.node.style.zIndex=2)),e.node}function H(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=O(e);e.background=r.insertBefore(Zi("div",null,t),r.firstChild)}}function z(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Yn(e,t)}function W(e,t){var r=t.text.className,n=z(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,E(t)):r&&(t.text.className=r)}function E(e){H(e),e.line.wrapClass?O(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function I(e,t,r,n){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=O(t),a=t.gutter=o.insertBefore(Zi("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px"),t.text);if(!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(Zi("div",b(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var l=0;l<e.options.gutters.length;++l){var s=e.options.gutters[l],u=i.hasOwnProperty(s)&&i[s];u&&a.appendChild(Zi("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[s]+"px; width: "+n.gutterWidth[s]+"px"))}}}function D(e,t){e.alignable&&(e.alignable=null);for(var r=e.node.firstChild,n;r;r=n){var n=r.nextSibling;"CodeMirror-linewidget"==r.className&&e.node.removeChild(r)}F(e,t)}function P(e,t,r,n){var i=z(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),E(t),I(e,t,r,n),F(t,n),t.node}function F(e,t){if(B(e.line,e,t,!0),e.rest)for(var r=0;r<e.rest.length;r++)B(e.rest[r],e,t,!1)}function B(e,t,r,n){if(e.widgets)for(var i=O(t),o=0,a=e.widgets;o<a.length;++o){var l=a[o],s=Zi("div",[l.node],"CodeMirror-linewidget");l.handleMouseEvents||(s.ignoreEvents=!0),R(l,s,t,r),n&&l.above?i.insertBefore(s,t.gutter||t.text):i.appendChild(s),Ii(l,"redraw")}}function R(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function j(e){return Vo(e.line,e.ch)}function _(e,t){return Go(e,t)<0?t:e}function V(e,t){return Go(e,t)<0?e:t}function G(e,t){this.ranges=e,this.primIndex=t}function q(e,t){this.anchor=e,this.head=t}function U(e,t){var r=e[t];e.sort(function(e,t){return Go(e.from(),t.from())}),t=Gi(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(Go(o.to(),i.from())>=0){var a=V(o.from(),i.from()),l=_(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;t>=n&&--t,e.splice(--n,2,new q(s?l:a,s?a:l))}}return new G(e,t)}function K(e,t){return new G([new q(e,t||e)],0)}function $(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function X(e,t){if(t.line<e.first)return Vo(e.first,0);var r=e.first+e.size-1;return t.line>r?Vo(r,ui(e,r).text.length):Y(t,ui(e,t.line).text.length)}function Y(e,t){var r=e.ch;return null==r||r>t?Vo(e.line,t):0>r?Vo(e.line,0):e}function Z(e,t){return t>=e.first&&t<e.first+e.size}function Q(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=X(e,t[n]);return r}function J(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=Go(r,i)<0;o!=Go(n,i)<0?(i=r,r=n):o!=Go(r,n)<0&&(r=n)}return new q(i,r)}return new q(n||r,r)}function et(e,t,r,n){at(e,new G([J(e,e.sel.primary(),t,r)],0),n)}function tt(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=J(e,e.sel.ranges[i],t[i],null);var o=U(n,e.sel.primIndex);at(e,o,r)}function rt(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,at(e,U(i,e.sel.primIndex),n)}function nt(e,t,r,n){at(e,K(t,r),n)}function it(e,t){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new q(X(e,t[r].anchor),X(e,t[r].head))}};return Ia(e,"beforeSelectionChange",e,r),e.cm&&Ia(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?U(r.ranges,r.ranges.length-1):t}function ot(e,t,r){var n=e.history.done,i=Vi(n);i&&i.ranges?(n[n.length-1]=t,lt(e,t,r)):at(e,t,r)}function at(e,t,r){lt(e,t,r),Ci(e,e.sel,e.cm?e.cm.curOp.id:0/0,r)}function lt(e,t,r){(Fi(e,"beforeSelectionChange")||e.cm&&Fi(e.cm,"beforeSelectionChange"))&&(t=it(e,t));var n=Go(t.primary().head,e.sel.primary().head)<0?-1:1;st(e,ct(e,t,n,!0)),r&&r.scroll===!1||!e.cm||rn(e.cm)}function st(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=e.cm.curOp.cursorActivity=!0),Ii(e,"cursorActivity",e))}function ut(e){st(e,ct(e,e.sel,null,!1),Ra)}function ct(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=ft(e,a.anchor,r,n),s=ft(e,a.head,r,n);(i||l!=a.anchor||s!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new q(l,s))}return i?U(i,t.primIndex):t}function ft(e,t,r,n){var i=!1,o=t,a=r||1;e.cantEdit=!1;e:for(;;){var l=ui(e,o.line);if(l.markedSpans)for(var s=0;s<l.markedSpans.length;++s){var u=l.markedSpans[s],c=u.marker;if((null==u.from||(c.inclusiveLeft?u.from<=o.ch:u.from<o.ch))&&(null==u.to||(c.inclusiveRight?u.to>=o.ch:u.to>o.ch))){if(n&&(Ia(c,"beforeCursorEnter"),c.explicitlyCleared)){if(l.markedSpans){--s;continue}break}if(!c.atomic)continue;var f=c.find(0>a?-1:1);if(0==Go(f,o)&&(f.ch+=a,f.ch<0?f=f.line>e.first?X(e,Vo(f.line-1)):null:f.ch>l.text.length&&(f=f.line<e.first+e.size-1?Vo(f.line+1,0):null),!f)){if(i)return n?(e.cantEdit=!0,Vo(e.first,0)):ft(e,t,r,!0);i=!0,f=t,a=-a}o=f;continue e}}return o}}function dt(e){for(var t=e.display,r=e.doc,n=document.createDocumentFragment(),i=document.createDocumentFragment(),o=0;o<r.sel.ranges.length;o++){var a=r.sel.ranges[o],l=a.empty();(l||e.options.showCursorWhenSelecting)&&ht(e,a,n),l||pt(e,a,i)}if(e.options.moveInputWithCursor){var s=Bt(e,r.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),c=t.lineDiv.getBoundingClientRect(),f=Math.max(0,Math.min(t.wrapper.clientHeight-10,s.top+c.top-u.top)),d=Math.max(0,Math.min(t.wrapper.clientWidth-10,s.left+c.left-u.left));t.inputDiv.style.top=f+"px",t.inputDiv.style.left=d+"px"}Ji(t.cursorDiv,n),Ji(t.selectionDiv,i)}function ht(e,t,r){var n=Bt(e,t.head,"div"),i=r.appendChild(Zi("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(Zi("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function pt(e,t,r){function n(e,t,r,n){0>t&&(t=0),l.appendChild(Zi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?c-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return Ft(e,Vo(t,r),"div",l,n)}var l=ui(a,t),s=l.text.length,f,d;return oo(gi(l),r||0,null==i?s:i,function(e,t,a){var l=o(e,"left"),h,p,m;if(e==t)h=l,p=m=l.left;else{if(h=o(t-1,"right"),"rtl"==a){var g=l;l=h,h=g}p=l.left,m=h.right}null==r&&0==e&&(p=u),h.top-l.top>3&&(n(p,l.top,null,l.bottom),p=u,l.bottom<h.top&&n(p,l.bottom,null,h.top)),null==i&&t==s&&(m=c),(!f||l.top<f.top||l.top==f.top&&l.left<f.left)&&(f=l),(!d||h.bottom>d.bottom||h.bottom==d.bottom&&h.right>d.right)&&(d=h),u+1>p&&(p=u),n(p,h.top,m-p,h.bottom)}),{start:f,end:d}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=kt(e.display),u=s.left,c=o.lineSpace.offsetWidth-s.right,f=t.from(),d=t.to();if(f.line==d.line)i(f.line,f.ch,d.ch);else{var h=ui(a,f.line),p=ui(a,d.line),m=En(h)==En(p),g=i(f.line,f.ch,m?h.text.length+1:null).end,v=i(d.line,m?0:null,d.ch).start;m&&(g.top<v.top-2?(n(g.right,g.top,null,g.bottom),n(u,v.top,v.left,v.bottom)):n(g.right,g.top,v.left-g.right,g.bottom)),g.bottom<v.top&&n(u,g.bottom,null,v.top)}r.appendChild(l)}function mt(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0&&(t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate))}}function gt(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,$i(vt,e))}function vt(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=fa(t.mode,bt(e,t.frontier));$t(e,function(){t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(i){if(t.frontier>=e.display.viewFrom){var o=i.styles;i.styles=Un(e,i,n,!0);for(var a=!o||o.length!=i.styles.length,l=0;!a&&l<o.length;++l)a=o[l]!=i.styles[l];a&&tr(e,t.frontier,"text"),i.stateAfter=fa(t.mode,n)}else $n(e,i.text,n),i.stateAfter=t.frontier%5==0?fa(t.mode,n):null;return++t.frontier,+new Date>r?(gt(e,e.options.workDelay),!0):void 0})})}}function yt(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=ui(o,l-1);if(s.stateAfter&&(!r||l<=o.frontier))return l;var u=Va(s.text,null,e.options.tabSize);(null==i||n>u)&&(i=l-1,n=u)}return i}function bt(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=yt(e,t,r),a=o>n.first&&ui(n,o-1).stateAfter;return a=a?fa(n.mode,a):da(n.mode),n.iter(o,t,function(r){$n(e,r.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=l?fa(n.mode,a):null,++o}),r&&(n.frontier=o),a}function wt(e){return e.lineSpace.offsetTop}function xt(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function kt(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Ji(e.measure,Zi("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle;return e.cachedPaddingH={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)}}function Ct(e,t,r){var n=e.options.lineWrapping,i=n&&e.display.scroller.clientWidth;if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],u=a[l+1];Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Lt(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var n=0;n<e.rest.length;n++)if(hi(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function St(e,t){t=En(t);var r=hi(t),n=e.display.externalMeasured=new Qt(e.doc,t,r);n.lineN=r;var i=n.built=Yn(e,n);return n.text=i.pre,Ji(e.display.lineMeasure,i.pre),n}function Mt(e,t,r,n){return Nt(e,At(e,t),r,n)}function Tt(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[nr(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function At(e,t){var r=hi(t),n=Tt(e,r);n&&!n.text?n=null:n&&n.changes&&N(e,n,r,T(e)),n||(n=St(e,t));var i=Lt(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Nt(e,t,r,n){t.before&&(r=-1);var i=r+(n||""),o;return t.cache.hasOwnProperty(i)?o=t.cache[i]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ct(e,t.view,t.rect),t.hasHeights=!0),o=Ot(e,t,r,n),o.bogus||(t.cache[i]=o)),{left:o.left,right:o.right,top:o.top,bottom:o.bottom}}function Ot(e,t,r,n){for(var i=t.map,o,a,l,s,u=0;u<i.length;u+=3){var c=i[u],f=i[u+1];if(c>r?(a=0,l=1,s="left"):f>r?(a=r-c,l=a+1):(u==i.length-3||r==f&&i[u+3]>r)&&(l=f-c,a=l-1,r>=f&&(s="right")),null!=a){if(o=i[u+2],c==f&&n==(o.insertLeft?"left":"right")&&(s=n),"left"==n&&0==a)for(;u&&i[u-2]==i[u-3]&&i[u-1].insertLeft;)o=i[(u-=3)+2],s="left";if("right"==n&&a==f-c)for(;u<i.length-3&&i[u+3]==i[u+4]&&!i[u+5].insertLeft;)o=i[(u+=3)+2],s="right";break}}var d;if(3==o.nodeType){for(;a&&Yi(t.line.text.charAt(c+a));)--a;for(;f>c+l&&Yi(t.line.text.charAt(c+l));)++l;if(xo&&0==a&&l==f-c)d=o.parentNode.getBoundingClientRect();else if(Lo&&e.options.lineWrapping){var h=Xa(o,a,l).getClientRects();d=h.length?h["right"==n?h.length-1:0]:qo}else d=Xa(o,a,l).getBoundingClientRect()}else{a>0&&(s=n="right");var h;d=e.options.lineWrapping&&(h=o.getClientRects()).length>1?h["right"==n?h.length-1:0]:o.getBoundingClientRect()}if(xo&&!a&&(!d||!d.left&&!d.right)){var p=o.parentNode.getClientRects()[0];d=p?{left:p.left,right:p.left+qt(e.display),top:p.top,bottom:p.bottom}:qo}for(var m,g=(d.bottom+d.top)/2-t.rect.top,v=t.view.measure.heights,u=0;u<v.length-1&&!(g<v[u]);u++);m=u?v[u-1]:0,g=v[u];var y={left:("right"==s?d.right:d.left)-t.rect.left,right:("left"==s?d.left:d.right)-t.rect.left,top:m,bottom:g};return d.left||d.right||(y.bogus=!0),y}function Ht(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function zt(e){e.display.externalMeasure=null,Qi(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Ht(e.display.view[t])}function Wt(e){zt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Et(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function It(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function Dt(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=jn(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=mi(t);if("local"==n?a+=wt(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:It());var s=l.left+("window"==n?0:Et());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function Pt(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=Et(),i-=It();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function Ft(e,t,r,n,i){return n||(n=ui(e.doc,t.line)),Dt(e,n,Mt(e,n,t.ch,i),r)}function Bt(e,t,r,n,i){function o(t,o){var a=Nt(e,i,t,o?"right":"left");return o?a.left=a.right:a.right=a.left,Dt(e,n,a,r)}function a(e,t){var r=l[t],n=r.level%2;return e==ao(r)&&t&&r.level<l[t-1].level?(r=l[--t],e=lo(r)-(r.level%2?0:1),n=!0):e==lo(r)&&t<l.length-1&&r.level<l[t+1].level&&(r=l[++t],e=ao(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?o(e-1):o(e,n)}n=n||ui(e.doc,t.line),i||(i=At(e,n));var l=gi(n),s=t.ch;if(!l)return o(s);var u=po(l,s),c=a(s,u);return null!=il&&(c.other=a(s,il)),c}function Rt(e,t){var r=0,t=X(e.doc,t);e.options.lineWrapping||(r=qt(e.display)*t.ch);var n=ui(e.doc,t.line),i=mi(n)+wt(e.display);return{left:r,right:r,top:i,bottom:i+n.height}
|
2 |
+
}function jt(e,t,r,n){var i=Vo(e,t);return i.xRel=n,r&&(i.outside=!0),i}function _t(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return jt(n.first,0,!0,-1);var i=pi(n,r),o=n.first+n.size-1;if(i>o)return jt(n.first+n.size-1,ui(n,o).text.length,!0,1);0>t&&(t=0);for(var a=ui(n,i);;){var l=Vt(e,a,i,t,r),s=zn(a),u=s&&s.find(0,!0);if(!s||!(l.ch>u.from.ch||l.ch==u.from.ch&&l.xRel>0))return l;i=hi(a=u.to.line)}}function Vt(e,t,r,n,i){function o(n){var i=Bt(e,Vo(r,n),"line",t,u);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-mi(t),l=!1,s=2*e.display.wrapper.clientWidth,u=At(e,t),c=gi(t),f=t.text.length,d=so(t),h=uo(t),p=o(d),m=l,g=o(h),v=l;if(n>g)return jt(r,h,v,1);for(;;){if(c?h==d||h==go(t,d,1):1>=h-d){for(var y=p>n||g-n>=n-p?d:h,b=n-(y==d?p:g);Yi(t.text.charAt(y));)++y;var w=jt(r,y,y==d?m:v,-1>b?-1:b>1?1:0);return w}var x=Math.ceil(f/2),k=d+x;if(c){k=d;for(var C=0;x>C;++C)k=go(t,k,1)}var L=o(k);L>n?(h=k,g=L,(v=l)&&(g+=1e3),f=x):(d=k,p=L,m=l,f-=x)}}function Gt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Uo){Uo=Zi("pre");for(var t=0;49>t;++t)Uo.appendChild(document.createTextNode("x")),Uo.appendChild(Zi("br"));Uo.appendChild(document.createTextNode("x"))}Ji(e.measure,Uo);var r=Uo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),Qi(e.measure),r||1}function qt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Zi("span","xxxxxxxxxx"),r=Zi("pre",[t]);Ji(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ut(e){e.curOp={viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivity:!1,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++Ko},Pa++||(Da=[])}function Kt(e){var t=e.curOp,r=e.doc,n=e.display;if(e.curOp=null,t.updateMaxLine&&d(e),t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<n.viewFrom||t.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping){var i=x(e,{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate);e.display.scroller.offsetHeight&&(e.doc.scrollTop=e.display.scroller.scrollTop)}if(!i&&t.selectionChanged&&dt(e),i||t.startHeight==e.doc.height||m(e),null!=t.scrollTop&&n.scroller.scrollTop!=t.scrollTop){var o=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,t.scrollTop));n.scroller.scrollTop=n.scrollbarV.scrollTop=r.scrollTop=o}if(null!=t.scrollLeft&&n.scroller.scrollLeft!=t.scrollLeft){var a=Math.max(0,Math.min(n.scroller.scrollWidth-n.scroller.clientWidth,t.scrollLeft));n.scroller.scrollLeft=n.scrollbarH.scrollLeft=r.scrollLeft=a,v(e)}if(t.scrollToPos){var l=Qr(e,X(e.doc,t.scrollToPos.from),X(e.doc,t.scrollToPos.to),t.scrollToPos.margin);t.scrollToPos.isCursor&&e.state.focused&&Zr(e,l)}t.selectionChanged&&mt(e),e.state.focused&&t.updateInput&&cr(e,t.typing);var s=t.maybeHiddenMarkers,u=t.maybeUnhiddenMarkers;if(s)for(var c=0;c<s.length;++c)s[c].lines.length||Ia(s[c],"hide");if(u)for(var c=0;c<u.length;++c)u[c].lines.length&&Ia(u[c],"unhide");var f;if(--Pa||(f=Da,Da=null),t.changeObjs){for(var c=0;c<t.changeObjs.length;c++)Ia(e,"change",e,t.changeObjs[c]);Ia(e,"changes",e,t.changeObjs)}if(t.cursorActivity&&Ia(e,"cursorActivity",e),f)for(var c=0;c<f.length;++c)f[c]()}function $t(e,t){if(e.curOp)return t();Ut(e);try{return t()}finally{Kt(e)}}function Xt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ut(e);try{return t.apply(e,arguments)}finally{Kt(e)}}}function Yt(e){return function(){if(this.curOp)return e.apply(this,arguments);Ut(this);try{return e.apply(this,arguments)}finally{Kt(this)}}}function Zt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Ut(t);try{return e.apply(this,arguments)}finally{Kt(t)}}}function Qt(e,t,r){this.line=t,this.rest=In(t),this.size=this.rest?hi(Vi(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Fn(e,t)}function Jt(e,t,r){for(var n=[],i,o=t;r>o;o=i){var a=new Qt(e.doc,ui(e.doc,o),o);i=o+a.size,n.push(a)}return n}function er(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)_o&&Dn(e.doc,t)<i.viewTo&&rr(e);else if(r<=i.viewFrom)_o&&Pn(e.doc,r+n)>i.viewFrom?rr(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)rr(e);else if(t<=i.viewFrom){var o=ir(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):rr(e)}else if(r>=i.viewTo){var o=ir(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):rr(e)}else{var a=ir(e,t,t,-1),l=ir(e,r,r+n,1);a&&l?(i.view=i.view.slice(0,a.index).concat(Jt(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=n):rr(e)}var s=i.externalMeasured;s&&(r<s.lineN?s.lineN+=n:t<s.lineN+s.size&&(i.externalMeasured=null))}function tr(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[nr(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Gi(a,r)&&a.push(r)}}}function rr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function nr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,0>t)return n}function ir(e,t,r,n){var i=nr(e,t),o,a=e.display.view;if(!_o)return{index:i,lineN:r};for(var l=0,s=e.display.viewFrom;i>l;l++)s+=a[l].size;if(s!=t){if(n>0){if(i==a.length-1)return null;o=s+a[i].size-t,i++}else o=s-t;t+=o,r+=o}for(;Dn(e.doc,r)!=r;){if(i==(0>n?0:a.length-1))return null;r+=n*a[i-(0>n?1:0)].size,i+=n}return{index:i,lineN:r}}function or(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Jt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Jt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(nr(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Jt(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,nr(e,r)))),n.viewTo=r}function ar(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function lr(e){e.display.pollingFast||e.display.poll.set(e.options.pollInterval,function(){ur(e),e.state.focused&&lr(e)})}function sr(e){function t(){var n=ur(e);n||r?(e.display.pollingFast=!1,lr(e)):(r=!0,e.display.poll.set(60,t))}var r=!1;e.display.pollingFast=!0,e.display.poll.set(20,t)}function ur(e){var t=e.display.input,r=e.display.prevInput,n=e.doc;if(!e.state.focused||tl(t)||hr(e)||e.options.disableInput)return!1;var i=t.value;if(i==r&&!e.somethingSelected())return!1;if(Lo&&!xo&&e.display.inputHasSelection===i)return cr(e),!1;var o=!e.curOp;o&&Ut(e),e.display.shift=!1;for(var a=0,l=Math.min(r.length,i.length);l>a&&r.charCodeAt(a)==i.charCodeAt(a);)++a;for(var s=i.slice(a),u=el(s),c=e.state.pasteIncoming&&u.length>1&&n.sel.ranges.length==u.length,f=n.sel.ranges.length-1;f>=0;f--){var d=n.sel.ranges[f],h=d.from(),p=d.to();a<r.length?h=Vo(h.line,h.ch-(r.length-a)):e.state.overwrite&&d.empty()&&!e.state.pasteIncoming&&(p=Vo(p.line,Math.min(ui(n,p.line).text.length,p.ch+Vi(u).length)));var m=e.curOp.updateInput,g={from:h,to:p,text:c?[u[f]]:u,origin:e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input"};if(Gr(e.doc,g),Ii(e,"inputRead",e,g),s&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&d.head.ch<100&&(!f||n.sel.ranges[f-1].head.line!=d.head.line)){var v=e.getModeAt(d.head).electricChars;if(v)for(var y=0;y<v.length;y++)if(s.indexOf(v.charAt(y))>-1){on(e,d.head.line,"smart");break}}}return rn(e),e.curOp.updateInput=m,e.curOp.typing=!0,i.length>1e3||i.indexOf("\n")>-1?t.value=e.display.prevInput="":e.display.prevInput=i,o&&Kt(e),e.state.pasteIncoming=e.state.cutIncoming=!1,!0}function cr(e,t){var r,n,i=e.doc;if(e.somethingSelected()){e.display.prevInput="";var o=i.sel.primary();r=rl&&(o.to().line-o.from().line>100||(n=e.getSelection()).length>1e3);var a=r?"-":n||e.getSelection();e.display.input.value=a,e.state.focused&&qa(e.display.input),Lo&&!xo&&(e.display.inputHasSelection=a)}else t||(e.display.prevInput=e.display.input.value="",Lo&&!xo&&(e.display.inputHasSelection=null));e.display.inaccurateSelection=r}function fr(e){"nocursor"==e.options.readOnly||Io&&to()==e.display.input||e.display.input.focus()}function dr(e){e.state.focused||(fr(e),Ir(e))}function hr(e){return e.options.readOnly||e.doc.cantEdit}function pr(e){function t(){e.state.focused&&setTimeout($i(fr,e),0)}function r(){null==l&&(l=setTimeout(function(){l=null,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=Za=null,e.setSize()},100))}function n(){eo(document.body,a.wrapper)?setTimeout(n,5e3):Ea(window,"resize",r)}function i(t){Pi(e,t)||za(t)}function o(t){a.inaccurateSelection&&(a.prevInput="",a.inaccurateSelection=!1,a.input.value=e.getSelection(),qa(a.input)),"cut"==t.type&&(e.state.cutIncoming=!0)}var a=e.display;Wa(a.scroller,"mousedown",Xt(e,vr)),bo?Wa(a.scroller,"dblclick",Xt(e,function(t){if(!Pi(e,t)){var r=gr(e,t);if(r&&!kr(e,t)&&!mr(e.display,t)){Oa(t);var n=cn(e.doc,r);et(e.doc,n.anchor,n.head)}}})):Wa(a.scroller,"dblclick",function(t){Pi(e,t)||Oa(t)}),Wa(a.lineSpace,"selectstart",function(e){mr(a,e)||Oa(e)}),Ro||Wa(a.scroller,"contextmenu",function(t){Pr(e,t)}),Wa(a.scroller,"scroll",function(){a.scroller.clientHeight&&(Sr(e,a.scroller.scrollTop),Mr(e,a.scroller.scrollLeft,!0),Ia(e,"scroll",e))}),Wa(a.scrollbarV,"scroll",function(){a.scroller.clientHeight&&Sr(e,a.scrollbarV.scrollTop)}),Wa(a.scrollbarH,"scroll",function(){a.scroller.clientHeight&&Mr(e,a.scrollbarH.scrollLeft)}),Wa(a.scroller,"mousewheel",function(t){Tr(e,t)}),Wa(a.scroller,"DOMMouseScroll",function(t){Tr(e,t)}),Wa(a.scrollbarH,"mousedown",t),Wa(a.scrollbarV,"mousedown",t),Wa(a.wrapper,"scroll",function(){a.wrapper.scrollTop=a.wrapper.scrollLeft=0});var l;Wa(window,"resize",r),setTimeout(n,5e3),Wa(a.input,"keyup",Xt(e,Wr)),Wa(a.input,"input",function(){Lo&&!xo&&e.display.inputHasSelection&&(e.display.inputHasSelection=null),sr(e)}),Wa(a.input,"keydown",Xt(e,zr)),Wa(a.input,"keypress",Xt(e,Er)),Wa(a.input,"focus",$i(Ir,e)),Wa(a.input,"blur",$i(Dr,e)),e.options.dragDrop&&(Wa(a.scroller,"dragstart",function(t){Lr(e,t)}),Wa(a.scroller,"dragenter",i),Wa(a.scroller,"dragover",i),Wa(a.scroller,"drop",Xt(e,Cr))),Wa(a.scroller,"paste",function(t){mr(a,t)||(e.state.pasteIncoming=!0,fr(e),sr(e))}),Wa(a.input,"paste",function(){e.state.pasteIncoming=!0,sr(e)}),Wa(a.input,"cut",o),Wa(a.input,"copy",o),Oo&&Wa(a.sizer,"mouseup",function(){to()==a.input&&a.input.blur(),fr(e)})}function mr(e,t){for(var r=Wi(t);r!=e.wrapper;r=r.parentNode)if(!r||r.ignoreEvents||r.parentNode==e.sizer&&r!=e.mover)return!0}function gr(e,t,r,n){var i=e.display;if(!r){var o=Wi(t);if(o==i.scrollbarH||o==i.scrollbarV||o==i.scrollbarFiller||o==i.gutterFiller)return null}var a,l,s=i.lineSpace.getBoundingClientRect();try{a=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var u=_t(e,a,l),c;if(n&&1==u.xRel&&(c=ui(e.doc,u.line).text).length==u.ch){var f=Va(c,c.length,e.options.tabSize)-c.length;u=Vo(u.line,Math.round((a-kt(e.display).left)/qt(e.display))-f)}return u}function vr(e){if(!Pi(this,e)){var t=this,r=t.display;if(r.shift=e.shiftKey,mr(r,e))return void(So||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!kr(t,e)){var n=gr(t,e);switch(window.focus(),Ei(e)){case 1:n?yr(t,e,n):Wi(e)==r.scroller&&Oa(e);break;case 2:So&&(t.state.lastMiddleDown=+new Date),n&&et(t.doc,n),setTimeout($i(fr,t),20),Oa(e);break;case 3:Ro&&Pr(t,e)}}}}function yr(e,t,r){setTimeout($i(dr,e),0);var n=+new Date,i;Xo&&Xo.time>n-400&&0==Go(Xo.pos,r)?i="triple":$o&&$o.time>n-400&&0==Go($o.pos,r)?(i="double",Xo={time:n,pos:r}):(i="single",$o={time:n,pos:r});var o=e.doc.sel,a=Do?t.metaKey:t.ctrlKey;e.options.dragDrop&&Ya&&!a&&!hr(e)&&"single"==i&&o.contains(r)>-1&&o.somethingSelected()?br(e,t,r):wr(e,t,r,i,a)}function br(e,t,r){var n=e.display,i=Xt(e,function(o){So&&(n.scroller.draggable=!1),e.state.draggingText=!1,Ea(document,"mouseup",i),Ea(n.scroller,"drop",i),Math.abs(t.clientX-o.clientX)+Math.abs(t.clientY-o.clientY)<10&&(Oa(o),et(e.doc,r),fr(e),bo&&!xo&&setTimeout(function(){document.body.focus(),fr(e)},20))});So&&(n.scroller.draggable=!0),e.state.draggingText=i,n.scroller.dragDrop&&n.scroller.dragDrop(),Wa(document,"mouseup",i),Wa(n.scroller,"drop",i)}function wr(e,t,r,n,i){function o(t){if(0!=Go(m,t))if(m=t,"rect"==n){for(var i=[],o=e.options.tabSize,a=Va(ui(u,r.line).text,r.ch,o),l=Va(ui(u,t.line).text,t.ch,o),s=Math.min(a,l),h=Math.max(a,l),p=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));g>=p;p++){var v=ui(u,p).text,y=ji(v,s,o);s==h?i.push(new q(Vo(p,y),Vo(p,y))):v.length>y&&i.push(new q(Vo(p,y),Vo(p,ji(v,h,o))))}i.length||i.push(new q(r,r)),at(u,U(d.ranges.slice(0,f).concat(i),f),ja)}else{var b=c,w=b.anchor,x=t;if("single"!=n){if("double"==n)var k=cn(u,t);else var k=new q(Vo(t.line,0),X(u,Vo(t.line+1,0)));Go(k.anchor,w)>0?(x=k.head,w=V(b.from(),k.anchor)):(x=k.anchor,w=_(b.to(),k.head))}var i=d.ranges.slice(0);i[f]=new q(X(u,w),x),at(u,U(i,f),ja)}}function a(t){var r=++y,i=gr(e,t,!0,"rect"==n);if(i)if(0!=Go(i,m)){dr(e),o(i);var l=g(s,u);(i.line>=l.to||i.line<l.from)&&setTimeout(Xt(e,function(){y==r&&a(t)}),150)}else{var c=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;c&&setTimeout(Xt(e,function(){y==r&&(s.scroller.scrollTop+=c,a(t))}),50)}}function l(t){y=1/0,Oa(t),fr(e),Ea(document,"mousemove",b),Ea(document,"mouseup",w),u.history.lastSelOrigin=null}var s=e.display,u=e.doc;Oa(t);var c,f,d=u.sel;if(i?(f=u.sel.contains(r),c=f>-1?u.sel.ranges[f]:new q(r,r)):c=u.sel.primary(),t.altKey)n="rect",i||(c=new q(r,r)),r=gr(e,t,!0,!0),f=-1;else if("double"==n){var h=cn(u,r);c=e.display.shift||u.extend?J(u,c,h.anchor,h.head):h}else if("triple"==n){var p=new q(Vo(r.line,0),X(u,Vo(r.line+1,0)));c=e.display.shift||u.extend?J(u,c,p.anchor,p.head):p}else c=J(u,c,r);i?f>-1?rt(u,f,c,ja):(f=u.sel.ranges.length,at(u,U(u.sel.ranges.concat([c]),f),{scroll:!1,origin:"*mouse"})):(f=0,at(u,new G([c],0),ja));var m=r,v=s.wrapper.getBoundingClientRect(),y=0,b=Xt(e,function(e){(Lo&&!ko?e.buttons:Ei(e))?a(e):l(e)}),w=Xt(e,l);Wa(document,"mousemove",b),Wa(document,"mouseup",w)}function xr(e,t,r,n,i){try{var o=t.clientX,a=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Oa(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(a>s.bottom||!Fi(e,r))return zi(t);a-=s.top-l.viewOffset;for(var u=0;u<e.options.gutters.length;++u){var c=l.gutters.childNodes[u];if(c&&c.getBoundingClientRect().right>=o){var f=pi(e.doc,a),d=e.options.gutters[u];return i(e,r,e,f,d,t),zi(t)}}}function kr(e,t){return xr(e,t,"gutterClick",!0,Ii)}function Cr(e){var t=this;if(!Pi(t,e)&&!mr(t.display,e)){Oa(e),bo&&(Yo=+new Date);var r=gr(t,e,!0),n=e.dataTransfer.files;if(r&&!hr(t))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,l=function(e,n){var l=new FileReader;l.onload=function(){if(o[n]=l.result,++a==i){r=X(t.doc,r);var e={from:r,to:r,text:el(o.join("\n")),origin:"paste"};Gr(t.doc,e),ot(t.doc,K(r,ra(e)))}},l.readAsText(e)},s=0;i>s;++s)l(n[s],s);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout($i(fr,t),20);try{var o=e.dataTransfer.getData("Text");if(o){var u=t.state.draggingText&&t.listSelections();if(lt(t.doc,K(r,r)),u)for(var s=0;s<u.length;++s)Yr(t.doc,"",u[s].anchor,u[s].head,"drag");t.replaceSelection(o,"around","paste"),fr(t)}}catch(e){}}}}function Lr(e,t){if(bo&&(!e.state.draggingText||+new Date-Yo<100))return void za(t);if(!Pi(e,t)&&!mr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!No)){var r=Zi("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",Ao&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),Ao&&r.parentNode.removeChild(r)}}function Sr(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,yo||x(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbarV.scrollTop!=t&&(e.display.scrollbarV.scrollTop=t),yo&&x(e),gt(e,100))}function Mr(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,v(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbarH.scrollLeft!=t&&(e.display.scrollbarH.scrollLeft=t))}function Tr(e,t){var r=t.wheelDeltaX,n=t.wheelDeltaY;null==r&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(r=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta);var i=e.display,o=i.scroller;if(r&&o.scrollWidth>o.clientWidth||n&&o.scrollHeight>o.clientHeight){if(n&&Do&&So)e:for(var a=t.target,l=i.view;a!=o;a=a.parentNode)for(var s=0;s<l.length;s++)if(l[s].node==a){e.display.currentWheelTarget=a;break e}if(r&&!yo&&!Ao&&null!=Qo)return n&&Sr(e,Math.max(0,Math.min(o.scrollTop+n*Qo,o.scrollHeight-o.clientHeight))),Mr(e,Math.max(0,Math.min(o.scrollLeft+r*Qo,o.scrollWidth-o.clientWidth))),Oa(t),void(i.wheelStartX=null);if(n&&null!=Qo){var u=n*Qo,c=e.doc.scrollTop,f=c+i.wrapper.clientHeight;0>u?c=Math.max(0,c+u-50):f=Math.min(e.doc.height,f+u+50),x(e,{top:c,bottom:f})}20>Zo&&(null==i.wheelStartX?(i.wheelStartX=o.scrollLeft,i.wheelStartY=o.scrollTop,i.wheelDX=r,i.wheelDY=n,setTimeout(function(){if(null!=i.wheelStartX){var e=o.scrollLeft-i.wheelStartX,t=o.scrollTop-i.wheelStartY,r=t&&i.wheelDY&&t/i.wheelDY||e&&i.wheelDX&&e/i.wheelDX;i.wheelStartX=i.wheelStartY=null,r&&(Qo=(Qo*Zo+r)/(Zo+1),++Zo)}},200)):(i.wheelDX+=r,i.wheelDY+=n))}}function Ar(e,t,r){if("string"==typeof t&&(t=ha[t],!t))return!1;e.display.pollingFast&&ur(e)&&(e.display.pollingFast=!1);var n=e.display.shift,i=!1;try{hr(e)&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Ba}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function Nr(e){var t=e.state.keyMaps.slice(0);return e.options.extraKeys&&t.push(e.options.extraKeys),t.push(e.options.keyMap),t}function Or(e,t){var r=dn(e.options.keyMap),n=r.auto;clearTimeout(Jo),n&&!ga(t)&&(Jo=setTimeout(function(){dn(e.options.keyMap)==r&&(e.options.keyMap=n.call?n.call(null,e):n,l(e))},50));var i=va(t,!0),o=!1;if(!i)return!1;var a=Nr(e);return o=t.shiftKey?ma("Shift-"+i,a,function(t){return Ar(e,t,!0)})||ma(i,a,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?Ar(e,t):void 0}):ma(i,a,function(t){return Ar(e,t)}),o&&(Oa(t),mt(e),Ii(e,"keyHandled",e,i,t)),o}function Hr(e,t,r){var n=ma("'"+r+"'",Nr(e),function(t){return Ar(e,t,!0)});return n&&(Oa(t),mt(e),Ii(e,"keyHandled",e,"'"+r+"'",t)),n}function zr(e){var t=this;if(dr(t),!Pi(t,e)){bo&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=Or(t,e);Ao&&(ea=n?r:null,!n&&88==r&&!rl&&(Do?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut"))}}function Wr(e){Pi(this,e)||16==e.keyCode&&(this.doc.sel.shift=!1)}function Er(e){var t=this;if(!Pi(t,e)){var r=e.keyCode,n=e.charCode;if(Ao&&r==ea)return ea=null,void Oa(e);if(!(Ao&&(!e.which||e.which<10)||Oo)||!Or(t,e)){var i=String.fromCharCode(null==n?r:n);Hr(t,e,i)||(Lo&&!xo&&(t.display.inputHasSelection=null),sr(t))}}}function Ir(e){"nocursor"!=e.options.readOnly&&(e.state.focused||(Ia(e,"focus",e),e.state.focused=!0,-1==e.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(e.display.wrapper.className+=" CodeMirror-focused"),e.curOp||(cr(e),So&&setTimeout($i(cr,e,!0),0))),lr(e),mt(e))}function Dr(e){e.state.focused&&(Ia(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.display.shift=!1)},150)}function Pr(e,t){function r(){if(null!=i.input.selectionStart){var t=i.input.value=""+(e.somethingSelected()?i.input.value:"");i.prevInput="",i.input.selectionStart=1,i.input.selectionEnd=t.length}}function n(){if(i.inputDiv.style.position="relative",i.input.style.cssText=s,xo&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=a),lr(e),null!=i.input.selectionStart){(!Lo||xo)&&r(),clearTimeout(ta);var t=0,n=function(){""==i.prevInput&&0==i.input.selectionStart?Xt(e,ha.selectAll)(e):t++<10?ta=setTimeout(n,500):cr(e)};ta=setTimeout(n,200)}}if(!Pi(e,t,"contextmenu")){var i=e.display;if(!mr(i,t)&&!Fr(e,t)){var o=gr(e,t),a=i.scroller.scrollTop;if(o&&!Ao){var l=e.options.resetSelectionOnContextMenu;l&&-1==e.doc.sel.contains(o)&&Xt(e,at)(e.doc,K(o),Ra);var s=i.input.style.cssText;if(i.inputDiv.style.position="absolute",i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(t.clientY-5)+"px; left: "+(t.clientX-5)+"px; z-index: 1000; background: "+(Lo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",fr(e),cr(e),e.somethingSelected()||(i.input.value=i.prevInput=" "),Lo&&!xo&&r(),Ro){za(t);var u=function(){Ea(window,"mouseup",u),setTimeout(n,20)};Wa(window,"mouseup",u)}else setTimeout(n,50)}}}}function Fr(e,t){return Fi(e,"gutterContextMenu")?xr(e,t,"gutterContextMenu",!1,Ia):!1}function Br(e,t){if(Go(e,t.from)<0)return e;if(Go(e,t.to)<=0)return ra(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=ra(t).ch-t.to.ch),Vo(r,n)}function Rr(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new q(Br(i.anchor,t),Br(i.head,t)))}return U(r,e.sel.primIndex)}function jr(e,t,r){return e.line==t.line?Vo(r.line,e.ch-t.ch+r.ch):Vo(r.line+(e.line-t.line),e.ch)}function _r(e,t,r){for(var n=[],i=Vo(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=jr(l.from,i,o),u=jr(ra(l),i,o);if(i=l.to,o=u,"around"==r){var c=e.sel.ranges[a],f=Go(c.head,c.anchor)<0;n[a]=new q(f?u:s,f?s:u)}else n[a]=new q(s,s)}return new G(n,e.sel.primIndex)}function Vr(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(t,r,n,i){t&&(this.from=X(e,t)),r&&(this.to=X(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),Ia(e,"beforeChange",e,n),e.cm&&Ia(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Gr(e,t,r){if(e.cm){if(!e.cm.curOp)return Xt(e.cm,Gr)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Fi(e,"beforeChange")||e.cm&&Fi(e.cm,"beforeChange"))||(t=Vr(e,t,!0))){var n=jo&&!r&&Ln(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)qr(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else qr(e,t)}}function qr(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Go(t.from,t.to)){var r=Rr(e,t);xi(e,t,r,e.cm?e.cm.curOp.id:0/0),$r(e,t,r,xn(e,t));var n=[];li(e,function(e,r){r||-1!=Gi(n,e.history)||(Hi(e.history,t),n.push(e.history)),$r(e,t,null,xn(e,t))})}}function Ur(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n=e.history,i,o=e.sel,a="undo"==t?n.done:n.undone,l="undo"==t?n.undone:n.done,s=0;s<a.length&&(i=a[s],r?!i.ranges||i.equals(e.sel):i.ranges);s++);if(s!=a.length){for(n.lastOrigin=n.lastSelOrigin=null;i=a.pop(),i.ranges;){if(Li(i,l),r&&!i.equals(e.sel))return void at(e,i,{clearRedo:!1});o=i}var u=[];Li(o,l),l.push({changes:u,generation:n.generation}),n.generation=i.generation||++n.maxGeneration;for(var c=Fi(e,"beforeChange")||e.cm&&Fi(e.cm,"beforeChange"),s=i.changes.length-1;s>=0;--s){var f=i.changes[s];if(f.origin=t,c&&!Vr(e,f,!1))return void(a.length=0);u.push(yi(e,f));var d=s?Rr(e,f,null):Vi(a);$r(e,f,d,Cn(e,f)),e.cm&&rn(e.cm);var h=[];li(e,function(e,t){t||-1!=Gi(h,e.history)||(Hi(e.history,f),h.push(e.history)),$r(e,f,null,Cn(e,f))})}}}}function Kr(e,t){e.first+=t,e.sel=new G(qi(e.sel.ranges,function(e){return new q(Vo(e.anchor.line+t,e.anchor.ch),Vo(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm&&er(e.cm,e.first,e.first-t,t)}function $r(e,t,r,n){if(e.cm&&!e.cm.curOp)return Xt(e.cm,$r)(e,t,r,n);if(t.to.line<e.first)return void Kr(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Kr(e,i),t={from:Vo(e.first,0),to:Vo(t.to.line+i,t.to.ch),text:[Vi(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Vo(o,ui(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ci(e,t.from,t.to),r||(r=Rr(e,t,null)),e.cm?Xr(e.cm,t,n):ii(e,t,n),lt(e,r,Ra)}}function Xr(e,t,r){var n=e.doc,i=e.display,a=t.from,l=t.to,s=!1,u=a.line;e.options.lineWrapping||(u=hi(En(ui(n,a.line))),n.iter(u,l.line+1,function(e){return e==i.maxLine?(s=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&(e.curOp.cursorActivity=!0),ii(n,t,r,o(e)),e.options.lineWrapping||(n.iter(u,a.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),gt(e,400);var c=t.text.length-(l.line-a.line)-1;a.line!=l.line||1!=t.text.length||ni(e.doc,t)?er(e,a.line,l.line+1,c):tr(e,a.line,"text"),(Fi(e,"change")||Fi(e,"changes"))&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push({from:a,to:l,text:t.text,removed:t.removed,origin:t.origin})}function Yr(e,t,r,n,i){if(n||(n=r),Go(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=el(t)),Gr(e,{from:r,to:n,text:t,origin:i})}function Zr(e,t){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!Wo){var o=Zi("div","",null,"position: absolute; top: "+(t.top-r.viewOffset-wt(e.display))+"px; height: "+(t.bottom-t.top+Fa)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}function Qr(e,t,r,n){for(null==n&&(n=0);;){var i=!1,o=Bt(e,t),a=r&&r!=t?Bt(e,r):o,l=en(e,Math.min(o.left,a.left),Math.min(o.top,a.top)-n,Math.max(o.left,a.left),Math.max(o.bottom,a.bottom)+n),s=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=l.scrollTop&&(Sr(e,l.scrollTop),Math.abs(e.doc.scrollTop-s)>1&&(i=!0)),null!=l.scrollLeft&&(Mr(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(i=!0)),!i)return o}}function Jr(e,t,r,n,i){var o=en(e,t,r,n,i);null!=o.scrollTop&&Sr(e,o.scrollTop),null!=o.scrollLeft&&Mr(e,o.scrollLeft)}function en(e,t,r,n,i){var o=e.display,a=Gt(e.display);0>r&&(r=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=o.scroller.clientHeight-Fa,u={},c=e.doc.height+xt(o),f=a>r,d=i>c-a;if(l>r)u.scrollTop=f?0:r;else if(i>l+s){var h=Math.min(r,(d?c:i)-s);h!=l&&(u.scrollTop=h)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=o.scroller.clientWidth-Fa;t+=o.gutters.offsetWidth,n+=o.gutters.offsetWidth;var g=o.gutters.offsetWidth,v=g+10>t;return p+g>t||v?(v&&(t=0),u.scrollLeft=Math.max(0,t-10-g)):n>m+p-3&&(u.scrollLeft=n+10-m),u}function tn(e,t,r){(null!=t||null!=r)&&nn(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function rn(e){nn(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Vo(t.line,t.ch-1):t,n=Vo(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function nn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=Rt(e,t.from),n=Rt(e,t.to),i=en(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function on(e,t,r,n){var i=e.doc,o;null==r&&(r="add"),"smart"==r&&(e.doc.mode.indent?o=bt(e,t):r="prev");var a=e.options.tabSize,l=ui(i,t),s=Va(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var u=l.text.match(/^\s*/)[0],c;if(n||/\S/.test(l.text)){if("smart"==r&&(c=e.doc.mode.indent(o,l.text.slice(u.length),l.text),c==Ba)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>i.first?Va(ui(i,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)d+=a,f+=" ";if(c>d&&(f+=_i(c-d)),f!=u)Yr(e.doc,f,Vo(t,0),Vo(t,u.length),"+input");else for(var h=0;h<i.sel.ranges.length;h++){var p=i.sel.ranges[h];if(p.head.line==t&&p.head.ch<u.length){var d=Vo(t,u.length);rt(i,h,new q(d,d));break}}l.stateAfter=null}function an(e,t,r,n){var i=t,o=t,a=e.doc;return"number"==typeof t?o=ui(a,$(a,t)):i=hi(t),null==i?null:n(o,i)?(tr(e,i,r),o):null}function ln(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&Go(o.from,Vi(n).to)<=0;){var a=n.pop();if(Go(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}$t(e,function(){for(var t=n.length-1;t>=0;t--)Yr(e.doc,"",n[t].from,n[t].to,"+delete");rn(e)})}function sn(e,t,r,n,i){function o(){var t=l+r;return t<e.first||t>=e.first+e.size?f=!1:(l=t,c=ui(e,t))}function a(e){var t=(i?go:vo)(c,s,r,!0);if(null==t){if(e||!o())return f=!1;s=i?(0>r?uo:so)(c):0>r?c.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,u=r,c=ui(e,l),f=!0;if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var d=null,h="group"==n,p=!0;!(0>r)||a(!p);p=!1){var m=c.text.charAt(s)||"\n",g=Ka(m)?"w":h&&"\n"==m?"n":!h||/\s/.test(m)?null:"p";if(!h||p||g||(g="s"),d&&d!=g){0>r&&(r=1,a());break}if(g&&(d=g),r>0&&!a(!p))break}var v=ft(e,Vo(l,s),u,!0);return f||(v.hitSide=!0),v}function un(e,t,r,n){var i=e.doc,o=t.left,a;if("page"==n){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);a=t.top+r*(l-(0>r?1.5:.5)*Gt(e.display))}else"line"==n&&(a=r>0?t.bottom+3:t.top-3);for(;;){var s=_t(e,o,a);if(!s.outside)break;if(0>r?0>=a:a>=i.height){s.hitSide=!0;break}a+=5*r}return s}function cn(e,t){var r=ui(e,t.line).text,n=t.ch,i=t.ch;if(r){(t.xRel<0||i==r.length)&&n?--n:++i;for(var o=r.charAt(n),a=Ka(o)?Ka:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Ka(e)};n>0&&a(r.charAt(n-1));)--n;for(;i<r.length&&a(r.charAt(i));)++i}return new q(Vo(t.line,n),Vo(t.line,i))}function fn(t,r,n,i){e.defaults[t]=r,n&&(ia[t]=i?function(e,t,r){r!=oa&&n(e,t,r)}:n)}function dn(e){return"string"==typeof e?pa[e]:e}function hn(e,t,r,n,i){if(n&&n.shared)return pn(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Xt(e.cm,hn)(e,t,r,n,i);var o=new ba(e,i),a=Go(t,r);if(n&&Ki(n,o),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Zi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||(o.widgetNode.ignoreEvents=!0),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Wn(e,t.line,t,r,o)||t.line!=r.line&&Wn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");_o=!0}o.addToHistory&&xi(e,{from:t,to:r,origin:"markText"},e.sel,0/0);var l=t.line,s=e.cm,u;if(e.iter(l,r.line+1,function(e){s&&o.collapsed&&!s.options.lineWrapping&&En(e)==s.display.maxLine&&(u=!0),o.collapsed&&l!=t.line&&di(e,0),yn(e,new mn(o,l==t.line?t.ch:null,l==r.line?r.ch:null)),++l}),o.collapsed&&e.iter(t.line,r.line+1,function(t){Fn(e,t)&&di(t,0)}),o.clearOnEnter&&Wa(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(jo=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++wa,o.atomic=!0),s){if(u&&(s.curOp.updateMaxLine=!0),o.collapsed)er(s,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle)for(var c=t.line;c<=r.line;c++)tr(s,c,"text");o.atomic&&ut(s.doc),Ii(s,"markerAdded",s,o)}return o}function pn(e,t,r,n,i){n=Ki(n),n.shared=!1;var o=[hn(e,t,r,n,i)],a=o[0],l=n.widgetNode;return li(e,function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push(hn(e,X(e,t),X(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;
|
3 |
+
a=Vi(o)}),new xa(o,a)}function mn(e,t,r){this.marker=e,this.from=t,this.to=r}function gn(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function vn(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function yn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function bn(e,t,r){if(e)for(var n=0,i;n<e.length;++n){var o=e[n],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(i||(i=[])).push(new mn(a,o.from,s?null:o.to))}}return i}function wn(e,t,r){if(e)for(var n=0,i;n<e.length;++n){var o=e[n],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(i||(i=[])).push(new mn(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return i}function xn(e,t){var r=Z(e,t.from.line)&&ui(e,t.from.line).markedSpans,n=Z(e,t.to.line)&&ui(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==Go(t.from,t.to),l=bn(r,i,a),s=wn(n,o,a),u=1==t.text.length,c=Vi(t.text).length+(u?i:0);if(l)for(var f=0;f<l.length;++f){var d=l[f];if(null==d.to){var h=gn(s,d.marker);h?u&&(d.to=null==h.to?null:h.to+c):d.to=i}}if(s)for(var f=0;f<s.length;++f){var d=s[f];if(null!=d.to&&(d.to+=c),null==d.from){var h=gn(l,d.marker);h||(d.from=c,u&&(l||(l=[])).push(d))}else d.from+=c,u&&(l||(l=[])).push(d)}l&&(l=kn(l)),s&&s!=l&&(s=kn(s));var p=[l];if(!u){var m=t.text.length-2,g;if(m>0&&l)for(var f=0;f<l.length;++f)null==l[f].to&&(g||(g=[])).push(new mn(l[f].marker,null,null));for(var f=0;m>f;++f)p.push(g);p.push(s)}return p}function kn(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Cn(e,t){var r=Ti(e,t),n=xn(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function Ln(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=Gi(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var u=i[s];if(!(Go(u.to,l.from)<0||Go(u.from,l.to)>0)){var c=[s,1],f=Go(u.from,l.from),d=Go(u.to,l.to);(0>f||!a.inclusiveLeft&&!f)&&c.push({from:u.from,to:l.from}),(d>0||!a.inclusiveRight&&!d)&&c.push({from:l.to,to:u.to}),i.splice.apply(i,c),s+=c.length-1}}return i}function Sn(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function Mn(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Tn(e){return e.inclusiveLeft?-1:0}function An(e){return e.inclusiveRight?1:0}function Nn(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=Go(n.from,i.from)||Tn(e)-Tn(t);if(o)return-o;var a=Go(n.to,i.to)||An(e)-An(t);return a?a:t.id-e.id}function On(e,t){var r=_o&&e.markedSpans,n;if(r)for(var i,o=0;o<r.length;++o)i=r[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!n||Nn(n,i.marker)<0)&&(n=i.marker);return n}function Hn(e){return On(e,!0)}function zn(e){return On(e,!1)}function Wn(e,t,r,n,i){var o=ui(e,t),a=_o&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var u=s.marker.find(0),c=Go(u.from,r)||Tn(s.marker)-Tn(i),f=Go(u.to,n)||An(s.marker)-An(i);if(!(c>=0&&0>=f||0>=c&&f>=0)&&(0>=c&&(Go(u.to,r)||An(s.marker)-Tn(i))>0||c>=0&&(Go(u.from,n)||Tn(s.marker)-An(i))<0))return!0}}}function En(e){for(var t;t=Hn(e);)e=t.find(-1,!0).line;return e}function In(e){for(var t,r;t=zn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function Dn(e,t){var r=ui(e,t),n=En(r);return r==n?t:hi(n)}function Pn(e,t){if(t>e.lastLine())return t;var r=ui(e,t),n;if(!Fn(e,r))return t;for(;n=zn(r);)r=n.find(1,!0).line;return hi(r)+1}function Fn(e,t){var r=_o&&t.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Bn(e,t,n))return!0}}function Bn(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Bn(e,n.line,gn(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Bn(e,t,i))return!0}function Rn(e,t,r){mi(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&tn(e,null,r)}function jn(e){return null!=e.height?e.height:(eo(document.body,e.node)||Ji(e.cm.display.measure,Zi("div",[e.node],null,"position: relative")),e.height=e.node.offsetHeight)}function _n(e,t,r,n){var i=new ka(e,r,n);return i.noHScroll&&(e.display.alignWidgets=!0),an(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,!Fn(e.doc,t)){var n=mi(t)<e.doc.scrollTop;di(t,t.height+jn(i)),n&&tn(e,null,i.height),e.curOp.forceUpdate=!0}return!0}),i}function Vn(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Sn(e),Mn(e,r);var i=n?n(e):1;i!=e.height&&di(e,i)}function Gn(e){e.parent=null,Sn(e)}function qn(t,r,n,i,o,a){var l=n.flattenSpans;null==l&&(l=t.options.flattenSpans);var s=0,u=null,c=new ya(r,t.options.tabSize),f;for(""==r&&n.blankLine&&n.blankLine(i);!c.eol();){if(c.pos>t.options.maxHighlightLength?(l=!1,a&&$n(t,r,i,c.pos),c.pos=r.length,f=null):f=n.token(c,i),t.options.addModeClass){var d=e.innerMode(n,i).mode.name;d&&(f="m-"+(f?d+" "+f:d))}l&&u==f||(s<c.start&&o(c.start,u),s=c.start,u=f),c.start=c.pos}for(;s<c.pos;){var h=Math.min(c.pos,s+5e4);o(h,u),s=h}}function Un(e,t,r,n){var i=[e.state.modeGen];qn(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},n);for(var o=0;o<e.state.overlays.length;++o){var a=e.state.overlays[o],l=1,s=0;qn(e,t.text,a.mode,!0,function(e,t){for(var r=l;e>s;){var n=i[l];n>e&&i.splice(l,1,e,i[l+1],n),l+=2,s=Math.min(e,n)}if(t)if(a.opaque)i.splice(r,l-r,e,t),l=r+2;else for(;l>r;r+=2){var o=i[r+1];i[r+1]=o?o+" "+t:t}})}return i}function Kn(e,t){return t.styles&&t.styles[0]==e.state.modeGen||(t.styles=Un(e,t,t.stateAfter=bt(e,hi(t)))),t.styles}function $n(e,t,r,n){var i=e.doc.mode,o=new ya(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&i.blankLine&&i.blankLine(r);!o.eol()&&o.pos<=e.options.maxHighlightLength;)i.token(o,r),o.start=o.pos}function Xn(e,t){if(!e)return null;for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}if(/^\s*$/.test(e))return null;var i=t.cm.options.addModeClass?Sa:La;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Yn(e,t){var r=Zi("span",null,null,So?"padding-right: .1px":null),n={pre:Zi("pre",[r]),content:r,col:0,pos:0,cm:e};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a;n.pos=0,n.addToken=Qn,(Lo||So)&&e.getOption("lineWrapping")&&(n.addToken=Jn(n.addToken)),io(e.display.measure)&&(a=gi(o))&&(n.addToken=ei(n.addToken,a)),n.map=[],ri(o,n,Kn(e,o)),0==n.map.length&&n.map.push(0,0,n.content.appendChild(no(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return Ia(e,"renderLine",e,t.line,n.pre),n}function Zn(e){var t=Zi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t}function Qn(e,t,r,n,i,o){if(t){var a=e.cm.options.specialChars,l=!1;if(a.test(t))for(var s=document.createDocumentFragment(),u=0;;){a.lastIndex=u;var c=a.exec(t),f=c?c.index-u:t.length-u;if(f){var d=document.createTextNode(t.slice(u,u+f));s.appendChild(xo?Zi("span",[d]):d),e.map.push(e.pos,e.pos+f,d),e.col+=f,e.pos+=f}if(!c)break;if(u+=f+1," "==c[0]){var h=e.cm.options.tabSize,p=h-e.col%h,d=s.appendChild(Zi("span",_i(p),"cm-tab"));e.col+=p}else{var d=e.cm.options.specialCharPlaceholder(c[0]);s.appendChild(xo?Zi("span",[d]):d),e.col+=1}e.map.push(e.pos,e.pos+1,d),e.pos++}else{e.col+=t.length;var s=document.createTextNode(t);e.map.push(e.pos,e.pos+t.length,s),xo&&(l=!0),e.pos+=t.length}if(r||n||i||l){var m=r||"";n&&(m+=n),i&&(m+=i);var g=Zi("span",[s],m);return o&&(g.title=o),e.content.appendChild(g)}e.content.appendChild(s)}}function Jn(e){function t(e){for(var t=" ",r=0;r<e.length-2;++r)t+=r%2?" ":" ";return t+=" "}return function(r,n,i,o,a,l){e(r,n.replace(/ {3,}/g,t),i,o,a,l)}}function ei(e,t){return function(r,n,i,o,a,l){i=i?i+" cm-force-border":"cm-force-border";for(var s=r.pos,u=s+n.length;;){for(var c=0;c<t.length;c++){var f=t[c];if(f.to>s&&f.from<=s)break}if(f.to>=u)return e(r,n,i,o,a,l);e(r,n.slice(0,f.to-s),i,o,null,l),o=null,n=n.slice(f.to-s),s=f.to}}}function ti(e,t,r,n){var i=!n&&r.widgetNode;i&&(e.map.push(e.pos,e.pos+t,i),e.content.appendChild(i)),e.pos+=t}function ri(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a=i.length,l=0,s=1,u="",c,f=0,d,h,p,m,g;;){if(f==l){d=h=p=m="",g=null,f=1/0;for(var v=[],y=0;y<n.length;++y){var b=n[y],w=b.marker;b.from<=l&&(null==b.to||b.to>l)?(null!=b.to&&f>b.to&&(f=b.to,h=""),w.className&&(d+=" "+w.className),w.startStyle&&b.from==l&&(p+=" "+w.startStyle),w.endStyle&&b.to==f&&(h+=" "+w.endStyle),w.title&&!m&&(m=w.title),w.collapsed&&(!g||Nn(g.marker,w)<0)&&(g=b)):b.from>l&&f>b.from&&(f=b.from),"bookmark"==w.type&&b.from==l&&w.widgetNode&&v.push(w)}if(g&&(g.from||0)==l&&(ti(t,(null==g.to?a+1:g.to)-l,g.marker,null==g.from),null==g.to))return;if(!g&&v.length)for(var y=0;y<v.length;++y)ti(t,0,v[y])}if(l>=a)break;for(var x=Math.min(a,f);;){if(u){var k=l+u.length;if(!g){var C=k>x?u.slice(0,x-l):u;t.addToken(t,C,c?c+d:d,p,l+C.length==f?h:"",m)}if(k>=x){u=u.slice(x-l),l=x;break}l=k,p=""}u=i.slice(o,o=r[s++]),c=Xn(r[s++],t)}}else for(var s=1;s<r.length;s+=2)t.addToken(t,i.slice(o,o=r[s]),Xn(r[s+1],t))}function ni(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Vi(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ii(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){Vn(e,r,i,n),Ii(e,"change",e,t)}var a=t.from,l=t.to,s=t.text,u=ui(e,a.line),c=ui(e,l.line),f=Vi(s),d=i(s.length-1),h=l.line-a.line;if(ni(e,t)){for(var p=0,m=[];p<s.length-1;++p)m.push(new Ca(s[p],i(p),n));o(c,c.text,d),h&&e.remove(a.line,h),m.length&&e.insert(a.line,m)}else if(u==c)if(1==s.length)o(u,u.text.slice(0,a.ch)+f+u.text.slice(l.ch),d);else{for(var m=[],p=1;p<s.length-1;++p)m.push(new Ca(s[p],i(p),n));m.push(new Ca(f+u.text.slice(l.ch),d,n)),o(u,u.text.slice(0,a.ch)+s[0],i(0)),e.insert(a.line+1,m)}else if(1==s.length)o(u,u.text.slice(0,a.ch)+s[0]+c.text.slice(l.ch),i(0)),e.remove(a.line+1,h);else{o(u,u.text.slice(0,a.ch)+s[0],i(0)),o(c,f+c.text.slice(l.ch),d);for(var p=1,m=[];p<s.length-1;++p)m.push(new Ca(s[p],i(p),n));h>1&&e.remove(a.line+1,h-1),e.insert(a.line+1,m)}Ii(e,"change",e,t)}function oi(e){this.lines=e,this.parent=null;for(var t=0,r=0;t<e.length;++t)e[t].parent=this,r+=e[t].height;this.height=r}function ai(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}function li(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;(!r||s)&&(t(l.doc,s),n(l.doc,e,s))}}}n(e,null,!0)}function si(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),r(e),e.options.lineWrapping||d(e),e.options.mode=t.modeOption,er(e)}function ui(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(o>t){r=i;break}t-=o}return r.lines[t]}function ci(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function fi(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function di(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function hi(e){if(null==e.parent)return null;for(var t=e.parent,r=Gi(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function pi(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(o>t){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;n<e.lines.length;++n){var a=e.lines[n],l=a.height;if(l>t)break;t-=l}return r+n}function mi(e){e=En(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var n=0;n<o.children.length;++n){var a=o.children[n];if(a==r)break;t+=a.height}return t}function gi(e){var t=e.order;return null==t&&(t=e.order=ol(e.text)),t}function vi(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function yi(e,t){var r={from:j(t.from),to:ra(t),text:ci(e,t.from,t.to)};return Si(e,r,t.from.line,t.to.line+1),li(e,function(e){Si(e,r,t.from.line,t.to.line+1)},!0),r}function bi(e){for(;e.length;){var t=Vi(e);if(!t.ranges)break;e.pop()}}function wi(e,t){return t?(bi(e.done),Vi(e.done)):e.done.length&&!Vi(e.done).ranges?Vi(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Vi(e.done)):void 0}function xi(e,t,r,n){var i=e.history;i.undone.length=0;var o=+new Date,a;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>o-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(a=wi(i,i.lastOp==n))){var l=Vi(a.changes);0==Go(t.from,t.to)&&0==Go(t.from,l.to)?l.to=ra(t):a.changes.push(yi(e,t))}else{var s=Vi(i.done);for(s&&s.ranges||Li(e.sel,i.done),a={changes:[yi(e,t)],generation:i.generation},i.done.push(a);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=o,i.lastOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||Ia(e,"historyAdded")}function ki(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Ci(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ki(e,o,Vi(i.done),t))?i.done[i.done.length-1]=t:Li(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastOp=r,n&&n.clearRedo!==!1&&bi(i.undone)}function Li(e,t){var r=Vi(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Si(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function Mi(e){if(!e)return null;for(var t=0,r;t<e.length;++t)e[t].marker.explicitlyCleared?r||(r=e.slice(0,t)):r&&r.push(e[t]);return r?r.length?r:null:e}function Ti(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(Mi(r[n]));return i}function Ai(e,t,r){for(var n=0,i=[];n<e.length;++n){var o=e[n];if(o.ranges)i.push(r?G.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];i.push({changes:l});for(var s=0;s<a.length;++s){var u=a[s],c;if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&Gi(t,Number(c[1]))>-1&&(Vi(l)[f]=u[f],delete u[f])}}}return i}function Ni(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Oi(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var l=0;l<o.ranges.length;l++)Ni(o.ranges[l].anchor,t,r,n),Ni(o.ranges[l].head,t,r,n)}else{for(var l=0;l<o.changes.length;++l){var s=o.changes[l];if(r<s.from.line)s.from=Vo(s.from.line+n,s.from.ch),s.to=Vo(s.to.line+n,s.to.ch);else if(t<=s.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function Hi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;Oi(e.done,r,n,i),Oi(e.undone,r,n,i)}function zi(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Wi(e){return e.target||e.srcElement}function Ei(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Do&&e.ctrlKey&&1==t&&(t=3),t}function Ii(e,t){function r(e){return function(){e.apply(null,i)}}var n=e._handlers&&e._handlers[t];if(n){var i=Array.prototype.slice.call(arguments,2);Da||(++Pa,Da=[],setTimeout(Di,0));for(var o=0;o<n.length;++o)Da.push(r(n[o]))}}function Di(){--Pa;var e=Da;Da=null;for(var t=0;t<e.length;++t)e[t]()}function Pi(e,t,r){return Ia(e,r||t.type,e,t),zi(t)||t.codemirrorIgnore}function Fi(e,t){var r=e._handlers&&e._handlers[t];return r&&r.length>0}function Bi(e){e.prototype.on=function(e,t){Wa(this,e,t)},e.prototype.off=function(e,t){Ea(this,e,t)}}function Ri(){this.id=null}function ji(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}function _i(e){for(;Ga.length<=e;)Ga.push(Vi(Ga)+" ");return Ga[e]}function Vi(e){return e[e.length-1]}function Gi(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function qi(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Ui(e,t){var r;if(Object.create)r=Object.create(e);else{var n=function(){};n.prototype=e,r=new n}return t&&Ki(t,r),r}function Ki(e,t){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function $i(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Xi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Yi(e){return e.charCodeAt(0)>=768&&$a.test(e)}function Zi(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function Qi(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Ji(e,t){return Qi(e).appendChild(t)}function eo(e,t){if(e.contains)return e.contains(t);for(;t=t.parentNode;)if(t==e)return!0}function to(){return document.activeElement}function ro(e){if(null!=Za)return Za;var t=Zi("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return Ji(e,t),t.offsetWidth&&(Za=t.offsetHeight-t.clientHeight),Za||0}function no(e){if(null==Qa){var t=Zi("span","");Ji(e,Zi("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Qa=t.offsetWidth<=1&&t.offsetHeight>2&&!wo)}return Qa?Zi("span",""):Zi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function io(e){if(null!=Ja)return Ja;var t=Ji(e,document.createTextNode("AخA")),r=Xa(t,0,1).getBoundingClientRect();if(r.left==r.right)return!1;var n=Xa(t,1,2).getBoundingClientRect();return Ja=n.right-r.right<3}function oo(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function ao(e){return e.level%2?e.to:e.from}function lo(e){return e.level%2?e.from:e.to}function so(e){var t=gi(e);return t?ao(t[0]):0}function uo(e){var t=gi(e);return t?lo(Vi(t)):e.text.length}function co(e,t){var r=ui(e.doc,t),n=En(r);n!=r&&(t=hi(n));var i=gi(n),o=i?i[0].level%2?uo(n):so(n):0;return Vo(t,o)}function fo(e,t){for(var r,n=ui(e.doc,t);r=zn(n);)n=r.find(1,!0).line,t=null;var i=gi(n),o=i?i[0].level%2?so(n):uo(n):n.text.length;return Vo(null==t?hi(n):t,o)}function ho(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function po(e,t){il=null;for(var r=0,n;r<e.length;++r){var i=e[r];if(i.from<t&&i.to>t)return r;if(i.from==t||i.to==t){if(null!=n)return ho(e,i.level,e[n].level)?(i.from!=i.to&&(il=n),r):(i.from!=i.to&&(il=r),n);n=r}}return n}function mo(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Yi(e.text.charAt(t)));return t}function go(e,t,r,n){var i=gi(e);if(!i)return vo(e,t,r,n);for(var o=po(i,t),a=i[o],l=mo(e,t,a.level%2?-r:r,n);;){if(l>a.from&&l<a.to)return l;if(l==a.from||l==a.to)return po(i,l)==o?l:(a=i[o+=r],r>0==a.level%2?a.to:a.from);if(a=i[o+=r],!a)return null;l=r>0==a.level%2?mo(e,a.to,-1,n):mo(e,a.from,1,n)}}function vo(e,t,r,n){var i=t+r;if(n)for(;i>0&&Yi(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var yo=/gecko\/\d/i.test(navigator.userAgent),bo=/MSIE \d/.test(navigator.userAgent),wo=bo&&(null==document.documentMode||document.documentMode<8),xo=bo&&(null==document.documentMode||document.documentMode<9),ko=bo&&(null==document.documentMode||document.documentMode<10),Co=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),Lo=bo||Co,So=/WebKit\//.test(navigator.userAgent),Mo=So&&/Qt\/\d+\.\d+/.test(navigator.userAgent),To=/Chrome\//.test(navigator.userAgent),Ao=/Opera\//.test(navigator.userAgent),No=/Apple Computer/.test(navigator.vendor),Oo=/KHTML\//.test(navigator.userAgent),Ho=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),zo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Wo=/PhantomJS/.test(navigator.userAgent),Eo=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Io=Eo||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Do=Eo||/Mac/.test(navigator.platform),Po=/win/i.test(navigator.platform),Fo=Ao&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Fo&&(Fo=Number(Fo[1])),Fo&&Fo>=15&&(Ao=!1,So=!0);var Bo=Do&&(Mo||Ao&&(null==Fo||12.11>Fo)),Ro=yo||Lo&&!xo,jo=!1,_o=!1,Vo=e.Pos=function(e,t){return this instanceof Vo?(this.line=e,void(this.ch=t)):new Vo(e,t)},Go=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch};G.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(0!=Go(r.anchor,n.anchor)||0!=Go(r.head,n.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new q(j(this.ranges[t].anchor),j(this.ranges[t].head));return new G(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(Go(t,n.from())>=0&&Go(e,n.to())<=0)return r}return-1}},q.prototype={from:function(){return V(this.anchor,this.head)},to:function(){return _(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var qo={left:0,right:0,top:0,bottom:0},Uo,Ko=0,$o,Xo,Yo=0,Zo=0,Qo=null;Lo?Qo=-.53:yo?Qo=15:To?Qo=-.7:No&&(Qo=-1/3);var Jo,ea=null,ta,ra=e.changeEnd=function(e){return e.text?Vo(e.from.line+e.text.length-1,Vi(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),fr(this),sr(this)},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,ia.hasOwnProperty(e)&&Xt(this,ia[e])(this,t,n))},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){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||"string"!=typeof t[r]&&t[r].name==e)return t.splice(r,1),!0},addOverlay:Yt(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:t,opaque:r&&r.opaque}),this.state.modeGen++,er(this)}),removeOverlay:Yt(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void er(this)}}),indentLine:Yt(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Z(this.doc,e)&&on(this,e,t,r)}),indentSelection:Yt(function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(on(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&rn(this));else{var o=Math.max(r,i.from().line),a=i.to();r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=o;r>l;++l)on(this,l,e)}}}),getTokenAt:function(e,t){var r=this.doc;e=X(r,e);for(var n=bt(this,e.line,t),i=this.doc.mode,o=ui(r,e.line),a=new ya(o.text,this.options.tabSize);a.pos<e.ch&&!a.eol();){a.start=a.pos;var l=i.token(a,n)}return{start:a.start,end:a.pos,string:a.current(),type:l||null,state:n}},getTokenTypeAt:function(e){e=X(this.doc,e);var t=Kn(this,ui(this.doc,e.line)),r=0,n=(t.length-1)/2,i=e.ch;if(0==i)return t[2];for(;;){var o=r+n>>1;if((o?t[2*o-1]:0)>=i)n=o;else{if(!(t[2*o+1]<i))return t[2*o+2];r=o+1}}},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!ca.hasOwnProperty(t))return ca;var n=ca[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var a=n[i[t][o]];a&&r.push(a)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var o=0;o<n._global.length;o++){var l=n._global[o];l.pred(i,this)&&-1==Gi(r,l.val)&&r.push(l.val)}return r},getStateAfter:function(e,t){var r=this.doc;return e=$(r,null==e?r.first+r.size-1:e),bt(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?X(this.doc,e):e?n.from():n.to(),Bt(this,r,t||"page")},charCoords:function(e,t){return Ft(this,X(this.doc,e),t||"page")},coordsChar:function(e,t){return e=Pt(this,e,t||"page"),_t(this,e.left,e.top)},lineAtHeight:function(e,t){return e=Pt(this,{top:e,left:0},t||"page").top,pi(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r=!1,n=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>n&&(e=n,r=!0);var i=ui(this.doc,e);return Dt(this,i,{top:0,left:0},t||"page").top+(r?this.doc.height-mi(i):0)},defaultTextHeight:function(){return Gt(this.display)},defaultCharWidth:function(){return qt(this.display)},setGutterMarker:Yt(function(e,t,r){return an(this,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&Xi(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Yt(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,tr(t,n,"gutter"),Xi(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),addLineClass:Yt(function(e,t,r){return an(this,e,"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"wrapClass";if(e[n]){if(new RegExp("(?:^|\\s)"+r+"(?:$|\\s)").test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:Yt(function(e,t,r){return an(this,e,"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(new RegExp("(?:^|\\s+)"+r+"(?:$|\\s+)"));if(!o)return!1;var a=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:Yt(function(e,t,r){return _n(this,e,t,r)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if("number"==typeof e){if(!Z(this.doc,e))return null;var t=e;if(e=ui(this.doc,e),!e)return null}else{var t=hi(e);if(null==t)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.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=Bt(this,X(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>u&&(l=u-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),r&&Jr(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Yt(zr),triggerOnKeyPress:Yt(Er),triggerOnKeyUp:Yt(Wr),execCommand:function(e){return ha.hasOwnProperty(e)?ha[e](this):void 0},findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=X(this.doc,e);t>o&&(a=sn(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:Yt(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?sn(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},_a)}),deleteH:Yt(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):ln(this,function(r){var i=sn(n,r.head,e,t,!1);return 0>e?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var a=0,l=X(this.doc,e);t>a;++a){var s=Bt(this,l,"div");if(null==o?o=s.left:s.left=o,l=un(this,s,i,r),l.hitSide)break}return l},moveV:Yt(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var l=Bt(r,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=un(r,l,e,t);return"page"==t&&a==n.sel.primary()&&tn(r,null,Ft(r,s,"div").top-l.top),s},_a),i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]}),toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursorDiv.className+=" CodeMirror-overwrite":this.display.cursorDiv.className=this.display.cursorDiv.className.replace(" CodeMirror-overwrite",""),Ia(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return to()==this.display.input},scrollTo:Yt(function(e,t){(null!=e||null!=t)&&nn(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller,t=Fa;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-t,width:e.scrollWidth-t,clientHeight:e.clientHeight-t,clientWidth:e.clientWidth-t}},scrollIntoView:Yt(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:Vo(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)nn(this),this.curOp.scrollToPos=e;else{var r=en(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(r.scrollLeft,r.scrollTop)}}),setSize:Yt(function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&zt(this),this.curOp.forceUpdate=!0,Ia(this,"refresh",this)}),operation:function(e){return $t(this,e)},refresh:Yt(function(){var e=this.display.cachedTextHeight;er(this),Wt(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),(null==e||Math.abs(e-Gt(this.display))>.5)&&a(this),Ia(this,"refresh",this)
|
4 |
+
}),swapDoc:Yt(function(e){var t=this.doc;return t.cm=null,si(this,e),Wt(this),cr(this),this.scrollTo(e.scrollLeft,e.scrollTop),Ii(this,"swapDoc",this,t),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}},Bi(e);var na=e.defaults={},ia=e.optionHandlers={},oa=e.Init={toString:function(){return"CodeMirror.Init"}};fn("value","",function(e,t){e.setValue(t)},!0),fn("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),fn("indentUnit",2,r,!0),fn("indentWithTabs",!1),fn("smartIndent",!0),fn("tabSize",4,function(e){n(e),Wt(e),er(e)},!0),fn("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),fn("specialCharPlaceholder",Zn,function(e){e.refresh()},!0),fn("electricChars",!0),fn("rtlMoveVisually",!Po),fn("wholeLineUpdateBefore",!0),fn("theme","default",function(e){s(e),u(e)},!0),fn("keyMap","default",l),fn("extraKeys",null),fn("lineWrapping",!1,i,!0),fn("gutters",[],function(e){h(e.options),u(e)},!0),fn("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?w(e.display)+"px":"0",e.refresh()},!0),fn("coverGutterNextToScrollbar",!1,m,!0),fn("lineNumbers",!1,function(e){h(e.options),u(e)},!0),fn("firstLineNumber",1,u,!0),fn("lineNumberFormatter",function(e){return e},u,!0),fn("showCursorWhenSelecting",!1,dt,!0),fn("resetSelectionOnContextMenu",!0),fn("readOnly",!1,function(e,t){"nocursor"==t?(Dr(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||cr(e))}),fn("disableInput",!1,function(e,t){t||cr(e)},!0),fn("dragDrop",!0),fn("cursorBlinkRate",530),fn("cursorScrollMargin",0),fn("cursorHeight",1),fn("workTime",100),fn("workDelay",100),fn("flattenSpans",!0,n,!0),fn("addModeClass",!1,n,!0),fn("pollInterval",100),fn("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),fn("historyEventDelay",1250),fn("viewportMargin",10,function(e){e.refresh()},!0),fn("maxHighlightLength",1e4,n,!0),fn("moveInputWithCursor",!0,function(e,t){t||(e.display.inputDiv.style.top=e.display.inputDiv.style.left=0)}),fn("tabindex",null,function(e,t){e.display.input.tabIndex=t||""}),fn("autofocus",null);var aa=e.modes={},la=e.mimeModes={};e.defineMode=function(t,r){if(e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2){r.dependencies=[];for(var n=2;n<arguments.length;++n)r.dependencies.push(arguments[n])}aa[t]=r},e.defineMIME=function(e,t){la[e]=t},e.resolveMode=function(t){if("string"==typeof t&&la.hasOwnProperty(t))t=la[t];else if(t&&"string"==typeof t.name&&la.hasOwnProperty(t.name)){var r=la[t.name];"string"==typeof r&&(r={name:r}),t=Ui(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=aa[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(sa.hasOwnProperty(r.name)){var o=sa[r.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var a in r.modeProps)i[a]=r.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var sa=e.modeExtensions={};e.extendMode=function(e,t){var r=sa.hasOwnProperty(e)?sa[e]:sa[e]={};Ki(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){Ta.prototype[e]=t},e.defineOption=fn;var ua=[];e.defineInitHook=function(e){ua.push(e)};var ca=e.helpers={};e.registerHelper=function(t,r,n){ca.hasOwnProperty(t)||(ca[t]=e[t]={_global:[]}),ca[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),ca[t]._global.push({pred:n,val:i})};var fa=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},da=e.startState=function(e,t,r){return e.startState?e.startState(t,r):!0};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var ha=e.commands={selectAll:function(e){e.setSelection(Vo(e.firstLine(),0),Vo(e.lastLine()),Ra)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ra)},killLine:function(e){ln(e,function(t){if(t.empty()){var r=ui(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Vo(t.head.line+1,0)}:{from:t.head,to:Vo(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){ln(e,function(t){return{from:Vo(t.from().line,0),to:X(e.doc,Vo(t.to().line+1,0))}})},delLineLeft:function(e){ln(e,function(e){return{from:Vo(e.from().line,0),to:e.from()}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(Vo(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Vo(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return co(e,t.head.line)},_a)},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){var r=co(e,t.head.line),n=e.getLineHandle(r.line),i=gi(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.head.line==r.line&&t.head.ch<=o&&t.head.ch;return Vo(r.line,a?0:o)}return r},_a)},goLineEnd:function(e){e.extendSelectionsBy(function(t){return fo(e,t.head.line)},_a)},goLineRight:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},_a)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},_a)},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(" ")},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){$t(e,function(){for(var t=e.listSelections(),r=0;r<t.length;r++){var n=t[r].head,i=ui(e.doc,n.line).text;n.ch>0&&n.ch<i.length-1&&e.replaceRange(i.charAt(n.ch)+i.charAt(n.ch-1),Vo(n.line,n.ch-1),Vo(n.line,n.ch+1))}})},newlineAndIndent:function(e){$t(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange("\n",n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0),rn(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},pa=e.keyMap={};pa.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},pa.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-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","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},pa.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","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection",fallthrough:["basic","emacsy"]},pa.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"},pa["default"]=Do?pa.macDefault:pa.pcDefault;var ma=e.lookupKey=function(e,t,r){function n(t){t=dn(t);var i=t[e];if(i===!1)return"stop";if(null!=i&&r(i))return!0;if(t.nofallthrough)return"stop";var o=t.fallthrough;if(null==o)return!1;if("[object Array]"!=Object.prototype.toString.call(o))return n(o);for(var a=0;a<o.length;++a){var l=n(o[a]);if(l)return l}return!1}for(var i=0;i<t.length;++i){var o=n(t[i]);if(o)return"stop"!=o}},ga=e.isModifierKey=function(e){var t=nl[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},va=e.keyName=function(e,t){if(Ao&&34==e.keyCode&&e["char"])return!1;var r=nl[e.keyCode];return null==r||e.altGraphKey?!1:(e.altKey&&(r="Alt-"+r),(Bo?e.metaKey:e.ctrlKey)&&(r="Ctrl-"+r),(Bo?e.ctrlKey:e.metaKey)&&(r="Cmd-"+r),!t&&e.shiftKey&&(r="Shift-"+r),r)};e.fromTextArea=function(t,r){function n(){t.value=u.getValue()}if(r||(r={}),r.value=t.value,!r.tabindex&&t.tabindex&&(r.tabindex=t.tabindex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus){var i=to();r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Wa(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var o=t.form,a=o.submit;try{var l=o.submit=function(){n(),o.submit=a,o.submit(),o.submit=l}}catch(s){}}t.style.display="none";var u=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return u.save=n,u.getTextArea=function(){return t},u.toTextArea=function(){n(),t.parentNode.removeChild(u.getWrapperElement()),t.style.display="",t.form&&(Ea(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=a))},u};var ya=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};ya.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var r=t==e;else var r=t&&(e.test?e.test(t):e(t));return r?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\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);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Va(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Va(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Va(this.string,null,this.tabSize)-(this.lineStart?Va(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var ba=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e};Bi(ba),ba.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Ut(e),Fi(this,"clear")){var r=this.find();r&&Ii(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=gn(a.markedSpans,this);e&&!this.collapsed?tr(e,hi(a),"text"):e&&(null!=l.to&&(i=hi(a)),null!=l.from&&(n=hi(a))),a.markedSpans=vn(a.markedSpans,l),null==l.from&&this.collapsed&&!Fn(this.doc,a)&&e&&di(a,Gt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var s=En(this.lines[o]),u=f(s);u>e.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&er(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ut(e.doc)),e&&Ii(e,"markerCleared",e,this),t&&Kt(e)}},ba.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var o=this.lines[i],a=gn(o.markedSpans,this);if(null!=a.from&&(r=Vo(t?o:hi(o),a.from),-1==e))return r;if(null!=a.to&&(n=Vo(t?o:hi(o),a.to),1==e))return n}return r&&{from:r,to:n}},ba.prototype.changed=function(){var e=this.find(-1,!0),t=this,r=this.doc.cm;e&&r&&$t(r,function(){var n=e.line,i=hi(e.line),o=Tt(r,i);if(o&&(Ht(o),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Fn(t.doc,n)&&null!=t.height){var a=t.height;t.height=null;var l=jn(t)-a;l&&di(n,n.height+l)}})},ba.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=Gi(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ba.prototype.detachLine=function(e){if(this.lines.splice(Gi(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var wa=0,xa=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var r=0,n=this;r<e.length;++r)e[r].parent=this,Wa(e[r],"clear",function(){n.clear()})};Bi(xa),xa.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Ii(this,"clear")}},xa.prototype.find=function(e,t){return this.primary.find(e,t)};var ka=e.LineWidget=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.cm=e,this.node=t};Bi(ka),ka.prototype.clear=function(){var e=this.cm,t=this.line.widgets,r=this.line,n=hi(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=jn(this);$t(e,function(){Rn(e,r,-o),tr(e,n,"widget"),di(r,Math.max(0,r.height-o))})}},ka.prototype.changed=function(){var e=this.height,t=this.cm,r=this.line;this.height=null;var n=jn(this)-e;n&&$t(t,function(){t.curOp.forceUpdate=!0,Rn(t,r,n),di(r,r.height+n)})};var Ca=e.Line=function(e,t,r){this.text=e,Mn(this,t),this.height=r?r(this):1};Bi(Ca),Ca.prototype.lineNo=function(){return hi(this)};var La={},Sa={};oi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;n>r;++r){var i=this.lines[r];this.height-=i.height,Gn(i),Ii(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;n>e;++e)if(r(this.lines[e]))return!0}},ai.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(i>e){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof oi))){var l=[];this.collapse(l),this.children=[new oi(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),l=new oi(a);i.height-=l.height,this.children.splice(n+1,0,l),l.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new ai(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=Gi(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new ai(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>e){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var Ma=0,Ta=e.Doc=function(e,t,r){if(!(this instanceof Ta))return new Ta(e,t,r);null==r&&(r=0),ai.call(this,[new oi([new Ca("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var n=Vo(r,0);this.sel=K(n),this.history=new vi(null),this.id=++Ma,this.modeOption=t,"string"==typeof e&&(e=el(e)),ii(this,{from:n,to:n,text:e}),at(this,K(n),Ra)};Ta.prototype=Ui(ai.prototype,{constructor:Ta,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=fi(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:Zt(function(e){var t=Vo(this.first,0),r=this.first+this.size-1;Gr(this,{from:t,to:Vo(r,ui(this,r).text.length),text:el(e),origin:"setValue"},!0),at(this,K(t))}),replaceRange:function(e,t,r,n){t=X(this,t),r=r?X(this,r):t,Yr(this,e,t,r,n)},getRange:function(e,t,r){var n=ci(this,X(this,e),X(this,t));return r===!1?n:n.join(r||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return Z(this,e)?ui(this,e):void 0},getLineNumber:function(e){return hi(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=ui(this,e)),En(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return X(this,e)},getCursor:function(e){var t=this.sel.primary(),r;return r=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||e===!1?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Zt(function(e,t,r){nt(this,X(this,"number"==typeof e?Vo(e,t||0):e),null,r)}),setSelection:Zt(function(e,t,r){nt(this,X(this,e),X(this,t||e),r)}),extendSelection:Zt(function(e,t,r){et(this,X(this,e),t&&X(this,t),r)}),extendSelections:Zt(function(e,t){tt(this,Q(this,e,t))}),extendSelectionsBy:Zt(function(e,t){tt(this,qi(this.sel.ranges,e),t)}),setSelections:Zt(function(e,t,r){if(e.length){for(var n=0,i=[];n<e.length;n++)i[n]=new q(X(this,e[n].anchor),X(this,e[n].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),at(this,U(i,t),r)}}),addSelection:Zt(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new q(X(this,e),X(this,t||e))),at(this,U(n,n.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,n=0;n<t.length;n++){var i=ci(this,t[n].from(),t[n].to());r=r?r.concat(i):i}return e===!1?r:r.join(e||"\n")},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=ci(this,r[n].from(),r[n].to());e!==!1&&(i=i.join(e||"\n")),t[n]=i}return t},replaceSelection:Zt(function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")}),replaceSelections:function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];n[o]={from:a.from(),to:a.to(),text:el(e[o]),origin:r}}for(var l=t&&"end"!=t&&_r(this,n,t),o=n.length-1;o>=0;o--)Gr(this,n[o]);l?ot(this,l):this.cm&&rn(this.cm)},undo:Zt(function(){Ur(this,"undo")}),redo:Zt(function(){Ur(this,"redo")}),undoSelection:Zt(function(){Ur(this,"undo",!0)}),redoSelection:Zt(function(){Ur(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new vi(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Ai(this.history.done),undone:Ai(this.history.undone)}},setHistory:function(e){var t=this.history=new vi(this.history.maxGeneration);t.done=Ai(e.done.slice(0),null,!0),t.undone=Ai(e.undone.slice(0),null,!0)},markText:function(e,t,r){return hn(this,X(this,e),X(this,t),r,"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared};return e=X(this,e),hn(this,e,e,r,"bookmark")},findMarksAt:function(e){e=X(this,e);var t=[],r=ui(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t){e=X(this,e),t=X(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(i){var o=i.markedSpans;if(o)for(var a=0;a<o.length;a++){var l=o[a];n==e.line&&e.ch>l.to||null==l.from&&n!=e.line||n==t.line&&l.from>t.ch||r.push(l.marker.parent||l.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first;return this.iter(function(n){var i=n.text.length+1;return i>e?(t=e,!0):(e-=i,void++r)}),X(this,Vo(r,t))},indexFromPos:function(e){e=X(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new Ta(fi(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Ta(fi(this,t,r),e.mode||this.modeOption,t);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],n},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=this.linked[r];if(n.doc==t){this.linked.splice(r,1),t.unlinkDoc(this);break}}if(t.history==this.history){var i=[t.id];li(t,function(e){i.push(e.id)},!0),t.history=new vi(null),t.history.done=Ai(this.history.done,i),t.history.undone=Ai(this.history.undone,i)}},iterLinkedDocs:function(e){li(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),Ta.prototype.eachLine=Ta.prototype.iter;var Aa="iter insert remove copy getEditor".split(" ");for(var Na in Ta.prototype)Ta.prototype.hasOwnProperty(Na)&&Gi(Aa,Na)<0&&(e.prototype[Na]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ta.prototype[Na]));Bi(Ta);var Oa=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},Ha=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},za=e.e_stop=function(e){Oa(e),Ha(e)},Wa=e.on=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={}),i=n[t]||(n[t]=[]);i.push(r)}},Ea=e.off=function(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers&&e._handlers[t];if(!n)return;for(var i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}}},Ia=e.signal=function(e,t){var r=e._handlers&&e._handlers[t];if(r)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)},Da,Pa=0,Fa=30,Ba=e.Pass={toString:function(){return"CodeMirror.Pass"}},Ra={scroll:!1},ja={origin:"*mouse"},_a={origin:"+move"};Ri.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Va=e.countColumn=function(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=n||0,a=i||0;;){var l=e.indexOf(" ",o);if(0>l||l>=t)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}},Ga=[""],qa=function(e){e.select()};Eo?qa=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:Lo&&(qa=function(e){try{e.select()}catch(t){}}),[].indexOf&&(Gi=function(e,t){return e.indexOf(t)}),[].map&&(qi=function(e,t){return e.map(t)});var Ua=/[\u00df\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ka=e.isWordChar=function(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Ua.test(e))},$a=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,Xa;Xa=document.createRange?function(e,t,r){var n=document.createRange();return n.setEnd(e,r),n.setStart(e,t),n}:function(e,t,r){var n=document.body.createTextRange();return n.moveToElementText(e.parentNode),n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n},bo&&(to=function(){try{return document.activeElement}catch(e){return document.body}});var Ya=function(){if(xo)return!1;var e=Zi("div");return"draggable"in e||"dragDrop"in e}(),Za,Qa,Ja,el=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},tl=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},rl=function(){var e=Zi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),nl={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};e.keyNames=nl,function(){for(var e=0;10>e;e++)nl[e+48]=nl[e+96]=String(e);for(var e=65;90>=e;e++)nl[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)nl[e+111]=nl[e+63235]="F"+e}();var il,ol=function(){function e(e){return 247>=e?r.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?n.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,u="L";return function(r){if(!i.test(r))return!1;for(var n=r.length,c=[],f=0,d;n>f;++f)c.push(d=e(r.charCodeAt(f)));for(var f=0,h=u;n>f;++f){var d=c[f];"m"==d?c[f]=h:h=d}for(var f=0,p=u;n>f;++f){var d=c[f];"1"==d&&"r"==p?c[f]="n":a.test(d)&&(p=d,"r"==d&&(c[f]="R"))}for(var f=1,h=c[0];n-1>f;++f){var d=c[f];"+"==d&&"1"==h&&"1"==c[f+1]?c[f]="1":","!=d||h!=c[f+1]||"1"!=h&&"n"!=h||(c[f]=h),h=d}for(var f=0;n>f;++f){var d=c[f];if(","==d)c[f]="N";else if("%"==d){for(var m=f+1;n>m&&"%"==c[m];++m);for(var g=f&&"!"==c[f-1]||n>m&&"1"==c[m]?"1":"N",v=f;m>v;++v)c[v]=g;f=m-1}}for(var f=0,p=u;n>f;++f){var d=c[f];"L"==p&&"1"==d?c[f]="L":a.test(d)&&(p=d)}for(var f=0;n>f;++f)if(o.test(c[f])){for(var m=f+1;n>m&&o.test(c[m]);++m);for(var y="L"==(f?c[f-1]:u),b="L"==(n>m?c[m]:u),g=y||b?"L":"R",v=f;m>v;++v)c[v]=g;
|
5 |
+
f=m-1}for(var w=[],x,f=0;n>f;)if(l.test(c[f])){var k=f;for(++f;n>f&&l.test(c[f]);++f);w.push(new t(0,k,f))}else{var C=f,L=w.length;for(++f;n>f&&"L"!=c[f];++f);for(var v=C;f>v;)if(s.test(c[v])){v>C&&w.splice(L,0,new t(1,C,v));var S=v;for(++v;f>v&&s.test(c[v]);++v);w.splice(L,0,new t(2,S,v)),C=v}else++v;f>C&&w.splice(L,0,new t(1,C,f))}return 1==w[0].level&&(x=r.match(/^\s+/))&&(w[0].from=x[0].length,w.unshift(new t(0,0,x[0].length))),1==Vi(w).level&&(x=r.match(/\s+$/))&&(Vi(w).to-=x[0].length,w.push(new t(0,n-x[0].length,n))),w[0].level!=Vi(w).level&&w.push(new t(w[0].level,n,n)),w}}();return e.version="4.0.3",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=!0;return t}function r(e,t){for(var r=!1,n;null!=(n=e.next());){if(r&&"/"==n){t.tokenize=null;break}r="*"==n}return["comment","comment"]}function n(e,t){return e.skipTo("-->")?(e.match("-->"),t.tokenize=null):e.skipToEnd(),["comment","comment"]}e.defineMode("css",function(t,r){function n(e,t){return k=t,e}function i(e,t){var r=e.next();if(p[r]){var i=p[r](e,t);if(i!==!1)return i}return"@"==r?(e.eatWhile(/[\w\\\-]/),n("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?n(null,"compare"):'"'==r||"'"==r?(t.tokenize=o(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),n("atom","hash")):"!"==r?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),n("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?n(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?n(null,r):"u"==r&&e.match("rl(")?(e.backUp(1),t.tokenize=a,n("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),n("number","unit")):e.match(/^[^-]+-/)?n("meta","meta"):void 0}function o(e){return function(t,r){for(var i=!1,o;null!=(o=t.next());){if(o==e&&!i){")"==e&&t.backUp(1);break}i=!i&&"\\"==o}return(o==e||!i&&")"!=e)&&(r.tokenize=null),n("string","string")}}function a(e,t){return e.next(),t.tokenize=e.match(/\s*[\"\']/,!1)?null:o(")"),n(null,"(")}function l(e,t,r){this.type=e,this.indent=t,this.prev=r}function s(e,t,r){return e.context=new l(r,t.indentation()+h,e.context),r}function u(e){return e.context=e.context.prev,e.context.type}function c(e,t,r){return L[r.context.type](e,t,r)}function f(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return c(e,t,r)}function d(e){var t=e.current().toLowerCase();C=b.hasOwnProperty(t)?"atom":y.hasOwnProperty(t)?"keyword":"variable"}r.propertyKeywords||(r=e.resolveMode("text/css"));var h=t.indentUnit,p=r.tokenHooks,m=r.mediaTypes||{},g=r.mediaFeatures||{},v=r.propertyKeywords||{},y=r.colorKeywords||{},b=r.valueKeywords||{},w=r.fontProperties||{},x=r.allowNested,k,C,L={};return L.top=function(e,t,r){if("{"==e)return s(r,t,"block");if("}"==e&&r.context.prev)return u(r);if("@media"==e)return s(r,t,"media");if("@font-face"==e)return"font_face_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return s(r,t,"at");if("hash"==e)C="builtin";else if("word"==e)C="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return s(r,t,"interpolation");if(":"==e)return"pseudo";if(x&&"("==e)return s(r,t,"params")}return r.context.type},L.block=function(e,t,r){return"word"==e?v.hasOwnProperty(t.current().toLowerCase())?(C="property","maybeprop"):x?(C=t.match(/^\s*:/,!1)?"property":"tag","block"):(C+=" error","maybeprop"):"meta"==e?"block":x||"hash"!=e&&"qualifier"!=e?L.top(e,t,r):(C="error","block")},L.maybeprop=function(e,t,r){return":"==e?s(r,t,"prop"):c(e,t,r)},L.prop=function(e,t,r){if(";"==e)return u(r);if("{"==e&&x)return s(r,t,"propBlock");if("}"==e||"{"==e)return f(e,t,r);if("("==e)return s(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t.current())){if("word"==e)d(t);else if("interpolation"==e)return s(r,t,"interpolation")}else C+=" error";return"prop"},L.propBlock=function(e,t,r){return"}"==e?u(r):"word"==e?(C="property","maybeprop"):r.context.type},L.parens=function(e,t,r){return"{"==e||"}"==e?f(e,t,r):")"==e?u(r):"parens"},L.pseudo=function(e,t,r){return"word"==e?(C="variable-3",r.context.type):c(e,t,r)},L.media=function(e,t,r){if("("==e)return s(r,t,"media_parens");if("}"==e)return f(e,t,r);if("{"==e)return u(r)&&s(r,t,x?"block":"top");if("word"==e){var n=t.current().toLowerCase();C="only"==n||"not"==n||"and"==n?"keyword":m.hasOwnProperty(n)?"attribute":g.hasOwnProperty(n)?"property":"error"}return r.context.type},L.media_parens=function(e,t,r){return")"==e?u(r):"{"==e||"}"==e?f(e,t,r,2):L.media(e,t,r)},L.font_face_before=function(e,t,r){return"{"==e?s(r,t,"font_face"):c(e,t,r)},L.font_face=function(e,t,r){return"}"==e?u(r):"word"==e?(C=w.hasOwnProperty(t.current().toLowerCase())?"property":"error","maybeprop"):"font_face"},L.keyframes=function(e,t,r){return"word"==e?(C="variable","keyframes"):"{"==e?s(r,t,"top"):c(e,t,r)},L.at=function(e,t,r){return";"==e?u(r):"{"==e||"}"==e?f(e,t,r):("word"==e?C="tag":"hash"==e&&(C="builtin"),"at")},L.interpolation=function(e,t,r){return"}"==e?u(r):"{"==e||";"==e?f(e,t,r):("variable"!=e&&(C="error"),"interpolation")},L.params=function(e,t,r){return")"==e?u(r):"{"==e||"}"==e?f(e,t,r):("word"==e&&d(t),"params")},{startState:function(e){return{tokenize:null,state:"top",context:new l("top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||i)(e,t);return r&&"object"==typeof r&&(k=r[1],r=r[0]),C=r,t.state=L[t.state](k,e,t),C},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return"prop"==r.type&&"}"==n&&(r=r.prev),!r.prev||("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"font_face"!=r.type)&&(")"!=n||"parens"!=r.type&&"params"!=r.type&&"media_parens"!=r.type)&&("{"!=n||"at"!=r.type&&"media"!=r.type)||(i=r.indent-h,r=r.prev),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var i=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],o=t(i),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"],l=t(a),s=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","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","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","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"],u=t(s),c=["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=t(c),d=["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"],h=t(d),p=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],m=t(p),g=i.concat(a).concat(s).concat(c).concat(d);e.registerHelper("hintWords","css",g),e.defineMIME("text/css",{mediaTypes:o,mediaFeatures:l,propertyKeywords:u,colorKeywords:f,valueKeywords:h,fontProperties:m,tokenHooks:{"<":function(e,t){return e.match("!--")?(t.tokenize=n,n(e,t)):!1},"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:o,mediaFeatures:l,propertyKeywords:u,colorKeywords:f,valueKeywords:h,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:o,mediaFeatures:l,propertyKeywords:u,colorKeywords:f,valueKeywords:h,fontProperties:m,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},"@":function(e){return e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("htmlmixed",function(t,r){function n(e,t){var r=t.htmlState.tagName,n=l.token(e,t.htmlState);if("script"==r&&/\btag\b/.test(n)&&">"==e.current()){var i=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);i=i?i[1]:"",i&&/[\"\']/.test(i.charAt(0))&&(i=i.slice(1,i.length-1));for(var c=0;c<u.length;++c){var f=u[c];if("string"==typeof f.matches?i==f.matches:f.matches.test(i)){f.mode&&(t.token=o,t.localMode=f.mode,t.localState=f.mode.startState&&f.mode.startState(l.indent(t.htmlState,"")));break}}}else"style"==r&&/\btag\b/.test(n)&&">"==e.current()&&(t.token=a,t.localMode=s,t.localState=s.startState(l.indent(t.htmlState,"")));return n}function i(e,t,r){var n=e.current(),i=n.search(t),o;return i>-1?e.backUp(n.length-i):(o=n.match(/<\/?$/))&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}function o(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=n,t.localState=t.localMode=null,n(e,t)):i(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function a(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=n,t.localState=t.localMode=null,n(e,t)):i(e,/<\/\s*style\s*>/,s.token(e,t.localState))}var l=e.getMode(t,{name:"xml",htmlMode:!0,multilineTagIndentFactor:r.multilineTagIndentFactor,multilineTagIndentPastTag:r.multilineTagIndentPastTag}),s=e.getMode(t,"css"),u=[],c=r&&r.scriptTypes;if(u.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:e.getMode(t,"javascript")}),c)for(var f=0;f<c.length;++f){var d=c[f];u.push({matches:d.matches,mode:d.mode&&e.getMode(t,d.mode)})}return u.push({matches:/./,mode:e.getMode(t,"text/plain")}),{startState:function(){var e=l.startState();return{token:n,localMode:null,localState:null,htmlState:e}},copyState:function(t){if(t.localState)var r=e.copyState(t.localMode,t.localState);return{token:t.token,localMode:t.localMode,localState:r,htmlState:e.copyState(l,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,r){return!t.localMode||/^\s*<\//.test(r)?l.indent(t.htmlState,r):t.localMode.indent?t.localMode.indent(t.localState,r):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||l}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("javascript",function(t,r){function n(e){for(var t=!1,r,n=!1;null!=(r=e.next());){if(!t){if("/"==r&&!n)return;"["==r?n=!0:n&&"]"==r&&(n=!1)}t=!t&&"\\"==r}}function i(e,t,r){return xt=e,kt=r,t}function o(e,t){var r=e.next();if('"'==r||"'"==r)return t.tokenize=a(r),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return i("number","number");if("."==r&&e.match(".."))return i("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return i(r);if("="==r&&e.eat(">"))return i("=>","operator");if("0"==r&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),i("number","number");if(/\d/.test(r))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),i("number","number");if("/"==r)return e.eat("*")?(t.tokenize=l,l(e,t)):e.eat("/")?(e.skipToEnd(),i("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(n(e),e.eatWhile(/[gimy]/),i("regexp","string-2")):(e.eatWhile(bt),i("operator","operator",e.current()));if("`"==r)return t.tokenize=s,s(e,t);if("#"==r)return e.skipToEnd(),i("error","error");if(bt.test(r))return e.eatWhile(bt),i("operator","operator",e.current());e.eatWhile(/[\w\$_]/);var o=e.current(),u=yt.propertyIsEnumerable(o)&&yt[o];return u&&"."!=t.lastType?i(u.type,u.style,o):i("variable","variable",o)}function a(e){return function(t,r){var n=!1,a;if(mt&&"@"==t.peek()&&t.match(wt))return r.tokenize=o,i("jsonld-keyword","meta");for(;null!=(a=t.next())&&(a!=e||n);)n=!n&&"\\"==a;return n||(r.tokenize=o),i("string","string")}}function l(e,t){for(var r=!1,n;n=e.next();){if("/"==n&&r){t.tokenize=o;break}r="*"==n}return i("comment","comment")}function s(e,t){for(var r=!1,n;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=o;break}r=!r&&"\\"==n}return i("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),l=Ct.indexOf(a);if(l>=0&&3>l){if(!n){++o;break}if(0==--n)break}else if(l>=3&&6>l)++n;else if(/[$\w]/.test(a))i=!0;else if(i&&!n){++o;break}}i&&!n&&(t.fatArrowAt=o)}}function c(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function f(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function d(e,t,r,n,i){var o=e.cc;for(St.state=e,St.stream=i,St.marked=null,St.cc=o,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():gt?k:x;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return St.marked?St.marked:"variable"==r&&f(e,n)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)St.cc.push(arguments[e])}function p(){return h.apply(null,arguments),!0}function m(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var n=St.state;if(n.context){if(St.marked="def",t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;r.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function g(){St.state.context={prev:St.state.context,vars:St.state.localVars},St.state.localVars=Mt}function v(){St.state.localVars=St.state.context.vars,St.state.context=St.state.context.prev}function y(e,t){var r=function(){var r=St.state,n=r.indented;"stat"==r.lexical.type&&(n=r.lexical.indented),r.lexical=new c(n,St.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function b(){var e=St.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function w(e){function t(r){return r==e?p():";"==e?h():p(t)}return t}function x(e,t){return"var"==e?p(y("vardef",t.length),V,w(";"),b):"keyword a"==e?p(y("form"),k,x,b):"keyword b"==e?p(y("form"),x,b):"{"==e?p(y("}"),R,b):";"==e?p():"if"==e?p(y("form"),k,x,b,$):"function"==e?p(et):"for"==e?p(y("form"),X,x,b):"variable"==e?p(y("stat"),W):"switch"==e?p(y("form"),k,y("}","switch"),w("{"),R,b,b):"case"==e?p(k,w(":")):"default"==e?p(w(":")):"catch"==e?p(y("form"),g,w("("),tt,w(")"),x,b,v):"module"==e?p(y("form"),g,ot,v,b):"class"==e?p(y("form"),rt,it,b):"export"==e?p(y("form"),at,b):"import"==e?p(y("form"),lt,b):h(y("stat"),k,w(";"),b)}function k(e){return L(e,!1)}function C(e){return L(e,!0)}function L(e,t){if(St.state.fatArrowAt==St.stream.start){var r=t?z:H;if("("==e)return p(g,y(")"),F(G,")"),b,w("=>"),r,v);if("variable"==e)return h(g,G,w("=>"),r,v)}var n=t?A:T;return Lt.hasOwnProperty(e)?p(n):"function"==e?p(et):"keyword c"==e?p(t?M:S):"("==e?p(y(")"),S,dt,w(")"),b,n):"operator"==e||"spread"==e?p(t?C:k):"["==e?p(y("]"),ct,b,n):"{"==e?B(I,"}",null,n):p()}function S(e){return e.match(/[;\}\)\],]/)?h():h(k)}function M(e){return e.match(/[;\}\)\],]/)?h():h(C)}function T(e,t){return","==e?p(k):A(e,t,!1)}function A(e,t,r){var n=0==r?T:A,i=0==r?k:C;return"=>"==t?p(g,r?z:H,v):"operator"==e?/\+\+|--/.test(t)?p(n):"?"==t?p(k,w(":"),i):p(i):"quasi"==e?(St.cc.push(n),N(t)):";"!=e?"("==e?B(C,")","call",n):"."==e?p(E,n):"["==e?p(y("]"),S,w("]"),b,n):void 0:void 0}function N(e){return"${"!=e.slice(e.length-2)?p():p(k,O)}function O(e){return"}"==e?(St.marked="string-2",St.state.tokenize=s,p()):void 0}function H(e){return u(St.stream,St.state),h("{"==e?x:k)}function z(e){return u(St.stream,St.state),h("{"==e?x:C)}function W(e){return":"==e?p(b,x):h(T,w(";"),b)}function E(e){return"variable"==e?(St.marked="property",p()):void 0}function I(e,t){if("variable"==e){if(St.marked="property","get"==t||"set"==t)return p(D)}else if("number"==e||"string"==e)St.marked=mt?"property":e+" property";else if("["==e)return p(k,w("]"),P);return Lt.hasOwnProperty(e)?p(P):void 0}function D(e){return"variable"!=e?h(P):(St.marked="property",p(et))}function P(e){return":"==e?p(C):"("==e?h(et):void 0}function F(e,t){function r(n){if(","==n){var i=St.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),p(e,r)}return n==t?p():p(w(t))}return function(n){return n==t?p():h(e,r)}}function B(e,t,r){for(var n=3;n<arguments.length;n++)St.cc.push(arguments[n]);return p(y(t,r),F(e,t),b)}function R(e){return"}"==e?p():h(x,R)}function j(e){return vt&&":"==e?p(_):void 0}function _(e){return"variable"==e?(St.marked="variable-3",p()):void 0}function V(){return h(G,j,U,K)}function G(e,t){return"variable"==e?(m(t),p()):"["==e?B(G,"]"):"{"==e?B(q,"}"):void 0}function q(e,t){return"variable"!=e||St.stream.match(/^\s*:/,!1)?("variable"==e&&(St.marked="property"),p(w(":"),G,U)):(m(t),p(U))}function U(e,t){return"="==t?p(C):void 0}function K(e){return","==e?p(V):void 0}function $(e,t){return"keyword b"==e&&"else"==t?p(y("form"),x,b):void 0}function X(e){return"("==e?p(y(")"),Y,w(")"),b):void 0}function Y(e){return"var"==e?p(V,w(";"),Q):";"==e?p(Q):"variable"==e?p(Z):h(k,w(";"),Q)}function Z(e,t){return"in"==t||"of"==t?(St.marked="keyword",p(k)):p(T,Q)}function Q(e,t){return";"==e?p(J):"in"==t||"of"==t?(St.marked="keyword",p(k)):h(k,w(";"),J)}function J(e){")"!=e&&p(k)}function et(e,t){return"*"==t?(St.marked="keyword",p(et)):"variable"==e?(m(t),p(et)):"("==e?p(g,y(")"),F(tt,")"),b,x,v):void 0}function tt(e){return"spread"==e?p(tt):h(G,j)}function rt(e,t){return"variable"==e?(m(t),p(nt)):void 0}function nt(e,t){return"extends"==t?p(k):void 0}function it(e){return"{"==e?B(I,"}"):void 0}function ot(e,t){return"string"==e?p(x):"variable"==e?(m(t),p(ut)):void 0}function at(e,t){return"*"==t?(St.marked="keyword",p(ut,w(";"))):"default"==t?(St.marked="keyword",p(k,w(";"))):h(x)}function lt(e){return"string"==e?p():h(st,ut)}function st(e,t){return"{"==e?B(st,"}"):("variable"==e&&m(t),p())}function ut(e,t){return"from"==t?(St.marked="keyword",p(k)):void 0}function ct(e){return"]"==e?p():h(C,ft)}function ft(e){return"for"==e?h(dt,w("]")):","==e?p(F(C,"]")):h(F(C,"]"))}function dt(e){return"for"==e?p(X,dt):"if"==e?p(k,dt):void 0}var ht=t.indentUnit,pt=r.statementIndent,mt=r.jsonld,gt=r.json||mt,vt=r.typescript,yt=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},a={"if":e("if"),"while":t,"with":t,"else":r,"do":r,"try":r,"finally":r,"return":n,"break":n,"continue":n,"new":n,"delete":n,"throw":n,"debugger":n,"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":n,"export":e("export"),"import":e("import"),"extends":n};
|
6 |
+
if(vt){var l={type:"variable",style:"variable-3"},s={"interface":e("interface"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),string:l,number:l,bool:l,any:l};for(var u in s)a[u]=s[u]}return a}(),bt=/[+\-*&%=<>!?|~^]/,wt=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,xt,kt,Ct="([{}])",Lt={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},St={state:null,column:null,marked:null,cc:null},Mt={name:"this",next:{name:"arguments"}};return b.lex=!0,{startState:function(e){var t={tokenize:o,lastType:"sof",cc:[],lexical:new c((e||0)-ht,0,"block",!1),localVars:r.localVars,context:r.localVars&&{vars:r.localVars},indented:0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=l&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==xt?r:(t.lastType="operator"!=xt||"++"!=kt&&"--"!=kt?xt:"incdec",d(t,r,xt,kt,e))},indent:function(t,n){if(t.tokenize==l)return e.Pass;if(t.tokenize!=o)return 0;for(var i=n&&n.charAt(0),a=t.lexical,s=t.cc.length-1;s>=0;--s){var u=t.cc[s];if(u==b)a=a.prev;else if(u!=$)break}"stat"==a.type&&"}"==i&&(a=a.prev),pt&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var c=a.type,f=i==c;return"vardef"==c?a.indented+("operator"==t.lastType||","==t.lastType?a.info+1:0):"form"==c&&"{"==i?a.indented:"form"==c?a.indented+ht:"stat"==c?a.indented+("operator"==t.lastType||","==t.lastType?pt||ht:0):"switch"!=a.info||f||0==r.doubleIndentSwitch?a.align?a.column+(f?0:1):a.indented+(f?0:ht):a.indented+(/^(?:case|default)\b/.test(n)?ht:2*ht)},electricChars:":{}",blockCommentStart:gt?null:"/*",blockCommentEnd:gt?null:"*/",lineComment:gt?null:"//",fold:"brace",helperType:gt?"json":"javascript",jsonldMode:mt,jsonMode:gt}}),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("xml",function(t,r){function n(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();if("<"==n){if(e.eat("!"))return e.eat("[")?e.match("CDATA[")?r(a("atom","]]>")):null:e.match("--")?r(a("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(l(1))):null;if(e.eat("?"))return e.eatWhile(/[\w\._\-]/),t.tokenize=a("meta","?>"),"meta";var o=e.eat("/");C="";for(var s;s=e.eat(/[^\s\u00a0=<>\"\'\/?]/);)C+=s;return x.caseFold&&(C=C.toLowerCase()),C?(L=o?"closeTag":"openTag",t.tokenize=i,"tag"):"tag error"}if("&"==n){var u;return u=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),u?"atom":"error"}return e.eatWhile(/[^&<]/),null}function i(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=n,L=">"==r?"endTag":"selfcloseTag","tag";if("="==r)return L="equals",null;if("<"==r){t.tokenize=n,t.state=f,t.tagName=t.tagStart=null;var i=t.tokenize(e,t);return i?i+" error":"error"}return/[\'\"]/.test(r)?(t.tokenize=o(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.eatWhile(/[^\s\u00a0=<>\"\']/),"word")}function o(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=i;break}return"string"};return t.isInAttribute=!0,t}function a(e,t){return function(r,i){for(;!r.eol();){if(r.match(t)){i.tokenize=n;break}r.next()}return e}}function l(e){return function(t,r){for(var i;null!=(i=t.next());){if("<"==i)return r.tokenize=l(e+1),r.tokenize(t,r);if(">"==i){if(1==e){r.tokenize=n;break}return r.tokenize=l(e-1),r.tokenize(t,r)}}return"meta"}}function s(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(x.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function u(e){e.context&&(e.context=e.context.prev)}function c(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!x.contextGrabbers.hasOwnProperty(r)||!x.contextGrabbers[r].hasOwnProperty(t))return;u(e)}}function f(e,t,r){if("openTag"==e)return r.tagName=C,r.tagStart=t.column(),p;if("closeTag"==e){var n=!1;return r.context?r.context.tagName!=C&&(x.implicitlyClosed.hasOwnProperty(r.context.tagName)&&u(r),n=!r.context||r.context.tagName!=C):n=!0,n&&(S="error"),n?h:d}return f}function d(e,t,r){return"endTag"!=e?(S="error",d):(u(r),f)}function h(e,t,r){return S="error",d(e,t,r)}function p(e,t,r){if("word"==e)return S="attribute",m;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||x.autoSelfClosers.hasOwnProperty(n)?c(r,n):(c(r,n),r.context=new s(r,n,i==r.indented)),f}return S="error",p}function m(e,t,r){return"equals"==e?g:(x.allowMissing||(S="error"),p(e,t,r))}function g(e,t,r){return"string"==e?v:"word"==e&&x.allowUnquoted?(S="string",p):(S="error",p(e,t,r))}function v(e,t,r){return"string"==e?v:p(e,t,r)}var y=t.indentUnit,b=r.multilineTagIndentFactor||1,w=r.multilineTagIndentPastTag;null==w&&(w=!0);var x=r.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,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},k=r.alignCDATA,C,L,S;return{startState:function(){return{tokenize:n,state:f,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;C=L=null;var r=t.tokenize(e,t);return(r||L)&&"comment"!=r&&(S=null,t.state=t.state(L||r,e,t),S&&(r="error"==S?r+" error":S)),r},indent:function(t,r,o){var a=t.context;if(t.tokenize.isInAttribute)return t.stringStartCol+1;if(a&&a.noIndent)return e.Pass;if(t.tokenize!=i&&t.tokenize!=n)return o?o.match(/^(\s*)/)[0].length:0;if(t.tagName)return w?t.tagStart+t.tagName.length+2:t.tagStart+y*b;if(k&&/<!\[CDATA\[/.test(r))return 0;for(a&&/^<\//.test(r)&&(a=a.prev);a&&!a.startOfLine;)a=a.prev;return a?a.indent+y:0},electricChars:"/",blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:r.htmlMode?"html":"xml",helperType:r.htmlMode?"html":"xml"}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",o),e.removeLineClass(e.state.activeLines[t],"background",a)}function r(e,t){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function n(e,n){for(var i=[],l=0;l<n.length;l++){var s=e.getLineHandleVisualStart(n[l].head.line);i[i.length-1]!=s&&i.push(s)}r(e.state.activeLines,i)||e.operation(function(){t(e);for(var r=0;r<i.length;r++)e.addLineClass(i[r],"wrap",o),e.addLineClass(i[r],"background",a);e.state.activeLines=i})}function i(e,t){n(e,t.ranges)}var o="CodeMirror-activeline",a="CodeMirror-activeline-background";e.defineOption("styleActiveLine",!1,function(r,o,a){var l=a&&a!=e.Init;o&&!l?(r.state.activeLines=[],n(r,r.listSelections()),r.on("beforeSelectionChange",i)):!o&&l&&(r.off("beforeSelectionChange",i),t(r),delete r.state.activeLines)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n,i){var o=e.getLineHandle(t.line),s=t.ch-1,u=s>=0&&l[o.text.charAt(s)]||l[o.text.charAt(++s)];if(!u)return null;var c=">"==u.charAt(1)?1:-1;if(n&&c>0!=(s==t.ch))return null;var f=e.getTokenTypeAt(a(t.line,s+1)),d=r(e,a(t.line,s+(c>0?1:0)),c,f||null,i);return{from:a(t.line,s),to:d&&d.pos,match:d&&d.ch==u.charAt(0),forward:c>0}}function r(e,t,r,n,i){for(var o=i&&i.maxScanLineLength||1e4,s=i&&i.maxScanLines||500,u=[],c=/[(){}[\]]/,f=r>0?Math.min(t.line+s,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-s),d=t.line;d!=f;d+=r){var h=e.getLine(d);if(h){var p=r>0?0:h.length-1,m=r>0?h.length:-1;if(!(h.length>o))for(d==t.line&&(p=t.ch-(0>r?1:0));p!=m;p+=r){var g=h.charAt(p);if(c.test(g)&&(void 0===n||e.getTokenTypeAt(a(d,p+1))==n)){var v=l[g];if(">"==v.charAt(1)==r>0)u.push(g);else{if(!u.length)return{pos:a(d,p),ch:g};u.pop()}}}}}}function n(e,r,n){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,l=[],s=e.listSelections(),u=0;u<s.length;u++){var c=s[u].empty()&&t(e,s[u].head,!1,n);if(c&&e.getLine(c.from.line).length<=i&&c.to&&e.getLine(c.to.line).length<=i){var f=c.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";l.push(e.markText(c.from,a(c.from.line,c.from.ch+1),{className:f})),c.to&&l.push(e.markText(c.to,a(c.to.line,c.to.ch+1),{className:f}))}}if(l.length){o&&e.state.focused&&e.display.input.focus();var d=function(){e.operation(function(){for(var e=0;e<l.length;e++)l[e].clear()})};if(!r)return d;setTimeout(d,800)}}function i(e){e.operation(function(){s&&(s(),s=null),s=n(e,!1,e.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),a=e.Pos,l={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},s=null;e.defineOption("matchBrackets",!1,function(t,r,n){n&&n!=e.Init&&t.off("cursorActivity",i),r&&(t.state.matchBrackets="object"==typeof r?r:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){n(this,!0)}),e.defineExtension("findMatchingBracket",function(e,r){return t(this,e,r)}),e.defineExtension("scanForBracket",function(e,t,n){return r(this,e,t,n)})}),window.onload=heshPlugin;
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
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.9
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
Add syntax highlighting to the HTML editor.
|
10 |
|
@@ -31,6 +31,10 @@ If you like the plugin, don’t hesitate to support me and leave a review :)
|
|
31 |
|
32 |
== Changelog ==
|
33 |
|
|
|
|
|
|
|
|
|
34 |
= 1.4.8 =
|
35 |
* Add Link button now works with page selector window
|
36 |
* Some minor improvements
|
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.9
|
7 |
+
Stable tag: 1.5.0
|
8 |
|
9 |
Add syntax highlighting to the HTML editor.
|
10 |
|
31 |
|
32 |
== Changelog ==
|
33 |
|
34 |
+
= 1.5.0 =
|
35 |
+
* Updated CodeMirror library
|
36 |
+
* Some minor improvements
|
37 |
+
|
38 |
= 1.4.8 =
|
39 |
* Add Link button now works with page selector window
|
40 |
* Some minor improvements
|