From a9b4fb30a3044883239261276205ac1227e38156 Mon Sep 17 00:00:00 2001
From: Bruno Bord
Date: Mon, 5 Dec 2016 22:11:13 +0100
Subject: [PATCH] HTTPS is minified
---
static/css/style.min.css | 2 +-
static/js/load.min.js | 2 +-
vendor/js/codemirror.min.js | 10 ++++++----
vendor/js/editor.min.js | 2 +-
vendor/js/intro.min.js | 2 +-
vendor/js/marked.min.js | 2 +-
6 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/static/css/style.min.css b/static/css/style.min.css
index 9c2062b..53de265 100644
--- a/static/css/style.min.css
+++ b/static/css/style.min.css
@@ -1 +1 @@
-@font-face{font-family:'Ubuntu Mono';font-style:normal;font-weight:400;src:local('Ubuntu Mono'),local('UbuntuMono-Regular'),url(http://themes.googleusercontent.com/static/fonts/ubuntumono/v4/ViZhet7Ak-LRXZMXzuAfkbrIa-7acMAeDBVuclsi6Gc.woff) format('woff')}@font-face{font-family:'Ubuntu Mono';font-style:normal;font-weight:700;src:local('Ubuntu Mono Bold'),local('UbuntuMono-Bold'),url(http://themes.googleusercontent.com/static/fonts/ubuntumono/v4/ceqTZGKHipo8pJj4molythbnBKKEOwRKgsHDreGcocg.woff) format('woff')}@font-face{font-family:'Ubuntu Mono';font-style:italic;font-weight:400;src:local('Ubuntu Mono Italic'),local('UbuntuMono-Italic'),url(http://themes.googleusercontent.com/static/fonts/ubuntumono/v4/KAKuHXAHZOeECOWAHsRKA4o3ZslTYfJv0R05CazkwN8.woff) format('woff')}@font-face{font-family:'Ubuntu Mono';font-style:italic;font-weight:700;src:local('Ubuntu Mono Bold Italic'),local('UbuntuMono-BoldItalic'),url(http://themes.googleusercontent.com/static/fonts/ubuntumono/v4/n_d8tv_JOIiYyMXR4eaV9SHgNb6vKVPdRA9LSAKGxzw.woff) format('woff')}@font-face{font-family:'Lato';font-style:normal;font-weight:400;src:local('Lato Regular'),local('Lato-Regular'),url(http://themes.googleusercontent.com/static/fonts/lato/v7/qIIYRU-oROkIk8vfvxw6QvesZW2xOQ-xsNqO47m55DA.woff) format('woff')}@font-face{font-family:'Lato';font-style:normal;font-weight:700;src:local('Lato Bold'),local('Lato-Bold'),url(http://themes.googleusercontent.com/static/fonts/lato/v7/qdgUG4U09HnJwhYI-uK18wLUuEpTyoUstqEm5AMlJo4.woff) format('woff')}@font-face{font-family:'Lato';font-style:italic;font-weight:400;src:local('Lato Italic'),local('Lato-Italic'),url(http://themes.googleusercontent.com/static/fonts/lato/v7/RYyZNoeFgb0l7W3Vu1aSWOvvDin1pK8aKteLpeZ5c0A.woff) format('woff')}@font-face{font-family:'Lato';font-style:italic;font-weight:700;src:local('Lato Bold Italic'),local('Lato-BoldItalic'),url(http://themes.googleusercontent.com/static/fonts/lato/v7/HkF_qI1x_noxlxhrhMQYELO3LdcAZYWl9Si6vvxL-qU.woff) format('woff')}@font-face{font-family:'Roboto Slab';font-style:normal;font-weight:400;src:local('Roboto Slab Regular'),local('RobotoSlab-Regular'),url(http://themes.googleusercontent.com/static/fonts/robotoslab/v3/y7lebkjgREBJK96VQi37ZrrIa-7acMAeDBVuclsi6Gc.woff) format('woff')}@font-face{font-family:'Roboto Slab';font-style:normal;font-weight:700;src:local('Roboto Slab Bold'),local('RobotoSlab-Bold'),url(http://themes.googleusercontent.com/static/fonts/robotoslab/v3/dazS1PrQQuCxC3iOAJFEJRbnBKKEOwRKgsHDreGcocg.woff) format('woff')}.wrapper{max-width:1024px;margin:auto}.editor-wrapper{max-width:700px;margin:auto}.title-container h1{text-align:left}.CodeMirror{height:550px !important}.sidebar{padding-left:.33em}body{background:#f8ecc2;font-family:'Roboto Slab'}.editor-wrapper{font-family:'Ubuntu Mono' !important}.editor-preview{font-family:'Lato' !important}.sidebar{border-left:1px solid rgba(41,41,41,.3);font-size:.82em}.sidebar a{text-decoration:none;color:#292929}.sidebar a:hover{color:#466482}.sidebar a.playing{color:#6e2828}.notes a{text-decoration:underline}
\ No newline at end of file
+@font-face{font-family:'Ubuntu Mono';font-style:normal;font-weight:400;src:local('Ubuntu Mono'),local('UbuntuMono-Regular'),url(https://themes.googleusercontent.com/static/fonts/ubuntumono/v4/ViZhet7Ak-LRXZMXzuAfkbrIa-7acMAeDBVuclsi6Gc.woff) format('woff')}@font-face{font-family:'Ubuntu Mono';font-style:normal;font-weight:700;src:local('Ubuntu Mono Bold'),local('UbuntuMono-Bold'),url(https://themes.googleusercontent.com/static/fonts/ubuntumono/v4/ceqTZGKHipo8pJj4molythbnBKKEOwRKgsHDreGcocg.woff) format('woff')}@font-face{font-family:'Ubuntu Mono';font-style:italic;font-weight:400;src:local('Ubuntu Mono Italic'),local('UbuntuMono-Italic'),url(https://themes.googleusercontent.com/static/fonts/ubuntumono/v4/KAKuHXAHZOeECOWAHsRKA4o3ZslTYfJv0R05CazkwN8.woff) format('woff')}@font-face{font-family:'Ubuntu Mono';font-style:italic;font-weight:700;src:local('Ubuntu Mono Bold Italic'),local('UbuntuMono-BoldItalic'),url(https://themes.googleusercontent.com/static/fonts/ubuntumono/v4/n_d8tv_JOIiYyMXR4eaV9SHgNb6vKVPdRA9LSAKGxzw.woff) format('woff')}@font-face{font-family:'Lato';font-style:normal;font-weight:400;src:local('Lato Regular'),local('Lato-Regular'),url(https://themes.googleusercontent.com/static/fonts/lato/v7/qIIYRU-oROkIk8vfvxw6QvesZW2xOQ-xsNqO47m55DA.woff) format('woff')}@font-face{font-family:'Lato';font-style:normal;font-weight:700;src:local('Lato Bold'),local('Lato-Bold'),url(https://themes.googleusercontent.com/static/fonts/lato/v7/qdgUG4U09HnJwhYI-uK18wLUuEpTyoUstqEm5AMlJo4.woff) format('woff')}@font-face{font-family:'Lato';font-style:italic;font-weight:400;src:local('Lato Italic'),local('Lato-Italic'),url(https://themes.googleusercontent.com/static/fonts/lato/v7/RYyZNoeFgb0l7W3Vu1aSWOvvDin1pK8aKteLpeZ5c0A.woff) format('woff')}@font-face{font-family:'Lato';font-style:italic;font-weight:700;src:local('Lato Bold Italic'),local('Lato-BoldItalic'),url(https://themes.googleusercontent.com/static/fonts/lato/v7/HkF_qI1x_noxlxhrhMQYELO3LdcAZYWl9Si6vvxL-qU.woff) format('woff')}@font-face{font-family:'Roboto Slab';font-style:normal;font-weight:400;src:local('Roboto Slab Regular'),local('RobotoSlab-Regular'),url(https://themes.googleusercontent.com/static/fonts/robotoslab/v3/y7lebkjgREBJK96VQi37ZrrIa-7acMAeDBVuclsi6Gc.woff) format('woff')}@font-face{font-family:'Roboto Slab';font-style:normal;font-weight:700;src:local('Roboto Slab Bold'),local('RobotoSlab-Bold'),url(https://themes.googleusercontent.com/static/fonts/robotoslab/v3/dazS1PrQQuCxC3iOAJFEJRbnBKKEOwRKgsHDreGcocg.woff) format('woff')}.wrapper{max-width:1024px;margin:auto}.editor-wrapper{max-width:700px;margin:auto}.title-container h1{text-align:left}.CodeMirror{height:550px !important}.sidebar{padding-left:.33em}body{background:#f8ecc2;font-family:'Roboto Slab'}.editor-wrapper{font-family:'Ubuntu Mono' !important}.editor-preview{font-family:'Lato' !important}.sidebar{border-left:1px solid rgba(41,41,41,.3);font-size:.82em}.sidebar a{text-decoration:none;color:#292929}.sidebar a:hover{color:#466482}.sidebar a.playing{color:#6e2828}.notes a{text-decoration:underline}
\ No newline at end of file
diff --git a/static/js/load.min.js b/static/js/load.min.js
index 67c2f60..9e35f52 100644
--- a/static/js/load.min.js
+++ b/static/js/load.min.js
@@ -1 +1 @@
-$(document).ready(function(){$.getJSON("static/js/sounds.json",function(a){for(var b in a){obj=a[b];var c=$("").attr({href:"#","class":"play","data-mp3":b});c.html(" "+obj.label).addClass(obj.class),obj.data&&c.attr("data-"+obj.class,obj.data),$("#soundlinks").append(c).append("
"),$("body").append('')}$(".player").jPlayer({ready:function(){var b=$(this).attr("id"),c=a[b];$(this).jPlayer("setMedia",{mp3:"./sounds/"+b+".mp3"}),c.volume&&$(this).jPlayer("volume",c.volume/100)},play:function(){console.log("playing "+$(this).attr("id"))},loop:!0,preload:!1,volume:.6}),$(".play").on("click",function(){var a=$(this).data("mp3");$(this).hasClass("playing")?$("#"+a).jPlayer("pause"):$("#"+a).jPlayer("play"),$(this).toggleClass("playing")})})});
\ No newline at end of file
+$(document).ready(function(){$.getJSON("static/js/sounds.json",function(sounds){for(var key in sounds){obj=sounds[key];var link=$("").attr({href:"#","class":"play","data-mp3":key});link.html(" "+obj.label).addClass(obj["class"]),obj.data&&link.attr("data-"+obj["class"],obj.data),$("#soundlinks").append(link).append("
"),$("body").append('')}$(".player").jPlayer({ready:function(){var key=$(this).attr("id"),sound=sounds[key];$(this).jPlayer("setMedia",{mp3:"./sounds/"+key+".mp3"}),sound.volume&&$(this).jPlayer("volume",sound.volume/100)},play:function(){console.log("playing "+$(this).attr("id"))},loop:!0,preload:!1,volume:.6}),$(".play").on("click",function(){var player=$(this).data("mp3");$("#"+player).jPlayer($(this).hasClass("playing")?"pause":"play"),$(this).toggleClass("playing")})})});
\ No newline at end of file
diff --git a/vendor/js/codemirror.min.js b/vendor/js/codemirror.min.js
index 6006271..25657df 100644
--- a/vendor/js/codemirror.min.js
+++ b/vendor/js/codemirror.min.js
@@ -1,4 +1,6 @@
-window.CodeMirror=function(){function w(a,c){if(!(this instanceof w))return new w(a,c);this.options=c=c||{};for(var d in Xc)!c.hasOwnProperty(d)&&Xc.hasOwnProperty(d)&&(c[d]=Xc[d]);I(c);var e=typeof c.value=="string"?0:c.value.first,f=this.display=x(a,e);f.wrapper.CodeMirror=this,F(this),c.autofocus&&!o&&Lb(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new Te},D(this),c.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var g=c.value;typeof g=="string"&&(g=new ce(c.value,c.mode)),Db(this,ge)(this,g),b&&setTimeout(bf(Kb,this,!0),20),Nb(this);var h;try{h=document.activeElement==f.input}catch(i){}h||c.autofocus&&!o?setTimeout(bf(ic,this),20):jc(this),Db(this,function(){for(var a in Wc)Wc.propertyIsEnumerable(a)&&Wc[a](this,c[a],Zc);for(var b=0;bb.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function I(a){var b=!1;for(var c=0;cb.scroller.clientWidth+1,g=e>b.scroller.clientHeight+1;g?(b.scrollbarV.style.display="block",b.scrollbarV.style.bottom=f?pf(b.measure)+"px":"0",b.scrollbarV.firstChild.style.height=e-b.scroller.clientHeight+b.scrollbarV.clientHeight+"px"):b.scrollbarV.style.display="",f?(b.scrollbarH.style.display="block",b.scrollbarH.style.right=g?pf(b.measure)+"px":"0",b.scrollbarH.firstChild.style.width=b.scroller.scrollWidth-b.scroller.clientWidth+b.scrollbarH.clientWidth+"px"):b.scrollbarH.style.display="",f&&g?(b.scrollbarFiller.style.display="block",b.scrollbarFiller.style.height=b.scrollbarFiller.style.width=pf(b.measure)+"px"):b.scrollbarFiller.style.display="",f&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(b.gutterFiller.style.display="block",b.gutterFiller.style.height=pf(b.measure)+"px",b.gutterFiller.style.width=b.gutters.offsetWidth+"px"):b.gutterFiller.style.display="",k&&pf(b.measure)===0&&(b.scrollbarV.style.minWidth=b.scrollbarH.style.minHeight=l?"18px":"12px")}function K(a,b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;typeof c=="number"?d=c:c&&(d=c.top,e=c.bottom-c.top),d=Math.floor(d-eb(a));var f=Math.ceil(d+e);return{from:me(b,d),to:me(b,f)}}function L(a){var b=a.display;if(!b.alignWidgets&&(!b.gutters.firstChild||!a.options.fixedGutter))return;var c=O(b)-b.scroller.scrollLeft+a.doc.scrollLeft,d=b.gutters.offsetWidth,e=c+"px";for(var f=b.lineDiv.firstChild;f;f=f.nextSibling)if(f.alignable)for(var g=0,h=f.alignable;g=a.display.showingFrom&&h.to<=a.display.showingTo)break;b=[]}return g&&(Me(a,"update",a),(a.display.showingFrom!=e||a.display.showingTo!=f)&&Me(a,"viewportChange",a,a.display.showingFrom,a.display.showingTo)),g}function Q(a,b,c,d){var e=a.display,f=a.doc;if(!e.wrapper.clientWidth){e.showingFrom=e.showingTo=f.first,e.viewOffset=0;return}if(!d&&b.length==0&&c.from>e.showingFrom&&c.tol&&e.showingTo-l<20&&(l=Math.min(j,e.showingTo));if(v){k=le(Bd(f,he(f,k)));while(l=m[0].to?m=[]:m=T(m,b);if(v)for(var i=0;in.from)){m.splice(i--,1);break}n.to=p}}var q=0;for(var i=0;il&&(n.to=l),n.from>=n.to?m.splice(i--,1):q+=n.to-n.from}if(!d&&q==l-k&&k==e.showingFrom&&l==e.showingTo){S(a);return}m.sort(function(a,b){return a.from-b.from});try{var r=document.activeElement}catch(s){}q<(l-k)*.7&&(e.lineDiv.style.display="none"),V(a,k,l,m,h),e.lineDiv.style.display="",r&&document.activeElement!=r&&r.offsetHeight&&r.focus();var t=k!=e.showingFrom||l!=e.showingTo||e.lastSizeC!=e.wrapper.clientHeight;return t&&(e.lastSizeC=e.wrapper.clientHeight,ab(a,400)),e.showingFrom=k,e.showingTo=l,R(a),S(a),!0}function R(a){var b=a.display,d=b.lineDiv.offsetTop;for(var e=b.lineDiv.firstChild,f;e;e=e.nextSibling)if(e.lineObj){if(c){var g=e.offsetTop+e.offsetHeight;f=g-d,d=g}else{var h=lf(e);f=h.bottom-h.top}var i=e.lineObj.height-f;f<2&&(f=yb(b));if(i>.001||i<-0.001){ke(e.lineObj,f);var j=e.lineObj.widgets;if(j)for(var k=0;k=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from}),e.ton){while(k.lineObj!=b)k=l(k);i&&f<=n&&k.lineNumber&&kf(k.lineNumber,N(a.options,n)),k=k.nextSibling}else{if(b.widgets)for(var q=0,r=k,s;r&&q<20;++q,r=r.nextSibling)if(r.lineObj==b&&/div/i.test(r.nodeName)){s=r;break}var t=W(a,b,n,g,s);if(t!=s)j.insertBefore(t,k);else{while(k!=s)k=l(k);k=k.nextSibling}t.lineObj=b}++n});while(k)k=l(k)}function W(a,b,d,e,f){var g=Td(a,b),h=b.gutterMarkers,i=a.display,j;if(!a.options.lineNumbers&&!h&&!b.bgClass&&!b.wrapClass&&!b.widgets)return g;if(f){f.alignable=null;var k=!0,l=0,m=null;for(var n=f.firstChild,o;n;n=o){o=n.nextSibling;if(!/\bCodeMirror-linewidget\b/.test(n.className))f.removeChild(n);else{for(var p=0;p3&&(h(o,i.top,null,i.bottom),o=g,i.bottoml.bottom||n.bottom==l.bottom&&n.right>l.right)l=n;o=a.display.showingTo)return;var c=+(new Date)+a.options.workTime,d=dd(b.mode,db(a,b.frontier)),e=[],f;b.iter(b.frontier,Math.min(b.first+b.size,a.display.showingTo+500),function(g){if(b.frontier>=a.display.showingFrom){var h=g.styles;g.styles=Od(a,g,d);var i=!h||h.length!=g.styles.length;for(var j=0;!i&&jc)return ab(a,a.options.workDelay),!0}),e.length&&Db(a,function(){for(var a=0;ah;--g){if(g<=f.first)return f.first;var i=he(f,g-1);if(i.stateAfter&&(!c||g<=f.frontier))return g;var j=Ue(i.text,null,a.options.tabSize);if(e==null||d>j)e=g-1,d=j}return e}function db(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=cb(a,b,c),g=f>d.first&&he(d,f-1).stateAfter;return g?g=dd(d.mode,g):g=ed(d.mode),d.iter(f,b,function(c){Qd(a,c,g);var h=f==b-1||f%5==0||f>=e.showingFrom&&fc?"left":gc?h.left:h.right,top:h.top,bottom:h.bottom}}function ib(a,b){var c=a.display.measureLineCache;for(var d=0;ds&&(c=s),b<0&&(b=0);for(var d=q.length-2;d>=0;d-=2){var e=q[d],f=q[d+1];if(e>c||f=c||b<=e&&c>=f||Math.min(c,f)-Math.max(b,e)>=c-b>>1){q[d]=Math.min(b,e),q[d+1]=Math.max(c,f);break}}return d<0&&(d=q.length,q.push(b,c)),{left:a.left-p.left,right:a.right-p.left,top:d,bottom:null}}function u(a){a.bottom=q[a.top+1],a.top=q[a.top]}var f=a.display,g=af(e.text.length),h=Td(a,e,g,!0);if(b&&!c&&!a.options.lineWrapping&&h.childNodes.length>100){var i=document.createDocumentFragment(),j=10,k=h.childNodes.length;for(var l=0,m=Math.ceil(k/j);l1&&(x=r[l]=t(y[0]),x.rightSide=t(y[y.length-1]))}x||(x=r[l]=t(lf(w))),v.measureRight&&(x.right=lf(v.measureRight).left),v.leftSide&&(x.leftSide=t(lf(v.leftSide)))}for(var l=0,v;lc.from?f(a-1):f(a,d)}d=d||he(a.doc,b.line),e||(e=kb(a,d));var h=oe(d),i=b.ch;if(!h)return f(i);var j=Ff(h,i),k=g(i,j);return Ef!=null&&(k.other=g(i,Ef)),k}function ub(a,b,c,d){var e=new xc(a,b);return e.xRel=d,c&&(e.outside=!0),e}function vb(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(c<0)return ub(d.first,0,!0,-1);var e=me(d,c),f=d.first+d.size-1;if(e>f)return ub(d.first+d.size-1,he(d,f).text.length,!0,1);b<0&&(b=0);for(;;){var g=he(d,e),h=wb(a,g,e,b,c),i=Ad(g),j=i&&i.find();if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=j.to.line}}function wb(a,b,c,d,e){function j(d){var e=tb(a,xc(c,d),"line",b,i);return g=!0,f>e.bottom?e.left-h:fq)return ub(c,n,r,1);for(;;){if(k?n==m||n==Hf(b,m,1):n-m<=1){var s=dd){n=w,q=y;if(r=g)q+=1e3;l=v}else m=w,o=y,p=g,l-=v}}function yb(a){if(a.cachedTextHeight!=null)return a.cachedTextHeight;if(xb==null){xb=gf("pre");for(var b=0;b<49;++b)xb.appendChild(document.createTextNode("x")),xb.appendChild(gf("br"));xb.appendChild(document.createTextNode("x"))}jf(a.measure,xb);var c=xb.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),hf(a.measure),c||1}function zb(a){if(a.cachedCharWidth!=null)return a.cachedCharWidth;var b=gf("span","x"),c=gf("pre",[b]);jf(a.measure,c);var d=b.offsetWidth;return d>2&&(a.cachedCharWidth=d),d||10}function Bb(a){a.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Ab},Le++||(Ke=[])}function Cb(a){var b=a.curOp,c=a.doc,d=a.display;a.curOp=null,b.updateMaxLine&&H(a);if(d.maxLineChanged&&!a.options.lineWrapping&&d.maxLine){var e=mb(a,d.maxLine);d.sizer.style.minWidth=Math.max(0,e+3+Re)+"px",d.maxLineChanged=!1;var f=Math.max(0,d.sizer.offsetLeft+d.sizer.offsetWidth-d.scroller.clientWidth);f1e3||h.indexOf("\n")>-1?c.value=a.display.prevInput="":a.display.prevInput=h,i&&Cb(a),a.state.pasteIncoming=!1,!0}function Kb(a,c){var e,f,g=a.doc;if(!yc(g.sel.from,g.sel.to)){a.display.prevInput="",e=uf&&(g.sel.to.line-g.sel.from.line>100||(f=a.getSelection()).length>1e3);var h=e?"-":f||a.getSelection();a.display.input.value=h,a.state.focused&&Ye(a.display.input),b&&!d&&(a.display.inputHasSelection=h)}else c&&(a.display.prevInput=a.display.input.value="",b&&!d&&(a.display.inputHasSelection=null));a.display.inaccurateSelection=e}function Lb(a){a.options.readOnly!="nocursor"&&(!o||document.activeElement!=a.display.input)&&a.display.input.focus()}function Mb(a){return a.options.readOnly||a.doc.cantEdit}function Nb(a){function d(){a.state.focused&&setTimeout(bf(Lb,a),0)}function f(){e==null&&(e=setTimeout(function(){e=null,c.cachedCharWidth=c.cachedTextHeight=of=null,nb(a),Fb(a,bf(Gb,a))},100))}function g(){for(var a=c.wrapper.parentNode;a&&a!=document.body;a=a.parentNode);a?setTimeout(g,5e3):Ie(window,"resize",f)}function h(b){if(Ne(a,b)||a.options.onDragEvent&&a.options.onDragEvent(a,Ae(b)))return;Ee(b)}function i(){c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,c.input.value=a.getSelection(),Ye(c.input))}var c=a.display;He(c.scroller,"mousedown",Db(a,Sb)),b?He(c.scroller,"dblclick",Db(a,function(b){if(Ne(a,b))return;var c=Pb(a,b);if(!c||Tb(a,b)||Ob(a.display,b))return;Be(b);var d=Uc(he(a.doc,c.line).text,c);Fc(a.doc,d.from,d.to)})):He(c.scroller,"dblclick",function(b){Ne(a,b)||Be(b)}),He(c.lineSpace,"selectstart",function(a){Ob(c,a)||Be(a)}),t||He(c.scroller,"contextmenu",function(b){lc(a,b)}),He(c.scroller,"scroll",function(){c.scroller.clientHeight&&(Xb(a,c.scroller.scrollTop),Yb(a,c.scroller.scrollLeft,!0),Je(a,"scroll",a))}),He(c.scrollbarV,"scroll",function(){c.scroller.clientHeight&&Xb(a,c.scrollbarV.scrollTop)}),He(c.scrollbarH,"scroll",function(){c.scroller.clientHeight&&Yb(a,c.scrollbarH.scrollLeft)}),He(c.scroller,"mousewheel",function(b){_b(a,b)}),He(c.scroller,"DOMMouseScroll",function(b){_b(a,b)}),He(c.scrollbarH,"mousedown",d),He(c.scrollbarV,"mousedown",d),He(c.wrapper,"scroll",function(){c.wrapper.scrollTop=c.wrapper.scrollLeft=0});var e;He(window,"resize",f),setTimeout(g,5e3),He(c.input,"keyup",Db(a,function(b){if(Ne(a,b)||a.options.onKeyEvent&&a.options.onKeyEvent(a,Ae(b)))return;b.keyCode==16&&(a.doc.sel.shift=!1)})),He(c.input,"input",bf(Ib,a)),He(c.input,"keydown",Db(a,gc)),He(c.input,"keypress",Db(a,hc)),He(c.input,"focus",bf(ic,a)),He(c.input,"blur",bf(jc,a)),a.options.dragDrop&&(He(c.scroller,"dragstart",function(b){Wb(a,b)}),He(c.scroller,"dragenter",h),He(c.scroller,"dragover",h),He(c.scroller,"drop",Db(a,Vb))),He(c.scroller,"paste",function(b){if(Ob(c,b))return;Lb(a),Ib(a)}),He(c.input,"paste",function(){a.state.pasteIncoming=!0,Ib(a)}),He(c.input,"cut",i),He(c.input,"copy",i),j&&He(c.sizer,"mouseup",function(){document.activeElement==c.input&&c.input.blur(),Lb(a)})}function Ob(a,b){for(var c=Fe(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function Pb(a,b,c){var d=a.display;if(!c){var e=Fe(b);if(e==d.scrollbarH||e==d.scrollbarH.firstChild||e==d.scrollbarV||e==d.scrollbarV.firstChild||e==d.scrollbarFiller||e==d.gutterFiller)return null}var f,g,h=lf(d.lineSpace);try{f=b.clientX,g=b.clientY}catch(b){return null}return vb(a,f-h.left,g-h.top)}function Sb(a){function q(a){if(yc(p,a))return;p=a;if(j=="single"){Fc(c.doc,Cc(f,h),a);return}n=Cc(f,n),o=Cc(f,o);if(j=="double"){var b=Uc(he(f,a.line).text,a);zc(a,n)?Fc(c.doc,b.from,o):Fc(c.doc,n,b.to)}else j=="triple"&&(zc(a,n)?Fc(c.doc,o,Cc(f,xc(a.line,0))):Fc(c.doc,n,Cc(f,xc(a.line+1,0))))}function u(a){var b=++s,e=Pb(c,a,!0);if(!e)return;if(!yc(e,l)){c.state.focused||ic(c),l=e,q(e);var g=K(d,f);(e.line>=g.to||e.liner.bottom?20:0;h&&setTimeout(Db(c,function(){if(s!=b)return;d.scroller.scrollTop+=h,u(a)}),50)}}function v(a){s=Infinity,Be(a),Lb(c),Ie(document,"mousemove",w),Ie(document,"mouseup",x)}if(Ne(this,a))return;var c=this,d=c.display,f=c.doc,g=f.sel;g.shift=a.shiftKey;if(Ob(d,a)){e||(d.scroller.draggable=!1,setTimeout(function(){d.scroller.draggable=!0},100));return}if(Tb(c,a))return;var h=Pb(c,a);switch(Ge(a)){case 3:t&&lc.call(c,c,a);return;case 2:h&&Fc(c.doc,h),setTimeout(bf(Lb,c),20),Be(a);return}if(!h){Fe(a)==d.scroller&&Be(a);return}c.state.focused||ic(c);var i=+(new Date),j="single";if(Rb&&Rb.time>i-400&&yc(Rb.pos,h))j="triple",Be(a),setTimeout(bf(Lb,c),20),Vc(c,h.line);else if(Qb&&Qb.time>i-400&&yc(Qb.pos,h)){j="double",Rb={time:i,pos:h},Be(a);var k=Uc(he(f,h.line).text,h);Fc(c.doc,k.from,k.to)}else Qb={time:i,pos:h};var l=h;if(c.options.dragDrop&&mf&&!Mb(c)&&!yc(g.from,g.to)&&!zc(h,g.from)&&!zc(g.to,h)&&j=="single"){var m=Db(c,function(b){e&&(d.scroller.draggable=!1),c.state.draggingText=!1,Ie(document,"mouseup",m),Ie(d.scroller,"drop",m),Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10&&(Be(b),Fc(c.doc,h),Lb(c))});e&&(d.scroller.draggable=!0),c.state.draggingText=m,d.scroller.dragDrop&&d.scroller.dragDrop(),He(document,"mouseup",m),He(d.scroller,"drop",m);return}Be(a),j=="single"&&Fc(c.doc,Cc(f,h));var n=g.from,o=g.to,p=h,r=lf(d.wrapper),s=0,w=Db(c,function(a){!b&&!Ge(a)?v(a):u(a)}),x=Db(c,v);He(document,"mousemove",w),He(document,"mouseup",x)}function Tb(a,b){var c=a.display;try{var d=b.clientX,e=b.clientY}catch(b){return!1}if(d>=Math.floor(lf(c.gutters).right))return!1
-;Be(b);if(!Pe(a,"gutterClick"))return!0;var f=lf(c.lineDiv);if(e>f.bottom)return!0;e-=f.top-c.viewOffset;for(var g=0;g=d){var i=me(a.doc,e),j=a.options.gutters[g];Me(a,"gutterClick",a,i,j,b);break}}return!0}function Vb(a){var c=this;if(Ne(c,a)||Ob(c.display,a)||c.options.onDragEvent&&c.options.onDragEvent(c,Ae(a)))return;Be(a),b&&(Ub=+(new Date));var d=Pb(c,a,!0),e=a.dataTransfer.files;if(!d||Mb(c))return;if(e&&e.length&&window.FileReader&&window.File){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=Cc(c.doc,d),qc(c.doc,{from:d,to:d,text:sf(g.join("\n")),origin:"paste"},"around"))},e.readAsText(a)};for(var j=0;ji.clientWidth||f&&i.scrollHeight>i.clientHeight))return;if(f&&p&&e)for(var j=c.target;j!=i;j=j.parentNode)if(j.lineObj){b.display.currentWheelTarget=j;break}if(d&&!a&&!h&&$b!=null){f&&Xb(b,Math.max(0,Math.min(i.scrollTop+f*$b,i.scrollHeight-i.clientHeight))),Yb(b,Math.max(0,Math.min(i.scrollLeft+d*$b,i.scrollWidth-i.clientWidth))),Be(c),g.wheelStartX=null;return}if(f&&$b!=null){var k=f*$b,l=b.doc.scrollTop,m=l+g.wrapper.clientHeight;k<0?l=Math.max(0,l+k-50):m=Math.min(b.doc.height,m+k+50),P(b,[],{top:l,bottom:m})}Zb<20&&(g.wheelStartX==null?(g.wheelStartX=i.scrollLeft,g.wheelStartY=i.scrollTop,g.wheelDX=d,g.wheelDY=f,setTimeout(function(){if(g.wheelStartX==null)return;var a=i.scrollLeft-g.wheelStartX,b=i.scrollTop-g.wheelStartY,c=b&&g.wheelDY&&b/g.wheelDY||a&&g.wheelDX&&a/g.wheelDX;g.wheelStartX=g.wheelStartY=null;if(!c)return;$b=($b*Zb+c)/(Zb+1),++Zb},200)):(g.wheelDX+=d,g.wheelDY+=f))}function ac(a,b,c){if(typeof b=="string"){b=fd[b];if(!b)return!1}a.display.pollingFast&&Jb(a)&&(a.display.pollingFast=!1);var d=a.doc,e=d.sel.shift,f=!1;try{Mb(a)&&(a.state.suppressEdits=!0),c&&(d.sel.shift=!1),f=b(a)!=Se}finally{d.sel.shift=e,a.state.suppressEdits=!1}return f}function bc(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function dc(a,b){var c=hd(a.options.keyMap),e=c.auto;clearTimeout(cc),e&&!jd(b)&&(cc=setTimeout(function(){hd(a.options.keyMap)==c&&(a.options.keyMap=e.call?e.call(null,a):e,C(a))},50));var f=kd(b,!0),g=!1;if(!f)return!1;var h=bc(a);return b.shiftKey?g=id("Shift-"+f,h,function(b){return ac(a,b,!0)})||id(f,h,function(b){if(typeof b=="string"?/^go[A-Z]/.test(b):b.motion)return ac(a,b)}):g=id(f,h,function(b){return ac(a,b)}),g&&(Be(b),_(a),d&&(b.oldKeyCode=b.keyCode,b.keyCode=0),Me(a,"keyHandled",a,f,b)),g}function ec(a,b,c){var d=id("'"+c+"'",bc(a),function(b){return ac(a,b,!0)});return d&&(Be(b),_(a),Me(a,"keyHandled",a,"'"+c+"'",b)),d}function gc(a){var c=this;c.state.focused||ic(c),b&&a.keyCode==27&&(a.returnValue=!1);if(Ne(c,a)||c.options.onKeyEvent&&c.options.onKeyEvent(c,Ae(a)))return;var d=a.keyCode;c.doc.sel.shift=d==16||a.shiftKey;var e=dc(c,a);h&&(fc=e?d:null,!e&&d==88&&!uf&&(p?a.metaKey:a.ctrlKey)&&c.replaceSelection(""))}function hc(a){var c=this;if(Ne(c,a)||c.options.onKeyEvent&&c.options.onKeyEvent(c,Ae(a)))return;var e=a.keyCode,f=a.charCode;if(h&&e==fc){fc=null,Be(a);return}if((h&&(!a.which||a.which<10)||j)&&dc(c,a))return;var g=String.fromCharCode(f==null?e:f);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!Mb(this)&&this.doc.mode.electricChars.indexOf(g)>-1&&setTimeout(Db(c,function(){Qc(c,c.doc.sel.to.line,"smart")}),75);if(ec(c,a,g))return;b&&!d&&(c.display.inputHasSelection=null),Ib(c)}function ic(a){if(a.options.readOnly=="nocursor")return;a.state.focused||(Je(a,"focus",a),a.state.focused=!0,a.display.wrapper.className.search(/\bCodeMirror-focused\b/)==-1&&(a.display.wrapper.className+=" CodeMirror-focused"),Kb(a,!0)),Hb(a),_(a)}function jc(a){a.state.focused&&(Je(a,"blur",a),a.state.focused=!1,a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.doc.sel.shift=!1)},150)}function lc(a,c){function k(){if(e.input.selectionStart!=null){var a=e.input.value=" "+(yc(f.from,f.to)?"":e.input.value);e.prevInput=" ",e.input.selectionStart=1,e.input.selectionEnd=a.length}}function l(){e.inputDiv.style.position="relative",e.input.style.cssText=j,d&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=i),Hb(a);if(e.input.selectionStart!=null){(!b||d)&&k(),clearTimeout(kc);var c=0,f=function(){e.prevInput==" "&&e.input.selectionStart==0?Db(a,fd.selectAll)(a):c++<10?kc=setTimeout(f,500):Kb(a)};kc=setTimeout(f,200)}}if(Ne(a,c,"contextmenu"))return;var e=a.display,f=a.doc.sel;if(Ob(e,c))return;var g=Pb(a,c),i=e.scroller.scrollTop;if(!g||h)return;(yc(f.from,f.to)||zc(g,f.from)||!zc(g,f.to))&&Db(a,Hc)(a.doc,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; -ms-opacity: .05; filter: alpha(opacity=5);",Lb(a),Kb(a,!0),yc(f.from,f.to)&&(e.input.value=e.prevInput=" "),b&&!d&&k();if(t){Ee(c);var m=function(){Ie(window,"mouseup",m),setTimeout(l,20)};He(window,"mouseup",m)}else setTimeout(l,50)}function nc(a,b,c){if(!zc(b.from,c))return Cc(a,c);var d=b.text.length-1-(b.to.line-b.from.line);if(c.line>b.to.line+d){var e=c.line-d,f=a.first+a.size-1;return e>f?xc(f,he(a,f).text.length):Dc(c,he(a,e).text.length)}if(c.line==b.to.line+d)return Dc(c,Xe(b.text).length+(b.text.length==1?b.from.ch:0)+he(a,b.to.line).text.length-b.to.ch);var g=c.line-b.from.line;return Dc(c,b.text[g].length+(g?0:b.from.ch))}function oc(a,b,c){if(c&&typeof c=="object")return{anchor:nc(a,b,c.anchor),head:nc(a,b,c.head)};if(c=="start")return{anchor:b.from,head:b.from};var d=mc(b);if(c=="around")return{anchor:b.from,head:d};if(c=="end")return{anchor:d,head:d};var e=function(a){if(zc(a,b.from))return a;if(!zc(b.to,a))return d;var c=a.line+b.text.length-(b.to.line-b.from.line)-1,e=a.ch;return a.line==b.to.line&&(e+=d.ch-b.to.ch),xc(c,e)};return{anchor:e(a.sel.anchor),head:e(a.sel.head)}}function pc(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};return c&&(d.update=function(b,c,d,e){b&&(this.from=Cc(a,b)),c&&(this.to=Cc(a,c)),d&&(this.text=d),e!==undefined&&(this.origin=e)}),Je(a,"beforeChange",a,d),a.cm&&Je(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function qc(a,b,c,d){if(a.cm){if(!a.cm.curOp)return Db(a.cm,qc)(a,b,c,d);if(a.cm.state.suppressEdits)return}if(Pe(a,"beforeChange")||a.cm&&Pe(a.cm,"beforeChange")){b=pc(a,b,!0);if(!b)return}var e=u&&!d&&xd(a,b.from,b.to);if(e){for(var f=e.length-1;f>=1;--f)rc(a,{from:e[f].from,to:e[f].to,text:[""]});e.length&&rc(a,{from:e[0].from,to:e[0].to,text:b.text},c)}else rc(a,b,c)}function rc(a,b,c){var d=oc(a,b,c);se(a,b,d,a.cm?a.cm.curOp.id:NaN),uc(a,b,d,vd(a,b));var e=[];fe(a,function(a,c){!c&&Ze(e,a.history)==-1&&(ye(a.history,b),e.push(a.history)),uc(a,b,null,vd(a,b))})}function sc(a,b){if(a.cm&&a.cm.state.suppressEdits)return;var c=a.history,d=(b=="undo"?c.done:c.undone).pop();if(!d)return;var e={changes:[],anchorBefore:d.anchorAfter,headBefore:d.headAfter,anchorAfter:d.anchorBefore,headAfter:d.headBefore,generation:c.generation};(b=="undo"?c.undone:c.done).push(e),c.generation=d.generation||++c.maxGeneration;var f=Pe(a,"beforeChange")||a.cm&&Pe(a.cm,"beforeChange");for(var g=d.changes.length-1;g>=0;--g){var h=d.changes[g];h.origin=b;if(f&&!pc(a,h,!1)){(b=="undo"?c.done:c.undone).length=0;return}e.changes.push(re(a,h));var i=g?oc(a,h,null):{anchor:d.anchorBefore,head:d.headBefore};uc(a,h,i,wd(a,h));var j=[];fe(a,function(a,b){!b&&Ze(j,a.history)==-1&&(ye(a.history,h),j.push(a.history)),uc(a,h,null,wd(a,h))})}}function tc(a,b){function c(a){return xc(a.line+b,a.ch)}a.first+=b,a.cm&&Gb(a.cm,a.first,a.first,b),a.sel.head=c(a.sel.head),a.sel.anchor=c(a.sel.anchor),a.sel.from=c(a.sel.from),a.sel.to=c(a.sel.to)}function uc(a,b,c,d){if(a.cm&&!a.cm.curOp)return Db(a.cm,uc)(a,b,c,d);if(b.to.linea.lastLine())return;if(b.from.linef&&(b={from:b.from,to:xc(f,he(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=ie(a,b.from,b.to),c||(c=oc(a,b,null)),a.cm?vc(a.cm,b,d,c):$d(a,b,d,c)}function vc(a,b,c,d){var e=a.doc,f=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=le(Bd(e,he(e,g.line))),e.iter(j,h.line+1,function(a){if(a==f.maxLine)return i=!0,!0})),!zc(e.sel.head,b.from)&&!zc(b.to,e.sel.head)&&(a.curOp.cursorActivity=!0),$d(e,b,c,d,A(a)),a.options.lineWrapping||(e.iter(j,g.line+b.text.length,function(a){var b=G(e,a);b>f.maxLineLength&&(f.maxLine=a,f.maxLineLength=b,f.maxLineChanged=!0,i=!1)}),i&&(a.curOp.updateMaxLine=!0)),e.frontier=Math.min(e.frontier,g.line),ab(a,400);var k=b.text.length-(h.line-g.line)-1;Gb(a,g.line,h.line+1,k);if(Pe(a,"change")){var l={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};if(a.curOp.textChanged){for(var m=a.curOp.textChanged;m.next;m=m.next);m.next=l}else a.curOp.textChanged=l}}function wc(a,b,c,d,e){d||(d=c);if(zc(d,c)){var f=d;d=c,c=f}typeof b=="string"&&(b=sf(b)),qc(a,{from:c,to:d,text:b,origin:e},null)}function xc(a,b){if(!(this instanceof xc))return new xc(a,b);this.line=a,this.ch=b}function yc(a,b){return a.line==b.line&&a.ch==b.ch}function zc(a,b){return a.linec?xc(c,he(a,c).text.length):Dc(b,he(a,b.line).text.length)}function Dc(a,b){var c=a.ch;return c==null||c>b?xc(a.line,b):c<0?xc(a.line,0):a}function Ec(a,b){return b>=a.first&&b=f.ch:j.to>f.ch))){if(d){Je(k,"beforeCursorEnter");if(k.explicitlyCleared){if(!h.markedSpans)break;--i;continue}}if(!k.atomic)continue;var l=k.find()[g<0?"from":"to"];if(yc(l,f)){l.ch+=g,l.ch<0?l.line>a.first?l=Cc(a,xc(l.line-1)):l=null:l.ch>h.text.length&&(l.line(window.innerHeight||document.documentElement.clientHeight)&&(e=!1);if(e!=null&&!m){var f=c.cursor.style.display=="none";f&&(c.cursor.style.display="",c.cursor.style.left=b.left+"px",c.cursor.style.top=b.top-c.viewOffset+"px"),c.cursor.scrollIntoView(e),f&&(c.cursor.style.display="none")}}function Lc(a,b,c){c==null&&(c=0);for(;;){var d=!1,e=tb(a,b),f=Nc(a,e.left,e.top-c,e.left,e.bottom+c),g=a.doc.scrollTop,h=a.doc.scrollLeft;f.scrollTop!=null&&(Xb(a,f.scrollTop),Math.abs(a.doc.scrollTop-g)>1&&(d=!0)),f.scrollLeft!=null&&(Yb(a,f.scrollLeft),Math.abs(a.doc.scrollLeft-h)>1&&(d=!0));if(!d)return e}}function Mc(a,b,c,d,e){var f=Nc(a,b,c,d,e);f.scrollTop!=null&&Xb(a,f.scrollTop),f.scrollLeft!=null&&Yb(a,f.scrollLeft)}function Nc(a,b,c,d,e){var f=a.display,g=yb(a.display);c<0&&(c=0);var h=f.scroller.clientHeight-Re,i=f.scroller.scrollTop,j={},k=a.doc.height+fb(f),l=ck-g;if(ci+h){var n=Math.min(c,(m?k:e)-h);n!=i&&(j.scrollTop=n)}var o=f.scroller.clientWidth-Re,p=f.scroller.scrollLeft;b+=f.gutters.offsetWidth,d+=f.gutters.offsetWidth;var q=f.gutters.offsetWidth,r=bo+p-3&&(j.scrollLeft=d+10-o),j}function Oc(a,b,c){a.curOp.updateScrollPos={scrollLeft:b==null?a.doc.scrollLeft:b,scrollTop:c==null?a.doc.scrollTop:c}}function Pc(a,b,c){var d=a.curOp.updateScrollPos||(a.curOp.updateScrollPos={scrollLeft:a.doc.scrollLeft,scrollTop:a.doc.scrollTop}),e=a.display.scroller;d.scrollTop=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,d.scrollTop+c)),d.scrollLeft=Math.max(0,Math.min(e.scrollWidth-e.clientWidth,d.scrollLeft+b))}function Qc(a,b,c,d){var e=a.doc;c==null&&(c="add");if(c=="smart")if(!a.doc.mode.indent)c="prev";else var f=db(a,b);var g=a.options.tabSize,h=he(e,b),i=Ue(h.text,null,g),j=h.text.match(/^\s*/)[0],k;if(c=="smart"){k=a.doc.mode.indent(f,h.text.slice(j.length),h.text);if(k==Se){if(!d)return;c="prev"}}c=="prev"?b>e.first?k=Ue(he(e,b-1).text,null,g):k=0:c=="add"?k=i+a.options.indentUnit:c=="subtract"?k=i-a.options.indentUnit:typeof c=="number"&&(k=i+c),k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(k/g);n;--n)m+=g,l+=" ";m=a.first+a.size?j=!1:(f=b,i=he(a,b))}function l(a){var b=(e?Hf:If)(i,g,c,!0);if(b==null){if(!!a||!k())return j=!1;e?g=(c<0?Af:zf)(i):g=c<0?i.text.length:0}else g=b;return!0}var f=b.line,g=b.ch,h=c,i=he(a,f),j=!0;if(d=="char")l();else if(d=="column")l(!0);else if(d=="word"||d=="group"){var m=null,n=d=="group";for(var o=!0;;o=!1){if(c<0&&!l(!o))break;var p=i.text.charAt(g)||"\n",q=df(p)?"w":n?/\s/.test(p)?null:"p":null;if(m&&m!=q){c<0&&(c=1,l());break}q&&(m=q);if(c>0&&!l(!o))break}}var r=Jc(a,xc(f,g),h,!0);return j||(r.hitSide=!0),r}function Tc(a,b,c,d){var e=a.doc,f=b.left,g;if(d=="page"){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);g=b.top+c*(h-(c<0?1.5:.5)*yb(a.display))}else d=="line"&&(g=c>0?b.bottom+3:b.top-3);for(;;){var i=vb(a,f,g);if(!i.outside)break;if(c<0?g<=0:g>=e.height){i.hitSide=!0;break}g+=c*5}return i}function Uc(a,b){var c=b.ch,d=b.ch;if(a){(b.xRel<0||d==a.length)&&c?--c:++d;var e=a.charAt(c),f=df(e)?df:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!df(a)};while(c>0&&f(a.charAt(c-1)))--c;while(d=b:f.to>b);(e||(e=[])).push({from:f.from,to:i?null:f.to,marker:g})}}return e}function ud(a,b,c){if(a)for(var d=0,e;d=b:f.to>b);if(h||g.type=="bookmark"&&f.from==b&&(!c||f.marker.insertLeft)){var i=f.from==null||(g.inclusiveLeft?f.from<=b:f.from0&&h)for(var l=0;lb)&&(!d||d.widtha.options.maxHighlightLength?(f=!1,i.pos=Math.min(b.length,i.start+5e4),j=null):j=c.token(i,d);if(!f||h!=j)ga&&d.splice(g,1,a,d[g+1],e),g+=2,h=Math.min(a,e)}if(!b)return;if(f.opaque)d.splice(c,g-c,a,b),g=c+2;else for(;c="�"&&i<"�"&&hi)?(t.to!=null&&l>t.to&&(l=t.to,n=""),u.className&&(m+=" "+u.className),u.startStyle&&t.from==i&&(o+=" "+u.startStyle),u.endStyle&&t.to==l&&(n+=" "+u.endStyle),u.title&&!p&&(p=u.title),u.collapsed&&(!q||q.marker.sizei&&l>t.from&&(l=t.from),u.type=="bookmark"&&t.from==i&&u.replacedWith&&(r=u)}if(q&&(q.from||0)==i){Yd(b,(q.to==null?h:q.to)-i,q.marker,q.from==null);if(q.to==null)return q.marker.find()}r&&!q&&Yd(b,0,r)}if(i>=h)break;var v=Math.min(h,l);for(;;){if(j){var w=i+j.length;if(!q){var x=w>v?j.slice(0,v-i):j;b.addToken(b,x,k?k+m:m,o,i+x.length==l?n:"",p)}if(w>=v){j=j.slice(v-i),i=v;break}i=w,o=""}j=e.slice(f,f=c[g++]),k=Sd(c[g++])}}}function $d(a,b,c,d,e){function f(a){return c?c[a]:null}function g(a,c,d){Ld(a,c,d,e),Me(a,"change",a,b)}var h=b.from,i=b.to,j=b.text,k=he(a,h.line),l=he(a,i.line),m=Xe(j),n=f(j.length-1),o=i.line-h.line;if(h.ch==0&&i.ch==0&&m==""){for(var p=0,q=j.length-1,r=[];p1&&a.remove(h.line+1,o-1),a.insert(h.line+1,r)}Me(a,"change",a,b),Hc(a,d.anchor,d.head,null,!0)}function _d(a){this.lines=a,this.parent=null;for(var b=0,c=a.length,d=0;bf-a.cm.options.historyEventDelay||b.origin.charAt(0)=="*"))){var h=Xe(g.changes);yc(b.from,b.to)&&yc(b.from,h.to)?h.to=mc(b):g.changes.push(re(a,b)),g.anchorAfter=c.anchor,g.headAfter=c.head}else{g={changes:[re(a,b)],generation:e.generation,anchorBefore:a.sel.anchor,headBefore:a.sel.head,anchorAfter:c.anchor,headAfter:c.head},e.done.push(g),e.generation=++e.maxGeneration;while(e.done.length>e.undoDepth)e.done.shift()}e.lastTime=f,e.lastOp=d,e.lastOrigin=b.origin}function te(a){if(!a)return null;for(var b=0,c;b-1&&(Xe(g)[k]=i[k],delete i[k])}}return d}function we(a,b,c,d){c0}function Qe(a){a.prototype.on=function(a,b){He(this,a,b)},a.prototype.off=function(a,b){Ie(this,a,b)}}function Te(){this.id=null}function Ue(a,b,c,d,e){b==null&&(b=a.search(/[^\s\u00a0]/),b==-1&&(b=a.length));for(var f=d||0,g=e||0;f""&&(a.toUpperCase()!=a.toLowerCase()||cf.test(a))}function ef(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function gf(a,b,c,d){var e=document.createElement(a);c&&(e.className=c),d&&(e.style.cssText=d);if(typeof b=="string")kf(e,b);else if(b)for(var f=0;f0;--b)a.removeChild(a.firstChild);return a}function jf(a,b){return hf(a).appendChild(b)}function kf(a,b){d?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function lf(a){return a.getBoundingClientRect()}function nf(){return!1}function pf(a){if(of!=null)return of;var b=gf("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return jf(a,b),b.offsetWidth&&(of=b.offsetHeight-b.clientHeight),of||0}function rf(a){if(qf==null){var b=gf("span","");jf(a,gf("span",[b,document.createTextNode("x")])),a.firstChild.offsetHeight!=0&&(qf=b.offsetWidth<=1&&b.offsetHeight>2&&!c)}return qf?gf("span",""):gf("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function wf(a,b,c,d){if(!a)return d(b,c,"ltr");var e=!1;for(var f=0;fb||b==c&&g.to==b)d(Math.max(g.from,b),Math.min(g.to,c),g.level==1?"rtl":"ltr"),e=!0}e||d(b,c,"ltr")}function xf(a){return a.level%2?a.to:a.from}function yf(a){return a.level%2?a.from:a.to}function zf(a){var b=oe(a);return b?xf(b[0]):0}function Af(a){var b=oe(a);return b?yf(Xe(b)):a.text.length}function Bf(a,b){var c=he(a.doc,b),d=Bd(a.doc,c);d!=c&&(b=le(d));var e=oe(d),f=e?e[0].level%2?Af(d):zf(d):0;return xc(b,f)}function Cf(a,b){var c,d;while(c=Ad(d=he(a.doc,b)))b=c.find().to.line;var e=oe(d),f=e?e[0].level%2?zf(d):Af(d):d.text.length;return xc(b,f)}function Df(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:bb)return Ef=null,c;if(e.from==b||e.to==b){if(d!=null)return Df(a,e.level,a[d].level)?(Ef=d,c):(Ef=c,d);d=c}}return Ef=null,d}function Gf(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&ff.test(a.text.charAt(b)));return b}function Hf(a,b,c,d){var e=oe(a);if(!e)return If(a,b,c,d);var f=Ff(e,b),g=e[f],h=Gf(a,b,g.level%2?-c:c,d);for(;;){if(h>g.from&&h0==g.level%2?g.to:g.from);g=e[f+=c];if(!g)return null;c>0==g.level%2?h=Gf(a,g.to,-1,d):h=Gf(a,g.from,1,d)}}function If(a,b,c,d){var e=b+c;if(d)while(e>0&&ff.test(a.text.charAt(e)))e+=c;return e<0||e>a.text.length?null:e}"use strict";var a=/gecko\/\d/i.test(navigator.userAgent),b=/MSIE \d/.test(navigator.userAgent),c=b&&(document.documentMode==null||document.documentMode<8),d=b&&(document.documentMode==null||document.documentMode<9),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|Opera Mobi|IEMobile/i.test(navigator.userAgent),p=n||/Mac/.test(navigator.platform),q=/windows/i.test(navigator.platform),r=h&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);r&&(r=Number(r[1])),r&&r>=15&&(h=!1,e=!0);var s=p&&(f||h&&(r==null||r<12.11)),t=a||b&&!d,u=!1,v=!1,xb,Ab=0,Qb,Rb,Ub=0,Zb=0,$b=null;b?$b=-0.53:a?$b=15:g?$b=-0.7:i&&($b=-1/3);var cc,fc=null,kc,mc=w.changeEnd=function(a){return a.text?xc(a.from.line+a.text.length-1,Xe(a.text).length+(a.text.length==1?a.from.ch:0)):a.to};w.Pos=xc,w.prototype={constructor:w,focus:function(){window.focus(),Lb(this),ic(this),Ib(this)},setOption:function(a,b){var c=this.options,d=c[a];if(c[a]==b&&a!="mode")return;c[a]=b,Wc.hasOwnProperty(a)&&Db(this,Wc[a])(this,b,d)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){var b=this.state.keyMaps;for(var c=0;c>1;if((f?b[f*2-1]:0)>=e)d=f;else{if(!(b[f*2+1]d&&(a=d,c=!0);var e=he(this.doc,a);return qb(this,he(this.doc,a),{top:0,left:0},b||"page").top+(c?e.height:0)},defaultTextHeight:function(){return yb(this.display)},defaultCharWidth:function(){return zb(this.display)},setGutterMarker:Db(null,function(a,b,c){return Rc(this,a,function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&ef(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Db(null,function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Gb(b,d,d+1),ef(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineClass:Db(null,function(a,b,c){return Rc(this,a,function(a){var d=b=="text"?"textClass":b=="background"?"bgClass":"wrapClass";if(!a[d])a[d]=c;else{if((new RegExp("(?:^|\\s)"+c+"(?:$|\\s)")).test(a[d]))return!1;a[d]+=" "+c}return!0})}),removeLineClass:Db(null,function(a,b,c){return Rc(this,a,function(a){var d=b=="text"?"textClass":b=="background"?"bgClass":"wrapClass",e=a[d];if(!e)return!1;if(c==null)a[d]=null;else{var f=e.match(new RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!f)return!1;var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(!f.index||g==e.length?"":" ")+e.slice(g)||null}return!0})}),addLineWidget:Db(null,function(a,b,c){return Jd(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if(typeof a=="number"){if(!Ec(this.doc,a))return null;var b=a;a=he(this.doc,a);if(!a)return null}else{var b=le(a);if(b==null)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=tb(this,Cc(this.doc,a));var g=a.bottom,h=a.left;b.style.position="absolute",f.sizer.appendChild(b);if(d=="over")g=a.top;else if(d=="above"||d=="near"){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);(d=="above"||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="",e=="right"?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):(e=="left"?h=0:e=="middle"&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Mc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Db(null,gc),execCommand:function(a){return fd[a](this)},findPosH:function(a,b,c,d){var e=1;b<0&&(e=-1,b=-b);for(var f=0,g=Cc(this.doc,a);f2){b.dependencies=[];for(var c=2;c0&&b.ch=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.posb},eatSpace:function(){var a=this.pos;while(/[\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);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos0?null:(f&&b!==!1&&(this.pos+=f[0].length),f)}var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);if(d(e)==d(a))return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)}},w.StringStream=ld,w.TextMarker=md,Qe(md),md.prototype.clear=function(){if(this.explicitlyCleared)return;var a=this.doc.cm,b=a&&!a.curOp;b&&Bb(a);if(Pe(this,"clear")){var c=this.find();c&&Me(this,"clear",c.from,c.to)}var d=null,e=null;for(var f=0;fa.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}d!=null&&a&&Gb(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Ic(a)),b&&Cb(a)},md.prototype.find=function(){var a,b;for(var c=0;c=b.display.showingFrom&&a.from.line50){while(f.lines.length>50){var h=f.lines.splice(f.lines.length-25,25),i=new _d(h);f.height-=i.height,this.children.splice(d+1,0,i),i.parent=this}this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(this.children.length<=10)return;var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new ae(b);if(!a.parent){var d=new ae(a.children);d.parent=a,a.children=[d,c],a=d}else{a.size-=c.size,a.height-=c.height;var e=Ze(a.parent.children,a);a.parent.children.splice(e+1,0,c)}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()},iterN:function(a,b,c){for(var d=0,e=this.children.length;d=a.ch)&&b.push(e.marker.parent||e.marker)}return b},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;da)return b=a,!0;a-=e,++c}),Cc(this,xc(c,b))},indexFromPos:function(a){a=Cc(this,a);var b=a.ch;return a.lineb&&(b=a.from),a.to!=null&&a.to1&&a.charCodeAt(b-1)==45){if(/\w/.test(a.charAt(b-2))&&/[^\-?\.]/.test(a.charAt(b)))return!0;if(b>2&&/[\d\.,]/.test(a.charAt(b-2))&&/[\d\.,]/.test(a.charAt(b)))return!1}return/[~!#%&*)=+}\]|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(a.slice(b-1,b+1))});var of,qf,sf="\n\nb".split(/\n/).length!=3?function(a){var b=0,c=[],d=a.length;while(b<=d){var e=a.indexOf("\n",b);e==-1&&(e=a.length);var f=a.slice(b,a.charAt(e-1)=="\r"?e-1:e),g=f.indexOf("\r");g!=-1?(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/)};w.splitLines=sf;var tf=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?!1:b.compareEndPoints("StartToEnd",b)!=0},uf=function(){var a=gf("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),typeof a.oncopy=="function")}(),vf={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"};w.keyNames=vf,function(){for(var a=0;a<10;a++)vf[a+48]=String(a);for(var a=65;a<=90;a++)vf[a]=String.fromCharCode(a);for(var a=1;a<=12;a++)vf[a+111]=vf[a+63235]="F"+a}();var Ef,Jf=function(){function c(c){return c<=255?a.charAt(c):1424<=c&&c<=1524?"R":1536<=c&&c<=1791?b.charAt(c-1536):1792<=c&&c<=2220?"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]/,i="L";return function(a){if(!d.test(a))return!1;var b=a.length,j=[];for(var k=0,l;kd.maxLineLength&&(d.maxLineLength=len,d.maxLine=line)})}function setGuttersForLineNumbers(options){for(var found=!1,i=0;id.scroller.clientWidth+1,needsV=scrollHeight>d.scroller.clientHeight+1;needsV?(d.scrollbarV.style.display="block",d.scrollbarV.style.bottom=needsH?scrollbarWidth(d.measure)+"px":"0",d.scrollbarV.firstChild.style.height=scrollHeight-d.scroller.clientHeight+d.scrollbarV.clientHeight+"px"):d.scrollbarV.style.display="",needsH?(d.scrollbarH.style.display="block",d.scrollbarH.style.right=needsV?scrollbarWidth(d.measure)+"px":"0",d.scrollbarH.firstChild.style.width=d.scroller.scrollWidth-d.scroller.clientWidth+d.scrollbarH.clientWidth+"px"):d.scrollbarH.style.display="",needsH&&needsV?(d.scrollbarFiller.style.display="block",d.scrollbarFiller.style.height=d.scrollbarFiller.style.width=scrollbarWidth(d.measure)+"px"):d.scrollbarFiller.style.display="",needsH&&cm.options.coverGutterNextToScrollbar&&cm.options.fixedGutter?(d.gutterFiller.style.display="block",d.gutterFiller.style.height=scrollbarWidth(d.measure)+"px",d.gutterFiller.style.width=d.gutters.offsetWidth+"px"):d.gutterFiller.style.display="",mac_geLion&&0===scrollbarWidth(d.measure)&&(d.scrollbarV.style.minWidth=d.scrollbarH.style.minHeight=mac_geMountainLion?"18px":"12px")}function visibleLines(display,doc,viewPort){var top=display.scroller.scrollTop,height=display.wrapper.clientHeight;"number"==typeof viewPort?top=viewPort:viewPort&&(top=viewPort.top,height=viewPort.bottom-viewPort.top),top=Math.floor(top-paddingTop(display));var bottom=Math.ceil(top+height);return{from:lineAtHeight(doc,top),to:lineAtHeight(doc,bottom)}}function alignHorizontally(cm){var display=cm.display;if(display.alignWidgets||display.gutters.firstChild&&cm.options.fixedGutter){for(var comp=compensateForHScroll(display)-display.scroller.scrollLeft+cm.doc.scrollLeft,gutterW=display.gutters.offsetWidth,l=comp+"px",n=display.lineDiv.firstChild;n;n=n.nextSibling)if(n.alignable)for(var i=0,a=n.alignable;i=cm.display.showingFrom&&visible.to<=cm.display.showingTo));)changes=[];return updated&&(signalLater(cm,"update",cm),(cm.display.showingFrom!=oldFrom||cm.display.showingTo!=oldTo)&&signalLater(cm,"viewportChange",cm,cm.display.showingFrom,cm.display.showingTo)),updated}function updateDisplayInner(cm,changes,visible,forced){var display=cm.display,doc=cm.doc;if(!display.wrapper.clientWidth)return display.showingFrom=display.showingTo=doc.first,void(display.viewOffset=0);if(!(!forced&&0==changes.length&&visible.from>display.showingFrom&&visible.toto&&display.showingTo-to<20&&(to=Math.min(end,display.showingTo)),sawCollapsedSpans)for(from=lineNo(visualLine(doc,getLine(doc,from)));end>to&&lineIsHidden(doc,getLine(doc,to));)++to;var intact=[{from:Math.max(display.showingFrom,doc.first),to:Math.min(display.showingTo,end)}];if(intact=intact[0].from>=intact[0].to?[]:computeIntact(intact,changes),sawCollapsedSpans)for(var i=0;irange.from)){intact.splice(i--,1);break}range.to=newTo}for(var intactLines=0,i=0;ito&&(range.to=to),range.from>=range.to?intact.splice(i--,1):intactLines+=range.to-range.from}if(!forced&&intactLines==to-from&&from==display.showingFrom&&to==display.showingTo)return void updateViewOffset(cm);intact.sort(function(a,b){return a.from-b.from});try{var focused=document.activeElement}catch(e){}.7*(to-from)>intactLines&&(display.lineDiv.style.display="none"),patchDisplay(cm,from,to,intact,positionsChangedFrom),display.lineDiv.style.display="",focused&&document.activeElement!=focused&&focused.offsetHeight&&focused.focus();var different=from!=display.showingFrom||to!=display.showingTo||display.lastSizeC!=display.wrapper.clientHeight;return different&&(display.lastSizeC=display.wrapper.clientHeight,startWorker(cm,400)),display.showingFrom=from,display.showingTo=to,updateHeightsInViewport(cm),updateViewOffset(cm),!0}}function updateHeightsInViewport(cm){for(var height,display=cm.display,prevBottom=display.lineDiv.offsetTop,node=display.lineDiv.firstChild;node;node=node.nextSibling)if(node.lineObj){if(ie_lt8){var bot=node.offsetTop+node.offsetHeight;height=bot-prevBottom,prevBottom=bot}else{var box=getRect(node);height=box.bottom-box.top}var diff=node.lineObj.height-height;if(2>height&&(height=textHeight(display)),diff>.001||-.001>diff){updateLineHeight(node.lineObj,height);var widgets=node.lineObj.widgets;if(widgets)for(var i=0;ii;++i){for(var change=changes[i],intact2=[],diff=change.diff||0,j=0,l2=intact.length;l2>j;++j){var range=intact[j];change.to<=range.from&&change.diff?intact2.push({from:range.from+diff,to:range.to+diff}):change.to<=range.from||change.from>=range.to?intact2.push(range):(change.from>range.from&&intact2.push({from:range.from,to:change.from}),change.tolineN){for(;cur.lineObj!=line;)cur=rm(cur);lineNumbers&&lineN>=updateNumbersFrom&&cur.lineNumber&&setTextContent(cur.lineNumber,lineNumberFor(cm.options,lineN)),cur=cur.nextSibling}else{if(line.widgets)for(var reuse,j=0,search=cur;search&&20>j;++j,search=search.nextSibling)if(search.lineObj==line&&/div/i.test(search.nodeName)){reuse=search;break}var lineNode=buildLineElement(cm,line,lineN,dims,reuse);if(lineNode!=reuse)container.insertBefore(lineNode,cur);else{for(;cur!=reuse;)cur=rm(cur);cur=cur.nextSibling}lineNode.lineObj=line}++lineN});cur;)cur=rm(cur)}function buildLineElement(cm,line,lineNo,dims,reuse){var wrap,lineElement=lineContent(cm,line),markers=line.gutterMarkers,display=cm.display;if(!(cm.options.lineNumbers||markers||line.bgClass||line.wrapClass||line.widgets))return lineElement;if(reuse){reuse.alignable=null;for(var next,isOk=!0,widgetsSeen=0,insertBefore=null,n=reuse.firstChild;n;n=next)if(next=n.nextSibling,/\bCodeMirror-linewidget\b/.test(n.className)){for(var i=0;itop&&(top=0),fragment.appendChild(elt("div",null,"CodeMirror-selected","position: absolute; left: "+left+"px; top: "+top+"px; width: "+(null==width?clientWidth-left:width)+"px; height: "+(bottom-top)+"px"))}function drawForLine(line,fromArg,toArg){function coords(ch,bias){return charCoords(cm,Pos(line,ch),"div",lineObj,bias)}var start,end,lineObj=getLine(doc,line),lineLen=lineObj.text.length;return iterateBidiSections(getOrder(lineObj),fromArg||0,null==toArg?lineLen:toArg,function(from,to,dir){var rightPos,left,right,leftPos=coords(from,"left");if(from==to)rightPos=leftPos,left=right=leftPos.left;else{if(rightPos=coords(to-1,"right"),"rtl"==dir){var tmp=leftPos;leftPos=rightPos,rightPos=tmp}left=leftPos.left,right=rightPos.right}null==fromArg&&0==from&&(left=pl),rightPos.top-leftPos.top>3&&(add(left,leftPos.top,null,leftPos.bottom),left=pl,leftPos.bottomend.bottom||rightPos.bottom==end.bottom&&rightPos.right>end.right)&&(end=rightPos),pl+1>left&&(left=pl),add(left,rightPos.top,right-left,rightPos.bottom)}),{start:start,end:end}}var display=cm.display,doc=cm.doc,sel=cm.doc.sel,fragment=document.createDocumentFragment(),clientWidth=display.lineSpace.offsetWidth,pl=paddingLeft(cm.display);if(sel.from.line==sel.to.line)drawForLine(sel.from.line,sel.from.ch,sel.to.ch);else{var fromLine=getLine(doc,sel.from.line),toLine=getLine(doc,sel.to.line),singleVLine=visualLine(doc,fromLine)==visualLine(doc,toLine),leftEnd=drawForLine(sel.from.line,sel.from.ch,singleVLine?fromLine.text.length:null).end,rightStart=drawForLine(sel.to.line,singleVLine?0:null,sel.to.ch).start;singleVLine&&(leftEnd.top=cm.display.showingTo)){var prevChange,end=+new Date+cm.options.workTime,state=copyState(doc.mode,getStateBefore(cm,doc.frontier)),changed=[];doc.iter(doc.frontier,Math.min(doc.first+doc.size,cm.display.showingTo+500),function(line){if(doc.frontier>=cm.display.showingFrom){var oldStyles=line.styles;line.styles=highlightLine(cm,line,state);for(var ischange=!oldStyles||oldStyles.length!=line.styles.length,i=0;!ischange&&iend?(startWorker(cm,cm.options.workDelay),!0):void 0}),changed.length&&operation(cm,function(){for(var i=0;ilim;--search){if(search<=doc.first)return doc.first;var line=getLine(doc,search-1);if(line.stateAfter&&(!precise||search<=doc.frontier))return search;var indented=countColumn(line.text,null,cm.options.tabSize);(null==minline||minindent>indented)&&(minline=search-1,minindent=indented)}return minline}function getStateBefore(cm,n,precise){var doc=cm.doc,display=cm.display;if(!doc.mode.startState)return!0;var pos=findStartLine(cm,n,precise),state=pos>doc.first&&getLine(doc,pos-1).stateAfter;return state=state?copyState(doc.mode,state):startState(doc.mode),doc.iter(pos,n,function(line){processLine(cm,line,state);var save=pos==n-1||pos%5==0||pos>=display.showingFrom&&posdir&&0==pos&&(dir=1)}return bias=pos>ch?"left":ch>pos?"right":bias,"left"==bias&&r.leftSide?r=r.leftSide:"right"==bias&&r.rightSide&&(r=r.rightSide),{left:ch>pos?r.right:r.left,right:pos>ch?r.left:r.right,top:r.top,bottom:r.bottom}}function findCachedMeasurement(cm,line){for(var cache=cm.display.measureLineCache,i=0;imaxBot&&(bot=maxBot),0>top&&(top=0);for(var i=vranges.length-2;i>=0;i-=2){var rtop=vranges[i],rbot=vranges[i+1];if(!(rtop>bot||top>rbot)&&(top>=rtop&&rbot>=bot||rtop>=top&&bot>=rbot||Math.min(bot,rbot)-Math.max(top,rtop)>=bot-top>>1)){vranges[i]=Math.min(top,rtop),vranges[i+1]=Math.max(bot,rbot);break}}return 0>i&&(i=vranges.length,vranges.push(top,bot)),{left:rect.left-outer.left,right:rect.right-outer.left,top:i,bottom:null}}function finishRect(rect){rect.bottom=vranges[rect.top+1],rect.top=vranges[rect.top]}var display=cm.display,measure=emptyArray(line.text.length),pre=lineContent(cm,line,measure,!0);if(ie&&!ie_lt8&&!cm.options.lineWrapping&&pre.childNodes.length>100){for(var fragment=document.createDocumentFragment(),chunk=10,n=pre.childNodes.length,i=0,chunks=Math.ceil(n/chunk);chunks>i;++i){for(var wrap=elt("div",null,null,"display: inline-block"),j=0;chunk>j&&n;++j)wrap.appendChild(pre.firstChild),--n;fragment.appendChild(wrap)}pre.appendChild(fragment)}removeChildrenAndAdd(display.measure,pre);var outer=getRect(display.lineDiv),vranges=[],data=emptyArray(line.text.length),maxBot=pre.offsetHeight;ie_lt9&&display.measure.first!=pre&&removeChildrenAndAdd(display.measure,pre);for(var cur,i=0;i1&&(rect=data[i]=measureRect(rects[0]),rect.rightSide=measureRect(rects[rects.length-1]))}rect||(rect=data[i]=measureRect(getRect(node))),cur.measureRight&&(rect.right=getRect(cur.measureRight).left),cur.leftSide&&(rect.leftSide=measureRect(getRect(cur.leftSide)))}for(var cur,i=0;ipart.from?get(ch-1):get(ch,right)}lineObj=lineObj||getLine(cm.doc,pos.line),measurement||(measurement=measureLine(cm,lineObj));var order=getOrder(lineObj),ch=pos.ch;if(!order)return get(ch);var partPos=getBidiPartAt(order,ch),val=getBidi(ch,partPos);return null!=bidiOther&&(val.other=getBidi(ch,bidiOther)),
+val}function PosWithInfo(line,ch,outside,xRel){var pos=new Pos(line,ch);return pos.xRel=xRel,outside&&(pos.outside=!0),pos}function coordsChar(cm,x,y){var doc=cm.doc;if(y+=cm.display.viewOffset,0>y)return PosWithInfo(doc.first,0,!0,-1);var lineNo=lineAtHeight(doc,y),last=doc.first+doc.size-1;if(lineNo>last)return PosWithInfo(doc.first+doc.size-1,getLine(doc,last).text.length,!0,1);for(0>x&&(x=0);;){var lineObj=getLine(doc,lineNo),found=coordsCharInner(cm,lineObj,lineNo,x,y),merged=collapsedSpanAtEnd(lineObj),mergedPos=merged&&merged.find();if(!merged||!(found.ch>mergedPos.from.ch||found.ch==mergedPos.from.ch&&found.xRel>0))return found;lineNo=mergedPos.to.line}}function coordsCharInner(cm,lineObj,lineNo,x,y){function getX(ch){var sp=cursorCoords(cm,Pos(lineNo,ch),"line",lineObj,measurement);return wrongLine=!0,innerOff>sp.bottom?sp.left-adjust:innerOfftoX)return PosWithInfo(lineNo,to,toOutside,1);for(;;){if(bidi?to==from||to==moveVisually(lineObj,from,1):1>=to-from){for(var ch=fromX>x||toX-x>=x-fromX?from:to,xDiff=x-(ch==from?fromX:toX);isExtendingChar.test(lineObj.text.charAt(ch));)++ch;var pos=PosWithInfo(lineNo,ch,ch==from?fromOutside:toOutside,0>xDiff?-1:xDiff?1:0);return pos}var step=Math.ceil(dist/2),middle=from+step;if(bidi){middle=from;for(var i=0;step>i;++i)middle=moveVisually(lineObj,middle,1)}var middleX=getX(middle);middleX>x?(to=middle,toX=middleX,(toOutside=wrongLine)&&(toX+=1e3),dist=step):(from=middle,fromX=middleX,fromOutside=wrongLine,dist-=step)}}function textHeight(display){if(null!=display.cachedTextHeight)return display.cachedTextHeight;if(null==measureText){measureText=elt("pre");for(var i=0;49>i;++i)measureText.appendChild(document.createTextNode("x")),measureText.appendChild(elt("br"));measureText.appendChild(document.createTextNode("x"))}removeChildrenAndAdd(display.measure,measureText);var height=measureText.offsetHeight/50;return height>3&&(display.cachedTextHeight=height),removeChildren(display.measure),height||1}function charWidth(display){if(null!=display.cachedCharWidth)return display.cachedCharWidth;var anchor=elt("span","x"),pre=elt("pre",[anchor]);removeChildrenAndAdd(display.measure,pre);var width=anchor.offsetWidth;return width>2&&(display.cachedCharWidth=width),width||10}function startOperation(cm){cm.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++nextOpId},delayedCallbackDepth++||(delayedCallbacks=[])}function endOperation(cm){var op=cm.curOp,doc=cm.doc,display=cm.display;if(cm.curOp=null,op.updateMaxLine&&computeMaxLength(cm),display.maxLineChanged&&!cm.options.lineWrapping&&display.maxLine){var width=measureLineWidth(cm,display.maxLine);display.sizer.style.minWidth=Math.max(0,width+3+scrollerCutOff)+"px",display.maxLineChanged=!1;var maxScrollLeft=Math.max(0,display.sizer.offsetLeft+display.sizer.offsetWidth-display.scroller.clientWidth);maxScrollLeftsame&&prevInput.charCodeAt(same)==text.charCodeAt(same);)++same;var from=sel.from,to=sel.to;same1e3||text.indexOf("\n")>-1?input.value=cm.display.prevInput="":cm.display.prevInput=text,withOp&&endOperation(cm),cm.state.pasteIncoming=!1,!0}function resetInput(cm,user){var minimal,selected,doc=cm.doc;if(posEq(doc.sel.from,doc.sel.to))user&&(cm.display.prevInput=cm.display.input.value="",ie&&!ie_lt9&&(cm.display.inputHasSelection=null));else{cm.display.prevInput="",minimal=hasCopyEvent&&(doc.sel.to.line-doc.sel.from.line>100||(selected=cm.getSelection()).length>1e3);var content=minimal?"-":selected||cm.getSelection();cm.display.input.value=content,cm.state.focused&&selectInput(cm.display.input),ie&&!ie_lt9&&(cm.display.inputHasSelection=content)}cm.display.inaccurateSelection=minimal}function focusInput(cm){"nocursor"==cm.options.readOnly||mobile&&document.activeElement==cm.display.input||cm.display.input.focus()}function isReadOnly(cm){return cm.options.readOnly||cm.doc.cantEdit}function registerEventHandlers(cm){function reFocus(){cm.state.focused&&setTimeout(bind(focusInput,cm),0)}function onResize(){null==resizeTimer&&(resizeTimer=setTimeout(function(){resizeTimer=null,d.cachedCharWidth=d.cachedTextHeight=knownScrollbarWidth=null,clearCaches(cm),runInOp(cm,bind(regChange,cm))},100))}function unregister(){for(var p=d.wrapper.parentNode;p&&p!=document.body;p=p.parentNode);p?setTimeout(unregister,5e3):off(window,"resize",onResize)}function drag_(e){signalDOMEvent(cm,e)||cm.options.onDragEvent&&cm.options.onDragEvent(cm,addStop(e))||e_stop(e)}function prepareCopy(){d.inaccurateSelection&&(d.prevInput="",d.inaccurateSelection=!1,d.input.value=cm.getSelection(),selectInput(d.input))}var d=cm.display;on(d.scroller,"mousedown",operation(cm,onMouseDown)),ie?on(d.scroller,"dblclick",operation(cm,function(e){if(!signalDOMEvent(cm,e)){var pos=posFromMouse(cm,e);if(pos&&!clickInGutter(cm,e)&&!eventInWidget(cm.display,e)){e_preventDefault(e);var word=findWordAt(getLine(cm.doc,pos.line).text,pos);extendSelection(cm.doc,word.from,word.to)}}})):on(d.scroller,"dblclick",function(e){signalDOMEvent(cm,e)||e_preventDefault(e)}),on(d.lineSpace,"selectstart",function(e){eventInWidget(d,e)||e_preventDefault(e)}),captureMiddleClick||on(d.scroller,"contextmenu",function(e){onContextMenu(cm,e)}),on(d.scroller,"scroll",function(){d.scroller.clientHeight&&(setScrollTop(cm,d.scroller.scrollTop),setScrollLeft(cm,d.scroller.scrollLeft,!0),signal(cm,"scroll",cm))}),on(d.scrollbarV,"scroll",function(){d.scroller.clientHeight&&setScrollTop(cm,d.scrollbarV.scrollTop)}),on(d.scrollbarH,"scroll",function(){d.scroller.clientHeight&&setScrollLeft(cm,d.scrollbarH.scrollLeft)}),on(d.scroller,"mousewheel",function(e){onScrollWheel(cm,e)}),on(d.scroller,"DOMMouseScroll",function(e){onScrollWheel(cm,e)}),on(d.scrollbarH,"mousedown",reFocus),on(d.scrollbarV,"mousedown",reFocus),on(d.wrapper,"scroll",function(){d.wrapper.scrollTop=d.wrapper.scrollLeft=0});var resizeTimer;on(window,"resize",onResize),setTimeout(unregister,5e3),on(d.input,"keyup",operation(cm,function(e){signalDOMEvent(cm,e)||cm.options.onKeyEvent&&cm.options.onKeyEvent(cm,addStop(e))||16==e.keyCode&&(cm.doc.sel.shift=!1)})),on(d.input,"input",bind(fastPoll,cm)),on(d.input,"keydown",operation(cm,onKeyDown)),on(d.input,"keypress",operation(cm,onKeyPress)),on(d.input,"focus",bind(onFocus,cm)),on(d.input,"blur",bind(onBlur,cm)),cm.options.dragDrop&&(on(d.scroller,"dragstart",function(e){onDragStart(cm,e)}),on(d.scroller,"dragenter",drag_),on(d.scroller,"dragover",drag_),on(d.scroller,"drop",operation(cm,onDrop))),on(d.scroller,"paste",function(e){eventInWidget(d,e)||(focusInput(cm),fastPoll(cm))}),on(d.input,"paste",function(){cm.state.pasteIncoming=!0,fastPoll(cm)}),on(d.input,"cut",prepareCopy),on(d.input,"copy",prepareCopy),khtml&&on(d.sizer,"mouseup",function(){document.activeElement==d.input&&d.input.blur(),focusInput(cm)})}function eventInWidget(display,e){for(var n=e_target(e);n!=display.wrapper;n=n.parentNode)if(!n||n.ignoreEvents||n.parentNode==display.sizer&&n!=display.mover)return!0}function posFromMouse(cm,e,liberal){var display=cm.display;if(!liberal){var target=e_target(e);if(target==display.scrollbarH||target==display.scrollbarH.firstChild||target==display.scrollbarV||target==display.scrollbarV.firstChild||target==display.scrollbarFiller||target==display.gutterFiller)return null}var x,y,space=getRect(display.lineSpace);try{x=e.clientX,y=e.clientY}catch(e){return null}return coordsChar(cm,x-space.left,y-space.top)}function onMouseDown(e){function doSelect(cur){if(!posEq(lastPos,cur)){if(lastPos=cur,"single"==type)return void extendSelection(cm.doc,clipPos(doc,start),cur);if(startstart=clipPos(doc,startstart),startend=clipPos(doc,startend),"double"==type){var word=findWordAt(getLine(doc,cur.line).text,cur);posLess(cur,startstart)?extendSelection(cm.doc,word.from,startend):extendSelection(cm.doc,startstart,word.to)}else"triple"==type&&(posLess(cur,startstart)?extendSelection(cm.doc,startend,clipPos(doc,Pos(cur.line,0))):extendSelection(cm.doc,startstart,clipPos(doc,Pos(cur.line+1,0))))}}function extend(e){var curCount=++counter,cur=posFromMouse(cm,e,!0);if(cur)if(posEq(cur,last)){var outside=e.clientYeditorSize.bottom?20:0;outside&&setTimeout(operation(cm,function(){counter==curCount&&(display.scroller.scrollTop+=outside,extend(e))}),50)}else{cm.state.focused||onFocus(cm),last=cur,doSelect(cur);var visible=visibleLines(display,doc);(cur.line>=visible.to||cur.linenow-400&&posEq(lastDoubleClick.pos,start))type="triple",e_preventDefault(e),setTimeout(bind(focusInput,cm),20),selectLine(cm,start.line);else if(lastClick&&lastClick.time>now-400&&posEq(lastClick.pos,start)){type="double",lastDoubleClick={time:now,pos:start},e_preventDefault(e);var word=findWordAt(getLine(doc,start.line).text,start);extendSelection(cm.doc,word.from,word.to)}else lastClick={time:now,pos:start};var last=start;if(cm.options.dragDrop&&dragAndDrop&&!isReadOnly(cm)&&!posEq(sel.from,sel.to)&&!posLess(start,sel.from)&&!posLess(sel.to,start)&&"single"==type){var dragEnd=operation(cm,function(e2){webkit&&(display.scroller.draggable=!1),cm.state.draggingText=!1,off(document,"mouseup",dragEnd),off(display.scroller,"drop",dragEnd),Math.abs(e.clientX-e2.clientX)+Math.abs(e.clientY-e2.clientY)<10&&(e_preventDefault(e2),extendSelection(cm.doc,start),focusInput(cm))});return webkit&&(display.scroller.draggable=!0),cm.state.draggingText=dragEnd,display.scroller.dragDrop&&display.scroller.dragDrop(),on(document,"mouseup",dragEnd),void on(display.scroller,"drop",dragEnd)}e_preventDefault(e),"single"==type&&extendSelection(cm.doc,clipPos(doc,start));var startstart=sel.from,startend=sel.to,lastPos=start,editorSize=getRect(display.wrapper),counter=0,move=operation(cm,function(e){ie||e_button(e)?extend(e):done(e)}),up=operation(cm,done);on(document,"mousemove",move),on(document,"mouseup",up)}}}function clickInGutter(cm,e){var display=cm.display;try{var mX=e.clientX,mY=e.clientY}catch(e){return!1}if(mX>=Math.floor(getRect(display.gutters).right))return!1;if(e_preventDefault(e),!hasHandler(cm,"gutterClick"))return!0;var lineBox=getRect(display.lineDiv);if(mY>lineBox.bottom)return!0;mY-=lineBox.top-display.viewOffset;for(var i=0;i=mX){var line=lineAtHeight(cm.doc,mY),gutter=cm.options.gutters[i];signalLater(cm,"gutterClick",cm,line,gutter,e);break}}return!0}function onDrop(e){var cm=this;if(!(signalDOMEvent(cm,e)||eventInWidget(cm.display,e)||cm.options.onDragEvent&&cm.options.onDragEvent(cm,addStop(e)))){e_preventDefault(e),ie&&(lastDrop=+new Date);var pos=posFromMouse(cm,e,!0),files=e.dataTransfer.files;if(pos&&!isReadOnly(cm))if(files&&files.length&&window.FileReader&&window.File)for(var n=files.length,text=Array(n),read=0,loadFile=function(file,i){var reader=new FileReader;reader.onload=function(){text[i]=reader.result,++read==n&&(pos=clipPos(cm.doc,pos),makeChange(cm.doc,{from:pos,to:pos,text:splitLines(text.join("\n")),origin:"paste"},"around"))},reader.readAsText(file)},i=0;n>i;++i)loadFile(files[i],i);else{if(cm.state.draggingText&&!posLess(pos,cm.doc.sel.from)&&!posLess(cm.doc.sel.to,pos))return cm.state.draggingText(e),void setTimeout(bind(focusInput,cm),20);try{var text=e.dataTransfer.getData("Text");if(text){var curFrom=cm.doc.sel.from,curTo=cm.doc.sel.to;setSelection(cm.doc,pos,pos),cm.state.draggingText&&replaceRange(cm.doc,"",curFrom,curTo,"paste"),cm.replaceSelection(text,null,"paste"),focusInput(cm),onFocus(cm)}}catch(e){}}}}function onDragStart(cm,e){if(ie&&(!cm.state.draggingText||+new Date-lastDrop<100))return void e_stop(e);if(!signalDOMEvent(cm,e)&&!eventInWidget(cm.display,e)){var txt=cm.getSelection();if(e.dataTransfer.setData("Text",txt),e.dataTransfer.setDragImage&&!safari){var img=elt("img",null,null,"position: fixed; left: 0; top: 0;");opera&&(img.width=img.height=1,cm.display.wrapper.appendChild(img),img._top=img.offsetTop),e.dataTransfer.setDragImage(img,0,0),opera&&img.parentNode.removeChild(img)}}}function setScrollTop(cm,val){Math.abs(cm.doc.scrollTop-val)<2||(cm.doc.scrollTop=val,gecko||updateDisplay(cm,[],val),cm.display.scroller.scrollTop!=val&&(cm.display.scroller.scrollTop=val),cm.display.scrollbarV.scrollTop!=val&&(cm.display.scrollbarV.scrollTop=val),gecko&&updateDisplay(cm,[]),startWorker(cm,100))}function setScrollLeft(cm,val,isScroller){(isScroller?val==cm.doc.scrollLeft:Math.abs(cm.doc.scrollLeft-val)<2)||(val=Math.min(val,cm.display.scroller.scrollWidth-cm.display.scroller.clientWidth),cm.doc.scrollLeft=val,alignHorizontally(cm),cm.display.scroller.scrollLeft!=val&&(cm.display.scroller.scrollLeft=val),cm.display.scrollbarH.scrollLeft!=val&&(cm.display.scrollbarH.scrollLeft=val))}function onScrollWheel(cm,e){var dx=e.wheelDeltaX,dy=e.wheelDeltaY;null==dx&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(dx=e.detail),null==dy&&e.detail&&e.axis==e.VERTICAL_AXIS?dy=e.detail:null==dy&&(dy=e.wheelDelta);var display=cm.display,scroll=display.scroller;if(dx&&scroll.scrollWidth>scroll.clientWidth||dy&&scroll.scrollHeight>scroll.clientHeight){if(dy&&mac&&webkit)for(var cur=e.target;cur!=scroll;cur=cur.parentNode)if(cur.lineObj){cm.display.currentWheelTarget=cur;break}if(dx&&!gecko&&!opera&&null!=wheelPixelsPerUnit)return dy&&setScrollTop(cm,Math.max(0,Math.min(scroll.scrollTop+dy*wheelPixelsPerUnit,scroll.scrollHeight-scroll.clientHeight))),setScrollLeft(cm,Math.max(0,Math.min(scroll.scrollLeft+dx*wheelPixelsPerUnit,scroll.scrollWidth-scroll.clientWidth))),e_preventDefault(e),void(display.wheelStartX=null);if(dy&&null!=wheelPixelsPerUnit){var pixels=dy*wheelPixelsPerUnit,top=cm.doc.scrollTop,bot=top+display.wrapper.clientHeight;0>pixels?top=Math.max(0,top+pixels-50):bot=Math.min(cm.doc.height,bot+pixels+50),updateDisplay(cm,[],{top:top,bottom:bot})}20>wheelSamples&&(null==display.wheelStartX?(display.wheelStartX=scroll.scrollLeft,display.wheelStartY=scroll.scrollTop,display.wheelDX=dx,display.wheelDY=dy,setTimeout(function(){if(null!=display.wheelStartX){var movedX=scroll.scrollLeft-display.wheelStartX,movedY=scroll.scrollTop-display.wheelStartY,sample=movedY&&display.wheelDY&&movedY/display.wheelDY||movedX&&display.wheelDX&&movedX/display.wheelDX;display.wheelStartX=display.wheelStartY=null,sample&&(wheelPixelsPerUnit=(wheelPixelsPerUnit*wheelSamples+sample)/(wheelSamples+1),++wheelSamples)}},200)):(display.wheelDX+=dx,display.wheelDY+=dy))}}function doHandleBinding(cm,bound,dropShift){if("string"==typeof bound&&(bound=commands[bound],!bound))return!1;cm.display.pollingFast&&readInput(cm)&&(cm.display.pollingFast=!1);var doc=cm.doc,prevShift=doc.sel.shift,done=!1;try{isReadOnly(cm)&&(cm.state.suppressEdits=!0),dropShift&&(doc.sel.shift=!1),done=bound(cm)!=Pass}finally{doc.sel.shift=prevShift,cm.state.suppressEdits=!1}return done}function allKeyMaps(cm){var maps=cm.state.keyMaps.slice(0);return cm.options.extraKeys&&maps.push(cm.options.extraKeys),maps.push(cm.options.keyMap),maps}function handleKeyBinding(cm,e){var startMap=getKeyMap(cm.options.keyMap),next=startMap.auto;clearTimeout(maybeTransition),next&&!isModifierKey(e)&&(maybeTransition=setTimeout(function(){getKeyMap(cm.options.keyMap)==startMap&&(cm.options.keyMap=next.call?next.call(null,cm):next,keyMapChanged(cm))},50));var name=keyName(e,!0),handled=!1;if(!name)return!1;var keymaps=allKeyMaps(cm);return handled=e.shiftKey?lookupKey("Shift-"+name,keymaps,function(b){return doHandleBinding(cm,b,!0)})||lookupKey(name,keymaps,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?doHandleBinding(cm,b):void 0}):lookupKey(name,keymaps,function(b){return doHandleBinding(cm,b)}),handled&&(e_preventDefault(e),restartBlink(cm),ie_lt9&&(e.oldKeyCode=e.keyCode,e.keyCode=0),signalLater(cm,"keyHandled",cm,name,e)),handled}function handleCharBinding(cm,e,ch){var handled=lookupKey("'"+ch+"'",allKeyMaps(cm),function(b){return doHandleBinding(cm,b,!0)});return handled&&(e_preventDefault(e),restartBlink(cm),signalLater(cm,"keyHandled",cm,"'"+ch+"'",e)),handled}function onKeyDown(e){var cm=this;if(cm.state.focused||onFocus(cm),ie&&27==e.keyCode&&(e.returnValue=!1),!(signalDOMEvent(cm,e)||cm.options.onKeyEvent&&cm.options.onKeyEvent(cm,addStop(e)))){var code=e.keyCode;cm.doc.sel.shift=16==code||e.shiftKey;var handled=handleKeyBinding(cm,e);opera&&(lastStoppedKey=handled?code:null,!handled&&88==code&&!hasCopyEvent&&(mac?e.metaKey:e.ctrlKey)&&cm.replaceSelection(""))}}function onKeyPress(e){var cm=this;if(!(signalDOMEvent(cm,e)||cm.options.onKeyEvent&&cm.options.onKeyEvent(cm,addStop(e)))){var keyCode=e.keyCode,charCode=e.charCode;if(opera&&keyCode==lastStoppedKey)return lastStoppedKey=null,void e_preventDefault(e);if(!(opera&&(!e.which||e.which<10)||khtml)||!handleKeyBinding(cm,e)){var ch=String.fromCharCode(null==charCode?keyCode:charCode);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!isReadOnly(this)&&this.doc.mode.electricChars.indexOf(ch)>-1&&setTimeout(operation(cm,function(){indentLine(cm,cm.doc.sel.to.line,"smart")}),75),handleCharBinding(cm,e,ch)||(ie&&!ie_lt9&&(cm.display.inputHasSelection=null),fastPoll(cm))}}}function onFocus(cm){"nocursor"!=cm.options.readOnly&&(cm.state.focused||(signal(cm,"focus",cm),cm.state.focused=!0,-1==cm.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(cm.display.wrapper.className+=" CodeMirror-focused"),resetInput(cm,!0)),slowPoll(cm),restartBlink(cm))}function onBlur(cm){cm.state.focused&&(signal(cm,"blur",cm),cm.state.focused=!1,cm.display.wrapper.className=cm.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(cm.display.blinker),setTimeout(function(){cm.state.focused||(cm.doc.sel.shift=!1)},150)}function onContextMenu(cm,e){function prepareSelectAllHack(){if(null!=display.input.selectionStart){var extval=display.input.value=" "+(posEq(sel.from,sel.to)?"":display.input.value);display.prevInput=" ",display.input.selectionStart=1,display.input.selectionEnd=extval.length}}function rehide(){if(display.inputDiv.style.position="relative",display.input.style.cssText=oldCSS,ie_lt9&&(display.scrollbarV.scrollTop=display.scroller.scrollTop=scrollPos),slowPoll(cm),null!=display.input.selectionStart){(!ie||ie_lt9)&&prepareSelectAllHack(),clearTimeout(detectingSelectAll);var i=0,poll=function(){" "==display.prevInput&&0==display.input.selectionStart?operation(cm,commands.selectAll)(cm):i++<10?detectingSelectAll=setTimeout(poll,500):resetInput(cm)};detectingSelectAll=setTimeout(poll,200)}}if(!signalDOMEvent(cm,e,"contextmenu")){var display=cm.display,sel=cm.doc.sel;if(!eventInWidget(display,e)){var pos=posFromMouse(cm,e),scrollPos=display.scroller.scrollTop;if(pos&&!opera){(posEq(sel.from,sel.to)||posLess(pos,sel.from)||!posLess(pos,sel.to))&&operation(cm,setSelection)(cm.doc,pos,pos);var oldCSS=display.input.style.cssText;if(display.inputDiv.style.position="absolute",display.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: white; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",focusInput(cm),resetInput(cm,!0),posEq(sel.from,sel.to)&&(display.input.value=display.prevInput=" "),ie&&!ie_lt9&&prepareSelectAllHack(),captureMiddleClick){e_stop(e);var mouseup=function(){off(window,"mouseup",mouseup),setTimeout(rehide,20)};on(window,"mouseup",mouseup)}else setTimeout(rehide,50)}}}}function clipPostChange(doc,change,pos){if(!posLess(change.from,pos))return clipPos(doc,pos);var diff=change.text.length-1-(change.to.line-change.from.line);if(pos.line>change.to.line+diff){var preLine=pos.line-diff,lastLine=doc.first+doc.size-1;return preLine>lastLine?Pos(lastLine,getLine(doc,lastLine).text.length):clipToLen(pos,getLine(doc,preLine).text.length)}if(pos.line==change.to.line+diff)return clipToLen(pos,lst(change.text).length+(1==change.text.length?change.from.ch:0)+getLine(doc,change.to.line).text.length-change.to.ch);var inside=pos.line-change.from.line;return clipToLen(pos,change.text[inside].length+(inside?0:change.from.ch))}function computeSelAfterChange(doc,change,hint){if(hint&&"object"==typeof hint)return{anchor:clipPostChange(doc,change,hint.anchor),head:clipPostChange(doc,change,hint.head)};if("start"==hint)return{anchor:change.from,head:change.from};var end=changeEnd(change);if("around"==hint)return{anchor:change.from,head:end};if("end"==hint)return{anchor:end,head:end};var adjustPos=function(pos){if(posLess(pos,change.from))return pos;if(!posLess(change.to,pos))return end;var line=pos.line+change.text.length-(change.to.line-change.from.line)-1,ch=pos.ch;return pos.line==change.to.line&&(ch+=end.ch-change.to.ch),Pos(line,ch)};return{anchor:adjustPos(doc.sel.anchor),head:adjustPos(doc.sel.head)}}function filterChange(doc,change,update){var obj={canceled:!1,from:change.from,to:change.to,text:change.text,origin:change.origin,cancel:function(){this.canceled=!0}};return update&&(obj.update=function(from,to,text,origin){from&&(this.from=clipPos(doc,from)),to&&(this.to=clipPos(doc,to)),text&&(this.text=text),void 0!==origin&&(this.origin=origin)}),signal(doc,"beforeChange",doc,obj),doc.cm&&signal(doc.cm,"beforeChange",doc.cm,obj),obj.canceled?null:{from:obj.from,to:obj.to,text:obj.text,origin:obj.origin}}function makeChange(doc,change,selUpdate,ignoreReadOnly){if(doc.cm){if(!doc.cm.curOp)return operation(doc.cm,makeChange)(doc,change,selUpdate,ignoreReadOnly);if(doc.cm.state.suppressEdits)return}if(!(hasHandler(doc,"beforeChange")||doc.cm&&hasHandler(doc.cm,"beforeChange"))||(change=filterChange(doc,change,!0))){var split=sawReadOnlySpans&&!ignoreReadOnly&&removeReadOnlyRanges(doc,change.from,change.to);if(split){for(var i=split.length-1;i>=1;--i)makeChangeNoReadonly(doc,{from:split[i].from,to:split[i].to,text:[""]});split.length&&makeChangeNoReadonly(doc,{from:split[0].from,to:split[0].to,text:change.text},selUpdate)}else makeChangeNoReadonly(doc,change,selUpdate)}}function makeChangeNoReadonly(doc,change,selUpdate){var selAfter=computeSelAfterChange(doc,change,selUpdate);addToHistory(doc,change,selAfter,doc.cm?doc.cm.curOp.id:0/0),makeChangeSingleDoc(doc,change,selAfter,stretchSpansOverChange(doc,change));var rebased=[];linkedDocs(doc,function(doc,sharedHist){sharedHist||-1!=indexOf(rebased,doc.history)||(rebaseHist(doc.history,change),rebased.push(doc.history)),makeChangeSingleDoc(doc,change,null,stretchSpansOverChange(doc,change))})}function makeChangeFromHistory(doc,type){if(!doc.cm||!doc.cm.state.suppressEdits){var hist=doc.history,event=("undo"==type?hist.done:hist.undone).pop();if(event){var anti={changes:[],anchorBefore:event.anchorAfter,headBefore:event.headAfter,anchorAfter:event.anchorBefore,headAfter:event.headBefore,generation:hist.generation};("undo"==type?hist.undone:hist.done).push(anti),hist.generation=event.generation||++hist.maxGeneration;for(var filter=hasHandler(doc,"beforeChange")||doc.cm&&hasHandler(doc.cm,"beforeChange"),i=event.changes.length-1;i>=0;--i){var change=event.changes[i];if(change.origin=type,filter&&!filterChange(doc,change,!1))return void(("undo"==type?hist.done:hist.undone).length=0);anti.changes.push(historyChangeFromChange(doc,change));var after=i?computeSelAfterChange(doc,change,null):{anchor:event.anchorBefore,head:event.headBefore};makeChangeSingleDoc(doc,change,after,mergeOldSpans(doc,change));var rebased=[];linkedDocs(doc,function(doc,sharedHist){sharedHist||-1!=indexOf(rebased,doc.history)||(rebaseHist(doc.history,change),rebased.push(doc.history)),makeChangeSingleDoc(doc,change,null,mergeOldSpans(doc,change))})}}}}function shiftDoc(doc,distance){function shiftPos(pos){return Pos(pos.line+distance,pos.ch)}doc.first+=distance,doc.cm&®Change(doc.cm,doc.first,doc.first,distance),doc.sel.head=shiftPos(doc.sel.head),doc.sel.anchor=shiftPos(doc.sel.anchor),doc.sel.from=shiftPos(doc.sel.from),doc.sel.to=shiftPos(doc.sel.to)}function makeChangeSingleDoc(doc,change,selAfter,spans){if(doc.cm&&!doc.cm.curOp)return operation(doc.cm,makeChangeSingleDoc)(doc,change,selAfter,spans);if(change.to.linedoc.lastLine())){if(change.from.linelast&&(change={from:change.from,to:Pos(last,getLine(doc,last).text.length),text:[change.text[0]],origin:change.origin}),change.removed=getBetween(doc,change.from,change.to),selAfter||(selAfter=computeSelAfterChange(doc,change,null)),doc.cm?makeChangeSingleDocInEditor(doc.cm,change,spans,selAfter):updateDoc(doc,change,spans,selAfter)}}function makeChangeSingleDocInEditor(cm,change,spans,selAfter){var doc=cm.doc,display=cm.display,from=change.from,to=change.to,recomputeMaxLength=!1,checkWidthStart=from.line;cm.options.lineWrapping||(checkWidthStart=lineNo(visualLine(doc,getLine(doc,from.line))),doc.iter(checkWidthStart,to.line+1,function(line){return line==display.maxLine?(recomputeMaxLength=!0,!0):void 0})),posLess(doc.sel.head,change.from)||posLess(change.to,doc.sel.head)||(cm.curOp.cursorActivity=!0),updateDoc(doc,change,spans,selAfter,estimateHeight(cm)),cm.options.lineWrapping||(doc.iter(checkWidthStart,from.line+change.text.length,function(line){var len=lineLength(doc,line);len>display.maxLineLength&&(display.maxLine=line,display.maxLineLength=len,display.maxLineChanged=!0,recomputeMaxLength=!1)}),recomputeMaxLength&&(cm.curOp.updateMaxLine=!0)),doc.frontier=Math.min(doc.frontier,from.line),startWorker(cm,400);var lendiff=change.text.length-(to.line-from.line)-1;if(regChange(cm,from.line,to.line+1,lendiff),hasHandler(cm,"change")){var changeObj={from:from,to:to,text:change.text,removed:change.removed,origin:change.origin};if(cm.curOp.textChanged){for(var cur=cm.curOp.textChanged;cur.next;cur=cur.next);cur.next=changeObj}else cm.curOp.textChanged=changeObj}}function replaceRange(doc,code,from,to,origin){if(to||(to=from),posLess(to,from)){var tmp=to;to=from,from=tmp}"string"==typeof code&&(code=splitLines(code)),makeChange(doc,{from:from,to:to,text:code,origin:origin},null)}function Pos(line,ch){return this instanceof Pos?(this.line=line,void(this.ch=ch)):new Pos(line,ch)}function posEq(a,b){return a.line==b.line&&a.ch==b.ch}function posLess(a,b){return a.linelast?Pos(last,getLine(doc,last).text.length):clipToLen(pos,getLine(doc,pos.line).text.length)}function clipToLen(pos,linelen){var ch=pos.ch;return null==ch||ch>linelen?Pos(pos.line,linelen):0>ch?Pos(pos.line,0):pos}function isLine(doc,l){return l>=doc.first&&l=curPos.ch:sp.to>curPos.ch))){if(mayClear&&(signal(m,"beforeCursorEnter"),m.explicitlyCleared)){if(line.markedSpans){--i;continue}break}if(!m.atomic)continue;var newPos=m.find()[0>dir?"from":"to"];if(posEq(newPos,curPos)&&(newPos.ch+=dir,newPos.ch<0?newPos=newPos.line>doc.first?clipPos(doc,Pos(newPos.line-1)):null:newPos.ch>line.text.length&&(newPos=newPos.line(window.innerHeight||document.documentElement.clientHeight)&&(doScroll=!1),null!=doScroll&&!phantom){var hidden="none"==display.cursor.style.display;hidden&&(display.cursor.style.display="",display.cursor.style.left=coords.left+"px",display.cursor.style.top=coords.top-display.viewOffset+"px"),display.cursor.scrollIntoView(doScroll),hidden&&(display.cursor.style.display="none")}}}function scrollPosIntoView(cm,pos,margin){for(null==margin&&(margin=0);;){var changed=!1,coords=cursorCoords(cm,pos),scrollPos=calculateScrollPos(cm,coords.left,coords.top-margin,coords.left,coords.bottom+margin),startTop=cm.doc.scrollTop,startLeft=cm.doc.scrollLeft;if(null!=scrollPos.scrollTop&&(setScrollTop(cm,scrollPos.scrollTop),Math.abs(cm.doc.scrollTop-startTop)>1&&(changed=!0)),null!=scrollPos.scrollLeft&&(setScrollLeft(cm,scrollPos.scrollLeft),Math.abs(cm.doc.scrollLeft-startLeft)>1&&(changed=!0)),!changed)return coords}}function scrollIntoView(cm,x1,y1,x2,y2){var scrollPos=calculateScrollPos(cm,x1,y1,x2,y2);null!=scrollPos.scrollTop&&setScrollTop(cm,scrollPos.scrollTop),null!=scrollPos.scrollLeft&&setScrollLeft(cm,scrollPos.scrollLeft)}function calculateScrollPos(cm,x1,y1,x2,y2){var display=cm.display,snapMargin=textHeight(cm.display);0>y1&&(y1=0);var screen=display.scroller.clientHeight-scrollerCutOff,screentop=display.scroller.scrollTop,result={},docBottom=cm.doc.height+paddingVert(display),atTop=snapMargin>y1,atBottom=y2>docBottom-snapMargin;if(screentop>y1)result.scrollTop=atTop?0:y1;else if(y2>screentop+screen){var newTop=Math.min(y1,(atBottom?docBottom:y2)-screen);newTop!=screentop&&(result.scrollTop=newTop)}var screenw=display.scroller.clientWidth-scrollerCutOff,screenleft=display.scroller.scrollLeft;x1+=display.gutters.offsetWidth,x2+=display.gutters.offsetWidth;var gutterw=display.gutters.offsetWidth,atLeft=gutterw+10>x1;return screenleft+gutterw>x1||atLeft?(atLeft&&(x1=0),result.scrollLeft=Math.max(0,x1-10-gutterw)):x2>screenw+screenleft-3&&(result.scrollLeft=x2+10-screenw),result}function updateScrollPos(cm,left,top){cm.curOp.updateScrollPos={scrollLeft:null==left?cm.doc.scrollLeft:left,scrollTop:null==top?cm.doc.scrollTop:top}}function addToScrollPos(cm,left,top){var pos=cm.curOp.updateScrollPos||(cm.curOp.updateScrollPos={scrollLeft:cm.doc.scrollLeft,scrollTop:cm.doc.scrollTop}),scroll=cm.display.scroller;pos.scrollTop=Math.max(0,Math.min(scroll.scrollHeight-scroll.clientHeight,pos.scrollTop+top)),pos.scrollLeft=Math.max(0,Math.min(scroll.scrollWidth-scroll.clientWidth,pos.scrollLeft+left))}function indentLine(cm,n,how,aggressive){var doc=cm.doc;if(null==how&&(how="add"),"smart"==how)if(cm.doc.mode.indent)var state=getStateBefore(cm,n);else how="prev";var indentation,tabSize=cm.options.tabSize,line=getLine(doc,n),curSpace=countColumn(line.text,null,tabSize),curSpaceString=line.text.match(/^\s*/)[0];if("smart"==how&&(indentation=cm.doc.mode.indent(state,line.text.slice(curSpaceString.length),line.text),indentation==Pass)){if(!aggressive)return;how="prev"}"prev"==how?indentation=n>doc.first?countColumn(getLine(doc,n-1).text,null,tabSize):0:"add"==how?indentation=curSpace+cm.options.indentUnit:"subtract"==how?indentation=curSpace-cm.options.indentUnit:"number"==typeof how&&(indentation=curSpace+how),indentation=Math.max(0,indentation);var indentString="",pos=0;if(cm.options.indentWithTabs)for(var i=Math.floor(indentation/tabSize);i;--i)pos+=tabSize,indentString+=" ";indentation>pos&&(indentString+=spaceStr(indentation-pos)),indentString!=curSpaceString&&replaceRange(cm.doc,indentString,Pos(n,0),Pos(n,curSpaceString.length),"+input"),line.stateAfter=null}function changeLine(cm,handle,op){var no=handle,line=handle,doc=cm.doc;return"number"==typeof handle?line=getLine(doc,clipLine(doc,handle)):no=lineNo(handle),null==no?null:op(line,no)?(regChange(cm,no,no+1),line):null}function findPosH(doc,pos,dir,unit,visually){function findNextLine(){var l=line+dir;return l=doc.first+doc.size?possible=!1:(line=l,lineObj=getLine(doc,l))}function moveOnce(boundToLine){var next=(visually?moveVisually:moveLogically)(lineObj,ch,dir,!0);if(null==next){if(boundToLine||!findNextLine())return possible=!1;ch=visually?(0>dir?lineRight:lineLeft)(lineObj):0>dir?lineObj.text.length:0}else ch=next;return!0}var line=pos.line,ch=pos.ch,origDir=dir,lineObj=getLine(doc,line),possible=!0;if("char"==unit)moveOnce();else if("column"==unit)moveOnce(!0);else if("word"==unit||"group"==unit)for(var sawType=null,group="group"==unit,first=!0;!(0>dir)||moveOnce(!first);first=!1){var cur=lineObj.text.charAt(ch)||"\n",type=isWordChar(cur)?"w":group?/\s/.test(cur)?null:"p":null;if(sawType&&sawType!=type){0>dir&&(dir=1,moveOnce());break}if(type&&(sawType=type),dir>0&&!moveOnce(!first))break}var result=skipAtomic(doc,Pos(line,ch),origDir,!0);return possible||(result.hitSide=!0),result}function findPosV(cm,pos,dir,unit){var y,doc=cm.doc,x=pos.left;if("page"==unit){var pageSize=Math.min(cm.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);y=pos.top+dir*(pageSize-(0>dir?1.5:.5)*textHeight(cm.display))}else"line"==unit&&(y=dir>0?pos.bottom+3:pos.top-3);for(;;){var target=coordsChar(cm,x,y);if(!target.outside)break;if(0>dir?0>=y:y>=doc.height){target.hitSide=!0;break}y+=5*dir}return target}function findWordAt(line,pos){var start=pos.ch,end=pos.ch;if(line){(pos.xRel<0||end==line.length)&&start?--start:++end;for(var startChar=line.charAt(start),check=isWordChar(startChar)?isWordChar:/\s/.test(startChar)?function(ch){return/\s/.test(ch)}:function(ch){return!/\s/.test(ch)&&!isWordChar(ch)};start>0&&check(line.charAt(start-1));)--start;for(;endi;++i){var done=lookup(fallthrough[i]);if(done)return done}return!1}for(var i=0;i=startCh:span.to>startCh);(nw||(nw=[])).push({from:span.from,to:endsAfter?null:span.to,marker:marker})}}return nw}function markedSpansAfter(old,endCh,isInsert){if(old)for(var nw,i=0;i=endCh:span.to>endCh);if(endsAfter||"bookmark"==marker.type&&span.from==endCh&&(!isInsert||span.marker.insertLeft)){var startsBefore=null==span.from||(marker.inclusiveLeft?span.from<=endCh:span.from0&&first)for(var i=0;ii;++i)newMarkers.push(gapMarkers);newMarkers.push(last)}return newMarkers}function mergeOldSpans(doc,change){var old=getOldSpans(doc,change),stretched=stretchSpansOverChange(doc,change);if(!old)return stretched;if(!stretched)return old;for(var i=0;ich)&&(!found||found.widthcm.options.maxHighlightLength?(flattenSpans=!1,stream.pos=Math.min(text.length,stream.start+5e4),style=null):style=mode.token(stream,state),flattenSpans&&curStyle==style||(curStartat;){var i_end=st[i];i_end>end&&st.splice(i,1,end,st[i+1],i_end),i+=2,at=Math.min(end,i_end)}if(style)if(overlay.opaque)st.splice(start,i-start,end,style),i=start+2;else for(;i>start;start+=2){var cur=st[start+1];st[start+1]=cur?cur+" "+style:style}})}return st}function getLineStyles(cm,line){return line.styles&&line.styles[0]==cm.state.modeGen||(line.styles=highlightLine(cm,line,line.stateAfter=getStateBefore(cm,lineNo(line)))),line.styles}function processLine(cm,line,state){var mode=cm.doc.mode,stream=new StringStream(line.text,cm.options.tabSize);for(""==line.text&&mode.blankLine&&mode.blankLine(state);!stream.eol()&&stream.pos<=cm.options.maxHighlightLength;)mode.token(stream,state),stream.start=stream.pos}function styleToClass(style){return style?styleToClassCache[style]||(styleToClassCache[style]="cm-"+style.replace(/ +/g," cm-")):null}function lineContent(cm,realLine,measure,copyWidgets){for(var merged,line=realLine,empty=!0;merged=collapsedSpanAtStart(line);)line=getLine(cm.doc,merged.find().from.line);var builder={pre:elt("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:cm,copyWidgets:copyWidgets};line.textClass&&(builder.pre.className=line.textClass);do{line.text&&(empty=!1),builder.measure=line==realLine&&measure,builder.pos=0,builder.addToken=builder.measure?buildTokenMeasure:buildToken,(ie||webkit)&&cm.getOption("lineWrapping")&&(builder.addToken=buildTokenSplitSpaces(builder.addToken));var next=insertLineContent(line,builder,getLineStyles(cm,line));measure&&line==realLine&&!builder.measuredSomething&&(measure[0]=builder.pre.appendChild(zeroWidthElement(cm.display.measure)),builder.measuredSomething=!0),next&&(line=getLine(cm.doc,next.to.line))}while(next);!measure||builder.measuredSomething||measure[0]||(measure[0]=builder.pre.appendChild(empty?elt("span"," "):zeroWidthElement(cm.display.measure))),builder.pre.firstChild||lineIsHidden(cm.doc,realLine)||builder.pre.appendChild(document.createTextNode(" "));var order;if(measure&&ie&&(order=getOrder(line))){var l=order.length-1;order[l].from==order[l].to&&--l;var last=order[l],prev=order[l-1];if(last.from+1==last.to&&prev&&last.level="�"&&"�">ch&&ipos)?(null!=sp.to&&nextChange>sp.to&&(nextChange=sp.to,spanEndStyle=""),m.className&&(spanStyle+=" "+m.className),m.startStyle&&sp.from==pos&&(spanStartStyle+=" "+m.startStyle),m.endStyle&&sp.to==nextChange&&(spanEndStyle+=" "+m.endStyle),m.title&&!title&&(title=m.title),m.collapsed&&(!collapsed||collapsed.marker.sizepos&&nextChange>sp.from&&(nextChange=sp.from),"bookmark"==m.type&&sp.from==pos&&m.replacedWith&&(foundBookmark=m)}if(collapsed&&(collapsed.from||0)==pos&&(buildCollapsedSpan(builder,(null==collapsed.to?len:collapsed.to)-pos,collapsed.marker,null==collapsed.from),null==collapsed.to))return collapsed.marker.find();foundBookmark&&!collapsed&&buildCollapsedSpan(builder,0,foundBookmark)}if(pos>=len)break;for(var upto=Math.min(len,nextChange);;){if(text){var end=pos+text.length;if(!collapsed){var tokenText=end>upto?text.slice(0,upto-pos):text;builder.addToken(builder,tokenText,style?style+spanStyle:spanStyle,spanStartStyle,pos+tokenText.length==nextChange?spanEndStyle:"",title)}if(end>=upto){text=text.slice(upto-pos),pos=upto;break}pos=end,spanStartStyle=""}text=allText.slice(at,at=styles[i++]),style=styleToClass(styles[i++])}}else for(var i=1;ii;++i)added.push(new Line(text[i],spansFor(i),estimateHeight));update(lastLine,lastLine.text,lastSpans),nlines&&doc.remove(from.line,nlines),added.length&&doc.insert(from.line,added)}else if(firstLine==lastLine)if(1==text.length)update(firstLine,firstLine.text.slice(0,from.ch)+lastText+firstLine.text.slice(to.ch),lastSpans);else{for(var added=[],i=1,e=text.length-1;e>i;++i)added.push(new Line(text[i],spansFor(i),estimateHeight));added.push(new Line(lastText+firstLine.text.slice(to.ch),lastSpans,estimateHeight)),update(firstLine,firstLine.text.slice(0,from.ch)+text[0],spansFor(0)),doc.insert(from.line+1,added)}else if(1==text.length)update(firstLine,firstLine.text.slice(0,from.ch)+text[0]+lastLine.text.slice(to.ch),spansFor(0)),doc.remove(from.line+1,nlines);else{update(firstLine,firstLine.text.slice(0,from.ch)+text[0],spansFor(0)),update(lastLine,lastText+lastLine.text.slice(to.ch),lastSpans);for(var i=1,e=text.length-1,added=[];e>i;++i)added.push(new Line(text[i],spansFor(i),estimateHeight));nlines>1&&doc.remove(from.line+1,nlines-1),doc.insert(from.line+1,added)}signalLater(doc,"change",doc,change),setSelection(doc,selAfter.anchor,selAfter.head,null,!0)}function LeafChunk(lines){this.lines=lines,this.parent=null;for(var i=0,e=lines.length,height=0;e>i;++i)lines[i].parent=this,height+=lines[i].height;this.height=height}function BranchChunk(children){this.children=children;for(var size=0,height=0,i=0,e=children.length;e>i;++i){var ch=children[i];size+=ch.chunkSize(),height+=ch.height,ch.parent=this}this.size=size,this.height=height,this.parent=null}function linkedDocs(doc,f,sharedHistOnly){function propagate(doc,skip,sharedHist){if(doc.linked)for(var i=0;in){chunk=child;break}n-=sz}return chunk.lines[n]}function getBetween(doc,start,end){var out=[],n=start.line;return doc.iter(start.line,end.line+1,function(line){var text=line.text;n==end.line&&(text=text.slice(0,end.ch)),n==start.line&&(text=text.slice(start.ch)),out.push(text),++n}),out}function getLines(doc,from,to){var out=[];return doc.iter(from,to,function(line){out.push(line.text)}),out}function updateLineHeight(line,height){for(var diff=height-line.height,n=line;n;n=n.parent)n.height+=diff}function lineNo(line){if(null==line.parent)return null;for(var cur=line.parent,no=indexOf(cur.lines,line),chunk=cur.parent;chunk;cur=chunk,chunk=chunk.parent)for(var i=0;chunk.children[i]!=cur;++i)no+=chunk.children[i].chunkSize();return no+cur.first}function lineAtHeight(chunk,h){var n=chunk.first;outer:do{for(var i=0,e=chunk.children.length;e>i;++i){var child=chunk.children[i],ch=child.height;if(ch>h){chunk=child;continue outer}h-=ch,n+=child.chunkSize()}return n}while(!chunk.lines);for(var i=0,e=chunk.lines.length;e>i;++i){var line=chunk.lines[i],lh=line.height;if(lh>h)break;h-=lh}return n+i}function heightAtLine(cm,lineObj){lineObj=visualLine(cm.doc,lineObj);for(var h=0,chunk=lineObj.parent,i=0;itime-doc.cm.options.historyEventDelay||"*"==change.origin.charAt(0)))){var last=lst(cur.changes);posEq(change.from,change.to)&&posEq(change.from,last.to)?last.to=changeEnd(change):cur.changes.push(historyChangeFromChange(doc,change)),cur.anchorAfter=selAfter.anchor,cur.headAfter=selAfter.head}else for(cur={changes:[historyChangeFromChange(doc,change)],generation:hist.generation,anchorBefore:doc.sel.anchor,headBefore:doc.sel.head,anchorAfter:selAfter.anchor,headAfter:selAfter.head},hist.done.push(cur),hist.generation=++hist.maxGeneration;hist.done.length>hist.undoDepth;)hist.done.shift();hist.lastTime=time,hist.lastOp=opId,hist.lastOrigin=change.origin}function removeClearedSpans(spans){if(!spans)return null;for(var out,i=0;i-1&&(lst(newChanges)[prop]=change[prop],delete change[prop])}}return copy}function rebaseHistSel(pos,from,to,diff){to0}function eventMixin(ctor){ctor.prototype.on=function(type,f){on(this,type,f)},ctor.prototype.off=function(type,f){off(this,type,f)}}function Delayed(){this.id=null}function countColumn(string,end,tabSize,startIndex,startValue){null==end&&(end=string.search(/[^\s\u00a0]/),-1==end&&(end=string.length));for(var i=startIndex||0,n=startValue||0;end>i;++i)" "==string.charAt(i)?n+=tabSize-n%tabSize:++n;return n}function spaceStr(n){for(;spaceStrs.length<=n;)spaceStrs.push(lst(spaceStrs)+" ");return spaceStrs[n]}function lst(arr){return arr[arr.length-1]}function selectInput(node){if(ios)node.selectionStart=0,node.selectionEnd=node.value.length;else try{node.select()}catch(_e){}}function indexOf(collection,elt){if(collection.indexOf)return collection.indexOf(elt);for(var i=0,e=collection.length;e>i;++i)if(collection[i]==elt)return i;return-1}function createObj(base,props){function Obj(){}Obj.prototype=base;var inst=new Obj;return props&©Obj(props,inst),inst}function copyObj(obj,target){target||(target={});for(var prop in obj)obj.hasOwnProperty(prop)&&(target[prop]=obj[prop]);return target}function emptyArray(size){for(var a=[],i=0;size>i;++i)a.push(void 0);return a}function bind(f){var args=Array.prototype.slice.call(arguments,1);return function(){return f.apply(null,args)}}function isWordChar(ch){return/\w/.test(ch)||ch>""&&(ch.toUpperCase()!=ch.toLowerCase()||nonASCIISingleCaseWordChar.test(ch))}function isEmpty(obj){for(var n in obj)if(obj.hasOwnProperty(n)&&obj[n])return!1;return!0}function elt(tag,content,className,style){var e=document.createElement(tag);if(className&&(e.className=className),style&&(e.style.cssText=style),"string"==typeof content)setTextContent(e,content);else if(content)for(var i=0;i0;--count)e.removeChild(e.firstChild);return e}function removeChildrenAndAdd(parent,e){return removeChildren(parent).appendChild(e)}function setTextContent(e,str){ie_lt9?(e.innerHTML="",e.appendChild(document.createTextNode(str))):e.textContent=str}function getRect(node){return node.getBoundingClientRect()}function spanAffectsWrapping(){return!1}function scrollbarWidth(measure){if(null!=knownScrollbarWidth)return knownScrollbarWidth;var test=elt("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return removeChildrenAndAdd(measure,test),test.offsetWidth&&(knownScrollbarWidth=test.offsetHeight-test.clientHeight),knownScrollbarWidth||0}function zeroWidthElement(measure){if(null==zwspSupported){var test=elt("span","");removeChildrenAndAdd(measure,elt("span",[test,document.createTextNode("x")])),0!=measure.firstChild.offsetHeight&&(zwspSupported=test.offsetWidth<=1&&test.offsetHeight>2&&!ie_lt8)}return zwspSupported?elt("span",""):elt("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function iterateBidiSections(order,from,to,f){if(!order)return f(from,to,"ltr");for(var found=!1,i=0;ifrom||from==to&&part.to==from)&&(f(Math.max(part.from,from),Math.min(part.to,to),1==part.level?"rtl":"ltr"),found=!0)}found||f(from,to,"ltr")}function bidiLeft(part){return part.level%2?part.to:part.from}function bidiRight(part){return part.level%2?part.from:part.to}function lineLeft(line){var order=getOrder(line);return order?bidiLeft(order[0]):0}function lineRight(line){var order=getOrder(line);return order?bidiRight(lst(order)):line.text.length}function lineStart(cm,lineN){var line=getLine(cm.doc,lineN),visual=visualLine(cm.doc,line);visual!=line&&(lineN=lineNo(visual));var order=getOrder(visual),ch=order?order[0].level%2?lineRight(visual):lineLeft(visual):0;return Pos(lineN,ch)}function lineEnd(cm,lineN){for(var merged,line;merged=collapsedSpanAtEnd(line=getLine(cm.doc,lineN));)lineN=merged.find().to.line;var order=getOrder(line),ch=order?order[0].level%2?lineLeft(line):lineRight(line):line.text.length;return Pos(lineN,ch)}function compareBidiLevel(order,a,b){var linedir=order[0].level;return a==linedir?!0:b==linedir?!1:b>a}function getBidiPartAt(order,pos){for(var found,i=0;ipos)return bidiOther=null,i;if(cur.from==pos||cur.to==pos){if(null!=found)return compareBidiLevel(order,cur.level,order[found].level)?(bidiOther=found,i):(bidiOther=i,found);found=i}}return bidiOther=null,found}function moveInLine(line,pos,dir,byUnit){if(!byUnit)return pos+dir;do pos+=dir;while(pos>0&&isExtendingChar.test(line.text.charAt(pos)));return pos}function moveVisually(line,start,dir,byUnit){var bidi=getOrder(line);if(!bidi)return moveLogically(line,start,dir,byUnit);for(var pos=getBidiPartAt(bidi,start),part=bidi[pos],target=moveInLine(line,start,part.level%2?-dir:dir,byUnit);;){if(target>part.from&&target0==part.level%2?part.to:part.from);if(part=bidi[pos+=dir],!part)return null;target=dir>0==part.level%2?moveInLine(line,part.to,-1,byUnit):moveInLine(line,part.from,1,byUnit)}}function moveLogically(line,start,dir,byUnit){var target=start+dir;if(byUnit)for(;target>0&&isExtendingChar.test(line.text.charAt(target));)target+=dir;return 0>target||target>line.text.length?null:target}var gecko=/gecko\/\d/i.test(navigator.userAgent),ie=/MSIE \d/.test(navigator.userAgent),ie_lt8=ie&&(null==document.documentMode||document.documentMode<8),ie_lt9=ie&&(null==document.documentMode||document.documentMode<9),webkit=/WebKit\//.test(navigator.userAgent),qtwebkit=webkit&&/Qt\/\d+\.\d+/.test(navigator.userAgent),chrome=/Chrome\//.test(navigator.userAgent),opera=/Opera\//.test(navigator.userAgent),safari=/Apple Computer/.test(navigator.vendor),khtml=/KHTML\//.test(navigator.userAgent),mac_geLion=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),mac_geMountainLion=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),phantom=/PhantomJS/.test(navigator.userAgent),ios=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),mobile=ios||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),mac=ios||/Mac/.test(navigator.platform),windows=/windows/i.test(navigator.platform),opera_version=opera&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);opera_version&&(opera_version=Number(opera_version[1])),opera_version&&opera_version>=15&&(opera=!1,webkit=!0);var measureText,lastClick,lastDoubleClick,flipCtrlCmd=mac&&(qtwebkit||opera&&(null==opera_version||12.11>opera_version)),captureMiddleClick=gecko||ie&&!ie_lt9,sawReadOnlySpans=!1,sawCollapsedSpans=!1,nextOpId=0,lastDrop=0,wheelSamples=0,wheelPixelsPerUnit=null;ie?wheelPixelsPerUnit=-.53:gecko?wheelPixelsPerUnit=15:chrome?wheelPixelsPerUnit=-.7:safari&&(wheelPixelsPerUnit=-1/3);var maybeTransition,detectingSelectAll,lastStoppedKey=null,changeEnd=CodeMirror.changeEnd=function(change){return change.text?Pos(change.from.line+change.text.length-1,lst(change.text).length+(1==change.text.length?change.from.ch:0)):change.to};CodeMirror.Pos=Pos,CodeMirror.prototype={constructor:CodeMirror,focus:function(){window.focus(),focusInput(this),onFocus(this),fastPoll(this)},setOption:function(option,value){var options=this.options,old=options[option];(options[option]!=value||"mode"==option)&&(options[option]=value,optionHandlers.hasOwnProperty(option)&&operation(this,optionHandlers[option])(this,value,old))},getOption:function(option){return this.options[option]},getDoc:function(){return this.doc},addKeyMap:function(map,bottom){this.state.keyMaps[bottom?"push":"unshift"](map)},removeKeyMap:function(map){for(var maps=this.state.keyMaps,i=0;i=i;++i)indentLine(this,i,how)}),getTokenAt:function(pos,precise){var doc=this.doc;pos=clipPos(doc,pos);for(var state=getStateBefore(this,pos.line,precise),mode=this.doc.mode,line=getLine(doc,pos.line),stream=new StringStream(line.text,this.options.tabSize);stream.pos>1;if((mid?styles[2*mid-1]:0)>=ch)after=mid;else{if(!(styles[2*mid+1]last&&(line=last,end=!0);var lineObj=getLine(this.doc,line);return intoCoordSystem(this,getLine(this.doc,line),{top:0,left:0},mode||"page").top+(end?lineObj.height:0)},defaultTextHeight:function(){return textHeight(this.display)},defaultCharWidth:function(){return charWidth(this.display)},setGutterMarker:operation(null,function(line,gutterID,value){return changeLine(this,line,function(line){var markers=line.gutterMarkers||(line.gutterMarkers={});return markers[gutterID]=value,!value&&isEmpty(markers)&&(line.gutterMarkers=null),!0})}),clearGutter:operation(null,function(gutterID){var cm=this,doc=cm.doc,i=doc.first;doc.iter(function(line){line.gutterMarkers&&line.gutterMarkers[gutterID]&&(line.gutterMarkers[gutterID]=null,regChange(cm,i,i+1),isEmpty(line.gutterMarkers)&&(line.gutterMarkers=null)),++i})}),addLineClass:operation(null,function(handle,where,cls){return changeLine(this,handle,function(line){var prop="text"==where?"textClass":"background"==where?"bgClass":"wrapClass";if(line[prop]){if(new RegExp("(?:^|\\s)"+cls+"(?:$|\\s)").test(line[prop]))return!1;line[prop]+=" "+cls}else line[prop]=cls;return!0})}),removeLineClass:operation(null,function(handle,where,cls){return changeLine(this,handle,function(line){var prop="text"==where?"textClass":"background"==where?"bgClass":"wrapClass",cur=line[prop];if(!cur)return!1;if(null==cls)line[prop]=null;else{var found=cur.match(new RegExp("(?:^|\\s+)"+cls+"(?:$|\\s+)"));if(!found)return!1;var end=found.index+found[0].length;line[prop]=cur.slice(0,found.index)+(found.index&&end!=cur.length?" ":"")+cur.slice(end)||null}return!0})}),addLineWidget:operation(null,function(handle,node,options){return addLineWidget(this,handle,node,options)}),removeLineWidget:function(widget){widget.clear()},lineInfo:function(line){if("number"==typeof line){if(!isLine(this.doc,line))return null;var n=line;if(line=getLine(this.doc,line),!line)return null}else{var n=lineNo(line);if(null==n)return null}return{line:n,handle:line,text:line.text,gutterMarkers:line.gutterMarkers,textClass:line.textClass,bgClass:line.bgClass,wrapClass:line.wrapClass,widgets:line.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(pos,node,scroll,vert,horiz){var display=this.display;pos=cursorCoords(this,clipPos(this.doc,pos));var top=pos.bottom,left=pos.left;if(node.style.position="absolute",display.sizer.appendChild(node),"over"==vert)top=pos.top;else if("above"==vert||"near"==vert){var vspace=Math.max(display.wrapper.clientHeight,this.doc.height),hspace=Math.max(display.sizer.clientWidth,display.lineSpace.clientWidth);("above"==vert||pos.bottom+node.offsetHeight>vspace)&&pos.top>node.offsetHeight?top=pos.top-node.offsetHeight:pos.bottom+node.offsetHeight<=vspace&&(top=pos.bottom),left+node.offsetWidth>hspace&&(left=hspace-node.offsetWidth)}node.style.top=top+"px",node.style.left=node.style.right="","right"==horiz?(left=display.sizer.clientWidth-node.offsetWidth,node.style.right="0px"):("left"==horiz?left=0:"middle"==horiz&&(left=(display.sizer.clientWidth-node.offsetWidth)/2),node.style.left=left+"px"),scroll&&scrollIntoView(this,left,top,left+node.offsetWidth,top+node.offsetHeight)},triggerOnKeyDown:operation(null,onKeyDown),execCommand:function(cmd){return commands[cmd](this)},findPosH:function(from,amount,unit,visually){var dir=1;0>amount&&(dir=-1,amount=-amount);for(var i=0,cur=clipPos(this.doc,from);amount>i&&(cur=findPosH(this.doc,cur,dir,unit,visually),!cur.hitSide);++i);return cur},moveH:operation(null,function(dir,unit){var pos,sel=this.doc.sel;pos=sel.shift||sel.extend||posEq(sel.from,sel.to)?findPosH(this.doc,sel.head,dir,unit,this.options.rtlMoveVisually):0>dir?sel.from:sel.to,extendSelection(this.doc,pos,pos,dir)}),deleteH:operation(null,function(dir,unit){var sel=this.doc.sel;posEq(sel.from,sel.to)?replaceRange(this.doc,"",sel.from,findPosH(this.doc,sel.head,dir,unit,!1),"+delete"):replaceRange(this.doc,"",sel.from,sel.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(from,amount,unit,goalColumn){var dir=1,x=goalColumn;0>amount&&(dir=-1,amount=-amount);for(var i=0,cur=clipPos(this.doc,from);amount>i;++i){var coords=cursorCoords(this,cur,"div");if(null==x?x=coords.left:coords.left=x,cur=findPosV(this,coords,dir,unit),cur.hitSide)break}return cur},moveV:operation(null,function(dir,unit){var sel=this.doc.sel,pos=cursorCoords(this,sel.head,"div");null!=sel.goalColumn&&(pos.left=sel.goalColumn);var target=findPosV(this,pos,dir,unit);"page"==unit&&addToScrollPos(this,0,charCoords(this,target,"div").top-pos.top),extendSelection(this.doc,target,target,dir),sel.goalColumn=pos.left}),toggleOverwrite:function(value){(null==value||value!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:operation(null,function(x,y){updateScrollPos(this,x,y)}),getScrollInfo:function(){var scroller=this.display.scroller,co=scrollerCutOff;return{left:scroller.scrollLeft,top:scroller.scrollTop,height:scroller.scrollHeight-co,width:scroller.scrollWidth-co,clientHeight:scroller.clientHeight-co,clientWidth:scroller.clientWidth-co}},scrollIntoView:operation(null,function(pos,margin){"number"==typeof pos&&(pos=Pos(pos,0)),margin||(margin=0);var coords=pos;pos&&null==pos.line||(this.curOp.scrollToPos=pos?clipPos(this.doc,pos):this.doc.sel.head,this.curOp.scrollToPosMargin=margin,coords=cursorCoords(this,this.curOp.scrollToPos));var sPos=calculateScrollPos(this,coords.left,coords.top-margin,coords.right,coords.bottom+margin);updateScrollPos(this,sPos.scrollLeft,sPos.scrollTop)}),setSize:operation(null,function(width,height){function interpret(val){return"number"==typeof val||/^\d+$/.test(String(val))?val+"px":val}null!=width&&(this.display.wrapper.style.width=interpret(width)),null!=height&&(this.display.wrapper.style.height=interpret(height)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(f){return runInOp(this,f)},refresh:operation(null,function(){clearCaches(this),updateScrollPos(this,this.doc.scrollLeft,this.doc.scrollTop),regChange(this)}),swapDoc:operation(null,function(doc){var old=this.doc;return old.cm=null,attachDoc(this,doc),clearCaches(this),resetInput(this,!0),updateScrollPos(this,doc.scrollLeft,doc.scrollTop),old}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},eventMixin(CodeMirror);var optionHandlers=CodeMirror.optionHandlers={},defaults=CodeMirror.defaults={},Init=CodeMirror.Init={toString:function(){return"CodeMirror.Init"}};option("value","",function(cm,val){cm.setValue(val)},!0),option("mode",null,function(cm,val){cm.doc.modeOption=val,loadMode(cm)},!0),option("indentUnit",2,loadMode,!0),option("indentWithTabs",!1),option("smartIndent",!0),option("tabSize",4,function(cm){loadMode(cm),clearCaches(cm),regChange(cm)},!0),option("electricChars",!0),option("rtlMoveVisually",!windows),option("theme","default",function(cm){themeChanged(cm),guttersChanged(cm)},!0),option("keyMap","default",keyMapChanged),option("extraKeys",null),option("onKeyEvent",null),option("onDragEvent",null),option("lineWrapping",!1,wrappingChanged,!0),option("gutters",[],function(cm){setGuttersForLineNumbers(cm.options),guttersChanged(cm)},!0),option("fixedGutter",!0,function(cm,val){cm.display.gutters.style.left=val?compensateForHScroll(cm.display)+"px":"0",cm.refresh()},!0),option("coverGutterNextToScrollbar",!1,updateScrollbars,!0),option("lineNumbers",!1,function(cm){setGuttersForLineNumbers(cm.options),guttersChanged(cm)},!0),option("firstLineNumber",1,guttersChanged,!0),option("lineNumberFormatter",function(integer){return integer},guttersChanged,!0),option("showCursorWhenSelecting",!1,updateSelection,!0),option("readOnly",!1,function(cm,val){"nocursor"==val?(onBlur(cm),cm.display.input.blur()):val||resetInput(cm,!0)}),option("dragDrop",!0),option("cursorBlinkRate",530),option("cursorScrollMargin",0),option("cursorHeight",1),option("workTime",100),option("workDelay",100),option("flattenSpans",!0),option("pollInterval",100),option("undoDepth",40,function(cm,val){cm.doc.history.undoDepth=val}),option("historyEventDelay",500),option("viewportMargin",10,function(cm){cm.refresh()},!0),option("maxHighlightLength",1e4,function(cm){loadMode(cm),cm.refresh()},!0),option("moveInputWithCursor",!0,function(cm,val){val||(cm.display.inputDiv.style.top=cm.display.inputDiv.style.left=0)}),option("tabindex",null,function(cm,val){cm.display.input.tabIndex=val||""}),option("autofocus",null);var modes=CodeMirror.modes={},mimeModes=CodeMirror.mimeModes={};CodeMirror.defineMode=function(name,mode){if(CodeMirror.defaults.mode||"null"==name||(CodeMirror.defaults.mode=name),arguments.length>2){mode.dependencies=[];for(var i=2;i0&&cur.ch=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.posstart},eatSpace:function(){for(var start=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>start},skipToEnd:function(){this.pos=this.string.length},skipTo:function(ch){var found=this.string.indexOf(ch,this.pos);return found>-1?(this.pos=found,!0):void 0},backUp:function(n){this.pos-=n},column:function(){return this.lastColumnPos0?null:(match&&consume!==!1&&(this.pos+=match[0].length),match)}var cased=function(str){return caseInsensitive?str.toLowerCase():str},substr=this.string.substr(this.pos,pattern.length);return cased(substr)==cased(pattern)?(consume!==!1&&(this.pos+=pattern.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},CodeMirror.StringStream=StringStream,CodeMirror.TextMarker=TextMarker,eventMixin(TextMarker),TextMarker.prototype.clear=function(){if(!this.explicitlyCleared){var cm=this.doc.cm,withOp=cm&&!cm.curOp;if(withOp&&startOperation(cm),hasHandler(this,"clear")){var found=this.find();found&&signalLater(this,"clear",found.from,found.to)}for(var min=null,max=null,i=0;icm.display.maxLineLength&&(cm.display.maxLine=visual,cm.display.maxLineLength=len,cm.display.maxLineChanged=!0)}null!=min&&cm&®Change(cm,min,max+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,cm&&reCheckSelection(cm)),withOp&&endOperation(cm)}},TextMarker.prototype.find=function(){for(var from,to,i=0;i=cm.display.showingFrom&&pos.from.linei;++i){var line=this.lines[i];this.height-=line.height,cleanUpLine(line),signalLater(line,"delete")}this.lines.splice(at,n)},collapse:function(lines){lines.splice.apply(lines,[lines.length,0].concat(this.lines))},insertInner:function(at,lines,height){this.height+=height,this.lines=this.lines.slice(0,at).concat(lines).concat(this.lines.slice(at));for(var i=0,e=lines.length;e>i;++i)lines[i].parent=this},iterN:function(at,n,op){for(var e=at+n;e>at;++at)if(op(this.lines[at]))return!0}},BranchChunk.prototype={chunkSize:function(){return this.size},removeInner:function(at,n){this.size-=n;for(var i=0;iat){var rm=Math.min(n,sz-at),oldHeight=child.height;if(child.removeInner(at,rm),this.height-=oldHeight-child.height,sz==rm&&(this.children.splice(i--,1),child.parent=null),0==(n-=rm))break;at=0}else at-=sz}if(this.size-n<25){var lines=[];this.collapse(lines),this.children=[new LeafChunk(lines)],this.children[0].parent=this}},collapse:function(lines){for(var i=0,e=this.children.length;e>i;++i)this.children[i].collapse(lines)},insertInner:function(at,lines,height){this.size+=lines.length,this.height+=height;for(var i=0,e=this.children.length;e>i;++i){var child=this.children[i],sz=child.chunkSize();if(sz>=at){if(child.insertInner(at,lines,height),child.lines&&child.lines.length>50){for(;child.lines.length>50;){var spilled=child.lines.splice(child.lines.length-25,25),newleaf=new LeafChunk(spilled);child.height-=newleaf.height,this.children.splice(i+1,0,newleaf),newleaf.parent=this}this.maybeSpill()}break}at-=sz}},maybeSpill:function(){if(!(this.children.length<=10)){var me=this;do{var spilled=me.children.splice(me.children.length-5,5),sibling=new BranchChunk(spilled);if(me.parent){me.size-=sibling.size,me.height-=sibling.height;var myIndex=indexOf(me.parent.children,me);me.parent.children.splice(myIndex+1,0,sibling)}else{var copy=new BranchChunk(me.children);copy.parent=me,me.children=[copy,sibling],me=copy}sibling.parent=me.parent}while(me.children.length>10);me.parent.maybeSpill()}},iterN:function(at,n,op){for(var i=0,e=this.children.length;e>i;++i){var child=this.children[i],sz=child.chunkSize();if(sz>at){var used=Math.min(n,sz-at);if(child.iterN(at,used,op))return!0;if(0==(n-=used))break;at=0}else at-=sz}}};var nextDocId=0,Doc=CodeMirror.Doc=function(text,mode,firstLine){if(!(this instanceof Doc))return new Doc(text,mode,firstLine);null==firstLine&&(firstLine=0),BranchChunk.call(this,[new LeafChunk([new Line("",null)])]),this.first=firstLine,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=makeHistory(),this.cleanGeneration=1,this.frontier=firstLine;var start=Pos(firstLine,0);this.sel={from:start,to:start,head:start,anchor:start,shift:!1,extend:!1,goalColumn:null},this.id=++nextDocId,this.modeOption=mode,"string"==typeof text&&(text=splitLines(text)),updateDoc(this,{from:start,to:start,text:text},null,{head:start,anchor:start})};Doc.prototype=createObj(BranchChunk.prototype,{constructor:Doc,iter:function(from,to,op){op?this.iterN(from-this.first,to-from,op):this.iterN(this.first,this.first+this.size,from)},insert:function(at,lines){for(var height=0,i=0,e=lines.length;e>i;++i)height+=lines[i].height;this.insertInner(at-this.first,lines,height)},remove:function(at,n){this.removeInner(at-this.first,n)},getValue:function(lineSep){var lines=getLines(this,this.first,this.first+this.size);return lineSep===!1?lines:lines.join(lineSep||"\n")},setValue:function(code){var top=Pos(this.first,0),last=this.first+this.size-1;makeChange(this,{from:top,to:Pos(last,getLine(this,last).text.length),text:splitLines(code),origin:"setValue"},{head:top,anchor:top},!0)},replaceRange:function(code,from,to,origin){from=clipPos(this,from),to=to?clipPos(this,to):from,replaceRange(this,code,from,to,origin)},getRange:function(from,to,lineSep){var lines=getBetween(this,clipPos(this,from),clipPos(this,to));return lineSep===!1?lines:lines.join(lineSep||"\n")},getLine:function(line){var l=this.getLineHandle(line);return l&&l.text},setLine:function(line,text){isLine(this,line)&&replaceRange(this,text,Pos(line,0),clipPos(this,Pos(line)))},removeLine:function(line){line?replaceRange(this,"",clipPos(this,Pos(line-1)),clipPos(this,Pos(line))):replaceRange(this,"",Pos(0,0),clipPos(this,Pos(1,0)))},getLineHandle:function(line){return isLine(this,line)?getLine(this,line):void 0},getLineNumber:function(line){return lineNo(line)},getLineHandleVisualStart:function(line){return"number"==typeof line&&(line=getLine(this,line)),visualLine(this,line)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(pos){return clipPos(this,pos)},getCursor:function(start){var pos,sel=this.sel;return pos=null==start||"head"==start?sel.head:"anchor"==start?sel.anchor:"end"==start||start===!1?sel.to:sel.from,copyPos(pos)},somethingSelected:function(){return!posEq(this.sel.head,this.sel.anchor)},setCursor:docOperation(function(line,ch,extend){var pos=clipPos(this,"number"==typeof line?Pos(line,ch||0):line);extend?extendSelection(this,pos):setSelection(this,pos,pos)}),setSelection:docOperation(function(anchor,head){setSelection(this,clipPos(this,anchor),clipPos(this,head||anchor))}),extendSelection:docOperation(function(from,to){extendSelection(this,clipPos(this,from),to&&clipPos(this,to))}),getSelection:function(lineSep){return this.getRange(this.sel.from,this.sel.to,lineSep)},replaceSelection:function(code,collapse,origin){makeChange(this,{from:this.sel.from,to:this.sel.to,text:splitLines(code),origin:origin},collapse||"around")},undo:docOperation(function(){makeChangeFromHistory(this,"undo")}),redo:docOperation(function(){makeChangeFromHistory(this,"redo")}),setExtending:function(val){this.sel.extend=val},historySize:function(){var hist=this.history;return{undo:hist.done.length,redo:hist.undone.length}},clearHistory:function(){this.history=makeHistory(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){return this.history.lastOp=this.history.lastOrigin=null,this.history.generation},isClean:function(gen){return this.history.generation==(gen||this.cleanGeneration)},getHistory:function(){return{done:copyHistoryArray(this.history.done),undone:copyHistoryArray(this.history.undone)}},setHistory:function(histData){var hist=this.history=makeHistory(this.history.maxGeneration);hist.done=histData.done.slice(0),hist.undone=histData.undone.slice(0)},markText:function(from,to,options){return markText(this,clipPos(this,from),clipPos(this,to),options,"range")},setBookmark:function(pos,options){var realOpts={replacedWith:options&&(null==options.nodeType?options.widget:options),insertLeft:options&&options.insertLeft};return pos=clipPos(this,pos),markText(this,pos,pos,realOpts,"bookmark")},findMarksAt:function(pos){pos=clipPos(this,pos);var markers=[],spans=getLine(this,pos.line).markedSpans;if(spans)for(var i=0;i=pos.ch)&&markers.push(span.marker.parent||span.marker)}return markers},getAllMarks:function(){var markers=[];return this.iter(function(line){var sps=line.markedSpans;if(sps)for(var i=0;ioff?(ch=off,!0):(off-=sz,void++lineNo)}),clipPos(this,Pos(lineNo,ch))},indexFromPos:function(coords){coords=clipPos(this,coords);var index=coords.ch;return coords.linefrom&&(from=options.from),null!=options.to&&options.to1&&45==str.charCodeAt(i-1)){if(/\w/.test(str.charAt(i-2))&&/[^\-?\.]/.test(str.charAt(i)))return!0;if(i>2&&/[\d\.,]/.test(str.charAt(i-2))&&/[\d\.,]/.test(str.charAt(i)))return!1}return/[~!#%&*)=+}\]|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(str.slice(i-1,i+1))});var knownScrollbarWidth,zwspSupported,splitLines=3!="\n\nb".split(/\n/).length?function(string){for(var pos=0,result=[],l=string.length;l>=pos;){var nl=string.indexOf("\n",pos);-1==nl&&(nl=string.length);var line=string.slice(pos,"\r"==string.charAt(nl-1)?nl-1:nl),rt=line.indexOf("\r");-1!=rt?(result.push(line.slice(0,rt)),pos+=rt+1):(result.push(line),pos=nl+1)}return result}:function(string){return string.split(/\r\n?|\n/)};CodeMirror.splitLines=splitLines;var hasSelection=window.getSelection?function(te){try{return te.selectionStart!=te.selectionEnd}catch(e){return!1}}:function(te){try{var range=te.ownerDocument.selection.createRange()}catch(e){}return range&&range.parentElement()==te?0!=range.compareEndPoints("StartToEnd",range):!1},hasCopyEvent=function(){var e=elt("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),keyNames={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"};CodeMirror.keyNames=keyNames,function(){for(var i=0;10>i;i++)keyNames[i+48]=String(i);for(var i=65;90>=i;i++)keyNames[i]=String.fromCharCode(i);for(var i=1;12>=i;i++)keyNames[i+111]=keyNames[i+63235]="F"+i}();var bidiOther,bidiOrdering=function(){function charType(code){return 255>=code?lowTypes.charAt(code):code>=1424&&1524>=code?"R":code>=1536&&1791>=code?arabicTypes.charAt(code-1536):code>=1792&&2220>=code?"r":"L"}var lowTypes="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",arabicTypes="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",bidiRE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,isNeutral=/[stwN]/,isStrong=/[LRr]/,countsAsLeft=/[Lb1n]/,countsAsNum=/[1n]/,outerType="L";return function(str){if(!bidiRE.test(str))return!1;for(var type,len=str.length,types=[],i=0;len>i;++i)types.push(type=charType(str.charCodeAt(i)));for(var i=0,prev=outerType;len>i;++i){var type=types[i];"m"==type?types[i]=prev:prev=type}for(var i=0,cur=outerType;len>i;++i){var type=types[i];"1"==type&&"r"==cur?types[i]="n":isStrong.test(type)&&(cur=type,"r"==type&&(types[i]="R"))}for(var i=1,prev=types[0];len-1>i;++i){var type=types[i];"+"==type&&"1"==prev&&"1"==types[i+1]?types[i]="1":","!=type||prev!=types[i+1]||"1"!=prev&&"n"!=prev||(types[i]=prev),prev=type}for(var i=0;len>i;++i){var type=types[i];if(","==type)types[i]="N";else if("%"==type){for(var end=i+1;len>end&&"%"==types[end];++end);for(var replace=i&&"!"==types[i-1]||len-1>end&&"1"==types[end]?"1":"N",j=i;end>j;++j)types[j]=replace;i=end-1}}for(var i=0,cur=outerType;len>i;++i){var type=types[i];"L"==cur&&"1"==type?types[i]="L":isStrong.test(type)&&(cur=type)}for(var i=0;len>i;++i)if(isNeutral.test(types[i])){for(var end=i+1;len>end&&isNeutral.test(types[end]);++end);for(var before="L"==(i?types[i-1]:outerType),after="L"==(len-1>end?types[end]:outerType),replace=before||after?"L":"R",j=i;end>j;++j)types[j]=replace;i=end-1}for(var m,order=[],i=0;len>i;)if(countsAsLeft.test(types[i])){var start=i;for(++i;len>i&&countsAsLeft.test(types[i]);++i);order.push({from:start,to:i,level:0})}else{var pos=i,at=order.length;for(++i;len>i&&"L"!=types[i];++i);for(var j=pos;i>j;)if(countsAsNum.test(types[j])){j>pos&&order.splice(at,0,{from:pos,to:j,level:1});var nstart=j;for(++j;i>j&&countsAsNum.test(types[j]);++j);order.splice(at,0,{from:nstart,to:j,level:2}),pos=j}else++j;i>pos&&order.splice(at,0,{from:pos,to:i,level:1})}return 1==order[0].level&&(m=str.match(/^\s+/))&&(order[0].from=m[0].length,order.unshift({from:0,to:m[0].length,level:0})),1==lst(order).level&&(m=str.match(/\s+$/))&&(lst(order).to-=m[0].length,order.push({from:len-m[0].length,to:len,level:0})),order[0].level!=lst(order).level&&order.push({from:len,to:len,level:order[0].level}),order}}();return CodeMirror.version="3.15.0",CodeMirror}();
\ No newline at end of file
diff --git a/vendor/js/editor.min.js b/vendor/js/editor.min.js
index 107b123..66af3a5 100644
--- a/vendor/js/editor.min.js
+++ b/vendor/js/editor.min.js
@@ -1 +1 @@
-function Editor(a){a=a||{},a.element&&(this.element=a.element),a.toolbar=a.toolbar||Editor.toolbar,a.hasOwnProperty("status")||(a.status=["lines","words","cursor"]),this.options=a,this.element&&this.render()}var toolbar=[{name:"bold",action:toggleBold},{name:"italic",action:toggleItalic},"|",{name:"quote",action:toggleBlockquote},{name:"unordered-list",action:toggleUnOrderedList},{name:"ordered-list",action:toggleOrderedList},"|",{name:"link",action:drawLink},{name:"image",action:drawImage},"|",{name:"info",action:"http://lab.lepture.com/editor/markdown"},{name:"preview",action:togglePreview},{name:"fullscreen",action:toggleFullScreen}];Editor.toolbar=toolbar,Editor.markdown=function(a){if(window.marked)return marked(a)},Editor.prototype.render=function(a){a||(a=this.element||document.getElementsByTagName("textarea")[0]);if(this._rendered&&this._rendered===a)return;this.element=a;var b=this.options,c=this,d={};for(var e in shortcuts)(function(a){d[fixShortcut(a)]=function(b){shortcuts[a](c)}})(e);d.Enter="newlineAndIndentContinueMarkdownList",this.codemirror=CodeMirror.fromTextArea(a,{mode:"markdown",theme:"paper",indentWithTabs:!0,lineNumbers:!1,extraKeys:d}),b.toolbar!==!1&&this.createToolbar(),b.status!==!1&&this.createStatusbar(),this._rendered=this.element},Editor.prototype.createToolbar=function(a){a=a||this.options.toolbar;if(!a||a.length===0)return;var b=document.createElement("div");b.className="editor-toolbar";var c=this,d;c.toolbar={};for(var e=0;e\s+/,"unordered-list":/^(\s*)(\*|\-|\+)\s+/,"ordered-list":/^(\s*)\d+\.\s+/},g={quote:"> ","unordered-list":"* ","ordered-list":"1. "};for(var h=d.line;h<=e.line;h++)(function(d){var e=a.getLine(d);c[b]?e=e.replace(f[b],"$1"):e=g[b]+e,a.setLine(d,e)})(h);a.focus()}function wordCount(a){var b=/[a-zA-Z0-9_\u0392-\u03c9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g,c=a.match(b),d=0;if(c===null)return d;for(var e=0;e=19968?d+=c[e].length:d+=1;return d}var isMac=/Mac/.test(navigator.platform),shortcuts={"Cmd-B":toggleBold,"Cmd-I":toggleItalic,"Cmd-K":drawLink,"Cmd-Alt-I":drawImage,"Cmd-'":toggleBlockquote,"Cmd-Alt-L":toggleOrderedList,"Cmd-L":toggleUnOrderedList};
\ No newline at end of file
+function fixShortcut(name){return name=isMac?name.replace("Ctrl","Cmd"):name.replace("Cmd","Ctrl")}function createIcon(name,options){options=options||{};var el=document.createElement("a"),shortcut=options.shortcut||shortcuts[name];return shortcut&&(shortcut=fixShortcut(shortcut),el.title=shortcut,el.title=el.title.replace("Cmd","⌘"),isMac&&(el.title=el.title.replace("Alt","⌥"))),el.className=options.className||"icon-"+name,el}function createSep(){return el=document.createElement("i"),el.className="separator",el.innerHTML="|",el}function getState(cm,pos){pos=pos||cm.getCursor("start");var stat=cm.getTokenAt(pos);if(!stat.type)return{};for(var data,text,types=stat.type.split(" "),ret={},i=0;i\s+/,"unordered-list":/^(\s*)(\*|\-|\+)\s+/,"ordered-list":/^(\s*)\d+\.\s+/},map={quote:"> ","unordered-list":"* ","ordered-list":"1. "},i=startPoint.line;i<=endPoint.line;i++)!function(i){var text=cm.getLine(i);text=stat[name]?text.replace(repl[name],"$1"):map[name]+text,cm.setLine(i,text)}(i);cm.focus()}function wordCount(data){var pattern=/[a-zA-Z0-9_\u0392-\u03c9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g,m=data.match(pattern),count=0;if(null===m)return count;for(var i=0;i=19968?m[i].length:1;return count}var isMac=/Mac/.test(navigator.platform),shortcuts={"Cmd-B":toggleBold,"Cmd-I":toggleItalic,"Cmd-K":drawLink,"Cmd-Alt-I":drawImage,"Cmd-'":toggleBlockquote,"Cmd-Alt-L":toggleOrderedList,"Cmd-L":toggleUnOrderedList};
\ No newline at end of file
diff --git a/vendor/js/marked.min.js b/vendor/js/marked.min.js
index cf1c939..3a40300 100644
--- a/vendor/js/marked.min.js
+++ b/vendor/js/marked.min.js
@@ -1 +1 @@
-(function(){function b(b){this.tokens=[],this.tokens.links={},this.options=b||j.defaults,this.rules=a.normal,this.options.gfm&&(this.options.tables?this.rules=a.tables:this.rules=a.gfm)}function d(a,b){this.options=b||j.defaults,this.links=a,this.rules=c.normal;if(!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=c.breaks:this.rules=c.gfm:this.options.pedantic&&(this.rules=c.pedantic)}function e(a){this.tokens=[],this.token=null,this.options=a||j.defaults}function f(a,b){return a.replace(b?/&/g:/&(?!#?\w+;)/g,"&").replace(/
/g,">").replace(/"/g,""").replace(/'/g,"'")}function g(a,b){return a=a.source,b=b||"",function c(d,e){return d?(e=e.source||e,e=e.replace(/(^|[^\[])\^/g,"$1"),a=a.replace(d,e),c):new RegExp(a,b)}}function h(){}function i(a){var b=1,c,d;for(;bAn error occured:
"+f(m.message+"",!0)+"
";throw m}}var a={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:h,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:h,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:h,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};a.bullet=/(?:[*+-]|\d+\.)/,a.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,a.item=g(a.item,"gm")(/bull/g,a.bullet)(),a.list=g(a.list)(/bull/g,a.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)(),a._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b",a.html=g(a.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,a._tag)(),a.paragraph=g(a.paragraph)("hr",a.hr)("heading",a.heading)("lheading",a.lheading)("blockquote",a.blockquote)("tag","<"+a._tag)("def",a.def)(),a.normal=i({},a),a.gfm=i({},a.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/}),a.gfm.paragraph=g(a.paragraph)("(?!","(?!"+a.gfm.fences.source.replace("\\1","\\2")+"|"+a.list.source.replace("\\1","\\3")+"|")(),a.tables=i({},a.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),b.rules=a,b.lex=function(a,c){var d=new b(c);return d.lex(a)},b.prototype.lex=function(a){return a=a.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(a,!0)},b.prototype.token=function(b,c){var b=b.replace(/^ +$/gm,""),d,e,f,g,h,i,j,k,l;while(b){if(f=this.rules.newline.exec(b))b=b.substring(f[0].length),f[0].length>1&&this.tokens.push({type:"space"});if(f=this.rules.code.exec(b)){b=b.substring(f[0].length),f=f[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?f:f.replace(/\n+$/,"")});continue}if(f=this.rules.fences.exec(b)){b=b.substring(f[0].length),this.tokens.push({type:"code",lang:f[2],text:f[3]});continue}if(f=this.rules.heading.exec(b)){b=b.substring(f[0].length),this.tokens.push({type:"heading",depth:f[1].length,text:f[2]});continue}if(c&&(f=this.rules.nptable.exec(b))){b=b.substring(f[0].length),i={type:"table",header:f[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:f[3].replace(/\n$/,"").split("\n")};for(k=0;k ?/gm,""),this.token(f,c),this.tokens.push({type:"blockquote_end"});continue}if(f=this.rules.list.exec(b)){b=b.substring(f[0].length),g=f[2],this.tokens.push({type:"list_start",ordered:g.length>1}),f=f[0].match(this.rules.item),d=!1,l=f.length,k=0;for(;k1&&h.length>1)&&(b=f.slice(k+1).join("\n")+b,k=l-1)),e=d||/\n\n(?!\s*$)/.test(i),k!==l-1&&(d=i.charAt(i.length-1)==="\n",e||(e=d)),this.tokens.push({type:e?"loose_item_start":"list_item_start"}),this.token(i,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"});continue}if(f=this.rules.html.exec(b)){b=b.substring(f[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:f[1]==="pre"||f[1]==="script"||f[1]==="style",text:f[0]});continue}if(c&&(f=this.rules.def.exec(b))){b=b.substring(f[0].length),this.tokens.links[f[1].toLowerCase()]={href:f[2],title:f[3]};continue}if(c&&(f=this.rules.table.exec(b))){b=b.substring(f[0].length),i={type:"table",header:f[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:f[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(k=0;k])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:h,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:h,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,c.link=g(c.link)("inside",c._inside)("href",c._href)(),c.reflink=g(c.reflink)("inside",c._inside)(),c.normal=i({},c),c.pedantic=i({},c.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),c.gfm=i({},c.normal,{escape:g(c.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:g(c.text)("]|","~]|")("|","|https?://|")()}),c.breaks=i({},c.gfm,{br:g(c.br)("{2,}","*")(),text:g(c.gfm.text)("{2,}","*")()}),d.rules=c,d.output=function(a,b,c){var e=new d(b,c);return e.output(a)},d.prototype.output=function(a){var b="",c,d,e,g;while(a){if(g=this.rules.escape.exec(a)){a=a.substring(g[0].length),b+=g[1];continue}if(g=this.rules.autolink.exec(a)){a=a.substring(g[0].length),g[2]==="@"?(d=g[1].charAt(6)===":"?this.mangle(g[1].substring(7)):this.mangle(g[1]),e=this.mangle("mailto:")+d):(d=f(g[1]),e=d),b+=''+d+"";continue}if(g=this.rules.url.exec(a)){a=a.substring(g[0].length),d=f(g[1]),e=d,b+=''+d+"";continue}if(g=this.rules.tag.exec(a)){a=a.substring(g[0].length),b+=this.options.sanitize?f(g[0]):g[0];continue}if(g=this.rules.link.exec(a)){a=a.substring(g[0].length),b+=this.outputLink(g,{href:g[2],title:g[3]});continue}if((g=this.rules.reflink.exec(a))||(g=this.rules.nolink.exec(a))){a=a.substring(g[0].length),c=(g[2]||g[1]).replace(/\s+/g," "),c=this.links[c.toLowerCase()];if(!c||!c.href){b+=g[0].charAt(0),a=g[0].substring(1)+a;continue}b+=this.outputLink(g,c);continue}if(g=this.rules.strong.exec(a)){a=a.substring(g[0].length),b+=""+this.output(g[2]||g[1])+"";continue}if(g=this.rules.em.exec(a)){a=a.substring(g[0].length),b+=""+this.output(g[2]||g[1])+"";continue}if(g=this.rules.code.exec(a)){a=a.substring(g[0].length),b+=""+f(g[2],!0)+"
";continue}if(g=this.rules.br.exec(a)){a=a.substring(g[0].length),b+="
";continue}if(g=this.rules.del.exec(a)){a=a.substring(g[0].length),b+=""+this.output(g[1])+"";continue}if(g=this.rules.text.exec(a)){a=a.substring(g[0].length),b+=f(this.smartypants(g[0]));continue}if(a)throw new Error("Infinite loop on byte: "+a.charCodeAt(0))}return b},d.prototype.outputLink=function(a,b){return a[0].charAt(0)!=="!"?'"+this.output(a[1])+"":'"},d.prototype.smartypants=function(a){return this.options.smartypants?a.replace(/--/g,"—").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):a},d.prototype.mangle=function(a){var b="",c=a.length,d=0,e;for(;d.5&&(e="x"+e.toString(16)),b+=""+e+";";return b},e.parse=function(a,b){var c=new e(b);return c.parse(a)},e.prototype.parse=function(a){this.inline=new d(a.links,this.options),this.tokens=a.reverse();var b="";while(this.next())b+=this.tok();return b},e.prototype.next=function(){return this.token=this.tokens.pop()},e.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},e.prototype.parseText=function(){var a=this.token.text;while(this.peek().type==="text")a+="\n"+this.next().text;return this.inline.output(a)},e.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return"
\n";case"heading":return"'+this.inline.output(this.token.text)+"\n";case"code":if(this.options.highlight){var a=this.options.highlight(this.token.text,this.token.lang);a!=null&&a!==this.token.text&&(this.token.escaped=!0,this.token.text=a)}return this.token.escaped||(this.token.text=f(this.token.text,!0)),""+this.token.text+"
\n";case"table":var b="",c,d,e,g,h;b+="\n\n";for(d=0;d"+c+"\n";b+="
\n\n",b+="\n";for(d=0;d\n";for(h=0;h"+g+"\n";b+="\n"}return b+="\n","\n";case"blockquote_start":var b="";while(this.next().type!=="blockquote_end")b+=this.tok();return"\n"+b+"
\n";case"list_start":var i=this.token.ordered?"ol":"ul",b="";while(this.next().type!=="list_end")b+=this.tok();return"<"+i+">\n"+b+""+i+">\n";case"list_item_start":var b="";while(this.next().type!=="list_item_end")b+=this.token.type==="text"?this.parseText():this.tok();return""+b+"\n";case"loose_item_start":var b="";while(this.next().type!=="list_item_end")b+=this.tok();return""+b+"\n";case"html":return!this.token.pre&&!this.options.pedantic?this.inline.output(this.token.text):this.token.text;case"paragraph":return""+this.inline.output(this.token.text)+"
\n";case"text":return""+this.parseText()+"
\n"}},h.exec=h,j.options=j.setOptions=function(a){return i(j.defaults,a),j},j.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1},j.Parser=e,j.parser=e.parse,j.Lexer=b,j.lexer=b.lex,j.InlineLexer=d,j.inlineLexer=d.output,j.parse=j,typeof exports=="object"?module.exports=j:typeof define=="function"&&define.amd?define(function(){return j}):this.marked=j}).call(function(){return this||(typeof window!="undefined"?window:global)}());
\ No newline at end of file
+(function(){function Lexer(options){this.tokens=[],this.tokens.links={},this.options=options||marked.defaults,this.rules=block.normal,this.options.gfm&&(this.rules=this.options.tables?block.tables:block.gfm)}function InlineLexer(links,options){if(this.options=options||marked.defaults,this.links=links,this.rules=inline.normal,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.rules=this.options.breaks?inline.breaks:inline.gfm:this.options.pedantic&&(this.rules=inline.pedantic)}function Parser(options){this.tokens=[],this.token=null,this.options=options||marked.defaults}function escape(html,encode){return html.replace(encode?/&/g:/&(?!#?\w+;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function replace(regex,opt){return regex=regex.source,opt=opt||"",function self(name,val){return name?(val=val.source||val,val=val.replace(/(^|[^\[])\^/g,"$1"),regex=regex.replace(name,val),self):new RegExp(regex,opt)}}function noop(){}function merge(obj){for(var target,key,i=1;iAn error occured:"+escape(e.message+"",!0)+"
";throw e}}var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/,block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,block.item=replace(block.item,"gm")(/bull/g,block.bullet)(),block.list=replace(block.list)(/bull/g,block.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)(),block._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b",block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)(),block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)(),block.normal=merge({},block),block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/}),block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")(),block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),Lexer.rules=block,Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)},Lexer.prototype.lex=function(src){return src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(src,!0)},Lexer.prototype.token=function(src,top){for(var next,loose,cap,bull,b,item,space,i,l,src=src.replace(/^ +$/gm,"");src;)if((cap=this.rules.newline.exec(src))&&(src=src.substring(cap[0].length),cap[0].length>1&&this.tokens.push({type:"space"})),cap=this.rules.code.exec(src))src=src.substring(cap[0].length),cap=cap[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?cap:cap.replace(/\n+$/,"")});else if(cap=this.rules.fences.exec(src))src=src.substring(cap[0].length),this.tokens.push({type:"code",lang:cap[2],text:cap[3]});else if(cap=this.rules.heading.exec(src))src=src.substring(cap[0].length),this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});else if(top&&(cap=this.rules.nptable.exec(src))){for(src=src.substring(cap[0].length),item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")},i=0;i ?/gm,""),this.token(cap,top),this.tokens.push({type:"blockquote_end"});else if(cap=this.rules.list.exec(src)){for(src=src.substring(cap[0].length),bull=cap[2],this.tokens.push({type:"list_start",ordered:bull.length>1}),cap=cap[0].match(this.rules.item),next=!1,l=cap.length,i=0;l>i;i++)item=cap[i],space=item.length,item=item.replace(/^ *([*+-]|\d+\.) +/,""),~item.indexOf("\n ")&&(space-=item.length,item=this.options.pedantic?item.replace(/^ {1,4}/gm,""):item.replace(new RegExp("^ {1,"+space+"}","gm"),"")),this.options.smartLists&&i!==l-1&&(b=block.bullet.exec(cap[i+1])[0],bull===b||bull.length>1&&b.length>1||(src=cap.slice(i+1).join("\n")+src,i=l-1)),loose=next||/\n\n(?!\s*$)/.test(item),i!==l-1&&(next="\n"===item.charAt(item.length-1),loose||(loose=next)),this.tokens.push({type:loose?"loose_item_start":"list_item_start"}),this.token(item,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(cap=this.rules.html.exec(src))src=src.substring(cap[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:"pre"===cap[1]||"script"===cap[1]||"style"===cap[1],text:cap[0]});else if(top&&(cap=this.rules.def.exec(src)))src=src.substring(cap[0].length),this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};else if(top&&(cap=this.rules.table.exec(src))){for(src=src.substring(cap[0].length),item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")},i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)(),inline.reflink=replace(inline.reflink)("inside",inline._inside)(),inline.normal=merge({},inline),inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()}),inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()}),InlineLexer.rules=inline,InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)},InlineLexer.prototype.output=function(src){for(var link,text,href,cap,out="";src;)if(cap=this.rules.escape.exec(src))src=src.substring(cap[0].length),out+=cap[1];else if(cap=this.rules.autolink.exec(src))src=src.substring(cap[0].length),"@"===cap[2]?(text=this.mangle(":"===cap[1].charAt(6)?cap[1].substring(7):cap[1]),href=this.mangle("mailto:")+text):(text=escape(cap[1]),href=text),out+=''+text+"";else if(cap=this.rules.url.exec(src))src=src.substring(cap[0].length),text=escape(cap[1]),href=text,out+=''+text+"";else if(cap=this.rules.tag.exec(src))src=src.substring(cap[0].length),out+=this.options.sanitize?escape(cap[0]):cap[0];else if(cap=this.rules.link.exec(src))src=src.substring(cap[0].length),out+=this.outputLink(cap,{href:cap[2],title:cap[3]});else if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){if(src=src.substring(cap[0].length),link=(cap[2]||cap[1]).replace(/\s+/g," "),link=this.links[link.toLowerCase()],!link||!link.href){out+=cap[0].charAt(0),src=cap[0].substring(1)+src;continue}out+=this.outputLink(cap,link)}else if(cap=this.rules.strong.exec(src))src=src.substring(cap[0].length),out+=""+this.output(cap[2]||cap[1])+"";else if(cap=this.rules.em.exec(src))src=src.substring(cap[0].length),out+=""+this.output(cap[2]||cap[1])+"";else if(cap=this.rules.code.exec(src))src=src.substring(cap[0].length),out+=""+escape(cap[2],!0)+"
";else if(cap=this.rules.br.exec(src))src=src.substring(cap[0].length),out+="
";else if(cap=this.rules.del.exec(src))src=src.substring(cap[0].length),out+=""+this.output(cap[1])+"";else if(cap=this.rules.text.exec(src))src=src.substring(cap[0].length),out+=escape(this.smartypants(cap[0]));else if(src)throw new Error("Infinite loop on byte: "+src.charCodeAt(0));return out},InlineLexer.prototype.outputLink=function(cap,link){return"!"!==cap[0].charAt(0)?'"+this.output(cap[1])+"":'"},InlineLexer.prototype.smartypants=function(text){return this.options.smartypants?text.replace(/--/g,"—").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):text},InlineLexer.prototype.mangle=function(text){for(var ch,out="",l=text.length,i=0;l>i;i++)ch=text.charCodeAt(i),Math.random()>.5&&(ch="x"+ch.toString(16)),out+=""+ch+";";return out},Parser.parse=function(src,options){var parser=new Parser(options);return parser.parse(src)},Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options),this.tokens=src.reverse();for(var out="";this.next();)out+=this.tok();return out},Parser.prototype.next=function(){return this.token=this.tokens.pop()},Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},Parser.prototype.parseText=function(){for(var body=this.token.text;"text"===this.peek().type;)body+="\n"+this.next().text;return this.inline.output(body)},Parser.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return"
\n";case"heading":return"'+this.inline.output(this.token.text)+"\n";case"code":if(this.options.highlight){var code=this.options.highlight(this.token.text,this.token.lang);null!=code&&code!==this.token.text&&(this.token.escaped=!0,this.token.text=code)}return this.token.escaped||(this.token.text=escape(this.token.text,!0)),""+this.token.text+"
\n";case"table":var heading,i,row,cell,j,body="";for(body+="\n\n",i=0;i"+heading+"\n";for(body+="
\n\n",body+="\n",i=0;i\n",j=0;j"+cell+"\n";body+="\n"}return body+="\n","\n";case"blockquote_start":for(var body="";"blockquote_end"!==this.next().type;)body+=this.tok();return"\n"+body+"
\n";case"list_start":for(var type=this.token.ordered?"ol":"ul",body="";"list_end"!==this.next().type;)body+=this.tok();return"<"+type+">\n"+body+""+type+">\n";case"list_item_start":for(var body="";"list_item_end"!==this.next().type;)body+="text"===this.token.type?this.parseText():this.tok();return""+body+"\n";case"loose_item_start":for(var body="";"list_item_end"!==this.next().type;)body+=this.tok();return""+body+"\n";case"html":return this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);case"paragraph":return""+this.inline.output(this.token.text)+"
\n";case"text":return""+this.parseText()+"
\n"}},noop.exec=noop,marked.options=marked.setOptions=function(opt){return merge(marked.defaults,opt),marked},marked.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1},marked.Parser=Parser,marked.parser=Parser.parse,marked.Lexer=Lexer,marked.lexer=Lexer.lex,marked.InlineLexer=InlineLexer,marked.inlineLexer=InlineLexer.output,marked.parse=marked,"object"==typeof exports?module.exports=marked:"function"==typeof define&&define.amd?define(function(){return marked}):this.marked=marked}).call(function(){return this||("undefined"!=typeof window?window:global)}());
\ No newline at end of file