mcopy/app/src/codemirror-compressed.js

16 lines
158 KiB
JavaScript
Raw Normal View History

2016-04-19 03:43:49 +00:00
/* CodeMirror - Minified & Bundled
2016-04-19 20:49:37 +00:00
Generated on 4/19/2016 with http://codemirror.net/doc/compress.html
2016-04-19 03:43:49 +00:00
Version: HEAD
CodeMirror Library:
- codemirror.js
2016-04-19 20:49:37 +00:00
Modes:
- python.js
2016-04-19 03:43:49 +00:00
*/
!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 y(a,b){if(!(this instanceof y))return new y(a,b);this.options=b=b?ng(b):{},ng(Ed,b,!1),L(b);var c=b.value;"string"==typeof c&&(c=new ef(c,b.mode,null,b.lineSeparator)),this.doc=c;var d=new y.inputStyles[b.inputStyle](this),e=this.display=new z(a,c,d);e.wrapper.CodeMirror=this,H(this),F(this),b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),b.autofocus&&!p&&e.input.focus(),P(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 cg,keySeq:null,specialChars:null};var i=this;f&&11>g&&setTimeout(function(){i.display.input.reset(!0)},20),tc(this),Hg(),Zb(this),this.curOp.forceUpdate=!0,jf(this,c),b.autofocus&&!p||i.hasFocus()?setTimeout(og(bd,this),20):cd(this);for(var j in Fd)Fd.hasOwnProperty(j)&&Fd[j](this,b[j],Hd);U(this),b.finishInit&&b.finishInit(this);for(var k=0;k<Ld.length;++k)Ld[k](this);_b(this),h&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(e.lineDiv).textRendering&&(e.lineDiv.style.textRendering="auto")}function z(a,b,d){var e=this;this.input=d,e.scrollbarFiller=vg("div",null,"CodeMirror-scrollbar-filler"),e.scrollbarFiller.setAttribute("cm-not-content","true"),e.gutterFiller=vg("div",null,"CodeMirror-gutter-filler"),e.gutterFiller.setAttribute("cm-not-content","true"),e.lineDiv=vg("div",null,"CodeMirror-code"),e.selectionDiv=vg("div",null,null,"position: relative; z-index: 1"),e.cursorDiv=vg("div",null,"CodeMirror-cursors"),e.measure=vg("div",null,"CodeMirror-measure"),e.lineMeasure=vg("div",null,"CodeMirror-measure"),e.lineSpace=vg("div",[e.measure,e.lineMeasure,e.selectionDiv,e.cursorDiv,e.lineDiv],null,"position: relative; outline: none"),e.mover=vg("div",[vg("div",[e.lineSpace],"CodeMirror-lines")],null,"position: relative"),e.sizer=vg("div",[e.mover],"CodeMirror-sizer"),e.sizerWidth=null,e.heightForcer=vg("div",null,null,"position: absolute; height: "+Zf+"px; width: 1px;"),e.gutters=vg("div",null,"CodeMirror-gutters"),e.lineGutter=null,e.scroller=vg("div",[e.sizer,e.heightForcer,e.gutters],"CodeMirror-scroll"),e.scroller.setAttribute("tabIndex","-1"),e.wrapper=vg("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 A(a){a.doc.mode=y.getMode(a.options,a.doc.modeOption),B(a)}function B(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,mb(a,100),a.state.modeGen++,a.curOp&&mc(a)}function C(a){a.options.lineWrapping?(Dg(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Cg(a.display.wrapper,"CodeMirror-wrap"),K(a)),E(a),mc(a),Jb(a),setTimeout(function(){Q(a)},100)}function D(a){var b=Vb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/Wb(a.display)-3);return function(e){if(Ae(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 E(a){var b=a.doc,c=D(a);b.iter(function(a){var b=c(a);b!=a.height&&nf(a,b)})}function F(a){a.display.wra
e=f-1,b>=j&&(g="right")),null!=e){if(d=a[h+2],i==j&&c==(d.insertLeft?"left":"right")&&(g=c),"left"==c&&0==e)for(;h&&a[h-2]==a[h-3]&&a[h-1].insertLeft;)d=a[(h-=3)+2],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 Fb(a,b,c,d){var l,e=Eb(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&&ug(b.line.text.charAt(e.coverStart+i));)--i;for(;e.coverStart+j<e.coverEnd&&ug(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=wg(h,i,j).getClientRects();l=n.length?n["right"==d?n.length-1:0]:Db}else l=wg(h,i,j).getBoundingClientRect()||Db;if(l.left||l.right||0==i)break;j=i,i-=1,k="right"}f&&11>g&&(l=Gb(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+Wb(a.display),top:o.top,bottom:o.bottom}:Db}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 Gb(a,b){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Sg(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 Hb(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 Ib(a){a.display.externalMeasure=null,xg(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)Hb(a.display.view[b])}function Jb(a){Ib(a),a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function Kb(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Lb(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function Mb(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Ee(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=qf(b);if("local"==d?g+=qb(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=a.display.lineSpace.getBoundingClientRect();g+=h.top+("window"==d?0:Lb());var i=h.left+("window"==d?0:Kb());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function Nb(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=Kb(),e-=Lb();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 Ob(a,b,c,d,e){return d||(d=kf(a.doc,b.line)),Mb(a,d,zb(a,d,b.ch,e),c)}function Pb(a,b,c,d,e,f){function g(b,g){var h=Cb(a,e,b,g?"right":"left",f);return g?h.left=h.right:h.right=h.left,Mb(a,d,h,c)}function h(a,b){var c=i[b],d=c.level%2;return a==Vg(c)&&b&&c.level<i[b-1].level?(c=i[--b],a=Wg(c)-(c.level%2?0:1),d=!0):a==Wg(c)&&b<i.length-1&&c.level<i[b+1].level&&(c=i[++b],a=Vg(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?g(a-1):g(a,d)}d=d||kf(a.doc,b.line),e||(e=Bb(a,d));var i=rf(d),j=b.ch;if(!i)return g(j);var k=ch(i,j),l=h(j,k);return null!=bh&&(l.other=h(j,bh)),l}function Qb(a,b){var c=0,b=Qa(a.doc,b);a.options.lineWrapping||(c=Wb(a.display)*b.ch);var d=kf(a.doc,b.line),e=qf(d)+qb(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function Rb(a,b,c,d){var e=ra(a,b);return e.xRel=d,c&&(e.outside=!0),e}function Sb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return Rb(d.first,0,!0,-1);var e=pf(d,c),f=d.
a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function yd(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=Qb(a,b.from),d=Qb(a,b.to),e=vd(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(e.scrollLeft,e.scrollTop)}}function zd(a,b,c,d){var f,e=a.doc;null==c&&(c="add"),"smart"==c&&(e.mode.indent?f=pb(a,b):c="prev");var g=a.options.tabSize,h=kf(e,b),i=dg(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==$f||k>150)){if(!d)return;c="prev"}}else k=0,c="not";"prev"==c?k=b>e.first?dg(kf(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+=gg(k-m)),l!=j)return rd(e,l,ra(b,0),ra(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=ra(b,j.length);Xa(e,n,new Ma(m,m));break}}}function Ad(a,b,c,d){var e=b,f=b;return"number"==typeof b?f=kf(a,Pa(a,b)):e=of(b),null==e?null:(d(f,e)&&a.cm&&nc(a.cm,e,c),f)}function Bd(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&sa(f.from,hg(d).to)<=0;){var g=d.pop();if(sa(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}gc(a,function(){for(var b=d.length-1;b>=0;b--)rd(a.doc,"",d[b].from,d[b].to,"+delete");xd(a)})}function Cd(a,b,c,d,e){function j(){var b=f+c;return b<a.first||b>=a.first+a.size?!1:(f=b,i=kf(a,b))}function k(a){var b=(e?eh:fh)(i,g,c,!0);if(null==b){if(a||!j())return!1;g=e?(0>c?Yg:Xg)(i):0>c?i.text.length:0}else g=b;return!0}var f=b.line,g=b.ch,h=c,i=kf(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=rg(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=fb(a,ra(f,g),b,h,!0);return sa(b,r)||(r.hitSide=!0),r}function Dd(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)*Vb(a.display))}else"line"==d&&(g=c>0?b.bottom+3:b.top-3);for(;;){var i=Sb(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 Gd(a,b,c,d){y.defaults[a]=b,c&&(Fd[a]=d?function(a,b,d){d!=Hd&&c(a,b,d)}:c)}function Rd(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 Vd(a){return"string"==typeof a?Qd[a]:a}function Zd(a,b,c,d,e){if(d&&d.shared)return _d(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return hc(a.cm,Zd)(a,b,c,d,e);var f=new Yd(a,e),g=sa(b,c);if(d&&ng(d,f,!1),g>0||0==g&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.widgetNode=vg("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(ve(a,b.line,b,c,f)||b.line!=c.line&&ve(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");x=!0}f.addToHistory&&wf(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&&we(a)==i.display.maxLine&&(j=!0),f.collapsed&&h!=b.line&&nf(a,0),ge(a,new de(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){Ae(a,b)&&nf(b,0)}),f.clearOnEnter&&Nf(f,"beforeCursorEnter
for(var a=0;a<this.events.length;a++)Rf.apply(null,this.events[a])};var ra=y.Pos=function(a,b){return this instanceof ra?(this.line=a,void(this.ch=b)):new ra(a,b)},sa=y.cmpPos=function(a,b){return a.line-b.line||a.ch-b.ch},xa=null;Da.prototype=ng({init:function(a){function h(a){if(!Vf(c,a)){if(c.somethingSelected())xa=c.getSelections(),b.inaccurateSelection&&(b.prevInput="",b.inaccurateSelection=!1,e.value=xa.join("\n"),ig(e));else{if(!c.options.lineWiseCopyCut)return;var d=Ba(c);xa=d.text,"cut"==a.type?c.setSelections(d.ranges,null,_f):(b.prevInput="",e.value=d.text.join("\n"),ig(e))}"cut"==a.type&&(c.state.cutIncoming=!0)}}var b=this,c=this.cm,d=this.wrapper=Ea(),e=this.textarea=d.firstChild;a.wrapper.insertBefore(d,a.wrapper.firstChild),o&&(e.style.width="0px"),Nf(e,"input",function(){f&&g>=9&&b.hasSelection&&(b.hasSelection=null),b.poll()}),Nf(e,"paste",function(a){Vf(c,a)||za(a,c)||(c.state.pasteIncoming=!0,b.fastPoll())}),Nf(e,"cut",h),Nf(e,"copy",h),Nf(a.scroller,"paste",function(d){wc(a,d)||Vf(c,d)||(c.state.pasteIncoming=!0,b.focus())}),Nf(a.lineSpace,"selectstart",function(b){wc(a,b)||Hf(b)}),Nf(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"})}}),Nf(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=ib(a);if(a.options.moveInputWithCursor){var e=Pb(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;yg(c.cursorDiv,a.cursors),yg(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=Qg&&(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&&ig(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||Ag()!=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||Pg(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 gc(a,function(){ya(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:fu
2016-04-19 20:49:37 +00:00
},Qd.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"},Qd.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"},Qd.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"]},Qd["default"]=q?Qd.macDefault:Qd.pcDefault,y.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=kg(c.split(" "),Rd),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 Sd=y.lookupKey=function(a,b,c,d){b=Vd(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 Sd(a,b.fallthrough,c,d);for(var f=0;f<b.fallthrough.length;f++){var g=Sd(a,b.fallthrough[f],c,d);if(g)return g}}},Td=y.isModifierKey=function(a){var b="string"==typeof a?a:Tg[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b},Ud=y.keyName=function(a,b){if(k&&34==a.keyCode&&a["char"])return!1;var c=Tg[a.keyCode],d=c;return null==d||a.altGraphKey?!1:(a.altKey&&"Alt"!=c&&(d="Alt-"+d),(u?a.metaKey:a.ctrlKey)&&"Ctrl"!=c&&(d="Ctrl-"+d),(u?a.ctrlKey:a.metaKey)&&"Cmd"!=c&&(d="Cmd-"+d),!b&&a.shiftKey&&"Shift"!=c&&(d="Shift-"+d),d)};y.fromTextArea=function(a,b){function d(){a.value=i.getValue()}if(b=b?ng(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=Ag();b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(Nf(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&&(Qf(a.form,"submit",d),"function"==typeof a.form.submit&&(a.form.submit=f))}},a.style.display="none";var i=y(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);return i};var Wd=y.StringStream=function(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};Wd.prototype={eol:function(){r
}else{s=s.concat(f.keywords),t=t.concat(f.builtins);var u=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var v=b(s),w=b(t),E={startState:function(a){return{tokenize:x,scopes:[{offset:a||0,type:"py",align:null}],indent:a||0,lastToken:null,lambda:!1,dedent:0}},token:function(a,b){var c=b.errorToken;c&&(b.errorToken=!1);var d=D(a,b);return d&&"comment"!=d&&(b.lastToken="keyword"==d||"punctuation"==d?a.current():d),"punctuation"==d&&(d=null),a.eol()&&b.lambda&&(b.lambda=!1),c?d+" "+k:d},indent:function(b,c){if(b.tokenize!=x)return b.tokenize.isString?a.Pass:0;var d=h(b),e=d.type==c.charAt(0);return null!=d.align?d.align-(e?1:0):d.offset-(e?r:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return E}),a.defineMIME("text/x-python","python");var i=function(a){return a.split(" ")};a.defineMIME("text/x-cython",{name:"python",extra_keywords:i("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})});