diff --git a/media/js/snipt.js b/media/js/snipt.js index f429dda..6a87fd6 100644 --- a/media/js/snipt.js +++ b/media/js/snipt.js @@ -172,7 +172,7 @@ if(destroyed){window.$selected.trigger('fadeAndRemove');}}else{if(!window.ui_hal window.site.$aside_nav.removeClass('open');}}},keyboardShortcuts:function(){var that=this;$selected=window.selected;$document=$(document);$document.bind('keydown','j',function(){if(!window.ui_halted){if(!$selected){window.site.$snipts.eq(0).trigger('selectSnipt');}else{$selected.trigger('next');}}});$document.bind('keydown','k',function(){if(!window.ui_halted){if(!$selected){window.site.$snipts.eq(0).trigger('selectSnipt');}else{$selected.trigger('prev');}}});$document.bind('keydown','c',function(e){if(!window.ui_halted&&!window.blog_post){if($selected){e.preventDefault();$selected.trigger('copyRaw');}}});$document.bind('keydown','Ctrl+e',function(){if(!window.ui_halted){if($selected){if($selected.hasClass('editable')){$selected.trigger('edit');}}}});$document.bind('keydown','Ctrl+backspace',function(){if(!window.ui_halted||window.editing){if($selected){if($selected.hasClass('editable')){if(confirm('Are you sure you want to delete this snipt?')){$selected.trigger('destroy');window.site.snipt_list.escapeUI(true);}}}}});$document.bind('keydown','Ctrl+del',function(){if(!window.ui_halted||window.editing){if($selected){if($selected.hasClass('editable')){if(confirm('Are you sure you want to delete this snipt?')){$selected.trigger('destroy');window.site.snipt_list.escapeUI(true);}}}}});$document.bind('keydown','Alt+n',function(){if(!window.ui_halted){that.addNewSnipt();}});$document.bind('keydown','Ctrl+n',function(){if(!window.ui_halted){that.addNewSnipt();}});$document.bind('keydown','Ctrl+s',function(){if(window.editing){if($selected){if($selected.hasClass('editable')){$('button.save').click();}}}});$document.bind('keydown','Ctrl+c',function(){if(window.editing){if($selected){if($selected.hasClass('editable')){$('button.save-and-close').click();}}}});$document.bind('keydown','esc',function(){that.escapeUI();});$document.bind('keydown','g',function(){if(!window.ui_halted){if(window.$selected){window.$selected.trigger('deselect');} window.scrollTo(0,0);}});$document.bind('keydown','Shift+g',function(){if(!window.ui_halted){if(window.$selected){window.$selected.trigger('deselect');} window.scrollTo(0,document.body.scrollHeight);}});$document.bind('keydown','n',function(){if(!window.ui_halted){var $anc=$('li.next a');if($anc.length){if($anc.attr('href')!=='#'){window.location=$anc.attr('href');}}}});$document.bind('keydown','e',function(){if(!window.ui_halted){if($selected){if($selected.hasClass('expandable')){$selected.trigger('expand');}}}});$document.bind('keydown','u',function(){if(!window.ui_halted){if($selected){$selected.trigger('goToAuthor');}}});$document.bind('keydown','p',function(){if(!window.ui_halted){var $anc=$('li.prev a');if($anc.length){if($anc.attr('href')!=='#'){window.location=$anc.attr('href');}}}});$document.bind('keydown','v',function(e){if(!window.ui_halted&&!window.blog_post){if($selected){e.preventDefault();$selected.trigger('embed');}}});$document.bind('keydown','o',function(){if(!window.ui_halted){if($selected){$selected.trigger('detail');}}});$document.bind('keydown','return',function(){if(!window.ui_halted){if($selected){$selected.trigger('detail');}}});}});})(snipt.module('snipt')); -(function(){if(typeof angular!=='undefined'){var root=this;var $=root.jQuery;var controllers={};var app=angular.module('Account',[],function($routeProvider,$locationProvider){$locationProvider.html5Mode(true);$routeProvider.when('/account/',{templateUrl:'/media/js/src/modules/partials/profile.html',controller:controllers.ProfileController});$routeProvider.when('/account/billing/',{templateUrl:'/media/js/src/modules/partials/billing.html',controller:controllers.BillingController});$routeProvider.when('/account/blogging/',{templateUrl:'/media/js/src/modules/partials/blogging.html',controller:controllers.BloggingController});$routeProvider.when('/account/editor/',{templateUrl:'/media/js/src/modules/partials/editor.html',controller:controllers.EditorController});$routeProvider.otherwise({'redirectTo':function(routeParams,locationPath){window.location=locationPath;}});});app.config(function($interpolateProvider){$interpolateProvider.startSymbol('[[');$interpolateProvider.endSymbol(']]');});app.factory('AccountStorage',function($http){return{getAccount:function(){var promise=$http({method:'GET',url:'/api/private/profile/'+window.user_profile_id+'/',headers:{'Authorization':'ApiKey '+window.user+':'+window.api_key}});return promise;},saveAccount:function(user,fields){var promise=$http({method:'PUT',url:'/api/private/profile/'+window.user_profile_id+'/',headers:{'Authorization':'ApiKey '+window.user+':'+window.api_key},data:function(){var userData={};for(var i=0;ib;++b)Bc[b](this)})()}function t(a){var b={},d=b.input=_d("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none;");d.setAttribute("wrap","off"),d.setAttribute("autocorrect","off"),d.setAttribute("autocapitalize","off"),b.inputDiv=_d("div",[d],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),b.scrollbarH=_d("div",[_d("div",null,null,"height: 1px")],"CodeMirror-hscrollbar"),b.scrollbarV=_d("div",[_d("div",null,null,"width: 1px")],"CodeMirror-vscrollbar"),b.scrollbarFiller=_d("div",null,"CodeMirror-scrollbar-filler"),b.lineDiv=_d("div"),b.selectionDiv=_d("div",null,null,"position: relative; z-index: 1"),b.cursor=_d("pre","\u00a0","CodeMirror-cursor"),b.otherCursor=_d("pre","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor"),b.measure=_d("div",null,"CodeMirror-measure"),b.lineSpace=_d("div",[b.measure,b.selectionDiv,b.lineDiv,b.cursor,b.otherCursor],null,"position: relative; outline: none"),b.mover=_d("div",[_d("div",[b.lineSpace],"CodeMirror-lines")],null,"position: relative"),b.sizer=_d("div",[b.mover],"CodeMirror-sizer"),b.heightForcer=_d("div","\u00a0",null,"position: absolute; height: "+Md+"px"),b.gutters=_d("div",null,"CodeMirror-gutters"),b.lineGutter=null;var f=_d("div",[b.sizer,b.heightForcer,b.gutters],null,"position: relative; min-height: 100%");return b.scroller=_d("div",[f],"CodeMirror-scroll"),b.scroller.setAttribute("tabIndex","-1"),b.wrapper=_d("div",[b.inputDiv,b.scrollbarH,b.scrollbarV,b.scrollbarFiller,b.scroller],"CodeMirror"),c&&(b.gutters.style.zIndex=-1,b.scroller.style.paddingRight=0),a.appendChild?a.appendChild(b.wrapper):a(b.wrapper),n&&(d.style.width="0px"),e||(b.scroller.draggable=!0),j?(b.inputDiv.style.height="1px",b.inputDiv.style.position="absolute"):c&&(b.scrollbarH.style.minWidth=b.scrollbarV.style.minWidth="18px"),b.viewOffset=b.showingFrom=b.showingTo=b.lastSizeC=0,b.lineNumWidth=b.lineNumInnerWidth=b.lineNumChars=null,b.prevInput="",b.alignWidgets=!1,b.pollingFast=!1,b.poll=new Od,b.draggingText=!1,b.cachedCharWidth=b.cachedTextHeight=null,b.measureLineCache=[],b.measureLineCachePos=0,b.inaccurateSelection=!1,b.pasteIncoming=!1,b}function u(a){var b={line:0,ch:0};return{doc:a,frontier:0,highlight:new Od,sel:{from:b,to:b,head:b,anchor:b,shift:!1,extend:!1},scrollTop:0,scrollLeft:0,overwrite:!1,focused:!1,maxLine:rd(a,0),maxLineLength:0,maxLineChanged:!1,suppressEdits:!1,goalColumn:null,cantEdit:!1,keyMaps:[]}}function v(a){var b=a.view.doc;a.view.mode=s.getMode(a.options,a.options.mode),b.iter(0,b.size,function(a){a.stateAfter=null}),a.view.frontier=0,U(a,100)}function w(a){var b=a.view.doc,c=ib(a.display);if(a.options.lineWrapping){a.display.wrapper.className+=" CodeMirror-wrap";var d=a.display.scroller.clientWidth/jb(a.display)-3;b.iter(0,b.size,function(a){if(0!=a.height){var b=Math.ceil(a.text.length/d)||1;1!=b&&sd(a,b*c)}}),a.display.sizer.style.minWidth=""}else a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-wrap",""),C(a.view),b.iter(0,b.size,function(a){0!=a.height&&sd(a,c)});nb(a,0,b.size),bb(a),setTimeout(function(){E(a.display,a.view.doc.height)},100)}function x(a){var b=Fc[a.options.keyMap].style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(b?" cm-keymap-"+b:"")}function y(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),bb(a)}function z(a){A(a),K(a,!0)}function A(a){var b=a.display.gutters,c=a.options.gutters;ae(b);for(var d=0;c.length>d;++d){var e=c[d],f=b.appendChild(_d("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none"}function B(a,b){if(0==b.height)return 0;for(var d,c=b.text.length,e=b;d=Uc(e);){var f=d.find();e=rd(a,f.from.line),c+=f.from.ch-f.to.ch}for(e=b;d=Vc(e);){var f=d.find();c-=e.text.length-f.from.ch,e=rd(a,f.to.line),c+=e.text.length-f.to.ch}return c}function C(a){a.maxLine=rd(a.doc,0),a.maxLineLength=B(a.doc,a.maxLine),a.maxLineChanged=!0,a.doc.iter(1,a.doc.size,function(b){var c=B(a.doc,b);c>a.maxLineLength&&(a.maxLineLength=c,a.maxLine=b)})}function D(a){for(var b=!1,c=0;a.gutters.length>c;++c)"CodeMirror-linenumbers"==a.gutters[c]&&(a.lineNumbers?b=!0:a.gutters.splice(c--,1));!b&&a.lineNumbers&&a.gutters.push("CodeMirror-linenumbers")}function E(a,b){var c=b+2*Y(a);a.sizer.style.minHeight=a.heightForcer.style.top=c+"px";var d=Math.max(c,a.scroller.scrollHeight),e=a.scroller.scrollWidth>a.scroller.clientWidth,f=d>a.scroller.clientHeight;f?(a.scrollbarV.style.display="block",a.scrollbarV.style.bottom=e?ge(a.measure)+"px":"0",a.scrollbarV.firstChild.style.height=d-a.scroller.clientHeight+a.scrollbarV.clientHeight+"px"):a.scrollbarV.style.display="",e?(a.scrollbarH.style.display="block",a.scrollbarH.style.right=f?ge(a.measure)+"px":"0",a.scrollbarH.firstChild.style.width=a.scroller.scrollWidth-a.scroller.clientWidth+a.scrollbarH.clientWidth+"px"):a.scrollbarH.style.display="",e&&f?(a.scrollbarFiller.style.display="block",a.scrollbarFiller.style.height=a.scrollbarFiller.style.width=ge(a.measure)+"px"):a.scrollbarFiller.style.display="",k&&0===ge(a.measure)&&(a.scrollbarV.style.minWidth=a.scrollbarH.style.minHeight=l?"18px":"12px")}function F(a,b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;"number"==typeof c?d=c:c&&(d=c.top,e=c.bottom-c.top),d=Math.floor(d-Y(a));var f=Math.ceil(d+e);return{from:ud(b,d),to:ud(b,f)}}function G(a){var b=a.display;if(b.alignWidgets||b.gutters.firstChild){for(var c=J(b)-b.scroller.scrollLeft+a.view.scrollLeft,d=b.gutters.offsetWidth,e=c+"px",f=b.lineDiv.firstChild;f;f=f.nextSibling)if(f.alignable)for(var g=0,h=f.alignable;h.length>g;++g)h[g].style.left=e;b.gutters.style.left=c+d+"px"}}function H(a){if(!a.options.lineNumbers)return!1;var b=a.view.doc,c=I(a.options,b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(_d("div",[_d("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),f=e.firstChild.offsetWidth,g=e.offsetWidth-f;return d.lineGutter.style.width="",d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-g),d.lineNumWidth=d.lineNumInnerWidth+g,d.lineNumChars=d.lineNumInnerWidth?c.length:-1,d.lineGutter.style.width=d.lineNumWidth+"px",!0}return!1}function I(a,b){return a.lineNumberFormatter(b+a.firstLineNumber)+""}function J(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function K(a,b,c){var d=a.display.showingFrom,e=a.display.showingTo,f=L(a,b,c);return f&&(Kd(a,a,"update",a),(a.display.showingFrom!=d||a.display.showingTo!=e)&&Kd(a,a,"viewportChange",a,a.display.showingFrom,a.display.showingTo)),Q(a),E(a.display,a.view.doc.height),f}function L(a,b,d){var e=a.display,f=a.view.doc;if(!e.wrapper.clientWidth)return e.showingFrom=e.showingTo=e.viewOffset=0,void 0;var g=F(e,f,d);if(!(b!==!0&&0==b.length&&g.from>e.showingFrom&&g.toh;++h)for(var j,i=b[h];j=Uc(rd(f,i.from));){var k=j.find().from.line;i.diff&&(i.diff-=i.from-k),i.from=k}var l=b===!0?0:1/0;if(a.options.lineNumbers&&b&&b!==!0)for(var h=0;b.length>h;++h)if(b[h].diff){l=b[h].from;break}var k=Math.max(g.from-a.options.viewportMargin,0),m=Math.min(f.size,g.to+a.options.viewportMargin);if(k>e.showingFrom&&20>k-e.showingFrom&&(k=e.showingFrom),e.showingTo>m&&20>e.showingTo-m&&(m=Math.min(f.size,e.showingTo)),r)for(k=td(Wc(f,rd(f,k)));f.size>m&&Xc(rd(f,m));)++m;for(var n=b===!0?[]:M([{from:e.showingFrom,to:e.showingTo}],b),o=0,h=0;n.length>h;++h){var p=n[h];k>p.from&&(p.from=k),p.to>m&&(p.to=m),p.from>=p.to?n.splice(h--,1):o+=p.to-p.from}if(o!=m-k||k!=e.showingFrom||m!=e.showingTo){n.sort(function(a,b){return a.from-b.from}),.7*(m-k)>o&&(e.lineDiv.style.display="none"),O(a,k,m,n,l),e.lineDiv.style.display="";var q=k!=e.showingFrom||m!=e.showingTo||e.lastSizeC!=e.wrapper.clientHeight;q&&(e.lastSizeC=e.wrapper.clientHeight),e.showingFrom=k,e.showingTo=m,U(a,100);for(var u,s=e.lineDiv.offsetTop,t=e.lineDiv.firstChild;t;t=t.nextSibling)if(t.lineObj){if(c){var v=t.offsetTop+t.offsetHeight;u=v-s,s=v}else{var w=t.getBoundingClientRect();u=w.bottom-w.top}var x=t.lineObj.height-u;2>u&&(u=ib(e)),(x>.001||-.001>x)&&sd(t.lineObj,u)}return e.viewOffset=vd(a,rd(f,k)),e.mover.style.top=e.viewOffset+"px",!0}}}function M(a,b){for(var c=0,d=b.length||0;d>c;++c){for(var e=b[c],f=[],g=e.diff||0,h=0,i=a.length;i>h;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from}),e.to=n.from&&n.to>o){for(;l.lineObj!=b;)l=m(l);j&&o>=g&&l.lineNumber&&ce(l.lineNumber,I(a.options,o)),l=l.nextSibling}else{var c=P(a,b,o,h);k.insertBefore(c,l),c.lineObj=b}++o});l;)l=m(l)}function P(a,b,d,e){var f=jd(a,b),g=b.gutterMarkers,h=a.display;if(!(a.options.lineNumbers||g||b.bgClass||b.wrapClass||b.widgets&&b.widgets.length))return f;var i=_d("div",null,b.wrapClass,"position: relative");if(a.options.lineNumbers||g){var j=i.appendChild(_d("div",null,null,"position: absolute; left: "+e.fixedPos+"px"));if(i.alignable=[j],!a.options.lineNumbers||g&&g["CodeMirror-linenumbers"]||(i.lineNumber=j.appendChild(_d("div",I(a.options,d),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+e.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+h.lineNumInnerWidth+"px"))),g)for(var k=0;a.options.gutters.length>k;++k){var l=a.options.gutters[k],m=g.hasOwnProperty(l)&&g[l];m&&j.appendChild(_d("div",[m],"CodeMirror-gutter-elt","left: "+e.gutterLeft[l]+"px; width: "+e.gutterWidth[l]+"px"))}}if(b.bgClass&&i.appendChild(_d("div","\u00a0",b.bgClass+" CodeMirror-linebackground")),i.appendChild(f),b.widgets)for(var n=0,o=b.widgets;o.length>n;++n){var p=o[n],q=_d("div",[p.node],"CodeMirror-linewidget");if(q.widget=p,p.noHScroll){(i.alignable||(i.alignable=[])).push(q);var r=e.wrapperWidth;q.style.left=e.fixedPos+"px",p.coverGutter||(r-=e.gutterTotalWidth,q.style.paddingLeft=e.gutterTotalWidth+"px"),q.style.width=r+"px"}p.coverGutter&&(q.style.zIndex=5,q.style.position="relative",p.noHScroll||(q.style.marginLeft=-e.gutterTotalWidth+"px")),p.above?i.insertBefore(q,a.options.lineNumbers&&0!=b.height?j:f):i.appendChild(q)}return c&&(i.style.zIndex=2),i}function Q(a){var b=a.display,c=bc(a.view.sel.from,a.view.sel.to);c||a.options.showCursorWhenSelecting?R(a):b.cursor.style.display=b.otherCursor.style.display="none",c?b.selectionDiv.style.display="none":S(a);var d=eb(a,a.view.sel.head,"div"),e=b.wrapper.getBoundingClientRect(),f=b.lineDiv.getBoundingClientRect();b.inputDiv.style.top=Math.max(0,Math.min(b.wrapper.clientHeight-10,d.top+f.top-e.top))+"px",b.inputDiv.style.left=Math.max(0,Math.min(b.wrapper.clientWidth-10,d.left+f.left-e.left))+"px"}function R(a){var b=a.display,c=eb(a,a.view.sel.head,"div");b.cursor.style.left=c.left+"px",b.cursor.style.top=c.top+"px",b.cursor.style.height=Math.max(0,c.bottom-c.top)*a.options.cursorHeight+"px",b.cursor.style.display="",c.other?(b.otherCursor.style.display="",b.otherCursor.style.left=c.other.left+"px",b.otherCursor.style.top=c.other.top+"px",b.otherCursor.style.height=.85*(c.other.bottom-c.other.top)+"px"):b.otherCursor.style.display="none"}function S(a){function h(a,b,c,d){0>b&&(b=0),e.appendChild(_d("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?f-a:c)+"px; height: "+(d-b)+"px"))}function i(b,d,e,i){function m(c){return db(a,{line:b,ch:c},"div",j)}var j=rd(c,b),k=j.text.length,l=i?1/0:-1/0;return ne(wd(j),d||0,null==e?k:e,function(a,b,c){var j=m("rtl"==c?b-1:a),n=m("rtl"==c?a:b-1),o=j.left,p=n.right;n.top-j.top>3&&(h(o,j.top,null,j.bottom),o=g,j.bottomo&&(o=g),h(o,n.top,p-o,n.bottom)}),l}var b=a.display,c=a.view.doc,d=a.view.sel,e=document.createDocumentFragment(),f=b.lineSpace.offsetWidth,g=Z(a.display);if(d.from.line==d.to.line)i(d.from.line,d.from.ch,d.to.ch);else{for(var l,n,j=rd(c,d.from.line),k=j,m=[d.from.line,d.from.ch];l=Vc(k);){var o=l.find();if(m.push(o.from.ch,o.to.line,o.to.ch),o.to.line==d.to.line){m.push(d.to.ch),n=!0;break}k=rd(c,o.to.line)}if(n)for(var p=0;m.length>p;p+=3)i(m[p],m[p+1],m[p+2]);else{var q,r,s=rd(c,d.to.line);q=d.from.ch?i(d.from.line,d.from.ch,null,!1):vd(a,j)-b.viewOffset,r=d.to.ch?i(d.to.line,Uc(s)?null:0,d.to.ch,!0):vd(a,s)-b.viewOffset,r>q&&h(g,q,null,r)}}be(b.selectionDiv,e),b.selectionDiv.style.display=""}function T(a){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursor.style.visibility=b.otherCursor.style.visibility="",b.blinker=setInterval(function(){b.cursor.offsetHeight&&(b.cursor.style.visibility=b.otherCursor.style.visibility=(c=!c)?"":"hidden")},a.options.cursorBlinkRate)}function U(a,b){a.view.frontier=a.display.showingTo)){var g,d=+new Date+a.options.workTime,e=Cc(b.mode,X(a,b.frontier)),f=[];c.iter(b.frontier,Math.min(c.size,a.display.showingTo+500),function(c){return b.frontier>=a.display.showingFrom?(fd(a,c,e)&&b.frontier>=a.display.showingFrom&&(g&&g.end==b.frontier?g.end++:f.push(g={start:b.frontier,end:b.frontier+1})),c.stateAfter=Cc(b.mode,e)):(gd(a,c,e),c.stateAfter=0==b.frontier%5?Cc(b.mode,e):null),++b.frontier,+new Date>d?(U(a,a.options.workDelay),!0):void 0}),f.length&&mb(a,function(){for(var a=0;f.length>a;++a)nb(this,f[a].start,f[a].end)})()}}function W(a,b){for(var c,d,e=a.view.doc,f=b,g=b-100;f>g;--f){if(0==f)return 0;var h=rd(e,f-1);if(h.stateAfter)return f;var i=Pd(h.text,null,a.options.tabSize);(null==d||c>i)&&(d=f-1,c=i)}return d}function X(a,b){var c=a.view,d=W(a,b),e=d&&rd(c.doc,d-1).stateAfter;return e=e?Cc(c.mode,e):Dc(c.mode),c.doc.iter(d,b,function(f){gd(a,f,e);var g=d==b-1||0==d%5||d>=c.showingFrom&&c.showingTo>d;f.stateAfter=g?Cc(c.mode,e):null,++d}),e}function Y(a){return a.lineSpace.offsetTop}function Z(a){var b=be(a.measure,_d("pre")).appendChild(_d("span","x"));return b.offsetLeft}function $(a,b,c,d){for(var d=d||_(a,b),e=-1,f=c;;f+=e){var g=d[f];if(g)break;0>e&&0==f&&(e=1)}return{left:c>f?g.right:g.left,right:f>c?g.left:g.right,top:g.top,bottom:g.bottom}}function _(a,b){for(var c=a.display,d=a.display.measureLineCache,e=0;d.length>e;++e){var f=d[e];if(f.text==b.text&&f.markedSpans==b.markedSpans&&c.scroller.clientWidth==f.width)return f.measure}var g=ab(a,b),f={text:b.text,width:c.scroller.clientWidth,markedSpans:b.markedSpans,measure:g};return 16==d.length?d[++c.measureLineCachePos%16]=f:d.push(f),g}function ab(a,d){var e=a.display,f=Vd(d.text.length),g=jd(a,d,f);if(b&&!c&&!a.options.lineWrapping&&g.childNodes.length>100){for(var h=document.createDocumentFragment(),i=10,j=g.childNodes.length,k=0,l=Math.ceil(j/i);l>k;++k){for(var m=_d("div",null,null,"display: inline-block"),n=0;i>n&&j;++n)m.appendChild(g.firstChild),--j;h.appendChild(m)}g.appendChild(h)}be(e.measure,g);for(var s,o=e.lineDiv.getBoundingClientRect(),p=[],q=Vd(d.text.length),r=g.offsetHeight,k=0;f.length>k;++k)if(s=f[k]){for(var t=s.getBoundingClientRect(),u=Math.max(0,t.top-o.top),v=Math.min(t.bottom-o.top,r),n=0;p.length>n;n+=2){var w=p[n],x=p[n+1];if(!(w>v||u>x)&&(u>=w&&x>=v||w>=u&&v>=x||Math.min(v,x)-Math.max(u,w)>=v-u>>1)){p[n]=Math.min(u,w),p[n+1]=Math.max(v,x);break}}n==p.length&&p.push(u,v),q[k]={left:t.left-o.left,right:t.right-o.left,top:n}}for(var s,k=0;q.length>k;++k)if(s=q[k]){var y=s.top;s.top=p[y],s.bottom=p[y+1]}return q}function bb(a){a.display.measureLineCache.length=a.display.measureLineCachePos=0,a.display.cachedCharWidth=a.display.cachedTextHeight=null,a.view.maxLineChanged=!0}function cb(a,b,c,d){if(b.widgets)for(var e=0;b.widgets.length>e;++e)if(b.widgets[e].above){var f=b.widgets[e].node.offsetHeight;c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=vd(a,b);if("local"!=d&&(g-=a.display.viewOffset),"page"==d){var h=a.display.lineSpace.getBoundingClientRect();g+=h.top+(window.pageYOffset||(document.documentElement||document.body).scrollTop);var i=h.left+(window.pageXOffset||(document.documentElement||document.body).scrollLeft);c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function db(a,b,c,d){return d||(d=rd(a.view.doc,b.line)),cb(a,d,$(a,d,b.ch),c)}function eb(a,b,c,d,e){function f(b,f){var g=$(a,d,b,e);return f?g.left=g.right:g.right=g.left,cb(a,d,g,c)}d=d||rd(a.view.doc,b.line),e||(e=_(a,d));var g=wd(d),h=b.ch;if(!g)return f(h);for(var i,j,k=g[0].level,l=0;g.length>l;++l){var o,p,m=g[l],n=m.level%2;if(h>m.from&&m.to>h)return f(h,n);var q=n?m.to:m.from,r=n?m.from:m.to;if(q==h)p=l&&m.level<(o=g[l-1]).level?f(o.level%2?o.from:o.to-1,!0):f(n&&m.from!=m.to?h-1:h),n==k?i=p:j=p;else if(r==h){var o=g.length-1>l&&g[l+1];if(!n&&o&&o.from==o.to)continue;p=o&&m.levelc)return{line:0,ch:0,outside:!0};var e=ud(d,c);if(e>=d.size)return{line:d.size-1,ch:rd(d,d.size-1).text.length};for(0>b&&(b=0);;){var f=rd(d,e),g=gb(a,f,e,b,c),h=Vc(f);if(!h||g.ch!=re(f))return g;e=h.find().to.line}}function gb(a,b,c,d,e){function j(d){var e=eb(a,{line:c,ch:d},"line",b,i);return g=!0,f>e.bottom?Math.max(0,e.left-h):e.top>f?e.left+h:(g=!1,e.left)}var f=e-vd(a,b),g=!1,h=a.display.wrapper.clientWidth,i=_(a,b),k=wd(b),l=b.text.length,m=qe(b),n=re(b),o=Z(a.display),p=j(n);if(d>p)return{line:c,ch:n,outside:g};for(;;){if(k?n==m||n==ue(b,m,1):1>=n-m){for(var q=p-d>d-o,r=q?m:n;$d.test(b.text.charAt(r));)++r;return{line:c,ch:r,after:q,outside:g}}var s=Math.ceil(l/2),t=m+s;if(k){t=m;for(var u=0;s>u;++u)t=ue(b,t,1)}var v=j(t);v>d?(n=t,p=v,g&&(p+=1e3),l-=s):(m=t,o=v,l=s)}}function ib(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==hb){hb=_d("pre");for(var b=0;49>b;++b)hb.appendChild(document.createTextNode("x")),hb.appendChild(_d("br"));hb.appendChild(document.createTextNode("x"))}be(a.measure,hb);var c=hb.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),ae(a.measure),c||1}function jb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=_d("span","x"),c=_d("pre",[b]);be(a.measure,c);var d=b.offsetWidth;return d>2&&(a.cachedCharWidth=d),d||10}function kb(a){a.curOp?++a.curOp.depth:a.curOp={depth:1,changes:[],delayedCallbacks:[],updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,updateMaxLine:!1,id:++a.nextOpId}}function lb(a){var b=a.curOp;if(!--b.depth){a.curOp=null;var c=a.view,d=a.display;if(b.updateMaxLine&&C(c),c.maxLineChanged&&!a.options.lineWrapping){var e=$(a,c.maxLine,c.maxLine.text.length).right;d.sizer.style.minWidth=e+3+Md+"px",c.maxLineChanged=!1}var f,g;if(b.selectionChanged){var h=eb(a,c.sel.head);f=oc(a,h.left,h.top,h.left,h.bottom)}(b.changes.length||f&&null!=f.scrollTop)&&(g=K(a,b.changes,f&&f.scrollTop)),!g&&b.selectionChanged&&Q(a),f&&lc(a),b.selectionChanged&&T(a),c.focused&&b.updateInput&&rb(a,b.userSelChange),b.textChanged&&Jd(a,"change",a,b.textChanged),b.selectionChanged&&Jd(a,"cursorActivity",a);for(var i=0;b.delayedCallbacks.length>i;++i)b.delayedCallbacks[i](a)}}function mb(a,b){return function(){var c=a||this;kb(c);try{var d=b.apply(c,arguments)}finally{lb(c)}return d}}function nb(a,b,c,d){a.curOp.changes.push({from:b,to:c,diff:d})}function ob(a){a.view.pollingFast||a.display.poll.set(a.options.pollInterval,function(){qb(a),a.view.focused&&ob(a)})}function pb(a){function c(){var d=qb(a);d||b?(a.display.pollingFast=!1,ob(a)):(b=!0,a.display.poll.set(60,c))}var b=!1;a.display.pollingFast=!0,a.display.poll.set(20,c)}function qb(a){var b=a.display.input,c=a.display.prevInput,d=a.view,e=d.sel;if(!d.focused||ke(b)||tb(a))return!1;var f=b.value;if(f==c&&bc(e.from,e.to))return!1;kb(a),d.sel.shift=!1;for(var g=0,h=Math.min(c.length,f.length);h>g&&c[g]==f[g];)++g;var i=e.from,j=e.to;c.length>g?i={line:i.line,ch:i.ch-(c.length-g)}:d.overwrite&&bc(i,j)&&!a.display.pasteIncoming&&(j={line:j.line,ch:Math.min(rd(a.view.doc,j.line).text.length,j.ch+(f.length-g))});var k=a.curOp.updateInput;return Yb(a,i,j,je(f.slice(g)),"end",a.display.pasteIncoming?"paste":"input",{from:i,to:j}),a.curOp.updateInput=k,f.length>1e3?b.value=a.display.prevInput="":a.display.prevInput=f,lb(a),a.display.pasteIncoming=!1,!0}function rb(a,b){var d,e,c=a.view;bc(c.sel.from,c.sel.to)?b&&(a.display.prevInput=a.display.input.value=""):(a.display.prevInput="",d=le&&(c.sel.to.line-c.sel.from.line>100||(e=a.getSelection()).length>1e3),a.display.input.value=d?"-":e||a.getSelection(),c.focused&&Td(a.display.input)),a.display.inaccurateSelection=d}function sb(a){"nocursor"==a.options.readOnly||!b&&document.activeElement==a.display.input||a.display.input.focus()}function tb(a){return a.options.readOnly||a.view.cantEdit}function ub(b){function d(){b.view.focused&&setTimeout(Wd(sb,b),0)}function f(a){b.options.onDragEvent&&b.options.onDragEvent(b,Ad(a))||Dd(a)}function g(){c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,c.input.value=b.getSelection(),Td(c.input))}var c=b.display;Hd(c.scroller,"mousedown",mb(b,zb)),Hd(c.scroller,"dblclick",mb(b,Bd)),Hd(c.lineSpace,"selectstart",function(a){vb(c,a)||Bd(a)}),a||Hd(c.scroller,"contextmenu",function(a){Xb(b,a)}),Hd(c.scroller,"scroll",function(){Db(b,c.scroller.scrollTop),Eb(b,c.scroller.scrollLeft,!0),Jd(b,"scroll",b)}),Hd(c.scrollbarV,"scroll",function(){Db(b,c.scrollbarV.scrollTop)}),Hd(c.scrollbarH,"scroll",function(){Eb(b,c.scrollbarH.scrollLeft)}),Hd(c.scroller,"mousewheel",function(a){Lb(b,a)}),Hd(c.scroller,"DOMMouseScroll",function(a){Lb(b,a)}),Hd(c.scrollbarH,"mousedown",d),Hd(c.scrollbarV,"mousedown",d),Hd(c.wrapper,"scroll",function(){c.wrapper.scrollTop=c.wrapper.scrollLeft=0}),Hd(window,"resize",function e(){c.cachedCharWidth=c.cachedTextHeight=null,bb(b),c.wrapper.parentNode?K(b,!0):Id(window,"resize",e)}),Hd(c.input,"keyup",mb(b,function(a){b.options.onKeyEvent&&b.options.onKeyEvent(b,Ad(a))||16==Gd(a,"keyCode")&&(b.view.sel.shift=!1)})),Hd(c.input,"input",Wd(pb,b)),Hd(c.input,"keydown",mb(b,Sb)),Hd(c.input,"keypress",mb(b,Tb)),Hd(c.input,"focus",Wd(Ub,b)),Hd(c.input,"blur",Wd(Vb,b)),b.options.dragDrop&&(Hd(c.scroller,"dragstart",function(a){Cb(b,a)}),Hd(c.scroller,"dragenter",f),Hd(c.scroller,"dragover",f),Hd(c.scroller,"drop",mb(b,Ab))),Hd(c.scroller,"paste",function(){sb(b),pb(b)}),Hd(c.input,"paste",function(){c.pasteIncoming=!0,pb(b)}),Hd(c.input,"cut",g),Hd(c.input,"copy",g),j&&Hd(c.sizer,"mouseup",function(){document.activeElement==c.input&&c.input.blur(),sb(b)})}function vb(a,b){for(var c=Ed(b);c!=a.wrapper;c=c.parentNode)if(/\bCodeMirror-(?:line)?widget\b/.test(c.className)||c.parentNode==a.sizer&&c!=a.mover)return!0}function wb(a,b,c){var d=a.display;if(!c){var e=Ed(b);if(e==d.scrollbarH||e==d.scrollbarH.firstChild||e==d.scrollbarV||e==d.scrollbarV.firstChild||e==d.scrollbarFiller)return null}var f,g,h=d.lineSpace.getBoundingClientRect();try{f=b.clientX,g=b.clientY}catch(b){return null}return fb(a,f-h.left,g-h.top)}function zb(c){function r(a){if("single"==l)return hc(d,fc(i,j),a),void 0;if(p=fc(i,p),q=fc(i,q),"double"==l){var b=sc(rd(i,a.line).text,a);cc(a,p)?hc(d,b.from,q):hc(d,p,b.to)}else"triple"==l&&(cc(a,p)?hc(d,q,fc(i,{line:a.line,ch:0})):hc(d,p,fc(i,{line:a.line+1,ch:0})))}function u(a){var b=++t,c=wb(d,a,!0);if(c)if(bc(c,n)){var h=a.clientYs.bottom?20:0;h&&setTimeout(mb(d,function(){t==b&&(f.scroller.scrollTop+=h,u(a))}),50)}else{g.focused||Ub(d),n=c,r(c);var e=F(f,i);(c.line>=e.to||c.linek-400&&bc(yb.pos,j))l="triple",Bd(c),setTimeout(Wd(sb,d),20),tc(d,j.line);else if(xb&&xb.time>k-400&&bc(xb.pos,j)){l="double",yb={time:k,pos:j},Bd(c);var m=sc(rd(i,j.line).text,j);hc(d,m.from,m.to)}else xb={time:k,pos:j};var n=j;if(d.options.dragDrop&&de&&!tb(d)&&!bc(h.from,h.to)&&!cc(j,h.from)&&!cc(h.to,j)&&"single"==l){var o=mb(d,function(a){e&&(f.scroller.draggable=!1),g.draggingText=!1,Id(document,"mouseup",o),Id(f.scroller,"drop",o),10>Math.abs(c.clientX-a.clientX)+Math.abs(c.clientY-a.clientY)&&(Bd(a),hc(d,j),sb(d))});return e&&(f.scroller.draggable=!0),g.draggingText=o,f.scroller.dragDrop&&f.scroller.dragDrop(),Hd(document,"mouseup",o),Hd(f.scroller,"drop",o),void 0}Bd(c),"single"==l&&hc(d,fc(i,j));var p=h.from,q=h.to,s=f.wrapper.getBoundingClientRect(),t=0,w=mb(d,function(a){b||Fd(a)?u(a):v(a)}),x=mb(d,v);Hd(document,"mousemove",w),Hd(document,"mouseup",x)}}function Ab(a){var c=this;if(!c.options.onDragEvent||!c.options.onDragEvent(c,Ad(a))){Bd(a);var d=wb(c,a,!0),e=a.dataTransfer.files;if(d&&!tb(c))if(e&&e.length&&window.FileReader&&window.File)for(var f=e.length,g=Array(f),h=0,i=function(a,b){var e=new FileReader;e.onload=function(){g[b]=e.result,++h==f&&(d=fc(c.view.doc,d),mb(c,function(){var a=ac(c,g.join(""),d,d,"paste");ic(c,d,a)})())},e.readAsText(a)},j=0;f>j;++j)i(e[j],j);else{if(c.view.draggingText&&!cc(d,c.view.sel.from)&&!cc(c.view.sel.to,d))return c.view.draggingText(a),b&&setTimeout(Wd(sb,c),50),void 0;try{var g=a.dataTransfer.getData("Text");if(g){var k=c.view.sel.from,l=c.view.sel.to;ic(c,d,d),c.view.draggingText&&ac(c,"",k,l,"paste"),c.replaceSelection(g,null,"paste"),sb(c),Ub(c)}}catch(a){}}}}function Bb(a,b){var c=a.display;try{var d=b.clientX,e=b.clientY}catch(b){return!1}if(d>=Math.floor(c.gutters.getBoundingClientRect().right))return!1;if(Bd(b),!Ld(a,"gutterClick"))return!0;var f=c.lineDiv.getBoundingClientRect();if(e>f.bottom)return!0;e-=f.top-c.viewOffset;for(var g=0;a.options.gutters.length>g;++g){var h=c.gutters.childNodes[g];if(h&&h.getBoundingClientRect().right>=d){var i=ud(a.view.doc,e),j=a.options.gutters[g];Kd(a,a,"gutterClick",a,i,j,b);break}}return!0}function Cb(a,b){var c=a.getSelection();b.dataTransfer.setData("Text",c),b.dataTransfer.setDragImage&&!i&&b.dataTransfer.setDragImage(_d("img"),0,0)}function Db(b,c){2>Math.abs(b.view.scrollTop-c)||(b.view.scrollTop=c,a||K(b,[],c),b.display.scroller.scrollTop!=c&&(b.display.scroller.scrollTop=c),b.display.scrollbarV.scrollTop!=c&&(b.display.scrollbarV.scrollTop=c),a&&K(b,[]))}function Eb(a,b,c){(c?b==a.view.scrollLeft:2>Math.abs(a.view.scrollLeft-b))||(a.view.scrollLeft=b,G(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function Lb(b,c){var d=c.wheelDeltaX,f=c.wheelDeltaY;if(null==d&&c.detail&&c.axis==c.HORIZONTAL_AXIS&&(d=c.detail),null==f&&c.detail&&c.axis==c.VERTICAL_AXIS?f=c.detail:null==f&&(f=c.wheelDelta),f&&p&&e)for(var g=c.target;g!=i;g=g.parentNode)if(g.lineObj){b.display.currentWheelTarget=g;break}var i=b.display.scroller;if(d&&!a&&!h&&null!=Kb)return f&&Db(b,Math.max(0,Math.min(i.scrollTop+f*Kb,i.scrollHeight-i.clientHeight))),Eb(b,Math.max(0,Math.min(i.scrollLeft+d*Kb,i.scrollWidth-i.clientWidth))),Bd(c),Ib=null,void 0;if(f&&null!=Kb){var j=f*Kb,k=b.view.scrollTop,l=k+b.display.wrapper.clientHeight;0>j?k=Math.max(0,k+j-50):l=Math.min(b.view.doc.height,l+j+50),K(b,[],{top:k,bottom:l})}20>Fb&&(null==Ib?(Ib=i.scrollLeft,Jb=i.scrollTop,Gb=d,Hb=f,setTimeout(function(){if(null!=Ib){var a=i.scrollLeft-Ib,b=i.scrollTop-Jb,c=b&&Hb&&b/Hb||a&&Gb&&a/Gb;Ib=Jb=null,c&&(Kb=(Kb*Fb+c)/(Fb+1),++Fb)}},200)):(Gb+=d,Hb+=f))}function Mb(a,b,c){if("string"==typeof b&&(b=Ec[b],!b))return!1;a.display.pollingFast&&qb(a)&&(a.display.pollingFast=!1);var d=a.view,e=d.sel.shift;try{tb(a)&&(d.suppressEdits=!0),c&&(d.sel.shift=!1),b(a)}catch(f){if(f!=Nd)throw f;return!1}finally{d.sel.shift=e,d.suppressEdits=!1}return!0}function Nb(a){var b=a.view.keyMaps.slice(0);return b.push(a.options.keyMap),a.options.extraKeys&&b.unshift(a.options.extraKeys),b}function Pb(a,b){function l(){k=!0}var c=Gc(a.options.keyMap),e=c.auto;clearTimeout(Ob),e&&!Ic(b)&&(Ob=setTimeout(function(){Gc(a.options.keyMap)==c&&(a.options.keyMap=e.call?e.call(null,a):e)},50));var g=me[Gd(b,"keyCode")],i=!1,j=p&&(h||f);if(null==g||b.altGraphKey)return!1;Gd(b,"altKey")&&(g="Alt-"+g),Gd(b,j?"metaKey":"ctrlKey")&&(g="Ctrl-"+g),Gd(b,j?"ctrlKey":"metaKey")&&(g="Cmd-"+g);var k=!1,m=Nb(a);return i=Gd(b,"shiftKey")?Hc("Shift-"+g,m,function(b){return Mb(a,b,!0)},l)||Hc(g,m,function(b){return"string"==typeof b&&/^go[A-Z]/.test(b)?Mb(a,b):void 0},l):Hc(g,m,function(b){return Mb(a,b)},l),k&&(i=!1),i&&(Bd(b),T(a),d&&(b.oldKeyCode=b.keyCode,b.keyCode=0)),i}function Qb(a,b,c){var d=Hc("'"+c+"'",Nb(a),function(b){return Mb(a,b,!0)});return d&&(Bd(b),T(a)),d}function Sb(a){var c=this;if(c.view.focused||Ub(c),b&&27==a.keyCode&&(a.returnValue=!1),!c.options.onKeyEvent||!c.options.onKeyEvent(c,Ad(a))){var d=Gd(a,"keyCode");c.view.sel.shift=16==d||Gd(a,"shiftKey");var e=Pb(c,a);h&&(Rb=e?d:null,e||88!=d||le||!Gd(a,p?"metaKey":"ctrlKey")||c.replaceSelection(""))}}function Tb(a){var b=this;if(!b.options.onKeyEvent||!b.options.onKeyEvent(b,Ad(a))){var c=Gd(a,"keyCode"),d=Gd(a,"charCode");if(h&&c==Rb)return Rb=null,Bd(a),void 0;if(!(h&&(!a.which||10>a.which)||j)||!Pb(b,a)){var e=String.fromCharCode(null==d?c:d);this.options.electricChars&&this.view.mode.electricChars&&this.options.smartIndent&&!tb(this)&&this.view.mode.electricChars.indexOf(e)>-1&&setTimeout(mb(b,function(){pc(b,b.view.sel.to.line,"smart")}),75),Qb(b,a,e)||pb(b)}}}function Ub(a){"nocursor"!=a.options.readOnly&&(a.view.focused||(Jd(a,"focus",a),a.view.focused=!0,-1==a.display.scroller.className.search(/\bCodeMirror-focused\b/)&&(a.display.scroller.className+=" CodeMirror-focused"),rb(a,!0)),ob(a),T(a))}function Vb(a){a.view.focused&&(Jd(a,"blur",a),a.view.focused=!1,a.display.scroller.className=a.display.scroller.className.replace(" CodeMirror-focused","")),clearInterval(a.display.blinker),setTimeout(function(){a.view.focused||(a.view.sel.shift=!1)},150)}function Xb(b,c){function k(){if(e.inputDiv.style.position="relative",e.input.style.cssText=j,d&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=i),ob(b),null!=e.input.selectionStart){clearTimeout(Wb); var a=e.input.value=" "+(bc(f.from,f.to)?"":e.input.value),c=0;e.prevInput=" ",e.input.selectionStart=1,e.input.selectionEnd=a.length,Wb=setTimeout(function g(){" "==e.prevInput&&0==e.input.selectionStart?mb(b,Ec.selectAll)(b):10>c++?Wb=setTimeout(g,500):rb(b)},200)}}var e=b.display,f=b.view.sel,g=wb(b,c),i=e.scroller.scrollTop;if(g&&!h){(bc(f.from,f.to)||cc(g,f.from)||!cc(g,f.to))&&mb(b,ic)(b,g,g);var j=e.input.style.cssText;e.inputDiv.style.position="absolute",e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(c.clientY-5)+"px; left: "+(c.clientX-5)+"px; z-index: 1000; background: white; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",sb(b),rb(b,!0),bc(f.from,f.to)&&(e.input.value=e.prevInput=" "),a?(Dd(c),Hd(window,"mouseup",function l(){Id(window,"mouseup",l),setTimeout(k,20)})):setTimeout(k,50)}}function Yb(a,b,c,d,e,f){var g=q&&Sc(a.view.doc,b,c);if(!g)return Zb(a,b,c,d,e,f);for(var h=g.length-1;h>=1;--h)Zb(a,g[h].from,g[h].to,[""],f);return g.length?Zb(a,g[0].from,g[0].to,d,e,f):void 0}function Zb(a,b,c,d,e,f){if(!a.view.suppressEdits){var g=a.view,h=g.doc,i=[];h.iter(b.line,c.line+1,function(a){i.push(_c(a.text,a.markedSpans))});var j=g.sel.from,k=g.sel.to,l=Rc($c(i[0]),$c(Sd(i)),b.ch,c.ch,d),m=_b(a,b,c,l,e,f);return g.history&&yd(a,b.line,d.length,i,f,j,k,g.sel.from,g.sel.to),m}}function $b(a,b){var c=a.view.doc,d=a.view.history,e=("undo"==b?d.done:d.undone).pop();if(e){for(var f={events:[],fromBefore:e.fromAfter,toBefore:e.toAfter,fromAfter:e.fromBefore,toAfter:e.toBefore},g=e.events.length-1;g>=0;g-=1){d.dirtyCounter+="undo"==b?-1:1;var h=e.events[g],i=[],j=h.start+h.added;c.iter(h.start,j,function(a){i.push(_c(a.text,a.markedSpans))}),f.events.push({start:h.start,added:h.old.length,old:i});var k=g?null:{from:e.fromBefore,to:e.toBefore};_b(a,{line:h.start,ch:0},{line:j-1,ch:rd(c,j-1).text.length},h.old,k,b)}("undo"==b?d.undone:d.done).push(f)}}function _b(a,b,c,d,e,f){var g=a.view,h=g.doc,i=a.display;if(!g.suppressEdits){var j=c.line-b.line,k=rd(h,b.line),l=rd(h,c.line),m=!1,n=b.line;a.options.lineWrapping||(n=td(Wc(h,k)),h.iter(n,c.line+1,function(a){return B(h,a)==g.maxLineLength?(m=!0,!0):void 0}));var o=Sd(d),p=ib(i);if(0==b.ch&&0==c.ch&&""==Zc(o)){for(var q=[],r=0,s=d.length-1;s>r;++r)q.push(cd(Zc(d[r]),$c(d[r]),p));dd(a,l,l.text,$c(o)),j&&h.remove(b.line,j,a),q.length&&h.insert(b.line,q)}else if(k==l)if(1==d.length)dd(a,k,k.text.slice(0,b.ch)+Zc(d[0])+k.text.slice(c.ch),$c(d[0]));else{for(var q=[],r=1,s=d.length-1;s>r;++r)q.push(cd(Zc(d[r]),$c(d[r]),p));q.push(cd(Zc(o)+k.text.slice(c.ch),$c(o),p)),dd(a,k,k.text.slice(0,b.ch)+Zc(d[0]),$c(d[0])),h.insert(b.line+1,q)}else if(1==d.length)dd(a,k,k.text.slice(0,b.ch)+Zc(d[0])+l.text.slice(c.ch),$c(d[0])),h.remove(b.line+1,j,a);else{var q=[];dd(a,k,k.text.slice(0,b.ch)+Zc(d[0]),$c(d[0])),dd(a,l,Zc(o)+l.text.slice(c.ch),$c(o));for(var r=1,s=d.length-1;s>r;++r)q.push(cd(Zc(d[r]),$c(d[r]),p));j>1&&h.remove(b.line+1,j-1,a),h.insert(b.line+1,q)}if(a.options.lineWrapping){var t=Math.max(5,i.scroller.clientWidth/jb(i)-3);h.iter(b.line,b.line+d.length,function(a){if(0!=a.height){var b=(Math.ceil(a.text.length/t)||1)*p;b!=a.height&&sd(a,b)}})}else h.iter(n,b.line+d.length,function(a){var b=B(h,a);b>g.maxLineLength&&(g.maxLine=a,g.maxLineLength=b,g.maxLineChanged=!0,m=!1)}),m&&(a.curOp.updateMaxLine=!0);g.frontier=Math.min(g.frontier,b.line),U(a,400);var u=d.length-j-1;if(nb(a,b.line,c.line+1,u),Ld(a,"change")){for(var r=0;d.length>r;++r)"string"!=typeof d[r]&&(d[r]=d[r].text);var v={from:b,to:c,text:d,origin:f};if(a.curOp.textChanged){for(var w=a.curOp.textChanged;w.next;w=w.next);w.next=v}else a.curOp.textChanged=v}var x,y,z={line:b.line+d.length-1,ch:Zc(o).length+(1==d.length?b.ch:0)};if(e&&"string"!=typeof e)e.from?(x=e.from,y=e.to):x=y=e;else if("end"==e)x=y=z;else if("start"==e)x=y=b;else if("around"==e)x=b,y=z;else{var A=function(a){if(cc(a,b))return a;if(!cc(c,a))return z;var d=a.line+u,e=a.ch;return a.line==c.line&&(e+=Zc(o).length-(c.ch-(c.line==b.line?b.ch:0))),{line:d,ch:e}};x=A(g.sel.from),y=A(g.sel.to)}return ic(a,x,y,null,!0),z}}function ac(a,b,c,d,e){if(d||(d=c),cc(d,c)){var f=d;d=c,c=f}return Yb(a,c,d,je(b),null,e)}function bc(a,b){return a.line==b.line&&a.ch==b.ch}function cc(a,b){return a.lineb.line)return{line:0,ch:0};if(b.line>=a.size)return{line:a.size-1,ch:rd(a,a.size-1).text.length};var c=b.ch,d=rd(a,b.line).text.length;return null==c||c>d?{line:b.line,ch:d}:0>c?{line:b.line,ch:0}:b}function gc(a,b){return b>=0&&a.size>b}function hc(a,b,c,d){var e=a.view.sel;if(e.shift||e.extend){var f=e.anchor;if(c){var g=cc(b,f);g!=cc(c,f)?(f=b,b=c):g!=cc(b,c)&&(b=c)}ic(a,f,b,d)}else ic(a,b,c||b,d);a.curOp.userSelChange=!0}function ic(a,b,c,d,e){a.view.goalColumn=null;var f=a.view.sel;if((e||!bc(b,f.anchor))&&(b=kc(a,b,d,"push"!=e)),(e||!bc(c,f.head))&&(c=kc(a,c,d,"push"!=e)),!bc(f.anchor,b)||!bc(f.head,c)){f.anchor=b,f.head=c;var g=cc(c,b);f.from=g?c:b,f.to=g?b:c,a.curOp.updateInput=!0,a.curOp.selectionChanged=!0}}function jc(a){ic(a,a.view.sel.from,a.view.sel.to,null,"push")}function kc(a,b,c,d){var e=a.view.doc,f=!1,g=b,h=c||1;a.view.cantEdit=!1;a:for(;;){var j,i=rd(e,g.line);if(i.markedSpans){for(var k=0;i.markedSpans.length>k;++k){var l=i.markedSpans[k],m=l.marker;if((null==l.from||(m.inclusiveLeft?l.from<=g.ch:l.from=g.ch:l.to>g.ch))){if(d&&m.clearOnEnter){(j||(j=[])).push(m);continue}if(!m.atomic)continue;var n=m.find()[0>h?"from":"to"];if(bc(n,g)&&(n.ch+=h,0>n.ch?n=n.line?fc(e,{line:n.line-1}):null:n.ch>i.text.length&&(n=n.linek;++k)j[k].clear()}return g}}function lc(a){var b=a.view,c=mc(a,b.sel.head);if(b.focused){var d=a.display,e=d.sizer.getBoundingClientRect(),f=null;if(0>c.top+e.top?f=!0:c.bottom+e.top>(window.innerHeight||document.documentElement.clientHeight)&&(f=!1),null!=f&&!m){var g="none"==d.cursor.style.display;g&&(d.cursor.style.display="",d.cursor.style.left=c.left+"px",d.cursor.style.top=c.top-d.viewOffset+"px"),d.cursor.scrollIntoView(f),g&&(d.cursor.style.display="none")}}}function mc(a,b){for(;;){var c=!1,d=eb(a,b),e=oc(a,d.left,d.top,d.left,d.bottom),f=a.view.scrollTop,g=a.view.scrollLeft;if(null!=e.scrollTop&&(Db(a,e.scrollTop),Math.abs(a.view.scrollTop-f)>1&&(c=!0)),null!=e.scrollLeft&&(Eb(a,e.scrollLeft),Math.abs(a.view.scrollLeft-g)>1&&(c=!0)),!c)return d}}function nc(a,b,c,d,e){var f=oc(a,b,c,d,e);null!=f.scrollTop&&Db(a,f.scrollTop),null!=f.scrollLeft&&Eb(a,f.scrollLeft)}function oc(a,b,c,d,e){var f=a.display,g=Y(f);c+=g,e+=g;var h=f.scroller.clientHeight-Md,i=f.scroller.scrollTop,j={},k=a.view.doc.height+2*g,l=g+10>c,m=e+g>k-10;i>c?j.scrollTop=l?0:Math.max(0,c):e>i+h&&(j.scrollTop=(m?k:e)-h);var n=f.scroller.clientWidth-Md,o=f.scroller.scrollLeft;b+=f.gutters.offsetWidth,d+=f.gutters.offsetWidth;var p=f.gutters.offsetWidth,q=p+10>b;return o+p>b||q?(q&&(b=0),j.scrollLeft=Math.max(0,b-10-p)):d>n+o-3&&(j.scrollLeft=d+10-n),j}function pc(a,b,c,d){var e=a.view.doc;if(c||(c="add"),"smart"==c)if(a.view.mode.indent)var f=X(a,b);else c="prev";var k,g=a.options.tabSize,h=rd(e,b),i=Pd(h.text,null,g),j=h.text.match(/^\s*/)[0];if("smart"==c&&(k=a.view.mode.indent(f,h.text.slice(j.length),h.text),k==Nd)){if(!d)return;c="prev"}"prev"==c?k=b?Pd(rd(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c&&(k=i-a.options.indentUnit),k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(k/g);n;--n)m+=g,l+=" ";k>m&&(l+=Rd(k-m)),l!=j&&ac(a,l,{line:b,ch:0},{line:b,ch:j.length},"input"),h.stateAfter=null}function qc(a,b,c){var d=b,e=b,f=a.view.doc;return"number"==typeof b?e=rd(f,ec(f,b)):d=td(b),null==d?null:c(e,d)?(nb(a,d,d+1),e):null}function rc(a,b,c,d){function j(){var a=g+b;return 0>a||a==e.size?!1:(g=a,i=rd(e,a))}function k(a){var c=(d?ue:ve)(i,h,b,!0);if(null==c){if(a||!j())return!1;h=d?(0>b?re:qe)(i):0>b?i.text.length:0}else h=c;return!0}var e=a.view.doc,f=a.view.sel.head,g=f.line,h=f.ch,i=rd(e,g);if("char"==c)k();else if("column"==c)k(!0);else if("word"==c)for(var l=!1;!(0>b)||k();){if(Yd(i.text.charAt(h)))l=!0;else if(l){0>b&&(b=1,k());break}if(b>0&&!k())break}return kc(a,{line:g,ch:h},b,!0)}function sc(a,b){var c=b.ch,d=b.ch;if(a){b.after===!1||d==a.length?--c:++d;for(var e=a.charAt(c),f=Yd(e)?Yd:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!Yd(a)};c>0&&f(a.charAt(c-1));)--c;for(;a.length>d&&f(a.charAt(d));)++d}return{from:{line:b.line,ch:c},to:{line:b.line,ch:d}}}function tc(a,b){hc(a,{line:b,ch:0},fc(a.view.doc,{line:b+1,ch:0}))}function wc(a,b,c,d){s.defaults[a]=b,c&&(uc[a]=d?function(a,b,d){d!=xc&&c(a,b,d)}:c)}function Cc(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function Dc(a,b,c){return a.startState?a.startState(b,c):!0}function Gc(a){return"string"==typeof a?Fc[a]:a}function Hc(a,b,c,d){function e(b){b=Gc(b);var f=b[a];if(f===!1)return d&&d(),!0;if(null!=f&&c(f))return!0;if(b.nofallthrough)return d&&d(),!0;var g=b.fallthrough;if(null==g)return!1;if("[object Array]"!=Object.prototype.toString.call(g))return e(g);for(var h=0,i=g.length;i>h;++h)if(e(g[h]))return!0;return!1}for(var f=0;b.length>f;++f)if(e(b[f]))return!0}function Ic(a){var b=me[Gd(a,"keyCode")];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b}function Jc(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8}function Kc(a,b){this.lines=[],this.type=b,this.cm=a}function Lc(a,b,c,d,e){var f=a.view.doc,g=new Kc(a,e);if("range"==e&&!cc(b,c))return g;if(d)for(var h in d)d.hasOwnProperty(h)&&(g[h]=d[h]);g.replacedWith&&(g.collapsed=!0,g.replacedWith=_d("span",[g.replacedWith],"CodeMirror-widget")),g.collapsed&&(r=!0);var k,l,i=b.line,j=0;if(f.iter(i,c.line+1,function(a){var d={from:null,to:null,marker:g};j+=a.text.length,i==b.line&&(d.from=b.ch,j-=b.ch),i==c.line&&(d.to=c.ch,j-=a.text.length-c.ch),g.collapsed&&(i==c.line&&(l=Tc(a,c.ch)),i==b.line?k=Tc(a,b.ch):sd(a,0)),Oc(a,d),g.collapsed&&i==b.line&&Xc(a)&&sd(a,0),++i}),g.readOnly&&(q=!0,(a.view.history.done.length||a.view.history.undone.length)&&a.clearHistory()),g.collapsed){if(k!=l)throw Error("Inserting collapsed marker overlapping an existing one");g.size=j,g.atomic=!0}return(g.className||g.startStyle||g.endStyle||g.collapsed)&&nb(a,b.line,c.line+1),g.atomic&&jc(a),g}function Mc(a,b){if(a)for(var c=0;a.length>c;++c){var d=a[c];if(d.marker==b)return d}}function Nc(a,b){for(var c,d=0;a.length>d;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function Oc(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.lines.push(a)}function Pc(a,b){if(a)for(var d,c=0;a.length>c;++c){var e=a[c],f=e.marker,g=null==e.from||(f.inclusiveLeft?b>=e.from:b>e.from);if(g||"bookmark"==f.type&&e.from==b){var h=null==e.to||(f.inclusiveRight?e.to>=b:e.to>b);(d||(d=[])).push({from:e.from,to:h?null:e.to,marker:f})}}return d}function Qc(a,b,c){if(a)for(var e,d=0;a.length>d;++d){var f=a[d],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=c:f.to>c);if(h||"bookmark"==g.type&&f.from==c&&f.from!=b){var i=null==f.from||(g.inclusiveLeft?c>=f.from:c>f.from);(e||(e=[])).push({from:i?null:f.from-c,to:null==f.to?null:f.to-c,marker:g})}}return e}function Rc(a,b,c,d,e){if(!a&&!b)return e;var f=Pc(a,c),g=Qc(b,c,d),h=1==e.length,i=Sd(e).length+(h?c:0);if(f)for(var j=0;f.length>j;++j){var k=f[j];if(null==k.to){var l=Mc(g,k.marker);l?h&&(k.to=null==l.to?null:l.to+i):k.to=c}}if(g)for(var j=0;g.length>j;++j){var k=g[j];if(null!=k.to&&(k.to+=i),null==k.from){var l=Mc(f,k.marker);l||(k.from=i,h&&(f||(f=[])).push(k))}else k.from+=i,h&&(f||(f=[])).push(k)}var m=[_c(e[0],f)];if(!h){var o,n=e.length-2;if(n>0&&f)for(var j=0;f.length>j;++j)null==f[j].to&&(o||(o=[])).push({from:null,to:null,marker:f[j].marker});for(var j=0;n>j;++j)m.push(_c(e[j+1],o));m.push(_c(Sd(e),g))}return m}function Sc(a,b,c){var d=null;if(a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;a.markedSpans.length>b;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=Ud(d,c)||(d||(d=[])).push(c)}}),!d)return null;for(var e=[{from:b,to:c}],f=0;d.length>f;++f)for(var g=d[f].find(),h=0;e.length>h;++h){var i=e[h];if(cc(g.from,i.to)&&!cc(g.to,i.from)){var j=[h,1];cc(i.from,g.from)&&j.push({from:i.from,to:g.from}),cc(g.to,i.to)&&j.push({from:g.to,to:i.to}),e.splice.apply(e,j),h+=j.length-1}}return e}function Tc(a,b){var d,c=r&&a.markedSpans;if(c)for(var e,f=0;c.length>f;++f)e=c[f],e.marker.collapsed&&(null==e.from||b>e.from)&&(null==e.to||e.to>b)&&(!d||d.widthd;++d)if(c=b[d],c.marker.collapsed){if(null==c.from)return!0;if(0==c.from&&c.marker.inclusiveLeft&&Yc(a,c))return!0}}function Yc(a,b){if(null==b.to||b.marker.inclusiveRight&&b.to==a.text.length)return!0;for(var c,d=0;a.markedSpans.length>d;++d)if(c=a.markedSpans[d],c.marker.collapsed&&c.from==b.to&&(c.marker.inclusiveLeft||b.marker.inclusiveRight)&&Yc(a,c))return!0}function Zc(a){return"string"==typeof a?a:a.text}function $c(a){if("string"==typeof a)return null;for(var b=a.markedSpans,c=null,d=0;b.length>d;++d)b[d].marker.explicitlyCleared?c||(c=b.slice(0,d)):c&&c.push(b[d]);return c?c.length?c:null:b}function _c(a,b){return b?{text:a,markedSpans:b}:a}function ad(a){var b=a.markedSpans;if(b){for(var c=0;b.length>c;++c){var d=b[c].marker.lines,e=Ud(d,a);d.splice(e,1)}a.markedSpans=null}}function bd(a,b){if(b){for(var c=0;b.length>c;++c)b[c].marker.lines.push(a);a.markedSpans=b}}function cd(a,b,c){var d={text:a,height:c};return bd(d,b),Xc(d)&&(d.height=0),d}function dd(a,b,c,d){b.text=c,b.stateAfter=b.styles=null,null!=b.order&&(b.order=null),ad(b),bd(b,d),Xc(b)?b.height=0:b.height||(b.height=ib(a.display)),Kd(a,b,"change")}function ed(a){a.parent=null,ad(a)}function fd(a,b,c){var d=a.view.mode,e=a.options.flattenSpans,f=!b.styles,g=0,h="",i=null,j=new Jc(b.text,a.options.tabSize),k=b.styles||(b.styles=[]);for(""==b.text&&d.blankLine&&d.blankLine(c);!j.eol();){var l=d.token(j,c),m=j.current();if(j.start=j.pos,e&&i==l?h+=m:(h&&(f=f||g>=k.length||h!=k[g]||i!=k[g+1],k[g++]=h,k[g++]=i),h=m,i=l),j.pos>5e3)break}return h&&(f=f||g>=k.length||h!=k[g]||i!=k[g+1],k[g++]=h,k[g++]=i),j.pos>5e3&&(k[g++]=b.text.slice(j.pos),k[g++]=null),g!=k.length&&(k.length=g,f=!0),f}function gd(a,b,c){var d=a.view.mode,e=new Jc(b.text,a.options.tabSize);for(""==b.text&&d.blankLine&&d.blankLine(c);!e.eol()&&5e3>=e.pos;)d.token(e,c),e.start=e.pos}function id(a){return a?hd[a]||(hd[a]="cm-"+a.replace(/ +/g," cm-")):null}function jd(a,b,c){for(var d,f,g,e=b,h=!0;d=Uc(e);)h=!1,e=rd(a.view.doc,d.find().from.line),f||(f=e);var i={pre:_d("pre"),col:0,pos:0,display:!c,measure:null,addedOne:!1,cm:a};e.textClass&&(i.pre.className=e.textClass);do{e.styles||fd(a,e,e.stateAfter=X(a,td(e))),i.measure=e==b&&c,i.pos=0,i.addToken=i.measure?md:ld,c&&g&&e!=b&&!i.addedOne&&(c[0]=i.pre.appendChild(ie(a.display.measure)),i.addedOne=!0);var j=od(e,i);g=e==f,j&&(e=rd(a.view.doc,j.to.line),h=!1)}while(j);return c&&!i.addedOne&&(c[0]=i.pre.appendChild(h?_d("span","\u00a0"):ie(a.display.measure))),i.pre.firstChild||Xc(b)||i.pre.appendChild(document.createTextNode("\u00a0")),i.pre}function ld(a,b,c,d,e){if(b){if(kd.test(b))for(var f=document.createDocumentFragment(),g=0;;){kd.lastIndex=g;var h=kd.exec(b),i=h?h.index-g:b.length-g;if(i&&(f.appendChild(document.createTextNode(b.slice(g,g+i))),a.col+=i),!h)break;if(g+=i+1," "==h[0]){var j=a.cm.options.tabSize,k=j-a.col%j;f.appendChild(_d("span",Rd(k),"cm-tab")),a.col+=k}else{var l=_d("span","\u2022","cm-invalidchar");l.title="\\u"+h[0].charCodeAt(0).toString(16),f.appendChild(l),a.col+=1}}else{a.col+=b.length;var f=document.createTextNode(b)}if(c||d||e||a.measure){var m=c||"";return d&&(m+=d),e&&(m+=e),a.pre.appendChild(_d("span",[f],m))}a.pre.appendChild(f)}}function md(a,b,c,d,e){for(var f=0;b.length>f;++f)f&&b.length-1>f&&a.cm.options.lineWrapping&&ee.test(b.slice(f-1,f+1))&&a.pre.appendChild(_d("wbr")),a.measure[a.pos++]=ld(a,b.charAt(f),c,0==f&&d,f==b.length-1&&e);b.length&&(a.addedOne=!0)}function nd(a,b,c){c&&(a.display||(c=c.cloneNode(!0)),a.pre.appendChild(c),a.measure&&b&&(a.measure[a.pos]=c,a.addedOne=!0)),a.pos+=b}function od(a,b){var c=a.styles,d=a.markedSpans;if(d)for(var j,l,m,n,o,f=a.text,g=f.length,h=0,e=0,i="",k=0;;){if(k==h){l=m=n="",o=null,k=1/0;for(var p=null,q=0;d.length>q;++q){var r=d[q],s=r.marker;h>=r.from&&(null==r.to||r.to>h)?(null!=r.to&&k>r.to&&(k=r.to,m=""),s.className&&(l+=" "+s.className),s.startStyle&&r.from==h&&(n+=" "+s.startStyle),s.endStyle&&r.to==k&&(m+=" "+s.endStyle),s.collapsed&&(!o||o.marker.widthh&&k>r.from&&(k=r.from),"bookmark"==s.type&&r.from==h&&s.replacedWith&&(p=s.replacedWith)}if(o&&(o.from||0)==h&&(nd(b,(null==o.to?g:o.to)-h,null!=o.from&&o.marker.replacedWith),null==o.to))return o.marker.find();p&&!o&&nd(b,0,p)}if(h>=g)break;for(var t=Math.min(g,k);;){if(i){var u=h+i.length;if(!o){var v=u>t?i.slice(0,t-h):i;b.addToken(b,v,j+l,n,h+v.length==k?m:"")}if(u>=t){i=i.slice(t-h),h=t;break}h=u,n=""}i=c[e++],j=id(c[e++])}}else for(var e=0;c.length>e;e+=2)b.addToken(b,c[e],id(c[e+1]))}function pd(a){this.lines=a,this.parent=null;for(var b=0,c=a.length,d=0;c>b;++b)a[b].parent=this,d+=a[b].height;this.height=d}function qd(a){this.children=a;for(var b=0,c=0,d=0,e=a.length;e>d;++d){var f=a[d];b+=f.chunkSize(),c+=f.height,f.parent=this}this.size=b,this.height=c,this.parent=null}function rd(a,b){for(;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(e>b){a=d;break}b-=e}return a.lines[b]}function sd(a,b){for(var c=b-a.height,d=a;d;d=d.parent)d.height+=c}function td(a){if(null==a.parent)return null;for(var b=a.parent,c=Ud(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c}function ud(a,b){var c=0;a:do{for(var d=0,e=a.children.length;e>d;++d){var f=a.children[d],g=f.height;if(g>b){a=f;continue a}b-=g,c+=f.chunkSize()}return c}while(!a.lines);for(var d=0,e=a.lines.length;e>d;++d){var h=a.lines[d],i=h.height;if(i>b)break;b-=i}return c+d}function vd(a,b){b=Wc(a.view.doc,b);for(var c=0,d=b.parent,e=0;d.lines.length>e;++e){var f=d.lines[e];if(f==b)break;c+=f.height}for(var g=d.parent;g;d=g,g=d.parent)for(var e=0;g.children.length>e;++e){var h=g.children[e];if(h==d)break;c+=h.height}return c}function wd(a){var b=a.order;return null==b&&(b=a.order=we(a.text)),b}function xd(){return{done:[],undone:[],lastTime:0,lastOp:null,lastOrigin:null,dirtyCounter:0}}function yd(a,b,c,d,e,f,g,h,i){var j=a.view.history;j.undone.length=0;var k=+new Date,l=Sd(j.done);if(l&&(j.lastOp==a.curOp.id||j.lastOrigin==e&&("input"==e||"delete"==e)&&j.lastTime>k-600)){var m=Sd(l.events);if(m.start>b+d.length||b>m.start+m.added)l.events.push({start:b,added:c,old:d});else{for(var n=Math.max(0,m.start-b),o=Math.max(0,b+d.length-(m.start+m.added)),p=n;p>0;--p)m.old.unshift(d[p-1]);for(var p=o;p>0;--p)m.old.push(d[d.length-p]);n&&(m.start=b),m.added+=c-(d.length-n-o)}l.fromAfter=h,l.toAfter=i}else{for(l={events:[{start:b,added:c,old:d}],fromBefore:f,toBefore:g,fromAfter:h,toAfter:i},j.done.push(l);j.done.length>a.options.undoDepth;)j.done.shift();0>j.dirtyCounter?j.dirtyCounter=0/0:j.dirtyCounter++}j.lastTime=k,j.lastOp=a.curOp.id,j.lastOrigin=e}function zd(){Dd(this)}function Ad(a){return a.stop||(a.stop=zd),a}function Bd(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Cd(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function Dd(a){Bd(a),Cd(a)}function Ed(a){return a.target||a.srcElement}function Fd(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),p&&a.ctrlKey&&1==b&&(b=3),b}function Gd(a,b){var c=a.override&&a.override.hasOwnProperty(b);return c?a.override[b]:a[b]}function Hd(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a._handlers||(a._handlers={}),e=d[b]||(d[b]=[]);e.push(c)}}function Id(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=a._handlers&&a._handlers[b];if(!d)return;for(var e=0;d.length>e;++e)if(d[e]==c){d.splice(e,1);break}}}function Jd(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;c.length>e;++e)c[e].apply(null,d)}function Kd(a,b,c){function g(a){return function(){a.apply(null,e)}}var d=b._handlers&&b._handlers[c];if(d)for(var e=Array.prototype.slice.call(arguments,3),f=a.curOp&&a.curOp.delayedCallbacks,h=0;d.length>h;++h)f?f.push(g(d[h])):d[h].apply(null,e)}function Ld(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function Od(){this.id=null}function Pd(a,b,c){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var d=0,e=0;b>d;++d)" "==a.charAt(d)?e+=c-e%c:++e;return e}function Rd(a){for(;a>=Qd.length;)Qd.push(Sd(Qd)+" ");return Qd[a]}function Sd(a){return a[a.length-1]}function Td(a){n?(a.selectionStart=0,a.selectionEnd=a.value.length):a.select()}function Ud(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;d>c;++c)if(a[c]==b)return c;return-1}function Vd(a){for(var b=[],c=0;a>c;++c)b.push(void 0);return b}function Wd(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Yd(a){return/\w/.test(a)||a>"\u0080"&&(a.toUpperCase()!=a.toLowerCase()||Xd.test(a))}function Zd(a){var b=0;for(var c in a)a.hasOwnProperty(c)&&a[c]&&++b;return!b}function _d(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)ce(e,b);else if(b)for(var f=0;b.length>f;++f)e.appendChild(b[f]);return e}function ae(a){return a.innerHTML="",a}function be(a,b){return ae(a).appendChild(b)}function ce(a,b){d?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function ge(a){if(null!=fe)return fe;var b=_d("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return be(a,b),b.offsetWidth&&(fe=b.offsetHeight-b.clientHeight),fe||0}function ie(a){if(null==he){var b=_d("span","\u200b");be(a,_d("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(he=1>=b.offsetWidth&&b.offsetHeight>2&&!c)}return he?_d("span","\u200b"):_d("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px")}function ne(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=0;a.length>e;++e){var f=a[e];c>f.from&&f.to>b&&d(Math.max(f.from,b),Math.min(f.to,c),1==f.level?"rtl":"ltr")}}function oe(a){return a.level%2?a.to:a.from}function pe(a){return a.level%2?a.from:a.to}function qe(a){var b=wd(a);return b?oe(b[0]):0}function re(a){var b=wd(a);return b?pe(Sd(b)):a.text.length}function se(a,b){var c=rd(a.view.doc,b),d=Wc(a.view.doc,c);d!=c&&(b=td(d));var e=wd(d),f=e?e[0].level%2?re(d):qe(d):0;return{line:b,ch:f}}function te(a,b){for(var c,d;c=Vc(d=rd(a.view.doc,b));)b=c.find().to.line;var e=wd(d),f=e?e[0].level%2?qe(d):re(d):d.text.length;return{line:b,ch:f}}function ue(a,b,c,d){var e=wd(a);if(!e)return ve(a,b,c,d);for(var f=d?function(b,c){do b+=c;while(b>0&&$d.test(a.text.charAt(b)));return b}:function(a,b){return a+b},g=e[0].level,h=0;e.length>h;++h){var i=e[h],j=i.level%2==g;if(b>i.from&&i.to>b||j&&(i.from==b||i.to==b))break}for(var k=f(b,i.level%2?-c:c);null!=k;)if(i.level%2==g){if(!(i.from>k||k>i.to))break;i=e[h+=c],k=i&&(c>0==i.level%2?f(i.to,-1):f(i.from,1))}else if(k==oe(i))i=e[--h],k=i&&pe(i);else{if(k!=pe(i))break;i=e[++h],k=i&&oe(i)}return 0>k||k>a.text.length?null:k}function ve(a,b,c,d){var e=b+c;if(d)for(;e>0&&$d.test(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var hb,xb,yb,Gb,Hb,Ib,Jb,a=/gecko\/\d/i.test(navigator.userAgent),b=/MSIE \d/.test(navigator.userAgent),c=/MSIE [1-7]\b/.test(navigator.userAgent),d=/MSIE [1-8]\b/.test(navigator.userAgent),e=/WebKit\//.test(navigator.userAgent),f=e&&/Qt\/\d+\.\d+/.test(navigator.userAgent),g=/Chrome\//.test(navigator.userAgent),h=/Opera\//.test(navigator.userAgent),i=/Apple Computer/.test(navigator.vendor),j=/KHTML\//.test(navigator.userAgent),k=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),m=/PhantomJS/.test(navigator.userAgent),n=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),o=n||/Android|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent),p=n||/Mac/.test(navigator.platform),q=!1,r=!1,Fb=0,Kb=null;b?Kb=-.53:a?Kb=15:g?Kb=-.7:i&&(Kb=-1/3);var Ob,Wb,Rb=null;s.prototype={getValue:function(a){var b=[],c=this.view.doc;return c.iter(0,c.size,function(a){b.push(a.text)}),b.join(a||"\n")},setValue:mb(null,function(a){var b=this.view.doc,c={line:0,ch:0},d=rd(b,b.size-1).text.length;Zb(this,c,{line:b.size-1,ch:d},je(a),c,c,"setValue")}),getSelection:function(a){return this.getRange(this.view.sel.from,this.view.sel.to,a)},replaceSelection:mb(null,function(a,b,c){var d=this.view.sel;Yb(this,d.from,d.to,je(a),b||"around",c)}),focus:function(){window.focus(),sb(this),Ub(this),pb(this)},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,uc.hasOwnProperty(a)&&mb(this,uc[a])(this,b,d))},getOption:function(a){return this.options[a]},getMode:function(){return this.view.mode},addKeyMap:function(a){this.view.keyMaps.push(a)},removeKeyMap:function(a){for(var b=this.view.keyMaps,c=0;b.length>c;++c)if(("string"==typeof a?b[c].name:b[c])==a)return b.splice(c,1),!0},undo:mb(null,function(){$b(this,"undo")}),redo:mb(null,function(){$b(this,"redo")}),indentLine:mb(null,function(a,b,c){"string"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),gc(this.view.doc,a)&&pc(this,a,b,c)}),indentSelection:mb(null,function(a){var b=this.view.sel;if(bc(b.from,b.to))return pc(this,b.from.line,a);for(var c=b.to.line-(b.to.ch?0:1),d=b.from.line;c>=d;++d)pc(this,d,a)}),historySize:function(){var a=this.view.history;return{undo:a.done.length,redo:a.undone.length}},clearHistory:function(){this.view.history=xd()},markClean:function(){this.view.history.dirtyCounter=0,this.view.history.lastOp=this.view.history.lastOrigin=null},isClean:function(){return 0==this.view.history.dirtyCounter},getHistory:function(){function b(a){for(var d,b=0,c=[];a.length>b;++b){var e=a[b];c.push({events:d=[],fromBefore:e.fromBefore,toBefore:e.toBefore,fromAfter:e.fromAfter,toAfter:e.toAfter});for(var f=0,g=e.events;g.length>f;++f){var h=[],i=g[f];d.push({start:i.start,added:i.added,old:h});for(var j=0;i.old.length>j;++j)h.push(Zc(i.old[j]))}}return c}var a=this.view.history;return{done:b(a.done),undone:b(a.undone)}},setHistory:function(a){var b=this.view.history=xd();b.done=a.done,b.undone=a.undone},getTokenAt:function(a){var b=this.view.doc;a=fc(b,a);for(var c=X(this,a.line),d=this.view.mode,e=rd(b,a.line),f=new Jc(e.text,this.options.tabSize);f.pose;++e){var f=d[e];(null==f.from||f.from<=a.ch)&&(null==f.to||f.to>=a.ch)&&c.push(f.marker)}return c},setGutterMarker:mb(null,function(a,b,c){return qc(this,a,function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&Zd(d)&&(a.gutterMarkers=null),!0})}),clearGutter:mb(null,function(a){var b=0,c=this,d=c.view.doc;d.iter(0,d.size,function(d){d.gutterMarkers&&d.gutterMarkers[a]&&(d.gutterMarkers[a]=null,nb(c,b,b+1),Zd(d.gutterMarkers)&&(d.gutterMarkers=null)),++b})}),addLineClass:mb(null,function(a,b,c){return qc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[d]){if(RegExp("\\b"+c+"\\b").test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:mb(null,function(a,b,c){return qc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.replace(RegExp("^"+c+"\\b\\s*|\\s*\\b"+c+"\\b"),"");if(f==e)return!1;a[d]=f||null}return!0})}),addLineWidget:mb(null,function(a,b,c){var d=c||{};return d.node=b,d.noHScroll&&(this.display.alignWidgets=!0),qc(this,a,function(a){return(a.widgets||(a.widgets=[])).push(d),d.line=a,!0}),d}),removeLineWidget:mb(null,function(a){var b=a.line.widgets,c=td(a.line);if(null!=c){for(var d=0;b.length>d;++d)b[d]==a&&b.splice(d--,1);nb(this,c,c+1)}}),lineInfo:function(a){if("number"==typeof a){if(!gc(this.view.doc,a))return null;var b=a;if(a=rd(this.view.doc,a),!a)return null}else{var b=td(a);if(null==b)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=eb(this,fc(this.view.doc,a));var g=a.top,h=a.left;if(b.style.position="absolute",f.sizer.appendChild(b),"over"==d)g=a.top;else if("near"==d){var i=Math.max(f.wrapper.clientHeight,this.view.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);a.bottom+b.offsetHeight>i&&a.top>b.offsetHeight&&(g=a.top-b.offsetHeight),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+Y(f)+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&nc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},lineCount:function(){return this.view.doc.size},clipPos:function(a){return fc(this.view.doc,a)},getCursor:function(a){var c,b=this.view.sel;return c=null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||a===!1?b.to:b.from,dc(c)},somethingSelected:function(){return!bc(this.view.sel.from,this.view.sel.to)},setCursor:mb(null,function(a,b,c){var d=fc(this.view.doc,"number"==typeof a?{line:a,ch:b||0}:a);c?hc(this,d):ic(this,d,d)}),setSelection:mb(null,function(a,b){var c=this.view.doc;ic(this,fc(c,a),fc(c,b||a))}),extendSelection:mb(null,function(a,b){var c=this.view.doc;hc(this,fc(c,a),b&&fc(c,b))}),setExtending:function(a){this.view.sel.extend=a},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},getLineHandle:function(a){var b=this.view.doc;return gc(b,a)?rd(b,a):void 0},getLineNumber:function(a){return td(a)},setLine:mb(null,function(a,b){gc(this.view.doc,a)&&ac(this,b,{line:a,ch:0},{line:a,ch:rd(this.view.doc,a).text.length})}),removeLine:mb(null,function(a){gc(this.view.doc,a)&&ac(this,"",{line:a,ch:0},fc(this.view.doc,{line:a+1,ch:0}))}),replaceRange:mb(null,function(a,b,c){var d=this.view.doc;return b=fc(d,b),c=c?fc(d,c):b,ac(this,a,b,c)}),getRange:function(a,b,c){var d=this.view.doc;a=fc(d,a),b=fc(d,b);var e=a.line,f=b.line;if(e==f)return rd(d,e).text.slice(a.ch,b.ch);var g=[rd(d,e).text.slice(a.ch)];return d.iter(e+1,f,function(a){g.push(a.text) }),g.push(rd(d,f).text.slice(0,b.ch)),g.join(c||"\n")},triggerOnKeyDown:mb(null,Sb),execCommand:function(a){return Ec[a](this)},moveH:mb(null,function(a,b){var c=this.view.sel,d=0>a?c.from:c.to;(c.shift||c.extend||bc(c.from,c.to))&&(d=rc(this,a,b,!0)),hc(this,d,d,a)}),deleteH:mb(null,function(a,b){var c=this.view.sel;bc(c.from,c.to)?ac(this,"",c.from,rc(this,a,b,!1),"delete"):ac(this,"",c.from,c.to,"delete"),this.curOp.userSelChange=!0}),moveV:mb(null,function(a,b){var i,c=this.view,d=c.doc,e=this.display,f=c.sel.head,g=eb(this,f,"div"),h=g.left;if(null!=c.goalColumn&&(h=c.goalColumn),"page"==b){var j=Math.min(e.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=g.top+a*j}else"line"==b&&(i=a>0?g.bottom+3:g.top-3);do{var k=fb(this,h,i);i+=5*a}while(k.outside&&(0>a?i>0:d.height>i));"page"==b&&(e.scrollbarV.scrollTop+=db(this,k,"div").top-g.top),hc(this,k,k,a),c.goalColumn=h}),toggleOverwrite:function(){(this.view.overwrite=!this.view.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite","")},posFromIndex:function(a){var c,b=0,d=this.view.doc;return d.iter(0,d.size,function(d){var e=d.text.length+1;return e>a?(c=a,!0):(a-=e,++b,void 0)}),fc(d,{line:b,ch:c})},indexFromPos:function(a){if(0>a.line||0>a.ch)return 0;var b=a.ch;return this.view.doc.iter(0,a.line,function(a){b+=a.text.length+1}),b},scrollTo:function(a,b){null!=a&&(this.display.scrollbarH.scrollLeft=this.display.scroller.scrollLeft=a),null!=b&&(this.display.scrollbarV.scrollTop=this.display.scroller.scrollTop=b),K(this,[])},getScrollInfo:function(){var a=this.display.scroller,b=Md;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:function(a){"number"==typeof a&&(a={line:a,ch:0}),a=a?fc(this.view.doc,a):this.view.sel.head,mc(this,a)},setSize:function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(a+"")?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a)),null!=b&&(this.display.wrapper.style.height=c(b)),this.refresh()},on:function(a,b){Hd(this,a,b)},off:function(a,b){Id(this,a,b)},operation:function(a){return mb(this,a)()},refresh:function(){bb(this),this.display.scroller.scrollHeight>this.view.scrollTop&&(this.display.scrollbarV.scrollTop=this.display.scroller.scrollTop=this.view.scrollTop),K(this,!0)},getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};var uc=s.optionHandlers={},vc=s.defaults={},xc=s.Init={toString:function(){return"CodeMirror.Init"}};wc("value","",function(a,b){a.setValue(b)},!0),wc("mode",null,v,!0),wc("indentUnit",2,v,!0),wc("indentWithTabs",!1),wc("smartIndent",!0),wc("tabSize",4,function(a){v(a),bb(a),K(a,!0)},!0),wc("electricChars",!0),wc("theme","default",function(a){y(a),z(a)},!0),wc("keyMap","default",x),wc("extraKeys",null),wc("onKeyEvent",null),wc("onDragEvent",null),wc("lineWrapping",!1,w,!0),wc("gutters",[],function(a){D(a.options),z(a)},!0),wc("lineNumbers",!1,function(a){D(a.options),z(a)},!0),wc("firstLineNumber",1,z,!0),wc("lineNumberFormatter",function(a){return a},z,!0),wc("showCursorWhenSelecting",!1,Q,!0),wc("readOnly",!1,function(a,b){"nocursor"==b?(Vb(a),a.display.input.blur()):b||rb(a,!0)}),wc("dragDrop",!0),wc("cursorBlinkRate",530),wc("cursorHeight",1),wc("workTime",100),wc("workDelay",100),wc("flattenSpans",!0),wc("pollInterval",100),wc("undoDepth",40),wc("viewportMargin",10,function(a){a.refresh()},!0),wc("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),wc("autofocus",null);var yc=s.modes={},zc=s.mimeModes={};s.defineMode=function(a,b){if(s.defaults.mode||"null"==a||(s.defaults.mode=a),arguments.length>2){b.dependencies=[];for(var c=2;arguments.length>c;++c)b.dependencies.push(arguments[c])}yc[a]=b},s.defineMIME=function(a,b){zc[a]=b},s.resolveMode=function(a){if("string"==typeof a&&zc.hasOwnProperty(a))a=zc[a];else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return s.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}},s.getMode=function(a,b){var b=s.resolveMode(b),c=yc[b.name];if(!c)return s.getMode(a,"text/plain");var d=c(a,b);if(Ac.hasOwnProperty(b.name)){var e=Ac[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}return d.name=b.name,d},s.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),s.defineMIME("text/plain","null");var Ac=s.modeExtensions={};s.extendMode=function(a,b){var c=Ac.hasOwnProperty(a)?Ac[a]:Ac[a]={};for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d])},s.defineExtension=function(a,b){s.prototype[a]=b},s.defineOption=wc;var Bc=[];s.defineInitHook=function(a){Bc.push(a)},s.copyState=Cc,s.startState=Dc,s.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);b=c.state,a=c.mode}return c||{mode:a,state:b}};var Ec=s.commands={selectAll:function(a){a.setSelection({line:0,ch:0},{line:a.lineCount()-1})},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),d=!bc(b,c);d||a.getLine(b.line).length!=b.ch?a.replaceRange("",b,d?c:{line:b.line},"delete"):a.replaceRange("",b,{line:b.line+1,ch:0},"delete")},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",{line:b,ch:0},{line:b},"delete")},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.extendSelection({line:0,ch:0})},goDocEnd:function(a){a.extendSelection({line:a.lineCount()-1})},goLineStart:function(a){a.extendSelection(se(a,a.getCursor().line))},goLineStartSmart:function(a){var b=a.getCursor(),c=se(a,b.line),d=a.getLineHandle(c.line),e=wd(d);if(e&&0!=e[0].level)a.extendSelection(c);else{var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&f>=b.ch&&b.ch;a.extendSelection({line:c.line,ch:g?0:f})}},goLineEnd:function(a){a.extendSelection(te(a,a.getCursor().line))},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection(" ","end","input")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.replaceSelection(" ","end","input")},transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);b.ch>0&&b.ch=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.posb},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},backUp:function(a){this.pos-=a},column:function(){return Pd(this.string,this.start,this.tabSize)},indentation:function(){return Pd(this.string,null,this.tabSize)},match:function(a,b,c){if("string"!=typeof a){var e=this.string.slice(this.pos).match(a);return e&&e.index>0?null:(e&&b!==!1&&(this.pos+=e[0].length),e)}var d=function(a){return c?a.toLowerCase():a};return d(this.string).indexOf(d(a),this.pos)==this.pos?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},s.StringStream=Jc,Kc.prototype.clear=function(){if(!this.explicitlyCleared){kb(this.cm);for(var a=null,b=null,c=0;this.lines.length>c;++c){var d=this.lines[c],e=Mc(d.markedSpans,this);null!=e.to&&(b=td(d)),d.markedSpans=Nc(d.markedSpans,e),null!=e.from?a=td(d):this.collapsed&&!Xc(d)&&sd(d,ib(this.cm.display))}null!=a&&nb(this.cm,a,b+1),this.lines.length=0,this.explicitlyCleared=!0,this.collapsed&&this.cm.view.cantEdit&&(this.cm.view.cantEdit=!1,jc(this.cm)),lb(this.cm),Kd(this.cm,this,"clear")}},Kc.prototype.find=function(){for(var a,b,c=0;this.lines.length>c;++c){var d=this.lines[c],e=Mc(d.markedSpans,this);if(null!=e.from||null!=e.to){var f=td(d);null!=e.from&&(a={line:f,ch:e.from}),null!=e.to&&(b={line:f,ch:e.to})}}return"bookmark"==this.type?a:a&&{from:a,to:b}},window.lineIsHidden=Xc;var hd={},kd=/[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g;pd.prototype={chunkSize:function(){return this.lines.length},remove:function(a,b,c){for(var d=a,e=a+b;e>d;++d){var f=this.lines[d];this.height-=f.height,ed(f),Kd(c,f,"delete")}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertHeight:function(a,b,c){this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0,e=b.length;e>d;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;d>a;++a)if(c(this.lines[a]))return!0}},qd.prototype={chunkSize:function(){return this.size},remove:function(a,b,c){this.size-=b;for(var d=0;this.children.length>d;++d){var e=this.children[d],f=e.chunkSize();if(f>a){var g=Math.min(b,f-a),h=e.height;if(e.remove(a,g,c),this.height-=h-e.height,f==g&&(this.children.splice(d--,1),e.parent=null),0==(b-=g))break;a=0}else a-=f}if(25>this.size-b){var i=[];this.collapse(i),this.children=[new pd(i)],this.children[0].parent=this}},collapse:function(a){for(var b=0,c=this.children.length;c>b;++b)this.children[b].collapse(a)},insert:function(a,b){for(var c=0,d=0,e=b.length;e>d;++d)c+=b[d].height;this.insertHeight(a,b,c)},insertHeight:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();if(g>=a){if(f.insertHeight(a,b,c),f.lines&&f.lines.length>50){for(;f.lines.length>50;){var h=f.lines.splice(f.lines.length-25,25),i=new pd(h);f.height-=i.height,this.children.splice(d+1,0,i),i.parent=this}this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new qd(b);if(a.parent){a.size-=c.size,a.height-=c.height;var e=Ud(a.parent.children,a);a.parent.children.splice(e+1,0,c)}else{var d=new qd(a.children);d.parent=a,a.children=[d,c],a=d}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iter:function(a,b,c){this.iterN(a,b-a,c)},iterN:function(a,b,c){for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();if(g>a){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if(0==(b-=h))break;a=0}else a-=g}}},s.e_stop=Dd,s.e_preventDefault=Bd,s.e_stopPropagation=Cd,s.on=Hd,s.off=Id,s.signal=Jd;var Md=30,Nd=s.Pass={toString:function(){return"CodeMirror.Pass"}};Od.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}},s.countColumn=Pd;var Qd=[""],Xd=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc]/,$d=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F]/,de=function(){if(d)return!1;var a=_d("div");return"draggable"in a||"dragDrop"in a}(),ee=/^$/;a?ee=/$'/:i?ee=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:g&&(ee=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/);var fe,he,je=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;d>=b;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)};s.splitLines=je;var ke=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},le=function(){var a=_d("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),me={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:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};s.keyNames=me,function(){for(var a=0;10>a;a++)me[a+48]=a+"";for(var a=65;90>=a;a++)me[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)me[a+111]=me[a+63235]="F"+a}();var we=function(){function c(c){return 255>=c?a.charAt(c):c>=1424&&1524>=c?"R":c>=1536&&1791>=c?b.charAt(c-1536):c>=1792&&2220>=c?"r":"L"}var a="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",b="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/;return function(a){if(!d.test(a))return!1;for(var l,b=a.length,i=[],j=null,k=0;b>k;++k)i.push(l=c(a.charCodeAt(k))),null==j&&("L"==l?j="L":("R"==l||"r"==l)&&(j="R"));null==j&&(j="L");for(var k=0,m=j;b>k;++k){var l=i[k];"m"==l?i[k]=m:m=l}for(var k=0,n=j;b>k;++k){var l=i[k];"1"==l&&"r"==n?i[k]="n":f.test(l)&&(n=l,"r"==l&&(i[k]="R"))}for(var k=1,m=i[0];b-1>k;++k){var l=i[k];"+"==l&&"1"==m&&"1"==i[k+1]?i[k]="1":","!=l||m!=i[k+1]||"1"!=m&&"n"!=m||(i[k]=m),m=l}for(var k=0;b>k;++k){var l=i[k];if(","==l)i[k]="N";else if("%"==l){for(var o=k+1;b>o&&"%"==i[o];++o);for(var p=k&&"!"==i[k-1]||b-1>o&&"1"==i[o]?"1":"N",q=k;o>q;++q)i[q]=p;k=o-1}}for(var k=0,n=j;b>k;++k){var l=i[k];"L"==n&&"1"==l?i[k]="L":f.test(l)&&(n=l)}for(var k=0;b>k;++k)if(e.test(i[k])){for(var o=k+1;b>o&&e.test(i[o]);++o);for(var r="L"==(k?i[k-1]:j),s="L"==(b-1>o?i[o]:j),p=r||s?"L":"R",q=k;o>q;++q)i[q]=p;k=o-1}for(var u,t=[],k=0;b>k;)if(g.test(i[k])){var v=k;for(++k;b>k&&g.test(i[k]);++k);t.push({from:v,to:k,level:0})}else{var w=k,x=t.length;for(++k;b>k&&"L"!=i[k];++k);for(var q=w;k>q;)if(h.test(i[q])){q>w&&t.splice(x,0,{from:w,to:q,level:1});var y=q;for(++q;k>q&&h.test(i[q]);++q);t.splice(x,0,{from:y,to:q,level:2}),w=q}else++q;k>w&&t.splice(x,0,{from:w,to:k,level:1})}return 1==t[0].level&&(u=a.match(/^\s+/))&&(t[0].from=u[0].length,t.unshift({from:0,to:u[0].length,level:0})),1==Sd(t).level&&(u=a.match(/\s+$/))&&(Sd(t).to-=u[0].length,t.push({from:b-u[0].length,to:b,level:0})),t[0].level!=Sd(t).level&&t.push({from:b,to:b,level:t[0].level}),t}}();return s.version="3.0",s}(),CodeMirror.defineMode("clike",function(a,b){function m(a,b){var c=a.next();if(i[c]){var d=i[c](a,b);if(d!==!1)return d}if('"'==c||"'"==c)return b.tokenize=n(c),b.tokenize(a,b);if(/[\[\]{}\(\),;\:\.]/.test(c))return l=c,null;if(/\d/.test(c))return a.eatWhile(/[\w\.]/),"number";if("/"==c){if(a.eat("*"))return b.tokenize=o,o(a,b);if(a.eat("/"))return a.skipToEnd(),"comment"}if(k.test(c))return a.eatWhile(k),"operator";a.eatWhile(/[\w\$_]/);var j=a.current();return e.propertyIsEnumerable(j)?(g.propertyIsEnumerable(j)&&(l="newstatement"),"keyword"):f.propertyIsEnumerable(j)?(g.propertyIsEnumerable(j)&&(l="newstatement"),"builtin"):h.propertyIsEnumerable(j)?"atom":"variable"}function n(a){return function(b,c){for(var e,d=!1,f=!1;null!=(e=b.next());){if(e==a&&!d){f=!0;break}d=!d&&"\\"==e}return(f||!d&&!j)&&(c.tokenize=null),"string"}}function o(a,b){for(var d,c=!1;d=a.next();){if("/"==d&&c){b.tokenize=null;break}c="*"==d}return"comment"}function p(a,b,c,d,e){this.indented=a,this.column=b,this.type=c,this.align=d,this.prev=e}function q(a,b,c){var d=a.indented;return a.context&&"statement"==a.context.type&&(d=a.context.indented),a.context=new p(d,b,c,null,a.context)}function r(a){var b=a.context.type;return(")"==b||"]"==b||"}"==b)&&(a.indented=a.context.indented),a.context=a.context.prev}var l,c=a.indentUnit,d=b.statementIndentUnit||c,e=b.keywords||{},f=b.builtin||{},g=b.blockKeywords||{},h=b.atoms||{},i=b.hooks||{},j=b.multiLineStrings,k=/[+\-*&%=<>!?|\/]/;return{startState:function(a){return{tokenize:null,context:new p((a||0)-c,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,b){var c=b.context;if(a.sol()&&(null==c.align&&(c.align=!1),b.indented=a.indentation(),b.startOfLine=!0),a.eatSpace())return null;l=null;var d=(b.tokenize||m)(a,b);if("comment"==d||"meta"==d)return d;if(null==c.align&&(c.align=!0),";"!=l&&":"!=l&&","!=l||"statement"!=c.type)if("{"==l)q(b,a.column(),"}");else if("["==l)q(b,a.column(),"]");else if("("==l)q(b,a.column(),")");else if("}"==l){for(;"statement"==c.type;)c=r(b);for("}"==c.type&&(c=r(b));"statement"==c.type;)c=r(b)}else l==c.type?r(b):(("}"==c.type||"top"==c.type)&&";"!=l||"statement"==c.type&&"newstatement"==l)&&q(b,a.column(),"statement");else r(b);return b.startOfLine=!1,d},indent:function(a,b){if(a.tokenize!=m&&null!=a.tokenize)return CodeMirror.Pass;var e=a.context,f=b&&b.charAt(0);"statement"==e.type&&"}"==f&&(e=e.prev);var g=f==e.type;return"statement"==e.type?e.indented+("{"==f?0:d):e.align?e.column+(g?0:1):e.indented+(g?0:c)},electricChars:"{}"}}),function(){function a(a){for(var b={},c=a.split(" "),d=0;c.length>d;++d)b[c[d]]=!0;return b}function c(a,b){if(!b.startOfLine)return!1;for(;;){if(!a.skipTo("\\")){a.skipToEnd(),b.tokenize=null;break}if(a.next(),a.eol()){b.tokenize=c;break}}return"meta"}function d(a,b){for(var c;null!=(c=a.next());)if('"'==c&&!a.eat('"')){b.tokenize=null;break}return"string"}function e(a,b){for(var c=0;a.length>c;++c)CodeMirror.defineMIME(a[c],b)}var b="auto if break int case long char register continue return default short do sizeof double static else struct entry switch extern typedef float union for unsigned goto while enum void const signed volatile";e(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:a(b),blockKeywords:a("case do else for if switch while struct"),atoms:a("null"),hooks:{"#":c}}),e(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:a(b+" asm dynamic_cast namespace reinterpret_cast try bool explicit new "+"static_cast typeid catch operator template typename class friend private "+"this using const_cast inline public throw virtual delete mutable protected "+"wchar_t"),blockKeywords:a("catch class do else finally for if struct switch try while"),atoms:a("true false null"),hooks:{"#":c}}),CodeMirror.defineMIME("text/x-java",{name:"clike",keywords:a("abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while"),blockKeywords:a("catch class do else finally for if switch try while"),atoms:a("true false null"),hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"}}}),CodeMirror.defineMIME("text/x-csharp",{name:"clike",keywords:a("abstract as base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),blockKeywords:a("catch class do else finally for foreach if struct switch try while"),builtin:a("Boolean Byte Char DateTime DateTimeOffset Decimal Double Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),atoms:a("true false null"),hooks:{"@":function(a,b){return a.eat('"')?(b.tokenize=d,d(a,b)):(a.eatWhile(/[\w\$_]/),"meta")}}}),CodeMirror.defineMIME("text/x-scala",{name:"clike",keywords:a("abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try trye type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),blockKeywords:a("catch class do else finally for forSome if match switch try while"),atoms:a("true false null"),hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"}}})}(),CodeMirror.defineMode("clojure",function(){function i(a){for(var b={},c=a.split(" "),d=0;c.length>d;++d)b[c[d]]=!0;return b}function o(a,b,c){this.indent=a,this.type=b,this.prev=c}function p(a,b,c){a.indentStack=new o(b,c,a.indentStack)}function q(a){a.indentStack=a.indentStack.prev}function r(a,b){return"0"===a&&b.eat(/x/i)?(b.eatWhile(n.hex),!0):("+"!=a&&"-"!=a||!n.digit.test(b.peek())||(b.eat(n.sign),a=b.next()),n.digit.test(a)?(b.eat(a),b.eatWhile(n.digit),"."==b.peek()&&(b.eat("."),b.eatWhile(n.digit)),b.eat(n.exponent)&&(b.eat(n.sign),b.eatWhile(n.digit)),!0):!1)}var a="builtin",b="comment",c="string",d="atom",e="number",f="bracket",g="keyword",h=2,j=i("true false nil"),k=i("defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle"),l=i("* *1 *2 *3 *agent* *allow-unresolved-vars* *assert *clojure-version* *command-line-args* *compile-files* *compile-path* *e *err* *file* *flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *use-context-classloader* *warn-on-reflection* + - / < <= = == > >= accessor aclone agent agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* butlast byte byte-array bytes case cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec decimal? declare definline defmacro defmethod defmulti defn defn- defonce defstruct delay delay? deliver deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall doc dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq eval even? every? extend extend-protocol extend-type extends? extenders false? ffirst file-seq filter find find-doc find-ns find-var first float float-array float? floats flush fn fn? fnext for force format future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator hash hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map? mapcat max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod name namespace neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? or parents partial partition pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-doc print-dup print-method print-namespace-doc print-simple print-special-doc print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string reify reduce ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure release-pending-sends rem remove remove-method remove-ns repeat repeatedly replace replicate require reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-validator! set? short short-array shorts shutdown-agents slurp some sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-form-anchor special-symbol? split-at split-with str stream? string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync syntax-symbol-anchor take take-last take-nth take-while test the-ns time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-dec unchecked-divide unchecked-inc unchecked-multiply unchecked-negate unchecked-remainder unchecked-subtract underive unquote unquote-splicing update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision xml-seq"),m=i("ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch let letfn binding loop for doseq dotimes when-let if-let defstruct struct-map assoc testing deftest handler-case handle dotrace deftrace"),n={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,keyword_char:/[^\s\(\[\;\)\]]/,basic:/[\w\$_\-]/,lang_keyword:/[\w*+!\-_?:\/]/};return{startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(i,o){if(null==o.indentStack&&i.sol()&&(o.indentation=i.indentation()),i.eatSpace())return null;var s=null;switch(o.mode){case"string":for(var t,u=!1;null!=(t=i.next());){if('"'==t&&!u){o.mode=!1;break}u=!u&&"\\"==t diff --git a/media/js/src/account.js b/media/js/src/account.js index 96153e2..edaa5e5 100644 --- a/media/js/src/account.js +++ b/media/js/src/account.js @@ -13,19 +13,19 @@ // Routes. $routeProvider.when('/account/', { - templateUrl: '/media/js/src/modules/partials/profile.html', + templateUrl: '/static/js/src/modules/partials/profile.html', controller: controllers.ProfileController }); $routeProvider.when('/account/billing/', { - templateUrl: '/media/js/src/modules/partials/billing.html', + templateUrl: '/static/js/src/modules/partials/billing.html', controller: controllers.BillingController }); $routeProvider.when('/account/blogging/', { - templateUrl: '/media/js/src/modules/partials/blogging.html', + templateUrl: '/static/js/src/modules/partials/blogging.html', controller: controllers.BloggingController }); $routeProvider.when('/account/editor/', { - templateUrl: '/media/js/src/modules/partials/editor.html', + templateUrl: '/static/js/src/modules/partials/editor.html', controller: controllers.EditorController }); diff --git a/media/js/src/account.min.js b/media/js/src/account.min.js index e8a8d73..c394bc8 100644 --- a/media/js/src/account.min.js +++ b/media/js/src/account.min.js @@ -1,3 +1,3 @@ -(function(){if(typeof angular!=='undefined'){var root=this;var $=root.jQuery;var controllers={};var app=angular.module('Account',[],function($routeProvider,$locationProvider){$locationProvider.html5Mode(true);$routeProvider.when('/account/',{templateUrl:'/media/js/src/modules/partials/profile.html',controller:controllers.ProfileController});$routeProvider.when('/account/billing/',{templateUrl:'/media/js/src/modules/partials/billing.html',controller:controllers.BillingController});$routeProvider.when('/account/blogging/',{templateUrl:'/media/js/src/modules/partials/blogging.html',controller:controllers.BloggingController});$routeProvider.when('/account/editor/',{templateUrl:'/media/js/src/modules/partials/editor.html',controller:controllers.EditorController});$routeProvider.otherwise({'redirectTo':function(routeParams,locationPath){window.location=locationPath;}});});app.config(function($interpolateProvider){$interpolateProvider.startSymbol('[[');$interpolateProvider.endSymbol(']]');});app.factory('AccountStorage',function($http){return{getAccount:function(){var promise=$http({method:'GET',url:'/api/private/profile/'+window.user_profile_id+'/',headers:{'Authorization':'ApiKey '+window.user+':'+window.api_key}});return promise;},saveAccount:function(user,fields){var promise=$http({method:'PUT',url:'/api/private/profile/'+window.user_profile_id+'/',headers:{'Authorization':'ApiKey '+window.user+':'+window.api_key},data:function(){var userData={};for(var i=0;i