!function(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(){"use strict";var e,t,r,n,i,o,l,s,a,u,c=navigator.userAgent,f=navigator.platform,h=/gecko\/\d/i.test(c),d=/MSIE \d/.test(c),p=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(c),g=/Edge\/(\d+)/.exec(c),v=d||p||g,m=v&&(d?document.documentMode||6:+(g||p)[1]),$=!g&&/WebKit\//.test(c),y=$&&/Qt\/\d+\.\d+/.test(c),_=!g&&/Chrome\/(\d+)/.exec(c),b=_&&+_[1],x=/Opera\//.test(c),w=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(c),S=/PhantomJS/.test(c),L=w&&(/Mobile\/\w+/.test(c)||navigator.maxTouchPoints>2),k=/Android/.test(c),T=L||k||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(c),N=L||/Mac/.test(f),O=/\bCrOS\b/.test(c),M=/win/i.test(f),A=x&&c.match(/Version\/(\d*\.\d*)/);A&&(A=Number(A[1])),A&&A>=15&&(x=!1,$=!0);var D=N&&(y||x&&(null==A||A<12.11)),W=h||v&&m>=9;function H(e){return RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var F=function(e,t){var r=e.className,n=H(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function P(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function E(e,t){return P(e).appendChild(t)}function z(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}L?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:v&&(V=function(e){try{e.select()}catch(t){}});var Z=function(){this.id=null,this.f=null,this.time=0,this.handler=j(this.onTimeout,this)};function Q(e,t){for(var r=0;r=t)return n+Math.min(l,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}var ei=[""];function eo(e){for(;ei.length<=e;)ei.push(el(ei)+" ");return ei[e]}function el(e){return e[e.length-1]}function es(e,t){for(var r=[],n=0;n"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ec.test(e))}function eh(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ef(e))||t.test(e):ef(e)}function ed(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ep=/[\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 eg(e){return e.charCodeAt(0)>=768&&ep.test(e)}function ev(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}var e$=null;function ey(e,t,r){var n;e$=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:e$=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:e$=i)}return null!=n?n:e$}var e_=function(){function e(e){if(e<=247)return"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(e);if(1424<=e&&e<=1524)return"R";if(1536<=e&&e<=1785)return"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(e-1536);if(1774<=e&&e<=2220)return"r";if(8192<=e&&e<=8203)return"w";else if(8204==e)return"b";else return"L"}var t=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,n=/[LRr]/,i=/[Lb1n]/,o=/[1n]/;function l(e,t,r){this.level=e,this.from=t,this.to=r}return function(s,a){var u="ltr"==a?"L":"R";if(0==s.length||"ltr"==a&&!t.test(s))return!1;for(var c=s.length,f=[],h=0;h-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function eL(e,t){var r=eC(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i0}function eO(e){e.prototype.on=function(e,t){ew(this,e,t)},e.prototype.off=function(e,t){eS(this,e,t)}}function eM(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function eA(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function e0(e){return null!=e.defaultPrevented?e.defaultPrevented:!1==e.returnValue}function eD(e){eM(e),eA(e)}function eW(e){return e.target||e.srcElement}function eH(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),N&&e.ctrlKey&&1==t&&(t=3),t}var eF=function(){if(v&&m<9)return!1;var e=z("div");return"draggable"in e||"dragDrop"in e}();function eP(e){if(null==o){var t=z("span","​");E(e,z("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(o=t.offsetWidth<=1&&t.offsetHeight>2&&!(v&&m<8))}var r=o?z("span","​"):z("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function e1(e){if(null!=l)return l;var t=E(e,document.createTextNode("AخA")),r=i(t,0,1).getBoundingClientRect(),n=i(t,1,2).getBoundingClientRect();return P(e),!!r&&r.left!=r.right&&(l=n.right-r.right<3)}var eE,ez=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},eR=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(r){}return!!t&&t.parentElement()==e&&0!=t.compareEndPoints("StartToEnd",t)},eI="oncopy"in(eE=z("div"))||(eE.setAttribute("oncopy","return;"),"function"==typeof eE.oncopy),e3=null,eB={},e7={};function e4(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),eB[e]=t}function e6(e,t){e7[e]=t}function e5(e){if("string"==typeof e&&e7.hasOwnProperty(e))e=e7[e];else if(e&&"string"==typeof e.name&&e7.hasOwnProperty(e.name)){var t=e7[e.name];"string"==typeof t&&(t={name:t}),(e=eu(t,e)).name=t.name}else if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return e5("application/xml");else if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return e5("application/json");return"string"==typeof e?{name:e}:e||{name:"null"}}function e2(e,t){var r=eB[(t=e5(t)).name];if(!r)return e2(e,"text/plain");var n=r(e,t);if(eG.hasOwnProperty(t.name)){var i=eG[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var eG={};function eU(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function eV(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function eK(e,t,r){return!e.startState||e.startState(t,r)}var eX=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function ej(e,t){if((t-=e.first)<0||t>=e.size)throw Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t=e.first&&ttt(e,t)?t:e}function to(e,t){return 0>tt(e,t)?e:t}function tl(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ts(e,t){if(t.lineo?te(o,ej(e,o).text.length):(r=t,n=ej(e,t.line).text.length,i=r.ch,null==i||i>n?te(r.line,n):i<0?te(r.line,0):r)}function ta(e,t){for(var r=[],n=0;n=this.string.length},eX.prototype.sol=function(){return this.pos==this.lineStart},eX.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},eX.prototype.next=function(){if(this.post},eX.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},eX.prototype.skipToEnd=function(){this.pos=this.string.length},eX.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},eX.prototype.backUp=function(e){this.pos-=e},eX.prototype.column=function(){return this.lastColumnPos0?null:(i&&!1!==t&&(this.pos+=i[0].length),i)}},eX.prototype.current=function(){return this.string.slice(this.start,this.pos)},eX.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},eX.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},eX.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var tu=function(e,t){this.state=e,this.lookAhead=t},tc=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function tf(e,t,r,n){var i=[e.state.modeGen],o={};t_(e,t.text,e.doc.mode,r,function(e,t){return i.push(e,t)},o,n);for(var l=r.state,s=0;se&&i.splice(a,1,e,i[a+1],n),a+=2,u=Math.min(e,n)}if(t){if(s.opaque)i.splice(r,a-r,e,"overlay "+t),a=r+2;else for(;re.options.maxHighlightLength&&eU(e.doc.mode,n.state),o=tf(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function td(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new tc(n,!0,t);var o=function e(t,r,n){for(var i,o,l=t.doc,s=n?-1:r-(t.doc.mode.innerMode?1e3:100),a=r;a>s;--a){if(a<=l.first)return l.first;var u=ej(l,a-1),c=u.stateAfter;if(c&&(!n||a+(c instanceof tu?c.lookAhead:0)<=l.modeFrontier))return a;var f=q(u.text,null,t.options.tabSize);(null==o||i>f)&&(o=a-1,i=f)}return o}(e,t,r),l=o>n.first&&ej(n,o-1).stateAfter,s=l?tc.fromSaved(n,l,o):new tc(n,eK(n.mode),o);return n.iter(o,t,function(r){tp(e,r.text,s);var n=s.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&nt.start)return o}throw Error("Mode "+e.name+" failed to advance stream.")}tc.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},tc.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}},tc.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},tc.fromSaved=function(e,t,r){return t instanceof tu?new tc(e,eU(e.mode,t.state),r,t.lookAhead):new tc(e,eU(e.mode,t),r)},tc.prototype.save=function(e){var t=!1!==e?eU(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new tu(t,this.maxLookAhead):t};var tm=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function t$(e,t,r,n){var i,o=e.doc,l=o.mode;t=ts(o,t);var s,a=ej(o,t.line),u=td(e,t.line,r),c=new eX(a.text,e.options.tabSize,u);for(n&&(s=[]);(n||c.pose.options.maxHighlightLength?(s=!1,l&&tp(e,t,n,f.pos),f.pos=t.length,a=null):a=ty(tv(r,f,n.state,h),o),h){var d=h[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||c!=a){for(;u=r:l.to>r);(i||(i=[])).push(new tw(s,l.from,a?null:l.to))}}return i}(r,i,l),a=function e(t,r,n){var i;if(t)for(var o=0;o=r:l.to>r)||l.from==r&&"bookmark"==s.type&&(!n||l.marker.insertLeft)){var a=null==l.from||(s.inclusiveLeft?l.from<=r:l.from0&&s)for(var y=0;ytA(r,i.marker))&&(r=i.marker);return r}function tD(e){return t0(e,!0)}function tW(e){return t0(e,!1)}function tH(e,t){var r,n=tx&&e.markedSpans;if(n)for(var i=0;it)&&(!r||0>tA(r,o.marker))&&(r=o.marker)}return r}function tF(e,t,r,n,i){var o=ej(e,t),l=tx&&o.markedSpans;if(l)for(var s=0;s=0)||!(f<=0))&&(!(c<=0)||!(f>=0))&&(c<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?tt(u.to,r)>=0:tt(u.to,r)>0)||c>=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?0>=tt(u.from,n):0>tt(u.from,n))))return!0}}}function tP(e){for(var t;t=tD(e);)e=t.find(-1,!0).line;return e}function t1(e,t){var r=ej(e,t),n=tP(r);return r==n?t:eq(n)}function tE(e,t){if(t>e.lastLine())return t;var r,n=ej(e,t);if(!tz(e,n))return t;for(;r=tW(n);)n=r.find(1,!0).line;return eq(n)+1}function tz(e,t){var r=tx&&t.markedSpans;if(r)for(var n=void 0,i=0;it.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}var t7=function(e,t,r){this.text=e,tN(this,t),this.height=r?r(this):1};function t4(e){e.parent=null,tT(e)}t7.prototype.lineNo=function(){return eq(this)},eO(t7);var t6={},t5={};function t2(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?t5:t6;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function tG(e,t){var r=R("span",null,null,$?"padding-right: .1px":null),n={pre:R("pre",[r],"CodeMirror-line Line-Hover"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,l=void 0;n.pos=0,n.addToken=tV,e1(e.display.measure)&&(l=eb(o,e.doc.direction))&&(n.addToken=tK(n.addToken,l)),n.map=[];var s=t!=e.display.externalMeasured&&eq(o);tj(o,n,th(e,o,s)),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=U(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=U(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(eP(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if($){var a=n.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return eL(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=U(n.pre.className,n.textClass||"")),n}function tU(e){var t=z("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function tV(e,t,r,n,i,o,l){if(t){var s,a=e.splitSpaces?function e(t,r){if(t.length>1&&!/ /.test(t))return t;for(var n=r,i="",o=0;ou)||!(f.from<=u));h++);if(f.to>=c)return e(r,n,i,o,l,s,a);e(r,n.slice(0,f.to-u),i,o,null,s,a),o=null,n=n.slice(f.to-u),u=f.to}}}function tX(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function tj(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(!n){for(var l=1;lg||w.collapsed&&x.to==g&&x.from==g)){if(null!=x.to&&x.to!=g&&$>x.to&&($=x.to,c=""),w.className&&(u+=" "+w.className),w.css&&(a=(a?a+";":"")+w.css),w.startStyle&&x.from==g&&(f+=" "+w.startStyle),w.endStyle&&x.to==$&&(_||(_=[])).push(w.endStyle,x.to),w.title&&((d||(d={})).title=w.title),w.attributes)for(var C in w.attributes)(d||(d={}))[C]=w.attributes[C];w.collapsed&&(!h||0>tA(h.marker,w))&&(h=x)}else x.from>g&&$>x.from&&($=x.from)}if(_)for(var S=0;S<_.length;S+=2)_[S+1]==$&&(c+=" "+_[S]);if(!h||h.from==g)for(var L=0;L=p)break;for(var k=Math.min(p,$);;){if(m){var T=g+m.length;if(!h){var N=T>k?m.slice(0,k-g):m;t.addToken(t,N,s?s+u:u,f,g+N.length==$?c:"",a,d)}if(T>=k){m=m.slice(k-g),g=k;break}g=T,f=""}m=i.slice(o,o=r[v++]),s=t2(r[v++],t.cm.options)}}}function tY(e,t,r){this.line=t,this.rest=function e(t){for(var r,n;r=tW(t);)t=r.find(1,!0).line,(n||(n=[])).push(t);return n}(t),this.size=this.rest?eq(el(this.rest))-r+1:1,this.node=this.text=null,this.hidden=tz(e,t)}function t8(e,t,r){for(var n,i=[],o=t;or)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function ry(e,t,r,n){return rx(e,rb(e,t),r,n)}function r_(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&t2&&l.push((u.bottom+c.top)/2-n.top)}}l.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(l=function e(t,r,n,o){var l,s,a=rC(r.map,n,o),u=a.node,c=a.start,f=a.end,h=a.collapse;if(3==u.nodeType){for(var d=0;d<4;d++){for(;c&&eg(r.line.text.charAt(a.coverStart+c));)--c;for(;a.coverStart+f1}(t))return r;var n=screen.logicalXDPI/screen.deviceXDPI,o=screen.logicalYDPI/screen.deviceYDPI;return{left:r.left*n,right:r.right*n,top:r.top*o,bottom:r.bottom*o}}(t.display.measure,l))}else c>0&&(h=o="right"),l=t.options.lineWrapping&&(s=u.getClientRects()).length>1?s["right"==o?s.length-1:0]:u.getBoundingClientRect();if(v&&m<9&&!c&&(!l||!l.left&&!l.right)){var p=u.parentNode.getClientRects()[0];l=p?{left:p.left,right:p.left+r7(t.display),top:p.top,bottom:p.bottom}:rw}for(var g=l.top-r.rect.top,$=l.bottom-r.rect.top,y=(g+$)/2,_=r.view.measure.heights,b=0;b<_.length-1&&!(y<_[b]);b++);var x=b?_[b-1]:0,w=_[b],C={left:("right"==h?l.right:l.left)-r.rect.left,right:("left"==h?l.left:l.right)-r.rect.left,top:x,bottom:w};return l.left||l.right||(C.bogus=!0),t.options.singleCursorHeightPerLine||(C.rtop=g,C.rbottom=$),C}(e,t,r,n)).bogus||(t.cache[s]=l)),{left:l.left,right:l.right,top:o?l.rtop:l.top,bottom:o?l.rbottom:l.bottom}}var rw={left:0,right:0,top:0,bottom:0};function rC(e,t,r){for(var n,i,o,l,s,a,u=0;ut)&&(i=(o=a-s)-1,t>=a&&(l="right")),null!=i){if(n=e[u+2],s==a&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)n=e[(u-=3)+2],l="left";if("right"==r&&i==a-s)for(;u=0&&(r=e[i]).left==r.right;i--);return r}function rL(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=n.text.length?(a=n.text.length,u="before"):a<=0&&(a=0,u="after"),!s)return l("before"==u?a-1:a,"before"==u);function c(e,t,r){return l(r?e-1:e,1==s[t].level!=r)}var f=ey(s,a,u),h=e$,d=c(a,f,"before"==u);return null!=h&&(d.other=c(a,h,"before"!=u)),d}function rH(e,t){var r=0;t=ts(e.doc,t),e.options.lineWrapping||(r=r7(e.display)*t.ch);var n=ej(e.doc,t.line),i=tI(n)+rh(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function rF(e,t,r,n,i){var o=te(e,t,r);return o.xRel=i,n&&(o.outside=n),o}function rP(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return rF(n.first,0,null,-1,-1);var i=eZ(n,r),o=n.first+n.size-1;if(i>o)return rF(n.first+n.size-1,ej(n,o).text.length,null,1,1);t<0&&(t=0);for(var l=ej(n,i);;){var s=rR(e,l,i,t,r),a=tH(l,s.ch+(s.xRel>0||s.outside>0?1:0));if(!a)return s;var u=a.find(1);if(u.line==i)return u;l=ej(n,i=u.line)}}function r1(e,t,r,n){n-=rM(t);var i=t.text.length,o=em(function(t){return rx(e,r,t-1).bottom<=n},i,0);return i=em(function(t){return rx(e,r,t).top>n},o,i),{begin:o,end:i}}function rE(e,t,r,n){r||(r=rb(e,t));var i=rA(e,t,rx(e,r,n),"line").top;return r1(e,t,r,i)}function rz(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function rR(e,t,r,n,i){i-=tI(t);var o=rb(e,t),l=rM(t),s=0,a=t.text.length,u=!0,c=eb(t,e.doc.direction);if(c){var f=(e.options.lineWrapping?r3:rI)(e,t,r,o,c,n,i);s=(u=1!=f.level)?f.from:f.to-1,a=u?f.to:f.from-1}var h,d,p=null,g=null,v=em(function(t){var r=rx(e,o,t);return r.top+=l,r.bottom+=l,!!rz(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,g=r),!0)},s,a),m=!1;if(g){var $=n-g.left=_.bottom?1:0}return v=ev(t.text,v,1),rF(r,v,d,m,n-h)}function rI(e,t,r,n,i,o,l){var s=em(function(s){var a=i[s],u=1!=a.level;return rz(rW(e,te(r,u?a.to:a.from,u?"before":"after"),"line",t,n),o,l,!0)},0,i.length-1),a=i[s];if(s>0){var u=1!=a.level,c=rW(e,te(r,u?a.from:a.to,u?"after":"before"),"line",t,n);rz(c,o,l,!0)&&c.top>l&&(a=i[s-1])}return a}function r3(e,t,r,n,i,o,l){var s=r1(e,t,n,l),a=s.begin,u=s.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,f=null,h=0;h=u)&&!(d.to<=a)){var p=rx(e,n,1!=d.level?Math.min(u,d.to)-1:Math.max(a,d.from)).right,g=pg)&&(c=d,f=g)}}return c||(c=i[i.length-1]),c.fromu&&(c={from:c.from,to:u,level:c.level}),c}function rB(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==s){s=z("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)s.appendChild(document.createTextNode("x")),s.appendChild(z("br"));s.appendChild(document.createTextNode("x"))}E(e.measure,s);var r=s.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),P(e.measure),r||1}function r7(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=z("span","xxxxxxxxxx"),r=z("pre",[t],"CodeMirror-line-like");E(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function r4(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var s=e.display.gutterSpecs[l].className;r[s]=o.offsetLeft+o.clientLeft+i,n[s]=o.clientWidth}return{fixedPos:r6(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function r6(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function r5(e){var t=rB(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/r7(e.display)-3);return function(i){if(tz(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l0&&(u=ej(e.doc,c.line).text).length==c.ch){var f=q(u,u.length,e.options.tabSize)-u.length;c=te(c.line,Math.max(0,Math.round((o-rp(e.display).left)/r7(e.display))-f))}return c}function rU(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;nt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)tx&&t1(e.doc,t)i.viewFrom?rX(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)rX(e);else if(t<=i.viewFrom){var o=rj(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):rX(e)}else if(r>=i.viewTo){var l=rj(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):rX(e)}else{var s=rj(e,t,t,-1),a=rj(e,r,r+n,1);s&&a?(i.view=i.view.slice(0,s.index).concat(t8(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=n):rX(e)}var u=i.externalMeasured;u&&(r=i.lineN&&t=n.viewTo)){var o=n.view[rU(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==Q(l,r)&&l.push(r)}}}function rX(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function rj(e,t,r,n){var i,o=rU(e,t),l=e.display.view;if(!tx||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=e.display.viewFrom,a=0;a0){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;t1(e.doc,r)!=r;){if(o==(n<0?0:l.length-1))return null;r+=n*l[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function rY(e){for(var t=e.display.view,r=0,n=0;n=e.display.viewTo)&&!(a.to().line0?l:e.defaultCharWidth())+"px"}if(n.other){var s=r.appendChild(z("div","\xa0","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="",s.style.left=n.other.left+"px",s.style.top=n.other.top+"px",s.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function rZ(e,t){return e.top-t.top||e.left-t.left}function rQ(e,t,r){var n=e.display,i=e.doc,o=document.createDocumentFragment(),l=rp(e.display),s=l.left,a=Math.max(n.sizerWidth,rv(e)-n.sizer.offsetLeft)-l.right,u="ltr"==i.direction;function c(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),o.appendChild(z("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?a-e:r)+"px;\n height: "+(n-t)+"px"))}function f(t,r,n){var o,l,f=ej(i,t),h=f.text.length;function d(r,n){return rD(e,te(t,r),"div",f,n)}function p(t,r,n){var i=rE(e,f,null,t),o="ltr"==r==("after"==n)?"left":"right";return d("after"==n?i.begin:i.end-(/\s/.test(f.text.charAt(i.end-1))?2:1),o)[o]}var g=eb(f,i.direction);return!function e(t,r,n,i){if(!t)return i(r,n,"ltr",0);for(var o=!1,l=0;lr||r==n&&s.to==r)&&(i(Math.max(s.from,r),Math.min(s.to,n),1==s.level?"rtl":"ltr",l),o=!0)}o||i(r,n,"ltr")}(g,r||0,null==n?h:n,function(e,t,i,f){var v,m,$,y,_="ltr"==i,b=d(e,_?"left":"right"),x=d(t-1,_?"right":"left"),w=null==r&&0==e,C=null==n&&t==h,S=0==f,L=!g||f==g.length-1;if(x.top-b.top<=3){var k=(u?w:C)&&S?s:(_?b:x).left,T=(u?C:w)&&L?a:(_?x:b).right;c(k,b.top,T-k,b.bottom)}else _?(v=u&&w&&S?s:b.left,m=u?a:p(e,i,"before"),$=u?s:p(t,i,"after"),y=u&&C&&L?a:x.right):(v=u?p(e,i,"before"):s,m=!u&&w&&S?a:b.right,$=!u&&C&&L?s:x.left,y=u?p(t,i,"after"):a),c(v,b.top,m-v,b.bottom),b.bottomrZ(b,o))&&(o=b),0>rZ(x,o)&&(o=x),(!l||0>rZ(b,l))&&(l=b),0>rZ(x,l)&&(l=x)}),{start:o,end:l}}var h=t.from(),d=t.to();if(h.line==d.line)f(h.line,h.ch,d.ch);else{var p=ej(i,h.line),g=ej(i,d.line),v=tP(p)==tP(g),m=f(h.line,h.ch,v?p.text.length+1:null).end,$=f(d.line,v?0:null,d.ch).start;v&&(m.top<$.top-2?(c(m.right,m.top,null,m.bottom),c(s,$.top,$.left,$.bottom)):c(m.right,m.top,$.left-m.right,m.bottom)),m.bottom<$.top&&c(s,m.bottom,null,$.top)}r.appendChild(o)}function rJ(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||nn(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function ne(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||nr(e))}function nt(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&nn(e))},100)}function nr(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(eL(e,"focus",e,t),e.state.focused=!0,G(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),$&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),rJ(e))}function nn(e,t){!e.state.delayingBlurEvent&&(e.state.focused&&(eL(e,"blur",e,t),e.state.focused=!1,F(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function ni(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,o=0,l=0;l.005||d<-.005)&&(ie.display.sizerWidth){var g=Math.ceil(c/r7(e.display));g>e.display.maxLineLength&&(e.display.maxLineLength=g,e.display.maxLine=s.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function no(e){if(e.widgets)for(var t=0;t=l&&(o=eZ(t,tI(ej(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function ns(e,t){var r=e.display,n=rB(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=rm(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+rd(r),a=t.tops-n;if(t.topi+o){var c=Math.min(t.top,(u?s:t.bottom)-o);c!=i&&(l.scrollTop=c)}var f=e.options.fixedGutter?0:r.gutters.offsetWidth,h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft-f,d=rv(e)-r.gutters.offsetWidth,p=t.right-t.left>d;return p&&(t.right=t.left+d),t.left<10?l.scrollLeft=0:t.leftd+h-3&&(l.scrollLeft=t.right+(p?0:10)-d),l}function na(e,t){null!=t&&(nf(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function nu(e){nf(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function nc(e,t,r){(null!=t||null!=r)&&nf(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function nf(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=rH(e,t.from),n=rH(e,t.to);nh(e,r,n,t.margin)}}function nh(e,t,r,n){var i=ns(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});nc(e,i.scrollLeft,i.scrollTop)}function nd(e,t){!(2>Math.abs(e.doc.scrollTop-t))&&(h||nE(e,{top:t}),np(e,t,!0),h&&nE(e),nW(e,100))}function np(e,t,r){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function ng(e,t,r,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),((r?t!=e.doc.scrollLeft:!(2>Math.abs(e.doc.scrollLeft-t)))||n)&&(e.doc.scrollLeft=t,nI(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function nv(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+rd(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?r:0,docHeight:n,scrollHeight:n+rg(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var nm=function(e,t,r){this.cm=r;var n=this.vert=z("div",[z("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=z("div",[z("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),ew(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),ew(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,v&&m<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};nm.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},nm.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},nm.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},nm.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=N&&!C?"12px":"18px",this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new Z,this.disableVert=new Z},nm.prototype.enableZeroWidthBar=function(e,t,r){function n(){var i=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.visibility="hidden":t.set(1e3,n)}e.style.visibility="",t.set(1e3,n)},nm.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var n$=function(){};function ny(e,t){t||(t=nv(e));var r=e.display.barWidth,n=e.display.barHeight;n_(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&ni(e),n_(e,nv(e)),r=e.display.barWidth,n=e.display.barHeight}function n_(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}n$.prototype.update=function(){return{bottom:0,right:0}},n$.prototype.setScrollLeft=function(){},n$.prototype.setScrollTop=function(){},n$.prototype.clear=function(){};var nb={native:nm,null:n$};function nx(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new nb[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ew(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){"horizontal"==r?ng(e,t):nd(e,t)},e),e.display.scrollbars.addClass&&G(e.display.wrapper,e.display.scrollbars.addClass)}var nw=0;function nC(e){var t;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:++nw,markArrays:null},t=e.curOp,t9?t9.ops.push(t):t.ownsGroup=t9={ops:[t],delayedCallbacks:[]}}function nS(e){var t=e.curOp;t&&function e(t,r){var n=t.ownsGroup;if(n)try{!function e(t){var r=t.delayedCallbacks,n=0;do{for(;n=i.viewTo)||i.maxLineChanged&&n.options.lineWrapping,e.update=e.mustUpdate&&new nF(n,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function nk(e){e.updatedDisplay=e.mustUpdate&&nP(e.cm,e.update)}function nT(e){var t=e.cm,r=t.display;e.updatedDisplay&&ni(t),e.barMeasure=nv(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ry(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+rg(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-rv(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function nN(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft1&&(s=!0)),null!=c.scrollLeft&&(ng(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-h)>1&&(s=!0)),!s)break}return o}(t,ts(n,e.scrollToPos.from),ts(n,e.scrollToPos.to),e.scrollToPos.margin);!function e(t,r){if(!ek(t,"scrollCursorIntoView")){var n=t.display,i=n.sizer.getBoundingClientRect(),o=null,l=n.wrapper.ownerDocument;if(r.top+i.top<0?o=!0:r.bottom+i.top>(l.defaultView.innerHeight||l.documentElement.clientHeight)&&(o=!1),null!=o&&!S){var s=z("div","​",null,"position: absolute;\n top: "+(r.top-n.viewOffset-rh(t.display))+"px;\n height: "+(r.bottom-r.top+rg(t)+n.barHeight)+"px;\n left: "+r.left+"px; width: "+Math.max(2,r.right-r.left)+"px;");t.display.lineSpace.appendChild(s),s.scrollIntoView(o),t.display.lineSpace.removeChild(s)}}}(t,i)}var o=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(o)for(var s=0;s=e.display.viewTo)){var r=+new Date+e.options.workTime,n=td(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(n.line>=e.display.viewFrom){var l=o.styles,s=o.text.length>e.options.maxHighlightLength?eU(t.mode,n.state):null,a=tf(e,o,n,!0);s&&(n.state=s),o.styles=a.styles;var u=o.styleClasses,c=a.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var f=!l||l.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),h=0;!f&&hr)return nW(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&nM(e,function(){for(var t=0;t=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==rY(e))return!1;n3(e)&&(rX(e),t.dims=r4(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFroml&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),tx&&(o=t1(e.doc,o),l=tE(e.doc,l));var s,a,u,c,f=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;s=e,a=o,u=l,0==(c=s.display).view.length||a>=c.viewTo||u<=c.viewFrom?(c.view=t8(s,a,u),c.viewFrom=a):(c.viewFrom>a?c.view=t8(s,a,c.viewFrom).concat(c.view):c.viewFromu&&(c.view=c.view.slice(0,rU(s,u)))),c.viewTo=u,r.viewOffset=tI(ej(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var h=rY(e);if(!f&&0==h&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var d=function e(t){if(t.hasFocus())return null;var r=B(K(t));if(!r||!I(t.display.lineDiv,r))return null;var n={activeElt:r};if(window.getSelection){var i=X(t).getSelection();i.anchorNode&&i.extend&&I(t.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}(e);return h>4&&(r.lineDiv.style.display="none"),function e(t,r,n){var i=t.display,o=t.options.lineNumbers,l=i.lineDiv,s=l.firstChild;function a(e){var r=e.nextSibling;return $&&N&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),r}for(var u=i.view,c=i.viewFrom,f=0;f-1&&(d=!1),tJ(t,h,c,n)),d&&(P(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(eJ(t.options,c)))),s=h.node.nextSibling}else{var p=rl(t,h,c,n);l.insertBefore(p,s)}c+=h.size}for(;s;)s=a(s)}(e,r.updateLineNumbers,t.dims),h>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,!function e(t){if(t&&t.activeElt&&t.activeElt!=B(t.activeElt.ownerDocument)&&(t.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(t.activeElt.nodeName)&&t.anchorNode&&I(document.body,t.anchorNode)&&I(document.body,t.focusNode))){var r=t.activeElt.ownerDocument,n=r.defaultView.getSelection(),i=r.createRange();i.setEnd(t.anchorNode,t.anchorOffset),i.collapse(!1),n.removeAllRanges(),n.addRange(i),n.extend(t.focusNode,t.focusOffset)}}(d),P(r.cursorDiv),P(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,f&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,nW(e,400)),r.updateLineNumbers=null,!0}function n1(e,t){for(var r=t.viewport,n=!0;;n=!1){if(n&&e.options.lineWrapping&&t.oldDisplayWidth!=rv(e))n&&(t.visible=nl(e.display,e.doc,r));else if(r&&null!=r.top&&(r={top:Math.min(e.doc.height+rd(e.display)-rm(e),r.top)}),t.visible=nl(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!nP(e,t))break;ni(e);var i=nv(e);r8(e),ny(e,i),nR(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 nE(e,t){var r=new nF(e,t);if(nP(e,r)){ni(e),n1(e,r);var n=nv(e);r8(e),ny(e,n),nR(e,n),r.finish()}}function nz(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",tZ(e,"gutterChanged",e)}function nR(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+rg(e)+"px"}function nI(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=r6(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l=105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),v&&m<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),$||h&&T||(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=nB(n.gutters,n.lineNumbers),n7(i),r.init(i)}nF.prototype.signal=function(e,t){eN(e,t)&&this.events.push(arguments)},nF.prototype.finish=function(){for(var e=0;es.clientWidth,u=s.scrollHeight>s.clientHeight;if(n&&a||i&&u){if(i&&N&&$){outer:for(var c=t.target,f=l.view;c!=s;c=c.parentNode)for(var d=0;d=0&&0>=tt(e,n.to()))return r}return -1};var nK=function(e,t){this.anchor=e,this.head=t};function nX(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort(function(e,t){return tt(e.from(),t.from())}),r=Q(t,i);for(var o=1;o0:a>=0){var u=to(s.from(),l.from()),c=ti(s.to(),l.to()),f=s.empty()?l.from()==l.head:s.from()==s.head;o<=r&&--r,t.splice(--o,2,new nK(f?c:u,f?u:c))}}return new nV(t,r)}function nj(e,t){return new nV([new nK(e,t||e)],0)}function nY(e){return e.text?te(e.from.line+e.text.length-1,el(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function n8(e,t){if(0>tt(e,t.from))return e;if(0>=tt(e,t.to))return nY(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=nY(t).ch-t.to.ch),te(r,n)}function n9(e,t){for(var r=[],n=0;n1&&e.remove(s.line+1,p-1),e.insert(s.line+1,m)}tZ(e,"change",e,t)}function it(e,t,r){!function e(n,i,o){if(n.linked)for(var l=0;lu-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(l=(s=o,a=o.lastOp==n,a?(is(s.done),el(s.done)):s.done.length&&!el(s.done).ranges?el(s.done):s.done.length>1&&!s.done[s.done.length-2].ranges?(s.done.pop(),el(s.done)):void 0)))i=el(l.changes),0==tt(t.from,t.to)&&0==tt(t.from,i.to)?i.to=nY(t):l.changes.push(il(e,t));else{var c=el(o.done);for(c&&c.ranges||iu(e.sel,o.done),l={changes:[il(e,t)],generation:o.generation},o.done.push(l);o.done.length>o.undoDepth;)o.done.shift(),o.done[0].ranges||o.done.shift()}o.done.push(r),o.generation=++o.maxGeneration,o.lastModTime=o.lastSelTime=u,o.lastOp=o.lastSelOp=n,o.lastOrigin=o.lastSelOrigin=t.origin,i||eL(e,"historyAdded")}function iu(e,t){var r=el(t);r&&r.ranges&&r.equals(e)||t.push(e)}function ic(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function ih(e){if(!e)return null;for(var t,r=0;r-1&&(el(s)[f]=u[f],delete u[f])}}return n}function ig(e,t,r,n){if(!n)return new nK(r||t,t);var i=e.anchor;if(r){var o=0>tt(t,i);o!=0>tt(r,i)?(i=t,t=r):o!=0>tt(t,r)&&(t=r)}return new nK(i,t)}function iv(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),ib(e,new nV([ig(e.sel.primary(),t,r,i)],0),n)}function im(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;ott(t.primary().head,e.sel.primary().head)?-1:1);iw(e,iS(e,t,s,!0)),!(r&&!1===r.scroll)&&e.cm&&"nocursor"!=e.cm.getOption("readOnly")&&nu(e.cm)}function iw(e,t){!t.equals(e.sel)&&(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,eT(e.cm)),tZ(e,"cursorActivity",e))}function iC(e){iw(e,iS(e,e.sel,null,!1))}function iS(e,t,r,n){for(var i,o=0;o=t.ch:s.to>t.ch))){if(i&&(eL(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(r){var f=a.find(n<0?1:-1),h=void 0;if((n<0?c:u)&&(f=iT(e,f,-n,f&&f.line==t.line?o:null)),f&&f.line==t.line&&(h=tt(f,r))&&(n<0?h<0:h>0))return iL(e,f,t,n,i)}var d=a.find(n<0?-1:1);return(n<0?u:c)&&(d=iT(e,d,n,d.line==t.line?o:null)),d?iL(e,d,t,n,i):null}}return t}function ik(e,t,r,n,i){var o=n||1,l=iL(e,t,r,o,i)||!i&&iL(e,t,r,o,!0)||iL(e,t,r,-o,i)||!i&&iL(e,t,r,-o,!0);return l||(e.cantEdit=!0,te(e.first,0))}function iT(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ts(e,te(t.line-1)):null:r>0&&t.ch==(n||ej(e,t.line)).text.length?t.linett(c.to,a.from)||tt(c.from,a.to)>0)){var f=[u,1],h=tt(c.from,a.from),d=tt(c.to,a.to);!(h<0)&&(s.inclusiveLeft||h)||f.push({from:c.from,to:a.from}),!(d>0)&&(s.inclusiveRight||d)||f.push({from:a.to,to:c.to}),o.splice.apply(o,f),u+=f.length-3}}return o}(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)iA(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else iA(e,t)}}function iA(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var r=n9(e,t);ia(e,t,r,e.cm?e.cm.curOp.id:NaN),iW(e,t,r,tL(e,t));var n=[];it(e,function(e,r){r||-1!=Q(n,e.history)||(i1(e.history,t),n.push(e.history)),iW(e,t,null,tL(e,t))})}}function i0(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!n||r){for(var i,o=e.history,l=e.sel,s="undo"==t?o.done:o.undone,a="undo"==t?o.undone:o.done,u=0;u=0;--h){var d=function(r){var n=i.changes[r];if(n.origin=t,f&&!iO(e,n,!1))return s.length=0,{};c.push(il(e,n));var o=r?n9(e,n):el(s);iW(e,n,o,id(e,n)),!r&&e.cm&&e.cm.scrollIntoView({from:n.from,to:nY(n)});var l=[];it(e,function(e,t){t||-1!=Q(l,e.history)||(i1(e.history,n),l.push(e.history)),iW(e,n,null,id(e,n))})}(h);if(d)return d.v}}}}function iD(e,t){if(0!=t&&(e.first+=t,e.sel=new nV(es(e.sel.ranges,function(e){return new nK(te(e.anchor.line+t,e.anchor.ch),te(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){rV(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())){if(t.from.lineo&&(t={from:t.from,to:te(o,ej(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=eY(e,t.from,t.to),r||(r=n9(e,t)),e.cm?function e(t,r,n){var i=t.doc,o=t.display,l=r.from,s=r.to,a=!1,u=l.line;t.options.lineWrapping||(u=eq(tP(ej(i,l.line))),i.iter(u,s.line+1,function(e){if(e==o.maxLine)return a=!0,!0})),i.sel.contains(r.from,r.to)>-1&&eT(t),ie(i,r,n,r5(t)),!t.options.lineWrapping&&(i.iter(u,l.line+r.text.length,function(e){var t=t3(e);t>o.maxLineLength&&(o.maxLine=e,o.maxLineLength=t,o.maxLineChanged=!0,a=!1)}),a&&(t.curOp.updateMaxLine=!0)),function e(t,r){if(t.modeFrontier=Math.min(t.modeFrontier,r),!(t.highlightFrontiern;i--){var o=ej(t,i).stateAfter;if(o&&(!(o instanceof tu)||i+o.lookAheadtt(n,r)&&(r=(o=[n,r])[0],n=o[1]),"string"==typeof t&&(t=e.splitLines(t)),iM(e,{from:r,to:n,text:t,origin:i})}function iF(e,t,r,n){r1||!(this.children[0]instanceof iz))){var s=[];this.collapse(s),this.children=[new iz(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var l=i.lines.length%25+25,s=l;s10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n0||0==p&&!1!==d.clearWhenEmpty)return d;if(d.replacedWith&&(d.collapsed=!0,d.widgetNode=R("span",[d.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||d.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(d.widgetNode.insertLeft=!0)),d.collapsed){if(tF(e,t.line,t,r,d)||t.line!=r.line&&tF(e,r.line,t,r,d))throw Error("Inserting collapsed marker partially overlapping an existing one");tx=!0}d.addToHistory&&ia(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var g,v=t.line,m=e.cm;if(e.iter(v,r.line+1,function(n){var i,o,l,s;m&&d.collapsed&&!m.options.lineWrapping&&tP(n)==m.display.maxLine&&(g=!0),d.collapsed&&v!=t.line&&e9(n,0),i=n,o=new tw(d,v==t.line?t.ch:null,v==r.line?r.ch:null),(s=(l=e.cm&&e.cm.curOp)&&window.WeakSet&&(l.markedSpans||(l.markedSpans=new WeakSet)))&&i.markedSpans&&s.has(i.markedSpans)?i.markedSpans.push(o):(i.markedSpans=i.markedSpans?i.markedSpans.concat([o]):[o],s&&s.add(i.markedSpans)),o.marker.attachLine(i),++v}),d.collapsed&&e.iter(t.line,r.line+1,function(t){tz(e,t)&&e9(t,0)}),d.clearOnEnter&&ew(d,"beforeCursorEnter",function(){return d.clear()}),d.readOnly&&(tb=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),d.collapsed&&(d.id=++iB,d.atomic=!0),m){if(g&&(m.curOp.updateMaxLine=!0),d.collapsed)rV(m,t.line,r.line+1);else if(d.className||d.startStyle||d.endStyle||d.css||d.attributes||d.title)for(var $=t.line;$<=r.line;$++)rK(m,$,"text");d.atomic&&iC(m.doc),tZ(m,"markerAdded",m,d)}return d}i7.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&nC(e),eN(this,"clear")){var r=this.find();r&&tZ(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&rV(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&iC(e.doc)),e&&tZ(e,"markerCleared",e,this,n,i),t&&nS(e),this.parent&&this.parent.clear()}},i7.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;itt(f.head,f.anchor);i[s]=new nK(h?c:u,h?u:c)}else i[s]=new nK(u,u)}return new nV(i,t.sel.primIndex)}(this,n,t),a=n.length-1;a>=0;a--)iM(this,n[a]);s?i_(this,s):this.cm&&nu(this.cm)}),undo:nD(function(){i0(this,"undo")}),redo:nD(function(){i0(this,"redo")}),undoSelection:nD(function(){i0(this,"undo",!0)}),redoSelection:nD(function(){i0(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=ts(this,e),t=ts(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var s=0;s=a.to||null==a.from&&i!=e.line||null!=a.from&&i==t.line&&a.from>=t.ch)&&(!r||r(a.marker))&&n.push(a.marker.parent||a.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne)return t=e,!0;e-=o,++r}),ts(this,te(r,t))},indexFromPos:function(e){var t=(e=ts(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var c,f=e.dataTransfer.getData("Text");if(f){if(t.state.draggingText&&!t.state.draggingText.copy&&(c=t.listSelections()),ix(t.doc,nj(r,r)),c)for(var h=0;h=tt(o.from,el(n).to);){var l=n.pop();if(0>tt(l.from,o.from)){o.from=l.from;break}}n.push(o)}nM(e,function(){for(var t=n.length-1;t>=0;t--)iH(e.doc,"",n[t].from,n[t].to,"+delete");nu(e)})}function os(e,t,r){var n=ev(e.text,t+r,r);return n<0||n>e.text.length?null:n}function oa(e,t,r){var n=os(e,t.ch,r);return null==n?null:new te(t.line,n,r<0?"after":"before")}function ou(e,t,r,n,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=eb(r,t.doc.direction);if(o){var l,s=i<0?el(o):o[0],a=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var u=rb(t,r),c=rx(t,u,l=i<0?r.text.length-1:0).top;l=em(function(e){return rx(t,u,e).top==c},i<0==(1==s.level)?s.from:s.to-1,l),"before"==a&&(l=os(r,l,1))}else l=i<0?s.to:s.from;return new te(n,l,a)}}return new te(n,i<0?r.text.length:0,i<0?"before":"after")}iJ.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"},iJ.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"},iJ.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},iJ.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"]},iJ.default=N?iJ.macDefault:iJ.pcDefault;var oc={selectAll:iN,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ee)},killLine:function(e){return ol(e,function(t){if(!t.empty())return{from:t.from(),to:t.to()};var r=ej(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)i=new te(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),te(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=ej(e.doc,i.line-1).text;l&&(i=new te(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),te(i.line-1,l.length-1),i,"+transpose"))}}r.push(new nK(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return nM(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n-1&&(0>tt((o=s.ranges[o]).from(),r)||r.xRel>0)&&(tt(o.to(),r)>0||r.xRel<0)?(c=t,f=i,h=r,d=l,p=c.display,g=!1,y=nA(c,function(e){$&&(p.scroller.draggable=!1),c.state.draggingText=!1,c.state.delayingBlurEvent&&(c.hasFocus()?c.state.delayingBlurEvent=!1:nt(c)),eS(p.wrapper.ownerDocument,"mouseup",y),eS(p.wrapper.ownerDocument,"mousemove",_),eS(p.scroller,"dragstart",b),eS(p.scroller,"drop",y),g||(eM(e),d.addNew||iv(c.doc,h,null,null,d.extend),$&&!w||v&&9==m?setTimeout(function(){p.wrapper.ownerDocument.body.focus({preventScroll:!0}),p.input.focus()},20):p.input.focus())}),_=function(e){g=g||Math.abs(f.clientX-e.clientX)+Math.abs(f.clientY-e.clientY)>=10},b=function(){return g=!0},$&&(p.scroller.draggable=!0),c.state.draggingText=y,y.copy=!d.moveOnDrag,ew(p.wrapper.ownerDocument,"mouseup",y),ew(p.wrapper.ownerDocument,"mousemove",_),ew(p.scroller,"dragstart",b),ew(p.scroller,"drop",y),c.state.delayingBlurEvent=!0,setTimeout(function(){return p.input.focus()},20),p.scroller.dragDrop&&p.scroller.dragDrop()):function e(t,r,n,i){v&&nt(t);var o=t.display,l=t.doc;eM(r);var s,a,u=l.sel,c=u.ranges;if(i.addNew&&!i.extend?s=(a=l.sel.contains(n))>-1?c[a]:new nK(n,n):(s=l.sel.primary(),a=l.sel.primIndex),"rectangle"==i.unit)i.addNew||(s=new nK(n,n)),n=rG(t,r,!0,!0),a=-1;else{var f=oC(t,n,i.unit);s=i.extend?ig(s,f.anchor,f.head,i.extend):f}i.addNew?-1==a?(a=c.length,ib(l,nX(t,c.concat([s]),a),{scroll:!1,origin:"*mouse"})):c.length>1&&c[a].empty()&&"char"==i.unit&&!i.extend?(ib(l,nX(t,c.slice(0,a).concat(c.slice(a+1)),0),{scroll:!1,origin:"*mouse"}),u=l.sel):i$(l,a,s,et):(a=0,ib(l,new nV([s],0),et),u=l.sel);var h=n,d=o.wrapper.getBoundingClientRect(),p=0;function g(e){t.state.selectingText=!1,p=1/0,e&&(eM(e),o.input.focus()),eS(o.wrapper.ownerDocument,"mousemove",m),eS(o.wrapper.ownerDocument,"mouseup",$),l.history.lastSelOrigin=null}var m=nA(t,function(e){0!==e.buttons&&eH(e)?function e(r){var c=++p,f=rG(t,r,!0,"rectangle"==i.unit);if(f){if(0!=tt(f,h)){t.curOp.focus=B(K(t)),function e(r){if(0!=tt(h,r)){if(h=r,"rectangle"==i.unit){for(var o=[],c=t.options.tabSize,f=q(ej(l,n.line).text,n.ch,c),d=q(ej(l,r.line).text,r.ch,c),p=Math.min(f,d),g=Math.max(f,d),v=Math.min(n.line,r.line),m=Math.min(t.lastLine(),Math.max(n.line,r.line));v<=m;v++){var $=ej(l,v).text,y=en($,p,c);p==g?o.push(new nK(te(v,y),te(v,y))):$.length>y&&o.push(new nK(te(v,y),te(v,en($,g,c))))}o.length||o.push(new nK(n,n)),ib(l,nX(t,u.ranges.slice(0,a).concat(o),a),{origin:"*mouse",scroll:!1}),t.scrollIntoView(r)}else{var _,b=s,x=oC(t,r,i.unit),w=b.anchor;tt(x.anchor,w)>0?(_=x.head,w=to(b.from(),x.anchor)):(_=x.anchor,w=ti(b.to(),x.head));var C=u.ranges.slice(0);C[a]=function e(t,r){var n,i=r.anchor,o=r.head,l=ej(t.doc,i.line);if(0==tt(i,o)&&i.sticky==o.sticky)return r;var s=eb(l);if(!s)return r;var a=ey(s,i.ch,i.sticky),u=s[a];if(u.from!=i.ch&&u.to!=i.ch)return r;var c=a+(u.from==i.ch==(1!=u.level)?0:1);if(0==c||c==s.length)return r;if(o.line!=i.line)n=(o.line-i.line)*("ltr"==t.doc.direction?1:-1)>0;else{var f=ey(s,o.ch,o.sticky),h=f-a||(o.ch-i.ch)*(1==u.level?-1:1);n=f==c-1||f==c?h<0:h>0}var d=s[c+(n?-1:0)],p=n==(1==d.level),g=p?d.from:d.to,v=p?"after":"before";return i.ch==g&&i.sticky==v?r:new nK(new te(i.line,g,v),o)}(t,new nK(ts(l,w),_)),ib(l,nX(t,C,a),et)}}}(f);var g=nl(o,l);(f.line>=g.to||f.lined.bottom?20:0;v&&setTimeout(nA(t,function(){p==c&&(o.scroller.scrollTop+=v,e(r))}),50)}}}(e):g(e)}),$=nA(t,g);t.state.selectingText=$,ew(o.wrapper.ownerDocument,"mousemove",m),ew(o.wrapper.ownerDocument,"mouseup",$)}(t,i,r,l)):eW(e)==x.scroller&&eM(e):2==P?(F&&iv(this.doc,F),setTimeout(function(){return x.input.focus()},20)):3==P&&(W?this.display.input.onContextMenu(e):nt(this))}}}}function oC(e,t,r){if("char"==r)return new nK(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new nK(te(t.line,0),ts(e.doc,te(t.line+1,0)));var n=r(e,t);return new nK(n.from,n.to)}function oS(e,t,r,n){if(t.touches)o=t.touches[0].clientX,l=t.touches[0].clientY;else try{o=t.clientX,l=t.clientY}catch(i){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&eM(t);var o,l,s=e.display,a=s.lineDiv.getBoundingClientRect();if(l>a.bottom||!eN(e,r))return e0(t);l-=a.top-s.viewOffset;for(var u=0;u=o){var f=eZ(e.doc,l),h=e.display.gutterSpecs[u];return eL(e,r,e,f,h.className,t),e0(t)}}}function oL(e,t){return oS(e,t,"gutterClick",!0)}function ok(e,t){var r,n;if(!(rf(e.display,t)||(r=e,n=t,eN(r,"gutterContextMenu")&&oS(r,n,"gutterContextMenu",!1))||ek(e,t,"contextmenu")))W||e.display.input.onContextMenu(t)}function oT(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),rT(e)}ox.prototype.compare=function(e,t,r){return this.time+400>e&&0==tt(t,this.pos)&&r==this.button};var oN={toString:function(){return"CodeMirror.Init"}},oO={},oM={};function oA(e,t,r){if(!t!=!(r&&r!=oN)){var n=e.display.dragFunctions,i=t?ew:eS;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function o0(e){e.options.lineWrapping?(G(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(F(e.display.wrapper,"CodeMirror-wrap"),tB(e)),r2(e),rV(e),rT(e),setTimeout(function(){return ny(e)},100)}function oD(e,t){var r=this;if(!(this instanceof oD))return new oD(e,t);this.options=t=t?Y(t):{},Y(oO,t,!1);var n=t.value;"string"==typeof n?n=new iU(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new oD.inputStyles[t.inputStyle](this),o=this.display=new n6(e,n,i,t);for(var l in o.wrapper.CodeMirror=this,oT(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),nx(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 Z,keySeq:null,specialChars:null},t.autofocus&&!T&&o.input.focus(),v&&m<11&&setTimeout(function(){return r.display.input.reset(!0)},20),function e(t){var r=t.display;ew(r.scroller,"mousedown",nA(t,ow)),v&&m<11?ew(r.scroller,"dblclick",nA(t,function(e){if(!ek(t,e)){var r=rG(t,e);if(!(!r||oL(t,e)||rf(t.display,e))){eM(e);var n=t.findWordAt(r);iv(t.doc,n.anchor,n.head)}}})):ew(r.scroller,"dblclick",function(e){return ek(t,e)||eM(e)}),ew(r.scroller,"contextmenu",function(e){return ok(t,e)}),ew(r.input.getField(),"contextmenu",function(e){r.scroller.contains(e.target)||ok(t,e)});var n,i={end:0};function o(){r.activeTouch&&(n=setTimeout(function(){return r.activeTouch=null},1e3),(i=r.activeTouch).end=+new Date)}function l(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}ew(r.scroller,"touchstart",function(e){if(!ek(t,e)&&!function e(t){if(1!=t.touches.length)return!1;var r=t.touches[0];return r.radiusX<=1&&r.radiusY<=1}(e)&&!oL(t,e)){r.input.ensurePolled(),clearTimeout(n);var o=+new Date;r.activeTouch={start:o,moved:!1,prev:o-i.end<=300?i:null},1==e.touches.length&&(r.activeTouch.left=e.touches[0].pageX,r.activeTouch.top=e.touches[0].pageY)}}),ew(r.scroller,"touchmove",function(){r.activeTouch&&(r.activeTouch.moved=!0)}),ew(r.scroller,"touchend",function(e){var n=r.activeTouch;if(n&&!rf(r,e)&&null!=n.left&&!n.moved&&new Date-n.start<300){var i,s=t.coordsChar(r.activeTouch,"page");i=!n.prev||l(n,n.prev)?new nK(s,s):!n.prev.prev||l(n,n.prev.prev)?t.findWordAt(s):new nK(te(s.line,0),ts(t.doc,te(s.line+1,0))),t.setSelection(i.anchor,i.head),t.focus(),eM(e)}o()}),ew(r.scroller,"touchcancel",o),ew(r.scroller,"scroll",function(){r.scroller.clientHeight&&(nd(t,r.scroller.scrollTop),ng(t,r.scroller.scrollLeft,!0),eL(t,"scroll",t))}),ew(r.scroller,"mousewheel",function(e){return nU(t,e)}),ew(r.scroller,"DOMMouseScroll",function(e){return nU(t,e)}),ew(r.wrapper,"scroll",function(){return r.wrapper.scrollTop=r.wrapper.scrollLeft=0}),r.dragFunctions={enter:function(e){ek(t,e)||eD(e)},over:function(e){ek(t,e)||(function e(t,r){var n=rG(t,r);if(n){var i=document.createDocumentFragment();rq(t,n,i),t.display.dragCursor||(t.display.dragCursor=z("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),E(t.display.dragCursor,i)}}(t,e),eD(e))},start:function(e){return function e(t,r){if(v&&(!t.state.draggingText||+new Date-iV<100)){eD(r);return}if(!(ek(t,r)||rf(t.display,r))&&(r.dataTransfer.setData("Text",t.getSelection()),r.dataTransfer.effectAllowed="copyMove",r.dataTransfer.setDragImage&&!w)){var n=z("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",x&&(n.width=n.height=1,t.display.wrapper.appendChild(n),n._top=n.offsetTop),r.dataTransfer.setDragImage(n,0,0),x&&n.parentNode.removeChild(n)}}(t,e)},drop:nA(t,iK),leave:function(e){ek(t,e)||iX(t)}};var s=r.input.getField();ew(s,"keyup",function(e){return o_.call(t,e)}),ew(s,"keydown",nA(t,oy)),ew(s,"keypress",nA(t,ob)),ew(s,"focus",function(e){return nr(t,e)}),ew(s,"blur",function(e){return nn(t,e)})}(this),!function e(){if(!iY){var t;ew(window,"resize",function(){null==t&&(t=setTimeout(function(){t=null,ij(i8)},100))}),ew(window,"blur",function(){return ij(nn)}),iY=!0}}(),nC(this),this.curOp.forceUpdate=!0,ir(this,n),t.autofocus&&!T||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&nr(r)},20):nn(this),oM)oM.hasOwnProperty(l)&&oM[l](this,t[l],oN);n3(this),t.finishInit&&t.finishInit(this);for(var s=0;s150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?q(ej(o,t-1).text,null,l):0:"add"==r?u=a+e.options.indentUnit:"subtract"==r?u=a-e.options.indentUnit:"number"==typeof r&&(u=a+r),u=Math.max(0,u);var f="",h=0;if(e.options.indentWithTabs)for(var d=Math.floor(u/l);d;--d)h+=l,f+=" ";if(hl,a=ez(t),u=null;if(s&&n.ranges.length>1){if(oF&&oF.text.join("\n")==t){if(n.ranges.length%oF.text.length==0){u=[];for(var c=0;c=0;h--){var d=n.ranges[h],p=d.from(),g=d.to();d.empty()&&(r&&r>0?p=te(p.line,p.ch-r):e.state.overwrite&&!s?g=te(g.line,Math.min(ej(o,g.line).text.length,g.ch+el(a).length)):s&&oF&&oF.lineWise&&oF.text.join("\n")==a.join("\n")&&(p=g=te(p.line,0)));var v={from:p,to:g,text:u?u[h%u.length]:a,origin:i||(s?"paste":e.state.cutIncoming>l?"cut":"+input")};iM(e.doc,v),tZ(e,"inputRead",e,v)}t&&!s&&oz(e,t),nu(e),e.curOp.updateInput<2&&(e.curOp.updateInput=f),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function oE(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&nM(t,function(){return o1(t,r,0,null,"paste")}),!0}function oz(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100)&&(!n||r.ranges[n-1].head.line!=i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var s=0;s-1){l=oH(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(ej(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=oH(e,i.head.line,"smart"));l&&tZ(e,"electricInput",e,i.head.line)}}}function oR(e){for(var t=[],r=[],n=0;n0?0:-1));if(isNaN(c))l=null;else{var f=r>0?c>=55296&&c<56320:c>=56320&&c<57343;l=new te(t.line,Math.max(0,Math.min(s.text.length,t.ch+r*(f?2:1))),-r)}}else l=i?function e(t,r,n,i){var o,l=eb(r,t.doc.direction);if(!l)return oa(r,n,i);n.ch>=r.text.length?(n.ch=r.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var s=ey(l,n.ch,n.sticky),a=l[s];if("ltr"==t.doc.direction&&a.level%2==0&&(i>0?a.to>n.ch:a.from=a.from&&d>=f.begin))return new te(n.line,d,h?"before":"after")}var p=function(e,t,r){for(var i=function(e,t){return t?new te(n.line,u(e,1),"before"):new te(n.line,e,"after")};e>=0&&e0==(1!=o.level),a=s?r.begin:u(r.end,-1);if(o.from<=a&&a0?f.end:u(f.begin,-1);return null!=v&&!(i>0&&v==r.text.length)&&(g=p(i>0?0:l.length-1,i,c(v)))?g:null}(e.cm,s,t,r):oa(s,t,r);if(null==l){if(!(!o&&!((u=t.line+a)=e.first+e.size)&&(t=new te(u,t.ch,t.sticky),s=ej(e,u))))return!1;t=ou(i,e.cm,s,t.line,a)}else t=l;return!0}if("char"==n||"codepoint"==n)u();else if("column"==n)u(!0);else if("word"==n||"group"==n)for(var c=null,f="group"==n,h=e.cm&&e.cm.getHelper(t,"wordChars"),d=!0;!(r<0)||u(!d);d=!1){var p=s.text.charAt(t.ch)||"\n",g=eh(p,h)?"w":f&&"\n"==p?"n":!f||/\s/.test(p)?null:"p";if(!f||d||g||(g="s"),c&&c!=g){r<0&&(r=1,u(),t.sticky="after");break}if(g&&(c=g),r>0&&!u(!d))break}var v=ik(e,t,o,l,!0);return tr(o,v)&&(v.hitSide=!0),v}function o7(e,t,r,n){var i,o,l=e.doc,s=t.left;if("page"==n){var a=Math.max(Math.min(e.display.wrapper.clientHeight,X(e).innerHeight||l(e).documentElement.clientHeight)-.5*rB(e.display),3);o=(r>0?t.bottom:t.top)+r*a}else"line"==n&&(o=r>0?t.bottom+3:t.top-3);for(;(i=rP(e,s,o)).outside;){if(r<0?o<=0:o>=l.height){i.hitSide=!0;break}o+=5*r}return i}var o4=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Z,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function o6(e,t){var r=r_(e,t.line);if(!r||r.hidden)return null;var n=ej(e.doc,t.line),i=r$(r,n,t.line),o=eb(n,e.doc.direction),l="left";o&&(l=ey(o,t.ch)%2?"right":"left");var s=rC(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function o5(e,t){return t&&(e.bad=!0),e}function o2(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return o5(e.clipPos(te(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i=t.display.viewTo||o.line=t.display.viewFrom&&o6(t,n)||{node:a[0].measure.map[2],offset:0},c=o.lineo.firstLine()&&(a=te(a.line-1,ej(o.doc,a.line-1).length)),u.ch==ej(o.doc,u.line).text.length&&u.linel.viewTo-1)return!1;a.line==l.viewFrom||0==(e=rU(o,a.line))?(t=eq(l.view[0].line),r=l.view[0].node):(t=eq(l.view[e].line),r=l.view[e-1].node.nextSibling);var c=rU(o,u.line);if(c==l.view.length-1?(n=l.viewTo-1,i=l.lineDiv.lastChild):(n=eq(l.view[c+1].line)-1,i=l.view[c+1].node.previousSibling),!r)return!1;for(var f=o.doc.splitLines(function e(t,r,n,i,o){var l="",s=!1,a=t.doc.lineSeparator(),u=!1;function c(){s&&(l+=a,u&&(l+=a),s=u=!1)}function f(e){e&&(c(),l+=e)}function h(e){if(1==e.nodeType){var r=e.getAttribute("cm-text");if(r){f(r);return}var n,l=e.getAttribute("cm-marker");if(l){var d,p=t.findMarks(te(i,0),te(o+1,0),(d=+l,function(e){return e.id==d}));p.length&&(n=p[0].find(0))&&f(eY(t.doc,n.from,n.to).join(a));return}if("false"!=e.getAttribute("contenteditable")){var g=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(/^br$/i.test(e.nodeName)||0!=e.textContent.length){g&&c();for(var v=0;v1&&h.length>1;)if(el(f)==el(h))f.pop(),h.pop(),n--;else if(f[0]==h[0])f.shift(),h.shift(),t++;else break;for(var d=0,p=0,g=f[0],v=h[0],m=Math.min(g.length,v.length);da.ch&&$.charCodeAt($.length-p-1)==y.charCodeAt(y.length-p-1);)d--,p++;f[f.length-1]=$.slice(0,$.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(d).replace(/\u200b+$/,"");var b=te(t,d),x=te(n,h.length?el(h).length-p:0);if(f.length>1||f[0]||tt(b,x))return iH(o.doc,f,b,x,"+input"),!0},o4.prototype.ensurePolled=function(){this.forceCompositionEnd()},o4.prototype.reset=function(){this.forceCompositionEnd()},o4.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},o4.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))},o4.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&nM(this.cm,function(){return rV(e.cm)})},o4.prototype.setUneditable=function(e){e.contentEditable="false"},o4.prototype.onKeyPress=function(e){0!=e.charCode&&!this.composing&&(e.preventDefault(),this.cm.isReadOnly()||nA(this.cm,o1)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},o4.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},o4.prototype.onContextMenu=function(){},o4.prototype.resetPosition=function(){},o4.prototype.needsContentAttribute=!0;var oU=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Z,this.hasSelection=!1,this.composing=null,this.resetting=!1};oU.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!ek(n,e)){if(n.somethingSelected()){var t;oF=t={lineWise:!1,text:n.getSelections()}}else{if(!n.options.lineWiseCopyCut)return;var o,l=oR(n);oF=o={lineWise:!0,text:l.text},"cut"==e.type?n.setSelections(l.ranges,null,ee):(r.prevInput="",i.value=l.text.join("\n"),V(i))}"cut"==e.type&&(n.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),L&&(i.style.width="0px"),ew(i,"input",function(){v&&m>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),ew(i,"paste",function(e){!(ek(n,e)||oE(e,n))&&(n.state.pasteIncoming=+new Date,r.fastPoll())}),ew(i,"cut",o),ew(i,"copy",o),ew(e.scroller,"paste",function(t){if(!(rf(e,t)||ek(n,t))){if(!i.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}}),ew(e.lineSpace,"selectstart",function(t){rf(e,t)||eM(t)}),ew(i,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),ew(i,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},oU.prototype.createField=function(e){this.wrapper=o3(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;oI(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},oU.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},oU.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=r9(e);if(e.options.moveInputWithCursor){var i=rW(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},oU.prototype.showSelection=function(e){var t=this.cm.display;E(t.cursorDiv,e.cursors),E(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},oU.prototype.reset=function(e){if(!this.contextMenuPending&&(!this.composing||!e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&V(this.textarea),v&&m>=9&&(this.hasSelection=r)}else!e&&(this.prevInput=this.textarea.value="",v&&m>=9&&(this.hasSelection=null));this.resetting=!1}},oU.prototype.getField=function(){return this.textarea},oU.prototype.supportsTouch=function(){return!1},oU.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!T||B(this.textarea.ownerDocument)!=this.textarea))try{this.textarea.focus()}catch(e){}},oU.prototype.blur=function(){this.textarea.blur()},oU.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},oU.prototype.receivedFocus=function(){this.slowPoll()},oU.prototype.slowPoll=function(){var e=this;!this.pollingFast&&this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},oU.prototype.fastPoll=function(){var e=!1,t=this;function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))}t.pollingFast=!0,t.polling.set(20,r)},oU.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||eR(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(v&&m>=9&&this.hasSelection===i||N&&/[\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||n||(n="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,s=Math.min(n.length,i.length);l1e3||i.indexOf("\n")>-1?r.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},oU.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},oU.prototype.onKeyPress=function(){v&&m>=9&&(this.hasSelection=null),this.fastPoll()},oU.prototype.onContextMenu=function(e){var t,r=this,n=r.cm,i=n.display,o=r.textarea;r.contextMenuPending&&r.contextMenuPending();var l=rG(n,e),s=i.scroller.scrollTop;if(l&&!x){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(l)&&nA(n,ib)(n.doc,nj(l),ee);var a=o.style.cssText,u=r.wrapper.style.cssText,c=r.wrapper.offsetParent.getBoundingClientRect();if(r.wrapper.style.cssText="position: static",o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+"px;\n z-index: 1000; background: "+(v?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",$&&(t=o.ownerDocument.defaultView.scrollY),i.input.focus(),$&&o.ownerDocument.defaultView.scrollTo(null,t),i.input.reset(),n.somethingSelected()||(o.value=r.prevInput=" "),r.contextMenuPending=d,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),v&&m>=9&&h(),W){eD(e);var f=function(){eS(window,"mouseup",f),setTimeout(d,20)};ew(window,"mouseup",f)}else setTimeout(d,50)}function h(){if(null!=o.selectionStart){var e=n.somethingSelected(),t="​"+(e?o.value:"");o.value="⇚",o.value=t,r.prevInput=e?"":"​",o.selectionStart=1,o.selectionEnd=t.length,i.selForContextMenu=n.doc.sel}}function d(){if(r.contextMenuPending==d&&(r.contextMenuPending=!1,r.wrapper.style.cssText=u,o.style.cssText=a,v&&m<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=s),null!=o.selectionStart)){(!v||v&&m<9)&&h();var e=0,t=function(){i.selForContextMenu==n.doc.sel&&0==o.selectionStart&&o.selectionEnd>0&&"​"==r.prevInput?nA(n,iN)(n):e++<10?i.detectingSelectAll=setTimeout(t,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(t,200)}}},oU.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},oU.prototype.setUneditable=function(){},oU.prototype.needsContentAttribute=!1,!function e(t){var r=t.optionHandlers;function n(e,n,i,o){t.defaults[e]=n,i&&(r[e]=o?function(e,t,r){r!=oN&&i(e,t,r)}:i)}t.defineOption=n,t.Init=oN,n("value","",function(e,t){return e.setValue(t)},!0),n("mode",null,function(e,t){e.doc.modeOption=t,nZ(e)},!0),n("indentUnit",2,nZ,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(e){nQ(e),rT(e),rV(e)},!0),n("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(te(n,o))}n++});for(var i=r.length-1;i>=0;i--)iH(e.doc,t,r[i],te(r[i].line,r[i].ch+t.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(e,t,r){e.state.specialChars=RegExp(t.source+(t.test(" ")?"":"| "),"g"),r!=oN&&e.refresh()}),n("specialCharPlaceholder",tU,function(e){return e.refresh()},!0),n("electricChars",!0),n("inputStyle",T?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),n("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),n("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),n("rtlMoveVisually",!M),n("wholeLineUpdateBefore",!0),n("theme","default",function(e){oT(e),n4(e)},!0),n("keyMap","default",function(e,t,r){var n=oo(t),i=r!=oN&&oo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,o0,!0),n("gutters",[],function(e,t){e.display.gutterSpecs=nB(t,e.options.lineNumbers),n4(e)},!0),n("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?r6(e.display)+"px":"0",e.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(e){return ny(e)},!0),n("scrollbarStyle","native",function(e){nx(e),ny(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),n("lineNumbers",!1,function(e,t){e.display.gutterSpecs=nB(e.options.gutters,t),n4(e)},!0),n("firstLineNumber",1,n4,!0),n("lineNumberFormatter",function(e){return e},n4,!0),n("showCursorWhenSelecting",!1,r8,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(e,t){"nocursor"==t&&(nn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),n("screenReaderLabel",null,function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)}),n("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),n("dragDrop",!0,oA),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,r8,!0),n("singleCursorHeightPerLine",!0,r8,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,nQ,!0),n("addModeClass",!1,nQ,!0),n("pollInterval",100),n("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),n("historyEventDelay",1250),n("viewportMargin",10,function(e){return e.refresh()},!0),n("maxHighlightLength",1e4,nQ,!0),n("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),n("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),n("autofocus",null),n("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),n("phrases",null)}(oD),t=(e=oD).optionHandlers,r=e.helpers={},e.prototype={constructor:e,focus:function(){X(this).focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,i=n[e];(n[e]!=r||"mode"==e)&&(n[e]=r,t.hasOwnProperty(e)&&nA(this,t[e])(this,r,i),eL(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"](oo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;rr&&(oH(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&nu(this));else{var o=i.from(),l=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var a=s;a0&&i$(this.doc,n,new nK(o,u[n].to()),ee)}}}),getTokenAt:function(e,t){return t$(this,e,t)},getLineTokens:function(e,t){return t$(this,te(e),t,!0)},getTokenTypeAt:function(e){e=ts(this.doc,e);var t,r=th(this,ej(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else if(r[2*l+1]o&&(e=o,i=!0),n=ej(this.doc,e)}else n=e;return rA(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-tI(n):0)},defaultTextHeight:function(){return rB(this.display)},defaultCharWidth:function(){return r7(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o,l,s,a=this.display,u=(e=rW(this,ts(this.doc,e))).bottom,c=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),a.sizer.appendChild(t),"over"==n)u=e.top;else if("above"==n||"near"==n){var f=Math.max(a.wrapper.clientHeight,this.doc.height),h=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>f)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=f&&(u=e.bottom),c+t.offsetWidth>h&&(c=h-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==i?(c=a.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),r&&(o=this,l={left:c,top:u,right:c+t.offsetWidth,bottom:u+t.offsetHeight},null!=(s=ns(o,l)).scrollTop&&nd(o,s.scrollTop),null!=s.scrollLeft&&ng(o,s.scrollLeft))},triggerOnKeyDown:n0(oy),triggerOnKeyPress:n0(ob),triggerOnKeyUp:o_,triggerOnMouseDown:n0(ow),execCommand:function(e){if(oc.hasOwnProperty(e))return oc[e].call(null,this)},triggerElectric:n0(function(e){oz(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=ts(this.doc,e),l=0;l0&&l(t.charAt(r-1));)--r;for(;n.5||this.options.lineWrapping)&&r2(this),eL(this,"refresh",this)}),swapDoc:n0(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),ir(this,e),rT(this),this.display.input.reset(),nc(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,tZ(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}},eO(e),e.registerHelper=function(t,n,i){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=i},e.registerGlobalHelper=function(t,n,i,o){e.registerHelper(t,n,o),r[t]._global.push({pred:i,val:o})};var oV="iter insert remove copy getEditor constructor".split(" ");for(var oK in iU.prototype)iU.prototype.hasOwnProperty(oK)&&0>Q(oV,oK)&&(oD.prototype[oK]=function(e){return function(){return e.apply(this.doc,arguments)}}(iU.prototype[oK]));return eO(iU),oD.inputStyles={textarea:oU,contenteditable:o4},oD.defineMode=function(e){oD.defaults.mode||"null"==e||(oD.defaults.mode=e),e4.apply(this,arguments)},oD.defineMIME=e6,oD.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),oD.defineMIME("text/plain","null"),oD.defineExtension=function(e,t){oD.prototype[e]=t},oD.defineDocExtension=function(e,t){iU.prototype[e]=t},oD.fromTextArea=function e(t,r){if((r=r?Y(r):{}).value=t.value,!r.tabindex&&t.tabIndex&&(r.tabindex=t.tabIndex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus){var n,i=B(t.ownerDocument);r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}function o(){t.value=u.getValue()}if(t.form&&(ew(t.form,"submit",o),!r.leaveSubmitMethodAlone)){var l=t.form;n=l.submit;try{var s=l.submit=function(){o(),l.submit=n,l.submit(),l.submit=s}}catch(a){}}r.finishInit=function(e){e.save=o,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,o(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(eS(t.form,"submit",o),r.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=n))}},t.style.display="none";var u=oD(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},r);return u},(n=oD).off=eS,n.on=ew,n.wheelEventPixels=function e(t){var r=nG(t);return r.x*=n2,r.y*=n2,r},n.Doc=iU,n.splitLines=ez,n.countColumn=q,n.findColumn=en,n.isWordChar=ef,n.Pass=J,n.signal=eL,n.Line=t7,n.changeEnd=nY,n.scrollbarModel=nb,n.Pos=te,n.cmpPos=tt,n.modes=eB,n.mimeModes=e7,n.resolveMode=e5,n.getMode=e2,n.modeExtensions=eG,n.extendMode=function e(t,r){Y(r,eG.hasOwnProperty(t)?eG[t]:eG[t]={})},n.copyState=eU,n.startState=eK,n.innerMode=eV,n.commands=oc,n.keyMap=iJ,n.keyName=oi,n.isModifierKey=or,n.lookupKey=ot,n.normalizeKeyMap=function e(t){var r={};for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==i){delete t[n];continue}for(var o=es(n.split(" "),oe),l=0;l