User:RyaNayR/Code/codemirror.js

window.CodeMirror=function{"use strict";function y(a,c){if(!(this instanceof y))return new y(a,c);this.options=c=c||{};for(var d in cd)!c.hasOwnProperty(d)&&cd.hasOwnProperty(d)&&(c[d]=cd[d]);L(c);var e="string"==typeof c.value?0:c.value.first,f=this.display=z(a,e);f.wrapper.CodeMirror=this,I(this),c.autofocus&&!q&&Pb(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new ff},G(this),c.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var g=c.value;"string"==typeof g&&(g=new qe(c.value,c.mode)),Hb(this,ue)(this,g),b&&setTimeout(qf(Ob,this,!0),20),Rb(this);var h;try{h=document.activeElement==f.input}catch(i){}h||c.autofocus&&!q?setTimeout(qf(oc,this),20):pc(this),Hb(this,function{for(var a in bd)bd.propertyIsEnumerable(a)&&bd[a](this,c[a],ed);for(var b=0;b<id.length;++b)id[b](this)})}function z(a,b){var d={},e=d.input=wf("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");return g?e.style.width="1000px":e.setAttribute("wrap","off"),p&&(e.style.border="1px solid black"),e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false"),d.inputDiv=wf("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),d.scrollbarH=wf("div",[wf("div",null,null,"height: 1px")],"CodeMirror-hscrollbar"),d.scrollbarV=wf("div",[wf("div",null,null,"width: 1px")],"CodeMirror-vscrollbar"),d.scrollbarFiller=wf("div",null,"CodeMirror-scrollbar-filler"),d.gutterFiller=wf("div",null,"CodeMirror-gutter-filler"),d.lineDiv=wf("div",null,"CodeMirror-code"),d.selectionDiv=wf("div",null,null,"position: relative; z-index: 1"),d.cursor=wf("div","\xa0","CodeMirror-cursor"),d.otherCursor=wf("div","\xa0","CodeMirror-cursor CodeMirror-secondarycursor"),d.measure=wf("div",null,"CodeMirror-measure"),d.lineSpace=wf("div",[d.measure,d.selectionDiv,d.lineDiv,d.cursor,d.otherCursor],null,"position: relative; outline: none"),d.mover=wf("div",[wf("div",[d.lineSpace],"CodeMirror-lines")],null,"position: relative"),d.sizer=wf("div",[d.mover],"CodeMirror-sizer"),d.heightForcer=wf("div",null,null,"position: absolute; height: "+df+"px; width: 1px;"),d.gutters=wf("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=wf("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=wf("div",[d.inputDiv,d.scrollbarH,d.scrollbarV,d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),c&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),a.appendChild?a.appendChild(d.wrapper):a(d.wrapper),p&&(e.style.width="0px"),g||(d.scroller.draggable=!0),l?(d.inputDiv.style.height="1px",d.inputDiv.style.position="absolute"):c&&(d.scrollbarH.style.minWidth=d.scrollbarV.style.minWidth="18px"),d.viewOffset=d.lastSizeC=0,d.showingFrom=d.showingTo=b,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.prevInput="",d.alignWidgets=!1,d.pollingFast=!1,d.poll=new ff,d.cachedCharWidth=d.cachedTextHeight=null,d.measureLineCache=[],d.measureLineCachePos=0,d.inaccurateSelection=!1,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d}function A(a){a.doc.mode=y.getMode(a.options,a.doc.modeOption),B(a)}function B(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,db(a,100),a.state.modeGen++,a.curOp&&Kb(a)}function C(a){a.options.lineWrapping?(a.display.wrapper.className+=" CodeMirror-wrap",a.display.sizer.style.minWidth=""):(a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-wrap",""),K(a)),E(a),Kb(a),rb(a),setTimeout(function{M(a)},100)}function D(a){var b=Cb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/Db(a.display)-3);return function(e){return Pd(a.doc,e)?0:c?(Math.ceil(e.text.length/d)||1)*b:b}}function E(a){var b=a.doc,c=D(a);b.iter(function(a){var b=c(a);b!=a.height&&ye(a,b)})}function F(a){var b=nd[a.options.keyMap],c=b.style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(c?" cm-keymap-"+c:"")}function G(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),rb(a)}function H(a){I(a),Kb(a),setTimeout(function{O(a)},20)}function I(a){var b=a.display.gutters,c=a.options.gutters;xf(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(wf("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none"}function J(a,b){if(0==b.height)return 0;for(var d,c=b.text.length,e=b;d=Ld(e);){var f=d.find;e=ve(a,f.from.line),c+=f.from.ch-f.to.ch}for(e=b;d=Md(e);){var f=d.find;c-=e.text.length-f.from.ch,e=ve(a,f.to.line),c+=e.text.length-f.to.ch}return c}function K(a){var b=a.display,c=a.doc;b.maxLine=ve(c,c.first),b.maxLineLength=J(c,b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var d=J(c,a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function L(a){var b=mf(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function M(a){var b=a.display,c=a.doc.height,d=c+ib(b);b.sizer.style.minHeight=b.heightForcer.style.top=d+"px",b.gutters.style.height=Math.max(d,b.scroller.clientHeight-df)+"px";var e=Math.max(d,b.scroller.scrollHeight),f=b.scroller.scrollWidth>b.scroller.clientWidth+1,g=e>b.scroller.clientHeight+1;g?(b.scrollbarV.style.display="block",b.scrollbarV.style.bottom=f?Ef(b.measure)+"px":"0",b.scrollbarV.firstChild.style.height=e-b.scroller.clientHeight+b.scrollbarV.clientHeight+"px"):(b.scrollbarV.style.display="",b.scrollbarV.firstChild.style.height="0"),f?(b.scrollbarH.style.display="block",b.scrollbarH.style.right=g?Ef(b.measure)+"px":"0",b.scrollbarH.firstChild.style.width=b.scroller.scrollWidth-b.scroller.clientWidth+b.scrollbarH.clientWidth+"px"):(b.scrollbarH.style.display="",b.scrollbarH.firstChild.style.width="0"),f&&g?(b.scrollbarFiller.style.display="block",b.scrollbarFiller.style.height=b.scrollbarFiller.style.width=Ef(b.measure)+"px"):b.scrollbarFiller.style.display="",f&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(b.gutterFiller.style.display="block",b.gutterFiller.style.height=Ef(b.measure)+"px",b.gutterFiller.style.width=b.gutters.offsetWidth+"px"):b.gutterFiller.style.display="",m&&0===Ef(b.measure)&&(b.scrollbarV.style.minWidth=b.scrollbarH.style.minHeight=n?"18px":"12px",b.scrollbarV.style.pointerEvents=b.scrollbarH.style.pointerEvents="none")}function N(a,b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;"number"==typeof c?d=c:c&&(d=c.top,e=c.bottom-c.top),d=Math.floor(d-hb(a));var f=Math.ceil(d+e);return{from:Ae(b,d),to:Ae(b,f)}}function O(a){var b=a.display;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var c=R(b)-b.scroller.scrollLeft+a.doc.scrollLeft,d=b.gutters.offsetWidth,e=c+"px",f=b.lineDiv.firstChild;f;f=f.nextSibling)if(f.alignable)for(var g=0,h=f.alignable;g<h.length;++g)h[g].style.left=e;a.options.fixedGutter&&(b.gutters.style.left=c+d+"px")}}function P(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=Q(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(wf("div",[wf("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),f=e.firstChild.offsetWidth,g=e.offsetWidth-f;return d.lineGutter.style.width="",d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-g),d.lineNumWidth=d.lineNumInnerWidth+g,d.lineNumChars=d.lineNumInnerWidth?c.length:-1,d.lineGutter.style.width=d.lineNumWidth+"px",!0}return!1}function Q(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function R(a){return Af(a.scroller).left-Af(a.sizer).left}function S(a,b,c,d){for(var g,e=a.display.showingFrom,f=a.display.showingTo,h=N(a.display,a.doc,c),i=!0;;i=!1){var j=a.display.scroller.clientWidth;if(!T(a,b,h,d))break;if(g=!0,b=[],_(a),M(a),i&&a.options.lineWrapping&&j!=a.display.scroller.clientWidth)d=!0;else if(d=!1,c&&(c=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,"number"==typeof c?c:c.top)),h=N(a.display,a.doc,c),h.from>=a.display.showingFrom&&h.to<=a.display.showingTo)break}return g&&($e(a,"update",a),(a.display.showingFrom!=e||a.display.showingTo!=f)&&$e(a,"viewportChange",a,a.display.showingFrom,a.display.showingTo)),g}function T(a,b,c,d){var e=a.display,f=a.doc;if(!e.wrapper.offsetWidth)return e.showingFrom=e.showingTo=f.first,e.viewOffset=0,void 0;if(!(!d&&0==b.length&&c.from>e.showingFrom&&c.tol&&e.showingTo-l<20&&(l=Math.min(j,e.showingTo)),x)for(k=ze(Od(f,ve(f,k)));j>l&&Pd(f,ve(f,l));)++l;var m=[{from:Math.max(e.showingFrom,f.first),to:Math.min(e.showingTo,j)}];if(m=m[0].from>=m[0].to?[]:W(m,b),x)for(var i=0;in.from)){m.splice(i--,1);break}n.to=p}for(var q=0,i=0;il&&(n.to=l),n.from>=n.to?m.splice(i--,1):q+=n.to-n.from}if(!d&&q==l-k&&k==e.showingFrom&&l==e.showingTo)return V(a),void 0;m.sort(function(a,b){return a.from-b.from});try{var r=document.activeElement}catch(s){}.7*(l-k)>q&&(e.lineDiv.style.display="none"),Y(a,k,l,m,h),e.lineDiv.style.display="",r&&document.activeElement!=r&&r.offsetHeight&&r.focus;var t=k!=e.showingFrom||l!=e.showingTo||e.lastSizeC!=e.wrapper.clientHeight;return t&&(e.lastSizeC=e.wrapper.clientHeight,db(a,400)),e.showingFrom=k,e.showingTo=l,e.gutters.style.height="",U(a),V(a),!0}}function U(a){for(var f,b=a.display,d=b.lineDiv.offsetTop,e=b.lineDiv.firstChild;e;e=e.nextSibling)if(e.lineObj){if(c){var g=e.offsetTop+e.offsetHeight;f=g-d,d=g}else{var h=Af(e);f=h.bottom-h.top}var i=e.lineObj.height-f;if(2>f&&(f=Cb(b)),i>.001||-.001>i){ye(e.lineObj,f);var j=e.lineObj.widgets;if(j)for(var k=0;kc;++c){for(var e=b[c],f=[],g=e.diff||0,h=0,i=a.length;i>h;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g}))}a=f}return a}function X(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:R(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function Y(a,b,c,d,e){function l(b){var c=b.nextSibling;return g&&r&&a.display.currentWheelTarget==b?(b.style.display="none",b.lineObj=null):b.parentNode.removeChild(b),c}var f=X(a),h=a.display,i=a.options.lineNumbers;d.length||g&&a.display.currentWheelTarget||xf(h.lineDiv);var j=h.lineDiv,k=j.firstChild,m=d.shift,n=b;for(a.doc.iter(b,c,function(b){if(m&&m.to==n&&(m=d.shift),Pd(a.doc,b)){if(0!=b.height&&ye(b,0),b.widgets&&k&&k.previousSibling)for(var c=0;cn){for(k.lineObj!=b;)k=l(k);i&&n>=e&&k.lineNumber&&zf(k.lineNumber,Q(a.options,n)),k=k.nextSibling}else{if(b.widgets)for(var s,q=0,r=k;r&&20>q;++q,r=r.nextSibling)if(r.lineObj==b&&/div/i.test(r.nodeName)){s=r;break}var t=Z(a,b,n,f,s);if(t!=s)j.insertBefore(t,k);else{for(k!=s;)k=l(k);k=k.nextSibling}t.lineObj=b}++n});k;)k=l(k)}function Z(a,b,d,e,f){var k,g=fe(a,b),h=g.pre,i=b.gutterMarkers,j=a.display,l=g.bgClass?g.bgClass+" "+(b.bgClass||""):b.bgClass;if(!(a.options.lineNumbers||i||l||b.wrapClass||b.widgets))return h;if(f){f.alignable=null;for(var q,m=!0,n=0,o=null,p=f.firstChild;p;p=q)if(q=p.nextSibling,/\bCodeMirror-linewidget\b/.test(p.className)){for(var r=0;r<b.widgets.length;++r){var s=b.widgets[r];if(s.node==p.firstChild){s.above||o||(o=p),$(s,p,f,e),++n;break}}if(r==b.widgets.length){m=!1;break}}else f.removeChild(p);f.insertBefore(h,o),m&&n==b.widgets.length&&(k=f,f.className=b.wrapClass||"")}if(k||(k=wf("div",null,b.wrapClass,"position: relative"),k.appendChild(h)),l&&k.insertBefore(wf("div",null,l+" CodeMirror-linebackground"),k.firstChild),a.options.lineNumbers||i){var t=k.insertBefore(wf("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(a.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+"px"),h);if(a.options.fixedGutter&&(k.alignable||(k.alignable=[])).push(t),!a.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(k.lineNumber=t.appendChild(wf("div",Q(a.options,d),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+e.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+j.lineNumInnerWidth+"px"))),i)for(var u=0;u<a.options.gutters.length;++u){var v=a.options.gutters[u],w=i.hasOwnProperty(v)&&i[v];w&&t.appendChild(wf("div",[w],"CodeMirror-gutter-elt","left: "+e.gutterLeft[v]+"px; width: "+e.gutterWidth[v]+"px"))}}if(c&&(k.style.zIndex=2),b.widgets&&k!=f)for(var r=0,x=b.widgets;r<x.length;++r){var s=x[r],y=wf("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||(y.ignoreEvents=!0),$(s,y,k,e),s.above?k.insertBefore(y,a.options.lineNumbers&&0!=b.height?t:h):k.appendChild(y),$e(s,"redraw")}return k}function $(a,b,c,d){if(a.noHScroll){(c.alignable||(c.alignable=[])).push(b);var e=d.wrapperWidth;b.style.left=d.fixedPos+"px",a.coverGutter||(e-=d.gutterTotalWidth,b.style.paddingLeft=d.gutterTotalWidth+"px"),b.style.width=e+"px"}a.coverGutter&&(b.style.zIndex=5,b.style.position="relative",a.noHScroll||(b.style.marginLeft=-d.gutterTotalWidth+"px"))}function _(a){var b=a.display,c=Ec(a.doc.sel.from,a.doc.sel.to);if(c||a.options.showCursorWhenSelecting?ab(a):b.cursor.style.display=b.otherCursor.style.display="none",c?b.selectionDiv.style.display="none":bb(a),a.options.moveInputWithCursor){var d=xb(a,a.doc.sel.head,"div"),e=Af(b.wrapper),f=Af(b.lineDiv);b.inputDiv.style.top=Math.max(0,Math.min(b.wrapper.clientHeight-10,d.top+f.top-e.top))+"px",b.inputDiv.style.left=Math.max(0,Math.min(b.wrapper.clientWidth-10,d.left+f.left-e.left))+"px"}}function ab(a){var b=a.display,c=xb(a,a.doc.sel.head,"div");b.cursor.style.left=c.left+"px",b.cursor.style.top=c.top+"px",b.cursor.style.height=Math.max(0,c.bottom-c.top)*a.options.cursorHeight+"px",b.cursor.style.display="",c.other?(b.otherCursor.style.display="",b.otherCursor.style.left=c.other.left+"px",b.otherCursor.style.top=c.other.top+"px",b.otherCursor.style.height=.85*(c.other.bottom-c.other.top)+"px"):b.otherCursor.style.display="none"}function bb(a){function h(a,b,c,d){0>b&&(b=0),e.appendChild(wf("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?f-a:c)+"px; height: "+(d-b)+"px"))}function i(b,d,e){function m(c,d){return wb(a,Dc(b,c),"div",i,d)}var k,l,i=ve(c,b),j=i.text.length;return Lf(Ce(i),d||0,null==e?j:e,function(a,b,c){var n,o,p,i=m(a,"left");if(a==b)n=i,o=p=i.left;else{if(n=m(b-1,"right"),"rtl"==c){var q=i;i=n,n=q}o=i.left,p=n.right}null==d&&0==a&&(o=g),n.top-i.top>3&&(h(o,i.top,null,i.bottom),o=g,i.bottoml.bottom||n.bottom==l.bottom&&n.right>l.right)&&(l=n),g+1>o&&(o=g),h(o,n.top,p-o,n.bottom)}),{start:k,end:l}}var b=a.display,c=a.doc,d=a.doc.sel,e=document.createDocumentFragment,f=b.lineSpace.offsetWidth,g=jb(a.display);if(d.from.line==d.to.line)i(d.from.line,d.from.ch,d.to.ch);else{var j=ve(c,d.from.line),k=ve(c,d.to.line),l=Od(c,j)==Od(c,k),m=i(d.from.line,d.from.ch,l?j.text.length:null).end,n=i(d.to.line,l?0:null,d.to.ch).start;l&&(m.top0&&(b.blinker=setInterval(function{b.cursor.style.visibility=b.otherCursor.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate))}}function db(a,b){a.doc.mode.startState&&a.doc.frontier=a.display.showingTo)){var f,c=+new Date+a.options.workTime,d=kd(b.mode,gb(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.showingTo+500),function(g){if(b.frontier>=a.display.showingFrom){var h=g.styles;g.styles=_d(a,g,d,!0);for(var i=!h||h.length!=g.styles.length,j=0;!i&&jc?(db(a,a.options.workDelay),!0):void 0}),e.length&&Hb(a,function{for(var a=0;ag;--h){if(h<=f.first)return f.first;var i=ve(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=gf(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function gb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=fb(a,b,c),g=f>d.first&&ve(d,f-1).stateAfter;return g=g?kd(d.mode,g):ld(d.mode),d.iter(f,b,function(c){be(a,c.text,g);var h=f==b-1||0==f%5||f>=e.showingFrom&&ff&&0==h&&(f=1)}return e=h>c?"left":c>h?"right":e,"left"==e&&i.leftSide?i=i.leftSide:"right"==e&&i.rightSide&&(i=i.rightSide),{left:c>h?i.right:i.left,right:h>c?i.left:i.right,top:i.top,bottom:i.bottom}}function lb(a,b){for(var c=a.display.measureLineCache,d=0;d<c.length;++d){var e=c[d];if(e.text==b.text&&e.markedSpans==b.markedSpans&&a.display.scroller.clientWidth==e.width&&e.classes==b.textClass+"|"+b.wrapClass)return e}}function mb(a,b){var c=lb(a,b);c&&(c.text=c.measure=c.markedSpans=null)}function nb(a,b){var c=lb(a,b);if(c)return c.measure;var d=ob(a,b),e=a.display.measureLineCache,f={text:b.text,width:a.display.scroller.clientWidth,markedSpans:b.markedSpans,measure:d,classes:b.textClass+"|"+b.wrapClass};return 16==e.length?e[++a.display.measureLineCachePos%16]=f:e.push(f),d}function ob(a,e){function t(a){var b=a.top-p.top,c=a.bottom-p.top;c>s&&(c=s),0>b&&(b=0);for(var d=q.length-2;d>=0;d-=2){var e=q[d],f=q[d+1];if(!(e>c||b>f)&&(b>=e&&f>=c||e>=b&&c>=f||Math.min(c,f)-Math.max(b,e)>=c-b>>1)){q[d]=Math.min(b,e),q[d+1]=Math.max(c,f);break}}return 0>d&&(d=q.length,q.push(b,c)),{left:a.left-p.left,right:a.right-p.left,top:d,bottom:null}}function u(a){a.bottom=q[a.top+1],a.top=q[a.top]}if(!a.options.lineWrapping&&e.text.length>=a.options.crudeMeasuringFrom)return pb(a,e);var f=a.display,g=pf(e.text.length),h=fe(a,e,g,!0).pre;if(b&&!c&&!a.options.lineWrapping&&h.childNodes.length>100){for(var i=document.createDocumentFragment,j=10,k=h.childNodes.length,l=0,m=Math.ceil(k/j);m>l;++l){for(var n=wf("div",null,null,"display: inline-block"),o=0;j>o&&k;++o)n.appendChild(h.firstChild),--k;i.appendChild(n)}h.appendChild(i)}yf(f.measure,h);var p=Af(f.lineDiv),q=[],r=pf(e.text.length),s=h.offsetHeight;d&&f.measure.first!=h&&yf(f.measure,h);for(var v,l=0;l1&&(x=r[l]=t(y[0]),x.rightSide=t(y[y.length-1]))}x||(x=r[l]=t(Af(w))),v.measureRight&&(x.right=Af(v.measureRight).left-p.left),v.leftSide&&(x.leftSide=t(Af(v.leftSide)))}xf(a.display.measure);for(var v,l=0;l<r.length;++l)(v=r[l])&&(u(v),v.leftSide&&u(v.leftSide),v.rightSide&&u(v.rightSide));return r}function pb(a,b){var c=new Xd(b.text.slice(0,100),null);b.textClass&&(c.textClass=b.textClass);var d=ob(a,c),e=kb(a,c,0,d,"left"),f=kb(a,c,99,d,"right");return{crude:!0,top:e.top,left:e.left,bottom:e.bottom,width:(f.right-e.left)/100}}function qb(a,b){var c=!1;if(b.markedSpans)for(var d=0;d=a.options.crudeMeasuringFrom)return kb(a,b,b.text.length,f&&f.measure,"right").right;var g=fe(a,b,null,!0).pre,h=g.appendChild(Gf(a.display.measure));return yf(a.display.measure,g),Af(h).right-Af(a.display.lineDiv).left}function rb(a){a.display.measureLineCache.length=a.display.measureLineCachePos=0,a.display.cachedCharWidth=a.display.cachedTextHeight=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function sb{return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function tb{return window.pageYOffset||(document.documentElement||document.body).scrollTop}function ub(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Vd(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=Be(a,b);if("local"==d?g+=hb(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=Af(a.display.lineSpace);g+=h.top+("window"==d?0:tb);var i=h.left+("window"==d?0:sb);c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function vb(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=sb,e-=tb;else if("local"==c||!c){var f=Af(a.display.sizer);d+=f.left,e+=f.top}var g=Af(a.display.lineSpace);return{left:d-g.left,top:e-g.top}}function wb(a,b,c,d,e){return d||(d=ve(a.doc,b.line)),ub(a,d,kb(a,d,b.ch,null,e),c)}function xb(a,b,c,d,e){function f(b,f){var g=kb(a,d,b,e,f?"right":"left");return f?g.left=g.right:g.right=g.left,ub(a,d,g,c)}function g(a,b){var c=h[b],d=c.level%2;return a==Mf(c)&&b&&c.levelc.from?f(a-1):f(a,d)}d=d||ve(a.doc,b.line),e||(e=nb(a,d));var h=Ce(d),i=b.ch;if(!h)return f(i);var j=Uf(h,i),k=g(i,j);return null!=Tf&&(k.other=g(i,Tf)),k}function yb(a,b,c,d){var e=new Dc(a,b);return e.xRel=d,c&&(e.outside=!0),e}function zb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return yb(d.first,0,!0,-1);var e=Ae(d,c),f=d.first+d.size-1;if(e>f)return yb(d.first+d.size-1,ve(d,f).text.length,!0,1);for(0>b&&(b=0);;){var g=ve(d,e),h=Ab(a,g,e,b,c),i=Md(g),j=i&&i.find;if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=j.to.line}}function Ab(a,b,c,d,e){function j(d){var e=xb(a,Dc(c,d),"line",b,i);return g=!0,f>e.bottom?e.left-h:fq)return yb(c,n,r,1);for{if(k?n==m||n==Wf(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);vf(b.text.charAt(s));)++s;var u=yb(c,s,s==m?p:r,0>t?-1:t?1:0);return u}var v=Math.ceil(l/2),w=m+v;if(k){w=m;for(var x=0;v>x;++x)w=Wf(b,w,1)}var y=j(w);y>d?(n=w,q=y,(r=g)&&(q+=1e3),l=v):(m=w,o=y,p=g,l-=v)}}function Cb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Bb){Bb=wf("pre");for(var b=0;49>b;++b)Bb.appendChild(document.createTextNode("x")),Bb.appendChild(wf("br"));Bb.appendChild(document.createTextNode("x"))}yf(a.measure,Bb);var c=Bb.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),xf(a.measure),c||1}function Db(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=wf("span","x"),c=wf("pre",[b]);yf(a.measure,c);var d=b.offsetWidth;return d>2&&(a.cachedCharWidth=d),d||10}function Fb(a){a.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Eb},Ze++||(Ye=[])}function Gb(a){var b=a.curOp,c=a.doc,d=a.display;if(a.curOp=null,b.updateMaxLine&&K(a),d.maxLineChanged&&!a.options.lineWrapping&&d.maxLine){var e=qb(a,d.maxLine);d.sizer.style.minWidth=Math.max(0,e+3+df)+"px",d.maxLineChanged=!1;var f=Math.max(0,d.sizer.offsetLeft+d.sizer.offsetWidth-d.scroller.clientWidth);f<c.scrollLeft&&!b.updateScrollPos&&cc(a,Math.min(d.scroller.scrollLeft,f),!0)}var g,h;if(b.updateScrollPos)g=b.updateScrollPos;else if(b.selectionChanged&&d.scroller.clientHeight){var i=xb(a,c.sel.head);g=Uc(a,i.left,i.top,i.left,i.bottom)}if((b.changes.length||b.forceUpdate||g&&null!=g.scrollTop)&&(h=S(a,b.changes,g&&g.scrollTop,b.forceUpdate),a.display.scroller.offsetHeight&&(a.doc.scrollTop=a.display.scroller.scrollTop)),!h&&b.selectionChanged&&_(a),b.updateScrollPos){var j=Math.max(0,Math.min(d.scroller.scrollHeight-d.scroller.clientHeight,g.scrollTop)),k=Math.max(0,Math.min(d.scroller.scrollWidth-d.scroller.clientWidth,g.scrollLeft));d.scroller.scrollTop=d.scrollbarV.scrollTop=c.scrollTop=j,d.scroller.scrollLeft=d.scrollbarH.scrollLeft=c.scrollLeft=k,O(a),b.scrollToPos&&Sc(a,Jc(a.doc,b.scrollToPos.from),Jc(a.doc,b.scrollToPos.to),b.scrollToPos.margin)}else g&&Rc(a);b.selectionChanged&&cb(a),a.state.focused&&b.updateInput&&Ob(a,b.userSelChange);var l=b.maybeHiddenMarkers,m=b.maybeUnhiddenMarkers;if(l)for(var n=0;n<l.length;++n)l[n].lines.length||Xe(l[n],"hide");if(m)for(var n=0;n<m.length;++n)m[n].lines.length&&Xe(m[n],"unhide");var o;if(--Ze||(o=Ye,Ye=null),b.textChanged&&Xe(a,"change",a,b.textChanged),b.cursorActivity&&Xe(a,"cursorActivity",a),o)for(var n=0;n<o.length;++n)o[n]}function Hb(a,b){return function{var c=a||this,d=!c.curOp;d&&Fb(c);try{var e=b.apply(c,arguments)}finally{d&&Gb(c)}return e}}function Ib(a){return function{var c,b=this.cm&&!this.cm.curOp;b&&Fb(this.cm);try{c=a.apply(this,arguments)}finally{b&&Gb(this.cm)}return c}}function Jb(a,b){var d,c=!a.curOp;c&&Fb(a);try{d=b}finally{c&&Gb(a)}return d}function Kb(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),a.curOp.changes.push({from:b,to:c,diff:d})}function Lb(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function{Nb(a),a.state.focused&&Lb(a)})}function Mb(a){function c{var d=Nb(a);d||b?(a.display.pollingFast=!1,Lb(a)):(b=!0,a.display.poll.set(60,c))}var b=!1;a.display.pollingFast=!0,a.display.poll.set(20,c)}function Nb(a){var b=a.display.input,c=a.display.prevInput,e=a.doc,g=e.sel;if(!a.state.focused||If(b)||Qb(a)||a.options.disableInput)return!1;a.state.pasteIncoming&&a.state.fakedLastChar&&(b.value=b.value.substring(0,b.value.length-1),a.state.fakedLastChar=!1);var h=b.value;if(h==c&&Ec(g.from,g.to))return!1;if(f&&!d&&a.display.inputHasSelection===h)return Ob(a,!0),!1;var i=!a.curOp;i&&Fb(a),g.shift=!1;for(var j=0,k=Math.min(c.length,h.length);k>j&&c.charCodeAt(j)==h.charCodeAt(j);)++j;var l=g.from,m=g.to,n=h.slice(j);j<c.length?l=Dc(l.line,l.ch-(c.length-j)):a.state.overwrite&&Ec(l,m)&&!a.state.pasteIncoming&&(m=Dc(m.line,Math.min(ve(e,m.line).text.length,m.ch+n.length)));var o=a.curOp.updateInput,p={from:l,to:m,text:Hf(n),origin:a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input"};if(wc(a.doc,p,"end"),a.curOp.updateInput=o,$e(a,"inputRead",a,p),n&&!a.state.pasteIncoming&&a.options.electricChars&&a.options.smartIndent&&g.head.ch<100){var q=a.getModeAt(g.head).electricChars;if(q)for(var r=0;r-1){Xc(a,g.head.line,"smart");break}}return h.length>1e3||h.indexOf("\n")>-1?b.value=a.display.prevInput="":a.display.prevInput=h,i&&Gb(a),a.state.pasteIncoming=a.state.cutIncoming=!1,!0}function Ob(a,b){var c,e,g=a.doc;if(Ec(g.sel.from,g.sel.to))b&&(a.display.prevInput=a.display.input.value="",f&&!d&&(a.display.inputHasSelection=null));else{a.display.prevInput="",c=Jf&&(g.sel.to.line-g.sel.from.line>100||(e=a.getSelection).length>1e3);var h=c?"-":e||a.getSelection;a.display.input.value=h,a.state.focused&&lf(a.display.input),f&&!d&&(a.display.inputHasSelection=h)}a.display.inaccurateSelection=c}function Pb(a){"nocursor"==a.options.readOnly||q&&document.activeElement==a.display.input||a.display.input.focus}function Qb(a){return a.options.readOnly||a.doc.cantEdit}function Rb(a){function e{a.state.focused&&setTimeout(qf(Pb,a),0)}function i{null==h&&(h=setTimeout(function{h=null,c.cachedCharWidth=c.cachedTextHeight=Df=null,rb(a),Jb(a,qf(Kb,a))},100))}function j{for(var a=c.wrapper.parentNode;a&&a!=document.body;a=a.parentNode);a?setTimeout(j,5e3):We(window,"resize",i)}function k(b){_e(a,b)||a.options.onDragEvent&&a.options.onDragEvent(a,Oe(b))||Se(b)}function m(b){c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,c.input.value=a.getSelection,lf(c.input)),"cut"==b.type&&(a.state.cutIncoming=!0)}var c=a.display;Ve(c.scroller,"mousedown",Hb(a,Wb)),b?Ve(c.scroller,"dblclick",Hb(a,function(b){if(!_e(a,b)){var c=Tb(a,b);if(c&&!Zb(a,b)&&!Sb(a.display,b)){Pe(b);var d=_c(ve(a.doc,c.line).text,c);Mc(a.doc,d.from,d.to)}}})):Ve(c.scroller,"dblclick",function(b){_e(a,b)||Pe(b)}),Ve(c.lineSpace,"selectstart",function(a){Sb(c,a)||Pe(a)}),v||Ve(c.scroller,"contextmenu",function(b){rc(a,b)}),Ve(c.scroller,"scroll",function{c.scroller.clientHeight&&(bc(a,c.scroller.scrollTop),cc(a,c.scroller.scrollLeft,!0),Xe(a,"scroll",a))}),Ve(c.scrollbarV,"scroll",function{c.scroller.clientHeight&&bc(a,c.scrollbarV.scrollTop)}),Ve(c.scrollbarH,"scroll",function{c.scroller.clientHeight&&cc(a,c.scrollbarH.scrollLeft)}),Ve(c.scroller,"mousewheel",function(b){fc(a,b)}),Ve(c.scroller,"DOMMouseScroll",function(b){fc(a,b)}),Ve(c.scrollbarH,"mousedown",e),Ve(c.scrollbarV,"mousedown",e),Ve(c.wrapper,"scroll",function{c.wrapper.scrollTop=c.wrapper.scrollLeft=0});var h;Ve(window,"resize",i),setTimeout(j,5e3),Ve(c.input,"keyup",Hb(a,function(b){_e(a,b)||a.options.onKeyEvent&&a.options.onKeyEvent(a,Oe(b))||16==b.keyCode&&(a.doc.sel.shift=!1)})),Ve(c.input,"input",function{f&&!d&&a.display.inputHasSelection&&(a.display.inputHasSelection=null),Mb(a)}),Ve(c.input,"keydown",Hb(a,mc)),Ve(c.input,"keypress",Hb(a,nc)),Ve(c.input,"focus",qf(oc,a)),Ve(c.input,"blur",qf(pc,a)),a.options.dragDrop&&(Ve(c.scroller,"dragstart",function(b){ac(a,b)}),Ve(c.scroller,"dragenter",k),Ve(c.scroller,"dragover",k),Ve(c.scroller,"drop",Hb(a,_b))),Ve(c.scroller,"paste",function(b){Sb(c,b)||(Pb(a),Mb(a))}),Ve(c.input,"paste",function{if(g&&!a.state.fakedLastChar&&!(new Date-a.state.lastMiddleDown<200)){var b=c.input.selectionStart,d=c.input.selectionEnd;c.input.value+="$",c.input.selectionStart=b,c.input.selectionEnd=d,a.state.fakedLastChar=!0}a.state.pasteIncoming=!0,Mb(a)}),Ve(c.input,"cut",m),Ve(c.input,"copy",m),l&&Ve(c.sizer,"mouseup",function{document.activeElement==c.input&&c.input.blur,Pb(a)})}function Sb(a,b){for(var c=Te(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0 }function Tb(a,b,c){var d=a.display;if(!c){var e=Te(b);if(e==d.scrollbarH||e==d.scrollbarH.firstChild||e==d.scrollbarV||e==d.scrollbarV.firstChild||e==d.scrollbarFiller||e==d.gutterFiller)return null}var f,g,h=Af(d.lineSpace);try{f=b.clientX,g=b.clientY}catch(b){return null}return zb(a,f-h.left,g-h.top)}function Wb(a){function r(a){if(!Ec(q,a)){if(q=a,"single"==k)return Mc(c.doc,Jc(f,i),a),void 0;if(o=Jc(f,o),p=Jc(f,p),"double"==k){var b=_c(ve(f,a.line).text,a);Fc(a,o)?Mc(c.doc,b.from,p):Mc(c.doc,o,b.to)}else"triple"==k&&(Fc(a,o)?Mc(c.doc,p,Jc(f,Dc(a.line,0))):Mc(c.doc,o,Jc(f,Dc(a.line+1,0))))}}function u(a){var b=++t,d=Tb(c,a,!0);if(d)if(Ec(d,m)){var h=a.clientY<s.top?-20:a.clientY>s.bottom?20:0;h&&setTimeout(Hb(c,function{t==b&&(e.scroller.scrollTop+=h,u(a))}),50)}else{c.state.focused||oc(c),m=d,r(d);var g=N(e,f);(d.line>=g.to||d.line<g.from)&&setTimeout(Hb(c,function{t==b&&u(a)}),150)}}function w(a){t=1/0,Pe(a),Pb(c),We(document,"mousemove",x),We(document,"mouseup",y)}if(!_e(this,a)){var c=this,e=c.display,f=c.doc,h=f.sel;if(h.shift=a.shiftKey,Sb(e,a))return g||(e.scroller.draggable=!1,setTimeout(function{e.scroller.draggable=!0},100)),void 0;if(!Zb(c,a)){var i=Tb(c,a);switch(Ue(a)){case 3:return v&&rc.call(c,c,a),void 0;case 2:return g&&(c.state.lastMiddleDown=+new Date),i&&Mc(c.doc,i),setTimeout(qf(Pb,c),20),Pe(a),void 0}if(!i)return Te(a)==e.scroller&&Pe(a),void 0;c.state.focused||oc(c);var j=+new Date,k="single";if(Vb&&Vb.time>j-400&&Ec(Vb.pos,i))k="triple",Pe(a),setTimeout(qf(Pb,c),20),ad(c,i.line);else if(Ub&&Ub.time>j-400&&Ec(Ub.pos,i)){k="double",Vb={time:j,pos:i},Pe(a);var l=_c(ve(f,i.line).text,i);Mc(c.doc,l.from,l.to)}else Ub={time:j,pos:i};var m=i;if(c.options.dragDrop&&Bf&&!Qb(c)&&!Ec(h.from,h.to)&&!Fc(i,h.from)&&!Fc(h.to,i)&&"single"==k){var n=Hb(c,function(f){g&&(e.scroller.draggable=!1),c.state.draggingText=!1,We(document,"mouseup",n),We(e.scroller,"drop",n),Math.abs(a.clientX-f.clientX)+Math.abs(a.clientY-f.clientY)<10&&(Pe(f),Mc(c.doc,i),Pb(c),b&&!d&&setTimeout(function{document.body.focus,Pb(c)},20))});return g&&(e.scroller.draggable=!0),c.state.draggingText=n,e.scroller.dragDrop&&e.scroller.dragDrop,Ve(document,"mouseup",n),Ve(e.scroller,"drop",n),void 0}Pe(a),"single"==k&&Mc(c.doc,Jc(f,i));var o=h.from,p=h.to,q=i,s=Af(e.wrapper),t=0,x=Hb(c,function(a){b||Ue(a)?u(a):w(a)}),y=Hb(c,w);Ve(document,"mousemove",x),Ve(document,"mouseup",y)}}}function Xb(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(b){return!1}if(f>=Math.floor(Af(a.display.gutters).right))return!1;d&&Pe(b);var h=a.display,i=Af(h.lineDiv);if(g>i.bottom||!bf(a,c))return Re(b);g-=i.top-h.viewOffset;for(var j=0;j<a.options.gutters.length;++j){var k=h.gutters.childNodes[j];if(k&&Af(k).right>=f){var l=Ae(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),Re(b)}}}function Yb(a,b){return bf(a,"gutterContextMenu")?Xb(a,b,"gutterContextMenu",!1,Xe):!1}function Zb(a,b){return Xb(a,b,"gutterClick",!0,$e)}function _b(a){var b=this;if(!(_e(b,a)||Sb(b.display,a)||b.options.onDragEvent&&b.options.onDragEvent(b,Oe(a)))){Pe(a),f&&($b=+new Date);var c=Tb(b,a,!0),d=a.dataTransfer.files;if(c&&!Qb(b))if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,g=Array(e),h=0,i=function(a,d){var f=new FileReader;f.onload=function{g[d]=f.result,++h==e&&(c=Jc(b.doc,c),wc(b.doc,{from:c,to:c,text:Hf(g.join("\n")),origin:"paste"},"around"))},f.readAsText(a)},j=0;e>j;++j)i(d[j],j);else{if(b.state.draggingText&&!Fc(c,b.doc.sel.from)&&!Fc(b.doc.sel.to,c))return b.state.draggingText(a),setTimeout(qf(Pb,b),20),void 0;try{var g=a.dataTransfer.getData("Text");if(g){var k=b.doc.sel.from,l=b.doc.sel.to;Oc(b.doc,c,c),b.state.draggingText&&Cc(b.doc,"",k,l,"paste"),b.replaceSelection(g,null,"paste"),Pb(b)}}catch(a){}}}}function ac(a,b){if(f&&(!a.state.draggingText||+new Date-$b<100))return Se(b),void 0;if(!_e(a,b)&&!Sb(a.display,b)){var c=a.getSelection;if(b.dataTransfer.setData("Text",c),b.dataTransfer.setDragImage&&!k){var d=wf("img",null,null,"Position:fixed; left: 0; top: 0;");d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",j&&(d.width=d.height=1,a.display.wrapper.appendChild(d),d._top=d.offsetTop),b.dataTransfer.setDragImage(d,0,0),j&&d.parentNode.removeChild(d)}}}function bc(b,c){Math.abs(b.doc.scrollTop-c)<2||(b.doc.scrollTop=c,a||S(b,[],c),b.display.scroller.scrollTop!=c&&(b.display.scroller.scrollTop=c),b.display.scrollbarV.scrollTop!=c&&(b.display.scrollbarV.scrollTop=c),a&&S(b,[]),db(b,100))}function cc(a,b,c){(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,O(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function fc(b,c){var d=c.wheelDeltaX,e=c.wheelDeltaY;null==d&&c.detail&&c.axis==c.HORIZONTAL_AXIS&&(d=c.detail),null==e&&c.detail&&c.axis==c.VERTICAL_AXIS?e=c.detail:null==e&&(e=c.wheelDelta);var f=b.display,h=f.scroller;if(d&&h.scrollWidth>h.clientWidth||e&&h.scrollHeight>h.clientHeight){if(e&&r&&g)for(var i=c.target;i!=h;i=i.parentNode)if(i.lineObj){b.display.currentWheelTarget=i;break}if(d&&!a&&!j&&null!=ec)return e&&bc(b,Math.max(0,Math.min(h.scrollTop+e*ec,h.scrollHeight-h.clientHeight))),cc(b,Math.max(0,Math.min(h.scrollLeft+d*ec,h.scrollWidth-h.clientWidth))),Pe(c),f.wheelStartX=null,void 0;if(e&&null!=ec){var k=e*ec,l=b.doc.scrollTop,m=l+f.wrapper.clientHeight;0>k?l=Math.max(0,l+k-50):m=Math.min(b.doc.height,m+k+50),S(b,[],{top:l,bottom:m})}20>dc&&(null==f.wheelStartX?(f.wheelStartX=h.scrollLeft,f.wheelStartY=h.scrollTop,f.wheelDX=d,f.wheelDY=e,setTimeout(function{if(null!=f.wheelStartX){var a=h.scrollLeft-f.wheelStartX,b=h.scrollTop-f.wheelStartY,c=b&&f.wheelDY&&b/f.wheelDY||a&&f.wheelDX&&a/f.wheelDX;f.wheelStartX=f.wheelStartY=null,c&&(ec=(ec*dc+c)/(dc+1),++dc)}},200)):(f.wheelDX+=d,f.wheelDY+=e))}}function gc(a,b,c){if("string"==typeof b&&(b=md[b],!b))return!1;a.display.pollingFast&&Nb(a)&&(a.display.pollingFast=!1);var d=a.doc,e=d.sel.shift,f=!1;try{Qb(a)&&(a.state.suppressEdits=!0),c&&(d.sel.shift=!1),f=b(a)!=ef}finally{d.sel.shift=e,a.state.suppressEdits=!1}return f}function hc(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function jc(a,b){var c=od(a.options.keyMap),e=c.auto;clearTimeout(ic),e&&!qd(b)&&(ic=setTimeout(function{od(a.options.keyMap)==c&&(a.options.keyMap=e.call?e.call(null,a):e,F(a))},50));var f=rd(b,!0),g=!1;if(!f)return!1;var h=hc(a);return g=b.shiftKey?pd("Shift-"+f,h,function(b){return gc(a,b,!0)})||pd(f,h,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?gc(a,b):void 0}):pd(f,h,function(b){return gc(a,b)}),g&&(Pe(b),cb(a),d&&(b.oldKeyCode=b.keyCode,b.keyCode=0),$e(a,"keyHandled",a,f,b)),g}function kc(a,b,c){var d=pd("'"+c+"'",hc(a),function(b){return gc(a,b,!0)});return d&&(Pe(b),cb(a),$e(a,"keyHandled",a,"'"+c+"'",b)),d}function mc(a){var c=this;if(c.state.focused||oc(c),!(_e(c,a)||c.options.onKeyEvent&&c.options.onKeyEvent(c,Oe(a)))){b&&27==a.keyCode&&(a.returnValue=!1);var d=a.keyCode;c.doc.sel.shift=16==d||a.shiftKey;var e=jc(c,a);j&&(lc=e?d:null,!e&&88==d&&!Jf&&(r?a.metaKey:a.ctrlKey)&&c.replaceSelection(""))}}function nc(a){var b=this;if(!(_e(b,a)||b.options.onKeyEvent&&b.options.onKeyEvent(b,Oe(a)))){var c=a.keyCode,e=a.charCode;if(j&&c==lc)return lc=null,Pe(a),void 0;if(!(j&&(!a.which||a.which<10)||l)||!jc(b,a)){var g=String.fromCharCode(null==e?c:e);kc(b,a,g)||(f&&!d&&(b.display.inputHasSelection=null),Mb(b))}}}function oc(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(Xe(a,"focus",a),a.state.focused=!0,-1==a.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(a.display.wrapper.className+=" CodeMirror-focused"),a.curOp||(Ob(a,!0),g&&setTimeout(qf(Ob,a,!0),0))),Lb(a),cb(a))}function pc(a){a.state.focused&&(Xe(a,"blur",a),a.state.focused=!1,a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(a.display.blinker),setTimeout(function{a.state.focused||(a.doc.sel.shift=!1)},150)}function rc(a,c){function l{if(null!=e.input.selectionStart){var a=e.input.value="\u200b"+(Ec(f.from,f.to)?"":e.input.value);e.prevInput="\u200b",e.input.selectionStart=1,e.input.selectionEnd=a.length}}function m{if(e.inputDiv.style.position="relative",e.input.style.cssText=k,d&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=h),Lb(a),null!=e.input.selectionStart){(!b||d)&&l,clearTimeout(qc);var c=0,f=function{"\u200b"==e.prevInput&&0==e.input.selectionStart?Hb(a,md.selectAll)(a):c++<10?qc=setTimeout(f,500):Ob(a)};qc=setTimeout(f,200)}}if(!_e(a,c,"contextmenu")){var e=a.display,f=a.doc.sel;if(!Sb(e,c)&&!Yb(a,c)){var g=Tb(a,c),h=e.scroller.scrollTop;if(g&&!j){var i=a.options.resetSelectionOnContextMenu;i&&(Ec(f.from,f.to)||Fc(g,f.from)||!Fc(g,f.to))&&Hb(a,Oc)(a.doc,g,g);var k=e.input.style.cssText;if(e.inputDiv.style.position="absolute",e.input.style.cssText="Position:fixed; width: 30px; height: 30px; top: "+(c.clientY-5)+"px; left: "+(c.clientX-5)+"px; z-index: 1000; background: transparent; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",Pb(a),Ob(a,!0),Ec(f.from,f.to)&&(e.input.value=e.prevInput=" "),b&&!d&&l,v){Se(c);var n=function{We(window,"mouseup",n),setTimeout(m,20)};Ve(window,"mouseup",n)}else setTimeout(m,50)}}}}function tc(a,b,c){if(!Fc(b.from,c))return Jc(a,c);var d=b.text.length-1-(b.to.line-b.from.line);if(c.line>b.to.line+d){var e=c.line-d,f=a.first+a.size-1;return e>f?Dc(f,ve(a,f).text.length):Kc(c,ve(a,e).text.length)}if(c.line==b.to.line+d)return Kc(c,kf(b.text).length+(1==b.text.length?b.from.ch:0)+ve(a,b.to.line).text.length-b.to.ch);var g=c.line-b.from.line;return Kc(c,b.text[g].length+(g?0:b.from.ch))}function uc(a,b,c){if(c&&"object"==typeof c)return{anchor:tc(a,b,c.anchor),head:tc(a,b,c.head)};if("start"==c)return{anchor:b.from,head:b.from};var d=sc(b);if("around"==c)return{anchor:b.from,head:d};if("end"==c)return{anchor:d,head:d};var e=function(a){if(Fc(a,b.from))return a;if(!Fc(b.to,a))return d;var c=a.line+b.text.length-(b.to.line-b.from.line)-1,e=a.ch;return a.line==b.to.line&&(e+=d.ch-b.to.ch),Dc(c,e)};return{anchor:e(a.sel.anchor),head:e(a.sel.head)}}function vc(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function{this.canceled=!0}};return c&&(d.update=function(b,c,d,e){b&&(this.from=Jc(a,b)),c&&(this.to=Jc(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),Xe(a,"beforeChange",a,d),a.cm&&Xe(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function wc(a,b,c,d){if(a.cm){if(!a.cm.curOp)return Hb(a.cm,wc)(a,b,c,d);if(a.cm.state.suppressEdits)return}if(!(bf(a,"beforeChange")||a.cm&&bf(a.cm,"beforeChange"))||(b=vc(a,b,!0))){var e=w&&!d&&Gd(a,b.from,b.to);if(e){for(var f=e.length-1;f>=1;--f)xc(a,{from:e[f].from,to:e[f].to,text:[""]});e.length&&xc(a,{from:e[0].from,to:e[0].to,text:b.text},c)}else xc(a,b,c)}}function xc(a,b,c){if(1!=b.text.length||""!=b.text[0]||!Ec(b.from,b.to)){var d=uc(a,b,c);Ge(a,b,d,a.cm?a.cm.curOp.id:0/0),Ac(a,b,d,Dd(a,b));var e=[];te(a,function(a,c){c||-1!=mf(e,a.history)||(Me(a.history,b),e.push(a.history)),Ac(a,b,null,Dd(a,b))})}}function yc(a,b){if(!a.cm||!a.cm.state.suppressEdits){var c=a.history,d=("undo"==b?c.done:c.undone).pop;if(d){var e={changes:[],anchorBefore:d.anchorAfter,headBefore:d.headAfter,anchorAfter:d.anchorBefore,headAfter:d.headBefore,generation:c.generation};("undo"==b?c.undone:c.done).push(e),c.generation=d.generation||++c.maxGeneration;for(var f=bf(a,"beforeChange")||a.cm&&bf(a.cm,"beforeChange"),g=d.changes.length-1;g>=0;--g){var h=d.changes[g];if(h.origin=b,f&&!vc(a,h,!1))return("undo"==b?c.done:c.undone).length=0,void 0;e.changes.push(Fe(a,h));var i=g?uc(a,h,null):{anchor:d.anchorBefore,head:d.headBefore};Ac(a,h,i,Fd(a,h));var j=[];te(a,function(a,b){b||-1!=mf(j,a.history)||(Me(a.history,h),j.push(a.history)),Ac(a,h,null,Fd(a,h))})}}}}function zc(a,b){function c(a){return Dc(a.line+b,a.ch)}a.first+=b,a.cm&&Kb(a.cm,a.first,a.first,b),a.sel.head=c(a.sel.head),a.sel.anchor=c(a.sel.anchor),a.sel.from=c(a.sel.from),a.sel.to=c(a.sel.to)}function Ac(a,b,c,d){if(a.cm&&!a.cm.curOp)return Hb(a.cm,Ac)(a,b,c,d);if(b.to.line<a.first)return zc(a,b.text.length-1-(b.to.line-b.from.line)),void 0;if(!(b.from.line>a.lastLine)){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);zc(a,e),b={from:Dc(a.first,0),to:Dc(b.to.line+e,b.to.ch),text:[kf(b.text)],origin:b.origin}}var f=a.lastLine;b.to.line>f&&(b={from:b.from,to:Dc(f,ve(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=we(a,b.from,b.to),c||(c=uc(a,b,null)),a.cm?Bc(a.cm,b,d,c):me(a,b,d,c)}}function Bc(a,b,c,d){var e=a.doc,f=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=ze(Od(e,ve(e,g.line))),e.iter(j,h.line+1,function(a){return a==f.maxLine?(i=!0,!0):void 0})),Fc(e.sel.head,b.from)||Fc(b.to,e.sel.head)||(a.curOp.cursorActivity=!0),me(e,b,c,d,D(a)),a.options.lineWrapping||(e.iter(j,g.line+b.text.length,function(a){var b=J(e,a);b>f.maxLineLength&&(f.maxLine=a,f.maxLineLength=b,f.maxLineChanged=!0,i=!1)}),i&&(a.curOp.updateMaxLine=!0)),e.frontier=Math.min(e.frontier,g.line),db(a,400);var k=b.text.length-(h.line-g.line)-1;if(Kb(a,g.line,h.line+1,k),bf(a,"change")){var l={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};if(a.curOp.textChanged){for(var m=a.curOp.textChanged;m.next;m=m.next);m.next=l}else a.curOp.textChanged=l}}function Cc(a,b,c,d,e){if(d||(d=c),Fc(d,c)){var f=d;d=c,c=f}"string"==typeof b&&(b=Hf(b)),wc(a,{from:c,to:d,text:b,origin:e},null)}function Dc(a,b){return this instanceof Dc?(this.line=a,this.ch=b,void 0):new Dc(a,b)}function Ec(a,b){return a.line==b.line&&a.ch==b.ch}function Fc(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function Gc(a,b){return a.line-b.line||a.ch-b.ch}function Hc(a){return Dc(a.line,a.ch)}function Ic(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function Jc(a,b){if(b.line<a.first)return Dc(a.first,0);var c=a.first+a.size-1;return b.line>c?Dc(c,ve(a,c).text.length):Kc(b,ve(a,b.line).text.length)}function Kc(a,b){var c=a.ch;return null==c||c>b?Dc(a.line,b):0>c?Dc(a.line,0):a}function Lc(a,b){return b>=a.first&&b<a.first+a.size}function Mc(a,b,c,d){if(a.sel.shift||a.sel.extend){var e=a.sel.anchor;if(c){var f=Fc(b,e);f!=Fc(c,e)?(e=b,b=c):f!=Fc(b,c)&&(b=c)}Oc(a,e,b,d)}else Oc(a,b,c||b,d);a.cm&&(a.cm.curOp.userSelChange=!0)}function Nc(a,b,c){var d={anchor:b,head:c};return Xe(a,"beforeSelectionChange",a,d),a.cm&&Xe(a.cm,"beforeSelectionChange",a.cm,d),d.anchor=Jc(a,d.anchor),d.head=Jc(a,d.head),d}function Oc(a,b,c,d,e){if(!e&&bf(a,"beforeSelectionChange")||a.cm&&bf(a.cm,"beforeSelectionChange")){var f=Nc(a,b,c);c=f.head,b=f.anchor}var g=a.sel;if(g.goalColumn=null,null==d&&(d=Fc(c,g.head)?-1:1),(e||!Ec(b,g.anchor))&&(b=Qc(a,b,d,"push"!=e)),(e||!Ec(c,g.head))&&(c=Qc(a,c,d,"push"!=e)),!Ec(g.anchor,b)||!Ec(g.head,c)){g.anchor=b,g.head=c;var h=Fc(c,b);g.from=h?c:b,g.to=h?b:c,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=a.cm.curOp.cursorActivity=!0),$e(a,"cursorActivity",a)}}function Pc(a){Oc(a.doc,a.doc.sel.from,a.doc.sel.to,null,"push")}function Qc(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for{var h=ve(a,f.line);if(h.markedSpans)for(var i=0;i<h.markedSpans.length;++i){var j=h.markedSpans[i],k=j.marker;if((null==j.from||(k.inclusiveLeft?j.from<=f.ch:j.from<f.ch))&&(null==j.to||(k.inclusiveRight?j.to>=f.ch:j.to>f.ch))){if(d&&(Xe(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find[0>g?"from":"to"];if(Ec(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?Jc(a,Dc(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?Dc(l.line+1,0):null),!l)){if(e)return d?(a.cantEdit=!0,Dc(a.first,0)):Qc(a,b,c,!0);e=!0,l=b,g=-g}f=l;continue a}}return f}}function Rc(a){var b=Sc(a,a.doc.sel.head,null,a.options.cursorScrollMargin);if(a.state.focused){var c=a.display,d=Af(c.sizer),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!o){var f=wf("div","\u200b",null,"position: absolute; top: "+(b.top-c.viewOffset)+"px; height: "+(b.bottom-b.top+df)+"px; left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(f),f.scrollIntoView(e),a.display.lineSpace.removeChild(f)}}}function Sc(a,b,c,d){for(null==d&&(d=0);;){var e=!1,f=xb(a,b),g=c&&c!=b?xb(a,c):f,h=Uc(a,Math.min(f.left,g.left),Math.min(f.top,g.top)-d,Math.max(f.left,g.left),Math.max(f.bottom,g.bottom)+d),i=a.doc.scrollTop,j=a.doc.scrollLeft;if(null!=h.scrollTop&&(bc(a,h.scrollTop),Math.abs(a.doc.scrollTop-i)>1&&(e=!0)),null!=h.scrollLeft&&(cc(a,h.scrollLeft),Math.abs(a.doc.scrollLeft-j)>1&&(e=!0)),!e)return f}}function Tc(a,b,c,d,e){var f=Uc(a,b,c,d,e);null!=f.scrollTop&&bc(a,f.scrollTop),null!=f.scrollLeft&&cc(a,f.scrollLeft)}function Uc(a,b,c,d,e){var f=a.display,g=Cb(a.display);0>c&&(c=0);var h=f.scroller.clientHeight-df,i=f.scroller.scrollTop,j={},k=a.doc.height+ib(f),l=g>c,m=e>k-g;if(i>c)j.scrollTop=l?0:c;else if(e>i+h){var n=Math.min(c,(m?k:e)-h);n!=i&&(j.scrollTop=n)}var o=f.scroller.clientWidth-df,p=f.scroller.scrollLeft;b+=f.gutters.offsetWidth,d+=f.gutters.offsetWidth;var q=f.gutters.offsetWidth,r=q+10>b;return p+q>b||r?(r&&(b=0),j.scrollLeft=Math.max(0,b-10-q)):d>o+p-3&&(j.scrollLeft=d+10-o),j}function Vc(a,b,c){a.curOp.updateScrollPos={scrollLeft:null==b?a.doc.scrollLeft:b,scrollTop:null==c?a.doc.scrollTop:c}}function Wc(a,b,c){var d=a.curOp.updateScrollPos||(a.curOp.updateScrollPos={scrollLeft:a.doc.scrollLeft,scrollTop:a.doc.scrollTop}),e=a.display.scroller;d.scrollTop=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,d.scrollTop+c)),d.scrollLeft=Math.max(0,Math.min(e.scrollWidth-e.clientWidth,d.scrollLeft+b))}function Xc(a,b,c,d){var e=a.doc;if(null==c&&(c="add"),"smart"==c)if(a.doc.mode.indent)var f=gb(a,b);else c="prev";var k,g=a.options.tabSize,h=ve(e,b),i=gf(h.text,null,g),j=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(k=a.doc.mode.indent(f,h.text.slice(j.length),h.text),k==ef)){if(!d)return;c="prev"}}else k=0,c="not";"prev"==c?k=b>e.first?gf(ve(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c?k=i-a.options.indentUnit:"number"==typeof c&&(k=i+c),k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(k/g);n;--n)m+=g,l+="	";k>m&&(l+=jf(k-m)),l!=j?Cc(a.doc,l,Dc(b,0),Dc(b,j.length),"+input"):e.sel.head.line==b&&e.sel.head.ch<j.length&&Oc(e,Dc(b,j.length),Dc(b,j.length),1),h.stateAfter=null}function Yc(a,b,c){var d=b,e=b,f=a.doc;return"number"==typeof b?e=ve(f,Ic(f,b)):d=ze(b),null==d?null:c(e,d)?(Kb(a,d,d+1),e):null}function Zc(a,b,c,d,e){function k{var b=f+c;return b<a.first||b>=a.first+a.size?j=!1:(f=b,i=ve(a,b))}function l(a){var b=(e?Wf:Xf)(i,g,c,!0);if(null==b){if(a||!k)return j=!1;g=e?(0>c?Pf:Of)(i):0>c?i.text.length:0}else g=b;return!0}var f=b.line,g=b.ch,h=c,i=ve(a,f),j=!0;if("char"==d)l;else if("column"==d)l(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=!0;!(0>c)||l(!o);o=!1){var p=i.text.charAt(g)||"\n",q=sf(p)?"w":n?/\s/.test(p)?null:"p":null;if(m&&m!=q){0>c&&(c=1,l);break}if(q&&(m=q),c>0&&!l(!o))break}var r=Qc(a,Dc(f,g),h,!0);return j||(r.hitSide=!0),r}function $c(a,b,c,d){var g,e=a.doc,f=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);g=b.top+c*(h-(0>c?1.5:.5)*Cb(a.display))}else"line"==d&&(g=c>0?b.bottom+3:b.top-3);for{var i=zb(a,f,g);if(!i.outside)break;if(0>c?0>=g:g>=e.height){i.hitSide=!0;break}g+=5*c}return i}function _c(a,b){var c=b.ch,d=b.ch;if(a){(b.xRel<0||d==a.length)&&c?--c:++d;for(var e=a.charAt(c),f=sf(e)?sf:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!sf(a)};c>0&&f(a.charAt(c-1));)--c;for(d<a.length&&f(a.charAt(d));)++d}return{from:Dc(b.line,c),to:Dc(b.line,d)}}function ad(a,b){Mc(a.doc,Dc(b,0),Jc(a.doc,Dc(b+1,0)))}function dd(a,b,c,d){y.defaults[a]=b,c&&(bd[a]=d?function(a,b,d){d!=ed&&c(a,b,d)}:c)}function kd(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function ld(a,b,c){return a.startState?a.startState(b,c):!0}function od(a){return"string"==typeof a?nd[a]:a}function pd(a,b,c){function d(b){b=od(b);var e=b[a];if(e===!1)return"stop";if(null!=e&&c(e))return!0;if(b.nofallthrough)return"stop";var f=b.fallthrough;if(null==f)return!1;if("[object Array]"!=Object.prototype.toString.call(f))return d(f);for(var g=0,h=f.length;h>g;++g){var i=d(f[g]);if(i)return i}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return"stop"!=f}}function qd(a){var b=Kf[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b}function rd(a,b){if(j&&34==a.keyCode&&a["char"])return!1;var c=Kf[a.keyCode];return null==c||a.altGraphKey?!1:(a.altKey&&(c="Alt-"+c),(u?a.metaKey:a.ctrlKey)&&(c="Ctrl-"+c),(u?a.ctrlKey:a.metaKey)&&(c="Cmd-"+c),!b&&a.shiftKey&&(c="Shift-"+c),c)}function sd(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0}function td(a,b){this.lines=[],this.type=b,this.doc=a}function vd(a,b,c,d,e){if(d&&d.shared)return xd(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return Hb(a.cm,vd)(a,b,c,d,e);var f=new td(a,e);if(d&&of(d,f),Fc(c,b)||Ec(b,c)&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.replacedWith=wf("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||(f.replacedWith.ignoreEvents=!0)),f.collapsed){if(Nd(a,b.line,b,c,f)||b.line!=c.line&&Nd(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");x=!0}f.addToHistory&&Ge(a,{from:b,to:c,origin:"markText"},{head:a.sel.head,anchor:a.sel.anchor},0/0);var i,g=b.line,h=a.cm;return a.iter(g,c.line+1,function(d){h&&f.collapsed&&!h.options.lineWrapping&&Od(a,d)==h.display.maxLine&&(i=!0);var e={from:null,to:null,marker:f};g==b.line&&(e.from=b.ch),g==c.line&&(e.to=c.ch),f.collapsed&&g!=b.line&&ye(d,0),Ad(d,e),++g}),f.collapsed&&a.iter(b.line,c.line+1,function(b){Pd(a,b)&&ye(b,0)}),f.clearOnEnter&&Ve(f,"beforeCursorEnter",function{f.clear}),f.readOnly&&(w=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory),f.collapsed&&(f.id=++ud,f.atomic=!0),h&&(i&&(h.curOp.updateMaxLine=!0),(f.className||f.title||f.startStyle||f.endStyle||f.collapsed)&&Kb(h,b.line,c.line+1),f.atomic&&Pc(h)),f}function wd(a,b){this.markers=a,this.primary=b;for(var c=0,d=this;c<a.length;++c)a[c].parent=this,Ve(a[c],"clear",function{d.clear})}function xd(a,b,c,d,e){d=of(d),d.shared=!1;var f=[vd(a,b,c,d,e)],g=f[0],h=d.replacedWith;return te(a,function(a){h&&(d.replacedWith=h.cloneNode(!0)),f.push(vd(a,Jc(a,b),Jc(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=kf(f)}),new wd(f,g)}function yd(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function zd(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function Ad(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function Bd(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],g=f.marker,h=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||f.from==b&&"bookmark"==g.type&&(!c||!f.marker.insertLeft)){var i=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);(e||(e=[])).push({from:f.from,to:i?null:f.to,marker:g})}}return e}function Cd(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);(e||(e=[])).push({from:i?null:f.from-b,to:null==f.to?null:f.to-b,marker:g})}}return e}function Dd(a,b){var c=Lc(a,b.from.line)&&ve(a,b.from.line).markedSpans,d=Lc(a,b.to.line)&&ve(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=Ec(b.from,b.to),h=Bd(c,e,g),i=Cd(d,f,g),j=1==b.text.length,k=kf(b.text).length+(j?e:0);if(h)for(var l=0;l<h.length;++l){var m=h[l];if(null==m.to){var n=yd(i,m.marker);n?j&&(m.to=null==n.to?null:n.to+k):m.to=e}}if(i)for(var l=0;l<i.length;++l){var m=i[l];if(null!=m.to&&(m.to+=k),null==m.from){var n=yd(h,m.marker);n||(m.from=k,j&&(h||(h=[])).push(m))}else m.from+=k,j&&(h||(h=[])).push(m)}h&&(h=Ed(h)),i&&i!=h&&(i=Ed(i));var o=[h];if(!j){var q,p=b.text.length-2;if(p>0&&h)for(var l=0;l<h.length;++l)null==h[l].to&&(q||(q=[])).push({from:null,to:null,marker:h[l].marker});for(var l=0;p>l;++l)o.push(q);o.push(i)}return o}function Ed(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&c.marker.clearWhenEmpty!==!1&&a.splice(b--,1)}return a.length?a:null}function Fd(a,b){var c=Ie(a,b),d=Dd(a,b);if(!c)return d;if(!d)return c;for(var e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g)a:for(var h=0;h<g.length;++h){for(var i=g[h],j=0;j<f.length;++j)if(f[j].marker==i.marker)continue a;f.push(i)}else g&&(c[e]=g)}return c}function Gd(a,b,c){var d=null;if(a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=mf(d,c)||(d||(d=[])).push(c)}}),!d)return null;for(var e=[{from:b,to:c}],f=0;f<d.length;++f)for(var g=d[f],h=g.find,i=0;i<e.length;++i){var j=e[i];if(!Fc(j.to,h.from)&&!Fc(h.to,j.from)){var k=[i,1];(Fc(j.from,h.from)||!g.inclusiveLeft&&Ec(j.from,h.from))&&k.push({from:j.from,to:h.from}),(Fc(h.to,j.to)||!g.inclusiveRight&&Ec(j.to,h.to))&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function Hd(a){return a.inclusiveLeft?-1:0}function Id(a){return a.inclusiveRight?1:0}function Jd(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var d=a.find,e=b.find,f=Gc(d.from,e.from)||Hd(a)-Hd(b);if(f)return-f;var g=Gc(d.to,e.to)||Id(a)-Id(b);return g?g:b.id-a.id}function Kd(a,b){var d,c=x&&a.markedSpans;if(c)for(var e,f=0;f<c.length;++f)e=c[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!d||Jd(d,e.marker)<0)&&(d=e.marker);return d}function Ld(a){return Kd(a,!0)}function Md(a){return Kd(a,!1)}function Nd(a,b,c,d,e){var f=ve(a,b),g=x&&f.markedSpans;if(g)for(var h=0;h<g.length;++h){var i=g[h];if(i.marker.collapsed){var j=i.marker.find(!0),k=Gc(j.from,c)||Hd(i.marker)-Hd(e),l=Gc(j.to,d)||Id(i.marker)-Id(e);if(!(k>=0&&0>=l||0>=k&&l>=0)&&(0>=k&&(Gc(j.to,c)||Id(i.marker)-Hd(e))>0||k>=0&&(Gc(j.from,d)||Hd(i.marker)-Id(e))<0))return!0}}}function Od(a,b){for(var c;c=Ld(b);)b=ve(a,c.find.from.line);return b}function Pd(a,b){var c=x&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed){if(null==d.from)return!0;if(!d.marker.replacedWith&&0==d.from&&d.marker.inclusiveLeft&&Qd(a,b,d))return!0}}function Qd(a,b,c){if(null==c.to){var d=c.marker.find.to,e=ve(a,d.line);return Qd(a,e,yd(e.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var f,g=0;g<b.markedSpans.length;++g)if(f=b.markedSpans[g],f.marker.collapsed&&!f.marker.replacedWith&&f.from==c.to&&(null==f.to||f.to!=c.from)&&(f.marker.inclusiveLeft||c.marker.inclusiveRight)&&Qd(a,b,f))return!0}function Rd(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Sd(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Ud(a){return function{var b=!this.cm.curOp;b&&Fb(this.cm);try{var c=a.apply(this,arguments)}finally{b&&Gb(this.cm)}return c}}function Vd(a){return null!=a.height?a.height:(a.node.parentNode&&1==a.node.parentNode.nodeType||yf(a.cm.display.measure,wf("div",[a.node],null,"position: relative")),a.height=a.node.offsetHeight)}function Wd(a,b,c,d){var e=new Td(a,c,d);return e.noHScroll&&(a.display.alignWidgets=!0),Yc(a,b,function(b){var c=b.widgets||(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,!Pd(a.doc,b)||e.showIfHidden){var d=Be(a,b)<a.doc.scrollTop;ye(b,b.height+Vd(e)),d&&Wc(a,0,e.height)}return!0}),e}function Yd(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),Rd(a),Sd(a,c);var e=d?d(a):1;e!=a.height&&ye(a,e)}function Zd(a){a.parent=null,Rd(a)}function $d(a,b,c,d,e,f){var g=c.flattenSpans;null==g&&(g=a.options.flattenSpans);var k,h=0,i=null,j=new sd(b,a.options.tabSize);for(""==b&&c.blankLine&&c.blankLine(d);!j.eol;){if(j.pos>a.options.maxHighlightLength?(g=!1,f&&be(a,b,d,j.pos),j.pos=b.length,k=null):k=c.token(j,d),a.options.addModeClass){var l=y.innerMode(c,d).mode.name;l&&(k="m-"+(k?l+" "+k:l))}g&&i==k||(h<j.start&&e(j.start,i),h=j.start,i=k),j.start=j.pos}for(h<j.pos;){var m=Math.min(j.pos,h+5e4);e(m,i),h=m}}function _d(a,b,c,d){var e=[a.state.modeGen];$d(a,b.text,a.doc.mode,c,function(a,b){e.push(a,b)},d);for(var f=0;f<a.state.overlays.length;++f){var g=a.state.overlays[f],h=1,i=0;$d(a,b.text,g.mode,!0,function(a,b){for(var c=h;a>i;){var d=e[h];d>a&&e.splice(h,1,a,e[h+1],d),h+=2,i=Math.min(a,d)}if(b)if(g.opaque)e.splice(c,h-c,a,b),h=c+2;else for(h>c;c+=2){var f=e[c+1];e[c+1]=f?f+" "+b:b}})}return e}function ae(a,b){return b.styles&&b.styles[0]==a.state.modeGen||(b.styles=_d(a,b,b.stateAfter=gb(a,ze(b)))),b.styles}function be(a,b,c,d){var e=a.doc.mode,f=new sd(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&e.blankLine&&e.blankLine(c);!f.eol&&f.pos<=a.options.maxHighlightLength;)e.token(f,c),f.start=f.pos}function ee(a,b){if(!a)return null;for{var c=a.match(/(?:^|\s)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:new RegExp("(?:^|s)"+c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}var e=b.cm.options.addModeClass?de:ce;return e[a]||(e[a]="cm-"+a.replace(/ +/g," cm-"))}function fe(a,c,d,e){for(var h,i=c,j=!0;h=Ld(i);)i=ve(a.doc,h.find.from.line);var k={pre:wf("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:a,copyWidgets:e};do{i.text&&(j=!1),k.measure=i==c&&d,k.pos=0,k.addToken=k.measure?ie:he,(b||g)&&a.getOption("lineWrapping")&&(k.addToken=je(k.addToken));var l=le(i,k,ae(a,i));d&&i==c&&!k.measuredSomething&&(d[0]=k.pre.appendChild(Gf(a.display.measure)),k.measuredSomething=!0),l&&(i=ve(a.doc,l.to.line))}while(l);!d||k.measuredSomething||d[0]||(d[0]=k.pre.appendChild(j?wf("span","\xa0"):Gf(a.display.measure))),k.pre.firstChild||Pd(a.doc,c)||k.pre.appendChild(document.createTextNode("\xa0"));var m;if(d&&f&&(m=Ce(i))){var n=m.length-1;m[n].from==m[n].to&&--n;var o=m[n],p=m[n-1];if(o.from+1==o.to&&p&&o.level<p.level){var q=d[k.pos-1];q&&q.parentNode.insertBefore(q.measureRight=Gf(a.display.measure),q.nextSibling)}}var r=k.textClass?k.textClass+" "+(c.textClass||""):c.textClass;return r&&(k.pre.className=r),Xe(a,"renderLine",a,c,k.pre),k}function ge(a){var b=wf("span","\u2022","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b}function he(a,b,c,d,e,f){if(b){var g=a.cm.options.specialChars;if(g.test(b))for(var h=document.createDocumentFragment,i=0;;){g.lastIndex=i;var j=g.exec(b),k=j?j.index-i:b.length-i;if(k&&(h.appendChild(document.createTextNode(b.slice(i,i+k))),a.col+=k),!j)break;if(i+=k+1,"	"==j[0]){var l=a.cm.options.tabSize,m=l-a.col%l;h.appendChild(wf("span",jf(m),"cm-tab")),a.col+=m}else{var n=a.cm.options.specialCharPlaceholder(j[0]);h.appendChild(n),a.col+=1}}else{a.col+=b.length;var h=document.createTextNode(b)}if(c||d||e||a.measure){var o=c||"";d&&(o+=d),e&&(o+=e);var n=wf("span",[h],o);return f&&(n.title=f),a.pre.appendChild(n)}a.pre.appendChild(h)}}function ie(a,c,d,e,f){for(var g=a.cm.options.lineWrapping,h=0;h<c.length;++h){for(var i=0==h,j=h+1;j<c.length&&vf(c.charAt(j));)++j;var k=c.slice(h,j);h=j-1,h&&g&&Cf(c,h)&&a.pre.appendChild(wf("wbr"));var l=a.measure[a.pos],m=a.measure[a.pos]=he(a,k,d,i&&e,h==c.length-1&&f);l&&(m.leftSide=l.leftSide||l),b&&g&&" "==k&&h&&!/\s/.test(c.charAt(h-1))&&h<c.length-1&&!/\s/.test(c.charAt(h+1))&&(m.style.whiteSpace="normal"),a.pos+=k.length }c.length&&(a.measuredSomething=!0)}function je(a){function b(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":"\xa0";return b+=" "}return function(c,d,e,f,g,h){return a(c,d.replace(/ {3,}/g,b),e,f,g,h)}}function ke(a,b,c,d){var e=!d&&c.replacedWith;if(e&&(a.copyWidgets&&(e=e.cloneNode(!0)),a.pre.appendChild(e),a.measure)){if(b)a.measure[a.pos]=e;else{var f=Gf(a.cm.display.measure);if("bookmark"!=c.type||c.insertLeft){if(a.measure[a.pos])return;a.measure[a.pos]=a.pre.insertBefore(f,e)}else a.measure[a.pos]=a.pre.appendChild(f)}a.measuredSomething=!0}a.pos+=b}function le(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var k,m,n,o,p,q,h=e.length,i=0,g=1,j="",l=0;;){if(l==i){m=n=o=p="",q=null,l=1/0;for(var r=[],s=0;s<d.length;++s){var t=d[s],u=t.marker;t.from<=i&&(null==t.to||t.to>i)?(null!=t.to&&l>t.to&&(l=t.to,n=""),u.className&&(m+=" "+u.className),u.startStyle&&t.from==i&&(o+=" "+u.startStyle),u.endStyle&&t.to==l&&(n+=" "+u.endStyle),u.title&&!p&&(p=u.title),u.collapsed&&(!q||Jd(q.marker,u)<0)&&(q=t)):t.from>i&&l>t.from&&(l=t.from),"bookmark"==u.type&&t.from==i&&u.replacedWith&&r.push(u)}if(q&&(q.from||0)==i&&(ke(b,(null==q.to?h:q.to)-i,q.marker,null==q.from),null==q.to))return q.marker.find;if(!q&&r.length)for(var s=0;s<r.length;++s)ke(b,0,r[s])}if(i>=h)break;for(var v=Math.min(h,l);;){if(j){var w=i+j.length;if(!q){var x=w>v?j.slice(0,v-i):j;b.addToken(b,x,k?k+m:m,o,i+x.length==l?n:"",p)}if(w>=v){j=j.slice(v-i),i=v;break}i=w,o=""}j=e.slice(f,f=c[g++]),k=ee(c[g++],b)}}else for(var g=1;g<c.length;g+=2)b.addToken(b,e.slice(f,f=c[g]),ee(c[g+1],b))}function me(a,b,c,d,e){function f(a){return c?c[a]:null}function g(a,c,d){Yd(a,c,d,e),$e(a,"change",a,b)}var h=b.from,i=b.to,j=b.text,k=ve(a,h.line),l=ve(a,i.line),m=kf(j),n=f(j.length-1),o=i.line-h.line;if(0!=h.ch||0!=i.ch||""!=m||a.cm&&!a.cm.options.wholeLineUpdateBefore)if(k==l)if(1==j.length)g(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{for(var r=[],p=1,q=j.length-1;q>p;++p)r.push(new Xd(j[p],f(p),e));r.push(new Xd(m+k.text.slice(i.ch),n,e)),g(k,k.text.slice(0,h.ch)+j[0],f(0)),a.insert(h.line+1,r)}else if(1==j.length)g(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),f(0)),a.remove(h.line+1,o);else{g(k,k.text.slice(0,h.ch)+j[0],f(0)),g(l,m+l.text.slice(i.ch),n);for(var p=1,q=j.length-1,r=[];q>p;++p)r.push(new Xd(j[p],f(p),e));o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,r)}else{for(var p=0,q=j.length-1,r=[];q>p;++p)r.push(new Xd(j[p],f(p),e));g(l,l.text,n),o&&a.remove(h.line,o),r.length&&a.insert(h.line,r)}$e(a,"change",a,b),Oc(a,d.anchor,d.head,null,!0)}function ne(a){this.lines=a,this.parent=null;for(var b=0,c=a.length,d=0;c>b;++b)a[b].parent=this,d+=a[b].height;this.height=d}function oe(a){this.children=a;for(var b=0,c=0,d=0,e=a.length;e>d;++d){var f=a[d];b+=f.chunkSize,c+=f.height,f.parent=this}this.size=b,this.height=c,this.parent=null}function te(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;g<a.linked.length;++g){var h=a.linked[g];if(h.doc!=e){var i=f&&h.sharedHist;(!c||i)&&(b(h.doc,i),d(h.doc,a,i))}}}d(a,null,!0)}function ue(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,E(a),A(a),a.options.lineWrapping||K(a),a.options.mode=b.modeOption,Kb(a)}function ve(a,b){for(b-=a.first;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize;if(e>b){a=d;break}b-=e}return a.lines[b]}function we(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function xe(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function ye(a,b){for(var c=b-a.height,d=a;d;d=d.parent)d.height+=c}function ze(a){if(null==a.parent)return null;for(var b=a.parent,c=mf(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize;return c+b.first}function Ae(a,b){var c=a.first;a:do{for(var d=0,e=a.children.length;e>d;++d){var f=a.children[d],g=f.height;if(g>b){a=f;continue a}b-=g,c+=f.chunkSize}return c}while(!a.lines);for(var d=0,e=a.lines.length;e>d;++d){var h=a.lines[d],i=h.height;if(i>b)break;b-=i}return c+d}function Be(a,b){b=Od(a.doc,b);for(var c=0,d=b.parent,e=0;e<d.lines.length;++e){var f=d.lines[e];if(f==b)break;c+=f.height}for(var g=d.parent;g;d=g,g=d.parent)for(var e=0;e<g.children.length;++e){var h=g.children[e];if(h==d)break;c+=h.height}return c}function Ce(a){var b=a.order;return null==b&&(b=a.order=Yf(a.text)),b}function De(a){return{done:[],undone:[],undoDepth:1/0,lastTime:0,lastOp:null,lastOrigin:null,generation:a||1,maxGeneration:a||1}}function Ee(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function Fe(a,b){var c={line:b.from.line,ch:b.from.ch},d={from:c,to:sc(b),text:we(a,b.from,b.to)};return Ee(a,d,b.from.line,b.to.line+1),te(a,function(a){Ee(a,d,b.from.line,b.to.line+1)},!0),d}function Ge(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,g=kf(e.done);if(g&&(e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))){var h=kf(g.changes);Ec(b.from,b.to)&&Ec(b.from,h.to)?h.to=sc(b):g.changes.push(Fe(a,b)),g.anchorAfter=c.anchor,g.headAfter=c.head}else for(g={changes:[Fe(a,b)],generation:e.generation,anchorBefore:a.sel.anchor,headBefore:a.sel.head,anchorAfter:c.anchor,headAfter:c.head},e.done.push(g);e.done.length>e.undoDepth;)e.done.shift;e.generation=++e.maxGeneration,e.lastTime=f,e.lastOp=d,e.lastOrigin=b.origin}function He(a){if(!a)return null;for(var c,b=0;b<a.length;++b)a[b].marker.explicitlyCleared?c||(c=a.slice(0,b)):c&&c.push(a[b]);return c?c.length?c:null:a}function Ie(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=0,e=[];d<b.text.length;++d)e.push(He(c[d]));return e}function Je(a,b){for(var c=0,d=[];c<a.length;++c){var e=a[c],f=e.changes,g=[];d.push({changes:g,anchorBefore:e.anchorBefore,headBefore:e.headBefore,anchorAfter:e.anchorAfter,headAfter:e.headAfter});for(var h=0;h<f.length;++h){var j,i=f[h];if(g.push({from:i.from,to:i.to,text:i.text}),b)for(var k in i)(j=k.match(/^spans_(\d+)$/))&&mf(b,Number(j[1]))>-1&&(kf(g)[k]=i[k],delete i[k])}}return d}function Ke(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Le(a,b,c,d){for(var e=0;e<a.length;++e){for(var f=a[e],g=!0,h=0;h<f.changes.length;++h){var i=f.changes[h];if(f.copied||(i.from=Hc(i.from),i.to=Hc(i.to)),c<i.from.line)i.from.line+=d,i.to.line+=d;else if(b<=i.to.line){g=!1;break}}f.copied||(f.anchorBefore=Hc(f.anchorBefore),f.headBefore=Hc(f.headBefore),f.anchorAfter=Hc(f.anchorAfter),f.readAfter=Hc(f.headAfter),f.copied=!0),g?(Ke(f.anchorBefore),Ke(f.headBefore),Ke(f.anchorAfter),Ke(f.headAfter)):(a.splice(0,e+1),e=0)}}function Me(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Le(a.done,c,d,e),Le(a.undone,c,d,e)}function Ne{Se(this)}function Oe(a){return a.stop||(a.stop=Ne),a}function Pe(a){a.preventDefault?a.preventDefault:a.returnValue=!1}function Qe(a){a.stopPropagation?a.stopPropagation:a.cancelBubble=!0}function Re(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Se(a){Pe(a),Qe(a)}function Te(a){return a.target||a.srcElement}function Ue(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),r&&a.ctrlKey&&1==b&&(b=3),b}function Ve(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a._handlers||(a._handlers={}),e=d[b]||(d[b]=[]);e.push(c)}}function We(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=a._handlers&&a._handlers[b];if(!d)return;for(var e=0;e<d.length;++e)if(d[e]==c){d.splice(e,1);break}}}function Xe(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function $e(a,b){function e(a){return function{a.apply(null,d)}}var c=a._handlers&&a._handlers[b];if(c){var d=Array.prototype.slice.call(arguments,2);Ye||(++Ze,Ye=[],setTimeout(af,0));for(var f=0;f<c.length;++f)Ye.push(e(c[f]))}}function _e(a,b,c){return Xe(a,c||b.type,a,b),Re(b)||b.codemirrorIgnore}function af{--Ze;var a=Ye;Ye=null;for(var b=0;b<a.length;++b)a[b]}function bf(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function cf(a){a.prototype.on=function(a,b){Ve(this,a,b)},a.prototype.off=function(a,b){We(this,a,b)}}function ff{this.id=null}function gf(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var f=d||0,g=e||0;b>f;++f)"	"==a.charAt(f)?g+=c-g%c:++g;return g}function jf(a){for(hf.length<=a;)hf.push(kf(hf)+" ");return hf[a]}function kf(a){return a[a.length-1]}function lf(a){if(p)a.selectionStart=0,a.selectionEnd=a.value.length;else try{a.select}catch(b){}}function mf(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;d>c;++c)if(a[c]==b)return c;return-1}function nf(a,b){function c{}c.prototype=a;var d=new c;return b&&of(b,d),d}function of(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function pf(a){for(var b=[],c=0;a>c;++c)b.push(void 0);return b}function qf(a){var b=Array.prototype.slice.call(arguments,1);return function{return a.apply(null,b)}}function sf(a){return/\w/.test(a)||a>"\x80"&&(a.toUpperCase!=a.toLowerCase||rf.test(a))}function tf(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function vf(a){return a.charCodeAt(0)>=768&&uf.test(a)}function wf(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)zf(e,b);else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function xf(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function yf(a,b){return xf(a).appendChild(b)}function zf(a,b){d?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function Af(a){return a.getBoundingClientRect}function Cf{return!1}function Ef(a){if(null!=Df)return Df;var b=wf("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return yf(a,b),b.offsetWidth&&(Df=b.offsetHeight-b.clientHeight),Df||0}function Gf(a){if(null==Ff){var b=wf("span","\u200b");yf(a,wf("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(Ff=b.offsetWidth<=1&&b.offsetHeight>2&&!c)}return Ff?wf("span","\u200b"):wf("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px")}function Lf(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];(g.from<c&&g.to>b||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function Mf(a){return a.level%2?a.to:a.from}function Nf(a){return a.level%2?a.from:a.to}function Of(a){var b=Ce(a);return b?Mf(b[0]):0}function Pf(a){var b=Ce(a);return b?Nf(kf(b)):a.text.length}function Qf(a,b){var c=ve(a.doc,b),d=Od(a.doc,c);d!=c&&(b=ze(d));var e=Ce(d),f=e?e[0].level%2?Pf(d):Of(d):0;return Dc(b,f)}function Rf(a,b){for(var c,d;c=Md(d=ve(a.doc,b));)b=c.find.to.line;var e=Ce(d),f=e?e[0].level%2?Of(d):Pf(d):d.text.length;return Dc(b,f)}function Sf(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function Uf(a,b){Tf=null;for(var d,c=0;c<a.length;++c){var e=a[c];if(e.from<b&&e.to>b)return c;if(e.from==b||e.to==b){if(null!=d)return Sf(a,e.level,a[d].level)?(e.from!=e.to&&(Tf=d),c):(e.from!=e.to&&(Tf=c),d);d=c}}return d}function Vf(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&vf(a.text.charAt(b)));return b}function Wf(a,b,c,d){var e=Ce(a);if(!e)return Xf(a,b,c,d);for(var f=Uf(e,b),g=e[f],h=Vf(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h<g.to)return h;if(h==g.from||h==g.to)return Uf(e,h)==f?h:(g=e[f+=c],c>0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?Vf(a,g.to,-1,d):Vf(a,g.from,1,d)}}function Xf(a,b,c,d){var e=b+c;if(d)for(e>0&&vf(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var a=/gecko\/\d/i.test(navigator.userAgent),b=/MSIE \d/.test(navigator.userAgent),c=b&&(null==document.documentMode||document.documentMode<8),d=b&&(null==document.documentMode||document.documentMode<9),e=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),f=b||e,g=/WebKit\//.test(navigator.userAgent),h=g&&/Qt\/\d+\.\d+/.test(navigator.userAgent),i=/Chrome\//.test(navigator.userAgent),j=/Opera\//.test(navigator.userAgent),k=/Apple Computer/.test(navigator.vendor),l=/KHTML\//.test(navigator.userAgent),m=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),n=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),o=/PhantomJS/.test(navigator.userAgent),p=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),q=p||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),r=p||/Mac/.test(navigator.platform),s=/win/i.test(navigator.platform),t=j&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);t&&(t=Number(t[1])),t&&t>=15&&(j=!1,g=!0);var Bb,Ub,Vb,u=r&&(h||j&&(null==t||12.11>t)),v=a||b&&!d,w=!1,x=!1,Eb=0,$b=0,dc=0,ec=null;b?ec=-.53:a?ec=15:i?ec=-.7:k&&(ec=-1/3);var ic,qc,lc=null,sc=y.changeEnd=function(a){return a.text?Dc(a.from.line+a.text.length-1,kf(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};y.Pos=Dc,y.prototype={constructor:y,focus:function{window.focus,Pb(this),Mb(this)},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,bd.hasOwnProperty(a)&&Hb(this,bd[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function{return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||"string"!=typeof b[c]&&b[c].name==a)return b.splice(c,1),!0},addOverlay:Hb(null,function(a,b){var c=a.token?a:y.getMode(this.options,a);if(c.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque}),this.state.modeGen++,Kb(this)}),removeOverlay:Hb(null,function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||"string"==typeof a&&d.name==a)return b.splice(c,1),this.state.modeGen++,Kb(this),void 0}}),indentLine:Hb(null,function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),Lc(this.doc,a)&&Xc(this,a,b,c)}),indentSelection:Hb(null,function(a){var b=this.doc.sel;if(Ec(b.from,b.to))return Xc(this,b.from.line,a,!0);for(var c=b.to.line-(b.to.ch?0:1),d=b.from.line;c>=d;++d)Xc(this,d,a)}),getTokenAt:function(a,b){var c=this.doc;a=Jc(c,a);for(var d=gb(this,a.line,b),e=this.doc.mode,f=ve(c,a.line),g=new sd(f.text,this.options.tabSize);g.pos<a.ch&&!g.eol;){g.start=g.pos;var h=e.token(g,d)}return{start:g.start,end:g.pos,string:g.current,className:h||null,type:h||null,state:d}},getTokenTypeAt:function(a){a=Jc(this.doc,a);var b=ae(this,ve(this.doc,a.line)),c=0,d=(b.length-1)/2,e=a.ch;if(0==e)return b[2];for{var f=c+d>>1;if((f?b[2*f-1]:0)>=e)d=f;else{if(!(b[2*f+1]<e))return b[2*f+2];c=f+1}}},getModeAt:function(a){var b=this.doc.mode;return b.innerMode?y.innerMode(b,this.getTokenAt(a).state).mode:b},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!jd.hasOwnProperty(b))return jd;var d=jd[b],e=this.getModeAt(a);if("string"==typeof e[b])d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;f<e[b].length;f++){var g=d[e[b][f]];g&&c.push(g)}else e.helperType&&d[e.helperType]?c.push(d[e.helperType]):d[e.name]&&c.push(d[e.name]);for(var f=0;f<d._global.length;f++){var h=d._global[f];h.pred(e,this)&&-1==mf(c,h.val)&&c.push(h.val)}return c},getStateAfter:function(a,b){var c=this.doc;return a=Ic(c,null==a?c.first+c.size-1:a),gb(this,a+1,b)},cursorCoords:function(a,b){var c,d=this.doc.sel;return c=null==a?d.head:"object"==typeof a?Jc(this.doc,a):a?d.from:d.to,xb(this,c,b||"page")},charCoords:function(a,b){return wb(this,Jc(this.doc,a),b||"page")},coordsChar:function(a,b){return a=vb(this,a,b||"page"),zb(this,a.left,a.top)},lineAtHeight:function(a,b){return a=vb(this,{top:a,left:0},b||"page").top,Ae(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=!1,d=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>d&&(a=d,c=!0);var e=ve(this.doc,a);return ub(this,ve(this.doc,a),{top:0,left:0},b||"page").top+(c?e.height:0)},defaultTextHeight:function{return Cb(this.display)},defaultCharWidth:function{return Db(this.display)},setGutterMarker:Hb(null,function(a,b,c){return Yc(this,a,function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&tf(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Hb(null,function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Kb(b,d,d+1),tf(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineClass:Hb(null,function(a,b,c){return Yc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[d]){if(new RegExp("(?:^|\\s)"+c+"(?:$|\\s)").test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:Hb(null,function(a,b,c){return Yc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.match(new RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!f)return!1;var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(f.index&&g!=e.length?" ":"")+e.slice(g)||null}return!0})}),addLineWidget:Hb(null,function(a,b,c){return Wd(this,a,b,c)}),removeLineWidget:function(a){a.clear},lineInfo:function(a){if("number"==typeof a){if(!Lc(this.doc,a))return null;var b=a;if(a=ve(this.doc,a),!a)return null}else{var b=ze(a);if(null==b)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function{return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=xb(this,Jc(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Tc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Hb(null,mc),execCommand:function(a){return md.hasOwnProperty(a)?md[a](this):void 0},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=Jc(this.doc,a);b>f&&(g=Zc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Hb(null,function(a,b){var d,c=this.doc.sel;d=c.shift||c.extend||Ec(c.from,c.to)?Zc(this.doc,c.head,a,b,this.options.rtlMoveVisually):0>a?c.from:c.to,Mc(this.doc,d,d,a)}),deleteH:Hb(null,function(a,b){var c=this.doc.sel;Ec(c.from,c.to)?Cc(this.doc,"",c.from,Zc(this.doc,c.head,a,b,!1),"+delete"):Cc(this.doc,"",c.from,c.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=Jc(this.doc,a);b>g;++g){var i=xb(this,h,"div");if(null==f?f=i.left:i.left=f,h=$c(this,i,e,c),h.hitSide)break}return h},moveV:Hb(null,function(a,b){var d,e,c=this.doc.sel;if(c.shift||c.extend||Ec(c.from,c.to)){var f=xb(this,c.head,"div");null!=c.goalColumn&&(f.left=c.goalColumn),d=$c(this,f,a,b),"page"==b&&Wc(this,0,wb(this,d,"div").top-f.top),e=f.left}else d=0>a?c.from:c.to;Mc(this.doc,d,d,a),null!=e&&(c.goalColumn=e)}),toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function{return this.state.focused},scrollTo:Hb(null,function(a,b){Vc(this,a,b)}),getScrollInfo:function{var a=this.display.scroller,b=df;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:Hb(null,function(a,b){null==a?a={from:this.doc.sel.head,to:null}:"number"==typeof a?a={from:Dc(a,0),to:null}:null==a.from&&(a={from:a,to:null}),a.to||(a.to=a.from),b||(b=0);var c=a;null!=a.from.line&&(this.curOp.scrollToPos={from:a.from,to:a.to,margin:b},c={from:xb(this,a.from),to:xb(this,a.to)});var d=Uc(this,Math.min(c.from.left,c.to.left),Math.min(c.from.top,c.to.top)-b,Math.max(c.from.right,c.to.right),Math.max(c.from.bottom,c.to.bottom)+b);Vc(this,d.scrollLeft,d.scrollTop)}),setSize:Hb(null,function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a)),null!=b&&(this.display.wrapper.style.height=c(b)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(a){return Jb(this,a)},refresh:Hb(null,function{var a=null==this.display.cachedTextHeight;rb(this),Vc(this,this.doc.scrollLeft,this.doc.scrollTop),Kb(this),a&&E(this)}),swapDoc:Hb(null,function(a){var b=this.doc;return b.cm=null,ue(this,a),rb(this),Ob(this,!0),Vc(this,a.scrollLeft,a.scrollTop),$e(this,"swapDoc",this,b),b}),getInputField:function{return this.display.input},getWrapperElement:function{return this.display.wrapper},getScrollerElement:function{return this.display.scroller},getGutterElement:function{return this.display.gutters}},cf(y);var bd=y.optionHandlers={},cd=y.defaults={},ed=y.Init={toString:function{return"CodeMirror.Init"}};dd("value","",function(a,b){a.setValue(b)},!0),dd("mode",null,function(a,b){a.doc.modeOption=b,A(a)},!0),dd("indentUnit",2,A,!0),dd("indentWithTabs",!1),dd("smartIndent",!0),dd("tabSize",4,function(a){B(a),rb(a),Kb(a)},!0),dd("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(a,b){a.options.specialChars=new RegExp(b.source+(b.test("	")?"":"|	"),"g"),a.refresh},!0),dd("specialCharPlaceholder",ge,function(a){a.refresh},!0),dd("electricChars",!0),dd("rtlMoveVisually",!s),dd("wholeLineUpdateBefore",!0),dd("theme","default",function(a){G(a),H(a)},!0),dd("keyMap","default",F),dd("extraKeys",null),dd("onKeyEvent",null),dd("onDragEvent",null),dd("lineWrapping",!1,C,!0),dd("gutters",[],function(a){L(a.options),H(a)},!0),dd("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?R(a.display)+"px":"0",a.refresh},!0),dd("coverGutterNextToScrollbar",!1,M,!0),dd("lineNumbers",!1,function(a){L(a.options),H(a)},!0),dd("firstLineNumber",1,H,!0),dd("lineNumberFormatter",function(a){return a},H,!0),dd("showCursorWhenSelecting",!1,_,!0),dd("resetSelectionOnContextMenu",!0),dd("readOnly",!1,function(a,b){"nocursor"==b?(pc(a),a.display.input.blur,a.display.disabled=!0):(a.display.disabled=!1,b||Ob(a,!0))}),dd("disableInput",!1,function(a,b){b||Ob(a,!0)},!0),dd("dragDrop",!0),dd("cursorBlinkRate",530),dd("cursorScrollMargin",0),dd("cursorHeight",1),dd("workTime",100),dd("workDelay",100),dd("flattenSpans",!0,B,!0),dd("addModeClass",!1,B,!0),dd("pollInterval",100),dd("undoDepth",40,function(a,b){a.doc.history.undoDepth=b}),dd("historyEventDelay",500),dd("viewportMargin",10,function(a){a.refresh},!0),dd("maxHighlightLength",1e4,B,!0),dd("crudeMeasuringFrom",1e4),dd("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),dd("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),dd("autofocus",null);var fd=y.modes={},gd=y.mimeModes={};y.defineMode=function(a,b){if(y.defaults.mode||"null"==a||(y.defaults.mode=a),arguments.length>2){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}fd[a]=b},y.defineMIME=function(a,b){gd[a]=b},y.resolveMode=function(a){if("string"==typeof a&&gd.hasOwnProperty(a))a=gd[a];else if(a&&"string"==typeof a.name&&gd.hasOwnProperty(a.name)){var b=gd[a.name];a=nf(b,a),a.name=b.name}else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return y.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}},y.getMode=function(a,b){var b=y.resolveMode(b),c=fd[b.name];if(!c)return y.getMode(a,"text/plain");var d=c(a,b);if(hd.hasOwnProperty(b.name)){var e=hd[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}if(d.name=b.name,b.helperType&&(d.helperType=b.helperType),b.modeProps)for(var f in b.modeProps)d[f]=b.modeProps[f];return d},y.defineMode("null",function{return{token:function(a){a.skipToEnd}}}),y.defineMIME("text/plain","null");var hd=y.modeExtensions={};y.extendMode=function(a,b){var c=hd.hasOwnProperty(a)?hd[a]:hd[a]={};of(b,c)},y.defineExtension=function(a,b){y.prototype[a]=b},y.defineDocExtension=function(a,b){qe.prototype[a]=b},y.defineOption=dd;var id=[];y.defineInitHook=function(a){id.push(a)};var jd=y.helpers={};y.registerHelper=function(a,b,c){jd.hasOwnProperty(a)||(jd[a]=y[a]={_global:[]}),jd[a][b]=c},y.registerGlobalHelper=function(a,b,c,d){y.registerHelper(a,b,d),jd[a]._global.push({pred:c,val:d})},y.isWordChar=sf,y.copyState=kd,y.startState=ld,y.innerMode=function(a,b){for(a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var md=y.commands={selectAll:function(a){a.setSelection(Dc(a.firstLine,0),Dc(a.lastLine))},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),d=!Ec(b,c);d||a.getLine(b.line).length!=b.ch?a.replaceRange("",b,d?c:Dc(b.line),"+delete"):a.replaceRange("",b,Dc(b.line+1,0),"+delete")},deleteLine:function(a){var b=a.getCursor.line;a.replaceRange("",Dc(b,0),Dc(b),"+delete")},delLineLeft:function(a){var b=a.getCursor;a.replaceRange("",Dc(b.line,0),b,"+delete")},undo:function(a){a.undo},redo:function(a){a.redo},goDocStart:function(a){a.extendSelection(Dc(a.firstLine,0))},goDocEnd:function(a){a.extendSelection(Dc(a.lastLine))},goLineStart:function(a){a.extendSelection(Qf(a,a.getCursor.line))},goLineStartSmart:function(a){var b=a.getCursor,c=Qf(a,b.line),d=a.getLineHandle(c.line),e=Ce(d);if(e&&0!=e[0].level)a.extendSelection(c);else{var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;a.extendSelection(Dc(c.line,g?0:f))}},goLineEnd:function(a){a.extendSelection(Rf(a,a.getCursor.line))},goLineRight:function(a){var b=a.charCoords(a.getCursor,"div").top+5;a.extendSelection(a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div"))},goLineLeft:function(a){var b=a.charCoords(a.getCursor,"div").top+5;a.extendSelection(a.coordsChar({left:0,top:b},"div"))},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection("	","end","+input")},defaultTab:function(a){a.somethingSelected?a.indentSelection("add"):a.replaceSelection("	","end","+input")},transposeChars:function(a){var b=a.getCursor,c=a.getLine(b.line);b.ch>0&&b.ch<c.length-1&&a.replaceRange(c.charAt(b.ch)+c.charAt(b.ch-1),Dc(b.line,b.ch-1),Dc(b.line,b.ch+1))},newlineAndIndent:function(a){Hb(a,function{a.replaceSelection("\n","end","+input"),a.indentLine(a.getCursor.line,null,!0)})},toggleOverwrite:function(a){a.toggleOverwrite}},nd=y.keyMap={};nd.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"},nd.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"},nd.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delLineLeft",fallthrough:["basic","emacsy"]},nd["default"]=r?nd.macDefault:nd.pcDefault,nd.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"},y.lookupKey=pd,y.isModifierKey=qd,y.keyName=rd,y.fromTextArea=function(a,b){function e{a.value=i.getValue}if(b||(b={}),b.value=a.value,!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex),!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder),null==b.autofocus){var c=document.body;try{c=document.activeElement}catch(d){}b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(Ve(a.form,"submit",e),!b.leaveSubmitMethodAlone)){var f=a.form,g=f.submit;try{var h=f.submit=function{e,f.submit=g,f.submit,f.submit=h}}catch(d){}}a.style.display="none";var i=y(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);return i.save=e,i.getTextArea=function{return a},i.toTextArea=function{e,a.parentNode.removeChild(i.getWrapperElement),a.style.display="",a.form&&(We(a.form,"submit",e),"function"==typeof a.form.submit&&(a.form.submit=g))},i},sd.prototype={eol:function{return this.pos>=this.string.length},sol:function{return this.pos==this.lineStart},peek:function{return this.string.charAt(this.pos)||void 0},next:function{return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a)var c=b==a;else var c=b&&(a.test?a.test(b):a(b));return c?(++this.pos,b):void 0},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function{for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function{this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},backUp:function(a){this.pos-=a},column:function{return this.lastColumnPos<this.start&&(this.lastColumnValue=gf(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?gf(this.string,this.lineStart,this.tabSize):0) },indentation:function{return gf(this.string,null,this.tabSize)-(this.lineStart?gf(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if("string"!=typeof a){var f=this.string.slice(this.pos).match(a);return f&&f.index>0?null:(f&&b!==!1&&(this.pos+=f[0].length),f)}var d=function(a){return c?a.toLowerCase:a},e=this.string.substr(this.pos,a.length);return d(e)==d(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function{return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b}finally{this.lineStart-=a}}},y.StringStream=sd,y.TextMarker=td,cf(td),td.prototype.clear=function{if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&Fb(a),bf(this,"clear")){var c=this.find;c&&$e(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;f<this.lines.length;++f){var g=this.lines[f],h=yd(g.markedSpans,this);null!=h.to&&(e=ze(g)),g.markedSpans=zd(g.markedSpans,h),null!=h.from?d=ze(g):this.collapsed&&!Pd(this.doc,g)&&a&&ye(g,Cb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var i=Od(a.doc,this.lines[f]),j=J(a.doc,i);j>a.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&Kb(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Pc(a)),b&&Gb(a)}},td.prototype.find=function(a){for(var b,c,d=0;d<this.lines.length;++d){var e=this.lines[d],f=yd(e.markedSpans,this);if(null!=f.from||null!=f.to){var g=ze(e);null!=f.from&&(b=Dc(g,f.from)),null!=f.to&&(c=Dc(g,f.to))}}return"bookmark"!=this.type||a?b&&{from:b,to:c}:b},td.prototype.changed=function{var a=this.find,b=this.doc.cm;if(a&&b){"bookmark"!=this.type&&(a=a.from);var c=ve(this.doc,a.line);if(mb(b,c),a.line>=b.display.showingFrom&&a.line<b.display.showingTo){for(var d=b.display.lineDiv.firstChild;d;d=d.nextSibling)if(d.lineObj==c){d.offsetHeight!=c.height&&ye(c,d.offsetHeight);break}Jb(b,function{b.curOp.selectionChanged=b.curOp.forceUpdate=b.curOp.updateMaxLine=!0})}}},td.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=mf(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},td.prototype.detachLine=function(a){if(this.lines.splice(mf(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}};var ud=0;y.SharedTextMarker=wd,cf(wd),wd.prototype.clear=function{if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear;$e(this,"clear")}},wd.prototype.find=function{return this.primary.find};var Td=y.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.cm=a,this.node=b};cf(Td),Td.prototype.clear=Ud(function{var a=this.line.widgets,b=ze(this.line);if(null!=b&&a){for(var c=0;c<a.length;++c)a[c]==this&&a.splice(c--,1);a.length||(this.line.widgets=null);var d=Be(this.cm,this.line)<this.cm.doc.scrollTop;ye(this.line,Math.max(0,this.line.height-Vd(this))),d&&Wc(this.cm,0,-this.height),Kb(this.cm,b,b+1)}}),Td.prototype.changed=Ud(function{var a=this.height;this.height=null;var b=Vd(this)-a;if(b){ye(this.line,this.line.height+b);var c=ze(this.line);Kb(this.cm,c,c+1)}});var Xd=y.Line=function(a,b,c){this.text=a,Sd(this,b),this.height=c?c(this):1};cf(Xd),Xd.prototype.lineNo=function{return ze(this)};var ce={},de={};ne.prototype={chunkSize:function{return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;d>c;++c){var e=this.lines[c];this.height-=e.height,Zd(e),$e(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertInner:function(a,b,c){this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0,e=b.length;e>d;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;d>a;++a)if(c(this.lines[a]))return!0}},oe.prototype={chunkSize:function{return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize;if(e>a){var f=Math.min(b,e-a),g=d.height;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}if(this.size-b<25){var h=[];this.collapse(h),this.children=[new ne(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0,c=this.children.length;c>b;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize;if(g>=a){if(f.insertInner(a,b,c),f.lines&&f.lines.length>50){for(f.lines.length>50;){var h=f.lines.splice(f.lines.length-25,25),i=new ne(h);f.height-=i.height,this.children.splice(d+1,0,i),i.parent=this}this.maybeSpill}break}a-=g}},maybeSpill:function{if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new oe(b);if(a.parent){a.size-=c.size,a.height-=c.height;var e=mf(a.parent.children,a);a.parent.children.splice(e+1,0,c)}else{var d=new oe(a.children);d.parent=a,a.children=[d,c],a=d}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill}},iterN:function(a,b,c){for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize;if(g>a){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if(0==(b-=h))break;a=0}else a-=g}}};var pe=0,qe=y.Doc=function(a,b,c){if(!(this instanceof qe))return new qe(a,b,c);null==c&&(c=0),oe.call(this,[new ne([new Xd("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=De,this.cleanGeneration=1,this.frontier=c;var d=Dc(c,0);this.sel={from:d,to:d,head:d,anchor:d,shift:!1,extend:!1,goalColumn:null},this.id=++pe,this.modeOption=b,"string"==typeof a&&(a=Hf(a)),me(this,{from:d,to:d,text:a},null,{head:d,anchor:d})};qe.prototype=nf(oe.prototype,{constructor:qe,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0,e=b.length;e>d;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=xe(this,this.first,this.first+this.size);return a===!1?b:b.join(a||"\n")},setValue:function(a){var b=Dc(this.first,0),c=this.first+this.size-1;wc(this,{from:b,to:Dc(c,ve(this,c).text.length),text:Hf(a),origin:"setValue"},{head:b,anchor:b},!0)},replaceRange:function(a,b,c,d){b=Jc(this,b),c=c?Jc(this,c):b,Cc(this,a,b,c,d)},getRange:function(a,b,c){var d=we(this,Jc(this,a),Jc(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},setLine:function(a,b){Lc(this,a)&&Cc(this,b,Dc(a,0),Jc(this,Dc(a)))},removeLine:function(a){a?Cc(this,"",Jc(this,Dc(a-1)),Jc(this,Dc(a))):Cc(this,"",Dc(0,0),Jc(this,Dc(1,0)))},getLineHandle:function(a){return Lc(this,a)?ve(this,a):void 0},getLineNumber:function(a){return ze(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=ve(this,a)),Od(this,a)},lineCount:function{return this.size},firstLine:function{return this.first},lastLine:function{return this.first+this.size-1},clipPos:function(a){return Jc(this,a)},getCursor:function(a){var c,b=this.sel;return c=null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||a===!1?b.to:b.from,Hc(c)},somethingSelected:function{return!Ec(this.sel.head,this.sel.anchor)},setCursor:Ib(function(a,b,c){var d=Jc(this,"number"==typeof a?Dc(a,b||0):a);c?Mc(this,d):Oc(this,d,d)}),setSelection:Ib(function(a,b,c){Oc(this,Jc(this,a),Jc(this,b||a),c)}),extendSelection:Ib(function(a,b,c){Mc(this,Jc(this,a),b&&Jc(this,b),c)}),getSelection:function(a){return this.getRange(this.sel.from,this.sel.to,a)},replaceSelection:function(a,b,c){wc(this,{from:this.sel.from,to:this.sel.to,text:Hf(a),origin:c},b||"around")},undo:Ib(function{yc(this,"undo")}),redo:Ib(function{yc(this,"redo")}),setExtending:function(a){this.sel.extend=a},historySize:function{var a=this.history;return{undo:a.done.length,redo:a.undone.length}},clearHistory:function{this.history=De(this.history.maxGeneration)},markClean:function{this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){return a&&(this.history.lastOp=this.history.lastOrigin=null),this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function{return{done:Je(this.history.done),undone:Je(this.history.undone)}},setHistory:function(a){var b=this.history=De(this.history.maxGeneration);b.done=a.done.slice(0),b.undone=a.undone.slice(0)},markText:function(a,b,c){return vd(this,Jc(this,a),Jc(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1};return a=Jc(this,a),vd(this,a,a,c,"bookmark")},findMarksAt:function(a){a=Jc(this,a);var b=[],c=ve(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},getAllMarks:function{var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;d<c.length;++d)null!=c[d].from&&a.push(c[d].marker)}),a},posFromIndex:function(a){var b,c=this.first;return this.iter(function(d){var e=d.text.length+1;return e>a?(b=a,!0):(a-=e,++c,void 0)}),Jc(this,Dc(c,b))},indexFromPos:function(a){a=Jc(this,a);var b=a.ch;return a.line<this.first||a.ch<0?0:(this.iter(this.first,a.line,function(a){b+=a.text.length+1}),b)},copy:function(a){var b=new qe(xe(this,this.first,this.first+this.size),this.modeOption,this.first);return b.scrollTop=this.scrollTop,b.scrollLeft=this.scrollLeft,b.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:!1,goalColumn:this.sel.goalColumn},a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory)),b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from),null!=a.to&&a.to<c&&(c=a.to);var d=new qe(xe(this,b,c),a.mode||this.modeOption,b);return a.sharedHist&&(d.history=this.history),(this.linked||(this.linked=[])).push({doc:d,sharedHist:a.sharedHist}),d.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}],d},unlinkDoc:function(a){if(a instanceof y&&(a=a.doc),this.linked)for(var b=0;b<this.linked.length;++b){var c=this.linked[b];if(c.doc==a){this.linked.splice(b,1),a.unlinkDoc(this);break}}if(a.history==this.history){var d=[a.id];te(a,function(a){d.push(a.id)},!0),a.history=De,a.history.done=Je(this.history.done,d),a.history.undone=Je(this.history.undone,d)}},iterLinkedDocs:function(a){te(this,a)},getMode:function{return this.mode},getEditor:function{return this.cm}}),qe.prototype.eachLine=qe.prototype.iter;var re="iter insert remove copy getEditor".split(" ");for(var se in qe.prototype)qe.prototype.hasOwnProperty(se)&&mf(re,se)<0&&(y.prototype[se]=function(a){return function{return a.apply(this.doc,arguments)}}(qe.prototype[se]));cf(qe),y.e_stop=Se,y.e_preventDefault=Pe,y.e_stopPropagation=Qe;var Ye,Ze=0;y.on=Ve,y.off=We,y.signal=Xe;var df=30,ef=y.Pass={toString:function{return"CodeMirror.Pass"}};ff.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}},y.countColumn=gf;var hf=[""],rf=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,uf=/[\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]/;y.replaceGetRect=function(a){Af=a};var Bf=function{if(d)return!1;var a=wf("div");return"draggable"in a||"dragDrop"in a};a?Cf=function(a,b){return 36==a.charCodeAt(b-1)&&39==a.charCodeAt(b)}:k&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?Cf=function(a,b){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(a.slice(b-1,b+1))}:g&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)?Cf=function(a,b){var c=a.charCodeAt(b-1);return c>=8208&&8212>=c}:g&&(Cf=function(a,b){if(b>1&&45==a.charCodeAt(b-1)){if(/\w/.test(a.charAt(b-2))&&/[^\-?\.]/.test(a.charAt(b)))return!0;if(b>2&&/[\d\.,]/.test(a.charAt(b-2))&&/[\d\.,]/.test(a.charAt(b)))return!1}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|\u2026[\w~`@#$%\^&*(_=+{[><]/.test(a.slice(b-1,b+1))});var Df,Ff,Hf=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;d>=b;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)};y.splitLines=Hf;var If=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange}catch(c){}return b&&b.parentElement==a?0!=b.compareEndPoints("StartToEnd",b):!1},Jf=function{var a=wf("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)},Kf={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};y.keyNames=Kf,function{for(var a=0;10>a;a++)Kf[a+48]=Kf[a+96]=String(a);for(var a=65;90>=a;a++)Kf[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)Kf[a+111]=Kf[a+63235]="F"+a};var Tf,Yf=function{function c(c){return 255>=c?a.charAt(c):c>=1424&&1524>=c?"R":c>=1536&&1791>=c?b.charAt(c-1536):c>=1792&&2220>=c?"r":"L"}var a="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",b="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/,i="L";return function(a){if(!d.test(a))return!1;for(var l,b=a.length,j=[],k=0;b>k;++k)j.push(l=c(a.charCodeAt(k)));for(var k=0,m=i;b>k;++k){var l=j[k];"m"==l?j[k]=m:m=l}for(var k=0,n=i;b>k;++k){var l=j[k];"1"==l&&"r"==n?j[k]="n":f.test(l)&&(n=l,"r"==l&&(j[k]="R"))}for(var k=1,m=j[0];b-1>k;++k){var l=j[k];"+"==l&&"1"==m&&"1"==j[k+1]?j[k]="1":","!=l||m!=j[k+1]||"1"!=m&&"n"!=m||(j[k]=m),m=l}for(var k=0;b>k;++k){var l=j[k];if(","==l)j[k]="N";else if("%"==l){for(var o=k+1;b>o&&"%"==j[o];++o);for(var p=k&&"!"==j[k-1]||b>o&&"1"==j[o]?"1":"N",q=k;o>q;++q)j[q]=p;k=o-1}}for(var k=0,n=i;b>k;++k){var l=j[k];"L"==n&&"1"==l?j[k]="L":f.test(l)&&(n=l)}for(var k=0;b>k;++k)if(e.test(j[k])){for(var o=k+1;b>o&&e.test(j[o]);++o);for(var r="L"==(k?j[k-1]:i),s="L"==(b>o?j[o]:i),p=r||s?"L":"R",q=k;o>q;++q)j[q]=p;k=o-1}for(var u,t=[],k=0;b>k;)if(g.test(j[k])){var v=k;for(++k;b>k&&g.test(j[k]);++k);t.push({from:v,to:k,level:0})}else{var w=k,x=t.length;for(++k;b>k&&"L"!=j[k];++k);for(var q=w;k>q;)if(h.test(j[q])){q>w&&t.splice(x,0,{from:w,to:q,level:1});var y=q;for(++q;k>q&&h.test(j[q]);++q);t.splice(x,0,{from:y,to:q,level:2}),w=q}else++q;k>w&&t.splice(x,0,{from:w,to:k,level:1})}return 1==t[0].level&&(u=a.match(/^\s+/))&&(t[0].from=u[0].length,t.unshift({from:0,to:u[0].length,level:0})),1==kf(t).level&&(u=a.match(/\s+$/))&&(kf(t).to-=u[0].length,t.push({from:b-u[0].length,to:b,level:0})),t[0].level!=kf(t).level&&t.push({from:b,to:b,level:t[0].level}),t}};return y.version="3.21.0",y},CodeMirror.defineMode("javascript",function(a,b){function i(a){for(var c,b=!1,d=!1;null!=(c=a.next);){if(!b){if("/"==c&&!d)return;"["==c?d=!0:d&&"]"==c&&(d=!1)}b=!b&&"\\"==c}}function l(a,b,c){return j=a,k=c,b}function m(a,b){var c=a.next;if('"'==c||"'"==c)return b.tokenize=n(c),b.tokenize(a,b);if("."==c&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return l("number","number");if("."==c&&a.match(".."))return l("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(c))return l(c);if("="==c&&a.eat(">"))return l("=>","operator");if("0"==c&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),l("number","number");if(/\d/.test(c))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),l("number","number");if("/"==c)return a.eat("*")?(b.tokenize=o,o(a,b)):a.eat("/")?(a.skipToEnd,l("comment","comment")):"operator"==b.lastType||"keyword c"==b.lastType||"sof"==b.lastType||/^[\[{}\(,;:]$/.test(b.lastType)?(i(a),a.eatWhile(/[gimy]/),l("regexp","string-2")):(a.eatWhile(h),l("operator","operator",a.current));if("`"==c)return b.tokenize=p,p(a,b);if("#"==c)return a.skipToEnd,l("error","error");if(h.test(c))return a.eatWhile(h),l("operator","operator",a.current);a.eatWhile(/[\w\$_]/);var d=a.current,e=g.propertyIsEnumerable(d)&&g[d];return e&&"."!=b.lastType?l(e.type,e.style,d):l("variable","variable",d)}function n(a){return function(b,c){for(var e,d=!1;null!=(e=b.next)&&(e!=a||d);)d=!d&&"\\"==e;return d||(c.tokenize=m),l("string","string")}}function o(a,b){for(var d,c=!1;d=a.next;){if("/"==d&&c){b.tokenize=m;break}c="*"==d}return l("comment","comment")}function p(a,b){for(var d,c=!1;null!=(d=a.next);){if(!c&&("`"==d||"$"==d&&a.eat("{"))){b.tokenize=m;break}c=!c&&"\\"==d}return l("quasi","string-2",a.current)}function r(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf("=>",a.start);if(!(0>c)){for(var d=0,e=!1,f=c-1;f>=0;--f){var g=a.string.charAt(f),h=q.indexOf(g);if(h>=0&&3>h){if(!d){++f;break}if(0==--d)break}else if(h>=3&&6>h)++d;else if(/[$\w]/.test(g))e=!0;else if(e&&!d){++f;break}}e&&!d&&(b.fatArrowAt=f)}}function t(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,null!=d&&(this.align=d)}function u(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0;for(var d=a.context;d;d=d.prev)for(var c=d.vars;c;c=c.next)if(c.name==b)return!0}function v(a,b,c,d,f){var g=a.cc;for(w.state=a,w.stream=f,w.marked=null,w.cc=g,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);;){var h=g.length?g.pop:e?H:G;if(h(c,d)){for(g.length&&g[g.length-1].lex;)g.pop;return w.marked?w.marked:"variable"==c&&u(a,d)?"variable-2":b}}}function x{for(var a=arguments.length-1;a>=0;a--)w.cc.push(arguments[a])}function y{return x.apply(null,arguments),!0}function z(a){function c(b){for(var c=b;c;c=c.next)if(c.name==a)return!0;return!1}var d=w.state;if(d.context){if(w.marked="def",c(d.localVars))return;d.localVars={name:a,next:d.localVars}}else{if(c(d.globalVars))return;b.globalVars&&(d.globalVars={name:a,next:d.globalVars})}}function B{w.state.context={prev:w.state.context,vars:w.state.localVars},w.state.localVars=A}function C{w.state.localVars=w.state.context.vars,w.state.context=w.state.context.prev}function D(a,b){var c=function{var c=w.state,d=c.indented;"stat"==c.lexical.type&&(d=c.lexical.indented),c.lexical=new t(d,w.stream.column,a,null,c.lexical,b)};return c.lex=!0,c}function E{var a=w.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function F(a){return function(b){return b==a?y:";"==a?x:y(arguments.callee)}}function G(a,b){return"var"==a?y(D("vardef",b.length),ab,F(";"),E):"keyword a"==a?y(D("form"),H,G,E):"keyword b"==a?y(D("form"),G,E):"{"==a?y(D("}"),Z,E):";"==a?y:"if"==a?y(D("form"),H,G,E,fb):"function"==a?y(lb):"for"==a?y(D("form"),gb,G,E):"variable"==a?y(D("stat"),S):"switch"==a?y(D("form"),H,D("}","switch"),F("{"),Z,E,E):"case"==a?y(H,F(":")):"default"==a?y(F(":")):"catch"==a?y(D("form"),B,F("("),mb,F(")"),G,E,C):"module"==a?y(D("form"),B,qb,C,E):"class"==a?y(D("form"),nb,pb,E):"export"==a?y(D("form"),rb,E):"import"==a?y(D("form"),sb,E):x(D("stat"),H,F(";"),E)}function H(a){return J(a,!1)}function I(a){return J(a,!0)}function J(a,b){if(w.state.fatArrowAt==w.stream.start){var c=b?R:Q;if("("==a)return y(B,D(")"),X(bb,")"),E,F("=>"),c,C);if("variable"==a)return x(B,bb,F("=>"),c,C)}var d=b?N:M;return s.hasOwnProperty(a)?y(d):"function"==a?y(lb):"keyword c"==a?y(b?L:K):"("==a?y(D(")"),K,xb,F(")"),E,d):"operator"==a||"spread"==a?y(b?I:H):"["==a?y(D("]"),vb,E,d):"{"==a?Y(U,"}",null,d):y}function K(a){return a.match(/[;\}\)\],]/)?x:x(H)}function L(a){return a.match(/[;\}\)\],]/)?x:x(I)}function M(a,b){return","==a?y(H):N(a,b,!1)}function N(a,b,c){var d=0==c?M:N,e=0==c?H:I;return"=>"==b?y(B,c?R:Q,C):"operator"==a?/\+\+|--/.test(b)?y(d):"?"==b?y(H,F(":"),e):y(e):"quasi"==a?(w.cc.push(d),O(b)):";"!=a?"("==a?Y(I,")","call",d):"."==a?y(T,d):"["==a?y(D("]"),K,F("]"),E,d):void 0:void 0}function O(a){return"${"!=a.slice(a.length-2)?y:y(H,P)}function P(a){return"}"==a?(w.marked="string-2",w.state.tokenize=p,y):void 0}function Q(a){return r(w.stream,w.state),"{"==a?x(G):x(H)}function R(a){return r(w.stream,w.state),"{"==a?x(G):x(I)}function S(a){return":"==a?y(E,G):x(M,F(";"),E)}function T(a){return"variable"==a?(w.marked="property",y):void 0}function U(a,b){if("variable"==a){if(w.marked="property","get"==b||"set"==b)return y(V)}else if("number"==a||"string"==a)w.marked=a+" property";else if("["==a)return y(H,F("]"),W);return s.hasOwnProperty(a)?y(W):void 0}function V(a){return"variable"!=a?x(W):(w.marked="property",y(lb))}function W(a){return":"==a?y(I):"("==a?x(lb):void 0}function X(a,b){function c(d){if(","==d){var e=w.state.lexical;return"call"==e.info&&(e.pos=(e.pos||0)+1),y(a,c)}return d==b?y:y(F(b))}return function(d){return d==b?y:x(a,c)}}function Y(a,b,c){for(var d=3;d<arguments.length;d++)w.cc.push(arguments[d]);return y(D(b,c),X(a,b),E)}function Z(a){return"}"==a?y:x(G,Z)}function $(a){return f&&":"==a?y(_):void 0}function _(a){return"variable"==a?(w.marked="variable-3",y):void 0}function ab{return x(bb,$,db,eb)}function bb(a,b){return"variable"==a?(z(b),y):"["==a?Y(bb,"]"):"{"==a?Y(cb,"}"):void 0}function cb(a,b){return"variable"!=a||w.stream.match(/^\s*:/,!1)?("variable"==a&&(w.marked="property"),y(F(":"),bb,db)):(z(b),y(db))}function db(a,b){return"="==b?y(I):void 0}function eb(a){return","==a?y(ab):void 0}function fb(a,b){return"keyword b"==a&&"else"==b?y(D("form"),G,E):void 0}function gb(a){return"("==a?y(D(")"),hb,F(")"),E):void 0}function hb(a){return"var"==a?y(ab,F(";"),jb):";"==a?y(jb):"variable"==a?y(ib):x(H,F(";"),jb)}function ib(a,b){return"in"==b||"of"==b?(w.marked="keyword",y(H)):y(M,jb)}function jb(a,b){return";"==a?y(kb):"in"==b||"of"==b?(w.marked="keyword",y(H)):x(H,F(";"),kb)}function kb(a){")"!=a&&y(H)}function lb(a,b){return"*"==b?(w.marked="keyword",y(lb)):"variable"==a?(z(b),y(lb)):"("==a?y(B,D(")"),X(mb,")"),E,G,C):void 0}function mb(a){return"spread"==a?y(mb):x(bb,$)}function nb(a,b){return"variable"==a?(z(b),y(ob)):void 0}function ob(a,b){return"extends"==b?y(H):void 0}function pb(a){return"{"==a?Y(U,"}"):void 0}function qb(a,b){return"string"==a?y(G):"variable"==a?(z(b),y(ub)):void 0}function rb(a,b){return"*"==b?(w.marked="keyword",y(ub,F(";"))):"default"==b?(w.marked="keyword",y(H,F(";"))):x(G)}function sb(a){return"string"==a?y:x(tb,ub)}function tb(a,b){return"{"==a?Y(tb,"}"):("variable"==a&&z(b),y)}function ub(a,b){return"from"==b?(w.marked="keyword",y(H)):void 0}function vb(a){return"]"==a?y:x(I,wb)}function wb(a){return"for"==a?x(xb,F("]")):","==a?y(X(I,"]")):x(X(I,"]"))}function xb(a){return"for"==a?y(gb,xb):"if"==a?y(H,xb):void 0}var j,k,c=a.indentUnit,d=b.statementIndent,e=b.json,f=b.typescript,g=function{function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),g={type:"atom",style:"atom"},h={"if":a("if"),"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":d,"delete":d,"throw":d,"debugger":d,"var":a("var"),"const":a("var"),let:a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":g,"false":g,"null":g,undefined:g,NaN:g,Infinity:g,"this":a("this"),module:a("module"),"class":a("class"),"super":a("atom"),yield:d,"export":a("export"),"import":a("import"),"extends":d};if(f){var i={type:"variable",style:"variable-3"},j={"interface":a("interface"),"extends":a("extends"),constructor:a("constructor"),"public":a("public"),"private":a("private"),"protected":a("protected"),"static":a("static"),string:i,number:i,bool:i,any:i};for(var k in j)h[k]=j[k]}return h},h=/[+\-*&%=<>!?|~^]/,q="([{}])",s={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0},w={state:null,column:null,marked:null,cc:null},A={name:"this",next:{name:"arguments"}};return E.lex=!0,{startState:function(a){var d={tokenize:m,lastType:"sof",cc:[],lexical:new t((a||0)-c,0,"block",!1),localVars:b.localVars,context:b.localVars&&{vars:b.localVars},indented:0};return b.globalVars&&(d.globalVars=b.globalVars),d},token:function(a,b){if(a.sol&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation,r(a,b)),b.tokenize!=o&&a.eatSpace)return null;var c=b.tokenize(a,b);return"comment"==j?c:(b.lastType="operator"!=j||"++"!=k&&"--"!=k?j:"incdec",v(b,c,j,k,a))},indent:function(a,e){if(a.tokenize==o)return CodeMirror.Pass;if(a.tokenize!=m)return 0;for(var f=e&&e.charAt(0),g=a.lexical,h=a.cc.length-1;h>=0;--h){var i=a.cc[h];if(i==E)g=g.prev;else if(i!=fb)break}"stat"==g.type&&"}"==f&&(g=g.prev),d&&")"==g.type&&"stat"==g.prev.type&&(g=g.prev);var j=g.type,k=f==j;return"vardef"==j?g.indented+("operator"==a.lastType||","==a.lastType?g.info+1:0):"form"==j&&"{"==f?g.indented:"form"==j?g.indented+c:"stat"==j?g.indented+("operator"==a.lastType||","==a.lastType?d||c:0):"switch"!=g.info||k||0==b.doubleIndentSwitch?g.align?g.column+(k?0:1):g.indented+(k?0:c):g.indented+(/^(?:case|default)\b/.test(e)?c:2*c)},electricChars:":{}",blockCommentStart:e?null:"/*",blockCommentEnd:e?null:"*/",lineComment:e?null:"//",fold:"brace",helperType:e?"json":"javascript",jsonMode:e}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("text/ecmascript","javascript"),CodeMirror.defineMIME("application/javascript","javascript"),CodeMirror.defineMIME("application/ecmascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMIME("application/x-json",{name:"javascript",json:!0}),CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:!0}),CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:!0}),function{"use strict";function c(c){"activeLine"in c.state&&(c.removeLineClass(c.state.activeLine,"wrap",a),c.removeLineClass(c.state.activeLine,"background",b))}function d(d,e){var f=d.getLineHandleVisualStart(e);d.state.activeLine!=f&&d.operation(function{c(d),d.addLineClass(f,"wrap",a),d.addLineClass(f,"background",b),d.state.activeLine=f})}function e(a,b){d(a,b.head.line)}var a="CodeMirror-activeline",b="CodeMirror-activeline-background";CodeMirror.defineOption("styleActiveLine",!1,function(a,b,f){var g=f&&f!=CodeMirror.Init;b&&!g?(d(a,a.getCursor.line),a.on("beforeSelectionChange",e)):!b&&g&&(a.off("beforeSelectionChange",e),c(a),delete a.state.activeLine)})},CodeMirror.registerHelper("fold","brace",function(a,b){function g(e){for(var g=b.ch,h=0;;){var i=0>=g?-1:d.lastIndexOf(e,g-1);if(-1!=i){if(1==h&&i<b.ch)break;if(f=a.getTokenTypeAt(CodeMirror.Pos(c,i+1)),!/^(comment|string)/.test(f))return i+1;g=i-1}else{if(1==h)break;h=1,g=d.length}}}var e,f,c=b.line,d=a.getLine(c),h="{",i="}",e=g("{");if(null==e&&(h="[",i="]",e=g("[")),null!=e){var l,m,j=1,k=a.lastLine;a:for(var n=c;k>=n;++n)for(var o=a.getLine(n),p=n==c?e:0;;){var q=o.indexOf(h,p),r=o.indexOf(i,p);if(0>q&&(q=o.length),0>r&&(r=o.length),p=Math.min(q,r),p==o.length)break;if(a.getTokenTypeAt(CodeMirror.Pos(n,p+1))==f)if(p==q)++j;else if(!--j){l=n,m=p;break a}++p}if(null!=l&&(c!=l||m!=e))return{from:CodeMirror.Pos(c,e),to:CodeMirror.Pos(l,m)}}}),CodeMirror.braceRangeFinder=CodeMirror.fold.brace,CodeMirror.registerHelper("fold","import",function(a,b){function c(b){if(b<a.firstLine||b>a.lastLine)return null;var c=a.getTokenAt(CodeMirror.Pos(b,1));if(/\S/.test(c.string)||(c=a.getTokenAt(CodeMirror.Pos(b,c.end+1))),"keyword"!=c.type||"import"!=c.string)return null;for(var d=b,e=Math.min(a.lastLine,b+10);e>=d;++d){var f=a.getLine(d),g=f.indexOf(";");if(-1!=g)return{startCh:c.end,end:CodeMirror.Pos(d,g)}}}var e,b=b.line,d=c(b);if(!d||c(b-1)||(e=c(b-2))&&e.end.line==b-1)return null;for(var f=d.end;;){var g=c(f.line+1);if(null==g)break;f=g.end}return{from:a.clipPos(CodeMirror.Pos(b,d.startCh+1)),to:f}}),CodeMirror.importRangeFinder=CodeMirror.fold["import"],CodeMirror.registerHelper("fold","include",function(a,b){function c(b){if(b<a.firstLine||b>a.lastLine)return null;var c=a.getTokenAt(CodeMirror.Pos(b,1));return/\S/.test(c.string)||(c=a.getTokenAt(CodeMirror.Pos(b,c.end+1))),"meta"==c.type&&"#include"==c.string.slice(0,8)?c.start+8:void 0}var b=b.line,d=c(b);if(null==d||null!=c(b-1))return null;for(var e=b;;){var f=c(e+1);if(null==f)break;++e}return{from:CodeMirror.Pos(b,d+1),to:a.clipPos(CodeMirror.Pos(e))}}),CodeMirror.includeRangeFinder=CodeMirror.fold.include,function{function d(a,b){var c=a.getRange(CodeMirror.Pos(b.line,b.ch-1),CodeMirror.Pos(b.line,b.ch+1));return 2==c.length?c:null}function e(a){for(var b={name:"autoCloseBrackets",Backspace:function(b){if(b.somethingSelected||b.getOption("disableInput"))return CodeMirror.Pass;var c=b.getCursor,e=d(b,c);return e&&0==a.indexOf(e)%2?(b.replaceRange("",CodeMirror.Pos(c.line,c.ch-1),CodeMirror.Pos(c.line,c.ch+1)),void 0):CodeMirror.Pass}},e="",f=0;f<a.length;f+=2)!function(a,d){function f(b){var c=b.getSelection;b.replaceSelection(a+c+d)}function g(a){var b=a.getCursor,c=a.getRange(b,CodeMirror.Pos(b.line,b.ch+1)); return c!=d||a.somethingSelected?CodeMirror.Pass:(a.execCommand("goCharRight"),void 0)}a!=d&&(e+=d),b["'"+a+"'"]=function(b){if("'"==a&&"comment"==b.getTokenAt(b.getCursor).type||b.getOption("disableInput"))return CodeMirror.Pass;if(b.somethingSelected)return f(b);if(a!=d||g(b)==CodeMirror.Pass){var h=b.getCursor,i=CodeMirror.Pos(h.line,h.ch+1),j=b.getLine(h.line),k=j.charAt(h.ch),l=h.ch>0?j.charAt(h.ch-1):"";return a==d&&CodeMirror.isWordChar(l)?CodeMirror.Pass:j.length==h.ch||e.indexOf(k)>=0||c.test(k)?(b.replaceSelection(a+d,{head:i,anchor:i}),void 0):CodeMirror.Pass}},a!=d&&(b["'"+d+"'"]=g)}(a.charAt(f),a.charAt(f+1));return b}function f(a){return function(b){var c=b.getCursor,e=d(b,c);return!e||0!=a.indexOf(e)%2||b.getOption("disableInput")?CodeMirror.Pass:(b.operation(function{var a=CodeMirror.Pos(c.line+1,0);b.replaceSelection("\n\n",{anchor:a,head:a},"+input"),b.indentLine(c.line+1,null,!0),b.indentLine(c.line+2,null,!0)}),void 0)}}var a="[]{}''\"\"",b="[]{}",c=/\s/;CodeMirror.defineOption("autoCloseBrackets",!1,function(c,d,g){if(g!=CodeMirror.Init&&g&&c.removeKeyMap("autoCloseBrackets"),d){var h=a,i=b;"string"==typeof d?h=d:"object"==typeof d&&(null!=d.pairs&&(h=d.pairs),null!=d.explode&&(i=d.explode));var j=e(h);i&&(j.Enter=f(i)),c.addKeyMap(j)}})},CodeMirror.registerGlobalHelper("fold","comment",function(a){return a.blockCommentStart&&a.blockCommentEnd},function(a,b){var c=a.getModeAt(b),d=c.blockCommentStart,e=c.blockCommentEnd;if(d&&e){for(var h,f=b.line,g=a.getLine(f),i=b.ch,j=0;;){var k=0>=i?-1:g.lastIndexOf(d,i-1);if(-1!=k){if(1==j&&k<b.ch)return;if(/comment/.test(a.getTokenTypeAt(CodeMirror.Pos(f,k+1)))){h=k+d.length;break}i=k-1}else{if(1==j)return;j=1,i=g.length}}var n,o,l=1,m=a.lastLine;a:for(var p=f;m>=p;++p)for(var q=a.getLine(p),r=p==f?h:0;;){var s=q.indexOf(d,r),t=q.indexOf(e,r);if(0>s&&(s=q.length),0>t&&(t=q.length),r=Math.min(s,t),r==q.length)break;if(r==s)++l;else if(!--l){n=p,o=r;break a}++r}if(null!=n&&(f!=n||o!=h))return{from:CodeMirror.Pos(f,h),to:CodeMirror.Pos(n,o)}}}),function{function a(a,b,c){var e,d=a.getWrapperElement;return e=d.appendChild(document.createElement("div")),e.className=c?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof b?e.innerHTML=b:e.appendChild(b),e}function b(a,b){a.state.currentNotificationClose&&a.state.currentNotificationClose,a.state.currentNotificationClose=b}CodeMirror.defineExtension("openDialog",function(c,d,e){function i{g||(g=!0,f.parentNode.removeChild(f))}b(this,null);var k,f=a(this,c,e&&e.bottom),g=!1,h=this,j=f.getElementsByTagName("input")[0];return j?(e&&e.value&&(j.value=e.value),CodeMirror.on(j,"keydown",function(a){e&&e.onKeyDown&&e.onKeyDown(a,j.value,i)||(13==a.keyCode||27==a.keyCode)&&(CodeMirror.e_stop(a),i,h.focus,13==a.keyCode&&d(j.value))}),e&&e.onKeyUp&&CodeMirror.on(j,"keyup",function(a){e.onKeyUp(a,j.value,i)}),e&&e.value&&(j.value=e.value),j.focus,CodeMirror.on(j,"blur",i)):(k=f.getElementsByTagName("button")[0])&&(CodeMirror.on(k,"click",function{i,h.focus}),k.focus,CodeMirror.on(k,"blur",i)),i}),CodeMirror.defineExtension("openConfirm",function(c,d,e){function k{h||(h=!0,f.parentNode.removeChild(f),i.focus)}b(this,null);var f=a(this,c,e&&e.bottom),g=f.getElementsByTagName("button"),h=!1,i=this,j=1;g[0].focus;for(var l=0;l<g.length;++l){var m=g[l];!function(a){CodeMirror.on(m,"click",function(b){CodeMirror.e_preventDefault(b),k,a&&a(i)})}(d[l]),CodeMirror.on(m,"blur",function{--j,setTimeout(function{0>=j&&k},200)}),CodeMirror.on(m,"focus",function{++j})}}),CodeMirror.defineExtension("openNotification",function(c,d){function i{g||(g=!0,clearTimeout(h),e.parentNode.removeChild(e))}b(this,i);var h,e=a(this,c,d&&d.bottom),f=d&&(void 0===d.duration?5e3:d.duration),g=!1;CodeMirror.on(e,"click",function(a){CodeMirror.e_preventDefault(a),i}),f&&(h=setTimeout(i,d.duration))})},function{"use strict";function a(a,c,d,e){function h(b){var d=f(a,c);if(!d||d.to.line-d.from.line<g)return null;for(var h=a.findMarksAt(d.from),i=0;i<h.length;++i)if(h[i].__isFold&&"fold"!==e){if(!b)return null;d.cleared=!0,h[i].clear}return d}var f=d&&(d.call?d:d.rangeFinder);f||(f=CodeMirror.fold.auto),"number"==typeof c&&(c=CodeMirror.Pos(c,0));var g=d&&d.minFoldSize||0,i=h(!0);if(d&&d.scanUp)for(!i&&c.line>a.firstLine;)c=CodeMirror.Pos(c.line-1,0),i=h(!1);if(i&&!i.cleared&&"unfold"!==e){var j=b(d);CodeMirror.on(j,"mousedown",function{k.clear});var k=a.markText(i.from,i.to,{replacedWith:j,clearOnEnter:!0,__isFold:!0});k.on("clear",function(b,c){CodeMirror.signal(a,"unfold",a,b,c)}),CodeMirror.signal(a,"fold",a,i.from,i.to)}}function b(a){var b=a&&a.widget||"\u2194";if("string"==typeof b){var c=document.createTextNode(b);b=document.createElement("span"),b.appendChild(c),b.className="CodeMirror-foldmarker"}return b}CodeMirror.newFoldFunction=function(b,c){return function(d,e){a(d,e,{rangeFinder:b,widget:c})}},CodeMirror.defineExtension("foldCode",function(b,c,d){a(this,b,c,d)}),CodeMirror.commands.fold=function(a){a.foldCode(a.getCursor)},CodeMirror.registerHelper("fold","combine",function{var a=Array.prototype.slice.call(arguments,0);return function(b,c){for(var d=0;d<a.length;++d){var e=a[d](b,c);if(e)return e}}}),CodeMirror.registerHelper("fold","auto",function(a,b){for(var c=a.getHelpers(b,"fold"),d=0;d<c.length;d++){var e=c[d](a,b);if(e)return e}})},function{"use strict";function b(a){this.options=a,this.from=this.to=0}function c(a){return a===!0&&(a={}),null==a.gutter&&(a.gutter="CodeMirror-foldgutter"),null==a.indicatorOpen&&(a.indicatorOpen="CodeMirror-foldgutter-open"),null==a.indicatorFolded&&(a.indicatorFolded="CodeMirror-foldgutter-folded"),a}function d(b,c){for(var d=b.findMarksAt(a(c)),e=0;e<d.length;++e)if(d[e].__isFold&&d[e].find.from.line==c)return!0}function e(a){if("string"==typeof a){var b=document.createElement("div");return b.className=a,b}return a.cloneNode(!0)}function f(b,c,f){var g=b.state.foldGutter.options,h=c;b.eachLine(c,f,function(c){var f=null;if(d(b,h))f=e(g.indicatorFolded);else{var i=a(h,0),j=g.rangeFinder||CodeMirror.fold.auto,k=j&&j(b,i);k&&k.from.line+1<k.to.line&&(f=e(g.indicatorOpen))}b.setGutterMarker(c,g.gutter,f),++h})}function g(a){var b=a.getViewport,c=a.state.foldGutter;c&&(a.operation(function{f(a,b.from,b.to)}),c.from=b.from,c.to=b.to)}function h(b,c,d){var e=b.state.foldGutter.options;d==e.gutter&&b.foldCode(a(c,0),e.rangeFinder)}function i(a){var b=a.state.foldGutter,c=a.state.foldGutter.options;b.from=b.to=0,clearTimeout(b.changeUpdate),b.changeUpdate=setTimeout(function{g(a)},c.foldOnChangeTimeSpan||600)}function j(a){var b=a.state.foldGutter,c=a.state.foldGutter.options;clearTimeout(b.changeUpdate),b.changeUpdate=setTimeout(function{var c=a.getViewport;b.from==b.to||c.from-b.to>20||b.from-c.to>20?g(a):a.operation(function{c.from<b.from&&(f(a,c.from,b.from),b.from=c.from),c.to>b.to&&(f(a,b.to,c.to),b.to=c.to)})},c.updateViewportTimeSpan||400)}function k(a,b){var c=a.state.foldGutter,d=b.line;d>=c.from&&d<c.to&&f(a,d,d+1)}CodeMirror.defineOption("foldGutter",!1,function(a,d,e){e&&e!=CodeMirror.Init&&(a.clearGutter(a.state.foldGutter.options.gutter),a.state.foldGutter=null,a.off("gutterClick",h),a.off("change",i),a.off("viewportChange",j),a.off("fold",k),a.off("unfold",k),a.off("swapDoc",g)),d&&(a.state.foldGutter=new b(c(d)),g(a),a.on("gutterClick",h),a.on("change",i),a.on("viewportChange",j),a.on("fold",k),a.on("unfold",k),a.on("swapDoc",g))});var a=CodeMirror.Pos},function{"use strict";function a(a){var b=a.getWrapperElement;a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:b.style.width,height:b.style.height},b.style.width="",b.style.height="auto",b.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh}function b(a){var b=a.getWrapperElement;b.className=b.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var c=a.state.fullScreenRestore;b.style.width=c.width,b.style.height=c.height,window.scrollTo(c.scrollLeft,c.scrollTop),a.refresh}CodeMirror.defineOption("fullScreen",!1,function(c,d,e){e==CodeMirror.Init&&(e=!1),!e!=!d&&(d?a(c):b(c))})},function{function b(a,b){for(var c=0,d=a.length;d>c;++c)b(a[c])}function c(a,b){if(!Array.prototype.indexOf){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1}return-1!=a.indexOf(b)}function d(b,c,d,e){var f=b.getCursor,g=d(b,f),h=g;if(!/\b(?:string|comment)\b/.test(g.type)){for(g.state=CodeMirror.innerMode(b.getMode,g.state).state,/^[\w$_]*$/.test(g.string)||(g=h={start:f.ch,end:f.ch,string:"",state:g.state,type:"."==g.string?"property":null});"property"==h.type;){if(h=d(b,a(f.line,h.start)),"."!=h.string)return;if(h=d(b,a(f.line,h.start)),!i)var i=[];i.push(h)}return{list:m(g,i,c,e),from:a(f.line,g.start),to:a(f.line,g.end)}}}function e(a,b){return d(a,k,function(a,b){return a.getTokenAt(b)},b)}function f(a,b){var c=a.getTokenAt(b);return b.ch==c.start+1&&"."==c.string.charAt(0)?(c.end=c.start,c.string=".",c.type="property"):/^\.[\w$_]*$/.test(c.string)&&(c.type="property",c.start++,c.string=c.string.replace(/\./,"")),c}function g(a,b){return d(a,l,f,b)}function m(a,d,e,f){function l(a){0!=a.lastIndexOf(k,0)||c(g,a)||g.push(a)}function m(a){"string"==typeof a?b(h,l):a instanceof Array?b(i,l):a instanceof Function&&b(j,l);for(var c in a)l(c)}var g=[],k=a.string;if(d&&d.length){var o,n=d.pop;for(n.type&&0===n.type.indexOf("variable")?(f&&f.additionalContext&&(o=f.additionalContext[n.string]),o=o||window[n.string]):"string"==n.type?o="":"atom"==n.type?o=1:"function"==n.type&&(null==window.jQuery||"$"!=n.string&&"jQuery"!=n.string||"function"!=typeof window.jQuery?null!=window._&&"_"==n.string&&"function"==typeof window._&&(o=window._):o=window.jQuery);null!=o&&d.length;)o=o[d.pop.string];null!=o&&m(o)}else{for(var p=a.state.localVars;p;p=p.next)l(p.name);for(var p=a.state.globalVars;p;p=p.next)l(p.name);m(window),b(e,l)}return g}var a=CodeMirror.Pos;CodeMirror.javascriptHint=e,CodeMirror.registerHelper("hint","javascript",e),CodeMirror.coffeescriptHint=g,CodeMirror.registerHelper("hint","coffeescript",g);var h="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),i="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),j="prototype apply call bind".split(" "),k="break case catch continue debugger default delete do else false finally for function if in instanceof new null return switch throw true try typeof var void while with".split(" "),l="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")},function{"use strict";function d(a,b){JSHINT(a,b);var c=JSHINT.data.errors,d=[];return c&&h(c,d),d}function e(a){return f(a,b,"warning",!0),f(a,c,"error"),g(a)?null:a}function f(a,b,c,d){var e,f,g,h,i;e=a.description;for(var j=0;j<b.length;j++)f=b[j],g="string"==typeof f?f:f[0],h="string"==typeof f?null:f[1],i=-1!==e.indexOf(g),(d||i)&&(a.severity=c),i&&h&&(a.description=h)}function g(b){for(var c=b.description,d=0;d<a.length;d++)if(-1!==c.indexOf(a[d]))return!0;return!1}function h(a,b){for(var c=0;c<a.length;c++){var d=a[c];if(d){var f,g;if(f=[],d.evidence){var h=f[d.line];if(!h){var i=d.evidence;h=[],Array.prototype.forEach.call(i,function(a,b){"	"===a&&h.push(b+1)}),f[d.line]=h}if(h.length>0){var j=d.character;h.forEach(function(a){j>a&&(j-=1)}),d.character=j}}var k=d.character-1,l=k+1;d.evidence&&(g=d.evidence.substring(k).search(/.\b/),g>-1&&(l+=g)),d.description=d.reason,d.start=d.character,d.end=l,d=e(d),d&&b.push({message:d.description,severity:d.severity,from:CodeMirror.Pos(d.line-1,k),to:CodeMirror.Pos(d.line-1,l)})}}}var a=["Dangerous comment"],b="Expected '{'","Statement body should be inside '{ }' braces.",c=["Missing semicolon","Extra comma","Missing property name","Unmatched "," and instead saw"," is not defined","Unclosed string","Stopping, unable to continue"];CodeMirror.registerHelper("lint","javascript",d),CodeMirror.javascriptValidator=CodeMirror.lint.javascript},function{"use strict";function c(a,b){function d(a){return c.parentNode?(c.style.top=Math.max(0,a.clientY-c.offsetHeight-5)+"px",c.style.left=a.clientX+5+"px",void 0):CodeMirror.off(document,"mousemove",d)}var c=document.createElement("div");return c.className="CodeMirror-lint-tooltip",c.appendChild(b.cloneNode(!0)),document.body.appendChild(c),CodeMirror.on(document,"mousemove",d),d(a),null!=c.style.opacity&&(c.style.opacity=1),c}function d(a){a.parentNode&&a.parentNode.removeChild(a)}function e(a){a.parentNode&&(null==a.style.opacity&&d(a),a.style.opacity=0,setTimeout(function{d(a)},600))}function f(a,b,d){function g{CodeMirror.off(d,"mouseout",g),f&&(e(f),f=null)}var f=c(a,b),h=setInterval(function{if(f)for(var a=d;;a=a.parentNode){if(a==document.body)return;if(!a){g;break}}return f?void 0:clearInterval(h)},400);CodeMirror.on(d,"mouseout",g)}function g(a,b,c){this.marked=[],this.options=b,this.timeout=null,this.hasGutter=c,this.onMouseOver=function(b){s(a,b)}}function h(a,b){if(b instanceof Function)return{getAnnotations:b};if(b&&b!==!0||(b={}),b.getAnnotations||(b.getAnnotations=a.getHelper(CodeMirror.Pos(0,0),"lint")),!b.getAnnotations)throw new Error("Required option 'getAnnotations' missing (lint addon)");return b}function i(b){var c=b.state.lint;c.hasGutter&&b.clearGutter(a);for(var d=0;d<c.marked.length;++d)c.marked[d].clear;c.marked.length=0}function j(a,b,c,d){var e=document.createElement("div"),g=e;return e.className="CodeMirror-lint-marker-"+b,c&&(g=e.appendChild(document.createElement("div")),g.className="CodeMirror-lint-marker-multiple"),0!=d&&CodeMirror.on(g,"mouseover",function(b){f(b,a,g)}),e}function k(a,b){return"error"==a?a:b}function l(a){for(var b=[],c=0;c<a.length;++c){var d=a[c],e=d.from.line;(b[e]||(b[e]=[])).push(d)}return b}function m(a){var c=a.severity;b.test(c)||(c="error");var d=document.createElement("div");return d.className="CodeMirror-lint-message-"+c,d.appendChild(document.createTextNode(a.message)),d}function n(a){var b=a.state.lint,c=b.options;c.async?c.getAnnotations(a,o,c):o(a,c.getAnnotations(a.getValue,c.options))}function o(c,d){i(c);for(var e=c.state.lint,f=e.options,g=l(d),h=0;h<g.length;++h){var n=g[h];if(n){for(var o=null,p=e.hasGutter&&document.createDocumentFragment,q=0;q<n.length;++q){var r=n[q],s=r.severity;b.test(s)||(s="error"),o=k(o,s),f.formatAnnotation&&(r=f.formatAnnotation(r)),e.hasGutter&&p.appendChild(m(r)),r.to&&e.marked.push(c.markText(r.from,r.to,{className:"CodeMirror-lint-mark-"+s,__annotation:r}))}e.hasGutter&&c.setGutterMarker(h,a,j(p,o,n.length>1,e.options.tooltips))}}f.onUpdateLinting&&f.onUpdateLinting(d,g,c)}function p(a){var b=a.state.lint;clearTimeout(b.timeout),b.timeout=setTimeout(function{n(a)},b.options.delay||500)}function q(a,b){var c=b.target||b.srcElement;f(b,m(a),c)}function s(a,b){if(/\bCodeMirror-lint-mark-/.test((b.target||b.srcElement).className))for(var c=0;c<r.length;c+=2)for(var d=a.findMarksAt(a.coordsChar({left:b.clientX+r[c],top:b.clientY+r[c+1]})),e=0;e<d.length;++e){var f=d[e],g=f.__annotation;if(g)return q(g,b)}}function t(b,c,d){if(d&&d!=CodeMirror.Init&&(i(b),b.off("change",p),CodeMirror.off(b.getWrapperElement,"mouseover",b.state.lint.onMouseOver),delete b.state.lint),c){for(var e=b.getOption("gutters"),f=!1,j=0;j<e.length;++j)e[j]==a&&(f=!0);var k=b.state.lint=new g(b,h(b,c),f);b.on("change",p),0!=k.options.tooltips&&CodeMirror.on(b.getWrapperElement,"mouseover",k.onMouseOver),n(b)}}var a="CodeMirror-lint-markers",b=/^(?:error|warning)$/,r=[0,0,0,5,0,-5,5,0,-5,0];CodeMirror.defineOption("lintWith",!1,t),CodeMirror.defineOption("lint",!1,t)},function{function d(a,d,e){function r(d,e,f){if(d.text){var h=m?0:d.text.length-1,i=m?d.text.length:-1;if(d.text.length>g)return null;for(null!=f&&(h=f+n);h!=i;h+=n){var j=d.text.charAt(h);if(q.test(j)&&a.getTokenTypeAt(b(e,h+1))==o){var k=c[j];if(">"==k.charAt(1)==m)p.push(j);else{if(p.pop!=k.charAt(0))return{pos:h,match:!1};if(!p.length)return{pos:h,match:!0}}}}}}var f=a.state.matchBrackets,g=f&&f.maxScanLineLength||1e4,h=f&&f.maxScanLines||100,i=d||a.getCursor,j=a.getLineHandle(i.line),k=i.ch-1,l=k>=0&&c[j.text.charAt(k)]||c[j.text.charAt(++k)];if(!l)return null;var m=">"==l.charAt(1),n=m?1:-1;if(e&&m!=(k==i.ch))return null;for(var t,o=a.getTokenTypeAt(b(i.line,k+1)),p=[j.text.charAt(k)],q=/[{}[\]]/,s=i.line,u=m?Math.min(s+h,a.lineCount):Math.max(-1,s-h);s!=u&&!(t=s==i.line?r(j,s,k):r(a.getLineHandle(s),s));s+=n);return{from:b(i.line,k),to:t&&b(s,t.pos),match:t&&t.match,forward:m}}function e(c,e){var f=c.state.matchBrackets.maxHighlightLineLength||1e3,g=d(c);if(!(!g||c.getLine(g.from.line).length>f||g.to&&c.getLine(g.to.line).length>f)){var h=g.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",i=c.markText(g.from,b(g.from.line,g.from.ch+1),{className:h}),j=g.to&&c.markText(g.to,b(g.to.line,g.to.ch+1),{className:h});a&&c.state.focused&&c.display.input.focus;var k=function{c.operation(function{i.clear,j&&j.clear})};return e?(setTimeout(k,800),void 0):k}}function g(a){a.operation(function{f&&(f,f=null),a.somethingSelected||(f=e(a,!1))})}var a=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),b=CodeMirror.Pos,c={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},f=null;CodeMirror.defineOption("matchBrackets",!1,function(a,b,c){c&&c!=CodeMirror.Init&&a.off("cursorActivity",g),b&&(a.state.matchBrackets="object"==typeof b?b:{},a.on("cursorActivity",g))}),CodeMirror.defineExtension("matchBrackets",function{e(this,!0)}),CodeMirror.defineExtension("findMatchingBracket",function(a,b){return d(this,a,b)})},function{function a(a,b){var c;return"string"==typeof a?(c=a.charAt(0),a=new RegExp("^"+a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),b?"i":"")):a=new RegExp("^(?:"+a.source+")",a.ignoreCase?"i":""),"string"==typeof a?{token:function(b){return b.match(a)?"searching":(b.next,b.skipTo(a.charAt(0))||b.skipToEnd,void 0)}}:{token:function(b){if(b.match(a))return"searching";for(!b.eol&&(b.next,c&&(b.skipTo(c)||b.skipToEnd),!b.match(a,!1)););}}}function b{this.posFrom=this.posTo=this.query=null,this.overlay=null}function c(a){return a.state.search||(a.state.search=new b)}function d(a){return"string"==typeof a&&a==a.toLowerCase}function e(a,b,c){return a.getSearchCursor(b,c,d(b))}function f(a,b,c,d,e){a.openDialog?a.openDialog(b,e,{value:d}):e(prompt(c,d))}function g(a,b,c,d){a.openConfirm?a.openConfirm(b,d):confirm(c)&&d[0]}function h(a){var b=a.match(/^\/(.*)\/([a-z]*)$/);return b?new RegExp(b[1],-1==b[2].indexOf("i")?"":"i"):a}function j(b,e){var g=c(b);return g.query?k(b,e):(f(b,i,"Search for:",b.getSelection,function(c){b.operation(function{c&&!g.query&&(g.query=h(c),b.removeOverlay(g.overlay,d(g.query)),g.overlay=a(g.query),b.addOverlay(g.overlay),g.posFrom=g.posTo=b.getCursor,k(b,e))})}),void 0)}function k(a,b){a.operation(function{var d=c(a),f=e(a,d.query,b?d.posFrom:d.posTo);(f.find(b)||(f=e(a,d.query,b?CodeMirror.Pos(a.lastLine):CodeMirror.Pos(a.firstLine,0)),f.find(b)))&&(a.setSelection(f.from,f.to),a.scrollIntoView({from:f.from,to:f.to}),d.posFrom=f.from,d.posTo=f.to)})}function l(a){a.operation(function{var b=c(a);b.query&&(b.query=null,a.removeOverlay(b.overlay))})}function p(a,b){f(a,m,"Replace:",a.getSelection,function(c){c&&(c=h(c),f(a,n,"Replace with:","",function(d){if(b)a.operation(function{for(var b=e(a,c);b.findNext;)if("string"!=typeof c){var f=a.getRange(b.from,b.to).match(c);b.replace(d.replace(/\$(\d)/,function(a,b){return f[b]}))}else b.replace(d)});else{l(a);var f=e(a,c,a.getCursor),h=function{var d,b=f.from;!(d=f.findNext)&&(f=e(a,c),!(d=f.findNext)||b&&f.from.line==b.line&&f.from.ch==b.ch)||(a.setSelection(f.from,f.to),a.scrollIntoView({from:f.from,to:f.to}),g(a,o,"Replace?",[function{i(d)},h]))},i=function(a){f.replace("string"==typeof c?d:d.replace(/\$(\d)/,function(b,c){return a[c]})),h};h}}))})}var i='Search: <input type="text" style="width: 10em"/> (Use /re/ syntax for regexp search) ',m='Replace: <input type="text" style="width: 10em"/> (Use /re/ syntax for regexp search) ',n='With: <input type="text" style="width: 10em"/>',o="Replace? Yes No  Stop ";CodeMirror.commands.find=function(a){l(a),j(a)},CodeMirror.commands.findNext=j,CodeMirror.commands.findPrev=function(a){j(a,!0)},CodeMirror.commands.clearSearch=l,CodeMirror.commands.replace=p,CodeMirror.commands.replaceAll=function(a){p(a,!0)}},function{function b(b,d,e,f){if(this.atOccurrence=!1,this.doc=b,null==f&&"string"==typeof d&&(f=!1),e=e?b.clipPos(e):a(0,0),this.pos={from:e,to:e},"string"!=typeof d)d.global||(d=new RegExp(d.source,d.ignoreCase?"ig":"g")),this.matches=function(c,e){if(c){d.lastIndex=0;for(var h,i,f=b.getLine(e.line).slice(0,e.ch),g=0;;){d.lastIndex=g;var j=d.exec(f);if(!j)break;if(h=j,i=h.index,g=h.index+(h[0].length||1),g==f.length)break}var k=h&&h[0].length||0;k||(0==i&&0==f.length?h=void 0:i!=b.getLine(e.line).length&&k++)}else{d.lastIndex=e.ch;var f=b.getLine(e.line),h=d.exec(f),k=h&&h[0].length||0,i=h&&h.index;i+k==f.length||k||(k=1)}return h&&k?{from:a(e.line,i),to:a(e.line,i+k),match:h}:void 0};else{var g=d;f&&(d=d.toLowerCase);var h=f?function(a){return a.toLowerCase}:function(a){return a},i=d.split("\n");if(1==i.length)this.matches=d.length?function(e,f){if(e){var i=b.getLine(f.line).slice(0,f.ch),j=h(i),k=j.lastIndexOf(d);if(k>-1)return k=c(i,j,k),{from:a(f.line,k),to:a(f.line,k+g.length)}}else{var i=b.getLine(f.line).slice(f.ch),j=h(i),k=j.indexOf(d);if(k>-1)return k=c(i,j,k)+f.ch,{from:a(f.line,k),to:a(f.line,k+g.length)}}}:function{};else{var j=g.split("\n");this.matches=function(c,d){var e=i.length-1;if(c){if(d.line-(i.length-1)<b.firstLine)return;if(h(b.getLine(d.line).slice(0,j[e].length))!=i[i.length-1])return;for(var f=a(d.line,j[e].length),g=d.line-1,k=e-1;k>=1;--k,--g)if(i[k]!=h(b.getLine(g)))return;var l=b.getLine(g),m=l.length-j[0].length;if(h(l.slice(m))!=i[0])return;return{from:a(g,m),to:f}}if(!(d.line+(i.length-1)>b.lastLine)){var l=b.getLine(d.line),m=l.length-j[0].length;if(h(l.slice(m))==i[0]){for(var n=a(d.line,m),g=d.line+1,k=1;e>k;++k,++g)if(i[k]!=h(b.getLine(g)))return;if(b.getLine(g).slice(0,j[e].length)==i[e])return{from:n,to:a(g,j[e].length)}}}}}}}function c(a,b,c){if(a.length==b.length)return c;for(var d=Math.min(c,a.length);;){var e=a.slice(0,d).toLowerCase.length;if(c>e)++d;else{if(!(e>c))return d;--d}}}var a=CodeMirror.Pos;b.prototype={findNext:function{return this.find(!1)},findPrevious:function{return this.find(!0)},find:function(b){function e(b){var d=a(b,0);return c.pos={from:d,to:d},c.atOccurrence=!1,!1}for(var c=this,d=this.doc.clipPos(b?this.pos.from:this.pos.to);;){if(this.pos=this.matches(b,d))return this.atOccurrence=!0,this.pos.match||!0;if(b){if(!d.line)return e(0);d=a(d.line-1,this.doc.getLine(d.line-1).length)}else{var f=this.doc.lineCount;if(d.line==f-1)return e(f);d=a(d.line+1,0)}}},from:function{return this.atOccurrence?this.pos.from:void 0},to:function{return this.atOccurrence?this.pos.to:void 0},replace:function(b){if(this.atOccurrence){var c=CodeMirror.splitLines(b);this.doc.replaceRange(c,this.pos.from,this.pos.to),this.pos.to=a(this.pos.from.line+c.length-1,c[c.length-1].length+(1==c.length?this.pos.from.ch:0))}}},CodeMirror.defineExtension("getSearchCursor",function(a,c,d){return new b(this.doc,a,c,d)}),CodeMirror.defineDocExtension("getSearchCursor",function(a,c,d){return new b(this,a,c,d)})},function{"use strict";function c(a,b,c){this.cm=a,this.getHints=b,this.options=c,this.widget=this.onClose=null}function d(a){return"string"==typeof a?a:a.text}function e(a,b){function e(a,e){var f;f="string"!=typeof e?function(a){return e(a,b)}:c.hasOwnProperty(e)?c[e]:e,d[a]=f}var c={Up:function{b.moveFocus(-1)},Down:function{b.moveFocus(1)},PageUp:function{b.moveFocus(-b.menuSize+1,!0)},PageDown:function{b.moveFocus(b.menuSize-1,!0)},Home:function{b.setFocus(0)},End:function{b.setFocus(b.length-1)},Enter:b.pick,Tab:b.pick,Esc:b.close},d=a.customKeys?{}:c;if(a.customKeys)for(var f in a.customKeys)a.customKeys.hasOwnProperty(f)&&e(f,a.customKeys[f]);if(a.extraKeys)for(var f in a.extraKeys)a.extraKeys.hasOwnProperty(f)&&e(f,a.extraKeys[f]);return d}function f(a,b){for(b&&b!=a;){if("LI"===b.nodeName.toUpperCase&&b.parentNode==a)return b;b=b.parentNode}}function g(c,g){this.completion=c,this.data=g;var h=this,i=c.cm,j=c.options,k=this.hints=document.createElement("ul");k.className="CodeMirror-hints",this.selectedHint=j.getDefaultSelection?j.getDefaultSelection(i,j,g):0;for(var l=g.list,m=0;m<l.length;++m){var n=k.appendChild(document.createElement("li")),o=l[m],p=a+(m!=this.selectedHint?"":" "+b);null!=o.className&&(p=o.className+" "+p),n.className=p,o.render?o.render(n,g,o):n.appendChild(document.createTextNode(o.displayText||d(o))),n.hintId=m}var q=i.cursorCoords(j.alignWithWord!==!1?g.from:null),r=q.left,s=q.bottom,t=!0;k.style.left=r+"px",k.style.top=s+"px";var u=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),v=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(j.container||document.body).appendChild(k);var w=k.getBoundingClientRect,x=w.right-u,y=w.bottom-v;if(x>0&&(w.right-w.left>u&&(k.style.width=u-5+"px",x-=w.right-w.left-u),k.style.left=(r=q.left-x)+"px"),y>0){var z=w.bottom-w.top;w.top-(q.bottom-q.top)-z>0?(y=z+(q.bottom-q.top),t=!1):z>v&&(k.style.height=v-5+"px",y-=z-v),k.style.top=(s=q.bottom-y)+"px"}if(i.addKeyMap(this.keyMap=e(j,{moveFocus:function(a,b){h.changeActive(h.selectedHint+a,b)},setFocus:function(a){h.changeActive(a)},menuSize:function{return h.screenAmount},length:l.length,close:function{c.close},pick:function{h.pick}})),j.closeOnUnfocus!==!1){var A;i.on("blur",this.onBlur=function{A=setTimeout(function{c.close},100)}),i.on("focus",this.onFocus=function{clearTimeout(A)})}var B=i.getScrollInfo;return i.on("scroll",this.onScroll=function{var a=i.getScrollInfo,b=i.getWrapperElement.getBoundingClientRect,d=s+B.top-a.top,e=d-(window.pageYOffset||(document.documentElement||document.body).scrollTop);return t||(e+=k.offsetHeight),e<=b.top||e>=b.bottom?c.close:(k.style.top=d+"px",k.style.left=r+B.left-a.left+"px",void 0)}),CodeMirror.on(k,"dblclick",function(a){var b=f(k,a.target||a.srcElement);b&&null!=b.hintId&&(h.changeActive(b.hintId),h.pick)}),CodeMirror.on(k,"click",function(a){var b=f(k,a.target||a.srcElement);b&&null!=b.hintId&&(h.changeActive(b.hintId),j.completeOnSingleClick&&h.pick)}),CodeMirror.on(k,"mousedown",function{setTimeout(function{i.focus},20)}),CodeMirror.signal(g,"select",l[0],k.firstChild),!0}var a="CodeMirror-hint",b="CodeMirror-hint-active";CodeMirror.showHint=function(a,b,d){if(!a.somethingSelected){if(null==b){if(d&&d.async)return;b=CodeMirror.hint.auto}a.state.completionActive&&a.state.completionActive.close;var e=a.state.completionActive=new c(a,b,d||{});return CodeMirror.signal(a,"startCompletion",a),e.options.async?(b(a,function(a){e.showHints(a)},e.options),void 0):e.showHints(b(a,e.options))}},c.prototype={close:function{this.active&&(this.cm.state.completionActive=null,this.widget&&this.widget.close,this.onClose&&this.onClose,CodeMirror.signal(this.cm,"endCompletion",this.cm))},active:function{return this.cm.state.completionActive==this},pick:function(a,b){var c=a.list[b];c.hint?c.hint(this.cm,a,c):this.cm.replaceRange(d(c),a.from,a.to),CodeMirror.signal(a,"pick",c),this.close},showHints:function(a){return a&&a.list.length&&this.active?(0!=this.options.completeSingle&&1==a.list.length?this.pick(a,0):this.showWidget(a),void 0):this.close},showWidget:function(a){function k{d||(d=!0,c.close,c.cm.off("cursorActivity",o),a&&CodeMirror.signal(a,"close"))}function l{d||(CodeMirror.signal(a,"update"),c.options.async?c.getHints(c.cm,m,c.options):m(c.getHints(c.cm,c.options)))}function m(b){return a=b,d?void 0:a&&a.list.length?(c.widget=new g(c,a),void 0):k}function n{b&&(j(b),b=0)}function o{n;var a=c.cm.getCursor,d=c.cm.getLine(a.line);a.line!=f.line||d.length-a.ch!=h-f.ch||a.ch<f.ch||c.cm.somethingSelected||a.ch&&e.test(d.charAt(a.ch-1))?c.close:(b=i(l),c.widget&&c.widget.close)}this.widget=new g(this,a),CodeMirror.signal(a,"shown");var d,b=0,c=this,e=this.options.closeCharacters||/[\s\[\]{};:>,]/,f=this.cm.getCursor,h=this.cm.getLine(f.line).length,i=window.requestAnimationFrame||function(a){return setTimeout(a,1e3/60)},j=window.cancelAnimationFrame||clearTimeout;this.cm.on("cursorActivity",o),this.onClose=k}},g.prototype={close:function{if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var a=this.completion.cm;this.completion.options.closeOnUnfocus!==!1&&(a.off("blur",this.onBlur),a.off("focus",this.onFocus)),a.off("scroll",this.onScroll)}},pick:function{this.completion.pick(this.data,this.selectedHint)},changeActive:function(a,c){if(a>=this.data.list.length?a=c?this.data.list.length-1:0:0>a&&(a=c?0:this.data.list.length-1),this.selectedHint!=a){var d=this.hints.childNodes[this.selectedHint];d.className=d.className.replace(" "+b,""),d=this.hints.childNodes[this.selectedHint=a],d.className+=" "+b,d.offsetTop<this.hints.scrollTop?this.hints.scrollTop=d.offsetTop-3:d.offsetTop+d.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=d.offsetTop+d.offsetHeight-this.hints.clientHeight+3),CodeMirror.signal(this.data,"select",this.data.list[this.selectedHint],d)}},screenAmount:function{return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},CodeMirror.registerHelper("hint","auto",function(a,b){var c=a.getHelpers(a.getCursor,"hint");if(c.length)for(var d=0;d<c.length;d++){var e=c[d](a,b);if(e&&e.list.length)return e}else{var f=a.getHelper(a.getCursor,"hintWords");if(f)return CodeMirror.hint.fromList(a,{words:f})}}),CodeMirror.registerHelper("hint","fromList",function(a,b){for(var c=a.getCursor,d=a.getTokenAt(c),e=[],f=0;f<b.words.length;f++){var g=b.words[f];g.slice(0,d.string.length)==d.string&&e.push(g)}return e.length?{list:e,from:CodeMirror.Pos(c.line,d.start),to:CodeMirror.Pos(c.line,d.end)}:void 0}),CodeMirror.commands.autocomplete=CodeMirror.showHint},CodeMirror.defineOption("showTrailingSpace",!1,function(a,b,c){c==CodeMirror.Init&&(c=!1),c&&!b?a.removeOverlay("trailingspace"):!c&&b&&a.addOverlay({token:function(a){for(var b=a.string.length,c=b;c&&/\s/.test(a.string.charAt(c-1));--c);return c>a.pos?(a.pos=c,null):(a.pos=b,"trailingspace")},name:"trailingspace"})}),function{"use strict";function d(a,b,c){var d=a.docs[b];d?c(G(a,d)):a.options.getFile?a.options.getFile(b,c):c(null)}function e(a,b,c){for(var d in a.docs){var e=a.docs[d];if(e.doc==b)return e}if(!c)for(var f=0;;++f)if(d="[doc"+(f||"")+"]",!a.docs[d]){c=d;break}return a.addDoc(c,b)}function f(a,b,d){var f=e(a,b),h=a.cachedArgHints;h&&h.doc==b&&x(h.start,d.to)<=0&&(a.cachedArgHints=null);var i=f.changed;null==i&&(f.changed=i={from:d.from.line,to:d.from.line});var j=d.from.line+(d.text.length-1);d.from.line<i.to&&(i.to=i.to-(d.to.line-j)),j>=i.to&&(i.to=j+1),i.from>d.from.line&&(i.from=d.from.line),b.lineCount>c&&d.to-i.from>100&&setTimeout(function{f.changed&&f.changed.to-f.changed.from>100&&g(a,f)},200)}function g(a,b){a.server.request({files:[{type:"full",name:b.name,text:G(a,b)}]},function(a){a?console.error(a):b.changed=null })}function h(c,d,e){c.request(d,{type:"completions",types:!0,docs:!0,urls:!0},function(f,g){if(f)return E(c,d,f);var h=[],j="",k=g.start,l=g.end;'["'==d.getRange(a(k.line,k.ch-2),k)&&'"]'!=d.getRange(l,a(l.line,l.ch+2))&&(j='"]');for(var m=0;m<g.completions.length;++m){var n=g.completions[m],o=i(n.type);g.guess&&(o+=" "+b+"guess"),h.push({text:n.name+j,displayText:n.name,className:o,data:n})}var p={from:k,to:l,list:h},q=null;CodeMirror.on(p,"close",function{C(q)}),CodeMirror.on(p,"update",function{C(q)}),CodeMirror.on(p,"select",function(a,d){C(q);var e=c.options.completionTip?c.options.completionTip(a.data):a.data.doc;e&&(q=B(d.parentNode.getBoundingClientRect.right+window.pageXOffset,d.getBoundingClientRect.top+window.pageYOffset,e),q.className+=" "+b+"hint-doc")}),e(p)})}function i(a){var c;return c="?"==a?"unknown":"number"==a||"string"==a||"bool"==a?a:/^fn\(/.test(a)?"fn":/^\[/.test(a)?"array":"object",b+"completion "+b+"completion-"+c}function j(a,b,c){a.request(b,"type",function(c,d){if(c)return E(a,b,c);if(a.options.typeTip)var e=a.options.typeTip(d);else{var e=y("span",null,y("strong",null,d.type||"not found"));d.doc&&e.appendChild(document.createTextNode(" \u2014 "+d.doc)),d.url&&(e.appendChild(document.createTextNode(" ")),e.appendChild(y("a",null,"[docs]")).href=d.url)}A(b,e)},c)}function k(b,c){if(F(b),!c.somethingSelected){var d=c.getTokenAt(c.getCursor).state,e=CodeMirror.innerMode(c.getMode,d);if("javascript"==e.mode.name){var f=e.state.lexical;if("call"==f.info){for(var g,h=f.pos||0,i=c.getOption("tabSize"),j=c.getCursor.line,k=Math.max(0,j-9),n=!1;j>=k;--j){for(var o=c.getLine(j),p=0,q=0;;){var r=o.indexOf("	",q);if(-1==r)break;p+=i-(r+p)%i-1,q=r+1}if(g=f.column-p,"("==o.charAt(g)){n=!0;break}}if(n){var s=a(j,g),t=b.cachedArgHints;return t&&t.doc==c.getDoc&&0==x(s,t.start)?l(b,c,h):(b.request(c,{type:"type",preferFunction:!0,end:s},function(a,d){!a&&d.type&&/^fn\(/.test(d.type)&&(b.cachedArgHints={start:q,type:m(d.type),name:d.exprName||d.name||"fn",guess:d.guess,doc:c.getDoc},l(b,c,h))}),void 0)}}}}}function l(a,c,d){F(a);for(var e=a.cachedArgHints,f=e.type,g=y("span",e.guess?b+"fhint-guess":null,y("span",b+"fname",e.name),"("),h=0;h<f.args.length;++h){h&&g.appendChild(document.createTextNode(", "));var i=f.args[h];g.appendChild(y("span",b+"farg"+(h==d?" "+b+"farg-current":""),i.name||"?")),"?"!=i.type&&(g.appendChild(document.createTextNode(":\xa0")),g.appendChild(y("span",b+"type",i.type)))}g.appendChild(document.createTextNode(f.rettype?") ->\xa0":")")),f.rettype&&g.appendChild(y("span",b+"type",f.rettype));var j=c.cursorCoords(null,"page");a.activeArgHints=B(j.right+1,j.bottom,g)}function m(a){function d(b){for(var d=0,e=c;;){var f=a.charAt(c);if(b.test(f)&&!d)return a.slice(e,c);/[{\[\(]/.test(f)?++d:/[}\]\)]/.test(f)&&--d,++c}}var b=[],c=3;if(")"!=a.charAt(c))for{var e=a.slice(c).match(/^([^, \(\[\{]+): /);if(e&&(c+=e[0].length,e=e[1]),b.push({name:e,type:d(/[\),]/)}),")"==a.charAt(c))break;c+=2}var f=a.slice(c).match(/^\) -> (.*)$/);return{args:b,rettype:f&&f[1]}}function n(a,b){function c(c){var d={type:"definition",variable:c||null},f=e(a,b.getDoc);a.server.request(v(a,f,d),function(c,d){if(c)return E(a,b,c);if(!d.file&&d.url)return window.open(d.url),void 0;if(d.file){var g,e=a.docs[d.file];if(e&&(g=q(e.doc,d)))return a.jumpStack.push({file:f.name,start:b.getCursor("from"),end:b.getCursor("to")}),p(a,f,e,g.start,g.end),void 0}E(a,b,"Could not find a definition.")})}r(b)?c:z(b,"Jump to variable",function(a){a&&c(a)})}function o(a,b){var c=a.jumpStack.pop,d=c&&a.docs[c.file];d&&p(a,e(a,b.getDoc),d,c.start,c.end)}function p(a,b,c,d,e){c.doc.setSelection(e,d),b!=c&&a.options.switchToDoc&&(F(a),a.options.switchToDoc(c.name))}function q(b,c){for(var d=c.context.slice(0,c.contextOffset).split("\n"),e=c.start.line-(d.length-1),f=a(e,(1==d.length?c.start.ch:b.getLine(e).length)-d[0].length),g=b.getLine(e).slice(f.ch),h=e+1;h<b.lineCount&&g.length<c.context.length;++h)g+="\n"+b.getLine(h);if(g.slice(0,c.context.length)==c.context)return c;for(var j,i=b.getSearchCursor(c.context,0,!1),k=1/0;i.findNext;){var l=i.from,m=1e4*Math.abs(l.line-f.line);m||(m=Math.abs(l.ch-f.ch)),k>m&&(j=l,k=m)}if(!j)return null;if(1==d.length?j.ch+=d[0].length:j=a(j.line+(d.length-1),d[d.length-1].length),c.start.line==c.end.line)var n=a(j.line,j.ch+(c.end.ch-c.start.ch));else var n=a(j.line+(c.end.line-c.start.line),c.end.ch);return{start:j,end:n}}function r(a){var b=a.getCursor("end"),c=a.getTokenAt(b);return c.start<b.ch&&("comment"==c.type||"string"==c.type)?!1:/\w/.test(a.getLine(b.line).slice(Math.max(b.ch-1,0),b.ch+1))}function s(a,b){var c=b.getTokenAt(b.getCursor);/\w/.test(c.string)||E(a,b,"Not at a variable"),z(b,"New name for "+c.string,function(c){a.request(b,{type:"rename",newName:c,fullDocs:!0},function(c,d){return c?E(a,b,c):(u(a,d.changes),void 0)})})}function u(a,b){for(var c=Object.create(null),d=0;d<b.length;++d){var e=b[d];(c[e.file]||(c[e.file]=[])).push(e)}for(var f in c){var g=a.docs[f],h=c[f];if(g){h.sort(function(a,b){return x(b.start,a.start)});for(var i="*rename"+ ++t,d=0;d<h.length;++d){var e=h[d];g.doc.replaceRange(e.text,e.start,e.end,i)}}}}function v(b,d,e,f){var g=[],h=0,i=!e.fullDocs;i||delete e.fullDocs,"string"==typeof e&&(e={type:e}),e.lineCharPositions=!0,null==e.end&&(e.end=f||d.doc.getCursor("end"),d.doc.somethingSelected&&(e.start=d.doc.getCursor("start")));var j=e.start||e.end;if(d.changed)if(d.doc.lineCount>c&&i!==!1&&d.changed.to-d.changed.from<100&&d.changed.from<=j.line&&d.changed.to>e.end.line){g.push(w(d,j,e.end)),e.file="#0";var h=g[0].offsetLines;null!=e.start&&(e.start=a(e.start.line- -h,e.start.ch)),e.end=a(e.end.line-h,e.end.ch)}else g.push({type:"full",name:d.name,text:G(b,d)}),e.file=d.name,d.changed=null;else e.file=d.name;for(var k in b.docs){var l=b.docs[k];l.changed&&l!=d&&(g.push({type:"full",name:l.name,text:G(b,l)}),l.changed=null)}return{query:e,files:g}}function w(b,c,d){for(var h,e=b.doc,f=null,g=null,i=4,j=c.line-1,k=Math.max(0,j-50);j>=k;--j){var l=e.getLine(j),m=l.search(/\bfunction\b/);if(!(0>m)){var n=CodeMirror.countColumn(l,null,i);null!=f&&n>=f||(f=n,g=j)}}null==g&&(g=k);var o=Math.min(e.lastLine,d.line+20);if(null==f||f==CodeMirror.countColumn(e.getLine(c.line),null,i))h=o;else for(h=d.line+1;o>h;++h){var n=CodeMirror.countColumn(e.getLine(h),null,i);if(f>=n)break}var p=a(g,0);return{type:"part",name:b.name,offsetLines:p.line,text:e.getRange(p,a(h,0))}}function x(a,b){return a.line-b.line||a.ch-b.ch}function y(a,b){var c=document.createElement(a);b&&(c.className=b);for(var d=2;d<arguments.length;++d){var e=arguments[d];"string"==typeof e&&(e=document.createTextNode(e)),c.appendChild(e)}return c}function z(a,b,c){a.openDialog?a.openDialog(b+": ",c):c(prompt(b,""))}function A(a,b){function e{d.parentNode&&(a.off("cursorActivity",e),D(d))}var c=a.cursorCoords,d=B(c.right+1,c.bottom,b);setTimeout(e,1700),a.on("cursorActivity",e)}function B(a,c,d){var e=y("div",b+"tooltip",d);return e.style.left=a+"px",e.style.top=c+"px",document.body.appendChild(e),e}function C(a){var b=a&&a.parentNode;b&&b.removeChild(a)}function D(a){a.style.opacity="0",setTimeout(function{C(a)},1100)}function E(a,b,c){a.options.showError?a.options.showError(b,c):A(b,String(c))}function F(a){a.activeArgHints&&(C(a.activeArgHints),a.activeArgHints=null)}function G(a,b){var c=b.doc.getValue;return a.options.fileFilter&&(c=a.options.fileFilter(c,b.name,b.doc)),c}function H(a){function f(a,d){d&&(a.id=++c,e[c]=d),b.postMessage(a)}var b=new Worker(a.options.workerScript);b.postMessage({type:"init",defs:a.options.defs,plugins:a.options.plugins,scripts:a.options.workerDeps});var c=0,e={};b.onmessage=function(b){var c=b.data;"getFile"==c.type?d(a,c.name,function(a,b){f({type:"getFile",err:String(a),text:b,id:c.id})}):"debug"==c.type?console.log(c.message):c.id&&e[c.id]&&(e[c.id](c.err,c.body),delete e[c.id])},b.onerror=function(a){for(var b in e)e[b](a);e={}},this.addFile=function(a,b){f({type:"add",name:a,text:b})},this.delFile=function(a){f({type:"del",name:a})},this.request=function(a,b){f({type:"req",body:a},b)}}CodeMirror.TernServer=function(a){var b=this;this.options=a||{};var c=this.options.plugins||(this.options.plugins={});c.doc_comment||(c.doc_comment=!0),this.server=this.options.useWorker?new H(this):new tern.Server({getFile:function(a,c){return d(b,a,c)},async:!0,defs:this.options.defs||[],plugins:c}),this.docs=Object.create(null),this.trackChange=function(a,c){f(b,a,c)},this.cachedArgHints=null,this.activeArgHints=null,this.jumpStack=[]},CodeMirror.TernServer.prototype={addDoc:function(a,b){var c={doc:b,name:a,changed:null};return this.server.addFile(a,G(this,c)),CodeMirror.on(b,"change",this.trackChange),this.docs[a]=c},delDoc:function(a){var b=this.docs[a];b&&(CodeMirror.off(b.doc,"change",this.trackChange),delete this.docs[a],this.server.delFile(a))},hideDoc:function(a){F(this);var b=this.docs[a];b&&b.changed&&g(this,b)},complete:function(a){var b=this;CodeMirror.showHint(a,function(a,c){return h(b,a,c)},{async:!0})},getHint:function(a,b){return h(this,a,b)},showType:function(a,b){j(this,a,b)},updateArgHints:function(a){k(this,a)},jumpToDef:function(a){n(this,a)},jumpBack:function(a){o(this,a)},rename:function(a){s(this,a)},request:function(a,b,c,d){var f=this,g=e(this,a.getDoc),h=v(this,g,b,d);this.server.request(h,function(a,d){!a&&f.options.responseFilter&&(d=f.options.responseFilter(g,b,h,a,d)),c(a,d)})}};var a=CodeMirror.Pos,b="CodeMirror-Tern-",c=250,t=0};