HackMD/public/vendor/codemirror/codemirror.min.js

23 lines
487 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(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?ji(n):{},ji(ta,n,!1),p(n);var i=n.value;"string"==typeof i&&(i=new Sa(i,n.mode,null,n.lineSeparator)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),a=this.display=new t(r,i,o);a.wrapper.CodeMirror=this,c(this),s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!Eo&&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;ko&&11>xo&&setTimeout(function(){l.display.input.reset(!0)},20),Ht(this),Zi(),xt(this),this.curOp.forceUpdate=!0,Yn(this,i),n.autofocus&&!Eo||l.hasFocus()?setTimeout(Di(vr,this),20):yr(this);for(var u in ra)ra.hasOwnProperty(u)&&ra[u](this,n[u],na);w(this),n.finishInit&&n.finishInit(this);for(var d=0;d<sa.length;++d)sa[d](this);_t(this),wo&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function t(e,t,r){var n=this;this.input=r,n.scrollbarFiller=Hi("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=Hi("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=Hi("div",null,"CodeMirror-code"),n.selectionDiv=Hi("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=Hi("div",null,"CodeMirror-cursors"),n.measure=Hi("div",null,"CodeMirror-measure"),n.lineMeasure=Hi("div",null,"CodeMirror-measure"),n.lineSpace=Hi("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=Hi("div",[Hi("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=Hi("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=Hi("div",null,null,"position: absolute; height: "+Pa+"px; width: 1px;"),n.gutters=Hi("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=Hi("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=Hi("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),ko&&8>xo&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),wo||vo&&Eo||(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,Be(e,100),e.state.modeGen++,e.curOp&&Pt(e)}function i(e){e.options.lineWrapping?(Ja(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Qa(e.display.wrapper,"CodeMirror-wrap"),f(e)),a(e),Pt(e),lt(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/kt(e.display)-3);return function(i){if(_n(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 r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function a(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.d
o=it(e,t,r,n),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 nt(e,t,r){for(var n,i,o,a,s=0;s<e.length;s+=3){var l=e[s],c=e[s+1];if(l>t?(i=0,o=1,a="left"):c>t?(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(n=e[s+2],l==c&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)n=e[(s-=3)+2],a="left";if("right"==r&&i==c-l)for(;s<e.length-3&&e[s+3]==e[s+4]&&!e[s+5].insertLeft;)n=e[(s+=3)+2],a="right";break}}return{node:n,start:i,end:o,collapse:a,coverStart:l,coverEnd:c}}function it(e,t,r,n){var i,o=nt(t.map,r,n),a=o.node,s=o.start,l=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;4>u;u++){for(;s&&Fi(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+l<o.coverEnd&&Fi(t.line.text.charAt(o.coverStart+l));)++l;if(ko&&9>xo&&0==s&&l==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(ko&&e.options.lineWrapping){var d=Ua(a,s,l).getClientRects();i=d.length?d["right"==n?d.length-1:0]:Uo}else i=Ua(a,s,l).getBoundingClientRect()||Uo;if(i.left||i.right||0==s)break;l=s,s-=1,c="right"}ko&&11>xo&&(i=ot(e.display.measure,i))}else{s>0&&(c=n="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(ko&&9>xo&&!s&&(!i||!i.left&&!i.right)){var f=a.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+kt(e.display),top:f.top,bottom:f.bottom}:Uo}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 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 at(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,$i(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)at(e.display.view[t])}function lt(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 dt(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=Mn(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=ii(t);if("local"==n?a+=$e(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();a+=s.top+("window"==n?0:ut());var l=s.left+("window"==n?0:ct());r.left+=l,r.right+=l}return r.top+=a,r.bottom+=a,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 a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function pt(e,t,r,n,i){return n||(n=Qn(e.doc,t.line)),dt(e,n,Je(e,n,t.ch,i),r)}function ht(e,t,r,n,i,o){function a(t,a){var s=rt(e,i,t,a?"right":"left",o);return a?s.left=s.right:s.right=s.left,dt(e,n,s,r)}function s(e,t){var r=l[t],n=r.level%2;return e==ro(r)&&t&&r.level<l[t-1].level?(r=l[--t],e=no(r)-(r.level%2?0:1),n=!0):e==no(r)&&t<l.length-1&&r.level<l[t+1].level&&(r=l[++t],e=ro(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?a(e-1):a(e,n)}n=n||Qn(e.doc,t.line),i||(i=tt(e,n));var l=oi(n),c=t.ch;if(!l)return a(c);var u=uo(l,c),d=s(c,u);return null!=ss&&(d.other=s(c,ss)),d}function mt(e,t){var r=0,t=ge(e.doc,t);e.options.lineWrapping||(r=kt(e.disp
c}function Rr(e,t,r){(null!=t||null!=r)&&Dr(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 jr(e){Dr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Do(t.line,t.ch-1):t,n=Do(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Dr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=mt(e,t.from),n=mt(e,t.to),i=Pr(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 Br(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=He(e,t):r="prev");var a=e.options.tabSize,s=Qn(o,t),l=Wa(s.text,null,a);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==Ra||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?Wa(Qn(o,t-1).text,null,a):0:"add"==r?c=l+e.options.indentUnit:"subtract"==r?c=l-e.options.indentUnit:"number"==typeof r&&(c=l+r),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var p=Math.floor(c/a);p;--p)f+=a,d+=" ";if(c>f&&(d+=zi(c-f)),d!=u)return zr(o,d,Do(t,0),Do(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 f=Do(t,u.length);_e(o,p,new fe(f,f));break}}}function Wr(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Qn(e,me(e,t)):i=ri(t),null==i?null:(n(o,i)&&e.cm&&Rt(e.cm,i,r),o)}function Fr(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&Bo(o.from,Ii(n).to)<=0;){var a=n.pop();if(Bo(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}Et(e,function(){for(var t=n.length-1;t>=0;t--)zr(e.doc,"",n[t].from,n[t].to,"+delete");jr(e)})}function Hr(e,t,r,n,i){function o(){var t=s+r;return t<e.first||t>=e.first+e.size?!1:(s=t,u=Qn(e,t))}function a(e){var t=(i?po:ho)(u,l,r,!0);if(null==t){if(e||!o())return!1;l=i?(0>r?oo:io)(u):0>r?u.text.length:0}else l=t;return!0}var s=t.line,l=t.ch,c=r,u=Qn(e,s);if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var d=null,f="group"==n,p=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(0>r)||a(!h);h=!1){var m=u.text.charAt(l)||"\n",g=Bi(m,p)?"w":f&&"\n"==m?"n":!f||/\s/.test(m)?null:"p";if(!f||h||g||(g="s"),d&&d!=g){0>r&&(r=1,a());break}if(g&&(d=g),r>0&&!a(!h))break}var v=Ie(e,Do(s,l),t,c,!0);return Bo(t,v)||(v.hitSide=!0),v}function $r(e,t,r,n){var i,o=e.doc,a=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(s-(0>r?1.5:.5)*bt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var l=vt(e,a,i);if(!l.outside)break;if(0>r?0>=i:i>=o.height){l.hitSide=!0;break}i+=5*r}return l}function Ur(t,r,n,i){e.defaults[t]=r,n&&(ra[t]=i?function(e,t,r){r!=na&&n(e,t,r)}:n)}function Kr(e){for(var t,r,n,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))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 Vr(e){return"string"==typeof e?fa[e]:e}function Gr(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,Gr)(e,t,r,n,i);var o=new ya(e,i),a=Bo(t,r);if(n&&ji(n,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Hi("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");jo=!0}o.addToHistory&&ui(e,{from:t,to:r,ori
2015-05-04 07:53:29 +00:00
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)}},m.prototype),g.prototype=ji({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){Ai(e,t)&&this.events.push(arguments)},S.prototype.finish=function(){for(var e=0;e<this.events.length;e++)qa.apply(null,this.events[e])};var Do=e.Pos=function(e,t){return this instanceof Do?(this.line=e,void(this.ch=t)):new Do(e,t)},Bo=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Wo=null;ne.prototype=ji({init:function(e){function t(e){if(!Li(n,e)){if(n.somethingSelected())Wo={lineWise:!1,text:n.getSelections()},r.inaccurateSelection&&(r.prevInput="",r.inaccurateSelection=!1,o.value=Wo.text.join("\n"),$a(o));else{if(!n.options.lineWiseCopyCut)return;var t=te(n);Wo={lineWise:!0,text:t.text},"cut"==e.type?n.setSelections(t.ranges,null,ja):(r.prevInput="",o.value=t.text.join("\n"),$a(o))}"cut"==e.type&&(n.state.cutIncoming=!0)}}var r=this,n=this.cm,i=this.wrapper=ie(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),Ao&&(o.style.width="0px"),Oa(o,"input",function(){ko&&xo>=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),Oa(o,"paste",function(e){Li(n,e)||J(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),Oa(o,"cut",t),Oa(o,"copy",t),Oa(e.scroller,"paste",function(t){Kt(e,t)||Li(n,t)||(n.state.pasteIncoming=!0,r.focus())}),Oa(e.lineSpace,"selectstart",function(t){Kt(e,t)||Ta(t)}),Oa(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"})}}),Oa(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=Pe(e);if(e.options.moveInputWithCursor){var i=ht(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.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 a=t?"-":r||n.getSelection();this.composing||(this.textarea.value=a),n.state.focused&&$a(this.textarea),ko&&xo>=9&&(this.hasSelection=a)}else e||(this.composing||(this.prevInput=this.textarea.value=""),ko&&xo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Eo||Ki()!=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(ko&&xo>=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(
for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange(e.doc.lineSeparator(),n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0)}jr(e)})},openLine:function(e){e.replaceSelection("\n","start")},toggleOverwrite:function(e){e.toggleOverwrite()}},fa=e.keyMap={};fa.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"},fa.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"},fa.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"},fa.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"]},fa["default"]=Oo?fa.macDefault:fa.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=Ni(r.split(" "),Kr),o=0;o<i.length;o++){var a,s;o==i.length-1?(s=i.join(" "),a=n):(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[r]}for(var c in t)e[c]=t[c];return e};var pa=e.lookupKey=function(e,t,r,n){t=Vr(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 pa(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=pa(e,t.fallthrough[o],r,n);if(a)return a}}},ha=e.isModifierKey=function(e){var t="string"==typeof e?e:as[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},ma=e.keyName=function(e,t){if(So&&34==e.keyCode&&e["char"])return!1;var r=as[e.keyCode],n=r;return null==n||e.altGraphKey?!1:(e.altKey&&"Alt"!=r&&(n="Alt-"+n),(No?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(n="Ctrl-"+n),(No?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?ji(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=Ki();r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Oa(t.form,"submi
2015-05-04 07:53:29 +00:00
2016-06-01 06:37:28 +00:00
var a=n.indent.length-1,s=t[n.state];e:for(;;){for(var c=0;c<s.length;c++){var u=s[c];if(u.data.dedent&&u.data.dedentIfLineStart!==!1){var d=u.regex.exec(i);if(d&&d[0]){a--,(u.next||u.push)&&(s=t[u.next||u.push]),i=i.slice(d[0].length);continue e}}}break}return 0>a?0:n.indent[a]}}e.defineSimpleMode=function(t,r){e.defineMode(t,function(t){return e.simpleMode(t,r)})},e.simpleMode=function(r,n){t(n,"start");var a={},s=n.meta||{},l=!1;for(var u in n)if(u!=s&&n.hasOwnProperty(u))for(var d=a[u]=[],f=n[u],p=0;p<f.length;p++){var h=f[p];d.push(new i(h,n)),(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 r={state:t.state,pending:t.pending,local:t.local,localState:null,indent:t.indent&&t.indent.slice(0)};t.localState&&(r.localState=e.copyState(t.local.mode,t.localState)),t.stack&&(r.stack=t.stack.slice(0));for(var n=t.persistentStates;n;n=n.next)r.persistentStates={mode:n.mode,spec:n.spec,state:n.state==t.localState?r.localState:e.copyState(n.mode,n.state),next:r.persistentStates};return r},token:o(a,r),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 r(e,t,r,n){if("string"==typeof t){var i=e.indexOf(t,r);return n&&i>-1?i+t.length:i}var o=t.exec(r?e.slice(r):e);return o?o.index+r+(n?o[0].length:0):-1}var n=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:e.startState(t),innerActive:null,inner:null}},copyState:function(r){return{outer:e.copyState(t,r.outer),innerActive:r.innerActive,inner:r.innerActive&&e.copyState(r.innerActive.mode,r.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?r(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,d=0;d<n.length;++d){var f=n[d],l=r(s,f.open,i.pos);if(l==i.pos)return f.parseDelimiters||i.match(f.open),o.innerActive=f,o.inner=e.startState(f.mode,t.indent?t.indent(o.outer,""):0),f.delimStyle&&f.delimStyle+" "+f.delimStyle+"-open";-1!=l&&u>l&&(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(r,n){var i=r.innerActive?r.innerActive.mode:t;return i.indent?i.indent(r.innerActive?r.inner:r.outer,n):e.Pass},blankLine:function(r){var i=r.innerActive?r.innerActive.mode:t;if(i.blankLine&&i.blankLine(r.innerActive?r.inner:r.outer),r.innerActive)"\n"===r.innerActive.close&&(r.innerActive=r.inner=null);else for(var o=0;o<n.length;++o){var a=n[o];"\n"===a.open&&(r.innerActive=a,r.inner=e.startState(a.mode,i.indent?i.indent(r.outer,""):0))}},electricChars:t.electricChars,innerMode:function(e){return e.inner?{state:e.inner,mode:e.innerActive.mode}:{state:e.outer,mode:t}}}}}),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=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",o),e.removeLineClass(e.state.activeLines[t],"background",a),e.removeLineClass(e.state.activeLines[t],"gutter",s)}function r(e,t){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function n(e,n){for(var i=[],l=0;l<n.length;l++){var c=n[l];if(c.empty()){var u=e.getLineHandleVisualSta
var p=e.getLine(f);if(p){var h=r>0?0:p.length-1,m=r>0?p.length:-1;if(!(p.length>o))for(f==t.line&&(h=t.ch-(0>r?1:0));h!=m;h+=r){var g=p.charAt(h);if(u.test(g)&&(void 0===n||e.getTokenTypeAt(a(f,h+1))==n)){var v=s[g];if(">"==v.charAt(1)==r>0)c.push(g);else{if(!c.length)return{pos:a(f,h),ch:g};c.pop()}}}}}return f-r==(r>0?e.lastLine():e.firstLine())?!1:null}function n(e,r,n){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,n);if(u&&e.getLine(u.from.line).length<=i){var d=u.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";s.push(e.markText(u.from,a(u.from.line,u.from.ch+1),{className:d})),u.to&&e.getLine(u.to.line).length<=i&&s.push(e.markText(u.to,a(u.to.line,u.to.ch+1),{className:d}))}}if(s.length){o&&e.state.focused&&e.focus();var f=function(){e.operation(function(){for(var e=0;e<s.length;e++)s[e].clear()})};if(!r)return f;setTimeout(f,800)}}function i(e){e.operation(function(){l&&(l(),l=null),l=n(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,r,n){n&&n!=e.Init&&t.off("cursorActivity",i),r&&(t.state.matchBrackets="object"==typeof r?r:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){n(this,!0)}),e.defineExtension("findMatchingBracket",function(e,r,n){return t(this,e,r,n)}),e.defineExtension("scanForBracket",function(e,t,n,i){return r(this,e,t,n,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]:d[t]}function r(e){return function(t){return s(t,e)}}function n(e){var t=e.state.closeBrackets;if(!t)return null;var r=e.getModeAt(e.getCursor());return r.closeBrackets||t}function i(r){var i=n(r);if(!i||r.getOption("disableInput"))return e.Pass;for(var o=t(i,"pairs"),a=r.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return e.Pass;var l=c(r,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;r.replaceRange("",f(u.line,u.ch-1),f(u.line,u.ch+1),"+delete")}}function o(r){var i=n(r),o=i&&t(i,"explode");if(!o||r.getOption("disableInput"))return e.Pass;for(var a=r.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return e.Pass;var l=c(r,a[s].head);if(!l||o.indexOf(l)%2!=0)return e.Pass}r.operation(function(){r.replaceSelection("\n\n",null),r.execCommand("goCharLeft"),a=r.listSelections();for(var e=0;e<a.length;e++){var t=a[e].head.line;r.indentLine(t,null,!0),r.indentLine(t+1,null,!0)}})}function a(t){var r=e.cmpPos(t.anchor,t.head)>0;return{anchor:new f(t.anchor.line,t.anchor.ch+(r?-1:1)),head:new f(t.head.line,t.head.ch+(r?1:-1))}}function s(r,i){var o=n(r);if(!o||r.getOption("disableInput"))return e.Pass;var s=t(o,"pairs"),c=s.indexOf(i);if(-1==c)return e.Pass;for(var d,p=t(o,"triples"),h=s.charAt(c+1)==i,m=r.listSelections(),g=c%2==0,v=0;v<m.length;v++){var y,b=m[v],k=b.head,x=r.getRange(k,f(k.line,k.ch+1));if(g&&!b.empty())y="surround";else if(!h&&g||x!=i)if(h&&k.ch>1&&p.indexOf(i)>=0&&r.getRange(f(k.line,k.ch-2),k)==i+i&&(k.ch<=2||r.getRange(f(k.line,k.ch-3),f(k.line,k.ch-2))!=i))y="addFour";else if(h){if(e.isWordChar(x)||!u(r,k,i))return e.Pass;y="both"}else{if(!g||r.getLine(k.line).length!=k.ch&&!l(x,s)&&!/\s/.test(x))return e.Pass;y="both"}else y=p.indexOf(i)>=0&&r.getRange(k,f(k.line,k.ch+3))==i+i+i?"skipThree":"skip";if(d){if(d!=y)return e.Pass}else d=y}var w=c%2?s.charAt(c-1):i,_=c%2?i:s.charAt(c+1);r.operation(function(){if("skip"==d)r.execCommand("goCharRight");else if("skipThree"==d)for(var e=0;3>e;e++)r.execCommand("goCharRight");else if("surround"==d){for(var t=r.getSelections(),e=0;e<t.length;e++)t[e]=w+t[e]+_;r.replaceSelections(t,"around"),t=r.listSelections().slice();for(var e=0;e<t.length
}}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 d(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;d(e)}}function p(e,t,r){return"openTag"==e?(r.tagStart=t.column(),h):"closeTag"==e?m:p}function h(e,t,r){return"word"==e?(r.tagName=t.current(),L="tag",y):(L="error",h)}function m(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&_.implicitlyClosed.hasOwnProperty(r.context.tagName)&&d(r),r.context&&r.context.tagName==n||_.matchClosing===!1?(L="tag",g):(L="tag error",v)}return L="error",v}function g(e,t,r){return"endTag"!=e?(L="error",g):(d(r),p)}function v(e,t,r){return L="error",g(e,t,r)}function y(e,t,r){if("word"==e)return L="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)),p}return L="error",y}function b(e,t,r){return"equals"==e?k:(_.allowMissing||(L="error"),y(e,t,r))}function k(e,t,r){return"string"==e?x:"word"==e&&_.allowUnquoted?(L="string",y):(L="error",y(e,t,r))}function x(e,t,r){return"string"==e?x: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 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 r=t.tokenize(e,t);return(r||M)&&"comment"!=r&&(L=null,t.state=t.state(M||r,e,t),L&&(r="error"==L?r+" error":L)),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!=a&&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 l=_.contextGrabbers[i.tagName];if(!l||!l.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==k&&(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(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 a(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=h,e.block=l),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine=null,null}function l(t,o){var s=t.sol(),l=o.list!==!1,c=o.indentedCode;o.indentedCode=!1,l&&(o.indentationDiff>=0?(o.indentationDiff<4&&(o.indentation-=o.indentationDiff),o.list=null):o.list=o.indentation>0?null:!1);var d=null;if(o.indentationDiff>=4)return t.skipToEnd(),c
2015-05-04 07:53:29 +00:00
2016-06-01 06:37:28 +00:00
return u(e,t,r)}function f(e){var t=e.current().toLowerCase();m=L.hasOwnProperty(t)?"atom":M.hasOwnProperty(t)?"keyword":"variable"}var p=r.inline;r.propertyKeywords||(r=e.resolveMode("text/css"));var h,m,g=t.indentUnit,v=r.tokenHooks,y=r.documentTypes||{},b=r.mediaTypes||{},k=r.mediaFeatures||{},x=r.mediaValueKeywords||{},w=r.propertyKeywords||{},_=r.nonStandardPropertyKeywords||{},C=r.fontProperties||{},S=r.counterDescriptors||{},M=r.colorKeywords||{},L=r.valueKeywords||{},T=r.allowNested,A=r.supportsAtComponent===!0,E={};return E.top=function(e,t,r){if("{"==e)return l(r,t,"block");if("}"==e&&r.context.prev)return c(r);if(A&&/@component/.test(e))return l(r,t,"atComponentBlock");if(/^@(-moz-)?document$/.test(e))return l(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(e))return l(r,t,"atBlock");if(/^@(font-face|counter-style)/.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return l(r,t,"at");if("hash"==e)m="builtin";else if("word"==e)m="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return l(r,t,"interpolation");if(":"==e)return"pseudo";if(T&&"("==e)return l(r,t,"parens")}return r.context.type},E.block=function(e,t,r){if("word"==e){var n=t.current().toLowerCase();return w.hasOwnProperty(n)?(m="property","maybeprop"):_.hasOwnProperty(n)?(m="string-2","maybeprop"):T?(m=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(m+=" error","maybeprop")}return"meta"==e?"block":T||"hash"!=e&&"qualifier"!=e?E.top(e,t,r):(m="error","block")},E.maybeprop=function(e,t,r){return":"==e?l(r,t,"prop"):u(e,t,r)},E.prop=function(e,t,r){if(";"==e)return c(r);if("{"==e&&T)return l(r,t,"propBlock");if("}"==e||"{"==e)return d(e,t,r);if("("==e)return l(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)f(t);else if("interpolation"==e)return l(r,t,"interpolation")}else m+=" error";return"prop"},E.propBlock=function(e,t,r){return"}"==e?c(r):"word"==e?(m="property","maybeprop"):r.context.type},E.parens=function(e,t,r){return"{"==e||"}"==e?d(e,t,r):")"==e?c(r):"("==e?l(r,t,"parens"):"interpolation"==e?l(r,t,"interpolation"):("word"==e&&f(t),"parens")},E.pseudo=function(e,t,r){return"word"==e?(m="variable-3",r.context.type):u(e,t,r)},E.documentTypes=function(e,t,r){return"word"==e&&y.hasOwnProperty(t.current())?(m="tag",r.context.type):E.atBlock(e,t,r)},E.atBlock=function(e,t,r){if("("==e)return l(r,t,"atBlock_parens");if("}"==e||";"==e)return d(e,t,r);if("{"==e)return c(r)&&l(r,t,T?"block":"top");if("interpolation"==e)return l(r,t,"interpolation");if("word"==e){var n=t.current().toLowerCase();m="only"==n||"not"==n||"and"==n||"or"==n?"keyword":b.hasOwnProperty(n)?"attribute":k.hasOwnProperty(n)?"property":x.hasOwnProperty(n)?"keyword":w.hasOwnProperty(n)?"property":_.hasOwnProperty(n)?"string-2":L.hasOwnProperty(n)?"atom":M.hasOwnProperty(n)?"keyword":"error"}return r.context.type},E.atComponentBlock=function(e,t,r){return"}"==e?d(e,t,r):"{"==e?c(r)&&l(r,t,T?"block":"top",!1):("word"==e&&(m="error"),r.context.type)},E.atBlock_parens=function(e,t,r){return")"==e?c(r):"{"==e||"}"==e?d(e,t,r,2):E.atBlock(e,t,r)},E.restricted_atBlock_before=function(e,t,r){return"{"==e?l(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(m="variable","restricted_atBlock_before"):u(e,t,r)},E.restricted_atBlock=function(e,t,r){return"}"==e?(r.stateArg=null,c(r)):"word"==e?(m="@font-face"==r.stateArg&&!C.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!S.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},E.keyframes=function(e,t,r){return"word"==e?(m="variable","keyframes"):"{"==e?l(r,t,"top"):u(e,t,r)},E.at=function(e,t,r){return";"==e?c(r):"{"==e||"}"==e?d(e,t,r):("word"==e?m="tag":"hash"==e&&(m="builtin"),"at")},E.interpolation=function(e,t,r){return"}"==e?c(r):"{"==e||";"==e?d(e,t,r):("word"==e?m="variable":"variable"!=e&&"("!=e&&")"!=e&&(m="error"),"interpolation")},{
2016-06-01 06:37:28 +00:00
}return"statement"==n.type?n.indented+("{"==i?0:g):!n.align||v&&")"==n.type?")"!=n.type||a?n.indented+(a?0:m)+(a||!s||/^(?:case|default)\b/.test(r)?0:m):n.indented+g:n.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"],{name:"clike",keywords:a(b),types:a(k+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:a("case do else for if switch while struct"),defKeywords:a("struct"),typeFirstDefinitions:!0,atoms:a("null true false"),hooks:{"#":l,"*":c},modeProps:{fold:["brace","include"]}}),m(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:a(b+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:a(k+" bool wchar_t"),blockKeywords:a("catch class do else finally for if struct switch try while"),defKeywords:a("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:a("true false null"),dontIndentStatements:/^template$/,hooks:{"#":l,"*":c,u:d,U:d,L:d,R:d,0:u,1:u,2:u,3:u,4:u,5:u,6:u,7:u,8:u,9:u,token:function(e,t,r){return"variable"!=r||"("!=e.peek()||";"!=t.prevToken&&null!=t.prevToken&&"}"!=t.prevToken||!f(e.current())?void 0:"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),m("text/x-java",{name:"clike",keywords:a("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while"),types:a("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:a("catch class do else finally for if switch try while"),defKeywords:a("class interface package enum"),typeFirstDefinitions:!0,atoms:a("true false null"),endStatement:/^[;:]$/,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),m("text/x-csharp",{name:"clike",keywords:a("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:a("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:a("catch class do else finally for foreach if struct switch try while"),defKeywords:a("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:a("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=p,p(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),m("text/x-scala",{name:"clike",keywords:a("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this
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(){function e(e,t){for(var r=t.split(" "),n=0;n<r.length;n++)i[r[n]]=e}function t(e,t){if(e.eatSpace())return null;var a=e.sol(),s=e.next();if("\\"===s)return e.next(),null;if("'"===s||'"'===s||"`"===s)return t.tokens.unshift(r(s)),n(e,t);if("#"===s)return a&&e.eat("!")?(e.skipToEnd(),"meta"):(e.skipToEnd(),"comment");if("$"===s)return t.tokens.unshift(o),n(e,t);if("+"===s||"="===s)return"operator";if("-"===s)return e.eat("-"),e.eatWhile(/\w/),"attribute";if(/\d/.test(s)&&(e.eatWhile(/\d/),e.eol()||!/\w/.test(e.peek())))return"number";e.eatWhile(/[\w-]/);var l=e.current();return"="===e.peek()&&/\w+/.test(l)?"def":i.hasOwnProperty(l)?i[l]:null}function r(e){return function(t,r){for(var n,i=!1,a=!1;null!=(n=t.next());){if(n===e&&!a){i=!0;break}if("$"===n&&!a&&"'"!==e){a=!0,t.backUp(1),r.tokens.unshift(o);break}a=!a&&"\\"===n}return(i||!a)&&r.tokens.shift(),"`"===e||")"===e?"quote":"string"}}function n(e,r){return(r.tokens[0]||t)(e,r)}var i={};e("atom","true false"),e("keyword","if then do else elif while until for in esac fi fin fil done exit set unset export function"),e("builtin","ab awk bash beep cat cc cd chown chmod chroot clear cp curl cut diff echo find gawk gcc get git grep kill killall ln ls make mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh shopt shred source sort sleep ssh start stop su sudo tee telnet top touch vi vim wall wc wget who write yes zsh");var o=function(e,t){t.tokens.length>1&&e.eat("$");var i=e.next(),o=/\w/;return"{"===i&&(o=/[^}]/),"("===i?(t.tokens[0]=r(")"),n(e,t)):(/\d/.test(i)||(e.eatWhile(o),e.eat("}")),t.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(e,t){return n(e,t)},lineComment:"#",fold:"brace"}}),e.defineMIME("text/x-sh","shell")}),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,a){for(var s=e[0],l=0;l<s.length;l++)if(o.match(s[l][0]))return a.tokenize=r(e.slice(1),t),s[l][1];return a.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",a="true false null TRUE FALSE NUL
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 nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:i("date time timestamp"),support:i("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),e.defineMIME("text/x-hive",{name:"sql",keywords:i("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:i("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-pgsql",{name:"sql",client:i("source"),keywords:i(o+"a abort abs absent absolute access according action ada add admin after aggregate all allocate also always analyse analyze any are array array_agg array_max_cardinality asensitive assertion assignment asymmetric at atomic attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli binary bit_length blob blocked bom both breadth c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain characteristics characters character_length character_set_catalog character_set_name character_set_schema char_length check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column columns column_name command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constraint constraints constraint_catalog constraint_name constraint_schema constructor contains content continue control conversion convert copy corr corresponding cost covar_pop cova
2016-06-01 06:37:28 +00:00
return{startState:function(e){return{tokenize:n,baseIndent:e||0,stack:[]}},token:function(e,t){if(e.eatSpace())return null;s=null;var r=t.tokenize(e,t),n=t.stack[t.stack.length-1];return"hash"==s&&"rule"==n?r="atom":"variable"==r&&("rule"==n?r="number":n&&"@media{"!=n||(r="tag")),"rule"==n&&/^[\{\};]$/.test(s)&&t.stack.pop(),"{"==s?"@media"==n?t.stack[t.stack.length-1]="@media{":t.stack.push("{"):"}"==s?t.stack.pop():"@media"==s?t.stack.push("@media"):"{"==n&&"comment"!=s&&t.stack.push("rule"),r},indent:function(e,t){var r=e.stack.length;return/^\}/.test(t)&&(r-="rule"==e.stack[e.stack.length-1]?2:1),e.baseIndent+r*d},electricChars:"}"}}),e.defineMIME("text/x-nginx-conf","nginx")}),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){return e.string.charAt(e.pos+(t||0))}function r(e,t){if(t){var r=e.pos-t;return e.string.substr(r>=0?r:0,t)}return e.string.substr(0,e.pos-1)}function n(e,t){var r=e.string.length,n=r-e.pos+1;return e.string.substr(e.pos,t&&r>t?t:n)}function i(e,t){var r,n=e.pos+t;e.pos=0>=n?0:n>=(r=e.string.length-1)?r:n}e.defineMode("perl",function(){function e(e,t,r,n,i){return t.chain=null,t.style=null,t.tail=null,t.tokenize=function(e,t){for(var o,s=!1,l=0;o=e.next();){if(o===r[l]&&!s)return void 0!==r[++l]?(t.chain=r[l],t.style=n,t.tail=i):i&&e.eatWhile(i),t.tokenize=a,n;s=!s&&"\\"==o}return n},t.tokenize(e,t)}function o(e,t,r){return t.tokenize=function(e,t){return e.string==r&&(t.tokenize=a),e.skipToEnd(),"string"},t.tokenize(e,t)}function a(a,u){if(a.eatSpace())return null;if(u.chain)return e(a,u,u.chain,u.style,u.tail);if(a.match(/^\-?[\d\.]/,!1)&&a.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))return"number";if(a.match(/^<<(?=\w)/))return a.eatWhile(/\w/),o(a,u,a.current().substr(2));if(a.sol()&&a.match(/^\=item(?!\w)/))return o(a,u,"=cut");var d=a.next();if('"'==d||"'"==d){if(r(a,3)=="<<"+d){var f=a.pos;a.eatWhile(/\w/);var p=a.current().substr(1);if(p&&a.eat(d))return o(a,u,p);a.pos=f}return e(a,u,[d],"string")}if("q"==d){var h=t(a,-2);if(!h||!/\w/.test(h))if(h=t(a,0),"x"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],l,c);if("["==h)return i(a,2),e(a,u,["]"],l,c);if("{"==h)return i(a,2),e(a,u,["}"],l,c);if("<"==h)return i(a,2),e(a,u,[">"],l,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],l,c)}else if("q"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"string");if("["==h)return i(a,2),e(a,u,["]"],"string");if("{"==h)return i(a,2),e(a,u,["}"],"string");if("<"==h)return i(a,2),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"string")}else if("w"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"bracket");if("["==h)return i(a,2),e(a,u,["]"],"bracket");if("{"==h)return i(a,2),e(a,u,["}"],"bracket");if("<"==h)return i(a,2),e(a,u,[">"],"bracket");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"bracket")}else if("r"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],l,c);if("["==h)return i(a,2),e(a,u,["]"],l,c);if("{"==h)return i(a,2),e(a,u,["}"],l,c);if("<"==h)return i(a,2),e(a,u,[">"],l,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],l,c)}else if(/[\^'"!~\/(\[{<]/.test(h)){if("("==h)return i(a,1),e(a,u,[")"],"string");if("["==h)return i(a,1),e(a,u,["]"],"string");if("{"==h)return i(a,1),e(a,u,["}"],"string");if("<"==h)return i(a,1),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return e(a,u,[a.eat(h)],"string")}}if("m"==d){var h=t(a,-2);if((!h||!/\w/.test(h))&&(h=a.eat(/[(\[{<\^'"!~\/]/))){if(/[\^'"!~\/]/.test(h))return e(a,u,[h],l,c);if("("==h)return e(a,u,[")"],l,c);if("["==h)return e(a,u,["]"],l,c);if("{"==h)return e(a,u,["}"],l,c);if("<"==h)return e(a,u,[">"],l,c)}}if("s"==d){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("y"==d){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=
var a=r[o],s=a.to().line+1,l=a.from().line;0!=a.to().ch||a.empty()||s--,i>s?n.push(s,l):n.length&&(n[n.length-1]=l),i=l}t.operation(function(){for(var e=n.length-2;e>=0;e-=2){var r=n[e],i=n[e+1],o=t.getLine(r);r==t.lastLine()?t.replaceRange("",f(r-1),f(r),"+swapLine"):t.replaceRange("",f(r,0),f(r+1,0),"+swapLine"),t.replaceRange(o+"\n",f(i,0),null,"+swapLine")}t.scrollIntoView()})},d[u[h+"/"]="toggleCommentIndented"]=function(e){e.toggleComment({indent:!0})},d[u[h+"J"]="joinLines"]=function(e){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++){for(var i=t[n],o=i.from(),a=o.line,s=i.to().line;n<t.length-1&&t[n+1].from().line==s;)s=t[++n].to().line;r.push({start:a,end:s,anchor:!i.empty()&&o})}e.operation(function(){for(var t=0,n=[],i=0;i<r.length;i++){for(var o,a=r[i],s=a.anchor&&f(a.anchor.line-t,a.anchor.ch),l=a.start;l<=a.end;l++){var c=l-t;l==a.end&&(o=f(c,e.getLine(c).length+1)),c<e.lastLine()&&(e.replaceRange(" ",f(c),f(c+1,/^\s*/.exec(e.getLine(c+1))[0].length)),++t)}n.push({anchor:s||o,head:o})}e.setSelections(n,0)})},d[u["Shift-"+h+"D"]="duplicateLine"]=function(e){e.operation(function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];n.empty()?e.replaceRange(e.getLine(n.head.line)+"\n",f(n.head.line,0)):e.replaceRange(e.getRange(n.from(),n.to()),n.from())}e.scrollIntoView()})},u[h+"T"]="transposeChars",d[u.F9="sortLines"]=function(e){a(e,!0)},d[u[h+"F9"]="sortLinesInsensitive"]=function(e){a(e,!1)},d[u.F2="nextBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var r=t.shift(),n=r.find();if(n)return t.push(r),e.setSelection(n.from,n.to)}},d[u["Shift-F2"]="prevBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var r=t[t.length-1].find();if(r)return e.setSelection(r.from,r.to);t.pop()}},d[u[h+"F2"]="toggleBookmark"]=function(e){for(var t=e.listSelections(),r=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),n=0;n<t.length;n++){for(var i=t[n].from(),o=t[n].to(),a=e.findMarks(i,o),s=0;s<a.length;s++)if(a[s].sublimeBookmark){a[s].clear();for(var l=0;l<r.length;l++)r[l]==a[s]&&r.splice(l--,1);break}s==a.length&&r.push(e.markText(i,o,{sublimeBookmark:!0,clearWhenEmpty:!1}))}},d[u["Shift-"+h+"F2"]="clearBookmarks"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(var r=0;r<t.length;r++)t[r].clear();t.length=0},d[u["Alt-F2"]="selectBookmarks"]=function(e){var t=e.state.sublimeBookmarks,r=[];if(t)for(var n=0;n<t.length;n++){var i=t[n].find();i?r.push({anchor:i.from,head:i.to}):t.splice(n--,0)}r.length&&e.setSelections(r,0)},u["Alt-Q"]="wrapLines";var y=h+"K ";u[y+h+"Backspace"]="delLineLeft",d[u[y+h+"K"]="delLineRight"]=function(e){e.operation(function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange("",t[r].anchor,f(t[r].to().line),"+delete");e.scrollIntoView()})},d[u[y+h+"U"]="upcaseAtCursor"]=function(e){s(e,function(e){return e.toUpperCase()})},d[u[y+h+"L"]="downcaseAtCursor"]=function(e){s(e,function(e){return e.toLowerCase()})},d[u[y+h+"Space"]="setSublimeMark"]=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},d[u[y+h+"A"]="selectToSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},d[u[y+h+"W"]="deleteToSublimeMark"]=function(t){var r=t.state.sublimeMark&&t.state.sublimeMark.find();if(r){var n=t.getCursor(),i=r;if(e.cmpPos(n,i)>0){var o=i;i=n,n=o}t.state.sublimeKilled=t.getRange(n,i),t.replaceRange("",n,i)}},d[u[y+h+"X"]="swapWithSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},d[u[y+h+"Y"]="sublimeYank"]=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},u[y+h+"G"]="clearBookmarks",d[u[y+h+"C"]="showInCenter"]=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)},d[u["Shift-Alt-Up"]="selectLinesUpward"]=function(e){e.operation(functi
2016-06-01 06:37:28 +00:00
At[i+o]?(r.push(At[i+o]),n++):t?(r.push(i),t=!1):"\\"===i?(t=!0,m(o)||"$"===o?r.push("$"):"/"!==o&&"\\"!==o&&r.push("\\")):("$"===i&&r.push("$"),r.push(i),"/"===o&&r.push("\\"))}return r.join("")}function ze(t){for(var r=new e.StringStream(t),n=[];!r.eol();){for(;r.peek()&&"\\"!=r.peek();)n.push(r.next());var i=!1;for(var o in Et)if(r.match(o,!0)){i=!0,n.push(Et[o]);break}i||n.push(r.next())}return n.join("")}function Ie(e,t,r){var n=kt.registerController.getRegister("/");if(n.setText(e),e instanceof RegExp)return e;var i,o,a=Ae(e);if(a.length){i=e.substring(0,a[0]);var s=e.substring(a[0]);o=-1!=s.indexOf("i")}else i=e;if(!i)return null;x("pcre")||(i=Ee(i)),r&&(t=/^[^A-Z]*$/.test(i));var l=new RegExp(i,t||o?"i":void 0);return l}function qe(e,t){e.openNotification?e.openNotification('<span style="color: red">'+t+"</span>",{bottom:!0,duration:5e3}):alert(t)}function Ne(e,t){var r='<span style="font-family: monospace; white-space: pre">'+(e||"")+'<input type="text"></span>';return t&&(r+=' <span style="color: #888">'+t+"</span>"),r}function Pe(e,t){var r=(t.prefix||"")+" "+(t.desc||""),n=Ne(t.prefix,t.desc);Le(e,n,r,t.onClose,t)}function Re(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var r=["global","multiline","ignoreCase","source"],n=0;n<r.length;n++){var i=r[n];if(e[i]!==t[i])return!1}return!0}return!1}function je(e,t,r,n){if(t){var i=Me(e),o=Ie(t,!!r,!!n);if(o)return Be(e,o),Re(o,i.getQuery())?o:(i.setQuery(o),o)}}function De(e){if("^"==e.source.charAt(0))var t=!0;return{token:function(r){if(t&&!r.sol())return void r.skipToEnd();var n=r.match(e,!1);if(n)return 0==n[0].length?(r.next(),"searching"):r.sol()||(r.backUp(1),e.exec(r.next()+n[0]))?(r.match(e),"searching"):(r.next(),null);for(;!r.eol()&&(r.next(),!r.match(e,!1)););},query:e}}function Be(e,t){var r=Me(e),n=r.getOverlay();n&&t==n.query||(n&&e.removeOverlay(n),n=De(t),e.addOverlay(n),e.showMatchesOnScrollbar&&(r.getScrollbarAnnotate()&&r.getScrollbarAnnotate().clear(),r.setScrollbarAnnotate(e.showMatchesOnScrollbar(t))),r.setOverlay(n))}function We(e,t,r,i){return void 0===i&&(i=1),e.operation(function(){for(var o=e.getCursor(),a=e.getSearchCursor(r,o),s=0;i>s;s++){var l=a.find(t);if(0==s&&l&&$(a.from(),o)&&(l=a.find(t)),!l&&(a=e.getSearchCursor(r,t?n(e.lastLine()):n(e.firstLine(),0)),!a.find(t)))return}return a.from()})}function Fe(e){var t=Me(e);e.removeOverlay(Me(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function He(e,t,r){return"number"!=typeof e&&(e=e.line),t instanceof Array?y(e,t):r?e>=t&&r>=e:e==t}function $e(e){var t=e.getScrollInfo(),r=6,n=10,i=e.coordsChar({left:0,top:r+t.top},"local"),o=t.clientHeight-n+t.top,a=e.coordsChar({left:0,top:o},"local");return{top:i.line,bottom:a.line}}function Ue(t,r,n,i,o,a,s,l,c){function u(){t.operation(function(){for(;!m;)d(),f();p()})}function d(){var e=t.getRange(a.from(),a.to()),r=e.replace(s,l);a.replace(r)}function f(){for(;a.findNext()&&He(a.from(),i,o);)if(n||!g||a.from().line!=g.line)return t.scrollIntoView(a.from(),30),t.setSelection(a.from(),a.to()),g=a.from(),void(m=!1);m=!0}function p(e){if(e&&e(),t.focus(),g){t.setCursor(g);var r=t.state.vim;r.exMode=!1,r.lastHPos=r.lastHSPos=g.ch}c&&c()}function h(r,n,i){e.e_stop(r);var o=e.keyName(r);switch(o){case"Y":d(),f();break;case"N":f();break;case"A":var a=c;c=void 0,t.operation(u),c=a;break;case"L":d();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":p(i)}return m&&p(i),!0}t.state.vim.exMode=!0;var m=!1,g=a.from();return f(),m?void qe(t,"No matches for "+s.source):r?void Pe(t,{prefix:"replace with <strong>"+l+"</strong> (y/n/a/q/l)",onKeyDown:h}):(u(),void(c&&c()))}function Ke(t){var r=t.state.vim,n=kt.macroModeState,i=kt.registerController.getRegister("."),o=n.isPlaying,a=n.lastInsertModeChanges,s=[];if(!o){for(var l=a.inVisualBlock?r.lastSelection.visualBlock.height:1,c=a.changes,s=[],u=0;u<c.length;)s.push(c[u]),c[u]instanceof nt?u++:u+=l;a.changes=s,t.off("change",Je),e.off(t.getInputField(),"keydown",it)}!o&&r.insertModeRepeat>1&&(ot(t,r,r.insertModeRepeat-1,!0),r.lastE
var i=H(e.getCursor()),o=kt.registerController.getRegister(t.registerName),a=o.toString();if(a){if(t.matchIndent){var s=e.getOption("tabSize"),l=function(e){var t=e.split(" ").length-1,r=e.split(" ").length-1;return t*s+1*r},c=e.getLine(e.getCursor().line),u=l(c.match(/^\s*/)[0]),d=a.replace(/\n$/,""),f=a!==d,p=l(a.match(/^\s*/)[0]),a=d.replace(/^\s*/gm,function(t){var r=u+(l(t)-p);if(0>r)return"";if(e.getOption("indentWithTabs")){var n=Math.floor(r/s);return Array(n+1).join(" ")}return Array(r+1).join(" ")});a+=f?"\n":""}if(t.repeat>1)var a=Array(t.repeat+1).join(a);var h=o.linewise,m=o.blockwise;if(h)r.visualMode?a=r.visualLine?a.slice(0,-1):"\n"+a.slice(0,a.length-1)+"\n":t.after?(a="\n"+a.slice(0,a.length-1),i.ch=X(e,i.line)):i.ch=0;else{if(m){a=a.split("\n");for(var g=0;g<a.length;g++)a[g]=""==a[g]?" ":a[g]}i.ch+=t.after?1:0}var v,y;if(r.visualMode){r.lastPastedText=a;var b,k=re(e,r),x=k[0],w=k[1],_=e.getSelection(),C=e.listSelections(),S=new Array(C.length).join("1").split("1");r.lastSelection&&(b=r.lastSelection.headMark.find()),kt.registerController.unnamedRegister.setText(_),m?(e.replaceSelections(S),w=n(x.line+a.length-1,x.ch),e.setCursor(x),J(e,w),e.replaceSelections(a),v=x):r.visualBlock?(e.replaceSelections(S),e.setCursor(x),e.replaceRange(a,x,x),v=x):(e.replaceRange(a,x,w),v=e.posFromIndex(e.indexFromPos(x)+a.length-1)),b&&(r.lastSelection.headMark=e.setBookmark(b)),h&&(v.ch=0)}else if(m){e.setCursor(i);for(var g=0;g<a.length;g++){var M=i.line+g;M>e.lastLine()&&e.replaceRange("\n",n(M,0));var L=X(e,M);L<i.ch&&Q(e,M,i.ch)}e.setCursor(i),J(e,n(i.line+a.length-1,i.ch)),e.replaceSelections(a),v=i}else e.replaceRange(a,i),h&&t.after?v=n(i.line+1,de(e.getLine(i.line+1))):h&&!t.after?v=n(i.line,de(e.getLine(i.line))):!h&&t.after?(y=e.indexFromPos(i),v=e.posFromIndex(y+a.length-1)):(y=e.indexFromPos(i),v=e.posFromIndex(y+a.length));r.visualMode&&le(e,!1),e.setCursor(v)}},undo:function(t,r){t.operation(function(){F(t,e.commands.undo,r.repeat)(),t.setCursor(t.getCursor("anchor"))})},redo:function(t,r){F(t,e.commands.redo,r.repeat)()},setRegister:function(e,t,r){r.inputState.registerName=t.selectedCharacter},setMark:function(e,t,r){var n=t.selectedCharacter;ke(e,r,n,e.getCursor())},replace:function(t,r,i){var o,a,s=r.selectedCharacter,l=t.getCursor(),c=t.listSelections();if(i.visualMode)l=t.getCursor("start"),a=t.getCursor("end");else{var u=t.getLine(l.line);o=l.ch+r.repeat,o>u.length&&(o=u.length),a=n(l.line,o)}if("\n"==s)i.visualMode||t.replaceRange("",l,a),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(t);else{var d=t.getRange(l,a);if(d=d.replace(/[^\n]/g,s),i.visualBlock){var f=new Array(t.getOption("tabSize")+1).join(" ");d=t.getSelection(),d=d.replace(/\t/g,f).replace(/[^\n]/g,s).split("\n"),t.replaceSelections(d)}else t.replaceRange(d,l,a);i.visualMode?(l=U(c[0].anchor,c[0].head)?c[0].anchor:c[0].head,t.setCursor(l),le(t,!1)):t.setCursor(R(a,0,-1))}},incrementNumberToken:function(e,t){for(var r,i,o,a,s,l=e.getCursor(),c=e.getLine(l.line),u=/-?\d+/g;null!==(r=u.exec(c))&&(s=r[0],i=r.index,o=i+s.length,!(l.ch<o)););if((t.backtrack||!(o<=l.ch))&&s){var d=t.increase?1:-1,f=parseInt(s)+d*t.repeat,p=n(l.line,i),h=n(l.line,o);a=f.toString(),e.replaceRange(a,p,h),e.setCursor(n(l.line,i+a.length-1))}},repeatLastEdit:function(e,t,r){var n=r.lastEditInputState;if(n){var i=t.repeat;i&&t.repeatIsExplicit?r.lastEditInputState.repeatOverride=i:i=r.lastEditInputState.repeatOverride||i,ot(e,r,i,!1)}},exitInsertMode:Ke},Lt={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},Tt={bracket:{isComplete:function(e){if(e.nextCh===e.symb){if(e.depth++,e.depth>=1)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?"]":"[")===e.symb?"{":"}"},isComplete:function(e){return 0===e.index&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t="*"===e.lastCh&&"/"===e.nextCh;return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb="m"===e.s