text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-8a44c3e0"],{"0109":function(e,t,n){},"02f0":function(e,t,n){(function(e){e(n("56b3"))})(function(e){"use strict";e.defineMode("shell",function(){var t={};function n(e,n){for(var i=0;i<n.length;i++)t[n[i]]=e}var i=["true","false"],r=["if","then","do","else","elif","while","until","for","in","esac","fi","fin","fil","done","exit","set","unset","export","function"],o=["ab","awk","bash","beep","cat","cc","cd","chown","chmod","chroot","clear","cp","curl","cut","diff","echo","find","gawk","gcc","get","git","grep","hg","kill","killall","ln","ls","make","mkdir","openssl","mv","nc","nl","node","npm","ping","ps","restart","rm","rmdir","sed","service","sh","shopt","shred","source","sort","sleep","ssh","start","stop","su","sudo","svn","tee","telnet","top","touch","vi","vim","wall","wc","wget","who","write","yes","zsh"];function l(e,n){if(e.eatSpace())return null;var i=e.sol(),r=e.next();if("\\"===r)return e.next(),null;if("'"===r||'"'===r||"`"===r)return n.tokens.unshift(a(r,"`"===r?"quote":"string")),u(e,n);if("#"===r)return i&&e.eat("!")?(e.skipToEnd(),"meta"):(e.skipToEnd(),"comment");if("$"===r)return n.tokens.unshift(c),u(e,n);if("+"===r||"="===r)return"operator";if("-"===r)return e.eat("-"),e.eatWhile(/\w/),"attribute";if(/\d/.test(r)&&(e.eatWhile(/\d/),e.eol()||!/\w/.test(e.peek())))return"number";e.eatWhile(/[\w-]/);var o=e.current();return"="===e.peek()&&/\w+/.test(o)?"def":t.hasOwnProperty(o)?t[o]:null}function a(e,t){var n="("==e?")":"{"==e?"}":e;return function(i,r){var o,l=!1;while(null!=(o=i.next())){if(o===n&&!l){r.tokens.shift();break}if("$"===o&&!l&&"'"!==e&&i.peek()!=n){l=!0,i.backUp(1),r.tokens.unshift(c);break}if(!l&&e!==n&&o===e)return r.tokens.unshift(a(e,t)),u(i,r);if(!l&&/['"]/.test(o)&&!/['"]/.test(e)){r.tokens.unshift(s(o,"string")),i.backUp(1);break}l=!l&&"\\"===o}return t}}function s(e,t){return function(n,i){return i.tokens[0]=a(e,t),n.next(),u(n,i)}}e.registerHelper("hintWords","shell",i.concat(r,o)),n("atom",i),n("keyword",r),n("builtin",o);var c=function(e,t){t.tokens.length>1&&e.eat("$");var n=e.next();return/['"({]/.test(n)?(t.tokens[0]=a(n,"("==n?"quote":"{"==n?"def":"string"),u(e,t)):(/\d/.test(n)||e.eatWhile(/\w/),t.tokens.shift(),"def")};function u(e,t){return(t.tokens[0]||l)(e,t)}return{startState:function(){return{tokens:[]}},token:function(e,t){return u(e,t)},closeBrackets:"()[]{}''\"\"``",lineComment:"#",fold:"brace"}}),e.defineMIME("text/x-sh","shell"),e.defineMIME("application/x-sh","shell")})},"11e9":function(e,t,n){var i=n("52a7"),r=n("4630"),o=n("6821"),l=n("6a99"),a=n("69a8"),s=n("c69a"),c=Object.getOwnPropertyDescriptor;t.f=n("9e1e")?c:function(e,t){if(e=o(e),t=l(t,!0),s)try{return c(e,t)}catch(n){}if(a(e,t))return r(!i.f.call(e,t),e[t])}},"1fdb":function(e,t,n){(function(e){e(n("56b3"))})(function(e){"use strict";function t(t,n,i){this.orientation=n,this.scroll=i,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=t+"-"+n,this.inner=this.node.appendChild(document.createElement("div"));var r=this;function o(t){var n=e.wheelEventPixels(t)["horizontal"==r.orientation?"x":"y"],i=r.pos;r.moveTo(r.pos+n),r.pos!=i&&e.e_preventDefault(t)}e.on(this.inner,"mousedown",function(t){if(1==t.which){e.e_preventDefault(t);var n="horizontal"==r.orientation?"pageX":"pageY",i=t[n],o=r.pos;e.on(document,"mousemove",a),e.on(document,"mouseup",l)}function l(){e.off(document,"mousemove",a),e.off(document,"mouseup",l)}function a(e){if(1!=e.which)return l();r.moveTo(o+(e[n]-i)*(r.total/r.size))}}),e.on(this.node,"click",function(t){e.e_preventDefault(t);var n,i=r.inner.getBoundingClientRect();n="horizontal"==r.orientation?t.clientX<i.left?-1:t.clientX>i.right?1:0:t.clientY<i.top?-1:t.clientY>i.bottom?1:0,r.moveTo(r.pos+n*r.screen)}),e.on(this.node,"mousewheel",o),e.on(this.node,"DOMMouseScroll",o)}t.prototype.setPos=function(e,t){return e<0&&(e=0),e>this.total-this.screen&&(e=this.total-this.screen),!(!t&&e==this.pos)&&(this.pos=e,this.inner.style["horizontal"==this.orientation?"left":"top"]=e*(this.size/this.total)+"px",!0)},t.prototype.moveTo=function(e){this.setPos(e)&&this.scroll(e,this.orientation)};var n=10;function i(e,n,i){this.addClass=e,this.horiz=new t(e,"horizontal",i),n(this.horiz.node),this.vert=new t(e,"vertical",i),n(this.vert.node),this.width=null}t.prototype.update=function(e,t,i){var r=this.screen!=t||this.total!=e||this.size!=i;r&&(this.screen=t,this.total=e,this.size=i);var o=this.screen*(this.size/this.total);o<n&&(this.size-=n-o,o=n),this.inner.style["horizontal"==this.orientation?"width":"height"]=o+"px",this.setPos(this.pos,r)},i.prototype.update=function(e){if(null==this.width){var t=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;t&&(this.width=parseInt(t.height))}var n=this.width||0,i=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1;return this.vert.node.style.display=r?"block":"none",this.horiz.node.style.display=i?"block":"none",r&&(this.vert.update(e.scrollHeight,e.clientHeight,e.viewHeight-(i?n:0)),this.vert.node.style.bottom=i?n+"px":"0"),i&&(this.horiz.update(e.scrollWidth,e.clientWidth,e.viewWidth-(r?n:0)-e.barLeft),this.horiz.node.style.right=r?n+"px":"0",this.horiz.node.style.left=e.barLeft+"px"),{right:r?n:0,bottom:i?n:0}},i.prototype.setScrollTop=function(e){this.vert.setPos(e)},i.prototype.setScrollLeft=function(e){this.horiz.setPos(e)},i.prototype.clear=function(){var e=this.horiz.node.parentNode;e.removeChild(this.horiz.node),e.removeChild(this.vert.node)},e.scrollbarModel.simple=function(e,t){return new i("CodeMirror-simplescroll",e,t)},e.scrollbarModel.overlay=function(e,t){return new i("CodeMirror-overlayscroll",e,t)}})},"24d2":function(e,t,n){"use strict";n.d(t,"j",function(){return r}),n.d(t,"q",function(){return o}),n.d(t,"h",function(){return l}),n.d(t,"e",function(){return a}),n.d(t,"c",function(){return s}),n.d(t,"l",function(){return c}),n.d(t,"a",function(){return u}),n.d(t,"f",function(){return d}),n.d(t,"k",function(){return f}),n.d(t,"i",function(){return h}),n.d(t,"p",function(){return p}),n.d(t,"g",function(){return g}),n.d(t,"m",function(){return m}),n.d(t,"d",function(){return v}),n.d(t,"b",function(){return y}),n.d(t,"n",function(){return b}),n.d(t,"o",function(){return w});var i=n("ead3");function r(e){return Object(i["b"])("/project/space/add",e)}function o(e){return Object(i["b"])("/project/space/update",e)}function l(e){return Object(i["a"])("/project/space/list",e)}function a(e){return Object(i["a"])("/project/space/detail",e)}function s(e){return Object(i["b"])("/project/space/delete",e)}function c(e){return Object(i["a"])("/project/member/search",e)}function u(e){return Object(i["b"])("/project/member/add",e)}function d(e){return Object(i["a"])("/project/member/list",e)}function f(e){return Object(i["b"])("/project/member/remove",e)}function h(e){return Object(i["b"])("/project/add",e)}function p(e){return Object(i["b"])("/project/update",e)}function g(e){return Object(i["a"])("/project/list",e)}function m(e){return Object(i["b"])("/project/switchstatus",e)}function v(e){return Object(i["a"])("/project/detail",e)}function y(e){return Object(i["b"])("/project/delete",e)}function b(e){return Object(i["b"])("/project/buildscript",e)}function w(e){return Object(i["b"])("/project/hookscript",e)}},4498:function(e,t,n){},"52a7":function(e,t){t.f={}.propertyIsEnumerable},"56b3":function(e,t,n){(function(t,n){e.exports=n()})(0,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),i=/MSIE \d/.test(e),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),l=i||r||o,a=l&&(i?document.documentMode||6:+(o||r)[1]),s=!o&&/WebKit\//.test(e),c=s&&/Qt\/\d+\.\d+/.test(e),u=!o&&/Chrome\//.test(e),d=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),m=/Android/.test(e),v=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),x=d&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(d=!1,s=!0);var C=y&&(c||d&&(null==x||x<12.11)),k=n||l&&a>=9;function _(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S,L=function(e,t){var n=e.className,i=_(t).exec(n);if(i){var r=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(r?i[1]+r:"")}};function T(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function M(e,t){return T(e).appendChild(t)}function O(e,t,n,i){var r=document.createElement(e);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof t)r.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)r.appendChild(t[o]);return r}function N(e,t,n,i){var r=O(e,t,n,i);return r.setAttribute("role","presentation"),r}function D(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function F(){var e;try{e=document.activeElement}catch(t){e=document.body||null}while(e&&e.shadowRoot&&e.shadowRoot.activeElement)e=e.shadowRoot.activeElement;return e}function A(e,t){var n=e.className;_(t).test(n)||(e.className+=(n?" ":"")+t)}function H(e,t){for(var n=e.split(" "),i=0;i<n.length;i++)n[i]&&!_(n[i]).test(t)&&(t+=" "+n[i]);return t}S=document.createRange?function(e,t,n,i){var r=document.createRange();return r.setEnd(i||e,n),r.setStart(e,t),r}:function(e,t,n){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(r){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",t),i};var W=function(e){e.select()};function $(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function P(e,t,n){for(var i in t||(t={}),e)!e.hasOwnProperty(i)||!1===n&&t.hasOwnProperty(i)||(t[i]=e[i]);return t}function I(e,t,n,i,r){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=i||0,l=r||0;;){var a=e.indexOf("\t",o);if(a<0||a>=t)return l+(t-o);l+=a-o,l+=n-l%n,o=a+1}}g?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:l&&(W=function(e){try{e.select()}catch(t){}});var E=function(){this.id=null};function z(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}E.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var R=30,B={toString:function(){return"CodeMirror.Pass"}},V={scroll:!1},j={origin:"*mouse"},G={origin:"+move"};function U(e,t,n){for(var i=0,r=0;;){var o=e.indexOf("\t",i);-1==o&&(o=e.length);var l=o-i;if(o==e.length||r+l>=t)return i+Math.min(l,t-r);if(r+=o-i,r+=n-r%n,i=o+1,r>=t)return i}}var K=[""];function X(e){while(K.length<=e)K.push(Y(K)+" ");return K[e]}function Y(e){return e[e.length-1]}function q(e,t){for(var n=[],i=0;i<e.length;i++)n[i]=t(e[i],i);return n}function Z(e,t,n){var i=0,r=n(t);while(i<e.length&&n(e[i])<=r)i++;e.splice(i,0,t)}function J(){}function Q(e,t){var n;return Object.create?n=Object.create(e):(J.prototype=e,n=new J),t&&P(t,n),n}var ee=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function te(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||ee.test(e))}function ne(e,t){return t?!!(t.source.indexOf("\\w")>-1&&te(e))||t.test(e):te(e)}function ie(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var re=/[\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]/;function oe(e){return e.charCodeAt(0)>=768&&re.test(e)}function le(e,t,n){while((n<0?t>0:t<e.length)&&oe(e.charAt(t)))t+=n;return t}function ae(e,t,n){for(var i=t>n?-1:1;;){if(t==n)return t;var r=(t+n)/2,o=i<0?Math.ceil(r):Math.floor(r);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+i}}function se(e,t,i){var r=this;this.input=i,r.scrollbarFiller=O("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=O("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=N("div",null,"CodeMirror-code"),r.selectionDiv=O("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=O("div",null,"CodeMirror-cursors"),r.measure=O("div",null,"CodeMirror-measure"),r.lineMeasure=O("div",null,"CodeMirror-measure"),r.lineSpace=N("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none");var o=N("div",[r.lineSpace],"CodeMirror-lines");r.mover=O("div",[o],null,"position: relative"),r.sizer=O("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=O("div",null,null,"position: absolute; height: "+R+"px; width: 1px;"),r.gutters=O("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=O("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=O("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),l&&a<8&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),s||n&&v||(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,i.init(r)}function ce(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");var n=e;while(!n.lines)for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(t<o){n=r;break}t-=o}return n.lines[t]}function ue(e,t,n){var i=[],r=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;r==n.line&&(o=o.slice(0,n.ch)),r==t.line&&(o=o.slice(t.ch)),i.push(o),++r}),i}function de(e,t,n){var i=[];return e.iter(t,n,function(e){i.push(e.text)}),i}function fe(e,t){var n=t-e.height;if(n)for(var i=e;i;i=i.parent)i.height+=n}function he(e){if(null==e.parent)return null;for(var t=e.parent,n=z(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var r=0;;++r){if(i.children[r]==t)break;n+=i.children[r].chunkSize()}return n+t.first}function pe(e,t){var n=e.first;e:do{for(var i=0;i<e.children.length;++i){var r=e.children[i],o=r.height;if(t<o){e=r;continue e}t-=o,n+=r.chunkSize()}return n}while(!e.lines);for(var l=0;l<e.lines.length;++l){var a=e.lines[l],s=a.height;if(t<s)break;t-=s}return n+l}function ge(e,t){return t>=e.first&&t<e.first+e.size}function me(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ve(e,t,n){if(void 0===n&&(n=null),!(this instanceof ve))return new ve(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ye(e,t){return e.line-t.line||e.ch-t.ch}function be(e,t){return e.sticky==t.sticky&&0==ye(e,t)}function we(e){return ve(e.line,e.ch)}function xe(e,t){return ye(e,t)<0?t:e}function Ce(e,t){return ye(e,t)<0?e:t}function ke(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function _e(e,t){if(t.line<e.first)return ve(e.first,0);var n=e.first+e.size-1;return t.line>n?ve(n,ce(e,n).text.length):Se(t,ce(e,t.line).text.length)}function Se(e,t){var n=e.ch;return null==n||n>t?ve(e.line,t):n<0?ve(e.line,0):e}function Le(e,t){for(var n=[],i=0;i<t.length;i++)n[i]=_e(e,t[i]);return n}var Te=!1,Me=!1;function Oe(){Te=!0}function Ne(){Me=!0}function De(e,t,n){this.marker=e,this.from=t,this.to=n}function Fe(e,t){if(e)for(var n=0;n<e.length;++n){var i=e[n];if(i.marker==t)return i}}function Ae(e,t){for(var n,i=0;i<e.length;++i)e[i]!=t&&(n||(n=[])).push(e[i]);return n}function He(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function We(e,t,n){var i;if(e)for(var r=0;r<e.length;++r){var o=e[r],l=o.marker,a=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);if(a||o.from==t&&"bookmark"==l.type&&(!n||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(i||(i=[])).push(new De(l,o.from,s?null:o.to))}}return i}function $e(e,t,n){var i;if(e)for(var r=0;r<e.length;++r){var o=e[r],l=o.marker,a=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);if(a||o.from==t&&"bookmark"==l.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(i||(i=[])).push(new De(l,s?null:o.from-t,null==o.to?null:o.to-t))}}return i}function Pe(e,t){if(t.full)return null;var n=ge(e,t.from.line)&&ce(e,t.from.line).markedSpans,i=ge(e,t.to.line)&&ce(e,t.to.line).markedSpans;if(!n&&!i)return null;var r=t.from.ch,o=t.to.ch,l=0==ye(t.from,t.to),a=We(n,r,l),s=$e(i,o,l),c=1==t.text.length,u=Y(t.text).length+(c?r:0);if(a)for(var d=0;d<a.length;++d){var f=a[d];if(null==f.to){var h=Fe(s,f.marker);h?c&&(f.to=null==h.to?null:h.to+u):f.to=r}}if(s)for(var p=0;p<s.length;++p){var g=s[p];if(null!=g.to&&(g.to+=u),null==g.from){var m=Fe(a,g.marker);m||(g.from=u,c&&(a||(a=[])).push(g))}else g.from+=u,c&&(a||(a=[])).push(g)}a&&(a=Ie(a)),s&&s!=a&&(s=Ie(s));var v=[a];if(!c){var y,b=t.text.length-2;if(b>0&&a)for(var w=0;w<a.length;++w)null==a[w].to&&(y||(y=[])).push(new De(a[w].marker,null,null));for(var x=0;x<b;++x)v.push(y);v.push(s)}return v}function Ie(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Ee(e,t,n){var i=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||i&&-1!=z(i,n)||(i||(i=[])).push(n)}}),!i)return null;for(var r=[{from:t,to:n}],o=0;o<i.length;++o)for(var l=i[o],a=l.find(0),s=0;s<r.length;++s){var c=r[s];if(!(ye(c.to,a.from)<0||ye(c.from,a.to)>0)){var u=[s,1],d=ye(c.from,a.from),f=ye(c.to,a.to);(d<0||!l.inclusiveLeft&&!d)&&u.push({from:c.from,to:a.from}),(f>0||!l.inclusiveRight&&!f)&&u.push({from:a.to,to:c.to}),r.splice.apply(r,u),s+=u.length-3}}return r}function ze(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Re(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Be(e){return e.inclusiveLeft?-1:0}function Ve(e){return e.inclusiveRight?1:0}function je(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var i=e.find(),r=t.find(),o=ye(i.from,r.from)||Be(e)-Be(t);if(o)return-o;var l=ye(i.to,r.to)||Ve(e)-Ve(t);return l||t.id-e.id}function Ge(e,t){var n,i=Me&&e.markedSpans;if(i)for(var r=void 0,o=0;o<i.length;++o)r=i[o],r.marker.collapsed&&null==(t?r.from:r.to)&&(!n||je(n,r.marker)<0)&&(n=r.marker);return n}function Ue(e){return Ge(e,!0)}function Ke(e){return Ge(e,!1)}function Xe(e,t){var n,i=Me&&e.markedSpans;if(i)for(var r=0;r<i.length;++r){var o=i[r];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||je(n,o.marker)<0)&&(n=o.marker)}return n}function Ye(e,t,n,i,r){var o=ce(e,t),l=Me&&o.markedSpans;if(l)for(var a=0;a<l.length;++a){var s=l[a];if(s.marker.collapsed){var c=s.marker.find(0),u=ye(c.from,n)||Be(s.marker)-Be(r),d=ye(c.to,i)||Ve(s.marker)-Ve(r);if(!(u>=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(s.marker.inclusiveRight&&r.inclusiveLeft?ye(c.to,n)>=0:ye(c.to,n)>0)||u>=0&&(s.marker.inclusiveRight&&r.inclusiveLeft?ye(c.from,i)<=0:ye(c.from,i)<0)))return!0}}}function qe(e){var t;while(t=Ue(e))e=t.find(-1,!0).line;return e}function Ze(e){var t;while(t=Ke(e))e=t.find(1,!0).line;return e}function Je(e){var t,n;while(t=Ke(e))e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Qe(e,t){var n=ce(e,t),i=qe(n);return n==i?t:he(i)}function et(e,t){if(t>e.lastLine())return t;var n,i=ce(e,t);if(!tt(e,i))return t;while(n=Ke(i))i=n.find(1,!0).line;return he(i)+1}function tt(e,t){var n=Me&&t.markedSpans;if(n)for(var i=void 0,r=0;r<n.length;++r)if(i=n[r],i.marker.collapsed){if(null==i.from)return!0;if(!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&nt(e,t,i))return!0}}function nt(e,t,n){if(null==n.to){var i=n.marker.find(1,!0);return nt(e,i.line,Fe(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var r=void 0,o=0;o<t.markedSpans.length;++o)if(r=t.markedSpans[o],r.marker.collapsed&&!r.marker.widgetNode&&r.from==n.to&&(null==r.to||r.to!=n.from)&&(r.marker.inclusiveLeft||n.marker.inclusiveRight)&&nt(e,t,r))return!0}function it(e){e=qe(e);for(var t=0,n=e.parent,i=0;i<n.lines.length;++i){var r=n.lines[i];if(r==e)break;t+=r.height}for(var o=n.parent;o;n=o,o=n.parent)for(var l=0;l<o.children.length;++l){var a=o.children[l];if(a==n)break;t+=a.height}return t}function rt(e){if(0==e.height)return 0;var t,n=e.text.length,i=e;while(t=Ue(i)){var r=t.find(0,!0);i=r.from.line,n+=r.from.ch-r.to.ch}i=e;while(t=Ke(i)){var o=t.find(0,!0);n-=i.text.length-o.from.ch,i=o.to.line,n+=i.text.length-o.to.ch}return n}function ot(e){var t=e.display,n=e.doc;t.maxLine=ce(n,n.first),t.maxLineLength=rt(t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var n=rt(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function lt(e,t,n,i){if(!e)return i(t,n,"ltr",0);for(var r=!1,o=0;o<e.length;++o){var l=e[o];(l.from<n&&l.to>t||t==n&&l.to==t)&&(i(Math.max(l.from,t),Math.min(l.to,n),1==l.level?"rtl":"ltr",o),r=!0)}r||i(t,n,"ltr")}var at=null;function st(e,t,n){var i;at=null;for(var r=0;r<e.length;++r){var o=e[r];if(o.from<t&&o.to>t)return r;o.to==t&&(o.from!=o.to&&"before"==n?i=r:at=r),o.from==t&&(o.from!=o.to&&"before"!=n?i=r:at=r)}return null!=i?i:at}var ct=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(n){return n<=247?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?t.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/;function s(e,t,n){this.level=e,this.from=t,this.to=n}return function(e,t){var c="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!i.test(e))return!1;for(var u=e.length,d=[],f=0;f<u;++f)d.push(n(e.charCodeAt(f)));for(var h=0,p=c;h<u;++h){var g=d[h];"m"==g?d[h]=p:p=g}for(var m=0,v=c;m<u;++m){var y=d[m];"1"==y&&"r"==v?d[m]="n":o.test(y)&&(v=y,"r"==y&&(d[m]="R"))}for(var b=1,w=d[0];b<u-1;++b){var x=d[b];"+"==x&&"1"==w&&"1"==d[b+1]?d[b]="1":","!=x||w!=d[b+1]||"1"!=w&&"n"!=w||(d[b]=w),w=x}for(var C=0;C<u;++C){var k=d[C];if(","==k)d[C]="N";else if("%"==k){var _=void 0;for(_=C+1;_<u&&"%"==d[_];++_);for(var S=C&&"!"==d[C-1]||_<u&&"1"==d[_]?"1":"N",L=C;L<_;++L)d[L]=S;C=_-1}}for(var T=0,M=c;T<u;++T){var O=d[T];"L"==M&&"1"==O?d[T]="L":o.test(O)&&(M=O)}for(var N=0;N<u;++N)if(r.test(d[N])){var D=void 0;for(D=N+1;D<u&&r.test(d[D]);++D);for(var F="L"==(N?d[N-1]:c),A="L"==(D<u?d[D]:c),H=F==A?F?"L":"R":c,W=N;W<D;++W)d[W]=H;N=D-1}for(var $,P=[],I=0;I<u;)if(l.test(d[I])){var E=I;for(++I;I<u&&l.test(d[I]);++I);P.push(new s(0,E,I))}else{var z=I,R=P.length;for(++I;I<u&&"L"!=d[I];++I);for(var B=z;B<I;)if(a.test(d[B])){z<B&&P.splice(R,0,new s(1,z,B));var V=B;for(++B;B<I&&a.test(d[B]);++B);P.splice(R,0,new s(2,V,B)),z=B}else++B;z<I&&P.splice(R,0,new s(1,z,I))}return"ltr"==t&&(1==P[0].level&&($=e.match(/^\s+/))&&(P[0].from=$[0].length,P.unshift(new s(0,0,$[0].length))),1==Y(P).level&&($=e.match(/\s+$/))&&(Y(P).to-=$[0].length,P.push(new s(0,u-$[0].length,u)))),"rtl"==t?P.reverse():P}}();function ut(e,t){var n=e.order;return null==n&&(n=e.order=ct(e.text,t)),n}var dt=[],ft=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||dt).concat(n)}};function ht(e,t){return e._handlers&&e._handlers[t]||dt}function pt(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var i=e._handlers,r=i&&i[t];if(r){var o=z(r,n);o>-1&&(i[t]=r.slice(0,o).concat(r.slice(o+1)))}}}function gt(e,t){var n=ht(e,t);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r<n.length;++r)n[r].apply(null,i)}function mt(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),gt(e,n||t.type,e,t),Ct(t)||t.codemirrorIgnore}function vt(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)-1==z(n,t[i])&&n.push(t[i])}function yt(e,t){return ht(e,t).length>0}function bt(e){e.prototype.on=function(e,t){ft(this,e,t)},e.prototype.off=function(e,t){pt(this,e,t)}}function wt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function xt(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ct(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function kt(e){wt(e),xt(e)}function _t(e){return e.target||e.srcElement}function St(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var Lt,Tt,Mt=function(){if(l&&a<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function Ot(e){if(null==Lt){var t=O("span","​");M(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Lt=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&a<8))}var n=Lt?O("span","​"):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Nt(e){if(null!=Tt)return Tt;var t=M(e,document.createTextNode("AخA")),n=S(t,0,1).getBoundingClientRect(),i=S(t,1,2).getBoundingClientRect();return T(e),!(!n||n.left==n.right)&&(Tt=i.right-n.right<3)}var Dt=3!="\n\nb".split(/\n/).length?function(e){var t=0,n=[],i=e.length;while(t<=i){var r=e.indexOf("\n",t);-1==r&&(r=e.length);var o=e.slice(t,"\r"==e.charAt(r-1)?r-1:r),l=o.indexOf("\r");-1!=l?(n.push(o.slice(0,l)),t+=l+1):(n.push(o),t=r+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Ft=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},At=function(){var e=O("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Ht=null;function Wt(e){if(null!=Ht)return Ht;var t=M(e,O("span","x")),n=t.getBoundingClientRect(),i=S(t,0,1).getBoundingClientRect();return Ht=Math.abs(n.left-i.left)>1}var $t={},Pt={};function It(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),$t[e]=t}function Et(e,t){Pt[e]=t}function zt(e){if("string"==typeof e&&Pt.hasOwnProperty(e))e=Pt[e];else if(e&&"string"==typeof e.name&&Pt.hasOwnProperty(e.name)){var t=Pt[e.name];"string"==typeof t&&(t={name:t}),e=Q(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return zt("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return zt("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Rt(e,t){t=zt(t);var n=$t[t.name];if(!n)return Rt(e,"text/plain");var i=n(e,t);if(Bt.hasOwnProperty(t.name)){var r=Bt[t.name];for(var o in r)r.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=r[o])}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)i[l]=t.modeProps[l];return i}var Bt={};function Vt(e,t){var n=Bt.hasOwnProperty(e)?Bt[e]:Bt[e]={};P(t,n)}function jt(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var r=t[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function Gt(e,t){var n;while(e.innerMode){if(n=e.innerMode(t),!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}}function Ut(e,t,n){return!e.startState||e.startState(t,n)}var Kt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Kt.prototype.eol=function(){return this.pos>=this.string.length},Kt.prototype.sol=function(){return this.pos==this.lineStart},Kt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Kt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Kt.prototype.eat=function(e){var t,n=this.string.charAt(this.pos);if(t="string"==typeof e?n==e:n&&(e.test?e.test(n):e(n)),t)return++this.pos,n},Kt.prototype.eatWhile=function(e){var t=this.pos;while(this.eat(e));return this.pos>t},Kt.prototype.eatSpace=function(){var e=this,t=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++e.pos;return this.pos>t},Kt.prototype.skipToEnd=function(){this.pos=this.string.length},Kt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Kt.prototype.backUp=function(e){this.pos-=e},Kt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=I(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?I(this.string,this.lineStart,this.tabSize):0)},Kt.prototype.indentation=function(){return I(this.string,null,this.tabSize)-(this.lineStart?I(this.string,this.lineStart,this.tabSize):0)},Kt.prototype.match=function(e,t,n){if("string"!=typeof e){var i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&!1!==t&&(this.pos+=i[0].length),i)}var r=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(r(o)==r(e))return!1!==t&&(this.pos+=e.length),!0},Kt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Kt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Kt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Kt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var Xt=function(e,t){this.state=e,this.lookAhead=t},Yt=function(e,t,n,i){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};function qt(e,t,n,i){var r=[e.state.modeGen],o={};ln(e,t.text,e.doc.mode,n,function(e,t){return r.push(e,t)},o,i);for(var l=n.state,a=function(i){n.baseTokens=r;var a=e.state.overlays[i],s=1,c=0;n.state=!0,ln(e,t.text,a.mode,n,function(e,t){var n=s;while(c<e){var i=r[s];i>e&&r.splice(s,1,e,r[s+1],i),s+=2,c=Math.min(e,i)}if(t)if(a.opaque)r.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;n<s;n+=2){var o=r[n+1];r[n+1]=(o?o+" ":"")+"overlay "+t}},o),n.state=l,n.baseTokens=null,n.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)a(s);return{styles:r,classes:o.bgClass||o.textClass?o:null}}function Zt(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=Jt(e,he(t)),r=t.text.length>e.options.maxHighlightLength&&jt(e.doc.mode,i.state),o=qt(e,t,i);r&&(i.state=r),t.stateAfter=i.save(!r),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Jt(e,t,n){var i=e.doc,r=e.display;if(!i.mode.startState)return new Yt(i,!0,t);var o=an(e,t,n),l=o>i.first&&ce(i,o-1).stateAfter,a=l?Yt.fromSaved(i,l,o):new Yt(i,Ut(i.mode),o);return i.iter(o,t,function(n){Qt(e,n.text,a);var i=a.line;n.stateAfter=i==t-1||i%5==0||i>=r.viewFrom&&i<r.viewTo?a.save():null,a.nextLine()}),n&&(i.modeFrontier=a.line),a}function Qt(e,t,n,i){var r=e.doc.mode,o=new Kt(t,e.options.tabSize,n);o.start=o.pos=i||0,""==t&&en(r,n.state);while(!o.eol())tn(r,o,n.state),o.start=o.pos}function en(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=Gt(e,t);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function tn(e,t,n,i){for(var r=0;r<10;r++){i&&(i[0]=Gt(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}Yt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Yt.prototype.baseToken=function(e){var t=this;if(!this.baseTokens)return null;while(this.baseTokens[this.baseTokenPos]<=e)t.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Yt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Yt.fromSaved=function(e,t,n){return t instanceof Xt?new Yt(e,jt(e.mode,t.state),n,t.lookAhead):new Yt(e,jt(e.mode,t),n)},Yt.prototype.save=function(e){var t=!1!==e?jt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Xt(t,this.maxLookAhead):t};var nn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function rn(e,t,n,i){var r,o=e.doc,l=o.mode;t=_e(o,t);var a,s=ce(o,t.line),c=Jt(e,t.line,n),u=new Kt(s.text,e.options.tabSize,c);i&&(a=[]);while((i||u.pos<t.ch)&&!u.eol())u.start=u.pos,r=tn(l,u,c.state),i&&a.push(new nn(u,r,jt(o.mode,c.state)));return i?a:new nn(u,r,c.state)}function on(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var i=n[1]?"bgClass":"textClass";null==t[i]?t[i]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(t[i])||(t[i]+=" "+n[2])}return e}function ln(e,t,n,i,r,o,l){var a=n.flattenSpans;null==a&&(a=e.options.flattenSpans);var s,c=0,u=null,d=new Kt(t,e.options.tabSize,i),f=e.options.addModeClass&&[null];""==t&&on(en(n,i.state),o);while(!d.eol()){if(d.pos>e.options.maxHighlightLength?(a=!1,l&&Qt(e,t,i,d.pos),d.pos=t.length,s=null):s=on(tn(n,d,i.state,f),o),f){var h=f[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!a||u!=s){while(c<d.start)c=Math.min(d.start,c+5e3),r(c,u);u=s}d.start=d.pos}while(c<d.pos){var p=Math.min(d.pos,c+5e3);r(p,u),c=p}}function an(e,t,n){for(var i,r,o=e.doc,l=n?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>l;--a){if(a<=o.first)return o.first;var s=ce(o,a-1),c=s.stateAfter;if(c&&(!n||a+(c instanceof Xt?c.lookAhead:0)<=o.modeFrontier))return a;var u=I(s.text,null,e.options.tabSize);(null==r||i>u)&&(r=a-1,i=u)}return r}function sn(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,i=t-1;i>n;i--){var r=ce(e,i).stateAfter;if(r&&(!(r instanceof Xt)||i+r.lookAhead<t)){n=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var cn=function(e,t,n){this.text=e,Re(this,t),this.height=n?n(this):1};function un(e,t,n,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),ze(e),Re(e,n);var r=i?i(e):1;r!=e.height&&fe(e,r)}function dn(e){e.parent=null,ze(e)}cn.prototype.lineNo=function(){return he(this)},bt(cn);var fn={},hn={};function pn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?hn:fn;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function gn(e,t){var n=N("span",null,null,s?"padding-right: .1px":null),i={pre:N("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var o=r?t.rest[r-1]:t.line,l=void 0;i.pos=0,i.addToken=vn,Nt(e.display.measure)&&(l=ut(o,e.doc.direction))&&(i.addToken=bn(i.addToken,l)),i.map=[];var a=t!=e.display.externalMeasured&&he(o);xn(o,i,Zt(e,o,a)),o.styleClasses&&(o.styleClasses.bgClass&&(i.bgClass=H(o.styleClasses.bgClass,i.bgClass||"")),o.styleClasses.textClass&&(i.textClass=H(o.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(Ot(e.display.measure))),0==r?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var c=i.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return gt(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=H(i.pre.className,i.textClass||"")),i}function mn(e){var t=O("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function vn(e,t,n,i,r,o,s){if(t){var c,u=e.splitSpaces?yn(t,e.trailingSpace):t,d=e.cm.state.specialChars,f=!1;if(d.test(t)){c=document.createDocumentFragment();var h=0;while(1){d.lastIndex=h;var p=d.exec(t),g=p?p.index-h:t.length-h;if(g){var m=document.createTextNode(u.slice(h,h+g));l&&a<9?c.appendChild(O("span",[m])):c.appendChild(m),e.map.push(e.pos,e.pos+g,m),e.col+=g,e.pos+=g}if(!p)break;h+=g+1;var v=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;v=c.appendChild(O("span",X(b),"cm-tab")),v.setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?(v=c.appendChild(O("span","\r"==p[0]?"␍":"␤","cm-invalidchar")),v.setAttribute("cm-text",p[0]),e.col+=1):(v=e.cm.options.specialCharPlaceholder(p[0]),v.setAttribute("cm-text",p[0]),l&&a<9?c.appendChild(O("span",[v])):c.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,c=document.createTextNode(u),e.map.push(e.pos,e.pos+t.length,c),l&&a<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==u.charCodeAt(t.length-1),n||i||r||f||o){var w=n||"";i&&(w+=i),r&&(w+=r);var x=O("span",[c],w,o);if(s)for(var C in s)s.hasOwnProperty(C)&&"style"!=C&&"class"!=C&&x.setAttribute(C,s[C]);return e.content.appendChild(x)}e.content.appendChild(c)}}function yn(e,t){if(e.length>1&&!/  /.test(e))return e;for(var n=t,i="",r=0;r<e.length;r++){var o=e.charAt(r);" "!=o||!n||r!=e.length-1&&32!=e.charCodeAt(r+1)||(o=" "),i+=o,n=" "==o}return i}function bn(e,t){return function(n,i,r,o,l,a,s){r=r?r+" cm-force-border":"cm-force-border";for(var c=n.pos,u=c+i.length;;){for(var d=void 0,f=0;f<t.length;f++)if(d=t[f],d.to>c&&d.from<=c)break;if(d.to>=u)return e(n,i,r,o,l,a,s);e(n,i.slice(0,d.to-c),r,o,null,a,s),o=null,i=i.slice(d.to-c),c=d.to}}}function wn(e,t,n,i){var r=!i&&n.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!i&&e.cm.display.input.needsContentAttribute&&(r||(r=e.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t,e.trailingSpace=!1}function xn(e,t,n){var i=e.markedSpans,r=e.text,o=0;if(i)for(var l,a,s,c,u,d,f,h=r.length,p=0,g=1,m="",v=0;;){if(v==p){s=c=u=a="",f=null,d=null,v=1/0;for(var y=[],b=void 0,w=0;w<i.length;++w){var x=i[w],C=x.marker;if("bookmark"==C.type&&x.from==p&&C.widgetNode)y.push(C);else if(x.from<=p&&(null==x.to||x.to>p||C.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),C.className&&(s+=" "+C.className),C.css&&(a=(a?a+";":"")+C.css),C.startStyle&&x.from==p&&(u+=" "+C.startStyle),C.endStyle&&x.to==v&&(b||(b=[])).push(C.endStyle,x.to),C.title&&((f||(f={})).title=C.title),C.attributes)for(var k in C.attributes)(f||(f={}))[k]=C.attributes[k];C.collapsed&&(!d||je(d.marker,C)<0)&&(d=x)}else x.from>p&&v>x.from&&(v=x.from)}if(b)for(var _=0;_<b.length;_+=2)b[_+1]==v&&(c+=" "+b[_]);if(!d||d.from==p)for(var S=0;S<y.length;++S)wn(t,0,y[S]);if(d&&(d.from||0)==p){if(wn(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(p>=h)break;var L=Math.min(h,v);while(1){if(m){var T=p+m.length;if(!d){var M=T>L?m.slice(0,L-p):m;t.addToken(t,M,l?l+s:s,u,p+M.length==v?c:"",a,f)}if(T>=L){m=m.slice(L-p),p=L;break}p=T,u=""}m=r.slice(o,o=n[g++]),l=pn(n[g++],t.cm.options)}}else for(var O=1;O<n.length;O+=2)t.addToken(t,r.slice(o,o=n[O]),pn(n[O+1],t.cm.options))}function Cn(e,t,n){this.line=t,this.rest=Je(t),this.size=this.rest?he(Y(this.rest))-n+1:1,this.node=this.text=null,this.hidden=tt(e,t)}function kn(e,t,n){for(var i,r=[],o=t;o<n;o=i){var l=new Cn(e.doc,ce(e.doc,o),o);i=o+l.size,r.push(l)}return r}var _n=null;function Sn(e){_n?_n.ops.push(e):e.ownsGroup=_n={ops:[e],delayedCallbacks:[]}}function Ln(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var i=0;i<e.ops.length;i++){var r=e.ops[i];if(r.cursorActivityHandlers)while(r.cursorActivityCalled<r.cursorActivityHandlers.length)r.cursorActivityHandlers[r.cursorActivityCalled++].call(null,r.cm)}}while(n<t.length)}function Tn(e,t){var n=e.ownsGroup;if(n)try{Ln(n)}finally{_n=null,t(n)}}var Mn=null;function On(e,t){var n=ht(e,t);if(n.length){var i,r=Array.prototype.slice.call(arguments,2);_n?i=_n.delayedCallbacks:Mn?i=Mn:(i=Mn=[],setTimeout(Nn,0));for(var o=function(e){i.push(function(){return n[e].apply(null,r)})},l=0;l<n.length;++l)o(l)}}function Nn(){var e=Mn;Mn=null;for(var t=0;t<e.length;++t)e[t]()}function Dn(e,t,n,i){for(var r=0;r<t.changes.length;r++){var o=t.changes[r];"text"==o?Wn(e,t):"gutter"==o?Pn(e,t,n,i):"class"==o?$n(e,t):"widget"==o&&In(e,t,i)}t.changes=null}function Fn(e){return e.node==e.text&&(e.node=O("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),l&&a<8&&(e.node.style.zIndex=2)),e.node}function An(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var i=Fn(t);t.background=i.insertBefore(O("div",null,n),i.firstChild),e.display.input.setUneditable(t.background)}}function Hn(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):gn(e,t)}function Wn(e,t){var n=t.text.className,i=Hn(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,$n(e,t)):n&&(t.text.className=n)}function $n(e,t){An(e,t),t.line.wrapClass?Fn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Pn(e,t,n,i){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var r=Fn(t);t.gutterBackground=O("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),r.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var l=Fn(t),a=t.gutter=O("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),l.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(O("div",me(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.options.gutters.length;++s){var c=e.options.gutters[s],u=o.hasOwnProperty(c)&&o[c];u&&a.appendChild(O("div",[u],"CodeMirror-gutter-elt","left: "+i.gutterLeft[c]+"px; width: "+i.gutterWidth[c]+"px"))}}}function In(e,t,n){t.alignable&&(t.alignable=null);for(var i=t.node.firstChild,r=void 0;i;i=r)r=i.nextSibling,"CodeMirror-linewidget"==i.className&&t.node.removeChild(i);zn(e,t,n)}function En(e,t,n,i){var r=Hn(e,t);return t.text=t.node=r.pre,r.bgClass&&(t.bgClass=r.bgClass),r.textClass&&(t.textClass=r.textClass),$n(e,t),Pn(e,t,n,i),zn(e,t,i),t.node}function zn(e,t,n){if(Rn(e,t.line,t,n,!0),t.rest)for(var i=0;i<t.rest.length;i++)Rn(e,t.rest[i],t,n,!1)}function Rn(e,t,n,i,r){if(t.widgets)for(var o=Fn(n),l=0,a=t.widgets;l<a.length;++l){var s=a[l],c=O("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),Bn(s,c,n,i),e.display.input.setUneditable(c),r&&s.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),On(s,"redraw")}}function Bn(e,t,n,i){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var r=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(r-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=r+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function Vn(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),M(t.display.measure,O("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function jn(e,t){for(var n=_t(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Gn(e){return e.lineSpace.offsetTop}function Un(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Kn(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=M(e.measure,O("pre","x")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(i.left)||isNaN(i.right)||(e.cachedPaddingH=i),i}function Xn(e){return R-e.display.nativeBarWidth}function Yn(e){return e.display.scroller.clientWidth-Xn(e)-e.display.barWidth}function qn(e){return e.display.scroller.clientHeight-Xn(e)-e.display.barHeight}function Zn(e,t,n){var i=e.options.lineWrapping,r=i&&Yn(e);if(!t.measure.heights||i&&t.measure.width!=r){var o=t.measure.heights=[];if(i){t.measure.width=r;for(var l=t.text.firstChild.getClientRects(),a=0;a<l.length-1;a++){var s=l[a],c=l[a+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Jn(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var r=0;r<e.rest.length;r++)if(he(e.rest[r])>n)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Qn(e,t){t=qe(t);var n=he(t),i=e.display.externalMeasured=new Cn(e.doc,t,n);i.lineN=n;var r=i.built=gn(e,i);return i.text=r.pre,M(e.display.lineMeasure,r.pre),i}function ei(e,t,n,i){return ii(e,ni(e,t),n,i)}function ti(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[$i(e,t)];var n=e.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function ni(e,t){var n=he(t),i=ti(e,n);i&&!i.text?i=null:i&&i.changes&&(Dn(e,i,n,Di(e)),e.curOp.forceUpdate=!0),i||(i=Qn(e,t));var r=Jn(i,t,n);return{line:t,view:i,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function ii(e,t,n,i,r){t.before&&(n=-1);var o,l=n+(i||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Zn(e,t.view,t.rect),t.hasHeights=!0),o=si(e,t,n,i),o.bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:r?o.rtop:o.top,bottom:r?o.rbottom:o.bottom}}var ri,oi={left:0,right:0,top:0,bottom:0};function li(e,t,n){for(var i,r,o,l,a,s,c=0;c<e.length;c+=3)if(a=e[c],s=e[c+1],t<a?(r=0,o=1,l="left"):t<s?(r=t-a,o=r+1):(c==e.length-3||t==s&&e[c+3]>t)&&(o=s-a,r=o-1,t>=s&&(l="right")),null!=r){if(i=e[c+2],a==s&&n==(i.insertLeft?"left":"right")&&(l=n),"left"==n&&0==r)while(c&&e[c-2]==e[c-3]&&e[c-1].insertLeft)i=e[2+(c-=3)],l="left";if("right"==n&&r==s-a)while(c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft)i=e[(c+=3)+2],l="right";break}return{node:i,start:r,end:o,collapse:l,coverStart:a,coverEnd:s}}function ai(e,t){var n=oi;if("left"==t){for(var i=0;i<e.length;i++)if((n=e[i]).left!=n.right)break}else for(var r=e.length-1;r>=0;r--)if((n=e[r]).left!=n.right)break;return n}function si(e,t,n,i){var r,o=li(t.map,n,i),s=o.node,c=o.start,u=o.end,d=o.collapse;if(3==s.nodeType){for(var f=0;f<4;f++){while(c&&oe(t.line.text.charAt(o.coverStart+c)))--c;while(o.coverStart+u<o.coverEnd&&oe(t.line.text.charAt(o.coverStart+u)))++u;if(r=l&&a<9&&0==c&&u==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():ai(S(s,c,u).getClientRects(),i),r.left||r.right||0==c)break;u=c,c-=1,d="right"}l&&a<11&&(r=ci(e.display.measure,r))}else{var h;c>0&&(d=i="right"),r=e.options.lineWrapping&&(h=s.getClientRects()).length>1?h["right"==i?h.length-1:0]:s.getBoundingClientRect()}if(l&&a<9&&!c&&(!r||!r.left&&!r.right)){var p=s.parentNode.getClientRects()[0];r=p?{left:p.left,right:p.left+Ni(e.display),top:p.top,bottom:p.bottom}:oi}for(var g=r.top-t.rect.top,m=r.bottom-t.rect.top,v=(g+m)/2,y=t.view.measure.heights,b=0;b<y.length-1;b++)if(v<y[b])break;var w=b?y[b-1]:0,x=y[b],C={left:("right"==d?r.right:r.left)-t.rect.left,right:("left"==d?r.left:r.right)-t.rect.left,top:w,bottom:x};return r.left||r.right||(C.bogus=!0),e.options.singleCursorHeightPerLine||(C.rtop=g,C.rbottom=m),C}function ci(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Wt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*i,bottom:t.bottom*i}}function ui(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 di(e){e.display.externalMeasure=null,T(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)ui(e.display.view[t])}function fi(e){di(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function hi(){return u&&m?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function pi(){return u&&m?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function gi(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=Vn(e.widgets[n]));return t}function mi(e,t,n,i,r){if(!r){var o=gi(t);n.top+=o,n.bottom+=o}if("line"==i)return n;i||(i="local");var l=it(t);if("local"==i?l+=Gn(e.display):l-=e.display.viewOffset,"page"==i||"window"==i){var a=e.display.lineSpace.getBoundingClientRect();l+=a.top+("window"==i?0:pi());var s=a.left+("window"==i?0:hi());n.left+=s,n.right+=s}return n.top+=l,n.bottom+=l,n}function vi(e,t,n){if("div"==n)return t;var i=t.left,r=t.top;if("page"==n)i-=hi(),r-=pi();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();i+=o.left,r+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:i-l.left,top:r-l.top}}function yi(e,t,n,i,r){return i||(i=ce(e.doc,t.line)),mi(e,i,ei(e,i,t.ch,r),n)}function bi(e,t,n,i,r,o){function l(t,l){var a=ii(e,r,t,l?"right":"left",o);return l?a.left=a.right:a.right=a.left,mi(e,i,a,n)}i=i||ce(e.doc,t.line),r||(r=ni(e,i));var a=ut(i,e.doc.direction),s=t.ch,c=t.sticky;if(s>=i.text.length?(s=i.text.length,c="before"):s<=0&&(s=0,c="after"),!a)return l("before"==c?s-1:s,"before"==c);function u(e,t,n){var i=a[t],r=1==i.level;return l(n?e-1:e,r!=n)}var d=st(a,s,c),f=at,h=u(s,d,"before"==c);return null!=f&&(h.other=u(s,f,"before"!=c)),h}function wi(e,t){var n=0;t=_e(e.doc,t),e.options.lineWrapping||(n=Ni(e.display)*t.ch);var i=ce(e.doc,t.line),r=it(i)+Gn(e.display);return{left:n,right:n,top:r,bottom:r+i.height}}function xi(e,t,n,i,r){var o=ve(e,t,n);return o.xRel=r,i&&(o.outside=!0),o}function Ci(e,t,n){var i=e.doc;if(n+=e.display.viewOffset,n<0)return xi(i.first,0,null,!0,-1);var r=pe(i,n),o=i.first+i.size-1;if(r>o)return xi(i.first+i.size-1,ce(i,o).text.length,null,!0,1);t<0&&(t=0);for(var l=ce(i,r);;){var a=Li(e,l,r,t,n),s=Xe(l,a.ch+(a.xRel>0?1:0));if(!s)return a;var c=s.find(1);if(c.line==r)return c;l=ce(i,r=c.line)}}function ki(e,t,n,i){i-=gi(t);var r=t.text.length,o=ae(function(t){return ii(e,n,t-1).bottom<=i},r,0);return r=ae(function(t){return ii(e,n,t).top>i},o,r),{begin:o,end:r}}function _i(e,t,n,i){n||(n=ni(e,t));var r=mi(e,t,ii(e,n,i),"line").top;return ki(e,t,n,r)}function Si(e,t,n,i){return!(e.bottom<=n)&&(e.top>n||(i?e.left:e.right)>t)}function Li(e,t,n,i,r){r-=it(t);var o=ni(e,t),l=gi(t),a=0,s=t.text.length,c=!0,u=ut(t,e.doc.direction);if(u){var d=(e.options.lineWrapping?Mi:Ti)(e,t,n,o,u,i,r);c=1!=d.level,a=c?d.from:d.to-1,s=c?d.to:d.from-1}var f,h,p=null,g=null,m=ae(function(t){var n=ii(e,o,t);return n.top+=l,n.bottom+=l,!!Si(n,i,r,!1)&&(n.top<=r&&n.left<=i&&(p=t,g=n),!0)},a,s),v=!1;if(g){var y=i-g.left<g.right-i,b=y==c;m=p+(b?0:1),h=b?"after":"before",f=y?g.left:g.right}else{c||m!=s&&m!=a||m++,h=0==m?"after":m==t.text.length?"before":ii(e,o,m-(c?1:0)).bottom+l<=r==c?"after":"before";var w=bi(e,ve(n,m,h),"line",t,o);f=w.left,v=r<w.top||r>=w.bottom}return m=le(t.text,m,1),xi(n,m,h,v,i-f)}function Ti(e,t,n,i,r,o,l){var a=ae(function(a){var s=r[a],c=1!=s.level;return Si(bi(e,ve(n,c?s.to:s.from,c?"before":"after"),"line",t,i),o,l,!0)},0,r.length-1),s=r[a];if(a>0){var c=1!=s.level,u=bi(e,ve(n,c?s.from:s.to,c?"after":"before"),"line",t,i);Si(u,o,l,!0)&&u.top>l&&(s=r[a-1])}return s}function Mi(e,t,n,i,r,o,l){var a=ki(e,t,i,l),s=a.begin,c=a.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,d=null,f=0;f<r.length;f++){var h=r[f];if(!(h.from>=c||h.to<=s)){var p=1!=h.level,g=ii(e,i,p?Math.min(c,h.to)-1:Math.max(s,h.from)).right,m=g<o?o-g+1e9:g-o;(!u||d>m)&&(u=h,d=m)}}return u||(u=r[r.length-1]),u.from<s&&(u={from:s,to:u.to,level:u.level}),u.to>c&&(u={from:u.from,to:c,level:u.level}),u}function Oi(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==ri){ri=O("pre");for(var t=0;t<49;++t)ri.appendChild(document.createTextNode("x")),ri.appendChild(O("br"));ri.appendChild(document.createTextNode("x"))}M(e.measure,ri);var n=ri.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),T(e.measure),n||1}function Ni(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx"),n=O("pre",[t]);M(e.measure,n);var i=t.getBoundingClientRect(),r=(i.right-i.left)/10;return r>2&&(e.cachedCharWidth=r),r||10}function Di(e){for(var t=e.display,n={},i={},r=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)n[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+r,i[e.options.gutters[l]]=o.clientWidth;return{fixedPos:Fi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function Fi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Ai(e){var t=Oi(e.display),n=e.options.lineWrapping,i=n&&Math.max(5,e.display.scroller.clientWidth/Ni(e.display)-3);return function(r){if(tt(e.doc,r))return 0;var o=0;if(r.widgets)for(var l=0;l<r.widgets.length;l++)r.widgets[l].height&&(o+=r.widgets[l].height);return n?o+(Math.ceil(r.text.length/i)||1)*t:o+t}}function Hi(e){var t=e.doc,n=Ai(e);t.iter(function(e){var t=n(e);t!=e.height&&fe(e,t)})}function Wi(e,t,n,i){var r=e.display;if(!n&&"true"==_t(t).getAttribute("cm-not-content"))return null;var o,l,a=r.lineSpace.getBoundingClientRect();try{o=t.clientX-a.left,l=t.clientY-a.top}catch(t){return null}var s,c=Ci(e,o,l);if(i&&1==c.xRel&&(s=ce(e.doc,c.line).text).length==c.ch){var u=I(s,s.length,e.options.tabSize)-s.length;c=ve(c.line,Math.max(0,Math.round((o-Kn(e.display).left)/Ni(e.display))-u))}return c}function $i(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,i=0;i<n.length;i++)if(t-=n[i].size,t<0)return i}function Pi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Ii(e,t){void 0===t&&(t=!0);for(var n=e.doc,i={},r=i.cursors=document.createDocumentFragment(),o=i.selection=document.createDocumentFragment(),l=0;l<n.sel.ranges.length;l++)if(t||l!=n.sel.primIndex){var a=n.sel.ranges[l];if(!(a.from().line>=e.display.viewTo||a.to().line<e.display.viewFrom)){var s=a.empty();(s||e.options.showCursorWhenSelecting)&&Ei(e,a.head,r),s||Ri(e,a,o)}}return i}function Ei(e,t,n){var i=bi(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),r=n.appendChild(O("div"," ","CodeMirror-cursor"));if(r.style.left=i.left+"px",r.style.top=i.top+"px",r.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var o=n.appendChild(O("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=i.other.left+"px",o.style.top=i.other.top+"px",o.style.height=.85*(i.other.bottom-i.other.top)+"px"}}function zi(e,t){return e.top-t.top||e.left-t.left}function Ri(e,t,n){var i=e.display,r=e.doc,o=document.createDocumentFragment(),l=Kn(e.display),a=l.left,s=Math.max(i.sizerWidth,Yn(e)-i.sizer.offsetLeft)-l.right,c="ltr"==r.direction;function u(e,t,n,i){t<0&&(t=0),t=Math.round(t),i=Math.round(i),o.appendChild(O("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n                             top: "+t+"px; width: "+(null==n?s-e:n)+"px;\n                             height: "+(i-t)+"px"))}function d(t,n,i){var o,l,d=ce(r,t),f=d.text.length;function h(n,i){return yi(e,ve(t,n),"div",d,i)}function p(t,n,i){var r=_i(e,d,null,t),o="ltr"==n==("after"==i)?"left":"right",l="after"==i?r.begin:r.end-(/\s/.test(d.text.charAt(r.end-1))?2:1);return h(l,o)[o]}var g=ut(d,r.direction);return lt(g,n||0,null==i?f:i,function(e,t,r,d){var m="ltr"==r,v=h(e,m?"left":"right"),y=h(t-1,m?"right":"left"),b=null==n&&0==e,w=null==i&&t==f,x=0==d,C=!g||d==g.length-1;if(y.top-v.top<=3){var k=(c?b:w)&&x,_=(c?w:b)&&C,S=k?a:(m?v:y).left,L=_?s:(m?y:v).right;u(S,v.top,L-S,v.bottom)}else{var T,M,O,N;m?(T=c&&b&&x?a:v.left,M=c?s:p(e,r,"before"),O=c?a:p(t,r,"after"),N=c&&w&&C?s:y.right):(T=c?p(e,r,"before"):a,M=!c&&b&&x?s:v.right,O=!c&&w&&C?a:y.left,N=c?p(t,r,"after"):s),u(T,v.top,M-T,v.bottom),v.bottom<y.top&&u(a,v.bottom,null,y.top),u(O,y.top,N-O,y.bottom)}(!o||zi(v,o)<0)&&(o=v),zi(y,o)<0&&(o=y),(!l||zi(v,l)<0)&&(l=v),zi(y,l)<0&&(l=y)}),{start:o,end:l}}var f=t.from(),h=t.to();if(f.line==h.line)d(f.line,f.ch,h.ch);else{var p=ce(r,f.line),g=ce(r,h.line),m=qe(p)==qe(g),v=d(f.line,f.ch,m?p.text.length+1:null).end,y=d(h.line,m?0:null,h.ch).start;m&&(v.top<y.top-2?(u(v.right,v.top,null,v.bottom),u(a,y.top,y.left,y.bottom)):u(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&u(a,v.bottom,null,y.top)}n.appendChild(o)}function Bi(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Vi(e){e.state.focused||(e.display.input.focus(),Gi(e))}function ji(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ui(e))},100)}function Gi(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(gt(e,"focus",e,t),e.state.focused=!0,A(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Bi(e))}function Ui(e,t){e.state.delayingBlurEvent||(e.state.focused&&(gt(e,"blur",e,t),e.state.focused=!1,L(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Ki(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var r=t.view[i],o=e.options.lineWrapping,s=void 0,c=0;if(!r.hidden){if(l&&a<8){var u=r.node.offsetTop+r.node.offsetHeight;s=u-n,n=u}else{var d=r.node.getBoundingClientRect();s=d.bottom-d.top,!o&&r.text.firstChild&&(c=r.text.firstChild.getBoundingClientRect().right-d.left-1)}var f=r.line.height-s;if(s<2&&(s=Oi(t)),(f>.005||f<-.005)&&(fe(r.line,s),Xi(r.line),r.rest))for(var h=0;h<r.rest.length;h++)Xi(r.rest[h]);if(c>e.display.sizerWidth){var p=Math.ceil(c/Ni(e.display));p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=r.line,e.display.maxLineChanged=!0)}}}}function Xi(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],i=n.node.parentNode;i&&(n.height=i.offsetHeight)}}function Yi(e,t,n){var i=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;i=Math.floor(i-Gn(e));var r=n&&null!=n.bottom?n.bottom:i+e.wrapper.clientHeight,o=pe(t,i),l=pe(t,r);if(n&&n.ensure){var a=n.ensure.from.line,s=n.ensure.to.line;a<o?(o=a,l=pe(t,it(ce(t,a))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=l&&(o=pe(t,it(ce(t,s))-e.wrapper.clientHeight),l=s)}return{from:o,to:Math.max(l,o+1)}}function qi(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var i=Fi(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,o=i+"px",l=0;l<n.length;l++)if(!n[l].hidden){e.options.fixedGutter&&(n[l].gutter&&(n[l].gutter.style.left=o),n[l].gutterBackground&&(n[l].gutterBackground.style.left=o));var a=n[l].alignable;if(a)for(var s=0;s<a.length;s++)a[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=i+r+"px")}}function Zi(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=me(e.options,t.first+t.size-1),i=e.display;if(n.length!=i.lineNumChars){var r=i.measure.appendChild(O("div",[O("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=r.firstChild.offsetWidth,l=r.offsetWidth-o;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(o,i.lineGutter.offsetWidth-l)+1,i.lineNumWidth=i.lineNumInnerWidth+l,i.lineNumChars=i.lineNumInnerWidth?n.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Kr(e),!0}return!1}function Ji(e,t){if(!mt(e,"scrollCursorIntoView")){var n=e.display,i=n.sizer.getBoundingClientRect(),r=null;if(t.top+i.top<0?r=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),null!=r&&!p){var o=O("div","​",null,"position: absolute;\n                         top: "+(t.top-n.viewOffset-Gn(e.display))+"px;\n                         height: "+(t.bottom-t.top+Xn(e)+n.barHeight)+"px;\n                         left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(r),e.display.lineSpace.removeChild(o)}}}function Qi(e,t,n,i){var r;null==i&&(i=0),e.options.lineWrapping||t!=n||(t=t.ch?ve(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t,n="before"==t.sticky?ve(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,a=bi(e,t),s=n&&n!=t?bi(e,n):a;r={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-i,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+i};var c=tr(e,r),u=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=c.scrollTop&&(sr(e,c.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(l=!0)),null!=c.scrollLeft&&(ur(e,c.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(l=!0)),!l)break}return r}function er(e,t){var n=tr(e,t);null!=n.scrollTop&&sr(e,n.scrollTop),null!=n.scrollLeft&&ur(e,n.scrollLeft)}function tr(e,t){var n=e.display,i=Oi(e.display);t.top<0&&(t.top=0);var r=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=qn(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var a=e.doc.height+Un(n),s=t.top<i,c=t.bottom>a-i;if(t.top<r)l.scrollTop=s?0:t.top;else if(t.bottom>r+o){var u=Math.min(t.top,(c?a:t.bottom)-o);u!=r&&(l.scrollTop=u)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,f=Yn(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),h=t.right-t.left>f;return h&&(t.right=t.left+f),t.left<10?l.scrollLeft=0:t.left<d?l.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>f+d-3&&(l.scrollLeft=t.right+(h?0:10)-f),l}function nr(e,t){null!=t&&(lr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function ir(e){lr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function rr(e,t,n){null==t&&null==n||lr(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function or(e,t){lr(e),e.curOp.scrollToPos=t}function lr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=wi(e,t.from),i=wi(e,t.to);ar(e,n,i,t.margin)}}function ar(e,t,n,i){var r=tr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});rr(e,r.scrollLeft,r.scrollTop)}function sr(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||Gr(e,{top:t}),cr(e,t,!0),n&&Gr(e),Pr(e,100))}function cr(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function ur(e,t,n,i){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i||(e.doc.scrollLeft=t,qi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function dr(e){var t=e.display,n=t.gutters.offsetWidth,i=Math.round(e.doc.height+Un(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+Xn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var fr=function(e,t,n){this.cm=n;var i=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1,e(i),e(r),ft(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),ft(r,"scroll",function(){r.clientWidth&&t(r.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,l&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};fr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var r=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:t?i:0}},fr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},fr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},fr.prototype.zeroWidthHack=function(){var e=y&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new E,this.disableVert=new E},fr.prototype.enableZeroWidthBar=function(e,t,n){function i(){var r=e.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1);o!=e?e.style.pointerEvents="none":t.set(1e3,i)}e.style.pointerEvents="auto",t.set(1e3,i)},fr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var hr=function(){};function pr(e,t){t||(t=dr(e));var n=e.display.barWidth,i=e.display.barHeight;gr(e,t);for(var r=0;r<4&&n!=e.display.barWidth||i!=e.display.barHeight;r++)n!=e.display.barWidth&&e.options.lineWrapping&&Ki(e),gr(e,dr(e)),n=e.display.barWidth,i=e.display.barHeight}function gr(e,t){var n=e.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}hr.prototype.update=function(){return{bottom:0,right:0}},hr.prototype.setScrollLeft=function(){},hr.prototype.setScrollTop=function(){},hr.prototype.clear=function(){};var mr={native:fr,null:hr};function vr(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&L(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new mr[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ft(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){"horizontal"==n?ur(e,t):sr(e,t)},e),e.display.scrollbars.addClass&&A(e.display.wrapper,e.display.scrollbars.addClass)}var yr=0;function br(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++yr},Sn(e.curOp)}function wr(e){var t=e.curOp;t&&Tn(t,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;xr(e)})}function xr(e){for(var t=e.ops,n=0;n<t.length;n++)Cr(t[n]);for(var i=0;i<t.length;i++)kr(t[i]);for(var r=0;r<t.length;r++)_r(t[r]);for(var o=0;o<t.length;o++)Sr(t[o]);for(var l=0;l<t.length;l++)Lr(t[l])}function Cr(e){var t=e.cm,n=t.display;zr(t),e.updateMaxLine&&ot(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Er(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function kr(e){e.updatedDisplay=e.mustUpdate&&Vr(e.cm,e.update)}function _r(e){var t=e.cm,n=t.display;e.updatedDisplay&&Ki(t),e.barMeasure=dr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ei(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Xn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Yn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Sr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ur(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==F();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&pr(t,e.barMeasure),e.updatedDisplay&&Xr(t,e.barMeasure),e.selectionChanged&&Bi(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Vi(e.cm)}function Lr(e){var t=e.cm,n=t.display,i=t.doc;if(e.updatedDisplay&&jr(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&cr(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&ur(t,e.scrollLeft,!0,!0),e.scrollToPos){var r=Qi(t,_e(i,e.scrollToPos.from),_e(i,e.scrollToPos.to),e.scrollToPos.margin);Ji(t,r)}var o=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(o)for(var a=0;a<o.length;++a)o[a].lines.length||gt(o[a],"hide");if(l)for(var s=0;s<l.length;++s)l[s].lines.length&&gt(l[s],"unhide");n.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&gt(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Tr(e,t){if(e.curOp)return t();br(e);try{return t()}finally{wr(e)}}function Mr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);br(e);try{return t.apply(e,arguments)}finally{wr(e)}}}function Or(e){return function(){if(this.curOp)return e.apply(this,arguments);br(this);try{return e.apply(this,arguments)}finally{wr(this)}}}function Nr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);br(t);try{return e.apply(this,arguments)}finally{wr(t)}}}function Dr(e,t,n,i){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),i||(i=0);var r=e.display;if(i&&n<r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>t)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)Me&&Qe(e.doc,t)<r.viewTo&&Ar(e);else if(n<=r.viewFrom)Me&&et(e.doc,n+i)>r.viewFrom?Ar(e):(r.viewFrom+=i,r.viewTo+=i);else if(t<=r.viewFrom&&n>=r.viewTo)Ar(e);else if(t<=r.viewFrom){var o=Hr(e,n,n+i,1);o?(r.view=r.view.slice(o.index),r.viewFrom=o.lineN,r.viewTo+=i):Ar(e)}else if(n>=r.viewTo){var l=Hr(e,t,t,-1);l?(r.view=r.view.slice(0,l.index),r.viewTo=l.lineN):Ar(e)}else{var a=Hr(e,t,t,-1),s=Hr(e,n,n+i,1);a&&s?(r.view=r.view.slice(0,a.index).concat(kn(e,a.lineN,s.lineN)).concat(r.view.slice(s.index)),r.viewTo+=i):Ar(e)}var c=r.externalMeasured;c&&(n<c.lineN?c.lineN+=i:t<c.lineN+c.size&&(r.externalMeasured=null))}function Fr(e,t,n){e.curOp.viewChanged=!0;var i=e.display,r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size&&(i.externalMeasured=null),!(t<i.viewFrom||t>=i.viewTo)){var o=i.view[$i(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==z(l,n)&&l.push(n)}}}function Ar(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Hr(e,t,n,i){var r,o=$i(e,t),l=e.display.view;if(!Me||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var a=e.display.viewFrom,s=0;s<o;s++)a+=l[s].size;if(a!=t){if(i>0){if(o==l.length-1)return null;r=a+l[o].size-t,o++}else r=a-t;t+=r,n+=r}while(Qe(e.doc,n)!=n){if(o==(i<0?0:l.length-1))return null;n+=i*l[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:n}}function Wr(e,t,n){var i=e.display,r=i.view;0==r.length||t>=i.viewTo||n<=i.viewFrom?(i.view=kn(e,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=kn(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice($i(e,t))),i.viewFrom=t,i.viewTo<n?i.view=i.view.concat(kn(e,i.viewTo,n)):i.viewTo>n&&(i.view=i.view.slice(0,$i(e,n)))),i.viewTo=n}function $r(e){for(var t=e.display.view,n=0,i=0;i<t.length;i++){var r=t[i];r.hidden||r.node&&!r.changes||++n}return n}function Pr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,$(Ir,e))}function Ir(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,i=Jt(e,t.highlightFrontier),r=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(i.line>=e.display.viewFrom){var l=o.styles,a=o.text.length>e.options.maxHighlightLength?jt(t.mode,i.state):null,s=qt(e,o,i,!0);a&&(i.state=a),o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!l||l.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),f=0;!d&&f<l.length;++f)d=l[f]!=o.styles[f];d&&r.push(i.line),o.stateAfter=i.save(),i.nextLine()}else o.text.length<=e.options.maxHighlightLength&&Qt(e,o.text,i),o.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>n)return Pr(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),r.length&&Tr(e,function(){for(var t=0;t<r.length;t++)Fr(e,r[t],"text")})}}var Er=function(e,t,n){var i=e.display;this.viewport=t,this.visible=Yi(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Yn(e),this.force=n,this.dims=Di(e),this.events=[]};function zr(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Xn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Xn(e)+"px",t.scrollbarsClipped=!0)}function Rr(e){if(e.hasFocus())return null;var t=F();if(!t||!D(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&D(e.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}function Br(e){if(e&&e.activeElt&&e.activeElt!=F()&&(e.activeElt.focus(),e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Vr(e,t){var n=e.display,i=e.doc;if(t.editorIsHidden)return Ar(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==$r(e))return!1;Zi(e)&&(Ar(e),t.dims=Di(e));var r=i.first+i.size,o=Math.max(t.visible.from-e.options.viewportMargin,i.first),l=Math.min(r,t.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(i.first,n.viewFrom)),n.viewTo>l&&n.viewTo-l<20&&(l=Math.min(r,n.viewTo)),Me&&(o=Qe(e.doc,o),l=et(e.doc,l));var a=o!=n.viewFrom||l!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Wr(e,o,l),n.viewOffset=it(ce(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=$r(e);if(!a&&0==s&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=Rr(e);return s>4&&(n.lineDiv.style.display="none"),Ur(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Br(c),T(n.cursorDiv),T(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Pr(e,400)),n.updateLineNumbers=null,!0}function jr(e,t){for(var n=t.viewport,i=!0;;i=!1){if((!i||!e.options.lineWrapping||t.oldDisplayWidth==Yn(e))&&(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Un(e.display)-qn(e),n.top)}),t.visible=Yi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo))break;if(!Vr(e,t))break;Ki(e);var r=dr(e);Pi(e),pr(e,r),Xr(e,r),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Gr(e,t){var n=new Er(e,t);if(Vr(e,n)){Ki(e),jr(e,n);var i=dr(e);Pi(e),pr(e,i),Xr(e,i),n.finish()}}function Ur(e,t,n){var i=e.display,r=e.options.lineNumbers,o=i.lineDiv,l=o.firstChild;function a(t){var n=t.nextSibling;return s&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var c=i.view,u=i.viewFrom,d=0;d<c.length;d++){var f=c[d];if(f.hidden);else if(f.node&&f.node.parentNode==o){while(l!=f.node)l=a(l);var h=r&&null!=t&&t<=u&&f.lineNumber;f.changes&&(z(f.changes,"gutter")>-1&&(h=!1),Dn(e,f,u,n)),h&&(T(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(me(e.options,u)))),l=f.node.nextSibling}else{var p=En(e,f,u,n);o.insertBefore(p,l)}u+=f.size}while(l)l=a(l)}function Kr(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function Xr(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Xn(e)+"px"}function Yr(e){var t=e.display.gutters,n=e.options.gutters;T(t);for(var i=0;i<n.length;++i){var r=n[i],o=t.appendChild(O("div",null,"CodeMirror-gutter "+r));"CodeMirror-linenumbers"==r&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=i?"":"none",Kr(e)}function qr(e){var t=z(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))}Er.prototype.signal=function(e,t){yt(e,t)&&this.events.push(arguments)},Er.prototype.finish=function(){for(var e=this,t=0;t<this.events.length;t++)gt.apply(null,e.events[t])};var Zr=0,Jr=null;function Qr(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function eo(e){var t=Qr(e);return t.x*=Jr,t.y*=Jr,t}function to(e,t){var i=Qr(t),r=i.x,o=i.y,l=e.display,a=l.scroller,c=a.scrollWidth>a.clientWidth,u=a.scrollHeight>a.clientHeight;if(r&&c||o&&u){if(o&&y&&s)e:for(var f=t.target,h=l.view;f!=a;f=f.parentNode)for(var p=0;p<h.length;p++)if(h[p].node==f){e.display.currentWheelTarget=f;break e}if(r&&!n&&!d&&null!=Jr)return o&&u&&sr(e,Math.max(0,a.scrollTop+o*Jr)),ur(e,Math.max(0,a.scrollLeft+r*Jr)),(!o||o&&u)&&wt(t),void(l.wheelStartX=null);if(o&&null!=Jr){var g=o*Jr,m=e.doc.scrollTop,v=m+l.wrapper.clientHeight;g<0?m=Math.max(0,m+g-50):v=Math.min(e.doc.height,v+g+50),Gr(e,{top:m,bottom:v})}Zr<20&&(null==l.wheelStartX?(l.wheelStartX=a.scrollLeft,l.wheelStartY=a.scrollTop,l.wheelDX=r,l.wheelDY=o,setTimeout(function(){if(null!=l.wheelStartX){var e=a.scrollLeft-l.wheelStartX,t=a.scrollTop-l.wheelStartY,n=t&&l.wheelDY&&t/l.wheelDY||e&&l.wheelDX&&e/l.wheelDX;l.wheelStartX=l.wheelStartY=null,n&&(Jr=(Jr*Zr+n)/(Zr+1),++Zr)}},200)):(l.wheelDX+=r,l.wheelDY+=o))}}l?Jr=-.53:n?Jr=15:u?Jr=-.7:f&&(Jr=-1/3);var no=function(e,t){this.ranges=e,this.primIndex=t};no.prototype.primary=function(){return this.ranges[this.primIndex]},no.prototype.equals=function(e){var t=this;if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var n=0;n<this.ranges.length;n++){var i=t.ranges[n],r=e.ranges[n];if(!be(i.anchor,r.anchor)||!be(i.head,r.head))return!1}return!0},no.prototype.deepCopy=function(){for(var e=this,t=[],n=0;n<this.ranges.length;n++)t[n]=new io(we(e.ranges[n].anchor),we(e.ranges[n].head));return new no(t,this.primIndex)},no.prototype.somethingSelected=function(){for(var e=this,t=0;t<this.ranges.length;t++)if(!e.ranges[t].empty())return!0;return!1},no.prototype.contains=function(e,t){var n=this;t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=n.ranges[i];if(ye(t,r.from())>=0&&ye(e,r.to())<=0)return i}return-1};var io=function(e,t){this.anchor=e,this.head=t};function ro(e,t,n){var i=e&&e.options.selectionsMayTouch,r=t[n];t.sort(function(e,t){return ye(e.from(),t.from())}),n=z(t,r);for(var o=1;o<t.length;o++){var l=t[o],a=t[o-1],s=ye(a.to(),l.from());if(i&&!l.empty()?s>0:s>=0){var c=Ce(a.from(),l.from()),u=xe(a.to(),l.to()),d=a.empty()?l.from()==l.head:a.from()==a.head;o<=n&&--n,t.splice(--o,2,new io(d?u:c,d?c:u))}}return new no(t,n)}function oo(e,t){return new no([new io(e,t||e)],0)}function lo(e){return e.text?ve(e.from.line+e.text.length-1,Y(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function ao(e,t){if(ye(e,t.from)<0)return e;if(ye(e,t.to)<=0)return lo(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=lo(t).ch-t.to.ch),ve(n,i)}function so(e,t){for(var n=[],i=0;i<e.sel.ranges.length;i++){var r=e.sel.ranges[i];n.push(new io(ao(r.anchor,t),ao(r.head,t)))}return ro(e.cm,n,e.sel.primIndex)}function co(e,t,n){return e.line==t.line?ve(n.line,e.ch-t.ch+n.ch):ve(n.line+(e.line-t.line),e.ch)}function uo(e,t,n){for(var i=[],r=ve(e.first,0),o=r,l=0;l<t.length;l++){var a=t[l],s=co(a.from,r,o),c=co(lo(a),r,o);if(r=a.to,o=c,"around"==n){var u=e.sel.ranges[l],d=ye(u.head,u.anchor)<0;i[l]=new io(d?c:s,d?s:c)}else i[l]=new io(s,s)}return new no(i,e.sel.primIndex)}function fo(e){e.doc.mode=Rt(e.options,e.doc.modeOption),ho(e)}function ho(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Pr(e,100),e.state.modeGen++,e.curOp&&Dr(e)}function po(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Y(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function go(e,t,n,i){function r(e){return n?n[e]:null}function o(e,n,r){un(e,n,r,i),On(e,"change",e,t)}function l(e,t){for(var n=[],o=e;o<t;++o)n.push(new cn(c[o],r(o),i));return n}var a=t.from,s=t.to,c=t.text,u=ce(e,a.line),d=ce(e,s.line),f=Y(c),h=r(c.length-1),p=s.line-a.line;if(t.full)e.insert(0,l(0,c.length)),e.remove(c.length,e.size-c.length);else if(po(e,t)){var g=l(0,c.length-1);o(d,d.text,h),p&&e.remove(a.line,p),g.length&&e.insert(a.line,g)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,a.ch)+f+u.text.slice(s.ch),h);else{var m=l(1,c.length-1);m.push(new cn(f+u.text.slice(s.ch),h,i)),o(u,u.text.slice(0,a.ch)+c[0],r(0)),e.insert(a.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,a.ch)+c[0]+d.text.slice(s.ch),r(0)),e.remove(a.line+1,p);else{o(u,u.text.slice(0,a.ch)+c[0],r(0)),o(d,f+d.text.slice(s.ch),h);var v=l(1,c.length-1);p>1&&e.remove(a.line+1,p-1),e.insert(a.line+1,v)}On(e,"change",e,t)}function mo(e,t,n){function i(e,r,o){if(e.linked)for(var l=0;l<e.linked.length;++l){var a=e.linked[l];if(a.doc!=r){var s=o&&a.sharedHist;n&&!s||(t(a.doc,s),i(a.doc,e,s))}}}i(e,null,!0)}function vo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Hi(e),fo(e),yo(e),e.options.lineWrapping||ot(e),e.options.mode=t.modeOption,Dr(e)}function yo(e){("rtl"==e.doc.direction?A:L)(e.display.lineDiv,"CodeMirror-rtl")}function bo(e){Tr(e,function(){yo(e),Dr(e)})}function wo(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function xo(e,t){var n={from:we(t.from),to:lo(t),text:ue(e,t.from,t.to)};return Mo(e,n,t.from.line,t.to.line+1),mo(e,function(e){return Mo(e,n,t.from.line,t.to.line+1)},!0),n}function Co(e){while(e.length){var t=Y(e);if(!t.ranges)break;e.pop()}}function ko(e,t){return t?(Co(e.done),Y(e.done)):e.done.length&&!Y(e.done).ranges?Y(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Y(e.done)):void 0}function _o(e,t,n,i){var r=e.history;r.undone.length=0;var o,l,a=+new Date;if((r.lastOp==i||r.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&r.lastModTime>a-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=ko(r,r.lastOp==i)))l=Y(o.changes),0==ye(t.from,t.to)&&0==ye(t.from,l.to)?l.to=lo(t):o.changes.push(xo(e,t));else{var s=Y(r.done);s&&s.ranges||To(e.sel,r.done),o={changes:[xo(e,t)],generation:r.generation},r.done.push(o);while(r.done.length>r.undoDepth)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=t.origin,l||gt(e,"historyAdded")}function So(e,t,n,i){var r=t.charAt(0);return"*"==r||"+"==r&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Lo(e,t,n,i){var r=e.history,o=i&&i.origin;n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||So(e,o,Y(r.done),t))?r.done[r.done.length-1]=t:To(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=o,r.lastSelOp=n,i&&!1!==i.clearRedo&&Co(r.undone)}function To(e,t){var n=Y(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Mo(e,t,n,i){var r=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,i),function(n){n.markedSpans&&((r||(r=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function Oo(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function No(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var i=[],r=0;r<t.text.length;++r)i.push(Oo(n[r]));return i}function Do(e,t){var n=No(e,t),i=Pe(e,t);if(!n)return i;if(!i)return n;for(var r=0;r<n.length;++r){var o=n[r],l=i[r];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&&(n[r]=l)}return n}function Fo(e,t,n){for(var i=[],r=0;r<e.length;++r){var o=e[r];if(o.ranges)i.push(n?no.prototype.deepCopy.call(o):o);else{var l=o.changes,a=[];i.push({changes:a});for(var s=0;s<l.length;++s){var c=l[s],u=void 0;if(a.push({from:c.from,to:c.to,text:c.text}),t)for(var d in c)(u=d.match(/^spans_(\d+)$/))&&z(t,Number(u[1]))>-1&&(Y(a)[d]=c[d],delete c[d])}}}return i}function Ao(e,t,n,i){if(i){var r=e.anchor;if(n){var o=ye(t,r)<0;o!=ye(n,r)<0?(r=t,t=n):o!=ye(t,n)<0&&(t=n)}return new io(r,t)}return new io(n||t,t)}function Ho(e,t,n,i,r){null==r&&(r=e.cm&&(e.cm.display.shift||e.extend)),zo(e,new no([Ao(e.sel.primary(),t,n,r)],0),i)}function Wo(e,t,n){for(var i=[],r=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)i[o]=Ao(e.sel.ranges[o],t[o],null,r);var l=ro(e.cm,i,e.sel.primIndex);zo(e,l,n)}function $o(e,t,n,i){var r=e.sel.ranges.slice(0);r[t]=n,zo(e,ro(e.cm,r,e.sel.primIndex),i)}function Po(e,t,n,i){zo(e,oo(t,n),i)}function Io(e,t,n){var i={ranges:t.ranges,update:function(t){var n=this;this.ranges=[];for(var i=0;i<t.length;i++)n.ranges[i]=new io(_e(e,t[i].anchor),_e(e,t[i].head))},origin:n&&n.origin};return gt(e,"beforeSelectionChange",e,i),e.cm&&gt(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?ro(e.cm,i.ranges,i.ranges.length-1):t}function Eo(e,t,n){var i=e.history.done,r=Y(i);r&&r.ranges?(i[i.length-1]=t,Ro(e,t,n)):zo(e,t,n)}function zo(e,t,n){Ro(e,t,n),Lo(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Ro(e,t,n){(yt(e,"beforeSelectionChange")||e.cm&&yt(e.cm,"beforeSelectionChange"))&&(t=Io(e,t,n));var i=n&&n.bias||(ye(t.primary().head,e.sel.primary().head)<0?-1:1);Bo(e,jo(e,t,i,!0)),n&&!1===n.scroll||!e.cm||ir(e.cm)}function Bo(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,vt(e.cm)),On(e,"cursorActivity",e))}function Vo(e){Bo(e,jo(e,e.sel,null,!1))}function jo(e,t,n,i){for(var r,o=0;o<t.ranges.length;o++){var l=t.ranges[o],a=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=Uo(e,l.anchor,a&&a.anchor,n,i),c=Uo(e,l.head,a&&a.head,n,i);(r||s!=l.anchor||c!=l.head)&&(r||(r=t.ranges.slice(0,o)),r[o]=new io(s,c))}return r?ro(e.cm,r,t.primIndex):t}function Go(e,t,n,i,r){var o=ce(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var a=o.markedSpans[l],s=a.marker;if((null==a.from||(s.inclusiveLeft?a.from<=t.ch:a.from<t.ch))&&(null==a.to||(s.inclusiveRight?a.to>=t.ch:a.to>t.ch))){if(r&&(gt(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!s.atomic)continue;if(n){var c=s.find(i<0?1:-1),u=void 0;if((i<0?s.inclusiveRight:s.inclusiveLeft)&&(c=Ko(e,c,-i,c&&c.line==t.line?o:null)),c&&c.line==t.line&&(u=ye(c,n))&&(i<0?u<0:u>0))return Go(e,c,t,i,r)}var d=s.find(i<0?-1:1);return(i<0?s.inclusiveLeft:s.inclusiveRight)&&(d=Ko(e,d,i,d.line==t.line?o:null)),d?Go(e,d,t,i,r):null}}return t}function Uo(e,t,n,i,r){var o=i||1,l=Go(e,t,n,o,r)||!r&&Go(e,t,n,o,!0)||Go(e,t,n,-o,r)||!r&&Go(e,t,n,-o,!0);return l||(e.cantEdit=!0,ve(e.first,0))}function Ko(e,t,n,i){return n<0&&0==t.ch?t.line>e.first?_e(e,ve(t.line-1)):null:n>0&&t.ch==(i||ce(e,t.line)).text.length?t.line<e.first+e.size-1?ve(t.line+1,0):null:new ve(t.line,t.ch+n)}function Xo(e){e.setSelection(ve(e.firstLine(),0),ve(e.lastLine()),V)}function Yo(e,t,n){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return n&&(i.update=function(t,n,r,o){t&&(i.from=_e(e,t)),n&&(i.to=_e(e,n)),r&&(i.text=r),void 0!==o&&(i.origin=o)}),gt(e,"beforeChange",e,i),e.cm&&gt(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function qo(e,t,n){if(e.cm){if(!e.cm.curOp)return Mr(e.cm,qo)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(yt(e,"beforeChange")||e.cm&&yt(e.cm,"beforeChange"))||(t=Yo(e,t,!0),t)){var i=Te&&!n&&Ee(e,t.from,t.to);if(i)for(var r=i.length-1;r>=0;--r)Zo(e,{from:i[r].from,to:i[r].to,text:r?[""]:t.text,origin:t.origin});else Zo(e,t)}}function Zo(e,t){if(1!=t.text.length||""!=t.text[0]||0!=ye(t.from,t.to)){var n=so(e,t);_o(e,t,n,e.cm?e.cm.curOp.id:NaN),el(e,t,n,Pe(e,t));var i=[];mo(e,function(e,n){n||-1!=z(i,e.history)||(ol(e.history,t),i.push(e.history)),el(e,t,null,Pe(e,t))})}}function Jo(e,t,n){var i=e.cm&&e.cm.state.suppressEdits;if(!i||n){for(var r,o=e.history,l=e.sel,a="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,c=0;c<a.length;c++)if(r=a[c],n?r.ranges&&!r.equals(e.sel):!r.ranges)break;if(c!=a.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(r=a.pop(),!r.ranges){if(i)return void a.push(r);break}if(To(r,s),n&&!r.equals(e.sel))return void zo(e,r,{clearRedo:!1});l=r}var u=[];To(l,s),s.push({changes:u,generation:o.generation}),o.generation=r.generation||++o.maxGeneration;for(var d=yt(e,"beforeChange")||e.cm&&yt(e.cm,"beforeChange"),f=function(n){var i=r.changes[n];if(i.origin=t,d&&!Yo(e,i,!1))return a.length=0,{};u.push(xo(e,i));var o=n?so(e,i):Y(a);el(e,i,o,Do(e,i)),!n&&e.cm&&e.cm.scrollIntoView({from:i.from,to:lo(i)});var l=[];mo(e,function(e,t){t||-1!=z(l,e.history)||(ol(e.history,i),l.push(e.history)),el(e,i,null,Do(e,i))})},h=r.changes.length-1;h>=0;--h){var p=f(h);if(p)return p.v}}}}function Qo(e,t){if(0!=t&&(e.first+=t,e.sel=new no(q(e.sel.ranges,function(e){return new io(ve(e.anchor.line+t,e.anchor.ch),ve(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Dr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;i<n.viewTo;i++)Fr(e.cm,i,"gutter")}}function el(e,t,n,i){if(e.cm&&!e.cm.curOp)return Mr(e.cm,el)(e,t,n,i);if(t.to.line<e.first)Qo(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var r=t.text.length-1-(e.first-t.from.line);Qo(e,r),t={from:ve(e.first,0),to:ve(t.to.line+r,t.to.ch),text:[Y(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:ve(o,ce(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ue(e,t.from,t.to),n||(n=so(e,t)),e.cm?tl(e.cm,t,i):go(e,t,i),Ro(e,n,V)}}function tl(e,t,n){var i=e.doc,r=e.display,o=t.from,l=t.to,a=!1,s=o.line;e.options.lineWrapping||(s=he(qe(ce(i,o.line))),i.iter(s,l.line+1,function(e){if(e==r.maxLine)return a=!0,!0})),i.sel.contains(t.from,t.to)>-1&&vt(e),go(i,t,n,Ai(e)),e.options.lineWrapping||(i.iter(s,o.line+t.text.length,function(e){var t=rt(e);t>r.maxLineLength&&(r.maxLine=e,r.maxLineLength=t,r.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),sn(i,o.line),Pr(e,400);var c=t.text.length-(l.line-o.line)-1;t.full?Dr(e):o.line!=l.line||1!=t.text.length||po(e.doc,t)?Dr(e,o.line,l.line+1,c):Fr(e,o.line,"text");var u=yt(e,"changes"),d=yt(e,"change");if(d||u){var f={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};d&&On(e,"change",e,f),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}function nl(e,t,n,i,r){var o;i||(i=n),ye(i,n)<0&&(o=[i,n],n=o[0],i=o[1]),"string"==typeof t&&(t=e.splitLines(t)),qo(e,{from:n,to:i,text:t,origin:r})}function il(e,t,n,i){n<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function rl(e,t,n,i){for(var r=0;r<e.length;++r){var o=e[r],l=!0;if(o.ranges){o.copied||(o=e[r]=o.deepCopy(),o.copied=!0);for(var a=0;a<o.ranges.length;a++)il(o.ranges[a].anchor,t,n,i),il(o.ranges[a].head,t,n,i)}else{for(var s=0;s<o.changes.length;++s){var c=o.changes[s];if(n<c.from.line)c.from=ve(c.from.line+i,c.from.ch),c.to=ve(c.to.line+i,c.to.ch);else if(t<=c.to.line){l=!1;break}}l||(e.splice(0,r+1),r=0)}}}function ol(e,t){var n=t.from.line,i=t.to.line,r=t.text.length-(i-n)-1;rl(e.done,n,i,r),rl(e.undone,n,i,r)}function ll(e,t,n,i){var r=t,o=t;return"number"==typeof t?o=ce(e,ke(e,t)):r=he(t),null==r?null:(i(o,r)&&e.cm&&Fr(e.cm,r,n),o)}function al(e){var t=this;this.lines=e,this.parent=null;for(var n=0,i=0;i<e.length;++i)e[i].parent=t,n+=e[i].height;this.height=n}function sl(e){var t=this;this.children=e;for(var n=0,i=0,r=0;r<e.length;++r){var o=e[r];n+=o.chunkSize(),i+=o.height,o.parent=t}this.size=n,this.height=i,this.parent=null}io.prototype.from=function(){return Ce(this.anchor,this.head)},io.prototype.to=function(){return xe(this.anchor,this.head)},io.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},al.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=this,i=e,r=e+t;i<r;++i){var o=n.lines[i];n.height-=o.height,dn(o),On(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){var i=this;this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=i},iterN:function(e,t,n){for(var i=this,r=e+t;e<r;++e)if(n(i.lines[e]))return!0}},sl.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){var n=this;this.size-=t;for(var i=0;i<this.children.length;++i){var r=n.children[i],o=r.chunkSize();if(e<o){var l=Math.min(t,o-e),a=r.height;if(r.removeInner(e,l),n.height-=a-r.height,o==l&&(n.children.splice(i--,1),r.parent=null),0==(t-=l))break;e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof al))){var s=[];this.collapse(s),this.children=[new al(s)],this.children[0].parent=this}},collapse:function(e){for(var t=this,n=0;n<this.children.length;++n)t.children[n].collapse(e)},insertInner:function(e,t,n){var i=this;this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var o=i.children[r],l=o.chunkSize();if(e<=l){if(o.insertInner(e,t,n),o.lines&&o.lines.length>50){for(var a=o.lines.length%25+25,s=a;s<o.lines.length;){var c=new al(o.lines.slice(s,s+=25));o.height-=c.height,i.children.splice(++r,0,c),c.parent=i}o.lines=o.lines.slice(0,a),i.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),n=new sl(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=z(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new sl(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var i=this,r=0;r<this.children.length;++r){var o=i.children[r],l=o.chunkSize();if(e<l){var a=Math.min(t,l-e);if(o.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=l}}};var cl=function(e,t,n){var i=this;if(n)for(var r in n)n.hasOwnProperty(r)&&(i[r]=n[r]);this.doc=e,this.node=t};function ul(e,t,n){it(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&nr(e,n)}function dl(e,t,n,i){var r=new cl(e,n,i),o=e.cm;return o&&r.noHScroll&&(o.display.alignWidgets=!0),ll(e,t,"widget",function(t){var n=t.widgets||(t.widgets=[]);if(null==r.insertAt?n.push(r):n.splice(Math.min(n.length-1,Math.max(0,r.insertAt)),0,r),r.line=t,o&&!tt(e,t)){var i=it(t)<e.scrollTop;fe(t,t.height+Vn(r)),i&&nr(o,r.height),o.curOp.forceUpdate=!0}return!0}),o&&On(o,"lineWidgetAdded",o,r,"number"==typeof t?t:he(t)),r}cl.prototype.clear=function(){var e=this,t=this.doc.cm,n=this.line.widgets,i=this.line,r=he(i);if(null!=r&&n){for(var o=0;o<n.length;++o)n[o]==e&&n.splice(o--,1);n.length||(i.widgets=null);var l=Vn(this);fe(i,Math.max(0,i.height-l)),t&&(Tr(t,function(){ul(t,i,-l),Fr(t,r,"widget")}),On(t,"lineWidgetCleared",t,this,r))}},cl.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,i=this.line;this.height=null;var r=Vn(this)-t;r&&(tt(this.doc,i)||fe(i,i.height+r),n&&Tr(n,function(){n.curOp.forceUpdate=!0,ul(n,i,r),On(n,"lineWidgetChanged",n,e,he(i))}))},bt(cl);var fl=0,hl=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++fl};function pl(e,t,n,i,r){if(i&&i.shared)return ml(e,t,n,i,r);if(e.cm&&!e.cm.curOp)return Mr(e.cm,pl)(e,t,n,i,r);var o=new hl(e,r),l=ye(t,n);if(i&&P(i,o,!1),l>0||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Ye(e,t.line,t,n,o)||t.line!=n.line&&Ye(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ne()}o.addToHistory&&_o(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var a,s=t.line,c=e.cm;if(e.iter(s,n.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&qe(e)==c.display.maxLine&&(a=!0),o.collapsed&&s!=t.line&&fe(e,0),He(e,new De(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s}),o.collapsed&&e.iter(t.line,n.line+1,function(t){tt(e,t)&&fe(t,0)}),o.clearOnEnter&&ft(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Oe(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++fl,o.atomic=!0),c){if(a&&(c.curOp.updateMaxLine=!0),o.collapsed)Dr(c,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=t.line;u<=n.line;u++)Fr(c,u,"text");o.atomic&&Vo(c.doc),On(c,"markerAdded",c,o)}return o}hl.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,n=t&&!t.curOp;if(n&&br(t),yt(this,"clear")){var i=this.find();i&&On(this,"clear",i.from,i.to)}for(var r=null,o=null,l=0;l<this.lines.length;++l){var a=e.lines[l],s=Fe(a.markedSpans,e);t&&!e.collapsed?Fr(t,he(a),"text"):t&&(null!=s.to&&(o=he(a)),null!=s.from&&(r=he(a))),a.markedSpans=Ae(a.markedSpans,s),null==s.from&&e.collapsed&&!tt(e.doc,a)&&t&&fe(a,Oi(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var c=0;c<this.lines.length;++c){var u=qe(e.lines[c]),d=rt(u);d>t.display.maxLineLength&&(t.display.maxLine=u,t.display.maxLineLength=d,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&Dr(t,r,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Vo(t.doc)),t&&On(t,"markerCleared",t,this,r,o),n&&wr(t),this.parent&&this.parent.clear()}},hl.prototype.find=function(e,t){var n,i,r=this;null==e&&"bookmark"==this.type&&(e=1);for(var o=0;o<this.lines.length;++o){var l=r.lines[o],a=Fe(l.markedSpans,r);if(null!=a.from&&(n=ve(t?l:he(l),a.from),-1==e))return n;if(null!=a.to&&(i=ve(t?l:he(l),a.to),1==e))return i}return n&&{from:n,to:i}},hl.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,i=this.doc.cm;t&&i&&Tr(i,function(){var r=t.line,o=he(t.line),l=ti(i,o);if(l&&(ui(l),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!tt(n.doc,r)&&null!=n.height){var a=n.height;n.height=null;var s=Vn(n)-a;s&&fe(r,r.height+s)}On(i,"markerChanged",i,e)})},hl.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=z(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},hl.prototype.detachLine=function(e){if(this.lines.splice(z(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},bt(hl);var gl=function(e,t){var n=this;this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=n};function ml(e,t,n,i,r){i=P(i),i.shared=!1;var o=[pl(e,t,n,i,r)],l=o[0],a=i.widgetNode;return mo(e,function(e){a&&(i.widgetNode=a.cloneNode(!0)),o.push(pl(e,_e(e,t),_e(e,n),i,r));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;l=Y(o)}),new gl(o,l)}function vl(e){return e.findMarks(ve(e.first,0),e.clipPos(ve(e.lastLine())),function(e){return e.parent})}function yl(e,t){for(var n=0;n<t.length;n++){var i=t[n],r=i.find(),o=e.clipPos(r.from),l=e.clipPos(r.to);if(ye(o,l)){var a=pl(e,o,l,i.primary,i.primary.type);i.markers.push(a),a.parent=i}}}function bl(e){for(var t=function(t){var n=e[t],i=[n.primary.doc];mo(n.primary.doc,function(e){return i.push(e)});for(var r=0;r<n.markers.length;r++){var o=n.markers[r];-1==z(i,o.doc)&&(o.parent=null,n.markers.splice(r--,1))}},n=0;n<e.length;n++)t(n)}gl.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)e.markers[t].clear();On(this,"clear")}},gl.prototype.find=function(e,t){return this.primary.find(e,t)},bt(gl);var wl=0,xl=function(e,t,n,i,r){if(!(this instanceof xl))return new xl(e,t,n,i,r);null==n&&(n=0),sl.call(this,[new al([new cn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=ve(n,0);this.sel=oo(o),this.history=new wo(null),this.id=++wl,this.modeOption=t,this.lineSep=i,this.direction="rtl"==r?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),go(this,{from:o,to:o,text:e}),zo(this,oo(o),V)};xl.prototype=Q(sl.prototype,{constructor:xl,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,i=0;i<t.length;++i)n+=t[i].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=de(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Nr(function(e){var t=ve(this.first,0),n=this.first+this.size-1;qo(this,{from:t,to:ve(n,ce(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&rr(this.cm,0,0),zo(this,oo(t),V)}),replaceRange:function(e,t,n,i){t=_e(this,t),n=n?_e(this,n):t,nl(this,e,t,n,i)},getRange:function(e,t,n){var i=ue(this,_e(this,e),_e(this,t));return!1===n?i:i.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(ge(this,e))return ce(this,e)},getLineNumber:function(e){return he(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=ce(this,e)),qe(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return _e(this,e)},getCursor:function(e){var t,n=this.sel.primary();return t=null==e||"head"==e?n.head:"anchor"==e?n.anchor:"end"==e||"to"==e||!1===e?n.to():n.from(),t},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Nr(function(e,t,n){Po(this,_e(this,"number"==typeof e?ve(e,t||0):e),null,n)}),setSelection:Nr(function(e,t,n){Po(this,_e(this,e),_e(this,t||e),n)}),extendSelection:Nr(function(e,t,n){Ho(this,_e(this,e),t&&_e(this,t),n)}),extendSelections:Nr(function(e,t){Wo(this,Le(this,e),t)}),extendSelectionsBy:Nr(function(e,t){var n=q(this.sel.ranges,e);Wo(this,Le(this,n),t)}),setSelections:Nr(function(e,t,n){var i=this;if(e.length){for(var r=[],o=0;o<e.length;o++)r[o]=new io(_e(i,e[o].anchor),_e(i,e[o].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),zo(this,ro(this.cm,r,t),n)}}),addSelection:Nr(function(e,t,n){var i=this.sel.ranges.slice(0);i.push(new io(_e(this,e),_e(this,t||e))),zo(this,ro(this.cm,i,i.length-1),n)}),getSelection:function(e){for(var t,n=this,i=this.sel.ranges,r=0;r<i.length;r++){var o=ue(n,i[r].from(),i[r].to());t=t?t.concat(o):o}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=this,n=[],i=this.sel.ranges,r=0;r<i.length;r++){var o=ue(t,i[r].from(),i[r].to());!1!==e&&(o=o.join(e||t.lineSeparator())),n[r]=o}return n},replaceSelection:function(e,t,n){for(var i=[],r=0;r<this.sel.ranges.length;r++)i[r]=e;this.replaceSelections(i,t,n||"+input")},replaceSelections:Nr(function(e,t,n){for(var i=this,r=[],o=this.sel,l=0;l<o.ranges.length;l++){var a=o.ranges[l];r[l]={from:a.from(),to:a.to(),text:i.splitLines(e[l]),origin:n}}for(var s=t&&"end"!=t&&uo(this,r,t),c=r.length-1;c>=0;c--)qo(i,r[c]);s?Eo(this,s):this.cm&&ir(this.cm)}),undo:Nr(function(){Jo(this,"undo")}),redo:Nr(function(){Jo(this,"redo")}),undoSelection:Nr(function(){Jo(this,"undo",!0)}),redoSelection:Nr(function(){Jo(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var r=0;r<e.undone.length;r++)e.undone[r].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){this.history=new wo(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Fo(this.history.done),undone:Fo(this.history.undone)}},setHistory:function(e){var t=this.history=new wo(this.history.maxGeneration);t.done=Fo(e.done.slice(0),null,!0),t.undone=Fo(e.undone.slice(0),null,!0)},setGutterMarker:Nr(function(e,t,n){return ll(this,e,"gutter",function(e){var i=e.gutterMarkers||(e.gutterMarkers={});return i[t]=n,!n&&ie(i)&&(e.gutterMarkers=null),!0})}),clearGutter:Nr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&ll(t,n,"gutter",function(){return n.gutterMarkers[e]=null,ie(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!ge(this,e))return null;if(t=e,e=ce(this,e),!e)return null}else if(t=he(e),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}},addLineClass:Nr(function(e,t,n){return ll(this,e,"gutter"==t?"gutter":"class",function(e){var i="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[i]){if(_(n).test(e[i]))return!1;e[i]+=" "+n}else e[i]=n;return!0})}),removeLineClass:Nr(function(e,t,n){return ll(this,e,"gutter"==t?"gutter":"class",function(e){var i="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",r=e[i];if(!r)return!1;if(null==n)e[i]=null;else{var o=r.match(_(n));if(!o)return!1;var l=o.index+o[0].length;e[i]=r.slice(0,o.index)+(o.index&&l!=r.length?" ":"")+r.slice(l)||null}return!0})}),addLineWidget:Nr(function(e,t,n){return dl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return pl(this,_e(this,e),_e(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=_e(this,e),pl(this,e,e,n,"bookmark")},findMarksAt:function(e){e=_e(this,e);var t=[],n=ce(this,e.line).markedSpans;if(n)for(var i=0;i<n.length;++i){var r=n[i];(null==r.from||r.from<=e.ch)&&(null==r.to||r.to>=e.ch)&&t.push(r.marker.parent||r.marker)}return t},findMarks:function(e,t,n){e=_e(this,e),t=_e(this,t);var i=[],r=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var a=0;a<l.length;a++){var s=l[a];null!=s.to&&r==e.line&&e.ch>=s.to||null==s.from&&r!=e.line||null!=s.from&&r==t.line&&s.from>=t.ch||n&&!n(s.marker)||i.push(s.marker.parent||s.marker)}++r}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var i=0;i<n.length;++i)null!=n[i].from&&e.push(n[i].marker)}),e},posFromIndex:function(e){var t,n=this.first,i=this.lineSeparator().length;return this.iter(function(r){var o=r.text.length+i;if(o>e)return t=e,!0;e-=o,++n}),_e(this,ve(n,t))},indexFromPos:function(e){e=_e(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+n}),t},copy:function(e){var t=new xl(de(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);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,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);var i=new xl(de(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],yl(i,vl(this)),i},unlinkDoc:function(e){var t=this;if(e instanceof $a&&(e=e.doc),this.linked)for(var n=0;n<this.linked.length;++n){var i=t.linked[n];if(i.doc==e){t.linked.splice(n,1),e.unlinkDoc(t),bl(vl(t));break}}if(e.history==this.history){var r=[e.id];mo(e,function(e){return r.push(e.id)},!0),e.history=new wo(null),e.history.done=Fo(this.history.done,r),e.history.undone=Fo(this.history.undone,r)}},iterLinkedDocs:function(e){mo(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Dt(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Nr(function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&bo(this.cm))})}),xl.prototype.eachLine=xl.prototype.iter;var Cl=0;function kl(e){var t=this;if(Ll(t),!mt(t,e)&&!jn(t.display,e)){wt(e),l&&(Cl=+new Date);var n=Wi(t,e,!0),i=e.dataTransfer.files;if(n&&!t.isReadOnly())if(i&&i.length&&window.FileReader&&window.File)for(var r=i.length,o=Array(r),a=0,s=function(e,i){if(!t.options.allowDropFileTypes||-1!=z(t.options.allowDropFileTypes,e.type)){var l=new FileReader;l.onload=Mr(t,function(){var e=l.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[i]=e,++a==r){n=_e(t.doc,n);var s={from:n,to:n,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};qo(t.doc,s),Eo(t.doc,oo(n,lo(s)))}}),l.readAsText(e)}},c=0;c<r;++c)s(i[c],c);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var u=e.dataTransfer.getData("Text");if(u){var d;if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),Ro(t.doc,oo(n,n)),d)for(var f=0;f<d.length;++f)nl(t.doc,"",d[f].anchor,d[f].head,"drag");t.replaceSelection(u,"around","paste"),t.display.input.focus()}}catch(e){}}}}function _l(e,t){if(l&&(!e.state.draggingText||+new Date-Cl<100))kt(t);else if(!mt(e,t)&&!jn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f)){var n=O("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),d&&n.parentNode.removeChild(n)}}function Sl(e,t){var n=Wi(e,t);if(n){var i=document.createDocumentFragment();Ei(e,n,i),e.display.dragCursor||(e.display.dragCursor=O("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),M(e.display.dragCursor,i)}}function Ll(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Tl(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],i=0;i<t.length;i++){var r=t[i].CodeMirror;r&&n.push(r)}n.length&&n[0].operation(function(){for(var t=0;t<n.length;t++)e(n[t])})}}var Ml=!1;function Ol(){Ml||(Nl(),Ml=!0)}function Nl(){var e;ft(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Tl(Dl)},100))}),ft(window,"blur",function(){return Tl(Ui)})}function Dl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Fl={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Al=0;Al<10;Al++)Fl[Al+48]=Fl[Al+96]=String(Al);for(var Hl=65;Hl<=90;Hl++)Fl[Hl]=String.fromCharCode(Hl);for(var Wl=1;Wl<=12;Wl++)Fl[Wl+111]=Fl[Wl+63235]="F"+Wl;var $l={};function Pl(e){var t,n,i,r,o=e.split(/-(?!$)/);e=o[o.length-1];for(var l=0;l<o.length-1;l++){var a=o[l];if(/^(cmd|meta|m)$/i.test(a))r=!0;else if(/^a(lt)?$/i.test(a))t=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);i=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),r&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Il(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==i){delete e[n];continue}for(var r=q(n.split(" "),Pl),o=0;o<r.length;o++){var l=void 0,a=void 0;o==r.length-1?(a=r.join(" "),l=i):(a=r.slice(0,o+1).join(" "),l="...");var s=t[a];if(s){if(s!=l)throw new Error("Inconsistent bindings for "+a)}else t[a]=l}delete e[n]}for(var c in t)e[c]=t[c];return e}function El(e,t,n,i){t=Vl(t);var r=t.call?t.call(e,i):t[e];if(!1===r)return"nothing";if("..."===r)return"multi";if(null!=r&&n(r))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return El(e,t.fallthrough,n,i);for(var o=0;o<t.fallthrough.length;o++){var l=El(e,t.fallthrough[o],n,i);if(l)return l}}}function zl(e){var t="string"==typeof e?e:Fl[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Rl(e,t,n){var i=e;return t.altKey&&"Alt"!=i&&(e="Alt-"+e),(C?t.metaKey:t.ctrlKey)&&"Ctrl"!=i&&(e="Ctrl-"+e),(C?t.ctrlKey:t.metaKey)&&"Cmd"!=i&&(e="Cmd-"+e),!n&&t.shiftKey&&"Shift"!=i&&(e="Shift-"+e),e}function Bl(e,t){if(d&&34==e.keyCode&&e["char"])return!1;var n=Fl[e.keyCode];return null!=n&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(n=e.code),Rl(n,e,t))}function Vl(e){return"string"==typeof e?$l[e]:e}function jl(e,t){for(var n=e.doc.sel.ranges,i=[],r=0;r<n.length;r++){var o=t(n[r]);while(i.length&&ye(o.from,Y(i).to)<=0){var l=i.pop();if(ye(l.from,o.from)<0){o.from=l.from;break}}i.push(o)}Tr(e,function(){for(var t=i.length-1;t>=0;t--)nl(e.doc,"",i[t].from,i[t].to,"+delete");ir(e)})}function Gl(e,t,n){var i=le(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Ul(e,t,n){var i=Gl(e,t.ch,n);return null==i?null:new ve(t.line,i,n<0?"after":"before")}function Kl(e,t,n,i,r){if(e){var o=ut(n,t.doc.direction);if(o){var l,a=r<0?Y(o):o[0],s=r<0==(1==a.level),c=s?"after":"before";if(a.level>0||"rtl"==t.doc.direction){var u=ni(t,n);l=r<0?n.text.length-1:0;var d=ii(t,u,l).top;l=ae(function(e){return ii(t,u,e).top==d},r<0==(1==a.level)?a.from:a.to-1,l),"before"==c&&(l=Gl(n,l,1))}else l=r<0?a.to:a.from;return new ve(i,l,c)}}return new ve(i,r<0?n.text.length:0,r<0?"before":"after")}function Xl(e,t,n,i){var r=ut(t,e.doc.direction);if(!r)return Ul(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=st(r,n.ch,n.sticky),l=r[o];if("ltr"==e.doc.direction&&l.level%2==0&&(i>0?l.to>n.ch:l.from<n.ch))return Ul(t,n,i);var a,s=function(e,n){return Gl(t,e instanceof ve?e.ch:e,n)},c=function(n){return e.options.lineWrapping?(a=a||ni(e,t),_i(e,t,a,n)):{begin:0,end:t.text.length}},u=c("before"==n.sticky?s(n,-1):n.ch);if("rtl"==e.doc.direction||1==l.level){var d=1==l.level==i<0,f=s(n,d?1:-1);if(null!=f&&(d?f<=l.to&&f<=u.end:f>=l.from&&f>=u.begin)){var h=d?"before":"after";return new ve(n.line,f,h)}}var p=function(e,t,i){for(var o=function(e,t){return t?new ve(n.line,s(e,1),"before"):new ve(n.line,e,"after")};e>=0&&e<r.length;e+=t){var l=r[e],a=t>0==(1!=l.level),c=a?i.begin:s(i.end,-1);if(l.from<=c&&c<l.to)return o(c,a);if(c=a?l.from:s(l.to,-1),i.begin<=c&&c<i.end)return o(c,a)}},g=p(o+i,i,u);if(g)return g;var m=i>0?u.end:s(u.begin,-1);return null==m||i>0&&m==t.text.length||(g=p(i>0?0:r.length-1,i,c(m)),!g)?null:g}$l.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"},$l.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},$l.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},$l.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},$l["default"]=y?$l.macDefault:$l.pcDefault;var Yl={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),V)},killLine:function(e){return jl(e,function(t){if(t.empty()){var n=ce(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:ve(t.head.line+1,0)}:{from:t.head,to:ve(t.head.line,n)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return jl(e,function(t){return{from:ve(t.from().line,0),to:_e(e.doc,ve(t.to().line+1,0))}})},delLineLeft:function(e){return jl(e,function(e){return{from:ve(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){return jl(e,function(t){var n=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:n},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return jl(e,function(t){var n=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:i}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(ve(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(ve(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ql(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Jl(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Zl(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},G)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},G)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:n},"div");return i.ch<e.getLine(i.line).search(/\S/)?Jl(e,t.head):i},G)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),i=e.options.tabSize,r=0;r<n.length;r++){var o=n[r].from(),l=I(e.getLine(o.line),o.ch,i);t.push(X(i-l%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Tr(e,function(){for(var t=e.listSelections(),n=[],i=0;i<t.length;i++)if(t[i].empty()){var r=t[i].head,o=ce(e.doc,r.line).text;if(o)if(r.ch==o.length&&(r=new ve(r.line,r.ch-1)),r.ch>0)r=new ve(r.line,r.ch+1),e.replaceRange(o.charAt(r.ch-1)+o.charAt(r.ch-2),ve(r.line,r.ch-2),r,"+transpose");else if(r.line>e.doc.first){var l=ce(e.doc,r.line-1).text;l&&(r=new ve(r.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),ve(r.line-1,l.length-1),r,"+transpose"))}n.push(new io(r,r))}e.setSelections(n)})},newlineAndIndent:function(e){return Tr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);ir(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ql(e,t){var n=ce(e.doc,t),i=qe(n);return i!=n&&(t=he(i)),Kl(!0,e,i,t,1)}function Zl(e,t){var n=ce(e.doc,t),i=Ze(n);return i!=n&&(t=he(i)),Kl(!0,e,n,t,-1)}function Jl(e,t){var n=ql(e,t.line),i=ce(e.doc,n.line),r=ut(i,e.doc.direction);if(!r||0==r[0].level){var o=Math.max(0,i.text.search(/\S/)),l=t.line==n.line&&t.ch<=o&&t.ch;return ve(n.line,l?0:o,n.sticky)}return n}function Ql(e,t,n){if("string"==typeof t&&(t=Yl[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),r=t(e)!=B}finally{e.display.shift=i,e.state.suppressEdits=!1}return r}function ea(e,t,n){for(var i=0;i<e.state.keyMaps.length;i++){var r=El(t,e.state.keyMaps[i],n,e);if(r)return r}return e.options.extraKeys&&El(t,e.options.extraKeys,n,e)||El(t,e.options.keyMap,n,e)}var ta=new E;function na(e,t,n,i){var r=e.state.keySeq;if(r){if(zl(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:ta.set(50,function(){e.state.keySeq==r&&(e.state.keySeq=null,e.display.input.reset())}),ia(e,r+" "+t,n,i))return!0}return ia(e,t,n,i)}function ia(e,t,n,i){var r=ea(e,t,i);return"multi"==r&&(e.state.keySeq=t),"handled"==r&&On(e,"keyHandled",e,t,n),"handled"!=r&&"multi"!=r||(wt(n),Bi(e)),!!r}function ra(e,t){var n=Bl(t,!0);return!!n&&(t.shiftKey&&!e.state.keySeq?na(e,"Shift-"+n,t,function(t){return Ql(e,t,!0)})||na(e,n,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return Ql(e,t)}):na(e,n,t,function(t){return Ql(e,t)}))}function oa(e,t,n){return na(e,"'"+n+"'",t,function(t){return Ql(e,t,!0)})}var la=null;function aa(e){var t=this;if(t.curOp.focus=F(),!mt(t,e)){l&&a<11&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var i=ra(t,e);d&&(la=i?n:null,!i&&88==n&&!At&&(y?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||sa(t)}}function sa(e){var t=e.display.lineDiv;function n(e){18!=e.keyCode&&e.altKey||(L(t,"CodeMirror-crosshair"),pt(document,"keyup",n),pt(document,"mouseover",n))}A(t,"CodeMirror-crosshair"),ft(document,"keyup",n),ft(document,"mouseover",n)}function ca(e){16==e.keyCode&&(this.doc.sel.shift=!1),mt(this,e)}function ua(e){var t=this;if(!(jn(t.display,e)||mt(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var n=e.keyCode,i=e.charCode;if(d&&n==la)return la=null,void wt(e);if(!d||e.which&&!(e.which<10)||!ra(t,e)){var r=String.fromCharCode(null==i?n:i);"\b"!=r&&(oa(t,e,r)||t.display.input.onKeyPress(e))}}}var da,fa,ha=400,pa=function(e,t,n){this.time=e,this.pos=t,this.button=n};function ga(e,t){var n=+new Date;return fa&&fa.compare(n,e,t)?(da=fa=null,"triple"):da&&da.compare(n,e,t)?(fa=new pa(n,e,t),da=null,"double"):(da=new pa(n,e,t),fa=null,"single")}function ma(e){var t=this,n=t.display;if(!(mt(t,e)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=e.shiftKey,jn(n,e))s||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));else if(!Sa(t,e)){var i=Wi(t,e),r=St(e),o=i?ga(i,r):"single";window.focus(),1==r&&t.state.selectingText&&t.state.selectingText(e),i&&va(t,r,i,o,e)||(1==r?i?ba(t,i,o,e):_t(e)==n.scroller&&wt(e):2==r?(i&&Ho(t.doc,i),setTimeout(function(){return n.input.focus()},20)):3==r&&(k?t.display.input.onContextMenu(e):ji(t)))}}function va(e,t,n,i,r){var o="Click";return"double"==i?o="Double"+o:"triple"==i&&(o="Triple"+o),o=(1==t?"Left":2==t?"Middle":"Right")+o,na(e,Rl(o,r),r,function(t){if("string"==typeof t&&(t=Yl[t]),!t)return!1;var i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i=t(e,n)!=B}finally{e.state.suppressEdits=!1}return i})}function ya(e,t,n){var i=e.getOption("configureMouse"),r=i?i(e,t,n):{};if(null==r.unit){var o=b?n.shiftKey&&n.metaKey:n.altKey;r.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==r.extend||e.doc.extend)&&(r.extend=e.doc.extend||n.shiftKey),null==r.addNew&&(r.addNew=y?n.metaKey:n.ctrlKey),null==r.moveOnDrag&&(r.moveOnDrag=!(y?n.altKey:n.ctrlKey)),r}function ba(e,t,n,i){l?setTimeout($(Vi,e),0):e.curOp.focus=F();var r,o=ya(e,n,i),a=e.doc.sel;e.options.dragDrop&&Mt&&!e.isReadOnly()&&"single"==n&&(r=a.contains(t))>-1&&(ye((r=a.ranges[r]).from(),t)<0||t.xRel>0)&&(ye(r.to(),t)>0||t.xRel<0)?wa(e,i,t,o):Ca(e,i,t,o)}function wa(e,t,n,i){var r=e.display,o=!1,c=Mr(e,function(t){s&&(r.scroller.draggable=!1),e.state.draggingText=!1,pt(r.wrapper.ownerDocument,"mouseup",c),pt(r.wrapper.ownerDocument,"mousemove",u),pt(r.scroller,"dragstart",d),pt(r.scroller,"drop",c),o||(wt(t),i.addNew||Ho(e.doc,n,null,null,i.extend),s||l&&9==a?setTimeout(function(){r.wrapper.ownerDocument.body.focus(),r.input.focus()},20):r.input.focus())}),u=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},d=function(){return o=!0};s&&(r.scroller.draggable=!0),e.state.draggingText=c,c.copy=!i.moveOnDrag,r.scroller.dragDrop&&r.scroller.dragDrop(),ft(r.wrapper.ownerDocument,"mouseup",c),ft(r.wrapper.ownerDocument,"mousemove",u),ft(r.scroller,"dragstart",d),ft(r.scroller,"drop",c),ji(e),setTimeout(function(){return r.input.focus()},20)}function xa(e,t,n){if("char"==n)return new io(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new io(ve(t.line,0),_e(e.doc,ve(t.line+1,0)));var i=n(e,t);return new io(i.from,i.to)}function Ca(e,t,n,i){var r=e.display,o=e.doc;wt(t);var l,a,s=o.sel,c=s.ranges;if(i.addNew&&!i.extend?(a=o.sel.contains(n),l=a>-1?c[a]:new io(n,n)):(l=o.sel.primary(),a=o.sel.primIndex),"rectangle"==i.unit)i.addNew||(l=new io(n,n)),n=Wi(e,t,!0,!0),a=-1;else{var u=xa(e,n,i.unit);l=i.extend?Ao(l,u.anchor,u.head,i.extend):u}i.addNew?-1==a?(a=c.length,zo(o,ro(e,c.concat([l]),a),{scroll:!1,origin:"*mouse"})):c.length>1&&c[a].empty()&&"char"==i.unit&&!i.extend?(zo(o,ro(e,c.slice(0,a).concat(c.slice(a+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):$o(o,a,l,j):(a=0,zo(o,new no([l],0),j),s=o.sel);var d=n;function f(t){if(0!=ye(d,t))if(d=t,"rectangle"==i.unit){for(var r=[],c=e.options.tabSize,u=I(ce(o,n.line).text,n.ch,c),f=I(ce(o,t.line).text,t.ch,c),h=Math.min(u,f),p=Math.max(u,f),g=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));g<=m;g++){var v=ce(o,g).text,y=U(v,h,c);h==p?r.push(new io(ve(g,y),ve(g,y))):v.length>y&&r.push(new io(ve(g,y),ve(g,U(v,p,c))))}r.length||r.push(new io(n,n)),zo(o,ro(e,s.ranges.slice(0,a).concat(r),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=l,x=xa(e,t,i.unit),C=w.anchor;ye(x.anchor,C)>0?(b=x.head,C=Ce(w.from(),x.anchor)):(b=x.anchor,C=xe(w.to(),x.head));var k=s.ranges.slice(0);k[a]=ka(e,new io(_e(o,C),b)),zo(o,ro(e,k,a),j)}}var h=r.wrapper.getBoundingClientRect(),p=0;function g(t){var n=++p,l=Wi(e,t,!0,"rectangle"==i.unit);if(l)if(0!=ye(l,d)){e.curOp.focus=F(),f(l);var a=Yi(r,o);(l.line>=a.to||l.line<a.from)&&setTimeout(Mr(e,function(){p==n&&g(t)}),150)}else{var s=t.clientY<h.top?-20:t.clientY>h.bottom?20:0;s&&setTimeout(Mr(e,function(){p==n&&(r.scroller.scrollTop+=s,g(t))}),50)}}function m(t){e.state.selectingText=!1,p=1/0,wt(t),r.input.focus(),pt(r.wrapper.ownerDocument,"mousemove",v),pt(r.wrapper.ownerDocument,"mouseup",y),o.history.lastSelOrigin=null}var v=Mr(e,function(e){0!==e.buttons&&St(e)?g(e):m(e)}),y=Mr(e,m);e.state.selectingText=y,ft(r.wrapper.ownerDocument,"mousemove",v),ft(r.wrapper.ownerDocument,"mouseup",y)}function ka(e,t){var n=t.anchor,i=t.head,r=ce(e.doc,n.line);if(0==ye(n,i)&&n.sticky==i.sticky)return t;var o=ut(r);if(!o)return t;var l=st(o,n.ch,n.sticky),a=o[l];if(a.from!=n.ch&&a.to!=n.ch)return t;var s,c=l+(a.from==n.ch==(1!=a.level)?0:1);if(0==c||c==o.length)return t;if(i.line!=n.line)s=(i.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var u=st(o,i.ch,i.sticky),d=u-l||(i.ch-n.ch)*(1==a.level?-1:1);s=u==c-1||u==c?d<0:d>0}var f=o[c+(s?-1:0)],h=s==(1==f.level),p=h?f.from:f.to,g=h?"after":"before";return n.ch==p&&n.sticky==g?t:new io(new ve(n.line,p,g),i)}function _a(e,t,n,i){var r,o;if(t.touches)r=t.touches[0].clientX,o=t.touches[0].clientY;else try{r=t.clientX,o=t.clientY}catch(t){return!1}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&wt(t);var l=e.display,a=l.lineDiv.getBoundingClientRect();if(o>a.bottom||!yt(e,n))return Ct(t);o-=a.top-l.viewOffset;for(var s=0;s<e.options.gutters.length;++s){var c=l.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=r){var u=pe(e.doc,o),d=e.options.gutters[s];return gt(e,n,e,u,d,t),Ct(t)}}}function Sa(e,t){return _a(e,t,"gutterClick",!0)}function La(e,t){jn(e.display,t)||Ta(e,t)||mt(e,t,"contextmenu")||k||e.display.input.onContextMenu(t)}function Ta(e,t){return!!yt(e,"gutterContextMenu")&&_a(e,t,"gutterContextMenu",!1)}function Ma(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),fi(e)}pa.prototype.compare=function(e,t,n){return this.time+ha>e&&0==ye(t,this.pos)&&n==this.button};var Oa={toString:function(){return"CodeMirror.Init"}},Na={},Da={};function Fa(e){var t=e.optionHandlers;function n(n,i,r,o){e.defaults[n]=i,r&&(t[n]=o?function(e,t,n){n!=Oa&&r(e,t,n)}:r)}e.defineOption=n,e.Init=Oa,n("value","",function(e,t){return e.setValue(t)},!0),n("mode",null,function(e,t){e.doc.modeOption=t,fo(e)},!0),n("indentUnit",2,fo,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(e){ho(e),fi(e),Dr(e)},!0),n("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],i=e.doc.first;e.doc.iter(function(e){for(var r=0;;){var o=e.text.indexOf(t,r);if(-1==o)break;r=o+t.length,n.push(ve(i,o))}i++});for(var r=n.length-1;r>=0;r--)nl(e.doc,t,n[r],ve(n[r].line,n[r].ch+t.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Oa&&e.refresh()}),n("specialCharPlaceholder",mn,function(e){return e.refresh()},!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),n("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),n("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",function(e){Ma(e),Aa(e)},!0),n("keyMap","default",function(e,t,n){var i=Vl(t),r=n!=Oa&&Vl(n);r&&r.detach&&r.detach(e,i),i.attach&&i.attach(e,r||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Wa,!0),n("gutters",[],function(e){qr(e.options),Aa(e)},!0),n("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Fi(e.display)+"px":"0",e.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(e){return pr(e)},!0),n("scrollbarStyle","native",function(e){vr(e),pr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),n("lineNumbers",!1,function(e){qr(e.options),Aa(e)},!0),n("firstLineNumber",1,Aa,!0),n("lineNumberFormatter",function(e){return e},Aa,!0),n("showCursorWhenSelecting",!1,Pi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(e,t){"nocursor"==t&&(Ui(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),n("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),n("dragDrop",!0,Ha),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Pi,!0),n("singleCursorHeightPerLine",!0,Pi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,ho,!0),n("addModeClass",!1,ho,!0),n("pollInterval",100),n("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),n("historyEventDelay",1250),n("viewportMargin",10,function(e){return e.refresh()},!0),n("maxHighlightLength",1e4,ho,!0),n("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),n("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),n("autofocus",null),n("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),n("phrases",null)}function Aa(e){Yr(e),Dr(e),qi(e)}function Ha(e,t,n){var i=n&&n!=Oa;if(!t!=!i){var r=e.display.dragFunctions,o=t?ft:pt;o(e.display.scroller,"dragstart",r.start),o(e.display.scroller,"dragenter",r.enter),o(e.display.scroller,"dragover",r.over),o(e.display.scroller,"dragleave",r.leave),o(e.display.scroller,"drop",r.drop)}}function Wa(e){e.options.lineWrapping?(A(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(L(e.display.wrapper,"CodeMirror-wrap"),ot(e)),Hi(e),Dr(e),fi(e),setTimeout(function(){return pr(e)},100)}function $a(e,t){var n=this;if(!(this instanceof $a))return new $a(e,t);this.options=t=t?P(t):{},P(Na,t,!1),qr(t);var i=t.value;"string"==typeof i?i=new xl(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var r=new $a.inputStyles[t.inputStyle](this),o=this.display=new se(e,i,r);for(var c in o.wrapper.CodeMirror=this,Yr(this),Ma(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),vr(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new E,keySeq:null,specialChars:null},t.autofocus&&!v&&o.input.focus(),l&&a<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Pa(this),Ol(),br(this),this.curOp.forceUpdate=!0,vo(this,i),t.autofocus&&!v||this.hasFocus()?setTimeout($(Gi,this),20):Ui(this),Da)Da.hasOwnProperty(c)&&Da[c](n,t[c],Oa);Zi(this),t.finishInit&&t.finishInit(this);for(var u=0;u<Ia.length;++u)Ia[u](n);wr(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function Pa(e){var t=e.display;ft(t.scroller,"mousedown",Mr(e,ma)),ft(t.scroller,"dblclick",l&&a<11?Mr(e,function(t){if(!mt(e,t)){var n=Wi(e,t);if(n&&!Sa(e,t)&&!jn(e.display,t)){wt(t);var i=e.findWordAt(n);Ho(e.doc,i.anchor,i.head)}}}):function(t){return mt(e,t)||wt(t)}),ft(t.scroller,"contextmenu",function(t){return La(e,t)});var n,i={end:0};function r(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function o(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function s(e,t){if(null==t.left)return!0;var n=t.left-e.left,i=t.top-e.top;return n*n+i*i>400}ft(t.scroller,"touchstart",function(r){if(!mt(e,r)&&!o(r)&&!Sa(e,r)){t.input.ensurePolled(),clearTimeout(n);var l=+new Date;t.activeTouch={start:l,moved:!1,prev:l-i.end<=300?i:null},1==r.touches.length&&(t.activeTouch.left=r.touches[0].pageX,t.activeTouch.top=r.touches[0].pageY)}}),ft(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ft(t.scroller,"touchend",function(n){var i=t.activeTouch;if(i&&!jn(t,n)&&null!=i.left&&!i.moved&&new Date-i.start<300){var o,l=e.coordsChar(t.activeTouch,"page");o=!i.prev||s(i,i.prev)?new io(l,l):!i.prev.prev||s(i,i.prev.prev)?e.findWordAt(l):new io(ve(l.line,0),_e(e.doc,ve(l.line+1,0))),e.setSelection(o.anchor,o.head),e.focus(),wt(n)}r()}),ft(t.scroller,"touchcancel",r),ft(t.scroller,"scroll",function(){t.scroller.clientHeight&&(sr(e,t.scroller.scrollTop),ur(e,t.scroller.scrollLeft,!0),gt(e,"scroll",e))}),ft(t.scroller,"mousewheel",function(t){return to(e,t)}),ft(t.scroller,"DOMMouseScroll",function(t){return to(e,t)}),ft(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(t){mt(e,t)||kt(t)},over:function(t){mt(e,t)||(Sl(e,t),kt(t))},start:function(t){return _l(e,t)},drop:Mr(e,kl),leave:function(t){mt(e,t)||Ll(e)}};var c=t.input.getField();ft(c,"keyup",function(t){return ca.call(e,t)}),ft(c,"keydown",Mr(e,aa)),ft(c,"keypress",Mr(e,ua)),ft(c,"focus",function(t){return Gi(e,t)}),ft(c,"blur",function(t){return Ui(e,t)})}$a.defaults=Na,$a.optionHandlers=Da;var Ia=[];function Ea(e,t,n,i){var r,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?r=Jt(e,t).state:n="prev");var l=e.options.tabSize,a=ce(o,t),s=I(a.text,null,l);a.stateAfter&&(a.stateAfter=null);var c,u=a.text.match(/^\s*/)[0];if(i||/\S/.test(a.text)){if("smart"==n&&(c=o.mode.indent(r,a.text.slice(u.length),a.text),c==B||c>150)){if(!i)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?I(ce(o,t-1).text,null,l):0:"add"==n?c=s+e.options.indentUnit:"subtract"==n?c=s-e.options.indentUnit:"number"==typeof n&&(c=s+n),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/l);h;--h)f+=l,d+="\t";if(f<c&&(d+=X(c-f)),d!=u)return nl(o,d,ve(t,0),ve(t,u.length),"+input"),a.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<u.length){var m=ve(t,u.length);$o(o,p,new io(m,m));break}}}$a.defineInitHook=function(e){return Ia.push(e)};var za=null;function Ra(e){za=e}function Ba(e,t,n,i,r){var o=e.doc;e.display.shift=!1,i||(i=o.sel);var l=e.state.pasteIncoming||"paste"==r,a=Dt(t),s=null;if(l&&i.ranges.length>1)if(za&&za.text.join("\n")==t){if(i.ranges.length%za.text.length==0){s=[];for(var c=0;c<za.text.length;c++)s.push(o.splitLines(za.text[c]))}}else a.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(s=q(a,function(e){return[e]}));for(var u=e.curOp.updateInput,d=i.ranges.length-1;d>=0;d--){var f=i.ranges[d],h=f.from(),p=f.to();f.empty()&&(n&&n>0?h=ve(h.line,h.ch-n):e.state.overwrite&&!l?p=ve(p.line,Math.min(ce(o,p.line).text.length,p.ch+Y(a).length)):l&&za&&za.lineWise&&za.text.join("\n")==t&&(h=p=ve(h.line,0)));var g={from:h,to:p,text:s?s[d%s.length]:a,origin:r||(l?"paste":e.state.cutIncoming?"cut":"+input")};qo(e.doc,g),On(e,"inputRead",e,g)}t&&!l&&ja(e,t),ir(e),e.curOp.updateInput<2&&(e.curOp.updateInput=u),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Va(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Tr(t,function(){return Ba(t,n,0,null,"paste")}),!0}function ja(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(!(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line)){var o=e.getModeAt(r.head),l=!1;if(o.electricChars){for(var a=0;a<o.electricChars.length;a++)if(t.indexOf(o.electricChars.charAt(a))>-1){l=Ea(e,r.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(ce(e.doc,r.head.line).text.slice(0,r.head.ch))&&(l=Ea(e,r.head.line,"smart"));l&&On(e,"electricInput",e,r.head.line)}}}function Ga(e){for(var t=[],n=[],i=0;i<e.doc.sel.ranges.length;i++){var r=e.doc.sel.ranges[i].head.line,o={anchor:ve(r,0),head:ve(r+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function Ua(e,t,n,i){e.setAttribute("autocorrect",!!n),e.setAttribute("autocapitalize",!!i),e.setAttribute("spellcheck",!!t)}function Ka(){var e=O("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=O("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return s?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),Ua(e),t}function Xa(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var i=this.options,r=i[e];i[e]==n&&"mode"!=e||(i[e]=n,t.hasOwnProperty(e)&&Mr(this,t[e])(this,n,r),gt(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Vl(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:Or(function(t,n){var i=t.token?t:e.getMode(this.options,t);if(i.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:i,modeSpec:t,opaque:n&&n.opaque,priority:n&&n.priority||0},function(e){return e.priority}),this.state.modeGen++,Dr(this)}),removeOverlay:Or(function(e){for(var t=this,n=this.state.overlays,i=0;i<n.length;++i){var r=n[i].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return n.splice(i,1),t.state.modeGen++,void Dr(t)}}),indentLine:Or(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),ge(this.doc,e)&&Ea(this,e,t,n)}),indentSelection:Or(function(e){for(var t=this,n=this.doc.sel.ranges,i=-1,r=0;r<n.length;r++){var o=n[r];if(o.empty())o.head.line>i&&(Ea(t,o.head.line,e,!0),i=o.head.line,r==t.doc.sel.primIndex&&ir(t));else{var l=o.from(),a=o.to(),s=Math.max(i,l.line);i=Math.min(t.lastLine(),a.line-(a.ch?0:1))+1;for(var c=s;c<i;++c)Ea(t,c,e);var u=t.doc.sel.ranges;0==l.ch&&n.length==u.length&&u[r].from().ch>0&&$o(t.doc,r,new io(l,u[r].to()),V)}}}),getTokenAt:function(e,t){return rn(this,e,t)},getLineTokens:function(e,t){return rn(this,ve(e),t,!0)},getTokenTypeAt:function(e){e=_e(this.doc,e);var t,n=Zt(this,ce(this.doc,e.line)),i=0,r=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var l=i+r>>1;if((l?n[2*l-1]:0)>=o)r=l;else{if(!(n[2*l+1]<o)){t=n[2*l+2];break}i=l+1}}var a=t?t.indexOf("overlay "):-1;return a<0?t:0==a?null:t.slice(0,a-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var i=this,r=[];if(!n.hasOwnProperty(t))return r;var o=n[t],l=this.getModeAt(e);if("string"==typeof l[t])o[l[t]]&&r.push(o[l[t]]);else if(l[t])for(var a=0;a<l[t].length;a++){var s=o[l[t][a]];s&&r.push(s)}else l.helperType&&o[l.helperType]?r.push(o[l.helperType]):o[l.name]&&r.push(o[l.name]);for(var c=0;c<o._global.length;c++){var u=o._global[c];u.pred(l,i)&&-1==z(r,u.val)&&r.push(u.val)}return r},getStateAfter:function(e,t){var n=this.doc;return e=ke(n,null==e?n.first+n.size-1:e),Jt(this,e+1,t).state},cursorCoords:function(e,t){var n,i=this.doc.sel.primary();return n=null==e?i.head:"object"==typeof e?_e(this.doc,e):e?i.from():i.to(),bi(this,n,t||"page")},charCoords:function(e,t){return yi(this,_e(this.doc,e),t||"page")},coordsChar:function(e,t){return e=vi(this,e,t||"page"),Ci(this,e.left,e.top)},lineAtHeight:function(e,t){return e=vi(this,{top:e,left:0},t||"page").top,pe(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var i,r=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,r=!0),i=ce(this.doc,e)}else i=e;return mi(this,i,{top:0,left:0},t||"page",n||r).top+(r?this.doc.height-it(i):0)},defaultTextHeight:function(){return Oi(this.display)},defaultCharWidth:function(){return Ni(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,i,r){var o=this.display;e=bi(this,_e(this.doc,e));var l=e.bottom,a=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==i)l=e.top;else if("above"==i||"near"==i){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==i||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"==r?(a=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==r?a=0:"middle"==r&&(a=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=a+"px"),n&&er(this,{left:a,top:l,right:a+t.offsetWidth,bottom:l+t.offsetHeight})},triggerOnKeyDown:Or(aa),triggerOnKeyPress:Or(ua),triggerOnKeyUp:ca,triggerOnMouseDown:Or(ma),execCommand:function(e){if(Yl.hasOwnProperty(e))return Yl[e].call(null,this)},triggerElectric:Or(function(e){ja(this,e)}),findPosH:function(e,t,n,i){var r=this,o=1;t<0&&(o=-1,t=-t);for(var l=_e(this.doc,e),a=0;a<t;++a)if(l=Ya(r.doc,l,o,n,i),l.hitSide)break;return l},moveH:Or(function(e,t){var n=this;this.extendSelectionsBy(function(i){return n.display.shift||n.doc.extend||i.empty()?Ya(n.doc,i.head,e,t,n.options.rtlMoveVisually):e<0?i.from():i.to()},G)}),deleteH:Or(function(e,t){var n=this.doc.sel,i=this.doc;n.somethingSelected()?i.replaceSelection("",null,"+delete"):jl(this,function(n){var r=Ya(i,n.head,e,t,!1);return e<0?{from:r,to:n.head}:{from:n.head,to:r}})}),findPosV:function(e,t,n,i){var r=this,o=1,l=i;t<0&&(o=-1,t=-t);for(var a=_e(this.doc,e),s=0;s<t;++s){var c=bi(r,a,"div");if(null==l?l=c.left:c.left=l,a=qa(r,c,o,n),a.hitSide)break}return a},moveV:Or(function(e,t){var n=this,i=this.doc,r=[],o=!this.display.shift&&!i.extend&&i.sel.somethingSelected();if(i.extendSelectionsBy(function(l){if(o)return e<0?l.from():l.to();var a=bi(n,l.head,"div");null!=l.goalColumn&&(a.left=l.goalColumn),r.push(a.left);var s=qa(n,a,e,t);return"page"==t&&l==i.sel.primary()&&nr(n,yi(n,s,"div").top-a.top),s},G),r.length)for(var l=0;l<i.sel.ranges.length;l++)i.sel.ranges[l].goalColumn=r[l]}),findWordAt:function(e){var t=this.doc,n=ce(t,e.line).text,i=e.ch,r=e.ch;if(n){var o=this.getHelper(e,"wordChars");"before"!=e.sticky&&r!=n.length||!i?++r:--i;var l=n.charAt(i),a=ne(l,o)?function(e){return ne(e,o)}:/\s/.test(l)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ne(e)};while(i>0&&a(n.charAt(i-1)))--i;while(r<n.length&&a(n.charAt(r)))++r}return new io(ve(e.line,i),ve(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?A(this.display.cursorDiv,"CodeMirror-overwrite"):L(this.display.cursorDiv,"CodeMirror-overwrite"),gt(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==F()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Or(function(e,t){rr(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Xn(this)-this.display.barHeight,width:e.scrollWidth-Xn(this)-this.display.barWidth,clientHeight:qn(this),clientWidth:Yn(this)}},scrollIntoView:Or(function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:ve(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?or(this,e):ar(this,e.from,e.to,e.margin)}),setSize:Or(function(e,t){var n=this,i=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=i(e)),null!=t&&(this.display.wrapper.style.height=i(t)),this.options.lineWrapping&&di(this);var r=this.display.viewFrom;this.doc.iter(r,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){Fr(n,r,"widget");break}++r}),this.curOp.forceUpdate=!0,gt(this,"refresh",this)}),operation:function(e){return Tr(this,e)},startOperation:function(){return br(this)},endOperation:function(){return wr(this)},refresh:Or(function(){var e=this.display.cachedTextHeight;Dr(this),this.curOp.forceUpdate=!0,fi(this),rr(this,this.doc.scrollLeft,this.doc.scrollTop),Kr(this),(null==e||Math.abs(e-Oi(this.display))>.5)&&Hi(this),gt(this,"refresh",this)}),swapDoc:Or(function(e){var t=this.doc;return t.cm=null,vo(this,e),fi(this),this.display.input.reset(),rr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,On(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},bt(e),e.registerHelper=function(t,i,r){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][i]=r},e.registerGlobalHelper=function(t,i,r,o){e.registerHelper(t,i,o),n[t]._global.push({pred:r,val:o})}}function Ya(e,t,n,i,r){var o=t,l=n,a=ce(e,t.line);function s(){var i=t.line+n;return!(i<e.first||i>=e.first+e.size)&&(t=new ve(i,t.ch,t.sticky),a=ce(e,i))}function c(i){var o;if(o=r?Xl(e.cm,a,t,n):Ul(a,t,n),null==o){if(i||!s())return!1;t=Kl(r,e.cm,a,t.line,n)}else t=o;return!0}if("char"==i)c();else if("column"==i)c(!0);else if("word"==i||"group"==i)for(var u=null,d="group"==i,f=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;;h=!1){if(n<0&&!c(!h))break;var p=a.text.charAt(t.ch)||"\n",g=ne(p,f)?"w":d&&"\n"==p?"n":!d||/\s/.test(p)?null:"p";if(!d||h||g||(g="s"),u&&u!=g){n<0&&(n=1,c(),t.sticky="after");break}if(g&&(u=g),n>0&&!c(!h))break}var m=Uo(e,t,o,l,!0);return be(o,m)&&(m.hitSide=!0),m}function qa(e,t,n,i){var r,o,l=e.doc,a=t.left;if("page"==i){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(s-.5*Oi(e.display),3);r=(n>0?t.bottom:t.top)+n*c}else"line"==i&&(r=n>0?t.bottom+3:t.top-3);for(;;){if(o=Ci(e,a,r),!o.outside)break;if(n<0?r<=0:r>=l.height){o.hitSide=!0;break}r+=5*n}return o}var Za=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new E,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ja(e,t){var n=ti(e,t.line);if(!n||n.hidden)return null;var i=ce(e.doc,t.line),r=Jn(n,i,t.line),o=ut(i,e.doc.direction),l="left";if(o){var a=st(o,t.ch);l=a%2?"right":"left"}var s=li(r.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function Qa(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function es(e,t){return t&&(e.bad=!0),e}function ts(e,t,n,i,r){var o="",l=!1,a=e.doc.lineSeparator(),s=!1;function c(e){return function(t){return t.id==e}}function u(){l&&(o+=a,s&&(o+=a),l=s=!1)}function d(e){e&&(u(),o+=e)}function f(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void d(n);var o,h=t.getAttribute("cm-marker");if(h){var p=e.findMarks(ve(i,0),ve(r+1,0),c(+h));return void(p.length&&(o=p[0].find(0))&&d(ue(e.doc,o.from,o.to).join(a)))}if("false"==t.getAttribute("contenteditable"))return;var g=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;g&&u();for(var m=0;m<t.childNodes.length;m++)f(t.childNodes[m]);/^(pre|p)$/i.test(t.nodeName)&&(s=!0),g&&(l=!0)}else 3==t.nodeType&&d(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;;){if(f(t),t==n)break;t=t.nextSibling,s=!1}return o}function ns(e,t,n){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[n],!i)return es(e.clipPos(ve(e.display.viewTo-1)),!0);t=null,n=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var r=0;r<e.display.view.length;r++){var o=e.display.view[r];if(o.node==i)return is(o,t,n)}}function is(e,t,n){var i=e.text.firstChild,r=!1;if(!t||!D(i,t))return es(ve(he(e.line),0),!0);if(t==i&&(r=!0,t=i.childNodes[n],n=0,!t)){var o=e.rest?Y(e.rest):e.line;return es(ve(he(o),o.text.length),r)}var l=3==t.nodeType?t:null,a=t;l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,n&&(n=l.nodeValue.length));while(a.parentNode!=i)a=a.parentNode;var s=e.measure,c=s.maps;function u(t,n,i){for(var r=-1;r<(c?c.length:0);r++)for(var o=r<0?s.map:c[r],l=0;l<o.length;l+=3){var a=o[l+2];if(a==t||a==n){var u=he(r<0?e.line:e.rest[r]),d=o[l]+i;return(i<0||a!=t)&&(d=o[l+(i?1:0)]),ve(u,d)}}}var d=u(l,a,n);if(d)return es(d,r);for(var f=a.nextSibling,h=l?l.nodeValue.length-n:0;f;f=f.nextSibling){if(d=u(f,f.firstChild,0),d)return es(ve(d.line,d.ch-h),r);h+=f.textContent.length}for(var p=a.previousSibling,g=n;p;p=p.previousSibling){if(d=u(p,p.firstChild,-1),d)return es(ve(d.line,d.ch+g),r);g+=p.textContent.length}}Za.prototype.init=function(e){var t=this,n=this,i=n.cm,r=n.div=e.lineDiv;function o(e){if(!mt(i,e)){if(i.somethingSelected())Ra({lineWise:!1,text:i.getSelections()}),"cut"==e.type&&i.replaceSelection("",null,"cut");else{if(!i.options.lineWiseCopyCut)return;var t=Ga(i);Ra({lineWise:!0,text:t.text}),"cut"==e.type&&i.operation(function(){i.setSelections(t.ranges,0,V),i.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var o=za.text.join("\n");if(e.clipboardData.setData("Text",o),e.clipboardData.getData("Text")==o)return void e.preventDefault()}var l=Ka(),a=l.firstChild;i.display.lineSpace.insertBefore(l,i.display.lineSpace.firstChild),a.value=za.text.join("\n");var s=document.activeElement;W(a),setTimeout(function(){i.display.lineSpace.removeChild(l),s.focus(),s==r&&n.showPrimarySelection()},50)}}Ua(r,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize),ft(r,"paste",function(e){mt(i,e)||Va(e,i)||a<=11&&setTimeout(Mr(i,function(){return t.updateFromDOM()}),20)}),ft(r,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),ft(r,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),ft(r,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ft(r,"touchstart",function(){return n.forceCompositionEnd()}),ft(r,"input",function(){t.composing||t.readFromDOMSoon()}),ft(r,"copy",o),ft(r,"cut",o)},Za.prototype.prepareSelection=function(){var e=Ii(this.cm,!1);return e.focus=this.cm.state.focused,e},Za.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Za.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Za.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),o=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var l=ns(t,e.anchorNode,e.anchorOffset),a=ns(t,e.focusNode,e.focusOffset);if(!l||l.bad||!a||a.bad||0!=ye(Ce(l,a),r)||0!=ye(xe(l,a),o)){var s=t.display.view,c=r.line>=t.display.viewFrom&&Ja(t,r)||{node:s[0].measure.map[2],offset:0},u=o.line<t.display.viewTo&&Ja(t,o);if(!u){var d=s[s.length-1].measure,f=d.maps?d.maps[d.maps.length-1]:d.map;u={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(c&&u){var h,p=e.rangeCount&&e.getRangeAt(0);try{h=S(c.node,c.offset,u.offset,u.node)}catch(g){}h&&(!n&&t.state.focused?(e.collapse(c.node,c.offset),h.collapsed||(e.removeAllRanges(),e.addRange(h))):(e.removeAllRanges(),e.addRange(h)),p&&null==e.anchorNode?e.addRange(p):n&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Za.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Za.prototype.showMultipleSelections=function(e){M(this.cm.display.cursorDiv,e.cursors),M(this.cm.display.selectionDiv,e.selection)},Za.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Za.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},Za.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Za.prototype.blur=function(){this.div.blur()},Za.prototype.getField=function(){return this.div},Za.prototype.supportsTouch=function(){return!0},Za.prototype.receivedFocus=function(){var e=this;function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.selectionInEditor()?this.pollSelection():Tr(this.cm,function(){return e.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,t)},Za.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Za.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(m&&u&&this.cm.options.gutters.length&&Qa(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=ns(t,e.anchorNode,e.anchorOffset),i=ns(t,e.focusNode,e.focusOffset);n&&i&&Tr(t,function(){zo(t.doc,oo(n,i),V),(n.bad||i.bad)&&(t.curOp.selectionChanged=!0)})}}},Za.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,n,i=this.cm,r=i.display,o=i.doc.sel.primary(),l=o.from(),a=o.to();if(0==l.ch&&l.line>i.firstLine()&&(l=ve(l.line-1,ce(i.doc,l.line-1).length)),a.ch==ce(i.doc,a.line).text.length&&a.line<i.lastLine()&&(a=ve(a.line+1,0)),l.line<r.viewFrom||a.line>r.viewTo-1)return!1;l.line==r.viewFrom||0==(e=$i(i,l.line))?(t=he(r.view[0].line),n=r.view[0].node):(t=he(r.view[e].line),n=r.view[e-1].node.nextSibling);var s,c,u=$i(i,a.line);if(u==r.view.length-1?(s=r.viewTo-1,c=r.lineDiv.lastChild):(s=he(r.view[u+1].line)-1,c=r.view[u+1].node.previousSibling),!n)return!1;var d=i.doc.splitLines(ts(i,n,c,t,s)),f=ue(i.doc,ve(t,0),ve(s,ce(i.doc,s).text.length));while(d.length>1&&f.length>1)if(Y(d)==Y(f))d.pop(),f.pop(),s--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),t++}var h=0,p=0,g=d[0],m=f[0],v=Math.min(g.length,m.length);while(h<v&&g.charCodeAt(h)==m.charCodeAt(h))++h;var y=Y(d),b=Y(f),w=Math.min(y.length-(1==d.length?h:0),b.length-(1==f.length?h:0));while(p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1))++p;if(1==d.length&&1==f.length&&t==l.line)while(h&&h>l.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1))h--,p++;d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(h).replace(/\u200b+$/,"");var x=ve(t,h),C=ve(s,f.length?Y(f).length-p:0);return d.length>1||d[0]||ye(x,C)?(nl(i.doc,d,x,C,"+input"),!0):void 0},Za.prototype.ensurePolled=function(){this.forceCompositionEnd()},Za.prototype.reset=function(){this.forceCompositionEnd()},Za.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Za.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},Za.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Tr(this.cm,function(){return Dr(e.cm)})},Za.prototype.setUneditable=function(e){e.contentEditable="false"},Za.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Mr(this.cm,Ba)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Za.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Za.prototype.onContextMenu=function(){},Za.prototype.resetPosition=function(){},Za.prototype.needsContentAttribute=!0;var rs=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new E,this.hasSelection=!1,this.composing=null};function os(e,t){if(t=t?P(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=F();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function i(){e.value=a.getValue()}var r;if(e.form&&(ft(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var o=e.form;r=o.submit;try{var l=o.submit=function(){i(),o.submit=r,o.submit(),o.submit=l}}catch(s){}}t.finishInit=function(t){t.save=i,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,i(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(pt(e.form,"submit",i),"function"==typeof e.form.submit&&(e.form.submit=r))}},e.style.display="none";var a=$a(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return a}function ls(e){e.off=pt,e.on=ft,e.wheelEventPixels=eo,e.Doc=xl,e.splitLines=Dt,e.countColumn=I,e.findColumn=U,e.isWordChar=te,e.Pass=B,e.signal=gt,e.Line=cn,e.changeEnd=lo,e.scrollbarModel=mr,e.Pos=ve,e.cmpPos=ye,e.modes=$t,e.mimeModes=Pt,e.resolveMode=zt,e.getMode=Rt,e.modeExtensions=Bt,e.extendMode=Vt,e.copyState=jt,e.startState=Ut,e.innerMode=Gt,e.commands=Yl,e.keyMap=$l,e.keyName=Bl,e.isModifierKey=zl,e.lookupKey=El,e.normalizeKeyMap=Il,e.StringStream=Kt,e.SharedTextMarker=gl,e.TextMarker=hl,e.LineWidget=cl,e.e_preventDefault=wt,e.e_stopPropagation=xt,e.e_stop=kt,e.addClass=A,e.contains=D,e.rmClass=L,e.keyNames=Fl}rs.prototype.init=function(e){var t=this,n=this,i=this.cm;this.createField(e);var r=this.textarea;function o(e){if(!mt(i,e)){if(i.somethingSelected())Ra({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=Ga(i);Ra({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,V):(n.prevInput="",r.value=t.text.join("\n"),W(r))}"cut"==e.type&&(i.state.cutIncoming=!0)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(r.style.width="0px"),ft(r,"input",function(){l&&a>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),ft(r,"paste",function(e){mt(i,e)||Va(e,i)||(i.state.pasteIncoming=!0,n.fastPoll())}),ft(r,"cut",o),ft(r,"copy",o),ft(e.scroller,"paste",function(t){jn(e,t)||mt(i,t)||(i.state.pasteIncoming=!0,n.focus())}),ft(e.lineSpace,"selectstart",function(t){jn(e,t)||wt(t)}),ft(r,"compositionstart",function(){var e=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),ft(r,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},rs.prototype.createField=function(e){this.wrapper=Ka(),this.textarea=this.wrapper.firstChild},rs.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,i=Ii(e);if(e.options.moveInputWithCursor){var r=bi(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+l.top-o.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+l.left-o.left))}return i},rs.prototype.showSelection=function(e){var t=this.cm,n=t.display;M(n.cursorDiv,e.cursors),M(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},rs.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&W(this.textarea),l&&a>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",l&&a>=9&&(this.hasSelection=null))}},rs.prototype.getField=function(){return this.textarea},rs.prototype.supportsTouch=function(){return!1},rs.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||F()!=this.textarea))try{this.textarea.focus()}catch(e){}},rs.prototype.blur=function(){this.textarea.blur()},rs.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},rs.prototype.receivedFocus=function(){this.slowPoll()},rs.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},rs.prototype.fastPoll=function(){var e=!1,t=this;function n(){var i=t.poll();i||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}t.pollingFast=!0,t.polling.set(20,n)},rs.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ft(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var r=n.value;if(r==i&&!t.somethingSelected())return!1;if(l&&a>=9&&this.hasSelection===r||y&&/[\uf700-\uf7ff]/.test(r))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=r.charCodeAt(0);if(8203!=o||i||(i="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}var s=0,c=Math.min(i.length,r.length);while(s<c&&i.charCodeAt(s)==r.charCodeAt(s))++s;return Tr(t,function(){Ba(t,r.slice(s),i.length-s,null,e.composing?"*compose":null),r.length>1e3||r.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=r,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},rs.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},rs.prototype.onKeyPress=function(){l&&a>=9&&(this.hasSelection=null),this.fastPoll()},rs.prototype.onContextMenu=function(e){var t=this,n=t.cm,i=n.display,r=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=Wi(n,e),c=i.scroller.scrollTop;if(o&&!d){var u=n.options.resetSelectionOnContextMenu;u&&-1==n.doc.sel.contains(o)&&Mr(n,zo)(n.doc,oo(o),V);var f,h=r.style.cssText,p=t.wrapper.style.cssText,g=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",r.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(e.clientY-g.top-5)+"px; left: "+(e.clientX-g.left-5)+"px;\n      z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(f=window.scrollY),i.input.focus(),s&&window.scrollTo(null,f),i.input.reset(),n.somethingSelected()||(r.value=t.prevInput=" "),t.contextMenuPending=y,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),l&&a>=9&&v(),k){kt(e);var m=function(){pt(window,"mouseup",m),setTimeout(y,20)};ft(window,"mouseup",m)}else setTimeout(y,50)}function v(){if(null!=r.selectionStart){var e=n.somethingSelected(),o="​"+(e?r.value:"");r.value="⇚",r.value=o,t.prevInput=e?"":"​",r.selectionStart=1,r.selectionEnd=o.length,i.selForContextMenu=n.doc.sel}}function y(){if(t.contextMenuPending==y&&(t.contextMenuPending=!1,t.wrapper.style.cssText=p,r.style.cssText=h,l&&a<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=c),null!=r.selectionStart)){(!l||l&&a<9)&&v();var e=0,o=function(){i.selForContextMenu==n.doc.sel&&0==r.selectionStart&&r.selectionEnd>0&&"​"==t.prevInput?Mr(n,Xo)(n):e++<10?i.detectingSelectAll=setTimeout(o,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(o,200)}}},rs.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},rs.prototype.setUneditable=function(){},rs.prototype.needsContentAttribute=!1,Fa($a),Xa($a);var as="iter insert remove copy getEditor constructor".split(" ");for(var ss in xl.prototype)xl.prototype.hasOwnProperty(ss)&&z(as,ss)<0&&($a.prototype[ss]=function(e){return function(){return e.apply(this.doc,arguments)}}(xl.prototype[ss]));return bt(xl),$a.inputStyles={textarea:rs,contenteditable:Za},$a.defineMode=function(e){$a.defaults.mode||"null"==e||($a.defaults.mode=e),It.apply(this,arguments)},$a.defineMIME=Et,$a.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),$a.defineMIME("text/plain","null"),$a.defineExtension=function(e,t){$a.prototype[e]=t},$a.defineDocExtension=function(e,t){xl.prototype[e]=t},$a.fromTextArea=os,ls($a),$a.version="5.43.0",$a})},"5dbc":function(e,t,n){var i=n("d3f4"),r=n("8b97").set;e.exports=function(e,t,n){var o,l=t.constructor;return l!==n&&"function"==typeof l&&(o=l.prototype)!==n.prototype&&i(o)&&r&&r(e,o),e}},"7f7f":function(e,t,n){var i=n("86cc").f,r=Function.prototype,o=/^\s*function ([^ (]*)/,l="name";l in r||n("9e1e")&&i(r,l,{configurable:!0,get:function(){try{return(""+this).match(o)[1]}catch(e){return""}}})},"882b":function(e,t,n){"use strict";n.r(t);var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[e.spaceId?n("el-card",{attrs:{shadow:"never"}},[n("div",{staticClass:"app-btn-group"},[n("el-button",{attrs:{type:"primary",icon:"el-icon-refresh",size:"small"},on:{click:e.switchSpaceHandler}},[e._v(e._s(e.$t("switch_project_space")))])],1),n("div",{staticClass:"app-btn-group",staticStyle:{"min-height":"30px"}},[n("div",{directives:[{name:"loading",rawName:"v-loading",value:e.spaceLoading,expression:"spaceLoading"}]},[n("h4",[e._v(e._s(this.spaceDetail.name))]),n("p",{staticClass:"app-description"},[e._v(e._s(this.spaceDetail.description))])])]),n("div",{staticClass:"app-divider"}),n("el-row",{staticClass:"app-btn-group"},[n("el-col",{attrs:{span:4}},[e.$root.CheckPriv(e.$root.Priv.PROJECT_NEW)?n("el-button",{attrs:{icon:"iconfont left small icon-add",size:"medium",type:"primary"},on:{click:e.openAddDialogHandler}},[e._v(e._s(e.$t("add_project")))]):e._e(),e._v(" \n            ")],1),n("el-col",{attrs:{span:6,offset:14}},[n("el-input",{attrs:{size:"medium",placeholder:e.$t("please_input_keyword")},nativeOn:{keyup:function(t){return"button"in t||!e._k(t.keyCode,"enter",13,t.key,"Enter")?e.searchHandler(t):null}},model:{value:e.searchInput,callback:function(t){e.searchInput=t},expression:"searchInput"}},[n("el-button",{attrs:{slot:"append",icon:"el-icon-search"},on:{click:e.searchHandler},slot:"append"})],1)],1)],1),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.tableLoading,expression:"tableLoading"}],staticClass:"app-table",attrs:{size:"medium",data:e.tableData}},[n("el-table-column",{attrs:{prop:"name",label:e.$t("project_name")}}),n("el-table-column",{attrs:{align:"center",prop:"need_audit",width:"150",label:e.$t("open_audit")},scopedSlots:e._u([{key:"default",fn:function(t){return[1==t.row.need_audit?n("span",[e._v(e._s(e.$t("yes")))]):n("span",[e._v(e._s(e.$t("no")))])]}}])}),n("el-table-column",{attrs:{prop:"status",width:"120",label:e.$t("project_enable")},scopedSlots:e._u([{key:"default",fn:function(t){return[e.$root.CheckPriv(e.$root.Priv.PROJECT_AUDIT)?n("el-switch",{attrs:{"active-value":1,"inactive-value":0,"active-color":"#13ce66"},on:{change:function(n){e.enableSwitchHandler(n,t.row)}},model:{value:t.row.status,callback:function(n){e.$set(t.row,"status",n)},expression:"scope.row.status"}}):e._e(),t.row.status?n("span",{staticStyle:{"margin-left":"5px"}},[e._v(e._s(e.$t("have_enabled")))]):n("span",{staticStyle:{"margin-left":"5px"}},[e._v(e._s(e.$t("not_enable")))])]}}])}),n("el-table-column",{attrs:{label:e.$t("operate"),width:"380",align:"right"},scopedSlots:e._u([{key:"default",fn:function(t){return[e.$root.CheckPriv(e.$root.Priv.PROJECT_HOOK)?n("el-button",{attrs:{icon:"iconfont small left icon-webhook",type:"text"},on:{click:function(n){e.openHookDialogHandler(t.row)}}},[e._v(e._s(e.$t("hook")))]):e._e(),e.$root.CheckPriv(e.$root.Priv.PROJECT_BUILD)?n("el-button",{attrs:{icon:"iconfont small left icon-build",type:"text"},on:{click:function(n){e.openBuildDialogHandler(t.row)}}},[e._v(e._s(e.$t("build_setting")))]):e._e(),e.$root.CheckPriv(e.$root.Priv.PROJECT_VIEW)?n("el-button",{attrs:{icon:"el-icon-view",type:"text"},on:{click:function(n){e.openViewDialogHandler(t.row)}}},[e._v(e._s(e.$t("view")))]):e._e(),e.$root.CheckPriv(e.$root.Priv.PROJECT_EDIT)?n("el-button",{attrs:{icon:"el-icon-edit",type:"text"},on:{click:function(n){e.openEditDialogHandler(t.row)}}},[e._v(e._s(e.$t("edit")))]):e._e(),e.$root.CheckPriv(e.$root.Priv.PROJECT_DEL)?n("el-button",{staticClass:"app-danger",attrs:{type:"text",icon:"el-icon-delete"},on:{click:function(n){e.deleteHandler(t.row)}}},[e._v(e._s(e.$t("delete")))]):e._e()]}}])})],1),n("el-pagination",{staticClass:"app-pagination",attrs:{background:"",layout:"prev, pager, next","current-page":e.$root.Page,"page-size":e.$root.PageSize,total:e.$root.Total},on:{"current-change":e.currentChangeHandler,"update:currentPage":function(t){e.$set(e.$root,"Page",t)}}})],1):n("el-card",{attrs:{shadow:"never"}},[n("el-alert",{staticClass:"app-btn-group",attrs:{title:e.$t("prompt_message"),type:"info",closable:!1,description:e.$t("project_select_space_tips"),"show-icon":""}}),n("div",{staticClass:"app-btn-group"},[n("el-button",{attrs:{type:"primary",icon:"el-icon-refresh",size:"small"},on:{click:e.switchSpaceHandler}},[e._v(e._s(e.$t("select_project_space")))])],1),n("div",{staticClass:"app-divider"})],1),n("el-dialog",{attrs:{top:e.$root.DialogNormalTop,width:e.$root.DialogLargeWidth,title:e.dialogTitle,visible:e.dialogVisible},on:{"update:visible":function(t){e.dialogVisible=t},close:e.dialogCloseHandler}},[n("div",{directives:[{name:"loading",rawName:"v-loading",value:e.dialogLoading,expression:"dialogLoading"}],staticClass:"app-dialog"},[n("el-form",{ref:"dialogRef",staticClass:"app-form",attrs:{model:e.dialogForm,size:"medium","label-width":"130px"}},[n("h4",{staticClass:"app-form-subtitle"},[e._v(e._s(e.$t("base_setting")))]),n("el-form-item",{attrs:{label:e.$t("project_name"),prop:"name",rules:[{required:!0,message:e.$t("name_cannot_empty"),trigger:"blur"}]}},[n("el-input",{attrs:{placeholder:e.$t("please_input_project_name"),autocomplete:"off"},model:{value:e.dialogForm.name,callback:function(t){e.$set(e.dialogForm,"name",t)},expression:"dialogForm.name"}})],1),n("el-form-item",{attrs:{label:e.$t("description"),prop:"description"}},[n("el-input",{attrs:{placeholder:e.$t("please_input_project_description"),type:"textarea",rows:3,autocomplete:"off"},model:{value:e.dialogForm.description,callback:function(t){e.$set(e.dialogForm,"description",t)},expression:"dialogForm.description"}})],1),n("el-form-item",{attrs:{label:e.$t("open_audit"),prop:"need_audit"}},[n("div",[n("el-switch",{attrs:{"active-value":1,"inactive-value":0,"active-color":"#13ce66"},model:{value:e.dialogForm.need_audit,callback:function(t){e.$set(e.dialogForm,"need_audit",t)},expression:"dialogForm.need_audit"}}),n("span",{staticStyle:{"margin-left":"8px"}},[e.dialogForm.need_audit?n("span",[e._v(e._s(e.$t("open")))]):n("span",[e._v(e._s(e.$t("close")))])])],1),n("div",{staticClass:"app-form-explain"},[e._v(e._s(e.$t("if_open_apply_need_audit")))])]),n("div",{staticClass:"app-divider"}),n("h4",{staticClass:"app-form-subtitle"},[e._v(e._s(e.$t("repo_setting")))]),n("el-form-item",{attrs:{label:e.$t("repo_url"),prop:"repo_url",rules:[{required:!0,message:e.$t("repo_url_cannot_empty"),trigger:"blur"}]}},[n("el-input",{attrs:{placeholder:e.$t("please_input_repo_url"),autocomplete:"off"},model:{value:e.dialogForm.repo_url,callback:function(t){e.$set(e.dialogForm,"repo_url",t)},expression:"dialogForm.repo_url"}})],1),n("el-form-item",{attrs:{label:e.$t("deploy_mode"),prop:"deploy_mode",rules:[{required:!0,message:e.$t("deploy_mode_cannot_empty"),trigger:"blur"}]}},[n("el-radio-group",{model:{value:e.dialogForm.deploy_mode,callback:function(t){e.$set(e.dialogForm,"deploy_mode",t)},expression:"dialogForm.deploy_mode"}},[n("el-radio",{attrs:{label:1}},[e._v(e._s(e.$t("branch_deploy")))]),n("el-radio",{attrs:{label:2}},[e._v(e._s(e.$t("tag_deploy")))])],1),n("div",{staticClass:"app-form-explain"},[e._v(e._s(e.$t("deploy_mode_tips")))])],1),1==e.dialogForm.deploy_mode?n("el-form-item",{attrs:{label:e.$t("repo_branch"),prop:"repo_branch"}},[n("el-input",{staticClass:"app-input-mini",attrs:{autocomplete:"off"},model:{value:e.dialogForm.repo_branch,callback:function(t){e.$set(e.dialogForm,"repo_branch",t)},expression:"dialogForm.repo_branch"}}),n("div",{staticClass:"app-form-explain"},[e._v(e._s(e.$t("if_not_need_to_assign_branch_name")))])],1):e._e(),n("div",{staticClass:"app-divider"}),n("h4",{staticClass:"app-form-subtitle"},[e._v(e._s(e.$t("deploy_setting")))]),n("el-form-item",{attrs:{label:e.$t("online_cluster"),prop:"online_cluster",rules:[{required:!0,message:e.$t("online_cluster_cannot_empty"),trigger:"blur"}]}},[n("el-select",{staticClass:"app-input-mini",attrs:{filterable:"",clearable:"",placeholder:e.$t("please_input_keyword")},on:{change:e.selectClusterHandler},model:{value:e.selectOnlineCluster,callback:function(t){e.selectOnlineCluster=t},expression:"selectOnlineCluster"}},e._l(e.clusterList,function(e){return n("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})}),1),e.dialogForm.online_cluster&&e.dialogForm.online_cluster.length?n("div",[n("span",[e._v(e._s(e.$t("selected_cluster_list")))]),n("ul",{staticClass:"app-form-box"},e._l(e.dialogForm.online_cluster,function(t){return n("li",{key:t,staticClass:"item"},[n("span",[n("i",{staticClass:"iconfont small left icon-cluster"}),e._v(e._s(e.formatClusterName(t)))]),n("span",[n("el-button",{attrs:{icon:"el-icon-delete",type:"text"},on:{click:function(n){e.removeClusterHandler(t)}}},[e._v(e._s(e.$t("remove")))])],1)])}),0)]):e._e()],1),n("el-form-item",{attrs:{label:e.$t("user"),prop:"deploy_user",rules:[{required:!0,message:e.$t("user_cannot_empty"),trigger:"blur"}]}},[n("el-input",{staticClass:"app-input-mini",attrs:{placeholder:e.$t("deploy_user"),autocomplete:"off"},model:{value:e.dialogForm.deploy_user,callback:function(t){e.$set(e.dialogForm,"deploy_user",t)},expression:"dialogForm.deploy_user"}})],1),n("el-form-item",{attrs:{label:e.$t("path"),prop:"deploy_path",rules:[{required:!0,message:e.$t("deploy_path_cannot_empty"),trigger:"blur"}]}},[n("el-input",{attrs:{placeholder:e.$t("deploy_path"),autocomplete:"off"},model:{value:e.dialogForm.deploy_path,callback:function(t){e.$set(e.dialogForm,"deploy_path",t)},expression:"dialogForm.deploy_path"}})],1),n("el-form-item",{attrs:{label:e.$t("pre_deploy_cmd"),prop:"pre_deploy_cmd"}},[n("el-input",{attrs:{placeholder:e.$t("pre_deploy_cmd_tips"),type:"textarea",rows:3,autocomplete:"off"},model:{value:e.dialogForm.pre_deploy_cmd,callback:function(t){e.$set(e.dialogForm,"pre_deploy_cmd",t)},expression:"dialogForm.pre_deploy_cmd"}})],1),n("el-form-item",{attrs:{label:e.$t("after_deploy_cmd"),prop:"after_deploy_cmd"}},[n("el-input",{attrs:{placeholder:e.$t("after_deploy_cmd_tips"),type:"textarea",rows:3,autocomplete:"off"},model:{value:e.dialogForm.after_deploy_cmd,callback:function(t){e.$set(e.dialogForm,"after_deploy_cmd",t)},expression:"dialogForm.after_deploy_cmd"}})],1),n("div",{staticClass:"app-divider"}),n("h4",{staticClass:"app-form-subtitle"},[e._v(e._s(e.$t("email_setting")))]),n("el-form-item",{attrs:{label:e.$t("audit_notice"),prop:"audit_notice"}},[n("el-input",{attrs:{placeholder:e.$t("audit_notice_tips"),autocomplete:"off"},model:{value:e.dialogForm.audit_notice,callback:function(t){e.$set(e.dialogForm,"audit_notice",t)},expression:"dialogForm.audit_notice"}}),n("div",{staticClass:"app-form-explain",domProps:{innerHTML:e._s(e.$t("audit_notice_explain"))}})],1),n("el-form-item",{attrs:{label:e.$t("deploy_notice"),prop:"deploy_notice"}},[n("el-input",{attrs:{placeholder:e.$t("deploy_notice_tips"),autocomplete:"off"},model:{value:e.dialogForm.deploy_notice,callback:function(t){e.$set(e.dialogForm,"deploy_notice",t)},expression:"dialogForm.deploy_notice"}}),n("div",{staticClass:"app-form-explain",domProps:{innerHTML:e._s(e.$t("deploy_notice_explain"))}})],1)],1),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{size:"small"},on:{click:e.dialogCloseHandler}},[e._v(e._s(e.$t("cancel")))]),n("el-button",{attrs:{loading:e.btnLoading,size:"small",type:"primary"},on:{click:e.dialogSubmitHandler}},[e._v(e._s(e.$t("enter")))])],1)],1)]),n("el-dialog",{attrs:{top:e.$root.DialogNormalTop,width:e.$root.DialogLargeWidth,title:e.$t("view_project_info"),visible:e.dialogViewVisible},on:{"update:visible":function(t){e.dialogViewVisible=t},close:function(t){e.dialogViewVisible=!1}}},[n("div",{directives:[{name:"loading",rawName:"v-loading",value:e.dialogViewLoading,expression:"dialogViewLoading"}],staticClass:"app-dialog"},[n("el-form",{attrs:{size:"medium","label-width":"130px"}},[n("h4",{staticClass:"app-form-subtitle"},[e._v(e._s(e.$t("base_setting")))]),n("el-form-item",{attrs:{label:e.$t("project_id")}},[e._v("\n                    "+e._s(e.dialogViewForm.id)+"\n                ")]),n("el-form-item",{attrs:{label:e.$t("project_name")}},[e._v("\n                    "+e._s(e.dialogViewForm.name)+"\n                ")]),n("el-form-item",{attrs:{label:e.$t("description")}},[e._v("\n                    "+e._s(e.dialogViewForm.description)+"\n                ")]),n("el-form-item",{attrs:{label:e.$t("open_audit")}},[e.dialogViewForm.need_audit?n("span",[e._v(e._s(e.$t("need_audit")))]):n("span",[e._v(e._s(e.$t("not_audit")))])]),n("div",{staticClass:"app-divider"}),n("h4",{staticClass:"app-form-subtitle"},[e._v(e._s(e.$t("repo_setting")))]),n("el-form-item",{attrs:{label:e.$t("repo_url")}},[e._v("\n                    "+e._s(e.dialogViewForm.repo_url)+"\n                ")]),n("el-form-item",{attrs:{label:e.$t("deploy_mode")}},[1==e.dialogViewForm.deploy_mode?n("span",[n("i",{staticClass:"iconfont icon-branch"}),e._v(" - "+e._s(e.$t("branch_deploy"))+" - "),n("strong",[e._v(e._s(e.dialogViewForm.repo_branch))]),e._v(" "+e._s(e.$t("branch"))+"\n                    ")]):e._e(),2==e.dialogViewForm.deploy_mode?n("span",[n("i",{staticClass:"iconfont icon-branch"}),e._v(" "+e._s(e.$t("tag_deploy"))+"\n                    ")]):e._e()]),n("el-form-item",{attrs:{label:e.$t("repo_branch")}},[e._v("\n                    "+e._s(e.dialogViewForm.repo_branch)+"\n                ")]),n("div",{staticClass:"app-divider"}),n("h4",{staticClass:"app-form-subtitle"},[e._v(e._s(e.$t("deploy_setting")))]),n("el-form-item",{attrs:{label:e.$t("online_cluster")}},[e.dialogViewForm.online_cluster&&e.dialogViewForm.online_cluster.length?n("div",[n("ul",{staticClass:"app-form-box"},e._l(e.dialogViewForm.online_cluster,function(t){return n("li",{key:t,staticClass:"item"},[n("span",[n("i",{staticClass:"iconfont small left icon-cluster"}),e._v(e._s(e.formatClusterName(t)))])])}),0)]):e._e()]),n("el-form-item",{attrs:{label:e.$t("user")}},[e._v("\n                    "+e._s(e.dialogViewForm.deploy_user)+"\n                ")]),n("el-form-item",{attrs:{label:e.$t("path")}},[e._v("\n                    "+e._s(e.dialogViewForm.deploy_path)+"\n                ")]),n("el-form-item",{attrs:{label:e.$t("pre_deploy_cmd")}},[n("el-input",{attrs:{type:"textarea",rows:3,value:e.dialogViewForm.pre_deploy_cmd,readonly:"readonly"}})],1),n("el-form-item",{attrs:{label:e.$t("after_deploy_cmd")}},[n("el-input",{attrs:{type:"textarea",rows:3,value:e.dialogViewForm.after_deploy_cmd,readonly:"readonly"}})],1),n("el-form-item",{attrs:{label:e.$t("audit_notice")}},[e._v("\n                    "+e._s(e.dialogViewForm.audit_notice)+"\n                ")]),n("el-form-item",{attrs:{label:e.$t("deploy_notice")}},[e._v("\n                    "+e._s(e.dialogViewForm.deploy_notice)+"\n                ")])],1)],1)]),n("el-dialog",{attrs:{top:e.$root.DialogNormalTop,width:e.$root.DialogNormalWidth,title:e.$t("edit_build_script"),visible:e.dialogBuildVisible},on:{"update:visible":function(t){e.dialogBuildVisible=t},close:function(t){e.dialogBuildVisible=!1}}},[n("div",{directives:[{name:"loading",rawName:"v-loading",value:e.dialogBuildLoading,expression:"dialogBuildLoading"}],staticClass:"app-dialog"},[n("div",{staticClass:"app-shell-editor"},[n("textarea",{attrs:{id:"editor-textarea"}})]),n("h4",{staticClass:"app-form-subtitle"},[e._v(e._s(e.$t("illustrate")))]),n("div",{staticClass:"app-form-notice"},[n("p",[e._v(e._s(e.$t("build_script_tips"))+":")]),n("p",[n("i",{staticClass:"iconfont icon-dot"}),n("span",{staticClass:"code"},[e._v("${env_workspace}")]),e._v(" - "+e._s(e.$t("build_script_env_workspace"))+"\n                ")]),n("p",[n("i",{staticClass:"iconfont icon-dot"}),n("span",{staticClass:"code"},[e._v("${env_pack_file}")]),e._v(" - "),n("span",{domProps:{innerHTML:e._s(e.$t("build_script_env_pack_file"))}})]),n("p",[n("a",{staticClass:"app-link",attrs:{href:"https://github.com/dreamans/syncd",target:"_blank"}},[e._v(e._s(e.$t("view_build_script_eg")))])])]),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{size:"small"},on:{click:function(t){e.dialogBuildVisible=!1}}},[e._v(e._s(e.$t("cancel")))]),n("el-button",{attrs:{loading:e.btnLoading,size:"small",type:"primary"},on:{click:e.dialogSubmitBuildHandler}},[e._v(e._s(e.$t("enter")))])],1)])]),n("el-dialog",{attrs:{top:e.$root.DialogNormalTop,width:e.$root.DialogNormalWidth,title:e.$t("edit_hook_script"),visible:e.dialogHookVisible},on:{"update:visible":function(t){e.dialogHookVisible=t},close:function(t){e.dialogHookVisible=!1}}},[n("div",{directives:[{name:"loading",rawName:"v-loading",value:e.dialogHookLoading,expression:"dialogHookLoading"}],staticClass:"app-dialog"},[n("el-form",{attrs:{"label-position":"top",size:"medium","label-width":"130px"}},[n("el-form-item",{attrs:{label:e.$t("build_hook_script")}},[n("el-input",{attrs:{type:"textarea",autosize:{minRows:3,maxRows:10}},model:{value:e.dialogHookForm.build_hook_script,callback:function(t){e.$set(e.dialogHookForm,"build_hook_script",t)},expression:"dialogHookForm.build_hook_script"}}),n("div",{staticClass:"app-form-explain"},[n("p",[e._v(e._s(e.$t("build_hook_script_tips"))+":")]),n("p",[n("i",{staticClass:"iconfont icon-dot"}),n("span",{staticClass:"code"},[e._v("${env_apply_id}")]),e._v(" - 申请单ID")]),n("p",[n("i",{staticClass:"iconfont icon-dot"}),n("span",{staticClass:"code"},[e._v("${env_apply_name}")]),e._v(" - 申请单名称")]),n("p",[n("i",{staticClass:"iconfont icon-dot"}),n("span",{staticClass:"code"},[e._v("${env_pack_file}")]),e._v(" - 打包的文件绝对路径")]),n("p",[n("i",{staticClass:"iconfont icon-dot"}),n("span",{staticClass:"code"},[e._v("${env_build_output}")]),e._v(" - 构建脚本的原始输出 (JSON字符串)")]),n("p",[n("i",{staticClass:"iconfont icon-dot"}),n("span",{staticClass:"code"},[e._v("${env_build_errmsg}")]),e._v(" - 构建错误信息")]),n("p",[n("i",{staticClass:"iconfont icon-dot"}),n("span",{staticClass:"code"},[e._v("${env_build_status}")]),e._v(" - 构建结果状态，1 - 成功，0 - 失败")])])],1),n("el-form-item",{attrs:{label:e.$t("deploy_hook_script")}},[n("el-input",{attrs:{type:"textarea",autosize:{minRows:3,maxRows:10}},model:{value:e.dialogHookForm.deploy_hook_script,callback:function(t){e.$set(e.dialogHookForm,"deploy_hook_script",t)},expression:"dialogHookForm.deploy_hook_script"}}),n("div",{staticClass:"app-form-explain"},[n("p",[e._v(e._s(e.$t("deploy_hook_script_tips"))+":")]),n("p",[n("i",{staticClass:"iconfont icon-dot"}),n("span",{staticClass:"code"},[e._v("${env_apply_id}")]),e._v(" - 申请单ID")]),n("p",[n("i",{staticClass:"iconfont icon-dot"}),n("span",{staticClass:"code"},[e._v("${env_apply_name}")]),e._v(" - 申请单名称")]),n("p",[n("i",{staticClass:"iconfont icon-dot"}),n("span",{staticClass:"code"},[e._v("${env_deploy_status}")]),e._v(" - 部署状态")])])],1)],1),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{size:"small"},on:{click:function(t){e.dialogHookVisible=!1}}},[e._v(e._s(e.$t("cancel")))]),n("el-button",{attrs:{loading:e.btnLoading,size:"small",type:"primary"},on:{click:e.dialogSubmitHookHandler}},[e._v(e._s(e.$t("enter")))])],1)],1)]),n("el-dialog",{attrs:{width:e.$root.DialogSmallWidth,visible:e.dialogSpaceVisible,title:e.$t("select_project_space")},on:{"update:visible":function(t){e.dialogSpaceVisible=t}}},[n("div",{staticStyle:{"padding-bottom":"50px"}},[n("el-select",{staticStyle:{width:"100%"},attrs:{filterable:"",size:"small",placeholder:e.$t("select_project_space")},on:{change:e.selectSpaceHandler},model:{value:e.spaceId,callback:function(t){e.spaceId=t},expression:"spaceId"}},e._l(e.spaceList,function(t){return n("el-option",{key:t.id,attrs:{value:t.id,label:e.$root.Substr(t.name,50)}})}),1)],1)])],1)},r=[],o=(n("7f7f"),n("ac6a"),n("c5f6"),n("24d2")),l=n("aa22"),a=n("56b3"),s=n.n(a),c=(n("a7be"),n("02f0"),n("0109"),n("4498"),n("1fdb"),{data:function(){return{editorInstance:null,dialogBuildVisible:!1,dialogBuildLoading:!1,dialogBuildForm:{id:0,build_script:""},dialogHookVisible:!1,dialogHookLoading:!1,dialogHookForm:{id:0,build_hook_script:"",deploy_hook_script:""},searchInput:"",tableLoading:!1,tableData:[],dialogViewVisible:!1,dialogViewLoading:!1,dialogViewForm:{},dialogVisible:!1,dialogTitle:"",dialogLoading:!1,dialogForm:{id:0,name:"",description:"",need_audit:0,repo_url:"",repo_branch:"",deploy_mode:0,online_cluster:[],deploy_user:"",deploy_path:"",pre_deploy_cmd:"",after_deploy_cmd:"",audit_notice:"",deploy_notice:"",status:0},btnLoading:!1,dialogSpaceVisible:!1,spaceId:void 0,spaceLoading:!1,spaceDetail:{},spaceList:[],clusterList:[],selectOnlineCluster:void 0}},watch:{spaceId:function(){var e=this;this.spaceId&&(this.spaceLoading=!0,Object(o["e"])({id:this.spaceId}).then(function(t){e.spaceDetail=t,e.spaceLoading=!1}).catch(function(t){e.spaceLoading=!1}),this.$root.PageInit(),this.loadTableData())}},methods:{openHookDialogHandler:function(e){var t=this;this.dialogHookVisible=!0,this.dialogHookLoading=!0,Object(o["d"])({id:e.id}).then(function(e){t.dialogHookForm={id:e.id,build_hook_script:e.build_hook_script,deploy_hook_script:e.deploy_hook_script},t.dialogHookLoading=!1})},dialogSubmitHookHandler:function(){var e=this;Object(o["o"])(this.dialogHookForm).then(function(t){e.$root.MessageSuccess(function(){e.dialogHookVisible=!1})})},dialogSubmitBuildHandler:function(){var e=this;this.dialogBuildForm.build_script=this.getBuildEditorValue(),Object(o["n"])(this.dialogBuildForm).then(function(t){e.$root.MessageSuccess(function(){e.dialogBuildVisible=!1})})},openBuildDialogHandler:function(e){var t=this;this.dialogBuildVisible=!0,this.dialogBuildLoading=!0,Object(o["d"])({id:e.id}).then(function(e){t.dialogBuildForm={id:e.id,build_script:e.build_script},t.dialogBuildLoading=!1,t.$nextTick(function(){t.createBuildEditor(t.dialogBuildForm.build_script)})})},createBuildEditor:function(e){this.editorInstance||(this.editorInstance=s.a.fromTextArea(document.getElementById("editor-textarea"),{theme:"dracula",mode:"shell",tabSize:4,indentUnit:4,lineWrapping:"wrap",lineNumbers:!0,matchBrackets:!0,scrollbarStyle:"simple"})),e||(e=""),this.editorInstance.setValue(e)},getBuildEditorValue:function(){return this.editorInstance?this.editorInstance.getValue():""},openViewDialogHandler:function(e){var t=this;this.dialogViewVisible=!0,this.dialogViewLoading=!0,Object(o["d"])({id:e.id}).then(function(e){t.dialogViewForm=e,t.dialogViewLoading=!1})},deleteHandler:function(e){var t=this;this.$root.ConfirmDelete(function(){Object(o["b"])({id:e.id}).then(function(e){t.$root.MessageSuccess(),t.$root.PageReset(),t.loadTableData()})})},enableSwitchHandler:function(e,t){Object(o["m"])({status:e,id:t.id}).then(function(e){}).catch(function(n){t.status=Number(!e)})},searchHandler:function(){this.$root.PageInit(),this.loadTableData()},openAddDialogHandler:function(){this.dialogVisible=!0,this.dialogTitle=this.$t("add_project")},openEditDialogHandler:function(e){var t=this;this.dialogVisible=!0,this.dialogTitle=this.$t("edit_project"),this.dialogLoading=!0,Object(o["d"])({id:e.id}).then(function(e){t.dialogLoading=!1,t.dialogForm=e}).catch(function(e){t.dialogCloseHandler()})},dialogSubmitHandler:function(){var e=this;this.$refs.dialogRef.validate(function(t){if(!t)return!1;var n;e.btnLoading=!0,n=e.dialogForm.id?o["p"]:o["i"],e.dialogForm.space_id=e.spaceId,n(e.dialogForm).then(function(t){e.$root.MessageSuccess(function(){e.dialogCloseHandler(),e.btnLoading=!1,e.loadTableData()})}).catch(function(t){e.btnLoading=!1})})},dialogCloseHandler:function(){this.dialogVisible=!1,this.dialogLoading=!1,this.btnLoading=!1,this.$refs.dialogRef.resetFields(),this.dialogForm={}},selectClusterHandler:function(e){this.selectOnlineCluster=void 0,e&&(this.dialogForm.online_cluster||(this.dialogForm.online_cluster=[]),-1==this.dialogForm.online_cluster.indexOf(e)&&this.dialogForm.online_cluster.push(e))},removeClusterHandler:function(e){var t=this;this.dialogForm.online_cluster&&this.dialogForm.online_cluster.forEach(function(n,i){n==e&&t.dialogForm.online_cluster.splice(i,1)})},selectSpaceHandler:function(){this.dialogSpaceVisible=!1},switchSpaceHandler:function(){this.dialogSpaceVisible=!0},formatClusterName:function(e){var t="--";return this.clusterList.forEach(function(n){e==n.id&&(t=n.name)}),t},currentChangeHandler:function(){this.loadTableData()},loadTableData:function(){var e=this;this.tableLoading=!0,Object(o["g"])({space_id:this.spaceId,keyword:this.searchInput,offset:this.$root.PageOffset(),limit:this.$root.PageSize}).then(function(t){e.tableData=t.list,e.$root.Total=t.total,e.tableLoading=!1}).catch(function(t){e.tableLoading=!1})},loadSpaceList:function(){var e=this;Object(o["h"])({offset:0,limit:999}).then(function(t){t.list&&(e.spaceList=t.list),e.initSpaceId()})},loadClusterList:function(){var e=this;Object(l["e"])({offset:0,limit:999}).then(function(t){t.list&&(e.clusterList=t.list)})},initSpaceId:function(){this.spaceList.length&&!this.spaceId&&(this.spaceId=this.spaceList[0].id)}},mounted:function(){this.loadSpaceList(),this.loadClusterList()}}),u=c,d=n("2877"),f=Object(d["a"])(u,i,r,!1,null,null,null);f.options.__file="Project.vue";t["default"]=f.exports},"8b97":function(e,t,n){var i=n("d3f4"),r=n("cb7c"),o=function(e,t){if(r(e),!i(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,i){try{i=n("9b43")(Function.call,n("11e9").f(Object.prototype,"__proto__").set,2),i(e,[]),t=!(e instanceof Array)}catch(r){t=!0}return function(e,n){return o(e,n),t?e.__proto__=n:i(e,n),e}}({},!1):void 0),check:o}},9093:function(e,t,n){var i=n("ce10"),r=n("e11e").concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return i(e,r)}},a7be:function(e,t,n){},aa22:function(e,t,n){"use strict";n.d(t,"g",function(){return r}),n.d(t,"e",function(){return o}),n.d(t,"a",function(){return l}),n.d(t,"c",function(){return a}),n.d(t,"i",function(){return s}),n.d(t,"h",function(){return c}),n.d(t,"j",function(){return u}),n.d(t,"f",function(){return d}),n.d(t,"b",function(){return f}),n.d(t,"d",function(){return h});var i=n("ead3");function r(e){return Object(i["b"])("/server/group/add",e)}function o(e){return Object(i["a"])("/server/group/list",e)}function l(e){return Object(i["b"])("/server/group/delete",e)}function a(e){return Object(i["a"])("/server/group/detail",e)}function s(e){return Object(i["b"])("/server/group/update",e)}function c(e){return Object(i["b"])("/server/add",e)}function u(e){return Object(i["b"])("/server/update",e)}function d(e){return Object(i["a"])("/server/list",e)}function f(e){return Object(i["b"])("/server/delete",e)}function h(e){return Object(i["a"])("/server/detail",e)}},aa77:function(e,t,n){var i=n("5ca1"),r=n("be13"),o=n("79e5"),l=n("fdef"),a="["+l+"]",s="​",c=RegExp("^"+a+a+"*"),u=RegExp(a+a+"*$"),d=function(e,t,n){var r={},a=o(function(){return!!l[e]()||s[e]()!=s}),c=r[e]=a?t(f):l[e];n&&(r[n]=c),i(i.P+i.F*a,"String",r)},f=d.trim=function(e,t){return e=String(r(e)),1&t&&(e=e.replace(c,"")),2&t&&(e=e.replace(u,"")),e};e.exports=d},c5f6:function(e,t,n){"use strict";var i=n("7726"),r=n("69a8"),o=n("2d95"),l=n("5dbc"),a=n("6a99"),s=n("79e5"),c=n("9093").f,u=n("11e9").f,d=n("86cc").f,f=n("aa77").trim,h="Number",p=i[h],g=p,m=p.prototype,v=o(n("2aeb")(m))==h,y="trim"in String.prototype,b=function(e){var t=a(e,!1);if("string"==typeof t&&t.length>2){t=y?t.trim():f(t,3);var n,i,r,o=t.charCodeAt(0);if(43===o||45===o){if(n=t.charCodeAt(2),88===n||120===n)return NaN}else if(48===o){switch(t.charCodeAt(1)){case 66:case 98:i=2,r=49;break;case 79:case 111:i=8,r=55;break;default:return+t}for(var l,s=t.slice(2),c=0,u=s.length;c<u;c++)if(l=s.charCodeAt(c),l<48||l>r)return NaN;return parseInt(s,i)}}return+t};if(!p(" 0o1")||!p("0b1")||p("+0x1")){p=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof p&&(v?s(function(){m.valueOf.call(n)}):o(n)!=h)?l(new g(b(t)),n,p):b(t)};for(var w,x=n("9e1e")?c(g):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),C=0;x.length>C;C++)r(g,w=x[C])&&!r(p,w)&&d(p,w,u(g,w));p.prototype=m,m.constructor=p,n("2aba")(i,h,p)}},fdef:function(e,t){e.exports="\t\n\v\f\r   ᠎             　\u2028\u2029\ufeff"}}]);
  //# sourceMappingURL=chunk-8a44c3e0.5374e90e.js.map