From 376b040775ed9fb4e2eed4bd0efe459d4238cbd2 Mon Sep 17 00:00:00 2001 From: "Dave St.Germain" Date: Mon, 17 Mar 2014 12:21:00 -0400 Subject: [PATCH] Removed circuit editor setup code that had always been in codemirror-compressed.js --- common/lib/capa/capa/inputtypes.py | 11 +++- .../capa/capa/templates/schematicinput.html | 27 ++++---- common/lib/capa/capa/tests/test_inputtypes.py | 11 ++-- common/static/js/capa/schematicinput.js | 58 +++++++++++++++++ .../vendor/CodeMirror/addons/edx_markdown.js | 64 ------------------- .../vendor/CodeMirror/{addons => }/octave.js | 0 .../static/js/vendor/codemirror-compressed.js | 4 +- 7 files changed, 92 insertions(+), 83 deletions(-) create mode 100644 common/static/js/capa/schematicinput.js rename common/static/js/vendor/CodeMirror/{addons => }/octave.js (100%) diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py index 0c48d6dd16..bc7674b3c0 100644 --- a/common/lib/capa/capa/inputtypes.py +++ b/common/lib/capa/capa/inputtypes.py @@ -862,7 +862,7 @@ class MatlabInput(CodeInput): 'queue_len': str(self.queue_len), 'queue_msg': self.queue_msg, 'button_enabled': self.button_enabled(), - 'matlab_editor_js': '{static_url}js/vendor/CodeMirror/addons/octave.js'.format( + 'matlab_editor_js': '{static_url}js/vendor/CodeMirror/octave.js'.format( static_url=self.capa_system.STATIC_URL), } return extra_context @@ -961,6 +961,15 @@ class Schematic(InputTypeBase): Attribute('label', ''), ] + def _extra_context(self): + """ + """ + context = { + 'setup_script': '{static_url}js/capa/schematicinput.js'.format( + static_url=self.capa_system.STATIC_URL), + } + + return context #----------------------------------------------------------------------------- diff --git a/common/lib/capa/capa/templates/schematicinput.html b/common/lib/capa/capa/templates/schematicinput.html index 62bbbc943a..b0eb05d52f 100644 --- a/common/lib/capa/capa/templates/schematicinput.html +++ b/common/lib/capa/capa/templates/schematicinput.html @@ -1,15 +1,19 @@ - - - - - - - +
+ % if status == 'unsubmitted': @@ -29,5 +33,6 @@ Status: incomplete % endif + diff --git a/common/lib/capa/capa/tests/test_inputtypes.py b/common/lib/capa/capa/tests/test_inputtypes.py index 0450f71103..679ea90aa9 100644 --- a/common/lib/capa/capa/tests/test_inputtypes.py +++ b/common/lib/capa/capa/tests/test_inputtypes.py @@ -453,7 +453,7 @@ class MatlabTest(unittest.TestCase): 'tabsize': int(self.tabsize), 'button_enabled': True, 'queue_len': '3', - 'matlab_editor_js': '/dummy-static/js/vendor/CodeMirror/addons/octave.js', + 'matlab_editor_js': '/dummy-static/js/vendor/CodeMirror/octave.js', } self.assertEqual(context, expected) @@ -486,7 +486,7 @@ class MatlabTest(unittest.TestCase): 'tabsize': int(self.tabsize), 'button_enabled': True, 'queue_len': '3', - 'matlab_editor_js': '/dummy-static/js/vendor/CodeMirror/addons/octave.js', + 'matlab_editor_js': '/dummy-static/js/vendor/CodeMirror/octave.js', } self.assertEqual(context, expected) @@ -519,7 +519,7 @@ class MatlabTest(unittest.TestCase): 'tabsize': int(self.tabsize), 'button_enabled': False, 'queue_len': '0', - 'matlab_editor_js': '/dummy-static/js/vendor/CodeMirror/addons/octave.js', + 'matlab_editor_js': '/dummy-static/js/vendor/CodeMirror/octave.js', } self.assertEqual(context, expected) @@ -551,7 +551,7 @@ class MatlabTest(unittest.TestCase): 'tabsize': int(self.tabsize), 'button_enabled': True, 'queue_len': '1', - 'matlab_editor_js': '/dummy-static/js/vendor/CodeMirror/addons/octave.js', + 'matlab_editor_js': '/dummy-static/js/vendor/CodeMirror/octave.js', } self.assertEqual(context, expected) @@ -617,7 +617,7 @@ class MatlabTest(unittest.TestCase): output = self.the_input.get_html() self.assertEqual( etree.tostring(output), - """
{\'status\': \'queued\', \'button_enabled\': True, \'linenumbers\': \'true\', \'rows\': \'10\', \'queue_len\': \'3\', \'mode\': \'\', \'cols\': \'80\', \'value\': \'print "good evening"\', \'status_class\': \'processing\', \'queue_msg\': \'\', \'STATIC_URL\': \'/dummy-static/\', \'msg\': u\'Submitted. As soon as a response is returned, this message will be replaced by that feedback.\', \'matlab_editor_js\': \'/dummy-static/js/vendor/CodeMirror/addons/octave.js\', \'hidden\': \'\', \'status_display\': u\'queued\', \'id\': \'prob_1_2\', \'tabsize\': 4}
""" + """
{\'status\': \'queued\', \'button_enabled\': True, \'linenumbers\': \'true\', \'rows\': \'10\', \'queue_len\': \'3\', \'mode\': \'\', \'cols\': \'80\', \'value\': \'print "good evening"\', \'status_class\': \'processing\', \'queue_msg\': \'\', \'STATIC_URL\': \'/dummy-static/\', \'msg\': u\'Submitted. As soon as a response is returned, this message will be replaced by that feedback.\', \'matlab_editor_js\': \'/dummy-static/js/vendor/CodeMirror/octave.js\', \'hidden\': \'\', \'status_display\': u\'queued\', \'id\': \'prob_1_2\', \'tabsize\': 4}
""" ) # test html, that is correct HTML5 html, but is not parsable by XML parser. @@ -693,6 +693,7 @@ class SchematicTest(unittest.TestCase): 'width': width, 'height': height, 'parts': parts, + 'setup_script': '/dummy-static/js/capa/schematicinput.js', 'analyses': analyses, 'submit_analyses': submit_analyses, } diff --git a/common/static/js/capa/schematicinput.js b/common/static/js/capa/schematicinput.js new file mode 100644 index 0000000000..e4769374c4 --- /dev/null +++ b/common/static/js/capa/schematicinput.js @@ -0,0 +1,58 @@ +var schematic_height = 220; +var schematic_width = 400; +var styling_height_delta = 2; //How many pixels are added to the height of the box because of styling (like a shadow) +var styling_width_delta = 2; + +$(function() { + // TODO: someone should fix all of this... + //$("a[rel*=leanModal]").leanModal(); //TODO: Make this work with the new modal library. Try and integrate this with the "slices" + + $("body").append('\ + '); + + //This is the editor that pops up as a modal + var editorCircuit = $("#schematic_editor").get(0); + //This is the circuit that they last clicked. The one being edited. + var editingCircuit = null; + //Notice we use live, because new circuits can be inserted + $(".schematic_open").live("click", function() { + //Find the new editingCircuit. Transfer its contents to the editorCircuit + editingCircuit = $(this).children("input.schematic").get(0); + + editingCircuit.schematic.update_value(); + var circuit_so_far = $(editingCircuit).val(); + + var n = editorCircuit.schematic.components.length; + for (var i = 0; i < n; i++) + editorCircuit.schematic.components[n - 1 - i].remove(); + + editorCircuit.schematic.load_schematic(circuit_so_far, ""); + editorCircuit.schematic.zoomall(); + }); + + $("#circuit_save_btn").click(function () { + //Take the circuit from the editor and put it back into editingCircuit + editorCircuit.schematic.update_value(); + var saving_circuit = $(editorCircuit).val(); + + var n = editingCircuit.schematic.components.length; + for (var i = 0; i < n; i++) + editingCircuit.schematic.components[n - 1 - i].remove(); + + editingCircuit.schematic.load_schematic(saving_circuit, ""); + editingCircuit.schematic.zoomall(); + + if (editingCircuit.codeMirrorLine) { + editingCircuit.codeMirrorLine.replace(0, null, "circuit-schematic:" + saving_circuit); + } + }); +}); diff --git a/common/static/js/vendor/CodeMirror/addons/edx_markdown.js b/common/static/js/vendor/CodeMirror/addons/edx_markdown.js index b1f9f3651f..f107b0bac4 100644 --- a/common/static/js/vendor/CodeMirror/addons/edx_markdown.js +++ b/common/static/js/vendor/CodeMirror/addons/edx_markdown.js @@ -1,67 +1,3 @@ -var schematic_height = 220; -var schematic_width = 400; -var styling_height_delta = 2; //How many pixels are added to the height of the box because of styling (like a shadow) -var styling_width_delta = 2; - -var schematic_editor_height = 300; -var schematic_editor_width = 500; - -$(function(){ - $(document).ready(function() { - //$("a[rel*=leanModal]").leanModal(); //TODO: Make this work with the new modal library. Try and integrate this with the "slices" - - $("body").append('\ - '); - - //This is the editor that pops up as a modal - var editorCircuit = $("#schematic_editor").get(0); - //This is the circuit that they last clicked. The one being edited. - var editingCircuit = null; - //Notice we use live, because new circuits can be inserted - $(".schematic_open").live("click", function() { - //Find the new editingCircuit. Transfer its contents to the editorCircuit - editingCircuit = $(this).children("input.schematic").get(0); - - editingCircuit.schematic.update_value(); - var circuit_so_far = $(editingCircuit).val(); - - var n = editorCircuit.schematic.components.length; - for (var i = 0; i < n; i++) - editorCircuit.schematic.components[n - 1 - i].remove(); - - editorCircuit.schematic.load_schematic(circuit_so_far, ""); - editorCircuit.schematic.zoomall(); - }); - - $("#circuit_save_btn").click(function () { - //Take the circuit from the editor and put it back into editingCircuit - editorCircuit.schematic.update_value(); - var saving_circuit = $(editorCircuit).val(); - - var n = editingCircuit.schematic.components.length; - for (var i = 0; i < n; i++) - editingCircuit.schematic.components[n - 1 - i].remove(); - - editingCircuit.schematic.load_schematic(saving_circuit, ""); - editingCircuit.schematic.zoomall(); - - if (editingCircuit.codeMirrorLine) { - editingCircuit.codeMirrorLine.replace(0, null, "circuit-schematic:" + saving_circuit); - } - }); - }); -}); - - CodeMirror.defineMode("edx_markdown", function(cmCfg, modeCfg) { var htmlFound = CodeMirror.mimeModes.hasOwnProperty("text/html"); diff --git a/common/static/js/vendor/CodeMirror/addons/octave.js b/common/static/js/vendor/CodeMirror/octave.js similarity index 100% rename from common/static/js/vendor/CodeMirror/addons/octave.js rename to common/static/js/vendor/CodeMirror/octave.js diff --git a/common/static/js/vendor/codemirror-compressed.js b/common/static/js/vendor/codemirror-compressed.js index 13ee8ae145..0e57f84415 100644 --- a/common/static/js/vendor/codemirror-compressed.js +++ b/common/static/js/vendor/codemirror-compressed.js @@ -3,5 +3,5 @@ window.CodeMirror=function(){"use strict";function T(e,n){if(!(this instanceof T (_n(e,d)?In(n.doc,v,Bn(s,On(e.line,0))):In(n.doc,d,Bn(s,On(e.line+1,0))))}function w(e){var t=++b,r=Xt(n,e,!0);if(!r)return;if(!Mn(r,h)){n.state.focused||vn(n),h=r,g(r);var o=I(i,s);(r.line>=o.to||r.liney.bottom?20:0;u&&setTimeout(Dt(n,function(){if(b!=t)return;i.scroller.scrollTop+=u,w(e)}),50)}}function S(e){b=Infinity,zi(e),Rt(n),Qi(document,"mousemove",x),Qi(document,"mouseup",T)}if(ts(this,e))return;var n=this,i=n.display,s=n.doc,u=s.sel;u.shift=e.shiftKey;if(Wt(i,e)){o||(i.scroller.draggable=!1,setTimeout(function(){i.scroller.draggable=!0},100));return}if(Gt(n,e))return;var a=Xt(n,e);switch(Ji(e)){case 3:E&&yn.call(n,n,e);return;case 2:o&&(n.state.lastMiddleDown=+(new Date)),a&&In(n.doc,a),setTimeout(gs(Rt,n),20),zi(e);return}if(!a){$i(e)==i.scroller&&zi(e);return}n.state.focused||vn(n);var f=+(new Date),l="single";if($t&&$t.time>f-400&&Mn($t.pos,a))l="triple",zi(e),setTimeout(gs(Rt,n),20),nr(n,a.line);else if(Vt&&Vt.time>f-400&&Mn(Vt.pos,a)){l="double",$t={time:f,pos:a},zi(e);var c=tr(xi(s,a.line).text,a);In(n.doc,c.from,c.to)}else Vt={time:f,pos:a};var h=a;if(n.options.dragDrop&&Ls&&!Ut(n)&&!Mn(u.from,u.to)&&!_n(a,u.from)&&!_n(u.to,a)&&l=="single"){var p=Dt(n,function(s){o&&(i.scroller.draggable=!1),n.state.draggingText=!1,Qi(document,"mouseup",p),Qi(i.scroller,"drop",p),Math.abs(e.clientX-s.clientX)+Math.abs(e.clientY-s.clientY)<10&&(zi(s),In(n.doc,a),Rt(n),t&&!r&&setTimeout(function(){document.body.focus(),Rt(n)},20))});o&&(i.scroller.draggable=!0),n.state.draggingText=p,i.scroller.dragDrop&&i.scroller.dragDrop(),Ki(document,"mouseup",p),Ki(i.scroller,"drop",p);return}zi(e),l=="single"&&In(n.doc,Bn(s,a));var d=u.from,v=u.to,m=a,y=ks(i.wrapper),b=0,x=Dt(n,function(e){!t&&!Ji(e)?S(e):w(e)}),T=Dt(n,S);Ki(document,"mousemove",x),Ki(document,"mouseup",T)}function Kt(e,t,n,r,i){try{var s=t.clientX,o=t.clientY}catch(t){return!1}if(s>=Math.floor(ks(e.display.gutters).right))return!1;r&&zi(t);var u=e.display,a=ks(u.lineDiv);if(o>a.bottom||!rs(e,n))return Xi(t);o-=a.top-u.viewOffset;for(var f=0;f=s){var c=Li(e.doc,o),h=e.options.gutters[f];return i(e,n,e,c,h,t),Xi(t)}}}function Qt(e,t){return rs(e,"gutterContextMenu")?Kt(e,t,"gutterContextMenu",!1,Gi):!1}function Gt(e,t){return Kt(e,t,"gutterClick",!0,es)}function Zt(e){var t=this;if(ts(t,e)||Wt(t.display,e)||t.options.onDragEvent&&t.options.onDragEvent(t,Ui(e)))return;zi(e),s&&(Yt=+(new Date));var n=Xt(t,e,!0),r=e.dataTransfer.files;if(!n||Ut(t))return;if(r&&r.length&&window.FileReader&&window.File){var i=r.length,o=Array(i),u=0,a=function(e,r){var s=new FileReader;s.onload=function(){o[r]=s.result,++u==i&&(n=Bn(t.doc,n),xn(t.doc,{from:n,to:n,text:Ps(o.join("\n")),origin:"paste"},"around"))},s.readAsText(e)};for(var f=0;fu.clientWidth||i&&u.scrollHeight>u.clientHeight))return;if(i&&g&&o)for(var a=n.target;a!=u;a=a.parentNode)if(a.lineObj){t.display.currentWheelTarget=a;break}if(r&&!e&&!f&&sn!=null){i&&tn(t,Math.max(0,Math.min(u.scrollTop+i*sn,u.scrollHeight-u.clientHeight))),nn(t,Math.max(0,Math.min(u.scrollLeft+r*sn,u.scrollWidth-u.clientWidth))),zi(n),s.wheelStartX=null;return}if(i&&sn!=null){var l=i*sn,c=t.doc.scrollTop,h=c+s.wrapper.clientHeight;l<0?c=Math.max(0,c+l-50):h=Math.min(t.doc.height,h+l+50),W(t,[],{top:c,bottom:h})}rn<20&&(s.wheelStartX==null?(s.wheelStartX=u.scrollLeft,s.wheelStartY=u.scrollTop,s.wheelDX=r,s.wheelDY=i,setTimeout(function(){if(s.wheelStartX==null)return;var e=u.scrollLeft-s.wheelStartX,t=u.scrollTop-s.wheelStartY,n=t&&s.wheelDY&&t/s.wheelDY||e&&s.wheelDX&&e/s.wheelDX;s.wheelStartX=s.wheelStartY=null;if(!n)return;sn=(sn*rn+n)/(rn+1),++rn},200)):(s.wheelDX+=r,s.wheelDY+=i))}function un(e,t,n){if(typeof t=="string"){t=dr[t];if(!t)return!1}e.display.pollingFast&&It(e)&&(e.display.pollingFast=!1);var r=e.doc,i=r.sel.shift,s=!1;try{Ut(e)&&(e.state.suppressEdits=!0),n&&(r.sel.shift=!1),s=t(e)!=os}finally{r.sel.shift=i,e.state.suppressEdits=!1}return s}function an(e){var t=e.state.keyMaps.slice(0);return e.options.extraKeys&&t.push(e.options.extraKeys),t.push(e.options.keyMap),t}function ln(e,t){var n=mr(e.options.keyMap),i=n.auto;clearTimeout(fn),i&&!yr(t)&&(fn=setTimeout(function(){mr(e.options.keyMap)==n&&(e.options.keyMap=i.call?i.call(null,e):i,M(e))},50));var s=br(t,!0),o=!1;if(!s)return!1;var u=an(e);return t.shiftKey?o=gr("Shift-"+s,u,function(t){return un(e,t,!0)})||gr(s,u,function(t){if(typeof t=="string"?/^go[A-Z]/.test(t):t.motion)return un(e,t)}):o=gr(s,u,function(t){return un(e,t)}),o&&(zi(t),nt(e),r&&(t.oldKeyCode=t.keyCode,t.keyCode=0),es(e,"keyHandled",e,s,t)),o}function cn(e,t,n){var r=gr("'"+n+"'",an(e),function(t){return un(e,t,!0)});return r&&(zi(t),nt(e),es(e,"keyHandled",e,"'"+n+"'",t)),r}function pn(e){var n=this;n.state.focused||vn(n);if(ts(n,e)||n.options.onKeyEvent&&n.options.onKeyEvent(n,Ui(e)))return;t&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;n.doc.sel.shift=r==16||e.shiftKey;var i=ln(n,e);!i&&n.state.accessibleTextareaWaiting&&qn(n),f&&(hn=i?r:null,!i&&r==88&&!Bs&&(g?e.metaKey:e.ctrlKey)&&n.replaceSelection(""))}function dn(e){var t=this;if(ts(t,e)||t.options.onKeyEvent&&t.options.onKeyEvent(t,Ui(e)))return;var n=e.keyCode,i=e.charCode;if(f&&n==hn){hn=null,zi(e);return}if((f&&(!e.which||e.which<10)||c)&&ln(t,e))return;var o=String.fromCharCode(i==null?n:i);if(cn(t,e,o))return;s&&!r&&(t.display.inputHasSelection=null),Ft(t)}function vn(e){if(e.options.readOnly=="nocursor")return;e.state.focused||(Gi(e,"focus",e),e.state.focused=!0,e.display.wrapper.className.search(/\bCodeMirror-focused\b/)==-1&&(e.display.wrapper.className+=" CodeMirror-focused"),e.curOp||(qt(e,!0),o&&setTimeout(gs(qt,e,!0),0))),jt(e),nt(e)}function mn(e){e.state.focused&&(Gi(e,"blur",e),e.state.focused=!1,e.display.wrapper.className=e.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.doc.sel.shift=!1)},150)}function yn(e,n){function c(){if(i.input.selectionStart!=null){var e=i.input.value="​"+(Mn(s.from,s.to)?"":i.input.value);i.prevInput="​",i.input.selectionStart=1,i.input.selectionEnd=e.length}}function h(){i.inputDiv.style.position="relative",i.input.style.cssText=l,r&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=u),jt(e);if(i.input.selectionStart!=null){(!t||r)&&c(),clearTimeout(gn);var n=0,s=function(){i.prevInput=="​"&&i.input.selectionStart==0?Dt(e,dr.selectAll)(e):n++<10?gn=setTimeout(s,500):qt(e)};gn=setTimeout(s,200)}}if(ts(e,n,"contextmenu"))return;var i=e.display,s=e.doc.sel;if(Wt(i,n)||Qt(e,n))return;var o=Xt(e,n),u=i.scroller.scrollTop;if(!o||f)return;var a=e.options.resetSelectionOnContextMenu;a&&(Mn(s.from,s.to)||_n(o,s.from)||!_n(o,s.to))&&Dt(e,Un)(e.doc,o,o);var l=i.input.style.cssText;i.inputDiv.style.position="absolute",i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(n.clientY-5)+"px; left: "+(n.clientX-5)+"px; z-index: 1000; background: transparent; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",Rt(e),qt(e,!0),Mn(s.from,s.to)&&(i.input.value=i.prevInput=" "),t&&!r&&c();if(E){Vi(n);var p=function(){Qi(window,"mouseup",p),setTimeout(h,20)};Ki(window,"mouseup",p)}else setTimeout(h,50)}function wn(e,t,n){if(!_n(t.from,n))return Bn(e,n);var r=t.text.length-1-(t.to.line-t.from.line);if(n.line>t.to.line+r){var i=n.line-r,s=e.first+e.size-1;return i>s?On(s,xi(e,s).text.length):jn(n,xi(e,i).text.length)}if(n.line==t.to.line+r)return jn(n,cs(t.text).length+(t.text.length==1?t.from.ch:0)+xi(e,t.to.line).text.length-t.to.ch);var o=n.line-t.from.line;return jn(n,t.text[o].length+(o?0:t.from.ch))}function En(e,t,n){if(n&&typeof n=="object")return{anchor:wn(e,t,n.anchor),head:wn(e,t,n.head)};if(n=="start")return{anchor:t.from,head:t.from};var r=bn(t);if(n=="around")return{anchor:t.from,head:r};if(n=="end")return{anchor:r,head:r};var i=function(e){if(_n(e,t.from))return e;if(!_n(t.to,e))return r;var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=r.ch-t.to.ch),On(n,i)};return{anchor:i(e.sel.anchor),head:i(e.sel.head)}}function Sn(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return n&&(r.update=function(t,n,r,i){t&&(this.from=Bn(e,t)),n&&(this.to=Bn(e,n)),r&&(this.text=r),i!==undefined&&(this.origin=i)}),Gi(e,"beforeChange",e,r),e.cm&&Gi(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function xn(e,t,n,r){if(e.cm){if(!e.cm.curOp)return Dt(e.cm,xn)(e,t,n,r);if(e.cm.state.suppressEdits)return}if(rs(e,"beforeChange")||e.cm&&rs(e.cm,"beforeChange")){t=Sn(e,t,!0);if(!t)return}var i=S&&!r&&Pr(e,t.from,t.to);if(i){for(var s=i.length-1;s>=1;--s)Tn(e,{from:i[s].from,to:i[s].to,text:[""]});i.length&&Tn(e,{from:i[0].from,to:i[0].to,text:t.text},n)}else Tn(e,t,n)}function Tn(e,t,n){if(t.text.length==1&&t.text[0]==""&&Mn(t.from,t.to))return;var r=En(e,t,n);Pi(e,t,r,e.cm?e.cm.curOp.id:NaN),kn(e,t,r,Mr(e,t));var i=[];Ei(e,function(e,n){!n&&ps(i,e.history)==-1&&(qi(e.history,t),i.push(e.history)),kn(e,t,null,Mr(e,t))})}function Nn(e,t){if(e.cm&&e.cm.state.suppressEdits)return;var n=e.history,r=(t=="undo"?n.done:n.undone).pop();if(!r)return;var i={changes:[],anchorBefore:r.anchorAfter,headBefore:r.headAfter,anchorAfter:r.anchorBefore,headAfter:r.headBefore,generation:n.generation};(t=="undo"?n.undone:n.done).push(i),n.generation=r.generation||++n.maxGeneration;var s=rs(e,"beforeChange")||e.cm&&rs(e.cm,"beforeChange");for(var o=r.changes.length-1;o>=0;--o){var u=r.changes[o];u.origin=t;if(s&&!Sn(e,u,!1)){(t=="undo"?n.done:n.undone).length=0;return}i.changes.push(Di(e,u));var a=o?En(e,u,null):{anchor:r.anchorBefore,head:r.headBefore};kn(e,u,a,Dr(e,u));var f=[];Ei(e,function(e,t){!t&&ps(f,e.history)==-1&&(qi(e.history,u),f.push(e.history)),kn(e,u,null,Dr(e,u))})}}function Cn(e,t){function n(e){return On(e.line+t,e.ch)}e.first+=t,e.cm&&Bt(e.cm,e.first,e.first,t),e.sel.head=n(e.sel.head),e.sel.anchor=n(e.sel.anchor),e.sel.from=n(e.sel.from),e.sel.to=n(e.sel.to)}function kn(e,t,n,r){if(e.cm&&!e.cm.curOp)return Dt(e.cm,kn)(e,t,n,r);if(t.to.linee.lastLine())return;if(t.from.lines&&(t={from:t.from,to:On(s,xi(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ti(e,t.from,t.to),n||(n=En(e,t,null)),e.cm?Ln(e.cm,t,r,n):di(e,t,r,n)}function Ln(e,t,n,r){var i=e.doc,s=e.display,o=t.from,u=t.to,a=!1,f=o.line;e.options.lineWrapping||(f=ki(Ur(i,xi(i,o.line))),i.iter(f,u.line+1,function(e){if(e==s.maxLine)return a=!0,!0})),!_n(i.sel.head,t.from)&&!_n(t.to,i.sel.head)&&(e.curOp.cursorActivity=!0),di(i,t,n,r,A(e)),e.options.lineWrapping||(i.iter(f,o.line+t.text.length,function(e){var t=H(i,e);t>s.maxLineLength&&(s.maxLine=e,s.maxLineLength=t,s.maxLineChanged=!0,a=!1)}),a&&(e.curOp.updateMaxLine=!0)),i.frontier=Math.min(i.frontier,o.line),rt(e,400);var l=t.text.length-(u.line-o.line)-1;Bt(e,o.line,u.line+1,l);if(rs(e,"change")){var c={from:o,to:u,text:t.text,removed:t.removed,origin:t.origin};if(e.curOp.textChanged){for(var h=e.curOp.textChanged;h.next;h=h.next);h.next=c}else e.curOp.textChanged=c}}function An(e,t,n,r,i){r||(r=n);if(_n(r,n)){var s=r;r=n,n=s}typeof t=="string"&&(t=Ps(t)),xn(e,{from:n,to:r,text:t,origin:i},null)}function On(e,t){if(!(this instanceof On))return new On(e,t);this.line=e,this.ch=t}function Mn(e,t){return e.line==t.line&&e.ch==t.ch}function _n(e,t){return e.linen?On(n,xi(e,n).text.length):jn(t,xi(e,t.line).text.length)}function jn(e,t){var n=e.ch;return n==null||n>t?On(e.line,t):n<0?On(e.line,0):e}function Fn(e,t){return t>=e.first&&t=s.ch:f.to>s.ch))){if(r){Gi(l,"beforeCursorEnter");if(l.explicitlyCleared){if(!u.markedSpans)break;--a;continue}}if(!l.atomic)continue;var c=l.find()[o<0?"from":"to"];if(Mn(c,s)){c.ch+=o,c.ch<0?c.line>e.first?c=Bn(e,On(c.line-1)):c=null:c.ch>u.text.length&&(c.line(window.innerHeight||document.documentElement.clientHeight)&&(i=!1);if(i!=null&&!d){var s=xs("div","​",null,"position: absolute; top: "+(t.top-n.viewOffset)+"px; height: "+(t.bottom-t.top+ss)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(i),e.display.lineSpace.removeChild(s)}}function Vn(e,t,n,r){r==null&&(r=0);for(;;){var i=!1,s=xt(e,t),o=!n||n==t?s:xt(e,n),u=Jn(e,Math.min(s.left,o.left),Math.min(s.top,o.top)-r,Math.max(s.left,o.left),Math.max(s.bottom,o.bottom)+r),a=e.doc.scrollTop,f=e.doc.scrollLeft;u.scrollTop!=null&&(tn(e,u.scrollTop),Math.abs(e.doc.scrollTop-a)>1&&(i=!0)),u.scrollLeft!=null&&(nn(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(i=!0));if(!i)return s}}function $n(e,t,n,r,i){var s=Jn(e,t,n,r,i);s.scrollTop!=null&&tn(e,s.scrollTop),s.scrollLeft!=null&&nn(e,s.scrollLeft)}function Jn(e,t,n,r,i){var s=e.display,o=Lt(e.display);n<0&&(n=0);var u=s.scroller.clientHeight-ss,a=s.scroller.scrollTop,f={},l=e.doc.height+at(s),c=nl-o;if(na+u){var p=Math.min(n,(h?l:i)-u);p!=a&&(f.scrollTop=p)}var d=s.scroller.clientWidth-ss,v=s.scroller.scrollLeft;t+=s.gutters.offsetWidth,r+=s.gutters.offsetWidth;var m=s.gutters.offsetWidth,g=td+v-3&&(f.scrollLeft=r+10-d),f}function Kn(e,t,n){e.curOp.updateScrollPos={scrollLeft:t==null?e.doc.scrollLeft:t,scrollTop:n==null?e.doc.scrollTop:n}}function Qn(e,t,n){var r=e.curOp.updateScrollPos||(e.curOp.updateScrollPos={scrollLeft:e.doc.scrollLeft,scrollTop:e.doc.scrollTop}),i=e.display.scroller;r.scrollTop=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,r.scrollTop+n)),r.scrollLeft=Math.max(0,Math.min(i.scrollWidth-i.clientWidth,r.scrollLeft+t))}function Gn(e,t,n,r){var i=e.doc;n==null&&(n="add");if(n=="smart")if(!e.doc.mode.indent)n="prev";else var s=ot(e,t);var o=e.options.tabSize,u=xi(i,t),a=as(u.text,null,o),f=u.text.match(/^\s*/)[0],l;if(!r&&!/\S/.test(u.text))l=0,n="not";else if(n=="smart"){l=e.doc.mode.indent(s,u.text.slice(f.length),u.text);if(l==os){if(!r)return;n="prev"}}n=="prev"?t>i.first?l=as(xi(i,t-1).text,null,o):l=0:n=="add"?l=a+e.options.indentUnit:n=="subtract"?l=a-e.options.indentUnit:typeof n=="number"&&(l=a+n),l=Math.max(0,l);var c="",h=0;if(e.options.indentWithTabs)for(var p=Math.floor(l/o);p;--p)h+=o,c+=" ";h=e.first+e.size?f=!1:(s=t,a=xi(e,t))}function c(e){var t=(i?Ks:Qs)(a,o,n,!0);if(t==null){if(!!e||!l())return f=!1;i?o=(n<0?Us:Rs)(a):o=n<0?a.text.length:0}else o=t;return!0}var s=t.line,o=t.ch,u=n,a=xi(e,s),f=!0;if(r=="char")c();else if(r=="column")c(!0);else if(r=="word"||r=="group"){var h=null,p=r=="group";for(var d=!0;;d=!1){if(n<0&&!c(!d))break;var v=a.text.charAt(o)||"\n",m=bs(v)?"w":p?/\s/.test(v)?null:"p":null;if(h&&h!=m){n<0&&(n=1,c());break}m&&(h=m);if(n>0&&!c(!d))break}}var g=Wn(e,On(s,o),u,!0);return f||(g.hitSide=!0),g}function er(e,t,n,r){var i=e.doc,s=t.left,o;if(r=="page"){var u=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);o=t.top+n*(u-(n<0?1.5:.5)*Lt(e.display))}else r=="line"&&(o=n>0?t.bottom+3:t.top-3);for(;;){var a=Nt(e,s,o);if(!a.outside)break;if(n<0?o<=0:o>=i.height){a.hitSide=!0;break}o+=n*5}return a}function tr(e,t){var n=t.ch,r=t.ch;if(e){(t.xRel<0||r==e.length)&&n?--n:++r;var i=e.charAt(n),s=bs(i)?bs:/\s/.test(i)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!bs(e)};while(n>0&&s(e.charAt(n-1)))--n;while(r=t:s.to>t);(i||(i=[])).push({from:s.from,to:a?null:s.to,marker:o})}}return i}function Or(e,t,n){if(e)for(var r=0,i;r=t:s.to>t);if(u||s.from==t&&o.type=="bookmark"&&(!n||s.marker.insertLeft)){var a=s.from==null||(o.inclusiveLeft?s.from<=t:s.from0&&u)for(var c=0;c=0&&c<=0||l<=0&&c>=0)continue;if(l<=0&&(Dn(f.to,n)||Br(a.marker)-Hr(i))>0||l>=0&&(Dn(f.from,r)||Hr(a.marker)-Br(i))<0)return!0}}function Ur(e,t){var n;while(n=Ir(t))t=xi(e,n.find().from.line);return t}function zr(e,t){var n=x&&t.markedSpans;if(n)for(var r,i=0;ie.options.maxHighlightLength?(o=!1,s&&ri(e,t,r,f.pos),f.pos=t.length,l=null):l=n.token(f,r);if(e.options.addModeClass){var c=T.innerMode(n,r).mode.name;c&&(l="m-"+(l?c+" "+l:c))}if(!o||a!=l)ue&&i.splice(u,1,e,i[u+1],r),u+=2,a=Math.min(e,r)}if(!t)return;if(o.opaque)i.splice(n,u-n,e,t),u=n+2;else for(;na)?(b.to!=null&&c>b.to&&(c=b.to,p=""),w.className&&(h+=" "+w.className),w.startStyle&&b.from==a&&(d+=" "+w.startStyle),w.endStyle&&b.to==c&&(p+=" "+w.endStyle),w.title&&!v&&(v=w.title),w.collapsed&&(!m||jr(m.marker,w)<0)&&(m=b)):b.from>a&&c>b.from&&(c=b.from),w.type=="bookmark"&&b.from==a&&w.replacedWith&&g.push(w)}if(m&&(m.from||0)==a){hi(t,(m.to==null?u:m.to)-a,m.marker,m.from==null);if(m.to==null)return m.marker.find()}if(!m&&g.length)for(var y=0;y=u)break;var E=Math.min(u,c);for(;;){if(f){var S=a+f.length;if(!m){var x=S>E?f.slice(0,E-a):f;t.addToken(t,x,l?l+h:h,d,a+x.length==c?p:"",v)}if(S>=E){f=f.slice(E-a),a=E;break}a=S,d=""}f=i.slice(s,s=n[o++]),l=oi(n[o++],t)}}}function di(e,t,n,r,i){function s(e){return n?n[e]:null}function o(e,n,r){Yr(e,n,r,i),es(e,"change",e,t)}var u=t.from,a=t.to,f=t.text,l=xi(e,u.line),c=xi(e,a.line),h=cs(f),p=s(f.length-1),d=a.line-u.line;if(u.ch==0&&a.ch==0&&h==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)){for(var v=0,m=f.length-1,g=[];v1&&e.remove(u.line+1,d-1),e.insert(u.line+1,g)}es(e,"change",e,t),Un(e,r.anchor,r.head,null,!0)}function vi(e){this.lines=e,this.parent=null;for(var t=0,n=e.length,r=0;ts-e.cm.options.historyEventDelay||t.origin.charAt(0)=="*"))){var u=cs(o.changes);Mn(t.from,t.to)&&Mn(t.from,u.to)?u.to=bn(t):o.changes.push(Di(e,t)),o.anchorAfter=n.anchor,o.headAfter=n.head}else{o={changes:[Di(e,t)],generation:i.generation,anchorBefore:e.sel.anchor,headBefore:e.sel.head,anchorAfter:n.anchor,headAfter:n.head},i.done.push(o);while(i.done.length>i.undoDepth)i.done.shift()}i.generation=++i.maxGeneration,i.lastTime=s,i.lastOp=r,i.lastOrigin=t.origin}function Hi(e){if(!e)return null;for(var t=0,n;t-1&&(cs(o)[l]=a[l],delete a[l])}}return r}function Fi(e,t,n,r){n0}function is(e){e.prototype.on=function(e,t){Ki(this,e,t)},e.prototype.off=function(e,t){Qi(this,e,t)}}function us(){this.id=null}function as(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var s=r||0,o=i||0;s"€"&&(e.toUpperCase()!=e.toLowerCase()||ys.test(e))}function ws(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Ss(e){return e.charCodeAt(0)>=768&&Es.test(e)}function xs(e,t,n,r){var i=document.createElement(e);n&&(i.className=n),r&&(i.style.cssText=r);if(typeof t=="string")Cs(i,t);else if(t)for(var s=0;s0;--t)e.removeChild(e.firstChild);return e}function Ns(e,t){return Ts(e).appendChild(t)}function Cs(e,t){r?(e.innerHTML="",e.appendChild(document.createTextNode(t))):e.textContent=t}function ks(e){return e.getBoundingClientRect()}function As(){return!1}function Ms(e){if(Os!=null)return Os;var t=xs("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return Ns(e,t),t.offsetWidth&&(Os=t.offsetHeight-t.clientHeight),Os||0}function Ds(e){if(_s==null){var t=xs("span","​");Ns(e,xs("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(_s=t.offsetWidth<=1&&t.offsetHeight>2&&!n)}return _s?xs("span","​"):xs("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function Fs(e,t,n,r){if(!e)return r(t,n,"ltr");var i=!1;for(var s=0;st||t==n&&o.to==t)r(Math.max(o.from,t),Math.min(o.to,n),o.level==1?"rtl":"ltr"),i=!0}i||r(t,n,"ltr")}function Is(e){return e.level%2?e.to:e.from}function qs(e){return e.level%2?e.from:e.to}function Rs(e){var t=Oi(e);return t?Is(t[0]):0}function Us(e){var t=Oi(e);return t?qs(cs(t)):e.text.length}function zs(e,t){var n=xi(e.doc,t),r=Ur(e.doc,n);r!=n&&(t=ki(r));var i=Oi(r),s=i?i[0].level%2?Us(r):Rs(r):0;return On(t,s)}function Ws(e,t){var n,r;while(n=qr(r=xi(e.doc,t)))t=n.find().to.line;var i=Oi(r),s=i?i[0].level%2?Rs(r):Us(r):r.text.length;return On(t,s)}function Xs(e,t,n){var r=e[0].level;return t==r?!0:n==r?!1:tt)return n;if(i.from==t||i.to==t){if(r!=null)return Xs(e,i.level,e[r].level)?(i.from!=i.to&&(Vs=r),n):(i.from!=i.to&&(Vs=n),r);r=n}}return r}function Js(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&Ss(e.text.charAt(t)));return t}function Ks(e,t,n,r){var i=Oi(e);if(!i)return Qs(e,t,n,r);var s=$s(i,t),o=i[s],u=Js(e,t,o.level%2?-n:n,r);for(;;){if(u>o.from&&u0==o.level%2?o.to:o.from);o=i[s+=n];if(!o)return null;n>0==o.level%2?u=Js(e,o.to,-1,r):u=Js(e,o.from,1,r)}}function Qs(e,t,n,r){var i=t+n;if(r)while(i>0&&Ss(e.text.charAt(i)))i+=n;return i<0||i>e.text.length?null:i}var e=/gecko\/\d/i.test(navigator.userAgent),t=/MSIE \d/.test(navigator.userAgent),n=t&&(document.documentMode==null||document.documentMode<8),r=t&&(document.documentMode==null||document.documentMode<9),i=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),s=t||i,o=/WebKit\//.test(navigator.userAgent),u=o&&/Qt\/\d+\.\d+/.test(navigator.userAgent),a=/Chrome\//.test(navigator.userAgent),f=/Opera\//.test(navigator.userAgent),l=/Apple Computer/.test(navigator.vendor),c=/KHTML\//.test(navigator.userAgent),h=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),d=/PhantomJS/.test(navigator.userAgent),v=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),m=v||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),g=v||/Mac/.test(navigator.platform),y=/win/i.test(navigator.platform),b=f&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);b&&(b=Number(b[1])),b&&b>=15&&(f=!1,o=!0);var w=g&&(u||f&&(b==null||b<12.11)),E=e||t&&!r,S=!1,x=!1,kt,Ot=0,Vt,$t,Yt=0,rn=0,sn=null;t?sn=-0.53:e?sn=15:a?sn=-0.7:l&&(sn=-1/3);var fn,hn=null,gn,bn=T.changeEnd=function(e){return e.text?On(e.from.line+e.text.length-1,cs(e.text).length+(e.text.length==1?e.from.ch:0)):e.to};T.Pos=On,T.prototype={constructor:T,focus:function(){window.focus(),Rt(this),Ft(this)},setOption:function(e,t){var n=this.options,r=n[e];if(n[e]==t&&e!="mode")return;n[e]=t,rr.hasOwnProperty(e)&&Dt(this,rr[e])(this,t,r)},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](e)},removeKeyMap:function(e){var t=this.state.keyMaps;for(var n=0;n>1;if((s?t[s*2-1]:0)>=i)r=s;else{if(!(t[s*2+1]r&&(e=r,n=!0);var i=xi(this.doc,e);return wt(this,xi(this.doc,e),{top:0,left:0},t||"page").top+(n?i.height:0)},defaultTextHeight:function(){return Lt(this.display)},defaultCharWidth:function(){return At(this.display)},setGutterMarker:Dt(null,function(e,t,n){return Yn(this,e,function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&ws(r)&&(e.gutterMarkers=null),!0})}),clearGutter:Dt(null,function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,Bt(t,r,r+1),ws(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),addLineClass:Dt(null,function(e,t,n){return Yn(this,e,function(e){var r=t=="text"?"textClass":t=="background"?"bgClass":"wrapClass";if(!e[r])e[r]=n;else{if((new RegExp("(?:^|\\s)"+n+"(?:$|\\s)")).test(e[r]))return!1;e[r]+=" "+n}return!0})}),removeLineClass:Dt(null,function(e,t,n){return Yn(this,e,function(e){var r=t=="text"?"textClass":t=="background"?"bgClass":"wrapClass",i=e[r];if(!i)return!1;if(n==null)e[r]=null;else{var s=i.match(new RegExp("(?:^|\\s+)"+n+"(?:$|\\s+)"));if(!s)return!1;var o=s.index+s[0].length;e[r]=i.slice(0,s.index)+(!s.index||o==i.length?"":" ")+i.slice(o)||null}return!0})}),addLineWidget:Dt(null,function(e,t,n){return Qr(this,e,t,n)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if(typeof e=="number"){if(!Fn(this.doc,e))return null;var t=e;e=xi(this.doc,e);if(!e)return null}else{var t=ki(e);if(t==null)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(e,t,n,r,i){var s=this.display;e=xt(this,Bn(this.doc,e));var o=e.bottom,u=e.left;t.style.position="absolute",s.sizer.appendChild(t);if(r=="over")o=e.top;else if(r=="above"||r=="near"){var a=Math.max(s.wrapper.clientHeight,this.doc.height),f=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(r=="above"||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?o=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(o=e.bottom),u+t.offsetWidth>f&&(u=f-t.offsetWidth)}t.style.top=o+"px",t.style.left=t.style.right="",i=="right"?(u=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):(i=="left"?u=0:i=="middle"&&(u=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),n&&$n(this,u,o,u+t.offsetWidth,o+t.offsetHeight)},triggerOnKeyDown:Dt(null,pn),execCommand:function(e){if(dr.hasOwnProperty(e))return dr[e](this)},findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var s=0,o=Bn(this.doc,e);s2){t.dependencies=[];for(var n=2;n0&&t.ch=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.post},eatSpace:function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}var r=function(e){return n?e.toLowerCase():e},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}},T.StringStream=wr,T.TextMarker=Er,is(Er),Er.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;t&&Mt(e);if(rs(this,"clear")){var n=this.find();n&&es(this,"clear",n.from,n.to)}var r=null,i=null;for(var s=0;se.display.maxLineLength&&(e.display.maxLine=a,e.display.maxLineLength=f,e.display.maxLineChanged=!0)}r!=null&&e&&Bt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&zn(e)),t&&_t(e)},Er.prototype.find=function(e){var t,n;for(var r=0;r=t.display.showingFrom&&e.line50){while(s.lines.length>50){var u=s.lines.splice(s.lines.length-25,25),a=new vi(u);s.height-=a.height,this.children.splice(r+1,0,a),a.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new mi(t);if(!e.parent){var r=new mi(e.children);r.parent=e,e.children=[r,n],e=r}else{e.size-=n.size,e.height-=n.height;var i=ps(e.parent.children,e);e.parent.children.splice(i+1,0,n)}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0,i=this.children.length;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=i,++n}),Bn(this,On(n,t))},indexFromPos:function(e){e=Bn(this,e);var t=e.ch;return e.linet&&(t=e.from),e.to!=null&&e.to=8208&&n<=8212}:o&&(As=function(e,t){if(t>1&&e.charCodeAt(t-1)==45){if(/\w/.test(e.charAt(t-2))&&/[^\-?\.]/.test(e.charAt(t)))return!0;if(t>2&&/[\d\.,]/.test(e.charAt(t-2))&&/[\d\.,]/.test(e.charAt(t)))return!1}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|\u2026[\w~`@#$%\^&*(_=+{[><]/.test(e.slice(t-1,t+1))});var Os,_s,Ps="\n\nb".split(/\n/).length!=3?function(e){var t=0,n=[],r=e.length;while(t<=r){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var s=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),o=s.indexOf("\r");o!=-1?(n.push(s.slice(0,o)),t+=o+1):(n.push(s),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)};T.splitLines=Ps;var Hs=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Bs=function(){var e=xs("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),js={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};T.keyNames=js,function(){for(var e=0;e<10;e++)js[e+48]=js[e+96]=String(e);for(var e=65;e<=90;e++)js[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)js[e+111]=js[e+63235]="F"+e}();var Vs,Gs=function(){function n(n){return n<=255?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1791?t.charAt(n-1536):1792<=n&&n<=2220?"r":"L"}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",t="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,s=/[LRr]/,o=/[Lb1n]/,u=/[1n]/,a="L";return function(e){if(!r.test(e))return!1;var t=e.length,f=[];for(var l=0,c;lr.ch&&(h=h.slice(0,h.length-s.end+r.ch));var p=h.toLowerCase();if(!h||s.type=="string"&&(s.end!=r.ch||!/[\"\']/.test(s.string.charAt(s.string.length-1))||s.string.length==1)||s.type=="tag"&&u.type=="closeTag"||s.string.indexOf("/")==s.string.length-1||l&&i(l,p)>-1||CodeMirror.scanForClosingTag&&CodeMirror.scanForClosingTag(n,r,h,Math.min(n.lastLine()+1,r.line+50)))return CodeMirror.Pass;var d=c&&i(c,p)>-1,v=d?CodeMirror.Pos(r.line+1,0):CodeMirror.Pos(r.line,r.ch+1);n.replaceSelection(">"+(d?"\n\n":"")+"",{head:v,anchor:v}),d&&(n.indentLine(r.line+1,null,!0),n.indentLine(r.line+2,null))}function r(e){var t=e.getCursor(),n=e.getTokenAt(t),r=CodeMirror.innerMode(e.getMode(),n.state),i=r.state;if(n.type=="string"||n.string.charAt(0)!="<"||n.start!=t.ch-1||r.mode.name!="xml"||e.getOption("disableInput"))return CodeMirror.Pass;var s=i.context&&i.context.tagName;s&&e.replaceSelection("/"+s+">","end")}function i(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n'"]=function(e){return n(e)};e.addKeyMap(s)});var e=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],t=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"]}(),function(){"use strict";function r(e){var n=e.search(t);return n==-1?0:n}var e={},t=/[^\s\u00a0]/,n=CodeMirror.Pos;CodeMirror.commands.toggleComment=function(e){var t=e.getCursor("start"),n=e.getCursor("end");e.uncomment(t,n)||e.lineComment(t,n)},CodeMirror.defineExtension("lineComment",function(i,s,o){o||(o=e);var u=this,a=u.getModeAt(i),f=o.lineComment||a.lineComment;if(!f){if(o.blockCommentStart||a.blockCommentStart)o.fullLines=!0,u.blockComment(i,s,o);return}var l=u.getLine(i.line);if(l==null)return;var c=Math.min(s.ch!=0||s.line==i.line?s.line+1:s.line,u.lastLine()+1),h=o.padding==null?" ":o.padding,p=o.commentBlankLines||i.line==s.line;u.operation(function(){if(o.indent){var e=l.slice(0,r(l));for(var s=i.line;sl)return;o.operation(function(){if(s.fullLines!=0){var e=t.test(o.getLine(l));o.replaceRange(c+f,n(l)),o.replaceRange(a+c,n(r.line,0));var h=s.blockCommentLead||u.blockCommentLead;if(h!=null)for(var p=r.line+1;p<=l;++p)(p!=l||e)&&o.replaceRange(h+c,n(p,0))}else o.replaceRange(f,i),o.replaceRange(a,r)})}),CodeMirror.defineExtension("uncomment",function(r,i,s){s||(s=e);var o=this,u=o.getModeAt(r),a=Math.min(i.line,o.lastLine()),f=Math.min(r.line,a),l=s.lineComment||u.lineComment,c=[],h=s.padding==null?" ":s.padding,p;e:{if(!l)break e;for(var d=f;d<=a;++d){var v=o.getLine(d),m=v.indexOf(l);m>-1&&!/comment/.test(o.getTokenTypeAt(n(d,m+1)))&&(m=-1);if(!(m!=-1||d==a&&d!=f||!t.test(v)))break e;if(m>-1&&t.test(v.slice(0,m)))break e;c.push(v)}o.operation(function(){for(var e=f;e<=a;++e){var t=c[e-f],r=t.indexOf(l),i=r+l.length;if(r<0)continue;t.slice(i,i+h.length)==h&&(i+=h.length),p=!0,o.replaceRange("",n(e,r),n(e,i))}});if(p)return!0}var g=s.blockCommentStart||u.blockCommentStart,y=s.blockCommentEnd||u.blockCommentEnd;if(!g||!y)return!1;var b=s.blockCommentLead||u.blockCommentLead,w=o.getLine(f),E=a==f?w:o.getLine(a),S=w.indexOf(g),x=E.lastIndexOf(y);return x==-1&&f!=a&&(E=o.getLine(--a),x=E.lastIndexOf(y)),S==-1||x==-1||!/comment/.test(o.getTokenTypeAt(n(f,S+1)))||!/comment/.test(o.getTokenTypeAt(n(a,x+1)))?!1:(o.operation(function(){o.replaceRange("",n(a,x-(h&&E.slice(x-h.length,x)==h?h.length:0)),n(a,x+y.length));var e=S+g.length;h&&w.slice(e,e+h.length)==h&&(e+=h.length),o.replaceRange("",n(f,S),n(f,e));if(b)for(var r=f+1;r<=a;++r){var i=o.getLine(r),s=i.indexOf(b);if(s==-1||t.test(i.slice(0,s)))continue;var u=s+b.length;h&&i.slice(u,u+h.length)==h&&(u+=h.length),o.replaceRange("",n(r,s),n(r,u))}}),!0)})}(),CodeMirror.defineMode("css",function(e,t){"use strict";function p(e,t){return c=t,e}function d(e,t){var n=e.next();if(r[n]){var i=r[n](e,t);if(i!==!1)return i}if(n=="@")return e.eatWhile(/[\w\\\-]/),p("def",e.current());if(n=="="||(n=="~"||n=="|")&&e.eat("="))return p(null,"compare");if(n=='"'||n=="'")return t.tokenize=v(n),t.tokenize(e,t);if(n=="#")return e.eatWhile(/[\w\\\-]/),p("atom","hash");if(n=="!")return e.match(/^\s*\w*/),p("keyword","important");if(/\d/.test(n)||n=="."&&e.eat(/\d/))return e.eatWhile(/[\w.%]/),p("number","unit");if(n!=="-")return/[,+>*\/]/.test(n)?p(null,"select-op"):n=="."&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?p("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(n)?p(null,n):n=="u"&&e.match("rl(")?(e.backUp(1),t.tokenize=m,p("property","word")):/[\w\\\-]/.test(n)?(e.eatWhile(/[\w\\\-]/),p("property","word")):p(null,null);if(/[\d.]/.test(e.peek()))return e.eatWhile(/[\w.%]/),p("number","unit");if(e.match(/^[^-]+-/))return p("meta","meta")}function v(e){return function(t,n){var r=!1,i;while((i=t.next())!=null){if(i==e&&!r){e==")"&&t.backUp(1);break}r=!r&&i=="\\"}if(i==e||!r&&e!=")")n.tokenize=null;return p("string","string")}}function m(e,t){return e.next(),e.match(/\s*[\"\']/,!1)?t.tokenize=null:t.tokenize=v(")"),p(null,"(")}function g(e,t,n){this.type=e,this.indent=t,this.prev=n}function y(e,t,r){return e.context=new g(r,t.indentation()+n,e.context),r}function b(e){return e.context=e.context.prev,e.context.type}function w(e,t,n){return x[n.context.type](e,t,n)}function E(e,t,n,r){for(var i=r||1;i>0;i--)n.context=n.context.prev;return w(e,t,n)}function S(e){var t=e.current().toLowerCase();a.hasOwnProperty(t)?h="atom":u.hasOwnProperty(t)?h="keyword":h="variable"}t.propertyKeywords||(t=CodeMirror.resolveMode("text/css"));var n=e.indentUnit,r=t.tokenHooks,i=t.mediaTypes||{},s=t.mediaFeatures||{},o=t.propertyKeywords||{},u=t.colorKeywords||{},a=t.valueKeywords||{},f=t.fontProperties||{},l=t.allowNested,c,h,x={};return x.top=function(e,t,n){if(e=="{")return y(n,t,"block");if(e=="}"&&n.context.prev)return b(n);if(e=="@media")return y(n,t,"media");if(e=="@font-face")return"font_face_before";if(e&&e.charAt(0)=="@")return y(n,t,"at");if(e=="hash")h="builtin";else if(e=="word")h="tag";else{if(e=="variable-definition")return"maybeprop";if(e=="interpolation")return y(n,t,"interpolation");if(e==":")return"pseudo";if(l&&e=="(")return y(n,t,"params")}return n.context.type},x.block=function(e,t,n){return e=="word"?o.hasOwnProperty(t.current().toLowerCase())?(h="property","maybeprop"):l?(h=t.match(/^\s*:/,!1)?"property":"tag","block"):(h+=" error","maybeprop"):e=="meta"?"block":!!l||e!="hash"&&e!="qualifier"?x.top(e,t,n):(h="error","block")},x.maybeprop=function(e,t,n){return e==":"?y(n,t,"prop"):w(e,t,n)},x.prop=function(e,t,n){if(e==";")return b(n);if(e=="{"&&l)return y(n,t,"propBlock");if(e=="}"||e=="{")return E(e,t,n);if(e=="(")return y(n,t,"parens");if(e=="hash"&&!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t.current()))h+=" error";else if(e=="word")S(t);else if(e=="interpolation")return y(n,t,"interpolation");return"prop"},x.propBlock=function(e,t,n){return e=="}"?b(n):e=="word"?(h="property","maybeprop"):n.context.type},x.parens=function(e,t,n){return e=="{"||e=="}"?E(e,t,n):e==")"?b(n):"parens"},x.pseudo=function(e,t,n){return e=="word"?(h="variable-3",n.context.type):w(e,t,n)},x.media=function(e,t,n){if(e=="(")return y(n,t,"media_parens");if(e=="}")return E(e,t,n);if(e=="{")return b(n)&&y(n,t,l?"block":"top");if(e=="word"){var r=t.current().toLowerCase();r=="only"||r=="not"||r=="and"?h="keyword":i.hasOwnProperty(r)?h="attribute":s.hasOwnProperty(r)?h="property":h="error"}return n.context.type},x.media_parens=function(e,t,n){return e==")"?b(n):e=="{"||e=="}"?E(e,t,n,2):x.media(e,t,n)},x.font_face_before=function(e,t,n){return e=="{"?y(n,t,"font_face"):w(e,t,n)},x.font_face=function(e,t,n){return e=="}"?b(n):e=="word"?(f.hasOwnProperty(t.current().toLowerCase())?h="property":h="error","maybeprop"):"font_face"},x.at=function(e,t,n){return e==";"?b(n):e=="{"||e=="}"?E(e,t,n):(e=="word"?h="tag":e=="hash"&&(h="builtin"),"at")},x.interpolation=function(e,t,n){return e=="}"?b(n):e=="{"||e==";"?E(e,t,n):(e!="variable"&&(h="error"),"interpolation")},x.params=function(e,t,n){return e==")"?b(n):e=="{"||e=="}"?E(e,t,n):(e=="word"&&S(t),"params")},{startState:function(e){return{tokenize:null,state:"top",context:new g("top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var n=(t.tokenize||d)(e,t);return n&&typeof n=="object"&&(c=n[1],n=n[0]),h=n,t.state=x[t.state](c,e,t),h},indent:function(e,t){var r=e.context,i=t&&t.charAt(0),s=r.indent;return r.prev&&(i=="}"&&(r.type=="block"||r.type=="top"||r.type=="interpolation"||r.type=="font_face")||i==")"&&(r.type=="parens"||r.type=="params"||r.type=="media_parens")||i=="{"&&(r.type=="at"||r.type=="media"))&&(s=r.indent-n,r=r.prev),s},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}}),function(){function e(e){var t={};for(var n=0;n")?(e.match("-->"),t.tokenize=null):e.skipToEnd(),["comment","comment"]}var t=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],n=e(t),r=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],i=e(r),s=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid-cell","grid-column","grid-column-align","grid-column-sizing","grid-column-span","grid-columns","grid-flow","grid-row","grid-row-align","grid-row-sizing","grid-row-span","grid-rows","grid-template","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-inside","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function" -,"unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","zoom","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-profile","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","kerning","text-anchor","writing-mode"],o=e(s),u=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],a=e(u),f=["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"],l=e(f),c=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],h=e(c),p=t.concat(r).concat(s).concat(u).concat(f);CodeMirror.registerHelper("hintWords","css",p),CodeMirror.defineMIME("text/css",{mediaTypes:n,mediaFeatures:i,propertyKeywords:o,colorKeywords:a,valueKeywords:l,fontProperties:h,tokenHooks:{"<":function(e,t){return e.match("!--")?(t.tokenize=v,v(e,t)):!1},"/":function(e,t){return e.eat("*")?(t.tokenize=d,d(e,t)):!1}},name:"css"}),CodeMirror.defineMIME("text/x-scss",{mediaTypes:n,mediaFeatures:i,propertyKeywords:o,colorKeywords:a,valueKeywords:l,fontProperties:h,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=d,d(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),CodeMirror.defineMIME("text/x-less",{mediaTypes:n,mediaFeatures:i,propertyKeywords:o,colorKeywords:a,valueKeywords:l,fontProperties:h,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=d,d(e,t)):["operator","operator"]},"@":function(e){return e.match(/^(charset|document|font-face|import|keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}(),CodeMirror.defineMode("diff",function(){var e={"+":"positive","-":"negative","@":"meta"};return{token:function(t){var n=t.string.search(/[\t ]+?$/);if(!t.sol()||n===0)return t.skipToEnd(),("error "+(e[t.string.charAt(0)]||"")).replace(/ $/,"");var r=e[t.peek()]||t.skipToEnd();return n===-1?t.skipToEnd():t.pos=n,r}}}),CodeMirror.defineMIME("text/x-diff","diff");var schematic_height=220,schematic_width=400,styling_height_delta=2,styling_width_delta=2,schematic_editor_height=300,schematic_editor_width=500;$(function(){$(document).ready(function(){$("body").append(' ');var e=$("#schematic_editor").get(0),t=null;$(".schematic_open").live("click",function(){t=$(this).children("input.schematic").get(0),t.schematic.update_value();var n=$(t).val(),r=e.schematic.components.length;for(var i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}function N(e,t){var n;if(e.sol()&&e.match(b))return e.skipToEnd(),T;if(t.indentationDiff>=4)return t.indentation-=t.indentationDiff,e.skipToEnd(),s;if(e.eatSpace())return null;if(e.peek()==="#"||e.match(g))t.header=!0;else if(e.eat(">"))t.indentation++,t.quote=!0;else{if(e.peek()==="[")return w(e,t,_);if(e.match(d,!0))return a;if(n=e.match(v,!0)||e.match(m,!0))return t.indentation+=n[0].length,u}return w(e,t,t.inline)}function C(e,t){var i=r.token(e,t.htmlState);return n&&i==="tag"&&t.htmlState.type!=="openTag"&&!t.htmlState.context&&(t.f=A,t.block=N),t.md_inside&&e.current().indexOf(">")!=-1&&(t.f=A,t.block=N,t.htmlState.context=undefined),i}function k(e){var t=[];return e.strong?t.push(e.em?p:h):e.em&&t.push(c),e.header&&t.push(i),e.quote&&t.push(o),t.length?t.join(" "):null}function L(e,t){return e.match(y,!0)?k(t):undefined}function A(e,t){var n=t.text(e,t);if(typeof n!="undefined")return n;var r=e.next();if(r==="\\")return e.next(),k(t);if(r==="`")return w(e,t,H(s,"`"));if(r==="[")return w(e,t,O);if(r==="<"&&e.match(/^\w/,!1)){var i=!1;if(e.string.indexOf(">")!=-1){var o=e.string.substring(1,e.string.indexOf(">"));/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(o)&&(t.md_inside=!0)}return e.backUp(1),E(e,t,C)}if(r==="<"&&e.match(/^\/\w*?>/))return t.md_inside=!1,"tag";var u=k(t);return r==="*"||r==="_"?e.eat(r)?(t.strong=!t.strong)?k(t):u:(t.em=!t.em)?k(t):u:k(t)}function O(e,t){while(!e.eol()){var n=e.next();n==="\\"&&e.next();if(n==="]")return t.inline=t.f=M,f}return f}function M(e,t){e.eatSpace();var n=e.next();return n==="("||n==="["?w(e,t,H(l,n==="("?")":"]")):"error"}function _(e,t){return e.match(/^[^\]]*\]:/,!0)?(t.f=D,f):w(e,t,A)}function D(e,t){return e.eatSpace(),e.match(/^[^\s]+/,!0),t.f=t.inline=A,l}function P(e){return P[e]||(P[e]=new RegExp("^(?:[^\\\\\\"+e+"]|\\\\.)*(?:\\"+e+"|$)")),P[e]}function H(e,t,n){return n=n||A,function(r,i){return r.match(P(t)),i.inline=i.f=n,e}}var n=CodeMirror.mimeModes.hasOwnProperty("text/html"),r=CodeMirror.getMode(e,n?"text/html":"text/plain"),i="header",s="comment",o="quote",u="string",a="hr",f="link",l="string",c="em",h="strong",p="emstrong",d=/^([*\-=_])(?:\s*\1){2,}\s*$/,v=/^[*\-+]\s+/,m=/^[0-9]+\.\s+/,g=/^(?:\={3,}|-{3,})$/,y=/^[^\[*_\\<>`]+/,b=/^circuit-schematic:(.*)$/,T={creator:function(e){var t=e.match(b)[1];t=x(t);var n="
";return n},size:function(e){return{width:schematic_width+styling_width_delta,height:schematic_height+styling_height_delta}},callback:function(e,t){try{update_schematics();var n=e.firstChild.firstChild;n.codeMirrorLine=t,n.schematic&&(n.schematic.canvas.style.display="block",n.schematic.always_draw_grid=!0,n.schematic.redraw_background())}catch(r){console.log("Error in edx_markdown callback: "+r)}}};return{startState:function(){return{f:N,block:N,htmlState:CodeMirror.startState(r),indentation:0,inline:A,text:L,em:!1,strong:!1,header:!1,quote:!1}},copyState:function(e){return{f:e.f,block:e.block,htmlState:CodeMirror.copyState(r,e.htmlState),indentation:e.indentation,inline:e.inline,text:e.text,em:e.em,strong:e.strong,header:e.header,quote:e.quote,md_inside:e.md_inside}},token:function(e,t){if(e.sol()){if(e.match(/^\s*$/,!0))return S(t);t.header=!1,t.quote=!1,t.f=t.block;var n=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;t.indentationDiff=n-t.indentation,t.indentation=n;if(n>0)return null}return t.f(e,t)},blankLine:S,getType:k}},"xml"),CodeMirror.defineMIME("text/x-markdown","markdown"),function(){CodeMirror.extendMode("css",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(e,t){return/^[;{}]$/.test(t)}}),CodeMirror.extendMode("javascript",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(e,t,n,r){return this.jsonMode?/^[\[,{]$/.test(t)||/^}/.test(n):t==";"&&r.lexical&&r.lexical.type==")"?!1:/^[;{}]$/.test(t)&&!/^;/.test(n)}});var e=/^(a|abbr|acronym|area|base|bdo|big|br|button|caption|cite|code|col|colgroup|dd|del|dfn|em|frame|hr|iframe|img|input|ins|kbd|label|legend|link|map|object|optgroup|option|param|q|samp|script|select|small|span|strong|sub|sup|textarea|tt|var)$/;CodeMirror.extendMode("xml",{commentStart:"",newlineAfterToken:function(t,n,r,i){var s=!1;return this.configuration=="html"&&(s=i.context?e.test(i.context.tagName):!1),!s&&(t=="tag"&&/>$/.test(n)&&i.context||/^-1&&u>-1&&u>o&&(s=s.substr(0,o)+s.substring(o+i.commentStart.length,u)+s.substr(u+i.commentEnd.length)),r.replaceRange(s,t,n)}})}),CodeMirror.defineExtension("autoIndentRange",function(e,t){var n=this;this.operation(function(){for(var r=e.line;r<=t.line;r++)n.indentLine(r,"smart")})}),CodeMirror.defineExtension("autoFormatRange",function(e,t){function l(){u+="\n",f=!0,++a}var n=this,r=n.getMode(),i=n.getRange(e,t).split("\n"),s=CodeMirror.copyState(r,n.getTokenAt(e).state),o=n.getOption("tabSize"),u="",a=0,f=e.ch==0;for(var c=0;c/i,i,s;return{startState:function(){return i=i||CodeMirror.getMode(e,t.scriptingModeSpec),s=s||CodeMirror.getMode(e,"htmlmixed"),{token:t.startOpen?u:o,htmlState:CodeMirror.startState(s),scriptState:CodeMirror.startState(i)}},token:function(e,t){return t.token(e,t)},indent:function(e,t){if(e.token==o)return s.indent(e.htmlState,t);if(i.indent)return i.indent(e.scriptState,t)},copyState:function(e){return{token:e.token,htmlState:CodeMirror.copyState(s,e.htmlState),scriptState:CodeMirror.copyState(i,e.scriptState)}},innerMode:function(e){return e.token==u?{state:e.scriptState,mode:i}:{state:e.htmlState,mode:s}}}},"htmlmixed"),CodeMirror.defineMIME("application/x-ejs",{name:"htmlembedded",scriptingModeSpec:"javascript"}),CodeMirror.defineMIME("application/x-aspx",{name:"htmlembedded",scriptingModeSpec:"text/x-csharp"}),CodeMirror.defineMIME("application/x-jsp",{name:"htmlembedded",scriptingModeSpec:"text/x-java"}),CodeMirror.defineMIME("application/x-erb",{name:"htmlembedded",scriptingModeSpec:"ruby"}),CodeMirror.defineMode("htmlmixed",function(e,t){function a(e,t){var s=t.htmlState.tagName,o=n.token(e,t.htmlState);if(s=="script"&&/\btag\b/.test(o)&&e.current()==">"){var u=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);u=u?u[1]:"",u&&/[\"\']/.test(u.charAt(0))&&(u=u.slice(1,u.length-1));for(var a=0;a"&&(t.token=c,t.localMode=r,t.localState=r.startState(n.indent(t.htmlState,"")));return o}function f(e,t,n){var r=e.current(),i=r.search(t),s;if(i>-1)e.backUp(r.length-i);else if(s=r.match(/<\/?$/))e.backUp(r.length),e.match(t,!1)||e.match(r);return n}function l(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=a,t.localState=t.localMode=null,a(e,t)):f(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function c(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=a,t.localState=t.localMode=null,a(e,t)):f(e,/<\/\s*style\s*>/,r.token(e,t.localState))}var n=CodeMirror.getMode(e,{name:"xml",htmlMode:!0}),r=CodeMirror.getMode(e,"css"),i=[],s=t&&t.scriptTypes;i.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:CodeMirror.getMode(e,"javascript")});if(s)for(var o=0;o"))return c("=>","operator");if(n=="0"&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),c("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),c("number","number");if(n=="/")return e.eat("*")?(t.tokenize=d,d(e,t)):e.eat("/")?(e.skipToEnd(),c("comment","comment")):t.lastType=="operator"||t.lastType=="keyword c"||t.lastType=="sof"||/^[\[{}\(,;:]$/.test(t.lastType)?(a(e),e.eatWhile(/[gimy]/),c("regexp","string-2")):(e.eatWhile(u),c("operator","operator",e.current()));if(n=="`")return t.tokenize=v,v(e,t);if(n=="#")return e.skipToEnd(),c("error","error");if(u.test(n))return e.eatWhile(u),c("operator","operator",e.current());e.eatWhile(/[\w\$_]/);var r=e.current(),i=o.propertyIsEnumerable(r)&&o[r];return i&&t.lastType!="."?c(i.type,i.style,r):c("variable","variable",r)}function p(e){return function(t,n){var r=!1,i;while((i=t.next())!=null){if(i==e&&!r)break;r=!r&&i=="\\"}return r||(n.tokenize=h),c("string","string")}}function d(e,t){var n=!1,r;while(r=e.next()){if(r=="/"&&n){t.tokenize=h;break}n=r=="*"}return c("comment","comment")}function v(e,t){var n=!1,r;while((r=e.next())!=null){if(!n&&(r=="`"||r=="$"&&e.eat("{"))){t.tokenize=h;break}n=!n&&r=="\\"}return c("quasi","string-2",e.current())}function g(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(n<0)return;var r=0,i=!1;for(var s=n-1;s>=0;--s){var o=e.string.charAt(s),u=m.indexOf(o);if(u>=0&&u<3){if(!r){++s;break}if(--r==0)break}else if(u>=3&&u<6)++r;else if(/[$\w]/.test(o))i=!0;else if(i&&!r){++s;break}}i&&!r&&(t.fatArrowAt=s)}function b(e,t,n,r,i,s){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=s,r!=null&&(this.align=r)}function w(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(var n=r.vars;n;n=n.next)if(n.name==t)return!0}function E(e,t,n,r,s){var o=e.cc;S.state=e,S.stream=s,S.marked=null,S.cc=o,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);for(;;){var u=o.length?o.pop():i?D:_;if(u(n,r)){while(o.length&&o[o.length-1].lex)o.pop()();return S.marked?S.marked:n=="variable"&&w(e,r)?"variable-2":t}}}function x(){for(var e=arguments.length-1;e>=0;e--)S.cc.push(arguments[e])}function T(){return x.apply(null,arguments),!0}function N(e){function n(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var r=S.state;if(r.context){S.marked="def";if(n(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(n(r.globalVars))return;t.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function k(){S.state.context={prev:S.state.context,vars:S.state.localVars},S.state.localVars=C}function L(){S.state.localVars=S.state.context.vars,S.state.context=S.state.context.prev}function A(e,t){var n=function(){var n=S.state,r=n.indented;n.lexical.type=="stat"&&(r=n.lexical.indented),n.lexical=new b(r,S.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function O(){var e=S.state;e.lexical.prev&&(e.lexical.type==")"&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function M(e){return function(t){return t==e?T():e==";"?x():T(arguments.callee)}}function _(e,t){return e=="var"?T(A("vardef",t.length),et,M(";"),O):e=="keyword a"?T(A("form"),D,_,O):e=="keyword b"?T(A("form"),_,O):e=="{"?T(A("}"),G,O):e==";"?T():e=="if"?T(A("form"),D,_,O,st):e=="function"?T(ct):e=="for"?T(A("form"),ot,_,O):e=="variable"?T(A("stat"),W):e=="switch"?T(A("form"),D,A("}","switch"),M("{"),G,O,O):e=="case"?T(D,M(":")):e=="default"?T(M(":")):e=="catch"?T(A("form"),k,M("("),ht,M(")"),_,O,L):e=="module"?T(A("form"),k,mt,L,O):e=="class"?T(A("form"),pt,vt,O):e=="export"?T(A("form"),gt,O):e=="import"?T(A("form"),yt,O):x(A("stat"),D,M(";"),O)}function D(e){return H(e,!1)}function P(e){return H(e,!0)}function H(e,t){if(S.state.fatArrowAt==S.stream.start){var n=t?z:U;if(e=="(")return T(k,A(")"),K(tt,")"),O,M("=>"),n,L);if(e=="variable")return x(k,tt,M("=>"),n,L)}var r=t?I:F;return y.hasOwnProperty(e)?T(r):e=="function"?T(ct):e=="keyword c"?T(t?j:B):e=="("?T(A(")"),B,xt,M(")"),O,r):e=="operator"||e=="spread"?T(t?P:D):e=="["?T(A("]"),Et,O,r):e=="{"?Q(V,"}",null,r):T()}function B(e){return e.match(/[;\}\)\],]/)?x():x(D)}function j(e){return e.match(/[;\}\)\],]/)?x():x(P)}function F(e,t){return e==","?T(D):I(e,t,!1)}function I(e,t,n){var r=n==0?F:I,i=n==0?D:P;if(t=="=>")return T(k,n?z:U,L);if(e=="operator")return/\+\+|--/.test(t)?T(r):t=="?"?T(D,M(":"),i):T(i);if(e=="quasi")return S.cc.push(r),q(t);if(e==";")return;if(e=="(")return Q(P,")","call",r);if(e==".")return T(X,r);if(e=="[")return T(A("]"),B,M("]"),O,r)}function q(e){return e.slice(e.length-2)!="${"?T():T(D,R)}function R(e){if(e=="}")return S.marked="string-2",S.state.tokenize=v,T()}function U(e){return g(S.stream,S.state),e=="{"?x(_):x(D)}function z(e){return g(S.stream,S.state),e=="{"?x(_):x(P)}function W(e){return e==":"?T(O,_):x(F,M(";"),O)}function X(e){if(e=="variable")return S.marked="property",T()}function V(e,t){if(e=="variable"){S.marked="property";if(t=="get"||t=="set")return T($)}else if(e=="number"||e=="string")S.marked=e+" property";else if(e=="[")return T(D,M("]"),J);if(y.hasOwnProperty(e))return T(J)}function $(e){return e!="variable"?x(J):(S.marked="property",T(ct))}function J(e){if(e==":")return T(P);if(e=="(")return x(ct)}function K(e,t){function n(r){if(r==","){var i=S.state.lexical;return i.info=="call"&&(i.pos=(i.pos||0)+1),T(e,n)}return r==t?T():T(M(t))}return function(r){return r==t?T():x(e,n)}}function Q(e,t,n){for(var r=3;r!?|~^]/,f,l,m="([{}])",y={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0},S={state:null,column:null,marked:null,cc:null},C={name:"this",next:{name:"arguments"}};return O.lex=!0,{startState:function(e){var r={tokenize:h,lastType:"sof",cc:[],lexical:new b((e||0)-n,0,"block",!1),localVars:t.localVars,context:t.localVars&&{vars:t.localVars},indented:0};return t.globalVars&&(r.globalVars=t.globalVars),r},token:function(e,t){e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),g(e,t));if(t.tokenize!=d&&e.eatSpace())return null;var n=t.tokenize(e,t);return f=="comment"?n:(t.lastType=f!="operator"||l!="++"&&l!="--"?f:"incdec",E(t,n,f,l,e))},indent:function(e,i){if(e.tokenize==d)return CodeMirror.Pass;if(e.tokenize!=h)return 0;var s=i&&i.charAt(0),o=e.lexical;for(var u=e.cc.length-1;u>=0;--u){var a=e.cc[u];if(a==O)o=o.prev;else if(a!=st)break}o.type=="stat"&&s=="}"&&(o=o.prev),r&&o.type==")"&&o.prev.type=="stat"&&(o=o.prev);var f=o.type,l=s==f;return f=="vardef"?o.indented+(e.lastType=="operator"||e.lastType==","?o.info+1:0):f=="form"&&s=="{"?o.indented:f=="form"?o.indented+n:f=="stat"?o.indented+(e.lastType=="operator"||e.lastType==","?r||n:0):o.info=="switch"&&!l&&t.doubleIndentSwitch!=0?o.indented+(/^(?:case|default)\b/.test(i)?n:2*n):o.align?o.column+(l?0:1):o.indented+(l?0:n)},electricChars:":{}",blockCommentStart:i?null:"/*",blockCommentEnd:i?null:"*/",lineComment:i?null:"//",fold:"brace",helperType:i?"json":"javascript",jsonMode:i}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("text/ecmascript","javascript"),CodeMirror.defineMIME("application/javascript","javascript"),CodeMirror.defineMIME("application/ecmascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMIME("application/x-json",{name:"javascript",json:!0}),CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:!0}),CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:!0}),function(){function r(r){typeof r=="object"&&(this.minChars=r.minChars,this.style=r.style,this.showToken=r.showToken,this.delay=r.delay),this.style==null&&(this.style=t),this.minChars==null&&(this.minChars=e),this.delay==null&&(this.delay=n),this.overlay=this.timeout=null}function i(e){var t=e.state.matchHighlighter;clearTimeout(t.timeout),t.timeout=setTimeout(function(){s(e)},t.delay)}function s(e){e.operation(function(){var t=e.state.matchHighlighter;t.overlay&&(e.removeOverlay(t.overlay),t.overlay=null);if(!e.somethingSelected()&&t.showToken){var n=t.showToken===!0?/[\w$]/:t.showToken,r=e -.getCursor(),i=e.getLine(r.line),s=r.ch,o=s;while(s&&n.test(i.charAt(s-1)))--s;while(o=t.minChars&&e.addOverlay(t.overlay=u(a,!1,t.style))})}function o(e,t){return(!e.start||!t.test(e.string.charAt(e.start-1)))&&(e.pos==e.string.length||!t.test(e.string.charAt(e.pos)))}function u(e,t,n){return{token:function(r){if(r.match(e)&&(!t||o(r,t)))return n;r.next(),r.skipTo(e.charAt(0))||r.skipToEnd()}}}var e=2,t="matchhighlight",n=100;CodeMirror.defineOption("highlightSelectionMatches",!1,function(e,t,n){if(n&&n!=CodeMirror.Init){var o=e.state.matchHighlighter.overlay;o&&e.removeOverlay(o),clearTimeout(e.state.matchHighlighter.timeout),e.state.matchHighlighter=null,e.off("cursorActivity",i)}t&&(e.state.matchHighlighter=new r(t),s(e),e.on("cursorActivity",i))})}(),CodeMirror.defineMode("python",function(e,t){function r(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function w(e,t){if(e.sol()){var r=t.scopes[0].offset;if(e.eatSpace()){var l=e.indentation();return l>r?b="indent":l0&&x(e,t)}if(e.eatSpace())return null;var h=e.peek();if(h==="#")return e.skipToEnd(),"comment";if(e.match(/^[0-9\.]/,!1)){var p=!1;e.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(p=!0),e.match(/^\d+\.\d*/)&&(p=!0),e.match(/^\.\d+/)&&(p=!0);if(p)return e.eat(/J/i),"number";var d=!1;e.match(/^0x[0-9a-f]+/i)&&(d=!0),e.match(/^0b[01]+/i)&&(d=!0),e.match(/^0o[0-7]+/i)&&(d=!0),e.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(e.eat(/J/i),d=!0),e.match(/^0(?![\dx])/i)&&(d=!0);if(d)return e.eat(/L/i),"number"}return e.match(m)?(t.tokenize=E(e.current()),t.tokenize(e,t)):e.match(a)||e.match(u)?null:e.match(o)||e.match(i)||e.match(c)?"operator":e.match(s)?null:e.match(g)?"keyword":e.match(y)?"builtin":e.match(f)?t.lastToken=="def"||t.lastToken=="class"?"def":"variable":(e.next(),n)}function E(e){function s(s,o){while(!s.eol()){s.eatWhile(/[^'"\\]/);if(s.eat("\\")){s.next();if(r&&s.eol())return i}else{if(s.match(e))return o.tokenize=w,i;s.eat(/['"]/)}}if(r){if(t.singleLineStringErrors)return n;o.tokenize=w}return i}while("rub".indexOf(e.charAt(0).toLowerCase())>=0)e=e.substr(1);var r=e.length==1,i="string";return s.isString=!0,s}function S(t,n,r){r=r||"py";var i=0;if(r==="py"){if(n.scopes[0].type!=="py"){n.scopes[0].offset=t.indentation();return}for(var s=0;s0&&e.eol()&&t.scopes[0].type=="py"&&(t.scopes.length>1&&t.scopes.shift(),t.dedent-=1),r))}var n="error",i=t.singleOperators||new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"),s=t.singleDelimiters||new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"),o=t.doubleOperators||new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"),u=t.doubleDelimiters||new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),a=t.tripleDelimiters||new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"),f=t.identifiers||new RegExp("^[_A-Za-z][_A-Za-z0-9]*"),l=t.hangingIndent||t.indentUnit,c=r(["and","or","not","is","in"]),h=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield"],p=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"],d={builtins:["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"],keywords:["exec","print"]},v={builtins:["ascii","bytes","exec","print"],keywords:["nonlocal","False","True","None"]};t.extra_keywords!=undefined&&(h=h.concat(t.extra_keywords)),t.extra_builtins!=undefined&&(p=p.concat(t.extra_builtins));if(!t.version||parseInt(t.version,10)!==3){h=h.concat(d.keywords),p=p.concat(d.builtins);var m=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}else{h=h.concat(v.keywords),p=p.concat(v.builtins);var m=new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))","i")}var g=r(h),y=r(p),b=null,N={startState:function(e){return{tokenize:w,scopes:[{offset:e||0,type:"py"}],lastStyle:null,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=T(e,t);t.lastStyle=n;var r=e.current();return r&&n&&(t.lastToken=r),e.eol()&&t.lambda&&(t.lambda=!1),n},indent:function(e){return e.tokenize!=w?e.tokenize.isString?CodeMirror.Pass:0:e.scopes[0].offset},lineComment:"#",fold:"indent"};return N}),CodeMirror.defineMIME("text/x-python","python"),function(){"use strict";var e=function(e){return e.split(" ")};CodeMirror.defineMIME("text/x-cython",{name:"python",extra_keywords:e("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})}(),function(){function e(e,t){var n;return typeof e=="string"?(n=e.charAt(0),e=new RegExp("^"+e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"i":"")):e=new RegExp("^(?:"+e.source+")",e.ignoreCase?"i":""),typeof e=="string"?{token:function(t){if(t.match(e))return"searching";t.next(),t.skipTo(e.charAt(0))||t.skipToEnd()}}:{token:function(t){if(t.match(e))return"searching";while(!t.eol()){t.next(),n&&(t.skipTo(n)||t.skipToEnd());if(t.match(e,!1))break}}}}function t(){this.posFrom=this.posTo=this.query=null,this.overlay=null}function n(e){return e.state.search||(e.state.search=new t)}function r(e){return typeof e=="string"&&e==e.toLowerCase()}function i(e,t,n){return e.getSearchCursor(t,n,r(t))}function s(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r}):i(prompt(n,r))}function o(e,t,n,r){e.openConfirm?e.openConfirm(t,r):confirm(n)&&r[0]()}function u(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);return t?new RegExp(t[1],t[2].indexOf("i")==-1?"":"i"):e}function f(t,i){var o=n(t);if(o.query)return l(t,i);s(t,a,"Search for:",t.getSelection(),function(n){t.operation(function(){if(!n||o.query)return;o.query=u(n),t.removeOverlay(o.overlay,r(o.query)),o.overlay=e(o.query),t.addOverlay(o.overlay),o.posFrom=o.posTo=t.getCursor(),l(t,i)})})}function l(e,t){e.operation(function(){var r=n(e),s=i(e,r.query,t?r.posFrom:r.posTo);if(!s.find(t)){s=i(e,r.query,t?CodeMirror.Pos(e.lastLine()):CodeMirror.Pos(e.firstLine(),0));if(!s.find(t))return}e.setSelection(s.from(),s.to()),e.scrollIntoView({from:s.from(),to:s.to()}),r.posFrom=s.from(),r.posTo=s.to()})}function c(e){e.operation(function(){var t=n(e);if(!t.query)return;t.query=null,e.removeOverlay(t.overlay)})}function v(e,t){s(e,h,"Replace:",e.getSelection(),function(n){if(!n)return;n=u(n),s(e,p,"Replace with:","",function(r){if(t)e.operation(function(){for(var t=i(e,n);t.findNext();)if(typeof n!="string"){var s=e.getRange(t.from(),t.to()).match(n);t.replace(r.replace(/\$(\d)/,function(e,t){return s[t]}))}else t.replace(r)});else{c(e);var s=i(e,n,e.getCursor()),u=function(){var t=s.from(),r;if(!(r=s.findNext())){s=i(e,n);if(!(r=s.findNext())||t&&s.from().line==t.line&&s.from().ch==t.ch)return}e.setSelection(s.from(),s.to()),e.scrollIntoView({from:s.from(),to:s.to()}),o(e,d,"Replace?",[function(){a(r)},u])},a=function(e){s.replace(typeof n=="string"?r:r.replace(/\$(\d)/,function(t,n){return e[n]})),u()};u()}})})}var a='Search: (Use /re/ syntax for regexp search)',h='Replace: (Use /re/ syntax for regexp search)',p='With: ',d="Replace? ";CodeMirror.commands.find=function(e){c(e),f(e)},CodeMirror.commands.findNext=f,CodeMirror.commands.findPrev=function(e){f(e,!0)},CodeMirror.commands.clearSearch=c,CodeMirror.commands.replace=v,CodeMirror.commands.replaceAll=function(e){v(e,!0)}}(),function(){function t(t,r,i,s){this.atOccurrence=!1,this.doc=t,s==null&&typeof r=="string"&&(s=!1),i=i?t.clipPos(i):e(0,0),this.pos={from:i,to:i};if(typeof r!="string")r.global||(r=new RegExp(r.source,r.ignoreCase?"ig":"g")),this.matches=function(n,i){if(n){r.lastIndex=0;var s=t.getLine(i.line).slice(0,i.ch),o=0,u,a;for(;;){r.lastIndex=o;var f=r.exec(s);if(!f)break;u=f,a=u.index,o=u.index+(u[0].length||1);if(o==s.length)break}var l=u&&u[0].length||0;l||(a==0&&s.length==0?u=undefined:a!=t.getLine(i.line).length&&l++)}else{r.lastIndex=i.ch;var s=t.getLine(i.line),u=r.exec(s),l=u&&u[0].length||0,a=u&&u.index;a+l!=s.length&&!l&&(l=1)}if(u&&l)return{from:e(i.line,a),to:e(i.line,a+l),match:u}};else{var o=r;s&&(r=r.toLowerCase());var u=s?function(e){return e.toLowerCase()}:function(e){return e},a=r.split("\n");if(a.length==1)r.length?this.matches=function(i,s){if(i){var a=t.getLine(s.line).slice(0,s.ch),f=u(a),l=f.lastIndexOf(r);if(l>-1)return l=n(a,f,l),{from:e(s.line,l),to:e(s.line,l+o.length)}}else{var a=t.getLine(s.line).slice(s.ch),f=u(a),l=f.indexOf(r);if(l>-1)return l=n(a,f,l)+s.ch,{from:e(s.line,l),to:e(s.line,l+o.length)}}}:this.matches=function(){};else{var f=o.split("\n");this.matches=function(n,r){var i=a.length-1;if(n){if(r.line-(a.length-1)=1;--l,--o)if(a[l]!=u(t.getLine(o)))return;var c=t.getLine(o),h=c.length-f[0].length;if(u(c.slice(h))!=a[0])return;return{from:e(o,h),to:s}}if(r.line+(a.length-1)>t.lastLine())return;var c=t.getLine(r.line),h=c.length-f[0].length;if(u(c.slice(h))!=a[0])return;var p=e(r.line,h);for(var o=r.line+1,l=1;ln))return r;--r}}}var e=CodeMirror.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(t){function i(t){var r=e(t,0);return n.pos={from:r,to:r},n.atOccurrence=!1,!1}var n=this,r=this.doc.clipPos(t?this.pos.from:this.pos.to);for(;;){if(this.pos=this.matches(t,r))return this.atOccurrence=!0,this.pos.match||!0;if(t){if(!r.line)return i(0);r=e(r.line-1,this.doc.getLine(r.line-1).length)}else{var s=this.doc.lineCount();if(r.line==s-1)return i(s);r=e(r.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(t){if(!this.atOccurrence)return;var n=CodeMirror.splitLines(t);this.doc.replaceRange(n,this.pos.from,this.pos.to),this.pos.to=e(this.pos.from.line+n.length-1,n[n.length-1].length+(n.length==1?this.pos.from.ch:0))}},CodeMirror.defineExtension("getSearchCursor",function(e,n,r){return new t(this.doc,e,n,r)}),CodeMirror.defineDocExtension("getSearchCursor",function(e,n,r){return new t(this,e,n,r)})}(),CodeMirror.defineMode("xml",function(e,t){function l(e,t){function n(n){return t.tokenize=n,n(e,t)}var r=e.next();if(r=="<"){if(e.eat("!"))return e.eat("[")?e.match("CDATA[")?n(p("atom","]]>")):null:e.match("--")?n(p("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(d(1))):null;if(e.eat("?"))return e.eatWhile(/[\w\._\-]/),t.tokenize=p("meta","?>"),"meta";var i=e.eat("/");u="";var s;while(s=e.eat(/[^\s\u00a0=<>\"\'\/?]/))u+=s;return u?(a=i?"closeTag":"openTag",t.tokenize=c,"tag"):"tag error"}if(r=="&"){var o;return e.eat("#")?e.eat("x")?o=e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):o=e.eatWhile(/[\d]/)&&e.eat(";"):o=e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),o?"atom":"error"}return e.eatWhile(/[^&<]/),null}function c(e,t){var n=e.next();if(n==">"||n=="/"&&e.eat(">"))return t.tokenize=l,a=n==">"?"endTag":"selfcloseTag","tag";if(n=="=")return a="equals",null;if(n=="<"){t.tokenize=l,t.state=y,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" error":"error"}return/[\'\"]/.test(n)?(t.tokenize=h(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.eatWhile(/[^\s\u00a0=<>\"\']/),"word")}function h(e){var t=function(t,n){while(!t.eol())if(t.next()==e){n.tokenize=c;break}return"string"};return t.isInAttribute=!0,t}function p(e,t){return function(n,r){while(!n.eol()){if(n.match(t)){r.tokenize=l;break}n.next()}return e}}function d(e){return function(t,n){var r;while((r=t.next())!=null){if(r=="<")return n.tokenize=d(e+1),n.tokenize(t,n);if(r==">"){if(e==1){n.tokenize=l;break}return n.tokenize=d(e-1),n.tokenize(t,n)}}return"meta"}}function v(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n;if(s.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)this.noIndent=!0}function m(e){e.context&&(e.context=e.context.prev)}function g(e,t){var n;for(;;){if(!e.context)return;n=e.context.tagName.toLowerCase();if(!s.contextGrabbers.hasOwnProperty(n)||!s.contextGrabbers[n].hasOwnProperty(t))return;m(e)}}function y(e,t,n){if(e=="openTag")return n.tagName=u,n.tagStart=t.column(),E;if(e=="closeTag"){var r=!1;return n.context?n.context.tagName!=u&&(s.implicitlyClosed.hasOwnProperty(n.context.tagName.toLowerCase())&&m(n),r=!n.context||n.context.tagName!=u):r=!0,r&&(f="error"),r?w:b}return y}function b(e,t,n){return e!="endTag"?(f="error",b):(m(n),y)}function w(e,t,n){return f="error",b(e,t,n)}function E(e,t,n){if(e=="word")return f="attribute",S;if(e=="endTag"||e=="selfcloseTag"){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,e=="selfcloseTag"||s.autoSelfClosers.hasOwnProperty(r.toLowerCase())?g(n,r.toLowerCase()):(g(n,r.toLowerCase()),n.context=new v(n,r,i==n.indented)),y}return f="error",E}function S(e,t,n){return e=="equals"?x:(s.allowMissing||(f="error"),E(e,t,n))}function x(e,t,n){return e=="string"?T:e=="word"&&s.allowUnquoted?(f="string",E):(f="error",E(e,t,n))}function T(e,t,n){return e=="string"?T:E(e,t,n)}var n=e.indentUnit,r=t.multilineTagIndentFactor||1,i=t.multilineTagIndentPastTag||!0,s=t.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1},o=t.alignCDATA,u,a,f;return{startState:function(){return{tokenize:l,state:y,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){!t.tagName&&e.sol()&&(t.indented=e.indentation());if(e.eatSpace())return null;u=a=null;var n=t.tokenize(e,t);return(n||a)&&n!="comment"&&(f=null,t.state=t.state(a||n,e,t),f&&(n=f=="error"?n+" error":f)),n},indent:function(e,t,s){var u=e.context;if(e.tokenize.isInAttribute)return e.stringStartCol+1;if(u&&u.noIndent)return CodeMirror.Pass;if(e.tokenize!=c&&e.tokenize!=l)return s?s.match(/^(\s*)/)[0].length:0;if(e.tagName)return i?e.tagStart+e.tagName.length+2:e.tagStart+n*r;if(o&&/",configuration:t.htmlMode?"html":"xml",helperType:t.htmlMode?"html":"xml"}}),CodeMirror.defineMIME("text/xml","xml"),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.mimeModes.hasOwnProperty("text/html")||CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0}),CodeMirror.defineMode("yaml",function(){var e=["true","false","on","off","yes","no"],t=new RegExp("\\b(("+e.join(")|(")+"))$","i");return{token:function(e,n){var r=e.peek(),i=n.escaped;n.escaped=!1;if(r!="#"||e.pos!=0&&!/\s/.test(e.string.charAt(e.pos-1))){if(n.literal&&e.indentation()>n.keyCol)return e.skipToEnd(),"string";n.literal&&(n.literal=!1);if(e.sol()){n.keyCol=0,n.pair=!1,n.pairStart=!1;if(e.match(/---/))return"def";if(e.match(/\.\.\./))return"def";if(e.match(/\s*-\s+/))return"meta"}if(e.match(/^(\{|\}|\[|\])/))return r=="{"?n.inlinePairs++:r=="}"?n.inlinePairs--:r=="["?n.inlineList++:n.inlineList--,"meta";if(n.inlineList>0&&!i&&r==",")return e.next(),"meta";if(n.inlinePairs>0&&!i&&r==",")return n.keyCol=0,n.pair=!1,n.pairStart=!1,e.next(),"meta";if(n.pairStart){if(e.match(/^\s*(\||\>)\s*/))return n.literal=!0,"meta";if(e.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(n.inlinePairs==0&&e.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(n.inlinePairs>0&&e.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(e.match(t))return"keyword"}return!n.pair&&e.match(/^\s*\S+(?=\s*:($|\s))/i)?(n.pair=!0,n.keyCol=e.indentation(),"atom"):n.pair&&e.match(/^:\s*/)?(n.pairStart=!0,"meta"):(n.pairStart=!1,n.escaped=r=="\\",e.next(),null)}return e.skipToEnd(),"comment"},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}}}}),CodeMirror.defineMIME("text/x-yaml","yaml"); \ No newline at end of file +,"unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","zoom","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-profile","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","kerning","text-anchor","writing-mode"],o=e(s),u=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],a=e(u),f=["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"],l=e(f),c=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],h=e(c),p=t.concat(r).concat(s).concat(u).concat(f);CodeMirror.registerHelper("hintWords","css",p),CodeMirror.defineMIME("text/css",{mediaTypes:n,mediaFeatures:i,propertyKeywords:o,colorKeywords:a,valueKeywords:l,fontProperties:h,tokenHooks:{"<":function(e,t){return e.match("!--")?(t.tokenize=v,v(e,t)):!1},"/":function(e,t){return e.eat("*")?(t.tokenize=d,d(e,t)):!1}},name:"css"}),CodeMirror.defineMIME("text/x-scss",{mediaTypes:n,mediaFeatures:i,propertyKeywords:o,colorKeywords:a,valueKeywords:l,fontProperties:h,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=d,d(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),CodeMirror.defineMIME("text/x-less",{mediaTypes:n,mediaFeatures:i,propertyKeywords:o,colorKeywords:a,valueKeywords:l,fontProperties:h,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=d,d(e,t)):["operator","operator"]},"@":function(e){return e.match(/^(charset|document|font-face|import|keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}(),CodeMirror.defineMode("diff",function(){var e={"+":"positive","-":"negative","@":"meta"};return{token:function(t){var n=t.string.search(/[\t ]+?$/);if(!t.sol()||n===0)return t.skipToEnd(),("error "+(e[t.string.charAt(0)]||"")).replace(/ $/,"");var r=e[t.peek()]||t.skipToEnd();return n===-1?t.skipToEnd():t.pos=n,r}}}),CodeMirror.defineMIME("text/x-diff","diff"),CodeMirror.defineMode("edx_markdown",function(e,t){function w(e,t,n){return t.f=t.inline=n,n(e,t)}function E(e,t,n){return t.f=t.block=n,n(e,t)}function S(e){return e.em=!1,e.strong=!1,!n&&e.f==C&&(e.f=A,e.block=N),null}function x(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function N(e,t){var n;if(e.sol()&&e.match(b))return e.skipToEnd(),T;if(t.indentationDiff>=4)return t.indentation-=t.indentationDiff,e.skipToEnd(),s;if(e.eatSpace())return null;if(e.peek()==="#"||e.match(g))t.header=!0;else if(e.eat(">"))t.indentation++,t.quote=!0;else{if(e.peek()==="[")return w(e,t,_);if(e.match(d,!0))return a;if(n=e.match(v,!0)||e.match(m,!0))return t.indentation+=n[0].length,u}return w(e,t,t.inline)}function C(e,t){var i=r.token(e,t.htmlState);return n&&i==="tag"&&t.htmlState.type!=="openTag"&&!t.htmlState.context&&(t.f=A,t.block=N),t.md_inside&&e.current().indexOf(">")!=-1&&(t.f=A,t.block=N,t.htmlState.context=undefined),i}function k(e){var t=[];return e.strong?t.push(e.em?p:h):e.em&&t.push(c),e.header&&t.push(i),e.quote&&t.push(o),t.length?t.join(" "):null}function L(e,t){return e.match(y,!0)?k(t):undefined}function A(e,t){var n=t.text(e,t);if(typeof n!="undefined")return n;var r=e.next();if(r==="\\")return e.next(),k(t);if(r==="`")return w(e,t,H(s,"`"));if(r==="[")return w(e,t,O);if(r==="<"&&e.match(/^\w/,!1)){var i=!1;if(e.string.indexOf(">")!=-1){var o=e.string.substring(1,e.string.indexOf(">"));/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(o)&&(t.md_inside=!0)}return e.backUp(1),E(e,t,C)}if(r==="<"&&e.match(/^\/\w*?>/))return t.md_inside=!1,"tag";var u=k(t);return r==="*"||r==="_"?e.eat(r)?(t.strong=!t.strong)?k(t):u:(t.em=!t.em)?k(t):u:k(t)}function O(e,t){while(!e.eol()){var n=e.next();n==="\\"&&e.next();if(n==="]")return t.inline=t.f=M,f}return f}function M(e,t){e.eatSpace();var n=e.next();return n==="("||n==="["?w(e,t,H(l,n==="("?")":"]")):"error"}function _(e,t){return e.match(/^[^\]]*\]:/,!0)?(t.f=D,f):w(e,t,A)}function D(e,t){return e.eatSpace(),e.match(/^[^\s]+/,!0),t.f=t.inline=A,l}function P(e){return P[e]||(P[e]=new RegExp("^(?:[^\\\\\\"+e+"]|\\\\.)*(?:\\"+e+"|$)")),P[e]}function H(e,t,n){return n=n||A,function(r,i){return r.match(P(t)),i.inline=i.f=n,e}}var n=CodeMirror.mimeModes.hasOwnProperty("text/html"),r=CodeMirror.getMode(e,n?"text/html":"text/plain"),i="header",s="comment",o="quote",u="string",a="hr",f="link",l="string",c="em",h="strong",p="emstrong",d=/^([*\-=_])(?:\s*\1){2,}\s*$/,v=/^[*\-+]\s+/,m=/^[0-9]+\.\s+/,g=/^(?:\={3,}|-{3,})$/,y=/^[^\[*_\\<>`]+/,b=/^circuit-schematic:(.*)$/,T={creator:function(e){var t=e.match(b)[1];t=x(t);var n="
";return n},size:function(e){return{width:schematic_width+styling_width_delta,height:schematic_height+styling_height_delta}},callback:function(e,t){try{update_schematics();var n=e.firstChild.firstChild;n.codeMirrorLine=t,n.schematic&&(n.schematic.canvas.style.display="block",n.schematic.always_draw_grid=!0,n.schematic.redraw_background())}catch(r){console.log("Error in edx_markdown callback: "+r)}}};return{startState:function(){return{f:N,block:N,htmlState:CodeMirror.startState(r),indentation:0,inline:A,text:L,em:!1,strong:!1,header:!1,quote:!1}},copyState:function(e){return{f:e.f,block:e.block,htmlState:CodeMirror.copyState(r,e.htmlState),indentation:e.indentation,inline:e.inline,text:e.text,em:e.em,strong:e.strong,header:e.header,quote:e.quote,md_inside:e.md_inside}},token:function(e,t){if(e.sol()){if(e.match(/^\s*$/,!0))return S(t);t.header=!1,t.quote=!1,t.f=t.block;var n=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;t.indentationDiff=n-t.indentation,t.indentation=n;if(n>0)return null}return t.f(e,t)},blankLine:S,getType:k}},"xml"),CodeMirror.defineMIME("text/x-markdown","markdown"),function(){CodeMirror.extendMode("css",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(e,t){return/^[;{}]$/.test(t)}}),CodeMirror.extendMode("javascript",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(e,t,n,r){return this.jsonMode?/^[\[,{]$/.test(t)||/^}/.test(n):t==";"&&r.lexical&&r.lexical.type==")"?!1:/^[;{}]$/.test(t)&&!/^;/.test(n)}});var e=/^(a|abbr|acronym|area|base|bdo|big|br|button|caption|cite|code|col|colgroup|dd|del|dfn|em|frame|hr|iframe|img|input|ins|kbd|label|legend|link|map|object|optgroup|option|param|q|samp|script|select|small|span|strong|sub|sup|textarea|tt|var)$/;CodeMirror.extendMode("xml",{commentStart:"",newlineAfterToken:function(t,n,r,i){var s=!1;return this.configuration=="html"&&(s=i.context?e.test(i.context.tagName):!1),!s&&(t=="tag"&&/>$/.test(n)&&i.context||/^-1&&u>-1&&u>o&&(s=s.substr(0,o)+s.substring(o+i.commentStart.length,u)+s.substr(u+i.commentEnd.length)),r.replaceRange(s,t,n)}})}),CodeMirror.defineExtension("autoIndentRange",function(e,t){var n=this;this.operation(function(){for(var r=e.line;r<=t.line;r++)n.indentLine(r,"smart")})}),CodeMirror.defineExtension("autoFormatRange",function(e,t){function l(){u+="\n",f=!0,++a}var n=this,r=n.getMode(),i=n.getRange(e,t).split("\n"),s=CodeMirror.copyState(r,n.getTokenAt(e).state),o=n.getOption("tabSize"),u="",a=0,f=e.ch==0;for(var c=0;c/i,i,s;return{startState:function(){return i=i||CodeMirror.getMode(e,t.scriptingModeSpec),s=s||CodeMirror.getMode(e,"htmlmixed"),{token:t.startOpen?u:o,htmlState:CodeMirror.startState(s),scriptState:CodeMirror.startState(i)}},token:function(e,t){return t.token(e,t)},indent:function(e,t){if(e.token==o)return s.indent(e.htmlState,t);if(i.indent)return i.indent(e.scriptState,t)},copyState:function(e){return{token:e.token,htmlState:CodeMirror.copyState(s,e.htmlState),scriptState:CodeMirror.copyState(i,e.scriptState)}},innerMode:function(e){return e.token==u?{state:e.scriptState,mode:i}:{state:e.htmlState,mode:s}}}},"htmlmixed"),CodeMirror.defineMIME("application/x-ejs",{name:"htmlembedded",scriptingModeSpec:"javascript"}),CodeMirror.defineMIME("application/x-aspx",{name:"htmlembedded",scriptingModeSpec:"text/x-csharp"}),CodeMirror.defineMIME("application/x-jsp",{name:"htmlembedded",scriptingModeSpec:"text/x-java"}),CodeMirror.defineMIME("application/x-erb",{name:"htmlembedded",scriptingModeSpec:"ruby"}),CodeMirror.defineMode("htmlmixed",function(e,t){function a(e,t){var s=t.htmlState.tagName,o=n.token(e,t.htmlState);if(s=="script"&&/\btag\b/.test(o)&&e.current()==">"){var u=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);u=u?u[1]:"",u&&/[\"\']/.test(u.charAt(0))&&(u=u.slice(1,u.length-1));for(var a=0;a"&&(t.token=c,t.localMode=r,t.localState=r.startState(n.indent(t.htmlState,"")));return o}function f(e,t,n){var r=e.current(),i=r.search(t),s;if(i>-1)e.backUp(r.length-i);else if(s=r.match(/<\/?$/))e.backUp(r.length),e.match(t,!1)||e.match(r);return n}function l(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=a,t.localState=t.localMode=null,a(e,t)):f(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function c(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=a,t.localState=t.localMode=null,a(e,t)):f(e,/<\/\s*style\s*>/,r.token(e,t.localState))}var n=CodeMirror.getMode(e,{name:"xml",htmlMode:!0}),r=CodeMirror.getMode(e,"css"),i=[],s=t&&t.scriptTypes;i.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:CodeMirror.getMode(e,"javascript")});if(s)for(var o=0;o"))return c("=>","operator");if(n=="0"&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),c("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),c("number","number");if(n=="/")return e.eat("*")?(t.tokenize=d,d(e,t)):e.eat("/")?(e.skipToEnd(),c("comment","comment")):t.lastType=="operator"||t.lastType=="keyword c"||t.lastType=="sof"||/^[\[{}\(,;:]$/.test(t.lastType)?(a(e),e.eatWhile(/[gimy]/),c("regexp","string-2")):(e.eatWhile(u),c("operator","operator",e.current()));if(n=="`")return t.tokenize=v,v(e,t);if(n=="#")return e.skipToEnd(),c("error","error");if(u.test(n))return e.eatWhile(u),c("operator","operator",e.current());e.eatWhile(/[\w\$_]/);var r=e.current(),i=o.propertyIsEnumerable(r)&&o[r];return i&&t.lastType!="."?c(i.type,i.style,r):c("variable","variable",r)}function p(e){return function(t,n){var r=!1,i;while((i=t.next())!=null){if(i==e&&!r)break;r=!r&&i=="\\"}return r||(n.tokenize=h),c("string","string")}}function d(e,t){var n=!1,r;while(r=e.next()){if(r=="/"&&n){t.tokenize=h;break}n=r=="*"}return c("comment","comment")}function v(e,t){var n=!1,r;while((r=e.next())!=null){if(!n&&(r=="`"||r=="$"&&e.eat("{"))){t.tokenize=h;break}n=!n&&r=="\\"}return c("quasi","string-2",e.current())}function g(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(n<0)return;var r=0,i=!1;for(var s=n-1;s>=0;--s){var o=e.string.charAt(s),u=m.indexOf(o);if(u>=0&&u<3){if(!r){++s;break}if(--r==0)break}else if(u>=3&&u<6)++r;else if(/[$\w]/.test(o))i=!0;else if(i&&!r){++s;break}}i&&!r&&(t.fatArrowAt=s)}function b(e,t,n,r,i,s){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=s,r!=null&&(this.align=r)}function w(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(var n=r.vars;n;n=n.next)if(n.name==t)return!0}function E(e,t,n,r,s){var o=e.cc;S.state=e,S.stream=s,S.marked=null,S.cc=o,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);for(;;){var u=o.length?o.pop():i?D:_;if(u(n,r)){while(o.length&&o[o.length-1].lex)o.pop()();return S.marked?S.marked:n=="variable"&&w(e,r)?"variable-2":t}}}function x(){for(var e=arguments.length-1;e>=0;e--)S.cc.push(arguments[e])}function T(){return x.apply(null,arguments),!0}function N(e){function n(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var r=S.state;if(r.context){S.marked="def";if(n(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(n(r.globalVars))return;t.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function k(){S.state.context={prev:S.state.context,vars:S.state.localVars},S.state.localVars=C}function L(){S.state.localVars=S.state.context.vars,S.state.context=S.state.context.prev}function A(e,t){var n=function(){var n=S.state,r=n.indented;n.lexical.type=="stat"&&(r=n.lexical.indented),n.lexical=new b(r,S.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function O(){var e=S.state;e.lexical.prev&&(e.lexical.type==")"&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function M(e){return function(t){return t==e?T():e==";"?x():T(arguments.callee)}}function _(e,t){return e=="var"?T(A("vardef",t.length),et,M(";"),O):e=="keyword a"?T(A("form"),D,_,O):e=="keyword b"?T(A("form"),_,O):e=="{"?T(A("}"),G,O):e==";"?T():e=="if"?T(A("form"),D,_,O,st):e=="function"?T(ct):e=="for"?T(A("form"),ot,_,O):e=="variable"?T(A("stat"),W):e=="switch"?T(A("form"),D,A("}","switch"),M("{"),G,O,O):e=="case"?T(D,M(":")):e=="default"?T(M(":")):e=="catch"?T(A("form"),k,M("("),ht,M(")"),_,O,L):e=="module"?T(A("form"),k,mt,L,O):e=="class"?T(A("form"),pt,vt,O):e=="export"?T(A("form"),gt,O):e=="import"?T(A("form"),yt,O):x(A("stat"),D,M(";"),O)}function D(e){return H(e,!1)}function P(e){return H(e,!0)}function H(e,t){if(S.state.fatArrowAt==S.stream.start){var n=t?z:U;if(e=="(")return T(k,A(")"),K(tt,")"),O,M("=>"),n,L);if(e=="variable")return x(k,tt,M("=>"),n,L)}var r=t?I:F;return y.hasOwnProperty(e)?T(r):e=="function"?T(ct):e=="keyword c"?T(t?j:B):e=="("?T(A(")"),B,xt,M(")"),O,r):e=="operator"||e=="spread"?T(t?P:D):e=="["?T(A("]"),Et,O,r):e=="{"?Q(V,"}",null,r):T()}function B(e){return e.match(/[;\}\)\],]/)?x():x(D)}function j(e){return e.match(/[;\}\)\],]/)?x():x(P)}function F(e,t){return e==","?T(D):I(e,t,!1)}function I(e,t,n){var r=n==0?F:I,i=n==0?D:P;if(t=="=>")return T(k,n?z:U,L);if(e=="operator")return/\+\+|--/.test(t)?T(r):t=="?"?T(D,M(":"),i):T(i);if(e=="quasi")return S.cc.push(r),q(t);if(e==";")return;if(e=="(")return Q(P,")","call",r);if(e==".")return T(X,r);if(e=="[")return T(A("]"),B,M("]"),O,r)}function q(e){return e.slice(e.length-2)!="${"?T():T(D,R)}function R(e){if(e=="}")return S.marked="string-2",S.state.tokenize=v,T()}function U(e){return g(S.stream,S.state),e=="{"?x(_):x(D)}function z(e){return g(S.stream,S.state),e=="{"?x(_):x(P)}function W(e){return e==":"?T(O,_):x(F,M(";"),O)}function X(e){if(e=="variable")return S.marked="property",T()}function V(e,t){if(e=="variable"){S.marked="property";if(t=="get"||t=="set")return T($)}else if(e=="number"||e=="string")S.marked=e+" property";else if(e=="[")return T(D,M("]"),J);if(y.hasOwnProperty(e))return T(J)}function $(e){return e!="variable"?x(J):(S.marked="property",T(ct))}function J(e){if(e==":")return T(P);if(e=="(")return x(ct)}function K(e,t){function n(r){if(r==","){var i=S.state.lexical;return i.info=="call"&&(i.pos=(i.pos||0)+1),T(e,n)}return r==t?T():T(M(t))}return function(r){return r==t?T():x(e,n)}}function Q(e,t,n){for(var r=3;r!?|~^]/,f,l,m="([{}])",y={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0},S={state:null,column:null,marked:null,cc:null},C={name:"this",next:{name:"arguments"}};return O.lex=!0,{startState:function(e){var r={tokenize:h,lastType:"sof",cc:[],lexical:new b((e||0)-n,0,"block",!1),localVars:t.localVars,context:t.localVars&&{vars:t.localVars},indented:0};return t.globalVars&&(r.globalVars=t.globalVars),r},token:function(e,t){e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),g(e,t));if(t.tokenize!=d&&e.eatSpace())return null;var n=t.tokenize(e,t);return f=="comment"?n:(t.lastType=f!="operator"||l!="++"&&l!="--"?f:"incdec",E(t,n,f,l,e))},indent:function(e,i){if(e.tokenize==d)return CodeMirror.Pass;if(e.tokenize!=h)return 0;var s=i&&i.charAt(0),o=e.lexical;for(var u=e.cc.length-1;u>=0;--u){var a=e.cc[u];if(a==O)o=o.prev;else if(a!=st)break}o.type=="stat"&&s=="}"&&(o=o.prev),r&&o.type==")"&&o.prev.type=="stat"&&(o=o.prev);var f=o.type,l=s==f;return f=="vardef"?o.indented+(e.lastType=="operator"||e.lastType==","?o.info+1:0):f=="form"&&s=="{"?o.indented:f=="form"?o.indented+n:f=="stat"?o.indented+(e.lastType=="operator"||e.lastType==","?r||n:0):o.info=="switch"&&!l&&t.doubleIndentSwitch!=0?o.indented+(/^(?:case|default)\b/.test(i)?n:2*n):o.align?o.column+(l?0:1):o.indented+(l?0:n)},electricChars:":{}",blockCommentStart:i?null:"/*",blockCommentEnd:i?null:"*/",lineComment:i?null:"//",fold:"brace",helperType:i?"json":"javascript",jsonMode:i}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("text/ecmascript","javascript"),CodeMirror.defineMIME("application/javascript","javascript"),CodeMirror.defineMIME("application/ecmascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMIME("application/x-json",{name:"javascript",json:!0}),CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:!0}),CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:!0}),function(){function r(r){typeof r=="object"&&(this.minChars=r.minChars,this.style=r.style,this.showToken=r.showToken,this.delay=r.delay),this.style==null&&(this.style=t),this.minChars==null&&(this.minChars=e),this.delay==null&&(this.delay=n),this.overlay=this.timeout=null}function i(e){var t=e.state.matchHighlighter;clearTimeout(t.timeout),t.timeout=setTimeout(function(){s(e)},t.delay)}function s(e){e.operation(function(){var t=e.state.matchHighlighter;t.overlay&&(e.removeOverlay(t.overlay),t.overlay=null);if(!e.somethingSelected()&&t.showToken){var n=t.showToken===!0?/[\w$]/:t.showToken,r=e.getCursor(),i=e.getLine(r.line),s=r.ch,o=s;while(s&&n.test(i.charAt(s-1)))--s;while(o=t.minChars&&e.addOverlay(t.overlay=u(a,!1,t.style))})}function o(e,t){return(!e.start||!t.test(e.string.charAt(e.start-1)))&&(e.pos==e.string.length||!t.test(e.string.charAt(e.pos)))}function u(e,t,n){return{token:function(r){if(r.match(e)&&(!t||o(r,t)))return n;r.next(),r.skipTo(e.charAt(0))||r.skipToEnd()}}}var e=2,t="matchhighlight",n=100;CodeMirror.defineOption("highlightSelectionMatches",!1,function(e,t,n){if(n&&n!=CodeMirror.Init){var o=e.state.matchHighlighter.overlay;o&&e.removeOverlay(o),clearTimeout(e.state.matchHighlighter.timeout),e.state.matchHighlighter=null,e.off("cursorActivity",i)}t&&(e.state.matchHighlighter=new r(t),s(e),e.on("cursorActivity",i))})}(),CodeMirror.defineMode("python",function(e,t){function r(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function w(e,t){if(e.sol()){var r=t.scopes[0].offset;if(e.eatSpace()){var l=e.indentation();return l>r?b="indent":l0&&x(e,t)}if(e.eatSpace())return null;var h=e.peek();if(h==="#")return e.skipToEnd( +),"comment";if(e.match(/^[0-9\.]/,!1)){var p=!1;e.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(p=!0),e.match(/^\d+\.\d*/)&&(p=!0),e.match(/^\.\d+/)&&(p=!0);if(p)return e.eat(/J/i),"number";var d=!1;e.match(/^0x[0-9a-f]+/i)&&(d=!0),e.match(/^0b[01]+/i)&&(d=!0),e.match(/^0o[0-7]+/i)&&(d=!0),e.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(e.eat(/J/i),d=!0),e.match(/^0(?![\dx])/i)&&(d=!0);if(d)return e.eat(/L/i),"number"}return e.match(m)?(t.tokenize=E(e.current()),t.tokenize(e,t)):e.match(a)||e.match(u)?null:e.match(o)||e.match(i)||e.match(c)?"operator":e.match(s)?null:e.match(g)?"keyword":e.match(y)?"builtin":e.match(f)?t.lastToken=="def"||t.lastToken=="class"?"def":"variable":(e.next(),n)}function E(e){function s(s,o){while(!s.eol()){s.eatWhile(/[^'"\\]/);if(s.eat("\\")){s.next();if(r&&s.eol())return i}else{if(s.match(e))return o.tokenize=w,i;s.eat(/['"]/)}}if(r){if(t.singleLineStringErrors)return n;o.tokenize=w}return i}while("rub".indexOf(e.charAt(0).toLowerCase())>=0)e=e.substr(1);var r=e.length==1,i="string";return s.isString=!0,s}function S(t,n,r){r=r||"py";var i=0;if(r==="py"){if(n.scopes[0].type!=="py"){n.scopes[0].offset=t.indentation();return}for(var s=0;s0&&e.eol()&&t.scopes[0].type=="py"&&(t.scopes.length>1&&t.scopes.shift(),t.dedent-=1),r))}var n="error",i=t.singleOperators||new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"),s=t.singleDelimiters||new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"),o=t.doubleOperators||new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"),u=t.doubleDelimiters||new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),a=t.tripleDelimiters||new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"),f=t.identifiers||new RegExp("^[_A-Za-z][_A-Za-z0-9]*"),l=t.hangingIndent||t.indentUnit,c=r(["and","or","not","is","in"]),h=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield"],p=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"],d={builtins:["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"],keywords:["exec","print"]},v={builtins:["ascii","bytes","exec","print"],keywords:["nonlocal","False","True","None"]};t.extra_keywords!=undefined&&(h=h.concat(t.extra_keywords)),t.extra_builtins!=undefined&&(p=p.concat(t.extra_builtins));if(!t.version||parseInt(t.version,10)!==3){h=h.concat(d.keywords),p=p.concat(d.builtins);var m=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}else{h=h.concat(v.keywords),p=p.concat(v.builtins);var m=new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))","i")}var g=r(h),y=r(p),b=null,N={startState:function(e){return{tokenize:w,scopes:[{offset:e||0,type:"py"}],lastStyle:null,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=T(e,t);t.lastStyle=n;var r=e.current();return r&&n&&(t.lastToken=r),e.eol()&&t.lambda&&(t.lambda=!1),n},indent:function(e){return e.tokenize!=w?e.tokenize.isString?CodeMirror.Pass:0:e.scopes[0].offset},lineComment:"#",fold:"indent"};return N}),CodeMirror.defineMIME("text/x-python","python"),function(){"use strict";var e=function(e){return e.split(" ")};CodeMirror.defineMIME("text/x-cython",{name:"python",extra_keywords:e("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})}(),function(){function e(e,t){var n;return typeof e=="string"?(n=e.charAt(0),e=new RegExp("^"+e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"i":"")):e=new RegExp("^(?:"+e.source+")",e.ignoreCase?"i":""),typeof e=="string"?{token:function(t){if(t.match(e))return"searching";t.next(),t.skipTo(e.charAt(0))||t.skipToEnd()}}:{token:function(t){if(t.match(e))return"searching";while(!t.eol()){t.next(),n&&(t.skipTo(n)||t.skipToEnd());if(t.match(e,!1))break}}}}function t(){this.posFrom=this.posTo=this.query=null,this.overlay=null}function n(e){return e.state.search||(e.state.search=new t)}function r(e){return typeof e=="string"&&e==e.toLowerCase()}function i(e,t,n){return e.getSearchCursor(t,n,r(t))}function s(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r}):i(prompt(n,r))}function o(e,t,n,r){e.openConfirm?e.openConfirm(t,r):confirm(n)&&r[0]()}function u(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);return t?new RegExp(t[1],t[2].indexOf("i")==-1?"":"i"):e}function f(t,i){var o=n(t);if(o.query)return l(t,i);s(t,a,"Search for:",t.getSelection(),function(n){t.operation(function(){if(!n||o.query)return;o.query=u(n),t.removeOverlay(o.overlay,r(o.query)),o.overlay=e(o.query),t.addOverlay(o.overlay),o.posFrom=o.posTo=t.getCursor(),l(t,i)})})}function l(e,t){e.operation(function(){var r=n(e),s=i(e,r.query,t?r.posFrom:r.posTo);if(!s.find(t)){s=i(e,r.query,t?CodeMirror.Pos(e.lastLine()):CodeMirror.Pos(e.firstLine(),0));if(!s.find(t))return}e.setSelection(s.from(),s.to()),e.scrollIntoView({from:s.from(),to:s.to()}),r.posFrom=s.from(),r.posTo=s.to()})}function c(e){e.operation(function(){var t=n(e);if(!t.query)return;t.query=null,e.removeOverlay(t.overlay)})}function v(e,t){s(e,h,"Replace:",e.getSelection(),function(n){if(!n)return;n=u(n),s(e,p,"Replace with:","",function(r){if(t)e.operation(function(){for(var t=i(e,n);t.findNext();)if(typeof n!="string"){var s=e.getRange(t.from(),t.to()).match(n);t.replace(r.replace(/\$(\d)/,function(e,t){return s[t]}))}else t.replace(r)});else{c(e);var s=i(e,n,e.getCursor()),u=function(){var t=s.from(),r;if(!(r=s.findNext())){s=i(e,n);if(!(r=s.findNext())||t&&s.from().line==t.line&&s.from().ch==t.ch)return}e.setSelection(s.from(),s.to()),e.scrollIntoView({from:s.from(),to:s.to()}),o(e,d,"Replace?",[function(){a(r)},u])},a=function(e){s.replace(typeof n=="string"?r:r.replace(/\$(\d)/,function(t,n){return e[n]})),u()};u()}})})}var a='Search: (Use /re/ syntax for regexp search)',h='Replace: (Use /re/ syntax for regexp search)',p='With: ',d="Replace? ";CodeMirror.commands.find=function(e){c(e),f(e)},CodeMirror.commands.findNext=f,CodeMirror.commands.findPrev=function(e){f(e,!0)},CodeMirror.commands.clearSearch=c,CodeMirror.commands.replace=v,CodeMirror.commands.replaceAll=function(e){v(e,!0)}}(),function(){function t(t,r,i,s){this.atOccurrence=!1,this.doc=t,s==null&&typeof r=="string"&&(s=!1),i=i?t.clipPos(i):e(0,0),this.pos={from:i,to:i};if(typeof r!="string")r.global||(r=new RegExp(r.source,r.ignoreCase?"ig":"g")),this.matches=function(n,i){if(n){r.lastIndex=0;var s=t.getLine(i.line).slice(0,i.ch),o=0,u,a;for(;;){r.lastIndex=o;var f=r.exec(s);if(!f)break;u=f,a=u.index,o=u.index+(u[0].length||1);if(o==s.length)break}var l=u&&u[0].length||0;l||(a==0&&s.length==0?u=undefined:a!=t.getLine(i.line).length&&l++)}else{r.lastIndex=i.ch;var s=t.getLine(i.line),u=r.exec(s),l=u&&u[0].length||0,a=u&&u.index;a+l!=s.length&&!l&&(l=1)}if(u&&l)return{from:e(i.line,a),to:e(i.line,a+l),match:u}};else{var o=r;s&&(r=r.toLowerCase());var u=s?function(e){return e.toLowerCase()}:function(e){return e},a=r.split("\n");if(a.length==1)r.length?this.matches=function(i,s){if(i){var a=t.getLine(s.line).slice(0,s.ch),f=u(a),l=f.lastIndexOf(r);if(l>-1)return l=n(a,f,l),{from:e(s.line,l),to:e(s.line,l+o.length)}}else{var a=t.getLine(s.line).slice(s.ch),f=u(a),l=f.indexOf(r);if(l>-1)return l=n(a,f,l)+s.ch,{from:e(s.line,l),to:e(s.line,l+o.length)}}}:this.matches=function(){};else{var f=o.split("\n");this.matches=function(n,r){var i=a.length-1;if(n){if(r.line-(a.length-1)=1;--l,--o)if(a[l]!=u(t.getLine(o)))return;var c=t.getLine(o),h=c.length-f[0].length;if(u(c.slice(h))!=a[0])return;return{from:e(o,h),to:s}}if(r.line+(a.length-1)>t.lastLine())return;var c=t.getLine(r.line),h=c.length-f[0].length;if(u(c.slice(h))!=a[0])return;var p=e(r.line,h);for(var o=r.line+1,l=1;ln))return r;--r}}}var e=CodeMirror.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(t){function i(t){var r=e(t,0);return n.pos={from:r,to:r},n.atOccurrence=!1,!1}var n=this,r=this.doc.clipPos(t?this.pos.from:this.pos.to);for(;;){if(this.pos=this.matches(t,r))return this.atOccurrence=!0,this.pos.match||!0;if(t){if(!r.line)return i(0);r=e(r.line-1,this.doc.getLine(r.line-1).length)}else{var s=this.doc.lineCount();if(r.line==s-1)return i(s);r=e(r.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(t){if(!this.atOccurrence)return;var n=CodeMirror.splitLines(t);this.doc.replaceRange(n,this.pos.from,this.pos.to),this.pos.to=e(this.pos.from.line+n.length-1,n[n.length-1].length+(n.length==1?this.pos.from.ch:0))}},CodeMirror.defineExtension("getSearchCursor",function(e,n,r){return new t(this.doc,e,n,r)}),CodeMirror.defineDocExtension("getSearchCursor",function(e,n,r){return new t(this,e,n,r)})}(),CodeMirror.defineMode("xml",function(e,t){function l(e,t){function n(n){return t.tokenize=n,n(e,t)}var r=e.next();if(r=="<"){if(e.eat("!"))return e.eat("[")?e.match("CDATA[")?n(p("atom","]]>")):null:e.match("--")?n(p("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(d(1))):null;if(e.eat("?"))return e.eatWhile(/[\w\._\-]/),t.tokenize=p("meta","?>"),"meta";var i=e.eat("/");u="";var s;while(s=e.eat(/[^\s\u00a0=<>\"\'\/?]/))u+=s;return u?(a=i?"closeTag":"openTag",t.tokenize=c,"tag"):"tag error"}if(r=="&"){var o;return e.eat("#")?e.eat("x")?o=e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):o=e.eatWhile(/[\d]/)&&e.eat(";"):o=e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),o?"atom":"error"}return e.eatWhile(/[^&<]/),null}function c(e,t){var n=e.next();if(n==">"||n=="/"&&e.eat(">"))return t.tokenize=l,a=n==">"?"endTag":"selfcloseTag","tag";if(n=="=")return a="equals",null;if(n=="<"){t.tokenize=l,t.state=y,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" error":"error"}return/[\'\"]/.test(n)?(t.tokenize=h(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.eatWhile(/[^\s\u00a0=<>\"\']/),"word")}function h(e){var t=function(t,n){while(!t.eol())if(t.next()==e){n.tokenize=c;break}return"string"};return t.isInAttribute=!0,t}function p(e,t){return function(n,r){while(!n.eol()){if(n.match(t)){r.tokenize=l;break}n.next()}return e}}function d(e){return function(t,n){var r;while((r=t.next())!=null){if(r=="<")return n.tokenize=d(e+1),n.tokenize(t,n);if(r==">"){if(e==1){n.tokenize=l;break}return n.tokenize=d(e-1),n.tokenize(t,n)}}return"meta"}}function v(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n;if(s.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)this.noIndent=!0}function m(e){e.context&&(e.context=e.context.prev)}function g(e,t){var n;for(;;){if(!e.context)return;n=e.context.tagName.toLowerCase();if(!s.contextGrabbers.hasOwnProperty(n)||!s.contextGrabbers[n].hasOwnProperty(t))return;m(e)}}function y(e,t,n){if(e=="openTag")return n.tagName=u,n.tagStart=t.column(),E;if(e=="closeTag"){var r=!1;return n.context?n.context.tagName!=u&&(s.implicitlyClosed.hasOwnProperty(n.context.tagName.toLowerCase())&&m(n),r=!n.context||n.context.tagName!=u):r=!0,r&&(f="error"),r?w:b}return y}function b(e,t,n){return e!="endTag"?(f="error",b):(m(n),y)}function w(e,t,n){return f="error",b(e,t,n)}function E(e,t,n){if(e=="word")return f="attribute",S;if(e=="endTag"||e=="selfcloseTag"){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,e=="selfcloseTag"||s.autoSelfClosers.hasOwnProperty(r.toLowerCase())?g(n,r.toLowerCase()):(g(n,r.toLowerCase()),n.context=new v(n,r,i==n.indented)),y}return f="error",E}function S(e,t,n){return e=="equals"?x:(s.allowMissing||(f="error"),E(e,t,n))}function x(e,t,n){return e=="string"?T:e=="word"&&s.allowUnquoted?(f="string",E):(f="error",E(e,t,n))}function T(e,t,n){return e=="string"?T:E(e,t,n)}var n=e.indentUnit,r=t.multilineTagIndentFactor||1,i=t.multilineTagIndentPastTag||!0,s=t.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1},o=t.alignCDATA,u,a,f;return{startState:function(){return{tokenize:l,state:y,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){!t.tagName&&e.sol()&&(t.indented=e.indentation());if(e.eatSpace())return null;u=a=null;var n=t.tokenize(e,t);return(n||a)&&n!="comment"&&(f=null,t.state=t.state(a||n,e,t),f&&(n=f=="error"?n+" error":f)),n},indent:function(e,t,s){var u=e.context;if(e.tokenize.isInAttribute)return e.stringStartCol+1;if(u&&u.noIndent)return CodeMirror.Pass;if(e.tokenize!=c&&e.tokenize!=l)return s?s.match(/^(\s*)/)[0].length:0;if(e.tagName)return i?e.tagStart+e.tagName.length+2:e.tagStart+n*r;if(o&&/",configuration:t.htmlMode?"html":"xml",helperType:t.htmlMode?"html":"xml"}}),CodeMirror.defineMIME("text/xml","xml"),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.mimeModes.hasOwnProperty("text/html")||CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0}),CodeMirror.defineMode("yaml",function(){var e=["true","false","on","off","yes","no"],t=new RegExp("\\b(("+e.join(")|(")+"))$","i");return{token:function(e,n){var r=e.peek(),i=n.escaped;n.escaped=!1;if(r!="#"||e.pos!=0&&!/\s/.test(e.string.charAt(e.pos-1))){if(n.literal&&e.indentation()>n.keyCol)return e.skipToEnd(),"string";n.literal&&(n.literal=!1);if(e.sol()){n.keyCol=0,n.pair=!1,n.pairStart=!1;if(e.match(/---/))return"def";if(e.match(/\.\.\./))return"def";if(e.match(/\s*-\s+/))return"meta"}if(e.match(/^(\{|\}|\[|\])/))return r=="{"?n.inlinePairs++:r=="}"?n.inlinePairs--:r=="["?n.inlineList++:n.inlineList--,"meta";if(n.inlineList>0&&!i&&r==",")return e.next(),"meta";if(n.inlinePairs>0&&!i&&r==",")return n.keyCol=0,n.pair=!1,n.pairStart=!1,e.next(),"meta";if(n.pairStart){if(e.match(/^\s*(\||\>)\s*/))return n.literal=!0,"meta";if(e.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(n.inlinePairs==0&&e.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(n.inlinePairs>0&&e.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(e.match(t))return"keyword"}return!n.pair&&e.match(/^\s*\S+(?=\s*:($|\s))/i)?(n.pair=!0,n.keyCol=e.indentation(),"atom"):n.pair&&e.match(/^:\s*/)?(n.pairStart=!0,"meta"):(n.pairStart=!1,n.escaped=r=="\\",e.next(),null)}return e.skipToEnd(),"comment"},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}}}}),CodeMirror.defineMIME("text/x-yaml","yaml"); \ No newline at end of file