D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
usr
/
share
/
psa-roundcube
/
plugins
/
managesieve
/
codemirror
/
lib
/
Filename :
codemirror.min.js
back
Copy
((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).CodeMirror=t()})(this,function(){var e=navigator.userAgent,s=navigator.platform,G=/gecko\/\d/i.test(e),t=/MSIE \d/.test(e),a=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),u=/Edge\/(\d+)/.exec(e),w=t||a||u,v=w&&(t?document.documentMode||6:+(u||a)[1]),x=!u&&/WebKit\//.test(e),t=x&&/Qt\/\d+\.\d+/.test(e),c=!u&&/Chrome\//.test(e),U=/Opera\//.test(e),V=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),K=/PhantomJS/.test(e),j=!u&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),X=/Android/.test(e),Y=j||X||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),C=j||/Mac/.test(s),_=/\bCrOS\b/.test(e),a=/win/i.test(s),u=U&&e.match(/Version\/(\d*\.\d*)/),$=((u=u&&Number(u[1]))&&15<=u&&(x=!(U=!1)),C&&(t||U&&(null==u||u<12.11))),q=G||w&&9<=v;function Z(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var Q=function(e,t){var n,r=e.className,t=Z(t).exec(r);t&&(n=r.slice(t.index+t[0].length),e.className=r.slice(0,t.index)+(n?t[1]+n:""))};function J(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function y(e,t){return J(e).appendChild(t)}function H(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function ee(e,t,n,r){e=H(e,t,n,r);return e.setAttribute("role","presentation"),e}function te(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if((t=11==t.nodeType?t.host:t)==e)return!0}while(t=t.parentNode)}function ne(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function re(e,t){var n=e.className;Z(t).test(n)||(e.className+=(n?" ":"")+t)}function ie(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!Z(n[r]).test(t)&&(t+=" "+n[r]);return t}var oe=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r},le=function(e){e.select()};function se(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ae(e,t,n){for(var r in t=t||{},e)!e.hasOwnProperty(r)||!1===n&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function ue(e,t,n,r,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=r||0,l=i||0;;){var s=e.indexOf("\t",o);if(s<0||t<=s)return l+(t-o);l=(l+=s-o)+(n-l%n),o=s+1}}j?le=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:w&&(le=function(e){try{e.select()}catch(e){}});function ce(){this.id=null,this.f=null,this.time=0,this.handler=se(this.onTimeout,this)}function S(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}ce.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)};var he=50,de={toString:function(){return"CodeMirror.Pass"}},fe={scroll:!(ce.prototype.set=function(e,t){this.f=t;t=+new Date+e;(!this.id||t<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=t)})},pe={origin:"*mouse"},ge={origin:"+move"};function me(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r),l=(o=-1==o?e.length:o)-r;if(o==e.length||t<=i+l)return r+Math.min(l,t-i);if(i+=o-r,r=o+1,t<=(i+=n-i%n))return r}}var ve=[""];function ye(e){for(;ve.length<=e;)ve.push(z(ve)+" ");return ve[e]}function z(e){return e[e.length-1]}function be(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function we(){}function xe(e,t){e=Object.create?Object.create(e):(we.prototype=e,new we);return t&&ae(t,e),e}var Ce=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Se(e){return/\w/.test(e)||""<e&&(e.toUpperCase()!=e.toLowerCase()||Ce.test(e))}function Le(e,t){return t?!!(-1<t.source.indexOf("\\w")&&Se(e))||t.test(e):Se(e)}function ke(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return;return 1}var Te=/[\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]/;function Me(e){return 768<=e.charCodeAt(0)&&Te.test(e)}function Ne(e,t,n){for(;(n<0?0<t:t<e.length)&&Me(e.charAt(t));)t+=n;return t}function Oe(e,t,n){for(var r=n<t?-1:1;;){if(t==n)return t;var i=(t+n)/2,i=r<0?Math.ceil(i):Math.floor(i);if(i==t)return e(i)?t:n;e(i)?n=i:t=i+r}}var Ae=null;function De(e,t,n){var r;Ae=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:Ae=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:Ae=i)}return null!=r?r:Ae}We=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,He=/[stwN]/,Fe=/[LRr]/,Ee=/[Lb1n]/,Pe=/[1n]/;var We,He,Fe,Ee,Pe,Ie=function(e,t){var n="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!We.test(e))return!1;for(var r,i=e.length,o=[],l=0;l<i;++l)o.push((r=e.charCodeAt(l))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(r):1424<=r&&r<=1524?"R":1536<=r&&r<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(r-1536):1774<=r&&r<=2220?"r":8192<=r&&r<=8203?"w":8204==r?"b":"L");for(var s=0,a=n;s<i;++s){var u=o[s];"m"==u?o[s]=a:a=u}for(var c=0,h=n;c<i;++c){var d=o[c];"1"==d&&"r"==h?o[c]="n":Fe.test(d)&&"r"==(h=d)&&(o[c]="R")}for(var f=1,p=o[0];f<i-1;++f){var g=o[f];"+"==g&&"1"==p&&"1"==o[f+1]?o[f]="1":","!=g||p!=o[f+1]||"1"!=p&&"n"!=p||(o[f]=p),p=g}for(var m=0;m<i;++m){var v=o[m];if(","==v)o[m]="N";else if("%"==v){for(var y=void 0,y=m+1;y<i&&"%"==o[y];++y);for(var b=m&&"!"==o[m-1]||y<i&&"1"==o[y]?"1":"N",w=m;w<y;++w)o[w]=b;m=y-1}}for(var x=0,C=n;x<i;++x){var S=o[x];"L"==C&&"1"==S?o[x]="L":Fe.test(S)&&(C=S)}for(var L=0;L<i;++L)if(He.test(o[L])){for(var k=void 0,k=L+1;k<i&&He.test(o[k]);++k);for(var T="L"==(L?o[L-1]:n),M=T==("L"==(k<i?o[k]:n))?T?"L":"R":n,N=L;N<k;++N)o[N]=M;L=k-1}for(var O,A=[],D=0;D<i;)if(Ee.test(o[D])){var P=D;for(++D;D<i&&Ee.test(o[D]);++D);A.push(new ze(0,P,D))}else{var W=D,H=A.length,F="rtl"==t?1:0;for(++D;D<i&&"L"!=o[D];++D);for(var E=W;E<D;)if(Pe.test(o[E])){W<E&&(A.splice(H,0,new ze(1,W,E)),H+=F);var I=E;for(++E;E<D&&Pe.test(o[E]);++E);A.splice(H,0,new ze(2,I,E)),H+=F,W=E}else++E;W<D&&A.splice(H,0,new ze(1,W,D))}return"ltr"==t&&(1==A[0].level&&(O=e.match(/^\s+/))&&(A[0].from=O[0].length,A.unshift(new ze(0,0,O[0].length))),1==z(A).level)&&(O=e.match(/\s+$/))&&(z(A).to-=O[0].length,A.push(new ze(0,i-O[0].length,i))),"rtl"==t?A.reverse():A};function ze(e,t,n){this.level=e,this.from=t,this.to=n}function Re(e,t){var n=e.order;return n=null==n?e.order=Ie(e.text,t):n}var Be=[],L=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):(e=e._handlers||(e._handlers={}))[t]=(e[t]||Be).concat(n)};function Ge(e,t){return e._handlers&&e._handlers[t]||Be}function k(e,t,n){var r;e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):(r=(e=e._handlers)&&e[t])&&-1<(n=S(r,n))&&(e[t]=r.slice(0,n).concat(r.slice(n+1)))}function F(e,t){var n=Ge(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function E(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),F(e,n||t.type,e,t),Xe(t)||t.codemirrorIgnore}function Ue(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==S(n,t[r])&&n.push(t[r])}function Ve(e,t){return 0<Ge(e,t).length}function Ke(e){e.prototype.on=function(e,t){L(this,e,t)},e.prototype.off=function(e,t){k(this,e,t)}}function T(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function je(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Xe(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ye(e){T(e),je(e)}function _e(e){return e.target||e.srcElement}function $e(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),t=C&&e.ctrlKey&&1==t?3:t}var qe,Ze,Qe=!(w&&v<9)&&("draggable"in(s=H("div"))||"dragDrop"in s);var Je=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t),o=(-1==i&&(i=e.length),e.slice(t,"\r"==e.charAt(i-1)?i-1:i)),l=o.indexOf("\r");-1!=l?(n.push(o.slice(0,l)),t+=l+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},et=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},tt="oncopy"in(e=H("div"))||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy),nt=null;var rt={},it={};function ot(e){if("string"==typeof e&&it.hasOwnProperty(e))e=it[e];else if(e&&"string"==typeof e.name&&it.hasOwnProperty(e.name)){var t=it[e.name];(e=xe(t="string"==typeof t?{name:t}:t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ot("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ot("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function lt(e,t){t=ot(t);var n=rt[t.name];if(!n)return lt(e,"text/plain");var r=n(e,t);if(st.hasOwnProperty(t.name)){var i,o=st[t.name];for(i in o)o.hasOwnProperty(i)&&(r.hasOwnProperty(i)&&(r["_"+i]=r[i]),r[i]=o[i])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)r[l]=t.modeProps[l];return r}var st={};function at(e,t){ae(t,st.hasOwnProperty(e)?st[e]:st[e]={})}function ut(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n,r={};for(n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function ct(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function ht(e,t,n){return!e.startState||e.startState(t,n)}var g=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function M(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function dt(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){e=e.text;i==n.line&&(e=e.slice(0,n.ch)),i==t.line&&(e=e.slice(t.ch)),r.push(e),++i}),r}function ft(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function pt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function N(e){if(null==e.parent)return null;for(var t=e.parent,n=S(t.lines,e),r=t.parent;r;r=(t=r).parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function gt(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var l=0;l<e.lines.length;++l){var s=e.lines[l].height;if(t<s)break;t-=s}return n+l}function mt(e,t){return t>=e.first&&t<e.first+e.size}function vt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function P(e,t,n){if(void 0===n&&(n=null),!(this instanceof P))return new P(e,t,n);this.line=e,this.ch=t,this.sticky=n}function O(e,t){return e.line-t.line||e.ch-t.ch}function yt(e,t){return e.sticky==t.sticky&&0==O(e,t)}function bt(e){return P(e.line,e.ch)}function wt(e,t){return O(e,t)<0?t:e}function xt(e,t){return O(e,t)<0?e:t}function Ct(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function I(e,t){var n;return t.line<e.first?P(e.first,0):(n=e.first+e.size-1)<t.line?P(n,M(e,n).text.length):(e=M(e,(n=t).line).text.length,null==(t=n.ch)||e<t?P(n.line,e):t<0?P(n.line,0):n)}function St(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=I(e,t[r]);return n}g.prototype.eol=function(){return this.pos>=this.string.length},g.prototype.sol=function(){return this.pos==this.lineStart},g.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},g.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},g.prototype.eat=function(e){var t=this.string.charAt(this.pos),e="string"==typeof e?t==e:t&&(e.test?e.test(t):e(t));if(e)return++this.pos,t},g.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},g.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},g.prototype.skipToEnd=function(){this.pos=this.string.length},g.prototype.skipTo=function(e){e=this.string.indexOf(e,this.pos);if(-1<e)return this.pos=e,!0},g.prototype.backUp=function(e){this.pos-=e},g.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ue(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ue(this.string,this.lineStart,this.tabSize):0)},g.prototype.indentation=function(){return ue(this.string,null,this.tabSize)-(this.lineStart?ue(this.string,this.lineStart,this.tabSize):0)},g.prototype.match=function(e,t,n){var r;return"string"!=typeof e?(r=this.string.slice(this.pos).match(e))&&0<r.index?null:(r&&!1!==t&&(this.pos+=r[0].length),r):(r=function(e){return n?e.toLowerCase():e})(this.string.substr(this.pos,e.length))==r(e)?(!1!==t&&(this.pos+=e.length),!0):void 0},g.prototype.current=function(){return this.string.slice(this.start,this.pos)},g.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},g.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},g.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var Lt=function(e,t){this.state=e,this.lookAhead=t},kt=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function Tt(t,n,r,e){for(var a=[t.state.modeGen],i={},u=(Et(t,n.text,t.doc.mode,r,function(e,t){a.push(e,t)},i,e),r.state),o=0;o<t.state.overlays.length;++o)(e=>{r.baseTokens=a;var o=t.state.overlays[e],l=1,s=0;r.state=!0,Et(t,n.text,o.mode,r,function(e,t){for(var n=l;s<e;){var r=a[l];e<r&&a.splice(l,1,e,a[l+1],r),l+=2,s=Math.min(e,r)}if(t)if(o.opaque)a.splice(n,l-n,e,"overlay "+t),l=n+2;else for(;n<l;n+=2){var i=a[n+1];a[n+1]=(i?i+" ":"")+"overlay "+t}},i),r.state=u,r.baseTokens=null,r.baseTokenPos=1})(o);return{styles:a,classes:i.bgClass||i.textClass?i:null}}function Mt(e,t,n){var r,i,o;return t.styles&&t.styles[0]==e.state.modeGen||(r=Nt(e,N(t)),i=t.text.length>e.options.maxHighlightLength&&ut(e.doc.mode,r.state),o=Tt(e,t,r),i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))),t.styles}function Nt(n,r,e){var t,i,o,l=n.doc,s=n.display;return l.mode.startState?(t=((e,t,n)=>{for(var r,i,o=e.doc,l=n?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;l<s;--s){if(s<=o.first)return o.first;var a=M(o,s-1),u=a.stateAfter;if(u&&(!n||s+(u instanceof Lt?u.lookAhead:0)<=o.modeFrontier))return s;u=ue(a.text,null,e.options.tabSize);(null==i||u<r)&&(i=s-1,r=u)}return i})(n,r,e),i=l.first<t&&M(l,t-1).stateAfter,o=i?kt.fromSaved(l,i,t):new kt(l,ht(l.mode),t),l.iter(t,r,function(e){Ot(n,e.text,o);var t=o.line;e.stateAfter=t==r-1||t%5==0||t>=s.viewFrom&&t<s.viewTo?o.save():null,o.nextLine()}),e&&(l.modeFrontier=o.line),o):new kt(l,!0,r)}function Ot(e,t,n,r){var i=e.doc.mode,o=new g(t,e.options.tabSize,n);for(o.start=o.pos=r||0,""==t&&At(i,n.state);!o.eol();)Dt(i,o,n.state),o.start=o.pos}function At(e,t){return e.blankLine?e.blankLine(t):e.innerMode&&(e=ct(e,t)).mode.blankLine?e.mode.blankLine(e.state):void 0}function Dt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=ct(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}kt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},kt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},kt.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},kt.fromSaved=function(e,t,n){return t instanceof Lt?new kt(e,ut(e.mode,t.state),n,t.lookAhead):new kt(e,ut(e.mode,t),n)},kt.prototype.save=function(e){e=!1!==e?ut(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new Lt(e,this.maxLookAhead):e};var Wt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ht(e,t,n,r){var i,o,l=e.doc,s=l.mode,a=M(l,(t=I(l,t)).line),u=Nt(e,t.line,n),c=new g(a.text,e.options.tabSize,u);for(r&&(o=[]);(r||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=Dt(s,c,u.state),r&&o.push(new Wt(c,i,ut(l.mode,u.state)));return r?o:new Wt(c,i,u.state)}function Ft(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Et(e,t,n,r,i,o,l){var s=n.flattenSpans,a=(null==s&&(s=e.options.flattenSpans),0),u=null,c=new g(t,e.options.tabSize,r),h=e.options.addModeClass&&[null];for(""==t&&Ft(At(n,r.state),o);!c.eol();){var d,f=c.pos>e.options.maxHighlightLength?(s=!1,l&&Ot(e,t,r,c.pos),c.pos=t.length,null):Ft(Dt(n,c,r.state,h),o);if(h&&(d=h[0].name)&&(f="m-"+(f?d+" "+f:d)),!s||u!=f){for(;a<c.start;)i(a=Math.min(c.start,a+5e3),u);u=f}c.start=c.pos}for(;a<c.pos;){var p=Math.min(c.pos,a+5e3);i(p,u),a=p}}var Pt=!1,It=!1;function zt(e,t,n){this.marker=e,this.from=t,this.to=n}function Rt(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Bt(e,t){if(t.full)return null;var n=mt(e,t.from.line)&&M(e,t.from.line).markedSpans,e=mt(e,t.to.line)&&M(e,t.to.line).markedSpans;if(!n&&!e)return null;var r=t.from.ch,i=t.to.ch,o=0==O(t.from,t.to),l=((e,t,n)=>{var r;if(e)for(var i=0;i<e.length;++i){var o,l=e[i],s=l.marker;!(null==l.from||(s.inclusiveLeft?l.from<=t:l.from<t))&&(l.from!=t||"bookmark"!=s.type||n&&l.marker.insertLeft)||(o=null==l.to||(s.inclusiveRight?l.to>=t:l.to>t),(r=r||[]).push(new zt(s,l.from,o?null:l.to)))}return r})(n,r,o),s=((e,t,n)=>{var r;if(e)for(var i=0;i<e.length;++i){var o,l=e[i],s=l.marker;!(null==l.to||(s.inclusiveRight?l.to>=t:l.to>t))&&(l.from!=t||"bookmark"!=s.type||n&&!l.marker.insertLeft)||(o=null==l.from||(s.inclusiveLeft?l.from<=t:l.from<t),(r=r||[]).push(new zt(s,o?null:l.from-t,null==l.to?null:l.to-t)))}return r})(e,i,o),a=1==t.text.length,u=z(t.text).length+(a?r:0);if(l)for(var c=0;c<l.length;++c){var h,d=l[c];null==d.to&&((h=Rt(s,d.marker))?a&&(d.to=null==h.to?null:h.to+u):d.to=r)}if(s)for(var f=0;f<s.length;++f){var p=s[f];null!=p.to&&(p.to+=u),null==p.from?Rt(l,p.marker)||(p.from=u,a&&(l=l||[]).push(p)):(p.from+=u,a&&(l=l||[]).push(p))}l=l&&Gt(l),s&&s!=l&&(s=Gt(s));var g=[l];if(!a){var m,v=t.text.length-2;if(0<v&&l)for(var y=0;y<l.length;++y)null==l[y].to&&(m=m||[]).push(new zt(l[y].marker,null,null));for(var b=0;b<v;++b)g.push(m);g.push(s)}return g}function Gt(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Ut(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Vt(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Kt(e){return e.inclusiveLeft?-1:0}function jt(e){return e.inclusiveRight?1:0}function Xt(e,t){var n,r,i=e.lines.length-t.lines.length;return 0!=i?i:(i=e.find(),n=t.find(),(r=O(i.from,n.from)||Kt(e)-Kt(t))?-r:O(i.to,n.to)||jt(e)-jt(t)||t.id-e.id)}function Yt(e,t){var n,r=It&&e.markedSpans;if(r)for(var i,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!n||Xt(n,i.marker)<0)&&(n=i.marker);return n}function _t(e){return Yt(e,!0)}function $t(e){return Yt(e,!1)}function qt(e,t,n,r,i){var e=M(e,t),o=It&&e.markedSpans;if(o)for(var l=0;l<o.length;++l){var s=o[l];if(s.marker.collapsed){var a=s.marker.find(0),u=O(a.from,n)||Kt(s.marker)-Kt(i),c=O(a.to,r)||jt(s.marker)-jt(i);if(!(0<=u&&c<=0||u<=0&&0<=c)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?0<=O(a.to,n):0<O(a.to,n))||0<=u&&(s.marker.inclusiveRight&&i.inclusiveLeft?O(a.from,r)<=0:O(a.from,r)<0)))return 1}}}function Zt(e){for(var t;t=_t(e);)e=t.find(-1,!0).line;return e}function Qt(e,t){var e=M(e,t),n=Zt(e);return e==n?t:N(n)}function Jt(e,t){if(t>e.lastLine())return t;var n,r=M(e,t);if(!en(e,r))return t;for(;n=$t(r);)r=n.find(1,!0).line;return N(r)+1}function en(e,t){var n=It&&t.markedSpans;if(n)for(var r,i=0;i<n.length;++i)if((r=n[i]).marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&function e(t,n,r){{var i;if(null==r.to)return i=r.marker.find(1,!0),e(t,i.line,Rt(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==n.text.length)return!0;for(var o=void 0,l=0;l<n.markedSpans.length;++l)if((o=n.markedSpans[l]).marker.collapsed&&!o.marker.widgetNode&&o.from==r.to&&(null==o.to||o.to!=r.from)&&(o.marker.inclusiveLeft||r.marker.inclusiveRight)&&e(t,n,o))return!0}(e,t,r))return!0}}function tn(e){for(var t=0,n=(e=Zt(e)).parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;o=(n=o).parent)for(var l=0;l<o.children.length;++l){var s=o.children[l];if(s==n)break;t+=s.height}return t}function nn(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=_t(r);){var i=t.find(0,!0),r=i.from.line;n+=i.from.ch-i.to.ch}for(r=e;t=$t(r);)var o=t.find(0,!0),n=(n-=r.text.length-o.from.ch)+((r=o.to.line).text.length-o.to.ch);return n}function rn(e){var n=e.display,e=e.doc;n.maxLine=M(e,e.first),n.maxLineLength=nn(n.maxLine),n.maxLineChanged=!0,e.iter(function(e){var t=nn(e);t>n.maxLineLength&&(n.maxLineLength=t,n.maxLine=e)})}var on=function(e,t,n){this.text=e,Vt(this,t),this.height=n?n(this):1};on.prototype.lineNo=function(){return N(this)},Ke(on);var ln={},sn={};function an(e,t){return!e||/^\s*$/.test(e)?null:(t=t.addModeClass?sn:ln)[e]||(t[e]=e.replace(/\S+/g,"cm-$&"))}function un(e,t){var n=ee("span",null,null,x?"padding-right: .1px":null),r={pre:ee("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i,o,l=0;l<=(t.rest?t.rest.length:0);l++){var s=l?t.rest[l-1]:t.line,a=void 0,u=(r.pos=0,r.addToken=hn,u=e.display.measure,o=i=void 0,(null!=Ze?Ze:(o=y(u,document.createTextNode("AخA")),i=oe(o,0,1).getBoundingClientRect(),o=oe(o,1,2).getBoundingClientRect(),J(u),i&&i.left!=i.right&&(Ze=o.right-i.right<3)))&&(a=Re(s,e.doc.direction))&&(r.addToken=((h,d)=>function(e,t,n,r,i,o,l){n=n?n+" cm-force-border":"cm-force-border";for(var s=e.pos,a=s+t.length;;){for(var u=void 0,c=0;c<d.length&&!((u=d[c]).to>s&&u.from<=s);c++);if(u.to>=a)return h(e,t,n,r,i,o,l);h(e,t.slice(0,u.to-s),n,r,null,o,l),r=null,t=t.slice(u.to-s),s=u.to}})(r.addToken,a)),r.map=[],t!=e.display.externalMeasured&&N(s));((e,t,n)=>{var r=e.markedSpans,i=e.text,o=0;if(r)for(var l,s,a,u,c,h,d,f=i.length,p=0,g=1,m="",v=0;;){if(v==p){a=u=c=s="",h=d=null,v=1/0;for(var y=[],b=void 0,w=0;w<r.length;++w){var x=r[w],C=x.marker;if("bookmark"==C.type&&x.from==p&&C.widgetNode)y.push(C);else if(x.from<=p&&(null==x.to||x.to>p||C.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,u=""),C.className&&(a+=" "+C.className),C.css&&(s=(s?s+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==v&&(b=b||[]).push(C.endStyle,x.to),C.title&&((d=d||{}).title=C.title),C.attributes)for(var S in C.attributes)(d=d||{})[S]=C.attributes[S];C.collapsed&&(!h||Xt(h.marker,C)<0)&&(h=x)}else x.from>p&&v>x.from&&(v=x.from)}if(b)for(var L=0;L<b.length;L+=2)b[L+1]==v&&(u+=" "+b[L]);if(!h||h.from==p)for(var k=0;k<y.length;++k)dn(t,0,y[k]);if(h&&(h.from||0)==p){if(dn(t,(null==h.to?f+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(f<=p)break;for(var T=Math.min(f,v);;){if(m){var M,N=p+m.length;if(h||(M=T<N?m.slice(0,T-p):m,t.addToken(t,M,l?l+a:a,c,p+M.length==v?u:"",s,d)),T<=N){m=m.slice(T-p),p=T;break}p=N,c=""}m=i.slice(o,o=n[g++]),l=an(n[g++],t.cm.options)}}else for(var O=1;O<n.length;O+=2)t.addToken(t,i.slice(o,o=n[O]),an(n[O+1],t.cm.options))})(s,r,Mt(e,s,u)),s.styleClasses&&(s.styleClasses.bgClass&&(r.bgClass=ie(s.styleClasses.bgClass,r.bgClass||"")),s.styleClasses.textClass)&&(r.textClass=ie(s.styleClasses.textClass,r.textClass||"")),0==r.map.length&&r.map.push(0,0,r.content.appendChild((o=e.display.measure,i=void 0,(o=(qe=null==qe&&(i=H("span",""),y(o,H("span",[i,document.createTextNode("x")])),0!=o.firstChild.offsetHeight)?i.offsetWidth<=1&&2<i.offsetHeight&&!(w&&v<8):qe)?H("span",""):H("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")).setAttribute("cm-text",""),o))),0==l?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return x&&(n=r.content.lastChild,/\bcm-tab\b/.test(n.className)||n.querySelector&&n.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack"),F(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=ie(r.pre.className,r.textClass||"")),r}function cn(e){var t=H("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function hn(e,t,n,r,i,o,l){if(t){var s=e.splitSpaces?((e,t)=>{if(1<e.length&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r})(t,e.trailingSpace):t,a=e.cm.state.specialChars,u=!1;if(a.test(t))for(var c=document.createDocumentFragment(),h=0;;){a.lastIndex=h;var d=a.exec(t),f=d?d.index-h:t.length-h;if(f&&(p=document.createTextNode(s.slice(h,h+f)),w&&v<9?c.appendChild(H("span",[p])):c.appendChild(p),e.map.push(e.pos,e.pos+f,p),e.col+=f,e.pos+=f),!d)break;h+=1+f;var p=void 0;"\t"==d[0]?(f=e.cm.options.tabSize,(p=c.appendChild(H("span",ye(f=f-e.col%f),"cm-tab"))).setAttribute("role","presentation"),p.setAttribute("cm-text","\t"),e.col+=f):("\r"==d[0]||"\n"==d[0]?(p=c.appendChild(H("span","\r"==d[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",d[0]):((p=e.cm.options.specialCharPlaceholder(d[0])).setAttribute("cm-text",d[0]),w&&v<9?c.appendChild(H("span",[p])):c.appendChild(p)),e.col+=1),e.map.push(e.pos,e.pos+1,p),e.pos++}else e.col+=t.length,c=document.createTextNode(s),e.map.push(e.pos,e.pos+t.length,c),w&&v<9&&(u=!0),e.pos+=t.length;if(e.trailingSpace=32==s.charCodeAt(t.length-1),n||r||i||u||o||l){var u=n||"",g=(r&&(u+=r),i&&(u+=i),H("span",[c],u,o));if(l)for(var m in l)l.hasOwnProperty(m)&&"style"!=m&&"class"!=m&&g.setAttribute(m,l[m]);return e.content.appendChild(g)}e.content.appendChild(c)}}function dn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i=i||e.content.appendChild(document.createElement("span"))).setAttribute("cm-marker",n.id),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function fn(e,t,n){this.line=t,this.rest=(e=>{for(var t,n;t=$t(e);)e=t.find(1,!0).line,(n=n||[]).push(e);return n})(t),this.size=this.rest?N(z(this.rest))-n+1:1,this.node=this.text=null,this.hidden=en(e,t)}function pn(e,t,n){for(var r=[],i=t;i<n;i=l){var o=new fn(e.doc,M(e.doc,i),i),l=i+o.size;r.push(o)}return r}var gn=null;var mn=null;function b(e,t){var n=Ge(e,t);if(n.length)for(var r,i=Array.prototype.slice.call(arguments,2),o=(gn?r=gn.delayedCallbacks:mn?r=mn:(r=mn=[],setTimeout(vn,0)),0);o<n.length;++o)(e=>{r.push(function(){return n[e].apply(null,i)})})(o)}function vn(){var e=mn;mn=null;for(var t=0;t<e.length;++t)e[t]()}function yn(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];if("text"==o){u=a=s=l=void 0;var l=e,s=t,a=s.text.className,u=wn(l,s);s.text==s.node&&(s.node=u.pre),s.text.parentNode.replaceChild(u.pre,s.text),s.text=u.pre,u.bgClass!=s.bgClass||u.textClass!=s.textClass?(s.bgClass=u.bgClass,s.textClass=u.textClass,xn(l,s)):a&&(s.text.className=a)}else if("gutter"==o)Cn(e,t,n,r);else if("class"==o)xn(e,t);else if("widget"==o){f=d=h=l=c=u=void 0;var u=e,c=t,l=r;c.alignable&&(c.alignable=null);for(var h=Z("CodeMirror-linewidget"),d=c.node.firstChild,f=void 0;d;d=f)f=d.nextSibling,h.test(d.className)&&c.node.removeChild(d);Sn(u,c,l)}}t.changes=null}function bn(e){return e.node==e.text&&(e.node=H("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),w)&&v<8&&(e.node.style.zIndex=2),e.node}function wn(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):un(e,t)}function xn(e,t){e=e,(i=(n=t).bgClass?n.bgClass+" "+(n.line.bgClass||""):n.line.bgClass)&&(i+=" CodeMirror-linebackground"),n.background?i?n.background.className=i:(n.background.parentNode.removeChild(n.background),n.background=null):i&&(r=bn(n),n.background=r.insertBefore(H("div",null,i),r.firstChild),e.display.input.setUneditable(n.background)),t.line.wrapClass?bn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n,r,i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Cn(e,t,n,r){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass&&(o=bn(t),t.gutterBackground=H("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text));var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=bn(t),l=t.gutter=H("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(l),o.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(H("div",vt(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var s=0;s<e.display.gutterSpecs.length;++s){var a=e.display.gutterSpecs[s].className,u=i.hasOwnProperty(a)&&i[a];u&&l.appendChild(H("div",[u],"CodeMirror-gutter-elt","left: "+r.gutterLeft[a]+"px; width: "+r.gutterWidth[a]+"px"))}}}function Sn(e,t,n){if(Ln(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Ln(e,t.rest[r],t,n,!1)}function Ln(e,t,n,r,i){if(t.widgets)for(var o=bn(n),l=0,s=t.widgets;l<s.length;++l){var a=s[l],u=H("div",[a.node],"CodeMirror-linewidget"+(a.className?" "+a.className:"")),c=(a.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),f=d=h=c=void 0,a),h=u,d=n,f=r;c.noHScroll&&((d.alignable||(d.alignable=[])).push(h),d=f.wrapperWidth,h.style.left=f.fixedPos+"px",c.coverGutter||(d-=f.gutterTotalWidth,h.style.paddingLeft=f.gutterTotalWidth+"px"),h.style.width=d+"px"),c.coverGutter&&(h.style.zIndex=5,h.style.position="relative",c.noHScroll||(h.style.marginLeft=-f.gutterTotalWidth+"px")),e.display.input.setUneditable(u),i&&a.above?o.insertBefore(u,n.gutter||n.text):o.appendChild(u),b(a,"redraw")}}function kn(e){var t,n;return null!=e.height?e.height:(t=e.doc.cm)?(te(document.body,e.node)||(n="position: relative;",e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),y(t.display.measure,H("div",[e.node],null,n))),e.height=e.node.parentNode.offsetHeight):0}function Tn(e,t){for(var n=_e(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return 1}function Mn(e){return e.lineSpace.offsetTop}function Nn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function On(e){var t;return e.cachedPaddingH||(t=y(e.measure,H("pre","x","CodeMirror-line-like")),t=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,t={left:parseInt(t.paddingLeft),right:parseInt(t.paddingRight)},isNaN(t.left)||isNaN(t.right)||(e.cachedPaddingH=t),t)}function An(e){return he-e.display.nativeBarWidth}function Dn(e){return e.display.scroller.clientWidth-An(e)-e.display.barWidth}function Wn(e){return e.display.scroller.clientHeight-An(e)-e.display.barHeight}function Hn(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(N(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Fn(e,t,n,r){return In(e,Pn(e,t),n,r)}function En(e,t){return t>=e.display.viewFrom&&t<e.display.viewTo?e.display.view[cr(e,t)]:(e=e.display.externalMeasured)&&t>=e.lineN&&t<e.lineN+e.size?e:void 0}function Pn(e,t){var n,r,i=N(t),o=En(e,i),e=(o&&!o.text?o=null:o&&o.changes&&(yn(e,o,i,or(e)),e.curOp.forceUpdate=!0),o||(e=e,r=N(n=Zt(n=t)),(n=e.display.externalMeasured=new fn(e.doc,n,r)).lineN=r,r=n.built=un(e,n),n.text=r.pre,y(e.display.lineMeasure,r.pre),o=n),Hn(o,t,i));return{line:t,view:o,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function In(e,t,n,r,i){var o,l=(n=t.before?-1:n)+(r||"");if(t.cache.hasOwnProperty(l))o=t.cache[l];else{if(t.rect||(t.rect=t.view.text.getBoundingClientRect()),!t.hasHeights){var s=e,a=t.view,u=t.rect,c=s.options.lineWrapping,s=c&&Dn(s);if(!a.measure.heights||c&&a.measure.width!=s){var h=a.measure.heights=[];if(c){a.measure.width=s;for(var d=a.text.firstChild.getClientRects(),f=0;f<d.length-1;f++){var p=d[f],g=d[f+1];2<Math.abs(p.bottom-g.bottom)&&h.push((p.bottom+g.top)/2-u.top)}}h.push(u.bottom-u.top)}t.hasHeights=!0}(o=((e,t,n,r)=>{var i,o=Bn(t.map,n,r),l=o.node,s=o.start,a=o.end,u=o.collapse;if(3==l.nodeType){for(var c=0;c<4;c++){for(;s&&Me(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+a<o.coverEnd&&Me(t.line.text.charAt(o.coverStart+a));)++a;if((i=w&&v<9&&0==s&&a==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():((e,t)=>{var n=Rn;if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;0<=i&&(n=e[i]).left==n.right;i--);return n})(oe(l,s,a).getClientRects(),r)).left||i.right||0==s)break;a=s,s-=1,u="right"}w&&v<11&&(i=((e,t)=>{var n;return window.screen&&null!=screen.logicalXDPI&&screen.logicalXDPI!=screen.deviceXDPI&&(e=>{var t;return null!=nt?nt:(t=(e=y(e,H("span","x"))).getBoundingClientRect(),e=oe(e,0,1).getBoundingClientRect(),nt=1<Math.abs(t.left-e.left))})(e)?(e=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI,{left:t.left*e,right:t.right*e,top:t.top*n,bottom:t.bottom*n}):t})(e.display.measure,i))}else 0<s&&(u=r="right"),i=e.options.lineWrapping&&1<(n=l.getClientRects()).length?n["right"==r?n.length-1:0]:l.getBoundingClientRect();!(w&&v<9)||s||i&&(i.left||i.right)||(n=l.parentNode.getClientRects()[0],i=n?{left:n.left,right:n.left+ir(e.display),top:n.top,bottom:n.bottom}:Rn);for(var n=i.top-t.rect.top,h=i.bottom-t.rect.top,d=(n+h)/2,f=t.view.measure.heights,p=0;p<f.length-1&&!(d<f[p]);p++);var g=p?f[p-1]:0,m=f[p],g={left:("right"==u?i.right:i.left)-t.rect.left,right:("left"==u?i.left:i.right)-t.rect.left,top:g,bottom:m};return i.left||i.right||(g.bogus=!0),e.options.singleCursorHeightPerLine||(g.rtop=n,g.rbottom=h),g})(e,t,n,r)).bogus||(t.cache[l]=o)}return{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var zn,Rn={left:0,right:0,top:0,bottom:0};function Bn(e,t,n){for(var r,i,o,l,s,a,u=0;u<e.length;u+=3)if(a=e[u+1],t<(s=e[u])?(i=0,o=1,l="left"):t<a?o=(i=t-s)+1:(u==e.length-3||t==a&&e[u+3]>t)&&(i=(o=a-s)-1,a<=t)&&(l="right"),null!=i){if(r=e[u+2],s==a&&n==(r.insertLeft?"left":"right")&&(l=n),"left"==n&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[2+(u-=3)],l="left";if("right"==n&&i==a-s)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)r=e[(u+=3)+2],l="right";break}return{node:r,start:i,end:o,collapse:l,coverStart:s,coverEnd:a}}function Gn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Un(e){e.display.externalMeasure=null,J(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Gn(e.display.view[t])}function Vn(e){Un(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Kn(){return c&&X?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function jn(){return c&&X?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Xn(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=kn(e.widgets[n]));return t}function Yn(e,t,n,r,i){return i||(i=Xn(t),n.top+=i,n.bottom+=i),"line"!=r&&(r=r||"local",i=tn(t),"local"==r?i+=Mn(e.display):i-=e.display.viewOffset,"page"!=r&&"window"!=r||(i+=(t=e.display.lineSpace.getBoundingClientRect()).top+("window"==r?0:jn()),e=t.left+("window"==r?0:Kn()),n.left+=e,n.right+=e),n.top+=i,n.bottom+=i),n}function _n(e,t,n){var r;return"div"==n?t:(r=t.left,t=t.top,"page"==n?(r-=Kn(),t-=jn()):"local"!=n&&n||(r+=(n=e.display.sizer.getBoundingClientRect()).left,t+=n.top),{left:r-(n=e.display.lineSpace.getBoundingClientRect()).left,top:t-n.top})}function $n(e,t,n,r,i){return Yn(e,r=r||M(e.doc,t.line),Fn(e,r,t.ch,i),n)}function qn(n,e,r,i,o,l){function s(e,t){e=In(n,o,e,t?"right":"left",l);return t?e.left=e.right:e.right=e.left,Yn(n,i,e,r)}i=i||M(n.doc,e.line),o=o||Pn(n,i);var t,a,u=Re(i,n.doc.direction),c=e.ch,e=e.sticky;return c>=i.text.length?(c=i.text.length,e="before"):c<=0&&(c=0,e="after"),u?(a=De(u,c,e),t=Ae,a=h(c,a,"before"==e),null!=t&&(a.other=h(c,t,"before"!=e)),a):s("before"==e?c-1:c,"before"==e);function h(e,t,n){return s(n?e-1:e,1==u[t].level!=n)}}function Zn(e,t){var n=0,t=(t=I(e.doc,t),e.options.lineWrapping||(n=ir(e.display)*t.ch),M(e.doc,t.line)),e=tn(t)+Mn(e.display);return{left:n,right:n,top:e,bottom:e+t.height}}function Qn(e,t,n,r,i){e=P(e,t,n);return e.xRel=i,r&&(e.outside=r),e}function Jn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return Qn(r.first,0,null,-1,-1);var i=gt(r,n),o=r.first+r.size-1;if(o<i)return Qn(r.first+r.size-1,M(r,o).text.length,null,1,1);t<0&&(t=0);for(var l=M(r,i);;){var s=((n,e,t,r,i)=>{i-=tn(e);var o,l,s=Pn(n,e),a=Xn(e),u=0,c=e.text.length,h=!0,d=((p=Re(e,n.doc.direction))&&(p=(n.options.lineWrapping?function(e,t,n,r,i,o,l){var l=er(e,t,r,l),s=l.begin,a=l.end;/\s/.test(t.text.charAt(a-1))&&a--;for(var u=null,c=null,h=0;h<i.length;h++){var d,f=i[h];f.from>=a||f.to<=s||(d=In(e,r,1!=f.level?Math.min(a,f.to)-1:Math.max(s,f.from)).right,d=d<o?o-d+1e9:d-o,(!u||d<c)&&(u=f,c=d))}u=u||i[i.length-1];u.from<s&&(u={from:s,to:u.to,level:u.level});u.to>a&&(u={from:u.from,to:a,level:u.level});return u}:function(n,r,i,o,l,s,a){var e=Oe(function(e){var e=l[e],t=1!=e.level;return nr(qn(n,P(i,t?e.to:e.from,t?"before":"after"),"line",r,o),s,a,!0)},0,l.length-1),t=l[e];{var u;0<e&&(u=1!=t.level,nr(u=qn(n,P(i,u?t.from:t.to,u?"after":"before"),"line",r,o),s,a,!0))&&u.top>a&&(t=l[e-1])}return t})(n,e,t,s,p,r,i),h=1!=p.level,u=h?p.from:p.to-1,c=h?p.to:p.from-1),null),f=null,p=Oe(function(e){var t=In(n,s,e);return t.top+=a,t.bottom+=a,nr(t,r,i,!1)&&(t.top<=i&&t.left<=r&&(d=e,f=t),1)},u,c),g=!1;return f?(o=r-f.left<f.right-r,p=d+((l=o==h)?0:1),l=l?"after":"before",o=o?f.left:f.right):(h||p!=c&&p!=u||p++,l=0==p||p!=e.text.length&&In(n,s,p-(h?1:0)).bottom+a<=i==h?"after":"before",c=qn(n,P(t,p,l),"line",e,s),o=c.left,g=i<c.top?-1:i>=c.bottom?1:0),p=Ne(e.text,p,1),Qn(t,p,l,g,r-o)})(e,l,i,t,n),a=((e,t)=>{var n,r=It&&e.markedSpans;if(r)for(var i=0;i<r.length;++i){var o=r[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||Xt(n,o.marker)<0)&&(n=o.marker)}return n})(l,s.ch+(0<s.xRel||0<s.outside?1:0));if(!a)return s;s=a.find(1);if(s.line==i)return s;l=M(r,i=s.line)}}function er(t,e,n,r){r-=Xn(e);var e=e.text.length,i=Oe(function(e){return In(t,n,e-1).bottom<=r},e,0);return{begin:i,end:Oe(function(e){return In(t,n,e).top>r},i,e)}}function tr(e,t,n,r){return er(e,t,n=n||Pn(e,t),Yn(e,t,In(e,n,r),"line").top)}function nr(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function rr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==zn){zn=H("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)zn.appendChild(document.createTextNode("x")),zn.appendChild(H("br"));zn.appendChild(document.createTextNode("x"))}y(e.measure,zn);var n=zn.offsetHeight/50;return 3<n&&(e.cachedTextHeight=n),J(e.measure),n||1}function ir(e){var t,n;return null!=e.cachedCharWidth?e.cachedCharWidth:(n=H("span","xxxxxxxxxx"),t=H("pre",[n],"CodeMirror-line-like"),y(e.measure,t),2<(n=((t=n.getBoundingClientRect()).right-t.left)/10)&&(e.cachedCharWidth=n),n||10)}function or(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var s=e.display.gutterSpecs[l].className;n[s]=o.offsetLeft+o.clientLeft+i,r[s]=o.clientWidth}return{fixedPos:lr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function lr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function sr(r){var i=rr(r.display),o=r.options.lineWrapping,l=o&&Math.max(5,r.display.scroller.clientWidth/ir(r.display)-3);return function(e){if(en(r.doc,e))return 0;var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;n++)e.widgets[n].height&&(t+=e.widgets[n].height);return o?t+(Math.ceil(e.text.length/l)||1)*i:t+i}}function ar(e){var t=e.doc,n=sr(e);t.iter(function(e){var t=n(e);t!=e.height&&pt(e,t)})}function ur(e,t,n,r){var i=e.display;if(!n&&"true"==_e(t).getAttribute("cm-not-content"))return null;var o,l,n=i.lineSpace.getBoundingClientRect();try{o=t.clientX-n.left,l=t.clientY-n.top}catch(e){return null}i=Jn(e,o,l);return r&&0<i.xRel&&(t=M(e.doc,i.line).text).length==i.ch&&(n=ue(t,t.length,e.options.tabSize)-t.length,i=P(i.line,Math.max(0,Math.round((o-On(e.display).left)/ir(e.display))-n))),i}function cr(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if((t-=n[r].size)<0)return r}function A(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size);var i,o=e.display,l=((r=r||0)&&n<o.viewTo&&(null==o.updateLineNumbers||o.updateLineNumbers>t)&&(o.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=o.viewTo?It&&Qt(e.doc,t)<o.viewTo&&dr(e):n<=o.viewFrom?It&&Jt(e.doc,n+r)>o.viewFrom?dr(e):(o.viewFrom+=r,o.viewTo+=r):t<=o.viewFrom&&n>=o.viewTo?dr(e):t<=o.viewFrom?(l=fr(e,n,n+r,1))?(o.view=o.view.slice(l.index),o.viewFrom=l.lineN,o.viewTo+=r):dr(e):n>=o.viewTo?(l=fr(e,t,t,-1))?(o.view=o.view.slice(0,l.index),o.viewTo=l.lineN):dr(e):(l=fr(e,t,t,-1),i=fr(e,n,n+r,1),l&&i?(o.view=o.view.slice(0,l.index).concat(pn(e,l.lineN,i.lineN)).concat(o.view.slice(i.index)),o.viewTo+=r):dr(e)),o.externalMeasured);l&&(n<l.lineN?l.lineN+=r:t<l.lineN+l.size&&(o.externalMeasured=null))}function hr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo||null!=(i=r.view[cr(e,t)]).node&&-1==S(r=i.changes||(i.changes=[]),n)&&r.push(n)}function dr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function fr(e,t,n,r){var i,o=cr(e,t),l=e.display.view;if(It&&n!=e.doc.first+e.doc.size){for(var s=e.display.viewFrom,a=0;a<o;a++)s+=l[a].size;if(s!=t){if(0<r){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;Qt(e.doc,n)!=n;){if(o==(r<0?0:l.length-1))return null;n+=r*l[o-(r<0?1:0)].size,o+=r}}return{index:o,lineN:n}}function pr(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];i.hidden||i.node&&!i.changes||++n}return n}function gr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mr(e,t){void 0===t&&(t=!0);for(var n,r,i=e.doc,o={},l=o.cursors=document.createDocumentFragment(),s=o.selection=document.createDocumentFragment(),a=0;a<i.sel.ranges.length;a++)!t&&a==i.sel.primIndex||(n=i.sel.ranges[a]).from().line>=e.display.viewTo||n.to().line<e.display.viewFrom||(((r=n.empty())||e.options.showCursorWhenSelecting)&&vr(e,n.head,l),r)||((i,e,t)=>{var n,r=i.display,o=i.doc,l=document.createDocumentFragment(),s=On(i.display),S=s.left,L=Math.max(r.sizerWidth,Dn(i)-r.sizer.offsetLeft)-s.right,k="ltr"==o.direction;function T(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),l.appendChild(H("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?L-e:n)+"px;\n height: "+(r-t)+"px"))}function a(n,g,m){var v,y,r=M(o,n),b=r.text.length;function w(e,t){return $n(i,P(n,e),"div",r,t)}function x(e,t,n){e=tr(i,r,null,e),t="ltr"==t==("after"==n)?"left":"right";return w("after"==n?e.begin:e.end-(/\s/.test(r.text.charAt(e.end-1))?2:1),t)[t]}var C=Re(r,o.direction);return((e,t,n,r)=>{if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<n&&l.to>t||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),1==l.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")})(C,g||0,null==m?b:m,function(e,t,n,r){var i,o,l,s,a,u="ltr"==n,c=w(e,u?"left":"right"),h=w(t-1,u?"right":"left"),d=null==g&&0==e,f=null==m&&t==b,p=0==r,r=!C||r==C.length-1;h.top-c.top<=3?(i=(k?d:f)&&p?S:(u?c:h).left,a=(k?f:d)&&r?L:(u?h:c).right,T(i,c.top,a-i,c.bottom)):(a=u?(o=k&&d&&p?S:c.left,l=k?L:x(e,n,"before"),s=k?S:x(t,n,"after"),k&&f&&r?L:h.right):(o=k?x(e,n,"before"):S,l=!k&&d&&p?L:c.right,s=!k&&f&&r?S:h.left,k?x(t,n,"after"):L),T(o,c.top,l-o,c.bottom),c.bottom<h.top&&T(S,c.bottom,null,h.top),T(s,h.top,a-s,h.bottom)),(!v||yr(c,v)<0)&&(v=c),yr(h,v)<0&&(v=h),(!y||yr(c,y)<0)&&(y=c),yr(h,y)<0&&(y=h)}),{start:v,end:y}}r=e.from(),s=e.to(),r.line==s.line?a(r.line,r.ch,s.ch):(e=M(o,r.line),n=M(o,s.line),n=Zt(e)==Zt(n),r=a(r.line,r.ch,n?e.text.length+1:null).end,e=a(s.line,n?0:null,s.ch).start,n&&(r.top<e.top-2?(T(r.right,r.top,null,r.bottom),T(S,e.top,e.left,e.bottom)):T(r.right,r.top,e.left-r.right,r.bottom)),r.bottom<e.top&&T(S,r.bottom,null,e.top)),t.appendChild(l)})(e,n,s);return o}function vr(e,t,n){var t=qn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),r=n.appendChild(H("div"," ","CodeMirror-cursor"));r.style.left=t.left+"px",r.style.top=t.top+"px",r.style.height=Math.max(0,t.bottom-t.top)*e.options.cursorHeight+"px",t.other&&((r=n.appendChild(H("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"))).style.display="",r.style.left=t.other.left+"px",r.style.top=t.other.top+"px",r.style.height=.85*(t.other.bottom-t.other.top)+"px")}function yr(e,t){return e.top-t.top||e.left-t.left}function br(e){var t,n;e.state.focused&&(t=e.display,clearInterval(t.blinker),n=!0,t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){e.hasFocus()||Sr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden"))}function wr(e){e.hasFocus()||(e.display.input.focus(),e.state.focused)||Cr(e)}function xr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused)&&Sr(e)},100)}function Cr(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(F(e,"focus",e,t),e.state.focused=!0,re(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),x&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),br(e))}function Sr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(F(e,"blur",e,t),e.state.focused=!1,Q(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Lr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],o=e.options.lineWrapping,l=void 0,s=0;if(!i.hidden){w&&v<8?(l=(a=i.node.offsetTop+i.node.offsetHeight)-n,n=a):(l=(a=i.node.getBoundingClientRect()).bottom-a.top,!o&&i.text.firstChild&&(s=i.text.firstChild.getBoundingClientRect().right-a.left-1));var a,o=i.line.height-l;if((.005<o||o<-.005)&&(pt(i.line,l),kr(i.line),i.rest))for(var u=0;u<i.rest.length;u++)kr(i.rest[u]);s>e.display.sizerWidth&&(o=Math.ceil(s/ir(e.display)))>e.display.maxLineLength&&(e.display.maxLineLength=o,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function kr(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Tr(e,t,n){var r,i=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop,i=Math.floor(i-Mn(e)),o=n&&null!=n.bottom?n.bottom:i+e.wrapper.clientHeight,i=gt(t,i),o=gt(t,o);return n&&n.ensure&&(r=n.ensure.from.line,n=n.ensure.to.line,r<i?o=gt(t,tn(M(t,i=r))+e.wrapper.clientHeight):Math.min(n,t.lastLine())>=o&&(i=gt(t,tn(M(t,n))-e.wrapper.clientHeight),o=n)),{from:i,to:Math.max(o,i+1)}}function Mr(e,t){var n=e.display,r=rr(e.display),i=(t.top<0&&(t.top=0),(e.curOp&&null!=e.curOp.scrollTop?e.curOp:n.scroller).scrollTop),o=Wn(e),l={},s=(o<t.bottom-t.top&&(t.bottom=t.top+o),e.doc.height+Nn(n)),a=s-r<t.bottom,a=(t.top<i?l.scrollTop=t.top<r?0:t.top:t.bottom>i+o&&(r=Math.min(t.top,(a?s:t.bottom)-o))!=i&&(l.scrollTop=r),e.options.fixedGutter?0:n.gutters.offsetWidth),s=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-a,o=Dn(e)-n.gutters.offsetWidth,i=o<t.right-t.left;return i&&(t.right=t.left+o),t.left<10?l.scrollLeft=0:t.left<s?l.scrollLeft=Math.max(0,t.left+a-(i?0:10)):t.right>o+s-3&&(l.scrollLeft=t.right+(i?0:10)-o),l}function Nr(e,t){null!=t&&(Dr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc:e.curOp).scrollTop+t)}function Or(e){Dr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ar(e,t,n){null==t&&null==n||Dr(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Dr(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Wr(e,Zn(e,t.from),Zn(e,t.to),t.margin))}function Wr(e,t,n,r){t=Mr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Ar(e,t.scrollLeft,t.scrollTop)}function Hr(e,t){Math.abs(e.doc.scrollTop-t)<2||(G||Zr(e,{top:t}),Fr(e,t,!0),G&&Zr(e),Xr(e,100))}function Fr(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n||(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop==t)||(e.display.scroller.scrollTop=t)}function Er(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,ei(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Pr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Nn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+An(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function Ir(e,t,n){this.cm=n;var r=this.vert=H("div",[H("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=H("div",[H("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),L(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),L(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,w&&v<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function zr(){}Ir.prototype.update=function(e){var t,n=e.scrollWidth>e.clientWidth+1,r=e.clientHeight+1<e.scrollHeight,i=e.nativeBarWidth;return r?(this.vert.style.display="block",this.vert.style.bottom=n?i+"px":"0",t=e.viewHeight-(n?i:0),this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+t)+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0"),n?(this.horiz.style.display="block",this.horiz.style.right=r?i+"px":"0",this.horiz.style.left=e.barLeft+"px",this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+(e.viewWidth-e.barLeft-(r?i:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedZeroWidth&&0<e.clientHeight&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?i:0,bottom:n?i:0}},Ir.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Ir.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Ir.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=C&&!d?"12px":"18px",this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ce,this.disableVert=new ce},Ir.prototype.enableZeroWidthBar=function(n,r,i){n.style.pointerEvents="auto",r.set(1e3,function e(){var t=n.getBoundingClientRect();("vert"==i?document.elementFromPoint(t.right-1,(t.top+t.bottom)/2):document.elementFromPoint((t.right+t.left)/2,t.bottom-1))!=n?n.style.pointerEvents="none":r.set(1e3,e)})},Ir.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};function Rr(e,t){t=t||Pr(e);var n=e.display.barWidth,r=e.display.barHeight;Br(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Lr(e),Br(e,Pr(e)),n=e.display.barWidth,r=e.display.barHeight}function Br(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}zr.prototype.update=function(){return{bottom:0,right:0}},zr.prototype.setScrollLeft=function(){},zr.prototype.setScrollTop=function(){},zr.prototype.clear=function(){};var Gr={native:Ir,null:zr};function Ur(n){n.display.scrollbars&&(n.display.scrollbars.clear(),n.display.scrollbars.addClass)&&Q(n.display.wrapper,n.display.scrollbars.addClass),n.display.scrollbars=new Gr[n.options.scrollbarStyle](function(e){n.display.wrapper.insertBefore(e,n.display.scrollbarFiller),L(e,"mousedown",function(){n.state.focused&&setTimeout(function(){return n.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,t){("horizontal"==t?Er:Hr)(n,e)},n),n.display.scrollbars.addClass&&re(n.display.wrapper,n.display.scrollbars.addClass)}var Vr=0;function Kr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.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:++Vr},e=e.curOp,gn?gn.ops.push(e):e.ownsGroup=gn={ops:[e],delayedCallbacks:[]}}function jr(e){e=e.curOp;if(e){var t=function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;for(var n=e.ops,r=0;r<n.length;r++){a=s=l=o=i=void 0;var i=n[r],o=i.cm,l=o.display,s=o,a=s.display;!a.scrollbarsClipped&&a.scroller.offsetWidth&&(a.nativeBarWidth=a.scroller.offsetWidth-a.scroller.clientWidth,a.heightForcer.style.height=An(s)+"px",a.sizer.style.marginBottom=-a.nativeBarWidth+"px",a.sizer.style.borderRightWidth=An(s)+"px",a.scrollbarsClipped=!0),i.updateMaxLine&&rn(o),i.mustUpdate=i.viewChanged||i.forceUpdate||null!=i.scrollTop||i.scrollToPos&&(i.scrollToPos.from.line<l.viewFrom||i.scrollToPos.to.line>=l.viewTo)||l.maxLineChanged&&o.options.lineWrapping,i.update=i.mustUpdate&&new _r(o,i.mustUpdate&&{top:i.scrollTop,ensure:i.scrollToPos},i.forceUpdate)}for(var u=0;u<n.length;u++){c=void 0;var c=n[u];c.updatedDisplay=c.mustUpdate&&$r(c.cm,c.update)}for(var h=0;h<n.length;h++){d=void 0;f=void 0;p=void 0;var d=n[h];var f=d.cm,p=f.display;d.updatedDisplay&&Lr(f),d.barMeasure=Pr(f),p.maxLineChanged&&!f.options.lineWrapping&&(d.adjustWidthTo=Fn(f,p.maxLine,p.maxLine.text.length).left+3,f.display.sizerWidth=d.adjustWidthTo,d.barMeasure.scrollWidth=Math.max(p.scroller.clientWidth,p.sizer.offsetLeft+d.adjustWidthTo+An(f)+f.display.barWidth),d.maxScrollLeft=Math.max(0,p.sizer.offsetLeft+d.adjustWidthTo-Dn(f))),(d.updatedDisplay||d.selectionChanged)&&(d.preparedSelection=p.input.prepareSelection())}for(var g=0;g<n.length;g++){m=void 0;v=void 0;y=void 0;var m=n[g];var v=m.cm,y=(null!=m.adjustWidthTo&&(v.display.sizer.style.minWidth=m.adjustWidthTo+"px",m.maxScrollLeft<v.doc.scrollLeft&&Er(v,Math.min(v.display.scroller.scrollLeft,m.maxScrollLeft),!0),v.display.maxLineChanged=!1),m.focus&&m.focus==ne());m.preparedSelection&&v.display.input.showSelection(m.preparedSelection,y),!m.updatedDisplay&&m.startHeight==v.doc.height||Rr(v,m.barMeasure),m.updatedDisplay&&Jr(v,m.barMeasure),m.selectionChanged&&br(v),v.state.focused&&m.updateInput&&v.display.input.reset(m.typing),y&&wr(m.cm)}for(var b,w,x=0;x<n.length;x++){C=void 0;T=void 0;M=void 0;N=void 0;w=void 0;O=void 0;A=void 0;D=void 0;W=void 0;b=void 0;S=void 0;k=void 0;L=void 0;var C=n[x];var S,L,k,T=C.cm,M=T.display,N=T.doc;C.updatedDisplay&&qr(T,C.update),null==M.wheelStartX||null==C.scrollTop&&null==C.scrollLeft&&!C.scrollToPos||(M.wheelStartX=M.wheelStartY=null),null!=C.scrollTop&&Fr(T,C.scrollTop,C.forceScroll),null!=C.scrollLeft&&Er(T,C.scrollLeft,!0,!0),C.scrollToPos&&(w=((e,t,n,r)=>{null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==(t=t.ch?P(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?P(t.line,t.ch+1,"before"):t);for(var i=0;i<5;i++){var o,l=!1,s=qn(e,t),a=n&&n!=t?qn(e,n):s,s=Mr(e,o={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top)-r,right:Math.max(s.left,a.left),bottom:Math.max(s.bottom,a.bottom)+r}),a=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=s.scrollTop&&(Hr(e,s.scrollTop),1<Math.abs(e.doc.scrollTop-a))&&(l=!0),!(l=null!=s.scrollLeft&&(Er(e,s.scrollLeft),1<Math.abs(e.doc.scrollLeft-u))?!0:l))break}return o})(T,I(N,C.scrollToPos.from),I(N,C.scrollToPos.to),C.scrollToPos.margin),E(b=T,"scrollCursorIntoView")||(k=(S=b.display).sizer.getBoundingClientRect(),L=null,w.top+k.top<0?L=!0:w.bottom+k.top>(window.innerHeight||document.documentElement.clientHeight)&&(L=!1),null==L)||K||(k=H("div","",null,"position: absolute;\n top: "+(w.top-S.viewOffset-Mn(b.display))+"px;\n height: "+(w.bottom-w.top+An(b)+S.barHeight)+"px;\n left: "+w.left+"px; width: "+Math.max(2,w.right-w.left)+"px;"),b.display.lineSpace.appendChild(k),k.scrollIntoView(L),b.display.lineSpace.removeChild(k)));var O=C.maybeHiddenMarkers,A=C.maybeUnhiddenMarkers;if(O)for(var D=0;D<O.length;++D)O[D].lines.length||F(O[D],"hide");if(A)for(var W=0;W<A.length;++W)A[W].lines.length&&F(A[W],"unhide");M.wrapper.offsetHeight&&(N.scrollTop=T.display.scroller.scrollTop),C.changeObjs&&F(T,"changes",T,C.changeObjs),C.update&&C.update.finish()}};if(e=e.ownsGroup)try{var n=e,r=n.delayedCallbacks,i=0;do{for(;i<r.length;i++)r[i].call(null);for(var o=0;o<n.ops.length;o++){var l=n.ops[o];if(l.cursorActivityHandlers)for(;l.cursorActivityCalled<l.cursorActivityHandlers.length;)l.cursorActivityHandlers[l.cursorActivityCalled++].call(null,l.cm)}}while(i<r.length)}finally{gn=null,t(e)}}}function h(e,t){if(e.curOp)return t();Kr(e);try{return t()}finally{jr(e)}}function D(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Kr(e);try{return t.apply(e,arguments)}finally{jr(e)}}}function n(e){return function(){if(this.curOp)return e.apply(this,arguments);Kr(this);try{return e.apply(this,arguments)}finally{jr(this)}}}function r(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Kr(e);try{return t.apply(this,arguments)}finally{jr(e)}}}function Xr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,se(Yr,e))}function Yr(l){var s,a,u,c=l.doc;c.highlightFrontier>=l.display.viewTo||(s=+new Date+l.options.workTime,a=Nt(l,c.highlightFrontier),u=[],c.iter(a.line,Math.min(c.first+c.size,l.display.viewTo+500),function(e){if(a.line>=l.display.viewFrom){for(var t=e.styles,n=e.text.length>l.options.maxHighlightLength?ut(c.mode,a.state):null,r=Tt(l,e,a,!0),n=(n&&(a.state=n),e.styles=r.styles,e.styleClasses),r=r.classes,i=(r?e.styleClasses=r:n&&(e.styleClasses=null),!t||t.length!=e.styles.length||n!=r&&(!n||!r||n.bgClass!=r.bgClass||n.textClass!=r.textClass)),o=0;!i&&o<t.length;++o)i=t[o]!=e.styles[o];i&&u.push(a.line),e.stateAfter=a.save()}else e.text.length<=l.options.maxHighlightLength&&Ot(l,e.text,a),e.stateAfter=a.line%5==0?a.save():null;if(a.nextLine(),+new Date>s)return Xr(l,l.options.workDelay),!0}),c.highlightFrontier=a.line,c.modeFrontier=Math.max(c.modeFrontier,a.line),u.length&&h(l,function(){for(var e=0;e<u.length;e++)hr(l,u[e],"text")}))}var _r=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Tr(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Dn(e),this.force=n,this.dims=or(e),this.events=[]};function $r(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return dr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==pr(e))return!1;ti(e)&&(dr(e),t.dims=or(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),l=Math.min(i,t.visible.to+e.options.viewportMargin),r=(n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>l&&n.viewTo-l<20&&(l=Math.min(i,n.viewTo)),It&&(o=Qt(e.doc,o),l=Jt(e.doc,l)),o!=n.viewFrom||l!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth),i=(i=o,o=l,0==(s=(l=e).display).view.length||i>=s.viewTo||o<=s.viewFrom?(s.view=pn(l,i,o),s.viewFrom=i):(s.viewFrom>i?s.view=pn(l,i,s.viewFrom).concat(s.view):s.viewFrom<i&&(s.view=s.view.slice(cr(l,i))),s.viewFrom=i,s.viewTo<o?s.view=s.view.concat(pn(l,s.viewTo,o)):s.viewTo>o&&(s.view=s.view.slice(0,cr(l,o)))),s.viewTo=o,n.viewOffset=tn(M(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px",pr(e));if(!r&&0==i&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var s,l=!(l=e).hasFocus()&&(s=ne())&&te(l.display.lineDiv,s)?(s={activeElt:s},window.getSelection&&(o=window.getSelection()).anchorNode&&o.extend&&te(l.display.lineDiv,o.anchorNode)&&(s.anchorNode=o.anchorNode,s.anchorOffset=o.anchorOffset,s.focusNode=o.focusNode,s.focusOffset=o.focusOffset),s):null,a=(4<i&&(n.lineDiv.style.display="none"),e),u=n.updateLineNumbers,c=t.dims,o=a.display,h=a.options.lineNumbers,d=o.lineDiv,f=d.firstChild;function p(e){var t=e.nextSibling;return x&&C&&a.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var g=o.view,m=o.viewFrom,v=0;v<g.length;v++){var y=g[v];if(!y.hidden)if(y.node&&y.node.parentNode==d){for(;f!=y.node;)f=p(f);var b=h&&null!=u&&u<=m&&y.lineNumber;y.changes&&(-1<S(y.changes,"gutter")&&(b=!1),yn(a,y,m,c)),b&&(J(y.lineNumber),y.lineNumber.appendChild(document.createTextNode(vt(a.options,m)))),f=y.node.nextSibling}else{b=((e,t,n,r)=>{var i=wn(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),xn(e,t),Cn(e,t,n,r),Sn(e,t,r),t.node})(a,y,m,c);d.insertBefore(b,f)}m+=y.size}for(;f;)f=p(f);return 4<i&&(n.lineDiv.style.display=""),n.renderedView=n.view,(s=l)&&s.activeElt&&s.activeElt!=ne()&&(s.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(s.activeElt.nodeName))&&s.anchorNode&&te(document.body,s.anchorNode)&&te(document.body,s.focusNode)&&(o=window.getSelection(),(i=document.createRange()).setEnd(s.anchorNode,s.anchorOffset),i.collapse(!1),o.removeAllRanges(),o.addRange(i),o.extend(s.focusNode,s.focusOffset)),J(n.cursorDiv),J(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,r&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Xr(e,400)),!(n.updateLineNumbers=null)}function qr(e,t){for(var n=t.viewport,r=!0;;r=!1){if(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Dn(e))r&&(t.visible=Tr(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Nn(e.display)-Wn(e),n.top)}),t.visible=Tr(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!$r(e,t))break;Lr(e);var i=Pr(e);gr(e),Rr(e,i),Jr(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Zr(e,t){var n,t=new _r(e,t);$r(e,t)&&(Lr(e),qr(e,t),n=Pr(e),gr(e),Rr(e,n),Jr(e,n),t.finish())}function Qr(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Jr(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+An(e)+"px"}function ei(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=lr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",l=0;l<n.length;l++)if(!n[l].hidden){e.options.fixedGutter&&(n[l].gutter&&(n[l].gutter.style.left=o),n[l].gutterBackground)&&(n[l].gutterBackground.style.left=o);var s=n[l].alignable;if(s)for(var a=0;a<s.length;a++)s[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function ti(e){var t,n,r,i;return e.options.lineNumbers&&(t=vt(e.options,(t=e.doc).first+t.size-1)).length!=(n=e.display).lineNumChars?(r=(i=n.measure.appendChild(H("div",[H("div",t)],"CodeMirror-linenumber CodeMirror-gutter-elt"))).firstChild.offsetWidth,i=i.offsetWidth-r,n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(r,n.lineGutter.offsetWidth-i)+1,n.lineNumWidth=n.lineNumInnerWidth+i,n.lineNumChars=n.lineNumInnerWidth?t.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Qr(e.display),1):void 0}function ni(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var o=e[i],l=null;if("string"!=typeof o&&(l=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;r=!0}n.push({className:o,style:l})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function ri(e){var t=e.gutters,n=e.gutterSpecs;J(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,i=i.style,l=t.appendChild(H("div",null,"CodeMirror-gutter "+o));i&&(l.style.cssText=i),"CodeMirror-linenumbers"==o&&((e.lineGutter=l).style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Qr(e)}function ii(e){ri(e.display),A(e),ei(e)}function oi(e,t,n,r){var i=this,o=(this.input=n,i.scrollbarFiller=H("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=H("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=ee("div",null,"CodeMirror-code"),i.selectionDiv=H("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=H("div",null,"CodeMirror-cursors"),i.measure=H("div",null,"CodeMirror-measure"),i.lineMeasure=H("div",null,"CodeMirror-measure"),i.lineSpace=ee("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none"),ee("div",[i.lineSpace],"CodeMirror-lines"));i.mover=H("div",[o],null,"position: relative"),i.sizer=H("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=H("div",null,null,"position: absolute; height: "+he+"px; width: 1px;"),i.gutters=H("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=H("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=H("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),w&&v<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),x||G&&Y||(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ni(r.gutters,r.lineNumbers),ri(i),n.init(i)}_r.prototype.signal=function(e,t){Ve(e,t)&&this.events.push(arguments)},_r.prototype.finish=function(){for(var e=0;e<this.events.length;e++)F.apply(null,this.events[e])};var li=0,f=null;function si(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function ai(e){e=si(e);return e.x*=f,e.y*=f,e}function ui(e,t){var n,r,i=si(t),o=i.x,i=i.y,l=e.display,s=l.scroller,a=s.scrollWidth>s.clientWidth,u=s.clientHeight<s.scrollHeight;if(o&&a||i&&u){if(i&&C&&x)e:for(var c=t.target,h=l.view;c!=s;c=c.parentNode)for(var d=0;d<h.length;d++)if(h[d].node==c){e.display.currentWheelTarget=c;break e}!o||G||U||null==f?(i&&null!=f&&(a=i*f,r=(n=e.doc.scrollTop)+l.wrapper.clientHeight,a<0?n=Math.max(0,n+a-50):r=Math.min(e.doc.height,r+a+50),Zr(e,{top:n,bottom:r})),li<20&&(null==l.wheelStartX?(l.wheelStartX=s.scrollLeft,l.wheelStartY=s.scrollTop,l.wheelDX=o,l.wheelDY=i,setTimeout(function(){var e,t;null!=l.wheelStartX&&(e=s.scrollLeft-l.wheelStartX,t=(t=s.scrollTop-l.wheelStartY)&&l.wheelDY&&t/l.wheelDY||e&&l.wheelDX&&e/l.wheelDX,l.wheelStartX=l.wheelStartY=null,t)&&(f=(f*li+t)/(li+1),++li)},200)):(l.wheelDX+=o,l.wheelDY+=i))):(i&&u&&Hr(e,Math.max(0,s.scrollTop+i*f)),Er(e,Math.max(0,s.scrollLeft+o*f)),i&&!u||T(t),l.wheelStartX=null)}}w?f=-.53:G?f=15:c?f=-.7:V&&(f=-1/3);var W=function(e,t){this.ranges=e,this.primIndex=t},R=(W.prototype.primary=function(){return this.ranges[this.primIndex]},W.prototype.equals=function(e){if(e!=this){if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!yt(n.anchor,r.anchor)||!yt(n.head,r.head))return!1}}return!0},W.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new R(bt(this.ranges[t].anchor),bt(this.ranges[t].head));return new W(e,this.primIndex)},W.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},W.prototype.contains=function(e,t){t=t||e;for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(0<=O(t,r.from())&&O(e,r.to())<=0)return n}return-1},function(e,t){this.anchor=e,this.head=t});function ci(e,t,n){var r=e&&e.options.selectionsMayTouch,e=t[n];t.sort(function(e,t){return O(e.from(),t.from())}),n=S(t,e);for(var i=1;i<t.length;i++){var o,l=t[i],s=t[i-1],a=O(s.to(),l.from());(r&&!l.empty()?0<a:0<=a)&&(a=xt(s.from(),l.from()),o=wt(s.to(),l.to()),l=s.empty()?l.from()==l.head:s.from()==s.head,i<=n&&--n,t.splice(--i,2,new R(l?o:a,l?a:o)))}return new W(t,n)}function hi(e,t){return new W([new R(e,t||e)],0)}function di(e){return e.text?P(e.from.line+e.text.length-1,z(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function fi(e,t){var n,r;return O(e,t.from)<0?e:O(e,t.to)<=0?di(t):(n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch,e.line==t.to.line&&(r+=di(t).ch-t.to.ch),P(n,r))}function pi(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new R(fi(i.anchor,t),fi(i.head,t)))}return ci(e.cm,n,e.sel.primIndex)}function gi(e,t,n){return e.line==t.line?P(n.line,e.ch-t.ch+n.ch):P(n.line+(e.line-t.line),e.ch)}function mi(e){e.doc.mode=lt(e.options,e.doc.modeOption),vi(e)}function vi(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Xr(e,100),e.state.modeGen++,e.curOp&&A(e)}function yi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==z(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function bi(e,o,t,l){function i(e){return t?t[e]:null}function n(e,t,n){var r,i;t=t,n=n,i=l,(r=e).text=t,r.stateAfter&&(r.stateAfter=null),r.styles&&(r.styles=null),null!=r.order&&(r.order=null),Ut(r),Vt(r,n),(t=i?i(r):1)!=r.height&&pt(r,t),b(e,"change",e,o)}function r(e,t){for(var n=[],r=e;r<t;++r)n.push(new on(c[r],i(r),l));return n}var s,a=o.from,u=o.to,c=o.text,h=M(e,a.line),d=M(e,u.line),f=z(c),p=i(c.length-1),g=u.line-a.line;o.full?(e.insert(0,r(0,c.length)),e.remove(c.length,e.size-c.length)):yi(e,o)?(s=r(0,c.length-1),n(d,d.text,p),g&&e.remove(a.line,g),s.length&&e.insert(a.line,s)):h==d?1==c.length?n(h,h.text.slice(0,a.ch)+f+h.text.slice(u.ch),p):((s=r(1,c.length-1)).push(new on(f+h.text.slice(u.ch),p,l)),n(h,h.text.slice(0,a.ch)+c[0],i(0)),e.insert(a.line+1,s)):1==c.length?(n(h,h.text.slice(0,a.ch)+c[0]+d.text.slice(u.ch),i(0)),e.remove(a.line+1,g)):(n(h,h.text.slice(0,a.ch)+c[0],i(0)),n(d,f+d.text.slice(u.ch),p),s=r(1,c.length-1),1<g&&e.remove(a.line+1,g-1),e.insert(a.line+1,s)),b(e,"change",e,o)}function wi(e,s,a){!function e(t,n,r){if(t.linked)for(var i=0;i<t.linked.length;++i){var o,l=t.linked[i];l.doc!=n&&(o=r&&l.sharedHist,!a||o)&&(s(l.doc,o),e(l.doc,t,o))}}(e,null,!0)}function xi(e,t){if(t.cm)throw new Error("This document is already in use.");ar((e.doc=t).cm=e),mi(e),Ci(e),e.options.lineWrapping||rn(e),e.options.mode=t.modeOption,A(e)}function Ci(e){("rtl"==e.doc.direction?re:Q)(e.display.lineDiv,"CodeMirror-rtl")}function Si(e){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=e||1}function Li(e,t){var n={from:bt(t.from),to:di(t),text:dt(e,t.from,t.to)};return Oi(e,n,t.from.line,t.to.line+1),wi(e,function(e){return Oi(e,n,t.from.line,t.to.line+1)},!0),n}function ki(e){for(;e.length;){if(!z(e).ranges)break;e.pop()}}function Ti(e,t,n,r){var i,o,l=e.history,s=(l.undone.length=0,+new Date);if((l.lastOp==r||l.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&l.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=(o=l).lastOp==r?(ki(o.done),z(o.done)):o.done.length&&!z(o.done).ranges?z(o.done):1<o.done.length&&!o.done[o.done.length-2].ranges?(o.done.pop(),z(o.done)):void 0))i=z(o.changes),0==O(t.from,t.to)&&0==O(t.from,i.to)?i.to=di(t):o.changes.push(Li(e,t));else{var a=z(l.done);for(a&&a.ranges||Ni(e.sel,l.done),o={changes:[Li(e,t)],generation:l.generation},l.done.push(o);l.done.length>l.undoDepth;)l.done.shift(),l.done[0].ranges||l.done.shift()}l.done.push(n),l.generation=++l.maxGeneration,l.lastModTime=l.lastSelTime=s,l.lastOp=l.lastSelOp=r,l.lastOrigin=l.lastSelOrigin=t.origin,i||F(e,"historyAdded")}function Mi(e,t,n,r){var i,o,l,s=e.history,a=r&&r.origin;n==s.lastSelOp||a&&s.lastSelOrigin==a&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==a||(e=e,i=a,o=z(s.done),l=t,"*"==(i=i.charAt(0)))||"+"==i&&o.ranges.length==l.ranges.length&&o.somethingSelected()==l.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500))?s.done[s.done.length-1]=t:Ni(t,s.done),s.lastSelTime=+new Date,s.lastSelOrigin=a,s.lastSelOp=n,r&&!1!==r.clearRedo&&ki(s.undone)}function Ni(e,t){var n=z(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Oi(t,n,e,r){var i=n["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,r),function(e){e.markedSpans&&((i=i||(n["spans_"+t.id]={}))[o]=e.markedSpans),++o})}function Ai(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push((e=>{if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t=t||e.slice(0,n):t&&t.push(e[n]);return t?t.length?t:null:e})(n[i]));return r}function Di(e,t){var n=Ai(e,t),r=Bt(e,t);if(!n)return r;if(r)for(var i=0;i<n.length;++i){var o=n[i],l=r[i];if(o&&l)e:for(var s=0;s<l.length;++s){for(var a=l[s],u=0;u<o.length;++u)if(o[u].marker==a.marker)continue e;o.push(a)}else l&&(n[i]=l)}return n}function Wi(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?W.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];r.push({changes:s});for(var a=0;a<l.length;++a){var u,c=l[a];if(s.push({from:c.from,to:c.to,text:c.text}),t)for(var h in c)(u=h.match(/^spans_(\d+)$/))&&-1<S(t,Number(u[1]))&&(z(s)[h]=c[h],delete c[h])}}}return r}function Hi(e,t,n,r){return r?(r=e.anchor,n&&((e=O(t,r)<0)!=O(n,r)<0?(r=t,t=n):e!=O(t,n)<0&&(t=n)),new R(r,t)):new R(n||t,t)}function Fi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),B(e,new W([Hi(e.sel.primary(),t,n,i)],0),r)}function Ei(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=Hi(e.sel.ranges[o],t[o],null,i);B(e,ci(e.cm,r,e.sel.primIndex),n)}function Pi(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,B(e,ci(e.cm,i,e.sel.primIndex),r)}function Ii(e,t,n,r){B(e,hi(t,n),r)}function zi(e,t,n){var r=e.history.done,i=z(r);i&&i.ranges?Ri(e,r[r.length-1]=t,n):B(e,t,n)}function B(e,t,n){Ri(e,t,n),Mi(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Ri(e,t,n){(Ve(e,"beforeSelectionChange")||e.cm&&Ve(e.cm,"beforeSelectionChange"))&&(r=e,o=n,o={ranges:(i=t).ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new R(I(r,e[t].anchor),I(r,e[t].head))},origin:o&&o.origin},F(r,"beforeSelectionChange",r,o),r.cm&&F(r.cm,"beforeSelectionChange",r.cm,o),t=o.ranges!=i.ranges?ci(r.cm,o.ranges,o.ranges.length-1):i);var r,i,o=n&&n.bias||(O(t.primary().head,e.sel.primary().head)<0?-1:1);Bi(e,Ui(e,t,o,!0)),n&&!1===n.scroll||!e.cm||Or(e.cm)}function Bi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ue(e.cm)),b(e,"cursorActivity",e))}function Gi(e){Bi(e,Ui(e,e.sel,null,!1))}function Ui(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],a=Ki(e,l.anchor,s&&s.anchor,n,r),s=Ki(e,l.head,s&&s.head,n,r);!i&&a==l.anchor&&s==l.head||((i=i||t.ranges.slice(0,o))[o]=new R(a,s))}return i?ci(e.cm,i,t.primIndex):t}function Vi(e,t,n,r,i){var o=M(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var s=o.markedSpans[l],a=s.marker,u="selectLeft"in a?!a.selectLeft:a.inclusiveLeft,c="selectRight"in a?!a.selectRight:a.inclusiveRight;if((null==s.from||(u?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(c?s.to>=t.ch:s.to>t.ch))){if(i&&(F(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(a.atomic){if(n){var s=a.find(r<0?1:-1),h=void 0;if((s=(r<0?c:u)?ji(e,s,-r,s&&s.line==t.line?o:null):s)&&s.line==t.line&&(h=O(s,n))&&(r<0?h<0:0<h))return Vi(e,s,t,r,i)}h=a.find(r<0?-1:1);return(h=(r<0?u:c)?ji(e,h,r,h.line==t.line?o:null):h)?Vi(e,h,t,r,i):null}}}return t}function Ki(e,t,n,r,i){r=r||1,i=Vi(e,t,n,r,i)||!i&&Vi(e,t,n,r,!0)||Vi(e,t,n,-r,i)||!i&&Vi(e,t,n,-r,!0);return i||(e.cantEdit=!0,P(e.first,0))}function ji(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?I(e,P(t.line-1)):null:0<n&&t.ch==(r||M(e,t.line)).text.length?t.line<e.first+e.size-1?P(t.line+1,0):null:new P(t.line,t.ch+n)}function Xi(e){e.setSelection(P(e.firstLine(),0),P(e.lastLine()),fe)}function Yi(i,e,t){var o={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return o.canceled=!0}};return t&&(o.update=function(e,t,n,r){e&&(o.from=I(i,e)),t&&(o.to=I(i,t)),n&&(o.text=n),void 0!==r&&(o.origin=r)}),F(i,"beforeChange",i,o),i.cm&&F(i.cm,"beforeChange",i.cm,o),o.canceled?(i.cm&&(i.cm.curOp.updateInput=2),null):{from:o.from,to:o.to,text:o.text,origin:o.origin}}function _i(e,t,n){if(e.cm){if(!e.cm.curOp)return D(e.cm,_i)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Ve(e,"beforeChange")||e.cm&&Ve(e.cm,"beforeChange"))||(t=Yi(e,t,!0))){var r=Pt&&!n&&((e,t,n)=>{var r=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&-1!=S(r,n)||(r=r||[]).push(n)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var l=r[o],s=l.find(0),a=0;a<i.length;++a){var u,c,h,d=i[a];O(d.to,s.from)<0||0<O(d.from,s.to)||(u=[a,1],c=O(d.from,s.from),h=O(d.to,s.to),(c<0||!l.inclusiveLeft&&!c)&&u.push({from:d.from,to:s.from}),(0<h||!l.inclusiveRight&&!h)&&u.push({from:s.to,to:d.to}),i.splice.apply(i,u),a+=u.length-3)}return i})(e,t.from,t.to);if(r)for(var i=r.length-1;0<=i;--i)$i(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $i(e,t)}}function $i(e,n){var t,r;1==n.text.length&&""==n.text[0]&&0==O(n.from,n.to)||(t=pi(e,n),Ti(e,n,t,e.cm?e.cm.curOp.id:NaN),Qi(e,n,t,Bt(e,n)),r=[],wi(e,function(e,t){t||-1!=S(r,e.history)||(no(e.history,n),r.push(e.history)),Qi(e,n,null,Bt(e,n))}))}function qi(i,o,e){var t=i.cm&&i.cm.state.suppressEdits;if(!t||e){for(var l,n=i.history,r=i.sel,s="undo"==o?n.done:n.undone,a="undo"==o?n.undone:n.done,u=0;u<s.length&&(l=s[u],e?!l.ranges||l.equals(i.sel):l.ranges);u++);if(u!=s.length){for(n.lastOrigin=n.lastSelOrigin=null;;){if(!(l=s.pop()).ranges){if(t)return void s.push(l);break}if(Ni(l,a),e&&!l.equals(i.sel))return void B(i,l,{clearRedo:!1});r=l}for(var c=[],h=(Ni(r,a),a.push({changes:c,generation:n.generation}),n.generation=l.generation||++n.maxGeneration,Ve(i,"beforeChange")||i.cm&&Ve(i.cm,"beforeChange")),d=l.changes.length-1;0<=d;--d){var f=(e=>{var n=l.changes[e];if(n.origin=o,h&&!Yi(i,n,!1))return s.length=0,{};c.push(Li(i,n));var t=e?pi(i,n):z(s),r=(Qi(i,n,t,Di(i,n)),!e&&i.cm&&i.cm.scrollIntoView({from:n.from,to:di(n)}),[]);wi(i,function(e,t){t||-1!=S(r,e.history)||(no(e.history,n),r.push(e.history)),Qi(e,n,null,Di(e,n))})})(d);if(f)return f.v}}}}function Zi(e,t){if(0!=t&&(e.first+=t,e.sel=new W(be(e.sel.ranges,function(e){return new R(P(e.anchor.line+t,e.anchor.ch),P(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){A(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)hr(e.cm,r,"gutter")}}function Qi(e,t,n,r){if(e.cm&&!e.cm.curOp)return D(e.cm,Qi)(e,t,n,r);if(t.to.line<e.first)Zi(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){t.from.line<e.first&&(Zi(e,i=t.text.length-1-(e.first-t.from.line)),t={from:P(e.first,0),to:P(t.to.line+i,t.to.ch),text:[z(t.text)],origin:t.origin});var i=e.lastLine();if((t=t.to.line>i?{from:t.from,to:P(i,M(e,i).text.length),text:[t.text[0]],origin:t.origin}:t).removed=dt(e,t.from,t.to),n=n||pi(e,t),e.cm){var i=e.cm,o=t,l=r,s=i.doc,a=i.display,u=o.from,c=o.to,h=!1,d=u.line,f=(i.options.lineWrapping||(d=N(Zt(M(s,u.line))),s.iter(d,c.line+1,function(e){if(e==a.maxLine)return h=!0})),-1<s.sel.contains(o.from,o.to)&&Ue(i),bi(s,o,l,sr(i)),i.options.lineWrapping||(s.iter(d,u.line+o.text.length,function(e){var t=nn(e);t>a.maxLineLength&&(a.maxLine=e,a.maxLineLength=t,a.maxLineChanged=!0,h=!1)}),h&&(i.curOp.updateMaxLine=!0)),s),p=u.line;if(f.modeFrontier=Math.min(f.modeFrontier,p),!(f.highlightFrontier<p-10)){for(var g=f.first,m=p-1;g<m;m--){var v=M(f,m).stateAfter;if(v&&(!(v instanceof Lt)||m+v.lookAhead<p)){g=m+1;break}}f.highlightFrontier=Math.min(f.highlightFrontier,g)}Xr(i,400),l=o.text.length-(c.line-u.line)-1,o.full?A(i):u.line!=c.line||1!=o.text.length||yi(i.doc,o)?A(i,u.line,c.line+1,l):hr(i,u.line,"text"),d=Ve(i,"changes"),((s=Ve(i,"change"))||d)&&(l={from:u,to:c,text:o.text,removed:o.removed,origin:o.origin},s&&b(i,"change",i,l),d)&&(i.curOp.changeObjs||(i.curOp.changeObjs=[])).push(l),i.display.selForContextMenu=null}else bi(e,t,r);Ri(e,n,fe),e.cantEdit&&Ki(e,P(e.firstLine(),0))&&(e.cantEdit=!1)}}function Ji(e,t,n,r,i){var o;O(r=r||n,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),_i(e,{from:n,to:r,text:t,origin:i})}function eo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function to(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var s=0;s<o.ranges.length;s++)eo(o.ranges[s].anchor,t,n,r),eo(o.ranges[s].head,t,n,r)}else{for(var a=0;a<o.changes.length;++a){var u=o.changes[a];if(n<u.from.line)u.from=P(u.from.line+r,u.from.ch),u.to=P(u.to.line+r,u.to.ch);else if(t<=u.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function no(e,t){var n=t.from.line,r=t.to.line,t=t.text.length-(r-n)-1;to(e.done,n,r,t),to(e.undone,n,r,t)}function ro(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=M(e,Ct(e,t)):i=N(t),null==i?null:(r(o,i)&&e.cm&&hr(e.cm,i,n),o)}function io(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}function oo(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}R.prototype.from=function(){return xt(this.anchor,this.head)},R.prototype.to=function(){return wt(this.anchor,this.head)},R.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},io.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n,r=e,i=e+t;r<i;++r){var o=this.lines[r];this.height-=o.height,(n=o).parent=null,Ut(n),b(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},oo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n,r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e),s=i.height;if(i.removeInner(e,l),this.height-=s-i.height,o==l&&(this.children.splice(r--,1),i.parent=null),0==(t-=l))break;e=0}else e-=o}this.size-t<25&&(1<this.children.length||!(this.children[0]instanceof io))&&(this.collapse(n=[]),this.children=[new io(n)],this.children[0].parent=this)},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,n),i.lines&&50<i.lines.length){for(var l=i.lines.length%25+25,s=l;s<i.lines.length;){var a=new io(i.lines.slice(s,s+=25));i.height-=a.height,this.children.splice(++r,0,a),a.parent=this}i.lines=i.lines.slice(0,l),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t,n=new oo(e.children.splice(e.children.length-5,5))}while(e.parent?(e.size-=n.size,e.height-=n.height,t=S(e.parent.children,e),e.parent.children.splice(t+1,0,n)):(((t=new oo(e.children)).parent=e).children=[t,n],e=t),n.parent=e.parent,10<e.children.length);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e);if(i.iterN(e,l,n))return!0;if(0==(t-=l))break;e=0}else e-=o}}};function lo(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t}function so(e,t,n){tn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Nr(e,n)}lo.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=N(n);if(null!=r&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var o=kn(this);pt(n,Math.max(0,n.height-o)),e&&(h(e,function(){so(e,n,-o),hr(e,r,"widget")}),b(e,"lineWidgetCleared",e,this,r))}},lo.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line,i=(this.height=null,kn(this)-t);i&&(en(this.doc,r)||pt(r,r.height+i),n)&&h(n,function(){n.curOp.forceUpdate=!0,so(n,r,i),b(n,"lineWidgetChanged",n,e,N(r))})},Ke(lo);function ao(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++uo}var uo=0;function co(t,n,r,e,i){if(e&&e.shared)return f=t,o=n,l=r,a=i,(s=ae(s=e)).shared=!1,u=[co(f,o,l,s,a)],c=u[0],h=s.widgetNode,wi(f,function(e){h&&(s.widgetNode=h.cloneNode(!0)),u.push(co(e,I(e,o),I(e,l),s,a));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;c=z(u)}),new ho(u,c);var o,l,s,a,u,c,h;if(t.cm&&!t.cm.curOp)return D(t.cm,co)(t,n,r,e,i);var d=new ao(t,i),f=O(n,r);if(e&&ae(e,d,!1),!(0<f||0==f&&!1!==d.clearWhenEmpty)){if(d.replacedWith&&(d.collapsed=!0,d.widgetNode=ee("span",[d.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||d.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft)&&(d.widgetNode.insertLeft=!0),d.collapsed){if(qt(t,n.line,n,r,d)||n.line!=r.line&&qt(t,r.line,n,r,d))throw new Error("Inserting collapsed marker partially overlapping an existing one");It=!0}d.addToHistory&&Ti(t,{from:n,to:r,origin:"markText"},t.sel,NaN);var p,g=n.line,m=t.cm;if(t.iter(g,r.line+1,function(e){var t;m&&d.collapsed&&!m.options.lineWrapping&&Zt(e)==m.display.maxLine&&(p=!0),d.collapsed&&g!=n.line&&pt(e,0),e=e,t=new zt(d,g==n.line?n.ch:null,g==r.line?r.ch:null),e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e),++g}),d.collapsed&&t.iter(n.line,r.line+1,function(e){en(t,e)&&pt(e,0)}),d.clearOnEnter&&L(d,"beforeCursorEnter",function(){return d.clear()}),d.readOnly&&(Pt=!0,t.history.done.length||t.history.undone.length)&&t.clearHistory(),d.collapsed&&(d.id=++uo,d.atomic=!0),m){if(p&&(m.curOp.updateMaxLine=!0),d.collapsed)A(m,n.line,r.line+1);else if(d.className||d.startStyle||d.endStyle||d.css||d.attributes||d.title)for(var v=n.line;v<=r.line;v++)hr(m,v,"text");d.atomic&&Gi(m.doc),b(m,"markerAdded",m,d)}}return d}ao.prototype.clear=function(){if(!this.explicitlyCleared){for(var e,t=this.doc.cm,n=t&&!t.curOp,r=(n&&Kr(t),Ve(this,"clear")&&(e=this.find())&&b(this,"clear",e.from,e.to),null),i=null,o=0;o<this.lines.length;++o){var l=this.lines[o],s=Rt(l.markedSpans,this);t&&!this.collapsed?hr(t,N(l),"text"):t&&(null!=s.to&&(i=N(l)),null!=s.from)&&(r=N(l)),l.markedSpans=((e,t)=>{for(var n,r=0;r<e.length;++r)e[r]!=t&&(n=n||[]).push(e[r]);return n})(l.markedSpans,s),null==s.from&&this.collapsed&&!en(this.doc,l)&&t&&pt(l,rr(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var a=0;a<this.lines.length;++a){var u=Zt(this.lines[a]),c=nn(u);c>t.display.maxLineLength&&(t.display.maxLine=u,t.display.maxLineLength=c,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&A(t,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t)&&Gi(t.doc),t&&b(t,"markerCleared",t,this,r,i),n&&jr(t),this.parent&&this.parent.clear()}},ao.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],l=Rt(o.markedSpans,this);if(null!=l.from&&(n=P(t?o:N(o),l.from),-1==e))return n;if(null!=l.to&&(r=P(t?o:N(o),l.to),1==e))return r}return n&&{from:n,to:r}},ao.prototype.changed=function(){var n=this,r=this.find(-1,!0),i=this,o=this.doc.cm;r&&o&&h(o,function(){var e=r.line,t=N(r.line),t=En(o,t);t&&(Gn(t),o.curOp.selectionChanged=o.curOp.forceUpdate=!0),o.curOp.updateMaxLine=!0,!en(i.doc,e)&&null!=i.height&&(t=i.height,i.height=null,t=kn(i)-t)&&pt(e,e.height+t),b(o,"markerChanged",o,n)})},ao.prototype.attachLine=function(e){var t;this.lines.length||!this.doc.cm||(t=this.doc.cm.curOp).maybeHiddenMarkers&&-1!=S(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this),this.lines.push(e)},ao.prototype.detachLine=function(e){this.lines.splice(S(this.lines,e),1),!this.lines.length&&this.doc.cm&&((e=this.doc.cm.curOp).maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)},Ke(ao);var ho=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function fo(e){return e.findMarks(P(e.first,0),e.clipPos(P(e.lastLine())),function(e){return e.parent})}function po(o){for(var e=0;e<o.length;e++)(e=>{var t=o[e],n=[t.primary.doc];wi(t.primary.doc,function(e){return n.push(e)});for(var r=0;r<t.markers.length;r++){var i=t.markers[r];-1==S(n,i.doc)&&(i.parent=null,t.markers.splice(r--,1))}})(e)}ho.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();b(this,"clear")}},ho.prototype.find=function(e,t){return this.primary.find(e,t)},Ke(ho);function p(e,t,n,r,i){if(!(this instanceof p))return new p(e,t,n,r,i);null==n&&(n=0),oo.call(this,[new io([new on("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,n=P(this.modeFrontier=this.highlightFrontier=n,0),this.sel=hi(n),this.history=new Si(null),this.id=++go,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),bi(this,{from:n,to:n,text:e}),B(this,hi(n),fe)}var go=0,mo=((p.prototype=xe(oo.prototype,{constructor:p,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ft(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:r(function(e){var t=P(this.first,0),n=this.first+this.size-1;_i(this,{from:t,to:P(n,M(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ar(this.cm,0,0),B(this,hi(t),fe)}),replaceRange:function(e,t,n,r){Ji(this,e,t=I(this,t),n=n?I(this,n):t,r)},getRange:function(e,t,n){e=dt(this,I(this,e),I(this,t));return!1===n?e:e.join(n||this.lineSeparator())},getLine:function(e){e=this.getLineHandle(e);return e&&e.text},getLineHandle:function(e){if(mt(this,e))return M(this,e)},getLineNumber:N,getLineHandleVisualStart:function(e){return Zt(e="number"==typeof e?M(this,e):e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return I(this,e)},getCursor:function(e){var t=this.sel.primary(),e=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from();return e},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:r(function(e,t,n){Ii(this,I(this,"number"==typeof e?P(e,t||0):e),null,n)}),setSelection:r(function(e,t,n){Ii(this,I(this,e),I(this,t||e),n)}),extendSelection:r(function(e,t,n){Fi(this,I(this,e),t&&I(this,t),n)}),extendSelections:r(function(e,t){Ei(this,St(this,e),t)}),extendSelectionsBy:r(function(e,t){Ei(this,St(this,be(this.sel.ranges,e)),t)}),setSelections:r(function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new R(I(this,e[i].anchor),I(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),B(this,ci(this.cm,r,t),n)}}),addSelection:r(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new R(I(this,e),I(this,t||e))),B(this,ci(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n=0;n<t.length;n++)var r=dt(this,t[n].from(),t[n].to()),i=i?i.concat(r):r;return!1===e?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=dt(this,n[r].from(),n[r].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:r(function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];r[o]={from:l.from(),to:l.to(),text:this.splitLines(e[o]),origin:n}}for(var t=t&&"end"!=t&&((e,t,n)=>{for(var r=[],i=u=P(e.first,0),o=0;o<t.length;o++){var l=t[o],s=gi(l.from,u,i),a=gi(di(l),u,i),u=l.to,i=a;"around"==n?(l=O((l=e.sel.ranges[o]).head,l.anchor)<0,r[o]=new R(l?a:s,l?s:a)):r[o]=new R(s,s)}return new W(r,e.sel.primIndex)})(this,r,t),s=r.length-1;0<=s;s--)_i(this,r[s]);t?zi(this,t):this.cm&&Or(this.cm)}),undo:r(function(){qi(this,"undo")}),redo:r(function(){qi(this,"redo")}),undoSelection:r(function(){qi(this,"undo",!0)}),redoSelection:r(function(){qi(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var t=this;this.history=new Si(this.history.maxGeneration),wi(this,function(e){return e.history=t.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Wi(this.history.done),undone:Wi(this.history.undone)}},setHistory:function(e){var t=this.history=new Si(this.history.maxGeneration);t.done=Wi(e.done.slice(0),null,!0),t.undone=Wi(e.undone.slice(0),null,!0)},setGutterMarker:r(function(e,n,r){return ro(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[n]=r)&&ke(t)&&(e.gutterMarkers=null),1})}),clearGutter:r(function(t){var n=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&ro(n,e,"gutter",function(){return e.gutterMarkers[t]=null,ke(e.gutterMarkers)&&(e.gutterMarkers=null),1})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!mt(this,e))return null;if(!(e=M(this,t=e)))return null}else if(null==(t=N(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:r(function(e,n,r){return ro(this,e,"gutter"==n?"gutter":"class",function(e){var t="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(e[t]){if(Z(r).test(e[t]))return;e[t]+=" "+r}else e[t]=r;return 1})}),removeLineClass:r(function(e,o,l){return ro(this,e,"gutter"==o?"gutter":"class",function(e){var t="text"==o?"textClass":"background"==o?"bgClass":"gutter"==o?"gutterClass":"wrapClass",n=e[t];if(n){if(null==l)e[t]=null;else{var r=n.match(Z(l));if(!r)return;var i=r.index+r[0].length;e[t]=n.slice(0,r.index)+(r.index&&i!=n.length?" ":"")+n.slice(i)||null}return 1}})}),addLineWidget:r(function(e,t,n){return e=e,i=new lo(r=this,t,n),(o=r.cm)&&i.noHScroll&&(o.display.alignWidgets=!0),ro(r,e,"widget",function(e){var t=e.widgets||(e.widgets=[]);return null==i.insertAt?t.push(i):t.splice(Math.min(t.length,Math.max(0,i.insertAt)),0,i),i.line=e,o&&!en(r,e)&&(t=tn(e)<r.scrollTop,pt(e,e.height+kn(i)),t&&Nr(o,i.height),o.curOp.forceUpdate=!0),1}),o&&b(o,"lineWidgetAdded",o,i,"number"==typeof e?e:N(e)),i;var r,i,o}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return co(this,I(this,e),I(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){t={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return co(this,e=I(this,e),e,t,"bookmark")},findMarksAt:function(e){var t=[],n=M(this,(e=I(this,e)).line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(i,o,l){i=I(this,i),o=I(this,o);var s=[],a=i.line;return this.iter(i.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var n=0;n<t.length;n++){var r=t[n];null!=r.to&&a==i.line&&i.ch>=r.to||null==r.from&&a!=i.line||null!=r.from&&a==o.line&&r.from>=o.ch||l&&!l(r.marker)||s.push(r.marker.parent||r.marker)}++a}),s},getAllMarks:function(){var r=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var n=0;n<t.length;++n)null!=t[n].from&&r.push(t[n].marker)}),r},posFromIndex:function(t){var n,r=this.first,i=this.lineSeparator().length;return this.iter(function(e){e=e.text.length+i;if(t<e)return n=t,!0;t-=e,++r}),I(this,P(r,n))},indexFromPos:function(e){var t,n=(e=I(this,e)).ch;return e.line<this.first||e.ch<0?0:(t=this.lineSeparator().length,this.iter(this.first,e.line,function(e){n+=e.text.length+t}),n)},copy:function(e){var t=new p(ft(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,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){for(var t=this.first,n=this.first+this.size,n=(null!=(e=e||{}).from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to),new p(ft(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction)),r=(e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],n),i=fo(this),o=0;o<i.length;o++){var l=i[o],s=l.find(),a=r.clipPos(s.from),s=r.clipPos(s.to);O(a,s)&&(a=co(r,a,s,l.primary,l.primary.type),l.markers.push(a),a.parent=l)}return n},unlinkDoc:function(e){if(e instanceof m&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),po(fo(this));break}}var r;e.history==this.history&&(r=[e.id],wi(e,function(e){return r.push(e.id)},!0),e.history=new Si(null),e.history.done=Wi(this.history.done,r),e.history.undone=Wi(this.history.undone,r))},iterLinkedDocs:function(e){wi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Je(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:r(function(e){var t;(e="rtl"!=e?"ltr":e)!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm)&&h(t=this.cm,function(){Ci(t),A(t)})})})).eachLine=p.prototype.iter,0);function vo(e){var r=this;if(yo(r),!E(r,e)&&!Tn(r.display,e)){T(e),w&&(mo=+new Date);var t=ur(r,e,!0),n=e.dataTransfer.files;if(t&&!r.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,s=function(){++l==i&&D(r,function(){var e={from:t=I(r.doc,t),to:t,text:r.doc.splitLines(o.filter(function(e){return null!=e}).join(r.doc.lineSeparator())),origin:"paste"};_i(r.doc,e),zi(r.doc,hi(I(r.doc,t),I(r.doc,di(e))))})()},a=0;a<n.length;a++)((e,t)=>{var n;r.options.allowDropFileTypes&&-1==S(r.options.allowDropFileTypes,e.type)?s():((n=new FileReader).onerror=function(){return s()},n.onload=function(){var e=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[t]=e),s()},n.readAsText(e))})(n[a],a);else if(r.state.draggingText&&-1<r.doc.sel.contains(t))r.state.draggingText(e),setTimeout(function(){return r.display.input.focus()},20);else try{var u,c=e.dataTransfer.getData("Text");if(c){if(r.state.draggingText&&!r.state.draggingText.copy&&(u=r.listSelections()),Ri(r.doc,hi(t,t)),u)for(var h=0;h<u.length;++h)Ji(r.doc,"",u[h].anchor,u[h].head,"drag");r.replaceSelection(c,"around","paste"),r.display.input.focus()}}catch(e){}}}function yo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function bo(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<e.length;r++){var i=e[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var e=0;e<n.length;e++)t(n[e])})}}var wo=!1;function xo(){var e;wo||(L(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,bo(Co)},100))}),L(window,"blur",function(){return bo(Sr)}),wo=!0)}function Co(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var So={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:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Lo=0;Lo<10;Lo++)So[Lo+48]=So[Lo+96]=String(Lo);for(var ko=65;ko<=90;ko++)So[ko]=String.fromCharCode(ko);for(var To=1;To<=12;To++)So[To+111]=So[To+63235]="F"+To;var Mo={};function No(e){var t,n,r,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var l=0;l<o.length-1;l++){var s=o[l];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),e=r?"Shift-"+e:e}function Oo(e){var t,n,r={};for(t in e)if(e.hasOwnProperty(t)){var i=e[t];if(!/^(name|fallthrough|(de|at)tach)$/.test(t)){if("..."!=i)for(var o=be(t.split(" "),No),l=0;l<o.length;l++){var s=void 0,a=void 0,s=l==o.length-1?(a=o.join(" "),i):(a=o.slice(0,l+1).join(" "),"..."),u=r[a];if(u){if(u!=s)throw new Error("Inconsistent bindings for "+a)}else r[a]=s}delete e[t]}}for(n in r)e[n]=r[n];return e}function Ao(e,t,n,r){var i=(t=Fo(t)).call?t.call(e,r):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Ao(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var l=Ao(e,t.fallthrough[o],n,r);if(l)return l}}}function Do(e){e="string"==typeof e?e:So[e.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function Wo(e,t,n){var r=e;return t.altKey&&"Alt"!=r&&(e="Alt-"+e),($?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),($?t.ctrlKey:t.metaKey)&&"Mod"!=r&&(e="Cmd-"+e),e=!n&&t.shiftKey&&"Shift"!=r?"Shift-"+e:e}function Ho(e,t){var n;return!(U&&34==e.keyCode&&e.char||null==(n=So[e.keyCode])||e.altGraphKey)&&Wo(n=3==e.keyCode&&e.code?e.code:n,e,t)}function Fo(e){return"string"==typeof e?Mo[e]:e}function Eo(t,e){for(var n=t.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=e(n[i]);r.length&&O(o.from,z(r).to)<=0;){var l=r.pop();if(O(l.from,o.from)<0){o.from=l.from;break}}r.push(o)}h(t,function(){for(var e=r.length-1;0<=e;e--)Ji(t.doc,"",r[e].from,r[e].to,"+delete");Or(t)})}function Po(e,t,n){t=Ne(e.text,t+n,n);return t<0||t>e.text.length?null:t}function Io(e,t,n){e=Po(e,t.ch,n);return null==e?null:new P(t.line,e,n<0?"after":"before")}function zo(e,t,n,r,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o,l,s,a,e=Re(n,t.doc.direction);if(e)return o=i<0==(1==(e=i<0?z(e):e[0]).level)?"after":"before",0<e.level||"rtl"==t.doc.direction?(l=Pn(t,n),s=i<0?n.text.length-1:0,a=In(t,l,s).top,s=Oe(function(e){return In(t,l,e).top==a},i<0==(1==e.level)?e.from:e.to-1,s),"before"==o&&(s=Po(n,s,1))):s=i<0?e.to:e.from,new P(r,s,o)}return new P(r,i<0?n.text.length:0,i<0?"before":"after")}function Ro(t,n,s,e){var a=Re(n,t.doc.direction);if(!a)return Io(n,s,e);s.ch>=n.text.length?(s.ch=n.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var r=De(a,s.ch,s.sticky),i=a[r];if("ltr"==t.doc.direction&&i.level%2==0&&(0<e?i.to>s.ch:i.from<s.ch))return Io(n,s,e);function u(e,t){return Po(n,e instanceof P?e.ch:e,t)}function o(e){return t.options.lineWrapping?(l=l||Pn(t,n),tr(t,n,l,e)):{begin:0,end:n.text.length}}var l,c=o("before"==s.sticky?u(s,-1):s.ch);if("rtl"==t.doc.direction||1==i.level){var h=1==i.level==e<0,d=u(s,h?1:-1);if(null!=d&&(h?d<=i.to&&d<=c.end:d>=i.from&&d>=c.begin))return new P(s.line,d,h?"before":"after")}function f(e,t,n){for(var r=function(e,t){return t?new P(s.line,u(e,1),"before"):new P(s.line,e,"after")};0<=e&&e<a.length;e+=t){var i=a[e],o=0<t==(1!=i.level),l=o?n.begin:u(n.end,-1);if(i.from<=l&&l<i.to)return r(l,o);if(l=o?i.from:u(i.to,-1),n.begin<=l&&l<n.end)return r(l,o)}}i=f(r+e,e,c);return i||(null==(d=0<e?c.end:u(c.begin,-1))||0<e&&d==n.text.length||!(i=f(0<e?0:a.length-1,e,o(d)))?null:i)}Mo.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"},Mo.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"},Mo.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"},Mo.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"]},Mo.default=C?Mo.macDefault:Mo.pcDefault;var Bo={selectAll:Xi,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),fe)},killLine:function(n){return Eo(n,function(e){var t;return e.empty()?(t=M(n.doc,e.head.line).text.length,e.head.ch==t&&e.head.line<n.lastLine()?{from:e.head,to:P(e.head.line+1,0)}:{from:e.head,to:P(e.head.line,t)}):{from:e.from(),to:e.to()}})},deleteLine:function(t){return Eo(t,function(e){return{from:P(e.from().line,0),to:I(t.doc,P(e.to().line+1,0))}})},delLineLeft:function(e){return Eo(e,function(e){return{from:P(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(n){return Eo(n,function(e){var t=n.charCoords(e.head,"div").top+5;return{from:n.coordsChar({left:0,top:t},"div"),to:e.from()}})},delWrappedLineRight:function(n){return Eo(n,function(e){var t=n.charCoords(e.head,"div").top+5,t=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:t}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(P(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(P(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return Go(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return Uo(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(i){return i.extendSelectionsBy(function(e){var t=i,e=e.head.line,n=M(t.doc,e),r=(e=>{for(var t;t=$t(e);)e=t.find(1,!0).line;return e})(n);return r!=n&&(e=N(r)),zo(!0,t,n,e,-1)},{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy(function(e){e=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:e},"div")},ge)},goLineLeft:function(t){return t.extendSelectionsBy(function(e){e=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:e},"div")},ge)},goLineLeftSmart:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5,t=n.coordsChar({left:0,top:t},"div");return t.ch<n.getLine(t.line).search(/\S/)?Uo(n,e.head):t},ge)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),o=ue(e.getLine(o.line),o.ch,r);t.push(ye(r-o%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(l){return h(l,function(){for(var e,t,n,r=l.listSelections(),i=[],o=0;o<r.length;o++)r[o].empty()&&(e=r[o].head,(t=M(l.doc,e.line).text)&&(0<(e=e.ch==t.length?new P(e.line,e.ch-1):e).ch?(e=new P(e.line,e.ch+1),l.replaceRange(t.charAt(e.ch-1)+t.charAt(e.ch-2),P(e.line,e.ch-2),e,"+transpose")):e.line>l.doc.first&&(n=M(l.doc,e.line-1).text)&&(e=new P(e.line,1),l.replaceRange(t.charAt(0)+l.doc.lineSeparator()+n.charAt(n.length-1),P(e.line-1,n.length-1),e,"+transpose"))),i.push(new R(e,e)));l.setSelections(i)})},newlineAndIndent:function(r){return h(r,function(){for(var e=(t=r.listSelections()).length-1;0<=e;e--)r.replaceRange(r.doc.lineSeparator(),t[e].anchor,t[e].head,"+input");for(var t=r.listSelections(),n=0;n<t.length;n++)r.indentLine(t[n].from().line,null,!0);Or(r)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Go(e,t){var n=M(e.doc,t),r=Zt(n);return zo(!0,e,r,t=r!=n?N(r):t,1)}function Uo(e,t){var n=Go(e,t.line),r=M(e.doc,n.line),e=Re(r,e.doc.direction);return e&&0!=e[0].level?n:(e=Math.max(n.ch,r.text.search(/\S/)),r=t.line==n.line&&t.ch<=e&&t.ch,P(n.line,r?0:e,n.sticky))}function Vo(e,t,n){if("string"==typeof t&&!(t=Bo[t]))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=de}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}var Ko=new ce;function jo(e,t,n,r){var i=e.state.keySeq;if(i){if(Do(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ko.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),Xo(e,i+" "+t,n,r))return!0}return Xo(e,t,n,r)}function Xo(e,t,n,r){r=((e,t,n)=>{for(var r=0;r<e.state.keyMaps.length;r++){var i=Ao(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Ao(t,e.options.extraKeys,n,e)||Ao(t,e.options.keyMap,n,e)})(e,t,r);return"multi"==r&&(e.state.keySeq=t),"handled"==r&&b(e,"keyHandled",e,t,n),"handled"!=r&&"multi"!=r||(T(n),br(e)),!!r}function Yo(t,e){var n=Ho(e,!0);return!!n&&(e.shiftKey&&!t.state.keySeq?jo(t,"Shift-"+n,e,function(e){return Vo(t,e,!0)})||jo(t,n,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return Vo(t,e)}):jo(t,n,e,function(e){return Vo(t,e)}))}var _o=null;function $o(e){var t,n,r,i=this;function o(e){18!=e.keyCode&&e.altKey||(Q(r,"CodeMirror-crosshair"),k(document,"keyup",o),k(document,"mouseover",o))}e.target&&e.target!=i.display.input.getField()||(i.curOp.focus=ne(),E(i,e))||(w&&v<11&&27==e.keyCode&&(e.returnValue=!1),i.display.shift=16==(t=e.keyCode)||e.shiftKey,n=Yo(i,e),U&&(_o=n?t:null,!n)&&88==t&&!tt&&(C?e.metaKey:e.ctrlKey)&&i.replaceSelection("",null,"cut"),G&&!C&&!n&&46==t&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=t)||/\bCodeMirror-crosshair\b/.test(i.display.lineDiv.className)||(re(r=i.display.lineDiv,"CodeMirror-crosshair"),L(document,"keyup",o),L(document,"mouseover",o))}function qo(e){16==e.keyCode&&(this.doc.sel.shift=!1),E(this,e)}function Zo(e){var t,n,r,i=this;e.target&&e.target!=i.display.input.getField()||Tn(i.display,e)||E(i,e)||e.ctrlKey&&!e.altKey||C&&e.metaKey||(n=e.keyCode,t=e.charCode,U&&n==_o?(_o=null,T(e)):U&&(!e.which||e.which<10)&&Yo(i,e)||"\b"==(n=String.fromCharCode(null==t?n:t))||jo(r=i,"'"+n+"'",e,function(e){return Vo(r,e,!0)})||i.display.input.onKeyPress(e))}var Qo,Jo,el=function(e,t,n){this.time=e,this.pos=t,this.button=n};function tl(e){var t,n,r,i,o,l,s,a,u,c=this,h=c.display;E(c,e)||h.activeTouch&&h.input.supportsTouch()||(h.input.ensurePolled(),h.shift=e.shiftKey,Tn(h,e)?x||(h.scroller.draggable=!1,setTimeout(function(){return h.scroller.draggable=!0},100)):il(c,e)||(t=ur(c,e),n=$e(e),r=t?(i=t,o=n,r=+new Date,Jo&&Jo.compare(r,i,o)?(Qo=Jo=null,"triple"):Qo&&Qo.compare(r,i,o)?(Jo=new el(r,i,o),Qo=null,"double"):(Qo=new el(r,i,o),Jo=null,"single")):"single",window.focus(),1==n&&c.state.selectingText&&c.state.selectingText(e),t&&((n,e,r,t,i)=>{var o="Click";return"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o),jo(n,Wo(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,function(e){if(!(e="string"==typeof e?Bo[e]:e))return!1;var t=!1;try{n.isReadOnly()&&(n.state.suppressEdits=!0),t=e(n,r)!=de}finally{n.state.suppressEdits=!1}return t})})(c,n,t,r,e))||(1==n?t?(i=c,o=t,l=r,s=e,w?setTimeout(se(wr,i),0):i.curOp.focus=ne(),a=((e,t,n)=>{var r,i=e.getOption("configureMouse");return null==(i=i?i(e,t,n):{}).unit&&(r=_?n.shiftKey&&n.metaKey:n.altKey,i.unit=r?"rectangle":"single"==t?"char":"double"==t?"word":"line"),null!=i.extend&&!e.doc.extend||(i.extend=e.doc.extend||n.shiftKey),null==i.addNew&&(i.addNew=C?n.metaKey:n.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(C?n.altKey:n.ctrlKey)),i})(i,l,s),u=i.doc.sel,(i.options.dragDrop&&Qe&&!i.isReadOnly()&&"single"==l&&-1<(l=u.contains(o))&&(O((l=u.ranges[l]).from(),o)<0||0<o.xRel)&&(0<O(l.to(),o)||o.xRel<0)?(t,n,r,i)=>{var o=t.display,l=!1,s=D(t,function(e){x&&(o.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:xr(t)),k(o.wrapper.ownerDocument,"mouseup",s),k(o.wrapper.ownerDocument,"mousemove",a),k(o.scroller,"dragstart",u),k(o.scroller,"drop",s),l||(T(e),i.addNew||Fi(t.doc,r,null,null,i.extend),x&&!V||w&&9==v?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),a=function(e){l=l||10<=Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY)},u=function(){return l=!0};x&&(o.scroller.draggable=!0),(t.state.draggingText=s).copy=!i.moveOnDrag,L(o.wrapper.ownerDocument,"mouseup",s),L(o.wrapper.ownerDocument,"mousemove",a),L(o.scroller,"dragstart",u),L(o.scroller,"drop",s),t.state.delayingBlurEvent=!0,setTimeout(function(){return o.input.focus()},20),o.scroller.dragDrop&&o.scroller.dragDrop()}:(d,e,f,p)=>{w&&xr(d);var l=d.display,g=d.doc;T(e);var m,v,y=g.sel,t=y.ranges,b=(p.addNew&&!p.extend?(v=g.sel.contains(f),m=-1<v?t[v]:new R(f,f)):(m=g.sel.primary(),v=g.sel.primIndex),"rectangle"==p.unit?(p.addNew||(m=new R(f,f)),f=ur(d,e,!0,!0),v=-1):(e=nl(d,f,p.unit),m=p.extend?Hi(m,e.anchor,e.head,p.extend):e),p.addNew?-1==v?(v=t.length,B(g,ci(d,t.concat([m]),v),{scroll:!1,origin:"*mouse"})):1<t.length&&t[v].empty()&&"char"==p.unit&&!p.extend?(B(g,ci(d,t.slice(0,v).concat(t.slice(v+1)),0),{scroll:!1,origin:"*mouse"}),y=g.sel):Pi(g,v,m,pe):(B(g,new W([m],v=0),pe),y=g.sel),f);function s(e){if(0!=O(b,e))if(b=e,"rectangle"==p.unit){for(var t=[],n=d.options.tabSize,r=ue(M(g,f.line).text,f.ch,n),i=ue(M(g,e.line).text,e.ch,n),o=Math.min(r,i),l=Math.max(r,i),s=Math.min(f.line,e.line),a=Math.min(d.lastLine(),Math.max(f.line,e.line));s<=a;s++){var u=M(g,s).text,c=me(u,o,n);o==l?t.push(new R(P(s,c),P(s,c))):u.length>c&&t.push(new R(P(s,c),P(s,me(u,l,n))))}t.length||t.push(new R(f,f)),B(g,ci(d,y.ranges.slice(0,v).concat(t),v),{origin:"*mouse",scroll:!1}),d.scrollIntoView(e)}else{var h,r=m,i=nl(d,e,p.unit),e=r.anchor,e=0<O(i.anchor,e)?(h=i.head,xt(r.from(),i.anchor)):(h=i.anchor,wt(r.to(),i.head)),r=y.ranges.slice(0);r[v]=((e,t)=>{var n,r,i,o=t.anchor,l=t.head,s=M(e.doc,o.line);return 0==O(o,l)&&o.sticky==l.sticky||!(s=Re(s))||(n=De(s,o.ch,o.sticky),(r=s[n]).from!=o.ch&&r.to!=o.ch)||0==(i=n+(r.from==o.ch==(1!=r.level)?0:1))||i==s.length||(n=(r=l.line!=o.line?0<(l.line-o.line)*("ltr"==e.doc.direction?1:-1):(e=De(s,l.ch,l.sticky),n=e-n||(l.ch-o.ch)*(1==r.level?-1:1),e==i-1||e==i?n<0:0<n))==(1==(e=s[i+(r?-1:0)]).level),s=n?e.from:e.to,i=n?"after":"before",o.ch==s&&o.sticky==i)?t:new R(new P(o.line,s,i),l)})(d,new R(I(g,e),h)),B(g,ci(d,r,v),pe)}}var a=l.wrapper.getBoundingClientRect(),u=0;function n(e){d.state.selectingText=!1,u=1/0,e&&(T(e),l.input.focus()),k(l.wrapper.ownerDocument,"mousemove",r),k(l.wrapper.ownerDocument,"mouseup",i),g.history.lastSelOrigin=null}var r=D(d,function(e){(0!==e.buttons&&$e(e)?function e(t){var n,r,i=++u,o=ur(d,t,!0,"rectangle"==p.unit);o&&(0!=O(o,b)?(d.curOp.focus=ne(),s(o),n=Tr(l,g),(o.line>=n.to||o.line<n.from)&&setTimeout(D(d,function(){u==i&&e(t)}),150)):(r=t.clientY<a.top?-20:t.clientY>a.bottom?20:0)&&setTimeout(D(d,function(){u==i&&(l.scroller.scrollTop+=r,e(t))}),50))}:n)(e)}),i=D(d,n);d.state.selectingText=i,L(l.wrapper.ownerDocument,"mousemove",r),L(l.wrapper.ownerDocument,"mouseup",i)})(i,s,o,a)):_e(e)==h.scroller&&T(e):2==n?(t&&Fi(c.doc,t),setTimeout(function(){return h.input.focus()},20)):3==n&&(q?c.display.input.onContextMenu(e):xr(c))))}function nl(e,t,n){return"char"==n?new R(t,t):"word"==n?e.findWordAt(t):"line"==n?new R(P(t.line,0),I(e.doc,P(t.line+1,0))):(n=n(e,t),new R(n.from,n.to))}function rl(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&T(t);var l=e.display,r=l.lineDiv.getBoundingClientRect();if(o>r.bottom||!Ve(e,n))return Xe(t);o-=r.top-l.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var a=l.gutters.childNodes[s];if(a&&a.getBoundingClientRect().right>=i)return F(e,n,e,gt(e.doc,o),e.display.gutterSpecs[s].className,t),Xe(t)}}function il(e,t){return rl(e,t,"gutterClick",!0)}function ol(e,t){var n,r;Tn(e.display,t)||(r=t,Ve(n=e,"gutterContextMenu")&&rl(n,r,"gutterContextMenu",!1))||(E(e,t,"contextmenu")||q||e.display.input.onContextMenu(t))}function ll(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Vn(e)}el.prototype.compare=function(e,t,n){return this.time+400>e&&0==O(t,this.pos)&&n==this.button};var sl={toString:function(){return"CodeMirror.Init"}},al={},ul={};function cl(e,t,n){!t!=!(n&&n!=sl)&&(n=e.display.dragFunctions,(t=t?L:k)(e.display.scroller,"dragstart",n.start),t(e.display.scroller,"dragenter",n.enter),t(e.display.scroller,"dragover",n.over),t(e.display.scroller,"dragleave",n.leave),t(e.display.scroller,"drop",n.drop))}function hl(e){e.options.lineWrapping?(re(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Q(e.display.wrapper,"CodeMirror-wrap"),rn(e)),ar(e),A(e),Vn(e),setTimeout(function(){return Rr(e)},100)}function m(e,t){var n=this;if(!(this instanceof m))return new m(e,t);this.options=t=t?ae(t):{},ae(al,t,!1);var r,i=t.value,o=("string"==typeof i?i=new p(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i,new m.inputStyles[t.inputStyle](this)),e=this.display=new oi(e,i,o,t),l=(ll(e.wrapper.CodeMirror=this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ur(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 ce,keySeq:null,specialChars:null},t.autofocus&&!Y&&e.input.focus(),w&&v<11&&setTimeout(function(){return n.display.input.reset(!0)},20),this),s=l.display;L(s.scroller,"mousedown",D(l,tl)),L(s.scroller,"dblclick",w&&v<11?D(l,function(e){var t;E(l,e)||!(t=ur(l,e))||il(l,e)||Tn(l.display,e)||(T(e),e=l.findWordAt(t),Fi(l.doc,e.anchor,e.head))}):function(e){return E(l,e)||T(e)}),L(s.scroller,"contextmenu",function(e){return ol(l,e)}),L(s.input.getField(),"contextmenu",function(e){s.scroller.contains(e.target)||ol(l,e)});var a,u={end:0};function c(){s.activeTouch&&(a=setTimeout(function(){return s.activeTouch=null},1e3),(u=s.activeTouch).end=+new Date)}function h(e,t){var n;return null==t.left||400<(n=t.left-e.left)*n+(n=t.top-e.top)*n}L(s.scroller,"touchstart",function(e){var t;E(l,e)||(e=>1==e.touches.length&&(e=e.touches[0]).radiusX<=1&&e.radiusY<=1)(e)||il(l,e)||(s.input.ensurePolled(),clearTimeout(a),t=+new Date,s.activeTouch={start:t,moved:!1,prev:t-u.end<=300?u:null},1==e.touches.length&&(s.activeTouch.left=e.touches[0].pageX,s.activeTouch.top=e.touches[0].pageY))}),L(s.scroller,"touchmove",function(){s.activeTouch&&(s.activeTouch.moved=!0)}),L(s.scroller,"touchend",function(e){var t,n=s.activeTouch;n&&!Tn(s,e)&&null!=n.left&&!n.moved&&new Date-n.start<300&&(t=l.coordsChar(s.activeTouch,"page"),n=!n.prev||h(n,n.prev)?new R(t,t):!n.prev.prev||h(n,n.prev.prev)?l.findWordAt(t):new R(P(t.line,0),I(l.doc,P(t.line+1,0))),l.setSelection(n.anchor,n.head),l.focus(),T(e)),c()}),L(s.scroller,"touchcancel",c),L(s.scroller,"scroll",function(){s.scroller.clientHeight&&(Hr(l,s.scroller.scrollTop),Er(l,s.scroller.scrollLeft,!0),F(l,"scroll",l))}),L(s.scroller,"mousewheel",function(e){return ui(l,e)}),L(s.scroller,"DOMMouseScroll",function(e){return ui(l,e)}),L(s.wrapper,"scroll",function(){return s.wrapper.scrollTop=s.wrapper.scrollLeft=0}),s.dragFunctions={enter:function(e){E(l,e)||Ye(e)},over:function(e){var t,n;E(l,e)||((n=ur(t=l,n=e))&&(vr(t,n,n=document.createDocumentFragment()),t.display.dragCursor||(t.display.dragCursor=H("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),y(t.display.dragCursor,n)),Ye(e))},start:function(e){var t,n;t=l,e=e,w&&(!t.state.draggingText||+new Date-mo<100)?Ye(e):E(t,e)||Tn(t.display,e)||(e.dataTransfer.setData("Text",t.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!V&&((n=H("img",null,null,"position: fixed; left: 0; top: 0;")).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",U&&(n.width=n.height=1,t.display.wrapper.appendChild(n),n._top=n.offsetTop),e.dataTransfer.setDragImage(n,0,0),U)&&n.parentNode.removeChild(n))},drop:D(l,vo),leave:function(e){E(l,e)||yo(l)}};o=s.input.getField();for(r in L(o,"keyup",function(e){return qo.call(l,e)}),L(o,"keydown",D(l,$o)),L(o,"keypress",D(l,Zo)),L(o,"focus",function(e){return Cr(l,e)}),L(o,"blur",function(e){return Sr(l,e)}),xo(),Kr(this),this.curOp.forceUpdate=!0,xi(this,i),t.autofocus&&!Y||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Cr(n)},20):Sr(this),ul)ul.hasOwnProperty(r)&&ul[r](this,t[r],sl);ti(this),t.finishInit&&t.finishInit(this);for(var d=0;d<dl.length;++d)dl[d](this);jr(this),x&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(e.lineDiv).textRendering&&(e.lineDiv.style.textRendering="auto")}m.defaults=al,m.optionHandlers=ul;var dl=[];function fl(e,t,n,r){var i,o=e.doc,l=("smart"==(n=null==n?"add":n)&&(o.mode.indent?i=Nt(e,t).state:n="prev"),e.options.tabSize),s=M(o,t),a=ue(s.text,null,l),u=(s.stateAfter&&(s.stateAfter=null),s.text.match(/^\s*/)[0]);if(r||/\S/.test(s.text)){if("smart"==n&&((c=o.mode.indent(i,s.text.slice(u.length),s.text))==de||150<c)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?ue(M(o,t-1).text,null,l):0:"add"==n?c=a+e.options.indentUnit:"subtract"==n?c=a-e.options.indentUnit:"number"==typeof n&&(c=a+n);var c=Math.max(0,c),h="",d=0;if(e.options.indentWithTabs)for(var f=Math.floor(c/l);f;--f)d+=l,h+="\t";if(d<c&&(h+=ye(c-d)),h!=u)return Ji(o,h,P(t,0),P(t,u.length),"+input"),!(s.stateAfter=null);for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<u.length){g=P(t,u.length);Pi(o,p,new R(g,g));break}}}m.defineInitHook=function(e){return dl.push(e)};var pl=null;function gl(e){pl=e}function ml(e,t,n,r,i){var o=e.doc,l=(e.display.shift=!1,r=r||o.sel,+new Date-200),s="paste"==i||e.state.pasteIncoming>l,a=Je(t),u=null;if(s&&1<r.ranges.length)if(pl&&pl.text.join("\n")==t){if(r.ranges.length%pl.text.length==0)for(var u=[],c=0;c<pl.text.length;c++)u.push(o.splitLines(pl.text[c]))}else a.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=be(a,function(e){return[e]}));for(var h=e.curOp.updateInput,d=r.ranges.length-1;0<=d;d--){var f=r.ranges[d],p=f.from(),g=f.to(),f=(f.empty()&&(n&&0<n?p=P(p.line,p.ch-n):e.state.overwrite&&!s?g=P(g.line,Math.min(M(o,g.line).text.length,g.ch+z(a).length)):s&&pl&&pl.lineWise&&pl.text.join("\n")==a.join("\n")&&(p=g=P(p.line,0))),{from:p,to:g,text:u?u[d%u.length]:a,origin:i||(s?"paste":e.state.cutIncoming>l?"cut":"+input")});_i(e.doc,f),b(e,"inputRead",e,f)}t&&!s&&yl(e,t),Or(e),e.curOp.updateInput<2&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function vl(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");return n&&(e.preventDefault(),t.isReadOnly()||t.options.disableInput||h(t,function(){return ml(t,n,0,null,"paste")}),1)}function yl(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;0<=r;r--){var i=n.ranges[r];if(!(100<i.head.ch||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(-1<t.indexOf(o.electricChars.charAt(s))){l=fl(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(M(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=fl(e,i.head.line,"smart"));l&&b(e,"electricInput",e,i.head.line)}}}function bl(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,i={anchor:P(i,0),head:P(i+1,0)};n.push(i),t.push(e.getRange(i.anchor,i.head))}return{text:t,ranges:n}}function wl(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function xl(){var e=H("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=H("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return x?e.style.width="1000px":e.setAttribute("wrap","off"),j&&(e.style.border="1px solid black"),wl(e),t}function Cl(n,r,i,o,l){var e=r,t=i,s=M(n,r.line),a=l&&"rtl"==n.direction?-i:i;function u(e){var t;if(null==(t="codepoint"==o?(t=s.text.charCodeAt(r.ch+(0<o?0:-1)),isNaN(t)?null:new P(r.line,Math.max(0,Math.min(s.text.length,r.ch+i*(55296<=t&&t<56320?2:1))),-i)):l?Ro(n.cm,s,r,i):Io(s,r,i))){if(e||(e=r.line+a)<n.first||e>=n.first+n.size||(r=new P(e,r.ch,r.sticky),!(s=M(n,e))))return;r=zo(l,n.cm,s,r.line,a)}else r=t;return 1}if("char"==o||"codepoint"==o)u();else if("column"==o)u(!0);else if("word"==o||"group"==o)for(var c=null,h="group"==o,d=n.cm&&n.cm.getHelper(r,"wordChars"),f=!0;!(i<0)||u(!f);f=!1){var p=s.text.charAt(r.ch)||"\n",p=Le(p,d)?"w":h&&"\n"==p?"n":!h||/\s/.test(p)?null:"p";if(h&&!f&&(p=p||"s"),c&&c!=p){i<0&&(i=1,u(),r.sticky="after");break}if(p&&(c=p),0<i&&!u(!f))break}t=Ki(n,r,e,t,!0);return yt(e,t)&&(t.hitSide=!0),t}function Sl(e,t,n,r){var i,o,l,s=e.doc,a=t.left;for("page"==r?(i=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),i=Math.max(i-.5*rr(e.display),3),o=(0<n?t.bottom:t.top)+n*i):"line"==r&&(o=0<n?t.bottom+3:t.top-3);(l=Jn(e,a,o)).outside;){if(n<0?o<=0:o>=s.height){l.hitSide=!0;break}o+=5*n}return l}function i(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ce,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}function Ll(e,t){var n,r,i=En(e,t.line);return!i||i.hidden?null:(n=Hn(i,i=M(e.doc,t.line),t.line),r="left",(i=Re(i,e.doc.direction))&&(r=De(i,t.ch)%2?"right":"left"),(e=Bn(n.map,t.ch,r)).offset="right"==e.collapse?e.end:e.start,e)}function kl(e,t){return t&&(e.bad=!0),e}function Tl(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return kl(e.clipPos(P(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r){var u=o,o=t,l=n,s=u.text.firstChild,a=!1;if(!o||!te(s,o))return kl(P(N(u.line),0),!0);if(o==s)if(a=!0,o=s.childNodes[l],l=0,!o)return kl(P(N(c=u.rest?z(u.rest):u.line),c.text.length),a);var c=3==o.nodeType?o:null,h=o;for(c||1!=o.childNodes.length||3!=o.firstChild.nodeType||(c=o.firstChild,l=l&&c.nodeValue.length);h.parentNode!=s;)h=h.parentNode;var d=u.measure,f=d.maps;function p(e,t,n){for(var r=-1;r<(f?f.length:0);r++)for(var i=r<0?d.map:f[r],o=0;o<i.length;o+=3){var l,s,a=i[o+2];if(a==e||a==t)return l=N(r<0?u.line:u.rest[r]),s=i[o]+n,P(l,s=n<0||a!=e?i[o+(n?1:0)]:s)}}var g=p(c,h,l);if(g)return kl(g,a);for(var m=h.nextSibling,v=c?c.nodeValue.length-l:0;m;m=m.nextSibling){if(g=p(m,m.firstChild,0))return kl(P(g.line,g.ch-v),a);v+=m.textContent.length}for(var y=h.previousSibling,b=l;y;y=y.previousSibling){if(g=p(y,y.firstChild,-1))return kl(P(g.line,g.ch+b),a);b+=y.textContent.length}return}}}i.prototype.init=function(e){var t=this,o=this,l=o.cm,s=o.div=e.lineDiv;function a(e){for(var t=e.target;t;t=t.parentNode){if(t==s)return 1;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}}function n(e){if(a(e)&&!E(l,e)){if(l.somethingSelected())gl({lineWise:!1,text:l.getSelections()}),"cut"==e.type&&l.replaceSelection("",null,"cut");else{if(!l.options.lineWiseCopyCut)return;var t=bl(l);gl({lineWise:!0,text:t.text}),"cut"==e.type&&l.operation(function(){l.setSelections(t.ranges,0,fe),l.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=pl.text.join("\n");if(e.clipboardData.setData("Text",n),e.clipboardData.getData("Text")==n)return void e.preventDefault()}var r=xl(),n=r.firstChild,i=(l.display.lineSpace.insertBefore(r,l.display.lineSpace.firstChild),n.value=pl.text.join("\n"),document.activeElement);le(n),setTimeout(function(){l.display.lineSpace.removeChild(r),i.focus(),i==s&&o.showPrimarySelection()},50)}}wl(s,l.options.spellcheck,l.options.autocorrect,l.options.autocapitalize),L(s,"paste",function(e){!a(e)||E(l,e)||vl(e,l)||v<=11&&setTimeout(D(l,function(){return t.updateFromDOM()}),20)}),L(s,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),L(s,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),L(s,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),L(s,"touchstart",function(){return o.forceCompositionEnd()}),L(s,"input",function(){t.composing||t.readFromDOMSoon()}),L(s,"copy",n),L(s,"cut",n)},i.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},i.prototype.prepareSelection=function(){var e=mr(this.cm,!1);return e.focus=document.activeElement==this.div,e},i.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},i.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},i.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),n=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom)e.removeAllRanges();else{var i=Tl(t,e.anchorNode,e.anchorOffset),o=Tl(t,e.focusNode,e.focusOffset);if(!i||i.bad||!o||o.bad||0!=O(xt(i,o),r)||0!=O(wt(i,o),n)){var i=t.display.view,o=r.line>=t.display.viewFrom&&Ll(t,r)||{node:i[0].measure.map[2],offset:0},r=n.line<t.display.viewTo&&Ll(t,n);if(r||(r={node:(i=(n=i[i.length-1].measure).maps?n.maps[n.maps.length-1]:n.map)[i.length-1],offset:i[i.length-2]-i[i.length-3]}),o&&r){var l,n=e.rangeCount&&e.getRangeAt(0);try{l=oe(o.node,o.offset,r.offset,r.node)}catch(e){}l&&(!G&&t.state.focused&&(e.collapse(o.node,o.offset),l.collapsed)||(e.removeAllRanges(),e.addRange(l)),n&&null==e.anchorNode?e.addRange(n):G&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},i.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},i.prototype.showMultipleSelections=function(e){y(this.cm.display.cursorDiv,e.cursors),y(this.cm.display.selectionDiv,e.selection)},i.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},i.prototype.selectionInEditor=function(){var e=this.getSelection();return!!e.rangeCount&&(e=e.getRangeAt(0).commonAncestorContainer,te(this.div,e))},i.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&document.activeElement==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},i.prototype.blur=function(){this.div.blur()},i.prototype.getField=function(){return this.div},i.prototype.supportsTouch=function(){return!0},i.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():h(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))})},i.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},i.prototype.pollSelection=function(){var e,t,n,r;null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()&&(e=this.getSelection(),t=this.cm,X&&c&&this.cm.display.gutterSpecs.length&&(e=>{for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return 1})(e.anchorNode)?(this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus()):this.composing||(this.rememberSelection(),n=Tl(t,e.anchorNode,e.anchorOffset),r=Tl(t,e.focusNode,e.focusOffset),n&&r&&h(t,function(){B(t.doc,hi(n,r),fe),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})))},i.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t=this.cm,n=t.display,r=t.doc.sel.primary(),i=r.from(),r=r.to();if(0==i.ch&&i.line>t.firstLine()&&(i=P(i.line-1,M(t.doc,i.line-1).length)),r.ch==M(t.doc,r.line).text.length&&r.line<t.lastLine()&&(r=P(r.line+1,0)),i.line<n.viewFrom||r.line>n.viewTo-1)return!1;var o,l=i.line==n.viewFrom||0==(l=cr(t,i.line))?(e=N(n.view[0].line),n.view[0].node):(e=N(n.view[l].line),n.view[l-1].node.nextSibling),r=cr(t,r.line),n=r==n.view.length-1?(o=n.viewTo-1,n.lineDiv.lastChild):(o=N(n.view[r+1].line)-1,n.view[r+1].node.previousSibling);if(!l)return!1;for(var s=t.doc.splitLines(((o,e,t,l,s)=>{var n="",a=!1,u=o.doc.lineSeparator(),c=!1;function h(){a&&(n+=u,c&&(n+=u),a=c=!1)}function d(e){e&&(h(),n+=e)}for(;!function e(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)d(n);else if(n=t.getAttribute("cm-marker"))(n=o.findMarks(P(l,0),P(s+1,0),(i=+n,function(e){return e.id==i}))).length&&(n=n[0].find(0))&&d(dt(o.doc,n.from,n.to).join(u));else if("false"!=t.getAttribute("contenteditable")&&(n=/^(pre|div|p|li|table|br)$/i.test(t.nodeName),/^br$/i.test(t.nodeName)||0!=t.textContent.length)){n&&h();for(var r=0;r<t.childNodes.length;r++)e(t.childNodes[r]);/^(pre|p)$/i.test(t.nodeName)&&(c=!0),n&&(a=!0)}}else 3==t.nodeType&&d(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var i}(e),e!=t;)e=e.nextSibling,c=!1;return n})(t,l,n,e,o)),a=dt(t.doc,P(e,0),P(o,M(t.doc,o).text.length));1<s.length&&1<a.length;)if(z(s)==z(a))s.pop(),a.pop(),o--;else{if(s[0]!=a[0])break;s.shift(),a.shift(),e++}for(var u=0,c=0,h=s[0],d=a[0],f=Math.min(h.length,d.length);u<f&&h.charCodeAt(u)==d.charCodeAt(u);)++u;for(var p=z(s),g=z(a),m=Math.min(p.length-(1==s.length?u:0),g.length-(1==a.length?u:0));c<m&&p.charCodeAt(p.length-c-1)==g.charCodeAt(g.length-c-1);)++c;if(1==s.length&&1==a.length&&e==i.line)for(;u&&u>i.ch&&p.charCodeAt(p.length-c-1)==g.charCodeAt(g.length-c-1);)u--,c++;s[s.length-1]=p.slice(0,p.length-c).replace(/^\u200b+/,""),s[0]=s[0].slice(u).replace(/\u200b+$/,"");r=P(e,u),l=P(o,a.length?z(a).length-c:0);return 1<s.length||s[0]||O(r,l)?(Ji(t.doc,s,r,l,"+input"),!0):void 0},i.prototype.ensurePolled=function(){this.forceCompositionEnd()},i.prototype.reset=function(){this.forceCompositionEnd()},i.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},i.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},i.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||h(this.cm,function(){return A(e.cm)})},i.prototype.setUneditable=function(e){e.contentEditable="false"},i.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly())||D(this.cm,ml)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},i.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},i.prototype.onContextMenu=function(){},i.prototype.resetPosition=function(){},i.prototype.needsContentAttribute=!0;function o(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ce,this.hasSelection=!1,this.composing=null}var Ml,Nl,Ol,Al,Dl;function l(e,t,r,n){Ml.defaults[e]=t,r&&(Nl[e]=n?function(e,t,n){n!=sl&&r(e,t,n)}:r)}o.prototype.init=function(n){var e=this,r=this,i=this.cm,o=(this.createField(n),this.textarea);function t(e){if(!E(i,e)){if(i.somethingSelected())gl({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=bl(i);gl({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,fe):(r.prevInput="",o.value=t.text.join("\n"),le(o))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}n.wrapper.insertBefore(this.wrapper,n.wrapper.firstChild),j&&(o.style.width="0px"),L(o,"input",function(){w&&9<=v&&e.hasSelection&&(e.hasSelection=null),r.poll()}),L(o,"paste",function(e){E(i,e)||vl(e,i)||(i.state.pasteIncoming=+new Date,r.fastPoll())}),L(o,"cut",t),L(o,"copy",t),L(n.scroller,"paste",function(e){var t;Tn(n,e)||E(i,e)||(o.dispatchEvent?((t=new Event("paste")).clipboardData=e.clipboardData,o.dispatchEvent(t)):(i.state.pasteIncoming=+new Date,r.focus()))}),L(n.lineSpace,"selectstart",function(e){Tn(n,e)||T(e)}),L(o,"compositionstart",function(){var e=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),L(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},o.prototype.createField=function(e){this.wrapper=xl(),this.textarea=this.wrapper.firstChild},o.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},o.prototype.prepareSelection=function(){var e,t=this.cm,n=t.display,r=t.doc,i=mr(t);return t.options.moveInputWithCursor&&(t=qn(t,r.sel.primary().head,"div"),r=n.wrapper.getBoundingClientRect(),e=n.lineDiv.getBoundingClientRect(),i.teTop=Math.max(0,Math.min(n.wrapper.clientHeight-10,t.top+e.top-r.top)),i.teLeft=Math.max(0,Math.min(n.wrapper.clientWidth-10,t.left+e.left-r.left))),i},o.prototype.showSelection=function(e){var t=this.cm.display;y(t.cursorDiv,e.cursors),y(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},o.prototype.reset=function(e){var t,n;this.contextMenuPending||this.composing||((t=this.cm).somethingSelected()?(this.prevInput="",n=t.getSelection(),this.textarea.value=n,t.state.focused&&le(this.textarea),w&&9<=v&&(this.hasSelection=n)):e||(this.prevInput=this.textarea.value="",w&&9<=v&&(this.hasSelection=null)))},o.prototype.getField=function(){return this.textarea},o.prototype.supportsTouch=function(){return!1},o.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Y||ne()!=this.textarea))try{this.textarea.focus()}catch(e){}},o.prototype.blur=function(){this.textarea.blur()},o.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},o.prototype.receivedFocus=function(){this.slowPoll()},o.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},o.prototype.fastPoll=function(){var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,function e(){n.poll()||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))})},o.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||et(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(w&&9<=v&&this.hasSelection===i||C&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203==o&&(r=r||""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,s=Math.min(r.length,i.length);l<s&&r.charCodeAt(l)==i.charCodeAt(l);)++l;return h(t,function(){ml(t,i.slice(l),r.length-l,null,e.composing?"*compose":null),1e3<i.length||-1<i.indexOf("\n")?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},o.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},o.prototype.onKeyPress=function(){w&&9<=v&&(this.hasSelection=null),this.fastPoll()},o.prototype.onContextMenu=function(e){var n,r,t,i,o=this,l=o.cm,s=l.display,a=o.textarea,u=(o.contextMenuPending&&o.contextMenuPending(),ur(l,e)),c=s.scroller.scrollTop;function h(){var e,t;null!=a.selectionStart&&(t=""+((e=l.somethingSelected())?a.value:""),a.value="⇚",a.value=t,o.prevInput=e?"":"",a.selectionStart=1,a.selectionEnd=t.length,s.selForContextMenu=l.doc.sel)}function d(){var e,t;o.contextMenuPending==d&&(o.contextMenuPending=!1,o.wrapper.style.cssText=r,a.style.cssText=n,w&&v<9&&s.scrollbars.setScrollTop(s.scroller.scrollTop=c),null!=a.selectionStart)&&((!w||v<9)&&h(),e=0,t=function(){s.selForContextMenu==l.doc.sel&&0==a.selectionStart&&0<a.selectionEnd&&""==o.prevInput?D(l,Xi)(l):e++<10?s.detectingSelectAll=setTimeout(t,500):(s.selForContextMenu=null,s.input.reset())},s.detectingSelectAll=setTimeout(t,200))}u&&!U&&(l.options.resetSelectionOnContextMenu&&-1==l.doc.sel.contains(u)&&D(l,B)(l.doc,hi(u),fe),n=a.style.cssText,r=o.wrapper.style.cssText,u=o.wrapper.offsetParent.getBoundingClientRect(),o.wrapper.style.cssText="position: static",a.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-u.top-5)+"px; left: "+(e.clientX-u.left-5)+"px;\n z-index: 1000; background: "+(w?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",x&&(t=window.scrollY),s.input.focus(),x&&window.scrollTo(null,t),s.input.reset(),l.somethingSelected()||(a.value=o.prevInput=" "),o.contextMenuPending=d,s.selForContextMenu=l.doc.sel,clearTimeout(s.detectingSelectAll),w&&9<=v&&h(),q?(Ye(e),i=function(){k(window,"mouseup",i),setTimeout(d,20)},L(window,"mouseup",i)):setTimeout(d,50))},o.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},o.prototype.setUneditable=function(){},o.prototype.needsContentAttribute=!1,Nl=(Ml=m).optionHandlers,Ml.defineOption=l,Ml.Init=sl,l("value","",function(e,t){return e.setValue(t)},!0),l("mode",null,function(e,t){e.doc.modeOption=t,mi(e)},!0),l("indentUnit",2,mi,!0),l("indentWithTabs",!1),l("smartIndent",!0),l("tabSize",4,function(e){vi(e),Vn(e),A(e)},!0),l("lineSeparator",null,function(e,r){if(e.doc.lineSep=r){var i=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var n=e.text.indexOf(r,t);if(-1==n)break;t=n+r.length,i.push(P(o,n))}o++});for(var t=i.length-1;0<=t;t--)Ji(e.doc,r,i[t],P(i[t].line,i[t].ch+r.length))}}),l("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=sl&&e.refresh()}),l("specialCharPlaceholder",cn,function(e){return e.refresh()},!0),l("electricChars",!0),l("inputStyle",Y?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),l("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),l("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),l("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),l("rtlMoveVisually",!a),l("wholeLineUpdateBefore",!0),l("theme","default",function(e){ll(e),ii(e)},!0),l("keyMap","default",function(e,t,n){t=Fo(t),n=n!=sl&&Fo(n);n&&n.detach&&n.detach(e,t),t.attach&&t.attach(e,n||null)}),l("extraKeys",null),l("configureMouse",null),l("lineWrapping",!1,hl,!0),l("gutters",[],function(e,t){e.display.gutterSpecs=ni(t,e.options.lineNumbers),ii(e)},!0),l("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?lr(e.display)+"px":"0",e.refresh()},!0),l("coverGutterNextToScrollbar",!1,function(e){return Rr(e)},!0),l("scrollbarStyle","native",function(e){Ur(e),Rr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),l("lineNumbers",!1,function(e,t){e.display.gutterSpecs=ni(e.options.gutters,t),ii(e)},!0),l("firstLineNumber",1,ii,!0),l("lineNumberFormatter",function(e){return e},ii,!0),l("showCursorWhenSelecting",!1,gr,!0),l("resetSelectionOnContextMenu",!0),l("lineWiseCopyCut",!0),l("pasteLinesPerSelection",!0),l("selectionsMayTouch",!1),l("readOnly",!1,function(e,t){"nocursor"==t&&(Sr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),l("screenReaderLabel",null,function(e,t){e.display.input.screenReaderLabelChanged(t=""===t?null:t)}),l("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),l("dragDrop",!0,cl),l("allowDropFileTypes",null),l("cursorBlinkRate",530),l("cursorScrollMargin",0),l("cursorHeight",1,gr,!0),l("singleCursorHeightPerLine",!0,gr,!0),l("workTime",100),l("workDelay",100),l("flattenSpans",!0,vi,!0),l("addModeClass",!1,vi,!0),l("pollInterval",100),l("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),l("historyEventDelay",1250),l("viewportMargin",10,function(e){return e.refresh()},!0),l("maxHighlightLength",1e4,vi,!0),l("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),l("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),l("autofocus",null),l("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),l("phrases",null),Al=(Ol=m).optionHandlers,Dl=Ol.helpers={},Ol.prototype={constructor:Ol,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];n[e]==t&&"mode"!=e||(n[e]=t,Al.hasOwnProperty(e)&&D(this,Al[e])(this,t,r),F(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Fo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:n(function(e,t){var n=e.token?e:Ol.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");for(var r=this.state.overlays,n={mode:n,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},i=function(e){return e.priority},o=0,l=i(n);o<r.length&&i(r[o])<=l;)o++;r.splice(o,0,n),this.state.modeGen++,A(this)}),removeOverlay:n(function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void A(this)}}),indentLine:n(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),mt(this.doc,e)&&fl(this,e,t,n)}),indentSelection:n(function(e){for(var t=this.doc.sel.ranges,n=-1,r=0;r<t.length;r++){var i=t[r];if(i.empty())i.head.line>n&&(fl(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex)&&Or(this);else{for(var o=i.from(),i=i.to(),l=Math.max(n,o.line),n=Math.min(this.lastLine(),i.line-(i.ch?0:1))+1,s=l;s<n;++s)fl(this,s,e);i=this.doc.sel.ranges;0==o.ch&&t.length==i.length&&0<i[r].from().ch&&Pi(this.doc,r,new R(o,i[r].to()),fe)}}}),getTokenAt:function(e,t){return Ht(this,e,t)},getLineTokens:function(e,t){return Ht(this,P(e),t,!0)},getTokenTypeAt:function(e){e=I(this.doc,e);var t,n=Mt(this,M(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var l=r+i>>1;if((l?n[2*l-1]:0)>=o)i=l;else{if(!(n[2*l+1]<o)){t=n[2*l+2];break}r=1+l}}e=t?t.indexOf("overlay "):-1;return e<0?t:0==e?null:t.slice(0,e-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?Ol.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(Dl.hasOwnProperty(t)){var r=Dl[t],i=this.getModeAt(e);if("string"==typeof i[t])r[i[t]]&&n.push(r[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var l=r[i[t][o]];l&&n.push(l)}else i.helperType&&r[i.helperType]?n.push(r[i.helperType]):r[i.name]&&n.push(r[i.name]);for(var s=0;s<r._global.length;s++){var a=r._global[s];a.pred(i,this)&&-1==S(n,a.val)&&n.push(a.val)}}return n},getStateAfter:function(e,t){var n=this.doc;return Nt(this,(e=Ct(n,null==e?n.first+n.size-1:e))+1,t).state},cursorCoords:function(e,t){var n=this.doc.sel.primary(),e=null==e?n.head:"object"==typeof e?I(this.doc,e):e?n.from():n.to();return qn(this,e,t||"page")},charCoords:function(e,t){return $n(this,I(this.doc,e),t||"page")},coordsChar:function(e,t){return Jn(this,(e=_n(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=_n(this,{top:e,left:0},t||"page").top,gt(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r=!1,i="number"==typeof e?(i=this.doc.first+this.doc.size-1,e<this.doc.first?e=this.doc.first:i<e&&(e=i,r=!0),M(this.doc,e)):e;return Yn(this,i,{top:0,left:0},t||"page",n||r).top+(r?this.doc.height-tn(i):0)},defaultTextHeight:function(){return rr(this.display)},defaultCharWidth:function(){return ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,l,s=this.display,a=(e=qn(this,I(this.doc,e))).bottom,u=e.left;t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t),"over"==r?a=e.top:"above"!=r&&"near"!=r||(l=Math.max(s.wrapper.clientHeight,this.doc.height),o=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth),("above"==r||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(a=e.bottom),u+t.offsetWidth>o&&(u=o-t.offsetWidth)),t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(u=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),n&&(r=this,l={left:u,top:a,right:u+t.offsetWidth,bottom:a+t.offsetHeight},null!=(l=Mr(r,l)).scrollTop&&Hr(r,l.scrollTop),null!=l.scrollLeft)&&Er(r,l.scrollLeft)},triggerOnKeyDown:n($o),triggerOnKeyPress:n(Zo),triggerOnKeyUp:qo,triggerOnMouseDown:n(tl),execCommand:function(e){if(Bo.hasOwnProperty(e))return Bo[e].call(null,this)},triggerElectric:n(function(e){yl(this,e)}),findPosH:function(e,t,n,r){for(var i=1,o=(t<0&&(i=-1,t=-t),I(this.doc,e)),l=0;l<t&&!(o=Cl(this.doc,o,i,n,r)).hitSide;++l);return o},moveH:n(function(t,n){var r=this;this.extendSelectionsBy(function(e){return r.display.shift||r.doc.extend||e.empty()?Cl(r.doc,e.head,t,n,r.options.rtlMoveVisually):t<0?e.from():e.to()},ge)}),deleteH:n(function(n,r){var e=this.doc.sel,i=this.doc;e.somethingSelected()?i.replaceSelection("",null,"+delete"):Eo(this,function(e){var t=Cl(i,e.head,n,r,!1);return n<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,n,r){for(var i=1,o=r,l=(t<0&&(i=-1,t=-t),I(this.doc,e)),s=0;s<t;++s){var a=qn(this,l,"div");if(null==o?o=a.left:a.left=o,(l=Sl(this,a,i,n)).hitSide)break}return l},moveV:n(function(r,i){var o=this,l=this.doc,s=[],a=!this.display.shift&&!l.extend&&l.sel.somethingSelected();if(l.extendSelectionsBy(function(e){var t,n;return a?r<0?e.from():e.to():(t=qn(o,e.head,"div"),null!=e.goalColumn&&(t.left=e.goalColumn),s.push(t.left),n=Sl(o,t,r,i),"page"==i&&e==l.sel.primary()&&Nr(o,$n(o,n,"div").top-t.top),n)},ge),s.length)for(var e=0;e<l.sel.ranges.length;e++)l.sel.ranges[e].goalColumn=s[e]}),findWordAt:function(e){var t=M(this.doc,e.line).text,n=e.ch,r=e.ch;if(t){for(var i=this.getHelper(e,"wordChars"),o=("before"!=e.sticky&&r!=t.length||!n?++r:--n,t.charAt(n)),l=Le(o,i)?function(e){return Le(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Le(e)};0<n&&l(t.charAt(n-1));)--n;for(;r<t.length&&l(t.charAt(r));)++r}return new R(P(e.line,n),P(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||(((this.state.overwrite=!this.state.overwrite)?re:Q)(this.display.cursorDiv,"CodeMirror-overwrite"),F(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==ne()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:n(function(e,t){Ar(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-An(this)-this.display.barHeight,width:e.scrollWidth-An(this)-this.display.barWidth,clientHeight:Wn(this),clientWidth:Dn(this)}},scrollIntoView:n(function(e,t){var n;null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:P(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?(t=e,Dr(n=this),n.curOp.scrollToPos=t):Wr(this,e.from,e.to,e.margin)}),setSize:n(function(e,t){function n(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var r=this,i=(null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Un(this),this.display.viewFrom);this.doc.iter(i,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){hr(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,F(this,"refresh",this)}),operation:function(e){return h(this,e)},startOperation:function(){return Kr(this)},endOperation:function(){return jr(this)},refresh:n(function(){var e=this.display.cachedTextHeight;A(this),this.curOp.forceUpdate=!0,Vn(this),Ar(this,this.doc.scrollLeft,this.doc.scrollTop),Qr(this.display),(null==e||.5<Math.abs(e-rr(this.display))||this.options.lineWrapping)&&ar(this),F(this,"refresh",this)}),swapDoc:n(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),xi(this,e),Vn(this),this.display.input.reset(),Ar(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,b(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},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}},Ke(Ol),Ol.registerHelper=function(e,t,n){Dl.hasOwnProperty(e)||(Dl[e]=Ol[e]={_global:[]}),Dl[e][t]=n},Ol.registerGlobalHelper=function(e,t,n,r){Ol.registerHelper(e,t,r),Dl[e]._global.push({pred:n,val:r})};var Wl,Hl="iter insert remove copy getEditor constructor".split(" ");for(Wl in p.prototype)p.prototype.hasOwnProperty(Wl)&&S(Hl,Wl)<0&&(m.prototype[Wl]=(e=>function(){return e.apply(this.doc,arguments)})(p.prototype[Wl]));return Ke(p),m.inputStyles={textarea:o,contenteditable:i},m.defineMode=function(e){m.defaults.mode||"null"==e||(m.defaults.mode=e),function(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),rt[e]=t}.apply(this,arguments)},m.defineMIME=function(e,t){it[e]=t},m.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),m.defineMIME("text/plain","null"),m.defineExtension=function(e,t){m.prototype[e]=t},m.defineDocExtension=function(e,t){p.prototype[e]=t},m.fromTextArea=function(t,n){var e;function r(){t.value=s.getValue()}if((n=n?ae(n):{}).value=t.value,!n.tabindex&&t.tabIndex&&(n.tabindex=t.tabIndex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus&&(e=ne(),n.autofocus=e==t||null!=t.getAttribute("autofocus")&&e==document.body),t.form&&(L(t.form,"submit",r),!n.leaveSubmitMethodAlone)){var i=t.form,o=i.submit;try{var l=i.submit=function(){r(),i.submit=o,i.submit(),i.submit=l}}catch(e){}}n.finishInit=function(e){e.save=r,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,r(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(k(t.form,"submit",r),n.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=o))}},t.style.display="none";var s=m(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},n);return s},(t=m).off=k,t.on=L,t.wheelEventPixels=ai,t.Doc=p,t.splitLines=Je,t.countColumn=ue,t.findColumn=me,t.isWordChar=Se,t.Pass=de,t.signal=F,t.Line=on,t.changeEnd=di,t.scrollbarModel=Gr,t.Pos=P,t.cmpPos=O,t.modes=rt,t.mimeModes=it,t.resolveMode=ot,t.getMode=lt,t.modeExtensions=st,t.extendMode=at,t.copyState=ut,t.startState=ht,t.innerMode=ct,t.commands=Bo,t.keyMap=Mo,t.keyName=Ho,t.isModifierKey=Do,t.lookupKey=Ao,t.normalizeKeyMap=Oo,t.StringStream=g,t.SharedTextMarker=ho,t.TextMarker=ao,t.LineWidget=lo,t.e_preventDefault=T,t.e_stopPropagation=je,t.e_stop=Ye,t.addClass=re,t.contains=te,t.rmClass=Q,t.keyNames=So,m.version="5.58.3",m});