(function(b,a){typeof exports==="object"&&typeof module!=="undefined"?module.exports=a():typeof define==="function"&&define.amd?define(a):(b.CodeMirror=a())}(this,(function(){var ez=navigator.userAgent;var eK=navigator.platform;var cP=/gecko\/\d/i.test(ez);var fs=/MSIE \d/.test(ez);var b3=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ez);var c3=/Edge\/(\d+)/.exec(ez);var ef=fs||b3||c3;var n=ef&&(fs?document.documentMode||6:+(c3||b3)[1]);var dt=!c3&&/WebKit\//.test(ez);var ei=dt&&/Qt\/\d+\.\d+/.test(ez);var dJ=!c3&&/Chrome\//.test(ez);var eB=/Opera\//.test(ez);var aM=/Apple Computer/.test(navigator.vendor);var dB=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ez);var ge=/PhantomJS/.test(ez);var fM=!c3&&/AppleWebKit/.test(ez)&&/Mobile\/\w+/.test(ez);var aX=/Android/.test(ez);var eQ=fM||aX||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ez);var ct=fM||/Mac/.test(eK);var gx=/\bCrOS\b/.test(ez);var a0=/win/i.test(eK);var ba=eB&&ez.match(/Version\/(\d*\.\d*)/);if(ba){ba=Number(ba[1])}if(ba&&ba>=15){eB=false;dt=true}var cb=ct&&(ei||eB&&(ba==null||ba<12.11));var g9=cP||(ef&&n>=9);function X(i){return new RegExp("(^|\\s)"+i+"(?:$|\\s)\\s*")}var h=function(hl,i){var hm=hl.className;var hk=X(i).exec(hm);if(hk){var hn=hm.slice(hk.index+hk[0].length);hl.className=hm.slice(0,hk.index)+(hn?hk[1]+hn:"")}};function eA(hk){for(var i=hk.childNodes.length;i>0;--i){hk.removeChild(hk.firstChild)}return hk}function cd(i,hk){return eA(i).appendChild(hk)}function g0(hk,ho,hn,hm){var hp=document.createElement(hk);if(hn){hp.className=hn}if(hm){hp.style.cssText=hm}if(typeof ho=="string"){hp.appendChild(document.createTextNode(ho))}else{if(ho){for(var hl=0;hl=hl){return hr+(hl-ho)}hr+=hk-ho;hr+=hp-(hr%hp);ho=hk+1}}var hj=function(){this.id=null;this.f=null;this.time=0;this.handler=cW(this.onTimeout,this)};hj.prototype.onTimeout=function(i){i.id=0;if(i.time<=+new Date){i.f()}else{setTimeout(i.handler,i.time-+new Date)}};hj.prototype.set=function(i,hk){this.f=hk;var hl=+new Date+i;if(!this.id||hl=hm){return hp+Math.min(i,hm-hl)}hl+=hk-hp;hl+=ho-(hl%ho);hp=hk+1;if(hl>=hm){return hp}}}var bb=[""];function cQ(i){while(bb.length<=i){bb.push(gt(bb)+" ")}return bb[i]}function gt(i){return i[i.length-1]}function ce(hn,hm){var hk=[];for(var hl=0;hl"\x80"&&(i.toUpperCase()!=i.toLowerCase()||bo.test(i))}function c1(i,hk){if(!hk){return gq(i)}if(hk.source.indexOf("\\w")>-1&&gq(i)){return true}return hk.test(i)}function fE(i){for(var hk in i){if(i.hasOwnProperty(hk)&&i[hk]){return false}}return true}var fr=/[\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 f9(i){return i.charCodeAt(0)>=768&&fr.test(i)}function eU(hk,hl,i){while((i<0?hl>0:hlhn?-1:1;for(;;){if(ho==hn){return ho}var hm=(ho+hn)/2,hk=hl<0?Math.ceil(hm):Math.floor(hm);if(hk==ho){return i(hk)?ho:hn}if(i(hk)){hn=hk}else{ho=hk+hl}}}function eE(hk,hq,hp,ho){if(!hk){return ho(hq,hp,"ltr",0)}var hn=false;for(var hm=0;hmhq||hq==hp&&hl.to==hq){ho(Math.max(hl.from,hq),Math.min(hl.to,hp),hl.level==1?"rtl":"ltr",hm);hn=true}}if(!hn){ho(hq,hp,"ltr")}}var fO=null;function aR(hk,hm,ho){var hn;fO=null;for(var hl=0;hlhm){return hl}if(hp.to==hm){if(hp.from!=hp.to&&ho=="before"){hn=hl}else{fO=hl}}if(hp.from==hm){if(hp.from!=hp.to&&ho!="before"){hn=hl}else{fO=hl}}}return hn!=null?hn:fO}var bu=(function(){var hp="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";var hn="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function hm(hs){if(hs<=247){return hp.charAt(hs)}else{if(1424<=hs&&hs<=1524){return"R"}else{if(1536<=hs&&hs<=1785){return hn.charAt(hs-1536)}else{if(1774<=hs&&hs<=2220){return"r"}else{if(8192<=hs&&hs<=8203){return"w"}else{if(hs==8204){return"b"}else{return"L"}}}}}}}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var hr=/[stwN]/,hl=/[LRr]/,hk=/[Lb1n]/,ho=/[1n]/;function hq(hu,ht,hs){this.level=hu;this.from=ht;this.to=hs}return function(hP,hv){var hE=hv=="ltr"?"L":"R";if(hP.length==0||hv=="ltr"&&!i.test(hP)){return false}var hy=hP.length,hZ=[];for(var h2=0;h2-1){hm[hl]=i.slice(0,hk).concat(i.slice(hk+1))}}}}}function aN(ho,hn){var hk=eW(ho,hn);if(!hk.length){return}var hl=Array.prototype.slice.call(arguments,2);for(var hm=0;hm0}function bS(i){i.prototype.on=function(hk,hl){ci(this,hk,hl)};i.prototype.off=function(hk,hl){eP(this,hk,hl)}}function c7(i){if(i.preventDefault){i.preventDefault()}else{i.returnValue=false}}function dX(i){if(i.stopPropagation){i.stopPropagation()}else{i.cancelBubble=true}}function b5(i){return i.defaultPrevented!=null?i.defaultPrevented:i.returnValue==false}function e3(i){c7(i);dX(i)}function Q(i){return i.target||i.srcElement}function gE(hk){var i=hk.which;if(i==null){if(hk.button&1){i=1}else{if(hk.button&2){i=3}else{if(hk.button&4){i=2}}}}if(ct&&hk.ctrlKey&&i==1){i=3}return i}var ft=function(){if(ef&&n<9){return false}var i=g0("div");return"draggable" in i||"dragDrop" in i}();var gC;function bE(i){if(gC==null){var hl=g0("span","\u200b");cd(i,g0("span",[hl,document.createTextNode("x")]));if(i.firstChild.offsetHeight!=0){gC=hl.offsetWidth<=1&&hl.offsetHeight>2&&!(ef&&n<8)}}var hk=gC?g0("span","\u200b"):g0("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px");hk.setAttribute("cm-text","");return hk}var gD;function b8(hm){if(gD!=null){return gD}var i=cd(hm,document.createTextNode("A\u062eA"));var hl=cM(i,0,1).getBoundingClientRect();var hk=cM(i,1,2).getBoundingClientRect();eA(hm);if(!hl||hl.left==hl.right){return false}return gD=(hk.right-hl.right<3)}var gJ="\n\nb".split(/\n/).length!=3?function(ho){var hp=0,i=[],hn=ho.length;while(hp<=hn){var hm=ho.indexOf("\n",hp);if(hm==-1){hm=ho.length}var hl=ho.slice(hp,ho.charAt(hm-1)=="\r"?hm-1:hm);var hk=hl.indexOf("\r");if(hk!=-1){i.push(hl.slice(0,hk));hp+=hk+1}else{i.push(hl);hp=hm+1}}return i}:function(i){return i.split(/\r\n?|\n/)};var bK=window.getSelection?function(hk){try{return hk.selectionStart!=hk.selectionEnd}catch(i){return false}}:function(hl){var hk;try{hk=hl.ownerDocument.selection.createRange()}catch(i){}if(!hk||hk.parentElement()!=hl){return false}return hk.compareEndPoints("StartToEnd",hk)!=0};var dG=(function(){var i=g0("div");if("oncopy" in i){return true}i.setAttribute("oncopy","return;");return typeof i.oncopy=="function"})();var fS=null;function aV(hk){if(fS!=null){return fS}var hl=cd(hk,g0("span","x"));var hm=hl.getBoundingClientRect();var i=cM(hl,0,1).getBoundingClientRect();return fS=Math.abs(hm.left-i.left)>1}var dZ={},a3={};function e6(i,hk){if(arguments.length>2){hk.dependencies=Array.prototype.slice.call(arguments,2)}dZ[i]=hk}function bD(hk,i){a3[hk]=i}function hb(i){if(typeof i=="string"&&a3.hasOwnProperty(i)){i=a3[i]}else{if(i&&typeof i.name=="string"&&a3.hasOwnProperty(i.name)){var hk=a3[i.name];if(typeof hk=="string"){hk={name:hk}}i=cK(hk,i);i.name=hk.name}else{if(typeof i=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(i)){return hb("application/xml")}else{if(typeof i=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(i)){return hb("application/json")}}}}if(typeof i=="string"){return{name:i}}else{return i||{name:"null"}}}function gm(hl,hk){hk=hb(hk);var hn=dZ[hk.name];if(!hn){return gm(hl,"text/plain")}var ho=hn(hl,hk);if(dW.hasOwnProperty(hk.name)){var hm=dW[hk.name];for(var hp in hm){if(!hm.hasOwnProperty(hp)){continue}if(ho.hasOwnProperty(hp)){ho["_"+hp]=ho[hp]}ho[hp]=hm[hp]}}ho.name=hk.name;if(hk.helperType){ho.helperType=hk.helperType}if(hk.modeProps){for(var i in hk.modeProps){ho[i]=hk.modeProps[i]}}return ho}var dW={};function fj(hl,hk){var i=dW.hasOwnProperty(hl)?dW[hl]:(dW[hl]={});aY(hk,i)}function cp(hm,i){if(i===true){return i}if(hm.copyState){return hm.copyState(i)}var hl={};for(var hn in i){var hk=i[hn];if(hk instanceof Array){hk=hk.concat([])}hl[hn]=hk}return hl}function g7(hl,i){var hk;while(hl.innerMode){hk=hl.innerMode(i);if(!hk||hk.mode==hl){break}i=hk.state;hl=hk.mode}return hk||{mode:hl,state:i}}function cm(hl,hk,i){return hl.startState?hl.startState(hk,i):true}var fD=function(i,hl,hk){this.pos=this.start=0;this.string=i;this.tabSize=hl||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0;this.lineOracle=hk};fD.prototype.eol=function(){return this.pos>=this.string.length};fD.prototype.sol=function(){return this.pos==this.lineStart};fD.prototype.peek=function(){return this.string.charAt(this.pos)||undefined};fD.prototype.next=function(){if(this.poshk};fD.prototype.eatSpace=function(){var hk=this;var i=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos))){++hk.pos}return this.pos>i};fD.prototype.skipToEnd=function(){this.pos=this.string.length};fD.prototype.skipTo=function(i){var hk=this.string.indexOf(i,this.pos);if(hk>-1){this.pos=hk;return true}};fD.prototype.backUp=function(i){this.pos-=i};fD.prototype.column=function(){if(this.lastColumnPos0){return null}if(hl&&hk!==false){this.pos+=hl[0].length}return hl}};fD.prototype.current=function(){return this.string.slice(this.start,this.pos)};fD.prototype.hideFirstChars=function(hk,i){this.lineStart+=hk;try{return i()}finally{this.lineStart-=hk}};fD.prototype.lookAhead=function(hk){var i=this.lineOracle;return i&&i.lookAhead(hk)};fD.prototype.baseToken=function(){var i=this.lineOracle;return i&&i.baseToken(this.pos)};function f0(hn,hp){hp-=hn.first;if(hp<0||hp>=hn.size){throw new Error("There is no line "+(hp+hn.first)+" in the document.")}var hk=hn;while(!hk.lines){for(var hl=0;;++hl){var ho=hk.children[hl],hm=ho.chunkSize();if(hp=hk.first&&ii){return ab(i,f0(hk,i).text.length)}return gc(hl,f0(hk,hl.line).text.length)}function gc(hl,hk){var i=hl.ch;if(i==null||i>hk){return ab(hl.line,hk)}else{if(i<0){return ab(hl.line,0)}else{return hl}}}function ey(hm,hn){var hk=[];for(var hl=0;hlthis.maxLookAhead){this.maxLookAhead=hk}return i};af.prototype.baseToken=function(hl){var hk=this;if(!this.baseTokens){return null}while(this.baseTokens[this.baseTokenPos]<=hl){hk.baseTokenPos+=2}var i=this.baseTokens[this.baseTokenPos+1];return{type:i&&i.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-hl}};af.prototype.nextLine=function(){this.line++;if(this.maxLookAhead>0){this.maxLookAhead--}};af.fromSaved=function(hl,hk,i){if(hk instanceof aP){return new af(hl,cp(hl.mode,hk.state),i,hk.lookAhead)}else{return new af(hl,cp(hl.mode,hk),i)}};af.prototype.save=function(hk){var i=hk!==false?cp(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new aP(i,this.maxLookAhead):i};function gk(hp,hr,hk,hn){var hq=[hp.state.modeGen],hm={};y(hp,hr.text,hp.doc.mode,hk,function(hs,ht){return hq.push(hs,ht)},hm,hn);var i=hk.state;var ho=function(hv){hk.baseTokens=hq;var ht=hp.state.overlays[hv],hu=1,hs=0;hk.state=true;y(hp,hr.text,ht.mode,hk,function(hw,hy){var hA=hu;while(hshw){hq.splice(hu,1,hw,hq[hu+1],hx)}hu+=2;hs=Math.min(hw,hx)}if(!hy){return}if(ht.opaque){hq.splice(hA,hu-hA,hw,"overlay "+hy);hu=hA+2}else{for(;hAhk.options.maxHighlightLength&&cp(hk.doc.mode,hn.state);var i=gk(hk,hm,hn);if(hl){hn.state=hl}hm.stateAfter=hn.save(!hl);hm.styles=i.styles;if(i.classes){hm.styleClasses=i.classes}else{if(hm.styleClasses){hm.styleClasses=null}}if(ho===hk.doc.highlightFrontier){hk.doc.modeFrontier=Math.max(hk.doc.modeFrontier,++hk.doc.highlightFrontier)}}return hm.styles}function fH(i,hq,hk){var ho=i.doc,hn=i.display;if(!ho.mode.startState){return new af(ho,true,hq)}var hp=cZ(i,hq,hk);var hm=hp>ho.first&&f0(ho,hp-1).stateAfter;var hl=hm?af.fromSaved(ho,hm,hp):new af(ho,cm(ho.mode),hp);ho.iter(hp,hq,function(hr){d3(i,hr.text,hl);var hs=hl.line;hr.stateAfter=hs==hq-1||hs%5==0||hs>=hn.viewFrom&&hsho.start){return hm}}throw new Error("Mode "+hp.name+" failed to advance stream.")}var dF=function(hl,i,hk){this.start=hl.start;this.end=hl.pos;this.string=hl.current();this.type=i||null;this.state=hk};function cR(hr,hp,hm,hl){var hq=hr.doc,hn=hq.mode,i;hp=gy(hq,hp);var ht=f0(hq,hp.line),hk=fH(hr,hp.line,hm);var hs=new fD(ht.text,hr.options.tabSize,hk),ho;if(hl){ho=[]}while((hl||hs.posht.options.maxHighlightLength){hk=false;if(hn){d3(ht,hv,hl,hu.pos)}hu.pos=hv.length;i=null}else{i=dQ(fh(ho,hu,hl.state,hx),hm)}if(hx){var hw=hx[0].name;if(hw){i="m-"+(i?hw+" "+i:hw)}}if(!hk||hq!=i){while(hrhm;--ht){if(ht<=hp.first){return hp.first}var hs=f0(hp,ht-1),i=hs.stateAfter;if(i&&(!hn||ht+(i instanceof aP?i.lookAhead:0)<=hp.modeFrontier)){return ht}var hr=cc(hs.text,null,hq.options.tabSize);if(ho==null||hl>hr){ho=ht-1;hl=hr}}return ho}function hd(hl,hn){hl.modeFrontier=Math.min(hl.modeFrontier,hn);if(hl.highlightFrontierhm;i--){var hk=f0(hl,i).stateAfter;if(hk&&(!(hk instanceof aP)||i+hk.lookAhead=hm:hs.to>hm);(hr||(hr=[])).push(new eT(hp,hs.from,hn?null:hs.to))}}}return hr}function aK(hl,hn,hq){var hr;if(hl){for(var ho=0;ho=hn:hs.to>hn);if(hm||hs.from==hn&&hp.type=="bookmark"&&(!hq||hs.marker.insertLeft)){var hk=hs.from==null||(hp.inclusiveLeft?hs.from<=hn:hs.from0&&hr){for(var ho=0;ho0){continue}var ht=[hn,1],hk=cD(hl.from,hm.from),hs=cD(hl.to,hm.to);if(hk<0||!hr.inclusiveLeft&&!hk){ht.push({from:hl.from,to:hm.from})}if(hs>0||!hr.inclusiveRight&&!hs){ht.push({from:hm.to,to:hl.to})}hp.splice.apply(hp,ht);hn+=ht.length-3}}return hp}function g8(hk){var hm=hk.markedSpans;if(!hm){return}for(var hl=0;hlhn)&&(!hp||en(hp,ho.marker)<0)){hp=ho.marker}}}return hp}function B(hs,hk,hq,hr,ho){var hv=f0(hs,hk);var hl=bj&&hv.markedSpans;if(hl){for(var hn=0;hn=0&&hp<=0||ht<=0&&hp>=0){continue}if(ht<=0&&(hm.marker.inclusiveRight&&ho.inclusiveLeft?cD(hu.to,hq)>=0:cD(hu.to,hq)>0)||ht>=0&&(hm.marker.inclusiveRight&&ho.inclusiveLeft?cD(hu.from,hr)<=0:cD(hu.from,hr)<0)){return true}}}}function A(hk){var i;while(i=fy(hk)){hk=i.find(-1,true).line}return hk}function cJ(hk){var i;while(i=e9(hk)){hk=i.find(1,true).line}return hk}function g(hl){var i,hk;while(i=e9(hl)){hl=i.find(1,true).line;(hk||(hk=[])).push(hl)}return hk}function a7(hm,hk){var i=f0(hm,hk),hl=A(i);if(i==hl){return hk}return b7(hl)}function eC(hm,hl){if(hl>hm.lastLine()){return hl}var hk=f0(hm,hl),i;if(!gg(hm,hk)){return hl}while(i=e9(hk)){hk=i.find(1,true).line}return b7(hk)+1}function gg(ho,hl){var hk=bj&&hl.markedSpans;if(hk){for(var hn=(void 0),hm=0;hmhl.maxLineLength){hl.maxLineLength=hm;hl.maxLine=hn}})}var g4=function(hl,hk,i){this.text=hl;dw(this,hk);this.height=i?i(this):1};g4.prototype.lineNo=function(){return b7(this)};bS(g4);function eZ(hk,hn,hl,i){hk.text=hn;if(hk.stateAfter){hk.stateAfter=null}if(hk.styles){hk.styles=null}if(hk.order!=null){hk.order=null}g8(hk);dw(hk,hl);var hm=i?i(hk):1;if(hm!=hk.height){g5(hk,hm)}}function bU(i){i.parent=null;g8(i)}var et={},co={};function fG(hl,hk){if(!hl||/^\s*$/.test(hl)){return null}var i=hk.addModeClass?co:et;return i[hl]||(i[hl]=hl.replace(/\S+/g,"cm-$&"))}function fB(hq,hp){var ho=g6("span",null,null,dt?"padding-right: .1px":null);var hn={pre:g6("pre",[ho],"CodeMirror-line"),content:ho,col:0,pos:0,cm:hq,trailingSpace:false,splitSpaces:hq.getOption("lineWrapping")};hp.measure={};for(var hm=0;hm<=(hp.rest?hp.rest.length:0);hm++){var hs=hm?hp.rest[hm-1]:hp.line,hl=(void 0);hn.pos=0;hn.addToken=v;if(b8(hq.display.measure)&&(hl=a(hs,hq.doc.direction))){hn.addToken=Z(hn.addToken,hl)}hn.map=[];var hk=hp!=hq.display.externalMeasured&&b7(hs);bF(hs,hn,dC(hq,hs,hk));if(hs.styleClasses){if(hs.styleClasses.bgClass){hn.bgClass=gN(hs.styleClasses.bgClass,hn.bgClass||"")}if(hs.styleClasses.textClass){hn.textClass=gN(hs.styleClasses.textClass,hn.textClass||"")}}if(hn.map.length==0){hn.map.push(0,0,hn.content.appendChild(bE(hq.display.measure)))}if(hm==0){hp.measure.map=hn.map;hp.measure.cache={}}else{(hp.measure.maps||(hp.measure.maps=[])).push(hn.map);(hp.measure.caches||(hp.measure.caches=[])).push({})}}if(dt){var hr=hn.content.lastChild;if(/\bcm-tab\b/.test(hr.className)||(hr.querySelector&&hr.querySelector(".cm-tab"))){hn.content.className="cm-tab-wrap-hack"}}aN(hq,"renderLine",hq,hp.line,hn.pre);if(hn.pre.className){hn.textClass=gN(hn.pre.className,hn.textClass||"")}return hn}function fZ(hk){var i=g0("span","\u2022","cm-invalidchar");i.title="\\u"+hk.charCodeAt(0).toString(16);i.setAttribute("aria-label",i.title);return i}function v(hw,hq,hB,hy,ht,hp,ho){if(!hq){return}var hA=hw.splitSpaces?c6(hq,hw.trailingSpace):hq;var i=hw.cm.state.specialChars,hk=false;var hz;if(!i.test(hq)){hw.col+=hq.length;hz=document.createTextNode(hA);hw.map.push(hw.pos,hw.pos+hq.length,hz);if(ef&&n<9){hk=true}hw.pos+=hq.length}else{hz=document.createDocumentFragment();var hm=0;while(true){i.lastIndex=hm;var hx=i.exec(hq);var hD=hx?hx.index-hm:hq.length-hm;if(hD){var hs=document.createTextNode(hA.slice(hm,hm+hD));if(ef&&n<9){hz.appendChild(g0("span",[hs]))}else{hz.appendChild(hs)}hw.map.push(hw.pos,hw.pos+hD,hs);hw.col+=hD;hw.pos+=hD}if(!hx){break}hm+=hD+1;var hC=(void 0);if(hx[0]=="\t"){var hu=hw.cm.options.tabSize,hr=hu-hw.col%hu;hC=hz.appendChild(g0("span",cQ(hr),"cm-tab"));hC.setAttribute("role","presentation");hC.setAttribute("cm-text","\t");hw.col+=hr}else{if(hx[0]=="\r"||hx[0]=="\n"){hC=hz.appendChild(g0("span",hx[0]=="\r"?"\u240d":"\u2424","cm-invalidchar"));hC.setAttribute("cm-text",hx[0]);hw.col+=1}else{hC=hw.cm.options.specialCharPlaceholder(hx[0]);hC.setAttribute("cm-text",hx[0]);if(ef&&n<9){hz.appendChild(g0("span",[hC]))}else{hz.appendChild(hC)}hw.col+=1}}hw.map.push(hw.pos,hw.pos+1,hC);hw.pos++}}hw.trailingSpace=hA.charCodeAt(hq.length-1)==32;if(hB||hy||ht||hk||hp){var hl=hB||"";if(hy){hl+=hy}if(ht){hl+=ht}var hn=g0("span",[hz],hl,hp);if(ho){for(var hv in ho){if(ho.hasOwnProperty(hv)&&hv!="style"&&hv!="class"){hn.setAttribute(hv,ho[hv])}}}return hw.content.appendChild(hn)}hw.content.appendChild(hz)}function c6(hp,ho){if(hp.length>1&&!/ /.test(hp)){return hp}var hl=ho,hk="";for(var hm=0;hmhm&&hn.from<=hm){break}}if(hn.to>=ho){return hk(ht,hu,hl,hq,hv,hs,hp)}hk(ht,hu.slice(0,hn.to-hm),hl,hq,null,hs,hp);hq=null;hu=hu.slice(hn.to-hm);hm=hn.to}}}function ak(hk,hm,i,hl){var hn=!hl&&i.widgetNode;if(hn){hk.map.push(hk.pos,hk.pos+hm,hn)}if(!hl&&hk.cm.display.input.needsContentAttribute){if(!hn){hn=hk.content.appendChild(document.createElement("span"))}hn.setAttribute("cm-marker",i.id)}if(hn){hk.cm.display.input.setUneditable(hn);hk.content.appendChild(hn)}hk.pos+=hm;hk.trailingSpace=false}function bF(hw,hE,hv){var hp=hw.markedSpans,ht=hw.text,hB=0;if(!hp){for(var hq=1;hqho||hD.collapsed&&hG.to==ho&&hG.from==ho)){if(hG.to!=null&&hG.to!=ho&&hN>hG.to){hN=hG.to;hM=""}if(hD.className){hk+=" "+hD.className}if(hD.css){hx=(hx?hx+";":"")+hD.css}if(hD.startStyle&&hG.from==ho){hA+=" "+hD.startStyle}if(hD.endStyle&&hG.to==hN){(hu||(hu=[])).push(hD.endStyle,hG.to)}if(hD.title){(hs||(hs={})).title=hD.title}if(hD.attributes){for(var hC in hD.attributes){(hs||(hs={}))[hC]=hD.attributes[hC]}}if(hD.collapsed&&(!hm||en(hm.marker,hD)<0)){hm=hG}}else{if(hG.from>ho&&hN>hG.from){hN=hG.from}}}}if(hu){for(var hL=0;hL=hI){break}var hy=Math.min(hI,hN);while(true){if(hz){var hl=ho+hz.length;if(!hm){var hn=hl>hy?hz.slice(0,hy-ho):hz;hE.addToken(hE,hn,hJ?hJ+hk:hk,hA,ho+hn.length==hN?hM:"",hx,hs)}if(hl>=hy){hz=hz.slice(hy-ho);ho=hy;break}ho=hl;hA=""}hz=ht.slice(hB,hB=hv[hH++]);hJ=fG(hv[hH++],hE.cm.options)}}}function bN(hl,i,hk){this.line=i;this.rest=g(i);this.size=this.rest?b7(gt(this.rest))-hk+1:1;this.node=this.text=null;this.hidden=gg(hl,i)}function fF(i,hp,ho){var hn=[],hl;for(var hm=hp;hm2){hp.push((hs.bottom+hl.top)/2-hq.top)}}}hp.push(hq.bottom-hq.top)}}function cU(hm,hk,hn){if(hm.line==hk){return{map:hm.measure.map,cache:hm.measure.cache}}for(var hl=0;hlhn){return{map:hm.measure.maps[ho],cache:hm.measure.caches[ho],before:true}}}}function dv(i,hl){hl=A(hl);var hn=b7(hl);var hk=i.display.externalMeasured=new bN(i.doc,hl,hn);hk.lineN=hn;var hm=hk.built=fB(i,hk);hk.text=hm.pre;cd(i.display.lineMeasure,hm.pre);return hk}function eR(i,hk,hm,hl){return G(i,bh(i,hk),hm,hl)}function fX(i,hl){if(hl>=i.display.viewFrom&&hl=hk.lineN&&hlhk){ho=hs-hn;hl=ho-1;if(hk>=hs){hr="right"}}}}if(hl!=null){hm=ht[hp+2];if(hn==hs&&hq==(hm.insertLeft?"left":"right")){hr=hq}if(hq=="left"&&hl==0){while(hp&&ht[hp-2]==ht[hp-3]&&ht[hp-1].insertLeft){hm=ht[(hp-=3)+2];hr="left"}}if(hq=="right"&&hl==hs-hn){while(hp=0;ho--){if((hn=hl[ho]).left!=hn.right){break}}}return hn}function l(hs,hC,hv,hp){var ht=aU(hC.map,hv,hp);var hA=ht.node,ho=ht.start,hn=ht.end,hk=ht.collapse;var hl;if(hA.nodeType==3){for(var hq=0;hq<4;hq++){while(ho&&f9(hC.line.text.charAt(ht.coverStart+ho))){--ho}while(ht.coverStart+hn0){hk=hp="right"}var hm;if(hs.options.lineWrapping&&(hm=hA.getClientRects()).length>1){hl=hm[hp=="right"?hm.length-1:0]}else{hl=hA.getBoundingClientRect()}}if(ef&&n<9&&!ho&&(!hl||!hl.left&&!hl.right)){var hr=hA.parentNode.getClientRects()[0];if(hr){hl={left:hr.left,right:hr.left+d7(hs.display),top:hr.top,bottom:hr.bottom}}else{hl=fg}}var hy=hl.top-hC.rect.top,hw=hl.bottom-hC.rect.top;var hE=(hy+hw)/2;var hD=hC.view.measure.heights;var hB=0;for(;hB=hp.text.length){i=hp.text.length;ht="before"}else{if(i<=0){i=0;ht="after"}}if(!ho){return hn(ht=="before"?i-1:i,ht=="before")}function hv(hA,hx,hB){var hy=ho[hx],hz=hy.level==1;return hn(hB?hA-1:hA,hz!=hB)}var hk=aR(ho,i,ht);var hr=fO;var hm=hv(i,hk,ht=="before");if(hr!=null){hm.other=hv(i,hr,ht!="before")}return hm}function eb(i,hn){var hm=0;hn=gy(i.doc,hn);if(!i.options.lineWrapping){hm=d7(i.display)*hn.ch}var hk=f0(i.doc,hn.line);var hl=b6(hk)+fU(i.display);return{left:hm,right:hm,top:hl,bottom:hl+hk.height}}function gY(i,hk,hm,hl,ho){var hn=ab(i,hk,hm);hn.xRel=ho;if(hl){hn.outside=hl}return hn}function gG(hq,ho,hn){var hp=hq.doc;hn+=hq.display.viewOffset;if(hn<0){return gY(hp.first,0,null,-1,-1)}var hm=b0(hp,hn),hr=hp.first+hp.size-1;if(hm>hr){return gY(hp.first+hp.size-1,f0(hp,hr).text.length,null,1,1)}if(ho<0){ho=0}var hl=f0(hp,hm);for(;;){var hs=ds(hq,hl,hm,ho,hn);var hk=cC(hl,hs.ch+(hs.xRel>0||hs.outside>0?1:0));if(!hk){return hs}var i=hk.find(1);if(i.line==hm){return i}hl=f0(hp,hm=i.line)}}function bC(i,hl,hn,ho){ho-=ee(hl);var hk=hl.text.length;var hm=cN(function(hp){return G(i,hn,hp-1).bottom<=ho},hk,0);hk=cN(function(hp){return G(i,hn,hp).top>ho},hm,hk);return{begin:hm,end:hk}}function bA(i,hk,hm,hn){if(!hm){hm=bh(i,hk)}var hl=fz(i,hk,G(i,hm,hn),"line").top;return bC(i,hk,hm,hl)}function az(hk,i,hm,hl){return hk.bottom<=hm?false:hk.top>hm?true:(hl?hk.left:hk.right)>i}function ds(hm,hk,hB,hp,ho){ho-=b6(hk);var ht=bh(hm,hk);var hD=ee(hk);var hA=0,hl=hk.text.length,hx=true;var hv=a(hk,hm.doc.direction);if(hv){var hu=(hm.options.lineWrapping?gV:gA)(hm,hk,hB,ht,hv,hp,ho);hx=hu.level!=1;hA=hx?hu.from:hu.to-1;hl=hx?hu.to:hu.from-1}var hn=null,hr=null;var hs=cN(function(hE){var hF=G(hm,ht,hE);hF.top+=hD;hF.bottom+=hD;if(!az(hF,hp,ho,false)){return false}if(hF.top<=ho&&hF.left<=hp){hn=hE;hr=hF}return true},hA,hl);var i,hC,hz=false;if(hr){var hy=hp-hr.left=hw.bottom?1:0}hs=eU(hk.text,hs,1);return gY(hB,hs,hC,hz,hp-i)}function gA(hs,ho,i,ht,hn,hr,hq){var hp=cN(function(hw){var hu=hn[hw],hv=hu.level!=1;return az(er(hs,ab(i,hv?hu.to:hu.from,hv?"before":"after"),"line",ho,ht),hr,hq,true)},0,hn.length-1);var hm=hn[hp];if(hp>0){var hl=hm.level!=1;var hk=er(hs,ab(i,hl?hm.from:hm.to,hl?"after":"before"),"line",ho,ht);if(az(hk,hr,hq,true)&&hk.top>hq){hm=hn[hp-1]}}return hm}function gV(hx,hs,hv,hA,hp,hw,hu){var ho=bC(hx,hs,hA,hu);var hn=ho.begin;var hq=ho.end;if(/\s/.test(hs.text.charAt(hq-1))){hq--}var hm=null,hy=null;for(var hr=0;hr=hq||hk.to<=hn){continue}var hl=hk.level!=1;var hz=G(hx,hA,hl?Math.min(hq,hk.to)-1:Math.max(hn,hk.from)).right;var ht=hzht){hm=hk;hy=ht}}if(!hm){hm=hp[hp.length-1]}if(hm.fromhq){hm={from:hm.from,to:hq,level:hm.level}}return hm}var aQ;function a9(hm){if(hm.cachedTextHeight!=null){return hm.cachedTextHeight}if(aQ==null){aQ=g0("pre",null,"CodeMirror-line-like");for(var hl=0;hl<49;++hl){aQ.appendChild(document.createTextNode("x"));aQ.appendChild(g0("br"))}aQ.appendChild(document.createTextNode("x"))}cd(hm.measure,aQ);var hk=aQ.offsetHeight/50;if(hk>3){hm.cachedTextHeight=hk}eA(hm.measure);return hk||1}function d7(hn){if(hn.cachedCharWidth!=null){return hn.cachedCharWidth}var i=g0("span","xxxxxxxxxx");var hm=g0("pre",[i],"CodeMirror-line-like");cd(hn.measure,hm);var hl=i.getBoundingClientRect(),hk=(hl.right-hl.left)/10;if(hk>2){hn.cachedCharWidth=hk}return hk||10}function fY(hk){var hp=hk.display,hn={},hm={};var ho=hp.gutters.clientLeft;for(var hr=hp.gutters.firstChild,hl=0;hr;hr=hr.nextSibling,++hl){var hq=hk.display.gutterSpecs[hl].className;hn[hq]=hr.offsetLeft+hr.clientLeft+ho;hm[hq]=hr.clientWidth}return{fixedPos:ev(hp),gutterTotalWidth:hp.gutters.offsetWidth,gutterLeft:hn,gutterWidth:hm,wrapperWidth:hp.wrapper.clientWidth}}function ev(i){return i.scroller.getBoundingClientRect().left-i.sizer.getBoundingClientRect().left}function bq(i){var hl=a9(i.display),hk=i.options.lineWrapping;var hm=hk&&Math.max(5,i.display.scroller.clientWidth/d7(i.display)-3);return function(ho){if(gg(i.doc,ho)){return 0}var hn=0;if(ho.widgets){for(var hp=0;hp0&&(ht=f0(hs.doc,hq.line).text).length==hq.ch){var hm=cc(ht,ht.length,hs.options.tabSize)-ht.length;hq=ab(hq.line,Math.max(0,Math.round((hr-fQ(hs.display).left)/d7(hs.display))-hm))}return hq}function dY(hk,hn){if(hn>=hk.display.viewTo){return null}hn-=hk.display.viewFrom;if(hn<0){return null}var hl=hk.display.view;for(var hm=0;hmhp)){hm.updateLineNumbers=hp}hr.curOp.viewChanged=true;if(hp>=hm.viewTo){if(bj&&a7(hr.doc,hp)hm.viewFrom){fa(hr)}else{hm.viewFrom+=hs;hm.viewTo+=hs}}else{if(hp<=hm.viewFrom&&hq>=hm.viewTo){fa(hr)}else{if(hp<=hm.viewFrom){var ho=dL(hr,hq,hq+hs,1);if(ho){hm.view=hm.view.slice(ho.index);hm.viewFrom=ho.lineN;hm.viewTo+=hs}else{fa(hr)}}else{if(hq>=hm.viewTo){var hk=dL(hr,hp,hp,-1);if(hk){hm.view=hm.view.slice(0,hk.index);hm.viewTo=hk.lineN}else{fa(hr)}}else{var hn=dL(hr,hp,hp,-1);var hl=dL(hr,hq,hq+hs,1);if(hn&&hl){hm.view=hm.view.slice(0,hn.index).concat(fF(hr,hn.lineN,hl.lineN)).concat(hm.view.slice(hl.index));hm.viewTo+=hs}else{fa(hr)}}}}}}var i=hm.externalMeasured;if(i){if(hq=hn.lineN&&hl=hp.viewTo){return}var hm=hp.view[dY(hk,hl)];if(hm.node==null){return}var i=hm.changes||(hm.changes=[]);if(dP(i,ho)==-1){i.push(ho)}}function fa(i){i.display.viewFrom=i.display.viewTo=i.doc.first;i.display.view=[];i.display.viewOffset=0}function dL(hs,hm,ho,hl){var hp=dY(hs,hm),hr,hq=hs.display.view;if(!bj||ho==hs.doc.first+hs.doc.size){return{index:hp,lineN:ho}}var hk=hs.display.viewFrom;for(var hn=0;hn0){if(hp==hq.length-1){return null}hr=(hk+hq[hp].size)-hm;hp++}else{hr=hk-hm}hm+=hr;ho+=hr}while(a7(hs.doc,ho)!=ho){if(hp==(hl<0?0:hq.length-1)){return null}ho+=hl*hq[hp-(hl<0?1:0)].size;hp+=hl}return{index:hp,lineN:ho}}function dk(i,hn,hm){var hl=i.display,hk=hl.view;if(hk.length==0||hn>=hl.viewTo||hm<=hl.viewFrom){hl.view=fF(i,hn,hm);hl.viewFrom=hn}else{if(hl.viewFrom>hn){hl.view=fF(i,hn,hl.viewFrom).concat(hl.view)}else{if(hl.viewFromhm){hl.view=hl.view.slice(0,dY(i,hm))}}}hl.viewTo=hm}function dI(hk){var hl=hk.display.view,ho=0;for(var hn=0;hn=hq.display.viewTo||hr.to().line0){hl.blinker=setInterval(function(){return hl.cursorDiv.style.visibility=(hk=!hk)?"":"hidden"},i.options.cursorBlinkRate)}else{if(i.options.cursorBlinkRate<0){hl.cursorDiv.style.visibility="hidden"}}}function u(i){if(!i.state.focused){i.display.input.focus();c2(i)}}function ar(i){i.state.delayingBlurEvent=true;setTimeout(function(){if(i.state.delayingBlurEvent){i.state.delayingBlurEvent=false;a6(i)}},100)}function c2(i,hk){if(i.state.delayingBlurEvent){i.state.delayingBlurEvent=false}if(i.options.readOnly=="nocursor"){return}if(!i.state.focused){aN(i,"focus",i,hk);i.state.focused=true;gn(i.display.wrapper,"CodeMirror-focused");if(!i.curOp&&i.display.selForContextMenu!=i.doc.sel){i.display.input.reset();if(dt){setTimeout(function(){return i.display.input.reset(true)},20)}}i.display.input.receivedFocus()}r(i)}function a6(i,hk){if(i.state.delayingBlurEvent){return}if(i.state.focused){aN(i,"blur",i,hk);i.state.focused=false;h(i.display.wrapper,"CodeMirror-focused")}clearInterval(i.display.blinker);setTimeout(function(){if(!i.state.focused){i.display.shift=false}},150)}function bl(hu){var hs=hu.display;var hm=hs.lineDiv.offsetTop;for(var hn=0;hn0.005||ht<-0.005){g5(hv.line,hw);cx(hv.line);if(hv.rest){for(var hl=0;hlhu.display.sizerWidth){var hq=Math.ceil(hk/d7(hu.display));if(hq>hu.display.maxLineLength){hu.display.maxLineLength=hq;hu.display.maxLine=hv.line;hu.display.maxLineChanged=true}}}}function cx(hl){if(hl.widgets){for(var hm=0;hm=hp){ho=b0(hq,b6(f0(hq,hr))-hm.wrapper.clientHeight);hp=hr}}}return{from:ho,to:Math.max(hp,ho+1)}}function eF(hk,hm){if(a2(hk,"scrollCursorIntoView")){return}var ho=hk.display,hl=ho.sizer.getBoundingClientRect(),i=null;if(hm.top+hl.top<0){i=true}else{if(hm.bottom+hl.top>(window.innerHeight||document.documentElement.clientHeight)){i=false}}if(i!=null&&!ge){var hn=g0("div","\u200b",null,("position: absolute;\n top: "+(hm.top-ho.viewOffset-fU(hk.display))+"px;\n height: "+(hm.bottom-hm.top+dl(hk)+ho.barHeight)+"px;\n left: "+(hm.left)+"px; width: "+(Math.max(2,hm.right-hm.left))+"px;"));hk.display.lineSpace.appendChild(hn);hn.scrollIntoView(i);hk.display.lineSpace.removeChild(hn)}}function H(hu,hr,hn,hm){if(hm==null){hm=0}var hs;if(!hu.options.lineWrapping&&hr==hn){hr=hr.ch?ab(hr.line,hr.sticky=="before"?hr.ch-1:hr.ch,"after"):hr;hn=hr.sticky=="before"?ab(hr.line,hr.ch+1,"before"):hr}for(var ho=0;ho<5;ho++){var hp=false;var ht=er(hu,hr);var i=!hn||hn==hr?ht:er(hu,hn);hs={left:Math.min(ht.left,i.left),top:Math.min(ht.top,i.top)-hm,right:Math.max(ht.left,i.left),bottom:Math.max(ht.bottom,i.bottom)+hm};var hl=M(hu,hs);var hq=hu.doc.scrollTop,hk=hu.doc.scrollLeft;if(hl.scrollTop!=null){C(hu,hl.scrollTop);if(Math.abs(hu.doc.scrollTop-hq)>1){hp=true}}if(hl.scrollLeft!=null){bX(hu,hl.scrollLeft);if(Math.abs(hu.doc.scrollLeft-hk)>1){hp=true}}if(!hp){break}}return hs}function I(i,hk){var hl=M(i,hk);if(hl.scrollTop!=null){C(i,hl.scrollTop)}if(hl.scrollLeft!=null){bX(i,hl.scrollLeft)}}function M(hs,hr){var hp=hs.display,hn=a9(hs.display);if(hr.top<0){hr.top=0}var hl=hs.curOp&&hs.curOp.scrollTop!=null?hs.curOp.scrollTop:hp.scroller.scrollTop;var hu=dn(hs),hw={};if(hr.bottom-hr.top>hu){hr.bottom=hr.top+hu}var hk=hs.doc.height+b1(hp);var i=hr.tophk-hn;if(hr.tophl+hu){var hq=Math.min(hr.top,(ho?hk:hr.bottom)-hu);if(hq!=hl){hw.scrollTop=hq}}}var hv=hs.curOp&&hs.curOp.scrollLeft!=null?hs.curOp.scrollLeft:hp.scroller.scrollLeft;var ht=dS(hs)-(hs.options.fixedGutter?hp.gutters.offsetWidth:0);var hm=hr.right-hr.left>ht;if(hm){hr.right=hr.left+ht}if(hr.left<10){hw.scrollLeft=0}else{if(hr.leftht+hv-3){hw.scrollLeft=hr.right+(hm?0:10)-ht}}}return hw}function c9(i,hk){if(hk==null){return}gp(i);i.curOp.scrollTop=(i.curOp.scrollTop==null?i.doc.scrollTop:i.curOp.scrollTop)+hk}function gs(i){gp(i);var hk=i.getCursor();i.curOp.scrollToPos={from:hk,to:hk,margin:i.options.cursorScrollMargin}}function fu(hk,i,hl){if(i!=null||hl!=null){gp(hk)}if(i!=null){hk.curOp.scrollLeft=i}if(hl!=null){hk.curOp.scrollTop=hl}}function cA(i,hk){gp(i);i.curOp.scrollToPos=hk}function gp(i){var hk=i.curOp.scrollToPos;if(hk){i.curOp.scrollToPos=null;var hm=eb(i,hk.from),hl=eb(i,hk.to);ca(i,hm,hl,hk.margin)}}function ca(i,hn,hm,hl){var hk=M(i,{left:Math.min(hn.left,hm.left),top:Math.min(hn.top,hm.top)-hl,right:Math.max(hn.right,hm.right),bottom:Math.max(hn.bottom,hm.bottom)+hl});fu(i,hk.scrollLeft,hk.scrollTop)}function C(i,hk){if(Math.abs(i.doc.scrollTop-hk)<2){return}if(!cP){eq(i,{top:hk})}T(i,hk,true);if(cP){eq(i)}eO(i,100)}function T(i,hl,hk){hl=Math.max(0,Math.min(i.display.scroller.scrollHeight-i.display.scroller.clientHeight,hl));if(i.display.scroller.scrollTop==hl&&!hk){return}i.doc.scrollTop=hl;i.display.scrollbars.setScrollTop(hl);if(i.display.scroller.scrollTop!=hl){i.display.scroller.scrollTop=hl}}function bX(i,hm,hl,hk){hm=Math.max(0,Math.min(hm,i.display.scroller.scrollWidth-i.display.scroller.clientWidth));if((hl?hm==i.doc.scrollLeft:Math.abs(i.doc.scrollLeft-hm)<2)&&!hk){return}i.doc.scrollLeft=hm;fk(i);if(i.display.scroller.scrollLeft!=hm){i.display.scroller.scrollLeft=hm}i.display.scrollbars.setScrollLeft(hm)}function d5(i){var hm=i.display,hl=hm.gutters.offsetWidth;var hk=Math.round(i.doc.height+b1(i.display));return{clientHeight:hm.scroller.clientHeight,viewHeight:hm.wrapper.clientHeight,scrollWidth:hm.scroller.scrollWidth,clientWidth:hm.scroller.clientWidth,viewWidth:hm.wrapper.clientWidth,barLeft:i.options.fixedGutter?hl:0,docHeight:hk,scrollHeight:hk+dl(i)+hm.barHeight,nativeBarWidth:hm.nativeBarWidth,gutterWidth:hl}}var dR=function(hl,hk,i){this.cm=i;var hm=this.vert=g0("div",[g0("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");var hn=this.horiz=g0("div",[g0("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");hm.tabIndex=hn.tabIndex=-1;hl(hm);hl(hn);ci(hm,"scroll",function(){if(hm.clientHeight){hk(hm.scrollTop,"vertical")}});ci(hn,"scroll",function(){if(hn.clientWidth){hk(hn.scrollLeft,"horizontal")}});this.checkedZeroWidth=false;if(ef&&n<8){this.horiz.style.minHeight=this.vert.style.minWidth="18px"}};dR.prototype.update=function(hm){var hn=hm.scrollWidth>hm.clientWidth+1;var hl=hm.scrollHeight>hm.clientHeight+1;var ho=hm.nativeBarWidth;if(hl){this.vert.style.display="block";this.vert.style.bottom=hn?ho+"px":"0";var hk=hm.viewHeight-(hn?ho:0);this.vert.firstChild.style.height=Math.max(0,hm.scrollHeight-hm.clientHeight+hk)+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(hn){this.horiz.style.display="block";this.horiz.style.right=hl?ho+"px":"0";this.horiz.style.left=hm.barLeft+"px";var i=hm.viewWidth-hm.barLeft-(hl?ho:0);this.horiz.firstChild.style.width=Math.max(0,hm.scrollWidth-hm.clientWidth+i)+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedZeroWidth&&hm.clientHeight>0){if(ho==0){this.zeroWidthHack()}this.checkedZeroWidth=true}return{right:hl?ho:0,bottom:hn?ho:0}};dR.prototype.setScrollLeft=function(i){if(this.horiz.scrollLeft!=i){this.horiz.scrollLeft=i}if(this.disableHoriz){this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")}};dR.prototype.setScrollTop=function(i){if(this.vert.scrollTop!=i){this.vert.scrollTop=i}if(this.disableVert){this.enableZeroWidthBar(this.vert,this.disableVert,"vert")}};dR.prototype.zeroWidthHack=function(){var i=ct&&!dB?"12px":"18px";this.horiz.style.height=this.vert.style.width=i;this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new hj;this.disableVert=new hj};dR.prototype.enableZeroWidthBar=function(hl,i,hk){hl.style.pointerEvents="auto";function hm(){var ho=hl.getBoundingClientRect();var hn=hk=="vert"?document.elementFromPoint(ho.right-1,(ho.top+ho.bottom)/2):document.elementFromPoint((ho.right+ho.left)/2,ho.bottom-1);if(hn!=hl){hl.style.pointerEvents="none"}else{i.set(1000,hm)}}i.set(1000,hm)};dR.prototype.clear=function(){var i=this.horiz.parentNode;i.removeChild(this.horiz);i.removeChild(this.vert)};var fP=function(){};fP.prototype.update=function(){return{bottom:0,right:0}};fP.prototype.setScrollLeft=function(){};fP.prototype.setScrollTop=function(){};fP.prototype.clear=function(){};function fJ(hm,ho){if(!ho){ho=d5(hm)}var hl=hm.display.barWidth,hk=hm.display.barHeight;a5(hm,ho);for(var hn=0;hn<4&&hl!=hm.display.barWidth||hk!=hm.display.barHeight;hn++){if(hl!=hm.display.barWidth&&hm.options.lineWrapping){bl(hm)}a5(hm,d5(hm));hl=hm.display.barWidth;hk=hm.display.barHeight}}function a5(i,hk){var hm=i.display;var hl=hm.scrollbars.update(hk);hm.sizer.style.paddingRight=(hm.barWidth=hl.right)+"px";hm.sizer.style.paddingBottom=(hm.barHeight=hl.bottom)+"px";hm.heightForcer.style.borderBottom=hl.bottom+"px solid transparent";if(hl.right&&hl.bottom){hm.scrollbarFiller.style.display="block";hm.scrollbarFiller.style.height=hl.bottom+"px";hm.scrollbarFiller.style.width=hl.right+"px"}else{hm.scrollbarFiller.style.display=""}if(hl.bottom&&i.options.coverGutterNextToScrollbar&&i.options.fixedGutter){hm.gutterFiller.style.display="block";hm.gutterFiller.style.height=hl.bottom+"px";hm.gutterFiller.style.width=hk.gutterWidth+"px"}else{hm.gutterFiller.style.display=""}}var bz={"native":dR,"null":fP};function aL(i){if(i.display.scrollbars){i.display.scrollbars.clear();if(i.display.scrollbars.addClass){h(i.display.wrapper,i.display.scrollbars.addClass)}}i.display.scrollbars=new bz[i.options.scrollbarStyle](function(hk){i.display.wrapper.insertBefore(hk,i.display.scrollbarFiller);ci(hk,"mousedown",function(){if(i.state.focused){setTimeout(function(){return i.display.input.focus()},0)}});hk.setAttribute("cm-not-content","true")},function(hl,hk){if(hk=="horizontal"){bX(i,hl)}else{C(i,hl)}},i);if(i.display.scrollbars.addClass){gn(i.display.wrapper,i.display.scrollbars.addClass)}}var eJ=0;function db(i){i.curOp={cm:i,viewChanged:false,startHeight:i.doc.height,forceUpdate:false,updateInput:0,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:false,id:++eJ};fc(i.curOp)}function av(i){var hk=i.curOp;if(hk){cj(hk,function(hm){for(var hl=0;hl=hk.viewTo)||hk.maxLineChanged&&i.options.lineWrapping;hl.update=hl.mustUpdate&&new aT(i,hl.mustUpdate&&{top:hl.scrollTop,ensure:hl.scrollToPos},hl.forceUpdate)}function ay(i){i.updatedDisplay=i.mustUpdate&&F(i.cm,i.update)}function cn(hl){var i=hl.cm,hk=i.display;if(hl.updatedDisplay){bl(i)}hl.barMeasure=d5(i);if(hk.maxLineChanged&&!i.options.lineWrapping){hl.adjustWidthTo=eR(i,hk.maxLine,hk.maxLine.text.length).left+3;i.display.sizerWidth=hl.adjustWidthTo;hl.barMeasure.scrollWidth=Math.max(hk.scroller.clientWidth,hk.sizer.offsetLeft+hl.adjustWidthTo+dl(i)+i.display.barWidth);hl.maxScrollLeft=Math.max(0,hk.sizer.offsetLeft+hl.adjustWidthTo-dS(i))}if(hl.updatedDisplay||hl.selectionChanged){hl.preparedSelection=hk.input.prepareSelection()}}function ax(hl){var i=hl.cm;if(hl.adjustWidthTo!=null){i.display.sizer.style.minWidth=hl.adjustWidthTo+"px";if(hl.maxScrollLeft=i.display.viewTo){return}var hl=+new Date+i.options.workTime;var hm=fH(i,hn.highlightFrontier);var hk=[];hn.iter(hm.line,Math.min(hn.first+hn.size,i.display.viewTo+500),function(hp){if(hm.line>=i.display.viewFrom){var hs=hp.styles;var ho=hp.text.length>i.options.maxHighlightLength?cp(hn.mode,hm.state):null;var hu=gk(i,hp,hm,true);if(ho){hm.state=ho}hp.styles=hu.styles;var hr=hp.styleClasses,ht=hu.classes;if(ht){hp.styleClasses=ht}else{if(hr){hp.styleClasses=null}}var hv=!hs||hs.length!=hp.styles.length||hr!=ht&&(!hr||!ht||hr.bgClass!=ht.bgClass||hr.textClass!=ht.textClass);for(var hq=0;!hv&&hqhl){eO(i,i.options.workDelay);return true}});hn.highlightFrontier=hm.line;hn.modeFrontier=Math.max(hn.modeFrontier,hm.line);if(hk.length){df(i,function(){for(var ho=0;ho=hn.viewFrom&&hm.visible.to<=hn.viewTo&&(hn.updateLineNumbers==null||hn.updateLineNumbers>=hn.viewTo)&&hn.renderedView==hn.view&&dI(hs)==0){return false}if(eD(hs)){fa(hs);hm.dims=fY(hs)}var hl=hr.first+hr.size;var hp=Math.max(hm.visible.from-hs.options.viewportMargin,hr.first);var hq=Math.min(hl,hm.visible.to+hs.options.viewportMargin);if(hn.viewFromhq&&hn.viewTo-hq<20){hq=Math.min(hl,hn.viewTo)}if(bj){hp=a7(hs.doc,hp);hq=eC(hs.doc,hq)}var hk=hp!=hn.viewFrom||hq!=hn.viewTo||hn.lastWrapHeight!=hm.wrapperHeight||hn.lastWrapWidth!=hm.wrapperWidth;dk(hs,hp,hq);hn.viewOffset=b6(f0(hs.doc,hn.viewFrom));hs.display.mover.style.top=hn.viewOffset+"px";var i=dI(hs);if(!hk&&i==0&&!hm.force&&hn.renderedView==hn.view&&(hn.updateLineNumbers==null||hn.updateLineNumbers>=hn.viewTo)){return false}var ho=bB(hs);if(i>4){hn.lineDiv.style.display="none"}cL(hs,hn.updateLineNumbers,hm.dims);if(i>4){hn.lineDiv.style.display=""}hn.renderedView=hn.view;j(ho);eA(hn.cursorDiv);eA(hn.selectionDiv);hn.gutters.style.height=hn.sizer.style.minHeight=0;if(hk){hn.lastWrapHeight=hm.wrapperHeight;hn.lastWrapWidth=hm.wrapperWidth;eO(hs,400)}hn.updateLineNumbers=null;return true}function cI(hk,hn){var i=hn.viewport;for(var hm=true;;hm=false){if(!hm||!hk.options.lineWrapping||hn.oldDisplayWidth==dS(hk)){if(i&&i.top!=null){i={top:Math.min(hk.doc.height+b1(hk.display)-dn(hk),i.top)}}hn.visible=cs(hk.display,hk.doc,i);if(hn.visible.from>=hk.display.viewFrom&&hn.visible.to<=hk.display.viewTo){break}}else{if(hm){hn.visible=cs(hk.display,hk.doc,i)}}if(!F(hk,hn)){break}bl(hk);var hl=d5(hk);bV(hk);fJ(hk,hl);d4(hk,hl);hn.force=false}hn.signal(hk,"update",hk);if(hk.display.viewFrom!=hk.display.reportedViewFrom||hk.display.viewTo!=hk.display.reportedViewTo){hn.signal(hk,"viewportChange",hk,hk.display.viewFrom,hk.display.viewTo);hk.display.reportedViewFrom=hk.display.viewFrom;hk.display.reportedViewTo=hk.display.viewTo}}function eq(hk,i){var hm=new aT(hk,i);if(F(hk,hm)){bl(hk);cI(hk,hm);var hl=d5(hk);bV(hk);fJ(hk,hl);d4(hk,hl);hm.finish()}}function cL(hv,hm,hu){var hr=hv.display,hx=hv.options.lineNumbers;var hk=hr.lineDiv,hw=hk.firstChild;function hq(hy){var i=hy.nextSibling;if(dt&&ct&&hv.display.currentWheelTarget==hy){hy.style.display="none"}else{hy.parentNode.removeChild(hy)}return i}var hs=hr.view,hp=hr.viewFrom;for(var hn=0;hn-1){ht=false}ai(hv,ho,hp,hu)}if(ht){eA(ho.lineNumber);ho.lineNumber.appendChild(document.createTextNode(e5(hv.options,hp)))}hw=ho.node.nextSibling}}hp+=ho.size}while(hw){hw=hq(hw)}}function dx(hk){var i=hk.gutters.offsetWidth;hk.sizer.style.marginLeft=i+"px"}function d4(i,hk){i.display.sizer.style.minHeight=hk.docHeight+"px";i.display.heightForcer.style.top=hk.docHeight+"px";i.display.gutters.style.height=(hk.docHeight+i.display.barHeight+dl(i))+"px"}function fk(hs){var hq=hs.display,hr=hq.view;if(!hq.alignWidgets&&(!hq.gutters.firstChild||!hs.options.fixedGutter)){return}var ho=ev(hq)-hq.scroller.scrollLeft+hs.doc.scrollLeft;var hk=hq.gutters.offsetWidth,hl=ho+"px";for(var hn=0;hnht.clientWidth;var hm=ht.scrollHeight>ht.clientHeight;if(!(hy&&hn||hx&&hm)){return}if(hx&&ct&&dt){outer:for(var hv=ho.target,hs=hq.view;hv!=ht;hv=hv.parentNode){for(var hl=0;hl=0&&cD(ho,hl.to())<=0){return hm}}return -1};var eu=function(i,hk){this.anchor=i;this.head=hk};eu.prototype.from=function(){return aA(this.anchor,this.head)};eu.prototype.to=function(){return bQ(this.anchor,this.head)};eu.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function cX(hu,hk,ht){var hp=hu&&hu.options.selectionsMayTouch;var hm=hk[ht];hk.sort(function(hw,i){return cD(hw.from(),i.from())});ht=dP(hk,hm);for(var ho=1;ho0:hs>=0){var hr=aA(hl.from(),hv.from()),hq=bQ(hl.to(),hv.to());var hn=hl.empty()?hv.from()==hv.head:hl.from()==hl.head;if(ho<=ht){--ht}hk.splice(--ho,2,new eu(hn?hq:hr,hn?hr:hq))}}return new gZ(hk,ht)}function fA(i,hk){return new gZ([new eu(i,hk||i)],0)}function dq(i){if(!i.text){return i.to}return ab(i.from.line+i.text.length-1,gt(i.text).length+(i.text.length==1?i.from.ch:0))}function cl(hm,hl){if(cD(hm,hl.from)<0){return hm}if(cD(hm,hl.to)<=0){return dq(hl)}var i=hm.line+hl.text.length-(hl.to.line-hl.from.line)-1,hk=hm.ch;if(hm.line==hl.to.line){hk+=dq(hl).ch-hl.to.ch}return ab(i,hk)}function f4(hn,ho){var hl=[];for(var hm=0;hm1){hA.remove(hy.line+1,hw-1)}hA.insert(hy.line+1,ho)}}}}al(hA,"change",hA,ht)}function eG(hm,hl,hk){function i(hs,hq,ho){if(hs.linked){for(var hp=0;hp1&&!hk.done[hk.done.length-2].ranges){hk.done.pop();return gt(hk.done)}}}}function gB(hp,hn,i,hm){var hl=hp.history;hl.undone.length=0;var hk=+new Date,hq;var hr;if((hl.lastOp==hm||hl.lastOrigin==hn.origin&&hn.origin&&((hn.origin.charAt(0)=="+"&&hl.lastModTime>hk-(hp.cm?hp.cm.options.historyEventDelay:500))||hn.origin.charAt(0)=="*"))&&(hq=fv(hl,hl.lastOp==hm))){hr=gt(hq.changes);if(cD(hn.from,hn.to)==0&&cD(hn.from,hr.to)==0){hr.to=dq(hn)}else{hq.changes.push(d2(hp,hn))}}else{var ho=gt(hl.done);if(!ho||!ho.ranges){dh(hp.sel,hl.done)}hq={changes:[d2(hp,hn)],generation:hl.generation};hl.done.push(hq);while(hl.done.length>hl.undoDepth){hl.done.shift();if(!hl.done[0].ranges){hl.done.shift()}}}hl.done.push(i);hl.generation=++hl.maxGeneration;hl.lastModTime=hl.lastSelTime=hk;hl.lastOp=hl.lastSelOp=hm;hl.lastOrigin=hl.lastSelOrigin=hn.origin;if(!hr){aN(hp,"historyAdded")}}function bT(hn,i,hl,hm){var hk=i.charAt(0);return hk=="*"||hk=="+"&&hl.ranges.length==hm.ranges.length&&hl.somethingSelected()==hm.somethingSelected()&&new Date-hn.history.lastSelTime<=(hn.cm?hn.cm.options.historyEventDelay:500)}function hc(ho,hm,i,hl){var hn=ho.history,hk=hl&&hl.origin;if(i==hn.lastSelOp||(hk&&hn.lastSelOrigin==hk&&(hn.lastModTime==hn.lastSelTime&&hn.lastOrigin==hk||bT(ho,hk,gt(hn.done),hm)))){hn.done[hn.done.length-1]=hm}else{dh(hm,hn.done)}hn.lastSelTime=+new Date;hn.lastSelOrigin=hk;hn.lastSelOp=i;if(hl&&hl.clearRedo!==false){go(hn.undone)}}function dh(hk,i){var hl=gt(i);if(!(hl&&hl.ranges&&hl.equals(hk))){i.push(hk)}}function ck(hk,ho,hn,hm){var i=ho["spans_"+hk.id],hl=0;hk.iter(Math.max(hk.first,hn),Math.min(hk.first+hk.size,hm),function(hp){if(hp.markedSpans){(i||(i=ho["spans_"+hk.id]={}))[hl]=hp.markedSpans}++hl})}function bx(hm){if(!hm){return null}var hk;for(var hl=0;hl-1){gt(ht)[hk]=hr[hk];delete hr[hk]}}}}}}return hl}function gf(hk,hn,i,ho){if(ho){var hm=hk.anchor;if(i){var hl=cD(hn,hm)<0;if(hl!=(cD(i,hm)<0)){hm=hn;hn=i}else{if(hl!=(cD(hn,i)<0)){hn=i}}}return new eu(hm,hn)}else{return new eu(i||hn,hn)}}function gS(hm,hl,i,hk,hn){if(hn==null){hn=hm.cm&&(hm.cm.display.shift||hm.extend)}cf(hm,new gZ([gf(hm.sel.primary(),hl,i,hn)],0),hk)}function aE(hp,ho,hm){var hl=[];var hq=hp.cm&&(hp.cm.display.shift||hp.extend);for(var hn=0;hn=ht.ch:hl.to>ht.ch))){if(hr){aN(hm,"beforeCursorEnter");if(hm.explicitlyCleared){if(!hx.markedSpans){break}else{--hp;continue}}}if(!hm.atomic){continue}if(ho){var hs=hm.find(hn<0?1:-1),hu=(void 0);if(hn<0?hv:hk){hs=hg(hw,hs,-hn,hs&&hs.line==ht.line?hx:null)}if(hs&&hs.line==ht.line&&(hu=cD(hs,ho))&&(hn<0?hu<0:hu>0)){return fq(hw,hs,ht,hn,hr)}}var hq=hm.find(hn<0?-1:1);if(hn<0?hk:hv){hq=hg(hw,hq,hn,hq.line==ht.line?hx:null)}return hq?fq(hw,hq,ht,hn,hr):null}}}return ht}function cg(ho,hp,hm,hk,i){var hl=hk||1;var hn=fq(ho,hp,hm,hl,i)||(!i&&fq(ho,hp,hm,hl,true))||fq(ho,hp,hm,-hl,i)||(!i&&fq(ho,hp,hm,-hl,true));if(!hn){ho.cantEdit=true;return ab(ho.first,0)}return hn}function hg(hl,hm,hk,i){if(hk<0&&hm.ch==0){if(hm.line>hl.first){return gy(hl,ab(hm.line-1))}else{return null}}else{if(hk>0&&hm.ch==(i||f0(hl,hm.line)).text.length){if(hm.line=0;--hk){P(hn,{from:hl[hk].from,to:hl[hk].to,text:hk?[""]:ho.text,origin:ho.origin})}}else{P(hn,ho)}}function P(hl,hm){if(hm.text.length==1&&hm.text[0]==""&&cD(hm.from,hm.to)==0){return}var hk=f4(hl,hm);gB(hl,hm,hk,hl.cm?hl.cm.curOp.id:NaN);eN(hl,hm,hk,eV(hl,hm));var i=[];eG(hl,function(ho,hn){if(!hn&&dP(i,ho.history)==-1){d8(ho.history,hm);i.push(ho.history)}eN(ho,hm,null,eV(ho,hm))})}function cu(hx,hu,hy){var hv=hx.cm&&hx.cm.state.suppressEdits;if(hv&&!hy){return}var ht=hx.history,hl,hn=hx.sel;var hk=hu=="undo"?ht.done:ht.undone,hw=hu=="undo"?ht.undone:ht.done;var hq=0;for(;hq=0;--ho){var hp=hr(ho);if(hp){return hp.v}}}function f8(hk,hm){if(hm==0){return}hk.first+=hm;hk.sel=new gZ(ce(hk.sel.ranges,function(hn){return new eu(ab(hn.anchor.line+hm,hn.anchor.ch),ab(hn.head.line+hm,hn.head.ch))}),hk.sel.primIndex);if(hk.cm){ao(hk.cm,hk.first,hk.first-hm,hm);for(var hl=hk.cm.display,i=hl.viewFrom;ihn.lastLine()){return}if(ho.from.linehl){ho={from:ho.from,to:ab(hl,f0(hn,hl).text.length),text:[ho.text[0]],origin:ho.origin}}ho.removed=g2(hn,ho.from,ho.to);if(!hm){hm=f4(hn,ho)}if(hn.cm){aS(hn.cm,ho,hk)}else{gj(hn,ho,hk)}e1(hn,hm,ag);if(hn.cantEdit&&cg(hn,ab(hn.firstLine(),0))){hn.cantEdit=false}}function aS(hu,hq,ho){var ht=hu.doc,hp=hu.display,hr=hq.from,hs=hq.to;var i=false,hn=hr.line;if(!hu.options.lineWrapping){hn=b7(A(f0(ht,hr.line)));ht.iter(hn,hs.line+1,function(hw){if(hw==hp.maxLine){i=true;return true}})}if(ht.sel.contains(hq.from,hq.to)>-1){aa(hu)}gj(ht,hq,ho,bq(hu));if(!hu.options.lineWrapping){ht.iter(hn,hr.line+hq.text.length,function(hx){var hw=eY(hx);if(hw>hp.maxLineLength){hp.maxLine=hx;hp.maxLineLength=hw;hp.maxLineChanged=true;i=false}});if(i){hu.curOp.updateMaxLine=true}}hd(ht,hr.line);eO(hu,400);var hv=hq.text.length-(hs.line-hr.line)-1;if(hq.full){ao(hu)}else{if(hr.line==hs.line&&hq.text.length==1&&!eo(hu.doc,hq)){W(hu,hr.line,"text")}else{ao(hu,hr.line,hs.line+1,hv)}}var hl=f5(hu,"changes"),hm=f5(hu,"change");if(hm||hl){var hk={from:hr,to:hs,text:hq.text,removed:hq.removed,origin:hq.origin};if(hm){al(hu,"change",hu,hk)}if(hl){(hu.curOp.changeObjs||(hu.curOp.changeObjs=[])).push(hk)}}hu.display.selForContextMenu=null}function bc(hm,hl,ho,hn,hk){var i;if(!hn){hn=ho}if(cD(hn,ho)<0){(i=[hn,ho],ho=i[0],hn=i[1])}if(typeof hl=="string"){hl=hm.splitLines(hl)}bs(hm,{from:ho,to:hn,text:hl,origin:hk})}function N(hm,hl,hk,i){if(hk1||!(this.children[0] instanceof fK))){var hs=[];this.collapse(hs);this.children=[new fK(hs)];this.children[0].parent=this}},collapse:function(hk){var hm=this;for(var hl=0;hl50){var hm=hk.lines.length%25+25;for(var hr=hm;hr10);hm.parent.maybeSpill()},iterN:function(hk,hr,hq){var hp=this;for(var hl=0;hlht.display.maxLineLength){ht.display.maxLine=hk;ht.display.maxLineLength=hq;ht.display.maxLineChanged=true}}}if(hn!=null&&ht&&this.collapsed){ao(ht,hn,hr+1)}this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(ht){fb(ht.doc)}}if(ht){al(ht,"markerCleared",ht,this,hn,hr)}if(hm){av(ht)}if(this.parent){this.parent.clear()}};V.prototype.find=function(hn,hl){var hr=this;if(hn==null&&this.type=="bookmark"){hn=1}var hq,hp;for(var hm=0;hm0||ht==0&&hn.clearWhenEmpty!==false){return hn}if(hn.replacedWith){hn.collapsed=true;hn.widgetNode=g6("span",[hn.replacedWith],"CodeMirror-widget");if(!hu.handleMouseEvents){hn.widgetNode.setAttribute("cm-ignore-events","true")}if(hu.insertLeft){hn.widgetNode.insertLeft=true}}if(hn.collapsed){if(B(hs,hq.line,hq,hr,hn)||hq.line!=hr.line&&B(hs,hr.line,hq,hr,hn)){throw new Error("Inserting collapsed marker partially overlapping an existing one")}bP()}if(hn.addToHistory){gB(hs,{from:hq,to:hr,origin:"markText"},hs.sel,NaN)}var hl=hq.line,hp=hs.cm,hk;hs.iter(hl,hr.line+1,function(i){if(hp&&hn.collapsed&&!hp.options.lineWrapping&&A(i)==hp.display.maxLine){hk=true}if(hn.collapsed&&hl!=hq.line){g5(i,0)}cB(i,new eT(hn,hl==hq.line?hq.ch:null,hl==hr.line?hr.ch:null));++hl});if(hn.collapsed){hs.iter(hq.line,hr.line+1,function(i){if(gg(hs,i)){g5(i,0)}})}if(hn.clearOnEnter){ci(hn,"beforeCursorEnter",function(){return hn.clear()})}if(hn.readOnly){gl();if(hs.history.done.length||hs.history.undone.length){hs.clearHistory()}}if(hn.collapsed){hn.id=++bg;hn.atomic=true}if(hp){if(hk){hp.curOp.updateMaxLine=true}if(hn.collapsed){ao(hp,hq.line,hr.line+1)}else{if(hn.className||hn.startStyle||hn.endStyle||hn.css||hn.attributes||hn.title){for(var hm=hq.line;hm<=hr.line;hm++){W(hp,hm,"text")}}}if(hn.atomic){fb(hp.doc)}al(hp,"markerAdded",hp,hn)}return hn}var z=function(hm,hl){var hn=this;this.markers=hm;this.primary=hl;for(var hk=0;hk=0;hm--){bs(hp,hr[hm])}if(hk){fT(this,hk)}else{if(this.cm){gs(this.cm)}}}),undo:c5(function(){cu(this,"undo")}),redo:c5(function(){cu(this,"redo")}),undoSelection:c5(function(){cu(this,"undo",true)}),redoSelection:c5(function(){cu(this,"redo",true)}),setExtending:function(i){this.extend=i},getExtending:function(){return this.extend},historySize:function(){var hn=this.history,hk=0,hm=0;for(var hl=0;hl=ho.ch)){hn.push(hm.marker.parent||hm.marker)}}}return hn},findMarks:function(hn,hm,hk){hn=gy(this,hn);hm=gy(this,hm);var hl=[],i=hn.line;this.iter(hn.line,hm.line+1,function(ho){var hq=ho.markedSpans;if(hq){for(var hp=0;hp=hr.to||hr.from==null&&i!=hn.line||hr.from!=null&&i==hm.line&&hr.from>=hm.ch)&&(!hk||hk(hr.marker))){hl.push(hr.marker.parent||hr.marker)}}}++i});return hl},getAllMarks:function(){var i=[];this.iter(function(hl){var hk=hl.markedSpans;if(hk){for(var hm=0;hmhm){hk=hm;return true}hm-=ho;++i});return gy(this,ab(i,hk))},indexFromPos:function(hl){hl=gy(this,hl);var i=hl.ch;if(hl.linehm){hm=i.from}if(i.to!=null&&i.to-1){hu.state.draggingText(hs);setTimeout(function(){return hu.display.input.focus()},20);return}try{var hk=hs.dataTransfer.getData("Text");if(hk){var hq;if(hu.state.draggingText&&!hu.state.draggingText.copy){hq=hu.listSelections()}e1(hu.doc,fA(ht,ht));if(hq){for(var ho=0;ho=0;hr--){bc(hk.doc,"",ho[hr].from,ho[hr].to,"+delete")}gs(hk)})}function bG(i,hl,hk){var hm=eU(i.text,hl+hk,hk);return hm<0||hm>i.text.length?null:hm}function ap(i,hm,hk){var hl=bG(i,hm.ch,hk);return hl==null?null:new ab(hm.line,hl,hk<0?"after":"before")}function fd(hk,hs,hp,ho,hm){if(hk){if(hs.doc.direction=="rtl"){hm=-hm}var hn=a(hp,hs.doc.direction);if(hn){var hl=hm<0?gt(hn):hn[0];var hu=(hm<0)==(hl.level==1);var hr=hu?"after":"before";var i;if(hl.level>0||hs.doc.direction=="rtl"){var hq=bh(hs,hp);i=hm<0?hp.text.length-1:0;var ht=G(hs,hq,i).top;i=cN(function(hv){return G(hs,hq,hv).top==ht},(hm<0)==(hl.level==1)?hl.from:hl.to-1,i);if(hr=="before"){i=bG(hp,i,1)}}else{i=hm<0?hl.to:hl.from}return new ab(ho,i,hr)}}return new ab(ho,hm<0?hp.text.length:0,hm<0?"before":"after")}function w(hu,hz,hn,hq){var hw=a(hz,hu.doc.direction);if(!hw){return ap(hz,hn,hq)}if(hn.ch>=hz.text.length){hn.ch=hz.text.length;hn.sticky="before"}else{if(hn.ch<=0){hn.ch=0;hn.sticky="after"}}var hm=aR(hw,hn.ch,hn.sticky),ho=hw[hm];if(hu.doc.direction=="ltr"&&ho.level%2==0&&(hq>0?ho.to>hn.ch:ho.from=ho.from&&hk>=hp.begin:hk<=ho.to&&hk<=hp.end)){var ht=hy?"before":"after";return new ab(hn.line,hk,ht)}}var hl=function(hA,hD,hG){var hC=function(hI,hH){return hH?new ab(hn.line,hx(hI,1),"before"):new ab(hn.line,hI,"after")};for(;hA>=0&&hA0)==(hB.level!=1);var hF=hE?hG.begin:hx(hG.end,-1);if(hB.from<=hF&&hF0?hp.end:hx(hp.begin,-1);if(i!=null&&!(hq>0&&i==hz.text.length)){hs=hl(hq>0?0:hw.length-1,hq,hv(i));if(hs){return hs}}return null}var fi={selectAll:au,singleSelection:function(i){return i.setSelection(i.getCursor("anchor"),i.getCursor("head"),ag)},killLine:function(i){return fI(i,function(hl){if(hl.empty()){var hk=f0(i.doc,hl.head.line).text.length;if(hl.head.ch==hk&&hl.head.line0){hp=new ab(hp.line,hp.ch+1);i.replaceRange(hk.charAt(hp.ch-1)+hk.charAt(hp.ch-2),ab(hp.line,hp.ch-2),hp,"+transpose")}else{if(hp.line>i.doc.first){var ho=f0(i.doc,hp.line-1).text;if(ho){hp=new ab(hp.line,1);i.replaceRange(hk.charAt(0)+i.doc.lineSeparator()+ho.charAt(ho.length-1),ab(hp.line-1,ho.length-1),hp,"+transpose")}}}}hl.push(new eu(hp,hp))}i.setSelections(hl)})},newlineAndIndent:function(i){return df(i,function(){var hk=i.listSelections();for(var hl=hk.length-1;hl>=0;hl--){i.replaceRange(i.doc.lineSeparator(),hk[hl].anchor,hk[hl].head,"+input")}hk=i.listSelections();for(var hm=0;hmhk&&cD(hl,this.pos)==0&&i==this.button};var dU,dK;function J(hl,hk){var i=+new Date;if(dK&&dK.compare(i,hl,hk)){dU=dK=null;return"triple"}else{if(dU&&dU.compare(i,hl,hk)){dK=new dT(i,hl,hk);dU=null;return"double"}else{dU=new dT(i,hl,hk);dK=null;return"single"}}}function e7(hn){var i=this,hm=i.display;if(a2(i,hn)||hm.activeTouch&&hm.input.supportsTouch()){return}hm.input.ensurePolled();hm.shift=hn.shiftKey;if(bn(hm,hn)){if(!dt){hm.scroller.draggable=false;setTimeout(function(){return hm.scroller.draggable=true},100)}return}if(o(i,hn)){return}var ho=cO(i,hn),hk=gE(hn),hl=ho?J(ho,hk):"single";window.focus();if(hk==1&&i.state.selectingText){i.state.selectingText(hn)}if(ho&&dd(i,hk,ho,hl,hn)){return}if(hk==1){if(ho){aF(i,ho,hl,hn)}else{if(Q(hn)==hm.scroller){c7(hn)}}}else{if(hk==2){if(ho){gS(i.doc,ho)}setTimeout(function(){return hm.input.focus()},20)}else{if(hk==3){if(g9){i.display.input.onContextMenu(hn)}else{ar(i)}}}}}function dd(i,hl,ho,hn,hm){var hk="Click";if(hn=="double"){hk="Double"+hk}else{if(hn=="triple"){hk="Triple"+hk}}hk=(hl==1?"Left":hl==2?"Middle":"Right")+hk;return bp(i,gU(hk,hm),hm,function(hq){if(typeof hq=="string"){hq=fi[hq]}if(!hq){return false}var hp=false;try{if(i.isReadOnly()){i.state.suppressEdits=true}hp=hq(i,ho)!=cy}finally{i.state.suppressEdits=false}return hp})}function b2(i,ho,hm){var hk=i.getOption("configureMouse");var hn=hk?hk(i,ho,hm):{};if(hn.unit==null){var hl=gx?hm.shiftKey&&hm.metaKey:hm.altKey;hn.unit=hl?"rectangle":ho=="single"?"char":ho=="double"?"word":"line"}if(hn.extend==null||i.doc.extend){hn.extend=i.doc.extend||hm.shiftKey}if(hn.addNew==null){hn.addNew=ct?hm.metaKey:hm.ctrlKey}if(hn.moveOnDrag==null){hn.moveOnDrag=!(ct?hm.altKey:hm.ctrlKey)}return hn}function aF(i,hp,ho,hm){if(ef){setTimeout(cW(u,i),0)}else{i.curOp.focus=ej()}var hl=b2(i,ho,hm);var hn=i.doc.sel,hk;if(i.options.dragDrop&&ft&&!i.isReadOnly()&&ho=="single"&&(hk=hn.contains(hp))>-1&&(cD((hk=hn.ranges[hk]).from(),hp)<0||hp.xRel>0)&&(cD(hk.to(),hp)>0||hp.xRel<0)){bf(i,hm,hp,hl)}else{p(i,hm,hp,hl)}}function bf(hq,i,hn,hk){var hm=hq.display,ho=false;var hl=du(hq,function(hs){if(dt){hm.scroller.draggable=false}hq.state.draggingText=false;eP(hm.wrapper.ownerDocument,"mouseup",hl);eP(hm.wrapper.ownerDocument,"mousemove",hr);eP(hm.scroller,"dragstart",hp);eP(hm.scroller,"drop",hl);if(!ho){c7(hs);if(!hk.addNew){gS(hq.doc,hn,null,null,hk.extend)}if(dt||ef&&n==9){setTimeout(function(){hm.wrapper.ownerDocument.body.focus();hm.input.focus()},20)}else{hm.input.focus()}}});var hr=function(hs){ho=ho||Math.abs(i.clientX-hs.clientX)+Math.abs(i.clientY-hs.clientY)>=10};var hp=function(){return ho=true};if(dt){hm.scroller.draggable=true}hq.state.draggingText=hl;hl.copy=!hk.moveOnDrag;if(hm.scroller.dragDrop){hm.scroller.dragDrop()}ci(hm.wrapper.ownerDocument,"mouseup",hl);ci(hm.wrapper.ownerDocument,"mousemove",hr);ci(hm.scroller,"dragstart",hp);ci(hm.scroller,"drop",hl);ar(hq);setTimeout(function(){return hm.input.focus()},20)}function ep(hk,hm,hl){if(hl=="char"){return new eu(hm,hm)}if(hl=="word"){return hk.findWordAt(hm)}if(hl=="line"){return new eu(ab(hm.line,0),gy(hk.doc,ab(hm.line+1,0)))}var i=hl(hk,hm);return new eu(i.from,i.to)}function p(hn,hy,hl,hr){var hx=hn.display,hB=hn.doc;c7(hy);var hk,hA,ho=hB.sel,i=ho.ranges;if(hr.addNew&&!hr.extend){hA=hB.sel.contains(hl);if(hA>-1){hk=i[hA]}else{hk=new eu(hl,hl)}}else{hk=hB.sel.primary();hA=hB.sel.primIndex}if(hr.unit=="rectangle"){if(!hr.addNew){hk=new eu(hl,hl)}hl=cO(hn,hy,true,true);hA=-1}else{var hm=ep(hn,hl,hr.unit);if(hr.extend){hk=gf(hk,hm.anchor,hm.head,hr.extend)}else{hk=hm}}if(!hr.addNew){hA=0;cf(hB,new gZ([hk],0),R);ho=hB.sel}else{if(hA==-1){hA=i.length;cf(hB,cX(hn,i.concat([hk]),hA),{scroll:false,origin:"*mouse"})}else{if(i.length>1&&i[hA].empty()&&hr.unit=="char"&&!hr.extend){cf(hB,cX(hn,i.slice(0,hA).concat(i.slice(hA+1)),0),{scroll:false,origin:"*mouse"});ho=hB.sel}else{e(hB,hA,hk,R)}}}var hw=hl;function hv(hM){if(cD(hw,hM)==0){return}hw=hM;if(hr.unit=="rectangle"){var hE=[],hJ=hn.options.tabSize;var hD=cc(f0(hB,hl.line).text,hl.ch,hJ);var hQ=cc(f0(hB,hM.line).text,hM.ch,hJ);var hF=Math.min(hD,hQ),hO=Math.max(hD,hQ);for(var hR=Math.min(hl.line,hM.line),hH=Math.min(hn.lastLine(),Math.max(hl.line,hM.line));hR<=hH;hR++){var hP=f0(hB,hR).text,hG=e2(hP,hF,hJ);if(hF==hO){hE.push(new eu(ab(hR,hG),ab(hR,hG)))}else{if(hP.length>hG){hE.push(new eu(ab(hR,hG),ab(hR,e2(hP,hO,hJ))))}}}if(!hE.length){hE.push(new eu(hl,hl))}cf(hB,cX(hn,ho.ranges.slice(0,hA).concat(hE),hA),{origin:"*mouse",scroll:false});hn.scrollIntoView(hM)}else{var hK=hk;var hN=ep(hn,hM,hr.unit);var hI=hK.anchor,hL;if(cD(hN.anchor,hI)>0){hL=hN.head;hI=aA(hK.from(),hN.anchor)}else{hL=hN.anchor;hI=bQ(hK.to(),hN.head)}var hC=ho.ranges.slice(0);hC[hA]=at(hn,new eu(gy(hB,hI),hL));cf(hB,cX(hn,hC,hA),R)}}var ht=hx.wrapper.getBoundingClientRect();var hp=0;function hz(hE){var hC=++hp;var hG=cO(hn,hE,true,hr.unit=="rectangle");if(!hG){return}if(cD(hG,hw)!=0){hn.curOp.focus=ej();hv(hG);var hF=cs(hx,hB);if(hG.line>=hF.to||hG.lineht.bottom?20:0;if(hD){setTimeout(du(hn,function(){if(hp!=hC){return}hx.scroller.scrollTop+=hD;hz(hE)}),50)}}}function hs(hC){hn.state.selectingText=false;hp=Infinity;if(hC){c7(hC);hx.input.focus()}eP(hx.wrapper.ownerDocument,"mousemove",hu);eP(hx.wrapper.ownerDocument,"mouseup",hq);hB.history.lastSelOrigin=null}var hu=du(hn,function(hC){if(hC.buttons===0||!gE(hC)){hs(hC)}else{hz(hC)}});var hq=du(hn,hs);hn.state.selectingText=hq;ci(hx.wrapper.ownerDocument,"mousemove",hu);ci(hx.wrapper.ownerDocument,"mouseup",hq)}function at(hx,hy){var hq=hy.anchor;var hu=hy.head;var ht=f0(hx.doc,hq.line);if(cD(hq,hu)==0&&hq.sticky==hu.sticky){return hy}var hn=a(ht);if(!hn){return hy}var hs=aR(hn,hq.ch,hq.sticky),hl=hn[hs];if(hl.from!=hq.ch&&hl.to!=hq.ch){return hy}var hk=hs+((hl.from==hq.ch)==(hl.level!=1)?0:1);if(hk==0||hk==hn.length){return hy}var hr;if(hu.line!=hq.line){hr=(hu.line-hq.line)*(hx.doc.direction=="ltr"?1:-1)>0}else{var hp=aR(hn,hu.ch,hu.sticky);var hm=hp-hs||(hu.ch-hq.ch)*(hl.level==1?-1:1);if(hp==hk-1||hp==hk){hr=hm<0}else{hr=hm>0}}var ho=hn[hk+(hr?-1:0)];var hw=hr==(ho.level==1);var i=hw?ho.from:ho.to,hv=hw?"after":"before";return hq.ch==i&&hq.sticky==hv?hy:new eu(new ab(hq.line,i,hv),hu)}function hi(hu,hq,hs,ht){var hl,hk;if(hq.touches){hl=hq.touches[0].clientX;hk=hq.touches[0].clientY}else{try{hl=hq.clientX;hk=hq.clientY}catch(hq){return false}}if(hl>=Math.floor(hu.display.gutters.getBoundingClientRect().right)){return false}if(ht){c7(hq)}var hr=hu.display;var hp=hr.lineDiv.getBoundingClientRect();if(hk>hp.bottom||!f5(hu,hs)){return b5(hq)}hk-=hp.top-hr.viewOffset;for(var hn=0;hn=hl){var hv=b0(hu.doc,hk);var hm=hu.display.gutterSpecs[hn];aN(hu,hs,hu,hv,hm.className,hq);return b5(hq)}}}function o(i,hk){return hi(i,hk,"gutterClick",true)}function aG(i,hk){if(bn(i.display,hk)||dN(i,hk)){return}if(a2(i,hk,"contextmenu")){return}if(!g9){i.display.input.onContextMenu(hk)}}function dN(i,hk){if(!f5(i,"gutterContextMenu")){return false}return hi(i,hk,"gutterContextMenu",false)}function dg(i){i.display.wrapper.className=i.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+i.options.theme.replace(/(^|\s)\s*/g," cm-s-");aq(i)}var cz={toString:function(){return"CodeMirror.Init"}};var fN={};var br={};function fn(i){var hl=i.optionHandlers;function hk(hm,hp,ho,hn){i.defaults[hm]=hp;if(ho){hl[hm]=hn?function(hq,hs,hr){if(hr!=cz){ho(hq,hs,hr)}}:ho}}i.defineOption=hk;i.Init=cz;hk("value","",function(hm,hn){return hm.setValue(hn)},true);hk("mode",null,function(hm,hn){hm.doc.modeOption=hn;bJ(hm)},true);hk("indentUnit",2,bJ,true);hk("indentWithTabs",false);hk("smartIndent",true);hk("tabSize",4,function(hm){eX(hm);aq(hm);ao(hm)},true);hk("lineSeparator",null,function(hm,hp){hm.doc.lineSep=hp;if(!hp){return}var ho=[],hq=hm.doc.first;hm.doc.iter(function(hr){for(var ht=0;;){var hs=hr.text.indexOf(hp,ht);if(hs==-1){break}ht=hs+hp.length;ho.push(ab(hq,hs))}hq++});for(var hn=ho.length-1;hn>=0;hn--){bc(hm.doc,hp,ho[hn],ab(ho[hn].line,ho[hn].ch+hp.length))}});hk("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(hm,ho,hn){hm.state.specialChars=new RegExp(ho.source+(ho.test("\t")?"":"|\t"),"g");if(hn!=cz){hm.refresh()}});hk("specialCharPlaceholder",fZ,function(hm){return hm.refresh()},true);hk("electricChars",true);hk("inputStyle",eQ?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},true);hk("spellcheck",false,function(hm,hn){return hm.getInputField().spellcheck=hn},true);hk("autocorrect",false,function(hm,hn){return hm.getInputField().autocorrect=hn},true);hk("autocapitalize",false,function(hm,hn){return hm.getInputField().autocapitalize=hn},true);hk("rtlMoveVisually",!a0);hk("wholeLineUpdateBefore",true);hk("theme","default",function(hm){dg(hm);eM(hm)},true);hk("keyMap","default",function(hm,hq,hn){var ho=gR(hq);var hp=hn!=cz&&gR(hn);if(hp&&hp.detach){hp.detach(hm,ho)}if(ho.attach){ho.attach(hm,hp||null)}});hk("extraKeys",null);hk("configureMouse",null);hk("lineWrapping",false,fm,true);hk("gutters",[],function(hm,hn){hm.display.gutterSpecs=bd(hn,hm.options.lineNumbers);eM(hm)},true);hk("fixedGutter",true,function(hm,hn){hm.display.gutters.style.left=hn?ev(hm.display)+"px":"0";hm.refresh()},true);hk("coverGutterNextToScrollbar",false,function(hm){return fJ(hm)},true);hk("scrollbarStyle","native",function(hm){aL(hm);fJ(hm);hm.display.scrollbars.setScrollTop(hm.doc.scrollTop);hm.display.scrollbars.setScrollLeft(hm.doc.scrollLeft)},true);hk("lineNumbers",false,function(hm,hn){hm.display.gutterSpecs=bd(hm.options.gutters,hn);eM(hm)},true);hk("firstLineNumber",1,eM,true);hk("lineNumberFormatter",function(hm){return hm},eM,true);hk("showCursorWhenSelecting",false,bV,true);hk("resetSelectionOnContextMenu",true);hk("lineWiseCopyCut",true);hk("pasteLinesPerSelection",true);hk("selectionsMayTouch",false);hk("readOnly",false,function(hm,hn){if(hn=="nocursor"){a6(hm);hm.display.input.blur()}hm.display.input.readOnlyChanged(hn)});hk("screenReaderLabel",null,function(hm,hn){hn=(hn==="")?null:hn;hm.display.input.screenReaderLabelChanged(hn)});hk("disableInput",false,function(hm,hn){if(!hn){hm.display.input.reset()}},true);hk("dragDrop",true,gX);hk("allowDropFileTypes",null);hk("cursorBlinkRate",530);hk("cursorScrollMargin",0);hk("cursorHeight",1,bV,true);hk("singleCursorHeightPerLine",true,bV,true);hk("workTime",100);hk("workDelay",100);hk("flattenSpans",true,eX,true);hk("addModeClass",false,eX,true);hk("pollInterval",100);hk("undoDepth",200,function(hm,hn){return hm.doc.history.undoDepth=hn});hk("historyEventDelay",1250);hk("viewportMargin",10,function(hm){return hm.refresh()},true);hk("maxHighlightLength",10000,eX,true);hk("moveInputWithCursor",true,function(hm,hn){if(!hn){hm.display.input.resetPosition()}});hk("tabindex",null,function(hm,hn){return hm.display.input.getField().tabIndex=hn||""});hk("autofocus",null);hk("direction","ltr",function(hm,hn){return hm.doc.setDirection(hn)},true);hk("phrases",null)}function gX(hk,hn,hl){var ho=hl&&hl!=cz;if(!hn!=!ho){var hm=hk.display.dragFunctions;var i=hn?ci:eP;i(hk.display.scroller,"dragstart",hm.start);i(hk.display.scroller,"dragenter",hm.enter);i(hk.display.scroller,"dragover",hm.over);i(hk.display.scroller,"dragleave",hm.leave);i(hk.display.scroller,"drop",hm.drop)}}function fm(i){if(i.options.lineWrapping){gn(i.display.wrapper,"CodeMirror-wrap");i.display.sizer.style.minWidth="";i.display.sizerWidth=null}else{h(i.display.wrapper,"CodeMirror-wrap");f(i)}ae(i);ao(i);aq(i);setTimeout(function(){return fJ(i)},100)}function L(hk,hm){var hr=this;if(!(this instanceof L)){return new L(hk,hm)}this.options=hm=hm?aY(hm):{};aY(fN,hm,false);var hq=hm.value;if(typeof hq=="string"){hq=new aC(hq,hm.mode,null,hm.lineSeparator,hm.direction)}else{if(hm.mode){hq.modeOption=hm.mode}}this.doc=hq;var hl=new L.inputStyles[hm.inputStyle](this);var hp=this.display=new fo(hk,hq,hl,hm);hp.wrapper.CodeMirror=this;dg(this);if(hm.lineWrapping){this.display.wrapper.className+=" CodeMirror-wrap"}aL(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,delayingBlurEvent:false,focused:false,suppressEdits:false,pasteIncoming:-1,cutIncoming:-1,selectingText:false,draggingText:false,highlight:new hj(),keySeq:null,specialChars:null};if(hm.autofocus&&!eQ){hp.input.focus()}if(ef&&n<11){setTimeout(function(){return hr.display.input.reset(true)},20)}gH(this);bv();db(this);this.curOp.forceUpdate=true;eL(this,hq);if((hm.autofocus&&!eQ)||this.hasFocus()){setTimeout(cW(c2,this),20)}else{a6(this)}for(var ho in br){if(br.hasOwnProperty(ho)){br[ho](hr,hm[ho],cz)}}eD(this);if(hm.finishInit){hm.finishInit(this)}for(var hn=0;hn20*20}ci(ho.scroller,"touchstart",function(hs){if(!a2(hk,hs)&&!hm(hs)&&!o(hk,hs)){ho.input.ensurePolled();clearTimeout(hq);var hr=+new Date;ho.activeTouch={start:hr,moved:false,prev:hr-i.end<=300?i:null};if(hs.touches.length==1){ho.activeTouch.left=hs.touches[0].pageX;ho.activeTouch.top=hs.touches[0].pageY}}});ci(ho.scroller,"touchmove",function(){if(ho.activeTouch){ho.activeTouch.moved=true}});ci(ho.scroller,"touchend",function(hs){var hu=ho.activeTouch;if(hu&&!bn(ho,hs)&&hu.left!=null&&!hu.moved&&new Date-hu.start<300){var ht=hk.coordsChar(ho.activeTouch,"page"),hr;if(!hu.prev||hl(hu,hu.prev)){hr=new eu(ht,ht)}else{if(!hu.prev.prev||hl(hu,hu.prev.prev)){hr=hk.findWordAt(ht)}else{hr=new eu(ab(ht.line,0),gy(hk.doc,ab(ht.line+1,0)))}}hk.setSelection(hr.anchor,hr.head);hk.focus();c7(hs)}hp()});ci(ho.scroller,"touchcancel",hp);ci(ho.scroller,"scroll",function(){if(ho.scroller.clientHeight){C(hk,ho.scroller.scrollTop);bX(hk,ho.scroller.scrollLeft,true);aN(hk,"scroll",hk)}});ci(ho.scroller,"mousewheel",function(hr){return c(hk,hr)});ci(ho.scroller,"DOMMouseScroll",function(hr){return c(hk,hr)});ci(ho.wrapper,"scroll",function(){return ho.wrapper.scrollTop=ho.wrapper.scrollLeft=0});ho.dragFunctions={enter:function(hr){if(!a2(hk,hr)){e3(hr)}},over:function(hr){if(!a2(hk,hr)){hh(hk,hr);e3(hr)}},start:function(hr){return U(hk,hr)},drop:du(hk,bw),leave:function(hr){if(!a2(hk,hr)){dH(hk)}}};var hn=ho.input.getField();ci(hn,"keyup",function(hr){return bt.call(hk,hr)});ci(hn,"keydown",du(hk,s));ci(hn,"keypress",du(hk,cY));ci(hn,"focus",function(hr){return c2(hk,hr)});ci(hn,"blur",function(hr){return a6(hk,hr)})}var bk=[];L.defineInitHook=function(i){return bk.push(i)};function aj(hz,ho,hy,hm){var hx=hz.doc,hl;if(hy==null){hy="add"}if(hy=="smart"){if(!hx.mode.indent){hy="prev"}else{hl=fH(hz,ho).state}}var hs=hz.options.tabSize;var hA=f0(hx,ho),hr=cc(hA.text,null,hs);if(hA.stateAfter){hA.stateAfter=null}var hk=hA.text.match(/^\s*/)[0],hv;if(!hm&&!/\S/.test(hA.text)){hv=0;hy="not"}else{if(hy=="smart"){hv=hx.mode.indent(hl,hA.text.slice(hk.length),hA.text);if(hv==cy||hv>150){if(!hm){return}hy="prev"}}}if(hy=="prev"){if(ho>hx.first){hv=cc(f0(hx,ho-1).text,null,hs)}else{hv=0}}else{if(hy=="add"){hv=hr+hz.options.indentUnit}else{if(hy=="subtract"){hv=hr-hz.options.indentUnit}else{if(typeof hy=="number"){hv=hr+hy}}}}hv=Math.max(0,hv);var hw="",hu=0;if(hz.options.indentWithTabs){for(var hp=Math.floor(hv/hs);hp;--hp){hu+=hs;hw+="\t"}}if(huhA;var hr=gJ(hp),hk=null;if(ho&&hm.ranges.length>1){if(by&&by.text.join("\n")==hp){if(hm.ranges.length%by.text.length==0){hk=[];for(var hq=0;hq=0;hl--){var hz=hm.ranges[hl];var hv=hz.from(),hu=hz.to();if(hz.empty()){if(hn&&hn>0){hv=ab(hv.line,hv.ch-hn)}else{if(hy.state.overwrite&&!ho){hu=ab(hu.line,Math.min(f0(hw,hu.line).text.length,hu.ch+gt(hr).length))}else{if(ho&&by&&by.lineWise&&by.text.join("\n")==hp){hv=hu=ab(hv.line,0)}}}}var ht={from:hv,to:hu,text:hk?hk[hl%hk.length]:hr,origin:hx||(ho?"paste":hy.state.cutIncoming>hA?"cut":"+input")};bs(hy.doc,ht);al(hy,"inputRead",hy,ht)}if(hp&&!ho){gP(hy,hp)}gs(hy);if(hy.curOp.updateInput<2){hy.curOp.updateInput=hs}hy.curOp.typing=true;hy.state.pasteIncoming=hy.state.cutIncoming=-1}function bm(hl,i){var hk=hl.clipboardData&&hl.clipboardData.getData("Text");if(hk){hl.preventDefault();if(!i.isReadOnly()&&!i.options.disableInput){df(i,function(){return gT(i,hk,0,null,"paste")})}return true}}function gP(hk,hn){if(!hk.options.electricChars||!hk.options.smartIndent){return}var ho=hk.doc.sel;for(var hm=ho.ranges.length-1;hm>=0;hm--){var hq=ho.ranges[hm];if(hq.head.ch>100||(hm&&ho.ranges[hm-1].head.line==hq.head.line)){continue}var hp=hk.getModeAt(hq.head);var hr=false;if(hp.electricChars){for(var hl=0;hl-1){hr=aj(hk,hq.head.line,"smart");break}}}else{if(hp.electricInput){if(hp.electricInput.test(f0(hk.doc,hq.head.line).text.slice(0,hq.head.ch))){hr=aj(hk,hq.head.line,"smart")}}}if(hr){al(hk,"electricInput",hk,hq.head.line)}}}function dO(hk){var hp=[],hm=[];for(var hn=0;hn0){e(hs.doc,hr,new eu(ht,ho[hr].to()),ag)}}else{if(hw.head.line>hp){aj(hs,hw.head.line,hv,true);hp=hw.head.line;if(hr==hs.doc.sel.primIndex){gs(hs)}}}}}),getTokenAt:function(hn,hm){return cR(this,hn,hm)},getLineTokens:function(hn,hm){return cR(this,ab(hn),hm,true)},getTokenTypeAt:function(ht){ht=gy(this.doc,ht);var hp=dC(this,f0(this.doc,ht.line));var hr=0,hs=(hp.length-1)/2,ho=ht.ch;var hn;if(ho==0){hn=hp[2]}else{for(;;){var hm=(hr+hs)>>1;if((hm?hp[hm*2-1]:0)>=ho){hs=hm}else{if(hp[hm*2+1]hp){hn=hp;hm=true}}ho=f0(this.doc,hn)}else{ho=hn}return fz(this,ho,{top:0,left:0},hr||"page",hq||hm).top+(hm?this.doc.height-b6(ho):0)},defaultTextHeight:function(){return a9(this.display)},defaultCharWidth:function(){return d7(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(hr,ho,ht,hp,hv){var hq=this.display;hr=er(this,gy(this.doc,hr));var hs=hr.bottom,hn=hr.left;ho.style.position="absolute";ho.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(ho);hq.sizer.appendChild(ho);if(hp=="over"){hs=hr.top}else{if(hp=="above"||hp=="near"){var hm=Math.max(hq.wrapper.clientHeight,this.doc.height),hu=Math.max(hq.sizer.clientWidth,hq.lineSpace.clientWidth);if((hp=="above"||hr.bottom+ho.offsetHeight>hm)&&hr.top>ho.offsetHeight){hs=hr.top-ho.offsetHeight}else{if(hr.bottom+ho.offsetHeight<=hm){hs=hr.bottom}}if(hn+ho.offsetWidth>hu){hn=hu-ho.offsetWidth}}}ho.style.top=hs+"px";ho.style.left=ho.style.right="";if(hv=="right"){hn=hq.sizer.clientWidth-ho.offsetWidth;ho.style.right="0px"}else{if(hv=="left"){hn=0}else{if(hv=="middle"){hn=(hq.sizer.clientWidth-ho.offsetWidth)/2}}ho.style.left=hn+"px"}if(ht){I(this,{left:hn,top:hs,right:hn+ho.offsetWidth,bottom:hs+ho.offsetHeight})}},triggerOnKeyDown:dE(s),triggerOnKeyPress:dE(cY),triggerOnKeyUp:bt,triggerOnMouseDown:dE(e7),execCommand:function(hm){if(fi.hasOwnProperty(hm)){return fi[hm].call(null,this)}},triggerElectric:dE(function(hm){gP(this,hm)}),findPosH:function(ht,hp,hq,hn){var hs=this;var hm=1;if(hp<0){hm=-1;hp=-hp}var hr=gy(this.doc,ht);for(var ho=0;ho0&&hm(hp.charAt(hs-1))){--hs}while(ho0.5||this.options.lineWrapping){ae(this)}aN(this,"refresh",this)}),swapDoc:dE(function(hn){var hm=this.doc;hm.cm=null;if(this.state.selectingText){this.state.selectingText()}eL(this,hn);aq(this);this.display.input.reset();fu(this,hn.scrollLeft,hn.scrollTop);this.curOp.forceScroll=true;al(this,"swapDoc",this,hm);return hm}),phrase:function(hn){var hm=this.options.phrases;return hm&&Object.prototype.hasOwnProperty.call(hm,hn)?hm[hn]:hn},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}};bS(i);i.registerHelper=function(hn,hm,ho){if(!hl.hasOwnProperty(hn)){hl[hn]=i[hn]={_global:[]}}hl[hn][hm]=ho};i.registerGlobalHelper=function(ho,hn,hm,hp){i.registerHelper(ho,hn,hp);hl[ho]._global.push({pred:hm,val:hp})}}function bO(hA,ho,hu,ht,hq){var hv=ho;var hz=hu;var hk=f0(hA,ho.line);var hn=hq&&hA.direction=="rtl"?-hu:hu;function hy(){var hB=ho.line+hn;if(hB=hA.first+hA.size){return false}ho=new ab(hB,ho.ch,ho.sticky);return hk=f0(hA,hB)}function hx(hC){var hB;if(hq){hB=w(hA.cm,hk,ho,hu)}else{hB=ap(hk,ho,hu)}if(hB==null){if(!hC&&hy()){ho=fd(hq,hA.cm,hk,ho.line,hn)}else{return false}}else{ho=hB}return true}if(ht=="char"){hx()}else{if(ht=="column"){hx(true)}else{if(ht=="word"||ht=="group"){var hw=null,hr=ht=="group";var i=hA.cm&&hA.cm.getHelper(ho,"wordChars");for(var hp=true;;hp=false){if(hu<0&&!hx(!hp)){break}var hl=hk.text.charAt(ho.ch)||"\n";var hm=c1(hl,i)?"w":hr&&hl=="\n"?"n":!hr||/\s/.test(hl)?null:"p";if(hr&&!hp&&!hm){hm="s"}if(hw&&hw!=hm){if(hu<0){hu=1;hx();ho.sticky="after"}break}if(hm){hw=hm}if(hu>0&&!hx(!hp)){break}}}}}var hs=cg(hA,ho,hv,hz,true);if(ac(hv,hs)){hs.hitSide=true}return hs}function bI(hs,hn,hk,hr){var hq=hs.doc,hp=hn.left,ho;if(hr=="page"){var hm=Math.min(hs.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);var i=Math.max(hm-0.5*a9(hs.display),3);ho=(hk>0?hn.bottom:hn.top)+hk*i}else{if(hr=="line"){ho=hk>0?hn.bottom+3:hn.top-3}}var hl;for(;;){hl=gG(hs,hp,ho);if(!hl.outside){break}if(hk<0?ho<=0:ho>=hq.height){hl.hitSide=true;break}ho+=hk*5}return hl}var d1=function(i){this.cm=i;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new hj();this.composing=null;this.gracePeriod=false;this.readDOMTimeout=null};d1.prototype.init=function(hm){var ho=this;var hl=this,i=hl.cm;var hn=hl.div=hm.lineDiv;gF(hn,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);ci(hn,"paste",function(hp){if(a2(i,hp)||bm(hp,i)){return}if(n<=11){setTimeout(du(i,function(){return ho.updateFromDOM()}),20)}});ci(hn,"compositionstart",function(hp){ho.composing={data:hp.data,done:false}});ci(hn,"compositionupdate",function(hp){if(!ho.composing){ho.composing={data:hp.data,done:false}}});ci(hn,"compositionend",function(hp){if(ho.composing){if(hp.data!=ho.composing.data){ho.readFromDOMSoon()}ho.composing.done=true}});ci(hn,"touchstart",function(){return hl.forceCompositionEnd()});ci(hn,"input",function(){if(!ho.composing){ho.readFromDOMSoon()}});function hk(ht){if(a2(i,ht)){return}if(i.somethingSelected()){dA({lineWise:false,text:i.getSelections()});if(ht.type=="cut"){i.replaceSelection("",null,"cut")}}else{if(!i.options.lineWiseCopyCut){return}else{var hq=dO(i);dA({lineWise:true,text:hq.text});if(ht.type=="cut"){i.operation(function(){i.setSelections(hq.ranges,0,ag);i.replaceSelection("",null,"cut")})}}}if(ht.clipboardData){ht.clipboardData.clearData();var hs=by.text.join("\n");ht.clipboardData.setData("Text",hs);if(ht.clipboardData.getData("Text")==hs){ht.preventDefault();return}}var hr=a8(),hu=hr.firstChild;i.display.lineSpace.insertBefore(hr,i.display.lineSpace.firstChild);hu.value=by.text.join("\n");var hp=document.activeElement;eg(hu);setTimeout(function(){i.display.lineSpace.removeChild(hr);hp.focus();if(hp==hn){hl.showPrimarySelection()}},50)}ci(hn,"copy",hk);ci(hn,"cut",hk)};d1.prototype.screenReaderLabelChanged=function(i){if(i){this.div.setAttribute("aria-label",i)}else{this.div.removeAttribute("aria-label")}};d1.prototype.prepareSelection=function(){var i=gw(this.cm,false);i.focus=document.activeElement==this.div;return i};d1.prototype.showSelection=function(hk,i){if(!hk||!this.cm.display.view.length){return}if(hk.focus||i){this.showPrimarySelection()}this.showMultipleSelections(hk)};d1.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};d1.prototype.showPrimarySelection=function(){var hm=this.getSelection(),hw=this.cm,hp=hw.doc.sel.primary();var hu=hp.from(),hv=hp.to();if(hw.display.viewTo==hw.display.viewFrom||hu.line>=hw.display.viewTo||hv.line=hw.display.viewFrom&&c0(hw,hu))||{node:ht[0].measure.map[2],offset:0};var hq=hv.lineht.firstLine()){hC=ab(hC.line-1,f0(ht.doc,hC.line-1).length)}if(hn.ch==f0(ht.doc,hn.line).text.length&&hn.linehD.viewTo-1){return false}var hq,ho,hs;if(hC.line==hD.viewFrom||(hq=dY(ht,hC.line))==0){ho=b7(hD.view[0].line);hs=hD.view[0].node}else{ho=b7(hD.view[hq].line);hs=hD.view[hq-1].node.nextSibling}var hA=dY(ht,hn.line);var hv,hy;if(hA==hD.view.length-1){hv=hD.viewTo-1;hy=hD.lineDiv.lastChild}else{hv=b7(hD.view[hA+1].line)-1;hy=hD.view[hA+1].node.previousSibling}if(!hs){return false}var hE=ht.doc.splitLines(gW(ht,hs,hy,ho,hv));var hx=g2(ht.doc,ab(ho,0),ab(hv,f0(ht.doc,hv).text.length));while(hE.length>1&&hx.length>1){if(gt(hE)==gt(hx)){hE.pop();hx.pop();hv--}else{if(hE[0]==hx[0]){hE.shift();hx.shift();ho++}else{break}}}var hz=0,hl=0;var hu=hE[0],hk=hx[0],i=Math.min(hu.length,hk.length);while(hzhC.ch&&hr.charCodeAt(hr.length-hl-1)==hF.charCodeAt(hF.length-hl-1)){hz--;hl++}}hE[hE.length-1]=hr.slice(0,hr.length-hl).replace(/^\u200b+/,"");hE[0]=hE[0].slice(hz).replace(/\u200b+$/,"");var hp=ab(ho,hz);var hw=ab(hv,hx.length?gt(hx).length-hl:0);if(hE.length>1||hE[0]||cD(hp,hw)){bc(ht.doc,hE,hp,hw,"+input");return true}};d1.prototype.ensurePolled=function(){this.forceCompositionEnd()};d1.prototype.reset=function(){this.forceCompositionEnd()};d1.prototype.forceCompositionEnd=function(){if(!this.composing){return}clearTimeout(this.readDOMTimeout);this.composing=null;this.updateFromDOM();this.div.blur();this.div.focus()};d1.prototype.readFromDOMSoon=function(){var i=this;if(this.readDOMTimeout!=null){return}this.readDOMTimeout=setTimeout(function(){i.readDOMTimeout=null;if(i.composing){if(i.composing.done){i.composing=null}else{return}}i.updateFromDOM()},80)};d1.prototype.updateFromDOM=function(){var i=this;if(this.cm.isReadOnly()||!this.pollContent()){df(this.cm,function(){return ao(i.cm)})}};d1.prototype.setUneditable=function(i){i.contentEditable="false"};d1.prototype.onKeyPress=function(i){if(i.charCode==0||this.composing){return}i.preventDefault();if(!this.cm.isReadOnly()){du(this.cm,gT)(this.cm,String.fromCharCode(i.charCode==null?i.keyCode:i.charCode),0)}};d1.prototype.readOnlyChanged=function(i){this.div.contentEditable=String(i!="nocursor")};d1.prototype.onContextMenu=function(){};d1.prototype.resetPosition=function(){};d1.prototype.needsContentAttribute=true;function c0(hp,hn){var ho=fX(hp,hn.line);if(!ho||ho.hidden){return null}var hr=f0(hp.doc,hn.line);var hk=cU(ho,hr,hn.line);var hl=a(hr,hp.doc.direction),hm="left";if(hl){var i=aR(hl,hn.ch);hm=i%2?"right":"left"}var hq=aU(hk.map,hn.ch,hm);hq.offset=hq.collapse=="right"?hq.end:hq.start;return hq}function g1(hk){for(var i=hk;i;i=i.parentNode){if(/CodeMirror-gutter-wrapper/.test(i.className)){return true}}return false}function e4(hk,i){if(i){hk.bad=true}return hk}function gW(hs,hq,hr,hm,hk){var hu="",hl=false,i=hs.doc.lineSeparator(),hn=false;function ho(hw){return function(hx){return hx.id==hw}}function hv(){if(hl){hu+=i;if(hn){hu+=i}hl=hn=false}}function ht(hw){if(hw){hv();hu+=hw}}function hp(hA){if(hA.nodeType==1){var hx=hA.getAttribute("cm-text");if(hx){ht(hx);return}var hz=hA.getAttribute("cm-marker"),hC;if(hz){var hB=hs.findMarks(ab(hm,0),ab(hk+1,0),ho(+hz));if(hB.length&&(hC=hB[0].find(0))){ht(g2(hs.doc,hC.from,hC.to).join(i))}return}if(hA.getAttribute("contenteditable")=="false"){return}var hw=/^(pre|div|p|li|table|br)$/i.test(hA.nodeName);if(!/^br$/i.test(hA.nodeName)&&hA.textContent.length==0){return}if(hw){hv()}for(var hy=0;hy=9&&ho.hasSelection){ho.hasSelection=null}hk.poll()});ci(hm,"paste",function(hp){if(a2(i,hp)||bm(hp,i)){return}i.state.pasteIncoming=+new Date;hk.fastPoll()});function hn(hq){if(a2(i,hq)){return}if(i.somethingSelected()){dA({lineWise:false,text:i.getSelections()})}else{if(!i.options.lineWiseCopyCut){return}else{var hp=dO(i);dA({lineWise:true,text:hp.text});if(hq.type=="cut"){i.setSelections(hp.ranges,null,ag)}else{hk.prevInput="";hm.value=hp.text.join("\n");eg(hm)}}}if(hq.type=="cut"){i.state.cutIncoming=+new Date}}ci(hm,"cut",hn);ci(hm,"copy",hn);ci(hl.scroller,"paste",function(hq){if(bn(hl,hq)||a2(i,hq)){return}if(!hm.dispatchEvent){i.state.pasteIncoming=+new Date;hk.focus();return}var hp=new Event("paste");hp.clipboardData=hq.clipboardData;hm.dispatchEvent(hp)});ci(hl.lineSpace,"selectstart",function(hp){if(!bn(hl,hp)){c7(hp)}});ci(hm,"compositionstart",function(){var hp=i.getCursor("from");if(hk.composing){hk.composing.range.clear()}hk.composing={start:hp,range:i.markText(hp,i.getCursor("to"),{className:"CodeMirror-composing"})}});ci(hm,"compositionend",function(){if(hk.composing){hk.poll();hk.composing.range.clear();hk.composing=null}})};ad.prototype.createField=function(i){this.wrapper=a8();this.textarea=this.wrapper.firstChild};ad.prototype.screenReaderLabelChanged=function(i){if(i){this.textarea.setAttribute("aria-label",i)}else{this.textarea.removeAttribute("aria-label")}};ad.prototype.prepareSelection=function(){var hk=this.cm,ho=hk.display,hn=hk.doc;var i=gw(hk);if(hk.options.moveInputWithCursor){var hp=er(hk,hn.sel.primary().head,"div");var hl=ho.wrapper.getBoundingClientRect(),hm=ho.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(ho.wrapper.clientHeight-10,hp.top+hm.top-hl.top));i.teLeft=Math.max(0,Math.min(ho.wrapper.clientWidth-10,hp.left+hm.left-hl.left))}return i};ad.prototype.showSelection=function(hl){var i=this.cm,hk=i.display;cd(hk.cursorDiv,hl.cursors);cd(hk.selectionDiv,hl.selection);if(hl.teTop!=null){this.wrapper.style.top=hl.teTop+"px";this.wrapper.style.left=hl.teLeft+"px"}};ad.prototype.reset=function(hk){if(this.contextMenuPending||this.composing){return}var i=this.cm;if(i.somethingSelected()){this.prevInput="";var hl=i.getSelection();this.textarea.value=hl;if(i.state.focused){eg(this.textarea)}if(ef&&n>=9){this.hasSelection=hl}}else{if(!hk){this.prevInput=this.textarea.value="";if(ef&&n>=9){this.hasSelection=null}}}};ad.prototype.getField=function(){return this.textarea};ad.prototype.supportsTouch=function(){return false};ad.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!eQ||ej()!=this.textarea)){try{this.textarea.focus()}catch(i){}}};ad.prototype.blur=function(){this.textarea.blur()};ad.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};ad.prototype.receivedFocus=function(){this.slowPoll()};ad.prototype.slowPoll=function(){var i=this;if(this.pollingFast){return}this.polling.set(this.cm.options.pollInterval,function(){i.poll();if(i.cm.state.focused){i.slowPoll()}})};ad.prototype.fastPoll=function(){var hk=false,i=this;i.pollingFast=true;function hl(){var hm=i.poll();if(!hm&&!hk){hk=true;i.polling.set(60,hl)}else{i.pollingFast=false;i.slowPoll()}}i.polling.set(20,hl)};ad.prototype.poll=function(){var hq=this;var i=this.cm,hl=this.textarea,hm=this.prevInput;if(this.contextMenuPending||!i.state.focused||(bK(hl)&&!hm&&!this.composing)||i.isReadOnly()||i.options.disableInput||i.state.keySeq){return false}var ho=hl.value;if(ho==hm&&!i.somethingSelected()){return false}if(ef&&n>=9&&this.hasSelection===ho||ct&&/[\uf700-\uf7ff]/.test(ho)){i.display.input.reset();return false}if(i.doc.sel==i.display.selForContextMenu){var hn=ho.charCodeAt(0);if(hn==8203&&!hm){hm="\u200b"}if(hn==8666){this.reset();return this.cm.execCommand("undo")}}var hp=0,hk=Math.min(hm.length,ho.length);while(hp1000||ho.indexOf("\n")>-1){hl.value=hq.prevInput=""}else{hq.prevInput=ho}if(hq.composing){hq.composing.range.clear();hq.composing.range=i.markText(hq.composing.start,i.getCursor("to"),{className:"CodeMirror-composing"})}});return true};ad.prototype.ensurePolled=function(){if(this.pollingFast&&this.poll()){this.pollingFast=false}};ad.prototype.onKeyPress=function(){if(ef&&n>=9){this.hasSelection=null}this.fastPoll()};ad.prototype.onContextMenu=function(ho){var ht=this,hu=ht.cm,hq=hu.display,hk=ht.textarea;if(ht.contextMenuPending){ht.contextMenuPending()}var hs=cO(hu,ho),i=hq.scroller.scrollTop;if(!hs||eB){return}var hn=hu.options.resetSelectionOnContextMenu;if(hn&&hu.doc.sel.contains(hs)==-1){du(hu,cf)(hu.doc,fA(hs),ag)}var hp=hk.style.cssText,hx=ht.wrapper.style.cssText;var hw=ht.wrapper.offsetParent.getBoundingClientRect();ht.wrapper.style.cssText="position: static";hk.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(ho.clientY-hw.top-5)+"px; left: "+(ho.clientX-hw.left-5)+"px;\n z-index: 1000; background: "+(ef?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var hv;if(dt){hv=window.scrollY}hq.input.focus();if(dt){window.scrollTo(null,hv)}hq.input.reset();if(!hu.somethingSelected()){hk.value=ht.prevInput=" "}ht.contextMenuPending=hr;hq.selForContextMenu=hu.doc.sel;clearTimeout(hq.detectingSelectAll);function hm(){if(hk.selectionStart!=null){var hy=hu.somethingSelected();var hz="\u200b"+(hy?hk.value:"");hk.value="\u21da";hk.value=hz;ht.prevInput=hy?"":"\u200b";hk.selectionStart=1;hk.selectionEnd=hz.length;hq.selForContextMenu=hu.doc.sel}}function hr(){if(ht.contextMenuPending!=hr){return}ht.contextMenuPending=false;ht.wrapper.style.cssText=hx;hk.style.cssText=hp;if(ef&&n<9){hq.scrollbars.setScrollTop(hq.scroller.scrollTop=i)}if(hk.selectionStart!=null){if(!ef||(ef&&n<9)){hm()}var hy=0,hz=function(){if(hq.selForContextMenu==hu.doc.sel&&hk.selectionStart==0&&hk.selectionEnd>0&&ht.prevInput=="\u200b"){du(hu,au)(hu)}else{if(hy++<10){hq.detectingSelectAll=setTimeout(hz,500)}else{hq.selForContextMenu=null;hq.input.reset()}}};hq.detectingSelectAll=setTimeout(hz,200)}}if(ef&&n>=9){hm()}if(g9){e3(ho);var hl=function(){eP(window,"mouseup",hl);setTimeout(hr,20)};ci(window,"mouseup",hl)}else{setTimeout(hr,50)}};ad.prototype.readOnlyChanged=function(i){if(!i){this.reset()}this.textarea.disabled=i=="nocursor"};ad.prototype.setUneditable=function(){};ad.prototype.needsContentAttribute=false;function gu(hq,hr){hr=hr?aY(hr):{};hr.value=hq.value;if(!hr.tabindex&&hq.tabIndex){hr.tabindex=hq.tabIndex}if(!hr.placeholder&&hq.placeholder){hr.placeholder=hq.placeholder}if(hr.autofocus==null){var i=ej();hr.autofocus=i==hq||hq.getAttribute("autofocus")!=null&&i==document.body}function hn(){hq.value=hp.getValue()}var ho;if(hq.form){ci(hq.form,"submit",hn);if(!hr.leaveSubmitMethodAlone){var hk=hq.form;ho=hk.submit;try{var hm=hk.submit=function(){hn();hk.submit=ho;hk.submit();hk.submit=hm}}catch(hl){}}}hr.finishInit=function(hs){hs.save=hn;hs.getTextArea=function(){return hq};hs.toTextArea=function(){hs.toTextArea=isNaN;hn();hq.parentNode.removeChild(hs.getWrapperElement());hq.style.display="";if(hq.form){eP(hq.form,"submit",hn);if(!hr.leaveSubmitMethodAlone&&typeof hq.form.submit=="function"){hq.form.submit=ho}}}};hq.style.display="none";var hp=L(function(hs){return hq.parentNode.insertBefore(hs,hq.nextSibling)},hr);return hp}function gz(i){i.off=eP;i.on=ci;i.wheelEventPixels=aI;i.Doc=aC;i.splitLines=gJ;i.countColumn=cc;i.findColumn=e2;i.isWordChar=gq;i.Pass=cy;i.signal=aN;i.Line=g4;i.changeEnd=dq;i.scrollbarModel=bz;i.Pos=ab;i.cmpPos=cD;i.modes=dZ;i.mimeModes=a3;i.resolveMode=hb;i.getMode=gm;i.modeExtensions=dW;i.extendMode=fj;i.copyState=cp;i.startState=cm;i.innerMode=g7;i.commands=fi;i.keyMap=fW;i.keyName=gb;i.isModifierKey=ff;i.lookupKey=k;i.normalizeKeyMap=c8;i.StringStream=fD;i.SharedTextMarker=z;i.TextMarker=V;i.LineWidget=d6;i.e_preventDefault=c7;i.e_stopPropagation=dX;i.e_stop=e3;i.addClass=gn;i.contains=ha;i.rmClass=h;i.keyNames=f1}fn(L);ek(L);var d="iter insert remove copy getEditor constructor".split(" ");for(var b4 in aC.prototype){if(aC.prototype.hasOwnProperty(b4)&&dP(d,b4)<0){L.prototype[b4]=(function(i){return function(){return i.apply(this.doc,arguments)}})(aC.prototype[b4])}}bS(aC);L.inputStyles={textarea:ad,contenteditable:d1};L.defineMode=function(i){if(!L.defaults.mode&&i!="null"){L.defaults.mode=i}e6.apply(this,arguments)};L.defineMIME=bD;L.defineMode("null",function(){return({token:function(i){return i.skipToEnd()}})});L.defineMIME("text/plain","null");L.defineExtension=function(i,hk){L.prototype[i]=hk};L.defineDocExtension=function(i,hk){aC.prototype[i]=hk};L.fromTextArea=gu;gz(L);L.version="5.53.2";return L})));