%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/jalalj2hb/www/ftm-admin/assets/js/
Upload File :
Create Path :
Current File : /home/jalalj2hb/www/ftm-admin/assets/js/uikit_htmleditor_custom.min.js

!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);(this||window).CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?Ii(n):{},Ii(tl,n,!1),d(n);var i=n.value;"string"==typeof i&&(i=new Sl(i,n.mode,null,n.lineSeparator)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),l=this.display=new t(r,i,o);l.wrapper.CodeMirror=this,c(this),s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!No&&l.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Oi,keySeq:null,specialChars:null};var a=this;xo&&ko<11&&setTimeout(function(){a.display.input.reset(!0)},20),$t(this),Yi(),kt(this),this.curOp.forceUpdate=!0,Zn(this,i),n.autofocus&&!No||a.hasFocus()?setTimeout(Pi(vr,this),20):yr(this);for(var u in rl)rl.hasOwnProperty(u)&&rl[u](this,n[u],nl);w(this),n.finishInit&&n.finishInit(this);for(var h=0;h<sl.length;++h)sl[h](this);_t(this),wo&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(l.lineDiv).textRendering&&(l.lineDiv.style.textRendering="auto")}function t(e,t,r){var n=this;this.input=r,n.scrollbarFiller=$i("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=$i("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=$i("div",null,"CodeMirror-code"),n.selectionDiv=$i("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=$i("div",null,"CodeMirror-cursors"),n.measure=$i("div",null,"CodeMirror-measure"),n.lineMeasure=$i("div",null,"CodeMirror-measure"),n.lineSpace=$i("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=$i("div",[$i("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=$i("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=$i("div",null,null,"position: absolute; height: "+Hl+"px; width: 1px;"),n.gutters=$i("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=$i("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=$i("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),xo&&ko<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),wo||vo&&No||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Pe(e,100),e.state.modeGen++,e.curOp&&Ht(e)}function i(e){e.options.lineWrapping?(Jl(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Ql(e.display.wrapper,"CodeMirror-wrap"),f(e)),l(e),Ht(e),at(e),setTimeout(function(){y(e)},100)}function o(e){var t=bt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/xt(e.display)-3);return function(i){if(_n(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l<i.widgets.length;l++)i.widgets[l].height&&(o+=i.widgets[l].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function l(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&ti(e,t)})}function s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),at(e)}function a(e){c(e),Ht(e),setTimeout(function(){k(e)},20)}function c(e){var t=e.display.gutters,r=e.options.gutters;ji(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild($i("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",u(e)}function u(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function h(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=mn(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=vn(n);){var i=t.find(0,!0);r-=n.text.length-i.from.ch,n=i.to.line,r+=n.text.length-i.to.ch}return r}function f(e){var t=e.display,r=e.doc;t.maxLine=Qn(r,r.first),t.maxLineLength=h(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=h(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function d(e){var t=zi(e.gutters,"CodeMirror-linenumbers");t==-1&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function p(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+je(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Ve(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function g(e,t,r){this.cm=r;var n=this.vert=$i("div",[$i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=$i("div",[$i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Ol(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Ol(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,xo&&ko<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function m(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Ql(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Ol(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?or(t,e):ir(t,e)},t),t.display.scrollbars.addClass&&Jl(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=p(e));var r=e.display.barWidth,n=e.display.barHeight;b(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&O(e),b(e,p(e)),r=e.display.barWidth,n=e.display.barHeight}function b(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function x(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-$e(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=ni(t,n),l=ni(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;s<o?(o=s,l=ni(t,ii(Qn(t,s))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=l&&(o=ni(t,ii(Qn(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function k(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=C(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l<r.length;l++)if(!r[l].hidden){e.options.fixedGutter&&r[l].gutter&&(r[l].gutter.style.left=o);var s=r[l].alignable;if(s)for(var a=0;a<s.length;a++)s[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function w(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=_(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild($i("div",[$i("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-l)+1,n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",u(e),!0}return!1}function _(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function C(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function S(e,t,r){var n=e.display;this.viewport=t,this.visible=x(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Ge(e),this.force=r,this.dims=W(e),this.events=[]}function L(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ve(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ve(e)+"px",t.scrollbarsClipped=!0)}function M(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return It(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Bt(e))return!1;w(e)&&(It(e),t.dims=W(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>l&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),Io&&(o=kn(e.doc,o),l=wn(e.doc,l));var s=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Rt(e,o,l),r.viewOffset=ii(Qn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var a=Bt(e);if(!s&&0==a&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Vi();return a>4&&(r.lineDiv.style.display="none"),z(e,r.updateLineNumbers,t.dims),a>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,c&&Vi()!=c&&c.offsetHeight&&c.focus(),ji(r.cursorDiv),ji(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Pe(e,400)),r.updateLineNumbers=null,!0}function T(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Ge(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+je(e.display)-Ke(e),r.top)}),t.visible=x(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&M(e,t);n=!1){O(e);var i=p(e);ze(e),y(e,i),N(e,i)}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var r=new S(e,t);if(M(e,r)){O(e),T(e,r);var n=p(e);ze(e),y(e,n),N(e,n),r.finish()}}function N(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ve(e)+"px"}function O(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i,o=t.view[n];if(!o.hidden){if(xo&&ko<8){var l=o.node.offsetTop+o.node.offsetHeight;i=l-r,r=l}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var a=o.line.height-i;if(i<2&&(i=bt(t)),(a>.001||a<-.001)&&(ti(o.line,i),q(o.line),o.rest))for(var c=0;c<o.rest.length;c++)q(o.rest[c])}}}function q(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.parentNode.offsetHeight}function W(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)r[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[l]]=o.clientWidth;return{fixedPos:C(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function z(e,t,r){function n(t){var r=t.nextSibling;return wo&&Oo&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var i=e.display,o=e.options.lineNumbers,l=i.lineDiv,s=l.firstChild,a=i.view,c=i.viewFrom,u=0;u<a.length;u++){var h=a[u];if(h.hidden);else if(h.node&&h.node.parentNode==l){for(;s!=h.node;)s=n(s);var f=o&&null!=t&&t<=c&&h.lineNumber;h.changes&&(zi(h.changes,"gutter")>-1&&(f=!1),D(e,h,c,r)),f&&(ji(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(_(e.options,c)))),s=h.node.nextSibling}else{var d=$(e,h,c,r);l.insertBefore(d,s)}c+=h.size}for(;s;)s=n(s)}function D(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?P(e,t):"gutter"==o?R(e,t,r,n):"class"==o?F(t):"widget"==o&&B(e,t,n)}t.changes=null}function H(e){return e.node==e.text&&(e.node=$i("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),xo&&ko<8&&(e.node.style.zIndex=2)),e.node}function E(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=H(e);e.background=r.insertBefore($i("div",null,t),r.firstChild)}}function I(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Pn(e,t)}function P(e,t){var r=t.text.className,n=I(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,F(t)):r&&(t.text.className=r)}function F(e){E(e),e.line.wrapClass?H(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function R(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=H(t);t.gutterBackground=$i("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=H(t),l=t.gutter=$i("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(l),i.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild($i("div",_(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.options.gutters.length;++s){var a=e.options.gutters[s],c=o.hasOwnProperty(a)&&o[a];c&&l.appendChild($i("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[a]+"px; width: "+n.gutterWidth[a]+"px"))}}}function B(e,t,r){t.alignable&&(t.alignable=null);for(var n,i=t.node.firstChild;i;i=n){var n=i.nextSibling;"CodeMirror-linewidget"==i.className&&t.node.removeChild(i)}j(e,t,r)}function $(e,t,r,n){var i=I(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),F(t),R(e,t,r,n),j(e,t,n),t.node}function j(e,t,r){if(U(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)U(e,t.rest[n],t,r,!1)}function U(e,t,r,n,i){if(t.widgets)for(var o=H(r),l=0,s=t.widgets;l<s.length;++l){var a=s[l],c=$i("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),V(a,c,r,n),e.display.input.setUneditable(c),i&&a.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),Si(a,"redraw")}}function V(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function G(e){return Po(e.line,e.ch)}function K(e,t){return Fo(e,t)<0?t:e}function X(e,t){return Fo(e,t)<0?e:t}function Y(e){e.state.focused||(e.display.input.focus(),vr(e))}function Z(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var l=e.state.pasteIncoming||"paste"==i,s=o.splitLines(t),a=null;if(l&&n.ranges.length>1)if(Ro&&Ro.text.join("\n")==t){if(n.ranges.length%Ro.text.length==0){a=[];for(var c=0;c<Ro.text.length;c++)a.push(o.splitLines(Ro.text[c]))}}else s.length==n.ranges.length&&(a=Di(s,function(e){return[e]}));for(var c=n.ranges.length-1;c>=0;c--){var u=n.ranges[c],h=u.from(),f=u.to();u.empty()&&(r&&r>0?h=Po(h.line,h.ch-r):e.state.overwrite&&!l?f=Po(f.line,Math.min(Qn(o,f.line).text.length,f.ch+Wi(s).length)):Ro&&Ro.lineWise&&Ro.text.join("\n")==t&&(h=f=Po(h.line,0)));var d=e.curOp.updateInput,p={from:h,to:f,text:a?a[c%a.length]:s,origin:i||(l?"paste":e.state.cutIncoming?"cut":"+input")};Lr(e.doc,p),Si(e,"inputRead",e,p)}t&&!l&&J(e,t),Ir(e),e.curOp.updateInput=d,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Q(e,t){var r=e.clipboardData&&e.clipboardData.getData("text/plain");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Nt(t,function(){Z(t,r,0,null,"paste")}),!0}function J(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(t.indexOf(o.electricChars.charAt(s))>-1){l=Fr(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Qn(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Fr(e,i.head.line,"smart"));l&&Si(e,"electricInput",e,i.head.line)}}}function ee(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:Po(i,0),head:Po(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function te(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function re(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Oi,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function ne(){var e=$i("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=$i("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return wo?e.style.width="1000px":e.setAttribute("wrap","off"),Ao&&(e.style.border="1px solid black"),te(e),t}function ie(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Oi,this.gracePeriod=!1}function oe(e,t){var r=Je(e,t.line);if(!r||r.hidden)return null;var n=Qn(e.doc,t.line),i=Ye(r,n,t.line),o=oi(n),l="left";if(o){var s=uo(o,t.ch);l=s%2?"right":"left"}var a=rt(i.map,t.ch,l);return a.offset="right"==a.collapse?a.end:a.start,a}function le(e,t){return t&&(e.bad=!0),e}function se(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return le(e.clipPos(Po(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return ae(o,t,r)}}function ae(e,t,r){function n(t,r,n){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?c.map:u[i],l=0;l<o.length;l+=3){var s=o[l+2];if(s==t||s==r){var a=ri(i<0?e.line:e.rest[i]),h=o[l]+n;return(n<0||s!=t)&&(h=o[l+(n?1:0)]),Po(a,h)}}}var i=e.text.firstChild,o=!1;if(!t||!Xl(i,t))return le(Po(ri(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var l=e.rest?Wi(e.rest):e.line;return le(Po(ri(l),l.text.length),o)}var s=3==t.nodeType?t:null,a=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,r&&(r=s.nodeValue.length));a.parentNode!=i;)a=a.parentNode;var c=e.measure,u=c.maps,h=n(s,a,r);if(h)return le(h,o);for(var f=a.nextSibling,d=s?s.nodeValue.length-r:0;f;f=f.nextSibling){if(h=n(f,f.firstChild,0))return le(Po(h.line,h.ch-d),o);d+=f.textContent.length}for(var p=a.previousSibling,d=r;p;p=p.previousSibling){if(h=n(p,p.firstChild,-1))return le(Po(h.line,h.ch+d),o);d+=f.textContent.length}}function ce(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function l(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(s+=r);var u,h=t.getAttribute("cm-marker");if(h){var f=e.findMarks(Po(n,0),Po(i+1,0),o(+h));return void(f.length&&(u=f[0].find())&&(s+=Jn(e.doc,u.from,u.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;for(var d=0;d<t.childNodes.length;d++)l(t.childNodes[d]);/^(pre|div|p)$/i.test(t.nodeName)&&(a=!0)}else if(3==t.nodeType){var p=t.nodeValue;if(!p)return;a&&(s+=c,a=!1),s+=p}}for(var s="",a=!1,c=e.doc.lineSeparator();l(t),t!=r;)t=t.nextSibling;return s}function ue(e,t){this.ranges=e,this.primIndex=t}function he(e,t){this.anchor=e,this.head=t}function fe(e,t){var r=e[t];e.sort(function(e,t){return Fo(e.from(),t.from())}),t=zi(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(Fo(o.to(),i.from())>=0){var l=X(o.from(),i.from()),s=K(o.to(),i.to()),a=o.empty()?i.from()==i.head:o.from()==o.head;n<=t&&--t,e.splice(--n,2,new he(a?s:l,a?l:s))}}return new ue(e,t)}function de(e,t){return new ue([new he(e,t||e)],0)}function pe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.line<e.first)return Po(e.first,0);var r=e.first+e.size-1;return t.line>r?Po(r,Qn(e,r).text.length):me(t,Qn(e,t.line).text.length)}function me(e,t){var r=e.ch;return null==r||r>t?Po(e.line,t):r<0?Po(e.line,0):e}function ve(e,t){return t>=e.first&&t<e.first+e.size}function ye(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=ge(e,t[n]);return r}function be(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=Fo(r,i)<0;o!=Fo(n,i)<0?(i=r,r=n):o!=Fo(r,n)<0&&(r=n)}return new he(i,r)}return new he(n||r,r)}function xe(e,t,r,n){Le(e,new ue([be(e,e.sel.primary(),t,r)],0),n)}function ke(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=be(e,e.sel.ranges[i],t[i],null);var o=fe(n,e.sel.primIndex);Le(e,o,r)}function we(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Le(e,fe(i,e.sel.primIndex),n)}function _e(e,t,r,n){Le(e,de(t,r),n)}function Ce(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new he(ge(e,t[r].anchor),ge(e,t[r].head))},origin:r&&r.origin};return zl(e,"beforeSelectionChange",e,n),e.cm&&zl(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?fe(n.ranges,n.ranges.length-1):t}function Se(e,t,r){var n=e.history.done,i=Wi(n);i&&i.ranges?(n[n.length-1]=t,Me(e,t,r)):Le(e,t,r)}function Le(e,t,r){Me(e,t,r),fi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Me(e,t,r){(Ai(e,"beforeSelectionChange")||e.cm&&Ai(e.cm,"beforeSelectionChange"))&&(t=Ce(e,t,r));var n=r&&r.bias||(Fo(t.primary().head,e.sel.primary().head)<0?-1:1);Te(e,Ne(e,t,n,!0)),r&&r.scroll===!1||!e.cm||Ir(e.cm)}function Te(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Ti(e.cm)),Si(e,"cursorActivity",e))}function Ae(e){Te(e,Ne(e,e.sel,null,!1),Il)}function Ne(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],a=qe(e,l.anchor,s&&s.anchor,r,n),c=qe(e,l.head,s&&s.head,r,n);(i||a!=l.anchor||c!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new he(a,c))}return i?fe(i,t.primIndex):t}function Oe(e,t,r,n,i){var o=Qn(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var s=o.markedSpans[l],a=s.marker;if((null==s.from||(a.inclusiveLeft?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(a.inclusiveRight?s.to>=t.ch:s.to>t.ch))){if(i&&(zl(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(r){var c,u=a.find(n<0?1:-1);if((n<0?a.inclusiveRight:a.inclusiveLeft)&&(u=We(e,u,-n,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=Fo(u,r))&&(n<0?c<0:c>0))return Oe(e,u,t,n,i)}var h=a.find(n<0?-1:1);return(n<0?a.inclusiveLeft:a.inclusiveRight)&&(h=We(e,h,n,h.line==t.line?o:null)),h?Oe(e,h,t,n,i):null}}return t}function qe(e,t,r,n,i){var o=n||1,l=Oe(e,t,r,o,i)||!i&&Oe(e,t,r,o,!0)||Oe(e,t,r,-o,i)||!i&&Oe(e,t,r,-o,!0);return l?l:(e.cantEdit=!0,Po(e.first,0))}function We(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ge(e,Po(t.line-1)):null:r>0&&t.ch==(n||Qn(e,t.line)).text.length?t.line<e.first+e.size-1?Po(t.line+1,0):null:new Po(t.line,t.ch+r)}function ze(e){e.display.input.showSelection(e.display.input.prepareSelection())}function De(e,t){for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),l=0;l<r.sel.ranges.length;l++)if(t!==!1||l!=r.sel.primIndex){var s=r.sel.ranges[l];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var a=s.empty();(a||e.options.showCursorWhenSelecting)&&He(e,s.head,i),a||Ee(e,s,o)}}return n}function He(e,t,r){var n=pt(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild($i("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild($i("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function Ee(e,t,r){function n(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),s.appendChild($i("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?u-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return dt(e,Po(t,r),"div",h,n)}var s,a,h=Qn(l,t),f=h.text.length;return to(oi(h),r||0,null==i?f:i,function(e,t,l){var h,d,p,g=o(e,"left");if(e==t)h=g,d=p=g.left;else{if(h=o(t-1,"right"),"rtl"==l){var m=g;g=h,h=m}d=g.left,p=h.right}null==r&&0==e&&(d=c),h.top-g.top>3&&(n(d,g.top,null,g.bottom),d=c,g.bottom<h.top&&n(d,g.bottom,null,h.top)),null==i&&t==f&&(p=u),(!s||g.top<s.top||g.top==s.top&&g.left<s.left)&&(s=g),(!a||h.bottom>a.bottom||h.bottom==a.bottom&&h.right>a.right)&&(a=h),d<c+1&&(d=c),n(d,h.top,p-d,h.bottom)}),{start:s,end:a}}var o=e.display,l=e.doc,s=document.createDocumentFragment(),a=Ue(e.display),c=a.left,u=Math.max(o.sizerWidth,Ge(e)-o.sizer.offsetLeft)-a.right,h=t.from(),f=t.to();if(h.line==f.line)i(h.line,h.ch,f.ch);else{var d=Qn(l,h.line),p=Qn(l,f.line),g=bn(d)==bn(p),m=i(h.line,h.ch,g?d.text.length+1:null).end,v=i(f.line,g?0:null,f.ch).start;g&&(m.top<v.top-2?(n(m.right,m.top,null,m.bottom),n(c,v.top,v.left,v.bottom)):n(m.right,m.top,v.left-m.right,m.bottom)),m.bottom<v.top&&n(c,m.bottom,null,v.top)}r.appendChild(s)}function Ie(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Pe(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Pi(Fe,e))}function Fe(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=cl(t.mode,Be(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var l=o.styles,s=o.text.length>e.options.maxHighlightLength,a=Dn(e,o,s?cl(t.mode,n):n,!0);o.styles=a.styles;var c=o.styleClasses,u=a.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var h=!l||l.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),f=0;!h&&f<l.length;++f)h=l[f]!=o.styles[f];h&&i.push(t.frontier),o.stateAfter=s?n:cl(t.mode,n)}else o.text.length<=e.options.maxHighlightLength&&En(e,o.text,n),o.stateAfter=t.frontier%5==0?cl(t.mode,n):null;if(++t.frontier,+new Date>r)return Pe(e,e.options.workDelay),!0}),i.length&&Nt(e,function(){for(var t=0;t<i.length;t++)Et(e,i[t],"text")})}}function Re(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>l;--s){if(s<=o.first)return o.first;var a=Qn(o,s-1);if(a.stateAfter&&(!r||s<=o.frontier))return s;var c=Rl(a.text,null,e.options.tabSize);(null==i||n>c)&&(i=s-1,n=c)}return i}function Be(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=Re(e,t,r),l=o>n.first&&Qn(n,o-1).stateAfter;return l=l?cl(n.mode,l):ul(n.mode),n.iter(o,t,function(r){En(e,r.text,l);var s=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=s?cl(n.mode,l):null,++o}),r&&(n.frontier=o),l}function $e(e){return e.lineSpace.offsetTop}function je(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ue(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Ui(e.measure,$i("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Ve(e){return Hl-e.display.nativeBarWidth}function Ge(e){return e.display.scroller.clientWidth-Ve(e)-e.display.barWidth}function Ke(e){return e.display.scroller.clientHeight-Ve(e)-e.display.barHeight}function Xe(e,t,r){var n=e.options.lineWrapping,i=n&&Ge(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),s=0;s<l.length-1;s++){var a=l[s],c=l[s+1];Math.abs(a.bottom-c.bottom)>2&&o.push((a.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Ye(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var n=0;n<e.rest.length;n++)if(ri(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Ze(e,t){t=bn(t);var r=ri(t),n=e.display.externalMeasured=new zt(e.doc,t,r);n.lineN=r;var i=n.built=Pn(e,n);return n.text=i.pre,Ui(e.display.lineMeasure,i.pre),n}function Qe(e,t,r,n){return tt(e,et(e,t),r,n)}function Je(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Pt(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function et(e,t){var r=ri(t),n=Je(e,r);n&&!n.text?n=null:n&&n.changes&&(D(e,n,r,W(e)),e.curOp.forceUpdate=!0),n||(n=Ze(e,t));var i=Ye(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function tt(e,t,r,n,i){t.before&&(r=-1);var o,l=r+(n||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Xe(e,t.view,t.rect),t.hasHeights=!0),o=it(e,t,r,n),o.bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function rt(e,t,r){for(var n,i,o,l,s=0;s<e.length;s+=3){var a=e[s],c=e[s+1];if(t<a?(i=0,o=1,l="left"):t<c?(i=t-a,
o=i+1):(s==e.length-3||t==c&&e[s+3]>t)&&(o=c-a,i=o-1,t>=c&&(l="right")),null!=i){if(n=e[s+2],a==c&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)n=e[(s-=3)+2],l="left";if("right"==r&&i==c-a)for(;s<e.length-3&&e[s+3]==e[s+4]&&!e[s+5].insertLeft;)n=e[(s+=3)+2],l="right";break}}return{node:n,start:i,end:o,collapse:l,coverStart:a,coverEnd:c}}function nt(e,t){var r=Uo;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var n=e.length-1;n>=0&&(r=e[n]).left==r.right;n--);return r}function it(e,t,r,n){var i,o=rt(t.map,r,n),l=o.node,s=o.start,a=o.end,c=o.collapse;if(3==l.nodeType){for(var u=0;u<4;u++){for(;s&&Bi(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+a<o.coverEnd&&Bi(t.line.text.charAt(o.coverStart+a));)++a;if(i=xo&&ko<9&&0==s&&a==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():nt(Ul(l,s,a).getClientRects(),n),i.left||i.right||0==s)break;a=s,s-=1,c="right"}xo&&ko<11&&(i=ot(e.display.measure,i))}else{s>0&&(c=n="right");var h;i=e.options.lineWrapping&&(h=l.getClientRects()).length>1?h["right"==n?h.length-1:0]:l.getBoundingClientRect()}if(xo&&ko<9&&!s&&(!i||!i.left&&!i.right)){var f=l.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+xt(e.display),top:f.top,bottom:f.bottom}:Uo}for(var d=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(d+p)/2,m=t.view.measure.heights,u=0;u<m.length-1&&!(g<m[u]);u++);var v=u?m[u-1]:0,y=m[u],b={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:v,bottom:y};return i.left||i.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=d,b.rbottom=p),b}function ot(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!eo(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function lt(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function st(e){e.display.externalMeasure=null,ji(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)lt(e.display.view[t])}function at(e){st(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ct(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ut(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function ht(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=Ln(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=ii(t);if("local"==n?l+=$e(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:ut());var a=s.left+("window"==n?0:ct());r.left+=a,r.right+=a}return r.top+=l,r.bottom+=l,r}function ft(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=ct(),i-=ut();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:i-l.top}}function dt(e,t,r,n,i){return n||(n=Qn(e.doc,t.line)),ht(e,n,Qe(e,n,t.ch,i),r)}function pt(e,t,r,n,i,o){function l(t,l){var s=tt(e,i,t,l?"right":"left",o);return l?s.left=s.right:s.right=s.left,ht(e,n,s,r)}function s(e,t){var r=a[t],n=r.level%2;return e==ro(r)&&t&&r.level<a[t-1].level?(r=a[--t],e=no(r)-(r.level%2?0:1),n=!0):e==no(r)&&t<a.length-1&&r.level<a[t+1].level&&(r=a[++t],e=ro(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?l(e-1):l(e,n)}n=n||Qn(e.doc,t.line),i||(i=et(e,n));var a=oi(n),c=t.ch;if(!a)return l(c);var u=uo(a,c),h=s(c,u);return null!=ss&&(h.other=s(c,ss)),h}function gt(e,t){var r=0,t=ge(e.doc,t);e.options.lineWrapping||(r=xt(e.display)*t.ch);var n=Qn(e.doc,t.line),i=ii(n)+$e(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function mt(e,t,r,n){var i=Po(e,t);return i.xRel=n,r&&(i.outside=!0),i}function vt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return mt(n.first,0,!0,-1);var i=ni(n,r),o=n.first+n.size-1;if(i>o)return mt(n.first+n.size-1,Qn(n,o).text.length,!0,1);t<0&&(t=0);for(var l=Qn(n,i);;){var s=yt(e,l,i,t,r),a=vn(l),c=a&&a.find(0,!0);if(!a||!(s.ch>c.from.ch||s.ch==c.from.ch&&s.xRel>0))return s;i=ri(l=c.to.line)}}function yt(e,t,r,n,i){function o(n){var i=pt(e,Po(r,n),"line",t,c);return s=!0,l>i.bottom?i.left-a:l<i.top?i.left+a:(s=!1,i.left)}var l=i-ii(t),s=!1,a=2*e.display.wrapper.clientWidth,c=et(e,t),u=oi(t),h=t.text.length,f=io(t),d=oo(t),p=o(f),g=s,m=o(d),v=s;if(n>m)return mt(r,d,v,1);for(;;){if(u?d==f||d==fo(t,f,1):d-f<=1){var y=n<p||n-p<=m-n?f:d,b=y==f?g:v,x=n-(y==f?p:m);if(v&&!u&&!/\s/.test(t.text.charAt(y))&&x>0&&y<t.text.length&&c.view.measure.heights.length>1){var k=tt(e,c,y,"right");l<=k.bottom&&l>=k.top&&Math.abs(n-k.right)<x&&(b=!1,y++,x=n-k.right)}for(;Bi(t.text.charAt(y));)++y;var w=mt(r,y,b,x<-1?-1:x>1?1:0);return w}var _=Math.ceil(h/2),C=f+_;if(u){C=f;for(var S=0;S<_;++S)C=fo(t,C,1)}var L=o(C);L>n?(d=C,m=L,(v=s)&&(m+=1e3),h=_):(f=C,p=L,g=s,h-=_)}}function bt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Bo){Bo=$i("pre");for(var t=0;t<49;++t)Bo.appendChild(document.createTextNode("x")),Bo.appendChild($i("br"));Bo.appendChild(document.createTextNode("x"))}Ui(e.measure,Bo);var r=Bo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),ji(e.measure),r||1}function xt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=$i("span","xxxxxxxxxx"),r=$i("pre",[t]);Ui(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function kt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Go},Vo?Vo.ops.push(e.curOp):e.curOp.ownsGroup=Vo={ops:[e.curOp],delayedCallbacks:[]}}function wt(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function _t(e){var t=e.curOp,r=t.ownsGroup;if(r)try{wt(r)}finally{Vo=null;for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;Ct(r)}}function Ct(e){for(var t=e.ops,r=0;r<t.length;r++)St(t[r]);for(var r=0;r<t.length;r++)Lt(t[r]);for(var r=0;r<t.length;r++)Mt(t[r]);for(var r=0;r<t.length;r++)Tt(t[r]);for(var r=0;r<t.length;r++)At(t[r])}function St(e){var t=e.cm,r=t.display;L(t),e.updateMaxLine&&f(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new S(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Lt(e){e.updatedDisplay=e.mustUpdate&&M(e.cm,e.update)}function Mt(e){var t=e.cm,r=t.display;e.updatedDisplay&&O(t),e.barMeasure=p(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Qe(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Ve(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ge(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection(e.focus))}function Tt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&or(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==Vi()&&(!document.hasFocus||document.hasFocus());e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.updatedDisplay&&N(t,e.barMeasure),e.selectionChanged&&Ie(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&Y(e.cm)}function At(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&T(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null==e.scrollTop||r.scroller.scrollTop==e.scrollTop&&!e.forceScroll||(n.scrollTop=Math.max(0,Math.min(r.scroller.scrollHeight-r.scroller.clientHeight,e.scrollTop)),r.scrollbars.setScrollTop(n.scrollTop),r.scroller.scrollTop=n.scrollTop),null==e.scrollLeft||r.scroller.scrollLeft==e.scrollLeft&&!e.forceScroll||(n.scrollLeft=Math.max(0,Math.min(r.scroller.scrollWidth-r.scroller.clientWidth,e.scrollLeft)),r.scrollbars.setScrollLeft(n.scrollLeft),r.scroller.scrollLeft=n.scrollLeft,k(t)),e.scrollToPos){var i=zr(t,ge(n,e.scrollToPos.from),ge(n,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&Wr(t,i)}var o=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(o)for(var s=0;s<o.length;++s)o[s].lines.length||zl(o[s],"hide");if(l)for(var s=0;s<l.length;++s)l[s].lines.length&&zl(l[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&zl(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Nt(e,t){if(e.curOp)return t();kt(e);try{return t()}finally{_t(e)}}function Ot(e,t){return function(){if(e.curOp)return t.apply(e,arguments);kt(e);try{return t.apply(e,arguments)}finally{_t(e)}}}function qt(e){return function(){if(this.curOp)return e.apply(this,arguments);kt(this);try{return e.apply(this,arguments)}finally{_t(this)}}}function Wt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);kt(t);try{return e.apply(this,arguments)}finally{_t(t)}}}function zt(e,t,r){this.line=t,this.rest=xn(t),this.size=this.rest?ri(Wi(this.rest))-r+1:1,this.node=this.text=null,this.hidden=_n(e,t)}function Dt(e,t,r){for(var n,i=[],o=t;o<r;o=n){var l=new zt(e.doc,Qn(e.doc,o),o);n=o+l.size,i.push(l)}return i}function Ht(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Io&&kn(e.doc,t)<i.viewTo&&It(e);else if(r<=i.viewFrom)Io&&wn(e.doc,r+n)>i.viewFrom?It(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)It(e);else if(t<=i.viewFrom){var o=Ft(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):It(e)}else if(r>=i.viewTo){var o=Ft(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):It(e)}else{var l=Ft(e,t,t,-1),s=Ft(e,r,r+n,1);l&&s?(i.view=i.view.slice(0,l.index).concat(Dt(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):It(e)}var a=i.externalMeasured;a&&(r<a.lineN?a.lineN+=n:t<a.lineN+a.size&&(i.externalMeasured=null))}function Et(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[Pt(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);zi(l,r)==-1&&l.push(r)}}}function It(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Pt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,t<0)return n}function Ft(e,t,r,n){var i,o=Pt(e,t),l=e.display.view;if(!Io||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=0,a=e.display.viewFrom;s<o;s++)a+=l[s].size;if(a!=t){if(n>0){if(o==l.length-1)return null;i=a+l[o].size-t,o++}else i=a-t;t+=i,r+=i}for(;kn(e.doc,r)!=r;){if(o==(n<0?0:l.length-1))return null;r+=n*l[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Rt(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Dt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Dt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Pt(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Dt(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Pt(e,r)))),n.viewTo=r}function Bt(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function $t(e){function t(){i.activeTouch&&(o=setTimeout(function(){i.activeTouch=null},1e3),l=i.activeTouch,l.end=+new Date)}function r(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function n(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}var i=e.display;Ol(i.scroller,"mousedown",Ot(e,Kt)),xo&&ko<11?Ol(i.scroller,"dblclick",Ot(e,function(t){if(!Mi(e,t)){var r=Gt(e,t);if(r&&!Jt(e,t)&&!Vt(e.display,t)){Tl(t);var n=e.findWordAt(r);xe(e.doc,n.anchor,n.head)}}})):Ol(i.scroller,"dblclick",function(t){Mi(e,t)||Tl(t)}),Ho||Ol(i.scroller,"contextmenu",function(t){br(e,t)});var o,l={end:0};Ol(i.scroller,"touchstart",function(t){if(!Mi(e,t)&&!r(t)){clearTimeout(o);var n=+new Date;i.activeTouch={start:n,moved:!1,prev:n-l.end<=300?l:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Ol(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Ol(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Vt(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var l,s=e.coordsChar(i.activeTouch,"page");l=!o.prev||n(o,o.prev)?new he(s,s):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(s):new he(Po(s.line,0),ge(e.doc,Po(s.line+1,0))),e.setSelection(l.anchor,l.head),e.focus(),Tl(r)}t()}),Ol(i.scroller,"touchcancel",t),Ol(i.scroller,"scroll",function(){i.scroller.clientHeight&&(ir(e,i.scroller.scrollTop),or(e,i.scroller.scrollLeft,!0),zl(e,"scroll",e))}),Ol(i.scroller,"mousewheel",function(t){lr(e,t)}),Ol(i.scroller,"DOMMouseScroll",function(t){lr(e,t)}),Ol(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Mi(e,t)||Nl(t)},over:function(t){Mi(e,t)||(rr(e,t),Nl(t))},start:function(t){tr(e,t)},drop:Ot(e,er),leave:function(t){Mi(e,t)||nr(e)}};var s=i.input.getField();Ol(s,"keyup",function(t){pr.call(e,t)}),Ol(s,"keydown",Ot(e,fr)),Ol(s,"keypress",Ot(e,gr)),Ol(s,"focus",Pi(vr,e)),Ol(s,"blur",Pi(yr,e))}function jt(t,r,n){var i=n&&n!=e.Init;if(!r!=!i){var o=t.display.dragFunctions,l=r?Ol:Wl;l(t.display.scroller,"dragstart",o.start),l(t.display.scroller,"dragenter",o.enter),l(t.display.scroller,"dragover",o.over),l(t.display.scroller,"dragleave",o.leave),l(t.display.scroller,"drop",o.drop)}}function Ut(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Vt(e,t){for(var r=wi(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Gt(e,t,r,n){var i=e.display;if(!r&&"true"==wi(t).getAttribute("cm-not-content"))return null;var o,l,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var a,c=vt(e,o,l);if(n&&1==c.xRel&&(a=Qn(e.doc,c.line).text).length==c.ch){var u=Rl(a,a.length,e.options.tabSize)-a.length;c=Po(c.line,Math.max(0,Math.round((o-Ue(e.display).left)/xt(e.display))-u))}return c}function Kt(e){var t=this,r=t.display;if(!(Mi(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.shift=e.shiftKey,Vt(r,e))return void(wo||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Jt(t,e)){var n=Gt(t,e);switch(window.focus(),_i(e)){case 1:t.state.selectingText?t.state.selectingText(e):n?Xt(t,e,n):wi(e)==r.scroller&&Tl(e);break;case 2:wo&&(t.state.lastMiddleDown=+new Date),n&&xe(t.doc,n),setTimeout(function(){r.input.focus()},20),Tl(e);break;case 3:Ho?br(t,e):mr(t)}}}}function Xt(e,t,r){xo?setTimeout(Pi(Y,e),0):e.curOp.focus=Vi();var n,i=+new Date;jo&&jo.time>i-400&&0==Fo(jo.pos,r)?n="triple":$o&&$o.time>i-400&&0==Fo($o.pos,r)?(n="double",jo={time:i,pos:r}):(n="single",$o={time:i,pos:r});var o,l=e.doc.sel,s=Oo?t.metaKey:t.ctrlKey;e.options.dragDrop&&ts&&!e.isReadOnly()&&"single"==n&&(o=l.contains(r))>-1&&(Fo((o=l.ranges[o]).from(),r)<0||r.xRel>0)&&(Fo(o.to(),r)>0||r.xRel<0)?Yt(e,t,r,s):Zt(e,t,r,n,s)}function Yt(e,t,r,n){var i=e.display,o=+new Date,l=Ot(e,function(s){wo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Wl(document,"mouseup",l),Wl(i.scroller,"drop",l),Math.abs(t.clientX-s.clientX)+Math.abs(t.clientY-s.clientY)<10&&(Tl(s),!n&&+new Date-200<o&&xe(e.doc,r),wo||xo&&9==ko?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});wo&&(i.scroller.draggable=!0),e.state.draggingText=l,l.copy=Oo?t.altKey:t.ctrlKey,i.scroller.dragDrop&&i.scroller.dragDrop(),Ol(document,"mouseup",l),Ol(i.scroller,"drop",l)}function Zt(e,t,r,n,i){function o(t){if(0!=Fo(m,t))if(m=t,"rect"==n){for(var i=[],o=e.options.tabSize,l=Rl(Qn(c,r.line).text,r.ch,o),s=Rl(Qn(c,t.line).text,t.ch,o),a=Math.min(l,s),d=Math.max(l,s),p=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));p<=g;p++){var v=Qn(c,p).text,y=Bl(v,a,o);a==d?i.push(new he(Po(p,y),Po(p,y))):v.length>y&&i.push(new he(Po(p,y),Po(p,Bl(v,d,o))))}i.length||i.push(new he(r,r)),Le(c,fe(f.ranges.slice(0,h).concat(i),h),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,x=b.anchor,k=t;if("single"!=n){if("double"==n)var w=e.findWordAt(t);else var w=new he(Po(t.line,0),ge(c,Po(t.line+1,0)));Fo(w.anchor,x)>0?(k=w.head,x=X(b.from(),w.anchor)):(k=w.anchor,x=K(b.to(),w.head))}var i=f.ranges.slice(0);i[h]=new he(ge(c,x),k),Le(c,fe(i,h),Pl)}}function l(t){var r=++y,i=Gt(e,t,!0,"rect"==n);if(i)if(0!=Fo(i,m)){e.curOp.focus=Vi(),o(i);var s=x(a,c);(i.line>=s.to||i.line<s.from)&&setTimeout(Ot(e,function(){y==r&&l(t)}),150)}else{var u=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;u&&setTimeout(Ot(e,function(){y==r&&(a.scroller.scrollTop+=u,l(t))}),50)}}function s(t){e.state.selectingText=!1,y=1/0,Tl(t),a.input.focus(),Wl(document,"mousemove",b),Wl(document,"mouseup",k),c.history.lastSelOrigin=null}var a=e.display,c=e.doc;Tl(t);var u,h,f=c.sel,d=f.ranges;if(i&&!t.shiftKey?(h=c.sel.contains(r),u=h>-1?d[h]:new he(r,r)):(u=c.sel.primary(),h=c.sel.primIndex),qo?t.shiftKey&&t.metaKey:t.altKey)n="rect",i||(u=new he(r,r)),r=Gt(e,t,!0,!0),h=-1;else if("double"==n){var p=e.findWordAt(r);u=e.display.shift||c.extend?be(c,u,p.anchor,p.head):p}else if("triple"==n){var g=new he(Po(r.line,0),ge(c,Po(r.line+1,0)));u=e.display.shift||c.extend?be(c,u,g.anchor,g.head):g}else u=be(c,u,r);i?h==-1?(h=d.length,Le(c,fe(d.concat([u]),h),{scroll:!1,origin:"*mouse"})):d.length>1&&d[h].empty()&&"single"==n&&!t.shiftKey?(Le(c,fe(d.slice(0,h).concat(d.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),f=c.sel):we(c,h,u,Pl):(h=0,Le(c,new ue([u],0),Pl),f=c.sel);var m=r,v=a.wrapper.getBoundingClientRect(),y=0,b=Ot(e,function(e){_i(e)?l(e):s(e)}),k=Ot(e,s);e.state.selectingText=k,Ol(document,"mousemove",b),Ol(document,"mouseup",k)}function Qt(e,t,r,n){try{var i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Tl(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!Ai(e,r))return ki(t);o-=s.top-l.viewOffset;for(var a=0;a<e.options.gutters.length;++a){var c=l.gutters.childNodes[a];if(c&&c.getBoundingClientRect().right>=i){var u=ni(e.doc,o),h=e.options.gutters[a];return zl(e,r,e,u,h,t),ki(t)}}}function Jt(e,t){return Qt(e,t,"gutterClick",!0)}function er(e){var t=this;if(nr(t),!Mi(t,e)&&!Vt(t.display,e)){Tl(e),xo&&(Ko=+new Date);var r=Gt(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,s=function(e,n){if(!t.options.allowDropFileTypes||zi(t.options.allowDropFileTypes,e.type)!=-1){var s=new FileReader;s.onload=Ot(t,function(){var e=s.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++l==i){r=ge(t.doc,r);var a={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Lr(t.doc,a),Se(t.doc,de(r,el(a)))}}),s.readAsText(e)}},a=0;a<i;++a)s(n[a],a);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!t.state.draggingText.copy)var c=t.listSelections();if(Me(t.doc,de(r,r)),c)for(var a=0;a<c.length;++a)qr(t.doc,"",c[a].anchor,c[a].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function tr(e,t){if(xo&&(!e.state.draggingText||+new Date-Ko<100))return void Nl(t);if(!Mi(e,t)&&!Vt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!Lo)){var r=$i("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",So&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),So&&r.parentNode.removeChild(r)}}function rr(e,t){var r=Gt(e,t);if(r){var n=document.createDocumentFragment();He(e,r,n),e.display.dragCursor||(e.display.dragCursor=$i("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Ui(e.display.dragCursor,n)}}function nr(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ir(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,vo||A(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),vo&&A(e),Pe(e,100))}function or(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,k(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function lr(e,t){var r=Zo(t),n=r.x,i=r.y,o=e.display,l=o.scroller,s=l.scrollWidth>l.clientWidth,a=l.scrollHeight>l.clientHeight;if(n&&s||i&&a){if(i&&Oo&&wo)e:for(var c=t.target,u=o.view;c!=l;c=c.parentNode)for(var h=0;h<u.length;h++)if(u[h].node==c){e.display.currentWheelTarget=c;break e}if(n&&!vo&&!So&&null!=Yo)return i&&a&&ir(e,Math.max(0,Math.min(l.scrollTop+i*Yo,l.scrollHeight-l.clientHeight))),or(e,Math.max(0,Math.min(l.scrollLeft+n*Yo,l.scrollWidth-l.clientWidth))),(!i||i&&a)&&Tl(t),void(o.wheelStartX=null);if(i&&null!=Yo){var f=i*Yo,d=e.doc.scrollTop,p=d+o.wrapper.clientHeight;f<0?d=Math.max(0,d+f-50):p=Math.min(e.doc.height,p+f+50),A(e,{top:d,bottom:p})}Xo<20&&(null==o.wheelStartX?(o.wheelStartX=l.scrollLeft,o.wheelStartY=l.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=l.scrollLeft-o.wheelStartX,t=l.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Yo=(Yo*Xo+r)/(Xo+1),++Xo)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function sr(e,t,r){if("string"==typeof t&&(t=hl[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=El}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function ar(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=dl(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&dl(t,e.options.extraKeys,r,e)||dl(t,e.options.keyMap,r,e)}function cr(e,t,r,n){var i=e.state.keySeq;if(i){if(pl(t))return"handled";Qo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=ar(e,t,n);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&Si(e,"keyHandled",e,t,r),"handled"!=o&&"multi"!=o||(Tl(r),Ie(e)),i&&!o&&/\'$/.test(t)?(Tl(r),!0):!!o}function ur(e,t){var r=gl(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?cr(e,"Shift-"+r,t,function(t){return sr(e,t,!0)})||cr(e,r,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return sr(e,t)}):cr(e,r,t,function(t){return sr(e,t)}))}function hr(e,t,r){return cr(e,"'"+r+"'",t,function(t){return sr(e,t,!0)})}function fr(e){var t=this;if(t.curOp.focus=Vi(),!Mi(t,e)){xo&&ko<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=ur(t,e);So&&(Jo=n?r:null,!n&&88==r&&!is&&(Oo?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||dr(t)}}function dr(e){function t(e){18!=e.keyCode&&e.altKey||(Ql(r,"CodeMirror-crosshair"),Wl(document,"keyup",t),Wl(document,"mouseover",t))}var r=e.display.lineDiv;Jl(r,"CodeMirror-crosshair"),Ol(document,"keyup",t),Ol(document,"mouseover",t)}function pr(e){16==e.keyCode&&(this.doc.sel.shift=!1),Mi(this,e)}function gr(e){var t=this;if(!(Vt(t.display,e)||Mi(t,e)||e.ctrlKey&&!e.altKey||Oo&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(So&&r==Jo)return Jo=null,void Tl(e);if(!So||e.which&&!(e.which<10)||!ur(t,e)){var i=String.fromCharCode(null==n?r:n);hr(t,e,i)||t.display.input.onKeyPress(e)}}}function mr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,yr(e))},100)}function vr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(zl(e,"focus",e),e.state.focused=!0,Jl(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),wo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ie(e))}function yr(e){e.state.delayingBlurEvent||(e.state.focused&&(zl(e,"blur",e),e.state.focused=!1,Ql(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function br(e,t){Vt(e.display,t)||xr(e,t)||Mi(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function xr(e,t){return!!Ai(e,"gutterContextMenu")&&Qt(e,t,"gutterContextMenu",!1)}function kr(e,t){if(Fo(e,t.from)<0)return e;if(Fo(e,t.to)<=0)return el(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=el(t).ch-t.to.ch),Po(r,n)}function wr(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new he(kr(i.anchor,t),kr(i.head,t)))}return fe(r,e.sel.primIndex)}function _r(e,t,r){return e.line==t.line?Po(r.line,e.ch-t.ch+r.ch):Po(r.line+(e.line-t.line),e.ch)}function Cr(e,t,r){for(var n=[],i=Po(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=_r(s.from,i,o),c=_r(el(s),i,o);if(i=s.to,o=c,"around"==r){var u=e.sel.ranges[l],h=Fo(u.head,u.anchor)<0;n[l]=new he(h?c:a,h?a:c)}else n[l]=new he(a,a)}return new ue(n,e.sel.primIndex)}function Sr(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(t,r,n,i){t&&(this.from=ge(e,t)),r&&(this.to=ge(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),zl(e,"beforeChange",e,n),e.cm&&zl(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Lr(e,t,r){if(e.cm){if(!e.cm.curOp)return Ot(e.cm,Lr)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Ai(e,"beforeChange")||e.cm&&Ai(e.cm,"beforeChange"))||(t=Sr(e,t,!0))){var n=Eo&&!r&&cn(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Mr(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Mr(e,t)}}function Mr(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Fo(t.from,t.to)){var r=wr(e,t);ui(e,t,r,e.cm?e.cm.curOp.id:NaN),Nr(e,t,r,ln(e,t));var n=[];Yn(e,function(e,r){r||zi(n,e.history)!=-1||(xi(e.history,t),n.push(e.history)),Nr(e,t,null,ln(e,t))})}}function Tr(e,t,r){if(!e.cm||!e.cm.state.suppressEdits||r){for(var n,i=e.history,o=e.sel,l="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,a=0;a<l.length&&(n=l[a],r?!n.ranges||n.equals(e.sel):n.ranges);a++);if(a!=l.length){for(i.lastOrigin=i.lastSelOrigin=null;n=l.pop(),n.ranges;){if(di(n,s),r&&!n.equals(e.sel))return void Le(e,n,{clearRedo:!1});o=n}var c=[];di(o,s),s.push({changes:c,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var u=Ai(e,"beforeChange")||e.cm&&Ai(e.cm,"beforeChange"),a=n.changes.length-1;a>=0;--a){var h=n.changes[a];if(h.origin=t,u&&!Sr(e,h,!1))return void(l.length=0);c.push(si(e,h));var f=a?wr(e,h):Wi(l);Nr(e,h,f,an(e,h)),!a&&e.cm&&e.cm.scrollIntoView({from:h.from,to:el(h)});var d=[];Yn(e,function(e,t){t||zi(d,e.history)!=-1||(xi(e.history,h),d.push(e.history)),Nr(e,h,null,an(e,h))})}}}}function Ar(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Di(e.sel.ranges,function(e){return new he(Po(e.anchor.line+t,e.anchor.ch),Po(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Ht(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Et(e.cm,n,"gutter")}}function Nr(e,t,r,n){if(e.cm&&!e.cm.curOp)return Ot(e.cm,Nr)(e,t,r,n);if(t.to.line<e.first)return void Ar(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Ar(e,i),t={from:Po(e.first,0),to:Po(t.to.line+i,t.to.ch),text:[Wi(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Po(o,Qn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Jn(e,t.from,t.to),r||(r=wr(e,t)),e.cm?Or(e.cm,t,n):Gn(e,t,n),Me(e,r,Il)}}function Or(e,t,r){var n=e.doc,i=e.display,l=t.from,s=t.to,a=!1,c=l.line;e.options.lineWrapping||(c=ri(bn(Qn(n,l.line))),n.iter(c,s.line+1,function(e){if(e==i.maxLine)return a=!0,!0})),n.sel.contains(t.from,t.to)>-1&&Ti(e),Gn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(c,l.line+t.text.length,function(e){var t=h(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,l.line),Pe(e,400);var u=t.text.length-(s.line-l.line)-1;t.full?Ht(e):l.line!=s.line||1!=t.text.length||Vn(e.doc,t)?Ht(e,l.line,s.line+1,u):Et(e,l.line,"text");var f=Ai(e,"changes"),d=Ai(e,"change");if(d||f){var p={from:l,to:s,text:t.text,removed:t.removed,origin:t.origin};d&&Si(e,"change",e,p),f&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function qr(e,t,r,n,i){if(n||(n=r),Fo(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=e.splitLines(t)),Lr(e,{from:r,to:n,text:t,origin:i})}function Wr(e,t){if(!Mi(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!To){var o=$i("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-$e(e.display))+"px; height: "+(t.bottom-t.top+Ve(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function zr(e,t,r,n){null==n&&(n=0);for(var i=0;i<5;i++){var o=!1,l=pt(e,t),s=r&&r!=t?pt(e,r):l,a=Hr(e,Math.min(l.left,s.left),Math.min(l.top,s.top)-n,Math.max(l.left,s.left),Math.max(l.bottom,s.bottom)+n),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=a.scrollTop&&(ir(e,a.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=a.scrollLeft&&(or(e,a.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return l}function Dr(e,t,r,n,i){var o=Hr(e,t,r,n,i);null!=o.scrollTop&&ir(e,o.scrollTop),null!=o.scrollLeft&&or(e,o.scrollLeft)}function Hr(e,t,r,n,i){var o=e.display,l=bt(e.display);r<0&&(r=0);var s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,a=Ke(e),c={};i-r>a&&(i=r+a);var u=e.doc.height+je(o),h=r<l,f=i>u-l;if(r<s)c.scrollTop=h?0:r;else if(i>s+a){var d=Math.min(r,(f?u:i)-a);d!=s&&(c.scrollTop=d)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,g=Ge(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),m=n-t>g;return m&&(n=t+g),t<10?c.scrollLeft=0:t<p?c.scrollLeft=Math.max(0,t-(m?0:10)):n>g+p-3&&(c.scrollLeft=n+(m?0:10)-g),
c}function Er(e,t,r){null==t&&null==r||Pr(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function Ir(e){Pr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Po(t.line,t.ch-1):t,n=Po(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Pr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=gt(e,t.from),n=gt(e,t.to),i=Hr(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Fr(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Be(e,t):r="prev");var l=e.options.tabSize,s=Qn(o,t),a=Rl(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&(c=o.mode.indent(i,s.text.slice(u.length),s.text),c==El||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?Rl(Qn(o,t-1).text,null,l):0:"add"==r?c=a+e.options.indentUnit:"subtract"==r?c=a-e.options.indentUnit:"number"==typeof r&&(c=a+r),c=Math.max(0,c);var h="",f=0;if(e.options.indentWithTabs)for(var d=Math.floor(c/l);d;--d)f+=l,h+="\t";if(f<c&&(h+=qi(c-f)),h!=u)return qr(o,h,Po(t,0),Po(t,u.length),"+input"),s.stateAfter=null,!0;for(var d=0;d<o.sel.ranges.length;d++){var p=o.sel.ranges[d];if(p.head.line==t&&p.head.ch<u.length){var f=Po(t,u.length);we(o,d,new he(f,f));break}}}function Rr(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Qn(e,pe(e,t)):i=ri(t),null==i?null:(n(o,i)&&e.cm&&Et(e.cm,i,r),o)}function Br(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&Fo(o.from,Wi(n).to)<=0;){var l=n.pop();if(Fo(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}Nt(e,function(){for(var t=n.length-1;t>=0;t--)qr(e.doc,"",n[t].from,n[t].to,"+delete");Ir(e)})}function $r(e,t,r,n,i){function o(){var t=s+r;return!(t<e.first||t>=e.first+e.size)&&(s=t,u=Qn(e,t))}function l(e){var t=(i?fo:po)(u,a,r,!0);if(null==t){if(e||!o())return!1;a=i?(r<0?oo:io)(u):r<0?u.text.length:0}else a=t;return!0}var s=t.line,a=t.ch,c=r,u=Qn(e,s);if("char"==n)l();else if("column"==n)l(!0);else if("word"==n||"group"==n)for(var h=null,f="group"==n,d=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(r<0)||l(!p);p=!1){var g=u.text.charAt(a)||"\n",m=Fi(g,d)?"w":f&&"\n"==g?"n":!f||/\s/.test(g)?null:"p";if(!f||p||m||(m="s"),h&&h!=m){r<0&&(r=1,l());break}if(m&&(h=m),r>0&&!l(!p))break}var v=qe(e,Po(s,a),t,c,!0);return Fo(t,v)||(v.hitSide=!0),v}function jr(e,t,r,n){var i,o=e.doc,l=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(s-(r<0?1.5:.5)*bt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var a=vt(e,l,i);if(!a.outside)break;if(r<0?i<=0:i>=o.height){a.hitSide=!0;break}i+=5*r}return a}function Ur(t,r,n,i){e.defaults[t]=r,n&&(rl[t]=i?function(e,t,r){r!=nl&&n(e,t,r)}:n)}function Vr(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],l=0;l<o.length-1;l++){var s=o[l];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else{if(!/^s(hift)$/i.test(s))throw new Error("Unrecognized modifier name: "+s);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Gr(e){return"string"==typeof e?fl[e]:e}function Kr(e,t,r,n,i){if(n&&n.shared)return Xr(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Ot(e.cm,Kr)(e,t,r,n,i);var o=new yl(e,i),l=Fo(t,r);if(n&&Ii(n,o,!1),l>0||0==l&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=$i("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(yn(e,t.line,t,r,o)||t.line!=r.line&&yn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Io=!0}o.addToHistory&&ui(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,a=t.line,c=e.cm;if(e.iter(a,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&bn(e)==c.display.maxLine&&(s=!0),o.collapsed&&a!=t.line&&ti(e,0),rn(e,new Jr(o,a==t.line?t.ch:null,a==r.line?r.ch:null)),++a}),o.collapsed&&e.iter(t.line,r.line+1,function(t){_n(e,t)&&ti(t,0)}),o.clearOnEnter&&Ol(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Eo=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++vl,o.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),o.collapsed)Ht(c,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=r.line;u++)Et(c,u,"text");o.atomic&&Ae(c.doc),Si(c,"markerAdded",c,o)}return o}function Xr(e,t,r,n,i){n=Ii(n),n.shared=!1;var o=[Kr(e,t,r,n,i)],l=o[0],s=n.widgetNode;return Yn(e,function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(Kr(e,ge(e,t),ge(e,r),n,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;l=Wi(o)}),new bl(o,l)}function Yr(e){return e.findMarks(Po(e.first,0),e.clipPos(Po(e.lastLine())),function(e){return e.parent})}function Zr(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(Fo(o,l)){var s=Kr(e,o,l,n.primary,n.primary.type);n.markers.push(s),s.parent=n}}}function Qr(e){for(var t=0;t<e.length;t++){var r=e[t],n=[r.primary.doc];Yn(r.primary.doc,function(e){n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];zi(n,o.doc)==-1&&(o.parent=null,r.markers.splice(i--,1))}}}function Jr(e,t,r){this.marker=e,this.from=t,this.to=r}function en(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function tn(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function rn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function nn(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],l=o.marker,s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);if(s||o.from==t&&"bookmark"==l.type&&(!r||!o.marker.insertLeft)){var a=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Jr(l,o.from,a?null:o.to))}}return n}function on(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],l=o.marker,s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);if(s||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var a=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Jr(l,a?null:o.from-t,null==o.to?null:o.to-t))}}return n}function ln(e,t){if(t.full)return null;var r=ve(e,t.from.line)&&Qn(e,t.from.line).markedSpans,n=ve(e,t.to.line)&&Qn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=0==Fo(t.from,t.to),s=nn(r,i,l),a=on(n,o,l),c=1==t.text.length,u=Wi(t.text).length+(c?i:0);if(s)for(var h=0;h<s.length;++h){var f=s[h];if(null==f.to){var d=en(a,f.marker);d?c&&(f.to=null==d.to?null:d.to+u):f.to=i}}if(a)for(var h=0;h<a.length;++h){var f=a[h];if(null!=f.to&&(f.to+=u),null==f.from){var d=en(s,f.marker);d||(f.from=u,c&&(s||(s=[])).push(f))}else f.from+=u,c&&(s||(s=[])).push(f)}s&&(s=sn(s)),a&&a!=s&&(a=sn(a));var p=[s];if(!c){var g,m=t.text.length-2;if(m>0&&s)for(var h=0;h<s.length;++h)null==s[h].to&&(g||(g=[])).push(new Jr(s[h].marker,null,null));for(var h=0;h<m;++h)p.push(g);p.push(a)}return p}function sn(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function an(e,t){var r=mi(e,t),n=ln(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)e:for(var s=0;s<l.length;++s){for(var a=l[s],c=0;c<o.length;++c)if(o[c].marker==a.marker)continue e;o.push(a)}else l&&(r[i]=l)}return r}function cn(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&zi(n,r)!=-1||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var l=n[o],s=l.find(0),a=0;a<i.length;++a){var c=i[a];if(!(Fo(c.to,s.from)<0||Fo(c.from,s.to)>0)){var u=[a,1],h=Fo(c.from,s.from),f=Fo(c.to,s.to);(h<0||!l.inclusiveLeft&&!h)&&u.push({from:c.from,to:s.from}),(f>0||!l.inclusiveRight&&!f)&&u.push({from:s.to,to:c.to}),i.splice.apply(i,u),a+=u.length-1}}return i}function un(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function hn(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function fn(e){return e.inclusiveLeft?-1:0}function dn(e){return e.inclusiveRight?1:0}function pn(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=Fo(n.from,i.from)||fn(e)-fn(t);if(o)return-o;var l=Fo(n.to,i.to)||dn(e)-dn(t);return l?l:t.id-e.id}function gn(e,t){var r,n=Io&&e.markedSpans;if(n)for(var i,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!r||pn(r,i.marker)<0)&&(r=i.marker);return r}function mn(e){return gn(e,!0)}function vn(e){return gn(e,!1)}function yn(e,t,r,n,i){var o=Qn(e,t),l=Io&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var c=a.marker.find(0),u=Fo(c.from,r)||fn(a.marker)-fn(i),h=Fo(c.to,n)||dn(a.marker)-dn(i);if(!(u>=0&&h<=0||u<=0&&h>=0)&&(u<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?Fo(c.to,r)>=0:Fo(c.to,r)>0)||u>=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?Fo(c.from,n)<=0:Fo(c.from,n)<0)))return!0}}}function bn(e){for(var t;t=mn(e);)e=t.find(-1,!0).line;return e}function xn(e){for(var t,r;t=vn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function kn(e,t){var r=Qn(e,t),n=bn(r);return r==n?t:ri(n)}function wn(e,t){if(t>e.lastLine())return t;var r,n=Qn(e,t);if(!_n(e,n))return t;for(;r=vn(n);)n=r.find(1,!0).line;return ri(n)+1}function _n(e,t){var r=Io&&t.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Cn(e,t,n))return!0}}function Cn(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Cn(e,n.line,en(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Cn(e,t,i))return!0}function Sn(e,t,r){ii(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Er(e,null,r)}function Ln(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Xl(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),Ui(t.display.measure,$i("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Mn(e,t,r,n){var i=new xl(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),Rr(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!_n(e,t)){var n=ii(t)<e.scrollTop;ti(t,t.height+Ln(i)),n&&Er(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),i}function Tn(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),un(e),hn(e,r);var i=n?n(e):1;i!=e.height&&ti(e,i)}function An(e){e.parent=null,un(e)}function Nn(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function On(t,r){if(t.blankLine)return t.blankLine(r);if(t.innerMode){var n=e.innerMode(t,r);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function qn(t,r,n,i){for(var o=0;o<10;o++){i&&(i[0]=e.innerMode(t,n).mode);var l=t.token(r,n);if(r.pos>r.start)return l}throw new Error("Mode "+t.name+" failed to advance stream.")}function Wn(e,t,r,n){function i(e){return{start:h.start,end:h.pos,string:h.current(),type:o||null,state:e?cl(l.mode,u):u}}var o,l=e.doc,s=l.mode;t=ge(l,t);var a,c=Qn(l,t.line),u=Be(e,t.line,r),h=new ml(c.text,e.options.tabSize);for(n&&(a=[]);(n||h.pos<t.ch)&&!h.eol();)h.start=h.pos,o=qn(s,h,u),n&&a.push(i(!0));return n?a:i()}function zn(e,t,r,n,i,o,l){var s=r.flattenSpans;null==s&&(s=e.options.flattenSpans);var a,c=0,u=null,h=new ml(t,e.options.tabSize),f=e.options.addModeClass&&[null];for(""==t&&Nn(On(r,n),o);!h.eol();){if(h.pos>e.options.maxHighlightLength?(s=!1,l&&En(e,t,n,h.pos),h.pos=t.length,a=null):a=Nn(qn(r,h,n,f),o),f){var d=f[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||u!=a){for(;c<h.start;)c=Math.min(h.start,c+5e4),i(c,u);u=a}h.start=h.pos}for(;c<h.pos;){var p=Math.min(h.pos,c+5e4);i(p,u),c=p}}function Dn(e,t,r,n){var i=[e.state.modeGen],o={};zn(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},o,n);for(var l=0;l<e.state.overlays.length;++l){var s=e.state.overlays[l],a=1,c=0;zn(e,t.text,s.mode,!0,function(e,t){for(var r=a;c<e;){var n=i[a];n>e&&i.splice(a,1,e,i[a+1],n),a+=2,c=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,a-r,e,"cm-overlay "+t),a=r+2;else for(;r<a;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Hn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Be(e,ri(t)),i=Dn(e,t,t.text.length>e.options.maxHighlightLength?cl(e.doc.mode,n):n);t.stateAfter=n,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function En(e,t,r,n){var i=e.doc.mode,o=new ml(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&On(i,r);!o.eol();)qn(i,o,r),o.start=o.pos}function In(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?_l:wl;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Pn(e,t){var r=$i("span",null,null,wo?"padding-right: .1px":null),n={pre:$i("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(xo||wo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,l=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=Rn,Ji(e.display.measure)&&(o=oi(l))&&(n.addToken=$n(n.addToken,o)),n.map=[];var s=t!=e.display.externalMeasured&&ri(l);Un(l,n,Hn(e,l,s)),l.styleClasses&&(l.styleClasses.bgClass&&(n.bgClass=Ki(l.styleClasses.bgClass,n.bgClass||"")),l.styleClasses.textClass&&(n.textClass=Ki(l.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Qi(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(wo){var a=n.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return zl(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Ki(n.pre.className,n.textClass||"")),n}function Fn(e){var t=$i("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Rn(e,t,r,n,i,o,l){if(t){var s=e.splitSpaces?Bn(t,e.trailingSpace):t,a=e.cm.state.specialChars,c=!1;if(a.test(t))for(var u=document.createDocumentFragment(),h=0;;){a.lastIndex=h;var f=a.exec(t),d=f?f.index-h:t.length-h;if(d){var p=document.createTextNode(s.slice(h,h+d));xo&&ko<9?u.appendChild($i("span",[p])):u.appendChild(p),e.map.push(e.pos,e.pos+d,p),e.col+=d,e.pos+=d}if(!f)break;if(h+=d+1,"\t"==f[0]){var g=e.cm.options.tabSize,m=g-e.col%g,p=u.appendChild($i("span",qi(m),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text","\t"),e.col+=m}else if("\r"==f[0]||"\n"==f[0]){var p=u.appendChild($i("span","\r"==f[0]?"␍":"␤","cm-invalidchar"));p.setAttribute("cm-text",f[0]),e.col+=1}else{var p=e.cm.options.specialCharPlaceholder(f[0]);p.setAttribute("cm-text",f[0]),xo&&ko<9?u.appendChild($i("span",[p])):u.appendChild(p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var u=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,u),xo&&ko<9&&(c=!0),e.pos+=t.length}if(e.trailingSpace=32==s.charCodeAt(t.length-1),r||n||i||c||l){var v=r||"";n&&(v+=n),i&&(v+=i);var y=$i("span",[u],v,l);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Bn(e,t){if(e.length>1&&!/  /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}function $n(e,t){return function(r,n,i,o,l,s,a){i=i?i+" cm-force-border":"cm-force-border";for(var c=r.pos,u=c+n.length;;){for(var h=0;h<t.length;h++){var f=t[h];if(f.to>c&&f.from<=c)break}if(f.to>=u)return e(r,n,i,o,l,s,a);e(r,n.slice(0,f.to-c),i,o,null,s,a),o=null,n=n.slice(f.to-c),c=f.to}}}function jn(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Un(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,c,u,h,f,d=i.length,p=0,g=1,m="",v=0;;){if(v==p){a=c=u=h=s="",f=null,v=1/0;for(var y,b=[],x=0;x<n.length;++x){var k=n[x],w=k.marker;"bookmark"==w.type&&k.from==p&&w.widgetNode?b.push(w):k.from<=p&&(null==k.to||k.to>p||w.collapsed&&k.to==p&&k.from==p)?(null!=k.to&&k.to!=p&&v>k.to&&(v=k.to,c=""),w.className&&(a+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&k.from==p&&(u+=" "+w.startStyle),w.endStyle&&k.to==v&&(y||(y=[])).push(w.endStyle,k.to),w.title&&!h&&(h=w.title),w.collapsed&&(!f||pn(f.marker,w)<0)&&(f=k)):k.from>p&&v>k.from&&(v=k.from)}if(y)for(var x=0;x<y.length;x+=2)y[x+1]==v&&(c+=" "+y[x]);if(!f||f.from==p)for(var x=0;x<b.length;++x)jn(t,0,b[x]);if(f&&(f.from||0)==p){if(jn(t,(null==f.to?d+1:f.to)-p,f.marker,null==f.from),null==f.to)return;f.to==p&&(f=!1)}}if(p>=d)break;for(var _=Math.min(d,v);;){if(m){var C=p+m.length;if(!f){var S=C>_?m.slice(0,_-p):m;t.addToken(t,S,l?l+a:a,u,p+S.length==v?c:"",h,s)}if(C>=_){m=m.slice(_-p),p=_;break}p=C,u=""}m=i.slice(o,o=r[g++]),l=In(r[g++],t.cm.options)}}else for(var g=1;g<r.length;g+=2)t.addToken(t,i.slice(o,o=r[g]),In(r[g+1],t.cm.options))}function Vn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Wi(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Gn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){Tn(e,r,i,n),Si(e,"change",e,t)}function l(e,t){for(var r=e,o=[];r<t;++r)o.push(new kl(c[r],i(r),n));return o}var s=t.from,a=t.to,c=t.text,u=Qn(e,s.line),h=Qn(e,a.line),f=Wi(c),d=i(c.length-1),p=a.line-s.line;if(t.full)e.insert(0,l(0,c.length)),e.remove(c.length,e.size-c.length);else if(Vn(e,t)){var g=l(0,c.length-1);o(h,h.text,d),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(u==h)if(1==c.length)o(u,u.text.slice(0,s.ch)+f+u.text.slice(a.ch),d);else{var g=l(1,c.length-1);g.push(new kl(f+u.text.slice(a.ch),d,n)),o(u,u.text.slice(0,s.ch)+c[0],i(0)),e.insert(s.line+1,g)}else if(1==c.length)o(u,u.text.slice(0,s.ch)+c[0]+h.text.slice(a.ch),i(0)),e.remove(s.line+1,p);else{o(u,u.text.slice(0,s.ch)+c[0],i(0)),o(h,f+h.text.slice(a.ch),d);var g=l(1,c.length-1);p>1&&e.remove(s.line+1,p-1),e.insert(s.line+1,g)}Si(e,"change",e,t)}function Kn(e){this.lines=e,this.parent=null;for(var t=0,r=0;t<e.length;++t)e[t].parent=this,r+=e[t].height;this.height=r}function Xn(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}function Yn(e,t,r){function n(e,i,o){if(e.linked)for(var l=0;l<e.linked.length;++l){var s=e.linked[l];if(s.doc!=i){var a=o&&s.sharedHist;r&&!a||(t(s.doc,a),n(s.doc,e,a))}}}n(e,null,!0)}function Zn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,l(e),r(e),e.options.lineWrapping||f(e),e.options.mode=t.modeOption,Ht(e)}function Qn(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function Jn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function ei(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ti(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function ri(e){if(null==e.parent)return null;for(var t=e.parent,r=zi(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function ni(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;n<e.lines.length;++n){var l=e.lines[n],s=l.height;if(t<s)break;t-=s}return r+n}function ii(e){e=bn(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var n=0;n<o.children.length;++n){var l=o.children[n];if(l==r)break;t+=l.height}return t}function oi(e){var t=e.order;return null==t&&(t=e.order=as(e.text)),t}function li(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function si(e,t){var r={from:G(t.from),to:el(t),text:Jn(e,t.from,t.to)};return pi(e,r,t.from.line,t.to.line+1),Yn(e,function(e){pi(e,r,t.from.line,t.to.line+1)},!0),r}function ai(e){for(;e.length;){var t=Wi(e);if(!t.ranges)break;e.pop()}}function ci(e,t){return t?(ai(e.done),Wi(e.done)):e.done.length&&!Wi(e.done).ranges?Wi(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Wi(e.done)):void 0}function ui(e,t,r,n){var i=e.history;i.undone.length=0;var o,l=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>l-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ci(i,i.lastOp==n))){var s=Wi(o.changes);0==Fo(t.from,t.to)&&0==Fo(t.from,s.to)?s.to=el(t):o.changes.push(si(e,t))}else{var a=Wi(i.done);for(a&&a.ranges||di(e.sel,i.done),o={changes:[si(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,s||zl(e,"historyAdded")}function hi(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function fi(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||hi(e,o,Wi(i.done),t))?i.done[i.done.length-1]=t:di(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&ai(i.undone)}function di(e,t){var r=Wi(t);r&&r.ranges&&r.equals(e)||t.push(e)}function pi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function gi(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function mi(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(gi(r[n]));return i}function vi(e,t,r){for(var n=0,i=[];n<e.length;++n){var o=e[n];if(o.ranges)i.push(r?ue.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];i.push({changes:s});for(var a=0;a<l.length;++a){var c,u=l[a];if(s.push({from:u.from,to:u.to,text:u.text}),t)for(var h in u)(c=h.match(/^spans_(\d+)$/))&&zi(t,Number(c[1]))>-1&&(Wi(s)[h]=u[h],delete u[h])}}}return i}function yi(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function bi(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var s=0;s<o.ranges.length;s++)yi(o.ranges[s].anchor,t,r,n),yi(o.ranges[s].head,t,r,n)}else{for(var s=0;s<o.changes.length;++s){var a=o.changes[s];if(r<a.from.line)a.from=Po(a.from.line+n,a.from.ch),a.to=Po(a.to.line+n,a.to.ch);else if(t<=a.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function xi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;bi(e.done,r,n,i),bi(e.undone,r,n,i)}function ki(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function wi(e){return e.target||e.srcElement}function _i(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Oo&&e.ctrlKey&&1==t&&(t=3),t}function Ci(e,t,r){var n=e._handlers&&e._handlers[t];return r?n&&n.length>0?n.slice():ql:n||ql}function Si(e,t){function r(e){return function(){e.apply(null,o)}}var n=Ci(e,t,!1);if(n.length){var i,o=Array.prototype.slice.call(arguments,2);Vo?i=Vo.delayedCallbacks:Dl?i=Dl:(i=Dl=[],setTimeout(Li,0));for(var l=0;l<n.length;++l)i.push(r(n[l]))}}function Li(){var e=Dl;Dl=null;for(var t=0;t<e.length;++t)e[t]()}function Mi(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),zl(e,r||t.type,e,t),ki(t)||t.codemirrorIgnore}function Ti(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)zi(r,t[n])==-1&&r.push(t[n])}function Ai(e,t){return Ci(e,t).length>0}function Ni(e){e.prototype.on=function(e,t){Ol(this,e,t)},e.prototype.off=function(e,t){Wl(this,e,t)}}function Oi(){this.id=null}function qi(e){for(;$l.length<=e;)$l.push(Wi($l)+" ");return $l[e]}function Wi(e){return e[e.length-1]}function zi(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function Di(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Hi(){}function Ei(e,t){var r;return Object.create?r=Object.create(e):(Hi.prototype=e,r=new Hi),t&&Ii(t,r),r}function Ii(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||r===!1&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function Pi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Fi(e,t){return t?!!(t.source.indexOf("\\w")>-1&&Gl(e))||t.test(e):Gl(e)}function Ri(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Bi(e){return e.charCodeAt(0)>=768&&Kl.test(e)}function $i(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function ji(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Ui(e,t){return ji(e).appendChild(t)}function Vi(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function Gi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Ki(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!Gi(r[n]).test(t)&&(t+=" "+r[n]);return t}function Xi(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}function Yi(){es||(Zi(),es=!0)}function Zi(){var e;Ol(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Xi(Ut)},100))}),Ol(window,"blur",function(){Xi(yr)})}function Qi(e){if(null==Yl){var t=$i("span","​");Ui(e,$i("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Yl=t.offsetWidth<=1&&t.offsetHeight>2&&!(xo&&ko<8))}var r=Yl?$i("span","​"):$i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Ji(e){if(null!=Zl)return Zl;var t=Ui(e,document.createTextNode("AخA")),r=Ul(t,0,1).getBoundingClientRect(),n=Ul(t,1,2).getBoundingClientRect();return ji(e),!(!r||r.left==r.right)&&(Zl=n.right-r.right<3)}function eo(e){if(null!=os)return os;var t=Ui(e,$i("span","x")),r=t.getBoundingClientRect(),n=Ul(t,0,1).getBoundingClientRect();return os=Math.abs(r.left-n.left)>1}function to(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<r&&l.to>t||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function ro(e){return e.level%2?e.to:e.from}function no(e){return e.level%2?e.from:e.to}function io(e){var t=oi(e);return t?ro(t[0]):0}function oo(e){var t=oi(e);return t?no(Wi(t)):e.text.length}function lo(e,t){var r=Qn(e.doc,t),n=bn(r);n!=r&&(t=ri(n));var i=oi(n),o=i?i[0].level%2?oo(n):io(n):0;return Po(t,o)}function so(e,t){for(var r,n=Qn(e.doc,t);r=vn(n);)n=r.find(1,!0).line,t=null;var i=oi(n),o=i?i[0].level%2?io(n):oo(n):n.text.length;return Po(null==t?ri(n):t,o)}function ao(e,t){var r=lo(e,t.line),n=Qn(e.doc,r.line),i=oi(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return Po(r.line,l?0:o)}return r}function co(e,t,r){var n=e[0].level;return t==n||r!=n&&t<r}function uo(e,t){ss=null;for(var r,n=0;n<e.length;++n){var i=e[n];if(i.from<t&&i.to>t)return n;if(i.from==t||i.to==t){if(null!=r)return co(e,i.level,e[r].level)?(i.from!=i.to&&(ss=r),n):(i.from!=i.to&&(ss=n),r);r=n}}return r}function ho(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Bi(e.text.charAt(t)));return t}function fo(e,t,r,n){var i=oi(e);if(!i)return po(e,t,r,n);for(var o=uo(i,t),l=i[o],s=ho(e,t,l.level%2?-r:r,n);;){if(s>l.from&&s<l.to)return s;if(s==l.from||s==l.to)return uo(i,s)==o?s:(l=i[o+=r],r>0==l.level%2?l.to:l.from);if(l=i[o+=r],!l)return null;s=r>0==l.level%2?ho(e,l.to,-1,n):ho(e,l.from,1,n)}}function po(e,t,r,n){var i=t+r;if(n)for(;i>0&&Bi(e.text.charAt(i));)i+=r;return i<0||i>e.text.length?null:i}var go=navigator.userAgent,mo=navigator.platform,vo=/gecko\/\d/i.test(go),yo=/MSIE \d/.test(go),bo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(go),xo=yo||bo,ko=xo&&(yo?document.documentMode||6:bo[1]),wo=/WebKit\//.test(go),_o=wo&&/Qt\/\d+\.\d+/.test(go),Co=/Chrome\//.test(go),So=/Opera\//.test(go),Lo=/Apple Computer/.test(navigator.vendor),Mo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(go),To=/PhantomJS/.test(go),Ao=/AppleWebKit/.test(go)&&/Mobile\/\w+/.test(go),No=Ao||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(go),Oo=Ao||/Mac/.test(mo),qo=/\bCrOS\b/.test(go),Wo=/win/i.test(mo),zo=So&&go.match(/Version\/(\d*\.\d*)/);zo&&(zo=Number(zo[1])),zo&&zo>=15&&(So=!1,wo=!0);var Do=Oo&&(_o||So&&(null==zo||zo<12.11)),Ho=vo||xo&&ko>=9,Eo=!1,Io=!1;g.prototype=Ii({update:function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var e=Oo&&!Mo?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",
this.disableHoriz=new Oi,this.disableVert=new Oi},enableZeroWidthBar:function(e,t){function r(){var n=e.getBoundingClientRect(),i=document.elementFromPoint(n.left+1,n.bottom-1);i!=e?e.style.pointerEvents="none":t.set(1e3,r)}e.style.pointerEvents="auto",t.set(1e3,r)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},g.prototype),m.prototype=Ii({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},m.prototype),e.scrollbarModel={"native":g,"null":m},S.prototype.signal=function(e,t){Ai(e,t)&&this.events.push(arguments)},S.prototype.finish=function(){for(var e=0;e<this.events.length;e++)zl.apply(null,this.events[e])};var Po=e.Pos=function(e,t){return this instanceof Po?(this.line=e,void(this.ch=t)):new Po(e,t)},Fo=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Ro=null;re.prototype=Ii({init:function(e){function t(e){if(!Mi(n,e)){if(n.somethingSelected())Ro={lineWise:!1,text:n.getSelections()},r.inaccurateSelection&&(r.prevInput="",r.inaccurateSelection=!1,o.value=Ro.text.join("\n"),jl(o));else{if(!n.options.lineWiseCopyCut)return;var t=ee(n);Ro={lineWise:!0,text:t.text},"cut"==e.type?n.setSelections(t.ranges,null,Il):(r.prevInput="",o.value=t.text.join("\n"),jl(o))}"cut"==e.type&&(n.state.cutIncoming=!0)}}var r=this,n=this.cm,i=this.wrapper=ne(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),Ao&&(o.style.width="0px"),Ol(o,"input",function(){xo&&ko>=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),Ol(o,"paste",function(e){Mi(n,e)||Q(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),Ol(o,"cut",t),Ol(o,"copy",t),Ol(e.scroller,"paste",function(t){Vt(e,t)||Mi(n,t)||(n.state.pasteIncoming=!0,r.focus())}),Ol(e.lineSpace,"selectstart",function(t){Vt(e,t)||Tl(t)}),Ol(o,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Ol(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,r=e.doc,n=De(e);if(e.options.moveInputWithCursor){var i=pt(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},showSelection:function(e){var t=this.cm,r=t.display;Ui(r.cursorDiv,e.cursors),Ui(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,r,n=this.cm,i=n.doc;if(n.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=is&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var l=t?"-":r||n.getSelection();this.textarea.value=l,n.state.focused&&jl(this.textarea),xo&&ko>=9&&(this.hasSelection=l)}else e||(this.prevInput=this.textarea.value="",xo&&ko>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!No||Vi()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var n=r.poll();n||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))}var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,r=this.prevInput;if(this.contextMenuPending||!e.state.focused||ns(t)&&!r&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var n=t.value;if(n==r&&!e.somethingSelected())return!1;if(xo&&ko>=9&&this.hasSelection===n||Oo&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=n.charCodeAt(0);if(8203!=i||r||(r="​"),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,l=Math.min(r.length,n.length);o<l&&r.charCodeAt(o)==n.charCodeAt(o);)++o;var s=this;return Nt(e,function(){Z(e,n.slice(o),r.length-o,null,s.composing?"*compose":null),n.length>1e3||n.indexOf("\n")>-1?t.value=s.prevInput="":s.prevInput=n,s.composing&&(s.composing.range.clear(),s.composing.range=e.markText(s.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){xo&&ko>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=l.selectionStart){var e=i.somethingSelected(),t="​"+(e?l.value:"");l.value="⇚",l.value=t,n.prevInput=e?"":"​",l.selectionStart=1,l.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.cssText=h,l.style.cssText=u,xo&&ko<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=a),null!=l.selectionStart){(!xo||xo&&ko<9)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==l.selectionStart&&l.selectionEnd>0&&"​"==n.prevInput?Ot(i,hl.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(r,500):o.input.reset()};o.detectingSelectAll=setTimeout(r,200)}}var n=this,i=n.cm,o=i.display,l=n.textarea,s=Gt(i,e),a=o.scroller.scrollTop;if(s&&!So){var c=i.options.resetSelectionOnContextMenu;c&&i.doc.sel.contains(s)==-1&&Ot(i,Le)(i.doc,de(s),Il);var u=l.style.cssText,h=n.wrapper.style.cssText;n.wrapper.style.cssText="position: absolute";var f=n.wrapper.getBoundingClientRect();if(l.style.cssText="position: absolute; width: 30px; height: 30px; top: "+(e.clientY-f.top-5)+"px; left: "+(e.clientX-f.left-5)+"px; z-index: 1000; background: "+(xo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",wo)var d=window.scrollY;if(o.input.focus(),wo&&window.scrollTo(null,d),o.input.reset(),i.somethingSelected()||(l.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),xo&&ko>=9&&t(),Ho){Nl(e);var p=function(){Wl(window,"mouseup",p),setTimeout(r,20)};Ol(window,"mouseup",p)}else setTimeout(r,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Hi,needsContentAttribute:!1},re.prototype),ie.prototype=Ii({init:function(e){function t(e){if(!Mi(n,e)){if(n.somethingSelected())Ro={lineWise:!1,text:n.getSelections()},"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=ee(n);Ro={lineWise:!0,text:t.text},"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Il),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!Ao)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Ro.text.join("\n"));else{var r=ne(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Ro.text.join("\n");var o=document.activeElement;jl(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}}var r=this,n=r.cm,i=r.div=e.lineDiv;te(i),Ol(i,"paste",function(e){Mi(n,e)||Q(e,n)}),Ol(i,"compositionstart",function(e){var t=e.data;if(r.composing={sel:n.doc.sel,data:t,startData:t},t){var i=n.doc.sel.primary(),o=n.getLine(i.head.line),l=o.indexOf(t,Math.max(0,i.head.ch-t.length));l>-1&&l<=i.head.ch&&(r.composing.sel=de(Po(i.head.line,l),Po(i.head.line,l+t.length)))}}),Ol(i,"compositionupdate",function(e){r.composing.data=e.data}),Ol(i,"compositionend",function(e){var t=r.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||r.applyComposition(t),r.composing==t&&(r.composing=null)},50))}),Ol(i,"touchstart",function(){r.forceCompositionEnd()}),Ol(i,"input",function(){r.composing||!n.isReadOnly()&&r.pollContent()||Nt(r.cm,function(){Ht(n)})}),Ol(i,"copy",t),Ol(i,"cut",t)},prepareSelection:function(){var e=De(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),r=se(this.cm,e.anchorNode,e.anchorOffset),n=se(this.cm,e.focusNode,e.focusOffset);if(!r||r.bad||!n||n.bad||0!=Fo(X(r,n),t.from())||0!=Fo(K(r,n),t.to())){var i=oe(this.cm,t.from()),o=oe(this.cm,t.to());if(i||o){var l=this.cm.display.view,s=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var a=l[l.length-1].measure,c=a.maps?a.maps[a.maps.length-1]:a.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:l[0].measure.map[2],offset:0};try{var u=Ul(i.node,i.offset,o.offset,o.node)}catch(h){}u&&(!vo&&this.cm.state.focused?(e.collapse(i.node,i.offset),u.collapsed||e.addRange(u)):(e.removeAllRanges(),e.addRange(u)),s&&null==e.anchorNode?e.addRange(s):vo&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Ui(this.cm.display.cursorDiv,e.cursors),Ui(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Xl(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Nt(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var r=se(t,e.anchorNode,e.anchorOffset),n=se(t,e.focusNode,e.focusOffset);r&&n&&Nt(t,function(){Le(t.doc,de(r,n),Il),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(n.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o;if(n.line==t.viewFrom||0==(o=Pt(e,n.line)))var l=ri(t.view[0].line),s=t.view[0].node;else var l=ri(t.view[o].line),s=t.view[o-1].node.nextSibling;var a=Pt(e,i.line);if(a==t.view.length-1)var c=t.viewTo-1,u=t.lineDiv.lastChild;else var c=ri(t.view[a+1].line)-1,u=t.view[a+1].node.previousSibling;for(var h=e.doc.splitLines(ce(e,s,u,l,c)),f=Jn(e.doc,Po(l,0),Po(c,Qn(e.doc,c).text.length));h.length>1&&f.length>1;)if(Wi(h)==Wi(f))h.pop(),f.pop(),c--;else{if(h[0]!=f[0])break;h.shift(),f.shift(),l++}for(var d=0,p=0,g=h[0],m=f[0],v=Math.min(g.length,m.length);d<v&&g.charCodeAt(d)==m.charCodeAt(d);)++d;for(var y=Wi(h),b=Wi(f),x=Math.min(y.length-(1==h.length?d:0),b.length-(1==f.length?d:0));p<x&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;h[h.length-1]=y.slice(0,y.length-p),h[0]=h[0].slice(d);var k=Po(l,d),w=Po(c,f.length?Wi(f).length-p:0);return h.length>1||h[0]||Fo(k,w)?(qr(e.doc,h,k,w,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){this.cm.isReadOnly()?Ot(this.cm,Ht)(this.cm):e.data&&e.data!=e.startData&&Ot(this.cm,Z)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),this.cm.isReadOnly()||Ot(this.cm,Z)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Hi,resetPosition:Hi,needsContentAttribute:!0},ie.prototype),e.inputStyles={textarea:re,contenteditable:ie},ue.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(0!=Fo(r.anchor,n.anchor)||0!=Fo(r.head,n.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new he(G(this.ranges[t].anchor),G(this.ranges[t].head));return new ue(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(Fo(t,n.from())>=0&&Fo(e,n.to())<=0)return r}return-1}},he.prototype={from:function(){return X(this.anchor,this.head)},to:function(){return K(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Bo,$o,jo,Uo={left:0,right:0,top:0,bottom:0},Vo=null,Go=0,Ko=0,Xo=0,Yo=null;xo?Yo=-.53:vo?Yo=15:Co?Yo=-.7:Lo&&(Yo=-1/3);var Zo=function(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}};e.wheelEventPixels=function(e){var t=Zo(e);return t.x*=Yo,t.y*=Yo,t};var Qo=new Oi,Jo=null,el=e.changeEnd=function(e){return e.text?Po(e.from.line+e.text.length-1,Wi(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];r[e]==t&&"mode"!=e||(r[e]=t,rl.hasOwnProperty(e)&&Ot(this,rl[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Gr(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:qt(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:t,opaque:r&&r.opaque}),this.state.modeGen++,Ht(this)}),removeOverlay:qt(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void Ht(this)}}),indentLine:qt(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),ve(this.doc,e)&&Fr(this,e,t,r)}),indentSelection:qt(function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(Fr(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Ir(this));else{var o=i.from(),l=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var a=s;a<r;++a)Fr(this,a,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[n].from().ch>0&&we(this.doc,n,new he(o,c[n].to()),Il)}}}),getTokenAt:function(e,t){return Wn(this,e,t)},getLineTokens:function(e,t){return Wn(this,Po(e),t,!0)},getTokenTypeAt:function(e){e=ge(this.doc,e);var t,r=Hn(this,Qn(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]<o)){t=r[2*l+2];break}n=l+1}}var s=t?t.indexOf("cm-overlay "):-1;return s<0?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!al.hasOwnProperty(t))return r;var n=al[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var l=n[i[t][o]];l&&r.push(l)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var o=0;o<n._global.length;o++){var s=n._global[o];s.pred(i,this)&&zi(r,s.val)==-1&&r.push(s.val)}return r},getStateAfter:function(e,t){var r=this.doc;return e=pe(r,null==e?r.first+r.size-1:e),Be(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?ge(this.doc,e):e?n.from():n.to(),pt(this,r,t||"page")},charCoords:function(e,t){return dt(this,ge(this.doc,e),t||"page")},coordsChar:function(e,t){return e=ft(this,e,t||"page"),vt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=ft(this,{top:e,left:0},t||"page").top,ni(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r,n=!1;if("number"==typeof e){var i=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>i&&(e=i,n=!0),r=Qn(this.doc,e)}else r=e;return ht(this,r,{top:0,left:0},t||"page").top+(n?this.doc.height-ii(r):0)},defaultTextHeight:function(){return bt(this.display)},defaultCharWidth:function(){return xt(this.display)},setGutterMarker:qt(function(e,t,r){return Rr(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&Ri(n)&&(e.gutterMarkers=null),!0})}),clearGutter:qt(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,Et(t,n,"gutter"),Ri(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),lineInfo:function(e){if("number"==typeof e){if(!ve(this.doc,e))return null;var t=e;if(e=Qn(this.doc,e),!e)return null}else{var t=ri(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=pt(this,ge(this.doc,e));var l=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)l=e.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||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(l=e.bottom),s+t.offsetWidth>c&&(s=c-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),r&&Dr(this,s,l,s+t.offsetWidth,l+t.offsetHeight)},triggerOnKeyDown:qt(fr),triggerOnKeyPress:qt(gr),triggerOnKeyUp:pr,execCommand:function(e){if(hl.hasOwnProperty(e))return hl[e].call(null,this)},triggerElectric:qt(function(e){J(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=0,l=ge(this.doc,e);o<t&&(l=$r(this.doc,l,i,r,n),!l.hitSide);++o);return l},moveH:qt(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?$r(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()},Fl)}),deleteH:qt(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Br(this,function(r){var i=$r(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var l=0,s=ge(this.doc,e);l<t;++l){var a=pt(this,s,"div");if(null==o?o=a.left:a.left=o,s=jr(this,a,i,r),s.hitSide)break}return s},moveV:qt(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(l){if(o)return e<0?l.from():l.to();var s=pt(r,l.head,"div");null!=l.goalColumn&&(s.left=l.goalColumn),i.push(s.left);var a=jr(r,s,e,t);return"page"==t&&l==n.sel.primary()&&Er(r,null,dt(r,a,"div").top-s.top),a},Fl),i.length)for(var l=0;l<n.sel.ranges.length;l++)n.sel.ranges[l].goalColumn=i[l]}),findWordAt:function(e){var t=this.doc,r=Qn(t,e.line).text,n=e.ch,i=e.ch;if(r){var o=this.getHelper(e,"wordChars");(e.xRel<0||i==r.length)&&n?--n:++i;for(var l=r.charAt(n),s=Fi(l,o)?function(e){return Fi(e,o)}:/\s/.test(l)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Fi(e)};n>0&&s(r.charAt(n-1));)--n;for(;i<r.length&&s(r.charAt(i));)++i}return new he(Po(e.line,n),Po(e.line,i))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?Jl(this.display.cursorDiv,"CodeMirror-overwrite"):Ql(this.display.cursorDiv,"CodeMirror-overwrite"),zl(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Vi()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:qt(function(e,t){null==e&&null==t||Pr(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Ve(this)-this.display.barHeight,width:e.scrollWidth-Ve(this)-this.display.barWidth,clientHeight:Ke(this),clientWidth:Ge(this)}},scrollIntoView:qt(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:Po(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)Pr(this),this.curOp.scrollToPos=e;else{var r=Hr(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(r.scrollLeft,r.scrollTop)}}),setSize:qt(function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var n=this;null!=e&&(n.display.wrapper.style.width=r(e)),null!=t&&(n.display.wrapper.style.height=r(t)),n.options.lineWrapping&&st(this);var i=n.display.viewFrom;n.doc.iter(i,n.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){Et(n,i,"widget");break}++i}),n.curOp.forceUpdate=!0,zl(n,"refresh",this)}),operation:function(e){return Nt(this,e)},refresh:qt(function(){var e=this.display.cachedTextHeight;Ht(this),this.curOp.forceUpdate=!0,at(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),u(this),(null==e||Math.abs(e-bt(this.display))>.5)&&l(this),zl(this,"refresh",this)}),swapDoc:qt(function(e){var t=this.doc;return t.cm=null,Zn(this,e),at(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Si(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ni(e);var tl=e.defaults={},rl=e.optionHandlers={},nl=e.Init={toString:function(){return"CodeMirror.Init"}};Ur("value","",function(e,t){e.setValue(t)},!0),Ur("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),Ur("indentUnit",2,r,!0),Ur("indentWithTabs",!1),Ur("smartIndent",!0),Ur("tabSize",4,function(e){n(e),at(e),Ht(e)},!0),Ur("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(o==-1)break;i=o+t.length,r.push(Po(n,o))}n++});for(var i=r.length-1;i>=0;i--)qr(e.doc,t,r[i],Po(r[i].line,r[i].ch+t.length))}}),Ur("specialChars",/[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,r,n){t.state.specialChars=new RegExp(r.source+(r.test("\t")?"":"|\t"),"g"),n!=e.Init&&t.refresh()}),Ur("specialCharPlaceholder",Fn,function(e){e.refresh()},!0),Ur("electricChars",!0),Ur("inputStyle",No?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Ur("rtlMoveVisually",!Wo),Ur("wholeLineUpdateBefore",!0),Ur("theme","default",function(e){s(e),a(e)},!0),Ur("keyMap","default",function(t,r,n){var i=Gr(r),o=n!=e.Init&&Gr(n);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Ur("extraKeys",null),Ur("lineWrapping",!1,i,!0),Ur("gutters",[],function(e){d(e.options),a(e)},!0),Ur("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?C(e.display)+"px":"0",e.refresh()},!0),Ur("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Ur("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Ur("lineNumbers",!1,function(e){d(e.options),a(e)},!0),Ur("firstLineNumber",1,a,!0),Ur("lineNumberFormatter",function(e){return e},a,!0),Ur("showCursorWhenSelecting",!1,ze,!0),Ur("resetSelectionOnContextMenu",!0),Ur("lineWiseCopyCut",!0),Ur("readOnly",!1,function(e,t){"nocursor"==t?(yr(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),Ur("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Ur("dragDrop",!0,jt),Ur("allowDropFileTypes",null),Ur("cursorBlinkRate",530),Ur("cursorScrollMargin",0),Ur("cursorHeight",1,ze,!0),Ur("singleCursorHeightPerLine",!0,ze,!0),Ur("workTime",100),Ur("workDelay",100),Ur("flattenSpans",!0,n,!0),Ur("addModeClass",!1,n,!0),Ur("pollInterval",100),Ur("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Ur("historyEventDelay",1250),Ur("viewportMargin",10,function(e){e.refresh()},!0),Ur("maxHighlightLength",1e4,n,!0),Ur("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Ur("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Ur("autofocus",null);var il=e.modes={},ol=e.mimeModes={};e.defineMode=function(t,r){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),il[t]=r},e.defineMIME=function(e,t){ol[e]=t},e.resolveMode=function(t){if("string"==typeof t&&ol.hasOwnProperty(t))t=ol[t];else if(t&&"string"==typeof t.name&&ol.hasOwnProperty(t.name)){var r=ol[t.name];"string"==typeof r&&(r={name:r}),t=Ei(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=il[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(ll.hasOwnProperty(r.name)){var o=ll[r.name];for(var l in o)o.hasOwnProperty(l)&&(i.hasOwnProperty(l)&&(i["_"+l]=i[l]),i[l]=o[l])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var l in r.modeProps)i[l]=r.modeProps[l];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var ll=e.modeExtensions={};e.extendMode=function(e,t){var r=ll.hasOwnProperty(e)?ll[e]:ll[e]={};Ii(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){Sl.prototype[e]=t},e.defineOption=Ur;var sl=[];e.defineInitHook=function(e){sl.push(e)};var al=e.helpers={};e.registerHelper=function(t,r,n){al.hasOwnProperty(t)||(al[t]=e[t]={_global:[]}),al[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),al[t]._global.push({pred:n,val:i})};var cl=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},ul=e.startState=function(e,t,r){return!e.startState||e.startState(t,r)};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var hl=e.commands={selectAll:function(e){e.setSelection(Po(e.firstLine(),0),Po(e.lastLine()),Il)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Il)},killLine:function(e){Br(e,function(t){if(t.empty()){var r=Qn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:Po(t.head.line+1,0)}:{from:t.head,to:Po(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){Br(e,function(t){return{from:Po(t.from().line,0),to:ge(e.doc,Po(t.to().line+1,0))}})},delLineLeft:function(e){Br(e,function(e){return{from:Po(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){Br(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){Br(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(Po(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Po(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return lo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return ao(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return so(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},Fl)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},Fl)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?ao(e,t.head):n},Fl)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),l=Rl(e.getLine(o.line),o.ch,n);t.push(qi(n-l%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){Nt(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){var i=t[n].head,o=Qn(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new Po(i.line,i.ch-1)),i.ch>0)i=new Po(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Po(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=Qn(e.doc,i.line-1).text;l&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),Po(i.line-1,l.length-1),Po(i.line,1),"+transpose");
}r.push(new he(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){Nt(e,function(){for(var t=e.listSelections().length,r=0;r<t;r++){var n=e.listSelections()[r];e.replaceRange(e.doc.lineSeparator(),n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0)}Ir(e)})},openLine:function(e){e.replaceSelection("\n","start")},toggleOverwrite:function(e){e.toggleOverwrite()}},fl=e.keyMap={};fl.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},fl.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},fl.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},fl.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},fl["default"]=Oo?fl.macDefault:fl.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=Di(r.split(" "),Vr),o=0;o<i.length;o++){var l,s;o==i.length-1?(s=i.join(" "),l=n):(s=i.slice(0,o+1).join(" "),l="...");var a=t[s];if(a){if(a!=l)throw new Error("Inconsistent bindings for "+s)}else t[s]=l}delete e[r]}for(var c in t)e[c]=t[c];return e};var dl=e.lookupKey=function(e,t,r,n){t=Gr(t);var i=t.call?t.call(e,n):t[e];if(i===!1)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return dl(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var l=dl(e,t.fallthrough[o],r,n);if(l)return l}}},pl=e.isModifierKey=function(e){var t="string"==typeof e?e:ls[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},gl=e.keyName=function(e,t){if(So&&34==e.keyCode&&e["char"])return!1;var r=ls[e.keyCode],n=r;return null!=n&&!e.altGraphKey&&(e.altKey&&"Alt"!=r&&(n="Alt-"+n),(Do?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(n="Ctrl-"+n),(Do?e.ctrlKey:e.metaKey)&&"Cmd"!=r&&(n="Cmd-"+n),!t&&e.shiftKey&&"Shift"!=r&&(n="Shift-"+n),n)};e.fromTextArea=function(t,r){function n(){t.value=c.getValue()}if(r=r?Ii(r):{},r.value=t.value,!r.tabindex&&t.tabIndex&&(r.tabindex=t.tabIndex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus){var i=Vi();r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Ol(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var o=t.form,l=o.submit;try{var s=o.submit=function(){n(),o.submit=l,o.submit(),o.submit=s}}catch(a){}}r.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(Wl(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=l))}},t.style.display="none";var c=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return c};var ml=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};ml.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var r=t==e;else var r=t&&(e.test?e.test(t):e(t));if(r)return++this.pos,t},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Rl(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Rl(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Rl(this.string,null,this.tabSize)-(this.lineStart?Rl(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return t!==!1&&(this.pos+=e.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var vl=0,yl=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++vl};Ni(yl),yl.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&kt(e),Ai(this,"clear")){var r=this.find();r&&Si(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var l=this.lines[o],s=en(l.markedSpans,this);e&&!this.collapsed?Et(e,ri(l),"text"):e&&(null!=s.to&&(i=ri(l)),null!=s.from&&(n=ri(l))),l.markedSpans=tn(l.markedSpans,s),null==s.from&&this.collapsed&&!_n(this.doc,l)&&e&&ti(l,bt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var a=bn(this.lines[o]),c=h(a);c>e.display.maxLineLength&&(e.display.maxLine=a,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Ht(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ae(e.doc)),e&&Si(e,"markerCleared",e,this),t&&_t(e),this.parent&&this.parent.clear()}},yl.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var o=this.lines[i],l=en(o.markedSpans,this);if(null!=l.from&&(r=Po(t?o:ri(o),l.from),e==-1))return r;if(null!=l.to&&(n=Po(t?o:ri(o),l.to),1==e))return n}return r&&{from:r,to:n}},yl.prototype.changed=function(){var e=this.find(-1,!0),t=this,r=this.doc.cm;e&&r&&Nt(r,function(){var n=e.line,i=ri(e.line),o=Je(r,i);if(o&&(lt(o),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!_n(t.doc,n)&&null!=t.height){var l=t.height;t.height=null;var s=Ln(t)-l;s&&ti(n,n.height+s)}})},yl.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&zi(t.maybeHiddenMarkers,this)!=-1||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},yl.prototype.detachLine=function(e){if(this.lines.splice(zi(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var vl=0,bl=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};Ni(bl),bl.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Si(this,"clear")}},bl.prototype.find=function(e,t){return this.primary.find(e,t)};var xl=e.LineWidget=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};Ni(xl),xl.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=ri(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=Ln(this);ti(r,Math.max(0,r.height-o)),e&&Nt(e,function(){Sn(e,r,-o),Et(e,n,"widget")})}},xl.prototype.changed=function(){var e=this.height,t=this.doc.cm,r=this.line;this.height=null;var n=Ln(this)-e;n&&(ti(r,r.height+n),t&&Nt(t,function(){t.curOp.forceUpdate=!0,Sn(t,r,n)}))};var kl=e.Line=function(e,t,r){this.text=e,hn(this,t),this.height=r?r(this):1};Ni(kl),kl.prototype.lineNo=function(){return ri(this)};var wl={},_l={};Kn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r];this.height-=i.height,An(i),Si(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},Xn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var o=Math.min(t,i-e),l=n.height;if(n.removeInner(e,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Kn))){var s=[];this.collapse(s),this.children=[new Kn(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var l=i.lines.length%25+25,s=l;s<i.lines.length;){var a=new Kn(i.lines.slice(s,s+=25));i.height-=a.height,this.children.splice(++n,0,a),a.parent=this}i.lines=i.lines.slice(0,l),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Xn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=zi(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new Xn(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e);if(i.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var Cl=0,Sl=e.Doc=function(e,t,r,n){if(!(this instanceof Sl))return new Sl(e,t,r,n);null==r&&(r=0),Xn.call(this,[new Kn([new kl("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var i=Po(r,0);this.sel=de(i),this.history=new li(null),this.id=++Cl,this.modeOption=t,this.lineSep=n,this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Gn(this,{from:i,to:i,text:e}),Le(this,de(i),Il)};Sl.prototype=Ei(Xn.prototype,{constructor:Sl,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ei(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Wt(function(e){var t=Po(this.first,0),r=this.first+this.size-1;Lr(this,{from:t,to:Po(r,Qn(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),Le(this,de(t))}),replaceRange:function(e,t,r,n){t=ge(this,t),r=r?ge(this,r):t,qr(this,e,t,r,n)},getRange:function(e,t,r){var n=Jn(this,ge(this,e),ge(this,t));return r===!1?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(ve(this,e))return Qn(this,e)},getLineNumber:function(e){return ri(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Qn(this,e)),bn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ge(this,e)},getCursor:function(e){var t,r=this.sel.primary();return t=null==e||"head"==e?r.head:"anchor"==e?r.anchor:"end"==e||"to"==e||e===!1?r.to():r.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Wt(function(e,t,r){_e(this,ge(this,"number"==typeof e?Po(e,t||0):e),null,r)}),setSelection:Wt(function(e,t,r){_e(this,ge(this,e),ge(this,t||e),r)}),extendSelection:Wt(function(e,t,r){xe(this,ge(this,e),t&&ge(this,t),r)}),extendSelections:Wt(function(e,t){ke(this,ye(this,e),t)}),extendSelectionsBy:Wt(function(e,t){var r=Di(this.sel.ranges,e);ke(this,ye(this,r),t)}),setSelections:Wt(function(e,t,r){if(e.length){for(var n=0,i=[];n<e.length;n++)i[n]=new he(ge(this,e[n].anchor),ge(this,e[n].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Le(this,fe(i,t),r)}}),addSelection:Wt(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new he(ge(this,e),ge(this,t||e))),Le(this,fe(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=Jn(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return e===!1?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=Jn(this,r[n].from(),r[n].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Wt(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];n[o]={from:l.from(),to:l.to(),text:this.splitLines(e[o]),origin:r}}for(var s=t&&"end"!=t&&Cr(this,n,t),o=n.length-1;o>=0;o--)Lr(this,n[o]);s?Se(this,s):this.cm&&Ir(this.cm)}),undo:Wt(function(){Tr(this,"undo")}),redo:Wt(function(){Tr(this,"redo")}),undoSelection:Wt(function(){Tr(this,"undo",!0)}),redoSelection:Wt(function(){Tr(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new li(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:vi(this.history.done),undone:vi(this.history.undone)}},setHistory:function(e){var t=this.history=new li(this.history.maxGeneration);t.done=vi(e.done.slice(0),null,!0),t.undone=vi(e.undone.slice(0),null,!0)},addLineClass:Wt(function(e,t,r){return Rr(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(Gi(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:Wt(function(e,t,r){return Rr(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(Gi(r));if(!o)return!1;var l=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0})}),addLineWidget:Wt(function(e,t,r){return Mn(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Kr(this,ge(this,e),ge(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ge(this,e),Kr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=ge(this,e);var t=[],r=Qn(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=ge(this,e),t=ge(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var s=0;s<l.length;s++){var a=l[s];null!=a.to&&i==e.line&&e.ch>=a.to||null==a.from&&i!=e.line||null!=a.from&&i==t.line&&a.from>=t.ch||r&&!r(a.marker)||n.push(a.marker.parent||a.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+n;return o>e?(t=e,!0):(e-=o,void++r)}),ge(this,Po(r,t))},indexFromPos:function(e){e=ge(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+r}),t},copy:function(e){var t=new Sl(ei(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Sl(ei(this,t,r),e.mode||this.modeOption,t,this.lineSep);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Zr(n,Yr(this)),n},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=this.linked[r];if(n.doc==t){this.linked.splice(r,1),t.unlinkDoc(this),Qr(Yr(this));break}}if(t.history==this.history){var i=[t.id];Yn(t,function(e){i.push(e.id)},!0),t.history=new li(null),t.history.done=vi(this.history.done,i),t.history.undone=vi(this.history.undone,i)}},iterLinkedDocs:function(e){Yn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):rs(e)},lineSeparator:function(){return this.lineSep||"\n"}}),Sl.prototype.eachLine=Sl.prototype.iter;var Ll="iter insert remove copy getEditor constructor".split(" ");for(var Ml in Sl.prototype)Sl.prototype.hasOwnProperty(Ml)&&zi(Ll,Ml)<0&&(e.prototype[Ml]=function(e){return function(){return e.apply(this.doc,arguments)}}(Sl.prototype[Ml]));Ni(Sl);var Tl=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},Al=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},Nl=e.e_stop=function(e){Tl(e),Al(e)},Ol=e.on=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={}),i=n[t]||(n[t]=[]);i.push(r)}},ql=[],Wl=e.off=function(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else for(var n=Ci(e,t,!1),i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}},zl=e.signal=function(e,t){var r=Ci(e,t,!0);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)},Dl=null,Hl=30,El=e.Pass={toString:function(){return"CodeMirror.Pass"}},Il={scroll:!1},Pl={origin:"*mouse"},Fl={origin:"+move"};Oi.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Rl=e.countColumn=function(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=n||0,l=i||0;;){var s=e.indexOf("\t",o);if(s<0||s>=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}},Bl=e.findColumn=function(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);o==-1&&(o=e.length);var l=o-n;if(o==e.length||i+l>=t)return n+Math.min(l,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}},$l=[""],jl=function(e){e.select()};Ao?jl=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:xo&&(jl=function(e){try{e.select()}catch(t){}});var Ul,Vl=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Gl=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Vl.test(e))},Kl=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Ul=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var Xl=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};xo&&ko<11&&(Vi=function(){try{return document.activeElement}catch(e){return document.body}});var Yl,Zl,Ql=e.rmClass=function(e,t){var r=e.className,n=Gi(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}},Jl=e.addClass=function(e,t){var r=e.className;Gi(t).test(r)||(e.className+=(r?" ":"")+t)},es=!1,ts=function(){if(xo&&ko<9)return!1;var e=$i("div");return"draggable"in e||"dragDrop"in e}(),rs=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");l!=-1?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ns=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},is=function(){var e=$i("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),os=null,ls=e.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!function(){for(var e=0;e<10;e++)ls[e+48]=ls[e+96]=String(e);for(var e=65;e<=90;e++)ls[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)ls[e+111]=ls[e+63235]="F"+e}();var ss,as=function(){function e(e){return e<=247?r.charAt(e):1424<=e&&e<=1524?"R":1536<=e&&e<=1773?n.charAt(e-1536):1774<=e&&e<=2220?"r":8192<=e&&e<=8203?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,l=/[LRr]/,s=/[Lb1n]/,a=/[1n]/,c="L";return function(r){if(!i.test(r))return!1;for(var n,u=r.length,h=[],f=0;f<u;++f)h.push(n=e(r.charCodeAt(f)));for(var f=0,d=c;f<u;++f){var n=h[f];"m"==n?h[f]=d:d=n}for(var f=0,p=c;f<u;++f){var n=h[f];"1"==n&&"r"==p?h[f]="n":l.test(n)&&(p=n,"r"==n&&(h[f]="R"))}for(var f=1,d=h[0];f<u-1;++f){var n=h[f];"+"==n&&"1"==d&&"1"==h[f+1]?h[f]="1":","!=n||d!=h[f+1]||"1"!=d&&"n"!=d||(h[f]=d),d=n}for(var f=0;f<u;++f){var n=h[f];if(","==n)h[f]="N";else if("%"==n){for(var g=f+1;g<u&&"%"==h[g];++g);for(var m=f&&"!"==h[f-1]||g<u&&"1"==h[g]?"1":"N",v=f;v<g;++v)h[v]=m;f=g-1}}for(var f=0,p=c;f<u;++f){var n=h[f];"L"==p&&"1"==n?h[f]="L":l.test(n)&&(p=n)}for(var f=0;f<u;++f)if(o.test(h[f])){for(var g=f+1;g<u&&o.test(h[g]);++g);for(var y="L"==(f?h[f-1]:c),b="L"==(g<u?h[g]:c),m=y||b?"L":"R",v=f;v<g;++v)h[v]=m;f=g-1}for(var x,k=[],f=0;f<u;)if(s.test(h[f])){var w=f;for(++f;f<u&&s.test(h[f]);++f);k.push(new t(0,w,f))}else{var _=f,C=k.length;for(++f;f<u&&"L"!=h[f];++f);for(var v=_;v<f;)if(a.test(h[v])){_<v&&k.splice(C,0,new t(1,_,v));var S=v;for(++v;v<f&&a.test(h[v]);++v);k.splice(C,0,new t(2,S,v)),_=v}else++v;_<f&&k.splice(C,0,new t(1,_,f))}return 1==k[0].level&&(x=r.match(/^\s+/))&&(k[0].from=x[0].length,k.unshift(new t(0,0,x[0].length))),1==Wi(k).level&&(x=r.match(/\s+$/))&&(Wi(k).to-=x[0].length,k.push(new t(0,u-x[0].length,u))),2==k[0].level&&k.unshift(new t(1,k[0].to,k[0].to)),k[0].level!=Wi(k).level&&k.push(new t(k[0].level,u,u)),k}}();return e.version="5.17.0",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("markdown",function(t,r){function n(r){if(e.findModeByName){var n=e.findModeByName(r);n&&(r=n.mime||n.mimes[0])}var i=e.getMode(t,r);return"null"==i.name?null:i}function i(e,t,r){return t.f=t.inline=r,r(e,t)}function o(e,t,r){return t.f=t.block=r,r(e,t)}function l(e){return!e||!/\S/.test(e.string)}function s(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,w&&e.f==c&&(e.f=p,e.block=a),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine=null,null}function a(t,o){var s=t.sol(),a=o.list!==!1,c=o.indentedCode;o.indentedCode=!1,a&&(o.indentationDiff>=0?(o.indentationDiff<4&&(o.indentation-=o.indentationDiff),o.list=null):o.indentation>0?o.list=null:o.list=!1);var h=null;if(o.indentationDiff>=4)return t.skipToEnd(),c||l(o.prevLine)?(o.indentation-=4,o.indentedCode=!0,_.code):null;if(t.eatSpace())return null;if((h=t.match(A))&&h[1].length<=6)return o.header=h[1].length,r.highlightFormatting&&(o.formatting="header"),o.f=o.inline,f(o);if(!(l(o.prevLine)||o.quote||a||c)&&(h=t.match(N)))return o.header="="==h[0].charAt(0)?1:2,r.highlightFormatting&&(o.formatting="header"),o.f=o.inline,f(o);if(t.eat(">"))return o.quote=s?1:o.quote+1,r.highlightFormatting&&(o.formatting="quote"),t.eatSpace(),f(o);if("["===t.peek())return i(t,o,y);if(t.match(S,!0))return o.hr=!0,_.hr;if((l(o.prevLine)||a)&&(t.match(L,!1)||t.match(M,!1))){var d=null;for(t.match(L,!0)?d="ul":(t.match(M,!0),d="ol"),o.indentation=t.column()+t.current().length,o.list=!0;o.listStack&&t.column()<o.listStack[o.listStack.length-1];)o.listStack.pop();return o.listStack.push(o.indentation),r.taskLists&&t.match(T,!1)&&(o.taskList=!0),o.f=o.inline,r.highlightFormatting&&(o.formatting=["list","list-"+d]),f(o)}return r.fencedCodeBlocks&&(h=t.match(q,!0))?(o.fencedChars=h[1],o.localMode=n(h[2]),o.localMode&&(o.localState=e.startState(o.localMode)),o.f=o.block=u,r.highlightFormatting&&(o.formatting="code-block"),o.code=-1,f(o)):i(t,o,o.inline)}function c(t,r){var n=k.token(t,r.htmlState);if(!w){var i=e.innerMode(k,r.htmlState);("xml"==i.mode.name&&null===i.state.tagStart&&!i.state.context&&i.state.tokenize.isInText||r.md_inside&&t.current().indexOf(">")>-1)&&(r.f=p,r.block=a,r.htmlState=null)}return n}function u(e,t){return t.fencedChars&&e.match(t.fencedChars,!1)?(t.localMode=t.localState=null,t.f=t.block=h,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),_.code)}function h(e,t){e.match(t.fencedChars),t.block=a,t.f=p,t.fencedChars=null,r.highlightFormatting&&(t.formatting="code-block"),t.code=1;var n=f(t);return t.code=0,n}function f(e){var t=[];if(e.formatting){t.push(_.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var n=0;n<e.formatting.length;n++)t.push(_.formatting+"-"+e.formatting[n]),"header"===e.formatting[n]&&t.push(_.formatting+"-"+e.formatting[n]+"-"+e.header),"quote"===e.formatting[n]&&(!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?t.push(_.formatting+"-"+e.formatting[n]+"-"+e.quote):t.push("error"))}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(_.linkHref,"url"):(e.strong&&t.push(_.strong),e.em&&t.push(_.em),e.strikethrough&&t.push(_.strikethrough),e.linkText&&t.push(_.linkText),e.code&&t.push(_.code),e.image&&t.push(_.image),e.imageAltText&&t.push(_.imageAltText,"link"),e.imageMarker&&t.push(_.imageMarker)),e.header&&t.push(_.header,_.header+"-"+e.header),e.quote&&(t.push(_.quote),!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?t.push(_.quote+"-"+e.quote):t.push(_.quote+"-"+r.maxBlockquoteDepth)),
e.list!==!1){var i=(e.listStack.length-1)%3;i?1===i?t.push(_.list2):t.push(_.list3):t.push(_.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function d(e,t){if(e.match(O,!0))return f(t)}function p(t,n){var i=n.text(t,n);if("undefined"!=typeof i)return i;if(n.list)return n.list=null,f(n);if(n.taskList){var l="x"!==t.match(T,!0)[1];return l?n.taskOpen=!0:n.taskClosed=!0,r.highlightFormatting&&(n.formatting="task"),n.taskList=!1,f(n)}if(n.taskOpen=!1,n.taskClosed=!1,n.header&&t.match(/^#+$/,!0))return r.highlightFormatting&&(n.formatting="header"),f(n);var s=t.sol(),a=t.next();if(n.linkTitle){n.linkTitle=!1;var u=a;"("===a&&(u=")"),u=(u+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var h="^\\s*(?:[^"+u+"\\\\]+|\\\\\\\\|\\\\.)"+u;if(t.match(new RegExp(h),!0))return _.linkHref}if("`"===a){var d=n.formatting;r.highlightFormatting&&(n.formatting="code"),t.eatWhile("`");var p=t.current().length;if(0==n.code)return n.code=p,f(n);if(p==n.code){var v=f(n);return n.code=0,v}return n.formatting=d,f(n)}if(n.code)return f(n);if("\\"===a&&(t.next(),r.highlightFormatting)){var y=f(n),b=_.formatting+"-escape";return y?y+" "+b:b}if("!"===a&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return n.imageMarker=!0,n.image=!0,r.highlightFormatting&&(n.formatting="image"),f(n);if("["===a&&n.imageMarker)return n.imageMarker=!1,n.imageAltText=!0,r.highlightFormatting&&(n.formatting="image"),f(n);if("]"===a&&n.imageAltText){r.highlightFormatting&&(n.formatting="image");var y=f(n);return n.imageAltText=!1,n.image=!1,n.inline=n.f=m,y}if("["===a&&t.match(/[^\]]*\](\(.*\)| ?\[.*?\])/,!1)&&!n.image)return n.linkText=!0,r.highlightFormatting&&(n.formatting="link"),f(n);if("]"===a&&n.linkText&&t.match(/\(.*?\)| ?\[.*?\]/,!1)){r.highlightFormatting&&(n.formatting="link");var y=f(n);return n.linkText=!1,n.inline=n.f=m,y}if("<"===a&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=g,r.highlightFormatting&&(n.formatting="link");var y=f(n);return y?y+=" ":y="",y+_.linkInline}if("<"===a&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=g,r.highlightFormatting&&(n.formatting="link");var y=f(n);return y?y+=" ":y="",y+_.linkEmail}if("<"===a&&t.match(/^(!--|\w)/,!1)){var x=t.string.indexOf(">",t.pos);if(x!=-1){var w=t.string.substring(t.start,x);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(w)&&(n.md_inside=!0)}return t.backUp(1),n.htmlState=e.startState(k),o(t,n,c)}if("<"===a&&t.match(/^\/\w*?>/))return n.md_inside=!1,"tag";var C=!1;if(!r.underscoresBreakWords&&"_"===a&&"_"!==t.peek()&&t.match(/(\w)/,!1)){var S=t.pos-2;if(S>=0){var L=t.string.charAt(S);"_"!==L&&L.match(/(\w)/,!1)&&(C=!0)}}if("*"===a||"_"===a&&!C)if(s&&" "===t.peek());else{if(n.strong===a&&t.eat(a)){r.highlightFormatting&&(n.formatting="strong");var v=f(n);return n.strong=!1,v}if(!n.strong&&t.eat(a))return n.strong=a,r.highlightFormatting&&(n.formatting="strong"),f(n);if(n.em===a){r.highlightFormatting&&(n.formatting="em");var v=f(n);return n.em=!1,v}if(!n.em)return n.em=a,r.highlightFormatting&&(n.formatting="em"),f(n)}else if(" "===a&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return f(n);t.backUp(1)}if(r.strikethrough)if("~"===a&&t.eatWhile(a)){if(n.strikethrough){r.highlightFormatting&&(n.formatting="strikethrough");var v=f(n);return n.strikethrough=!1,v}if(t.match(/^[^\s]/,!1))return n.strikethrough=!0,r.highlightFormatting&&(n.formatting="strikethrough"),f(n)}else if(" "===a&&t.match(/^~~/,!0)){if(" "===t.peek())return f(n);t.backUp(2)}return" "===a&&(t.match(/ +$/,!1)?n.trailingSpace++:n.trailingSpace&&(n.trailingSpaceNewLine=!0)),f(n)}function g(e,t){var n=e.next();if(">"===n){t.f=t.inline=p,r.highlightFormatting&&(t.formatting="link");var i=f(t);return i?i+=" ":i="",i+_.linkInline}return e.match(/^[^>]+/,!0),_.linkInline}function m(e,t){if(e.eatSpace())return null;var n=e.next();return"("===n||"["===n?(t.f=t.inline=v("("===n?")":"]",0),r.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,f(t)):"error"}function v(e){return function(t,n){var i=t.next();if(i===e){n.f=n.inline=p,r.highlightFormatting&&(n.formatting="link-string");var o=f(n);return n.linkHref=!1,o}return t.match(W[e]),n.linkHref=!0,f(n)}}function y(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=b,e.next(),r.highlightFormatting&&(t.formatting="link"),t.linkText=!0,f(t)):i(e,t,p)}function b(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=x,r.highlightFormatting&&(t.formatting="link");var n=f(t);return t.linkText=!1,n}return e.match(/^([^\]\\]|\\.)+/,!0),_.linkText}function x(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=p,_.linkHref+" url")}var k=e.getMode(t,"text/html"),w="null"==k.name;void 0===r.highlightFormatting&&(r.highlightFormatting=!1),void 0===r.maxBlockquoteDepth&&(r.maxBlockquoteDepth=0),void 0===r.underscoresBreakWords&&(r.underscoresBreakWords=!0),void 0===r.taskLists&&(r.taskLists=!1),void 0===r.strikethrough&&(r.strikethrough=!1),void 0===r.tokenTypeOverrides&&(r.tokenTypeOverrides={});var _={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough"};for(var C in _)_.hasOwnProperty(C)&&r.tokenTypeOverrides[C]&&(_[C]=r.tokenTypeOverrides[C]);var S=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^[*\-+]\s+/,M=/^[0-9]+([.)])\s+/,T=/^\[(x| )\](?=\s)/,A=r.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,N=/^ *(?:\={1,}|-{1,})\s*$/,O=/^[^#!\[\]*_\\<>` "'(~]+/,q=new RegExp("^("+(r.fencedCodeBlocks===!0?"~~~+|```+":r.fencedCodeBlocks)+")[ \\t]*([\\w+#-]*)"),W={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\\]]|\\.)*\])*?(?=\])/},z={startState:function(){return{f:a,prevLine:null,thisLine:null,block:a,htmlState:null,indentation:0,inline:p,text:d,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,fencedChars:null}},copyState:function(t){return{f:t.f,prevLine:t.prevLine,thisLine:t.thisLine,block:t.block,htmlState:t.htmlState&&e.copyState(k,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkTitle:t.linkTitle,code:t.code,em:t.em,strong:t.strong,strikethrough:t.strikethrough,header:t.header,hr:t.hr,taskList:t.taskList,list:t.list,listStack:t.listStack.slice(0),quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside,fencedChars:t.fencedChars}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine){var r=t.header||t.hr;if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0)||r){if(s(t),!r)return null;t.prevLine=null}t.prevLine=t.thisLine,t.thisLine=e,t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block;var n=e.match(/^\s*/,!0)[0].replace(/\t/g,"    ").length;if(t.indentationDiff=Math.min(n-t.indentation,4),t.indentation=t.indentation+t.indentationDiff,n>0)return null}return t.f(e,t)},innerMode:function(e){return e.block==c?{state:e.htmlState,mode:k}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:z}},blankLine:s,getType:f,fold:"markdown"};return z},"xml"),e.defineMIME("text/x-markdown","markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,r,n){return{startState:function(){return{base:e.startState(t),overlay:e.startState(r),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(n){return{base:e.copyState(t,n.base),overlay:e.copyState(r,n.overlay),basePos:n.basePos,baseCur:null,overlayPos:n.overlayPos,overlayCur:null}},token:function(e,i){return(e!=i.streamSeen||Math.min(i.basePos,i.overlayPos)<e.start)&&(i.streamSeen=e,i.basePos=i.overlayPos=e.start),e.start==i.basePos&&(i.baseCur=t.token(e,i.base),i.basePos=e.pos),e.start==i.overlayPos&&(e.pos=e.start,i.overlayCur=r.token(e,i.overlay),i.overlayPos=e.pos),e.pos=Math.min(i.basePos,i.overlayPos),null==i.overlayCur?i.baseCur:null!=i.baseCur&&i.overlay.combineTokens||n&&null==i.overlay.combineTokens?i.baseCur+" "+i.overlayCur:i.overlayCur},indent:t.indent&&function(e,r){return t.indent(e.base,r)},electricChars:t.electricChars,innerMode:function(e){return{state:e.base,mode:t}},blankLine:function(e){t.blankLine&&t.blankLine(e.base),r.blankLine&&r.blankLine(e.overlay)}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}e.defineMode("javascript",function(r,n){function i(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function o(e,t,r){return be=e,xe=r,t}function l(e,r){var n=e.next();if('"'==n||"'"==n)return r.tokenize=s(n),r.tokenize(e,r);if("."==n&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return o("number","number");if("."==n&&e.match(".."))return o("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return o(n);if("="==n&&e.eat(">"))return o("=>","operator");if("0"==n&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),o("number","number");if("0"==n&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),o("number","number");if("0"==n&&e.eat(/b/i))return e.eatWhile(/[01]/i),o("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),o("number","number");if("/"==n)return e.eat("*")?(r.tokenize=a,a(e,r)):e.eat("/")?(e.skipToEnd(),o("comment","comment")):t(e,r,1)?(i(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),o("regexp","string-2")):(e.eatWhile(Te),o("operator","operator",e.current()));if("`"==n)return r.tokenize=c,c(e,r);if("#"==n)return e.skipToEnd(),o("error","error");if(Te.test(n))return e.eatWhile(Te),o("operator","operator",e.current());if(Le.test(n)){e.eatWhile(Le);var l=e.current(),u=Me.propertyIsEnumerable(l)&&Me[l];return u&&"."!=r.lastType?o(u.type,u.style,l):o("variable","variable",l)}}function s(e){return function(t,r){var n,i=!1;if(_e&&"@"==t.peek()&&t.match(Ae))return r.tokenize=l,o("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||i);)i=!i&&"\\"==n;return i||(r.tokenize=l),o("string","string")}}function a(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=l;break}n="*"==r}return o("comment","comment")}function c(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=l;break}n=!n&&"\\"==r}return o("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){for(var n=0,i=!1,o=r-1;o>=0;--o){var l=e.string.charAt(o),s=Ne.indexOf(l);if(s>=0&&s<3){if(!n){++o;break}if(0==--n)break}else if(s>=3&&s<6)++n;else if(Le.test(l))i=!0;else{if(/["'\/]/.test(l))return;if(i&&!n){++o;break}}}i&&!n&&(t.fatArrowAt=o)}}function h(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function f(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function d(e,t,r,n,i){var o=e.cc;for(qe.state=e,qe.stream=i,qe.marked=null,qe.cc=o,qe.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var l=o.length?o.pop():Ce?_:w;if(l(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return qe.marked?qe.marked:"variable"==r&&f(e,n)?"variable-2":t}}}function p(){for(var e=arguments.length-1;e>=0;e--)qe.cc.push(arguments[e])}function g(){return p.apply(null,arguments),!0}function m(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var r=qe.state;if(qe.marked="def",r.context){if(t(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return;n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function v(){qe.state.context={prev:qe.state.context,vars:qe.state.localVars},qe.state.localVars=We}function y(){qe.state.localVars=qe.state.context.vars,qe.state.context=qe.state.context.prev}function b(e,t){var r=function(){var r=qe.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new h(n,qe.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function x(){var e=qe.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function k(e){function t(r){return r==e?g():";"==e?p():g(t)}return t}function w(e,t){return"var"==e?g(b("vardef",t.length),X,k(";"),x):"keyword a"==e?g(b("form"),_,w,x):"keyword b"==e?g(b("form"),w,x):"{"==e?g(b("}"),j,x):";"==e?g():"if"==e?("else"==qe.state.lexical.info&&qe.state.cc[qe.state.cc.length-1]==x&&qe.state.cc.pop()(),g(b("form"),_,w,x,ee)):"function"==e?g(le):"for"==e?g(b("form"),te,w,x):"variable"==e?g(b("stat"),E):"switch"==e?g(b("form"),_,b("}","switch"),k("{"),j,x,x):"case"==e?g(_,k(":")):"default"==e?g(k(":")):"catch"==e?g(b("form"),v,k("("),se,k(")"),w,x,y):"class"==e?g(b("form"),ae,x):"export"==e?g(b("stat"),fe,x):"import"==e?g(b("stat"),de,x):"module"==e?g(b("form"),Y,b("}"),k("{"),j,x,x):"async"==e?g(w):p(b("stat"),_,k(";"),x)}function _(e){return S(e,!1)}function C(e){return S(e,!0)}function S(e,t){if(qe.state.fatArrowAt==qe.stream.start){var r=t?W:q;if("("==e)return g(v,b(")"),B(Y,")"),x,k("=>"),r,y);if("variable"==e)return p(v,Y,k("=>"),r,y)}var n=t?A:T;return Oe.hasOwnProperty(e)?g(n):"function"==e?g(le,n):"keyword c"==e||"async"==e?g(t?M:L):"("==e?g(b(")"),L,k(")"),x,n):"operator"==e||"spread"==e?g(t?C:_):"["==e?g(b("]"),ve,x,n):"{"==e?$(P,"}",null,n):"quasi"==e?p(N,n):"new"==e?g(z(t)):g()}function L(e){return e.match(/[;\}\)\],]/)?p():p(_)}function M(e){return e.match(/[;\}\)\],]/)?p():p(C)}function T(e,t){return","==e?g(_):A(e,t,!1)}function A(e,t,r){var n=0==r?T:A,i=0==r?_:C;return"=>"==e?g(v,r?W:q,y):"operator"==e?/\+\+|--/.test(t)?g(n):"?"==t?g(_,k(":"),i):g(i):"quasi"==e?p(N,n):";"!=e?"("==e?$(C,")","call",n):"."==e?g(I,n):"["==e?g(b("]"),L,k("]"),x,n):void 0:void 0}function N(e,t){return"quasi"!=e?p():"${"!=t.slice(t.length-2)?g(N):g(_,O)}function O(e){if("}"==e)return qe.marked="string-2",qe.state.tokenize=c,g(N)}function q(e){return u(qe.stream,qe.state),p("{"==e?w:_)}function W(e){return u(qe.stream,qe.state),p("{"==e?w:C)}function z(e){return function(t){return"."==t?g(e?H:D):p(e?C:_)}}function D(e,t){if("target"==t)return qe.marked="keyword",g(T)}function H(e,t){if("target"==t)return qe.marked="keyword",g(A)}function E(e){return":"==e?g(x,w):p(T,k(";"),x)}function I(e){if("variable"==e)return qe.marked="property",g()}function P(e,t){return"async"==e?g(P):"variable"==e||"keyword"==qe.style?(qe.marked="property",g("get"==t||"set"==t?F:R)):"number"==e||"string"==e?(qe.marked=_e?"property":qe.style+" property",g(R)):"jsonld-keyword"==e?g(R):"modifier"==e?g(P):"["==e?g(_,k("]"),R):"spread"==e?g(_):void 0}function F(e){return"variable"!=e?p(R):(qe.marked="property",g(le))}function R(e){return":"==e?g(C):"("==e?p(le):void 0}function B(e,t){function r(n,i){if(","==n){var o=qe.state.lexical;return"call"==o.info&&(o.pos=(o.pos||0)+1),g(function(r,n){return r==t||n==t?p():p(e)},r)}return n==t||i==t?g():g(k(t))}return function(n,i){return n==t||i==t?g():p(e,r)}}function $(e,t,r){for(var n=3;n<arguments.length;n++)qe.cc.push(arguments[n]);return g(b(t,r),B(e,t),x)}function j(e){return"}"==e?g():p(w,j)}function U(e){if(Se&&":"==e)return g(G)}function V(e,t){if("="==t)return g(C)}function G(e){if("variable"==e)return qe.marked="variable-3",g(K)}function K(e,t){return"<"==t?g(B(G,">"),K):"["==e?g(k("]"),K):void 0}function X(){return p(Y,U,Q,J)}function Y(e,t){return"modifier"==e?g(Y):"variable"==e?(m(t),g()):"spread"==e?g(Y):"["==e?$(Y,"]"):"{"==e?$(Z,"}"):void 0}function Z(e,t){return"variable"!=e||qe.stream.match(/^\s*:/,!1)?("variable"==e&&(qe.marked="property"),"spread"==e?g(Y):"}"==e?p():g(k(":"),Y,Q)):(m(t),g(Q))}function Q(e,t){if("="==t)return g(C)}function J(e){if(","==e)return g(X)}function ee(e,t){if("keyword b"==e&&"else"==t)return g(b("form","else"),w,x)}function te(e){if("("==e)return g(b(")"),re,k(")"),x)}function re(e){return"var"==e?g(X,k(";"),ie):";"==e?g(ie):"variable"==e?g(ne):p(_,k(";"),ie)}function ne(e,t){return"in"==t||"of"==t?(qe.marked="keyword",g(_)):g(T,ie)}function ie(e,t){return";"==e?g(oe):"in"==t||"of"==t?(qe.marked="keyword",g(_)):p(_,k(";"),oe)}function oe(e){")"!=e&&g(_)}function le(e,t){return"*"==t?(qe.marked="keyword",g(le)):"variable"==e?(m(t),g(le)):"("==e?g(v,b(")"),B(se,")"),x,U,w,y):void 0}function se(e){return"spread"==e?g(se):p(Y,U,V)}function ae(e,t){if("variable"==e)return m(t),g(ce)}function ce(e,t){return"extends"==t?g(_,ce):"{"==e?g(b("}"),ue,x):void 0}function ue(e,t){return"variable"==e||"keyword"==qe.style?"static"==t?(qe.marked="keyword",g(ue)):(qe.marked="property","get"==t||"set"==t?g(he,le,ue):g(le,ue)):"*"==t?(qe.marked="keyword",g(ue)):";"==e?g(ue):"}"==e?g():void 0}function he(e){return"variable"!=e?p():(qe.marked="property",g())}function fe(e,t){return"*"==t?(qe.marked="keyword",g(me,k(";"))):"default"==t?(qe.marked="keyword",g(_,k(";"))):p(w)}function de(e){return"string"==e?g():p(pe,me)}function pe(e,t){return"{"==e?$(pe,"}"):("variable"==e&&m(t),"*"==t&&(qe.marked="keyword"),g(ge))}function ge(e,t){if("as"==t)return qe.marked="keyword",g(pe)}function me(e,t){if("from"==t)return qe.marked="keyword",g(_)}function ve(e){return"]"==e?g():p(C,B(C,"]"))}function ye(e,t){return"operator"==e.lastType||","==e.lastType||Te.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var be,xe,ke=r.indentUnit,we=n.statementIndent,_e=n.jsonld,Ce=n.json||_e,Se=n.typescript,Le=n.wordCharacters||/[\w$\xa1-\uffff]/,Me=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},l={"if":e("if"),"while":t,"with":t,"else":r,"do":r,"try":r,"finally":r,"return":n,"break":n,"continue":n,"new":e("new"),"delete":n,"throw":n,"debugger":n,"var":e("var"),"const":e("var"),"let":e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":e("this"),"class":e("class"),"super":e("atom"),"yield":n,"export":e("export"),"import":e("import"),"extends":n,await:n,async:e("async")};if(Se){var s={type:"variable",style:"variable-3"},a={"interface":e("class"),"implements":n,namespace:n,module:e("module"),"enum":e("module"),"public":e("modifier"),"private":e("modifier"),"protected":e("modifier"),"abstract":e("modifier"),as:i,string:s,number:s,"boolean":s,any:s};for(var c in a)l[c]=a[c]}return l}(),Te=/[+\-*&%=<>!?|~^]/,Ae=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Ne="([{}])",Oe={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},qe={state:null,column:null,marked:null,cc:null},We={name:"this",next:{name:"arguments"}};return x.lex=!0,{startState:function(e){var t={tokenize:l,lastType:"sof",cc:[],lexical:new h((e||0)-ke,0,"block",(!1)),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:e||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=a&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==be?r:(t.lastType="operator"!=be||"++"!=xe&&"--"!=xe?be:"incdec",d(t,r,be,xe,e))},indent:function(t,r){if(t.tokenize==a)return e.Pass;if(t.tokenize!=l)return 0;var i=r&&r.charAt(0),o=t.lexical;if(!/^\s*else\b/.test(r))for(var s=t.cc.length-1;s>=0;--s){var c=t.cc[s];if(c==x)o=o.prev;else if(c!=ee)break}"stat"==o.type&&"}"==i&&(o=o.prev),we&&")"==o.type&&"stat"==o.prev.type&&(o=o.prev);var u=o.type,h=i==u;return"vardef"==u?o.indented+("operator"==t.lastType||","==t.lastType?o.info+1:0):"form"==u&&"{"==i?o.indented:"form"==u?o.indented+ke:"stat"==u?o.indented+(ye(t,r)?we||ke:0):"switch"!=o.info||h||0==n.doubleIndentSwitch?o.align?o.column+(h?0:1):o.indented+(h?0:ke):o.indented+(/^(?:case|default)\b/.test(r)?ke:2*ke)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ce?null:"/*",blockCommentEnd:Ce?null:"*/",lineComment:Ce?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Ce?"json":"javascript",jsonldMode:_e,jsonMode:Ce,expressionAllowed:t,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=_&&t!=C||e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function r(e,t,i){return 0==e.length?n(t):function(o,l){for(var s=e[0],a=0;a<s.length;a++)if(o.match(s[a][0]))return l.tokenize=r(e.slice(1),t),s[a][1];return l.tokenize=n(t,i),"string"}}function n(e,t){return function(r,n){return i(r,n,e,t)}}function i(e,t,n,i){if(i!==!1&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(i!==!1&&e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=r([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],n,i)),e.match(/\-\>\w/,!1)&&(t.tokenize=r([[["->",null]],[[/[\w]+/,"variable"]]],n,i)),"variable-2";for(var o=!1;!e.eol()&&(o||i===!1||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!o&&e.match(n)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}o="\\"==e.next()&&!o}return"string"}var o="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",l="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",s="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";
e.registerHelper("hintWords","php",[o,l,s].join(" ").split(" ")),e.registerHelper("wordChars","php",/[\w$]/);var a={name:"clike",helperType:"php",keywords:t(o),blockKeywords:t("catch do else elseif for foreach if switch try while finally"),defKeywords:t("class function interface namespace trait"),atoms:t(l),builtin:t(s),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){var r;if(r=e.match(/<<\s*/)){var i=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var o=e.current().slice(r[0].length+(i?2:1));if(i&&e.eat(i),o)return(t.tokStack||(t.tokStack=[])).push(o,0),t.tokenize=n(o,"'"!=i),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=n('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&t.tokStack.length>0&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=n(t.tokStack[t.tokStack.length-2])),!1}}};e.defineMode("php",function(t,r){function n(t,r){var n=r.curMode==o;if(t.sol()&&r.pending&&'"'!=r.pending&&"'"!=r.pending&&(r.pending=null),n)return n&&null==r.php.tokenize&&t.match("?>")?(r.curMode=i,r.curState=r.html,r.php.context.prev||(r.php=null),"meta"):o.token(t,r.curState);if(t.match(/^<\?\w*/))return r.curMode=o,r.php||(r.php=e.startState(o,i.indent(r.html,""))),r.curState=r.php,"meta";if('"'==r.pending||"'"==r.pending){for(;!t.eol()&&t.next()!=r.pending;);var l="string"}else if(r.pending&&t.pos<r.pending.end){t.pos=r.pending.end;var l=r.pending.style}else var l=i.token(t,r.curState);r.pending&&(r.pending=null);var s,a=t.current(),c=a.search(/<\?/);return c!=-1&&("string"==l&&(s=a.match(/[\'\"]$/))&&!/\?>/.test(a)?r.pending=s[0]:r.pending={end:t.pos,style:l},t.backUp(a.length-c)),l}var i=e.getMode(t,"text/html"),o=e.getMode(t,a);return{startState:function(){var t=e.startState(i),n=r.startOpen?e.startState(o):null;return{html:t,php:n,curMode:r.startOpen?o:i,curState:r.startOpen?n:t,pending:null}},copyState:function(t){var r,n=t.html,l=e.copyState(i,n),s=t.php,a=s&&e.copyState(o,s);return r=t.curMode==i?l:a,{html:l,php:a,curMode:t.curMode,curState:r,pending:t.pending}},token:n,indent:function(e,t){return e.curMode!=o&&/^\s*<\//.test(t)||e.curMode==o&&/^\?>/.test(t)?i.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),e.defineMIME("application/x-httpd-php","php"),e.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),e.defineMIME("text/x-php",a)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../markdown/markdown"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],e):e(CodeMirror)}(function(e){"use strict";var t=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;e.defineMode("gfm",function(r,n){function i(e){return e.code=!1,null}var o=0,l={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,r){if(r.combineTokens=null,r.codeBlock)return e.match(/^```+/)?(r.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(r.code=!1),e.sol()&&e.match(/^```+/))return e.skipToEnd(),r.codeBlock=!0,null;if("`"===e.peek()){e.next();var i=e.pos;e.eatWhile("`");var l=1+e.pos-i;return r.code?l===o&&(r.code=!1):(o=l,r.code=!0),null}if(r.code)return e.next(),null;if(e.eatSpace())return r.ateSpace=!0,null;if((e.sol()||r.ateSpace)&&(r.ateSpace=!1,n.gitHubSpice!==!1)){if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return r.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return r.combineTokens=!0,"link"}return e.match(t)&&"]("!=e.string.slice(e.start-2,e.start)&&(0==e.start||/\W/.test(e.string.charAt(e.start-1)))?(r.combineTokens=!0,"link"):(e.next(),null)},blankLine:i},s={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:"```",strikethrough:!0};for(var a in n)s[a]=n[a];return s.name="markdown",e.overlayMode(e.getMode(r,s),l)},"markdown"),e.defineMIME("text/x-gfm","gfm")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},r={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};e.defineMode("xml",function(n,i){function o(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();if("<"==n)return e.eat("!")?e.eat("[")?e.match("CDATA[")?r(a("atom","]]>")):null:e.match("--")?r(a("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(c(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=a("meta","?>"),"meta"):(L=e.eat("/")?"closeTag":"openTag",t.tokenize=l,"tag bracket");if("&"==n){var i;return i=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function l(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=o,L=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return L="equals",null;if("<"==r){t.tokenize=o,t.state=d,t.tagName=t.tagStart=null;var n=t.tokenize(e,t);return n?n+" tag error":"tag error"}return/[\'\"]/.test(r)?(t.tokenize=s(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function s(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=l;break}return"string"};return t.isInAttribute=!0,t}function a(e,t){return function(r,n){for(;!r.eol();){if(r.match(t)){n.tokenize=o;break}r.next()}return e}}function c(e){return function(t,r){for(var n;null!=(n=t.next());){if("<"==n)return r.tokenize=c(e+1),r.tokenize(t,r);if(">"==n){if(1==e){r.tokenize=o;break}return r.tokenize=c(e-1),r.tokenize(t,r)}}return"meta"}}function u(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(_.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function h(e){e.context&&(e.context=e.context.prev)}function f(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!_.contextGrabbers.hasOwnProperty(r)||!_.contextGrabbers[r].hasOwnProperty(t))return;h(e)}}function d(e,t,r){return"openTag"==e?(r.tagStart=t.column(),p):"closeTag"==e?g:d}function p(e,t,r){return"word"==e?(r.tagName=t.current(),M="tag",y):(M="error",p)}function g(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&_.implicitlyClosed.hasOwnProperty(r.context.tagName)&&h(r),r.context&&r.context.tagName==n||_.matchClosing===!1?(M="tag",m):(M="tag error",v)}return M="error",v}function m(e,t,r){return"endTag"!=e?(M="error",m):(h(r),d)}function v(e,t,r){return M="error",m(e,t,r)}function y(e,t,r){if("word"==e)return M="attribute",b;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||_.autoSelfClosers.hasOwnProperty(n)?f(r,n):(f(r,n),r.context=new u(r,n,i==r.indented)),d}return M="error",y}function b(e,t,r){return"equals"==e?x:(_.allowMissing||(M="error"),y(e,t,r))}function x(e,t,r){return"string"==e?k:"word"==e&&_.allowUnquoted?(M="string",y):(M="error",y(e,t,r))}function k(e,t,r){return"string"==e?k:y(e,t,r)}var w=n.indentUnit,_={},C=i.htmlMode?t:r;for(var S in C)_[S]=C[S];for(var S in i)_[S]=i[S];var L,M;return o.isInText=!0,{startState:function(e){var t={tokenize:o,state:d,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;L=null;var r=t.tokenize(e,t);return(r||L)&&"comment"!=r&&(M=null,t.state=t.state(L||r,e,t),M&&(r="error"==M?r+" error":M)),r},indent:function(t,r,n){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+w;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=l&&t.tokenize!=o)return n?n.match(/^(\s*)/)[0].length:0;if(t.tagName)return _.multilineTagIndentPastTag!==!1?t.tagStart+t.tagName.length+2:t.tagStart+w*(_.multilineTagIndentFactor||1);if(_.alignCDATA&&/<!\[CDATA\[/.test(r))return 0;var s=r&&/^<(\/)?([\w_:\.-]*)/.exec(r);if(s&&s[1])for(;i;){if(i.tagName==s[2]){i=i.prev;break}if(!_.implicitlyClosed.hasOwnProperty(i.tagName))break;i=i.prev}else if(s)for(;i;){var a=_.contextGrabbers[i.tagName];if(!a||!a.hasOwnProperty(s[2]))break;i=i.prev}for(;i&&i.prev&&!i.startOfLine;)i=i.prev;return i?i.indent+w:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:_.htmlMode?"html":"xml",helperType:_.htmlMode?"html":"xml",skipAttribute:function(e){e.state==x&&(e.state=y)}}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(){function e(e){this.tokens=[],this.tokens.links={},this.options=e||c.defaults,this.rules=u.normal,this.options.gfm&&(this.options.tables?this.rules=u.tables:this.rules=u.gfm)}function t(e,t){if(this.options=t||c.defaults,this.links=e,this.rules=h.normal,this.renderer=this.options.renderer||new r,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=h.breaks:this.rules=h.gfm:this.options.pedantic&&(this.rules=h.pedantic)}function r(e){this.options=e||{}}function n(e){this.tokens=[],this.token=null,this.options=e||c.defaults,this.options.renderer=this.options.renderer||new r,this.renderer=this.options.renderer,this.renderer.options=this.options}function i(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function o(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function l(e,t){return e=e.source,t=t||"",function r(n,i){return n?(i=i.source||i,i=i.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(n,i),r):new RegExp(e,t)}}function s(){}function a(e){for(var t,r,n=1;n<arguments.length;n++){t=arguments[n];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}function c(t,r,o){if(o||"function"==typeof r){o||(o=r,r=null),r=a({},c.defaults,r||{});var l,s,u=r.highlight,h=0;try{l=e.lex(t,r)}catch(f){return o(f)}s=l.length;var d=function(e){if(e)return r.highlight=u,o(e);var t;try{t=n.parse(l,r)}catch(i){e=i}return r.highlight=u,e?o(e):o(null,t)};if(!u||u.length<3)return d();if(delete r.highlight,!s)return d();for(;h<l.length;h++)!function(e){return"code"!==e.type?--s||d():u(e.text,e.lang,function(t,r){return t?d(t):null==r||r===e.text?--s||d():(e.text=r,e.escaped=!0,void(--s||d()))})}(l[h])}else try{return r&&(r=a({},c.defaults,r)),n.parse(e.lex(t,r),r)}catch(f){if(f.message+="\nPlease report this to https://github.com/chjj/marked.",(r||c.defaults).silent)return"<p>An error occured:</p><pre>"+i(f.message+"",!0)+"</pre>";throw f}}var u={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:s,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:s,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:s,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};u.bullet=/(?:[*+-]|\d+\.)/,u.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,u.item=l(u.item,"gm")(/bull/g,u.bullet)(),u.list=l(u.list)(/bull/g,u.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+u.def.source+")")(),u.blockquote=l(u.blockquote)("def",u.def)(),u._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",u.html=l(u.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,u._tag)(),u.paragraph=l(u.paragraph)("hr",u.hr)("heading",u.heading)("lheading",u.lheading)("blockquote",u.blockquote)("tag","<"+u._tag)("def",u.def)(),u.normal=a({},u),u.gfm=a({},u.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),u.gfm.paragraph=l(u.paragraph)("(?!","(?!"+u.gfm.fences.source.replace("\\1","\\2")+"|"+u.list.source.replace("\\1","\\3")+"|")(),u.tables=a({},u.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),e.rules=u,e.lex=function(t,r){var n=new e(r);return n.lex(t)},e.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g,"    ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},e.prototype.token=function(e,t,r){for(var n,i,o,l,s,a,c,h,f,e=e.replace(/^ +$/gm,"");e;)if((o=this.rules.newline.exec(e))&&(e=e.substring(o[0].length),o[0].length>1&&this.tokens.push({type:"space"})),o=this.rules.code.exec(e))e=e.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=this.rules.fences.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"code",lang:o[2],text:o[3]||""});else if(o=this.rules.heading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(t&&(o=this.rules.nptable.exec(e))){for(e=e.substring(o[0].length),a={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},h=0;h<a.align.length;h++)/^ *-+: *$/.test(a.align[h])?a.align[h]="right":/^ *:-+: *$/.test(a.align[h])?a.align[h]="center":/^ *:-+ *$/.test(a.align[h])?a.align[h]="left":a.align[h]=null;for(h=0;h<a.cells.length;h++)a.cells[h]=a.cells[h].split(/ *\| */);this.tokens.push(a)}else if(o=this.rules.lheading.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"heading",depth:"="===o[2]?1:2,text:o[1]});else if(o=this.rules.hr.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"hr"});else if(o=this.rules.blockquote.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"blockquote_start"}),o=o[0].replace(/^ *> ?/gm,""),this.token(o,t,!0),this.tokens.push({type:"blockquote_end"});else if(o=this.rules.list.exec(e)){for(e=e.substring(o[0].length),l=o[2],this.tokens.push({type:"list_start",ordered:l.length>1}),o=o[0].match(this.rules.item),n=!1,f=o.length,h=0;h<f;h++)a=o[h],c=a.length,a=a.replace(/^ *([*+-]|\d+\.) +/,""),~a.indexOf("\n ")&&(c-=a.length,a=this.options.pedantic?a.replace(/^ {1,4}/gm,""):a.replace(new RegExp("^ {1,"+c+"}","gm"),"")),this.options.smartLists&&h!==f-1&&(s=u.bullet.exec(o[h+1])[0],l===s||l.length>1&&s.length>1||(e=o.slice(h+1).join("\n")+e,h=f-1)),i=n||/\n\n(?!\s*$)/.test(a),h!==f-1&&(n="\n"===a.charAt(a.length-1),i||(i=n)),this.tokens.push({type:i?"loose_item_start":"list_item_start"}),this.token(a,!1,r),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(o=this.rules.html.exec(e))e=e.substring(o[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(!r&&t&&(o=this.rules.def.exec(e)))e=e.substring(o[0].length),this.tokens.links[o[1].toLowerCase()]={href:o[2],title:o[3]};else if(t&&(o=this.rules.table.exec(e))){for(e=e.substring(o[0].length),a={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},h=0;h<a.align.length;h++)/^ *-+: *$/.test(a.align[h])?a.align[h]="right":/^ *:-+: *$/.test(a.align[h])?a.align[h]="center":/^ *:-+ *$/.test(a.align[h])?a.align[h]="left":a.align[h]=null;for(h=0;h<a.cells.length;h++)a.cells[h]=a.cells[h].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(a)}else if(t&&(o=this.rules.paragraph.exec(e)))e=e.substring(o[0].length),this.tokens.push({type:"paragraph",text:"\n"===o[1].charAt(o[1].length-1)?o[1].slice(0,-1):o[1]});else if(o=this.rules.text.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"text",text:o[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var h={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:s,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:s,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};h._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,h._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,h.link=l(h.link)("inside",h._inside)("href",h._href)(),h.reflink=l(h.reflink)("inside",h._inside)(),h.normal=a({},h),h.pedantic=a({},h.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),h.gfm=a({},h.normal,{escape:l(h.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:l(h.text)("]|","~]|")("|","|https?://|")()}),h.breaks=a({},h.gfm,{br:l(h.br)("{2,}","*")(),text:l(h.gfm.text)("{2,}","*")()}),t.rules=h,t.output=function(e,r,n){var i=new t(r,n);return i.output(e)},t.prototype.output=function(e){for(var t,r,n,o,l="";e;)if(o=this.rules.escape.exec(e))e=e.substring(o[0].length),l+=o[1];else if(o=this.rules.autolink.exec(e))e=e.substring(o[0].length),"@"===o[2]?(r=":"===o[1].charAt(6)?this.mangle(o[1].substring(7)):this.mangle(o[1]),n=this.mangle("mailto:")+r):(r=i(o[1]),n=r),l+=this.renderer.link(n,null,r);else if(this.inLink||!(o=this.rules.url.exec(e))){if(o=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(o[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(o[0])&&(this.inLink=!1),e=e.substring(o[0].length),l+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(o[0]):i(o[0]):o[0];else if(o=this.rules.link.exec(e))e=e.substring(o[0].length),this.inLink=!0,l+=this.outputLink(o,{href:o[2],title:o[3]}),this.inLink=!1;else if((o=this.rules.reflink.exec(e))||(o=this.rules.nolink.exec(e))){if(e=e.substring(o[0].length),t=(o[2]||o[1]).replace(/\s+/g," "),t=this.links[t.toLowerCase()],!t||!t.href){l+=o[0].charAt(0),e=o[0].substring(1)+e;continue}this.inLink=!0,l+=this.outputLink(o,t),this.inLink=!1}else if(o=this.rules.strong.exec(e))e=e.substring(o[0].length),l+=this.renderer.strong(this.output(o[2]||o[1]));else if(o=this.rules.em.exec(e))e=e.substring(o[0].length),l+=this.renderer.em(this.output(o[2]||o[1]));else if(o=this.rules.code.exec(e))e=e.substring(o[0].length),l+=this.renderer.codespan(i(o[2],!0));else if(o=this.rules.br.exec(e))e=e.substring(o[0].length),l+=this.renderer.br();else if(o=this.rules.del.exec(e))e=e.substring(o[0].length),l+=this.renderer.del(this.output(o[1]));else if(o=this.rules.text.exec(e))e=e.substring(o[0].length),l+=this.renderer.text(i(this.smartypants(o[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(o[0].length),r=i(o[1]),n=r,l+=this.renderer.link(n,null,r);return l},t.prototype.outputLink=function(e,t){var r=i(t.href),n=t.title?i(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(r,n,this.output(e[1])):this.renderer.image(r,n,i(e[1]))},t.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},t.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,r="",n=e.length,i=0;i<n;i++)t=e.charCodeAt(i),Math.random()>.5&&(t="x"+t.toString(16)),r+="&#"+t+";";return r},r.prototype.code=function(e,t,r){if(this.options.highlight){var n=this.options.highlight(e,t);null!=n&&n!==e&&(r=!0,e=n)}return t?'<pre><code class="'+this.options.langPrefix+i(t,!0)+'">'+(r?e:i(e,!0))+"\n</code></pre>\n":"<pre><code>"+(r?e:i(e,!0))+"\n</code></pre>"},r.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,r){return"<h"+t+' id="'+this.options.headerPrefix+r.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},r.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},r.prototype.list=function(e,t){var r=t?"ol":"ul";return"<"+r+">\n"+e+"</"+r+">\n"},r.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},r.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},r.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},r.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},r.prototype.tablecell=function(e,t){var r=t.header?"th":"td",n=t.align?"<"+r+' style="text-align:'+t.align+'">':"<"+r+">";return n+e+"</"+r+">\n"},r.prototype.strong=function(e){return"<strong>"+e+"</strong>"},r.prototype.em=function(e){return"<em>"+e+"</em>"},r.prototype.codespan=function(e){return"<code>"+e+"</code>"},r.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},r.prototype.del=function(e){return"<del>"+e+"</del>"},r.prototype.link=function(e,t,r){if(this.options.sanitize){try{var n=decodeURIComponent(o(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(i){return""}if(0===n.indexOf("javascript:")||0===n.indexOf("vbscript:"))return""}var l='<a href="'+e+'"';return t&&(l+=' title="'+t+'"'),l+=">"+r+"</a>"},r.prototype.image=function(e,t,r){var n='<img src="'+e+'" alt="'+r+'"';return t&&(n+=' title="'+t+'"'),n+=this.options.xhtml?"/>":">"},r.prototype.text=function(e){return e},n.parse=function(e,t,r){var i=new n(t,r);return i.parse(e)},n.prototype.parse=function(e){this.inline=new t(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var r="";this.next();)r+=this.tok();return r},n.prototype.next=function(){return this.token=this.tokens.pop()},n.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},n.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},n.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,r,n,i,o="",l="";for(r="",e=0;e<this.token.header.length;e++)n={header:!0,align:this.token.align[e]},r+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(o+=this.renderer.tablerow(r),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],r="",i=0;i<t.length;i++)r+=this.renderer.tablecell(this.inline.output(t[i]),{header:!1,align:this.token.align[i]});l+=this.renderer.tablerow(r)}return this.renderer.table(o,l);case"blockquote_start":for(var l="";"blockquote_end"!==this.next().type;)l+=this.tok();return this.renderer.blockquote(l);case"list_start":for(var l="",s=this.token.ordered;"list_end"!==this.next().type;)l+=this.tok();return this.renderer.list(l,s);case"list_item_start":for(var l="";"list_item_end"!==this.next().type;)l+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(l);case"loose_item_start":for(var l="";"list_item_end"!==this.next().type;)l+=this.tok();return this.renderer.listitem(l);case"html":var a=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(a);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},s.exec=s,c.options=c.setOptions=function(e){return a(c.defaults,e),c},c.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new r,xhtml:!1},c.Parser=n,c.parser=n.parse,c.Renderer=r,c.Lexer=e,c.lexer=e.lex,c.InlineLexer=t,c.inlineLexer=t.output,c.parse=c,"undefined"!=typeof module&&"object"==typeof exports?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):this.marked=c}.call(function(){return this||("undefined"!=typeof window?window:global)}()),function(e){var t;window.UIkit&&(t=e(UIkit)),"function"==typeof define&&define.amd&&define("uikit-htmleditor",["uikit"],function(){return t||e(UIkit)})}(function(e){"use strict";var t=[];return e.component("htmleditor",{defaults:{iframe:!1,mode:"split",markdown:!1,autocomplete:!0,enablescripts:!1,height:500,maxsplitsize:1e3,codemirror:{mode:"htmlmixed",lineWrapping:!0,dragDrop:!1,autoCloseTags:!0,matchTags:!0,autoCloseBrackets:!0,matchBrackets:!0,indentUnit:4,indentWithTabs:!1,tabSize:4,hintOptions:{completionSingle:!1}},toolbar:["bold","italic","strike","link","image","blockquote","listUl","listOl"],lblPreview:"Preview",lblCodeview:"HTML",lblMarkedview:"Markdown"},boot:function(){e.ready(function(t){e.$("textarea[data-uk-htmleditor]",t).each(function(){var t=e.$(this);t.data("htmleditor")||e.htmleditor(t,e.Utils.options(t.attr("data-uk-htmleditor")))})})},init:function(){var r=this,n=e.components.htmleditor.template;this.CodeMirror=this.options.CodeMirror||CodeMirror,this.buttons={},n=n.replace(/\{:lblPreview}/g,this.options.lblPreview),n=n.replace(/\{:lblCodeview}/g,this.options.lblCodeview),this.htmleditor=e.$(n),this.content=this.htmleditor.find(".uk-htmleditor-content"),this.toolbar=this.htmleditor.find(".uk-htmleditor-toolbar"),this.preview=this.htmleditor.find(".uk-htmleditor-preview").children().eq(0),this.code=this.htmleditor.find(".uk-htmleditor-code"),this.element.before(this.htmleditor).appendTo(this.code),this.editor=this.CodeMirror.fromTextArea(this.element[0],this.options.codemirror),this.editor.htmleditor=this,this.editor.on("change",e.Utils.debounce(function(){r.render()},150)),this.editor.on("change",function(){r.editor.save(),r.element.trigger("input")}),this.code.find(".CodeMirror").css("height",this.options.height),this.options.iframe?(this.iframe=e.$('<iframe class="uk-htmleditor-iframe" frameborder="0" scrolling="auto" height="100" width="100%"></iframe>'),this.preview.append(this.iframe),this.iframe[0].contentWindow.document.open(),this.iframe[0].contentWindow.document.close(),this.preview.container=e.$(this.iframe[0].contentWindow.document).find("body"),"string"==typeof this.options.iframe&&this.preview.container.parent().append('<link rel="stylesheet" href="'+this.options.iframe+'">')):this.preview.container=this.preview,e.$win.on("resize load",e.Utils.debounce(function(){r.fit()},200));var i=this.iframe?this.preview.container:r.preview.parent(),o=this.code.find(".CodeMirror-sizer"),l=this.code.find(".CodeMirror-scroll").on("scroll",e.Utils.debounce(function(){if("tab"!=r.htmleditor.attr("data-mode")){var e=o.height()-l.height(),t=i[0].scrollHeight-(r.iframe?r.iframe.height():i.height()),n=t/e,s=l.scrollTop()*n;i.scrollTop(s)}},10));this.htmleditor.on("click",".uk-htmleditor-button-code, .uk-htmleditor-button-preview",function(t){t.preventDefault(),"tab"==r.htmleditor.attr("data-mode")&&(r.htmleditor.find(".uk-htmleditor-button-code, .uk-htmleditor-button-preview").removeClass("uk-active").filter(this).addClass("uk-active"),r.activetab=e.$(this).hasClass("uk-htmleditor-button-code")?"code":"preview",r.htmleditor.attr("data-active-tab",r.activetab),r.editor.refresh())}),this.htmleditor.on("click","a[data-htmleditor-button]",function(){r.code.is(":visible")&&r.trigger("action."+e.$(this).data("htmleditor-button"),[r.editor])}),this.preview.parent().css("height",this.code.height()),this.options.autocomplete&&this.CodeMirror.showHint&&this.CodeMirror.hint&&this.CodeMirror.hint.html&&this.editor.on("inputRead",e.Utils.debounce(function(){var e=r.editor.getDoc(),t=e.getCursor(),n=r.CodeMirror.innerMode(r.editor.getMode(),r.editor.getTokenAt(t).state).mode.name;if("xml"==n){var i=r.editor.getCursor(),o=r.editor.getTokenAt(i);"<"!=o.string.charAt(0)&&"attribute"!=o.type||r.CodeMirror.showHint(r.editor,r.CodeMirror.hint.html,{completeSingle:!1})}},100)),this.debouncedRedraw=e.Utils.debounce(function(){r.redraw()},5),this.on("init.uk.component",function(){r.debouncedRedraw()}),this.element.attr("data-uk-check-display",1).on("display.uk.check",function(e){this.htmleditor.is(":visible")&&this.fit()}.bind(this)),t.push(this)},addButton:function(e,t){this.buttons[e]=t},addButtons:function(t){e.$.extend(this.buttons,t)},replaceInPreview:function(e,t){function r(e){var t=n.getValue().substring(0,e).split("\n");return{line:t.length-1,ch:t[t.length-1].length}}var n=this.editor,i=[],o=n.getValue(),l=-1,s=0;return this.currentvalue=this.currentvalue.replace(e,function(){l=o.indexOf(arguments[0],++l);var e={matches:arguments,from:r(l),to:r(l+arguments[0].length),replace:function(t){n.replaceRange(t,e.from,e.to)},inRange:function(t){return t.line===e.from.line&&t.line===e.to.line?t.ch>=e.from.ch&&t.ch<e.to.ch:t.line===e.from.line&&t.ch>=e.from.ch||t.line>e.from.line&&t.line<e.to.line||t.line===e.to.line&&t.ch<e.to.ch;
}},a="string"==typeof t?t:t(e,s);return a||""===a?(s++,i.push(e),a):arguments[0]}),i},_buildtoolbar:function(){if(this.options.toolbar&&this.options.toolbar.length){var e=this,t=[];this.toolbar.empty(),this.options.toolbar.forEach(function(r){if(e.buttons[r]){var n=e.buttons[r].title?e.buttons[r].title:r;t.push('<li><a data-htmleditor-button="'+r+'" title="'+n+'" data-uk-tooltip>'+e.buttons[r].label+"</a></li>")}}),this.toolbar.html(t.join("\n"))}},fit:function(){var e=this.options.mode;"split"==e&&this.htmleditor.width()<this.options.maxsplitsize&&(e="tab"),"tab"==e&&(this.activetab||(this.activetab="code",this.htmleditor.attr("data-active-tab",this.activetab)),this.htmleditor.find(".uk-htmleditor-button-code, .uk-htmleditor-button-preview").removeClass("uk-active").filter("code"==this.activetab?".uk-htmleditor-button-code":".uk-htmleditor-button-preview").addClass("uk-active")),this.editor.refresh(),this.preview.parent().css("height",this.code.height()),this.htmleditor.attr("data-mode",e)},redraw:function(){this._buildtoolbar(),this.render(),this.fit()},getMode:function(){return this.editor.getOption("mode")},getCursorMode:function(){var e={mode:"html"};return this.trigger("cursorMode",[e]),e.mode},render:function(){return this.currentvalue=this.editor.getValue(),this.options.enablescripts||(this.currentvalue=this.currentvalue.replace(/<(script|style)\b[^<]*(?:(?!<\/(script|style)>)<[^<]*)*<\/(script|style)>/gim,"")),this.currentvalue?(this.trigger("render",[this]),this.trigger("renderLate",[this]),void this.preview.container.html(this.currentvalue)):(this.element.val(""),void this.preview.container.html(""))},addShortcut:function(t,r){var n={};return e.$.isArray(t)||(t=[t]),t.forEach(function(e){n[e]=r}),this.editor.addKeyMap(n),n},addShortcutAction:function(e,t){var r=this;this.addShortcut(t,function(){r.element.trigger("action."+e,[r.editor])})},replaceSelection:function(e){var t=this.editor.getSelection();if(!t.length){for(var r=this.editor.getCursor(),n=this.editor.getLine(r.line),i=r.ch,o=i;o<n.length&&/[\w$]+/.test(n.charAt(o));)++o;for(;i&&/[\w$]+/.test(n.charAt(i-1));)--i;var l=i!=o&&n.slice(i,o);l&&(this.editor.setSelection({line:r.line,ch:i},{line:r.line,ch:o}),t=l)}var s=e.replace("$1",t);this.editor.replaceSelection(s,"end"),this.editor.focus()},replaceLine:function(e){var t=this.editor.getDoc().getCursor(),r=this.editor.getLine(t.line),n=e.replace("$1",r);this.editor.replaceRange(n,{line:t.line,ch:0},{line:t.line,ch:r.length}),this.editor.setCursor({line:t.line,ch:n.length}),this.editor.focus()},save:function(){this.editor.save()}}),e.components.htmleditor.template=['<div class="uk-htmleditor uk-clearfix" data-mode="split">','<div class="uk-htmleditor-navbar">','<ul class="uk-htmleditor-navbar-nav uk-htmleditor-toolbar"></ul>','<div class="uk-htmleditor-navbar-flip">','<ul class="uk-htmleditor-navbar-nav">','<li class="uk-htmleditor-button-code"><a>{:lblCodeview}</a></li>','<li class="uk-htmleditor-button-preview"><a>{:lblPreview}</a></li>','<li><a data-htmleditor-button="fullscreen"><i class="uk-icon-expand"></i></a></li>',"</ul>","</div>","</div>",'<div class="uk-htmleditor-content">','<div class="uk-htmleditor-code"></div>','<div class="uk-htmleditor-preview"><div></div></div>',"</div>","</div>"].join(""),e.plugin("htmleditor","base",{init:function(t){function r(e,r,n){t.on("action."+e,function(){"html"==t.getCursorMode()&&t["replaceLine"==n?"replaceLine":"replaceSelection"](r)})}t.addButtons({fullscreen:{title:"Fullscreen",label:'<i class="uk-icon-expand"></i>'},bold:{title:"Bold",label:'<i class="uk-icon-bold"></i>'},italic:{title:"Italic",label:'<i class="uk-icon-italic"></i>'},strike:{title:"Strikethrough",label:'<i class="uk-icon-strikethrough"></i>'},blockquote:{title:"Blockquote",label:'<i class="uk-icon-quote-right"></i>'},link:{title:"Link",label:'<i class="uk-icon-link"></i>'},image:{title:"Image",label:'<i class="uk-icon-picture-o"></i>'},listUl:{title:"Unordered List",label:'<i class="uk-icon-list-ul"></i>'},listOl:{title:"Ordered List",label:'<i class="uk-icon-list-ol"></i>'}}),r("bold","<strong>$1</strong>"),r("italic","<em>$1</em>"),r("strike","<del>$1</del>"),r("blockquote","<blockquote><p>$1</p></blockquote>","replaceLine"),r("link",'<a href="http://">$1</a>'),r("image",'<img src="http://" alt="$1">');var n=function(e){if("html"==t.getCursorMode()){e=e||"ul";for(var r=t.editor,n=r.getDoc(),i=n.getCursor(!0),o=n.getCursor(!1),l=CodeMirror.innerMode(r.getMode(),r.getTokenAt(r.getCursor()).state),s=l&&l.state&&l.state.context&&["ul","ol"].indexOf(l.state.context.tagName)!=-1,a=i.line;a<o.line+1;a++)r.replaceRange("<li>"+r.getLine(a)+"</li>",{line:a,ch:0},{line:a,ch:r.getLine(a).length});s?r.setCursor({line:o.line,ch:r.getLine(o.line).length}):(r.replaceRange("<"+e+">\n"+r.getLine(i.line),{line:i.line,ch:0},{line:i.line,ch:r.getLine(i.line).length}),r.replaceRange(r.getLine(o.line+1)+"\n</"+e+">",{line:o.line+1,ch:0},{line:o.line+1,ch:r.getLine(o.line+1).length}),r.setCursor({line:o.line+1,ch:r.getLine(o.line+1).length})),r.focus()}};t.on("action.listUl",function(){n("ul")}),t.on("action.listOl",function(){n("ol")}),t.htmleditor.on("click",'a[data-htmleditor-button="fullscreen"]',function(){t.htmleditor.toggleClass("uk-htmleditor-fullscreen");var r=t.editor.getWrapperElement();if(t.htmleditor.hasClass("uk-htmleditor-fullscreen")){var n=!1,i=t.htmleditor.parents().each(function(){"fixed"!=e.$(this).css("position")||e.$(this).is("html")||(n=e.$(this))});if(t.htmleditor.data("fixedParents",!1),n){var o=[];n=n.parent().find(i).each(function(){"none"!=e.$(this).css("transform")&&o.push(e.$(this).data("transform-reset",{transform:this.style.transform,"-webkit-transform":this.style.webkitTransform,"-webkit-transition":this.style.webkitTransition,transition:this.style.transition}).css({transform:"none","-webkit-transform":"none","-webkit-transition":"none",transition:"none"}))}),t.htmleditor.data("fixedParents",o)}t.editor.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:r.style.width,height:r.style.height},r.style.width="",r.style.height=t.content.height()+"px",document.documentElement.style.overflow="hidden"}else{document.documentElement.style.overflow="";var l=t.editor.state.fullScreenRestore;r.style.width=l.width,r.style.height=l.height,window.scrollTo(l.scrollLeft,l.scrollTop),t.htmleditor.data("fixedParents")&&t.htmleditor.data("fixedParents").forEach(function(e){e.css(e.data("transform-reset"))})}setTimeout(function(){t.fit(),e.$win.trigger("resize")},50)}),t.addShortcut(["Ctrl-S","Cmd-S"],function(){t.element.trigger("htmleditor-save",[t])}),t.addShortcutAction("bold",["Ctrl-B","Cmd-B"])}}),e.plugin("htmleditor","markdown",{init:function(t){function r(){t.editor.setOption("mode","gfm"),t.htmleditor.find(".uk-htmleditor-button-code a").html(t.options.lblMarkedview)}function n(e,r,n){t.on("action."+e,function(){"markdown"==t.getCursorMode()&&t["replaceLine"==n?"replaceLine":"replaceSelection"](r)})}var i=t.options.mdparser||window.marked||null;i&&(t.options.markdown&&r(),n("bold","**$1**"),n("italic","*$1*"),n("strike","~~$1~~"),n("blockquote","> $1","replaceLine"),n("link","[$1](http://)"),n("image","![$1](http://)"),t.on("action.listUl",function(){if("markdown"==t.getCursorMode()){for(var e=t.editor,r=e.getDoc().getCursor(!0),n=e.getDoc().getCursor(!1),i=r.line;i<n.line+1;i++)e.replaceRange("* "+e.getLine(i),{line:i,ch:0},{line:i,ch:e.getLine(i).length});e.setCursor({line:n.line,ch:e.getLine(n.line).length}),e.focus()}}),t.on("action.listOl",function(){if("markdown"==t.getCursorMode()){var e=t.editor,r=e.getDoc().getCursor(!0),n=e.getDoc().getCursor(!1),i=1;if(r.line>0){var o,l=e.getLine(r.line-1);(o=l.match(/^(\d+)\./))&&(i=Number(o[1])+1)}for(var s=r.line;s<n.line+1;s++)e.replaceRange(i+". "+e.getLine(s),{line:s,ch:0},{line:s,ch:e.getLine(s).length}),i++;e.setCursor({line:n.line,ch:e.getLine(n.line).length}),e.focus()}}),t.on("renderLate",function(){"gfm"==t.editor.options.mode&&(t.currentvalue=i(t.currentvalue))}),t.on("cursorMode",function(e,r){if("gfm"==t.editor.options.mode){var n=t.editor.getDoc().getCursor();t.editor.getTokenAt(n).state.base.htmlState||(r.mode="markdown")}}),e.$.extend(t,{enableMarkdown:function(){r(),this.render()},disableMarkdown:function(){this.editor.setOption("mode","htmlmixed"),this.htmleditor.find(".uk-htmleditor-button-code a").html(this.options.lblCodeview),this.render()}}),t.on({enableMarkdown:function(){t.enableMarkdown()},disableMarkdown:function(){t.disableMarkdown()}}))}}),e.htmleditor});

Zerion Mini Shell 1.0