function submit(){}!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.CodeMirror=t()}(this,function(){"use strict";function lf(n){return new RegExp("(^|\\s)"+n+"(?:$|\\s)\\s*")}function wi(n){for(var t=n.childNodes.length;0<t;--t)n.removeChild(n.firstChild);return n}function lt(n,t){return wi(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),"string"==typeof t)u.appendChild(document.createTextNode(t));else if(t)for(f=0;f<t.length;++f)u.appendChild(t[f]);return u}function iu(n,t,r,u){var f=i(n,t,r,u);return f.setAttribute("role","presentation"),f}function bi(n,t){if(3==t.nodeType&&(t=t.parentNode),n.contains)return n.contains(t);do if(11==t.nodeType&&(t=t.host),t==n)return!0;while(t=t.parentNode)}function si(){var n;try{n=document.activeElement}catch(t){n=document.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function fr(n,t){var i=n.className;lf(t).test(i)||(n.className+=(i?" ":"")+t)}function bs(n,t){for(var r=n.split(" "),i=0;i<r.length;i++)r[i]&&!lf(r[i]).test(t)&&(t+=" "+r[i]);return t}function ks(n){var t=Array.prototype.slice.call(arguments,1);return function(){return n.apply(null,t)}}function er(n,t,i){for(var r in t||(t={}),n)!n.hasOwnProperty(r)||!1===i&&t.hasOwnProperty(r)||(t[r]=n[r]);return t}function vt(n,t,i,r,u){var f,e,o;for(null==t&&-1==(t=n.search(/[^\s\u00a0]/))&&(t=n.length),f=r||0,e=u||0;;){if(o=n.indexOf("\t",f),o<0||t<=o)return e+(t-f);e+=o-f;e+=i-e%i;f=o+1}}function g(n,t){for(var i=0;i<n.length;++i)if(n[i]==t)return i;return-1}function gs(n,t,i){for(var u,e,r=0,f=0;;){if(u=n.indexOf("\t",r),-1==u&&(u=n.length),e=u-r,u==n.length||t<=f+e)return r+Math.min(e,t-f);if(f+=u-r,r=u+1,t<=(f+=i-f%i))return r}}function nh(n){for(;vf.length<=n;)vf.push(h(vf)+" ");return vf[n]}function h(n){return n[n.length-1]}function eo(n,t){for(var r=[],i=0;i<n.length;i++)r[i]=t(n[i],i);return r}function la(){}function aa(n,t){var i;return i=Object.create?Object.create(n):(la.prototype=n,new la),t&&er(t,i),i}function th(n){return/\w/.test(n)||""<n&&(n.toUpperCase()!=n.toLowerCase()||va.test(n))}function oo(n,t){return t?!!(-1<t.source.indexOf("\\w")&&th(n))||t.test(n):th(n)}function ya(n){for(var t in n)if(n.hasOwnProperty(t)&&n[t])return!1;return!0}function ih(n){return 768<=n.charCodeAt(0)&&pa.test(n)}function wa(n,t,i){for(;(i<0?0<t:t<n.length)&&ih(n.charAt(t));)t+=i;return t}function yf(n,t,i){for(var f,r,u=i<t?-1:1;;){if(t==i)return t;if(f=(t+i)/2,r=u<0?Math.ceil(f):Math.floor(f),r==t)return n(r)?t:i;n(r)?i=r:t=r+u}}function ck(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=iu("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=iu("div",[u.measure,u.lineMeasure,u.selectionDiv,u.cursorDiv,u.lineDiv],null,"position: relative; outline: none");f=iu("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: "+ca+"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");o&&a<8&&(u.gutters.style.zIndex=-1,u.scroller.style.paddingRight=0);rt||yi&&cf||(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)<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 or(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 rh(n,t,i){var r=[];return n.iter(t,i,function(n){r.push(n.text)}),r}function ii(n,t){var r=t-n.height,i;if(r)for(i=n;i;i=i.parent)i.height+=r}function c(n){var r;if(null==n.parent)return null;for(var t=n.parent,u=g(t.lines,n),i=t.parent;i;i=(t=i).parent)for(r=0;i.children[r]!=t;++r)u+=i.children[r].chunkSize();return u+t.first}function sr(n,t){var f=n.first,r,u,e,i,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(o=n.lines[i].height,t<o)break;t-=o}return f+i}function pf(n,t){return t>=n.first&&t<n.first+n.size}function uh(n,t){return String(n.lineNumberFormatter(t+n.firstLineNumber))}function n(t,i,r){if(void 0===r&&(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 fh(n,t){return n.sticky==t.sticky&&0==u(n,t)}function eh(t){return n(t.line,t.ch)}function so(n,t){return u(n,t)<0?t:n}function ho(n,t){return u(n,t)<0?n:t}function ba(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,f,e,o=i.first+i.size-1;return r.line>o?n(o,t(i,o).text.length):(f=t(i,(u=r).line).text.length,null==(e=u.ch)||f<e?n(u.line,f):e<0?n(u.line,0):u)}function ka(n,t){for(var r=[],i=0;i<t.length;i++)r[i]=f(n,t[i]);return r}function co(n,t,i){this.marker=n;this.from=t;this.to=i}function wf(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 sh(n,i){var w,b,a,s,v,y,e,p,d,g,c,nt;if(i.full||(w=pf(n,i.from.line)&&t(n,i.from.line).markedSpans,b=pf(n,i.to.line)&&t(n,i.to.line).markedSpans,!w&&!b))return null;var k=i.from.ch,it=i.to.ch,tt=0==u(i.from,i.to),r=function(n,t,i){var e,f,r,u,o;if(n)for(f=0;f<n.length;++f)r=n[f],u=r.marker,null!=r.from&&!(u.inclusiveLeft?r.from<=t:r.from<t)&&(r.from!=t||"bookmark"!=u.type||i&&r.marker.insertLeft)||(o=null==r.to||(u.inclusiveRight?r.to>=t:r.to>t),(e||(e=[])).push(new co(u,r.from,o?null:r.to)));return e}(w,k,tt),f=function(n,t,i){var e,f,r,u,o;if(n)for(f=0;f<n.length;++f)r=n[f],u=r.marker,(null==r.to||(u.inclusiveRight?r.to>=t:r.to>t)||r.from==t&&"bookmark"==u.type&&(!i||r.marker.insertLeft))&&(o=null==r.from||(u.inclusiveLeft?r.from<=t:r.from<t),(e||(e=[])).push(new co(u,o?null:r.from-t,null==r.to?null:r.to-t)));return e}(b,it,tt),o=1==i.text.length,l=h(i.text).length+(o?k:0);if(r)for(a=0;a<r.length;++a)s=r[a],null==s.to&&(v=wf(f,s.marker),v?o&&(s.to=null==v.to?null:v.to+l):s.to=k);if(f)for(y=0;y<f.length;++y)e=f[y],(null!=e.to&&(e.to+=l),null==e.from)?wf(r,e.marker)||(e.from=l,o&&(r||(r=[])).push(e)):(e.from+=l,o&&(r||(r=[])).push(e));if(r&&(r=da(r)),f&&f!=r&&(f=da(f)),p=[r],!o){if(g=i.text.length-2,0<g&&r)for(c=0;c<r.length;++c)null==r[c].to&&(d||(d=[])).push(new co(r[c].marker,null,null));for(nt=0;nt<g;++nt)p.push(d);p.push(f)}return p}function da(n){for(var i,t=0;t<n.length;++t)i=n[t],null!=i.from&&i.from==i.to&&!1!==i.marker.clearWhenEmpty&&n.splice(t--,1);return n.length?n:null}function ga(n){var i=n.markedSpans,t;if(i){for(t=0;t<i.length;++t)i[t].marker.detachLine(n);n.markedSpans=null}}function nv(n,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(n);n.markedSpans=t}}function lo(n){return n.inclusiveLeft?-1:0}function ao(n){return n.inclusiveRight?1:0}function hh(n,t){var i=n.lines.length-t.lines.length,o;if(0!=i)return i;var r=n.find(),f=t.find(),e=u(r.from,f.from)||lo(n)-lo(t);return e?-e:(o=u(r.to,f.to)||ao(n)-ao(t),o||t.id-n.id)}function tv(n,t){var r,f=ri&&n.markedSpans,i,u;if(f)for(i=void 0,u=0;u<f.length;++u)(i=f[u]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||hh(r,i.marker)<0)&&(r=i.marker);return r}function iv(n){return tv(n,!0)}function vo(n){return tv(n,!1)}function ak(n,t){var r,f=ri&&n.markedSpans,u,i;if(f)for(u=0;u<f.length;++u)i=f[u],i.marker.collapsed&&(null==i.from||i.from<t)&&(null==i.to||i.to>t)&&(!r||hh(r,i.marker)<0)&&(r=i.marker);return r}function rv(n,i,r,f,e){var v=t(n,i),l=ri&&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)||lo(o.marker)-lo(e),a=u(s.to,f)||ao(o.marker)-ao(e);if(!(0<=c&&a<=0||c<=0&&0<=a)&&(c<=0&&(o.marker.inclusiveRight&&e.inclusiveLeft?0<=u(s.to,r):0<u(s.to,r))||0<=c&&(o.marker.inclusiveRight&&e.inclusiveLeft?u(s.from,f)<=0:u(s.from,f)<0)))return!0}}function ui(n){for(var t;t=iv(n);)n=t.find(-1,!0).line;return n}function ch(n,i){var r=t(n,i),u=ui(r);return r==u?i:c(u)}function uv(n,i){if(i>n.lastLine())return i;var u,r=t(n,i);if(!di(n,r))return i;for(;u=vo(r);)r=u.find(1,!0).line;return c(r)+1}function di(n,t){var u=ri&&t.markedSpans,i,r;if(u)for(i=void 0,r=0;r<u.length;++r)if((i=u[r]).marker.collapsed&&(null==i.from||!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&lh(n,t,i)))return!0}function lh(n,t,i){var f,r,u;if(null==i.to)return f=i.marker.find(1,!0),lh(n,f.line,wf(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]).marker.collapsed&&!r.marker.widgetNode&&r.from==i.to&&(null==r.to||r.to!=i.from)&&(r.marker.inclusiveLeft||i.marker.inclusiveRight)&&lh(n,t,r))return!0}function hi(n){for(var e,t,r,o,u=0,i=(n=ui(n)).parent,f=0;f<i.lines.length;++f){if(e=i.lines[f],e==n)break;u+=e.height}for(t=i.parent;t;t=(i=t).parent)for(r=0;r<t.children.length;++r){if(o=t.children[r],o==i)break;u+=o.height}return u}function yo(n){var r,i,t,u,f;if(0==n.height)return 0;for(i=n.text.length,t=n;r=iv(t);)u=r.find(0,!0),t=u.from.line,i+=u.from.ch-u.to.ch;for(t=n;r=vo(t);)f=r.find(0,!0),i-=t.text.length-f.from.ch,i+=(t=f.to.line).text.length-f.to.ch;return i}function ah(n){var i=n.display,r=n.doc;i.maxLine=t(r,r.first);i.maxLineLength=yo(i.maxLine);i.maxLineChanged=!0;r.iter(function(n){var t=yo(n);t>i.maxLineLength&&(i.maxLineLength=t,i.maxLine=n)})}function bf(n,t,i){var f,r,u;for(uu=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&&"before"==i?f=r:uu=r);u.from==t&&(u.from!=u.to&&"before"!=i?f=r:uu=r)}return null!=f?f:uu}function ci(n,t){var i=n.order;return null==i&&(i=n.order=fv(n.text,t)),i}function yh(n,t){return n._handlers&&n._handlers[t]||vh}function at(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=g(r,i),-1<f&&(u[t]=r.slice(0,f).concat(r.slice(f+1)))))}function w(n,t){var r=yh(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 b(n,t,i){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),w(n,i||t.type,n,t),ph(t)||t.codemirrorIgnore}function ev(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)-1==g(r,i[t])&&r.push(i[t])}function yt(n,t){return 0<yh(n,t).length}function fu(n){n.prototype.on=function(n,t){r(this,n,t)};n.prototype.off=function(n,t){at(this,n,t)}}function et(n){n.preventDefault?n.preventDefault():n.returnValue=!1}function ov(n){n.stopPropagation?n.stopPropagation():n.cancelBubble=!0}function ph(n){return null!=n.defaultPrevented?n.defaultPrevented:0==n.returnValue}function kf(n){et(n);ov(n)}function wh(n){return n.target||n.srcElement}function sv(n){var t=n.which;return null==t&&(1&n.button?t=1:2&n.button?t=3:4&n.button&&(t=2)),bt&&n.ctrlKey&&1==t&&(t=3),t}function vk(n){var t,r;return null==bh&&(t=i("span","​"),lt(n,i("span",[t,document.createTextNode("x")])),0!=n.firstChild.offsetHeight&&(bh=t.offsetWidth<=1&&2<t.offsetHeight&&!(o&&a<8))),r=bh?i("span","​"):i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px"),r.setAttribute("cm-text",""),r}function yk(n){if(null!=kh)return kh;var i=lt(n,document.createTextNode("AخA")),t=tu(i,0,1).getBoundingClientRect(),r=tu(i,1,2).getBoundingClientRect();return wi(n),!(!t||t.left==t.right)&&(kh=r.right-t.right<3)}function po(n){if("string"==typeof n&&eu.hasOwnProperty(n))n=eu[n];else if(n&&"string"==typeof n.name&&eu.hasOwnProperty(n.name)){var t=eu[n.name];"string"==typeof t&&(t={name:t});(n=aa(t,n)).name=t.name}else{if("string"==typeof n&&/^[\w\-]+\/[\w\-]+\+xml$/.test(n))return po("application/xml");if("string"==typeof n&&/^[\w\-]+\/[\w\-]+\+json$/.test(n))return po("application/json")}return"string"==typeof n?{name:n}:n||{name:"null"}}function ic(n,t){var f,i,u,r,e;if(t=po(t),f=tc[t.name],!f)return ic(n,"text/plain");if(i=f(n,t),hr.hasOwnProperty(t.name)){u=hr[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 bk(n,t){er(t,hr.hasOwnProperty(n)?hr[n]:hr[n]={})}function cr(n,t){var r,u,i;if(!0===t)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 rc(n,t){for(var i;n.innerMode&&(i=n.innerMode(t))&&i.mode!=n;)t=i.state,n=i.mode;return i||{mode:n,state:t}}function cv(n,t,i){return!n.startState||n.startState(t,i)}function lv(n,t,i,r){var u=[n.state.modeGen],f={};wv(n,t.text,n.doc.mode,i,function(n,t){return u.push(n,t)},f,r);for(var o=i.state,s=function(r){i.baseTokens=u;var s=n.state.overlays[r],e=1,h=0;i.state=!0;wv(n,t.text,s.mode,i,function(n,t){for(var r,f,i=e;h<n;)r=u[e],n<r&&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 av(n,t,i){if(!t.styles||t.styles[0]!=n.state.modeGen){var r=gf(n,c(t)),u=t.text.length>n.options.maxHighlightLength&&cr(n.doc.mode,r.state),f=lv(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 gf(n,i,r){var u=n.doc,o=n.display;if(!u.mode.startState)return new kt(u,!0,i);var e=function(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;l<u;--u){if(u<=f.first)return f.first;if(s=t(f,u-1),e=s.stateAfter,e&&(!r||u+(e instanceof df?e.lookAhead:0)<=f.modeFrontier))return u;h=vt(s.text,null,n.options.tabSize);(null==o||h<c)&&(o=u-1,c=h)}return o}(n,i,r),s=e>u.first&&t(u,e-1).stateAfter,f=s?kt.fromSaved(u,s,e):new kt(u,cv(u.mode),e);return u.iter(e,i,function(t){uc(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 uc(n,t,i,r){var f=n.doc.mode,u=new y(t,n.options.tabSize,i);for(u.start=u.pos=r||0,""==t&&vv(f,i.state);!u.eol();)fc(f,u,i.state),u.start=u.pos}function vv(n,t){if(n.blankLine)return n.blankLine(t);if(n.innerMode){var i=rc(n,t);return i.mode.blankLine?i.mode.blankLine(i.state):void 0}}function fc(n,t,i,r){for(var f,u=0;u<10;u++)if(r&&(r[0]=rc(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 yv(n,i,r,u){var h,c,o=n.doc,l=o.mode,a=t(o,(i=f(o,i)).line),s=gf(n,i.line,r),e=new y(a.text,n.options.tabSize,s);for(u&&(c=[]);(u||e.pos<i.ch)&&!e.eol();)e.start=e.pos,h=fc(l,e,s.state),u&&c.push(new ec(e,h,cr(o.mode,s.state)));return u?c:new ec(e,h,s.state)}function pv(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";null==t[r]?t[r]=i[2]:new RegExp("(?:^|s)"+i[2]+"(?:$|s)").test(t[r])||(t[r]+=" "+i[2])}return n}function wv(n,t,i,r,u,f,e){var c=i.flattenSpans,a,p;null==c&&(c=n.options.flattenSpans);var s,h=0,l=null,o=new y(t,n.options.tabSize,r),v=n.options.addModeClass&&[null];for(""==t&&pv(vv(i,r.state),f);!o.eol();){if((s=o.pos>n.options.maxHighlightLength?(c=!1,e&&uc(n,t,r,o.pos),o.pos=t.length,null):pv(fc(i,o,r.state,v),f),v)&&(a=v[0].name,a&&(s="m-"+(s?a+" "+s:a))),!c||l!=s){for(;h<o.start;)u(h=Math.min(o.start,h+5e3),l);l=s}o.start=o.pos}for(;h<o.pos;)p=Math.min(o.pos,h+5e3),u(p,l),h=p}function dv(n,t){if(!n||/^\s*$/.test(n))return null;var i=t.addModeClass?kv:bv;return i[n]||(i[n]=n.replace(/\S+/g,"cm-$&"))}function gv(n,t){var o=iu("span",null,null,rt?"padding-right: .1px":null),i={pre:iu("pre",[o],"CodeMirror-line"),content:o,col:0,pos:0,cm:n,trailingSpace:!1,splitSpaces:n.getOption("lineWrapping")},u,r,e,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=dk,yk(n.display.measure)&&(e=ci(r,n.doc.direction))&&(i.addToken=gk(i.addToken,e)),i.map=[],nd(r,i,av(n,r,t!=n.display.externalMeasured&&c(r))),r.styleClasses&&(r.styleClasses.bgClass&&(i.bgClass=bs(r.styleClasses.bgClass,i.bgClass||"")),r.styleClasses.textClass&&(i.textClass=bs(r.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(vk(n.display.measure))),0==u?(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 rt&&(f=i.content.lastChild,(/\bcm-tab\b/.test(f.className)||f.querySelector&&f.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")),w(n,"renderLine",n,t.line,i.pre),i.pre.className&&(i.textClass=bs(i.pre.className,i.textClass||"")),i}function kk(n){var t=i("span","•","cm-invalidchar");return t.title="\\u"+n.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function dk(n,t,r,u,f,e,s){var v,c,y,w,l,g,nt,b,tt,p;if(t){var h,k=n.splitSpaces?function(n,t){var r;if(1<n.length&&!/  /.test(n))return n;for(var u=t,f="",i=0;i<n.length;i++)r=n.charAt(i)," "==r&&u&&(i==n.length-1||32==n.charCodeAt(i+1))&&(r=" "),f+=r,u=" "==r;return f}(t,n.trailingSpace):t,d=n.cm.state.specialChars,it=!1;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)),o&&a<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;l=void 0;"\t"==c[0]?(g=n.cm.options.tabSize,nt=g-n.col%g,(l=h.appendChild(i("span",nh(nt),"cm-tab"))).setAttribute("role","presentation"),l.setAttribute("cm-text","\t"),n.col+=nt):("\r"==c[0]||"\n"==c[0]?(l=h.appendChild(i("span","\r"==c[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",c[0]):((l=n.cm.options.specialCharPlaceholder(c[0])).setAttribute("cm-text",c[0]),o&&a<9?h.appendChild(i("span",[l])):h.appendChild(l)),n.col+=1);n.map.push(n.pos,n.pos+1,l);n.pos++}else n.col+=t.length,h=document.createTextNode(k),n.map.push(n.pos,n.pos+t.length,h),o&&a<9&&(it=!0),n.pos+=t.length;if(n.trailingSpace=32==k.charCodeAt(t.length-1),r||u||f||it||e){if(b=r||"",u&&(b+=u),f&&(b+=f),tt=i("span",[h],b,e),s)for(p in s)s.hasOwnProperty(p)&&"style"!=p&&"class"!=p&&tt.setAttribute(p,s[p]);return n.content.appendChild(tt)}n.content.appendChild(h)}}function gk(n,t){return function(i,r,u,f,e,o,s){var h,a,c,l;for(u=u?u+" cm-force-border":"cm-force-border",h=i.pos,a=h+r.length;;){for(c=void 0,l=0;l<t.length&&!((c=t[l]).to>h&&c.from<=h);l++);if(c.to>=a)return n(i,r,u,f,e,o,s);n(i,r.slice(0,c.to-h),u,f,null,o,s);f=null;r=r.slice(c.to-h);h=c.to}}}function ny(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 nd(n,t,i){var nt=n.markedSpans,tt=n.text,p=0,f,u,et,v,d,l,g,ot,y;if(nt)for(var it,a,w,b,k,e,h,rt=tt.length,r=0,st=1,s="",o=0;;){if(o==r){w=b=k=a="";e=h=null;o=1/0;for(var ut=[],c=void 0,ft=0;ft<nt.length;++ft)if(f=nt[ft],u=f.marker,"bookmark"==u.type&&f.from==r&&u.widgetNode)ut.push(u);else if(f.from<=r&&(null==f.to||f.to>r||u.collapsed&&f.to==r&&f.from==r)){if(null!=f.to&&f.to!=r&&o>f.to&&(o=f.to,b=""),u.className&&(w+=" "+u.className),u.css&&(a=(a?a+";":"")+u.css),u.startStyle&&f.from==r&&(k+=" "+u.startStyle),u.endStyle&&f.to==o&&(c||(c=[])).push(u.endStyle,f.to),u.title&&((h||(h={})).title=u.title),u.attributes)for(et in u.attributes)(h||(h={}))[et]=u.attributes[et];u.collapsed&&(!e||hh(e.marker,u)<0)&&(e=f)}else f.from>r&&o>f.from&&(o=f.from);if(c)for(v=0;v<c.length;v+=2)c[v+1]==o&&(b+=" "+c[v]);if(!e||e.from==r)for(d=0;d<ut.length;++d)ny(t,0,ut[d]);if(e&&(e.from||0)==r){if(ny(t,(null==e.to?rt+1:e.to)-r,e.marker,null==e.from),null==e.to)return;e.to==r&&(e=!1)}}if(rt<=r)break;for(l=Math.min(rt,o);;){if(s){if(g=r+s.length,e||(ot=l<g?s.slice(0,l-r):s,t.addToken(t,ot,it?it+w:w,k,r+ot.length==o?b:"",a,h)),l<=g){s=s.slice(l-r);r=l;break}r=g;k=""}s=tt.slice(p,p=i[st++]);it=dv(i[st++],t.cm.options)}}else for(y=1;y<i.length;y+=2)t.addToken(t,tt.slice(p,p=i[y]),dv(i[y+1],t.cm.options))}function ty(n,t,i){this.line=t;this.rest=function(n){for(var i,t;i=vo(n);)n=i.find(1,!0).line,(t||(t=[])).push(n);return t}(t);this.size=this.rest?c(h(this.rest))-i+1:1;this.node=this.text=null;this.hidden=di(n,t)}function wo(n,i,r){for(var o,e,f=[],u=i;u<r;u=o)e=new ty(n.doc,t(n.doc,u),u),o=u+e.size,f.push(e);return f}function nt(n,t){var u=yh(n,t),i,f,e,r;if(u.length)for(f=Array.prototype.slice.call(arguments,2),ar?i=ar.delayedCallbacks:ou?i=ou:(i=ou=[],setTimeout(td,0)),e=function(n){i.push(function(){return u[n].apply(null,f)})},r=0;r<u.length;++r)e(r)}function td(){var t=ou,n;for(ou=null,n=0;n<t.length;++n)t[n]()}function iy(n,t,i,r){for(var u,f=0;f<t.changes.length;f++)u=t.changes[f],"text"==u?id(n,t):"gutter"==u?uy(n,t,i,r):"class"==u?oc(n,t):"widget"==u&&rd(n,t,r);t.changes=null}function ne(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),o&&a<8&&(n.node.style.zIndex=2)),n.node}function ry(n,t){var i=n.display.externalMeasured;return i&&i.line==t.line?(n.display.externalMeasured=null,t.measure=i.measure,i.built):gv(n,t)}function id(n,t){var r=t.text.className,i=ry(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,oc(n,t)):r&&(t.text.className=r)}function oc(n,t){!function(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=ne(t),t.background=u.insertBefore(i("div",null,r),u.firstChild),n.display.input.setUneditable(t.background))}(n,t);t.line.wrapClass?ne(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function uy(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=ne(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=ne(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",uh(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 rd(n,t,i){t.alignable&&(t.alignable=null);for(var r=t.node.firstChild,u=void 0;r;r=u)u=r.nextSibling,"CodeMirror-linewidget"==r.className&&t.node.removeChild(r);fy(n,t,i)}function fy(n,t,i){if(ey(n,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)ey(n,t.rest[r],t,i,!1)}function ey(n,t,r,u,f){var e,o;if(t.widgets)for(var h=ne(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"),ud(e,o,r,u),n.display.input.setUneditable(o),f&&e.above?h.insertBefore(o,r.gutter||r.text):h.appendChild(o),nt(e,"redraw")}function ud(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 te(n){var t,r;return null!=n.height?n.height:(t=n.doc.cm,!t)?0:(bi(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;"),lt(t.display.measure,i("div",[n.node],null,r))),n.height=n.node.parentNode.offsetHeight)}function li(n,t){for(var i=wh(t);i!=n.wrapper;i=i.parentNode)if(!i||1==i.nodeType&&"true"==i.getAttribute("cm-ignore-events")||i.parentNode==n.sizer&&i!=n.mover)return!0}function bo(n){return n.lineSpace.offsetTop}function sc(n){return n.mover.offsetHeight-n.lineSpace.offsetHeight}function oy(n){if(n.cachedPaddingH)return n.cachedPaddingH;var r=lt(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 fi(n){return ca-n.display.nativeBarWidth}function vr(n){return n.display.scroller.clientWidth-fi(n)-n.display.barWidth}function hc(n){return n.display.scroller.clientHeight-fi(n)-n.display.barHeight}function sy(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(c(n.rest[u])>i)return{map:n.measure.maps[u],cache:n.measure.caches[u],before:!0}}function hy(n,t,i,r){return ei(n,su(n,t),i,r)}function cc(n,t){if(t>=n.display.viewFrom&&t<n.display.viewTo)return n.display.view[wr(n,t)];var i=n.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function su(n,t){var u=c(t),i=cc(n,u),r;return i&&!i.text?i=null:i&&i.changes&&(iy(n,i,u,bc(n)),n.curOp.forceUpdate=!0),i||(i=function(n,t){var u=c(t=ui(t)),i=n.display.externalMeasured=new ty(n.doc,t,u),r;return i.lineN=u,r=i.built=gv(n,i),i.text=r.pre,lt(n.display.lineMeasure,r.pre),i}(n,t)),r=sy(i,t,u),{line:t,view:i,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function ei(n,t,r,u,f){t.before&&(r=-1);var e,s=r+(u||"");return t.cache.hasOwnProperty(s)?e=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(!function(n,t,i){var f=n.options.lineWrapping,h=f&&vr(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],2<Math.abs(o.bottom-s.bottom)&&e.push((o.bottom+s.top)/2-i.top);e.push(i.bottom-i.top)}}(n,t.view,t.rect),t.hasHeights=!0),(e=function(n,t,r,u){var f,e=cy(t.map,r,u),h=e.node,s=e.start,c=e.end,y=e.collapse,b,k,l;if(3==h.nodeType){for(b=0;b<4;b++){for(;s&&ih(t.line.text.charAt(e.coverStart+s));)--s;for(;e.coverStart+c<e.coverEnd&&ih(t.line.text.charAt(e.coverStart+c));)++c;if((f=o&&a<9&&0==s&&c==e.coverEnd-e.coverStart?h.parentNode.getBoundingClientRect():fd(tu(h,s,c).getClientRects(),u)).left||f.right||0==s)break;c=s;s-=1;y="right"}o&&a<11&&(f=function(n,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(n){if(null!=nc)return nc;var t=lt(n,i("span","x")),r=t.getBoundingClientRect(),u=tu(t,0,1).getBoundingClientRect();return nc=1<Math.abs(r.left-u.left)}(n))return t;var r=screen.logicalXDPI/screen.deviceXDPI,u=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*u,bottom:t.bottom*u}}(n.display.measure,f))}else 0<s&&(y=u="right"),f=n.options.lineWrapping&&1<(k=h.getClientRects()).length?k["right"==u?k.length-1:0]:h.getBoundingClientRect();o&&a<9&&!s&&(!f||!f.left&&!f.right)&&(l=h.parentNode.getClientRects()[0],f=l?{left:l.left,right:l.left+cu(n.display),top:l.top,bottom:l.bottom}:lc);for(var d=f.top-t.rect.top,g=f.bottom-t.rect.top,nt=(d+g)/2,p=t.view.measure.heights,v=0;v<p.length-1&&!(nt<p[v]);v++);var tt=v?p[v-1]:0,it=p[v],w={left:("right"==y?f.right:f.left)-t.rect.left,right:("left"==y?f.left:f.right)-t.rect.left,top:tt,bottom:it};return f.left||f.right||(w.bogus=!0),n.options.singleCursorHeightPerLine||(w.rtop=d,w.rbottom=g),w}(n,t,r,u)).bogus||(t.cache[s]=e)),{left:e.left,right:e.right,top:f?e.rtop:e.top,bottom:f?e.rbottom:e.bottom}}function cy(n,t,i){for(var s,f,h,o,e,u,r=0;r<n.length;r+=3)if(e=n[r],u=n[r+1],t<e?(f=0,h=1,o="left"):t<u?h=(f=t-e)+1:(r==n.length-3||t==u&&n[r+3]>t)&&(f=(h=u-e)-1,u<=t&&(o="right")),null!=f){if(s=n[r+2],e==u&&i==(s.insertLeft?"left":"right")&&(o=i),"left"==i&&0==f)for(;r&&n[r-2]==n[r-3]&&n[r-1].insertLeft;)s=n[2+(r-=3)],o="left";if("right"==i&&f==u-e)for(;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:f,end:h,collapse:o,coverStart:e,coverEnd:u}}function fd(n,t){var i=lc,r,u;if("left"==t)for(r=0;r<n.length&&(i=n[r]).left==i.right;r++);else for(u=n.length-1;0<=u&&(i=n[u]).left==i.right;u--);return i}function ly(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 ay(n){n.display.externalMeasure=null;wi(n.display.lineMeasure);for(var t=0;t<n.display.view.length;t++)ly(n.display.view[t])}function ie(n){ay(n);n.display.cachedCharWidth=n.display.cachedTextHeight=n.display.cachedPaddingH=null;n.options.lineWrapping||(n.display.maxLineChanged=!0);n.display.lineNumChars=null}function vy(){return io&&ro?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function yy(){return io&&ro?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ac(n){var i=0,t;if(n.widgets)for(t=0;t<n.widgets.length;++t)n.widgets[t].above&&(i+=te(n.widgets[t]));return i}function ko(n,t,i,r,u){var e,f,o,s;return(u||(e=ac(t),i.top+=e,i.bottom+=e),"line"==r)?i:(r||(r="local"),f=hi(t),("local"==r?f+=bo(n.display):f-=n.display.viewOffset,"page"==r||"window"==r)&&(o=n.display.lineSpace.getBoundingClientRect(),f+=o.top+("window"==r?0:yy()),s=o.left+("window"==r?0:vy()),i.left+=s,i.right+=s),i.top+=f,i.bottom+=f,i)}function py(n,t,i){var r,u,f,e;return"div"==i?t:(r=t.left,u=t.top,"page"==i?(r-=vy(),u-=yy()):"local"!=i&&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 vc(n,i,r,u,f){return u||(u=t(n.doc,i.line)),ko(n,u,hy(n,u,i.ch,f),r)}function dt(n,i,r,u,f,e){function c(t,i){var o=ei(n,f,t,i?"right":"left",e);return i?o.left=o.right:o.right=o.left,ko(n,u,o,r)}function l(n,t,i){return c(i?n-1:n,1==h[t].level!=i)}u=u||t(n.doc,i.line);f||(f=su(n,u));var h=ci(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("before"==s?o-1:o,"before"==s);var y=bf(h,o,s),a=uu,v=l(o,y,"before"==s);return null!=a&&(v.other=l(o,a,"before"!=s)),v}function wy(n,i){var r=0,u,e;return i=f(n.doc,i),n.options.lineWrapping||(r=cu(n.display)*i.ch),u=t(n.doc,i.line),e=hi(u)+bo(n.display),{left:r,right:r,top:e,bottom:e+u.height}}function yc(t,i,r,u,f){var e=n(t,i,r);return e.xRel=f,u&&(e.outside=!0),e}function pc(n,i,r){var u=n.doc,f,h,e,o,c,s;if((r+=n.display.viewOffset)<0)return yc(u.first,0,null,!0,-1);if(f=sr(u,r),h=u.first+u.size-1,h<f)return yc(u.first+u.size-1,t(u,h).text.length,null,!0,1);for(i<0&&(i=0),e=t(u,f);;){if(o=ed(n,e,f,i,r),c=ak(e,o.ch+(0<o.xRel?1:0)),!c)return o;if(s=c.find(1),s.line==f)return s;e=t(u,f=s.line)}}function by(n,t,i,r){r-=ac(t);var u=t.text.length,f=yf(function(t){return ei(n,i,t-1).bottom<=r},u,0);return{begin:f,end:u=yf(function(t){return ei(n,i,t).top>r},f,u)}}function ky(n,t,i,r){return i||(i=su(n,t)),by(n,t,i,ko(n,t,ei(n,i,r),"line").top)}function wc(n,t,i,r){return!(n.bottom<=i)&&(n.top>i||(r?n.left:n.right)>t)}function ed(t,i,r,u,f){var s,b,k,a;f-=hi(i);var c=su(t,i),v=ac(i),y=0,p=i.text.length,o=!0,d=ci(i,t.doc.direction);d&&(s=(t.options.lineWrapping?function(n,t,i,r,u,f,e){var v=by(n,t,r,e),c=v.begin,h=v.end,s;/\s/.test(t.text.charAt(h-1))&&h--;for(var o=null,y=null,l=0;l<u.length;l++)if(s=u[l],!(s.from>=h||s.to<=c)){var w=1!=s.level,a=ei(n,r,w?Math.min(h,s.to)-1:Math.max(c,s.from)).right,p=a<f?f-a+1e9:a-f;(!o||p<y)&&(o=s,y=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(t,i,r,u,f,e,o){var h=yf(function(s){var h=f[s],c=1!=h.level;return wc(dt(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 0<h&&(c=1!=s.level,l=dt(t,n(r,c?s.from:s.to,c?"after":"before"),"line",i,u),wc(l,e,o,!0)&&l.top>o&&(s=f[h-1])),s})(t,i,r,c,d,u,f),y=(o=1!=s.level)?s.from:s.to-1,p=o?s.to:s.from-1);var w,l,g=null,h=null,e=yf(function(n){var i=ei(t,c,n);return i.top+=v,i.bottom+=v,!!wc(i,u,f,!1)&&(i.top<=f&&i.left<=u&&(g=n,h=i),!0)},y,p),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=0==e?"after":e==i.text.length?"before":ei(t,c,e-(o?1:0)).bottom+v<=f==o?"after":"before",a=dt(t,n(r,e,l),"line",i,c),w=a.left,nt=f<a.top||f>=a.bottom),yc(r,e=wa(i.text,e,1),l,nt,u-w)}function hu(n){var r,t;if(null!=n.cachedTextHeight)return n.cachedTextHeight;if(null==yr){for(yr=i("pre"),r=0;r<49;++r)yr.appendChild(document.createTextNode("x")),yr.appendChild(i("br"));yr.appendChild(document.createTextNode("x"))}return lt(n.measure,yr),t=yr.offsetHeight/50,3<t&&(n.cachedTextHeight=t),wi(n.measure),t||1}function cu(n){var r,f,u,t;return null!=n.cachedCharWidth?n.cachedCharWidth:(r=i("span","xxxxxxxxxx"),f=i("pre",[r]),lt(n.measure,f),u=r.getBoundingClientRect(),t=(u.right-u.left)/10,2<t&&(n.cachedCharWidth=t),t||10)}function bc(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:kc(i),gutterTotalWidth:i.gutters.offsetWidth,gutterLeft:u,gutterWidth:f,wrapperWidth:i.wrapper.clientWidth}}function kc(n){return n.scroller.getBoundingClientRect().left-n.sizer.getBoundingClientRect().left}function dy(n){var t=hu(n.display),i=n.options.lineWrapping,r=i&&Math.max(5,n.display.scroller.clientWidth/cu(n.display)-3);return function(u){var e,f;if(di(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 dc(n){var t=n.doc,i=dy(n);t.iter(function(n){var t=i(n);t!=n.height&&ii(n,t)})}function pr(i,r,u,f){var a=i.display,s,c,h,o,e,l;if(!u&&"true"==wh(r).getAttribute("cm-not-content"))return null;h=a.lineSpace.getBoundingClientRect();try{s=r.clientX-h.left;c=r.clientY-h.top}catch(r){return null}return e=pc(i,s,c),f&&1==e.xRel&&(o=t(i.doc,e.line).text).length==e.ch&&(l=vt(o,o.length,i.options.tabSize)-o.length,e=n(e.line,Math.max(0,Math.round((s-oy(i.display).left)/cu(i.display))-l))),e}function wr(n,t){if(t>=n.display.viewTo||(t-=n.display.viewFrom)<0)return null;for(var r=n.display.view,i=0;i<r.length;i++)if((t-=r[i].size)<0)return i}function re(n){n.display.input.showSelection(n.display.input.prepareSelection())}function gy(n,t){var i,e;void 0===t&&(t=!0);for(var u=n.doc,f={},o=f.cursors=document.createDocumentFragment(),s=f.selection=document.createDocumentFragment(),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)&&np(n,i.head,o),e||od(n,i,s)));return f}function np(n,t,r){var u=dt(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=.85*(u.other.bottom-u.other.top)+"px")}function go(n,t){return n.top-t.top||n.left-t.left}function od(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: "+(null==r?l-n:r)+"px;\n                             height: "+(u-t)+"px"))}function p(i,u,f){function p(t,u){return vc(r,n(i,t),"div",a,u)}function y(n,t,i){var u=ky(r,a,null,n),f="ltr"==t==("after"==i)?"left":"right";return p("after"==i?u.begin:u.end-(/\s/.test(a.text.charAt(u.end-1))?2:1),f)[f]}var o,c,a=t(v,i),b=a.text.length,w=ci(a,v.direction);return function(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),1==u.level?"rtl":"ltr",f),e=!0);e||r(t,i,"ltr")}(w,u||0,null==f?b:f,function(n,t,i,r){var k="ltr"==i,a=p(n,k?"left":"right"),v=p(t-1,k?"right":"left"),d=null==u&&0==n,g=null==f&&t==b,it=0==r,rt=!w||r==w.length-1,nt,ut,tt,et;if(v.top-a.top<=3){var ot=(e?g:d)&&rt,ft=(e?d:g)&&it?s:(k?a:v).left,st=ot?l:(k?v:a).right;h(ft,a.top,st-ft,a.bottom)}else et=k?(nt=e&&d&&it?s:a.left,ut=e?l:y(n,i,"before"),tt=e?s:y(t,i,"after"),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,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,et-tt,v.bottom);(!o||go(a,o)<0)&&(o=a);go(v,o)<0&&(o=v);(!c||go(a,c)<0)&&(c=a);go(v,c)<0&&(c=v)}),{start:o,end:c}}var b=r.display,v=r.doc,k=document.createDocumentFragment(),d=oy(r.display),s=d.left,l=Math.max(b.sizerWidth,vr(r)-b.sizer.offsetLeft)-d.right,e="ltr"==v.direction,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=ui(g)==ui(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 gc(n){var t,i;n.state.focused&&(t=n.display,clearInterval(t.blinker),i=!0,t.cursorDiv.style.visibility="",0<n.options.cursorBlinkRate?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 tp(n){n.state.focused||(n.display.input.focus(),nl(n))}function ip(n){n.state.delayingBlurEvent=!0;setTimeout(function(){n.state.delayingBlurEvent&&(n.state.delayingBlurEvent=!1,ue(n))},100)}function nl(n,t){n.state.delayingBlurEvent&&(n.state.delayingBlurEvent=!1);"nocursor"!=n.options.readOnly&&(n.state.focused||(w(n,"focus",n,t),n.state.focused=!0,fr(n.display.wrapper,"CodeMirror-focused"),n.curOp||n.display.selForContextMenu==n.doc.sel||(n.display.input.reset(),rt&&setTimeout(function(){return n.display.input.reset(!0)},20)),n.display.input.receivedFocus()),gc(n))}function ue(n,t){n.state.delayingBlurEvent||(n.state.focused&&(w(n,"blur",n,t),n.state.focused=!1,pi(n.display.wrapper,"CodeMirror-focused")),clearInterval(n.display.blinker),setTimeout(function(){n.state.focused||(n.display.shift=!1)},150))}function ns(n){for(var h,r,c,u,l,f=n.display,v=f.lineDiv.offsetTop,e=0;e<f.view.length;e++){var t=f.view[e],y=n.options.lineWrapping,i=void 0,s=0;if(!t.hidden){if(o&&a<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,(.005<c||c<-.005)&&(ii(t.line,i),rp(t.line),t.rest))for(u=0;u<t.rest.length;u++)rp(t.rest[u]);s>n.display.sizerWidth&&(l=Math.ceil(s/cu(n.display)),l>n.display.maxLineLength&&(n.display.maxLineLength=l,n.display.maxLine=t.line,n.display.maxLineChanged=!0))}}}function rp(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 tl(n,i,r){var f=r&&null!=r.top?Math.max(0,r.top):n.scroller.scrollTop,s,o;f=Math.floor(f-bo(n));var h=r&&null!=r.bottom?r.bottom:f+n.wrapper.clientHeight,u=sr(i,f),e=sr(i,h);return r&&r.ensure&&(s=r.ensure.from.line,o=r.ensure.to.line,s<u?e=sr(i,hi(t(i,u=s))+n.wrapper.clientHeight):Math.min(o,i.lastLine())>=e&&(u=sr(i,hi(t(i,o))-n.wrapper.clientHeight),e=o)),{from:u,to:Math.max(e,u+1)}}function up(n){var i=n.display,r=i.view,u,f;if(i.alignWidgets||i.gutters.firstChild&&n.options.fixedGutter){for(var o=kc(i)-i.scroller.scrollLeft+n.doc.scrollLeft,s=i.gutters.offsetWidth,e=o+"px",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 fp(n){if(!n.options.lineNumbers)return!1;var u=n.doc,r=uh(n.options,u.first+u.size-1),t=n.display;if(r.length==t.lineNumChars)return!1;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",ol(n),!0}function il(n,t){var r=n.display,h=hu(n.display),o;t.top<0&&(t.top=0);var e=n.curOp&&null!=n.curOp.scrollTop?n.curOp.scrollTop:r.scroller.scrollTop,u=hc(n),i={};t.bottom-t.top>u&&(t.bottom=t.top+u);var c=n.doc.height+sc(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&&null!=n.curOp.scrollLeft?n.curOp.scrollLeft:r.scroller.scrollLeft,f=vr(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 rl(n,t){null!=t&&(ts(n),n.curOp.scrollTop=(null==n.curOp.scrollTop?n.doc.scrollTop:n.curOp.scrollTop)+t)}function lu(n){ts(n);var t=n.getCursor();n.curOp.scrollToPos={from:t,to:t,margin:n.options.cursorScrollMargin}}function fe(n,t,i){null==t&&null==i||ts(n);null!=t&&(n.curOp.scrollLeft=t);null!=i&&(n.curOp.scrollTop=i)}function ts(n){var t=n.curOp.scrollToPos;t&&(n.curOp.scrollToPos=null,ep(n,wy(n,t.from),wy(n,t.to),t.margin))}function ep(n,t,i,r){var u=il(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});fe(n,u.scrollLeft,u.scrollTop)}function ee(n,t){Math.abs(n.doc.scrollTop-t)<2||(yi||el(n,{top:t}),op(n,t,!0),yi&&el(n),se(n,100))}function op(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 br(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,up(n),n.display.scroller.scrollLeft!=t&&(n.display.scroller.scrollLeft=t),n.display.scrollbars.setScrollLeft(t))}function oe(n){var t=n.display,i=t.gutters.offsetWidth,r=Math.round(n.doc.height+sc(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+fi(n)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}function vu(n,t){var i,r,u;for(t||(t=oe(n)),i=n.display.barWidth,r=n.display.barHeight,sp(n,t),u=0;u<4&&i!=n.display.barWidth||r!=n.display.barHeight;u++)i!=n.display.barWidth&&n.options.lineWrapping&&ns(n),sp(n,oe(n)),i=n.display.barWidth,r=n.display.barHeight}function sp(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 hp(n){n.display.scrollbars&&(n.display.scrollbars.clear(),n.display.scrollbars.addClass&&pi(n.display.wrapper,n.display.scrollbars.addClass));n.display.scrollbars=new ul[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){"horizontal"==i?br(n,t):ee(n,t)},n);n.display.scrollbars.addClass&&fr(n.display.wrapper,n.display.scrollbars.addClass)}function kr(n){var t;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:++cp};t=n.curOp;ar?ar.ops.push(t):t.ownsGroup=ar={ops:[t],delayedCallbacks:[]}}function dr(n){var t=n.curOp;t&&function(n,t){var i=n.ownsGroup;if(i)try{!function(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)for(;t.cursorActivityCalled<t.cursorActivityHandlers.length;)t.cursorActivityHandlers[t.cursorActivityCalled++].call(null,t.cm)}while(i<u.length)}(i)}finally{ar=null;t(i)}}(t,function(n){for(var t=0;t<n.ops.length;t++)n.ops[t].cm.curOp=null;!function(n){for(var r,u,f,e,o,t=n.ops,i=0;i<t.length;i++)sd(t[i]);for(r=0;r<t.length;r++)(u=t[r]).updatedDisplay=u.mustUpdate&&fl(u.cm,u.update);for(f=0;f<t.length;f++)hd(t[f]);for(e=0;e<t.length;e++)cd(t[e]);for(o=0;o<t.length;o++)ld(t[o])}(n)})}function sd(n){var r,t,i=n.cm,u=i.display;!(t=(r=i).display).scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=fi(r)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=fi(r)+"px",t.scrollbarsClipped=!0);n.updateMaxLine&&ah(i);n.mustUpdate=n.viewChanged||n.forceUpdate||null!=n.scrollTop||n.scrollToPos&&(n.scrollToPos.from.line<u.viewFrom||n.scrollToPos.to.line>=u.viewTo)||u.maxLineChanged&&i.options.lineWrapping;n.update=n.mustUpdate&&new he(i,n.mustUpdate&&{top:n.scrollTop,ensure:n.scrollToPos},n.forceUpdate)}function hd(n){var t=n.cm,i=t.display;n.updatedDisplay&&ns(t);n.barMeasure=oe(t);i.maxLineChanged&&!t.options.lineWrapping&&(n.adjustWidthTo=hy(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+fi(t)+t.display.barWidth),n.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+n.adjustWidthTo-vr(t)));(n.updatedDisplay||n.selectionChanged)&&(n.preparedSelection=i.input.prepareSelection())}function cd(n){var t=n.cm,i;null!=n.adjustWidthTo&&(t.display.sizer.style.minWidth=n.adjustWidthTo+"px",n.maxScrollLeft<t.doc.scrollLeft&&br(t,Math.min(t.display.scroller.scrollLeft,n.maxScrollLeft),!0),t.display.maxLineChanged=!1);i=n.focus&&n.focus==si();n.preparedSelection&&t.display.input.showSelection(n.preparedSelection,i);(n.updatedDisplay||n.startHeight!=t.doc.height)&&vu(t,n.barMeasure);n.updatedDisplay&&sl(t,n.barMeasure);n.selectionChanged&&gc(t);t.state.focused&&n.updateInput&&t.display.input.reset(n.typing);i&&tp(n.cm)}function ld(t){var r=t.cm,h=r.display,c=r.doc,u,e,o,s;if((t.updatedDisplay&&ap(r,t.update),null==h.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(h.wheelStartX=h.wheelStartY=null),null!=t.scrollTop&&op(r,t.scrollTop,t.forceScroll),null!=t.scrollLeft&&br(r,t.scrollLeft,!0,!0),t.scrollToPos)&&function(n,t){var u;if(!b(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),null==r||ok)||(u=i("div","​",null,"position: absolute;\n                         top: "+(t.top-f.viewOffset-bo(n.display))+"px;\n                         height: "+(t.bottom-t.top+fi(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))}}(r,function(t,i,r,u){var c,s;for(null==u&&(u=0),t.options.lineWrapping||i!=r||(r="before"==(i=i.ch?n(i.line,"before"==i.sticky?i.ch-1:i.ch,"after"):i).sticky?n(i.line,i.ch+1,"before"):i),s=0;s<5;s++){var h=!1,f=dt(t,i),e=r&&r!=i?dt(t,r):f,o=il(t,c={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}),l=t.doc.scrollTop,a=t.doc.scrollLeft;if(null!=o.scrollTop&&(ee(t,o.scrollTop),1<Math.abs(t.doc.scrollTop-l)&&(h=!0)),null!=o.scrollLeft&&(br(t,o.scrollLeft),1<Math.abs(t.doc.scrollLeft-a)&&(h=!0)),!h)break}return c}(r,f(c,t.scrollToPos.from),f(c,t.scrollToPos.to),t.scrollToPos.margin)),u=t.maybeHiddenMarkers,e=t.maybeUnhiddenMarkers,u)for(o=0;o<u.length;++o)u[o].lines.length||w(u[o],"hide");if(e)for(s=0;s<e.length;++s)e[s].lines.length&&w(e[s],"unhide");h.wrapper.offsetHeight&&(c.scrollTop=r.display.scroller.scrollTop);t.changeObjs&&w(r,"changes",r,t.changeObjs);t.update&&t.update.finish()}function st(n,t){if(n.curOp)return t();kr(n);try{return t()}finally{dr(n)}}function k(n,t){return function(){if(n.curOp)return t.apply(n,arguments);kr(n);try{return t.apply(n,arguments)}finally{dr(n)}}}function ut(n){return function(){if(this.curOp)return n.apply(this,arguments);kr(this);try{return n.apply(this,arguments)}finally{dr(this)}}}function d(n){return function(){var t=this.cm;if(!t||t.curOp)return n.apply(this,arguments);kr(t);try{return n.apply(this,arguments)}finally{dr(t)}}}function ot(n,t,i,r){var u,e,o,s,h,f;null==t&&(t=n.doc.first);null==i&&(i=n.doc.first+n.doc.size);r||(r=0);u=n.display;(r&&i<u.viewTo&&(null==u.updateLineNumbers||u.updateLineNumbers>t)&&(u.updateLineNumbers=t),n.curOp.viewChanged=!0,t>=u.viewTo)?ri&&ch(n.doc,t)<u.viewTo&&tr(n):i<=u.viewFrom?ri&&uv(n.doc,i+r)>u.viewFrom?tr(n):(u.viewFrom+=r,u.viewTo+=r):t<=u.viewFrom&&i>=u.viewTo?tr(n):t<=u.viewFrom?(e=is(n,i,i+r,1),e?(u.view=u.view.slice(e.index),u.viewFrom=e.lineN,u.viewTo+=r):tr(n)):i>=u.viewTo?(o=is(n,t,t,-1),o?(u.view=u.view.slice(0,o.index),u.viewTo=o.lineN):tr(n)):(s=is(n,t,t,-1),h=is(n,i,i+r,1),s&&h?(u.view=u.view.slice(0,s.index).concat(wo(n,s.lineN,h.lineN)).concat(u.view.slice(h.index)),u.viewTo+=r):tr(n));f=u.externalMeasured;f&&(i<f.lineN?f.lineN+=r:t<f.lineN+f.size&&(u.externalMeasured=null))}function nr(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[wr(n,t)],null!=f.node&&(e=f.changes||(f.changes=[]),-1==g(e,i)&&e.push(i)))}function tr(n){n.display.viewFrom=n.display.viewTo=n.doc.first;n.display.view=[];n.display.viewOffset=0}function is(n,t,i,r){var o,u=wr(n,t),f=n.display.view,e,s;if(!ri||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(0<r){if(u==f.length-1)return null;o=e+f[u].size-t;u++}else o=e-t;t+=o;i+=o}for(;ch(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 lp(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 se(n,t){n.doc.highlightFrontier<n.display.viewTo&&n.state.highlight.set(t,ks(ad,n))}function ad(n){var i=n.doc;if(!(i.highlightFrontier>=n.display.viewTo)){var u=+new Date+n.options.workTime,t=gf(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?cr(i.mode,t.state):null,a=lv(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&&uc(n,f.text,t),f.stateAfter=t.line%5==0?t.save():null,t.nextLine();if(+new Date>u)return se(n,n.options.workDelay),!0});i.highlightFrontier=t.line;i.modeFrontier=Math.max(i.modeFrontier,t.line);r.length&&st(n,function(){for(var t=0;t<r.length;t++)nr(n,r[t],"text")})}}function fl(n,i){var r=n.display,c=n.doc,h,f,e,u,a,l,y;if(i.editorIsHidden)return tr(n),!1;if(!i.force&&i.visible.from>=r.viewFrom&&i.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==lp(n))return!1;fp(n)&&(tr(n),i.dims=bc(n));var v=c.first+c.size,o=Math.max(i.visible.from-n.options.viewportMargin,c.first),s=Math.min(v,i.visible.to+n.options.viewportMargin);return(r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(c.first,r.viewFrom)),r.viewTo>s&&r.viewTo-s<20&&(s=Math.min(v,r.viewTo)),ri&&(o=ch(n.doc,o),s=uv(n.doc,s)),a=o!=r.viewFrom||s!=r.viewTo||r.lastWrapHeight!=i.wrapperHeight||r.lastWrapWidth!=i.wrapperWidth,f=o,e=s,0==(u=(h=n).display).view.length||f>=u.viewTo||e<=u.viewFrom?(u.view=wo(h,f,e),u.viewFrom=f):(u.viewFrom>f?u.view=wo(h,f,u.viewFrom).concat(u.view):u.viewFrom<f&&(u.view=u.view.slice(wr(h,f))),u.viewFrom=f,u.viewTo<e?u.view=u.view.concat(wo(h,u.viewTo,e)):u.viewTo>e&&(u.view=u.view.slice(0,wr(h,e)))),u.viewTo=e,r.viewOffset=hi(t(n.doc,r.viewFrom)),n.display.mover.style.top=r.viewOffset+"px",l=lp(n),!a&&0==l&&!i.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))?!1:(y=function(n){var r,i,t;return n.hasFocus()?null:(r=si(),!r||!bi(n.display.lineDiv,r))?null:(i={activeElt:r},window.getSelection&&(t=window.getSelection(),t.anchorNode&&t.extend&&bi(n.display.lineDiv,t.anchorNode)&&(i.anchorNode=t.anchorNode,i.anchorOffset=t.anchorOffset,i.focusNode=t.focusNode,i.focusOffset=t.focusOffset)),i)}(n),4<l&&(r.lineDiv.style.display="none"),function(n,t,i){function y(t){var i=t.nextSibling;return rt&&bt&&n.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),i}for(var h=n.display,k=n.options.lineNumbers,c=h.lineDiv,f=c.firstChild,r,a,w,s,u,b,v,e,p=h.view,o=h.viewFrom,l=0;l<p.length;l++){if(r=p[l],!r.hidden)if(r.node&&r.node.parentNode==c){for(;f!=r.node;)f=y(f);a=k&&null!=t&&t<=o&&r.lineNumber;r.changes&&(-1<g(r.changes,"gutter")&&(a=!1),iy(n,r,o,i));a&&(wi(r.lineNumber),r.lineNumber.appendChild(document.createTextNode(uh(n.options,o))));f=r.node.nextSibling}else w=(b=o,v=i,void 0,e=ry(s=n,u=r),u.text=u.node=e.pre,e.bgClass&&(u.bgClass=e.bgClass),e.textClass&&(u.textClass=e.textClass),oc(s,u),uy(s,u,b,v),fy(s,u,v),u.node),c.insertBefore(w,f);o+=r.size}for(;f;)f=y(f)}(n,r.updateLineNumbers,i.dims),4<l&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(n){if(n&&n.activeElt&&n.activeElt!=si()&&(n.activeElt.focus(),n.anchorNode&&bi(document.body,n.anchorNode)&&bi(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)}}(y),wi(r.cursorDiv),wi(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,a&&(r.lastWrapHeight=i.wrapperHeight,r.lastWrapWidth=i.wrapperWidth,se(n,400)),!(r.updateLineNumbers=null))}function ap(n,t){for(var u,i=t.viewport,r=!0;(r&&n.options.lineWrapping&&t.oldDisplayWidth!=vr(n)||(i&&null!=i.top&&(i={top:Math.min(n.doc.height+sc(n.display)-hc(n),i.top)}),t.visible=tl(n.display,n.doc,i),!(t.visible.from>=n.display.viewFrom&&t.visible.to<=n.display.viewTo)))&&fl(n,t);r=!1)ns(n),u=oe(n),re(n),vu(n,u),sl(n,u),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 el(n,t){var i=new he(n,t),r;fl(n,i)&&(ns(n),ap(n,i),r=oe(n),re(n),vu(n,r),sl(n,r),i.finish())}function ol(n){var t=n.display.gutters.offsetWidth;n.display.sizer.style.marginLeft=t+"px"}function sl(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+fi(n)+"px"}function vp(n){var r=n.display.gutters,f=n.options.gutters,t,u,e;for(wi(r),t=0;t<f.length;++t)u=f[t],e=r.appendChild(i("div",null,"CodeMirror-gutter "+u)),"CodeMirror-linenumbers"==u&&((n.display.lineGutter=e).style.width=(n.display.lineNumWidth||1)+"px");r.style.display=t?"":"none";ol(n)}function hl(n){var t=g(n.gutters,"CodeMirror-linenumbers");-1==t&&n.lineNumbers?n.gutters=n.gutters.concat(["CodeMirror-linenumbers"]):-1<t&&!n.lineNumbers&&(n.gutters=n.gutters.slice(0),n.gutters.splice(t,1))}function yp(n){var i=n.wheelDeltaX,t=n.wheelDeltaY;return null==i&&n.detail&&n.axis==n.HORIZONTAL_AXIS&&(i=n.detail),null==t&&n.detail&&n.axis==n.VERTICAL_AXIS?t=n.detail:null==t&&(t=n.wheelDelta),{x:i,y:t}}function vd(n){var t=yp(n);return t.x*=ht,t.y*=ht,t}function pp(n,t){var v=yp(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&&bt&&rt)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&&!yi&&!wt&&null!=ht)return u&&h&&ee(n,Math.max(0,r.scrollTop+u*ht)),br(n,Math.max(0,r.scrollLeft+e*ht)),(!u||u&&h)&&et(t),void(i.wheelStartX=null);if(u&&null!=ht){var l=u*ht,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);el(n,{top:s,bottom:a})}ce<20&&(null==i.wheelStartX?(i.wheelStartX=r.scrollLeft,i.wheelStartY=r.scrollTop,i.wheelDX=e,i.wheelDY=u,setTimeout(function(){if(null!=i.wheelStartX){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&&(ht=(ht*ce+u)/(ce+1),++ce)}},200)):(i.wheelDX+=e,i.wheelDY+=u))}}function gt(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=g(t,v),r=1;r<t.length;r++){var f=t[r],e=t[r-1],o=u(e.to(),f.from());if(a&&!f.empty()?0<o:0<=o){var h=ho(e.from(),f.from()),c=so(e.to(),f.to()),l=e.empty()?f.from()==f.head:e.from()==e.head;r<=i&&--i;t.splice(--r,2,new s(l?c:h,l?h:c))}}return new ct(t,i)}function ir(n,t){return new ct([new s(n,t||n)],0)}function rr(t){return t.text?n(t.from.line+t.text.length-1,h(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function wp(t,i){if(u(t,i.from)<0)return t;if(u(t,i.to)<=0)return rr(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+=rr(i).ch-i.to.ch),n(f,r)}function cl(n,t){for(var u,r=[],i=0;i<n.sel.ranges.length;i++)u=n.sel.ranges[i],r.push(new s(wp(u.anchor,t),wp(u.head,t)));return gt(n.cm,r,n.sel.primIndex)}function bp(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 ll(n){n.doc.mode=ic(n.options,n.doc.modeOption);le(n)}function le(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;se(n,100);n.state.modeGen++;n.curOp&&ot(n)}function kp(n,t){return 0==t.from.ch&&0==t.to.ch&&""==h(t.text)&&(!n.cm||n.cm.options.wholeLineUpdateBefore)}function al(n,i,r,u){function a(n){return r?r[n]:null}function s(n,t,r){!function(n,t,i,r){n.text=t;n.stateAfter&&(n.stateAfter=null);n.styles&&(n.styles=null);null!=n.order&&(n.order=null);ga(n);nv(n,i);var u=r?r(n):1;u!=n.height&&ii(n,u)}(n,t,r,u);nt(n,"change",n,i)}function y(n,t){for(var r=[],i=n;i<t;++i)r.push(new lr(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=h(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)):kp(n,i)?(b=y(0,f.length-1),s(l,l.text,p),v&&n.remove(e.line,v),b.length&&n.insert(e.line,b)):o==l?1==f.length?s(o,o.text.slice(0,e.ch)+w+o.text.slice(c.ch),p):(k=y(1,f.length-1),k.push(new lr(w+o.text.slice(c.ch),p,u)),s(o,o.text.slice(0,e.ch)+f[0],a(0)),n.insert(e.line+1,k)):1==f.length?(s(o,o.text.slice(0,e.ch)+f[0]+l.text.slice(c.ch),a(0)),n.remove(e.line+1,v)):(s(o,o.text.slice(0,e.ch)+f[0],a(0)),s(l,w+l.text.slice(c.ch),p),d=y(1,f.length-1),1<v&&n.remove(e.line+1,v-1),n.insert(e.line+1,d));nt(n,"change",n,i)}function gr(n,t,i){!function n(r,u,f){var o,e,s;if(r.linked)for(o=0;o<r.linked.length;++o)e=r.linked[o],e.doc!=u&&(s=f&&e.sharedHist,i&&!s||(t(e.doc,s),n(e.doc,r,s)))}(n,null,!0)}function dp(n,t){if(t.cm)throw new Error("This document is already in use.");dc((n.doc=t).cm=n);ll(n);gp(n);n.options.lineWrapping||ah(n);n.options.mode=t.modeOption;ot(n)}function gp(n){("rtl"==n.doc.direction?fr:pi)(n.display.lineDiv,"CodeMirror-rtl")}function rs(n){this.done=[];this.undone=[];this.undoDepth=1/0;this.lastModTime=this.lastSelTime=0;this.lastOp=this.lastSelOp=null;this.lastOrigin=this.lastSelOrigin=null;this.generation=this.maxGeneration=n||1}function vl(n,t){var i={from:eh(t.from),to:rr(t),text:or(n,t.from,t.to)};return iw(n,i,t.from.line,t.to.line+1),gr(n,function(n){return iw(n,i,t.from.line,t.to.line+1)},!0),i}function nw(n){for(;n.length;){if(!h(n).ranges)break;n.pop()}}function tw(n,t,i,r){var f=n.history,o,s,e,c,l;if(f.undone.length=0,c=+new Date,(f.lastOp==r||f.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&f.lastModTime>c-(n.cm?n.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=(e=f).lastOp==r?(nw(e.done),h(e.done)):e.done.length&&!h(e.done).ranges?h(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),h(e.done)):void 0))s=h(o.changes),0==u(t.from,t.to)&&0==u(t.from,s.to)?s.to=rr(t):o.changes.push(vl(n,t));else for(l=h(f.done),l&&l.ranges||us(n.sel,f.done),o={changes:[vl(n,t)],generation:f.generation},f.done.push(o);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=c;f.lastOp=f.lastSelOp=r;f.lastOrigin=f.lastSelOrigin=t.origin;s||w(n,"historyAdded")}function yd(n,t,i,r){var e,c,o,s,l,u=n.history,f=r&&r.origin;i==u.lastSelOp||f&&u.lastSelOrigin==f&&(u.lastModTime==u.lastSelTime&&u.lastOrigin==f||(e=n,c=f,o=h(u.done),s=t,"*"==(l=c.charAt(0))||"+"==l&&o.ranges.length==s.ranges.length&&o.somethingSelected()==s.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)))?u.done[u.done.length-1]=t:us(t,u.done);u.lastSelTime=+new Date;u.lastSelOrigin=f;u.lastSelOp=i;r&&!1!==r.clearRedo&&nw(u.undone)}function us(n,t){var i=h(t);i&&i.ranges&&i.equals(n)||t.push(n)}function iw(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 pd(n){if(!n)return null;for(var t,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 rw(n,t){var i=function(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(pd(u[i]));return r}(n,t),s=sh(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 yu(n,t,i){for(var u,l,s,c,r,a,f,e=[],o=0;o<n.length;++o)if(u=n[o],u.ranges)e.push(i?ct.prototype.deepCopy.call(u):u);else for(l=u.changes,s=[],e.push({changes:s}),c=0;c<l.length;++c)if(r=l[c],a=void 0,s.push({from:r.from,to:r.to,text:r.text}),t)for(f in r)(a=f.match(/^spans_(\d+)$/))&&-1<g(t,Number(a[1]))&&(h(s)[f]=r[f],delete r[f]);return e}function yl(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 s(f,t)):new s(i||t,t)}function fs(n,t,i,r,u){null==u&&(u=n.cm&&(n.cm.display.shift||n.extend));tt(n,new ct([yl(n.sel.primary(),t,i,u)],0),r)}function uw(n,t,i){for(var u=[],f=n.cm&&(n.cm.display.shift||n.extend),r=0;r<n.sel.ranges.length;r++)u[r]=yl(n.sel.ranges[r],t[r],null,f);tt(n,gt(n.cm,u,n.sel.primIndex),i)}function pl(n,t,i,r){var u=n.sel.ranges.slice(0);u[t]=i;tt(n,gt(n.cm,u,n.sel.primIndex),r)}function fw(n,t,i,r){tt(n,ir(t,i),r)}function ew(n,t,i){var r=n.history.done,u=h(r);u&&u.ranges?es(n,r[r.length-1]=t,i):tt(n,t,i)}function tt(n,t,i){es(n,t,i);yd(n,n.sel,n.cm?n.cm.curOp.id:NaN,i)}function es(n,t,i){var r,o,h,e;(yt(n,"beforeSelectionChange")||n.cm&&yt(n.cm,"beforeSelectionChange"))&&(r=n,h=i,e={ranges:(o=t).ranges,update:function(n){this.ranges=[];for(var t=0;t<n.length;t++)this.ranges[t]=new s(f(r,n[t].anchor),f(r,n[t].head))},origin:h&&h.origin},w(r,"beforeSelectionChange",r,e),r.cm&&w(r.cm,"beforeSelectionChange",r.cm,e),t=e.ranges!=o.ranges?gt(r.cm,e.ranges,e.ranges.length-1):o);ow(n,hw(n,t,i&&i.bias||(u(t.primary().head,n.sel.primary().head)<0?-1:1),!0));i&&!1===i.scroll||!n.cm||lu(n.cm)}function ow(n,t){t.equals(n.sel)||(n.sel=t,n.cm&&(n.cm.curOp.updateInput=1,n.cm.curOp.selectionChanged=!0,ev(n.cm)),nt(n,"cursorActivity",n))}function sw(n){ow(n,hw(n,n.sel,null,!1))}function hw(n,t,i,r){for(var f,u=0;u<t.ranges.length;u++){var e=t.ranges[u],o=t.ranges.length==n.sel.ranges.length&&n.sel.ranges[u],h=wl(n,e.anchor,o&&o.anchor,i,r),c=wl(n,e.head,o&&o.head,i,r);(f||h!=e.anchor||c!=e.head)&&(f||(f=t.ranges.slice(0,u)),f[u]=new s(h,c))}return f?gt(n.cm,f,t.primIndex):t}function pu(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,(null==h.from||(o.inclusiveLeft?h.from<=i.ch:h.from<i.ch))&&(null==h.to||(o.inclusiveRight?h.to>=i.ch:h.to>i.ch))){if(e&&(w(o,"beforeCursorEnter"),o.explicitlyCleared)){if(c.markedSpans){--a;continue}break}if(!o.atomic)continue;return r&&(s=o.find(f<0?1:-1),v=void 0,(f<0?o.inclusiveRight:o.inclusiveLeft)&&(s=cw(n,s,-f,s&&s.line==i.line?c:null)),s&&s.line==i.line&&(v=u(s,r))&&(f<0?v<0:0<v))?pu(n,s,i,f,e):(l=o.find(f<0?-1:1),(f<0?o.inclusiveLeft:o.inclusiveRight)&&(l=cw(n,l,f,l.line==i.line?c:null)),l?pu(n,l,i,f,e):null)}return i}function wl(t,i,r,u,f){var e=u||1,o=pu(t,i,r,e,f)||!f&&pu(t,i,r,e,!0)||pu(t,i,r,-e,f)||!f&&pu(t,i,r,-e,!0);return o||(t.cantEdit=!0,n(t.first,0))}function cw(i,r,u,e){return u<0&&0==r.ch?r.line>i.first?f(i,n(r.line-1)):null:0<u&&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 lw(t){t.setSelection(n(t.firstLine(),0),n(t.lastLine()),ti)}function aw(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);void 0!==e&&(r.origin=e)}),w(n,"beforeChange",n,r),n.cm&&w(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 wu(n,t,i){var f,r;if(n.cm){if(!n.cm.curOp)return k(n.cm,wu)(n,t,i);if(n.cm.state.suppressEdits)return}if(!(yt(n,"beforeChange")||n.cm&&yt(n.cm,"beforeChange"))||(t=aw(n,t,!0)))if(f=oh&&!i&&function(n,t,i){var r=null,e,h,f;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&&-1!=g(r,i)||(r||(r=[])).push(i)}),!r)return null;for(e=[{from:t,to:i}],h=0;h<r.length;++h)for(var l=r[h],o=l.find(0),s=0;s<e.length;++s)if(f=e[s],!(u(f.to,o.from)<0||0<u(f.from,o.to))){var c=[s,1],a=u(f.from,o.from),v=u(f.to,o.to);(a<0||!l.inclusiveLeft&&!a)&&c.push({from:f.from,to:o.from});(0<v||!l.inclusiveRight&&!v)&&c.push({from:o.to,to:f.to});e.splice.apply(e,c);s+=c.length-3}return e}(n,t.from,t.to),f)for(r=f.length-1;0<=r;--r)vw(n,{from:f[r].from,to:f[r].to,text:r?[""]:t.text,origin:t.origin});else vw(n,t)}function vw(n,t){var i,r;(1!=t.text.length||""!=t.text[0]||0!=u(t.from,t.to))&&(i=cl(n,t),tw(n,t,i,n.cm?n.cm.curOp.id:NaN),ae(n,t,i,sh(n,t)),r=[],gr(n,function(n,i){i||-1!=g(r,n.history)||(bw(n.history,t),r.push(n.history));ae(n,t,null,sh(n,t))}))}function os(n,t,i){var a=n.cm&&n.cm.state.suppressEdits,s,l;if(!a||i){for(var r,u=n.history,v=n.sel,f="undo"==t?u.done:u.undone,o="undo"==t?u.undone:u.done,e=0;e<f.length&&(r=f[e],i?!r.ranges||r.equals(n.sel):r.ranges);e++);if(e!=f.length){for(u.lastOrigin=u.lastSelOrigin=null;;){if(!(r=f.pop()).ranges){if(a)return void f.push(r);break}if(us(r,o),i&&!r.equals(n.sel))return void tt(n,r,{clearRedo:!1});v=r}s=[];us(v,o);o.push({changes:s,generation:u.generation});u.generation=r.generation||++u.maxGeneration;for(var y=yt(n,"beforeChange")||n.cm&&yt(n.cm,"beforeChange"),p=function(i){var u=r.changes[i],o,e;if(u.origin=t,y&&!aw(n,u,!1))return f.length=0,{};s.push(vl(n,u));o=i?cl(n,u):h(f);ae(n,u,o,rw(n,u));!i&&n.cm&&n.cm.scrollIntoView({from:u.from,to:rr(u)});e=[];gr(n,function(n,t){t||-1!=g(e,n.history)||(bw(n.history,u),e.push(n.history));ae(n,u,null,rw(n,u))})},c=r.changes.length-1;0<=c;--c)if(l=p(c),l)return l.v}}}function yw(t,i){if(0!=i&&(t.first+=i,t.sel=new ct(eo(t.sel.ranges,function(t){return new s(n(t.anchor.line+i,t.anchor.ch),n(t.head.line+i,t.head.ch))}),t.sel.primIndex),t.cm)){ot(t.cm,t.first,t.first-i,i);for(var u=t.cm.display,r=u.viewFrom;r<u.viewTo;r++)nr(t.cm,r,"gutter")}}function ae(i,r,u,f){var o,e;if(i.cm&&!i.cm.curOp)return k(i.cm,ae)(i,r,u,f);r.to.line<i.first?yw(i,r.text.length-1-(r.to.line-r.from.line)):r.from.line>i.lastLine()||(r.from.line<i.first&&(o=r.text.length-1-(i.first-r.from.line),yw(i,o),r={from:n(i.first,0),to:n(r.to.line+o,r.to.ch),text:[h(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=or(i,r.from,r.to),u||(u=cl(i,r)),i.cm?function(n,i,r){var f=n.doc,e=n.display,u=i.from,o=i.to,s=!1,h=u.line,y,l,a,v;n.options.lineWrapping||(h=c(ui(t(f,u.line))),f.iter(h,o.line+1,function(n){if(n==e.maxLine)return s=!0}));-1<f.sel.contains(i.from,i.to)&&ev(n);al(f,i,r,dy(n));n.options.lineWrapping||(f.iter(h,u.line+i.text.length,function(n){var t=yo(n);t>e.maxLineLength&&(e.maxLine=n,e.maxLineLength=t,e.maxLineChanged=!0,s=!1)}),s&&(n.curOp.updateMaxLine=!0)),function(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;u<r;r--)if(f=t(n,r).stateAfter,f&&(!(f instanceof df)||r+f.lookAhead<i)){u=r+1;break}n.highlightFrontier=Math.min(n.highlightFrontier,u)}}(f,u.line);se(n,400);y=i.text.length-(o.line-u.line)-1;i.full?ot(n):u.line!=o.line||1!=i.text.length||kp(n.doc,i)?ot(n,u.line,o.line+1,y):nr(n,u.line,"text");l=yt(n,"changes");a=yt(n,"change");(a||l)&&(v={from:u,to:o,text:i.text,removed:i.removed,origin:i.origin},a&&nt(n,"change",n,v),l&&(n.curOp.changeObjs||(n.curOp.changeObjs=[])).push(v));n.display.selForContextMenu=null}(i.cm,r,f):al(i,r,f),es(i,u,ti))}function bu(n,t,i,r,f){var e;r||(r=i);u(r,i)<0&&(i=(e=[r,i])[0],r=e[1]);"string"==typeof t&&(t=n.splitLines(t));wu(n,{from:i,to:r,text:t,origin:f})}function pw(n,t,i,r){i<n.line?n.line+=r:t<n.line&&(n.line=t,n.ch=0)}function ww(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()).copied=!0),s=0;s<f.ranges.length;s++)pw(f.ranges[s].anchor,i,r,u),pw(f.ranges[s].head,i,r,u);else{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 bw(n,t){var i=t.from.line,r=t.to.line,u=t.text.length-(r-i)-1;ww(n.done,i,r,u);ww(n.undone,i,r,u)}function ve(n,i,r,u){var f=i,e=i;return"number"==typeof i?e=t(n,ba(n,i)):f=c(i),null==f?null:(u(e,f)&&n.cm&&nr(n.cm,f,r),e)}function ye(n){this.lines=n;this.parent=null;for(var i=0,t=0;t<n.length;++t)n[t].parent=this,i+=n[t].height;this.height=i}function pe(n){var t;this.children=n;for(var r=0,u=0,i=0;i<n.length;++i)t=n[i],r+=t.chunkSize(),u+=t.height,t.parent=this;this.size=r;this.height=u;this.parent=null}function kw(n,t,i){hi(t)<(n.curOp&&n.curOp.scrollTop||n.doc.scrollTop)&&rl(n,i)}function du(n,t,i,e,o){var s,v,y,l,c,a;if(e&&e.shared)return function(n,t,i,r,u){(r=er(r)).shared=!1;var e=[du(n,t,i,r,u)],o=e[0],s=r.widgetNode;return gr(n,function(n){s&&(r.widgetNode=s.cloneNode(!0));e.push(du(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=h(e)}),new gu(e,o)}(n,t,i,e,o);if(n.cm&&!n.cm.curOp)return k(n.cm,du)(n,t,i,e,o);if(s=new ai(n,o),v=u(t,i),e&&er(e,s,!1),0<v||0==v&&!1!==s.clearWhenEmpty)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=iu("span",[s.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(rv(n,t.line,t,i,s)||t.line!=i.line&&rv(n,i.line,t,i,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");ri=!0}if(s.addToHistory&&tw(n,{from:t,to:i,origin:"markText"},n.sel,NaN),l=t.line,c=n.cm,n.iter(l,i.line+1,function(n){var r,u;c&&s.collapsed&&!c.options.lineWrapping&&ui(n)==c.display.maxLine&&(y=!0);s.collapsed&&l!=t.line&&ii(n,0);r=n;u=new co(s,l==t.line?t.ch:null,l==i.line?i.ch:null);r.markedSpans=r.markedSpans?r.markedSpans.concat([u]):[u];u.marker.attachLine(r);++l}),s.collapsed&&n.iter(t.line,i.line+1,function(t){di(n,t)&&ii(t,0)}),s.clearOnEnter&&r(s,"beforeCursorEnter",function(){return s.clear()}),s.readOnly&&(oh=!0,(n.history.done.length||n.history.undone.length)&&n.clearHistory()),s.collapsed&&(s.id=++bl,s.atomic=!0),c){if(y&&(c.curOp.updateMaxLine=!0),s.collapsed)ot(c,t.line,i.line+1);else if(s.className||s.startStyle||s.endStyle||s.css||s.attributes||s.title)for(a=t.line;a<=i.line;a++)nr(c,a,"text");s.atomic&&sw(c.doc);nt(c,"markerAdded",c,s)}return s}function dw(t){return t.findMarks(n(t.first,0),t.clipPos(n(t.lastLine())),function(n){return n.parent})}function wd(n){for(var i=function(t){var i=n[t],f=[i.primary.doc],r,u;for(gr(i.primary.doc,function(n){return f.push(n)}),r=0;r<i.markers.length;r++)u=i.markers[r],-1==g(f,u.doc)&&(u.parent=null,i.markers.splice(r--,1))},t=0;t<n.length;t++)i(t)}function bd(n){var t=this,i,r,c,u,e;if((nb(t),!b(t,n)&&!li(t.display,n))&&(et(n),o&&(kl=+new Date),i=pr(t,n,!0),r=n.dataTransfer.files,i&&!t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var h=r.length,l=Array(h),a=0,v=function(n,r){if(!t.options.allowDropFileTypes||-1!=g(t.options.allowDropFileTypes,n.type)){var u=new FileReader;u.onload=k(t,function(){var n=u.result,e;(/[\x00-\x08\x0e-\x1f]{2}/.test(n)&&(n=""),l[r]=n,++a==h)&&(e={from:i=f(t.doc,i),to:i,text:t.doc.splitLines(l.join(t.doc.lineSeparator())),origin:"paste"},wu(t.doc,e),ew(t.doc,ir(i,rr(e))))});u.readAsText(n)}},s=0;s<h;++s)v(r[s],s);else{if(t.state.draggingText&&-1<t.doc.sel.contains(i))return t.state.draggingText(n),void setTimeout(function(){return t.display.input.focus()},20);try{if(c=n.dataTransfer.getData("Text"),c){if(t.state.draggingText&&!t.state.draggingText.copy&&(u=t.listSelections()),es(t.doc,ir(i,i)),u)for(e=0;e<u.length;++e)bu(t.doc,"",u[e].anchor,u[e].head,"drag");t.replaceSelection(c,"around","paste");t.display.input.focus()}}catch(n){}}}function nb(n){n.display.dragCursor&&(n.display.lineSpace.removeChild(n.display.dragCursor),n.display.dragCursor=null)}function tb(n){var r;if(document.getElementsByClassName){for(var u=document.getElementsByClassName("CodeMirror"),t=[],i=0;i<u.length;i++)r=u[i].CodeMirror,r&&t.push(r);t.length&&t[0].operation(function(){for(var i=0;i<t.length;i++)n(t[i])})}}function kd(){var n;dl||(r(window,"resize",function(){null==n&&(n=setTimeout(function(){n=null;tb(dd)},100))}),r(window,"blur",function(){return tb(ue)}),dl=!0)}function dd(n){var t=n.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null;t.scrollbarsClipped=!1;n.setSize()}function gd(n){var u,f,e,o,i=n.split(/-(?!$)/),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))throw new Error("Unrecognized modifier name: "+t);e=!0}return u&&(n="Alt-"+n),f&&(n="Ctrl-"+n),o&&(n="Cmd-"+n),e&&(n="Shift-"+n),n}function ng(n){var f={},t,o,r,u,e,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=eo(t.split(" "),gd),u=0;u<r.length;u++)if(e=void 0,i=void 0,e=u==r.length-1?(i=r.join(" "),o):(i=r.slice(0,u+1).join(" "),"..."),s=f[i],s){if(s!=e)throw new Error("Inconsistent bindings for "+i);}else f[i]=e;delete n[t]}for(h in f)n[h]=f[h];return n}function rf(n,t,i,r){var u=(t=ss(t)).call?t.call(n,r):t[n],f,e;if(!1===u)return"nothing";if("..."===u)return"multi";if(null!=u&&i(u))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return rf(n,t.fallthrough,i,r);for(f=0;f<t.fallthrough.length;f++)if(e=rf(n,t.fallthrough[f],i,r),e)return e}}function ib(n){var t="string"==typeof n?n:vi[n.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function rb(n,t,i){var r=n;return t.altKey&&"Alt"!=r&&(n="Alt-"+n),(ws?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(n="Ctrl-"+n),(ws?t.ctrlKey:t.metaKey)&&"Cmd"!=r&&(n="Cmd-"+n),!i&&t.shiftKey&&"Shift"!=r&&(n="Shift-"+n),n}function ub(n,t){if(wt&&34==n.keyCode&&n.char)return!1;var i=vi[n.keyCode];return null!=i&&!n.altGraphKey&&(3==n.keyCode&&n.code&&(i=n.code),rb(i,n,t))}function ss(n){return"string"==typeof n?oi[n]:n}function uf(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,h(i).to)<=0;)if(e=i.pop(),u(e.from,r.from)<0){r.from=e.from;break}i.push(r)}st(n,function(){for(var t=i.length-1;0<=t;t--)bu(n.doc,"",i[t].from,i[t].to,"+delete");lu(n)})}function gl(n,t,i){var r=wa(n.text,t+i,i);return r<0||r>n.text.length?null:r}function na(t,i,r){var u=gl(t,i.ch,r);return null==u?null:new n(i.line,u,r<0?"after":"before")}function ta(t,i,r,u,f){var s,e,o,c,l,a;return t&&(s=ci(r,i.doc.direction),s)?(o=f<0?h(s):s[0],c=f<0==(1==o.level)?"after":"before",0<o.level||"rtl"==i.doc.direction?(l=su(i,r),e=f<0?r.text.length-1:0,a=ei(i,l,e).top,e=yf(function(n){return ei(i,l,n).top==a},f<0==(1==o.level)?o.from:o.to-1,e),"before"==c&&(e=gl(r,e,1))):e=f<0?o.to:o.from,new n(u,e,c)):new n(u,f<0?r.text.length:0,f<0?"before":"after")}function fb(n,i){var u=t(n.doc,i),r=ui(u);return r!=u&&(i=c(r)),ta(!0,n,r,i,1)}function eb(i,r){var u=fb(i,r.line),e=t(i.doc,u.line),o=ci(e,i.doc.direction),f,s;return o&&0!=o[0].level?u:(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))}function hs(n,t,i){if("string"==typeof t&&!(t=ff[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)!=fo}finally{n.display.shift=u;n.state.suppressEdits=!1}return r}function be(n,t,i,r){var u=n.state.keySeq;if(u){if(ib(t))return"handled";if(/\'$/.test(t)?n.state.keySeq=null:ob.set(50,function(){n.state.keySeq==u&&(n.state.keySeq=null,n.display.input.reset())}),sb(n,u+" "+t,i,r))return!0}return sb(n,t,i,r)}function sb(n,t,i,r){var u=function(n,t,i){for(var u,r=0;r<n.state.keyMaps.length;r++)if(u=rf(t,n.state.keyMaps[r],i,n),u)return u;return n.options.extraKeys&&rf(t,n.options.extraKeys,i,n)||rf(t,n.options.keyMap,i,n)}(n,t,r);return"multi"==u&&(n.state.keySeq=t),"handled"==u&&nt(n,"keyHandled",n,t,i),"handled"!=u&&"multi"!=u||(et(i),gc(n)),!!u}function hb(n,t){var i=ub(t,!0);return!!i&&(t.shiftKey&&!n.state.keySeq?be(n,"Shift-"+i,t,function(t){return hs(n,t,!0)})||be(n,i,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return hs(n,t)}):be(n,i,t,function(t){return hs(n,t)}))}function cb(n){var t=this,i,u;(t.curOp.focus=si(),b(t,n))||(o&&a<11&&27==n.keyCode&&(n.returnValue=!1),i=n.keyCode,t.display.shift=16==i||n.shiftKey,u=hb(t,n),wt&&(cs=u?i:null,!u&&88==i&&!wk&&(bt?n.metaKey:n.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=i||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(n){function t(n){18!=n.keyCode&&n.altKey||(pi(i,"CodeMirror-crosshair"),at(document,"keyup",t),at(document,"mouseover",t))}var i=n.display.lineDiv;fr(i,"CodeMirror-crosshair");r(document,"keyup",t);r(document,"mouseover",t)}(t))}function lb(n){16==n.keyCode&&(this.doc.sel.shift=!1);b(this,n)}function ab(n){var t=this,i,r,f,u;if(!(li(t.display,n)||b(t,n)||n.ctrlKey&&!n.altKey||bt&&n.metaKey)){if(i=n.keyCode,r=n.charCode,wt&&i==cs)return cs=null,void et(n);if((!wt||n.which&&!(n.which<10)||!hb(t,n))&&(u=String.fromCharCode(null==r?i:r),"\b"!=u&&!be(f=t,"'"+u+"'",n,function(n){return hs(f,n,!0)})))t.display.input.onKeyPress(n)}}function vb(i){var e=this,h=e.display;if(!(b(e,i)||h.activeTouch&&h.input.supportsTouch()))if(h.input.ensurePolled(),h.shift=i.shiftKey,li(h,i))rt||(h.scroller.draggable=!1,setTimeout(function(){return h.scroller.draggable=!0},100));else if(!ia(e,i)){var v,y,p,c=pr(e,i),l=sv(i),w=c?(v=c,y=l,p=+new Date,de&&de.compare(p,v,y)?(ke=de=null,"triple"):ke&&ke.compare(p,v,y)?(de=new ls(p,v,y),ke=null,"double"):(ke=new ls(p,v,y),de=null,"single")):"single";window.focus();1==l&&e.state.selectingText&&e.state.selectingText(i);c&&function(n,t,i,r,u){var f="Click";return"double"==r?f="Double"+f:"triple"==r&&(f="Triple"+f),be(n,rb(f=(1==t?"Left":2==t?"Middle":"Right")+f,u),u,function(t){if("string"==typeof t&&(t=ff[t]),!t)return!1;var r=!1;try{n.isReadOnly()&&(n.state.suppressEdits=!0);r=t(n,i)!=fo}finally{n.state.suppressEdits=!1}return r})}(e,l,c,w,i)||(1==l?c?function(i,e,h,c){o?setTimeout(ks(tp,i),0):i.curOp.focus=si();var l,v=function(n,t,i){var u=n.getOption("configureMouse"),r=u?u(n,t,i):{},f;return null==r.unit&&(f=sk?i.shiftKey&&i.metaKey:i.altKey,r.unit=f?"rectangle":"single"==t?"char":"double"==t?"word":"line"),(null==r.extend||n.doc.extend)&&(r.extend=n.doc.extend||i.shiftKey),null==r.addNew&&(r.addNew=bt?i.metaKey:i.ctrlKey),null==r.moveOnDrag&&(r.moveOnDrag=!(bt?i.altKey:i.ctrlKey)),r}(i,h,c),y=i.doc.sel;i.options.dragDrop&&hv&&!i.isReadOnly()&&"single"==h&&-1<(l=y.contains(e))&&(u((l=y.ranges[l]).from(),e)<0||0<e.xRel)&&(0<u(l.to(),e)||e.xRel<0)?function(n,t,i,u){var f=n.display,s=!1,e=k(n,function(t){rt&&(f.scroller.draggable=!1);n.state.draggingText=!1;at(f.wrapper.ownerDocument,"mouseup",e);at(f.wrapper.ownerDocument,"mousemove",h);at(f.scroller,"dragstart",c);at(f.scroller,"drop",e);s||(et(t),u.addNew||fs(n.doc,i,null,null,u.extend),rt||o&&9==a?setTimeout(function(){f.wrapper.ownerDocument.body.focus();f.input.focus()},20):f.input.focus())}),h=function(n){s=s||10<=Math.abs(t.clientX-n.clientX)+Math.abs(t.clientY-n.clientY)},c=function(){return s=!0};rt&&(f.scroller.draggable=!0);(n.state.draggingText=e).copy=!u.moveOnDrag;f.scroller.dragDrop&&f.scroller.dragDrop();r(f.wrapper.ownerDocument,"mouseup",e);r(f.wrapper.ownerDocument,"mousemove",h);r(f.scroller,"dragstart",c);r(f.scroller,"drop",e);ip(n);setTimeout(function(){return f.input.focus()},20)}(i,c,e,v):function(i,e,o,h){function ut(r){var k,y,rt;if(0!=u(d,r))if(d=r,"rectangle"==h.unit){for(var v=[],b=i.options.tabSize,ut=vt(t(c,o.line).text,o.ch,b),ft=vt(t(c,r.line).text,r.ch,b),et=Math.min(ut,ft),ot=Math.max(ut,ft),e=Math.min(o.line,r.line),st=Math.min(i.lastLine(),Math.max(o.line,r.line));e<=st;e++)k=t(c,e).text,y=gs(k,et,b),et==ot?v.push(new s(n(e,y),n(e,y))):k.length>y&&v.push(new s(n(e,y),n(e,gs(k,ot,b))));v.length||v.push(new s(o,o));tt(c,gt(i,p.ranges.slice(0,l).concat(v),l),{origin:"*mouse",scroll:!1});i.scrollIntoView(r)}else{var g,nt=a,w=yb(i,r,h.unit),it=nt.anchor;it=0<u(w.anchor,it)?(g=w.head,ho(nt.from(),w.anchor)):(g=w.anchor,so(nt.to(),w.head));rt=p.ranges.slice(0);rt[l]=function(i,r){var f=r.anchor,e=r.head,d=t(i.doc,f.line),o,l,h,a,c,v,y;if(0==u(f,e)&&f.sticky==e.sticky||(o=ci(d),!o)||(l=bf(o,f.ch,f.sticky),h=o[l],h.from!=f.ch&&h.to!=f.ch)||(c=l+(h.from==f.ch==(1!=h.level)?0:1),0==c||c==o.length))return r;e.line!=f.line?a=0<(e.line-f.line)*("ltr"==i.doc.direction?1:-1):(v=bf(o,e.ch,e.sticky),y=v-l||(e.ch-f.ch)*(1==h.level?-1:1),a=v==c-1||v==c?y<0:0<y);var p=o[c+(a?-1:0)],w=a==(1==p.level),b=w?p.from:p.to,k=w?"after":"before";return f.ch==b&&f.sticky==k?r:new s(new n(f.line,b,k),e)}(i,new s(f(c,it),g));tt(c,gt(i,rt,l),ds)}}function rt(n){i.state.selectingText=!1;w=1/0;et(n);v.input.focus();at(v.wrapper.ownerDocument,"mousemove",it);at(v.wrapper.ownerDocument,"mouseup",g);c.history.lastSelOrigin=null}var v=i.display,c=i.doc,a,l,p,y,b,d,nt,w,it,g;et(e);p=c.sel;y=p.ranges;h.addNew&&!h.extend?(l=c.sel.contains(o),a=-1<l?y[l]:new s(o,o)):(a=c.sel.primary(),l=c.sel.primIndex);"rectangle"==h.unit?(h.addNew||(a=new s(o,o)),o=pr(i,e,!0,!0),l=-1):(b=yb(i,o,h.unit),a=h.extend?yl(a,b.anchor,b.head,h.extend):b);h.addNew?-1==l?(l=y.length,tt(c,gt(i,y.concat([a]),l),{scroll:!1,origin:"*mouse"})):1<y.length&&y[l].empty()&&"char"==h.unit&&!h.extend?(tt(c,gt(i,y.slice(0,l).concat(y.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),p=c.sel):pl(c,l,a,ds):(tt(c,new ct([a],l=0),ds),p=c.sel);d=o;nt=v.wrapper.getBoundingClientRect();w=0;it=k(i,function(n){0!==n.buttons&&sv(n)?function n(t){var o=++w,r=pr(i,t,!0,"rectangle"==h.unit),f,e;r&&(0!=u(r,d)?(i.curOp.focus=si(),ut(r),f=tl(v,c),(r.line>=f.to||r.line<f.from)&&setTimeout(k(i,function(){w==o&&n(t)}),150)):(e=t.clientY<nt.top?-20:t.clientY>nt.bottom?20:0,e&&setTimeout(k(i,function(){w==o&&(v.scroller.scrollTop+=e,n(t))}),50)))}(n):rt(n)});g=k(i,rt);i.state.selectingText=g;r(v.wrapper.ownerDocument,"mousemove",it);r(v.wrapper.ownerDocument,"mouseup",g)}(i,c,e,v)}(e,c,w,i):wh(i)==h.scroller&&et(i):2==l?(c&&fs(e.doc,c),setTimeout(function(){return h.input.focus()},20)):3==l&&(uo?e.display.input.onContextMenu(i):ip(e)))}}function yb(t,i,r){if("char"==r)return new s(i,i);if("word"==r)return t.findWordAt(i);if("line"==r)return new s(n(i.line,0),f(t.doc,n(i.line+1,0)));var u=r(t,i);return new s(u.from,u.to)}function pb(n,t,i,r){var e,u,o,s,f,h;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&&et(t),o=n.display,s=o.lineDiv.getBoundingClientRect(),u>s.bottom||!yt(n,i))return ph(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 w(n,i,n,sr(n.doc,u),n.options.gutters[f],t),ph(t)}function ia(n,t){return pb(n,t,"gutterClick",!0)}function tg(n,t){var i,r;li(n.display,t)||(r=t,yt(i=n,"gutterContextMenu")&&pb(i,r,"gutterContextMenu",!1))||b(n,t,"contextmenu")||uo||n.display.input.onContextMenu(t)}function wb(n){n.display.wrapper.className=n.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+n.options.theme.replace(/(^|\s)\s*/g," cm-s-");ie(n)}function ge(n){vp(n);ot(n);up(n)}function ig(n,t,i){if(!t!=!(i&&i!=ef)){var u=n.display.dragFunctions,f=t?r:at;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 rg(n){n.options.lineWrapping?(fr(n.display.wrapper,"CodeMirror-wrap"),n.display.sizer.style.minWidth="",n.display.sizerWidth=null):(pi(n.display.wrapper,"CodeMirror-wrap"),ah(n));dc(n);ot(n);ie(n);setTimeout(function(){return vu(n)},100)}function v(t,u){var y=this,e,p,h,c,l;if(!(this instanceof v))return new v(t,u);this.options=u=u?er(u):{};er(bb,u,!1);hl(u);e=u.value;"string"==typeof e?e=new ft(e,u.mode,null,u.lineSeparator,u.direction):u.mode&&(e.modeOption=u.mode);this.doc=e;p=new v.inputStyles[u.inputStyle](this);h=this.display=new ck(t,e,p);for(c in vp(h.wrapper.CodeMirror=this),wb(this),u.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),hp(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 ki,keySeq:null,specialChars:null},u.autofocus&&!cf&&h.input.focus(),o&&a<11&&setTimeout(function(){return y.display.input.reset(!0)},20),function(t){function l(){u.activeTouch&&(c=setTimeout(function(){return u.activeTouch=null},1e3),(h=u.activeTouch).end=+new Date)}function v(n,t){if(null==t.left)return!0;var i=t.left-n.left,r=t.top-n.top;return 400<i*i+r*r}var u=t.display,c,h,e;r(u.scroller,"mousedown",k(t,vb));r(u.scroller,"dblclick",o&&a<11?k(t,function(n){var i,r;b(t,n)||(i=pr(t,n),!i||ia(t,n)||li(t.display,n)||(et(n),r=t.findWordAt(i),fs(t.doc,r.anchor,r.head)))}):function(n){return b(t,n)||et(n)});r(u.scroller,"contextmenu",function(n){return tg(t,n)});h={end:0};r(u.scroller,"touchstart",function(n){if(!b(t,n)&&!function(n){if(1!=n.touches.length)return!1;var t=n.touches[0];return t.radiusX<=1&&t.radiusY<=1}(n)&&!ia(t,n)){u.input.ensurePolled();clearTimeout(c);var i=+new Date;u.activeTouch={start:i,moved:!1,prev:i-h.end<=300?h:null};1==n.touches.length&&(u.activeTouch.left=n.touches[0].pageX,u.activeTouch.top=n.touches[0].pageY)}});r(u.scroller,"touchmove",function(){u.activeTouch&&(u.activeTouch.moved=!0)});r(u.scroller,"touchend",function(i){var r=u.activeTouch,o,e;r&&!li(u,i)&&null!=r.left&&!r.moved&&new Date-r.start<300&&(e=t.coordsChar(u.activeTouch,"page"),o=!r.prev||v(r,r.prev)?new s(e,e):!r.prev.prev||v(r,r.prev.prev)?t.findWordAt(e):new s(n(e.line,0),f(t.doc,n(e.line+1,0))),t.setSelection(o.anchor,o.head),t.focus(),et(i));l()});r(u.scroller,"touchcancel",l);r(u.scroller,"scroll",function(){u.scroller.clientHeight&&(ee(t,u.scroller.scrollTop),br(t,u.scroller.scrollLeft,!0),w(t,"scroll",t))});r(u.scroller,"mousewheel",function(n){return pp(t,n)});r(u.scroller,"DOMMouseScroll",function(n){return pp(t,n)});r(u.wrapper,"scroll",function(){return u.wrapper.scrollTop=u.wrapper.scrollLeft=0});u.dragFunctions={enter:function(n){b(t,n)||kf(n)},over:function(n){b(t,n)||(!function(n,t){var u=pr(n,t),r;u&&(r=document.createDocumentFragment(),np(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)),lt(n.display.dragCursor,r))}(t,n),kf(n))},start:function(n){return function(n,t){if(o&&(!n.state.draggingText||+new Date-kl<100))kf(t);else if(!b(n,t)&&!li(n.display,t)&&(t.dataTransfer.setData("Text",n.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!ha)){var r=i("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";wt&&(r.width=r.height=1,n.display.wrapper.appendChild(r),r._top=r.offsetTop);t.dataTransfer.setDragImage(r,0,0);wt&&r.parentNode.removeChild(r)}}(t,n)},drop:k(t,bd),leave:function(n){b(t,n)||nb(t)}};e=u.input.getField();r(e,"keyup",function(n){return lb.call(t,n)});r(e,"keydown",k(t,cb));r(e,"keypress",k(t,ab));r(e,"focus",function(n){return nl(t,n)});r(e,"blur",function(n){return ue(t,n)})}(this),kd(),kr(this),this.curOp.forceUpdate=!0,dp(this,e),u.autofocus&&!cf||this.hasFocus()?setTimeout(ks(nl,this),20):ue(this),as)as.hasOwnProperty(c)&&as[c](y,u[c],ef);for(fp(this),u.finishInit&&u.finishInit(this),l=0;l<vs.length;++l)vs[l](y);dr(this);rt&&u.lineWrapping&&"optimizelegibility"==getComputedStyle(h.lineDiv).textRendering&&(h.lineDiv.style.textRendering="auto")}function no(i,r,u,f){var d,o=i.doc,e,c,l,y,w,a,b,k;null==u&&(u="add");"smart"==u&&(o.mode.indent?d=gf(i,r).state:u="prev");var v=i.options.tabSize,h=t(o,r),p=vt(h.text,null,v);if(h.stateAfter&&(h.stateAfter=null),c=h.text.match(/^\s*/)[0],f||/\S/.test(h.text)){if("smart"==u&&((e=o.mode.indent(d,h.text.slice(c.length),h.text))==fo||150<e)){if(!f)return;u="prev"}}else e=0,u="not";if("prev"==u?e=r>o.first?vt(t(o,r-1).text,null,v):0:"add"==u?e=p+i.options.indentUnit:"subtract"==u?e=p-i.options.indentUnit:"number"==typeof u&&(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+=nh(e-y)),l!=c)return bu(o,l,n(r,0),n(r,c.length),"+input"),!(h.stateAfter=null);for(a=0;a<o.sel.ranges.length;a++)if(b=o.sel.ranges[a],b.head.line==r&&b.head.ch<c.length){k=n(r,c.length);pl(o,a,new s(k,k));break}}function ys(n){pt=n}function ra(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="paste"==e||i.state.pasteIncoming>k,v=gh(r),o=null;if(l&&1<f.ranges.length)if(pt&&pt.text.join("\n")==r){if(f.ranges.length%pt.text.length==0)for(o=[],y=0;y<pt.text.length;y++)o.push(p.splitLines(pt.text[y]))}else v.length==f.ranges.length&&i.options.pasteLinesPerSelection&&(o=eo(v,function(n){return[n]}));for(d=i.curOp.updateInput,a=f.ranges.length-1;0<=a;a--){var w=f.ranges[a],s=w.from(),c=w.to();w.empty()&&(u&&0<u?s=n(s.line,s.ch-u):i.state.overwrite&&!l?c=n(c.line,Math.min(t(p,c.line).text.length,c.ch+h(v).length)):l&&pt&&pt.lineWise&&pt.text.join("\n")==r&&(s=c=n(s.line,0)));b={from:s,to:c,text:o?o[a%o.length]:v,origin:e||(l?"paste":i.state.cutIncoming>k?"cut":"+input")};wu(i.doc,b);nt(i,"inputRead",i,b)}r&&!l&&db(i,r);lu(i);i.curOp.updateInput<2&&(i.curOp.updateInput=d);i.curOp.typing=!0;i.state.pasteIncoming=i.state.cutIncoming=-1}function kb(n,t){var i=n.clipboardData&&n.clipboardData.getData("Text");if(i)return n.preventDefault(),t.isReadOnly()||t.options.disableInput||st(t,function(){return ra(t,i,0,null,"paste")}),!0}function db(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;0<=u;u--)if(r=e.ranges[u],!(100<r.head.ch||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(-1<i.indexOf(f.electricChars.charAt(s))){o=no(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=no(n,r.head.line,"smart"));o&&nt(n,"electricInput",n,r.head.line)}}function gb(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 nk(n,t,i,r){n.setAttribute("autocorrect",!!i);n.setAttribute("autocapitalize",!!r);n.setAttribute("spellcheck",!!t)}function tk(){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 rt?n.style.width="1000px":n.setAttribute("wrap","off"),hf&&(n.style.border="1px solid black"),nk(n),t}function ua(i,r,u,f,e){function h(f){var h,o;if(null==(h=e?function(t,i,r,u){var o=ci(i,t.doc.direction),v,f,l,e,b,p,c,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=bf(o,r.ch,r.sticky),f=o[v],"ltr"==t.doc.direction&&f.level%2==0&&(0<u?f.to>r.ch:f.from<r.ch)))return na(i,r,u);var y,s=function(t,r){return gl(i,t instanceof n?t.ch:t,r)},w=function(n){return t.options.lineWrapping?(y=y||su(t,i),ky(t,i,y,n)):{begin:0,end:i.text.length}},h=w("before"==r.sticky?s(r,-1):r.ch);return("rtl"==t.doc.direction||1==f.level)&&(l=1==f.level==u<0,e=s(r,l?1:-1),null!=e&&(l?e<=f.to&&e<=h.end:e>=f.from&&e>=h.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")};0<=t&&t<o.length;t+=i){var e=o[t],h=0<i==(1!=e.level),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)}},c=p(v+u,u,h),c)?c:(a=0<u?h.end:s(h.begin,-1),null==a||0<u&&a==i.text.length||!(c=p(0<u?0:o.length-1,u,w(a)))?null:c)}(i.cm,s,r,u):na(s,r,u))){if(f||(o=r.line+u)<i.first||o>=i.first+i.size||(r=new n(o,r.ch,r.sticky),!(s=t(i,o))))return!1;r=ta(e,i.cm,s,r.line,u)}else r=h;return!0}var p=r,w=u,s=t(i,r.line),l,o,a;if("char"==f)h();else if("column"==f)h(!0);else if("word"==f||"group"==f)for(var v=null,y="group"==f,b=i.cm&&i.cm.getHelper(r,"wordChars"),c=!0;!(u<0)||h(!c);c=!1){if(l=s.text.charAt(r.ch)||"\n",o=oo(l,b)?"w":y&&"\n"==l?"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),0<u&&!h(!c))break}return a=wl(i,r,p,w,!0),fh(p,a)&&(a.hitSide=!0),a}function ik(n,t,i,r){var u,f,s=n.doc,h=t.left,e,o;for("page"==r?(e=Math.min(n.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),o=Math.max(e-.5*hu(n.display),3),u=(0<i?t.bottom:t.top)+i*o):"line"==r&&(u=0<i?t.bottom+3:t.top-3);(f=pc(n,h,u)).outside;){if(i<0?u<=0:u>=s.height){f.hitSide=!0;break}u+=5*i}return f}function rk(n,i){var u=cc(n,i.line),r;if(!u||u.hidden)return null;var f=t(n.doc,i.line),s=sy(u,f,i.line),e=ci(f,n.doc.direction),o="left";return e&&(o=bf(e,i.ch)%2?"right":"left"),r=cy(s.map,i.ch,o),r.offset="right"==r.collapse?r.end:r.start,r}function of(n,t){return t&&(n.bad=!0),n}function ps(t,i,r){var u,f,e;if(i==t.display.lineDiv){if(!(u=t.display.lineDiv.childNodes[r]))return of(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 ug(e,i,r)}function ug(t,i,r){function w(i,r,u){for(var o,e,s,l,h,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=c(f<0?t.line:t.rest[f]),h=o[e]+u,(u<0||s!=i)&&(h=o[e+(u?1:0)]),n(l,h)}var a=t.text.firstChild,l=!1,y,f,e,p,v,u,o,b,s,k;if(!i||!bi(a,i))return of(n(c(t.line),0),!0);if(i==a&&(l=!0,i=a.childNodes[r],r=0,!i))return y=t.rest?h(t.rest):t.line,of(n(c(y),y.text.length),l);for(f=3==i.nodeType?i:null,e=i,f||1!=i.childNodes.length||3!=i.firstChild.nodeType||(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 of(u,l);for(o=e.nextSibling,b=f?f.nodeValue.length-r:0;o;o=o.nextSibling){if(u=w(o,o.firstChild,0))return of(n(u.line,u.ch-b),l);b+=o.textContent.length}for(s=e.previousSibling,k=r;s;s=s.previousSibling){if(u=w(s,s.firstChild,-1))return of(n(u.line,u.ch+k),l);k+=s.textContent.length}}var it=navigator.userAgent,ea=navigator.platform,yi=/gecko\/\d/i.test(it),oa=/MSIE \d/.test(it),sa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(it),sf=/Edge\/(\d+)/.exec(it),o=oa||sa||sf,a=o&&(oa?document.documentMode||6:+(sf||sa)[1]),rt=!sf&&/WebKit\//.test(it),fk=rt&&/Qt\/\d+\.\d+/.test(it),io=!sf&&/Chrome\//.test(it),wt=/Opera\//.test(it),ha=/Apple Computer/.test(navigator.vendor),ek=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(it),ok=/PhantomJS/.test(it),hf=!sf&&/AppleWebKit/.test(it)&&/Mobile\/\w+/.test(it),ro=/Android/.test(it),cf=hf||ro||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(it),bt=hf||/Mac/.test(ea),sk=/\bCrOS\b/.test(it),hk=/win/i.test(ea),ur=wt&&it.match(/Version\/(\d*\.\d*)/),ws,uo,tu,pi,ru,ki,vf,va,pa,oh,ri,uu,fv,vh,r,bh,kh,hv,hr,y,df,kt,ec,lr,bv,kv,ar,ou,yr,lc,gi,au,ul,cp,he,ce,ht,ct,s,ku,bl,ai,gu,gw,ft,kl,dl,vi,nf,we,tf,oi,ff,ob,cs,ke,de,ls,vs,pt,l,ni,fa,nu,p,e,uk,to;ur&&(ur=Number(ur[1]));ur&&15<=ur&&(rt=!(wt=!1));ws=bt&&(fk||wt&&(null==ur||ur<12.11));uo=yi||o&&9<=a;pi=function(n,t){var r=n.className,i=lf(t).exec(r),u;i&&(u=r.slice(i.index+i[0].length),n.className=r.slice(0,i.index)+(u?i[1]+u:""))};tu=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(n){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};ru=function(n){n.select()};hf?ru=function(n){n.selectionStart=0;n.selectionEnd=n.value.length}:o&&(ru=function(n){try{n.select()}catch(n){}});ki=function(){this.id=null};ki.prototype.set=function(n,t){clearTimeout(this.id);this.id=setTimeout(t,n)};var ca=30,fo={toString:function(){return"CodeMirror.Pass"}},ti={scroll:!1},ds={origin:"*mouse"},af={origin:"+move"};vf=[""];va=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;pa=/[\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]/;oh=!1;ri=!1;uu=null;fv=function(){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",o=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,i=/[LRr]/,r=/[Lb1n]/,u=/[1n]/;return function(s,c){var rt="ltr"==c?"L":"R",et,yt,pt,ut,wt,st,nt,tt,ht,b,bt,k,gt,ct,ot,kt,lt,d,g,ft,y,a,ti,it,at,p,ii;if(0==s.length||"ltr"==c&&!o.test(s))return!1;for(var w,v=s.length,l=[],vt=0;vt<v;++vt)l.push((w=s.charCodeAt(vt))<=247?f.charAt(w):1424<=w&&w<=1524?"R":1536<=w&&w<=1785?e.charAt(w-1536):1774<=w&&w<=2220?"r":8192<=w&&w<=8203?"w":8204==w?"b":"L");for(et=0,yt=rt;et<v;++et)pt=l[et],"m"==pt?l[et]=yt:yt=pt;for(ut=0,wt=rt;ut<v;++ut)st=l[ut],"1"==st&&"r"==wt?l[ut]="n":i.test(st)&&"r"==(wt=st)&&(l[ut]="R");for(nt=1,tt=l[0];nt<v-1;++nt)ht=l[nt],"+"==ht&&"1"==tt&&"1"==l[nt+1]?l[nt]="1":","!=ht||tt!=l[nt+1]||"1"!=tt&&"n"!=tt||(l[nt]=tt),tt=ht;for(b=0;b<v;++b)if(bt=l[b],","==bt)l[b]="N";else if("%"==bt){for(k=void 0,k=b+1;k<v&&"%"==l[k];++k);for(gt=b&&"!"==l[b-1]||k<v&&"1"==l[k]?"1":"N",ct=b;ct<k;++ct)l[ct]=gt;b=k-1}for(ot=0,kt=rt;ot<v;++ot)lt=l[ot],"L"==kt&&"1"==lt?l[ot]="L":i.test(lt)&&(kt=lt);for(d=0;d<v;++d)if(t.test(l[d])){for(g=void 0,g=d+1;g<v&&t.test(l[g]);++g);for(var ni="L"==(d?l[d-1]:rt),ri=ni==("L"==(g<v?l[g]:rt))?ni?"L":"R":rt,dt=d;dt<g;++dt)l[dt]=ri;d=g-1}for(y=[],a=0;a<v;)if(r.test(l[a])){for(ti=a,++a;a<v&&r.test(l[a]);++a);y.push(new n(0,ti,a))}else{for(it=a,at=y.length,++a;a<v&&"L"!=l[a];++a);for(p=it;p<a;)if(u.test(l[p])){for(it<p&&y.splice(at,0,new n(1,it,p)),ii=p,++p;p<a&&u.test(l[p]);++p);y.splice(at,0,new n(2,ii,p));it=p}else++p;it<a&&y.splice(at,0,new n(1,it,a))}return"ltr"==c&&(1==y[0].level&&(ft=s.match(/^\s+/))&&(y[0].from=ft[0].length,y.unshift(new n(0,0,ft[0].length))),1==h(y).level&&(ft=s.match(/\s+$/))&&(h(y).to-=ft[0].length,y.push(new n(0,v-ft[0].length,v)))),"rtl"==c?y.reverse():y}}();vh=[];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]||vh).concat(i)}};hv=function(){if(o&&a<9)return!1;var n=i("div");return"draggable"in n||"dragDrop"in n}();var dh,gh=3!="\n\nb".split(/\n/).length?function(n){for(var t,r,u,i=0,f=[],e=n.length;i<=e;)t=n.indexOf("\n",i),-1==t&&(t=n.length),r=n.slice(i,"\r"==n.charAt(t-1)?t-1:t),u=r.indexOf("\r"),-1!=u?(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/)},pk=window.getSelection?function(n){try{return n.selectionStart!=n.selectionEnd}catch(n){return!1}}:function(n){var t;try{t=n.ownerDocument.selection.createRange()}catch(n){}return!(!t||t.parentElement()!=n)&&0!=t.compareEndPoints("StartToEnd",t)},wk="oncopy"in(dh=i("div"))||(dh.setAttribute("oncopy","return;"),"function"==typeof dh.oncopy),nc=null,tc={},eu={};for(hr={},y=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},y.prototype.eol=function(){return this.pos>=this.string.length},y.prototype.sol=function(){return this.pos==this.lineStart},y.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},y.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},y.prototype.eat=function(n){var t=this.string.charAt(this.pos);if("string"==typeof n?t==n:t&&(n.test?n.test(t):n(t)))return++this.pos,t},y.prototype.eatWhile=function(n){for(var t=this.pos;this.eat(n););return this.pos>t},y.prototype.eatSpace=function(){for(var n=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>n},y.prototype.skipToEnd=function(){this.pos=this.string.length},y.prototype.skipTo=function(n){var t=this.string.indexOf(n,this.pos);if(-1<t)return this.pos=t,!0},y.prototype.backUp=function(n){this.pos-=n},y.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=vt(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?vt(this.string,this.lineStart,this.tabSize):0)},y.prototype.indentation=function(){return vt(this.string,null,this.tabSize)-(this.lineStart?vt(this.string,this.lineStart,this.tabSize):0)},y.prototype.match=function(n,t,i){var r,u;return"string"!=typeof n?(r=this.string.slice(this.pos).match(n),r&&0<r.index?null:(r&&!1!==t&&(this.pos+=r[0].length),r)):(u=function(n){return i?n.toLowerCase():n},u(this.string.substr(this.pos,n.length))==u(n)?(!1!==t&&(this.pos+=n.length),!0):void 0)},y.prototype.current=function(){return this.string.slice(this.start,this.pos)},y.prototype.hideFirstChars=function(n,t){this.lineStart+=n;try{return t()}finally{this.lineStart-=n}},y.prototype.lookAhead=function(n){var t=this.lineOracle;return t&&t.lookAhead(n)},y.prototype.baseToken=function(){var n=this.lineOracle;return n&&n.baseToken(this.pos)},df=function(n,t){this.state=n;this.lookAhead=t},kt=function(n,t,i,r){this.state=t;this.doc=n;this.line=i;this.maxLookAhead=r||0;this.baseTokens=null;this.baseTokenPos=1},kt.prototype.lookAhead=function(n){var t=this.doc.getLine(this.line+n);return null!=t&&n>this.maxLookAhead&&(this.maxLookAhead=n),t},kt.prototype.baseToken=function(n){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=n;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-n}},kt.prototype.nextLine=function(){this.line++;0<this.maxLookAhead&&this.maxLookAhead--},kt.fromSaved=function(n,t,i){return t instanceof df?new kt(n,cr(n.mode,t.state),i,t.lookAhead):new kt(n,cr(n.mode,t),i)},kt.prototype.save=function(n){var t=!1!==n?cr(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new df(t,this.maxLookAhead):t},ec=function(n,t,i){this.start=n.start;this.end=n.pos;this.string=n.current();this.type=t||null;this.state=i},lr=function(n,t,i){this.text=n;nv(this,t);this.height=i?i(this):1},lr.prototype.lineNo=function(){return c(this)},fu(lr),bv={},kv={},ar=null,ou=null,lc={left:0,right:0,top:0,bottom:0},gi=function(n,t,u){this.cm=u;var f=this.vert=i("div",[i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=i("div",[i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");f.tabIndex=e.tabIndex=-1;n(f);n(e);r(f,"scroll",function(){f.clientHeight&&t(f.scrollTop,"vertical")});r(e,"scroll",function(){e.clientWidth&&t(e.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;o&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")},gi.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&&0<n.clientHeight&&(0==t&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?t:0,bottom:i?t:0}},gi.prototype.setScrollLeft=function(n){this.horiz.scrollLeft!=n&&(this.horiz.scrollLeft=n);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},gi.prototype.setScrollTop=function(n){this.vert.scrollTop!=n&&(this.vert.scrollTop=n);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},gi.prototype.zeroWidthHack=function(){var n=bt&&!ek?"12px":"18px";this.horiz.style.height=this.vert.style.width=n;this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new ki;this.disableVert=new ki},gi.prototype.enableZeroWidthBar=function(n,t,i){n.style.pointerEvents="auto";t.set(1e3,function r(){var u=n.getBoundingClientRect();("vert"==i?document.elementFromPoint(u.right-1,(u.top+u.bottom)/2):document.elementFromPoint((u.right+u.left)/2,u.bottom-1))!=n?n.style.pointerEvents="none":t.set(1e3,r)})},gi.prototype.clear=function(){var n=this.horiz.parentNode;n.removeChild(this.horiz);n.removeChild(this.vert)},au=function(){},au.prototype.update=function(){return{bottom:0,right:0}},au.prototype.setScrollLeft=function(){},au.prototype.setScrollTop=function(){},au.prototype.clear=function(){},ul={"native":gi,"null":au},cp=0,he=function(n,t,i){var r=n.display;this.viewport=t;this.visible=tl(r,n.doc,t);this.editorIsHidden=!r.wrapper.offsetWidth;this.wrapperHeight=r.wrapper.clientHeight;this.wrapperWidth=r.wrapper.clientWidth;this.oldDisplayWidth=vr(n);this.force=i;this.dims=bc(n);this.events=[]},he.prototype.signal=function(n,t){yt(n,t)&&this.events.push(arguments)},he.prototype.finish=function(){for(var n=0;n<this.events.length;n++)w.apply(null,this.events[n])},ce=0,ht=null,o?ht=-.53:yi?ht=15:io?ht=-.7:ha&&(ht=-1/3),ct=function(n,t){this.ranges=n;this.primIndex=t},ct.prototype.primary=function(){return this.ranges[this.primIndex]},ct.prototype.equals=function(n){var 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=this.ranges[t],r=n.ranges[t],!fh(i.anchor,r.anchor)||!fh(i.head,r.head))return!1;return!0},ct.prototype.deepCopy=function(){for(var t=[],n=0;n<this.ranges.length;n++)t[n]=new s(eh(this.ranges[n].anchor),eh(this.ranges[n].head));return new ct(t,this.primIndex)},ct.prototype.somethingSelected=function(){for(var n=0;n<this.ranges.length;n++)if(!this.ranges[n].empty())return!0;return!1},ct.prototype.contains=function(n,t){var i,r;for(t||(t=n),i=0;i<this.ranges.length;i++)if(r=this.ranges[i],0<=u(t,r.from())&&u(n,r.to())<=0)return i;return-1},s=function(n,t){this.anchor=n;this.head=t},s.prototype.from=function(){return ho(this.anchor,this.head)},s.prototype.to=function(){return so(this.anchor,this.head)},s.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},ye.prototype={chunkSize:function(){return this.lines.length},removeInner:function(n,t){for(var u,r,i=n,f=n+t;i<f;++i)r=this.lines[i],this.height-=r.height,(u=r).parent=null,ga(u),nt(r,"delete");this.lines.splice(n,t)},collapse:function(n){n.push.apply(n,this.lines)},insertInner:function(n,t,i){this.height+=i;this.lines=this.lines.slice(0,n).concat(t).concat(this.lines.slice(n));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(n,t,i){for(var r=n+t;n<r;++n)if(i(this.lines[n]))return!0}},pe.prototype={chunkSize:function(){return this.size},removeInner:function(n,t){var r,i,u,f,o,e;for(this.size-=t,r=0;r<this.children.length;++r)if(i=this.children[r],u=i.chunkSize(),n<u){if(f=Math.min(t,u-n),o=i.height,i.removeInner(n,f),this.height-=o-i.height,u==f&&(this.children.splice(r--,1),i.parent=null),0==(t-=f))break;n=0}else n-=u;this.size-t<25&&(1<this.children.length||!(this.children[0]instanceof ye))&&(e=[],this.collapse(e),this.children=[new ye(e)],this.children[0].parent=this)},collapse:function(n){for(var t=0;t<this.children.length;++t)this.children[t].collapse(n)},insertInner:function(n,t,i){var u,r,o,s,f,e;for(this.size+=t.length,this.height+=i,u=0;u<this.children.length;++u){if(r=this.children[u],o=r.chunkSize(),n<=o){if(r.insertInner(n,t,i),r.lines&&50<r.lines.length){for(s=r.lines.length%25+25,f=s;f<r.lines.length;)e=new ye(r.lines.slice(f,f+=25)),r.height-=e.height,this.children.splice(++u,0,e),e.parent=this;r.lines=r.lines.slice(0,s);this.maybeSpill()}break}n-=o}},maybeSpill:function(){var n,t,r,i;if(!(this.children.length<=10)){n=this;do t=new pe(n.children.splice(n.children.length-5,5)),n.parent?(n.size-=t.size,n.height-=t.height,r=g(n.parent.children,n),n.parent.children.splice(r+1,0,t)):(i=new pe(n.children),(i.parent=n).children=[i,t],n=i),t.parent=n.parent;while(10<n.children.length);n.parent.maybeSpill()}},iterN:function(n,t,i){for(var f,u,e,r=0;r<this.children.length;++r)if(f=this.children[r],u=f.chunkSize(),n<u){if(e=Math.min(t,u-n),f.iterN(n,e,i))return!0;if(0==(t-=e))break;n=0}else n-=u}},ku=function(n,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=n;this.node=t},ku.prototype.clear=function(){var n=this.doc.cm,t=this.line.widgets,i=this.line,u=c(i),r,f;if(null!=u&&t){for(r=0;r<t.length;++r)t[r]==this&&t.splice(r--,1);t.length||(i.widgets=null);f=te(this);ii(i,Math.max(0,i.height-f));n&&(st(n,function(){kw(n,i,-f);nr(n,u,"widget")}),nt(n,"lineWidgetCleared",n,this,u))}},ku.prototype.changed=function(){var r=this,u=this.height,n=this.doc.cm,t=this.line,i;this.height=null;i=te(this)-u;i&&(di(this.doc,t)||ii(t,t.height+i),n&&st(n,function(){n.curOp.forceUpdate=!0;kw(n,t,i);nt(n,"lineWidgetChanged",n,r,c(t))}))},fu(ku),bl=0,ai=function(n,t){this.lines=[];this.type=t;this.doc=n;this.id=++bl},ai.prototype.clear=function(){var i=this,n,o,u,t,r,e,l,a;if(!this.explicitlyCleared){n=this.doc.cm;o=n&&!n.curOp;(o&&kr(n),yt(this,"clear"))&&(u=this.find(),u&&nt(this,"clear",u.from,u.to));for(var f=null,s=null,h=0;h<this.lines.length;++h)t=i.lines[h],r=wf(t.markedSpans,i),n&&!i.collapsed?nr(n,c(t),"text"):n&&(null!=r.to&&(s=c(t)),null!=r.from&&(f=c(t))),t.markedSpans=lk(t.markedSpans,r),null==r.from&&i.collapsed&&!di(i.doc,t)&&n&&ii(t,hu(n.display));if(n&&this.collapsed&&!n.options.lineWrapping)for(e=0;e<this.lines.length;++e)l=ui(i.lines[e]),a=yo(l),a>n.display.maxLineLength&&(n.display.maxLine=l,n.display.maxLineLength=a,n.display.maxLineChanged=!0);null!=f&&n&&this.collapsed&&ot(n,f,s+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,n&&sw(n.doc));n&&nt(n,"markerCleared",n,this,f,s);o&&dr(n);this.parent&&this.parent.clear()}},ai.prototype.find=function(t,i){var f,o,e,r,u;for(null==t&&"bookmark"==this.type&&(t=1),e=0;e<this.lines.length;++e){if(r=this.lines[e],u=wf(r.markedSpans,this),null!=u.from&&(f=n(i?r:c(r),u.from),-1==t))return f;if(null!=u.to&&(o=n(i?r:c(r),u.to),1==t))return o}return f&&{from:f,to:o}},ai.prototype.changed=function(){var r=this,i=this.find(-1,!0),t=this,n=this.doc.cm;i&&n&&st(n,function(){var u=i.line,s=c(i.line),e=cc(n,s),o,f;(e&&(ly(e),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,di(t.doc,u)||null==t.height)||(o=t.height,t.height=null,f=te(t)-o,f&&ii(u,u.height+f));nt(n,"markerChanged",n,r)})},ai.prototype.attachLine=function(n){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=g(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(n)},ai.prototype.detachLine=function(n){if(this.lines.splice(g(this.lines,n),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},fu(ai),gu=function(n,t){this.markers=n;this.primary=t;for(var i=0;i<n.length;++i)n[i].parent=this},gu.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var n=0;n<this.markers.length;++n)this.markers[n].clear();nt(this,"clear")}},gu.prototype.find=function(n,t){return this.primary.find(n,t)},fu(gu),gw=0,ft=function(t,i,r,u,f){if(!(this instanceof ft))return new ft(t,i,r,u,f);null==r&&(r=0);pe.call(this,[new ye([new lr("",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=ir(e);this.history=new rs(null);this.id=++gw;this.modeOption=i;this.lineSep=u;this.direction="rtl"==f?"rtl":"ltr";this.extend=!1;"string"==typeof t&&(t=this.splitLines(t));al(this,{from:e,to:e,text:t});tt(this,ir(e),ti)},ft.prototype=aa(pe.prototype,{constructor:ft,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=rh(this,this.first,this.first+this.size);return!1===n?t:t.join(n||this.lineSeparator())},setValue:d(function(i){var r=n(this.first,0),u=this.first+this.size-1;wu(this,{from:r,to:n(u,t(this,u).text.length),text:this.splitLines(i),origin:"setValue",full:!0},!0);this.cm&&fe(this.cm,0,0);tt(this,ir(r),ti)}),replaceRange:function(n,t,i,r){bu(this,n,t=f(this,t),i=i?f(this,i):t,r)},getRange:function(n,t,i){var r=or(this,f(this,n),f(this,t));return!1===i?r:r.join(i||this.lineSeparator())},getLine:function(n){var t=this.getLineHandle(n);return t&&t.text},getLineHandle:function(n){if(pf(this,n))return t(this,n)},getLineNumber:function(n){return c(n)},getLineHandleVisualStart:function(n){return"number"==typeof n&&(n=t(this,n)),ui(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 null==n||"head"==n?t.head:"anchor"==n?t.anchor:"end"==n||"to"==n||!1===n?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:d(function(t,i,r){fw(this,f(this,"number"==typeof t?n(t,i||0):t),null,r)}),setSelection:d(function(n,t,i){fw(this,f(this,n),f(this,t||n),i)}),extendSelection:d(function(n,t,i){fs(this,f(this,n),t&&f(this,t),i)}),extendSelections:d(function(n,t){uw(this,ka(this,n),t)}),extendSelectionsBy:d(function(n,t){uw(this,ka(this,eo(this.sel.ranges,n)),t)}),setSelections:d(function(n,t,i){if(n.length){for(var u=[],r=0;r<n.length;r++)u[r]=new s(f(this,n[r].anchor),f(this,n[r].head));null==t&&(t=Math.min(n.length-1,this.sel.primIndex));tt(this,gt(this.cm,u,t),i)}}),addSelection:d(function(n,t,i){var r=this.sel.ranges.slice(0);r.push(new s(f(this,n),f(this,t||n)));tt(this,gt(this.cm,r,r.length-1),i)}),getSelection:function(n){for(var t,u,r=this.sel.ranges,i=0;i<r.length;i++)u=or(this,r[i].from(),r[i].to()),t=t?t.concat(u):u;return!1===n?t:t.join(n||this.lineSeparator())},getSelections:function(n){for(var i,u=[],r=this.sel.ranges,t=0;t<r.length;t++)i=or(this,r[t].from(),r[t].to()),!1!==n&&(i=i.join(n||this.lineSeparator())),u[t]=i;return u},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:d(function(t,i,r){for(var h,c,o,e=[],l=this.sel,f=0;f<l.ranges.length;f++)h=l.ranges[f],e[f]={from:h.from(),to:h.to(),text:this.splitLines(t[f]),origin:r};for(c=i&&"end"!=i&&function(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],o=bp(l.from,e,c),a=bp(rr(l),e,c);(e=l.to,c=a,"around"==r)?(v=t.sel.ranges[f],y=u(v.head,v.anchor)<0,h[f]=new s(y?a:o,y?o:a)):h[f]=new s(o,o)}return new ct(h,t.sel.primIndex)}(this,e,i),o=e.length-1;0<=o;o--)wu(this,e[o]);c?ew(this,c):this.cm&&lu(this.cm)}),undo:d(function(){os(this,"undo")}),redo:d(function(){os(this,"redo")}),undoSelection:d(function(){os(this,"undo",!0)}),redoSelection:d(function(){os(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 rs(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:yu(this.history.done),undone:yu(this.history.undone)}},setHistory:function(n){var t=this.history=new rs(this.history.maxGeneration);t.done=yu(n.done.slice(0),null,!0);t.undone=yu(n.undone.slice(0),null,!0)},setGutterMarker:d(function(n,t,i){return ve(this,n,"gutter",function(n){var r=n.gutterMarkers||(n.gutterMarkers={});return!(r[t]=i)&&ya(r)&&(n.gutterMarkers=null),!0})}),clearGutter:d(function(n){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[n]&&ve(t,i,"gutter",function(){return i.gutterMarkers[n]=null,ya(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(n){var i;if("number"==typeof n){if(!pf(this,n)||!(n=t(this,i=n)))return null}else if(null==(i=c(n)))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:d(function(n,t,i){return ve(this,n,"gutter"==t?"gutter":"class",function(n){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(n[r]){if(lf(i).test(n[r]))return!1;n[r]+=" "+i}else n[r]=i;return!0})}),removeLineClass:d(function(n,t,i){return ve(this,n,"gutter"==t?"gutter":"class",function(n){var f="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",u=n[f],r,e;if(!u)return!1;if(null==i)n[f]=null;else{if(r=u.match(lf(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}return!0})}),addLineWidget:d(function(n,t,i){return e=n,r=new ku(f=this,t,i),(u=f.cm)&&r.noHScroll&&(u.display.alignWidgets=!0),ve(f,e,"widget",function(n){var t=n.widgets||(n.widgets=[]),i;return(null==r.insertAt?t.push(r):t.splice(Math.min(t.length-1,Math.max(0,r.insertAt)),0,r),r.line=n,u&&!di(f,n))&&(i=hi(n)<f.scrollTop,ii(n,n.height+te(r)),i&&rl(u,r.height),u.curOp.forceUpdate=!0),!0}),u&&nt(u,"lineWidgetAdded",u,r,"number"==typeof e?e:c(e)),r;var f,e,r,u}),removeLineWidget:function(n){n.clear()},markText:function(n,t,i){return du(this,f(this,n),f(this,t),i,i&&i.type||"range")},setBookmark:function(n,t){var i={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return du(this,n=f(this,n),n,i,"bookmark")},findMarksAt:function(n){var e=[],u=t(this,(n=f(this,n)).line).markedSpans,r,i;if(u)for(r=0;r<u.length;++r)i=u[r],(null==i.from||i.from<=n.ch)&&(null==i.to||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],null!=e.to&&r==n.line&&n.ch>=e.to||null==e.from&&r!=n.line||null!=e.from&&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)null!=r[i].from&&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(t<f)return i=t,!0;t-=f;++r}),f(this,n(r,i))},indexFromPos:function(n){var t=(n=f(this,n)).ch,i;return 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 ft(rh(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,null!=n.from&&n.from>i&&(i=n.from),null!=n.to&&n.to<r&&(r=n.to),t=new ft(rh(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}],function(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=du(n,o,s,i.primary,i.primary.type),i.markers.push(f),f.parent=i)}}(t,dw(this)),t},unlinkDoc:function(n){var t,i;if(n instanceof v&&(n=n.doc),this.linked)for(t=0;t<this.linked.length;++t)if(this.linked[t].doc==n){this.linked.splice(t,1);n.unlinkDoc(this);wd(dw(this));break}n.history==this.history&&(i=[n.id],gr(n,function(n){return i.push(n.id)},!0),n.history=new rs(null),n.history.done=yu(this.history.done,i),n.history.undone=yu(this.history.undone,i))},iterLinkedDocs:function(n){gr(this,n)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(n){return this.lineSep?n.split(this.lineSep):gh(n)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:d(function(n){var t;("rtl"!=n&&(n="ltr"),n!=this.direction)&&(this.direction=n,this.iter(function(n){return n.order=null}),this.cm&&st(t=this.cm,function(){gp(t);ot(t)}))})}),ft.prototype.eachLine=ft.prototype.iter,kl=0,dl=!1,vi={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"},nf=0;nf<10;nf++)vi[nf+48]=vi[nf+96]=String(nf);for(we=65;we<=90;we++)vi[we]=String.fromCharCode(we);for(tf=1;tf<=12;tf++)vi[tf+111]=vi[tf+63235]="F"+tf;oi={};oi.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"};oi.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"};oi.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"};oi.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"]};oi.default=bt?oi.macDefault:oi.pcDefault;ff={selectAll:lw,singleSelection:function(n){return n.setSelection(n.getCursor("anchor"),n.getCursor("head"),ti)},killLine:function(i){return uf(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 uf(t,function(i){return{from:n(i.from().line,0),to:f(t.doc,n(i.to().line+1,0))}})},delLineLeft:function(t){return uf(t,function(t){return{from:n(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(n){return uf(n,function(t){var i=n.charCoords(t.head,"div").top+5;return{from:n.coordsChar({left:0,top:i},"div"),to:t.from()}})},delWrappedLineRight:function(n){return uf(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 fb(n,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(n){return n.extendSelectionsBy(function(t){return eb(n,t.head)},{origin:"+move",bias:1})},goLineEnd:function(n){return n.extendSelectionsBy(function(i){return function(n,i){var r=t(n.doc,i),u=function(n){for(var t;t=vo(n);)n=t.find(1,!0).line;return n}(r);return u!=r&&(i=c(u)),ta(!0,n,r,i,-1)}(n,i.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")},af)},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")},af)},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/)?eb(n,t.head):i},af)},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=vt(n.getLine(r.line),r.ch,t),u.push(nh(t-e%t));n.replaceSelections(u)},defaultTab:function(n){n.somethingSelected()?n.indentSelection("add"):n.execCommand("insertTab")},transposeChars:function(i){return st(i,function(){for(var r,u,f,o=i.listSelections(),h=[],e=0;e<o.length;e++)o[e].empty()&&(r=o[e].head,u=t(i.doc,r.line).text,u&&((r.ch==u.length&&(r=new n(r.line,r.ch-1)),0<r.ch)?(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 s(r,r)));i.setSelections(h)})},newlineAndIndent:function(n){return st(n,function(){for(var r,t=n.listSelections(),i=t.length-1;0<=i;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);lu(n)})},openLine:function(n){return n.replaceSelection("\n","start")},toggleOverwrite:function(n){return n.toggleOverwrite()}};ob=new ki;cs=null;ls=function(n,t,i){this.time=n;this.pos=t;this.button=i};ls.prototype.compare=function(n,t,i){return this.time+400>n&&0==u(t,this.pos)&&i==this.button};var ef={toString:function(){return"CodeMirror.Init"}},bb={},as={};v.defaults=bb;v.optionHandlers=as;vs=[];v.defineInitHook=function(n){return vs.push(n)};pt=null;l=function(n){this.cm=n;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new ki;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};l.prototype.init=function(n){function e(n){var r,e,i,o,s;if(!b(t,n)){if(t.somethingSelected())ys({lineWise:!1,text:t.getSelections()}),"cut"==n.type&&t.replaceSelection("",null,"cut");else{if(!t.options.lineWiseCopyCut)return;r=gb(t);ys({lineWise:!0,text:r.text});"cut"==n.type&&t.operation(function(){t.setSelections(r.ranges,0,ti);t.replaceSelection("",null,"cut")})}if(n.clipboardData&&(n.clipboardData.clearData(),e=pt.text.join("\n"),n.clipboardData.setData("Text",e),n.clipboardData.getData("Text")==e))return void n.preventDefault();i=tk();o=i.firstChild;t.display.lineSpace.insertBefore(i,t.display.lineSpace.firstChild);o.value=pt.text.join("\n");s=document.activeElement;ru(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;nk(u,t.options.spellcheck,t.options.autocorrect,t.options.autocapitalize);r(u,"paste",function(n){b(t,n)||kb(n,t)||a<=11&&setTimeout(k(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)};l.prototype.prepareSelection=function(){var n=gy(this.cm,!1);return n.focus=this.cm.state.focused,n};l.prototype.showSelection=function(n,t){n&&this.cm.display.view.length&&((n.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(n))};l.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};l.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,h,v;if(t.display.viewTo==t.display.viewFrom||c.line>=t.display.viewTo||l.line<t.display.viewFrom)n.removeAllRanges();else if(r=ps(t,n.anchorNode,n.anchorOffset),f=ps(t,n.focusNode,n.focusOffset),!r||r.bad||!f||f.bad||0!=u(ho(r,f),c)||0!=u(so(r,f),l)){var a=t.display.view,e=c.line>=t.display.viewFrom&&rk(t,c)||{node:a[0].measure.map[2],offset:0},o=l.line<t.display.viewTo&&rk(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){v=n.rangeCount&&n.getRangeAt(0);try{h=tu(e.node,e.offset,o.offset,o.node)}catch(n){}h&&(!yi&&t.state.focused?(n.collapse(e.node,e.offset),h.collapsed||(n.removeAllRanges(),n.addRange(h))):(n.removeAllRanges(),n.addRange(h)),v&&null==n.anchorNode?n.addRange(v):yi&&this.startGracePeriod());this.rememberSelection()}else n.removeAllRanges()}};l.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)};l.prototype.showMultipleSelections=function(n){lt(this.cm.display.cursorDiv,n.cursors);lt(this.cm.display.selectionDiv,n.selection)};l.prototype.rememberSelection=function(){var n=this.getSelection();this.lastAnchorNode=n.anchorNode;this.lastAnchorOffset=n.anchorOffset;this.lastFocusNode=n.focusNode;this.lastFocusOffset=n.focusOffset};l.prototype.selectionInEditor=function(){var n=this.getSelection(),t;return n.rangeCount?(t=n.getRangeAt(0).commonAncestorContainer,bi(this.div,t)):!1};l.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())};l.prototype.blur=function(){this.div.blur()};l.prototype.getField=function(){return this.div};l.prototype.supportsTouch=function(){return!0};l.prototype.receivedFocus=function(){var n=this;this.selectionInEditor()?this.pollSelection():st(this.cm,function(){return n.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,function t(){n.cm.state.focused&&(n.pollSelection(),n.polling.set(n.cm.options.pollInterval,t))})};l.prototype.selectionChanged=function(){var n=this.getSelection();return n.anchorNode!=this.lastAnchorNode||n.anchorOffset!=this.lastAnchorOffset||n.focusNode!=this.lastFocusNode||n.focusOffset!=this.lastFocusOffset};l.prototype.pollSelection=function(){var n,t,i,r;if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){if(n=this.getSelection(),t=this.cm,ro&&io&&this.cm.options.gutters.length&&function(n){for(var t=n;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(n.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();this.composing||(this.rememberSelection(),i=ps(t,n.anchorNode,n.anchorOffset),r=ps(t,n.focusNode,n.focusOffset),i&&r&&st(t,function(){tt(t.doc,ir(i,r),ti);(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)}))}};l.prototype.pollContent=function(){var y,it,b,i,e,g,nt;null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var k,a,d,r=this.cm,f=r.display,tt=r.doc.sel.primary(),s=tt.from(),v=tt.to();if((0==s.ch&&s.line>r.firstLine()&&(s=n(s.line-1,t(r.doc,s.line-1).length)),v.ch==t(r.doc,v.line).text.length&&v.line<r.lastLine()&&(v=n(v.line+1,0)),s.line<f.viewFrom||v.line>f.viewTo-1)||(d=s.line==f.viewFrom||0==(k=wr(r,s.line))?(a=c(f.view[0].line),f.view[0].node):(a=c(f.view[k].line),f.view[k-1].node.nextSibling),b=wr(r,v.line),it=b==f.view.length-1?(y=f.viewTo-1,f.lineDiv.lastChild):(y=c(f.view[b+1].line)-1,f.view[b+1].node.previousSibling),!d))return!1;for(i=r.doc.splitLines(function(t,i,r,u,f){function l(){s&&(e+=h,o&&(e+=h),s=o=!1)}function c(n){n&&(l(),e+=n)}function a(i){var e,v,y,p,w,r,b;if(1==i.nodeType){if(e=i.getAttribute("cm-text"),e)return void c(e);if(y=i.getAttribute("cm-marker"),y)return p=t.findMarks(n(u,0),n(f+1,0),(b=+y,function(n){return n.id==b})),void(p.length&&(v=p[0].find(0))&&c(or(t.doc,v.from,v.to).join(h)));if("false"==i.getAttribute("contenteditable"))return;if(w=/^(pre|div|p|li|table|br)$/i.test(i.nodeName),!/^br$/i.test(i.nodeName)&&0==i.textContent.length)return;for(w&&l(),r=0;r<i.childNodes.length;r++)a(i.childNodes[r]);/^(pre|p)$/i.test(i.nodeName)&&(o=!0);w&&(s=!0)}else 3==i.nodeType&&c(i.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(var e="",s=!1,h=t.doc.lineSeparator(),o=!1;a(i),i!=r;)i=i.nextSibling,o=!1;return e}(r,d,it,a,y)),e=or(r.doc,n(a,0),n(y,t(r.doc,y).text.length));1<i.length&&1<e.length;)if(h(i)==h(e))i.pop(),e.pop(),y--;else{if(i[0]!=e[0])break;i.shift();e.shift();a++}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=h(i),w=h(e),et=Math.min(p.length-(1==i.length?o:0),w.length-(1==e.length?o:0));l<et&&p.charCodeAt(p.length-l-1)==w.charCodeAt(w.length-l-1);)++l;if(1==i.length&&1==e.length&&a==s.line)for(;o&&o>s.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+$/,""),g=n(a,o),nt=n(y,e.length?h(e).length-l:0),1<i.length||i[0]||u(g,nt)?(bu(r.doc,i,g,nt,"+input"),!0):void 0};l.prototype.ensurePolled=function(){this.forceCompositionEnd()};l.prototype.reset=function(){this.forceCompositionEnd()};l.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())};l.prototype.readFromDOMSoon=function(){var n=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(n.readDOMTimeout=null,n.composing){if(!n.composing.done)return;n.composing=null}n.updateFromDOM()},80))};l.prototype.updateFromDOM=function(){var n=this;!this.cm.isReadOnly()&&this.pollContent()||st(this.cm,function(){return ot(n.cm)})};l.prototype.setUneditable=function(n){n.contentEditable="false"};l.prototype.onKeyPress=function(n){0==n.charCode||this.composing||(n.preventDefault(),this.cm.isReadOnly()||k(this.cm,ra)(this.cm,String.fromCharCode(null==n.charCode?n.keyCode:n.charCode),0))};l.prototype.readOnlyChanged=function(n){this.div.contentEditable=String("nocursor"!=n)};l.prototype.onContextMenu=function(){};l.prototype.resetPosition=function(){};l.prototype.needsContentAttribute=!0;p=function(n){this.cm=n;this.prevInput="";this.pollingFast=!1;this.polling=new ki;this.hasSelection=!1;this.composing=null};p.prototype.init=function(n){function e(n){if(!b(t,n)){if(t.somethingSelected())ys({lineWise:!1,text:t.getSelections()});else{if(!t.options.lineWiseCopyCut)return;var r=gb(t);ys({lineWise:!0,text:r.text});"cut"==n.type?t.setSelections(r.ranges,null,ti):(u.prevInput="",i.value=r.text.join("\n"),ru(i))}"cut"==n.type&&(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);hf&&(i.style.width="0px");r(i,"input",function(){o&&9<=a&&f.hasSelection&&(f.hasSelection=null);u.poll()});r(i,"paste",function(n){b(t,n)||kb(n,t)||(t.state.pasteIncoming=+new Date,u.fastPoll())});r(i,"cut",e);r(i,"copy",e);r(n.scroller,"paste",function(r){if(!li(n,r)&&!b(t,r)){if(!i.dispatchEvent)return t.state.pasteIncoming=+new Date,void u.focus();var f=new Event("paste");f.clipboardData=r.clipboardData;i.dispatchEvent(f)}});r(n.lineSpace,"selectstart",function(t){li(n,t)||et(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)})};p.prototype.createField=function(){this.wrapper=tk();this.textarea=this.wrapper.firstChild};p.prototype.prepareSelection=function(){var n=this.cm,t=n.display,e=n.doc,i=gy(n);if(n.options.moveInputWithCursor){var r=dt(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};p.prototype.showSelection=function(n){var t=this.cm.display;lt(t.cursorDiv,n.cursors);lt(t.selectionDiv,n.selection);null!=n.teTop&&(this.wrapper.style.top=n.teTop+"px",this.wrapper.style.left=n.teLeft+"px")};p.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&&ru(this.textarea),o&&9<=a&&(this.hasSelection=i)):n||(this.prevInput=this.textarea.value="",o&&9<=a&&(this.hasSelection=null)))};p.prototype.getField=function(){return this.textarea};p.prototype.supportsTouch=function(){return!1};p.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!cf||si()!=this.textarea))try{this.textarea.focus()}catch(n){}};p.prototype.blur=function(){this.textarea.blur()};p.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};p.prototype.receivedFocus=function(){this.slowPoll()};p.prototype.slowPoll=function(){var n=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){n.poll();n.cm.state.focused&&n.slowPoll()})};p.prototype.fastPoll=function(){var t=!1,n=this;n.pollingFast=!0;n.polling.set(20,function i(){n.poll()||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,i))})};p.prototype.poll=function(){var i=this,n=this.cm,f=this.textarea,r=this.prevInput,t,e,u,s;if(this.contextMenuPending||!n.state.focused||pk(f)&&!r&&!this.composing||n.isReadOnly()||n.options.disableInput||n.state.keySeq||(t=f.value,t==r&&!n.somethingSelected()))return!1;if(o&&9<=a&&this.hasSelection===t||bt&&/[\uf700-\uf7ff]/.test(t))return n.display.input.reset(),!1;if(n.doc.sel==n.display.selForContextMenu&&(e=t.charCodeAt(0),8203!=e||r||(r="​"),8666==e))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 st(n,function(){ra(n,t.slice(u),r.length-u,null,i.composing?"*compose":null);1e3<t.length||-1<t.indexOf("\n")?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};p.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};p.prototype.onKeyPress=function(){o&&9<=a&&(this.hasSelection=null);this.fastPoll()};p.prototype.onContextMenu=function(n){function y(){if(null!=f.selectionStart){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=w,f.style.cssText=p,o&&a<9&&u.scrollbars.setScrollTop(u.scroller.scrollTop=c),null!=f.selectionStart)){(!o||o&&a<9)&&y();var r=0,n=function(){u.selForContextMenu==i.doc.sel&&0==f.selectionStart&&0<f.selectionEnd&&"​"==t.prevInput?k(i,lw)(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,e,c,h;if(t.contextMenuPending&&t.contextMenuPending(),e=pr(i,n),c=u.scroller.scrollTop,e&&!wt){i.options.resetSelectionOnContextMenu&&-1==i.doc.sel.contains(e)&&k(i,tt)(i.doc,ir(e),ti);var l,p=f.style.cssText,w=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: "+(o?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",rt&&(l=window.scrollY),u.input.focus(),rt&&window.scrollTo(null,l),u.input.reset(),i.somethingSelected()||(f.value=t.prevInput=" "),t.contextMenuPending=s,u.selForContextMenu=i.doc.sel,clearTimeout(u.detectingSelectAll),o&&9<=a&&y(),uo)?(kf(n),h=function(){at(window,"mouseup",h);setTimeout(s,20)},r(window,"mouseup",h)):setTimeout(s,50)}};p.prototype.readOnlyChanged=function(n){n||this.reset();this.textarea.disabled="nocursor"==n};p.prototype.setUneditable=function(){};p.prototype.needsContentAttribute=!1,function(t){function i(n,i,u,f){t.defaults[n]=i;u&&(r[n]=f?function(n,t,i){i!=ef&&u(n,t,i)}:u)}var r=t.optionHandlers;t.defineOption=i;t.Init=ef;i("value","",function(n,t){return n.setValue(t)},!0);i("mode",null,function(n,t){n.doc.modeOption=t;ll(n)},!0);i("indentUnit",2,ll,!0);i("indentWithTabs",!1);i("smartIndent",!0);i("tabSize",4,function(n){le(n);ie(n);ot(n)},!0);i("lineSeparator",null,function(t,i){var r,f,u;if(t.doc.lineSep=i)for(r=[],f=t.doc.first,t.doc.iter(function(t){for(var u,e=0;;){if(u=t.text.indexOf(i,e),-1==u)break;e=u+i.length;r.push(n(f,u))}f++}),u=r.length-1;0<=u;u--)bu(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!=ef&&n.refresh()});i("specialCharPlaceholder",kk,function(n){return n.refresh()},!0);i("electricChars",!0);i("inputStyle",cf?"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",!hk);i("wholeLineUpdateBefore",!0);i("theme","default",function(n){wb(n);ge(n)},!0);i("keyMap","default",function(n,t,i){var u=ss(t),r=i!=ef&&ss(i);r&&r.detach&&r.detach(n,u);u.attach&&u.attach(n,r||null)});i("extraKeys",null);i("configureMouse",null);i("lineWrapping",!1,rg,!0);i("gutters",[],function(n){hl(n.options);ge(n)},!0);i("fixedGutter",!0,function(n,t){n.display.gutters.style.left=t?kc(n.display)+"px":"0";n.refresh()},!0);i("coverGutterNextToScrollbar",!1,function(n){return vu(n)},!0);i("scrollbarStyle","native",function(n){hp(n);vu(n);n.display.scrollbars.setScrollTop(n.doc.scrollTop);n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0);i("lineNumbers",!1,function(n){hl(n.options);ge(n)},!0);i("firstLineNumber",1,ge,!0);i("lineNumberFormatter",function(n){return n},ge,!0);i("showCursorWhenSelecting",!1,re,!0);i("resetSelectionOnContextMenu",!0);i("lineWiseCopyCut",!0);i("pasteLinesPerSelection",!0);i("selectionsMayTouch",!1);i("readOnly",!1,function(n,t){"nocursor"==t&&(ue(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,ig);i("allowDropFileTypes",null);i("cursorBlinkRate",530);i("cursorScrollMargin",0);i("cursorHeight",1,re,!0);i("singleCursorHeightPerLine",!0,re,!0);i("workTime",100);i("workDelay",100);i("flattenSpans",!0,le,!0);i("addModeClass",!1,le,!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,le,!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)}(v);fa=(ni=v).optionHandlers;nu=ni.helpers={};ni.prototype={constructor:ni,focus:function(){window.focus();this.display.input.focus()},setOption:function(n,t){var i=this.options,r=i[n];i[n]==t&&"mode"!=n||(i[n]=t,fa.hasOwnProperty(n)&&k(this,fa[n])(this,t,r),w(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"](ss(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:ut(function(n,t){var i=n.token?n:ni.getMode(this.options,n);if(i.startState)throw new Error("Overlays may not be stateful.");!function(n,t,i){for(var r=0,u=i(t);r<n.length&&i(n[r])<=u;)r++;n.splice(r,0,t)}(this.state.overlays,{mode:i,modeSpec:n,opaque:t&&t.opaque,priority:t&&t.priority||0},function(n){return n.priority});this.state.modeGen++;ot(this)}),removeOverlay:ut(function(n){for(var r,i=this.state.overlays,t=0;t<i.length;++t)if(r=i[t].modeSpec,r==n||"string"==typeof n&&r.name==n)return i.splice(t,1),this.state.modeGen++,void ot(this)}),indentLine:ut(function(n,t,i){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract");pf(this.doc,n)&&no(this,n,t,i)}),indentSelection:ut(function(n){for(var r,f,e,t=this,o=this.doc.sel.ranges,u=-1,i=0;i<o.length;i++)if(r=o[i],r.empty())r.head.line>u&&(no(t,r.head.line,n,!0),u=r.head.line,i==t.doc.sel.primIndex&&lu(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)no(t,f,n);e=t.doc.sel.ranges;0==h.ch&&o.length==e.length&&0<e[i].from().ch&&pl(t.doc,i,new s(h,e[i].to()),ti)}}),getTokenAt:function(n,t){return yv(this,n,t)},getLineTokens:function(t,i){return yv(this,n(t),i,!0)},getTokenTypeAt:function(n){var i,e;n=f(this.doc,n);var r,u=av(this,t(this.doc,n.line)),s=0,h=(u.length-1)/2,o=n.ch;if(0==o)r=u[2];else for(;;)if(i=s+h>>1,(i?u[2*i-1]:0)>=o)h=i;else{if(!(u[2*i+1]<o)){r=u[2*i+2];break}s=i+1}return e=r?r.indexOf("overlay "):-1,e<0?r:0==e?null:r.slice(0,e-1)},getModeAt:function(n){var t=this.doc.mode;return t.innerMode?ni.innerMode(t,this.getTokenAt(n).state).mode:t},getHelper:function(n,t){return this.getHelpers(n,t)[0]},getHelpers:function(n,t){var u=[],r,i,f,s,e,o;if(!nu.hasOwnProperty(t))return u;if(r=nu[t],i=this.getModeAt(n),"string"==typeof i[t])r[i[t]]&&u.push(r[i[t]]);else if(i[t])for(f=0;f<i[t].length;f++)s=r[i[t][f]],s&&u.push(s);else i.helperType&&r[i.helperType]?u.push(r[i.helperType]):r[i.name]&&u.push(r[i.name]);for(e=0;e<r._global.length;e++)o=r._global[e],o.pred(i,this)&&-1==g(u,o.val)&&u.push(o.val);return u},getStateAfter:function(n,t){var i=this.doc;return gf(this,(n=ba(i,null==n?i.first+i.size-1:n))+1,t).state},cursorCoords:function(n,t){var i=this.doc.sel.primary();return dt(this,null==n?i.head:"object"==typeof n?f(this.doc,n):n?i.from():i.to(),t||"page")},charCoords:function(n,t){return vc(this,f(this.doc,n),t||"page")},coordsChar:function(n,t){return pc(this,(n=py(this,n,t||"page")).left,n.top)},lineAtHeight:function(n,t){return n=py(this,{top:n,left:0},t||"page").top,sr(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,i,r){var u,f=!1,e;return"number"==typeof n?(e=this.doc.first+this.doc.size-1,n<this.doc.first?n=this.doc.first:e<n&&(n=e,f=!0),u=t(this.doc,n)):u=n,ko(this,u,{top:0,left:0},i||"page",r||f).top+(f?this.doc.height-hi(u):0)},defaultTextHeight:function(){return hu(this.display)},defaultCharWidth:function(){return cu(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,t,i,r,u){var h,v,c,o=this.display,s=(n=dt(this,f(this.doc,n))).bottom,e=n.left,l,a;(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)?s=n.top:("above"==r||"near"==r)&&(l=Math.max(o.wrapper.clientHeight,this.doc.height),a=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth),("above"==r||n.bottom+t.offsetHeight>l)&&n.top>t.offsetHeight?s=n.top-t.offsetHeight:n.bottom+t.offsetHeight<=l&&(s=n.bottom),e+t.offsetWidth>a&&(e=a-t.offsetWidth));t.style.top=s+"px";t.style.left=t.style.right="";"right"==u?(e=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==u?e=0:"middle"==u&&(e=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=e+"px");i&&(h=this,v={left:e,top:s,right:e+t.offsetWidth,bottom:s+t.offsetHeight},null!=(c=il(h,v)).scrollTop&&ee(h,c.scrollTop),null!=c.scrollLeft&&br(h,c.scrollLeft))},triggerOnKeyDown:ut(cb),triggerOnKeyPress:ut(ab),triggerOnKeyUp:lb,triggerOnMouseDown:ut(vb),execCommand:function(n){if(ff.hasOwnProperty(n))return ff[n].call(null,this)},triggerElectric:ut(function(n){db(this,n)}),findPosH:function(n,t,i,r){var o=1,u,e;for(t<0&&(o=-1,t=-t),u=f(this.doc,n),e=0;e<t&&!(u=ua(this.doc,u,o,i,r)).hitSide;++e);return u},moveH:ut(function(n,t){var i=this;this.extendSelectionsBy(function(r){return i.display.shift||i.doc.extend||r.empty()?ua(i.doc,r.head,n,t,i.options.rtlMoveVisually):n<0?r.from():r.to()},af)}),deleteH:ut(function(n,t){var r=this.doc.sel,i=this.doc;r.somethingSelected()?i.replaceSelection("",null,"+delete"):uf(this,function(r){var u=ua(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=1,o=r,u,s,e;for(t<0&&(h=-1,t=-t),u=f(this.doc,n),s=0;s<t;++s)if(e=dt(this,u,"div"),null==o?o=e.left:e.left=o,(u=ik(this,e,h,i)).hitSide)break;return u},moveV:ut(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=dt(u,r.head,"div"),null!=r.goalColumn&&(o.left=r.goalColumn),f.push(o.left),s=ik(u,o,n,t),"page"==t&&r==i.sel.primary()&&rl(u,vc(u,s,"div").top-o.top),s)},af),f.length)for(r=0;r<i.sel.ranges.length;r++)i.sel.ranges[r].goalColumn=f[r]}),findWordAt:function(i){var u=t(this.doc,i.line).text,r=i.ch,f=i.ch,e,o,h;if(u){for(e=this.getHelper(i,"wordChars"),"before"!=i.sticky&&f!=u.length||!r?++f:--r,o=u.charAt(r),h=oo(o,e)?function(n){return oo(n,e)}:/\s/.test(o)?function(n){return/\s/.test(n)}:function(n){return!/\s/.test(n)&&!oo(n)};0<r&&h(u.charAt(r-1));)--r;for(;f<u.length&&h(u.charAt(f));)++f}return new s(n(i.line,r),n(i.line,f))},toggleOverwrite:function(n){null!=n&&n==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?fr(this.display.cursorDiv,"CodeMirror-overwrite"):pi(this.display.cursorDiv,"CodeMirror-overwrite"),w(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==si()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ut(function(n,t){fe(this,n,t)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-fi(this)-this.display.barHeight,width:n.scrollWidth-fi(this)-this.display.barWidth,clientHeight:hc(this),clientWidth:vr(this)}},scrollIntoView:ut(function(t,i){var r,u;null==t?(t={from:this.doc.sel.primary().head,to:null},null==i&&(i=this.options.cursorScrollMargin)):"number"==typeof t?t={from:n(t,0),to:null}:null==t.from&&(t={from:t,to:null});t.to||(t.to=t.from);t.margin=i||0;null!=t.from.line?(u=t,ts(r=this),r.curOp.scrollToPos=u):ep(this,t.from,t.to,t.margin)}),setSize:ut(function(n,t){var u=this,r=function(n){return"number"==typeof n||/^\d+$/.test(String(n))?n+"px":n},i;null!=n&&(this.display.wrapper.style.width=r(n));null!=t&&(this.display.wrapper.style.height=r(t));this.options.lineWrapping&&ay(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){nr(u,i,"widget");break}++i});this.curOp.forceUpdate=!0;w(this,"refresh",this)}),operation:function(n){return st(this,n)},startOperation:function(){return kr(this)},endOperation:function(){return dr(this)},refresh:ut(function(){var n=this.display.cachedTextHeight;ot(this);this.curOp.forceUpdate=!0;ie(this);fe(this,this.doc.scrollLeft,this.doc.scrollTop);ol(this);(null==n||.5<Math.abs(n-hu(this.display)))&&dc(this);w(this,"refresh",this)}),swapDoc:ut(function(n){var t=this.doc;return t.cm=null,dp(this,n),ie(this),this.display.input.reset(),fe(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,nt(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}};fu(ni);ni.registerHelper=function(n,t,i){nu.hasOwnProperty(n)||(nu[n]=ni[n]={_global:[]});nu[n][t]=i};ni.registerGlobalHelper=function(n,t,i,r){ni.registerHelper(n,t,r);nu[n]._global.push({pred:i,val:r})};uk="iter insert remove copy getEditor constructor".split(" ");for(to in ft.prototype)ft.prototype.hasOwnProperty(to)&&g(uk,to)<0&&(v.prototype[to]=function(n){return function(){return n.apply(this.doc,arguments)}}(ft.prototype[to]));return fu(ft),v.inputStyles={textarea:p,contenteditable:l},v.defineMode=function(n){v.defaults.mode||"null"==n||(v.defaults.mode=n),function(n,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2));tc[n]=t}.apply(this,arguments)},v.defineMIME=function(n,t){eu[n]=t},v.defineMode("null",function(){return{token:function(n){return n.skipToEnd()}}}),v.defineMIME("text/plain","null"),v.defineExtension=function(n,t){v.prototype[n]=t},v.defineDocExtension=function(n,t){ft.prototype[n]=t},v.fromTextArea=function(n,t){function u(){n.value=s.getValue()}var f,e,i,o,s;if(((t=t?er(t):{}).value=n.value,!t.tabindex&&n.tabIndex&&(t.tabindex=n.tabIndex),!t.placeholder&&n.placeholder&&(t.placeholder=n.placeholder),null==t.autofocus)&&(f=si(),t.autofocus=f==n||null!=n.getAttribute("autofocus")&&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(t){}}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&&(at(n.form,"submit",u),"function"==typeof n.form.submit&&(n.form.submit=e))}},n.style.display="none",s=v(function(t){return n.parentNode.insertBefore(t,n.nextSibling)},t)},(e=v).off=at,e.on=r,e.wheelEventPixels=vd,e.Doc=ft,e.splitLines=gh,e.countColumn=vt,e.findColumn=gs,e.isWordChar=th,e.Pass=fo,e.signal=w,e.Line=lr,e.changeEnd=rr,e.scrollbarModel=ul,e.Pos=n,e.cmpPos=u,e.modes=tc,e.mimeModes=eu,e.resolveMode=po,e.getMode=ic,e.modeExtensions=hr,e.extendMode=bk,e.copyState=cr,e.startState=cv,e.innerMode=rc,e.commands=ff,e.keyMap=oi,e.keyName=ub,e.isModifierKey=ib,e.lookupKey=rf,e.normalizeKeyMap=ng,e.StringStream=y,e.SharedTextMarker=gu,e.TextMarker=ai,e.LineWidget=ku,e.e_preventDefault=et,e.e_stopPropagation=ov,e.e_stop=kf,e.addClass=fr,e.contains=bi,e.rmClass=pi,e.keyNames=vi,v.version="5.44.0",v});!function(n){"object"==typeof exports&&"object"==typeof module?n(require("../../")):"function"==typeof define&&define.amd?define(["../../"],n):n(CodeMirror)}(function(n){function i(n){n.state.placeholder&&(n.state.placeholder.parentNode.removeChild(n.state.placeholder),n.state.placeholder=null)}function u(n){var t,r;i(n);t=n.state.placeholder=document.createElement("pre");t.style.cssText="height: 0; overflow: visible; color:#ABB1BA; font-family: Arial, Helvetica, sans-serif;";t.style.direction=n.getOption("direction");t.className="CodeMirror-placeholder";r=n.getOption("placeholder");"string"==typeof r&&(r=document.createTextNode(r));t.appendChild(r);n.display.lineSpace.insertBefore(t,n.display.lineSpace.firstChild)}function r(n){f(n)&&u(n)}function t(n){var t=n.getWrapperElement(),r=f(n);t.className=t.className.replace(" CodeMirror-empty","")+(r?" CodeMirror-empty":"");r?u(n):i(n)}function f(n){return 1===n.lineCount()&&""===n.getLine(0)}n.defineOption("placeholder","",function(u,f,e){var s=e&&e!=n.Init,o;f&&!s?(u.on("blur",r),u.on("change",t),u.on("swapDoc",t),t(u)):!f&&s&&(u.off("blur",r),u.off("change",t),u.off("swapDoc",t),i(u),o=u.getWrapperElement(),o.className=o.className.replace(" CodeMirror-empty",""));f&&!u.hasFocus()&&r(u)})});$(document).ready(function(){var n=$("#search-area")[0],t;if(n){t=CodeMirror.fromTextArea(n,{lineNumbers:!0,autofocus:!0,lineWrapping:!0,gutter:!0,fixedGutter:!0,extraKeys:{Enter:i,Backspace:r},maxLine:5}).on("change",function(n){var i=n.getDoc().getValue(),t=n.lineCount();$("#searchButton").addClass("badge");t>5?$("#searchButton").attr("data-badge",5):$("#searchButton").attr("data-badge",t);$.isBlank(i)||$("#q").val(n.getDoc().getValue(","))});$("#searchButton").click(function(){for(var i=$("#q").val().split(","),t="",r=0,n=0;n<i.length;n++){if(r>=5)break;$.isBlank(i[n])||(n!=0&&t!=""&&(t+=","),t+=i[n],r++)}t!=""?($("#SearchValue").val(t),$("#searchForm").submit()):($("#error-message").html("En az bir adet barkod numarası giriniz."),$("#warning").fadeIn(750),setTimeout(function(){$("#warning").fadeOut(750)},3e3))});function i(n){var t=n.lineCount();return n.getValue()!=""||n.getValue()!="\n"?($("#searchButton").addClass("badge"),t>5?$("#searchButton").attr("data-badge",5):$("#searchButton").attr("data-badge",t)):$("#searchButton").removeClass("badge"),CodeMirror.Pass}function r(n){var t=n.lineCount();return t!=0&&$("#searchButton").attr("data-badge",t-1),t==1&&$("#searchButton").removeClass("badge"),CodeMirror.Pass}(function(n){n.isBlank=function(t){return!t||n.trim(t)===""}})(jQuery)}})