text: (function(n,t){typeof exports=="object"&&typeof module!="undefined"?module.exports=t():typeof define=="function"&&define.amd?define(t):n.CodeMirror=t()})(this,function(){"use strict";function sf(n){return new RegExp("(^|\\s)"+n+"(?:$|\\s)\\s*")}function yi(n){for(var t=n.childNodes.length;t>0;--t)n.removeChild(n.firstChild);return n}function ct(n,t){return yi(n).appendChild(t)}function i(n,t,i,r){var u=document.createElement(n),f;if(i&&(u.className=i),r&&(u.style.cssText=r),typeof t=="string")u.appendChild(document.createTextNode(t));else if(t)for(f=0;f<t.length;++f)u.appendChild(t[f]);return u}function gr(n,t,r,u){var f=i(n,t,r,u);return f.setAttribute("role","presentation"),f}function pi(n,t){if(t.nodeType==3&&(t=t.parentNode),n.contains)return n.contains(t);do if(t.nodeType==11&&(t=t.host),t==n)return!0;while(t=t.parentNode)}function ei(){var n;try{n=document.activeElement}catch(t){n=document.body||null}while(n&&n.shadowRoot&&n.shadowRoot.activeElement)n=n.shadowRoot.activeElement;return n}function rr(n,t){var i=n.className;sf(t).test(i)||(n.className+=(i?" ":"")+t)}function ps(n,t){for(var r=n.split(" "),i=0;i<r.length;i++)r[i]&&!sf(r[i]).test(t)&&(t+=" "+r[i]);return t}function ws(n){var t=Array.prototype.slice.call(arguments,1);return function(){return n.apply(null,t)}}function ur(n,t,i){t||(t={});for(var r in n)n.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=n[r]);return t}function at(n,t,i,r,u){var f,e,o;for(t==null&&(t=n.search(/[^\s\u00a0]/),t==-1&&(t=n.length)),f=r||0,e=u||0;;){if(o=n.indexOf("\t",f),o<0||o>=t)return e+(t-f);e+=o-f;e+=i-e%i;f=o+1}}function d(n,t){for(var i=0;i<n.length;++i)if(n[i]==t)return i;return-1}function ks(n,t,i){for(var f,e,r=0,u=0;;){if(f=n.indexOf("\t",r),f==-1&&(f=n.length),e=f-r,f==n.length||u+e>=t)return r+Math.min(e,t-u);if(u+=f-r,u+=i-u%i,r=f+1,u>=t)return r}}function ds(n){while(cf.length<=n)cf.push(s(cf)+" ");return cf[n]}function s(n){return n[n.length-1]}function ro(n,t){for(var r=[],i=0;i<n.length;i++)r[i]=t(n[i],i);return r}function ek(n,t,i){for(var r=0,u=i(t);r<n.length&&i(n[r])<=u;)r++;n.splice(r,0,t)}function ea(){}function oa(n,t){var i;return Object.create?i=Object.create(n):(ea.prototype=n,i=new ea),t&&ur(t,i),i}function gs(n){return/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||sa.test(n))}function uo(n,t){return t?t.source.indexOf("\\w")>-1&&gs(n)?!0:t.test(n):gs(n)}function ha(n){for(var t in n)if(n.hasOwnProperty(t)&&n[t])return!1;return!0}function nh(n){return n.charCodeAt(0)>=768&&ca.test(n)}function la(n,t,i){while((i<0?t>0:t<n.length)&&nh(n.charAt(t)))t+=i;return t}function lf(n,t,i){for(var f=t>i?-1:1,u,r;;){if(t==i)return t;if(u=(t+i)/2,r=f<0?Math.ceil(u):Math.floor(u),r==t)return n(r)?t:i;n(r)?i=r:t=r+f}}function ok(n,t,r){var u=this,f;this.input=r;u.scrollbarFiller=i("div",null,"CodeMirror-scrollbar-filler");u.scrollbarFiller.setAttribute("cm-not-content","true");u.gutterFiller=i("div",null,"CodeMirror-gutter-filler");u.gutterFiller.setAttribute("cm-not-content","true");u.lineDiv=gr("div",null,"CodeMirror-code");u.selectionDiv=i("div",null,null,"position: relative; z-index: 1");u.cursorDiv=i("div",null,"CodeMirror-cursors");u.measure=i("div",null,"CodeMirror-measure");u.lineMeasure=i("div",null,"CodeMirror-measure");u.lineSpace=gr("div",[u.measure,u.lineMeasure,u.selectionDiv,u.cursorDiv,u.lineDiv],null,"position: relative; outline: none");f=gr("div",[u.lineSpace],"CodeMirror-lines");u.mover=i("div",[f],null,"position: relative");u.sizer=i("div",[u.mover],"CodeMirror-sizer");u.sizerWidth=null;u.heightForcer=i("div",null,null,"position: absolute; height: "+fa+"px; width: 1px;");u.gutters=i("div",null,"CodeMirror-gutters");u.lineGutter=null;u.scroller=i("div",[u.sizer,u.heightForcer,u.gutters],"CodeMirror-scroll");u.scroller.setAttribute("tabIndex","-1");u.wrapper=i("div",[u.scrollbarFiller,u.gutterFiller,u.scroller],"CodeMirror");e&&l<8&&(u.gutters.style.zIndex=-1,u.scroller.style.paddingRight=0);it||ai&&of||(u.scroller.draggable=!0);n&&(n.appendChild?n.appendChild(u.wrapper):n(u.wrapper));u.viewFrom=u.viewTo=t.first;u.reportedViewFrom=u.reportedViewTo=t.first;u.view=[];u.renderedView=null;u.externalMeasured=null;u.viewOffset=0;u.lastWrapHeight=u.lastWrapWidth=0;u.updateLineNumbers=null;u.nativeBarWidth=u.barHeight=u.barWidth=0;u.scrollbarsClipped=!1;u.lineNumWidth=u.lineNumInnerWidth=u.lineNumChars=null;u.alignWidgets=!1;u.cachedCharWidth=u.cachedTextHeight=u.cachedPaddingH=null;u.maxLine=null;u.maxLineLength=0;u.maxLineChanged=!1;u.wheelDX=u.wheelDY=u.wheelStartX=u.wheelStartY=null;u.shift=!1;u.selForContextMenu=null;u.activeTouch=null;r.init(u)}function t(n,t){var i,r,u,f;if(t-=n.first,t<0||t>=n.size)throw new Error("There is no line "+(t+n.first)+" in the document.");for(i=n;!i.lines;)for(r=0;;++r){if(u=i.children[r],f=u.chunkSize(),t<f){i=u;break}t-=f}return i.lines[t]}function fr(n,t,i){var u=[],r=t.line;return n.iter(t.line,i.line+1,function(n){var f=n.text;r==i.line&&(f=f.slice(0,i.ch));r==t.line&&(f=f.slice(t.ch));u.push(f);++r}),u}function th(n,t,i){var r=[];return n.iter(t,i,function(n){r.push(n.text)}),r}function ni(n,t){var r=t-n.height,i;if(r)for(i=n;i;i=i.parent)i.height+=r}function h(n){var i,u,t,r;if(n.parent==null)return null;for(i=n.parent,u=d(i.lines,n),t=i.parent;t;i=t,t=t.parent)for(r=0;;++r){if(t.children[r]==i)break;u+=t.children[r].chunkSize()}return u+i.first}function er(n,t){var f=n.first,r,u,e,i,s,o;n:do{for(r=0;r<n.children.length;++r){if(u=n.children[r],e=u.height,t<e){n=u;continue n}t-=e;f+=u.chunkSize()}return f}while(!n.lines);for(i=0;i<n.lines.length;++i){if(s=n.lines[i],o=s.height,t<o)break;t-=o}return f+i}function af(n,t){return t>=n.first&&t<n.first+n.size}function ih(n,t){return String(n.lineNumberFormatter(t+n.firstLineNumber))}function n(t,i,r){if(r===void 0&&(r=null),!(this instanceof n))return new n(t,i,r);this.line=t;this.ch=i;this.sticky=r}function u(n,t){return n.line-t.line||n.ch-t.ch}function rh(n,t){return n.sticky==t.sticky&&u(n,t)==0}function uh(t){return n(t.line,t.ch)}function fo(n,t){return u(n,t)<0?t:n}function eo(n,t){return u(n,t)<0?n:t}function aa(n,t){return Math.max(n.first,Math.min(t,n.first+n.size-1))}function f(i,r){if(r.line<i.first)return n(i.first,0);var u=i.first+i.size-1;return r.line>u?n(u,t(i,u).text.length):sk(r,t(i,r.line).text.length)}function sk(t,i){var r=t.ch;return r==null||r>i?n(t.line,i):r<0?n(t.line,0):t}function va(n,t){for(var r=[],i=0;i<t.length;i++)r[i]=f(n,t[i]);return r}function hk(){fh=!0}function ck(){ti=!0}function oo(n,t,i){this.marker=n;this.from=t;this.to=i}function vf(n,t){var i,r;if(n)for(i=0;i<n.length;++i)if(r=n[i],r.marker==t)return r}function lk(n,t){for(var r,i=0;i<n.length;++i)n[i]!=t&&(r||(r=[])).push(n[i]);return r}function ak(n,t){n.markedSpans=n.markedSpans?n.markedSpans.concat([t]):[t];t.marker.attachLine(n)}function vk(n,t,i){var e,u,o;if(n)for(u=0;u<n.length;++u){var r=n[u],f=r.marker,s=r.from==null||(f.inclusiveLeft?r.from<=t:r.from<t);!s&&(r.from!=t||f.type!="bookmark"||i&&r.marker.insertLeft)||(o=r.to==null||(f.inclusiveRight?r.to>=t:r.to>t),(e||(e=[])).push(new oo(f,r.from,o?null:r.to)))}return e}function yk(n,t,i){var e,u,o;if(n)for(u=0;u<n.length;++u){var r=n[u],f=r.marker,s=r.to==null||(f.inclusiveRight?r.to>=t:r.to>t);(s||r.from==t&&f.type=="bookmark"&&(!i||r.marker.insertLeft))&&(o=r.from==null||(f.inclusiveLeft?r.from<=t:r.from<t),(e||(e=[])).push(new oo(f,o?null:r.from-t,r.to==null?null:r.to-t)))}return e}function eh(n,i){var w,b,a,h,v,y,e,it,p,d,g,c,nt;if(i.full||(w=af(n,i.from.line)&&t(n,i.from.line).markedSpans,b=af(n,i.to.line)&&t(n,i.to.line).markedSpans,!w&&!b))return null;var k=i.from.ch,rt=i.to.ch,tt=u(i.from,i.to)==0,r=vk(w,k,tt),f=yk(b,rt,tt),o=i.text.length==1,l=s(i.text).length+(o?k:0);if(r)for(a=0;a<r.length;++a)h=r[a],h.to==null&&(v=vf(f,h.marker),v?o&&(h.to=v.to==null?null:v.to+l):h.to=k);if(f)for(y=0;y<f.length;++y)e=f[y],e.to!=null&&(e.to+=l),e.from==null?(it=vf(r,e.marker),it||(e.from=l,o&&(r||(r=[])).push(e))):(e.from+=l,o&&(r||(r=[])).push(e));if(r&&(r=ya(r)),f&&f!=r&&(f=ya(f)),p=[r],!o){if(d=i.text.length-2,d>0&&r)for(c=0;c<r.length;++c)r[c].to==null&&(g||(g=[])).push(new oo(r[c].marker,null,null));for(nt=0;nt<d;++nt)p.push(g);p.push(f)}return p}function ya(n){for(var i,t=0;t<n.length;++t)i=n[t],i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&n.splice(t--,1);return n.length?n:null}function pk(n,t,i){var r=null,o,h,c,f,s,e;if(n.iter(t.line,i.line+1,function(n){var t,i;if(n.markedSpans)for(t=0;t<n.markedSpans.length;++t)i=n.markedSpans[t].marker,i.readOnly&&(!r||d(r,i)==-1)&&(r||(r=[])).push(i)}),!r)return null;for(o=[{from:t,to:i}],h=0;h<r.length;++h)for(c=r[h],f=c.find(0),s=0;s<o.length;++s)if(e=o[s],!(u(e.to,f.from)<0)&&!(u(e.from,f.to)>0)){var l=[s,1],a=u(e.from,f.from),v=u(e.to,f.to);(a<0||!c.inclusiveLeft&&!a)&&l.push({from:e.from,to:f.from});(v>0||!c.inclusiveRight&&!v)&&l.push({from:f.to,to:e.to});o.splice.apply(o,l);s+=l.length-3}return o}function pa(n){var i=n.markedSpans,t;if(i){for(t=0;t<i.length;++t)i[t].marker.detachLine(n);n.markedSpans=null}}function wa(n,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(n);n.markedSpans=t}}function so(n){return n.inclusiveLeft?-1:0}function ho(n){return n.inclusiveRight?1:0}function oh(n,t){var r=n.lines.length-t.lines.length,i;if(r!=0)return r;var f=n.find(),e=t.find(),o=u(f.from,e.from)||so(n)-so(t);return o?-o:(i=u(f.to,e.to)||ho(n)-ho(t),i)?i:t.id-n.id}function ba(n,t){var f=ti&&n.markedSpans,r,i,u;if(f)for(i=void 0,u=0;u<f.length;++u)i=f[u],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||oh(r,i.marker)<0)&&(r=i.marker);return r}function ka(n){return ba(n,!0)}function co(n){return ba(n,!1)}function wk(n,t){var f=ti&&n.markedSpans,r,u,i;if(f)for(u=0;u<f.length;++u)i=f[u],i.marker.collapsed&&(i.from==null||i.from<t)&&(i.to==null||i.to>t)&&(!r||oh(r,i.marker)<0)&&(r=i.marker);return r}function da(n,i,r,f,e){var v=t(n,i),l=ti&&v.markedSpans,h,o;if(l)for(h=0;h<l.length;++h)if(o=l[h],o.marker.collapsed){var s=o.marker.find(0),c=u(s.from,r)||so(o.marker)-so(e),a=u(s.to,f)||ho(o.marker)-ho(e);if((!(c>=0)||!(a<=0))&&(!(c<=0)||!(a>=0))&&(c<=0&&(o.marker.inclusiveRight&&e.inclusiveLeft?u(s.to,r)>=0:u(s.to,r)>0)||c>=0&&(o.marker.inclusiveRight&&e.inclusiveLeft?u(s.from,f)<=0:u(s.from,f)<0)))return!0}}function ii(n){for(var t;t=ka(n);)n=t.find(-1,!0).line;return n}function bk(n){for(var t;t=co(n);)n=t.find(1,!0).line;return n}function kk(n){for(var i,t;i=co(n);)n=i.find(1,!0).line,(t||(t=[])).push(n);return t}function sh(n,i){var r=t(n,i),u=ii(r);return r==u?i:h(u)}function ga(n,i){if(i>n.lastLine())return i;var r=t(n,i),u;if(!bi(n,r))return i;while(u=co(r))r=u.find(1,!0).line;return h(r)+1}function bi(n,t){var u=ti&&t.markedSpans,i,r;if(u)for(i=void 0,r=0;r<u.length;++r)if(i=u[r],i.marker.collapsed){if(i.from==null)return!0;if(!i.marker.widgetNode&&i.from==0&&i.marker.inclusiveLeft&&hh(n,t,i))return!0}}function hh(n,t,i){var f,r,u;if(i.to==null)return f=i.marker.find(1,!0),hh(n,f.line,vf(f.line.markedSpans,i.marker));if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(r=void 0,u=0;u<t.markedSpans.length;++u)if(r=t.markedSpans[u],r.marker.collapsed&&!r.marker.widgetNode&&r.from==i.to&&(r.to==null||r.to!=i.from)&&(r.marker.inclusiveLeft||i.marker.inclusiveRight)&&hh(n,t,r))return!0}function oi(n){var r,t,u,e,i,f,o;for(n=ii(n),r=0,t=n.parent,u=0;u<t.lines.length;++u)if(e=t.lines[u],e==n)break;else r+=e.height;for(i=t.parent;i;t=i,i=t.parent)for(f=0;f<i.children.length;++f)if(o=i.children[f],o==t)break;else r+=o.height;return r}function lo(n){var i,r,t,u,f;if(n.height==0)return 0;for(i=n.text.length,t=n;r=ka(t);)u=r.find(0,!0),t=u.from.line,i+=u.from.ch-u.to.ch;for(t=n;r=co(t);)f=r.find(0,!0),i-=t.text.length-f.from.ch,t=f.to.line,i+=t.text.length-f.to.ch;return i}function ch(n){var i=n.display,r=n.doc;i.maxLine=t(r,r.first);i.maxLineLength=lo(i.maxLine);i.maxLineChanged=!0;r.iter(function(n){var t=lo(n);t>i.maxLineLength&&(i.maxLineLength=t,i.maxLine=n)})}function dk(n,t,i,r){var e,f,u;if(!n)return r(t,i,"ltr",0);for(e=!1,f=0;f<n.length;++f)u=n[f],(u.from<i&&u.to>t||t==i&&u.to==t)&&(r(Math.max(u.from,t),Math.min(u.to,i),u.level==1?"rtl":"ltr",f),e=!0);e||r(t,i,"ltr")}function yf(n,t,i){var f,r,u;for(iu=null,r=0;r<n.length;++r){if(u=n[r],u.from<t&&u.to>t)return r;u.to==t&&(u.from!=u.to&&i=="before"?f=r:iu=r);u.from==t&&(u.from!=u.to&&i!="before"?f=r:iu=r)}return f!=null?f:iu}function si(n,t){var i=n.order;return i==null&&(i=n.order=nv(n.text,t)),i}function ah(n,t){return n._handlers&&n._handlers[t]||lh}function lt(n,t,i){var u,r,f;n.removeEventListener?n.removeEventListener(t,i,!1):n.detachEvent?n.detachEvent("on"+t,i):(u=n._handlers,r=u&&u[t],r&&(f=d(r,i),f>-1&&(u[t]=r.slice(0,f).concat(r.slice(f+1)))))}function p(n,t){var r=ah(n,t),u,i;if(r.length)for(u=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,u)}function w(n,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),p(n,i||t.type,n,t),vh(t)||t.codemirrorIgnore}function tv(n){var i=n._handlers&&n._handlers.cursorActivity,r,t;if(i)for(r=n.curOp.cursorActivityHandlers||(n.curOp.cursorActivityHandlers=[]),t=0;t<i.length;++t)d(r,i[t])==-1&&r.push(i[t])}function vt(n,t){return ah(n,t).length>0}function ru(n){n.prototype.on=function(n,t){r(this,n,t)};n.prototype.off=function(n,t){lt(this,n,t)}}function ft(n){n.preventDefault?n.preventDefault():n.returnValue=!1}function iv(n){n.stopPropagation?n.stopPropagation():n.cancelBubble=!0}function vh(n){return n.defaultPrevented!=null?n.defaultPrevented:n.returnValue==!1}function pf(n){ft(n);iv(n)}function yh(n){return n.target||n.srcElement}function rv(n){var t=n.which;return t==null&&(n.button&1?t=1:n.button&2?t=3:n.button&4&&(t=2)),wt&&n.ctrlKey&&t==1&&(t=3),t}function gk(n){var t,r;return ph==null&&(t=i("span","​"),ct(n,i("span",[t,document.createTextNode("x")])),n.firstChild.offsetHeight!=0&&(ph=t.offsetWidth<=1&&t.offsetHeight>2&&!(e&&l<8))),r=ph?i("span","​"):i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px"),r.setAttribute("cm-text",""),r}function nd(n){if(wh!=null)return wh;var i=ct(n,document.createTextNode("AخA")),t=nu(i,0,1).getBoundingClientRect(),r=nu(i,1,2).getBoundingClientRect();return(yi(n),!t||t.left==t.right)?!1:wh=r.right-t.right<3}function rd(n){if(kh!=null)return kh;var t=ct(n,i("span","x")),r=t.getBoundingClientRect(),u=nu(t,0,1).getBoundingClientRect();return kh=Math.abs(r.left-u.left)>1}function ud(n,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2));ao[n]=t}function fd(n,t){or[n]=t}function vo(n){if(typeof n=="string"&&or.hasOwnProperty(n))n=or[n];else if(n&&typeof n.name=="string"&&or.hasOwnProperty(n.name)){var t=or[n.name];typeof t=="string"&&(t={name:t});n=oa(t,n);n.name=t.name}else{if(typeof n=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(n))return vo("application/xml");if(typeof n=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(n))return vo("application/json")}return typeof n=="string"?{name:n}:n||{name:"null"}}function dh(n,t){var f,i,u,r,e;if(t=vo(t),f=ao[t.name],!f)return dh(n,"text/plain");if(i=f(n,t),sr.hasOwnProperty(t.name)){u=sr[t.name];for(r in u)u.hasOwnProperty(r)&&(i.hasOwnProperty(r)&&(i["_"+r]=i[r]),i[r]=u[r])}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(e in t.modeProps)i[e]=t.modeProps[e];return i}function ed(n,t){var i=sr.hasOwnProperty(n)?sr[n]:sr[n]={};ur(t,i)}function hr(n,t){var r,u,i;if(t===!0)return t;if(n.copyState)return n.copyState(t);r={};for(u in t)i=t[u],i instanceof Array&&(i=i.concat([])),r[u]=i;return r}function gh(n,t){for(var i;n.innerMode;){if(i=n.innerMode(t),!i||i.mode==n)break;t=i.state;n=i.mode}return i||{mode:n,state:t}}function fv(n,t,i){return n.startState?n.startState(t,i):!0}function ev(n,t,i,r){var u=[n.state.modeGen],f={},o,s,e;for(lv(n,t.text,n.doc.mode,i,function(n,t){return u.push(n,t)},f,r),o=i.state,s=function(r){i.baseTokens=u;var s=n.state.overlays[r],e=1,h=0;i.state=!0;lv(n,t.text,s.mode,i,function(n,t){for(var i=e,r,f;h<n;)r=u[e],r>n&&u.splice(e,1,n,u[e+1],r),e+=2,h=Math.min(n,r);if(t)if(s.opaque)u.splice(i,e-i,n,"overlay "+t),e=i+2;else for(;i<e;i+=2)f=u[i+1],u[i+1]=(f?f+" ":"")+"overlay "+t},f);i.state=o;i.baseTokens=null;i.baseTokenPos=1},e=0;e<n.state.overlays.length;++e)s(e);return{styles:u,classes:f.bgClass||f.textClass?f:null}}function ov(n,t,i){if(!t.styles||t.styles[0]!=n.state.modeGen){var r=bf(n,h(t)),u=t.text.length>n.options.maxHighlightLength&&hr(n.doc.mode,r.state),f=ev(n,t,r);u&&(r.state=u);t.stateAfter=r.save(!u);t.styles=f.styles;f.classes?t.styleClasses=f.classes:t.styleClasses&&(t.styleClasses=null);i===n.doc.highlightFrontier&&(n.doc.modeFrontier=Math.max(n.doc.modeFrontier,++n.doc.highlightFrontier))}return t.styles}function bf(n,i,r){var u=n.doc,o=n.display;if(!u.mode.startState)return new bt(u,!0,i);var e=od(n,i,r),s=e>u.first&&t(u,e-1).stateAfter,f=s?bt.fromSaved(u,s,e):new bt(u,fv(u.mode),e);return u.iter(e,i,function(t){nc(n,t.text,f);var r=f.line;t.stateAfter=r==i-1||r%5==0||r>=o.viewFrom&&r<o.viewTo?f.save():null;f.nextLine()}),r&&(u.modeFrontier=f.line),f}function nc(n,t,i,r){var f=n.doc.mode,u=new v(t,n.options.tabSize,i);for(u.start=u.pos=r||0,t==""&&sv(f,i.state);!u.eol();)tc(f,u,i.state),u.start=u.pos}function sv(n,t){if(n.blankLine)return n.blankLine(t);if(n.innerMode){var i=gh(n,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}}function tc(n,t,i,r){for(var f,u=0;u<10;u++)if(r&&(r[0]=gh(n,i).mode),f=n.token(t,i),t.pos>t.start)return f;throw new Error("Mode "+n.name+" failed to advance stream.");}function hv(n,i,r,u){var o=n.doc,l=o.mode,h;i=f(o,i);var a=t(o,i.line),s=bf(n,i.line,r),e=new v(a.text,n.options.tabSize,s),c;for(u&&(c=[]);(u||e.pos<i.ch)&&!e.eol();)e.start=e.pos,h=tc(l,e,s.state),u&&c.push(new ic(e,h,hr(o.mode,s.state)));return u?c:new ic(e,h,s.state)}function cv(n,t){var i,r;if(n)for(;;){if(i=n.match(/(?:^|\s+)line-(background-)?(\S+)/),!i)break;n=n.slice(0,i.index)+n.slice(i.index+i[0].length);r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|s)"+i[2]+"(?:$|s)").test(t[r])||(t[r]+=" "+i[2])}return n}function lv(n,t,i,r,u,f,e){var c=i.flattenSpans,a,p;c==null&&(c=n.options.flattenSpans);var s=0,l=null,o=new v(t,n.options.tabSize,r),h,y=n.options.addModeClass&&[null];for(t==""&&cv(sv(i,r.state),f);!o.eol();){if(o.pos>n.options.maxHighlightLength?(c=!1,e&&nc(n,t,r,o.pos),o.pos=t.length,h=null):h=cv(tc(i,o,r.state,y),f),y&&(a=y[0].name,a&&(h="m-"+(h?a+" "+h:a))),!c||l!=h){while(s<o.start)s=Math.min(o.start,s+5e3),u(s,l);l=h}o.start=o.pos}while(s<o.pos)p=Math.min(o.pos,s+5e3),u(p,l),s=p}function od(n,i,r){for(var s,e,h,c,o,f=n.doc,l=r?-1:i-(n.doc.mode.innerMode?1e3:100),u=i;u>l;--u){if(u<=f.first)return f.first;if(s=t(f,u-1),e=s.stateAfter,e&&(!r||u+(e instanceof wf?e.lookAhead:0)<=f.modeFrontier))return u;h=at(s.text,null,n.options.tabSize);(o==null||c>h)&&(o=u-1,c=h)}return o}function sd(n,i){var u,r,f;if(n.modeFrontier=Math.min(n.modeFrontier,i),!(n.highlightFrontier<i-10)){for(u=n.first,r=i-1;r>u;r--)if(f=t(n,r).stateAfter,f&&(!(f instanceof wf)||r+f.lookAhead<i)){u=r+1;break}n.highlightFrontier=Math.min(n.highlightFrontier,u)}}function hd(n,t,i,r){n.text=t;n.stateAfter&&(n.stateAfter=null);n.styles&&(n.styles=null);n.order!=null&&(n.order=null);pa(n);wa(n,i);var u=r?r(n):1;u!=n.height&&ni(n,u)}function cd(n){n.parent=null;pa(n)}function yv(n,t){if(!n||/^\s*$/.test(n))return null;var i=t.addModeClass?vv:av;return i[n]||(i[n]=n.replace(/\S+/g,"cm-$&"))}function pv(n,t){var o=gr("span",null,null,it?"padding-right: .1px":null),i={pre:gr("pre",[o],"CodeMirror-line"),content:o,col:0,pos:0,cm:n,trailingSpace:!1,splitSpaces:n.getOption("lineWrapping")},u,r,e,s,f;for(t.measure={},u=0;u<=(t.rest?t.rest.length:0);u++)r=u?t.rest[u-1]:t.line,e=void 0,i.pos=0,i.addToken=ad,nd(n.display.measure)&&(e=si(r,n.doc.direction))&&(i.addToken=yd(i.addToken,e)),i.map=[],s=t!=n.display.externalMeasured&&h(r),pd(r,i,ov(n,r,s)),r.styleClasses&&(r.styleClasses.bgClass&&(i.bgClass=ps(r.styleClasses.bgClass,i.bgClass||"")),r.styleClasses.textClass&&(i.textClass=ps(r.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(gk(n.display.measure))),u==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}));return it&&(f=i.content.lastChild,(/\bcm-tab\b/.test(f.className)||f.querySelector&&f.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")),p(n,"renderLine",n,t.line,i.pre),i.pre.className&&(i.textClass=ps(i.pre.className,i.textClass||"")),i}function ld(n){var t=i("span","•","cm-invalidchar");return t.title="\\u"+n.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ad(n,t,r,u,f,o,s){var v,c,y,w,a,g,nt,b,tt,p;if(t){var k=n.splitSpaces?vd(t,n.trailingSpace):t,d=n.cm.state.specialChars,it=!1,h;if(d.test(t))for(h=document.createDocumentFragment(),v=0;;){if(d.lastIndex=v,c=d.exec(t),y=c?c.index-v:t.length-v,y&&(w=document.createTextNode(k.slice(v,v+y)),e&&l<9?h.appendChild(i("span",[w])):h.appendChild(w),n.map.push(n.pos,n.pos+y,w),n.col+=y,n.pos+=y),!c)break;v+=y+1;a=void 0;c[0]=="\t"?(g=n.cm.options.tabSize,nt=g-n.col%g,a=h.appendChild(i("span",ds(nt),"cm-tab")),a.setAttribute("role","presentation"),a.setAttribute("cm-text","\t"),n.col+=nt):c[0]=="\r"||c[0]=="\n"?(a=h.appendChild(i("span",c[0]=="\r"?"␍":"␤","cm-invalidchar")),a.setAttribute("cm-text",c[0]),n.col+=1):(a=n.cm.options.specialCharPlaceholder(c[0]),a.setAttribute("cm-text",c[0]),e&&l<9?h.appendChild(i("span",[a])):h.appendChild(a),n.col+=1);n.map.push(n.pos,n.pos+1,a);n.pos++}else n.col+=t.length,h=document.createTextNode(k),n.map.push(n.pos,n.pos+t.length,h),e&&l<9&&(it=!0),n.pos+=t.length;if(n.trailingSpace=k.charCodeAt(t.length-1)==32,r||u||f||it||o){if(b=r||"",u&&(b+=u),f&&(b+=f),tt=i("span",[h],b,o),s)for(p in s)s.hasOwnProperty(p)&&p!="style"&&p!="class"&&tt.setAttribute(p,s[p]);return n.content.appendChild(tt)}n.content.appendChild(h)}}function vd(n,t){var u,f,i,r;if(n.length>1&&!/  /.test(n))return n;for(u=t,f="",i=0;i<n.length;i++)r=n.charAt(i),r==" "&&u&&(i==n.length-1||n.charCodeAt(i+1)==32)&&(r=" "),f+=r,u=r==" ";return f}function yd(n,t){return function(i,r,u,f,e,o,s){var c,a,h,l;for(u=u?u+" cm-force-border":"cm-force-border",c=i.pos,a=c+r.length;;){for(h=void 0,l=0;l<t.length;l++)if(h=t[l],h.to>c&&h.from<=c)break;if(h.to>=a)return n(i,r,u,f,e,o,s);n(i,r.slice(0,h.to-c),u,f,null,o,s);f=null;r=r.slice(h.to-c);c=h.to}}}function wv(n,t,i,r){var u=!r&&i.widgetNode;u&&n.map.push(n.pos,n.pos+t,u);!r&&n.cm.display.input.needsContentAttribute&&(u||(u=n.content.appendChild(document.createElement("span"))),u.setAttribute("cm-marker",i.id));u&&(n.cm.display.input.setUneditable(u),n.content.appendChild(u));n.pos+=t;n.trailingSpace=!1}function pd(n,t,i){var it=n.markedSpans,rt=n.text,p=0,a,d,h,g,f,u,et,y,nt,l,tt,ot;if(!it){for(a=1;a<i.length;a+=2)t.addToken(t,rt.slice(p,p=i[a]),yv(i[a+1],t.cm.options));return}for(var ut=rt.length,r=0,st=1,s="",ft,v,o=0,w,b,k,e,c;;){if(o==r){for(w=b=k=v="",c=null,e=null,o=Infinity,d=[],h=void 0,g=0;g<it.length;++g)if(f=it[g],u=f.marker,u.type=="bookmark"&&f.from==r&&u.widgetNode)d.push(u);else if(f.from<=r&&(f.to==null||f.to>r||u.collapsed&&f.to==r&&f.from==r)){if(f.to!=null&&f.to!=r&&o>f.to&&(o=f.to,b=""),u.className&&(w+=" "+u.className),u.css&&(v=(v?v+";":"")+u.css),u.startStyle&&f.from==r&&(k+=" "+u.startStyle),u.endStyle&&f.to==o&&(h||(h=[])).push(u.endStyle,f.to),u.title&&((c||(c={})).title=u.title),u.attributes)for(et in u.attributes)(c||(c={}))[et]=u.attributes[et];u.collapsed&&(!e||oh(e.marker,u)<0)&&(e=f)}else f.from>r&&o>f.from&&(o=f.from);if(h)for(y=0;y<h.length;y+=2)h[y+1]==o&&(b+=" "+h[y]);if(!e||e.from==r)for(nt=0;nt<d.length;++nt)wv(t,0,d[nt]);if(e&&(e.from||0)==r){if(wv(t,(e.to==null?ut+1:e.to)-r,e.marker,e.from==null),e.to==null)return;e.to==r&&(e=!1)}}if(r>=ut)break;for(l=Math.min(ut,o);;){if(s){if(tt=r+s.length,e||(ot=tt>l?s.slice(0,l-r):s,t.addToken(t,ot,ft?ft+w:w,k,r+ot.length==o?b:"",v,c)),tt>=l){s=s.slice(l-r);r=l;break}r=tt;k=""}s=rt.slice(p,p=i[st++]);ft=yv(i[st++],t.cm.options)}}}function bv(n,t,i){this.line=t;this.rest=kk(t);this.size=this.rest?h(s(this.rest))-i+1:1;this.node=this.text=null;this.hidden=bi(n,t)}function yo(n,i,r){for(var f,e=[],o,u=i;u<r;u=o)f=new bv(n.doc,t(n.doc,u),u),o=u+f.size,e.push(f);return e}function wd(n){lr?lr.ops.push(n):n.ownsGroup=lr={ops:[n],delayedCallbacks:[]}}function bd(n){var u=n.delayedCallbacks,i=0,r,t;do{for(;i<u.length;i++)u[i].call(null);for(r=0;r<n.ops.length;r++)if(t=n.ops[r],t.cursorActivityHandlers)while(t.cursorActivityCalled<t.cursorActivityHandlers.length)t.cursorActivityHandlers[t.cursorActivityCalled++].call(null,t.cm)}while(i<u.length)}function kd(n,t){var i=n.ownsGroup;if(i)try{bd(i)}finally{lr=null;t(i)}}function g(n,t){var u=ah(n,t),f,i,e,r;if(u.length)for(f=Array.prototype.slice.call(arguments,2),lr?i=lr.delayedCallbacks:uu?i=uu:(i=uu=[],setTimeout(dd,0)),e=function(n){i.push(function(){return u[n].apply(null,f)})},r=0;r<u.length;++r)e(r)}function dd(){var t=uu,n;for(uu=null,n=0;n<t.length;++n)t[n]()}function kv(n,t,i,r){for(var u,f=0;f<t.changes.length;f++)u=t.changes[f],u=="text"?ng(n,t):u=="gutter"?gv(n,t,i,r):u=="class"?rc(n,t):u=="widget"&&tg(n,t,r);t.changes=null}function kf(n){return n.node==n.text&&(n.node=i("div",null,null,"position: relative"),n.text.parentNode&&n.text.parentNode.replaceChild(n.node,n.text),n.node.appendChild(n.text),e&&l<8&&(n.node.style.zIndex=2)),n.node}function gd(n,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass,u;r&&(r+=" CodeMirror-linebackground");t.background?r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null):r&&(u=kf(t),t.background=u.insertBefore(i("div",null,r),u.firstChild),n.display.input.setUneditable(t.background))}function dv(n,t){var i=n.display.externalMeasured;return i&&i.line==t.line?(n.display.externalMeasured=null,t.measure=i.measure,i.built):pv(n,t)}function ng(n,t){var r=t.text.className,i=dv(n,t);t.text==t.node&&(t.node=i.pre);t.text.parentNode.replaceChild(i.pre,t.text);t.text=i.pre;i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,rc(n,t)):r&&(t.text.className=r)}function rc(n,t){gd(n,t);t.line.wrapClass?kf(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function gv(n,t,r,u){var c,f,l,e,s,o,h;if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass&&(c=kf(t),t.gutterBackground=i("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(n.options.fixedGutter?u.fixedPos:-u.gutterTotalWidth)+"px; width: "+u.gutterTotalWidth+"px"),n.display.input.setUneditable(t.gutterBackground),c.insertBefore(t.gutterBackground,t.text)),f=t.line.gutterMarkers,(n.options.lineNumbers||f)&&(l=kf(t),e=t.gutter=i("div",null,"CodeMirror-gutter-wrapper","left: "+(n.options.fixedGutter?u.fixedPos:-u.gutterTotalWidth)+"px"),n.display.input.setUneditable(e),l.insertBefore(e,t.text),t.line.gutterClass&&(e.className+=" "+t.line.gutterClass),!n.options.lineNumbers||f&&f["CodeMirror-linenumbers"]||(t.lineNumber=e.appendChild(i("div",ih(n.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+u.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+n.display.lineNumInnerWidth+"px"))),f))for(s=0;s<n.options.gutters.length;++s)o=n.options.gutters[s],h=f.hasOwnProperty(o)&&f[o],h&&e.appendChild(i("div",[h],"CodeMirror-gutter-elt","left: "+u.gutterLeft[o]+"px; width: "+u.gutterWidth[o]+"px"))}function tg(n,t,i){t.alignable&&(t.alignable=null);for(var r=t.node.firstChild,u=void 0;r;r=u)u=r.nextSibling,r.className=="CodeMirror-linewidget"&&t.node.removeChild(r);ny(n,t,i)}function ig(n,t,i,r){var u=dv(n,t);return t.text=t.node=u.pre,u.bgClass&&(t.bgClass=u.bgClass),u.textClass&&(t.textClass=u.textClass),rc(n,t),gv(n,t,i,r),ny(n,t,r),t.node}function ny(n,t,i){if(ty(n,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)ty(n,t.rest[r],t,i,!1)}function ty(n,t,r,u,f){var h,s,c,e,o;if(t.widgets)for(h=kf(r),s=0,c=t.widgets;s<c.length;++s)e=c[s],o=i("div",[e.node],"CodeMirror-linewidget"),e.handleMouseEvents||o.setAttribute("cm-ignore-events","true"),rg(e,o,r,u),n.display.input.setUneditable(o),f&&e.above?h.insertBefore(o,r.gutter||r.text):h.appendChild(o),g(e,"redraw")}function rg(n,t,i,r){if(n.noHScroll){(i.alignable||(i.alignable=[])).push(t);var u=r.wrapperWidth;t.style.left=r.fixedPos+"px";n.coverGutter||(u-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px");t.style.width=u+"px"}n.coverGutter&&(t.style.zIndex=5,t.style.position="relative",n.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function df(n){var t,r;return n.height!=null?n.height:(t=n.doc.cm,!t)?0:(pi(document.body,n.node)||(r="position: relative;",n.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),n.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),ct(t.display.measure,i("div",[n.node],null,r))),n.height=n.node.parentNode.offsetHeight)}function hi(n,t){for(var i=yh(t);i!=n.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==n.sizer&&i!=n.mover)return!0}function po(n){return n.lineSpace.offsetTop}function uc(n){return n.mover.offsetHeight-n.lineSpace.offsetHeight}function iy(n){if(n.cachedPaddingH)return n.cachedPaddingH;var r=ct(n.measure,i("pre","x")),u=window.getComputedStyle?window.getComputedStyle(r):r.currentStyle,t={left:parseInt(u.paddingLeft),right:parseInt(u.paddingRight)};return isNaN(t.left)||isNaN(t.right)||(n.cachedPaddingH=t),t}function ri(n){return fa-n.display.nativeBarWidth}function ar(n){return n.display.scroller.clientWidth-ri(n)-n.display.barWidth}function fc(n){return n.display.scroller.clientHeight-ri(n)-n.display.barHeight}function ug(n,t,i){var f=n.options.lineWrapping,h=f&&ar(n),e,u,r,o,s;if(!t.measure.heights||f&&t.measure.width!=h){if(e=t.measure.heights=[],f)for(t.measure.width=h,u=t.text.firstChild.getClientRects(),r=0;r<u.length-1;r++)o=u[r],s=u[r+1],Math.abs(o.bottom-s.bottom)>2&&e.push((o.bottom+s.top)/2-i.top);e.push(i.bottom-i.top)}}function ry(n,t,i){var r,u;if(n.line==t)return{map:n.measure.map,cache:n.measure.cache};for(r=0;r<n.rest.length;r++)if(n.rest[r]==t)return{map:n.measure.maps[r],cache:n.measure.caches[r]};for(u=0;u<n.rest.length;u++)if(h(n.rest[u])>i)return{map:n.measure.maps[u],cache:n.measure.caches[u],before:!0}}function fg(n,t){var r,i,u;return t=ii(t),r=h(t),i=n.display.externalMeasured=new bv(n.doc,t,r),i.lineN=r,u=i.built=pv(n,i),i.text=u.pre,ct(n.display.lineMeasure,u.pre),i}function uy(n,t,i,r){return ui(n,fu(n,t),i,r)}function ec(n,t){if(t>=n.display.viewFrom&&t<n.display.viewTo)return n.display.view[pr(n,t)];var i=n.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function fu(n,t){var u=h(t),i=ec(n,u),r;return i&&!i.text?i=null:i&&i.changes&&(kv(n,i,u,vc(n)),n.curOp.forceUpdate=!0),i||(i=fg(n,t)),r=ry(i,t,u),{line:t,view:i,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function ui(n,t,i,r,u){t.before&&(i=-1);var e=i+(r||""),f;return t.cache.hasOwnProperty(e)?f=t.cache[e]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(ug(n,t.view,t.rect),t.hasHeights=!0),f=og(n,t,i,r),f.bogus||(t.cache[e]=f)),{left:f.left,right:f.right,top:u?f.rtop:f.top,bottom:u?f.rbottom:f.bottom}}function fy(n,t,i){for(var s,u,h,o,e,f,r=0;r<n.length;r+=3)if(e=n[r],f=n[r+1],t<e?(u=0,h=1,o="left"):t<f?(u=t-e,h=u+1):(r==n.length-3||t==f&&n[r+3]>t)&&(h=f-e,u=h-1,t>=f&&(o="right")),u!=null){if(s=n[r+2],e==f&&i==(s.insertLeft?"left":"right")&&(o=i),i=="left"&&u==0)while(r&&n[r-2]==n[r-3]&&n[r-1].insertLeft)s=n[(r-=3)+2],o="left";if(i=="right"&&u==f-e)while(r<n.length-3&&n[r+3]==n[r+4]&&!n[r+5].insertLeft)s=n[(r+=3)+2],o="right";break}return{node:s,start:u,end:h,collapse:o,coverStart:e,coverEnd:f}}function eg(n,t){var i=oc,r,u;if(t=="left"){for(r=0;r<n.length;r++)if((i=n[r]).left!=i.right)break}else for(u=n.length-1;u>=0;u--)if((i=n[u]).left!=i.right)break;return i}function og(n,t,i,r){var o=fy(t.map,i,r),s=o.node,f=o.start,h=o.end,v=o.collapse,u,w,b,c;if(s.nodeType==3){for(w=0;w<4;w++){while(f&&nh(t.line.text.charAt(o.coverStart+f)))--f;while(o.coverStart+h<o.coverEnd&&nh(t.line.text.charAt(o.coverStart+h)))++h;if(u=e&&l<9&&f==0&&h==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():eg(nu(s,f,h).getClientRects(),r),u.left||u.right||f==0)break;h=f;f=f-1;v="right"}e&&l<11&&(u=sg(n.display.measure,u))}else f>0&&(v=r="right"),u=n.options.lineWrapping&&(b=s.getClientRects()).length>1?b[r=="right"?b.length-1:0]:s.getBoundingClientRect();e&&l<9&&!f&&(!u||!u.left&&!u.right)&&(c=s.parentNode.getClientRects()[0],u=c?{left:c.left,right:c.left+ou(n.display),top:c.top,bottom:c.bottom}:oc);for(var k=u.top-t.rect.top,d=u.bottom-t.rect.top,g=(k+d)/2,y=t.view.measure.heights,a=0;a<y.length-1;a++)if(g<y[a])break;var nt=a?y[a-1]:0,tt=y[a],p={left:(v=="right"?u.right:u.left)-t.rect.left,right:(v=="left"?u.left:u.right)-t.rect.left,top:nt,bottom:tt};return u.left||u.right||(p.bogus=!0),n.options.singleCursorHeightPerLine||(p.rtop=k,p.rbottom=d),p}function sg(n,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!rd(n))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function ey(n){if(n.measure&&(n.measure.cache={},n.measure.heights=null,n.rest))for(var t=0;t<n.rest.length;t++)n.measure.caches[t]={}}function oy(n){n.display.externalMeasure=null;yi(n.display.lineMeasure);for(var t=0;t<n.display.view.length;t++)ey(n.display.view[t])}function gf(n){oy(n);n.display.cachedCharWidth=n.display.cachedTextHeight=n.display.cachedPaddingH=null;n.options.lineWrapping||(n.display.maxLineChanged=!0);n.display.lineNumChars=null}function sy(){return ge&&no?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function hy(){return ge&&no?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function sc(n){var i=0,t;if(n.widgets)for(t=0;t<n.widgets.length;++t)n.widgets[t].above&&(i+=df(n.widgets[t]));return i}function wo(n,t,i,r,u){var e,f,o,s;return(u||(e=sc(t),i.top+=e,i.bottom+=e),r=="line")?i:(r||(r="local"),f=oi(t),r=="local"?f+=po(n.display):f-=n.display.viewOffset,(r=="page"||r=="window")&&(o=n.display.lineSpace.getBoundingClientRect(),f+=o.top+(r=="window"?0:hy()),s=o.left+(r=="window"?0:sy()),i.left+=s,i.right+=s),i.top+=f,i.bottom+=f,i)}function cy(n,t,i){var r,u,f,e;return i=="div"?t:(r=t.left,u=t.top,i=="page"?(r-=sy(),u-=hy()):i!="local"&&i||(f=n.display.sizer.getBoundingClientRect(),r+=f.left,u+=f.top),e=n.display.lineSpace.getBoundingClientRect(),{left:r-e.left,top:u-e.top})}function hc(n,i,r,u,f){return u||(u=t(n.doc,i.line)),wo(n,u,uy(n,u,i.ch,f),r)}function kt(n,i,r,u,f,e){function c(t,i){var o=ui(n,f,t,i?"right":"left",e);return i?o.left=o.right:o.right=o.left,wo(n,u,o,r)}function l(n,t,i){var r=h[t],u=r.level==1;return c(i?n-1:n,u!=i)}u=u||t(n.doc,i.line);f||(f=fu(n,u));var h=si(u,n.doc.direction),o=i.ch,s=i.sticky;if(o>=u.text.length?(o=u.text.length,s="before"):o<=0&&(o=0,s="after"),!h)return c(s=="before"?o-1:o,s=="before");var y=yf(h,o,s),a=iu,v=l(o,y,s=="before");return a!=null&&(v.other=l(o,a,s!="before")),v}function ly(n,i){var r=0,u,e;return i=f(n.doc,i),n.options.lineWrapping||(r=ou(n.display)*i.ch),u=t(n.doc,i.line),e=oi(u)+po(n.display),{left:r,right:r,top:e,bottom:e+u.height}}function cc(t,i,r,u,f){var e=n(t,i,r);return e.xRel=f,u&&(e.outside=!0),e}function lc(n,i,r){var u=n.doc,f,h,e,o,c,s;if(r+=n.display.viewOffset,r<0)return cc(u.first,0,null,!0,-1);if(f=er(u,r),h=u.first+u.size-1,f>h)return cc(u.first+u.size-1,t(u,h).text.length,null,!0,1);for(i<0&&(i=0),e=t(u,f);;){if(o=hg(n,e,f,i,r),c=wk(e,o.ch+(o.xRel>0?1:0)),!c)return o;if(s=c.find(1),s.line==f)return s;e=t(u,f=s.line)}}function ay(n,t,i,r){r-=sc(t);var u=t.text.length,f=lf(function(t){return ui(n,i,t-1).bottom<=r},u,0);return u=lf(function(t){return ui(n,i,t).top>r},f,u),{begin:f,end:u}}function vy(n,t,i,r){i||(i=fu(n,t));var u=wo(n,t,ui(n,i,r),"line").top;return ay(n,t,i,u)}function ac(n,t,i,r){return n.bottom<=i?!1:n.top>i?!0:(r?n.left:n.right)>t}function hg(t,i,r,u,f){var s,b,k,a;f-=oi(i);var c=fu(t,i),v=sc(i),y=0,p=i.text.length,o=!0,d=si(i,t.doc.direction);d&&(s=(t.options.lineWrapping?lg:cg)(t,i,r,c,d,u,f),o=s.level!=1,y=o?s.from:s.to-1,p=o?s.to:s.from-1);var g=null,h=null,e=lf(function(n){var i=ui(t,c,n);return(i.top+=v,i.bottom+=v,!ac(i,u,f,!1))?!1:(i.top<=f&&i.left<=u&&(g=n,h=i),!0)},y,p),w,l,nt=!1;return h?(b=u-h.left<h.right-u,k=b==o,e=g+(k?0:1),l=k?"after":"before",w=b?h.left:h.right):(o||e!=p&&e!=y||e++,l=e==0?"after":e==i.text.length?"before":ui(t,c,e-(o?1:0)).bottom+v<=f==o?"after":"before",a=kt(t,n(r,e,l),"line",i,c),w=a.left,nt=f<a.top||f>=a.bottom),e=la(i.text,e,1),cc(r,e,l,nt,u-w)}function cg(t,i,r,u,f,e,o){var h=lf(function(s){var h=f[s],c=h.level!=1;return ac(kt(t,n(r,c?h.to:h.from,c?"before":"after"),"line",i,u),e,o,!0)},0,f.length-1),s=f[h],c,l;return h>0&&(c=s.level!=1,l=kt(t,n(r,c?s.from:s.to,c?"after":"before"),"line",i,u),ac(l,e,o,!0)&&l.top>o&&(s=f[h-1])),s}function lg(n,t,i,r,u,f,e){var y=ay(n,t,r,e),c=y.begin,h=y.end,o,a,l,s;for(/\s/.test(t.text.charAt(h-1))&&h--,o=null,a=null,l=0;l<u.length;l++)if(s=u[l],!(s.from>=h)&&!(s.to<=c)){var w=s.level!=1,v=ui(n,r,w?Math.min(h,s.to)-1:Math.max(c,s.from)).right,p=v<f?f-v+1e9:v-f;(!o||a>p)&&(o=s,a=p)}return o||(o=u[u.length-1]),o.from<c&&(o={from:c,to:o.to,level:o.level}),o.to>h&&(o={from:o.from,to:h,level:o.level}),o}function eu(n){var r,t;if(n.cachedTextHeight!=null)return n.cachedTextHeight;if(vr==null){for(vr=i("pre"),r=0;r<49;++r)vr.appendChild(document.createTextNode("x")),vr.appendChild(i("br"));vr.appendChild(document.createTextNode("x"))}return ct(n.measure,vr),t=vr.offsetHeight/50,t>3&&(n.cachedTextHeight=t),yi(n.measure),t||1}function ou(n){var r,f,u,t;return n.cachedCharWidth!=null?n.cachedCharWidth:(r=i("span","xxxxxxxxxx"),f=i("pre",[r]),ct(n.measure,f),u=r.getBoundingClientRect(),t=(u.right-u.left)/10,t>2&&(n.cachedCharWidth=t),t||10)}function vc(n){for(var i=n.display,u={},f={},e=i.gutters.clientLeft,t=i.gutters.firstChild,r=0;t;t=t.nextSibling,++r)u[n.options.gutters[r]]=t.offsetLeft+t.clientLeft+e,f[n.options.gutters[r]]=t.clientWidth;return{fixedPos:yc(i),gutterTotalWidth:i.gutters.offsetWidth,gutterLeft:u,gutterWidth:f,wrapperWidth:i.wrapper.clientWidth}}function yc(n){return n.scroller.getBoundingClientRect().left-n.sizer.getBoundingClientRect().left}function yy(n){var t=eu(n.display),i=n.options.lineWrapping,r=i&&Math.max(5,n.display.scroller.clientWidth/ou(n.display)-3);return function(u){var e,f;if(bi(n.doc,u))return 0;if(e=0,u.widgets)for(f=0;f<u.widgets.length;f++)u.widgets[f].height&&(e+=u.widgets[f].height);return i?e+(Math.ceil(u.text.length/r)||1)*t:e+t}}function pc(n){var t=n.doc,i=yy(n);t.iter(function(n){var t=i(n);t!=n.height&&ni(n,t)})}function yr(i,r,u,f){var a=i.display,s,c,h,e,o,l;if(!u&&yh(r).getAttribute("cm-not-content")=="true")return null;h=a.lineSpace.getBoundingClientRect();try{s=r.clientX-h.left;c=r.clientY-h.top}catch(r){return null}return e=lc(i,s,c),f&&e.xRel==1&&(o=t(i.doc,e.line).text).length==e.ch&&(l=at(o,o.length,i.options.tabSize)-o.length,e=n(e.line,Math.max(0,Math.round((s-iy(i.display).left)/ou(i.display))-l))),e}function pr(n,t){var r,i;if(t>=n.display.viewTo||(t-=n.display.viewFrom,t<0))return null;for(r=n.display.view,i=0;i<r.length;i++)if(t-=r[i].size,t<0)return i}function ne(n){n.display.input.showSelection(n.display.input.prepareSelection())}function py(n,t){var r,i,e;t===void 0&&(t=!0);var u=n.doc,f={},o=f.cursors=document.createDocumentFragment(),s=f.selection=document.createDocumentFragment();for(r=0;r<u.sel.ranges.length;r++)(t||r!=u.sel.primIndex)&&((i=u.sel.ranges[r],i.from().line>=n.display.viewTo||i.to().line<n.display.viewFrom)||(e=i.empty(),(e||n.options.showCursorWhenSelecting)&&wy(n,i.head,o),e||ag(n,i,s)));return f}function wy(n,t,r){var u=kt(n,t,"div",null,null,!n.options.singleCursorHeightPerLine),e=r.appendChild(i("div"," ","CodeMirror-cursor")),f;e.style.left=u.left+"px";e.style.top=u.top+"px";e.style.height=Math.max(0,u.bottom-u.top)*n.options.cursorHeight+"px";u.other&&(f=r.appendChild(i("div"," ","CodeMirror-cursor CodeMirror-secondarycursor")),f.style.display="",f.style.left=u.other.left+"px",f.style.top=u.other.top+"px",f.style.height=(u.other.bottom-u.other.top)*.85+"px")}function bo(n,t){return n.top-t.top||n.left-t.left}function ag(r,u,f){function h(n,t,r,u){t<0&&(t=0);t=Math.round(t);u=Math.round(u);k.appendChild(i("div",null,"CodeMirror-selected","position: absolute; left: "+n+"px;\n                             top: "+t+"px; width: "+(r==null?l-n:r)+"px;\n                             height: "+(u-t)+"px"))}function p(i,u,f){function p(t,u){return hc(r,n(i,t),"div",a,u)}function y(n,t,i){var u=vy(r,a,null,n),f=t=="ltr"==(i=="after")?"left":"right",e=i=="after"?u.begin:u.end-(/\s/.test(a.text.charAt(u.end-1))?2:1);return p(e,f)[f]}var a=t(v,i),b=a.text.length,o,c,w=si(a,v.direction);return dk(w,u||0,f==null?b:f,function(n,t,i,r){var k=i=="ltr",a=p(n,k?"left":"right"),v=p(t-1,k?"right":"left"),d=u==null&&n==0,g=f==null&&t==b,it=r==0,rt=!w||r==w.length-1,nt,ut,tt,ft;if(v.top-a.top<=3){var ot=(e?d:g)&&it,st=(e?g:d)&&rt,et=ot?s:(k?a:v).left,ht=st?l:(k?v:a).right;h(et,a.top,ht-et,a.bottom)}else k?(nt=e&&d&&it?s:a.left,ut=e?l:y(n,i,"before"),tt=e?s:y(t,i,"after"),ft=e&&g&&rt?l:v.right):(nt=e?y(n,i,"before"):s,ut=!e&&d&&it?l:a.right,tt=!e&&g&&rt?s:v.left,ft=e?y(t,i,"after"):l),h(nt,a.top,ut-nt,a.bottom),a.bottom<v.top&&h(s,a.bottom,null,v.top),h(tt,v.top,ft-tt,v.bottom);(!o||bo(a,o)<0)&&(o=a);bo(v,o)<0&&(o=v);(!c||bo(a,c)<0)&&(c=a);bo(v,c)<0&&(c=v)}),{start:o,end:c}}var b=r.display,v=r.doc,k=document.createDocumentFragment(),d=iy(r.display),s=d.left,l=Math.max(b.sizerWidth,ar(r)-b.sizer.offsetLeft)-d.right,e=v.direction=="ltr",a=u.from(),y=u.to();if(a.line==y.line)p(a.line,a.ch,y.ch);else{var g=t(v,a.line),nt=t(v,y.line),w=ii(g)==ii(nt),o=p(a.line,a.ch,w?g.text.length+1:null).end,c=p(y.line,w?0:null,y.ch).start;w&&(o.top<c.top-2?(h(o.right,o.top,null,o.bottom),h(s,c.top,c.left,c.bottom)):h(o.right,o.top,c.left-o.right,o.bottom));o.bottom<c.top&&h(s,o.bottom,null,c.top)}f.appendChild(k)}function wc(n){var t,i;n.state.focused&&(t=n.display,clearInterval(t.blinker),i=!0,t.cursorDiv.style.visibility="",n.options.cursorBlinkRate>0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},n.options.cursorBlinkRate):n.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden"))}function by(n){n.state.focused||(n.display.input.focus(),bc(n))}function ky(n){n.state.delayingBlurEvent=!0;setTimeout(function(){n.state.delayingBlurEvent&&(n.state.delayingBlurEvent=!1,te(n))},100)}function bc(n,t){(n.state.delayingBlurEvent&&(n.state.delayingBlurEvent=!1),n.options.readOnly!="nocursor")&&(n.state.focused||(p(n,"focus",n,t),n.state.focused=!0,rr(n.display.wrapper,"CodeMirror-focused"),n.curOp||n.display.selForContextMenu==n.doc.sel||(n.display.input.reset(),it&&setTimeout(function(){return n.display.input.reset(!0)},20)),n.display.input.receivedFocus()),wc(n))}function te(n,t){n.state.delayingBlurEvent||(n.state.focused&&(p(n,"blur",n,t),n.state.focused=!1,vi(n.display.wrapper,"CodeMirror-focused")),clearInterval(n.display.blinker),setTimeout(function(){n.state.focused||(n.display.shift=!1)},150))}function ko(n){for(var h,r,c,u,a,f=n.display,v=f.lineDiv.offsetTop,o=0;o<f.view.length;o++){var t=f.view[o],y=n.options.lineWrapping,i=void 0,s=0;if(!t.hidden){if(e&&l<8?(h=t.node.offsetTop+t.node.offsetHeight,i=h-v,v=h):(r=t.node.getBoundingClientRect(),i=r.bottom-r.top,!y&&t.text.firstChild&&(s=t.text.firstChild.getBoundingClientRect().right-r.left-1)),c=t.line.height-i,(c>.005||c<-.005)&&(ni(t.line,i),dy(t.line),t.rest))for(u=0;u<t.rest.length;u++)dy(t.rest[u]);s>n.display.sizerWidth&&(a=Math.ceil(s/ou(n.display)),a>n.display.maxLineLength&&(n.display.maxLineLength=a,n.display.maxLine=t.line,n.display.maxLineChanged=!0))}}}function dy(n){var t,i,r;if(n.widgets)for(t=0;t<n.widgets.length;++t)i=n.widgets[t],r=i.node.parentNode,r&&(i.height=r.offsetHeight)}function kc(n,i,r){var f=r&&r.top!=null?Math.max(0,r.top):n.scroller.scrollTop,o,s;f=Math.floor(f-po(n));var h=r&&r.bottom!=null?r.bottom:f+n.wrapper.clientHeight,u=er(i,f),e=er(i,h);return r&&r.ensure&&(o=r.ensure.from.line,s=r.ensure.to.line,o<u?(u=o,e=er(i,oi(t(i,o))+n.wrapper.clientHeight)):Math.min(s,i.lastLine())>=e&&(u=er(i,oi(t(i,s))-n.wrapper.clientHeight),e=s)),{from:u,to:Math.max(e,u+1)}}function gy(n){var i=n.display,r=i.view,t,u,f;if(i.alignWidgets||i.gutters.firstChild&&n.options.fixedGutter){var o=yc(i)-i.scroller.scrollLeft+n.doc.scrollLeft,s=i.gutters.offsetWidth,e=o+"px";for(t=0;t<r.length;t++)if(!r[t].hidden&&(n.options.fixedGutter&&(r[t].gutter&&(r[t].gutter.style.left=e),r[t].gutterBackground&&(r[t].gutterBackground.style.left=e)),u=r[t].alignable,u))for(f=0;f<u.length;f++)u[f].style.left=e;n.options.fixedGutter&&(i.gutters.style.left=o+s+"px")}}function np(n){if(!n.options.lineNumbers)return!1;var u=n.doc,r=ih(n.options,u.first+u.size-1),t=n.display;if(r.length!=t.lineNumChars){var f=t.measure.appendChild(i("div",[i("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=f.firstChild.offsetWidth,o=f.offsetWidth-e;return t.lineGutter.style.width="",t.lineNumInnerWidth=Math.max(e,t.lineGutter.offsetWidth-o)+1,t.lineNumWidth=t.lineNumInnerWidth+o,t.lineNumChars=t.lineNumInnerWidth?r.length:-1,t.lineGutter.style.width=t.lineNumWidth+"px",rl(n),!0}return!1}function vg(n,t){var u;if(!w(n,"scrollCursorIntoView")){var f=n.display,e=f.sizer.getBoundingClientRect(),r=null;t.top+e.top<0?r=!0:t.bottom+e.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1);r==null||rk||(u=i("div","​",null,"position: absolute;\n                         top: "+(t.top-f.viewOffset-po(n.display))+"px;\n                         height: "+(t.bottom-t.top+ri(n)+f.barHeight)+"px;\n                         left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;"),n.display.lineSpace.appendChild(u),u.scrollIntoView(r),n.display.lineSpace.removeChild(u))}}function yg(t,i,r,u){var s,h;for(u==null&&(u=0),t.options.lineWrapping||i!=r||(i=i.ch?n(i.line,i.sticky=="before"?i.ch-1:i.ch,"after"):i,r=i.sticky=="before"?n(i.line,i.ch+1,"before"):i),h=0;h<5;h++){var c=!1,f=kt(t,i),e=!r||r==i?f:kt(t,r);s={left:Math.min(f.left,e.left),top:Math.min(f.top,e.top)-u,right:Math.max(f.left,e.left),bottom:Math.max(f.bottom,e.bottom)+u};var o=dc(t,s),l=t.doc.scrollTop,a=t.doc.scrollLeft;if(o.scrollTop!=null&&(re(t,o.scrollTop),Math.abs(t.doc.scrollTop-l)>1&&(c=!0)),o.scrollLeft!=null&&(wr(t,o.scrollLeft),Math.abs(t.doc.scrollLeft-a)>1&&(c=!0)),!c)break}return s}function pg(n,t){var i=dc(n,t);i.scrollTop!=null&&re(n,i.scrollTop);i.scrollLeft!=null&&wr(n,i.scrollLeft)}function dc(n,t){var r=n.display,h=eu(n.display),o;t.top<0&&(t.top=0);var e=n.curOp&&n.curOp.scrollTop!=null?n.curOp.scrollTop:r.scroller.scrollTop,u=fc(n),i={};t.bottom-t.top>u&&(t.bottom=t.top+u);var c=n.doc.height+uc(r),a=t.top<h,v=t.bottom>c-h;t.top<e?i.scrollTop=a?0:t.top:t.bottom>e+u&&(o=Math.min(t.top,(v?c:t.bottom)-u),o!=e&&(i.scrollTop=o));var l=n.curOp&&n.curOp.scrollLeft!=null?n.curOp.scrollLeft:r.scroller.scrollLeft,f=ar(n)-(n.options.fixedGutter?r.gutters.offsetWidth:0),s=t.right-t.left>f;return s&&(t.right=t.left+f),t.left<10?i.scrollLeft=0:t.left<l?i.scrollLeft=Math.max(0,t.left-(s?0:10)):t.right>f+l-3&&(i.scrollLeft=t.right+(s?0:10)-f),i}function gc(n,t){t!=null&&(go(n),n.curOp.scrollTop=(n.curOp.scrollTop==null?n.doc.scrollTop:n.curOp.scrollTop)+t)}function su(n){go(n);var t=n.getCursor();n.curOp.scrollToPos={from:t,to:t,margin:n.options.cursorScrollMargin}}function ie(n,t,i){(t!=null||i!=null)&&go(n);t!=null&&(n.curOp.scrollLeft=t);i!=null&&(n.curOp.scrollTop=i)}function wg(n,t){go(n);n.curOp.scrollToPos=t}function go(n){var t=n.curOp.scrollToPos,i,r;t&&(n.curOp.scrollToPos=null,i=ly(n,t.from),r=ly(n,t.to),tp(n,i,r,t.margin))}function tp(n,t,i,r){var u=dc(n,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});ie(n,u.scrollLeft,u.scrollTop)}function re(n,t){Math.abs(n.doc.scrollTop-t)<2||(ai||il(n,{top:t}),ip(n,t,!0),ai&&il(n),fe(n,100))}function ip(n,t,i){(t=Math.min(n.display.scroller.scrollHeight-n.display.scroller.clientHeight,t),n.display.scroller.scrollTop!=t||i)&&(n.doc.scrollTop=t,n.display.scrollbars.setScrollTop(t),n.display.scroller.scrollTop!=t&&(n.display.scroller.scrollTop=t))}function wr(n,t,i,r){(t=Math.min(t,n.display.scroller.scrollWidth-n.display.scroller.clientWidth),(i?t==n.doc.scrollLeft:Math.abs(n.doc.scrollLeft-t)<2)&&!r)||(n.doc.scrollLeft=t,gy(n),n.display.scroller.scrollLeft!=t&&(n.display.scroller.scrollLeft=t),n.display.scrollbars.setScrollLeft(t))}function ue(n){var t=n.display,i=t.gutters.offsetWidth,r=Math.round(n.doc.height+uc(n.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:n.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+ri(n)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}function cu(n,t){var i,r,u;for(t||(t=ue(n)),i=n.display.barWidth,r=n.display.barHeight,rp(n,t),u=0;u<4&&i!=n.display.barWidth||r!=n.display.barHeight;u++)i!=n.display.barWidth&&n.options.lineWrapping&&ko(n),rp(n,ue(n)),i=n.display.barWidth,r=n.display.barHeight}function rp(n,t){var i=n.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px";i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px";i.heightForcer.style.borderBottom=r.bottom+"px solid transparent";r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="";r.bottom&&n.options.coverGutterNextToScrollbar&&n.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}function up(n){n.display.scrollbars&&(n.display.scrollbars.clear(),n.display.scrollbars.addClass&&vi(n.display.wrapper,n.display.scrollbars.addClass));n.display.scrollbars=new nl[n.options.scrollbarStyle](function(t){n.display.wrapper.insertBefore(t,n.display.scrollbarFiller);r(t,"mousedown",function(){n.state.focused&&setTimeout(function(){return n.display.input.focus()},0)});t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?wr(n,t):re(n,t)},n);n.display.scrollbars.addClass&&rr(n.display.wrapper,n.display.scrollbars.addClass)}function br(n){n.curOp={cm:n,viewChanged:!1,startHeight:n.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++fp};wd(n.curOp)}function kr(n){var t=n.curOp;t&&kd(t,function(n){for(var t=0;t<n.ops.length;t++)n.ops[t].cm.curOp=null;bg(n)})}function bg(n){for(var i,r,u,f,t=n.ops,e=0;e<t.length;e++)kg(t[e]);for(i=0;i<t.length;i++)dg(t[i]);for(r=0;r<t.length;r++)gg(t[r]);for(u=0;u<t.length;u++)nn(t[u]);for(f=0;f<t.length;f++)tn(t[f])}function kg(n){var t=n.cm,i=t.display;fn(t);n.updateMaxLine&&ch(t);n.mustUpdate=n.viewChanged||n.forceUpdate||n.scrollTop!=null||n.scrollToPos&&(n.scrollToPos.from.line<i.viewFrom||n.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping;n.update=n.mustUpdate&&new ee(t,n.mustUpdate&&{top:n.scrollTop,ensure:n.scrollToPos},n.forceUpdate)}function dg(n){n.updatedDisplay=n.mustUpdate&&tl(n.cm,n.update)}function gg(n){var t=n.cm,i=t.display;n.updatedDisplay&&ko(t);n.barMeasure=ue(t);i.maxLineChanged&&!t.options.lineWrapping&&(n.adjustWidthTo=uy(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=n.adjustWidthTo,n.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+n.adjustWidthTo+ri(t)+t.display.barWidth),n.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+n.adjustWidthTo-ar(t)));(n.updatedDisplay||n.selectionChanged)&&(n.preparedSelection=i.input.prepareSelection())}function nn(n){var t=n.cm,i;n.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=n.adjustWidthTo+"px",n.maxScrollLeft<t.doc.scrollLeft&&wr(t,Math.min(t.display.scroller.scrollLeft,n.maxScrollLeft),!0),t.display.maxLineChanged=!1);i=n.focus&&n.focus==ei();n.preparedSelection&&t.display.input.showSelection(n.preparedSelection,i);(n.updatedDisplay||n.startHeight!=t.doc.height)&&cu(t,n.barMeasure);n.updatedDisplay&&ul(t,n.barMeasure);n.selectionChanged&&wc(t);t.state.focused&&n.updateInput&&t.display.input.reset(n.typing);i&&by(n.cm)}function tn(n){var t=n.cm,o=t.display,s=t.doc,h,i,r,u,e;if(n.updatedDisplay&&op(t,n.update),o.wheelStartX!=null&&(n.scrollTop!=null||n.scrollLeft!=null||n.scrollToPos)&&(o.wheelStartX=o.wheelStartY=null),n.scrollTop!=null&&ip(t,n.scrollTop,n.forceScroll),n.scrollLeft!=null&&wr(t,n.scrollLeft,!0,!0),n.scrollToPos&&(h=yg(t,f(s,n.scrollToPos.from),f(s,n.scrollToPos.to),n.scrollToPos.margin),vg(t,h)),i=n.maybeHiddenMarkers,r=n.maybeUnhiddenMarkers,i)for(u=0;u<i.length;++u)i[u].lines.length||p(i[u],"hide");if(r)for(e=0;e<r.length;++e)r[e].lines.length&&p(r[e],"unhide");o.wrapper.offsetHeight&&(s.scrollTop=t.display.scroller.scrollTop);n.changeObjs&&p(t,"changes",t,n.changeObjs);n.update&&n.update.finish()}function ot(n,t){if(n.curOp)return t();br(n);try{return t()}finally{kr(n)}}function b(n,t){return function(){if(n.curOp)return t.apply(n,arguments);br(n);try{return t.apply(n,arguments)}finally{kr(n)}}}function rt(n){return function(){if(this.curOp)return n.apply(this,arguments);br(this);try{return n.apply(this,arguments)}finally{kr(this)}}}function k(n){return function(){var t=this.cm;if(!t||t.curOp)return n.apply(this,arguments);br(t);try{return n.apply(this,arguments)}finally{kr(t)}}}function et(n,t,i,r){var u,e,o,s,h,f;t==null&&(t=n.doc.first);i==null&&(i=n.doc.first+n.doc.size);r||(r=0);u=n.display;r&&i<u.viewTo&&(u.updateLineNumbers==null||u.updateLineNumbers>t)&&(u.updateLineNumbers=t);n.curOp.viewChanged=!0;t>=u.viewTo?ti&&sh(n.doc,t)<u.viewTo&&gi(n):i<=u.viewFrom?ti&&ga(n.doc,i+r)>u.viewFrom?gi(n):(u.viewFrom+=r,u.viewTo+=r):t<=u.viewFrom&&i>=u.viewTo?gi(n):t<=u.viewFrom?(e=ns(n,i,i+r,1),e?(u.view=u.view.slice(e.index),u.viewFrom=e.lineN,u.viewTo+=r):gi(n)):i>=u.viewTo?(o=ns(n,t,t,-1),o?(u.view=u.view.slice(0,o.index),u.viewTo=o.lineN):gi(n)):(s=ns(n,t,t,-1),h=ns(n,i,i+r,1),s&&h?(u.view=u.view.slice(0,s.index).concat(yo(n,s.lineN,h.lineN)).concat(u.view.slice(h.index)),u.viewTo+=r):gi(n));f=u.externalMeasured;f&&(i<f.lineN?f.lineN+=r:t<f.lineN+f.size&&(u.externalMeasured=null))}function di(n,t,i){var r,u,f,e;(n.curOp.viewChanged=!0,r=n.display,u=n.display.externalMeasured,u&&t>=u.lineN&&t<u.lineN+u.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)||(f=r.view[pr(n,t)],f.node!=null)&&(e=f.changes||(f.changes=[]),d(e,i)==-1&&e.push(i))}function gi(n){n.display.viewFrom=n.display.viewTo=n.doc.first;n.display.view=[];n.display.viewOffset=0}function ns(n,t,i,r){var u=pr(n,t),o,f=n.display.view,e,s;if(!ti||i==n.doc.first+n.doc.size)return{index:u,lineN:i};for(e=n.display.viewFrom,s=0;s<u;s++)e+=f[s].size;if(e!=t){if(r>0){if(u==f.length-1)return null;o=e+f[u].size-t;u++}else o=e-t;t+=o;i+=o}while(sh(n.doc,i)!=i){if(u==(r<0?0:f.length-1))return null;i+=r*f[u-(r<0?1:0)].size;u+=r}return{index:u,lineN:i}}function rn(n,t,i){var r=n.display,u=r.view;u.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=yo(n,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=yo(n,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(pr(n,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(yo(n,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,pr(n,i))));r.viewTo=i}function ep(n){for(var t,r=n.display.view,u=0,i=0;i<r.length;i++)t=r[i],t.hidden||t.node&&!t.changes||++u;return u}function fe(n,t){n.doc.highlightFrontier<n.display.viewTo&&n.state.highlight.set(t,ws(un,n))}function un(n){var i=n.doc;if(!(i.highlightFrontier>=n.display.viewTo)){var u=+new Date+n.options.workTime,t=bf(n,i.highlightFrontier),r=[];i.iter(t.line,Math.min(i.first+i.size,n.display.viewTo+500),function(f){var o,e,c,s;if(t.line>=n.display.viewFrom){var h=f.styles,l=f.text.length>n.options.maxHighlightLength?hr(i.mode,t.state):null,a=ev(n,f,t,!0);for(l&&(t.state=l),f.styles=a.styles,o=f.styleClasses,e=a.classes,e?f.styleClasses=e:o&&(f.styleClasses=null),c=!h||h.length!=f.styles.length||o!=e&&(!o||!e||o.bgClass!=e.bgClass||o.textClass!=e.textClass),s=0;!c&&s<h.length;++s)c=h[s]!=f.styles[s];c&&r.push(t.line);f.stateAfter=t.save();t.nextLine()}else f.text.length<=n.options.maxHighlightLength&&nc(n,f.text,t),f.stateAfter=t.line%5==0?t.save():null,t.nextLine();if(+new Date>u)return fe(n,n.options.workDelay),!0});i.highlightFrontier=t.line;i.modeFrontier=Math.max(i.modeFrontier,t.line);r.length&&ot(n,function(){for(var t=0;t<r.length;t++)di(n,r[t],"text")})}}function fn(n){var t=n.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=ri(n)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ri(n)+"px",t.scrollbarsClipped=!0)}function en(n){var r,i,t;return n.hasFocus()?null:(r=ei(),!r||!pi(n.display.lineDiv,r))?null:(i={activeElt:r},window.getSelection&&(t=window.getSelection(),t.anchorNode&&t.extend&&pi(n.display.lineDiv,t.anchorNode)&&(i.anchorNode=t.anchorNode,i.anchorOffset=t.anchorOffset,i.focusNode=t.focusNode,i.focusOffset=t.focusOffset)),i)}function on(n){if(n&&n.activeElt&&n.activeElt!=ei()&&(n.activeElt.focus(),n.anchorNode&&pi(document.body,n.anchorNode)&&pi(document.body,n.focusNode))){var t=window.getSelection(),i=document.createRange();i.setEnd(n.anchorNode,n.anchorOffset);i.collapse(!1);t.removeAllRanges();t.addRange(i);t.extend(n.focusNode,n.focusOffset)}}function tl(n,i){var r=n.display,e=n.doc,s,o,c;if(i.editorIsHidden)return gi(n),!1;if(!i.force&&i.visible.from>=r.viewFrom&&i.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&ep(n)==0)return!1;np(n)&&(gi(n),i.dims=vc(n));var h=e.first+e.size,u=Math.max(i.visible.from-n.options.viewportMargin,e.first),f=Math.min(h,i.visible.to+n.options.viewportMargin);return(r.viewFrom<u&&u-r.viewFrom<20&&(u=Math.max(e.first,r.viewFrom)),r.viewTo>f&&r.viewTo-f<20&&(f=Math.min(h,r.viewTo)),ti&&(u=sh(n.doc,u),f=ga(n.doc,f)),s=u!=r.viewFrom||f!=r.viewTo||r.lastWrapHeight!=i.wrapperHeight||r.lastWrapWidth!=i.wrapperWidth,rn(n,u,f),r.viewOffset=oi(t(n.doc,r.viewFrom)),n.display.mover.style.top=r.viewOffset+"px",o=ep(n),!s&&o==0&&!i.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))?!1:(c=en(n),o>4&&(r.lineDiv.style.display="none"),sn(n,r.updateLineNumbers,i.dims),o>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,on(c),yi(r.cursorDiv),yi(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=i.wrapperHeight,r.lastWrapWidth=i.wrapperWidth,fe(n,400)),r.updateLineNumbers=null,!0)}function op(n,t){for(var r,i=t.viewport,u=!0;;u=!1){if((!u||!n.options.lineWrapping||t.oldDisplayWidth==ar(n))&&(i&&i.top!=null&&(i={top:Math.min(n.doc.height+uc(n.display)-fc(n),i.top)}),t.visible=kc(n.display,n.doc,i),t.visible.from>=n.display.viewFrom&&t.visible.to<=n.display.viewTo))break;if(!tl(n,t))break;ko(n);r=ue(n);ne(n);cu(n,r);ul(n,r);t.force=!1}t.signal(n,"update",n);(n.display.viewFrom!=n.display.reportedViewFrom||n.display.viewTo!=n.display.reportedViewTo)&&(t.signal(n,"viewportChange",n,n.display.viewFrom,n.display.viewTo),n.display.reportedViewFrom=n.display.viewFrom,n.display.reportedViewTo=n.display.viewTo)}function il(n,t){var i=new ee(n,t),r;tl(n,i)&&(ko(n),op(n,i),r=ue(n),ne(n),cu(n,r),ul(n,r),i.finish())}function sn(n,t,i){function c(t){var i=t.nextSibling;return it&&wt&&n.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),i}for(var r,a,h,e=n.display,v=n.options.lineNumbers,o=e.lineDiv,u=o.firstChild,l=e.view,f=e.viewFrom,s=0;s<l.length;s++){if(r=l[s],!r.hidden)if(r.node&&r.node.parentNode==o){while(u!=r.node)u=c(u);h=v&&t!=null&&t<=f&&r.lineNumber;r.changes&&(d(r.changes,"gutter")>-1&&(h=!1),kv(n,r,f,i));h&&(yi(r.lineNumber),r.lineNumber.appendChild(document.createTextNode(ih(n.options,f))));u=r.node.nextSibling}else a=ig(n,r,f,i),o.insertBefore(a,u);f+=r.size}while(u)u=c(u)}function rl(n){var t=n.display.gutters.offsetWidth;n.display.sizer.style.marginLeft=t+"px"}function ul(n,t){n.display.sizer.style.minHeight=t.docHeight+"px";n.display.heightForcer.style.top=t.docHeight+"px";n.display.gutters.style.height=t.docHeight+n.display.barHeight+ri(n)+"px"}function sp(n){var r=n.display.gutters,e=n.options.gutters,t,u,f;for(yi(r),t=0;t<e.length;++t)u=e[t],f=r.appendChild(i("div",null,"CodeMirror-gutter "+u)),u=="CodeMirror-linenumbers"&&(n.display.lineGutter=f,f.style.width=(n.display.lineNumWidth||1)+"px");r.style.display=t?"":"none";rl(n)}function fl(n){var t=d(n.gutters,"CodeMirror-linenumbers");t==-1&&n.lineNumbers?n.gutters=n.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!n.lineNumbers&&(n.gutters=n.gutters.slice(0),n.gutters.splice(t,1))}function hp(n){var i=n.wheelDeltaX,t=n.wheelDeltaY;return i==null&&n.detail&&n.axis==n.HORIZONTAL_AXIS&&(i=n.detail),t==null&&n.detail&&n.axis==n.VERTICAL_AXIS?t=n.detail:t==null&&(t=n.wheelDelta),{x:i,y:t}}function hn(n){var t=hp(n);return t.x*=st,t.y*=st,t}function cp(n,t){var v=hp(t),e=v.x,u=v.y,i=n.display,r=i.scroller,y=r.scrollWidth>r.clientWidth,h=r.scrollHeight>r.clientHeight,f,c,o;if(e&&y||u&&h){if(u&&wt&&it)n:for(f=t.target,c=i.view;f!=r;f=f.parentNode)for(o=0;o<c.length;o++)if(c[o].node==f){n.display.currentWheelTarget=f;break n}if(e&&!ai&&!pt&&st!=null){u&&h&&re(n,Math.max(0,r.scrollTop+u*st));wr(n,Math.max(0,r.scrollLeft+e*st));(!u||u&&h)&&ft(t);i.wheelStartX=null;return}if(u&&st!=null){var l=u*st,s=n.doc.scrollTop,a=s+i.wrapper.clientHeight;l<0?s=Math.max(0,s+l-50):a=Math.min(n.doc.height,a+l+50);il(n,{top:s,bottom:a})}oe<20&&(i.wheelStartX==null?(i.wheelStartX=r.scrollLeft,i.wheelStartY=r.scrollTop,i.wheelDX=e,i.wheelDY=u,setTimeout(function(){if(i.wheelStartX!=null){var n=r.scrollLeft-i.wheelStartX,t=r.scrollTop-i.wheelStartY,u=t&&i.wheelDY&&t/i.wheelDY||n&&i.wheelDX&&n/i.wheelDX;(i.wheelStartX=i.wheelStartY=null,u)&&(st=(st*oe+u)/(oe+1),++oe)}},200)):(i.wheelDX+=e,i.wheelDY+=u))}}function dt(n,t,i){var a=n&&n.options.selectionsMayTouch,v=t[i],r;for(t.sort(function(n,t){return u(n.from(),t.from())}),i=d(t,v),r=1;r<t.length;r++){var f=t[r],e=t[r-1],s=u(e.to(),f.from());if(a&&!f.empty()?s>0:s>=0){var h=eo(e.from(),f.from()),c=fo(e.to(),f.to()),l=e.empty()?f.from()==f.head:e.from()==e.head;r<=i&&--i;t.splice(--r,2,new o(l?c:h,l?h:c))}}return new ht(t,i)}function nr(n,t){return new ht([new o(n,t||n)],0)}function tr(t){return t.text?n(t.from.line+t.text.length-1,s(t.text).length+(t.text.length==1?t.from.ch:0)):t.to}function lp(t,i){if(u(t,i.from)<0)return t;if(u(t,i.to)<=0)return tr(i);var f=t.line+i.text.length-(i.to.line-i.from.line)-1,r=t.ch;return t.line==i.to.line&&(r+=tr(i).ch-i.to.ch),n(f,r)}function el(n,t){for(var r,u=[],i=0;i<n.sel.ranges.length;i++)r=n.sel.ranges[i],u.push(new o(lp(r.anchor,t),lp(r.head,t)));return dt(n.cm,u,n.sel.primIndex)}function ap(t,i,r){return t.line==i.line?n(r.line,t.ch-i.ch+r.ch):n(r.line+(t.line-i.line),t.ch)}function cn(t,i,r){for(var v,y,h=[],e=n(t.first,0),c=e,f=0;f<i.length;f++){var l=i[f],s=ap(l.from,e,c),a=ap(tr(l),e,c);e=l.to;c=a;r=="around"?(v=t.sel.ranges[f],y=u(v.head,v.anchor)<0,h[f]=new o(y?a:s,y?s:a)):h[f]=new o(s,s)}return new ht(h,t.sel.primIndex)}function ol(n){n.doc.mode=dh(n.options,n.doc.modeOption);se(n)}function se(n){n.doc.iter(function(n){n.stateAfter&&(n.stateAfter=null);n.styles&&(n.styles=null)});n.doc.modeFrontier=n.doc.highlightFrontier=n.doc.first;fe(n,100);n.state.modeGen++;n.curOp&&et(n)}function vp(n,t){return t.from.ch==0&&t.to.ch==0&&s(t.text)==""&&(!n.cm||n.cm.options.wholeLineUpdateBefore)}function sl(n,i,r,u){function a(n){return r?r[n]:null}function h(n,t,r){hd(n,t,r,u);g(n,"change",n,i)}function y(n,t){for(var r=[],i=n;i<t;++i)r.push(new cr(f[i],a(i),u));return r}var e=i.from,c=i.to,f=i.text,o=t(n,e.line),l=t(n,c.line),w=s(f),p=a(f.length-1),v=c.line-e.line,b,k,d;i.full?(n.insert(0,y(0,f.length)),n.remove(f.length,n.size-f.length)):vp(n,i)?(b=y(0,f.length-1),h(l,l.text,p),v&&n.remove(e.line,v),b.length&&n.insert(e.line,b)):o==l?f.length==1?h(o,o.text.slice(0,e.ch)+w+o.text.slice(c.ch),p):(k=y(1,f.length-1),k.push(new cr(w+o.text.slice(c.ch),p,u)),h(o,o.text.slice(0,e.ch)+f[0],a(0)),n.insert(e.line+1,k)):f.length==1?(h(o,o.text.slice(0,e.ch)+f[0]+l.text.slice(c.ch),a(0)),n.remove(e.line+1,v)):(h(o,o.text.slice(0,e.ch)+f[0],a(0)),h(l,w+l.text.slice(c.ch),p),d=y(1,f.length-1),v>1&&n.remove(e.line+1,v-1),n.insert(e.line+1,d));g(n,"change",n,i)}function dr(n,t,i){function r(n,u,f){var o,e,s;if(n.linked)for(o=0;o<n.linked.length;++o)(e=n.linked[o],e.doc!=u)&&(s=f&&e.sharedHist,!i||s)&&(t(e.doc,s),r(e.doc,n,s))}r(n,null,!0)}function yp(n,t){if(t.cm)throw new Error("This document is already in use.");n.doc=t;t.cm=n;pc(n);ol(n);pp(n);n.options.lineWrapping||ch(n);n.options.mode=t.modeOption;et(n)}function pp(n){(n.doc.direction=="rtl"?rr:vi)(n.display.lineDiv,"CodeMirror-rtl")}function ln(n){ot(n,function(){pp(n);et(n)})}function ts(n){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOp=this.lastSelOp=null;this.lastOrigin=this.lastSelOrigin=null;this.generation=this.maxGeneration=n||1}function hl(n,t){var i={from:uh(t.from),to:tr(t),text:fr(n,t.from,t.to)};return kp(n,i,t.from.line,t.to.line+1),dr(n,function(n){return kp(n,i,t.from.line,t.to.line+1)},!0),i}function wp(n){while(n.length){var t=s(n);if(t.ranges)n.pop();else break}}function an(n,t){return t?(wp(n.done),s(n.done)):n.done.length&&!s(n.done).ranges?s(n.done):n.done.length>1&&!n.done[n.done.length-2].ranges?(n.done.pop(),s(n.done)):void 0}function bp(n,t,i,r){var f=n.history,h,e,o,c;if(f.undone.length=0,h=+new Date,(f.lastOp==r||f.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&f.lastModTime>h-(n.cm?n.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(e=an(f,f.lastOp==r)))o=s(e.changes),u(t.from,t.to)==0&&u(t.from,o.to)==0?o.to=tr(t):e.changes.push(hl(n,t));else for(c=s(f.done),c&&c.ranges||is(n.sel,f.done),e={changes:[hl(n,t)],generation:f.generation},f.done.push(e);f.done.length>f.undoDepth;)f.done.shift(),f.done[0].ranges||f.done.shift();f.done.push(i);f.generation=++f.maxGeneration;f.lastModTime=f.lastSelTime=h;f.lastOp=f.lastSelOp=r;f.lastOrigin=f.lastSelOrigin=t.origin;o||p(n,"historyAdded")}function vn(n,t,i,r){var u=t.charAt(0);return u=="*"||u=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-n.history.lastSelTime<=(n.cm?n.cm.options.historyEventDelay:500)}function yn(n,t,i,r){var u=n.history,f=r&&r.origin;i==u.lastSelOp||f&&u.lastSelOrigin==f&&(u.lastModTime==u.lastSelTime&&u.lastOrigin==f||vn(n,f,s(u.done),t))?u.done[u.done.length-1]=t:is(t,u.done);u.lastSelTime=+new Date;u.lastSelOrigin=f;u.lastSelOp=i;r&&r.clearRedo!==!1&&wp(u.undone)}function is(n,t){var i=s(t);i&&i.ranges&&i.equals(n)||t.push(n)}function kp(n,t,i,r){var u=t["spans_"+n.id],f=0;n.iter(Math.max(n.first,i),Math.min(n.first+n.size,r),function(i){i.markedSpans&&((u||(u=t["spans_"+n.id]={}))[f]=i.markedSpans);++f})}function pn(n){var t,i;if(!n)return null;for(i=0;i<n.length;++i)n[i].marker.explicitlyCleared?t||(t=n.slice(0,i)):t&&t.push(n[i]);return t?t.length?t:null:n}function wn(n,t){var u=t["spans_"+n.id],r,i;if(!u)return null;for(r=[],i=0;i<t.text.length;++i)r.push(pn(u[i]));return r}function dp(n,t){var i=wn(n,t),s=eh(n,t),r,f,u,e,h,o;if(!i)return s;if(!s)return i;for(r=0;r<i.length;++r)if(f=i[r],u=s[r],f&&u)n:for(e=0;e<u.length;++e){for(h=u[e],o=0;o<f.length;++o)if(f[o].marker==h.marker)continue n;f.push(h)}else u&&(i[r]=u);return i}function lu(n,t,i){for(var u,l,e,o,r,a,f,h=[],c=0;c<n.length;++c){if(u=n[c],u.ranges){h.push(i?ht.prototype.deepCopy.call(u):u);continue}for(l=u.changes,e=[],h.push({changes:e}),o=0;o<l.length;++o)if(r=l[o],a=void 0,e.push({from:r.from,to:r.to,text:r.text}),t)for(f in r)(a=f.match(/^spans_(\d+)$/))&&d(t,Number(a[1]))>-1&&(s(e)[f]=r[f],delete r[f])}return h}function cl(n,t,i,r){var f,e;return r?(f=n.anchor,i&&(e=u(t,f)<0,e!=u(i,f)<0?(f=t,t=i):e!=u(t,i)<0&&(t=i)),new o(f,t)):new o(i||t,t)}function rs(n,t,i,r,u){u==null&&(u=n.cm&&(n.cm.display.shift||n.extend));nt(n,new ht([cl(n.sel.primary(),t,i,u)],0),r)}function gp(n,t,i){for(var f,u=[],e=n.cm&&(n.cm.display.shift||n.extend),r=0;r<n.sel.ranges.length;r++)u[r]=cl(n.sel.ranges[r],t[r],null,e);f=dt(n.cm,u,n.sel.primIndex);nt(n,f,i)}function ll(n,t,i,r){var u=n.sel.ranges.slice(0);u[t]=i;nt(n,dt(n.cm,u,n.sel.primIndex),r)}function nw(n,t,i,r){nt(n,nr(t,i),r)}function bn(n,t,i){var r={ranges:t.ranges,update:function(t){var r=this,i;for(this.ranges=[],i=0;i<t.length;i++)r.ranges[i]=new o(f(n,t[i].anchor),f(n,t[i].head))},origin:i&&i.origin};return p(n,"beforeSelectionChange",n,r),n.cm&&p(n.cm,"beforeSelectionChange",n.cm,r),r.ranges!=t.ranges?dt(n.cm,r.ranges,r.ranges.length-1):t}function tw(n,t,i){var r=n.history.done,u=s(r);u&&u.ranges?(r[r.length-1]=t,us(n,t,i)):nt(n,t,i)}function nt(n,t,i){us(n,t,i);yn(n,n.sel,n.cm?n.cm.curOp.id:NaN,i)}function us(n,t,i){(vt(n,"beforeSelectionChange")||n.cm&&vt(n.cm,"beforeSelectionChange"))&&(t=bn(n,t,i));var r=i&&i.bias||(u(t.primary().head,n.sel.primary().head)<0?-1:1);iw(n,uw(n,t,r,!0));i&&i.scroll===!1||!n.cm||su(n.cm)}function iw(n,t){t.equals(n.sel)||(n.sel=t,n.cm&&(n.cm.curOp.updateInput=1,n.cm.curOp.selectionChanged=!0,tv(n.cm)),g(n,"cursorActivity",n))}function rw(n){iw(n,uw(n,n.sel,null,!1))}function uw(n,t,i,r){for(var u,f=0;f<t.ranges.length;f++){var e=t.ranges[f],s=t.ranges.length==n.sel.ranges.length&&n.sel.ranges[f],h=al(n,e.anchor,s&&s.anchor,i,r),c=al(n,e.head,s&&s.head,i,r);(u||h!=e.anchor||c!=e.head)&&(u||(u=t.ranges.slice(0,f)),u[f]=new o(h,c))}return u?dt(n.cm,u,t.primIndex):t}function au(n,i,r,f,e){var c=t(n,i.line),a,h,o,s,v,l;if(c.markedSpans)for(a=0;a<c.markedSpans.length;++a)if(h=c.markedSpans[a],o=h.marker,(h.from==null||(o.inclusiveLeft?h.from<=i.ch:h.from<i.ch))&&(h.to==null||(o.inclusiveRight?h.to>=i.ch:h.to>i.ch))){if(e&&(p(o,"beforeCursorEnter"),o.explicitlyCleared))if(c.markedSpans){--a;continue}else break;if(!o.atomic)continue;return r&&(s=o.find(f<0?1:-1),v=void 0,(f<0?o.inclusiveRight:o.inclusiveLeft)&&(s=fw(n,s,-f,s&&s.line==i.line?c:null)),s&&s.line==i.line&&(v=u(s,r))&&(f<0?v<0:v>0))?au(n,s,i,f,e):(l=o.find(f<0?-1:1),(f<0?o.inclusiveLeft:o.inclusiveRight)&&(l=fw(n,l,f,l.line==i.line?c:null)),l?au(n,l,i,f,e):null)}return i}function al(t,i,r,u,f){var e=u||1,o=au(t,i,r,e,f)||!f&&au(t,i,r,e,!0)||au(t,i,r,-e,f)||!f&&au(t,i,r,-e,!0);return o?o:(t.cantEdit=!0,n(t.first,0))}function fw(i,r,u,e){return u<0&&r.ch==0?r.line>i.first?f(i,n(r.line-1)):null:u>0&&r.ch==(e||t(i,r.line)).text.length?r.line<i.first+i.size-1?n(r.line+1,0):null:new n(r.line,r.ch+u)}function ew(t){t.setSelection(n(t.firstLine(),0),n(t.lastLine()),gt)}function ow(n,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return(i&&(r.update=function(t,i,u,e){t&&(r.from=f(n,t));i&&(r.to=f(n,i));u&&(r.text=u);e!==undefined&&(r.origin=e)}),p(n,"beforeChange",n,r),n.cm&&p(n.cm,"beforeChange",n.cm,r),r.canceled)?(n.cm&&(n.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function vu(n,t,i){var u,r;if(n.cm){if(!n.cm.curOp)return b(n.cm,vu)(n,t,i);if(n.cm.state.suppressEdits)return}if(!vt(n,"beforeChange")&&(!n.cm||!vt(n.cm,"beforeChange"))||(t=ow(n,t,!0),t))if(u=fh&&!i&&pk(n,t.from,t.to),u)for(r=u.length-1;r>=0;--r)sw(n,{from:u[r].from,to:u[r].to,text:r?[""]:t.text,origin:t.origin});else sw(n,t)}function sw(n,t){var i,r;(t.text.length!=1||t.text[0]!=""||u(t.from,t.to)!=0)&&(i=el(n,t),bp(n,t,i,n.cm?n.cm.curOp.id:NaN),he(n,t,i,eh(n,t)),r=[],dr(n,function(n,i){i||d(r,n.history)!=-1||(aw(n.history,t),r.push(n.history));he(n,t,null,eh(n,t))}))}function fs(n,t,i){var a=n.cm&&n.cm.state.suppressEdits,c,y,p,o,l;if(!a||i){for(var u=n.history,r,v=n.sel,f=t=="undo"?u.done:u.undone,h=t=="undo"?u.undone:u.done,e=0;e<f.length;e++)if(r=f[e],i?r.ranges&&!r.equals(n.sel):!r.ranges)break;if(e!=f.length){for(u.lastOrigin=u.lastSelOrigin=null;;)if(r=f.pop(),r.ranges){if(is(r,h),i&&!r.equals(n.sel)){nt(n,r,{clearRedo:!1});return}v=r}else{if(a){f.push(r);return}break}for(c=[],is(v,h),h.push({changes:c,generation:u.generation}),u.generation=r.generation||++u.maxGeneration,y=vt(n,"beforeChange")||n.cm&&vt(n.cm,"beforeChange"),p=function(i){var u=r.changes[i],o,e;if(u.origin=t,y&&!ow(n,u,!1))return f.length=0,{};c.push(hl(n,u));o=i?el(n,u):s(f);he(n,u,o,dp(n,u));!i&&n.cm&&n.cm.scrollIntoView({from:u.from,to:tr(u)});e=[];dr(n,function(n,t){t||d(e,n.history)!=-1||(aw(n.history,u),e.push(n.history));he(n,u,null,dp(n,u))})},o=r.changes.length-1;o>=0;--o)if(l=p(o),l)return l.v}}}function hw(t,i){if(i!=0&&(t.first+=i,t.sel=new ht(ro(t.sel.ranges,function(t){return new o(n(t.anchor.line+i,t.anchor.ch),n(t.head.line+i,t.head.ch))}),t.sel.primIndex),t.cm)){et(t.cm,t.first,t.first-i,i);for(var u=t.cm.display,r=u.viewFrom;r<u.viewTo;r++)di(t.cm,r,"gutter")}}function he(i,r,u,f){var o,e;if(i.cm&&!i.cm.curOp)return b(i.cm,he)(i,r,u,f);if(r.to.line<i.first){hw(i,r.text.length-1-(r.to.line-r.from.line));return}r.from.line>i.lastLine()||(r.from.line<i.first&&(o=r.text.length-1-(i.first-r.from.line),hw(i,o),r={from:n(i.first,0),to:n(r.to.line+o,r.to.ch),text:[s(r.text)],origin:r.origin}),e=i.lastLine(),r.to.line>e&&(r={from:r.from,to:n(e,t(i,e).text.length),text:[r.text[0]],origin:r.origin}),r.removed=fr(i,r.from,r.to),u||(u=el(i,r)),i.cm?kn(i.cm,r,f):sl(i,r,f),us(i,u,gt))}function kn(n,i,r){var f=n.doc,e=n.display,u=i.from,o=i.to,s=!1,c=u.line,y,l,a,v;n.options.lineWrapping||(c=h(ii(t(f,u.line))),f.iter(c,o.line+1,function(n){if(n==e.maxLine)return s=!0,!0}));f.sel.contains(i.from,i.to)>-1&&tv(n);sl(f,i,r,yy(n));n.options.lineWrapping||(f.iter(c,u.line+i.text.length,function(n){var t=lo(n);t>e.maxLineLength&&(e.maxLine=n,e.maxLineLength=t,e.maxLineChanged=!0,s=!1)}),s&&(n.curOp.updateMaxLine=!0));sd(f,u.line);fe(n,400);y=i.text.length-(o.line-u.line)-1;i.full?et(n):u.line!=o.line||i.text.length!=1||vp(n.doc,i)?et(n,u.line,o.line+1,y):di(n,u.line,"text");l=vt(n,"changes");a=vt(n,"change");(a||l)&&(v={from:u,to:o,text:i.text,removed:i.removed,origin:i.origin},a&&g(n,"change",n,v),l&&(n.curOp.changeObjs||(n.curOp.changeObjs=[])).push(v));n.display.selForContextMenu=null}function yu(n,t,i,r,f){var e;r||(r=i);u(r,i)<0&&(e=[r,i],i=e[0],r=e[1]);typeof t=="string"&&(t=n.splitLines(t));vu(n,{from:i,to:r,text:t,origin:f})}function cw(n,t,i,r){i<n.line?n.line+=r:t<n.line&&(n.line=t,n.ch=0)}function lw(t,i,r,u){for(var f,c,s,h,e,o=0;o<t.length;++o){if(f=t[o],c=!0,f.ranges){for(f.copied||(f=t[o]=f.deepCopy(),f.copied=!0),s=0;s<f.ranges.length;s++)cw(f.ranges[s].anchor,i,r,u),cw(f.ranges[s].head,i,r,u);continue}for(h=0;h<f.changes.length;++h)if(e=f.changes[h],r<e.from.line)e.from=n(e.from.line+u,e.from.ch),e.to=n(e.to.line+u,e.to.ch);else if(i<=e.to.line){c=!1;break}c||(t.splice(0,o+1),o=0)}}function aw(n,t){var i=t.from.line,r=t.to.line,u=t.text.length-(r-i)-1;lw(n.done,i,r,u);lw(n.undone,i,r,u)}function ce(n,i,r,u){var f=i,e=i;return(typeof i=="number"?e=t(n,aa(n,i)):f=h(i),f==null)?null:(u(e,f)&&n.cm&&di(n.cm,f,r),e)}function le(n){var r=this,i,t;for(this.lines=n,this.parent=null,i=0,t=0;t<n.length;++t)n[t].parent=r,i+=n[t].height;this.height=i}function ae(n){var f=this,r,u,t,i;for(this.children=n,r=0,u=0,t=0;t<n.length;++t)i=n[t],r+=i.chunkSize(),u+=i.height,i.parent=f;this.size=r;this.height=u;this.parent=null}function vw(n,t,i){oi(t)<(n.curOp&&n.curOp.scrollTop||n.doc.scrollTop)&&gc(n,i)}function dn(n,t,i,r){var u=new pu(n,i,r),f=n.cm;return f&&u.noHScroll&&(f.display.alignWidgets=!0),ce(n,t,"widget",function(t){var i=t.widgets||(t.widgets=[]),r;return u.insertAt==null?i.push(u):i.splice(Math.min(i.length-1,Math.max(0,u.insertAt)),0,u),u.line=t,f&&!bi(n,t)&&(r=oi(t)<n.scrollTop,ni(t,t.height+df(u)),r&&gc(f,u.height),f.curOp.forceUpdate=!0),!0}),f&&g(f,"lineWidgetAdded",f,u,typeof t=="number"?t:h(t)),u}function wu(n,t,i,f,e){var o,l,h,s,a,c;if(f&&f.shared)return gn(n,t,i,f,e);if(n.cm&&!n.cm.curOp)return b(n.cm,wu)(n,t,i,f,e);if(o=new ci(n,e),l=u(t,i),f&&ur(f,o,!1),l>0||l==0&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=gr("span",[o.replacedWith],"CodeMirror-widget"),f.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),f.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(da(n,t.line,t,i,o)||t.line!=i.line&&da(n,i.line,t,i,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");ck()}if(o.addToHistory&&bp(n,{from:t,to:i,origin:"markText"},n.sel,NaN),h=t.line,s=n.cm,n.iter(h,i.line+1,function(n){s&&o.collapsed&&!s.options.lineWrapping&&ii(n)==s.display.maxLine&&(a=!0);o.collapsed&&h!=t.line&&ni(n,0);ak(n,new oo(o,h==t.line?t.ch:null,h==i.line?i.ch:null));++h}),o.collapsed&&n.iter(t.line,i.line+1,function(t){bi(n,t)&&ni(t,0)}),o.clearOnEnter&&r(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(hk(),(n.history.done.length||n.history.undone.length)&&n.clearHistory()),o.collapsed&&(o.id=++vl,o.atomic=!0),s){if(a&&(s.curOp.updateMaxLine=!0),o.collapsed)et(s,t.line,i.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(c=t.line;c<=i.line;c++)di(s,c,"text");o.atomic&&rw(s.doc);g(s,"markerAdded",s,o)}return o}function gn(n,t,i,r,u){r=ur(r);r.shared=!1;var e=[wu(n,t,i,r,u)],o=e[0],h=r.widgetNode;return dr(n,function(n){h&&(r.widgetNode=h.cloneNode(!0));e.push(wu(n,f(n,t),f(n,i),r,u));for(var c=0;c<n.linked.length;++c)if(n.linked[c].isParent)return;o=s(e)}),new bu(e,o)}function yw(t){return t.findMarks(n(t.first,0),t.clipPos(n(t.lastLine())),function(n){return n.parent})}function ntt(n,t){for(var f,r=0;r<t.length;r++){var i=t[r],e=i.find(),o=n.clipPos(e.from),s=n.clipPos(e.to);u(o,s)&&(f=wu(n,o,s,i.primary,i.primary.type),i.markers.push(f),f.parent=i)}}function ttt(n){for(var i=function(t){var i=n[t],f=[i.primary.doc],r,u;for(dr(i.primary.doc,function(n){return f.push(n)}),r=0;r<i.markers.length;r++)u=i.markers[r],d(f,u.doc)==-1&&(u.parent=null,i.markers.splice(r--,1))},t=0;t<n.length;t++)i(t)}function itt(n){var t=this,i,r,u,c,o,s;if((ww(t),!w(t,n)&&!hi(t.display,n))&&(ft(n),e&&(yl=+new Date),i=yr(t,n,!0),r=n.dataTransfer.files,i&&!t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File){var h=r.length,l=Array(h),a=0,v=function(n,r){if(!t.options.allowDropFileTypes||d(t.options.allowDropFileTypes,n.type)!=-1){var u=new FileReader;u.onload=b(t,function(){var n=u.result,e;/[\x00-\x08\x0e-\x1f]{2}/.test(n)&&(n="");l[r]=n;++a==h&&(i=f(t.doc,i),e={from:i,to:i,text:t.doc.splitLines(l.join(t.doc.lineSeparator())),origin:"paste"},vu(t.doc,e),tw(t.doc,nr(i,tr(e))))});u.readAsText(n)}};for(u=0;u<h;++u)v(r[u],u)}else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(n);setTimeout(function(){return t.display.input.focus()},20);return}try{if(c=n.dataTransfer.getData("Text"),c){if(t.state.draggingText&&!t.state.draggingText.copy&&(o=t.listSelections()),us(t.doc,nr(i,i)),o)for(s=0;s<o.length;++s)yu(t.doc,"",o[s].anchor,o[s].head,"drag");t.replaceSelection(c,"around","paste");t.display.input.focus()}}catch(n){}}}function rtt(n,t){if(e&&(!n.state.draggingText||+new Date-yl<100)){pf(t);return}if(!w(n,t)&&!hi(n.display,t)&&(t.dataTransfer.setData("Text",n.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!ua)){var r=i("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";pt&&(r.width=r.height=1,n.display.wrapper.appendChild(r),r._top=r.offsetTop);t.dataTransfer.setDragImage(r,0,0);pt&&r.parentNode.removeChild(r)}}function utt(n,t){var u=yr(n,t),r;u&&(r=document.createDocumentFragment(),wy(n,u,r),n.display.dragCursor||(n.display.dragCursor=i("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),n.display.lineSpace.insertBefore(n.display.dragCursor,n.display.cursorDiv)),ct(n.display.dragCursor,r))}function ww(n){n.display.dragCursor&&(n.display.lineSpace.removeChild(n.display.dragCursor),n.display.dragCursor=null)}function bw(n){var r,t,i,u;if(document.getElementsByClassName){for(r=document.getElementsByClassName("CodeMirror"),t=[],i=0;i<r.length;i++)u=r[i].CodeMirror,u&&t.push(u);t.length&&t[0].operation(function(){for(var i=0;i<t.length;i++)n(t[i])})}}function ftt(){pl||(ett(),pl=!0)}function ett(){var n;r(window,"resize",function(){n==null&&(n=setTimeout(function(){n=null;bw(ott)},100))});r(window,"blur",function(){return bw(te)})}function ott(n){var t=n.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null;t.scrollbarsClipped=!1;n.setSize()}function stt(n){var i=n.split(/-(?!$)/),u,f,e,o,r,t;for(n=i[i.length-1],r=0;r<i.length-1;r++)if(t=i[r],/^(cmd|meta|m)$/i.test(t))o=!0;else if(/^a(lt)?$/i.test(t))u=!0;else if(/^(c|ctrl|control)$/i.test(t))f=!0;else if(/^s(hift)?$/i.test(t))e=!0;else throw new Error("Unrecognized modifier name: "+t);return u&&(n="Alt-"+n),f&&(n="Ctrl-"+n),o&&(n="Cmd-"+n),e&&(n="Shift-"+n),n}function htt(n){var e={},t,o,r,u,f,i,s,h;for(t in n)if(n.hasOwnProperty(t)){if(o=n[t],/^(name|fallthrough|(de|at)tach)$/.test(t))continue;if(o=="..."){delete n[t];continue}for(r=ro(t.split(" "),stt),u=0;u<r.length;u++)if(f=void 0,i=void 0,u==r.length-1?(i=r.join(" "),f=o):(i=r.slice(0,u+1).join(" "),f="..."),s=e[i],s){if(s!=f)throw new Error("Inconsistent bindings for "+i);}else e[i]=f;delete n[t]}for(h in e)n[h]=e[h];return n}function gu(n,t,i,r){var u,f,e;if(t=es(t),u=t.call?t.call(n,r):t[n],u===!1)return"nothing";if(u==="...")return"multi";if(u!=null&&i(u))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return gu(n,t.fallthrough,i,r);for(f=0;f<t.fallthrough.length;f++)if(e=gu(n,t.fallthrough[f],i,r),e)return e}}function kw(n){var t=typeof n=="string"?n:li[n.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function dw(n,t,i){var r=n;return t.altKey&&r!="Alt"&&(n="Alt-"+n),(ys?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(n="Ctrl-"+n),(ys?t.ctrlKey:t.metaKey)&&r!="Cmd"&&(n="Cmd-"+n),!i&&t.shiftKey&&r!="Shift"&&(n="Shift-"+n),n}function gw(n,t){if(pt&&n.keyCode==34&&n.char)return!1;var i=li[n.keyCode];return i==null||n.altGraphKey?!1:(n.keyCode==3&&n.code&&(i=n.code),dw(i,n,t))}function es(n){return typeof n=="string"?fi[n]:n}function nf(n,t){for(var r,e,o=n.doc.sel.ranges,i=[],f=0;f<o.length;f++){for(r=t(o[f]);i.length&&u(r.from,s(i).to)<=0;)if(e=i.pop(),u(e.from,r.from)<0){r.from=e.from;break}i.push(r)}ot(n,function(){for(var t=i.length-1;t>=0;t--)yu(n.doc,"",i[t].from,i[t].to,"+delete");su(n)})}function wl(n,t,i){var r=la(n.text,t+i,i);return r<0||r>n.text.length?null:r}function bl(t,i,r){var u=wl(t,i.ch,r);return u==null?null:new n(i.line,u,r<0?"after":"before")}function kl(t,i,r,u,f){var h,c,a;if(t&&(h=si(r,i.doc.direction),h)){var o=f<0?s(h):h[0],v=f<0==(o.level==1),l=v?"after":"before",e;return o.level>0||i.doc.direction=="rtl"?(c=fu(i,r),e=f<0?r.text.length-1:0,a=ui(i,c,e).top,e=lf(function(n){return ui(i,c,n).top==a},f<0==(o.level==1)?o.from:o.to-1,e),l=="before"&&(e=wl(r,e,1))):e=f<0?o.to:o.from,new n(u,e,l)}return new n(u,f<0?r.text.length:0,f<0?"before":"after")}function ctt(t,i,r,u){var o=si(i,t.doc.direction),v,f,l,e,b,p,h,a;if(!o||(r.ch>=i.text.length?(r.ch=i.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after"),v=yf(o,r.ch,r.sticky),f=o[v],t.doc.direction=="ltr"&&f.level%2==0&&(u>0?f.to>r.ch:f.from<r.ch)))return bl(i,r,u);var s=function(t,r){return wl(i,t instanceof n?t.ch:t,r)},y,w=function(n){return t.options.lineWrapping?(y=y||fu(t,i),vy(t,i,y,n)):{begin:0,end:i.text.length}},c=w(r.sticky=="before"?s(r,-1):r.ch);return(t.doc.direction=="rtl"||f.level==1)&&(l=f.level==1==u<0,e=s(r,l?1:-1),e!=null&&(l?e<=f.to&&e<=c.end:e>=f.from&&e>=c.begin))?(b=l?"before":"after",new n(r.line,e,b)):(p=function(t,i,u){for(var c=function(t,i){return i?new n(r.line,s(t,1),"before"):new n(r.line,t,"after")};t>=0&&t<o.length;t+=i){var e=o[t],h=i>0==(e.level!=1),f=h?u.begin:s(u.end,-1);if(e.from<=f&&f<e.to||(f=h?e.from:s(e.to,-1),u.begin<=f&&f<u.end))return c(f,h)}},h=p(v+u,u,c),h)?h:(a=u>0?c.end:s(c.begin,-1),a!=null&&!(u>0&&a==i.text.length)&&(h=p(u>0?0:o.length-1,u,w(a)),h))?h:null}function nb(n,i){var u=t(n.doc,i),r=ii(u);return r!=u&&(i=h(r)),kl(!0,n,r,i,1)}function ltt(n,i){var r=t(n.doc,i),u=bk(r);return u!=r&&(i=h(u)),kl(!0,n,r,i,-1)}function tb(i,r){var u=nb(i,r.line),e=t(i.doc,u.line),o=si(e,i.doc.direction),f,s;return!o||o[0].level==0?(f=Math.max(0,e.text.search(/\S/)),s=r.line==u.line&&r.ch<=f&&r.ch,n(u.line,s?0:f,u.sticky)):u}function os(n,t,i){if(typeof t=="string"&&(t=tf[t],!t))return!1;n.display.input.ensurePolled();var u=n.display.shift,r=!1;try{n.isReadOnly()&&(n.state.suppressEdits=!0);i&&(n.display.shift=!1);r=t(n)!=io}finally{n.display.shift=u;n.state.suppressEdits=!1}return r}function att(n,t,i){for(var u,r=0;r<n.state.keyMaps.length;r++)if(u=gu(t,n.state.keyMaps[r],i,n),u)return u;return n.options.extraKeys&&gu(t,n.options.extraKeys,i,n)||gu(t,n.options.keyMap,i,n)}function ye(n,t,i,r){var u=n.state.keySeq;if(u){if(kw(t))return"handled";if(/\'$/.test(t)?n.state.keySeq=null:ib.set(50,function(){n.state.keySeq==u&&(n.state.keySeq=null,n.display.input.reset())}),rb(n,u+" "+t,i,r))return!0}return rb(n,t,i,r)}function rb(n,t,i,r){var u=att(n,t,r);return u=="multi"&&(n.state.keySeq=t),u=="handled"&&g(n,"keyHandled",n,t,i),(u=="handled"||u=="multi")&&(ft(i),wc(n)),!!u}function ub(n,t){var i=gw(t,!0);return i?t.shiftKey&&!n.state.keySeq?ye(n,"Shift-"+i,t,function(t){return os(n,t,!0)})||ye(n,i,t,function(t){if(typeof t=="string"?/^go[A-Z]/.test(t):t.motion)return os(n,t)}):ye(n,i,t,function(t){return os(n,t)}):!1}function vtt(n,t,i){return ye(n,"'"+i+"'",t,function(t){return os(n,t,!0)})}function fb(n){var t=this,i,r;(t.curOp.focus=ei(),w(t,n))||(e&&l<11&&n.keyCode==27&&(n.returnValue=!1),i=n.keyCode,t.display.shift=i==16||n.shiftKey,r=ub(t,n),pt&&(ss=r?i:null,r||i!=88||id||!(wt?n.metaKey:n.ctrlKey)||t.replaceSelection("",null,"cut")),i!=18||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||ytt(t))}function ytt(n){function t(n){n.keyCode!=18&&n.altKey||(vi(i,"CodeMirror-crosshair"),lt(document,"keyup",t),lt(document,"mouseover",t))}var i=n.display.lineDiv;rr(i,"CodeMirror-crosshair");r(document,"keyup",t);r(document,"mouseover",t)}function eb(n){n.keyCode==16&&(this.doc.sel.shift=!1);w(this,n)}function ob(n){var t=this,i,r,u;if(!hi(t.display,n)&&!w(t,n)&&(!n.ctrlKey||n.altKey)&&(!wt||!n.metaKey)){if(i=n.keyCode,r=n.charCode,pt&&i==ss){ss=null;ft(n);return}if((!pt||!(!n.which||n.which<10)||!ub(t,n))&&(u=String.fromCharCode(r==null?i:r),u!="\b")&&!vtt(t,n,u))t.display.input.onKeyPress(n)}}function ptt(n,t){var i=+new Date;return we&&we.compare(i,n,t)?(pe=we=null,"triple"):pe&&pe.compare(i,n,t)?(we=new hs(i,n,t),pe=null,"double"):(pe=new hs(i,n,t),we=null,"single")}function hb(n){var t=this,i=t.display;if(!w(t,n)&&(!i.activeTouch||!i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=n.shiftKey,hi(i,n)){it||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!dl(t,n)){var r=yr(t,n),u=rv(n),f=r?ptt(r,u):"single";if(window.focus(),u==1&&t.state.selectingText&&t.state.selectingText(n),!r||!wtt(t,u,r,f,n))if(u==1)r?ktt(t,r,f,n):yh(n)==i.scroller&&ft(n);else if(u==2)r&&rs(t.doc,r),setTimeout(function(){return i.input.focus()},20);else if(u==3)if(to)t.display.input.onContextMenu(n);else ky(t)}}}function wtt(n,t,i,r,u){var f="Click";return r=="double"?f="Double"+f:r=="triple"&&(f="Triple"+f),f=(t==1?"Left":t==2?"Middle":"Right")+f,ye(n,dw(f,u),u,function(t){if(typeof t=="string"&&(t=tf[t]),!t)return!1;var r=!1;try{n.isReadOnly()&&(n.state.suppressEdits=!0);r=t(n,i)!=io}finally{n.state.suppressEdits=!1}return r})}function btt(n,t,i){var u=n.getOption("configureMouse"),r=u?u(n,t,i):{},f;return r.unit==null&&(f=uk?i.shiftKey&&i.metaKey:i.altKey,r.unit=f?"rectangle":t=="single"?"char":t=="double"?"word":"line"),(r.extend==null||n.doc.extend)&&(r.extend=n.doc.extend||i.shiftKey),r.addNew==null&&(r.addNew=wt?i.metaKey:i.ctrlKey),r.moveOnDrag==null&&(r.moveOnDrag=!(wt?i.altKey:i.ctrlKey)),r}function ktt(n,t,i,r){e?setTimeout(ws(by,n),0):n.curOp.focus=ei();var o=btt(n,i,r),s=n.doc.sel,f;n.options.dragDrop&&uv&&!n.isReadOnly()&&i=="single"&&(f=s.contains(t))>-1&&(u((f=s.ranges[f]).from(),t)<0||t.xRel>0)&&(u(f.to(),t)>0||t.xRel<0)?dtt(n,r,t,o):gtt(n,r,t,o)}function dtt(n,t,i,u){var f=n.display,s=!1,o=b(n,function(t){it&&(f.scroller.draggable=!1);n.state.draggingText=!1;lt(f.wrapper.ownerDocument,"mouseup",o);lt(f.wrapper.ownerDocument,"mousemove",h);lt(f.scroller,"dragstart",c);lt(f.scroller,"drop",o);s||(ft(t),u.addNew||rs(n.doc,i,null,null,u.extend),it||e&&l==9?setTimeout(function(){f.wrapper.ownerDocument.body.focus();f.input.focus()},20):f.input.focus())}),h=function(n){s=s||Math.abs(t.clientX-n.clientX)+Math.abs(t.clientY-n.clientY)>=10},c=function(){return s=!0};it&&(f.scroller.draggable=!0);n.state.draggingText=o;o.copy=!u.moveOnDrag;f.scroller.dragDrop&&f.scroller.dragDrop();r(f.wrapper.ownerDocument,"mouseup",o);r(f.wrapper.ownerDocument,"mousemove",h);r(f.scroller,"dragstart",c);r(f.scroller,"drop",o);ky(n);setTimeout(function(){return f.input.focus()},20)}function cb(t,i,r){if(r=="char")return new o(i,i);if(r=="word")return t.findWordAt(i);if(r=="line")return new o(n(i.line,0),f(t.doc,n(i.line+1,0)));var u=r(t,i);return new o(u.from,u.to)}function gtt(i,e,s,h){function et(r){var e,st,k,y,rt;if(u(d,r)!=0)if(d=r,h.unit=="rectangle"){var v=[],b=i.options.tabSize,ut=at(t(c,s.line).text,s.ch,b),ft=at(t(c,r.line).text,r.ch,b),et=Math.min(ut,ft),ot=Math.max(ut,ft);for(e=Math.min(s.line,r.line),st=Math.min(i.lastLine(),Math.max(s.line,r.line));e<=st;e++)k=t(c,e).text,y=ks(k,et,b),et==ot?v.push(new o(n(e,y),n(e,y))):k.length>y&&v.push(new o(n(e,y),n(e,ks(k,ot,b))));v.length||v.push(new o(s,s));nt(c,dt(i,p.ranges.slice(0,l).concat(v),l),{origin:"*mouse",scroll:!1});i.scrollIntoView(r)}else{var tt=a,w=cb(i,r,h.unit),g=tt.anchor,it;u(w.anchor,g)>0?(it=w.head,g=eo(tt.from(),w.anchor)):(it=w.anchor,g=fo(tt.to(),w.head));rt=p.ranges.slice(0);rt[l]=nit(i,new o(f(c,g),it));nt(c,dt(i,rt,l),bs)}}function it(n){var e=++w,t=yr(i,n,!0,h.unit=="rectangle"),r,f;t&&(u(t,d)!=0?(i.curOp.focus=ei(),et(t),r=kc(v,c),(t.line>=r.to||t.line<r.from)&&setTimeout(b(i,function(){w==e&&it(n)}),150)):(f=n.clientY<tt.top?-20:n.clientY>tt.bottom?20:0,f&&setTimeout(b(i,function(){w==e&&(v.scroller.scrollTop+=f,it(n))}),50)))}function ut(n){i.state.selectingText=!1;w=Infinity;ft(n);v.input.focus();lt(v.wrapper.ownerDocument,"mousemove",rt);lt(v.wrapper.ownerDocument,"mouseup",g);c.history.lastSelOrigin=null}var v=i.display,c=i.doc,a,l,p,y,k,d,tt,w,rt,g;ft(e);p=c.sel;y=p.ranges;h.addNew&&!h.extend?(l=c.sel.contains(s),a=l>-1?y[l]:new o(s,s)):(a=c.sel.primary(),l=c.sel.primIndex);h.unit=="rectangle"?(h.addNew||(a=new o(s,s)),s=yr(i,e,!0,!0),l=-1):(k=cb(i,s,h.unit),a=h.extend?cl(a,k.anchor,k.head,h.extend):k);h.addNew?l==-1?(l=y.length,nt(c,dt(i,y.concat([a]),l),{scroll:!1,origin:"*mouse"})):y.length>1&&y[l].empty()&&h.unit=="char"&&!h.extend?(nt(c,dt(i,y.slice(0,l).concat(y.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),p=c.sel):ll(c,l,a,bs):(l=0,nt(c,new ht([a],0),bs),p=c.sel);d=s;tt=v.wrapper.getBoundingClientRect();w=0;rt=b(i,function(n){n.buttons!==0&&rv(n)?it(n):ut(n)});g=b(i,ut);i.state.selectingText=g;r(v.wrapper.ownerDocument,"mousemove",rt);r(v.wrapper.ownerDocument,"mouseup",g)}function nit(i,r){var f=r.anchor,e=r.head,d=t(i.doc,f.line),s,l,h,c,a,v,y;if(u(f,e)==0&&f.sticky==e.sticky||(s=si(d),!s)||(l=yf(s,f.ch,f.sticky),h=s[l],h.from!=f.ch&&h.to!=f.ch)||(c=l+(h.from==f.ch==(h.level!=1)?0:1),c==0||c==s.length))return r;e.line!=f.line?a=(e.line-f.line)*(i.doc.direction=="ltr"?1:-1)>0:(v=yf(s,e.ch,e.sticky),y=v-l||(e.ch-f.ch)*(h.level==1?-1:1),a=v==c-1||v==c?y<0:y>0);var p=s[c+(a?-1:0)],w=a==(p.level==1),b=w?p.from:p.to,k=w?"after":"before";return f.ch==b&&f.sticky==k?r:new o(new n(f.line,b,k),e)}function lb(n,t,i,r){var e,u,o,s,f,h,c,l;if(t.touches)e=t.touches[0].clientX,u=t.touches[0].clientY;else try{e=t.clientX;u=t.clientY}catch(t){return!1}if(e>=Math.floor(n.display.gutters.getBoundingClientRect().right))return!1;if(r&&ft(t),o=n.display,s=o.lineDiv.getBoundingClientRect(),u>s.bottom||!vt(n,i))return vh(t);for(u-=s.top-o.viewOffset,f=0;f<n.options.gutters.length;++f)if(h=o.gutters.childNodes[f],h&&h.getBoundingClientRect().right>=e)return c=er(n.doc,u),l=n.options.gutters[f],p(n,i,n,c,l,t),vh(t)}function dl(n,t){return lb(n,t,"gutterClick",!0)}function tit(n,t){if(!hi(n.display,t)&&!iit(n,t)&&!w(n,t,"contextmenu")&&!to)n.display.input.onContextMenu(t)}function iit(n,t){return vt(n,"gutterContextMenu")?lb(n,t,"gutterContextMenu",!1):!1}function ab(n){n.display.wrapper.className=n.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+n.options.theme.replace(/(^|\s)\s*/g," cm-s-");gf(n)}function rit(t){function i(n,i,u,f){t.defaults[n]=i;u&&(r[n]=f?function(n,t,i){i!=rf&&u(n,t,i)}:u)}var r=t.optionHandlers;t.defineOption=i;t.Init=rf;i("value","",function(n,t){return n.setValue(t)},!0);i("mode",null,function(n,t){n.doc.modeOption=t;ol(n)},!0);i("indentUnit",2,ol,!0);i("indentWithTabs",!1);i("smartIndent",!0);i("tabSize",4,function(n){se(n);gf(n);et(n)},!0);i("lineSeparator",null,function(t,i){var r,f,u;if(t.doc.lineSep=i,i)for(r=[],f=t.doc.first,t.doc.iter(function(t){for(var u,e=0;;){if(u=t.text.indexOf(i,e),u==-1)break;e=u+i.length;r.push(n(f,u))}f++}),u=r.length-1;u>=0;u--)yu(t.doc,i,r[u],n(r[u].line,r[u].ch+i.length))});i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(n,t,i){n.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g");i!=rf&&n.refresh()});i("specialCharPlaceholder",ld,function(n){return n.refresh()},!0);i("electricChars",!0);i("inputStyle",of?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor");},!0);i("spellcheck",!1,function(n,t){return n.getInputField().spellcheck=t},!0);i("autocorrect",!1,function(n,t){return n.getInputField().autocorrect=t},!0);i("autocapitalize",!1,function(n,t){return n.getInputField().autocapitalize=t},!0);i("rtlMoveVisually",!fk);i("wholeLineUpdateBefore",!0);i("theme","default",function(n){ab(n);be(n)},!0);i("keyMap","default",function(n,t,i){var u=es(t),r=i!=rf&&es(i);r&&r.detach&&r.detach(n,u);u.attach&&u.attach(n,r||null)});i("extraKeys",null);i("configureMouse",null);i("lineWrapping",!1,fit,!0);i("gutters",[],function(n){fl(n.options);be(n)},!0);i("fixedGutter",!0,function(n,t){n.display.gutters.style.left=t?yc(n.display)+"px":"0";n.refresh()},!0);i("coverGutterNextToScrollbar",!1,function(n){return cu(n)},!0);i("scrollbarStyle","native",function(n){up(n);cu(n);n.display.scrollbars.setScrollTop(n.doc.scrollTop);n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0);i("lineNumbers",!1,function(n){fl(n.options);be(n)},!0);i("firstLineNumber",1,be,!0);i("lineNumberFormatter",function(n){return n},be,!0);i("showCursorWhenSelecting",!1,ne,!0);i("resetSelectionOnContextMenu",!0);i("lineWiseCopyCut",!0);i("pasteLinesPerSelection",!0);i("selectionsMayTouch",!1);i("readOnly",!1,function(n,t){t=="nocursor"&&(te(n),n.display.input.blur());n.display.input.readOnlyChanged(t)});i("disableInput",!1,function(n,t){t||n.display.input.reset()},!0);i("dragDrop",!0,uit);i("allowDropFileTypes",null);i("cursorBlinkRate",530);i("cursorScrollMargin",0);i("cursorHeight",1,ne,!0);i("singleCursorHeightPerLine",!0,ne,!0);i("workTime",100);i("workDelay",100);i("flattenSpans",!0,se,!0);i("addModeClass",!1,se,!0);i("pollInterval",100);i("undoDepth",200,function(n,t){return n.doc.history.undoDepth=t});i("historyEventDelay",1250);i("viewportMargin",10,function(n){return n.refresh()},!0);i("maxHighlightLength",1e4,se,!0);i("moveInputWithCursor",!0,function(n,t){t||n.display.input.resetPosition()});i("tabindex",null,function(n,t){return n.display.input.getField().tabIndex=t||""});i("autofocus",null);i("direction","ltr",function(n,t){return n.doc.setDirection(t)},!0);i("phrases",null)}function be(n){sp(n);et(n);gy(n)}function uit(n,t,i){var e=i&&i!=rf,u,f;!t!=!e&&(u=n.display.dragFunctions,f=t?r:lt,f(n.display.scroller,"dragstart",u.start),f(n.display.scroller,"dragenter",u.enter),f(n.display.scroller,"dragover",u.over),f(n.display.scroller,"dragleave",u.leave),f(n.display.scroller,"drop",u.drop))}function fit(n){n.options.lineWrapping?(rr(n.display.wrapper,"CodeMirror-wrap"),n.display.sizer.style.minWidth="",n.display.sizerWidth=null):(vi(n.display.wrapper,"CodeMirror-wrap"),ch(n));pc(n);et(n);gf(n);setTimeout(function(){return cu(n)},100)}function a(n,t){var o=this,i,s,r,u,f;if(!(this instanceof a))return new a(n,t);this.options=t=t?ur(t):{};ur(vb,t,!1);fl(t);i=t.value;typeof i=="string"?i=new ut(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode);this.doc=i;s=new a.inputStyles[t.inputStyle](this);r=this.display=new ok(n,i,s);r.wrapper.CodeMirror=this;sp(this);ab(this);t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");up(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new wi,keySeq:null,specialChars:null};t.autofocus&&!of&&r.input.focus();e&&l<11&&setTimeout(function(){return o.display.input.reset(!0)},20);eit(this);ftt();br(this);this.curOp.forceUpdate=!0;yp(this,i);t.autofocus&&!of||this.hasFocus()?setTimeout(ws(bc,this),20):te(this);for(u in cs)cs.hasOwnProperty(u)&&cs[u](o,t[u],rf);for(np(this),t.finishInit&&t.finishInit(this),f=0;f<ls.length;++f)ls[f](o);kr(this);it&&t.lineWrapping&&getComputedStyle(r.lineDiv).textRendering=="optimizelegibility"&&(r.lineDiv.style.textRendering="auto")}function eit(t){function c(){i.activeTouch&&(h=setTimeout(function(){return i.activeTouch=null},1e3),s=i.activeTouch,s.end=+new Date)}function v(n){if(n.touches.length!=1)return!1;var t=n.touches[0];return t.radiusX<=1&&t.radiusY<=1}function a(n,t){if(t.left==null)return!0;var i=t.left-n.left,r=t.top-n.top;return i*i+r*r>400}var i=t.display,h,s,u;r(i.scroller,"mousedown",b(t,hb));e&&l<11?r(i.scroller,"dblclick",b(t,function(n){var i,r;w(t,n)||(i=yr(t,n),!i||dl(t,n)||hi(t.display,n))||(ft(n),r=t.findWordAt(i),rs(t.doc,r.anchor,r.head))})):r(i.scroller,"dblclick",function(n){return w(t,n)||ft(n)});r(i.scroller,"contextmenu",function(n){return tit(t,n)});s={end:0};r(i.scroller,"touchstart",function(n){if(!w(t,n)&&!v(n)&&!dl(t,n)){i.input.ensurePolled();clearTimeout(h);var r=+new Date;i.activeTouch={start:r,moved:!1,prev:r-s.end<=300?s:null};n.touches.length==1&&(i.activeTouch.left=n.touches[0].pageX,i.activeTouch.top=n.touches[0].pageY)}});r(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)});r(i.scroller,"touchend",function(r){var u=i.activeTouch,e,s;u&&!hi(i,r)&&u.left!=null&&!u.moved&&new Date-u.start<300&&(e=t.coordsChar(i.activeTouch,"page"),s=!u.prev||a(u,u.prev)?new o(e,e):!u.prev.prev||a(u,u.prev.prev)?t.findWordAt(e):new o(n(e.line,0),f(t.doc,n(e.line+1,0))),t.setSelection(s.anchor,s.head),t.focus(),ft(r));c()});r(i.scroller,"touchcancel",c);r(i.scroller,"scroll",function(){i.scroller.clientHeight&&(re(t,i.scroller.scrollTop),wr(t,i.scroller.scrollLeft,!0),p(t,"scroll",t))});r(i.scroller,"mousewheel",function(n){return cp(t,n)});r(i.scroller,"DOMMouseScroll",function(n){return cp(t,n)});r(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0});i.dragFunctions={enter:function(n){w(t,n)||pf(n)},over:function(n){w(t,n)||(utt(t,n),pf(n))},start:function(n){return rtt(t,n)},drop:b(t,itt),leave:function(n){w(t,n)||ww(t)}};u=i.input.getField();r(u,"keyup",function(n){return eb.call(t,n)});r(u,"keydown",b(t,fb));r(u,"keypress",b(t,ob));r(u,"focus",function(n){return bc(t,n)});r(u,"blur",function(n){return te(t,n)})}function ke(i,r,u,f){var s=i.doc,d,c,e,l,y,w,a,b,k;u==null&&(u="add");u=="smart"&&(s.mode.indent?d=bf(i,r).state:u="prev");var v=i.options.tabSize,h=t(s,r),p=at(h.text,null,v);if(h.stateAfter&&(h.stateAfter=null),c=h.text.match(/^\s*/)[0],f||/\S/.test(h.text)){if(u=="smart"&&(e=s.mode.indent(d,h.text.slice(c.length),h.text),e==io||e>150)){if(!f)return;u="prev"}}else e=0,u="not";if(u=="prev"?e=r>s.first?at(t(s,r-1).text,null,v):0:u=="add"?e=p+i.options.indentUnit:u=="subtract"?e=p-i.options.indentUnit:typeof u=="number"&&(e=p+u),e=Math.max(0,e),l="",y=0,i.options.indentWithTabs)for(w=Math.floor(e/v);w;--w)y+=v,l+="\t";if(y<e&&(l+=ds(e-y)),l!=c)return yu(s,l,n(r,0),n(r,c.length),"+input"),h.stateAfter=null,!0;for(a=0;a<s.sel.ranges.length;a++)if(b=s.sel.ranges[a],b.head.line==r&&b.head.ch<c.length){k=n(r,c.length);ll(s,a,new o(k,k));break}}function as(n){yt=n}function gl(i,r,u,f,e){var p=i.doc,y,d,a,b;i.display.shift=!1;f||(f=p.sel);var k=+new Date-200,l=e=="paste"||i.state.pasteIncoming>k,v=bh(r),o=null;if(l&&f.ranges.length>1)if(yt&&yt.text.join("\n")==r){if(f.ranges.length%yt.text.length==0)for(o=[],y=0;y<yt.text.length;y++)o.push(p.splitLines(yt.text[y]))}else v.length==f.ranges.length&&i.options.pasteLinesPerSelection&&(o=ro(v,function(n){return[n]}));for(d=i.curOp.updateInput,a=f.ranges.length-1;a>=0;a--){var w=f.ranges[a],h=w.from(),c=w.to();w.empty()&&(u&&u>0?h=n(h.line,h.ch-u):i.state.overwrite&&!l?c=n(c.line,Math.min(t(p,c.line).text.length,c.ch+s(v).length)):l&&yt&&yt.lineWise&&yt.text.join("\n")==r&&(h=c=n(h.line,0)));b={from:h,to:c,text:o?o[a%o.length]:v,origin:e||(l?"paste":i.state.cutIncoming>k?"cut":"+input")};vu(i.doc,b);g(i,"inputRead",i,b)}r&&!l&&pb(i,r);su(i);i.curOp.updateInput<2&&(i.curOp.updateInput=d);i.curOp.typing=!0;i.state.pasteIncoming=i.state.cutIncoming=-1}function yb(n,t){var i=n.clipboardData&&n.clipboardData.getData("Text");if(i)return n.preventDefault(),t.isReadOnly()||t.options.disableInput||ot(t,function(){return gl(t,i,0,null,"paste")}),!0}function pb(n,i){var e,u,r,f,o,s;if(n.options.electricChars&&n.options.smartIndent)for(e=n.doc.sel,u=e.ranges.length-1;u>=0;u--)if(r=e.ranges[u],!(r.head.ch>100)&&(!u||e.ranges[u-1].head.line!=r.head.line)){if(f=n.getModeAt(r.head),o=!1,f.electricChars){for(s=0;s<f.electricChars.length;s++)if(i.indexOf(f.electricChars.charAt(s))>-1){o=ke(n,r.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(t(n.doc,r.head.line).text.slice(0,r.head.ch))&&(o=ke(n,r.head.line,"smart"));o&&g(n,"electricInput",n,r.head.line)}}function wb(t){for(var u,i,f=[],e=[],r=0;r<t.doc.sel.ranges.length;r++)u=t.doc.sel.ranges[r].head.line,i={anchor:n(u,0),head:n(u+1,0)},e.push(i),f.push(t.getRange(i.anchor,i.head));return{text:f,ranges:e}}function bb(n,t,i,r){n.setAttribute("autocorrect",!!i);n.setAttribute("autocapitalize",!!r);n.setAttribute("spellcheck",!!t)}function kb(){var n=i("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=i("div",[n],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return it?n.style.width="1000px":n.setAttribute("wrap","off"),ef&&(n.style.border="1px solid black"),bb(n),t}function oit(i){var u=i.optionHandlers,r=i.helpers={};i.prototype={constructor:i,focus:function(){window.focus();this.display.input.focus()},setOption:function(n,t){var i=this.options,r=i[n];(i[n]!=t||n=="mode")&&(i[n]=t,u.hasOwnProperty(n)&&b(this,u[n])(this,t,r),p(this,"optionChange",this,n))},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,t){this.state.keyMaps[t?"push":"unshift"](es(n))},removeKeyMap:function(n){for(var i=this.state.keyMaps,t=0;t<i.length;++t)if(i[t]==n||i[t].name==n)return i.splice(t,1),!0},addOverlay:rt(function(n,t){var r=n.token?n:i.getMode(this.options,n);if(r.startState)throw new Error("Overlays may not be stateful.");ek(this.state.overlays,{mode:r,modeSpec:n,opaque:t&&t.opaque,priority:t&&t.priority||0},function(n){return n.priority});this.state.modeGen++;et(this)}),removeOverlay:rt(function(n){for(var r,u=this,i=this.state.overlays,t=0;t<i.length;++t)if(r=i[t].modeSpec,r==n||typeof n=="string"&&r.name==n){i.splice(t,1);u.state.modeGen++;et(u);return}}),indentLine:rt(function(n,t,i){typeof t!="string"&&typeof t!="number"&&(t=t==null?this.options.smartIndent?"smart":"prev":t?"add":"subtract");af(this.doc,n)&&ke(this,n,t,i)}),indentSelection:rt(function(n){for(var r,f,e,t=this,s=this.doc.sel.ranges,u=-1,i=0;i<s.length;i++)if(r=s[i],r.empty())r.head.line>u&&(ke(t,r.head.line,n,!0),u=r.head.line,i==t.doc.sel.primIndex&&su(t));else{var h=r.from(),c=r.to(),l=Math.max(u,h.line);for(u=Math.min(t.lastLine(),c.line-(c.ch?0:1))+1,f=l;f<u;++f)ke(t,f,n);e=t.doc.sel.ranges;h.ch==0&&s.length==e.length&&e[i].from().ch>0&&ll(t.doc,i,new o(h,e[i].to()),gt)}}),getTokenAt:function(n,t){return hv(this,n,t)},getLineTokens:function(t,i){return hv(this,n(t),i,!0)},getTokenTypeAt:function(n){var i,e;n=f(this.doc,n);var u=ov(this,t(this.doc,n.line)),s=0,h=(u.length-1)/2,o=n.ch,r;if(o==0)r=u[2];else for(;;)if(i=s+h>>1,(i?u[i*2-1]:0)>=o)h=i;else if(u[i*2+1]<o)s=i+1;else{r=u[i*2+2];break}return e=r?r.indexOf("overlay "):-1,e<0?r:e==0?null:r.slice(0,e-1)},getModeAt:function(n){var t=this.doc.mode;return t.innerMode?i.innerMode(t,this.getTokenAt(n).state).mode:t},getHelper:function(n,t){return this.getHelpers(n,t)[0]},getHelpers:function(n,t){var c=this,f=[],u,i,e,h,o,s;if(!r.hasOwnProperty(t))return f;if(u=r[t],i=this.getModeAt(n),typeof i[t]=="string")u[i[t]]&&f.push(u[i[t]]);else if(i[t])for(e=0;e<i[t].length;e++)h=u[i[t][e]],h&&f.push(h);else i.helperType&&u[i.helperType]?f.push(u[i.helperType]):u[i.name]&&f.push(u[i.name]);for(o=0;o<u._global.length;o++)s=u._global[o],s.pred(i,c)&&d(f,s.val)==-1&&f.push(s.val);return f},getStateAfter:function(n,t){var i=this.doc;return n=aa(i,n==null?i.first+i.size-1:n),bf(this,n+1,t).state},cursorCoords:function(n,t){var r,i=this.doc.sel.primary();return r=n==null?i.head:typeof n=="object"?f(this.doc,n):n?i.from():i.to(),kt(this,r,t||"page")},charCoords:function(n,t){return hc(this,f(this.doc,n),t||"page")},coordsChar:function(n,t){return n=cy(this,n,t||"page"),lc(this,n.left,n.top)},lineAtHeight:function(n,t){return n=cy(this,{top:n,left:0},t||"page").top,er(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,i,r){var f=!1,u,e;return typeof n=="number"?(e=this.doc.first+this.doc.size-1,n<this.doc.first?n=this.doc.first:n>e&&(n=e,f=!0),u=t(this.doc,n)):u=n,wo(this,u,{top:0,left:0},i||"page",r||f).top+(f?this.doc.height-oi(u):0)},defaultTextHeight:function(){return eu(this.display)},defaultCharWidth:function(){return ou(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,t,i,r,u){var s=this.display,o,e,h,c;n=kt(this,f(this.doc,n));o=n.bottom;e=n.left;t.style.position="absolute";t.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(t);s.sizer.appendChild(t);r=="over"?o=n.top:(r=="above"||r=="near")&&(h=Math.max(s.wrapper.clientHeight,this.doc.height),c=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth),(r=="above"||n.bottom+t.offsetHeight>h)&&n.top>t.offsetHeight?o=n.top-t.offsetHeight:n.bottom+t.offsetHeight<=h&&(o=n.bottom),e+t.offsetWidth>c&&(e=c-t.offsetWidth));t.style.top=o+"px";t.style.left=t.style.right="";u=="right"?(e=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):(u=="left"?e=0:u=="middle"&&(e=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=e+"px");i&&pg(this,{left:e,top:o,right:e+t.offsetWidth,bottom:o+t.offsetHeight})},triggerOnKeyDown:rt(fb),triggerOnKeyPress:rt(ob),triggerOnKeyUp:eb,triggerOnMouseDown:rt(hb),execCommand:function(n){if(tf.hasOwnProperty(n))return tf[n].call(null,this)},triggerElectric:rt(function(n){pb(this,n)}),findPosH:function(n,t,i,r){var s=this,o=1,u,e;for(t<0&&(o=-1,t=-t),u=f(this.doc,n),e=0;e<t;++e)if(u=na(s.doc,u,o,i,r),u.hitSide)break;return u},moveH:rt(function(n,t){var i=this;this.extendSelectionsBy(function(r){return i.display.shift||i.doc.extend||r.empty()?na(i.doc,r.head,n,t,i.options.rtlMoveVisually):n<0?r.from():r.to()},hf)}),deleteH:rt(function(n,t){var r=this.doc.sel,i=this.doc;r.somethingSelected()?i.replaceSelection("",null,"+delete"):nf(this,function(r){var u=na(i,r.head,n,t,!1);return n<0?{from:u,to:r.head}:{from:r.head,to:u}})}),findPosV:function(n,t,i,r){var h=this,c=1,o=r,u,s,e;for(t<0&&(c=-1,t=-t),u=f(this.doc,n),s=0;s<t;++s)if(e=kt(h,u,"div"),o==null?o=e.left:e.left=o,u=db(h,e,c,i),u.hitSide)break;return u},moveV:rt(function(n,t){var u=this,i=this.doc,f=[],e=!this.display.shift&&!i.extend&&i.sel.somethingSelected(),r;if(i.extendSelectionsBy(function(r){var o,s;return e?n<0?r.from():r.to():(o=kt(u,r.head,"div"),r.goalColumn!=null&&(o.left=r.goalColumn),f.push(o.left),s=db(u,o,n,t),t=="page"&&r==i.sel.primary()&&gc(u,hc(u,s,"div").top-o.top),s)},hf),f.length)for(r=0;r<i.sel.ranges.length;r++)i.sel.ranges[r].goalColumn=f[r]}),findWordAt:function(i){var c=this.doc,u=t(c,i.line).text,r=i.ch,f=i.ch,e,s,h;if(u){for(e=this.getHelper(i,"wordChars"),(i.sticky=="before"||f==u.length)&&r?--r:++f,s=u.charAt(r),h=uo(s,e)?function(n){return uo(n,e)}:/\s/.test(s)?function(n){return/\s/.test(n)}:function(n){return!/\s/.test(n)&&!uo(n)};r>0&&h(u.charAt(r-1));)--r;while(f<u.length&&h(u.charAt(f)))++f}return new o(n(i.line,r),n(i.line,f))},toggleOverwrite:function(n){(n==null||n!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?rr(this.display.cursorDiv,"CodeMirror-overwrite"):vi(this.display.cursorDiv,"CodeMirror-overwrite"),p(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==ei()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:rt(function(n,t){ie(this,n,t)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-ri(this)-this.display.barHeight,width:n.scrollWidth-ri(this)-this.display.barWidth,clientHeight:fc(this),clientWidth:ar(this)}},scrollIntoView:rt(function(t,i){t==null?(t={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof t=="number"?t={from:n(t,0),to:null}:t.from==null&&(t={from:t,to:null});t.to||(t.to=t.from);t.margin=i||0;t.from.line!=null?wg(this,t):tp(this,t.from,t.to,t.margin)}),setSize:rt(function(n,t){var u=this,r=function(n){return typeof n=="number"||/^\d+$/.test(String(n))?n+"px":n},i;n!=null&&(this.display.wrapper.style.width=r(n));t!=null&&(this.display.wrapper.style.height=r(t));this.options.lineWrapping&&oy(this);i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,function(n){if(n.widgets)for(var t=0;t<n.widgets.length;t++)if(n.widgets[t].noHScroll){di(u,i,"widget");break}++i});this.curOp.forceUpdate=!0;p(this,"refresh",this)}),operation:function(n){return ot(this,n)},startOperation:function(){return br(this)},endOperation:function(){return kr(this)},refresh:rt(function(){var n=this.display.cachedTextHeight;et(this);this.curOp.forceUpdate=!0;gf(this);ie(this,this.doc.scrollLeft,this.doc.scrollTop);rl(this);(n==null||Math.abs(n-eu(this.display))>.5)&&pc(this);p(this,"refresh",this)}),swapDoc:rt(function(n){var t=this.doc;return t.cm=null,yp(this,n),gf(this),this.display.input.reset(),ie(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,g(this,"swapDoc",this,t),t}),phrase:function(n){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:n},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};ru(i);i.registerHelper=function(n,t,u){r.hasOwnProperty(n)||(r[n]=i[n]={_global:[]});r[n][t]=u};i.registerGlobalHelper=function(n,t,u,f){i.registerHelper(n,t,f);r[n]._global.push({pred:u,val:f})}}function na(i,r,u,f,e){function b(){var f=r.line+u;return f<i.first||f>=i.first+i.size?!1:(r=new n(f,r.ch,r.sticky),s=t(i,f))}function h(n){var t;if(t=e?ctt(i.cm,s,r,u):bl(s,r,u),t==null)if(!n&&b())r=kl(e,i.cm,s,r.line,u);else return!1;else r=t;return!0}var p=r,w=u,s=t(i,r.line),c,l,o,a;if(f=="char")h();else if(f=="column")h(!0);else if(f=="word"||f=="group"){var v=null,y=f=="group",k=i.cm&&i.cm.getHelper(r,"wordChars");for(c=!0;;c=!1){if(u<0&&!h(!c))break;if(l=s.text.charAt(r.ch)||"\n",o=uo(l,k)?"w":y&&l=="\n"?"n":!y||/\s/.test(l)?null:"p",!y||c||o||(o="s"),v&&v!=o){u<0&&(u=1,h(),r.sticky="after");break}if(o&&(v=o),u>0&&!h(!c))break}}return a=al(i,r,p,w,!0),rh(p,a)&&(a.hitSide=!0),a}function db(n,t,i,r){var s=n.doc,h=t.left,u,e,o,f;for(r=="page"?(e=Math.min(n.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),o=Math.max(e-.5*eu(n.display),3),u=(i>0?t.bottom:t.top)+i*o):r=="line"&&(u=i>0?t.bottom+3:t.top-3);;){if(f=lc(n,h,u),!f.outside)break;if(i<0?u<=0:u>=s.height){f.hitSide=!0;break}u+=i*5}return f}function gb(n,i){var u=ec(n,i.line),s,r;if(!u||u.hidden)return null;var f=t(n.doc,i.line),h=ry(u,f,i.line),e=si(f,n.doc.direction),o="left";return e&&(s=yf(e,i.ch),o=s%2?"right":"left"),r=fy(h.map,i.ch,o),r.offset=r.collapse=="right"?r.end:r.start,r}function sit(n){for(var t=n;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function uf(n,t){return t&&(n.bad=!0),n}function hit(t,i,r,u,f){function v(n){return function(t){return t.id==n}}function l(){s&&(e+=h,o&&(e+=h),s=o=!1)}function c(n){n&&(l(),e+=n)}function a(i){var e,y,p,w,b,r;if(i.nodeType==1){if(e=i.getAttribute("cm-text"),e){c(e);return}if(y=i.getAttribute("cm-marker"),y){w=t.findMarks(n(u,0),n(f+1,0),v(+y));w.length&&(p=w[0].find(0))&&c(fr(t.doc,p.from,p.to).join(h));return}if(i.getAttribute("contenteditable")=="false")return;if(b=/^(pre|div|p|li|table|br)$/i.test(i.nodeName),!/^br$/i.test(i.nodeName)&&i.textContent.length==0)return;for(b&&l(),r=0;r<i.childNodes.length;r++)a(i.childNodes[r]);/^(pre|p)$/i.test(i.nodeName)&&(o=!0);b&&(s=!0)}else i.nodeType==3&&c(i.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(var e="",s=!1,h=t.doc.lineSeparator(),o=!1;;){if(a(i),i==r)break;i=i.nextSibling;o=!1}return e}function vs(t,i,r){var u,f,e;if(i==t.display.lineDiv){if(u=t.display.lineDiv.childNodes[r],!u)return uf(t.clipPos(n(t.display.viewTo-1)),!0);i=null;r=0}else for(u=i;;u=u.parentNode){if(!u||u==t.display.lineDiv)return null;if(u.parentNode&&u.parentNode==t.display.lineDiv)break}for(f=0;f<t.display.view.length;f++)if(e=t.display.view[f],e.node==u)return cit(e,i,r)}function cit(t,i,r){function w(i,r,u){for(var o,e,s,l,c,f=-1;f<(v?v.length:0);f++)for(o=f<0?p.map:v[f],e=0;e<o.length;e+=3)if(s=o[e+2],s==i||s==r)return l=h(f<0?t.line:t.rest[f]),c=o[e]+u,(u<0||s!=i)&&(c=o[e+(u?1:0)]),n(l,c)}var a=t.text.firstChild,l=!1,y,f,e,p,v,u,o,b,c,k;if(!i||!pi(a,i))return uf(n(h(t.line),0),!0);if(i==a&&(l=!0,i=a.childNodes[r],r=0,!i))return y=t.rest?s(t.rest):t.line,uf(n(h(y),y.text.length),l);for(f=i.nodeType==3?i:null,e=i,f||i.childNodes.length!=1||i.firstChild.nodeType!=3||(f=i.firstChild,r&&(r=f.nodeValue.length));e.parentNode!=a;)e=e.parentNode;if(p=t.measure,v=p.maps,u=w(f,e,r),u)return uf(u,l);for(o=e.nextSibling,b=f?f.nodeValue.length-r:0;o;o=o.nextSibling){if(u=w(o,o.firstChild,0),u)return uf(n(u.line,u.ch-b),l);b+=o.textContent.length}for(c=e.previousSibling,k=r;c;c=c.previousSibling){if(u=w(c,c.firstChild,-1),u)return uf(n(u.line,u.ch+k),l);k+=c.textContent.length}}function lit(n,t){function u(){n.value=s.getValue()}var f,e,i,o,s;if(t=t?ur(t):{},t.value=n.value,!t.tabindex&&n.tabIndex&&(t.tabindex=n.tabIndex),!t.placeholder&&n.placeholder&&(t.placeholder=n.placeholder),t.autofocus==null&&(f=ei(),t.autofocus=f==n||n.getAttribute("autofocus")!=null&&f==document.body),n.form&&(r(n.form,"submit",u),!t.leaveSubmitMethodAlone)){i=n.form;e=i.submit;try{o=i.submit=function(){u();i.submit=e;i.submit();i.submit=o}}catch(h){}}return t.finishInit=function(t){t.save=u;t.getTextArea=function(){return n};t.toTextArea=function(){t.toTextArea=isNaN;u();n.parentNode.removeChild(t.getWrapperElement());n.style.display="";n.form&&(lt(n.form,"submit",u),typeof n.form.submit=="function"&&(n.form.submit=e))}},n.style.display="none",s=a(function(t){return n.parentNode.insertBefore(t,n.nextSibling)},t)}function ait(t){t.off=lt;t.on=r;t.wheelEventPixels=hn;t.Doc=ut;t.splitLines=bh;t.countColumn=at;t.findColumn=ks;t.isWordChar=gs;t.Pass=io;t.signal=p;t.Line=cr;t.changeEnd=tr;t.scrollbarModel=nl;t.Pos=n;t.cmpPos=u;t.modes=ao;t.mimeModes=or;t.resolveMode=vo;t.getMode=dh;t.modeExtensions=sr;t.extendMode=ed;t.copyState=hr;t.startState=fv;t.innerMode=gh;t.commands=tf;t.keyMap=fi;t.keyName=gw;t.isModifierKey=kw;t.lookupKey=gu;t.normalizeKeyMap=htt;t.StringStream=v;t.SharedTextMarker=bu;t.TextMarker=ci;t.LineWidget=pu;t.e_preventDefault=ft;t.e_stopPropagation=iv;t.e_stop=pf;t.addClass=rr;t.contains=pi;t.rmClass=vi;t.keyNames=li}var tt=navigator.userAgent,ta=navigator.platform,ai=/gecko\/\d/i.test(tt),ia=/MSIE \d/.test(tt),ra=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(tt),ff=/Edge\/(\d+)/.exec(tt),e=ia||ra||ff,l=e&&(ia?document.documentMode||6:+(ff||ra)[1]),it=!ff&&/WebKit\//.test(tt),tk=it&&/Qt\/\d+\.\d+/.test(tt),ge=!ff&&/Chrome\//.test(tt),pt=/Opera\//.test(tt),ua=/Apple Computer/.test(navigator.vendor),ik=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(tt),rk=/PhantomJS/.test(tt),ef=!ff&&/AppleWebKit/.test(tt)&&/Mobile\/\w+/.test(tt),no=/Android/.test(tt),of=ef||no||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(tt),wt=ef||/Mac/.test(ta),uk=/\bCrOS\b/.test(tt),fk=/win/i.test(ta),ir=pt&&tt.match(/Version\/(\d*\.\d*)/),ys,to,vi,nu,tu,wi,cf,sa,ca,fh,ti,iu,nv,lh,r,uv,ph,wh,ao,or,sr,v,wf,bt,ic,cr,av,vv,lr,uu,oc,vr,ki,hu,nl,fp,ee,oe,st,ht,o,pu,vl,ci,bu,pw,ut,yl,pl,li,ku,ve,du,fi,tf,ib,ss,sb,hs,pe,we,ls,yt,c,y,nk,de;ir&&(ir=Number(ir[1]));ir&&ir>=15&&(pt=!1,it=!0);ys=wt&&(tk||pt&&(ir==null||ir<12.11));to=ai||e&&l>=9;vi=function(n,t){var r=n.className,i=sf(t).exec(r),u;i&&(u=r.slice(i.index+i[0].length),n.className=r.slice(0,i.index)+(u?i[1]+u:""))};nu=document.createRange?function(n,t,i,r){var u=document.createRange();return u.setEnd(r||n,i),u.setStart(n,t),u}:function(n,t,i){var r=document.body.createTextRange();try{r.moveToElementText(n.parentNode)}catch(u){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};tu=function(n){n.select()};ef?tu=function(n){n.selectionStart=0;n.selectionEnd=n.value.length}:e&&(tu=function(n){try{n.select()}catch(t){}});wi=function(){this.id=null};wi.prototype.set=function(n,t){clearTimeout(this.id);this.id=setTimeout(t,n)};var fa=30,io={toString:function(){return"CodeMirror.Pass"}},gt={scroll:!1},bs={origin:"*mouse"},hf={origin:"+move"};cf=[""];sa=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;ca=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;fh=!1;ti=!1;iu=null;nv=function(){function o(n){return n<=247?f.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?e.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":n==8204?"b":"L"}function n(n,t,i){this.level=n;this.from=t;this.to=i}var f="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",e="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",h=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,i=/[LRr]/,r=/[Lb1n]/,u=/[1n]/;return function(f,e){var tt=e=="ltr"?"L":"R",a,c,ot,ut,vt,yt,it,pt,ft,d,g,st,p,wt,w,kt,ht,et,bt,ct,b,k,lt,v,rt,l,gt,nt,at,y,ni;if(f.length==0||e=="ltr"&&!h.test(f))return!1;for(a=f.length,c=[],ot=0;ot<a;++ot)c.push(o(f.charCodeAt(ot)));for(ut=0,vt=tt;ut<a;++ut)yt=c[ut],yt=="m"?c[ut]=vt:vt=yt;for(it=0,pt=tt;it<a;++it)ft=c[it],ft=="1"&&pt=="r"?c[it]="n":i.test(ft)&&(pt=ft,ft=="r"&&(c[it]="R"));for(d=1,g=c[0];d<a-1;++d)st=c[d],st=="+"&&g=="1"&&c[d+1]=="1"?c[d]="1":st==","&&g==c[d+1]&&(g=="1"||g=="n")&&(c[d]=g),g=st;for(p=0;p<a;++p)if(wt=c[p],wt==",")c[p]="N";else if(wt=="%"){for(w=void 0,w=p+1;w<a&&c[w]=="%";++w);for(kt=p&&c[p-1]=="!"||w<a&&c[w]=="1"?"1":"N",ht=p;ht<w;++ht)c[ht]=kt;p=w-1}for(et=0,bt=tt;et<a;++et)ct=c[et],bt=="L"&&ct=="1"?c[et]="L":i.test(ct)&&(bt=ct);for(b=0;b<a;++b)if(t.test(c[b])){for(k=void 0,k=b+1;k<a&&t.test(c[k]);++k);var dt=(b?c[b-1]:tt)=="L",ti=(k<a?c[k]:tt)=="L",ii=dt==ti?dt?"L":"R":tt;for(lt=b;lt<k;++lt)c[lt]=ii;b=k-1}for(v=[],l=0;l<a;)if(r.test(c[l])){for(gt=l,++l;l<a&&r.test(c[l]);++l);v.push(new n(0,gt,l))}else{for(nt=l,at=v.length,++l;l<a&&c[l]!="L";++l);for(y=nt;y<l;)if(u.test(c[y])){for(nt<y&&v.splice(at,0,new n(1,nt,y)),ni=y,++y;y<l&&u.test(c[y]);++y);v.splice(at,0,new n(2,ni,y));nt=y}else++y;nt<l&&v.splice(at,0,new n(1,nt,l))}return e=="ltr"&&(v[0].level==1&&(rt=f.match(/^\s+/))&&(v[0].from=rt[0].length,v.unshift(new n(0,0,rt[0].length))),s(v).level==1&&(rt=f.match(/\s+$/))&&(s(v).to-=rt[0].length,v.push(new n(0,a-rt[0].length,a)))),e=="rtl"?v.reverse():v}}();lh=[];r=function(n,t,i){if(n.addEventListener)n.addEventListener(t,i,!1);else if(n.attachEvent)n.attachEvent("on"+t,i);else{var r=n._handlers||(n._handlers={});r[t]=(r[t]||lh).concat(i)}};uv=function(){if(e&&l<9)return!1;var n=i("div");return"draggable"in n||"dragDrop"in n}();var bh="\n\nb".split(/\n/).length!=3?function(n){for(var i=0,f=[],e=n.length,t,r,u;i<=e;)t=n.indexOf("\n",i),t==-1&&(t=n.length),r=n.slice(i,n.charAt(t-1)=="\r"?t-1:t),u=r.indexOf("\r"),u!=-1?(f.push(r.slice(0,u)),i+=u+1):(f.push(r),i=t+1);return f}:function(n){return n.split(/\r\n?|\n/)},td=window.getSelection?function(n){try{return n.selectionStart!=n.selectionEnd}catch(t){return!1}}:function(n){var t;try{t=n.ownerDocument.selection.createRange()}catch(i){}return!t||t.parentElement()!=n?!1:t.compareEndPoints("StartToEnd",t)!=0},id=function(){var n=i("div");return"oncopy"in n?!0:(n.setAttribute("oncopy","return;"),typeof n.oncopy=="function")}(),kh=null;for(ao={},or={},sr={},v=function(n,t,i){this.pos=this.start=0;this.string=n;this.tabSize=t||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0;this.lineOracle=i},v.prototype.eol=function(){return this.pos>=this.string.length},v.prototype.sol=function(){return this.pos==this.lineStart},v.prototype.peek=function(){return this.string.charAt(this.pos)||undefined},v.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},v.prototype.eat=function(n){var t=this.string.charAt(this.pos),i;return i=typeof n=="string"?t==n:t&&(n.test?n.test(t):n(t)),i?(++this.pos,t):void 0},v.prototype.eatWhile=function(n){for(var t=this.pos;this.eat(n););return this.pos>t},v.prototype.eatSpace=function(){for(var n=this,t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++n.pos;return this.pos>t},v.prototype.skipToEnd=function(){this.pos=this.string.length},v.prototype.skipTo=function(n){var t=this.string.indexOf(n,this.pos);if(t>-1)return this.pos=t,!0},v.prototype.backUp=function(n){this.pos-=n},v.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=at(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?at(this.string,this.lineStart,this.tabSize):0)},v.prototype.indentation=function(){return at(this.string,null,this.tabSize)-(this.lineStart?at(this.string,this.lineStart,this.tabSize):0)},v.prototype.match=function(n,t,i){var u,f,r;if(typeof n=="string"){if(u=function(n){return i?n.toLowerCase():n},f=this.string.substr(this.pos,n.length),u(f)==u(n))return t!==!1&&(this.pos+=n.length),!0}else return(r=this.string.slice(this.pos).match(n),r&&r.index>0)?null:(r&&t!==!1&&(this.pos+=r[0].length),r)},v.prototype.current=function(){return this.string.slice(this.start,this.pos)},v.prototype.hideFirstChars=function(n,t){this.lineStart+=n;try{return t()}finally{this.lineStart-=n}},v.prototype.lookAhead=function(n){var t=this.lineOracle;return t&&t.lookAhead(n)},v.prototype.baseToken=function(){var n=this.lineOracle;return n&&n.baseToken(this.pos)},wf=function(n,t){this.state=n;this.lookAhead=t},bt=function(n,t,i,r){this.state=t;this.doc=n;this.line=i;this.maxLookAhead=r||0;this.baseTokens=null;this.baseTokenPos=1},bt.prototype.lookAhead=function(n){var t=this.doc.getLine(this.line+n);return t!=null&&n>this.maxLookAhead&&(this.maxLookAhead=n),t},bt.prototype.baseToken=function(n){var i=this,t;if(!this.baseTokens)return null;while(this.baseTokens[this.baseTokenPos]<=n)i.baseTokenPos+=2;return t=this.baseTokens[this.baseTokenPos+1],{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-n}},bt.prototype.nextLine=function(){this.line++;this.maxLookAhead>0&&this.maxLookAhead--},bt.fromSaved=function(n,t,i){return t instanceof wf?new bt(n,hr(n.mode,t.state),i,t.lookAhead):new bt(n,hr(n.mode,t),i)},bt.prototype.save=function(n){var t=n!==!1?hr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new wf(t,this.maxLookAhead):t},ic=function(n,t,i){this.start=n.start;this.end=n.pos;this.string=n.current();this.type=t||null;this.state=i},cr=function(n,t,i){this.text=n;wa(this,t);this.height=i?i(this):1},cr.prototype.lineNo=function(){return h(this)},ru(cr),av={},vv={},lr=null,uu=null,oc={left:0,right:0,top:0,bottom:0},ki=function(n,t,u){this.cm=u;var f=this.vert=i("div",[i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=i("div",[i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");f.tabIndex=o.tabIndex=-1;n(f);n(o);r(f,"scroll",function(){f.clientHeight&&t(f.scrollTop,"vertical")});r(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;e&&l<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")},ki.prototype.update=function(n){var i=n.scrollWidth>n.clientWidth+1,r=n.scrollHeight>n.clientHeight+1,t=n.nativeBarWidth,u,f;return r?(this.vert.style.display="block",this.vert.style.bottom=i?t+"px":"0",u=n.viewHeight-(i?t:0),this.vert.firstChild.style.height=Math.max(0,n.scrollHeight-n.clientHeight+u)+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0"),i?(this.horiz.style.display="block",this.horiz.style.right=r?t+"px":"0",this.horiz.style.left=n.barLeft+"px",f=n.viewWidth-n.barLeft-(r?t:0),this.horiz.firstChild.style.width=Math.max(0,n.scrollWidth-n.clientWidth+f)+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedZeroWidth&&n.clientHeight>0&&(t==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?t:0,bottom:i?t:0}},ki.prototype.setScrollLeft=function(n){this.horiz.scrollLeft!=n&&(this.horiz.scrollLeft=n);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ki.prototype.setScrollTop=function(n){this.vert.scrollTop!=n&&(this.vert.scrollTop=n);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ki.prototype.zeroWidthHack=function(){var n=wt&&!ik?"12px":"18px";this.horiz.style.height=this.vert.style.width=n;this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new wi;this.disableVert=new wi},ki.prototype.enableZeroWidthBar=function(n,t,i){function r(){var u=n.getBoundingClientRect(),f=i=="vert"?document.elementFromPoint(u.right-1,(u.top+u.bottom)/2):document.elementFromPoint((u.right+u.left)/2,u.bottom-1);f!=n?n.style.pointerEvents="none":t.set(1e3,r)}n.style.pointerEvents="auto";t.set(1e3,r)},ki.prototype.clear=function(){var n=this.horiz.parentNode;n.removeChild(this.horiz);n.removeChild(this.vert)},hu=function(){},hu.prototype.update=function(){return{bottom:0,right:0}},hu.prototype.setScrollLeft=function(){},hu.prototype.setScrollTop=function(){},hu.prototype.clear=function(){},nl={"native":ki,"null":hu},fp=0,ee=function(n,t,i){var r=n.display;this.viewport=t;this.visible=kc(r,n.doc,t);this.editorIsHidden=!r.wrapper.offsetWidth;this.wrapperHeight=r.wrapper.clientHeight;this.wrapperWidth=r.wrapper.clientWidth;this.oldDisplayWidth=ar(n);this.force=i;this.dims=vc(n);this.events=[]},ee.prototype.signal=function(n,t){vt(n,t)&&this.events.push(arguments)},ee.prototype.finish=function(){for(var t=this,n=0;n<this.events.length;n++)p.apply(null,t.events[n])},oe=0,st=null,e?st=-.53:ai?st=15:ge?st=-.7:ua&&(st=-1/3),ht=function(n,t){this.ranges=n;this.primIndex=t},ht.prototype.primary=function(){return this.ranges[this.primIndex]},ht.prototype.equals=function(n){var u=this,t,i,r;if(n==this)return!0;if(n.primIndex!=this.primIndex||n.ranges.length!=this.ranges.length)return!1;for(t=0;t<this.ranges.length;t++)if(i=u.ranges[t],r=n.ranges[t],!rh(i.anchor,r.anchor)||!rh(i.head,r.head))return!1;return!0},ht.prototype.deepCopy=function(){for(var t=this,i=[],n=0;n<this.ranges.length;n++)i[n]=new o(uh(t.ranges[n].anchor),uh(t.ranges[n].head));return new ht(i,this.primIndex)},ht.prototype.somethingSelected=function(){for(var t=this,n=0;n<this.ranges.length;n++)if(!t.ranges[n].empty())return!0;return!1},ht.prototype.contains=function(n,t){var f=this,i,r;for(t||(t=n),i=0;i<this.ranges.length;i++)if(r=f.ranges[i],u(t,r.from())>=0&&u(n,r.to())<=0)return i;return-1},o=function(n,t){this.anchor=n;this.head=t},o.prototype.from=function(){return eo(this.anchor,this.head)},o.prototype.to=function(){return fo(this.anchor,this.head)},o.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},le.prototype={chunkSize:function(){return this.lines.length},removeInner:function(n,t){for(var i,u=this,r=n,f=n+t;r<f;++r)i=u.lines[r],u.height-=i.height,cd(i),g(i,"delete");this.lines.splice(n,t)},collapse:function(n){n.push.apply(n,this.lines)},insertInner:function(n,t,i){var u=this,r;for(this.height+=i,this.lines=this.lines.slice(0,n).concat(t).concat(this.lines.slice(n)),r=0;r<t.length;++r)t[r].parent=u},iterN:function(n,t,i){for(var r=this,u=n+t;n<u;++n)if(i(r.lines[n]))return!0}},ae.prototype={chunkSize:function(){return this.size},removeInner:function(n,t){var e=this,r,i,u,f,s,o;for(this.size-=t,r=0;r<this.children.length;++r)if(i=e.children[r],u=i.chunkSize(),n<u){if(f=Math.min(t,u-n),s=i.height,i.removeInner(n,f),e.height-=s-i.height,u==f&&(e.children.splice(r--,1),i.parent=null),(t-=f)==0)break;n=0}else n-=u;this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof le))&&(o=[],this.collapse(o),this.children=[new le(o)],this.children[0].parent=this)},collapse:function(n){for(var i=this,t=0;t<this.children.length;++t)i.children[t].collapse(n)},insertInner:function(n,t,i){var f=this,u,r,s,h,e,o;for(this.size+=t.length,this.height+=i,u=0;u<this.children.length;++u){if(r=f.children[u],s=r.chunkSize(),n<=s){if(r.insertInner(n,t,i),r.lines&&r.lines.length>50){for(h=r.lines.length%25+25,e=h;e<r.lines.length;)o=new le(r.lines.slice(e,e+=25)),r.height-=o.height,f.children.splice(++u,0,o),o.parent=f;r.lines=r.lines.slice(0,h);f.maybeSpill()}break}n-=s}},maybeSpill:function(){var n,r,t,i,u;if(!(this.children.length<=10)){n=this;do r=n.children.splice(n.children.length-5,5),t=new ae(r),n.parent?(n.size-=t.size,n.height-=t.height,u=d(n.parent.children,n),n.parent.children.splice(u+1,0,t)):(i=new ae(n.children),i.parent=n,n.children=[i,t],n=i),t.parent=n.parent;while(n.children.length>10);n.parent.maybeSpill()}},iterN:function(n,t,i){for(var f,r,e,o=this,u=0;u<this.children.length;++u)if(f=o.children[u],r=f.chunkSize(),n<r){if(e=Math.min(t,r-n),f.iterN(n,e,i))return!0;if((t-=e)==0)break;n=0}else n-=r}},pu=function(n,t,i){var u=this,r;if(i)for(r in i)i.hasOwnProperty(r)&&(u[r]=i[r]);this.doc=n;this.node=t},pu.prototype.clear=function(){var e=this,n=this.doc.cm,t=this.line.widgets,i=this.line,u=h(i),r,f;if(u!=null&&t){for(r=0;r<t.length;++r)t[r]==e&&t.splice(r--,1);t.length||(i.widgets=null);f=df(this);ni(i,Math.max(0,i.height-f));n&&(ot(n,function(){vw(n,i,-f);di(n,u,"widget")}),g(n,"lineWidgetCleared",n,this,u))}},pu.prototype.changed=function(){var r=this,u=this.height,n=this.doc.cm,t=this.line,i;(this.height=null,i=df(this)-u,i)&&(bi(this.doc,t)||ni(t,t.height+i),n&&ot(n,function(){n.curOp.forceUpdate=!0;vw(n,t,i);g(n,"lineWidgetChanged",n,r,h(t))}))},ru(pu),vl=0,ci=function(n,t){this.lines=[];this.type=t;this.doc=n;this.id=++vl},ci.prototype.clear=function(){var i=this,n,c,f,r,e,o,t,u,s,l,a;if(!this.explicitlyCleared){for(n=this.doc.cm,c=n&&!n.curOp,c&&br(n),vt(this,"clear")&&(f=this.find(),f&&g(this,"clear",f.from,f.to)),r=null,e=null,o=0;o<this.lines.length;++o)t=i.lines[o],u=vf(t.markedSpans,i),n&&!i.collapsed?di(n,h(t),"text"):n&&(u.to!=null&&(e=h(t)),u.from!=null&&(r=h(t))),t.markedSpans=lk(t.markedSpans,u),u.from==null&&i.collapsed&&!bi(i.doc,t)&&n&&ni(t,eu(n.display));if(n&&this.collapsed&&!n.options.lineWrapping)for(s=0;s<this.lines.length;++s)l=ii(i.lines[s]),a=lo(l),a>n.display.maxLineLength&&(n.display.maxLine=l,n.display.maxLineLength=a,n.display.maxLineChanged=!0);r!=null&&n&&this.collapsed&&et(n,r,e+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,n&&rw(n.doc));n&&g(n,"markerCleared",n,this,r,e);c&&kr(n);this.parent&&this.parent.clear()}},ci.prototype.find=function(t,i){var s=this,f,o,e,r,u;for(t==null&&this.type=="bookmark"&&(t=1),e=0;e<this.lines.length;++e){if(r=s.lines[e],u=vf(r.markedSpans,s),u.from!=null&&(f=n(i?r:h(r),u.from),t==-1))return f;if(u.to!=null&&(o=n(i?r:h(r),u.to),t==1))return o}return f&&{from:f,to:o}},ci.prototype.changed=function(){var r=this,i=this.find(-1,!0),t=this,n=this.doc.cm;i&&n&&ot(n,function(){var u=i.line,s=h(i.line),e=ec(n,s),o,f;e&&(ey(e),n.curOp.selectionChanged=n.curOp.forceUpdate=!0);n.curOp.updateMaxLine=!0;bi(t.doc,u)||t.height==null||(o=t.height,t.height=null,f=df(t)-o,f&&ni(u,u.height+f));g(n,"markerChanged",n,r)})},ci.prototype.attachLine=function(n){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&d(t.maybeHiddenMarkers,this)!=-1||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(n)},ci.prototype.detachLine=function(n){if(this.lines.splice(d(this.lines,n),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ru(ci),bu=function(n,t){var r=this,i;for(this.markers=n,this.primary=t,i=0;i<n.length;++i)n[i].parent=r},bu.prototype.clear=function(){var t=this,n;if(!this.explicitlyCleared){for(this.explicitlyCleared=!0,n=0;n<this.markers.length;++n)t.markers[n].clear();g(this,"clear")}},bu.prototype.find=function(n,t){return this.primary.find(n,t)},ru(bu),pw=0,ut=function(t,i,r,u,f){if(!(this instanceof ut))return new ut(t,i,r,u,f);r==null&&(r=0);ae.call(this,[new le([new cr("",null)])]);this.first=r;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.modeFrontier=this.highlightFrontier=r;var e=n(r,0);this.sel=nr(e);this.history=new ts(null);this.id=++pw;this.modeOption=i;this.lineSep=u;this.direction=f=="rtl"?"rtl":"ltr";this.extend=!1;typeof t=="string"&&(t=this.splitLines(t));sl(this,{from:e,to:e,text:t});nt(this,nr(e),gt)},ut.prototype=oa(ae.prototype,{constructor:ut,iter:function(n,t,i){i?this.iterN(n-this.first,t-n,i):this.iterN(this.first,this.first+this.size,n)},insert:function(n,t){for(var r=0,i=0;i<t.length;++i)r+=t[i].height;this.insertInner(n-this.first,t,r)},remove:function(n,t){this.removeInner(n-this.first,t)},getValue:function(n){var t=th(this,this.first,this.first+this.size);return n===!1?t:t.join(n||this.lineSeparator())},setValue:k(function(i){var r=n(this.first,0),u=this.first+this.size-1;vu(this,{from:r,to:n(u,t(this,u).text.length),text:this.splitLines(i),origin:"setValue",full:!0},!0);this.cm&&ie(this.cm,0,0);nt(this,nr(r),gt)}),replaceRange:function(n,t,i,r){t=f(this,t);i=i?f(this,i):t;yu(this,n,t,i,r)},getRange:function(n,t,i){var r=fr(this,f(this,n),f(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(n){var t=this.getLineHandle(n);return t&&t.text},getLineHandle:function(n){if(af(this,n))return t(this,n)},getLineNumber:function(n){return h(n)},getLineHandleVisualStart:function(n){return typeof n=="number"&&(n=t(this,n)),ii(n)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(n){return f(this,n)},getCursor:function(n){var t=this.sel.primary();return n==null||n=="head"?t.head:n=="anchor"?t.anchor:n=="end"||n=="to"||n===!1?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:k(function(t,i,r){nw(this,f(this,typeof t=="number"?n(t,i||0):t),null,r)}),setSelection:k(function(n,t,i){nw(this,f(this,n),f(this,t||n),i)}),extendSelection:k(function(n,t,i){rs(this,f(this,n),t&&f(this,t),i)}),extendSelections:k(function(n,t){gp(this,va(this,n),t)}),extendSelectionsBy:k(function(n,t){var i=ro(this.sel.ranges,n);gp(this,va(this,i),t)}),setSelections:k(function(n,t,i){var e=this,u,r;if(n.length){for(u=[],r=0;r<n.length;r++)u[r]=new o(f(e,n[r].anchor),f(e,n[r].head));t==null&&(t=Math.min(n.length-1,this.sel.primIndex));nt(this,dt(this.cm,u,t),i)}}),addSelection:k(function(n,t,i){var r=this.sel.ranges.slice(0);r.push(new o(f(this,n),f(this,t||n)));nt(this,dt(this.cm,r,r.length-1),i)}),getSelection:function(n){for(var u,f=this,r=this.sel.ranges,t,i=0;i<r.length;i++)u=fr(f,r[i].from(),r[i].to()),t=t?t.concat(u):u;return n===!1?t:t.join(n||this.lineSeparator())},getSelections:function(n){for(var i,u=this,f=[],r=this.sel.ranges,t=0;t<r.length;t++)i=fr(u,r[t].from(),r[t].to()),n!==!1&&(i=i.join(n||u.lineSeparator())),f[t]=i;return f},replaceSelection:function(n,t,i){for(var u=[],r=0;r<this.sel.ranges.length;r++)u[r]=n;this.replaceSelections(u,t,i||"+input")},replaceSelections:k(function(n,t,i){for(var e,o,f,s=this,u=[],h=this.sel,r=0;r<h.ranges.length;r++)e=h.ranges[r],u[r]={from:e.from(),to:e.to(),text:s.splitLines(n[r]),origin:i};for(o=t&&t!="end"&&cn(this,u,t),f=u.length-1;f>=0;f--)vu(s,u[f]);o?tw(this,o):this.cm&&su(this.cm)}),undo:k(function(){fs(this,"undo")}),redo:k(function(){fs(this,"redo")}),undoSelection:k(function(){fs(this,"undo",!0)}),redoSelection:k(function(){fs(this,"redo",!0)}),setExtending:function(n){this.extend=n},getExtending:function(){return this.extend},historySize:function(){for(var t,n=this.history,r=0,u=0,i=0;i<n.done.length;i++)n.done[i].ranges||++r;for(t=0;t<n.undone.length;t++)n.undone[t].ranges||++u;return{undo:r,redo:u}},clearHistory:function(){this.history=new ts(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(n){return n&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(n){return this.history.generation==(n||this.cleanGeneration)},getHistory:function(){return{done:lu(this.history.done),undone:lu(this.history.undone)}},setHistory:function(n){var t=this.history=new ts(this.history.maxGeneration);t.done=lu(n.done.slice(0),null,!0);t.undone=lu(n.undone.slice(0),null,!0)},setGutterMarker:k(function(n,t,i){return ce(this,n,"gutter",function(n){var r=n.gutterMarkers||(n.gutterMarkers={});return r[t]=i,!i&&ha(r)&&(n.gutterMarkers=null),!0})}),clearGutter:k(function(n){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[n]&&ce(t,i,"gutter",function(){return i.gutterMarkers[n]=null,ha(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(n){var i;if(typeof n=="number"){if(!af(this,n)||(i=n,n=t(this,n),!n))return null}else if(i=h(n),i==null)return null;return{line:i,handle:n,text:n.text,gutterMarkers:n.gutterMarkers,textClass:n.textClass,bgClass:n.bgClass,wrapClass:n.wrapClass,widgets:n.widgets}},addLineClass:k(function(n,t,i){return ce(this,n,t=="gutter"?"gutter":"class",function(n){var r=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(n[r]){if(sf(i).test(n[r]))return!1;n[r]+=" "+i}else n[r]=i;return!0})}),removeLineClass:k(function(n,t,i){return ce(this,n,t=="gutter"?"gutter":"class",function(n){var f=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",u=n[f],r,e;if(u)if(i==null)n[f]=null;else{if(r=u.match(sf(i)),!r)return!1;e=r.index+r[0].length;n[f]=u.slice(0,r.index)+(!r.index||e==u.length?"":" ")+u.slice(e)||null}else return!1;return!0})}),addLineWidget:k(function(n,t,i){return dn(this,n,t,i)}),removeLineWidget:function(n){n.clear()},markText:function(n,t,i){return wu(this,f(this,n),f(this,t),i,i&&i.type||"range")},setBookmark:function(n,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return n=f(this,n),wu(this,n,n,i,"bookmark")},findMarksAt:function(n){var e,r,u,i;if(n=f(this,n),e=[],r=t(this,n.line).markedSpans,r)for(u=0;u<r.length;++u)i=r[u],(i.from==null||i.from<=n.ch)&&(i.to==null||i.to>=n.ch)&&e.push(i.marker.parent||i.marker);return e},findMarks:function(n,t,i){n=f(this,n);t=f(this,t);var u=[],r=n.line;return this.iter(n.line,t.line+1,function(f){var s=f.markedSpans,o,e;if(s)for(o=0;o<s.length;o++)e=s[o],e.to!=null&&r==n.line&&n.ch>=e.to||e.from==null&&r!=n.line||e.from!=null&&r==t.line&&e.from>=t.ch||i&&!i(e.marker)||u.push(e.marker.parent||e.marker);++r}),u},getAllMarks:function(){var n=[];return this.iter(function(t){var r=t.markedSpans,i;if(r)for(i=0;i<r.length;++i)r[i].from!=null&&n.push(r[i].marker)}),n},posFromIndex:function(t){var i,r=this.first,u=this.lineSeparator().length;return this.iter(function(n){var f=n.text.length+u;if(f>t)return i=t,!0;t-=f;++r}),f(this,n(r,i))},indexFromPos:function(n){var t,i;return(n=f(this,n),t=n.ch,n.line<this.first||n.ch<0)?0:(i=this.lineSeparator().length,this.iter(this.first,n.line,function(n){t+=n.text.length+i}),t)},copy:function(n){var t=new ut(th(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,n&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(n){var i,r,t;return n||(n={}),i=this.first,r=this.first+this.size,n.from!=null&&n.from>i&&(i=n.from),n.to!=null&&n.to<r&&(r=n.to),t=new ut(th(this,i,r),n.mode||this.modeOption,i,this.lineSep,this.direction),n.sharedHist&&(t.history=this.history),(this.linked||(this.linked=[])).push({doc:t,sharedHist:n.sharedHist}),t.linked=[{doc:this,isParent:!0,sharedHist:n.sharedHist}],ntt(t,yw(this)),t},unlinkDoc:function(n){var i=this,t,u,r;if(n instanceof a&&(n=n.doc),this.linked)for(t=0;t<this.linked.length;++t)if(u=i.linked[t],u.doc==n){i.linked.splice(t,1);n.unlinkDoc(i);ttt(yw(i));break}n.history==this.history&&(r=[n.id],dr(n,function(n){return r.push(n.id)},!0),n.history=new ts(null),n.history.done=lu(this.history.done,r),n.history.undone=lu(this.history.undone,r))},iterLinkedDocs:function(n){dr(this,n)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(n){return this.lineSep?n.split(this.lineSep):bh(n)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:k(function(n){(n!="rtl"&&(n="ltr"),n!=this.direction)&&(this.direction=n,this.iter(function(n){return n.order=null}),this.cm&&ln(this.cm))})}),ut.prototype.eachLine=ut.prototype.iter,yl=0,pl=!1,li={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},ku=0;ku<10;ku++)li[ku+48]=li[ku+96]=String(ku);for(ve=65;ve<=90;ve++)li[ve]=String.fromCharCode(ve);for(du=1;du<=12;du++)li[du+111]=li[du+63235]="F"+du;fi={};fi.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"};fi.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"};fi.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"};fi.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]};fi["default"]=wt?fi.macDefault:fi.pcDefault;tf={selectAll:ew,singleSelection:function(n){return n.setSelection(n.getCursor("anchor"),n.getCursor("head"),gt)},killLine:function(i){return nf(i,function(r){if(r.empty()){var u=t(i.doc,r.head.line).text.length;return r.head.ch==u&&r.head.line<i.lastLine()?{from:r.head,to:n(r.head.line+1,0)}:{from:r.head,to:n(r.head.line,u)}}return{from:r.from(),to:r.to()}})},deleteLine:function(t){return nf(t,function(i){return{from:n(i.from().line,0),to:f(t.doc,n(i.to().line+1,0))}})},delLineLeft:function(t){return nf(t,function(t){return{from:n(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(n){return nf(n,function(t){var i=n.charCoords(t.head,"div").top+5,r=n.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(n){return nf(n,function(t){var i=n.charCoords(t.head,"div").top+5,r=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:r}})},undo:function(n){return n.undo()},redo:function(n){return n.redo()},undoSelection:function(n){return n.undoSelection()},redoSelection:function(n){return n.redoSelection()},goDocStart:function(t){return t.extendSelection(n(t.firstLine(),0))},goDocEnd:function(t){return t.extendSelection(n(t.lastLine()))},goLineStart:function(n){return n.extendSelectionsBy(function(t){return nb(n,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(n){return n.extendSelectionsBy(function(t){return tb(n,t.head)},{origin:"+move",bias:1})},goLineEnd:function(n){return n.extendSelectionsBy(function(t){return ltt(n,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(n){return n.extendSelectionsBy(function(t){var i=n.cursorCoords(t.head,"div").top+5;return n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:i},"div")},hf)},goLineLeft:function(n){return n.extendSelectionsBy(function(t){var i=n.cursorCoords(t.head,"div").top+5;return n.coordsChar({left:0,top:i},"div")},hf)},goLineLeftSmart:function(n){return n.extendSelectionsBy(function(t){var r=n.cursorCoords(t.head,"div").top+5,i=n.coordsChar({left:0,top:r},"div");return i.ch<n.getLine(i.line).search(/\S/)?tb(n,t.head):i},hf)},goLineUp:function(n){return n.moveV(-1,"line")},goLineDown:function(n){return n.moveV(1,"line")},goPageUp:function(n){return n.moveV(-1,"page")},goPageDown:function(n){return n.moveV(1,"page")},goCharLeft:function(n){return n.moveH(-1,"char")},goCharRight:function(n){return n.moveH(1,"char")},goColumnLeft:function(n){return n.moveH(-1,"column")},goColumnRight:function(n){return n.moveH(1,"column")},goWordLeft:function(n){return n.moveH(-1,"word")},goGroupRight:function(n){return n.moveH(1,"group")},goGroupLeft:function(n){return n.moveH(-1,"group")},goWordRight:function(n){return n.moveH(1,"word")},delCharBefore:function(n){return n.deleteH(-1,"char")},delCharAfter:function(n){return n.deleteH(1,"char")},delWordBefore:function(n){return n.deleteH(-1,"word")},delWordAfter:function(n){return n.deleteH(1,"word")},delGroupBefore:function(n){return n.deleteH(-1,"group")},delGroupAfter:function(n){return n.deleteH(1,"group")},indentAuto:function(n){return n.indentSelection("smart")},indentMore:function(n){return n.indentSelection("add")},indentLess:function(n){return n.indentSelection("subtract")},insertTab:function(n){return n.replaceSelection("\t")},insertSoftTab:function(n){for(var r,e,u=[],f=n.listSelections(),t=n.options.tabSize,i=0;i<f.length;i++)r=f[i].from(),e=at(n.getLine(r.line),r.ch,t),u.push(ds(t-e%t));n.replaceSelections(u)},defaultTab:function(n){n.somethingSelected()?n.indentSelection("add"):n.execCommand("insertTab")},transposeChars:function(i){return ot(i,function(){for(var r,u,f,s=i.listSelections(),h=[],e=0;e<s.length;e++)s[e].empty()&&(r=s[e].head,u=t(i.doc,r.line).text,u&&(r.ch==u.length&&(r=new n(r.line,r.ch-1)),r.ch>0?(r=new n(r.line,r.ch+1),i.replaceRange(u.charAt(r.ch-1)+u.charAt(r.ch-2),n(r.line,r.ch-2),r,"+transpose")):r.line>i.doc.first&&(f=t(i.doc,r.line-1).text,f&&(r=new n(r.line,1),i.replaceRange(u.charAt(0)+i.doc.lineSeparator()+f.charAt(f.length-1),n(r.line-1,f.length-1),r,"+transpose")))),h.push(new o(r,r)));i.setSelections(h)})},newlineAndIndent:function(n){return ot(n,function(){for(var r,t=n.listSelections(),i=t.length-1;i>=0;i--)n.replaceRange(n.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");for(t=n.listSelections(),r=0;r<t.length;r++)n.indentLine(t[r].from().line,null,!0);su(n)})},openLine:function(n){return n.replaceSelection("\n","start")},toggleOverwrite:function(n){return n.toggleOverwrite()}};ib=new wi;ss=null;sb=400;hs=function(n,t,i){this.time=n;this.pos=t;this.button=i};hs.prototype.compare=function(n,t,i){return this.time+sb>n&&u(t,this.pos)==0&&i==this.button};var rf={toString:function(){return"CodeMirror.Init"}},vb={},cs={};a.defaults=vb;a.optionHandlers=cs;ls=[];a.defineInitHook=function(n){return ls.push(n)};yt=null;c=function(n){this.cm=n;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new wi;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};c.prototype.init=function(n){function e(n){var r,e,i,o,s;if(!w(t,n)){if(t.somethingSelected())as({lineWise:!1,text:t.getSelections()}),n.type=="cut"&&t.replaceSelection("",null,"cut");else if(t.options.lineWiseCopyCut)r=wb(t),as({lineWise:!0,text:r.text}),n.type=="cut"&&t.operation(function(){t.setSelections(r.ranges,0,gt);t.replaceSelection("",null,"cut")});else return;if(n.clipboardData&&(n.clipboardData.clearData(),e=yt.text.join("\n"),n.clipboardData.setData("Text",e),n.clipboardData.getData("Text")==e)){n.preventDefault();return}i=kb();o=i.firstChild;t.display.lineSpace.insertBefore(i,t.display.lineSpace.firstChild);o.value=yt.text.join("\n");s=document.activeElement;tu(o);setTimeout(function(){t.display.lineSpace.removeChild(i);s.focus();s==u&&f.showPrimarySelection()},50)}}var i=this,f=this,t=f.cm,u=f.div=n.lineDiv;bb(u,t.options.spellcheck,t.options.autocorrect,t.options.autocapitalize);r(u,"paste",function(n){w(t,n)||yb(n,t)||l<=11&&setTimeout(b(t,function(){return i.updateFromDOM()}),20)});r(u,"compositionstart",function(n){i.composing={data:n.data,done:!1}});r(u,"compositionupdate",function(n){i.composing||(i.composing={data:n.data,done:!1})});r(u,"compositionend",function(n){i.composing&&(n.data!=i.composing.data&&i.readFromDOMSoon(),i.composing.done=!0)});r(u,"touchstart",function(){return f.forceCompositionEnd()});r(u,"input",function(){i.composing||i.readFromDOMSoon()});r(u,"copy",e);r(u,"cut",e)};c.prototype.prepareSelection=function(){var n=py(this.cm,!1);return n.focus=this.cm.state.focused,n};c.prototype.showSelection=function(n,t){n&&this.cm.display.view.length&&((n.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(n))};c.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};c.prototype.showPrimarySelection=function(){var n=this.getSelection(),t=this.cm,y=t.doc.sel.primary(),c=y.from(),l=y.to(),r,f,s,i,v,h;if(t.display.viewTo==t.display.viewFrom||c.line>=t.display.viewTo||l.line<t.display.viewFrom){n.removeAllRanges();return}if(r=vs(t,n.anchorNode,n.anchorOffset),f=vs(t,n.focusNode,n.focusOffset),!r||r.bad||!f||f.bad||u(eo(r,f),c)!=0||u(fo(r,f),l)!=0){var a=t.display.view,e=c.line>=t.display.viewFrom&&gb(t,c)||{node:a[0].measure.map[2],offset:0},o=l.line<t.display.viewTo&&gb(t,l);if(o||(s=a[a.length-1].measure,i=s.maps?s.maps[s.maps.length-1]:s.map,o={node:i[i.length-1],offset:i[i.length-2]-i[i.length-3]}),!e||!o){n.removeAllRanges();return}v=n.rangeCount&&n.getRangeAt(0);try{h=nu(e.node,e.offset,o.offset,o.node)}catch(p){}h&&(!ai&&t.state.focused?(n.collapse(e.node,e.offset),h.collapsed||(n.removeAllRanges(),n.addRange(h))):(n.removeAllRanges(),n.addRange(h)),v&&n.anchorNode==null?n.addRange(v):ai&&this.startGracePeriod());this.rememberSelection()}};c.prototype.startGracePeriod=function(){var n=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){n.gracePeriod=!1;n.selectionChanged()&&n.cm.operation(function(){return n.cm.curOp.selectionChanged=!0})},20)};c.prototype.showMultipleSelections=function(n){ct(this.cm.display.cursorDiv,n.cursors);ct(this.cm.display.selectionDiv,n.selection)};c.prototype.rememberSelection=function(){var n=this.getSelection();this.lastAnchorNode=n.anchorNode;this.lastAnchorOffset=n.anchorOffset;this.lastFocusNode=n.focusNode;this.lastFocusOffset=n.focusOffset};c.prototype.selectionInEditor=function(){var n=this.getSelection(),t;return n.rangeCount?(t=n.getRangeAt(0).commonAncestorContainer,pi(this.div,t)):!1};c.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())};c.prototype.blur=function(){this.div.blur()};c.prototype.getField=function(){return this.div};c.prototype.supportsTouch=function(){return!0};c.prototype.receivedFocus=function(){function t(){n.cm.state.focused&&(n.pollSelection(),n.polling.set(n.cm.options.pollInterval,t))}var n=this;this.selectionInEditor()?this.pollSelection():ot(this.cm,function(){return n.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,t)};c.prototype.selectionChanged=function(){var n=this.getSelection();return n.anchorNode!=this.lastAnchorNode||n.anchorOffset!=this.lastAnchorOffset||n.focusNode!=this.lastFocusNode||n.focusOffset!=this.lastFocusOffset};c.prototype.pollSelection=function(){var n,t,i,r;if(this.readDOMTimeout==null&&!this.gracePeriod&&this.selectionChanged()){if(n=this.getSelection(),t=this.cm,no&&ge&&this.cm.options.gutters.length&&sit(n.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs});this.blur();this.focus();return}this.composing||(this.rememberSelection(),i=vs(t,n.anchorNode,n.anchorOffset),r=vs(t,n.focusNode,n.focusOffset),i&&r&&ot(t,function(){nt(t.doc,nr(i,r),gt);(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)}))}};c.prototype.pollContent=function(){var d,v,b,k,y,g,i,e,nt,tt;this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var r=this.cm,f=r.display,it=r.doc.sel.primary(),c=it.from(),a=it.to();if((c.ch==0&&c.line>r.firstLine()&&(c=n(c.line-1,t(r.doc,c.line-1).length)),a.ch==t(r.doc,a.line).text.length&&a.line<r.lastLine()&&(a=n(a.line+1,0)),c.line<f.viewFrom||a.line>f.viewTo-1)||(c.line==f.viewFrom||(d=pr(r,c.line))==0?(v=h(f.view[0].line),b=f.view[0].node):(v=h(f.view[d].line),b=f.view[d-1].node.nextSibling),k=pr(r,a.line),k==f.view.length-1?(y=f.viewTo-1,g=f.lineDiv.lastChild):(y=h(f.view[k+1].line)-1,g=f.view[k+1].node.previousSibling),!b))return!1;for(i=r.doc.splitLines(hit(r,b,g,v,y)),e=fr(r.doc,n(v,0),n(y,t(r.doc,y).text.length));i.length>1&&e.length>1;)if(s(i)==s(e))i.pop(),e.pop(),y--;else if(i[0]==e[0])i.shift(),e.shift(),v++;else break;for(var o=0,l=0,rt=i[0],ut=e[0],ft=Math.min(rt.length,ut.length);o<ft&&rt.charCodeAt(o)==ut.charCodeAt(o);)++o;for(var p=s(i),w=s(e),et=Math.min(p.length-(i.length==1?o:0),w.length-(e.length==1?o:0));l<et&&p.charCodeAt(p.length-l-1)==w.charCodeAt(w.length-l-1);)++l;if(i.length==1&&e.length==1&&v==c.line)while(o&&o>c.ch&&p.charCodeAt(p.length-l-1)==w.charCodeAt(w.length-l-1))o--,l++;return i[i.length-1]=p.slice(0,p.length-l).replace(/^\u200b+/,""),i[0]=i[0].slice(o).replace(/\u200b+$/,""),nt=n(v,o),tt=n(y,e.length?s(e).length-l:0),i.length>1||i[0]||u(nt,tt)?(yu(r.doc,i,nt,tt,"+input"),!0):void 0};c.prototype.ensurePolled=function(){this.forceCompositionEnd()};c.prototype.reset=function(){this.forceCompositionEnd()};c.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())};c.prototype.readFromDOMSoon=function(){var n=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(n.readDOMTimeout=null,n.composing)if(n.composing.done)n.composing=null;else return;n.updateFromDOM()},80))};c.prototype.updateFromDOM=function(){var n=this;(this.cm.isReadOnly()||!this.pollContent())&&ot(this.cm,function(){return et(n.cm)})};c.prototype.setUneditable=function(n){n.contentEditable="false"};c.prototype.onKeyPress=function(n){n.charCode==0||this.composing||(n.preventDefault(),this.cm.isReadOnly()||b(this.cm,gl)(this.cm,String.fromCharCode(n.charCode==null?n.keyCode:n.charCode),0))};c.prototype.readOnlyChanged=function(n){this.div.contentEditable=String(n!="nocursor")};c.prototype.onContextMenu=function(){};c.prototype.resetPosition=function(){};c.prototype.needsContentAttribute=!0;y=function(n){this.cm=n;this.prevInput="";this.pollingFast=!1;this.polling=new wi;this.hasSelection=!1;this.composing=null};y.prototype.init=function(n){function o(n){if(!w(t,n)){if(t.somethingSelected())as({lineWise:!1,text:t.getSelections()});else if(t.options.lineWiseCopyCut){var r=wb(t);as({lineWise:!0,text:r.text});n.type=="cut"?t.setSelections(r.ranges,null,gt):(u.prevInput="",i.value=r.text.join("\n"),tu(i))}else return;n.type=="cut"&&(t.state.cutIncoming=+new Date)}}var f=this,u=this,t=this.cm,i;this.createField(n);i=this.textarea;n.wrapper.insertBefore(this.wrapper,n.wrapper.firstChild);ef&&(i.style.width="0px");r(i,"input",function(){e&&l>=9&&f.hasSelection&&(f.hasSelection=null);u.poll()});r(i,"paste",function(n){w(t,n)||yb(n,t)||(t.state.pasteIncoming=+new Date,u.fastPoll())});r(i,"cut",o);r(i,"copy",o);r(n.scroller,"paste",function(r){if(!hi(n,r)&&!w(t,r)){if(!i.dispatchEvent){t.state.pasteIncoming=+new Date;u.focus();return}var f=new Event("paste");f.clipboardData=r.clipboardData;i.dispatchEvent(f)}});r(n.lineSpace,"selectstart",function(t){hi(n,t)||ft(t)});r(i,"compositionstart",function(){var n=t.getCursor("from");u.composing&&u.composing.range.clear();u.composing={start:n,range:t.markText(n,t.getCursor("to"),{className:"CodeMirror-composing"})}});r(i,"compositionend",function(){u.composing&&(u.poll(),u.composing.range.clear(),u.composing=null)})};y.prototype.createField=function(){this.wrapper=kb();this.textarea=this.wrapper.firstChild};y.prototype.prepareSelection=function(){var n=this.cm,t=n.display,e=n.doc,i=py(n);if(n.options.moveInputWithCursor){var r=kt(n,e.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),f=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+f.top-u.top));i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+f.left-u.left))}return i};y.prototype.showSelection=function(n){var i=this.cm,t=i.display;ct(t.cursorDiv,n.cursors);ct(t.selectionDiv,n.selection);n.teTop!=null&&(this.wrapper.style.top=n.teTop+"px",this.wrapper.style.left=n.teLeft+"px")};y.prototype.reset=function(n){var t,i;this.contextMenuPending||this.composing||(t=this.cm,t.somethingSelected()?(this.prevInput="",i=t.getSelection(),this.textarea.value=i,t.state.focused&&tu(this.textarea),e&&l>=9&&(this.hasSelection=i)):n||(this.prevInput=this.textarea.value="",e&&l>=9&&(this.hasSelection=null)))};y.prototype.getField=function(){return this.textarea};y.prototype.supportsTouch=function(){return!1};y.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!of||ei()!=this.textarea))try{this.textarea.focus()}catch(n){}};y.prototype.blur=function(){this.textarea.blur()};y.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};y.prototype.receivedFocus=function(){this.slowPoll()};y.prototype.slowPoll=function(){var n=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){n.poll();n.cm.state.focused&&n.slowPoll()})};y.prototype.fastPoll=function(){function i(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,i))}var t=!1,n=this;n.pollingFast=!0;n.polling.set(20,i)};y.prototype.poll=function(){var i=this,n=this.cm,f=this.textarea,r=this.prevInput,t,o,u,s;if(this.contextMenuPending||!n.state.focused||td(f)&&!r&&!this.composing||n.isReadOnly()||n.options.disableInput||n.state.keySeq||(t=f.value,t==r&&!n.somethingSelected()))return!1;if(e&&l>=9&&this.hasSelection===t||wt&&/[\uf700-\uf7ff]/.test(t))return n.display.input.reset(),!1;if(n.doc.sel==n.display.selForContextMenu&&(o=t.charCodeAt(0),o!=8203||r||(r="​"),o==8666))return this.reset(),this.cm.execCommand("undo");for(u=0,s=Math.min(r.length,t.length);u<s&&r.charCodeAt(u)==t.charCodeAt(u);)++u;return ot(n,function(){gl(n,t.slice(u),r.length-u,null,i.composing?"*compose":null);t.length>1e3||t.indexOf("\n")>-1?f.value=i.prevInput="":i.prevInput=t;i.composing&&(i.composing.range.clear(),i.composing.range=n.markText(i.composing.start,n.getCursor("to"),{className:"CodeMirror-composing"}))}),!0};y.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};y.prototype.onKeyPress=function(){e&&l>=9&&(this.hasSelection=null);this.fastPoll()};y.prototype.onContextMenu=function(n){function p(){if(f.selectionStart!=null){var n=i.somethingSelected(),r="​"+(n?f.value:"");f.value="⇚";f.value=r;t.prevInput=n?"":"​";f.selectionStart=1;f.selectionEnd=r.length;u.selForContextMenu=i.doc.sel}}function s(){if(t.contextMenuPending==s&&(t.contextMenuPending=!1,t.wrapper.style.cssText=k,f.style.cssText=w,e&&l<9&&u.scrollbars.setScrollTop(u.scroller.scrollTop=c),f.selectionStart!=null)){(!e||e&&l<9)&&p();var r=0,n=function(){u.selForContextMenu==i.doc.sel&&f.selectionStart==0&&f.selectionEnd>0&&t.prevInput=="​"?b(i,ew)(i):r++<10?u.detectingSelectAll=setTimeout(n,500):(u.selForContextMenu=null,u.input.reset())};u.detectingSelectAll=setTimeout(n,200)}}var t=this,i=t.cm,u=i.display,f=t.textarea,o,c,a,y,h;if(t.contextMenuPending&&t.contextMenuPending(),o=yr(i,n),c=u.scroller.scrollTop,o&&!pt){a=i.options.resetSelectionOnContextMenu;a&&i.doc.sel.contains(o)==-1&&b(i,nt)(i.doc,nr(o),gt);var w=f.style.cssText,k=t.wrapper.style.cssText,v=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static";f.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(n.clientY-v.top-5)+"px; left: "+(n.clientX-v.left-5)+"px;\n      z-index: 1000; background: "+(e?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";it&&(y=window.scrollY);u.input.focus();it&&window.scrollTo(null,y);u.input.reset();i.somethingSelected()||(f.value=t.prevInput=" ");t.contextMenuPending=s;u.selForContextMenu=i.doc.sel;clearTimeout(u.detectingSelectAll);e&&l>=9&&p();to?(pf(n),h=function(){lt(window,"mouseup",h);setTimeout(s,20)},r(window,"mouseup",h)):setTimeout(s,50)}};y.prototype.readOnlyChanged=function(n){n||this.reset();this.textarea.disabled=n=="nocursor"};y.prototype.setUneditable=function(){};y.prototype.needsContentAttribute=!1;rit(a);oit(a);nk="iter insert remove copy getEditor constructor".split(" ");for(de in ut.prototype)ut.prototype.hasOwnProperty(de)&&d(nk,de)<0&&(a.prototype[de]=function(n){return function(){return n.apply(this.doc,arguments)}}(ut.prototype[de]));return ru(ut),a.inputStyles={textarea:y,contenteditable:c},a.defineMode=function(n){a.defaults.mode||n=="null"||(a.defaults.mode=n);ud.apply(this,arguments)},a.defineMIME=fd,a.defineMode("null",function(){return{token:function(n){return n.skipToEnd()}}}),a.defineMIME("text/plain","null"),a.defineExtension=function(n,t){a.prototype[n]=t},a.defineDocExtension=function(n,t){ut.prototype[n]=t},a.fromTextArea=lit,ait(a),a.version="5.45.0",a}),function(n){typeof exports=="object"&&typeof module=="object"?n(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],n):n(CodeMirror)}(function(n){"use strict";function y(n,t,i,r,u,f){this.indented=n;this.column=t;this.type=i;this.info=r;this.align=u;this.prev=f}function c(n,t,i,r){var u=n.indented;return n.context&&n.context.type=="statement"&&i!="statement"&&(u=n.context.indented),n.context=new y(u,t,i,r,null,n.context)}function e(n){var t=n.context.type;return(t==")"||t=="]"||t=="}")&&(n.indented=n.context.indented),n.context=n.context.prev}function k(n,t,i){return t.prevToken=="variable"||t.prevToken=="type"?!0:/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(n.string.slice(0,i))?!0:t.typeAtEndOfLine&&n.column()==n.indentation()?!0:void 0}function d(n){for(;;){if(!n||n.type=="top")return!0;if(n.type=="}"&&n.prev.info!="namespace")return!1;n=n.prev}}function t(n){for(var i={},r=n.split(" "),t=0;t<r.length;++t)i[r[t]]=!0;return i}function u(n,t){return typeof n=="function"?n(t):n.propertyIsEnumerable(t)}function o(n){return u(it,n)||/.+_t$/.test(n)}function ut(n){return o(n)||u(rt,n)}function f(n,t){if(!t.startOfLine)return!1;for(var i,r=null;i=n.peek();){if(i=="\\"&&n.match(/^.$/)){r=f;break}else if(i=="/"&&n.match(/^\/[\/\*]/,!1))break;n.next()}return t.tokenize=r,"meta"}function p(n,t){return t.prevToken=="type"?"type":!1}function w(n){return!n||n.length<2?!1:n[0]!="_"?!1:n[1]=="_"||n[1]!==n[1].toLowerCase()}function r(n){return n.eatWhile(/[\w\.']/),"number"}function v(n,t){if(n.backUp(1),n.match(/(R|u8R|uR|UR|LR)/)){var i=n.match(/"([^\s\\()]{0,16})\(/);return i?(t.cpp11RawStringDelim=i[1],t.tokenize=nt,nt(n,t)):!1}return n.match(/(u8|u|U|L)/)?n.match(/["']/,!1)?"string":!1:(n.next(),!1)}function ft(n){var t=/(\w+)::~?(\w+)$/.exec(n);return t&&t[1]==t[2]}function g(n,t){for(var i;(i=n.next())!=null;)if(i=='"'&&!n.eat('"')){t.tokenize=null;break}return"string"}function nt(n,t){var i=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&"),r=n.match(new RegExp(".*?\\)"+i+'"'));return r?t.tokenize=null:n.skipToEnd(),"string"}function i(t,i){function u(n){if(n)for(var t in n)n.hasOwnProperty(t)&&r.push(t)}var r,f;for(typeof t=="string"&&(t=[t]),r=[],u(i.keywords),u(i.types),u(i.builtin),u(i.atoms),r.length&&(i.helperType=t[0],n.registerHelper("hintWords",t[0],r)),f=0;f<t.length;++f)n.defineMIME(t[f],i)}function et(n,t){for(var i=!1;!n.eol();){if(!i&&n.match('"""')){t.tokenize=null;break}i=n.next()=="\\"&&!i}return"string"}function b(n){return function(t,i){for(var r;r=t.next();)if(r=="*"&&t.eat("/"))if(n==1){i.tokenize=null;break}else return i.tokenize=b(n-1),i.tokenize(t,i);else if(r=="/"&&t.eat("*"))return i.tokenize=b(n+1),i.tokenize(t,i);return"comment"}}function ot(n){return function(t,i){for(var r=!1,u,f=!1;!t.eol();){if(!n&&!r&&t.match('"')){f=!0;break}if(n&&t.match('"""')){f=!0;break}u=t.next();!r&&u=="$"&&t.match("{")&&t.skipTo("}");r=!r&&u=="\\"&&!n}return(f||!n)&&(i.tokenize=null),"string"}}function tt(n){return function(t,i){for(var r=!1,f,u=!1;!t.eol();){if(!r&&t.match('"')&&(n=="single"||t.match('""'))){u=!0;break}if(!r&&t.match("``")){h=tt(n);u=!0;break}f=t.next();r=n=="single"&&!r&&f=="\\"}return u&&(i.tokenize=null),"string"}}var s,a,h;n.defineMode("clike",function(t,i){function b(n,t){var i=n.next(),o,e;if(f[i]&&(o=f[i](n,t),o!==!1))return o;if(i=='"'||i=="'")return t.tokenize=vt(i),t.tokenize(n,t);if(ct.test(i))return r=i,null;if(lt.test(i)){if(n.backUp(1),n.match(at))return"number";n.next()}if(i=="/"){if(n.eat("*"))return t.tokenize=g,g(n,t);if(n.eat("/"))return n.skipToEnd(),"comment"}if(v.test(i)){while(!n.match(/^\/[\/*]/,!1)&&n.eat(v));return"operator"}if(n.eatWhile(p),a)while(n.match(a))n.eatWhile(p);return(e=n.current(),u(it,e))?(u(l,e)&&(r="newstatement"),u(ft,e)&&(s=!0),"keyword"):u(rt,e)?"type":u(ut,e)||w&&w(e)?(u(l,e)&&(r="newstatement"),"builtin"):u(et,e)?"atom":"variable"}function vt(n){return function(t,i){for(var r=!1,u,f=!1;(u=t.next())!=null;){if(u==n&&!r){f=!0;break}r=!r&&u=="\\"}return!f&&(r||ot)||(i.tokenize=null),"string"}}function g(n,t){for(var r=!1,i;i=n.next();){if(i=="/"&&r){t.tokenize=null;break}r=i=="*"}return"comment"}function nt(n,t){i.typeFirstDefinitions&&n.eol()&&d(t.context)&&(t.typeAtEndOfLine=k(n,t,n.pos))}var o=t.indentUnit,h=i.statementIndentUnit||o,tt=i.dontAlignCalls,it=i.keywords||{},rt=i.types||{},ut=i.builtin||{},l=i.blockKeywords||{},ft=i.defKeywords||{},et=i.atoms||{},f=i.hooks||{},ot=i.multiLineStrings,st=i.indentStatements!==!1,ht=i.indentSwitch!==!1,a=i.namespaceSeparator,ct=i.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,lt=i.numberStart||/[\d\.]/,at=i.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,v=i.isOperatorChar||/[+\-*&%=<>!?|\/]/,p=i.isIdentifierChar||/[\w\$_\xa1-\uffff]/,w=i.isReservedIdentifier||!1,r,s;return{startState:function(n){return{tokenize:null,context:new y((n||0)-o,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(n,t){var u=t.context,o,h;if(n.sol()&&(u.align==null&&(u.align=!1),t.indented=n.indentation(),t.startOfLine=!0),n.eatSpace())return nt(n,t),null;if(r=s=null,o=(t.tokenize||b)(n,t),o=="comment"||o=="meta")return o;if(u.align==null&&(u.align=!0),r==";"||r==":"||r==","&&n.match(/^\s*(?:\/\/.*)?$/,!1))while(t.context.type=="statement")e(t);else if(r=="{")c(t,n.column(),"}");else if(r=="[")c(t,n.column(),"]");else if(r=="(")c(t,n.column(),")");else if(r=="}"){while(u.type=="statement")u=e(t);for(u.type=="}"&&(u=e(t));u.type=="statement";)u=e(t)}else r==u.type?e(t):st&&((u.type=="}"||u.type=="top")&&r!=";"||u.type=="statement"&&r=="newstatement")&&c(t,n.column(),"statement",n.current());return o=="variable"&&(t.prevToken=="def"||i.typeFirstDefinitions&&k(n,t,n.start)&&d(t.context)&&n.match(/^\s*\(/,!1))&&(o="def"),f.token&&(h=f.token(n,t,o),h!==undefined&&(o=h)),o=="def"&&i.styleDefs===!1&&(o="variable"),t.startOfLine=!1,t.prevToken=s?"def":o||r,nt(n,t),o},indent:function(t,r){var c,l;if(t.tokenize!=b&&t.tokenize!=null||t.typeAtEndOfLine)return n.Pass;var u=t.context,e=r&&r.charAt(0),s=e==u.type;if(u.type=="statement"&&e=="}"&&(u=u.prev),i.dontIndentStatements)while(u.type=="statement"&&i.dontIndentStatements.test(u.info))u=u.prev;if(f.indent&&(c=f.indent(t,u,r,o),typeof c=="number"))return c;if(l=u.prev&&u.prev.info=="switch",i.allmanIndentation&&/[{(]/.test(e)){while(u.type!="top"&&u.type!="}")u=u.prev;return u.indented}return u.type=="statement"?u.indented+(e=="{"?0:h):u.align&&(!tt||u.type!=")")?u.column+(s?0:1):u.type==")"&&!s?u.indented+h:u.indented+(s?0:o)+(!s&&l&&!/^(?:case|default)\b/.test(r)?o:0)},electricInput:ht?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});var l="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile inline restrict asm fortran",it=t("int long char short double float unsigned signed void bool"),rt=t("SEL instancetype id Class Protocol BOOL");s="case do else for if switch while struct enum union";a="struct enum union";i(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:t(l),types:o,blockKeywords:t(s),defKeywords:t(a),typeFirstDefinitions:!0,atoms:t("NULL true false"),isReservedIdentifier:w,hooks:{"#":f,"*":p},modeProps:{fold:["brace","include"]}});i(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:t(l+"alignas alignof and and_eq audit axiom bitand bitor catch class compl concept constexpr const_cast decltype delete dynamic_cast explicit export final friend import module mutable namespace new noexcept not not_eq operator or or_eq override private protected public reinterpret_cast requires static_assert static_cast template this thread_local throw try typeid typename using virtual xor xor_eq"),types:o,blockKeywords:t(s+" class try catch"),defKeywords:t(a+" class namespace"),typeFirstDefinitions:!0,atoms:t("true false NULL nullptr"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,isReservedIdentifier:w,hooks:{"#":f,"*":p,u:v,U:v,L:v,R:v,"0":r,"1":r,"2":r,"3":r,"4":r,"5":r,"6":r,"7":r,"8":r,"9":r,token:function(n,t,i){if(i=="variable"&&n.peek()=="("&&(t.prevToken==";"||t.prevToken==null||t.prevToken=="}")&&ft(n.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}});i("text/x-java",{name:"clike",keywords:t("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:t("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:t("catch class do else finally for if switch try while"),defKeywords:t("class interface enum @interface"),typeFirstDefinitions:!0,atoms:t("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(n){return n.match("interface",!1)?!1:(n.eatWhile(/[\w\$_]/),"meta")}},modeProps:{fold:["brace","import"]}});i("text/x-csharp",{name:"clike",keywords:t("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:t("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:t("catch class do else finally for foreach if struct switch try while"),defKeywords:t("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"@":function(n,t){return n.eat('"')?(t.tokenize=g,g(n,t)):(n.eatWhile(/[\w\$_]/),"meta")}}});i("text/x-scala",{name:"clike",keywords:t("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:t("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:t("catch class enum do else finally for forSome if match switch try while"),defKeywords:t("class enum def object package trait type val var"),atoms:t("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(n){return n.eatWhile(/[\w\$_]/),"meta"},'"':function(n,t){return n.match('""')?(t.tokenize=et,t.tokenize(n,t)):!1},"'":function(n){return n.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(n,t){var i=t.context;return i.type=="}"&&i.align&&n.eat(">")?(t.context=new y(i.indented,i.column,i.type,i.info,null,i.prev),"operator"):!1},"/":function(n,t){return n.eat("*")?(t.tokenize=b(1),t.tokenize(n,t)):!1}},modeProps:{closeBrackets:{pairs:'()[]{}""',triples:'"'}}});i("text/x-kotlin",{name:"clike",keywords:t("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam"),types:t("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:t("catch class do else finally for if where try while enum"),defKeywords:t("class val var object interface fun"),atoms:t("true false null this"),hooks:{"@":function(n){return n.eatWhile(/[\w\$_]/),"meta"},"*":function(n,t){return t.prevToken=="."?"variable":"operator"},'"':function(n,t){return t.tokenize=ot(n.match('""')),t.tokenize(n,t)},indent:function(n,t,i,r){var u=i&&i.charAt(0);return(n.prevToken=="}"||n.prevToken==")")&&i==""?n.indented:n.prevToken=="operator"&&i!="}"||n.prevToken=="variable"&&u=="."||(n.prevToken=="}"||n.prevToken==")")&&u=="."?r*2+t.indented:t.align&&t.type=="}"?t.indented+(n.context.type==(i||"").charAt(0)?0:r):void 0}},modeProps:{closeBrackets:{triples:'"'}}});i(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:t("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:t("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:t("for while do if else struct"),builtin:t("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:t("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":f},modeProps:{fold:["brace","include"]}});i("text/x-nesc",{name:"clike",keywords:t(l+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:o,blockKeywords:t(s),atoms:t("null true false"),hooks:{"#":f},modeProps:{fold:["brace","include"]}});i("text/x-objectivec",{name:"clike",keywords:t(l+" bycopy byref in inout oneway out self super atomic nonatomic retain copy readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd @interface @implementation @end @protocol @encode @property @synthesize @dynamic @class @public @package @private @protected @required @optional @try @catch @finally @import @selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available"),types:ut,builtin:t("FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINED NS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT"),blockKeywords:t(s+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:t(a+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:t("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:w,hooks:{"#":f,"*":p},modeProps:{fold:["brace","include"]}});i("text/x-squirrel",{name:"clike",keywords:t("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:o,blockKeywords:t("case catch class else for foreach if switch try while"),defKeywords:t("function local class"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"#":f},modeProps:{fold:["brace","include"]}});h=null;i("text/x-ceylon",{name:"clike",keywords:t("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(n){var t=n.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:t("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:t("class dynamic function interface module object package value"),builtin:t("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:t("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(n){return n.eatWhile(/[\w\$_]/),"meta"},'"':function(n,t){return t.tokenize=tt(n.match('""')?"triple":"single"),t.tokenize(n,t)},"`":function(n,t){return!h||!n.match("`")?!1:(t.tokenize=h,h=null,t.tokenize(n,t))},"'":function(n){return n.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(n,t,i){if((i=="variable"||i=="type")&&t.prevToken==".")return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})});
  //# sourceMappingURL=codemirror-bundle.min.js.map