mirror of https://github.com/mindoc-org/mindoc.git
5 lines
151 KiB
Go
5 lines
151 KiB
Go
|
!function(a){if("object"==typeof exports&&"object"==typeof module)module.exports=a();else{if("function"==typeof define&&define.amd)return define([],a);(this||window).CodeMirror=a()}}(function(){"use strict";function x(a,b){if(!(this instanceof x))return new x(a,b);this.options=b=b?mg(b):{},mg(Dd,b,!1),K(b);var c=b.value;"string"==typeof c&&(c=new df(c,b.mode,null,b.lineSeparator)),this.doc=c;var d=new x.inputStyles[b.inputStyle](this),e=this.display=new y(a,c,d);e.wrapper.CodeMirror=this,G(this),E(this),b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),b.autofocus&&!p&&e.input.focus(),O(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 bg,keySeq:null,specialChars:null};var i=this;f&&11>g&&setTimeout(function(){i.display.input.reset(!0)},20),sc(this),Gg(),Yb(this),this.curOp.forceUpdate=!0,hf(this,c),b.autofocus&&!p||i.hasFocus()?setTimeout(ng(ad,this),20):bd(this);for(var j in Ed)Ed.hasOwnProperty(j)&&Ed[j](this,b[j],Gd);T(this),b.finishInit&&b.finishInit(this);for(var k=0;k<Kd.length;++k)Kd[k](this);$b(this),h&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(e.lineDiv).textRendering&&(e.lineDiv.style.textRendering="auto")}function y(a,b,d){var e=this;this.input=d,e.scrollbarFiller=ug("div",null,"CodeMirror-scrollbar-filler"),e.scrollbarFiller.setAttribute("cm-not-content","true"),e.gutterFiller=ug("div",null,"CodeMirror-gutter-filler"),e.gutterFiller.setAttribute("cm-not-content","true"),e.lineDiv=ug("div",null,"CodeMirror-code"),e.selectionDiv=ug("div",null,null,"position: relative; z-index: 1"),e.cursorDiv=ug("div",null,"CodeMirror-cursors"),e.measure=ug("div",null,"CodeMirror-measure"),e.lineMeasure=ug("div",null,"CodeMirror-measure"),e.lineSpace=ug("div",[e.measure,e.lineMeasure,e.selectionDiv,e.cursorDiv,e.lineDiv],null,"position: relative; outline: none"),e.mover=ug("div",[ug("div",[e.lineSpace],"CodeMirror-lines")],null,"position: relative"),e.sizer=ug("div",[e.mover],"CodeMirror-sizer"),e.sizerWidth=null,e.heightForcer=ug("div",null,null,"position: absolute; height: "+Yf+"px; width: 1px;"),e.gutters=ug("div",null,"CodeMirror-gutters"),e.lineGutter=null,e.scroller=ug("div",[e.sizer,e.heightForcer,e.gutters],"CodeMirror-scroll"),e.scroller.setAttribute("tabIndex","-1"),e.wrapper=ug("div",[e.scrollbarFiller,e.gutterFiller,e.scroller],"CodeMirror"),f&&8>g&&(e.gutters.style.zIndex=-1,e.scroller.style.paddingRight=0),h||c&&p||(e.scroller.draggable=!0),a&&(a.appendChild?a.appendChild(e.wrapper):a(e.wrapper)),e.viewFrom=e.viewTo=b.first,e.reportedViewFrom=e.reportedViewTo=b.first,e.view=[],e.renderedView=null,e.externalMeasured=null,e.viewOffset=0,e.lastWrapHeight=e.lastWrapWidth=0,e.updateLineNumbers=null,e.nativeBarWidth=e.barHeight=e.barWidth=0,e.scrollbarsClipped=!1,e.lineNumWidth=e.lineNumInnerWidth=e.lineNumChars=null,e.alignWidgets=!1,e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null,e.maxLine=null,e.maxLineLength=0,e.maxLineChanged=!1,e.wheelDX=e.wheelDY=e.wheelStartX=e.wheelStartY=null,e.shift=!1,e.selForContextMenu=null,e.activeTouch=null,d.init(e)}function z(a){a.doc.mode=x.getMode(a.options,a.doc.modeOption),A(a)}function A(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,lb(a,100),a.state.modeGen++,a.curOp&&lc(a)}function B(a){a.options.lineWrapping?(Cg(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Bg(a.display.wrapper,"CodeMirror-wrap"),J(a)),D(a),lc(a),Ib(a),setTimeout(function(){P(a)},100)}function C(a){var b=Ub(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/Vb(a.display)-3);return function(e){if(ze(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function D(a){var b=a.doc,c=C(a);b.iter(function(a){var b=c(a);b!=a.height&&mf(a,b)})}function E(a){a.display.wra
|
||
|
g="left";if("right"==c&&e==j-i)for(;h<a.length-3&&a[h+3]==a[h+4]&&!a[h+5].insertLeft;)d=a[(h+=3)+2],g="right";break}}return{node:d,start:e,end:f,collapse:g,coverStart:i,coverEnd:j}}function Eb(a,b,c,d){var l,e=Db(b.map,c,d),h=e.node,i=e.start,j=e.end,k=e.collapse;if(3==h.nodeType){for(var m=0;4>m;m++){for(;i&&tg(b.line.text.charAt(e.coverStart+i));)--i;for(;e.coverStart+j<e.coverEnd&&tg(b.line.text.charAt(e.coverStart+j));)++j;if(f&&9>g&&0==i&&j==e.coverEnd-e.coverStart)l=h.parentNode.getBoundingClientRect();else if(f&&a.options.lineWrapping){var n=vg(h,i,j).getClientRects();l=n.length?n["right"==d?n.length-1:0]:Cb}else l=vg(h,i,j).getBoundingClientRect()||Cb;if(l.left||l.right||0==i)break;j=i,i-=1,k="right"}f&&11>g&&(l=Fb(a.display.measure,l))}else{i>0&&(k=d="right");var n;l=a.options.lineWrapping&&(n=h.getClientRects()).length>1?n["right"==d?n.length-1:0]:h.getBoundingClientRect()}if(f&&9>g&&!i&&(!l||!l.left&&!l.right)){var o=h.parentNode.getClientRects()[0];l=o?{left:o.left,right:o.left+Vb(a.display),top:o.top,bottom:o.bottom}:Cb}for(var p=l.top-b.rect.top,q=l.bottom-b.rect.top,r=(p+q)/2,s=b.view.measure.heights,m=0;m<s.length-1&&!(r<s[m]);m++);var t=m?s[m-1]:0,u=s[m],v={left:("right"==k?l.right:l.left)-b.rect.left,right:("left"==k?l.left:l.right)-b.rect.left,top:t,bottom:u};return l.left||l.right||(v.bogus=!0),a.options.singleCursorHeightPerLine||(v.rtop=p,v.rbottom=q),v}function Fb(a,b){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Rg(a))return b;var c=screen.logicalXDPI/screen.deviceXDPI,d=screen.logicalYDPI/screen.deviceYDPI;return{left:b.left*c,right:b.right*c,top:b.top*d,bottom:b.bottom*d}}function Gb(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function Hb(a){a.display.externalMeasure=null,wg(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)Gb(a.display.view[b])}function Ib(a){Hb(a),a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function Jb(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Kb(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function Lb(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=De(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=pf(b);if("local"==d?g+=pb(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=a.display.lineSpace.getBoundingClientRect();g+=h.top+("window"==d?0:Kb());var i=h.left+("window"==d?0:Jb());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function Mb(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=Jb(),e-=Kb();else if("local"==c||!c){var f=a.display.sizer.getBoundingClientRect();d+=f.left,e+=f.top}var g=a.display.lineSpace.getBoundingClientRect();return{left:d-g.left,top:e-g.top}}function Nb(a,b,c,d,e){return d||(d=jf(a.doc,b.line)),Lb(a,d,yb(a,d,b.ch,e),c)}function Ob(a,b,c,d,e,f){function g(b,g){var h=Bb(a,e,b,g?"right":"left",f);return g?h.left=h.right:h.right=h.left,Lb(a,d,h,c)}function h(a,b){var c=i[b],d=c.level%2;return a==Ug(c)&&b&&c.level<i[b-1].level?(c=i[--b],a=Vg(c)-(c.level%2?0:1),d=!0):a==Vg(c)&&b<i.length-1&&c.level<i[b+1].level&&(c=i[++b],a=Ug(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?g(a-1):g(a,d)}d=d||jf(a.doc,b.line),e||(e=Ab(a,d));var i=qf(d),j=b.ch;if(!i)return g(j);var k=bh(i,j),l=h(j,k);return null!=ah&&(l.other=h(j,ah)),l}function Pb(a,b){var c=0,b=Pa(a.doc,b);a.options.lineWrapping||(c=Vb(a.display)*b.ch);var d=jf(a.doc,b.line),e=pf(d)+pb(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function Qb(a,b,c,d){var e=qa(a,b);return e.xRel=d,c&&(e.outside=!0),e}function Rb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return Qb(d.first,0,!0,-1);var e=of(d,c),f=d.first+d.size-1;if(e>f)return Qb(d.first+d.size-1,jf(d,f).text.length,!0,1);0>b&&(b=0);for(var g=jf(d,e);;){var h=Sb(a,g,e,b,c),i=te(g),j=i&&i.find(0,!0);if(!i||!(h.c
|
||
|
a.scrollTo(e.scrollLeft,e.scrollTop)}}function yd(a,b,c,d){var f,e=a.doc;null==c&&(c="add"),"smart"==c&&(e.mode.indent?f=ob(a,b):c="prev");var g=a.options.tabSize,h=jf(e,b),i=cg(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var k,j=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(k=e.mode.indent(f,h.text.slice(j.length),h.text),k==Zf||k>150)){if(!d)return;c="prev"}}else k=0,c="not";"prev"==c?k=b>e.first?cg(jf(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c?k=i-a.options.indentUnit:"number"==typeof c&&(k=i+c),k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(k/g);n;--n)m+=g,l+=" ";if(k>m&&(l+=fg(k-m)),l!=j)return qd(e,l,qa(b,0),qa(b,j.length),"+input"),h.stateAfter=null,!0;for(var n=0;n<e.sel.ranges.length;n++){var o=e.sel.ranges[n];if(o.head.line==b&&o.head.ch<j.length){var m=qa(b,j.length);Wa(e,n,new La(m,m));break}}}function zd(a,b,c,d){var e=b,f=b;return"number"==typeof b?f=jf(a,Oa(a,b)):e=nf(b),null==e?null:(d(f,e)&&a.cm&&mc(a.cm,e,c),f)}function Ad(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&ra(f.from,gg(d).to)<=0;){var g=d.pop();if(ra(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}fc(a,function(){for(var b=d.length-1;b>=0;b--)qd(a.doc,"",d[b].from,d[b].to,"+delete");wd(a)})}function Bd(a,b,c,d,e){function j(){var b=f+c;return b<a.first||b>=a.first+a.size?!1:(f=b,i=jf(a,b))}function k(a){var b=(e?dh:eh)(i,g,c,!0);if(null==b){if(a||!j())return!1;g=e?(0>c?Xg:Wg)(i):0>c?i.text.length:0}else g=b;return!0}var f=b.line,g=b.ch,h=c,i=jf(a,f);if("char"==d)k();else if("column"==d)k(!0);else if("word"==d||"group"==d)for(var l=null,m="group"==d,n=a.cm&&a.cm.getHelper(b,"wordChars"),o=!0;!(0>c)||k(!o);o=!1){var p=i.text.charAt(g)||"\n",q=qg(p,n)?"w":m&&"\n"==p?"n":!m||/\s/.test(p)?null:"p";if(!m||o||q||(q="s"),l&&l!=q){0>c&&(c=1,k());break}if(q&&(l=q),c>0&&!k(!o))break}var r=eb(a,qa(f,g),b,h,!0);return ra(b,r)||(r.hitSide=!0),r}function Cd(a,b,c,d){var g,e=a.doc,f=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);g=b.top+c*(h-(0>c?1.5:.5)*Ub(a.display))}else"line"==d&&(g=c>0?b.bottom+3:b.top-3);for(;;){var i=Rb(a,f,g);if(!i.outside)break;if(0>c?0>=g:g>=e.height){i.hitSide=!0;break}g+=5*c}return i}function Fd(a,b,c,d){x.defaults[a]=b,c&&(Ed[a]=d?function(a,b,d){d!=Gd&&c(a,b,d)}:c)}function Qd(a){for(var c,d,e,f,b=a.split(/-(?!$)/),a=b[b.length-1],g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))c=!0;else if(/^(c|ctrl|control)$/i.test(h))d=!0;else{if(!/^s(hift)$/i.test(h))throw new Error("Unrecognized modifier name: "+h);e=!0}}return c&&(a="Alt-"+a),d&&(a="Ctrl-"+a),f&&(a="Cmd-"+a),e&&(a="Shift-"+a),a}function Ud(a){return"string"==typeof a?Pd[a]:a}function Yd(a,b,c,d,e){if(d&&d.shared)return $d(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return gc(a.cm,Yd)(a,b,c,d,e);var f=new Xd(a,e),g=ra(b,c);if(d&&mg(d,f,!1),g>0||0==g&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.widgetNode=ug("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(ue(a,b.line,b,c,f)||b.line!=c.line&&ue(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");w=!0}f.addToHistory&&vf(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var j,h=b.line,i=a.cm;if(a.iter(h,c.line+1,function(a){i&&f.collapsed&&!i.options.lineWrapping&&ve(a)==i.display.maxLine&&(j=!0),f.collapsed&&h!=b.line&&mf(a,0),fe(a,new ce(f,h==b.line?b.ch:null,h==c.line?c.ch:null)),++h}),f.collapsed&&a.iter(b.line,c.line+1,function(b){ze(a,b)&&mf(b,0)}),f.clearOnEnter&&Mf(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(v=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed&&(f.id=++Wd,f.atomic=!0),i){if(j&&(i.curOp.updateMaxLine=!0),f.collapsed)lc(i,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(var k=b.line;k<=c.line;k++)m
|
||
|
b.inaccurateSelection&&(b.prevInput="",b.inaccurateSelection=!1,e.value=wa.join("\n"),hg(e));else{if(!c.options.lineWiseCopyCut)return;var d=Aa(c);wa=d.text,"cut"==a.type?c.setSelections(d.ranges,null,$f):(b.prevInput="",e.value=d.text.join("\n"),hg(e))}"cut"==a.type&&(c.state.cutIncoming=!0)}}var b=this,c=this.cm,d=this.wrapper=Da(),e=this.textarea=d.firstChild;a.wrapper.insertBefore(d,a.wrapper.firstChild),o&&(e.style.width="0px"),Mf(e,"input",function(){f&&g>=9&&b.hasSelection&&(b.hasSelection=null),b.poll()}),Mf(e,"paste",function(a){Uf(c,a)||ya(a,c)||(c.state.pasteIncoming=!0,b.fastPoll())}),Mf(e,"cut",h),Mf(e,"copy",h),Mf(a.scroller,"paste",function(d){vc(a,d)||Uf(c,d)||(c.state.pasteIncoming=!0,b.focus())}),Mf(a.lineSpace,"selectstart",function(b){vc(a,b)||Gf(b)}),Mf(e,"compositionstart",function(){var a=c.getCursor("from");b.composing&&b.composing.range.clear(),b.composing={start:a,range:c.markText(a,c.getCursor("to"),{className:"CodeMirror-composing"})}}),Mf(e,"compositionend",function(){b.composing&&(b.poll(),b.composing.range.clear(),b.composing=null)})},prepareSelection:function(){var a=this.cm,b=a.display,c=a.doc,d=hb(a);if(a.options.moveInputWithCursor){var e=Ob(a,c.sel.primary().head,"div"),f=b.wrapper.getBoundingClientRect(),g=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,e.top+g.top-f.top)),d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,e.left+g.left-f.left))}return d},showSelection:function(a){var b=this.cm,c=b.display;xg(c.cursorDiv,a.cursors),xg(c.selectionDiv,a.selection),null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")},reset:function(a){if(!this.contextMenuPending){var b,c,d=this.cm,e=d.doc;if(d.somethingSelected()){this.prevInput="";var h=e.sel.primary();b=Pg&&(h.to().line-h.from().line>100||(c=d.getSelection()).length>1e3);var i=b?"-":c||d.getSelection();this.textarea.value=i,d.state.focused&&hg(this.textarea),f&&g>=9&&(this.hasSelection=i)}else a||(this.prevInput=this.textarea.value="",f&&g>=9&&(this.hasSelection=null));this.inaccurateSelection=b}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!p||zg()!=this.textarea))try{this.textarea.focus()}catch(a){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var a=this;a.pollingFast||a.polling.set(this.cm.options.pollInterval,function(){a.poll(),a.cm.state.focused&&a.slowPoll()})},fastPoll:function(){function c(){var d=b.poll();d||a?(b.pollingFast=!1,b.slowPoll()):(a=!0,b.polling.set(60,c))}var a=!1,b=this;b.pollingFast=!0,b.polling.set(20,c)},poll:function(){var a=this.cm,b=this.textarea,c=this.prevInput;if(this.contextMenuPending||!a.state.focused||Og(b)&&!c&&!this.composing||a.isReadOnly()||a.options.disableInput||a.state.keySeq)return!1;var d=b.value;if(d==c&&!a.somethingSelected())return!1;if(f&&g>=9&&this.hasSelection===d||q&&/[\uf700-\uf7ff]/.test(d))return a.display.input.reset(),!1;if(a.doc.sel==a.display.selForContextMenu){var e=d.charCodeAt(0);if(8203!=e||c||(c="\u200b"),8666==e)return this.reset(),this.cm.execCommand("undo")}for(var h=0,i=Math.min(c.length,d.length);i>h&&c.charCodeAt(h)==d.charCodeAt(h);)++h;var j=this;return fc(a,function(){xa(a,d.slice(h),c.length-h,null,j.composing?"*compose":null),d.length>1e3||d.indexOf("\n")>-1?b.value=j.prevInput="":j.prevInput=d,j.composing&&(j.composing.range.clear(),j.composing.range=a.markText(j.composing.start,a.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){f&&g>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(a){function o(){if(null!=e.selectionStart){var a=c.somethingSelected(),f="\u200b"+(a?e.value:"");e.value="\u21da",e.value=f,b.prevInput=a?"":"\u200b",e.selectionStart=1,e.selectionEnd=f.length,d.selForContextMenu=c.doc.sel}}function p(){if(b.contextMenuPe
|
||
|
"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"},Pd.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"},Pd.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"]},Pd["default"]=q?Pd.macDefault:Pd.pcDefault,x.normalizeKeyMap=function(a){var b={};for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];if(/^(name|fallthrough|(de|at)tach)$/.test(c))continue;if("..."==d){delete a[c];continue}for(var e=jg(c.split(" "),Qd),f=0;f<e.length;f++){var g,h;f==e.length-1?(h=e.join(" "),g=d):(h=e.slice(0,f+1).join(" "),g="...");var i=b[h];if(i){if(i!=g)throw new Error("Inconsistent bindings for "+h)}else b[h]=g}delete a[c]}for(var j in b)a[j]=b[j];return a};var Rd=x.lookupKey=function(a,b,c,d){b=Ud(b);var e=b.call?b.call(a,d):b[a];if(e===!1)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return Rd(a,b.fallthrough,c,d);for(var f=0;f<b.fallthrough.length;f++){var g=Rd(a,b.fallthrough[f],c,d);if(g)return g}}},Sd=x.isModifierKey=function(a){var b="string"==typeof a?a:Sg[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b},Td=x.keyName=function(a,b){if(k&&34==a.keyCode&&a["char"])return!1;var c=Sg[a.keyCode],d=c;return null==d||a.altGraphKey?!1:(a.altKey&&"Alt"!=c&&(d="Alt-"+d),(t?a.metaKey:a.ctrlKey)&&"Ctrl"!=c&&(d="Ctrl-"+d),(t?a.ctrlKey:a.metaKey)&&"Cmd"!=c&&(d="Cmd-"+d),!b&&a.shiftKey&&"Shift"!=c&&(d="Shift-"+d),d)};x.fromTextArea=function(a,b){function d(){a.value=i.getValue()}if(b=b?mg(b):{},b.value=a.value,!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex),!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder),null==b.autofocus){var c=zg();b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(Mf(a.form,"submit",d),!b.leaveSubmitMethodAlone)){var e=a.form,f=e.submit;try{var g=e.submit=function(){d(),e.submit=f,e.submit(),e.submit=g}}catch(h){}}b.finishInit=function(b){b.save=d,b.getTextArea=function(){return a},b.toTextArea=function(){b.toTextArea=isNaN,d(),a.parentNode.removeChild(b.getWrapperElement()),a.style.display="",a.form&&(Pf(a.form,"submit",d),"function"==typeof a.form.submit&&(a.form.submit=f))}},a.style.display="none";var i=x(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);return i};var Vd=x.StringStream=function(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};Vd.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a)var c=b==a;else var c=b&&(a.test?a.test(b):a(b));return c?(++this.pos,b):void 0},eatWhile:functio
|