hedgedoc/public/vendor/codemirror/codemirror.min.js

17 lines
505 KiB
JavaScript
Raw Normal View History

!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(n,r){if(!(this instanceof e))return new e(n,r);this.options=r=r?Wi(r):{},Wi(ra,r,!1),p(r);var i=r.value;"string"==typeof i&&(i=new La(i,r.mode,null,r.lineSeparator)),this.doc=i;var o=new e.inputStyles[r.inputStyle](this),a=this.display=new t(n,i,o);a.wrapper.CodeMirror=this,c(this),s(this),r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),r.autofocus&&!Oo&&a.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 l=this;wo&&_o<11&&setTimeout(function(){l.display.input.reset(!0)},20),$t(this),Qi(),wt(this),this.curOp.forceUpdate=!0,Qr(this,i),r.autofocus&&!Oo||l.hasFocus()?setTimeout(Bi(bn,this),20):kn(this);for(var u in ia)ia.hasOwnProperty(u)&&ia[u](this,r[u],oa);w(this),r.finishInit&&r.finishInit(this);for(var f=0;f<ca.length;++f)ca[f](this);Ct(this),Co&&r.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function t(e,t,n){var r=this;this.input=n,r.scrollbarFiller=Ui("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=Ui("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=Ui("div",null,"CodeMirror-code"),r.selectionDiv=Ui("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=Ui("div",null,"CodeMirror-cursors"),r.measure=Ui("div",null,"CodeMirror-measure"),r.lineMeasure=Ui("div",null,"CodeMirror-measure"),r.lineSpace=Ui("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none"),r.mover=Ui("div",[Ui("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=Ui("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=Ui("div",null,null,"position: absolute; height: "+ja+"px; width: 1px;"),r.gutters=Ui("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=Ui("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=Ui("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),wo&&_o<8&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),Co||bo&&Oo||(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,n.init(r)}function n(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),r(t)}function r(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,We(e,100),e.state.modeGen++,e.curOp&&Rt(e)}function i(e){e.options.lineWrapping?(ts(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(es(e.display.wrapper,"CodeMirror-wrap"),d(e)),a(e),Rt(e),ct(e),setTimeout(function(){y(e)},100)}function o(e){var t=kt(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/xt(e.display)-3);return function(i){if(Cr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function a(e){var t=e.doc,n=o(e);t.iter(function(e){var t=n(e);t!=e.height&&ni(e,t)})}function s(e){e.d
t.hasHeights||(Ze(e,t.view,t.rect),t.hasHeights=!0),o=ot(e,t,n,r),o.bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function rt(e,t,n){for(var r,i,o,a,s=0;s<e.length;s+=3){var l=e[s],c=e[s+1];if(t<l?(i=0,o=1,a="left"):t<c?(i=t-l,o=i+1):(s==e.length-3||t==c&&e[s+3]>t)&&(o=c-l,i=o-1,t>=c&&(a="right")),null!=i){if(r=e[s+2],l==c&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)r=e[(s-=3)+2],a="left";if("right"==n&&i==c-l)for(;s<e.length-3&&e[s+3]==e[s+4]&&!e[s+5].insertLeft;)r=e[(s+=3)+2],a="right";break}}return{node:r,start:i,end:o,collapse:a,coverStart:l,coverEnd:c}}function it(e,t){var n=Vo;if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var r=e.length-1;r>=0&&(n=e[r]).left==n.right;r--);return n}function ot(e,t,n,r){var i,o=rt(t.map,n,r),a=o.node,s=o.start,l=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;u<4;u++){for(;s&&$i(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+l<o.coverEnd&&$i(t.line.text.charAt(o.coverStart+l));)++l;if(i=wo&&_o<9&&0==s&&l==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():it(Va(a,s,l).getClientRects(),r),i.left||i.right||0==s)break;l=s,s-=1,c="right"}wo&&_o<11&&(i=at(e.display.measure,i))}else{s>0&&(c=r="right");var f;i=e.options.lineWrapping&&(f=a.getClientRects()).length>1?f["right"==r?f.length-1:0]:a.getBoundingClientRect()}if(wo&&_o<9&&!s&&(!i||!i.left&&!i.right)){var d=a.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+xt(e.display),top:d.top,bottom:d.bottom}:Vo}for(var p=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(p+h)/2,g=t.view.measure.heights,u=0;u<g.length-1&&!(m<g[u]);u++);var v=u?g[u-1]:0,y=g[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=p,b.rbottom=h),b}function at(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!no(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function st(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 lt(e){e.display.externalMeasure=null,Ki(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)st(e.display.view[t])}function ct(e){lt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ut(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ft(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function dt(e,t,n,r){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=Lr(t.widgets[i]);n.top+=o,n.bottom+=o}if("line"==r)return n;r||(r="local");var a=oi(t);if("local"==r?a+=$e(e.display):a-=e.display.viewOffset,"page"==r||"window"==r){var s=e.display.lineSpace.getBoundingClientRect();a+=s.top+("window"==r?0:ft());var l=s.left+("window"==r?0:ut());n.left+=l,n.right+=l}return n.top+=a,n.bottom+=a,n}function pt(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=ut(),i-=ft();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function ht(e,t,n,r,i){return r||(r=Jr(e.doc,t.line)),dt(e,r,Je(e,r,t.ch,i),n)}function mt(e,t,n,r,i,o){function a(t,a){var s=nt(e,i,t,a?"right":"left",o);return a?s.left=s.right:s.right=s.left,dt(e,r,s,n)}function s(e,t){var n=l[t],r=n.level%2;return e==io(n)&&t&&n.level<l[t-1].level?(n=l[--t],e=oo(n)-(n.level%2?0:1),r=!0):e==oo(n)&&t<l.length-1&&n.level<l[t+1].level&&(n=l[++t],e=io(n)-n.level%2,r=!1),r&&e==n.to&&e>n.from?a(e-1):a(e,r)}r=r||Jr(e.doc,t.line),i||(i=tt(e,r));var l=ai(r),c=t.ch;if(!l)return a(c);var u=po(l,c),f=s(c,u);return null!=cs&&(f.other
if(n<s)c.scrollTop=f?0:n;else if(i>s+l){var p=Math.min(n,(d?u:i)-l);p!=s&&(c.scrollTop=p)}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ge(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=r-t>m;return g&&(r=t+m),t<10?c.scrollLeft=0:t<h?c.scrollLeft=Math.max(0,t-(g?0:10)):r>m+h-3&&(c.scrollLeft=r+(g?0:10)-m),c}function Dn(e,t,n){null==t&&null==n||Bn(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=n&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+n)}function Wn(e){Bn(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?Bo(t.line,t.ch-1):t,r=Bo(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function Bn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=gt(e,t.from),r=gt(e,t.to),i=jn(e,Math.min(n.left,r.left),Math.min(n.top,r.top)-t.margin,Math.max(n.right,r.right),Math.max(n.bottom,r.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Fn(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=He(e,t):n="prev");var a=e.options.tabSize,s=Jr(o,t),l=Ha(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&(c=o.mode.indent(i,s.text.slice(u.length),s.text),c==Da||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?Ha(Jr(o,t-1).text,null,a):0:"add"==n?c=l+e.options.indentUnit:"subtract"==n?c=l-e.options.indentUnit:"number"==typeof n&&(c=l+n),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var p=Math.floor(c/a);p;--p)d+=a,f+="\t";if(d<c&&(f+=Ii(c-d)),f!=u)return Nn(o,f,Bo(t,0),Bo(t,u.length),"+input"),s.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var h=o.sel.ranges[p];if(h.head.line==t&&h.head.ch<u.length){var d=Bo(t,u.length);_e(o,p,new de(d,d));break}}}function Hn(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=Jr(e,me(e,t)):i=ri(t),null==i?null:(r(o,i)&&e.cm&&jt(e.cm,i,n),o)}function $n(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=t(n[i]);r.length&&Fo(o.from,Ni(r).to)<=0;){var a=r.pop();if(Fo(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}zt(e,function(){for(var t=r.length-1;t>=0;t--)Nn(e.doc,"",r[t].from,r[t].to,"+delete");Wn(e)})}function Un(e,t,n,r,i){function o(){var t=s+n;return!(t<e.first||t>=e.first+e.size)&&(s=t,u=Jr(e,t))}function a(e){var t=(i?mo:go)(u,l,n,!0);if(null==t){if(e||!o())return!1;l=i?(n<0?so:ao)(u):n<0?u.text.length:0}else l=t;return!0}var s=t.line,l=t.ch,c=n,u=Jr(e,s);if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var f=null,d="group"==r,p=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(n<0)||a(!h);h=!1){var m=u.text.charAt(l)||"\n",g=Fi(m,p)?"w":d&&"\n"==m?"n":!d||/\s/.test(m)?null:"p";if(!d||h||g||(g="s"),f&&f!=g){n<0&&(n=1,a());break}if(g&&(f=g),n>0&&!a(!h))break}var v=Ie(e,Bo(s,l),t,c,!0);return Fo(t,v)||(v.hitSide=!0),v}function Kn(e,t,n,r){var i,o=e.doc,a=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),l=Math.max(s-.5*kt(e.display),3);i=(n>0?t.bottom:t.top)+n*l}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){var c=yt(e,a,i);if(!c.outside)break;if(n<0?i<=0:i>=o.height){c.hitSide=!0;break}i+=5*n}return c}function Vn(t,n,r,i){e.defaults[t]=n,r&&(ia[t]=i?function(e,t,n){n!=oa&&r(e,t,n)}:r)}function Gn(e){for(var t,n,r,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a<o.length-1;a++){var s=o[a];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))n=!0;else{if(!/^s(hift)$/i.test(s))throw new Error("Unrecognized modifier name: "+s);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function Xn(e){return"string"==typeof e?ha[e]:e}function Zn(e,t,n,r,i){if(r&&r.shared)return Yn(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Ot(e.cm,Zn)(e,t,n,r,i);var o=new ka(e,i),a=Fo(t,n);if(r&&Wi(r,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetN
{right:n?r:0,bottom:t?r: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=Io&&!Ao?"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 n(){var r=e.getBoundingClientRect(),i=document.elementFromPoint(r.left+1,r.bottom-1);i!=e?e.style.pointerEvents="none":t.set(1e3,n)}e.style.pointerEvents="auto",t.set(1e3,n)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=Wi({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={"native":m,"null":g},S.prototype.signal=function(e,t){Ei(e,t)&&this.events.push(arguments)},S.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Pa.apply(null,this.events[e])};var Bo=e.Pos=function(e,t){return this instanceof Bo?(this.line=e,void(this.ch=t)):new Bo(e,t)},Fo=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Ho=null;re.prototype=Wi({init:function(e){function t(e){if(!Ti(r,e)){if(r.somethingSelected())Ho={lineWise:!1,text:r.getSelections()},n.inaccurateSelection&&(n.prevInput="",n.inaccurateSelection=!1,o.value=Ho.text.join("\n"),Ka(o));else{if(!r.options.lineWiseCopyCut)return;var t=te(r);Ho={lineWise:!0,text:t.text},"cut"==e.type?r.setSelections(t.ranges,null,Wa):(n.prevInput="",o.value=t.text.join("\n"),Ka(o))}"cut"==e.type&&(r.state.cutIncoming=!0)}}var n=this,r=this.cm,i=this.wrapper=ie(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),zo&&(o.style.width="0px"),Ia(o,"input",function(){wo&&_o>=9&&n.hasSelection&&(n.hasSelection=null),n.poll()}),Ia(o,"paste",function(e){Ti(r,e)||J(e,r)||(r.state.pasteIncoming=!0,n.fastPoll())}),Ia(o,"cut",t),Ia(o,"copy",t),Ia(e.scroller,"paste",function(t){Vt(e,t)||Ti(r,t)||(r.state.pasteIncoming=!0,n.focus())}),Ia(e.lineSpace,"selectstart",function(t){Vt(e,t)||Ea(t)}),Ia(o,"compositionstart",function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ia(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,n=e.doc,r=Pe(e);if(e.options.moveInputWithCursor){var i=mt(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},showSelection:function(e){var t=this.cm,n=t.display;Vi(n.cursorDiv,e.cursors),Vi(n.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,n,r=this.cm,i=r.doc;if(r.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=as&&(o.to().line-o.from().line>100||(n=r.getSelection()).length>1e3);var a=t?"-":n||r.getSelection();this.composing||(this.textarea.value=a),r.state.focused&&Ka(this.textarea),wo&&_o>=9&&(this.hasSelection=a)}else e||(this.composing||(this.prevInput=this.textarea.value=""),wo&&_o>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Oo||Gi()!=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(
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=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=Ha(e.getLine(o.line),o.ch,r);t.push(Ii(r-a%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){zt(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i=t[r].head,o=Jr(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new Bo(i.line,i.ch-1)),i.ch>0)i=new Bo(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Bo(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Jr(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),Bo(i.line-1,a.length-1),Bo(i.line,1),"+transpose")}n.push(new de(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){zt(e,function(){for(var t=e.listSelections().length,n=0;n<t;n++){var r=e.listSelections()[n];e.replaceRange(e.doc.lineSeparator(),r.anchor,r.head,"+input"),e.indentLine(r.from().line+1,null,!0)}Wn(e)})},openLine:function(e){e.replaceSelection("\n","start")},toggleOverwrite:function(e){e.toggleOverwrite()}},ha=e.keyMap={};ha.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"},ha.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"},ha.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"},ha.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"]},ha["default"]=Io?ha.macDefault:ha.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=Pi(n.split(" "),Gn),o=0;o<i.length;o++){var a,s;o==i.length-1?(s=i.join(" "),a=r):(s=i.slice(0,o+1).join(" "),a="...");var l=t[s];if(l){if(l!=a)throw new Error("Inconsistent bindings for "+s)}else t[s]=a}delete e[n]}for(var c in t)e[c]=t[c];return e};var ma=e.lookupKey=function(e,t,n,r){t=Xn(t);var i=t.call?t.call(e,r):t[e];if(i===!1)retu
u.token[0]}return u.token&&u.token.join?u.token[0]:u.token}}return n.next(),null}}function a(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var n=0;for(var r in e)if(e.hasOwnProperty(r)){if(!t.hasOwnProperty(r)||!a(e[r],t[r]))return!1;n++}for(var r in t)t.hasOwnProperty(r)&&n--;return 0==n}function s(t,r,i,o){var s;if(i.persistent)for(var l=r.persistentStates;l&&!s;l=l.next)(i.spec?a(i.spec,l.spec):i.mode==l.mode)&&(s=l);var c=s?s.mode:i.mode||e.getMode(t,i.spec),u=s?s.state:e.startState(c);i.persistent&&!s&&(r.persistentStates={mode:c,spec:i.spec,state:u,next:r.persistentStates}),r.localState=u,r.local={mode:c,end:i.end&&n(i.end),endScan:i.end&&i.forceEnd!==!1&&n(i.end,!1),endToken:o&&o.join?o[o.length-1]:o}}function l(e,t){for(var n=0;n<t.length;n++)if(t[n]===e)return!0}function c(t,n){return function(r,i,o){if(r.local&&r.local.mode.indent)return r.local.mode.indent(r.localState,i,o);if(null==r.indent||r.local||n.dontIndentStates&&l(r.state,n.dontIndentStates)>-1)return e.Pass;var a=r.indent.length-1,s=t[r.state];e:for(;;){for(var c=0;c<s.length;c++){var u=s[c];if(u.data.dedent&&u.data.dedentIfLineStart!==!1){var f=u.regex.exec(i);if(f&&f[0]){a--,(u.next||u.push)&&(s=t[u.next||u.push]),i=i.slice(f[0].length);continue e}}}break}return a<0?0:r.indent[a]}}e.defineSimpleMode=function(t,n){e.defineMode(t,function(t){return e.simpleMode(t,n)})},e.simpleMode=function(n,r){t(r,"start");var a={},s=r.meta||{},l=!1;for(var u in r)if(u!=s&&r.hasOwnProperty(u))for(var f=a[u]=[],d=r[u],p=0;p<d.length;p++){var h=d[p];f.push(new i(h,r)),(h.indent||h.dedent)&&(l=!0)}var m={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:l?[]:null}},copyState:function(t){var n={state:t.state,pending:t.pending,local:t.local,localState:null,indent:t.indent&&t.indent.slice(0)};t.localState&&(n.localState=e.copyState(t.local.mode,t.localState)),t.stack&&(n.stack=t.stack.slice(0));for(var r=t.persistentStates;r;r=r.next)n.persistentStates={mode:r.mode,spec:r.spec,state:r.state==t.localState?n.localState:e.copyState(r.mode,r.state),next:n.persistentStates};return n},token:o(a,n),innerMode:function(e){return e.local&&{mode:e.local.mode,state:e.localState}},indent:c(a,s)};if(s)for(var g in s)s.hasOwnProperty(g)&&(m[g]=s[g]);return m}}),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.multiplexingMode=function(t){function n(e,t,n,r){if("string"==typeof t){var i=e.indexOf(t,n);return r&&i>-1?i+t.length:i}var o=t.exec(n?e.slice(n):e);return o?o.index+n+(r?o[0].length:0):-1}var r=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:e.startState(t),innerActive:null,inner:null}},copyState:function(n){return{outer:e.copyState(t,n.outer),innerActive:n.innerActive,inner:n.innerActive&&e.copyState(n.innerActive.mode,n.inner)}},token:function(i,o){if(o.innerActive){var a=o.innerActive,s=i.string;if(!a.close&&i.sol())return o.innerActive=o.inner=null,this.token(i,o);var l=a.close?n(s,a.close,i.pos,a.parseDelimiters):-1;if(l==i.pos&&!a.parseDelimiters)return i.match(a.close),o.innerActive=o.inner=null,a.delimStyle&&a.delimStyle+" "+a.delimStyle+"-close";l>-1&&(i.string=s.slice(0,l));var c=a.mode.token(i,o.inner);return l>-1&&(i.string=s),l==i.pos&&a.parseDelimiters&&(o.innerActive=o.inner=null),a.innerStyle&&(c=c?c+" "+a.innerStyle:a.innerStyle),c}for(var u=1/0,s=i.string,f=0;f<r.length;++f){var d=r[f],l=n(s,d.open,i.pos);if(l==i.pos)return d.parseDelimiters||i.match(d.open),o.innerActive=d,o.inner=e.startState(d.mode,t.indent?t.indent(o.outer,""):0),d.delimStyle&&d.delimStyle+" "+d.delimStyle+"-open";l!=-1&&l<u&&(u=l)}u!=1/0&&(i.string=s.slice(0,u));var p=t.token(i,o.outer);return u!=1/0&&(i.string=s),p},indent:function(n,r){var i=n.innerActive?n.innerActive.mode:t;return i.indent?i.indent(n.innerActive?n.inner:n.outer,r):e.Pass},blankLine:function(n){var i=n.innerActive?n.innerActive.mode:t;if(i.blankLine&&
}),o.closeOnBlur!==!1&&e.on(f,"blur",a)):(s=l.getElementsByTagName("button")[0])&&(e.on(s,"click",function(){a(),u.focus()}),o.closeOnBlur!==!1&&e.on(s,"blur",a),s.focus()),a}),e.defineExtension("openConfirm",function(r,i,o){function a(){c||(c=!0,s.parentNode.removeChild(s),u.focus())}n(this,null);var s=t(this,r,o&&o.bottom),l=s.getElementsByTagName("button"),c=!1,u=this,f=1;l[0].focus();for(var d=0;d<l.length;++d){var p=l[d];!function(t){e.on(p,"click",function(n){e.e_preventDefault(n),a(),t&&t(u)})}(i[d]),e.on(p,"blur",function(){--f,setTimeout(function(){f<=0&&a()},200)}),e.on(p,"focus",function(){++f})}}),e.defineExtension("openNotification",function(r,i){function o(){l||(l=!0,clearTimeout(a),s.parentNode.removeChild(s))}n(this,o);var a,s=t(this,r,i&&i.bottom),l=!1,c=i&&"undefined"!=typeof i.duration?i.duration:5e3;return e.on(s,"click",function(t){e.e_preventDefault(t),o()}),c&&(a=setTimeout(o,c)),o})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,r,i){var o=e.getLineHandle(t.line),l=t.ch-1,c=l>=0&&s[o.text.charAt(l)]||s[o.text.charAt(++l)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(r&&u>0!=(l==t.ch))return null;var f=e.getTokenTypeAt(a(t.line,l+1)),d=n(e,a(t.line,l+(u>0?1:0)),u,f||null,i);return null==d?null:{from:a(t.line,l),to:d&&d.pos,match:d&&d.ch==c.charAt(0),forward:u>0}}function n(e,t,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,l=i&&i.maxScanLines||1e3,c=[],u=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,f=n>0?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),d=t.line;d!=f;d+=n){var p=e.getLine(d);if(p){var h=n>0?0:p.length-1,m=n>0?p.length:-1;if(!(p.length>o))for(d==t.line&&(h=t.ch-(n<0?1:0));h!=m;h+=n){var g=p.charAt(h);if(u.test(g)&&(void 0===r||e.getTokenTypeAt(a(d,h+1))==r)){var v=s[g];if(">"==v.charAt(1)==n>0)c.push(g);else{if(!c.length)return{pos:a(d,h),ch:g};c.pop()}}}}}return d-n!=(n>0?e.lastLine():e.firstLine())&&null}function r(e,n,r){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,s=[],l=e.listSelections(),c=0;c<l.length;c++){var u=l[c].empty()&&t(e,l[c].head,!1,r);if(u&&e.getLine(u.from.line).length<=i){var f=u.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";s.push(e.markText(u.from,a(u.from.line,u.from.ch+1),{className:f})),u.to&&e.getLine(u.to.line).length<=i&&s.push(e.markText(u.to,a(u.to.line,u.to.ch+1),{className:f}))}}if(s.length){o&&e.state.focused&&e.focus();var d=function(){e.operation(function(){for(var e=0;e<s.length;e++)s[e].clear()})};if(!n)return d;setTimeout(d,800)}}function i(e){e.operation(function(){l&&(l(),l=null),l=r(e,!1,e.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),a=e.Pos,s={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;e.defineOption("matchBrackets",!1,function(t,n,r){r&&r!=e.Init&&(t.off("cursorActivity",i),l&&(l(),l=null)),n&&(t.state.matchBrackets="object"==typeof n?n:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){r(this,!0)}),e.defineExtension("findMatchingBracket",function(e,n,r){return t(this,e,n,r)}),e.defineExtension("scanForBracket",function(e,t,r,i){return n(this,e,t,r,i)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:f[t]}function n(e){return function(t){return s(t,e)}}function r(e){var t=e.state.closeBrackets;if(!t)return null;var n=e.getModeAt(e.getCursor());return n.closeBrackets||t}function i(n){var i=r(n);if(!i||n.getOption("disableInput"))return e.Pass;for(var o=t(i,"pairs"),a=n.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return e.Pass;var l=c(n,a[s].head);if(!l||o.indexOf(l)%2!=0)return e.Pass}for(var s=a.length-1;s>=0;s--){var u=a[s].head;n.replaceRange("",d(u.lin
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},n={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};e.defineMode("xml",function(r,i){function o(e,t){function n(n){return t.tokenize=n,n(e,t)}var r=e.next();if("<"==r)return e.eat("!")?e.eat("[")?e.match("CDATA[")?n(l("atom","]]>")):null:e.match("--")?n(l("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(c(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=l("meta","?>"),"meta"):(M=e.eat("/")?"closeTag":"openTag",t.tokenize=a,"tag bracket");if("&"==r){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 a(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=o,M=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return M="equals",null;if("<"==n){t.tokenize=o,t.state=p,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=s(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function s(e){var t=function(t,n){for(;!t.eol();)if(t.next()==e){n.tokenize=a;break}return"string"};return t.isInAttribute=!0,t}function l(e,t){return function(n,r){for(;!n.eol();){if(n.match(t)){r.tokenize=o;break}n.next()}return e}}function c(e){return function(t,n){for(var r;null!=(r=t.next());){if("<"==r)return n.tokenize=c(e+1),n.tokenize(t,n);if(">"==r){if(1==e){n.tokenize=o;break}return n.tokenize=c(e-1),n.tokenize(t,n)}}return"meta"}}function u(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n,(_.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function f(e){e.context&&(e.context=e.context.prev)}function d(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!_.contextGrabbers.hasOwnProperty(n)||!_.contextGrabbers[n].hasOwnProperty(t))return;f(e)}}function p(e,t,n){return"openTag"==e?(n.tagStart=t.column(),h):"closeTag"==e?m:p}function h(e,t,n){return"word"==e?(n.tagName=t.current(),L="tag",y):(L="error",h)}function m(e,t,n){if("word"==e){var r=t.current();return n.context&&n.context.tagName!=r&&_.implicitlyClosed.hasOwnProperty(n.context.tagName)&&f(n),n.context&&n.context.tagName==r||_.matchClosing===!1?(L="tag",g):(L="tag error",v)}return L="error",v}function g(e,t,n){return"endTag"!=e?(L="error",g):(f(n),p)}function v(e,t,n){return L="error",g(e,t,n)}function y(e,t,n){if("word"==e)return L="attribute",b;if("endTag"==e||"selfcloseTag"==e){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==e||_.autoSelfClosers.hasOwnProperty(r)?d(n,r):(d(n,r),n.context=new u(n,r,i==n.indented)),p}return L="error",y}function b(e,t,n){return"equals"==e?k:(_.allowMissing||(L="error"),y(e,t,n))}function k(e,t,n){return"string"==e?x:"word"==e&&_.allowUnquoted?(L="string",y):(L="error",y(e,t,n))}function x(e,t,n){return"string"==e?x:y(e,t,n)}var w=r.indentUnit,_={},C=i.htmlMode?t:n;for(var S in C)_[S]=C[S];for(var S in i)_[S]=i[S];var M,L;return o.isInText=!0,{startState:function(e){var t={tokenize:o,state:p,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;M=null;var n=t.tokenize(e,t);return(n||M)&&"comment"!=n&&(L=null,t.state=t.state(M||n,e,t),L&&(n="error"==L?n+" error":L)),n},indent:function(t,n,r){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!=a&&t.tokenize!=o)return r?r.match(/^(\s*)/)[0].length:0;if(t.tagName)return _.multilineTagIn
Me&&")"==s.type&&"stat"==s.prev.type&&(s=s.prev);var f=s.type,d=o==f;return"vardef"==f?s.indented+("operator"==t.lastType||","==t.lastType?s.info+1:0):"form"==f&&"{"==o?s.indented:"form"==f?s.indented+Se:"stat"==f?s.indented+(we(t,n)?Me||Se:0):"switch"!=s.info||d||0==r.doubleIndentSwitch?s.align?s.column+(d?0:1):s.indented+(d?0:Se):s.indented+(/^(?:case|default)\b/.test(n)?Se:2*Se)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Te?null:"/*",blockCommentEnd:Te?null:"*/",lineComment:Te?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Te?"json":"javascript",jsonldMode:Le,jsonMode:Te,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")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=!0;return t}function n(e,t){for(var n,r=!1;null!=(n=e.next());){if(r&&"/"==n){t.tokenize=null;break}r="*"==n}return["comment","comment"]}e.defineMode("css",function(t,n){function r(e,t){return h=t,e}function i(e,t){var n=e.next();if(v[n]){var i=v[n](e,t);if(i!==!1)return i}return"@"==n?(e.eatWhile(/[\w\\\-]/),r("def",e.current())):"="==n||("~"==n||"|"==n)&&e.eat("=")?r(null,"compare"):'"'==n||"'"==n?(t.tokenize=o(n),t.tokenize(e,t)):"#"==n?(e.eatWhile(/[\w\\\-]/),r("atom","hash")):"!"==n?(e.match(/^\s*\w*/),r("keyword","important")):/\d/.test(n)||"."==n&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),r("number","unit")):"-"!==n?/[,+>*\/]/.test(n)?r(null,"select-op"):"."==n&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?r("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(n)?r(null,n):"u"==n&&e.match(/rl(-prefix)?\(/)||"d"==n&&e.match("omain(")||"r"==n&&e.match("egexp(")?(e.backUp(1),t.tokenize=a,r("property","word")):/[\w\\\-]/.test(n)?(e.eatWhile(/[\w\\\-]/),r("property","word")):r(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),r("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?r("variable-2","variable-definition"):r("variable-2","variable")):e.match(/^\w+-/)?r("meta","meta"):void 0}function o(e){return function(t,n){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){")"==e&&t.backUp(1);break}o=!o&&"\\"==i}return(i==e||!o&&")"!=e)&&(n.tokenize=null),r("string","string")}}function a(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=o(")"),r(null,"(")}function s(e,t,n){this.type=e,this.indent=t,this.prev=n}function l(e,t,n,r){return e.context=new s(n,t.indentation()+(r===!1?0:g),e.context),n}function c(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function u(e,t,n){return E[n.context.type](e,t,n)}function f(e,t,n,r){for(var i=r||1;i>0;i--)n.context=n.context.prev;return u(e,t,n)}function d(e){var t=e.current().toLowerCase();m=L.hasOwnProperty(t)?"atom":M.hasOwnProperty(t)?"keyword":"variable"}var p=n.inline;n.propertyKeywords||(n=e.resolveMode("text/css"));var h,m,g=t.indentUnit,v=n.tokenHooks,y=n.documentTypes||{},b=n.mediaTypes||{},k=n.mediaFeatures||{},x=n.mediaValueKeywords||{},w=n.propertyKeywords||{},_=n.nonStandardPropertyKeywords||{},C=n.fontProperties||{},S=n.counterDescriptors||{},M=n.colorKeywords||{},L=n.valueKeywords||{},T=n.allowNested,A=n.supportsAtComponent===!0,E={};return E.top=function(e,t,n){if("{"==e)return l(n,t,"block");if("}"==e&&n.context.prev)return c
o=!0;break}if(e&&t.match('"""')){o=!0;break}r=t.next(),!i&&"$"==r&&t.match("{")&&t.skipTo("}"),i=!i&&"\\"==r&&!e}return!o&&e||(n.tokenize=null),"string"}}function y(e){return function(t,n){for(var r,i=!1,o=!1;!t.eol();){if(!i&&t.match('"')&&("single"==e||t.match('""'))){o=!0;break}if(!i&&t.match("``")){x=y(e),o=!0;break}r=t.next(),i="single"==e&&!i&&"\\"==r}return o&&(n.tokenize=null),"string"}}e.defineMode("clike",function(a,l){function c(e,t){var n=e.next();if(C[n]){var r=C[n](e,t);if(r!==!1)return r}if('"'==n||"'"==n)return t.tokenize=u(n),t.tokenize(e,t);if(A.test(n))return p=n,null;if(E.test(n)){if(e.backUp(1),e.match(z))return"number";e.next()}if("/"==n){if(e.eat("*"))return t.tokenize=f,f(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(O.test(n)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(O););return"operator"}if(e.eatWhile(/[\w\$_\xa1-\uffff]/),T)for(;e.match(T);)e.eatWhile(/[\w\$_\xa1-\uffff]/);var i=e.current();return s(y,i)?(s(x,i)&&(p="newstatement"),s(w,i)&&(h=!0),"keyword"):s(b,i)?"variable-3":s(k,i)?(s(x,i)&&(p="newstatement"),"builtin"):s(_,i)?"atom":"variable"}function u(e){return function(t,n){for(var r,i=!1,o=!1;null!=(r=t.next());){if(r==e&&!i){o=!0;break}i=!i&&"\\"==r}return(o||!i&&!S)&&(n.tokenize=null),"string"}}function f(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=null;break}r="*"==n}return"comment"}function d(e,t){l.typeFirstDefinitions&&e.eol()&&o(t.context)&&(t.typeAtEndOfLine=i(e,t,e.pos))}var p,h,m=a.indentUnit,g=l.statementIndentUnit||m,v=l.dontAlignCalls,y=l.keywords||{},b=l.types||{},k=l.builtin||{},x=l.blockKeywords||{},w=l.defKeywords||{},_=l.atoms||{},C=l.hooks||{},S=l.multiLineStrings,M=l.indentStatements!==!1,L=l.indentSwitch!==!1,T=l.namespaceSeparator,A=l.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,E=l.numberStart||/[\d\.]/,z=l.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,O=l.isOperatorChar||/[+\-*&%=<>!?|\/]/,I=l.endStatement||/^[;:,]$/;return{startState:function(e){return{tokenize:null,context:new t((e||0)-m,0,"top",null,(!1)),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var a=t.context;if(e.sol()&&(null==a.align&&(a.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return d(e,t),null;p=h=null;var s=(t.tokenize||c)(e,t);if("comment"==s||"meta"==s)return s;if(null==a.align&&(a.align=!0),I.test(p))for(;"statement"==t.context.type;)r(t);else if("{"==p)n(t,e.column(),"}");else if("["==p)n(t,e.column(),"]");else if("("==p)n(t,e.column(),")");else if("}"==p){for(;"statement"==a.type;)a=r(t);for("}"==a.type&&(a=r(t));"statement"==a.type;)a=r(t)}else p==a.type?r(t):M&&(("}"==a.type||"top"==a.type)&&";"!=p||"statement"==a.type&&"newstatement"==p)&&n(t,e.column(),"statement",e.current());if("variable"==s&&("def"==t.prevToken||l.typeFirstDefinitions&&i(e,t,e.start)&&o(t.context)&&e.match(/^\s*\(/,!1))&&(s="def"),C.token){var u=C.token(e,t,s);void 0!==u&&(s=u)}return"def"==s&&l.styleDefs===!1&&(s="variable"),t.startOfLine=!1,t.prevToken=h?"def":s||p,d(e,t),s},indent:function(t,n){if(t.tokenize!=c&&null!=t.tokenize||t.typeAtEndOfLine)return e.Pass;var r=t.context,i=n&&n.charAt(0);if("statement"==r.type&&"}"==i&&(r=r.prev),l.dontIndentStatements)for(;"statement"==r.type&&l.dontIndentStatements.test(r.info);)r=r.prev;if(C.indent){var o=C.indent(t,r,n);if("number"==typeof o)return o}var a=i==r.type,s=r.prev&&"switch"==r.prev.info;if(l.allmanIndentation&&/[{(]/.test(i)){for(;"top"!=r.type&&"}"!=r.type;)r=r.prev;return r.indented}return"statement"==r.type?r.indented+("{"==i?0:g):!r.align||v&&")"==r.type?")"!=r.type||a?r.indented+(a?0:m)+(a||!s||/^(?:case|default)\b/.test(n)?0:m):r.indented+g:r.column+(a?0:1)},electricInput:L?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var b="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",k="int long char short double float unsigned signed void size_t ptrdiff_t";m(["text/x-csrc","text/x-c","text/x-chdr"],{n
e.match(/^0o[0-7]+/i)&&(o=!0),e.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(e.eat(/J/i),o=!0),e.match(/^0(?![\dx])/i)&&(o=!0),o)return e.eat(/L/i),"number"}return e.match(M)?(t.tokenize=u(e.current()),t.tokenize(e,t)):e.match(b)||e.match(y)?"punctuation":e.match(v)||e.match(C)?"operator":e.match(g)?"punctuation":"."==t.lastToken&&e.match(S)?"property":e.match(L)||e.match(r)?"keyword":e.match(T)?"builtin":e.match(/^(self|cls)\b/)?"variable-2":e.match(S)?"def"==t.lastToken||"class"==t.lastToken?"def":"variable":(e.next(),m)}function u(e){function t(t,i){for(;!t.eol();)if(t.eatWhile(/[^'"\\]/),t.eat("\\")){if(t.next(),n&&t.eol())return r}else{if(t.match(e))return i.tokenize=l,r;t.eat(/['"]/)}if(n){if(s.singleLineStringErrors)return m;i.tokenize=l}return r}for(;"rubf".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var n=1==e.length,r="string";return t.isString=!0,t}function f(e){for(;"py"!=n(e).type;)e.scopes.pop();e.scopes.push({offset:n(e).offset+a.indentUnit,type:"py",align:null})}function d(e,t,n){var r=e.match(/^([\s\[\{\(]|#.*)*$/,!1)?null:e.column()+1;t.scopes.push({offset:t.indent+k,type:n,align:r})}function p(e,t){for(var r=e.indentation();t.scopes.length>1&&n(t).offset>r;){if("py"!=n(t).type)return!0;t.scopes.pop()}return n(t).offset!=r}function h(e,t){e.sol()&&(t.beginningOfLine=!0);var r=t.tokenize(e,t),i=e.current();if(t.beginningOfLine&&"@"==i)return e.match(S,!1)?"meta":_?"operator":m;/\S/.test(i)&&(t.beginningOfLine=!1),"variable"!=r&&"builtin"!=r||"meta"!=t.lastToken||(r="meta"),"pass"!=i&&"return"!=i||(t.dedent+=1),"lambda"==i&&(t.lambda=!0),":"!=i||t.lambda||"py"!=n(t).type||f(t);var o=1==i.length?"[({".indexOf(i):-1;if(o!=-1&&d(e,t,"])}".slice(o,o+1)),o="])}".indexOf(i),o!=-1){if(n(t).type!=i)return m;t.indent=t.scopes.pop().offset-k}return t.dedent>0&&e.eol()&&"py"==n(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),r}var m="error",g=s.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.]/,v=s.doubleOperators||/^([!<>]==|<>|<<|>>|\/\/|\*\*)/,y=s.doubleDelimiters||/^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/,b=s.tripleDelimiters||/^(\/\/=|>>=|<<=|\*\*=)/,k=s.hangingIndent||a.indentUnit,x=i,w=o;void 0!=s.extra_keywords&&(x=x.concat(s.extra_keywords)),void 0!=s.extra_builtins&&(w=w.concat(s.extra_builtins));var _=!(s.version&&Number(s.version)<3);if(_){var C=s.singleOperators||/^[\+\-\*\/%&|\^~<>!@]/,S=s.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;x=x.concat(["nonlocal","False","True","None","async","await"]),w=w.concat(["ascii","bytes","exec","print"]);var M=new RegExp("^(([rbuf]|(br))?('{3}|\"{3}|['\"]))","i")}else{var C=s.singleOperators||/^[\+\-\*\/%&|\^~<>!]/,S=s.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/;x=x.concat(["exec","print"]),w=w.concat(["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"]);var M=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var L=t(x),T=t(w),A={startState:function(e){return{tokenize:l,scopes:[{offset:e||0,type:"py",align:null}],indent:e||0,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=t.errorToken;n&&(t.errorToken=!1);var r=h(e,t);return r&&"comment"!=r&&(t.lastToken="keyword"==r||"punctuation"==r?e.current():r),"punctuation"==r&&(r=null),e.eol()&&t.lambda&&(t.lambda=!1),n?r+" "+m:r},indent:function(t,r){if(t.tokenize!=l)return t.tokenize.isString?e.Pass:0;var i=n(t),o=i.type==r.charAt(0);return null!=i.align?i.align-(o?1:0):i.offset-(o?k:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return A}),e.defineMIME("text/x-python","python");var a=function(e){return e.split(" ")};e.defineMIME("text/x-cython",{name:"python",extra_keywords:a("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("shell",function(){
atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":n,"`":t,"\\":r}}),e.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:i("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:i("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:i("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:i("commentSlashSlash decimallessFloat"),hooks:{}}),e.defineMIME("text/x-plsql",{name:"sql",client:i("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:i("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:i("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day
var i=t.next();return"$"===i?t.match(n)?"variable-2":"variable":r.continueString?(t.backUp(1),e(t,r)):t.match(/(\s+)?\w+\(/)||t.match(/(\s+)?\w+\ \(/)?(t.backUp(1),"def"):"#"==i?(t.skipToEnd(),"comment"):"'"==i||'"'==i?(r.pending=i,e(t,r)):"("==i||")"==i?"bracket":i.match(/[0-9]/)?"number":(t.eatWhile(/[\w-]/),null)}var n=/({)?[a-zA-Z0-9_]+(})?/;return{startState:function(){var e={};return e.inDefinition=!1,e.inInclude=!1,e.continueString=!1,e.pending=!1,e},token:function(e,n){return e.eatSpace()?null:t(e,n)}}}),e.defineMIME("text/x-cmake","cmake")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("nginx",function(e){function t(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function n(e,t){return s=t,e}function r(e,t){e.eatWhile(/[\w\$_]/);var r=e.current();if(l.propertyIsEnumerable(r))return"keyword";if(c.propertyIsEnumerable(r))return"variable-2";if(u.propertyIsEnumerable(r))return"string-2";var s=e.next();return"@"==s?(e.eatWhile(/[\w\\\-]/),n("meta",e.current())):"/"==s&&e.eat("*")?(t.tokenize=i,i(e,t)):"<"==s&&e.eat("!")?(t.tokenize=o,o(e,t)):"="!=s?"~"!=s&&"|"!=s||!e.eat("=")?'"'==s||"'"==s?(t.tokenize=a(s),t.tokenize(e,t)):"#"==s?(e.skipToEnd(),n("comment","comment")):"!"==s?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(s)?(e.eatWhile(/[\w.%]/),n("number","unit")):/[,.+>*\/]/.test(s)?n(null,"select-op"):/[;{}:\[\]]/.test(s)?n(null,s):(e.eatWhile(/[\w\\\-]/),n("variable","variable")):n(null,"compare"):void n(null,"compare")}function i(e,t){for(var i,o=!1;null!=(i=e.next());){if(o&&"/"==i){t.tokenize=r;break}o="*"==i}return n("comment","comment")}function o(e,t){for(var i,o=0;null!=(i=e.next());){if(o>=2&&">"==i){t.tokenize=r;break}o="-"==i?o+1:0}return n("comment","comment")}function a(e){return function(t,i){for(var o,a=!1;null!=(o=t.next())&&(o!=e||a);)a=!a&&"\\"==o;return a||(i.tokenize=r),n("string","string")}}var s,l=t("break return rewrite set accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fastcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_client_header_buffers limit_conn li
i("mw-template-delimiter",n)):t.match("}}")?(n.tokenize=n.stack.pop(),i("mw-template-bracket",n,"nTemplate")):E("mw-template","")(t,n)}}function m(e){return function(t,n){for(;e>0;)e--,t.next();return t.eol()?(n.nLink--,n.tokenize=n.stack.pop()):n.tokenize=g,i("mw-extlink-protocol",n)}}function g(e,t){return e.sol()?(t.nLink--,void(t.tokenize=t.stack.pop())):e.match(/[\s\u00a0]*\]/)?(t.tokenize=t.stack.pop(),i("mw-extlink-bracket",t,"nLink")):e.eatSpace()?(t.tokenize=v,r("",t)):e.match(/[^\s\u00a0\]\{\&~]+/)||e.eatSpace()?r("mw-extlink",t):E("mw-extlink","")(e,t)}function v(e,t){return e.sol()?(t.nLink--,void(t.tokenize=t.stack.pop())):e.eat("]")?(t.tokenize=t.stack.pop(),i("mw-extlink-bracket",t,"nLink")):e.match(/[^'\]\{\&~]+/)?r("mw-extlink-text",t):E("mw-extlink-text","")(e,t)}function y(e,t){return e.sol()?(t.nLink--,void(t.tokenize=t.stack.pop())):e.match(/[\s\u00a0]*#[\s\u00a0]*/)?(t.tokenize=b,i("mw-link",t)):e.match(/[\s\u00a0]*\|[\s\u00a0]*/)?(t.tokenize=k(),i("mw-link-delimiter",t)):e.match(/[\s\u00a0]*\]\]/)?(t.tokenize=t.stack.pop(),i("mw-link-bracket",t,"nLink")):e.match(/[\s\u00a0]*[^\s\u00a0#\|\]\&~\{]+/)||e.eatSpace()?r("mw-link-pagename mw-pagename",t):E("mw-link-pagename mw-pagename","mw-pagename")(e,t)}function b(e,t){return e.sol()?(t.nLink--,void(t.tokenize=t.stack.pop())):e.match(/[^\|\]\&~\{\}]+/)?i("mw-link-tosection",t):e.eat("|")?(t.tokenize=k(),i("mw-link-delimiter",t)):e.match("]]")?(t.tokenize=t.stack.pop(),i("mw-link-bracket",t,"nLink")):E("mw-link-tosection","")(e,t)}function k(){var e,t;return function(n,o){if(n.match("]]"))return o.tokenize=o.stack.pop(),i("mw-link-bracket",o,"nLink");if(n.match("'''"))return e=!e,i("mw-link-text mw-apostrophes",o);if(n.match("''"))return t=!t,i("mw-link-text mw-apostrophes",o);var a="mw-link-text";return e&&(a+=" strong"),t&&(a+=" em"),n.match(/[^'\]\{\&~]+/)?r(a,o):E(a,"")(n,o)}}function x(e,t,n){return function(r,o){for(var a="";e>0;)e--,a+=r.next();return r.eol()?(o.tokenize=o.stack.pop(),i(n?"mw-htmltag-name":"mw-exttag-name",o)):(r.eatSpace(),r.eol()?(o.tokenize=o.stack.pop(),i(n?"mw-htmltag-name":"mw-exttag-name",o)):n?(t?o.tokenize=s(">","mw-htmltag-bracket"):o.tokenize=w(a),i("mw-htmltag-name",o)):(t?o.tokenize=s(">","mw-exttag-bracket"):o.tokenize=_(a),i("mw-exttag-name",o)))}}function w(e){return function(t,n){return t.match(/[^>\/<\{\&~]+/)?i("mw-htmltag-attribute",n):t.eat(">")?(n.InHtmlTag.push(e),n.tokenize=n.stack.pop(),i("mw-htmltag-bracket",n)):t.match("/>")?(n.tokenize=n.stack.pop(),i("mw-htmltag-bracket",n)):E("mw-htmltag-attribute","")(t,n)}}function _(t){return function(r,o){return r.match(/[^>\/<\{\&~]+/)?i("mw-exttag-attribute",o):r.eat(">")?(o.extName=t,n.mwextMode&&t in n.mwextMode.tag&&(o.extMode=e.getMode(n,n.mwextMode.tag[t]),o.extState=e.startState(o.extMode)),o.tokenize=C(t),i("mw-exttag-bracket",o)):r.match("/>")?(o.tokenize=o.stack.pop(),i("mw-exttag-bracket",o)):E("mw-exttag-attribute","")(r,o)}}function C(e){return function(t,n){var r,i=!1,o=t.pos,a=new RegExp("</"+e+"\\s*>"),s=a.exec(o?t.string.slice(o):t.string);if(s){if(0===s.index)return n.tokenize=S(e),n.extName=!1,n.extMode!==!1&&(n.extMode=!1,n.extState=!1),n.tokenize(t,n);r=s.index+o,i=t.string,t.string=i.slice(0,r)}return n.stack.push(n.tokenize),n.tokenize=M(i),n.tokenize(t,n)}}function S(e){return function(t,n){return t.next(),t.next(),n.tokenize=x(e.length,!0,!1),i("mw-exttag-bracket",n)}}function M(e){return function(t,n){var r;return n.extMode===!1?(r=e===!1&&t.sol()?"line-cm-mw-exttag":"mw-exttag",t.skipToEnd()):(r=(e===!1&&t.sol()?"line-cm-mw-tag-":"mw-tag-")+n.extName,r+=" "+n.extMode.token(t,n.extState,e===!1)),t.eol()&&(e!==!1&&(t.string=e),n.tokenize=n.stack.pop()),i(r,n)}}function L(e,t){return e.sol()?(t.tokenize=T,T(e,t)):E("mw-table-definition","")(e,t)}function T(e,t){if(e.sol()){if(e.eat("|"))return e.eat("-")?(e.eatSpace(),t.tokenize=L,i("mw-table-delimiter",t)):e.eat("}")?(t.tokenize=t.stack.pop(),i("mw-table-bracket",t)):(e.eatSpace(),t.tokenize=A(!0,!1),i("mw-table-delimiter",t));if(e.eat("!"))return e.eatSpace(),t.tokenize=A(!0,!0),i("mw-
toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",actio
n&&(n.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog("(recording)["+t+"]",null,{bottom:!0})),this.isRecording=!0)}};var kt,xt,wt={buildKeyMap:function(){},getRegisterController:function(){return kt.registerController},resetVimGlobalState_:C,getVimGlobalState_:function(){return kt},maybeInitVimState_:_,suppressErrorLogging:!1,InsertModeKey:rt,map:function(e,t,n){Nt.map(e,t,n)},unmap:function(e,t){Nt.unmap(e,t)},setOption:k,getOption:x,defineOption:b,defineEx:function(e,t,n){if(t){if(0!==e.indexOf(t))throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered')}else t=e;It[e]=n,Nt.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,n){var r=this.findKey(e,t,n);if("function"==typeof r)return r()},findKey:function(n,r,i){function o(){var e=kt.macroModeState;if(e.isRecording){if("q"==r)return e.exitMacroRecordMode(),M(n),!0;"mapping"!=i&&Ze(e,r)}}function a(){if("<Esc>"==r)return M(n),f.visualMode?le(n):f.insertMode&&Ke(n),!0}function s(t){for(var i;t;)i=/<\w+-.+?>|<\w+>|./.exec(t),r=i[0],t=t.substring(i.index+r.length),e.Vim.handleKey(n,r,"mapping")}function l(){if(a())return!0;for(var e=f.inputState.keyBuffer=f.inputState.keyBuffer+r,i=1==r.length,o=_t.matchCommand(e,t,f.inputState,"insert");e.length>1&&"full"!=o.type;){var e=f.inputState.keyBuffer=e.slice(1),s=_t.matchCommand(e,t,f.inputState,"insert");"none"!=s.type&&(o=s)}if("none"==o.type)return M(n),!1;if("partial"==o.type)return xt&&window.clearTimeout(xt),xt=window.setTimeout(function(){f.insertMode&&f.inputState.keyBuffer&&M(n)},x("insertModeEscKeysTimeout")),!i;if(xt&&window.clearTimeout(xt),i){for(var l=n.listSelections(),c=0;c<l.length;c++){var u=l[c].head;n.replaceRange("",R(u,0,-(e.length-1)),u,"+input")}kt.macroModeState.lastInsertModeChanges.changes.pop()}return M(n),o.command}function c(){if(o()||a())return!0;var e=f.inputState.keyBuffer=f.inputState.keyBuffer+r;if(/^[1-9]\d*$/.test(e))return!0;var i=/^(\d*)(.*)$/.exec(e);if(!i)return M(n),!1;var s=f.visualMode?"visual":"normal",l=_t.matchCommand(i[2]||i[1],t,f.inputState,s);if("none"==l.type)return M(n),!1;if("partial"==l.type)return!0;f.inputState.keyBuffer="";var i=/^(\d*)(.*)$/.exec(e);return i[1]&&"0"!=i[1]&&f.inputState.pushRepeatDigit(i[1]),l.command}var u,f=_(n);return u=f.insertMode?l():c(),u===!1?void 0:u===!0?function(){return!0}:function(){return n.operation(function(){n.curOp.isVimOp=!0;try{"keyToKey"==u.type?s(u.toKeys):_t.processCommand(n,f,u)}catch(t){throw n.state.vim=void 0,_(n),e.Vim.suppressErrorLogging||console.log(t),t}return!0})}},handleEx:function(e,t){Nt.processCommand(e,t)},defineMotion:z,defineAction:N,defineOperator:I,mapCommand:Ge,_mapCommand:Ve,defineRegister:T,exitVisualMode:le,exitInsertMode:Ke};S.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},S.prototype.getRepeat=function(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(""),10))),e},L.prototype={setText:function(e,t,n){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!n},pushText:function(e,t){t&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(bt(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},A.prototype={pushText:function(e,t,n,r,i){r&&"\n"==n.charAt(0)&&(n=n.slice(1)+"\n"),r&&"\n"!==n.charAt(n.length-1)&&(n+="\n");var o=this.isValidRegister(e)?this.getRegister(e):null;if(!o){switch(t){case"yank":this.registers[0]=new L(n,r,i);break;case"delete":case"change":n.indexOf("\n")==-1?this.registers["-"]=new L(n,r):(this.shiftNumericRegisters_(),this.registers[1]=new L(n,r))}return void this.unnamedRegister.setText(n,r,i
scope:"local"},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:"global"},this.set(e,t)},registers:function(e,t){var n=t.args,r=kt.registerController.registers,i="----------Registers----------<br><br>";if(n){var o;n=n.join("");for(var a=0;a<n.length;a++)if(o=n.charAt(a),kt.registerController.isValidRegister(o)){var s=r[o]||new L;i+='"'+o+" "+s.toString()+"<br>"}}else for(var o in r){var l=r[o].toString();l.length&&(i+='"'+o+" "+l+"<br>")}Ne(e,i)},sort:function(t,n){function i(){if(n.argString){var t=new e.StringStream(n.argString);if(t.eat("!")&&(a=!0),t.eol())return;if(!t.eatSpace())return"Invalid arguments";var r=t.match(/[a-z]+/);if(r){r=r[0],s=r.indexOf("i")!=-1,l=r.indexOf("u")!=-1;var i=r.indexOf("d")!=-1&&1,o=r.indexOf("x")!=-1&&1,u=r.indexOf("o")!=-1&&1;if(i+o+u>1)return"Invalid arguments";c=i&&"decimal"||o&&"hex"||u&&"octal"}if(t.match(/\/.*\//))return"patterns not supported"}}function o(e,t){if(a){var n;n=e,e=t,t=n}s&&(e=e.toLowerCase(),t=t.toLowerCase());var r=c&&g.exec(e),i=c&&g.exec(t);return r?(r=parseInt((r[1]+r[2]).toLowerCase(),v),i=parseInt((i[1]+i[2]).toLowerCase(),v),r-i):e<t?-1:1}var a,s,l,c,u=i();if(u)return void Ne(t,u+": "+n.argString);var f=n.line||t.firstLine(),d=n.lineEnd||n.line||t.lastLine();if(f!=d){var p=r(f,0),h=r(d,X(t,d)),m=t.getRange(p,h).split("\n"),g="decimal"==c?/(-?)([\d]+)/:"hex"==c?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==c?/([0-7]+)/:null,v="decimal"==c?10:"hex"==c?16:"octal"==c?8:null,y=[],b=[];if(c)for(var k=0;k<m.length;k++)g.exec(m[k])?y.push(m[k]):b.push(m[k]);else b=m;if(y.sort(o),b.sort(o),m=a?y.concat(b):b.concat(y),l){var x,w=m;m=[];for(var k=0;k<w.length;k++)w[k]!=x&&m.push(w[k]),x=w[k]}t.replaceRange(m.join("\n"),p,h)}},global:function(e,t){var n=t.argString;if(!n)return void Ne(e,"Regular Expression missing from global");var r,i=void 0!==t.line?t.line:e.firstLine(),o=t.lineEnd||t.line||e.lastLine(),a=Te(n),s=n;if(a.length&&(s=a[0],r=a.slice(1,a.length).join("/")),s)try{je(e,s,!0,!0)}catch(l){return void Ne(e,"Invalid regex: "+s)}for(var c=Me(e).getQuery(),u=[],f="",d=i;d<=o;d++){var p=c.test(e.getLine(d));p&&(u.push(d+1),f+=e.getLine(d)+"<br>")}if(!r)return void Ne(e,f);var h=0,m=function(){if(h<u.length){var t=u[h]+r;Nt.processCommand(e,t,{callback:m})}h++};m()},substitute:function(e,t){if(!e.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var n,i,o,a,s=t.argString,l=s?Te(s):[],c="",u=!1,f=!1;if(l.length)n=l[0],c=l[1],void 0!==c&&(c=x("pcre")?Oe(c):ze(c),kt.lastSubstituteReplacePart=c),i=l[2]?l[2].split(" "):[];else if(s&&s.length)return void Ne(e,"Substitutions should be of the form :s/pattern/replace/");if(i&&(o=i[0],a=parseInt(i[1]),o&&(o.indexOf("c")!=-1&&(u=!0,o.replace("c","")),o.indexOf("g")!=-1&&(f=!0,o.replace("g","")),n=n+"/"+o)),n)try{je(e,n,!0,!0)}catch(d){return void Ne(e,"Invalid regex: "+n)}if(c=c||kt.lastSubstituteReplacePart,void 0===c)return void Ne(e,"No previous substitute regular expression");var p=Me(e),h=p.getQuery(),m=void 0!==t.line?t.line:e.getCursor().line,g=t.lineEnd||m;m==e.firstLine()&&g==e.lastLine()&&(g=1/0),a&&(m=g,g=m+a-1);var v=q(e,r(m,0)),y=e.getSearchCursor(h,v);Ue(e,u,f,m,g,y,h,c,t.callback)},redo:e.commands.redo,undo:e.commands.undo,write:function(t){e.commands.save?e.commands.save(t):t.save&&t.save()},nohlsearch:function(e){Fe(e)},yank:function(e){var t=H(e.getCursor()),n=t.line,r=e.getLine(n);kt.registerController.pushText("0","yank",r,!0,!0)},delmarks:function(t,n){if(!n.argString||!Z(n.argString))return void Ne(t,"Argument required");for(var r=t.state.vim,i=new e.StringStream(Z(n.argString));!i.eol();){i.eatSpace();var o=i.pos;if(!i.match(/[a-zA-Z]/,!1))return void Ne(t,"Invalid argument: "+n.argString.substring(o));var a=i.next();if(i.match("-",!0)){if(!i.match(/[a-zA-Z]/,!1))return void Ne(t,"Invalid argument: "+n.argString.substring(o));var s=a,l=i.next();if(!(p(s)&&p(l)||g(s)&&g(l)))return void Ne(t,"Invalid argument: "+s+"-");var c=s.charCodeAt(0),u=l.charCodeAt(0);if(c>=u)return void Ne(t,"Invalid argument: "+n.argString.subst