User:RyaNayR/Code/codemirror.js

window.CodeMirror=function{var bJ=/gecko\/\d/i.test(navigator.userAgent);var cg=/MSIE \d/.test(navigator.userAgent);var bG=cg&&(document.documentMode==null||document.documentMode<8);var bF=cg&&(document.documentMode==null||document.documentMode<9);var dD=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent);var cB=cg||dD;var b9=/WebKit\//.test(navigator.userAgent);var cE=b9&&/Qt\/\d+\.\d+/.test(navigator.userAgent);var ch=/Chrome\//.test(navigator.userAgent);var d2=/Opera\//.test(navigator.userAgent);var ag=/Apple Computer/.test(navigator.vendor);var aH=/KHTML\//.test(navigator.userAgent);var bU=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);var cd=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);var dZ=/PhantomJS/.test(navigator.userAgent);var dz=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent);var cW=dz||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);var br=dz||/Mac/.test(navigator.platform);var ao=/win/i.test(navigator.platform);var c9=d2&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);if(c9)c9=Number(c9[1]);if(c9&&c9>=15){d2=false;b9=true}var bf=br&&(cE||d2&&(c9==null||c9<12.11));var bY=bJ||cg&&!bF;var er=false,aD=false;function B(ex,ey){if(!(this instanceof B))return new B(ex,ey);this.options=ey=ey||{};for(var ez in dB)if(!ey.hasOwnProperty(ez)&&dB.hasOwnProperty(ez))ey[ez]=dB[ez];bz(ey);var eD=typeof ey.value=="string"?0:ey.value.first;var eC=this.display=f(ex,eD);eC.wrapper.CodeMirror=this;cS(this);if(ey.autofocus&&!cW)dc(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,cutIncoming:false,draggingText:false,highlight:new ew};b3(this);if(ey.lineWrapping)this.display.wrapper.className+=" CodeMirror-wrap";var eB=ey.value;if(typeof eB=="string")eB=new aa(ey.value,ey.mode);ca(this,cR)(this,eB);if(cg)setTimeout(bP(dV,this,true),20);ef(this);var eE;try{eE=document.activeElement==eC.input}catch(eA){}if(eE||ey.autofocus&&!cW)setTimeout(bP(bT,this),20);else au(this);ca(this,function{for(var eG in aK)if(aK.propertyIsEnumerable(eG))aK[eG](this,ey[eG],bx);for(var eF=0;eF<aE.length;++eF)aE[eF](this)})}function f(ex,ez){var eA={};var ey=eA.input=ek("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");if(b9)ey.style.width="1000px";else ey.setAttribute("wrap","off");if(dz)ey.style.border="1px solid black";ey.setAttribute("autocorrect","off");ey.setAttribute("autocapitalize","off");ey.setAttribute("spellcheck","false");eA.inputDiv=ek("div",[ey],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");eA.scrollbarH=ek("div",[ek("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");eA.scrollbarV=ek("div",[ek("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");eA.scrollbarFiller=ek("div",null,"CodeMirror-scrollbar-filler");eA.gutterFiller=ek("div",null,"CodeMirror-gutter-filler");eA.lineDiv=ek("div",null,"CodeMirror-code");eA.selectionDiv=ek("div",null,null,"position: relative; z-index: 1");eA.cursor=ek("div","\u00a0","CodeMirror-cursor");eA.otherCursor=ek("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor");eA.measure=ek("div",null,"CodeMirror-measure");eA.lineSpace=ek("div",[eA.measure,eA.selectionDiv,eA.lineDiv,eA.cursor,eA.otherCursor],null,"position: relative; outline: none");eA.mover=ek("div",[ek("div",[eA.lineSpace],"CodeMirror-lines")],null,"position: relative");eA.sizer=ek("div",[eA.mover],"CodeMirror-sizer");eA.heightForcer=ek("div",null,null,"position: absolute; height: "+aP+"px; width: 1px;");eA.gutters=ek("div",null,"CodeMirror-gutters");eA.lineGutter=null;eA.scroller=ek("div",[eA.sizer,eA.heightForcer,eA.gutters],"CodeMirror-scroll");eA.scroller.setAttribute("tabIndex","-1");eA.wrapper=ek("div",[eA.inputDiv,eA.scrollbarH,eA.scrollbarV,eA.scrollbarFiller,eA.gutterFiller,eA.scroller],"CodeMirror");if(bG){eA.gutters.style.zIndex=-1;eA.scroller.style.paddingRight=0}if(ex.appendChild)ex.appendChild(eA.wrapper);else ex(eA.wrapper);if(dz)ey.style.width="0px";if(!b9)eA.scroller.draggable=true;if(aH){eA.inputDiv.style.height="1px";eA.inputDiv.style.position="absolute"}else if(bG)eA.scrollbarH.style.minWidth=eA.scrollbarV.style.minWidth="18px";eA.viewOffset=eA.lastSizeC=0;eA.showingFrom=eA.showingTo=ez;eA.lineNumWidth=eA.lineNumInnerWidth=eA.lineNumChars=null;eA.prevInput="";eA.alignWidgets=false;eA.pollingFast=false;eA.poll=new ew;eA.cachedCharWidth=eA.cachedTextHeight=null;eA.measureLineCache=[];eA.measureLineCachePos=0;eA.inaccurateSelection=false;eA.maxLine=null;eA.maxLineLength=0;eA.maxLineChanged=false;eA.wheelDX=eA.wheelDY=eA.wheelStartX=eA.wheelStartY=null;return eA}function aX(ex){ex.doc.mode=B.getMode(ex.options,ex.doc.modeOption);c0(ex)}function c0(ex){ex.doc.iter(function(ey){if(ey.stateAfter)ey.stateAfter=null;if(ey.styles)ey.styles=null});ex.doc.frontier=ex.doc.first;cV(ex,100);ex.state.modeGen++;if(ex.curOp)Q(ex)}function dk(ex){if(ex.options.lineWrapping){ex.display.wrapper.className+=" CodeMirror-wrap";ex.display.sizer.style.minWidth=""}else{ex.display.wrapper.className=ex.display.wrapper.className.replace(" CodeMirror-wrap","");en(ex)}L(ex);Q(ex);T(ex);setTimeout(function{dx(ex)},100)}function aJ(ex){var ez=aw(ex.display),ey=ex.options.lineWrapping;var eA=ey&&Math.max(5,ex.display.scroller.clientWidth/cz(ex.display)-3);return function(eB){if(d0(ex.doc,eB))return 0;else if(ey)return(Math.ceil(eB.text.length/eA)||1)*ez;else return ez}}function L(ex){var ez=ex.doc,ey=aJ(ex);ez.iter(function(eA){var eB=ey(eA);if(eB!=eA.height)ep(eA,eB)})}function eu(ex){var ez=dG[ex.options.keyMap],ey=ez.style;ex.display.wrapper.className=ex.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(ey?" cm-keymap-"+ey:"")}function b3(ex){ex.display.wrapper.className=ex.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+ex.options.theme.replace(/(^|\s)\s*/g," cm-s-");T(ex)}function cu(ex){cS(ex);Q(ex);setTimeout(function{dg(ex)},20)}function cS(ex){var ey=ex.display.gutters,eC=ex.options.gutters;cL(ey);for(var ez=0;ez<eC.length;++ez){var eA=eC[ez];var eB=ey.appendChild(ek("div",null,"CodeMirror-gutter "+eA));if(eA=="CodeMirror-linenumbers"){ex.display.lineGutter=eB;eB.style.width=(ex.display.lineNumWidth||1)+"px"}}ey.style.display=ez?"":"none"}function c1(eB,ez){if(ez.height==0)return 0;var ey=ez.text.length,ex,eC=ez;while(ex=dp(eC)){var eA=ex.find;eC=dK(eB,eA.from.line);ey+=eA.from.ch-eA.to.ch}eC=ez;while(ex=c6(eC)){var eA=ex.find;ey-=eC.text.length-eA.from.ch;eC=dK(eB,eA.to.line);ey+=eC.text.length-eA.to.ch}return ey}function en(ex){var ez=ex.display,ey=ex.doc;ez.maxLine=dK(ey,ey.first);ez.maxLineLength=c1(ey,ez.maxLine);ez.maxLineChanged=true;ey.iter(function(eB){var eA=c1(ey,eB);if(eA>ez.maxLineLength){ez.maxLineLength=eA;ez.maxLine=eB}})}function bz(ex){var ey=cm(ex.gutters,"CodeMirror-linenumbers");if(ey==-1&&ex.lineNumbers)ex.gutters=ex.gutters.concat(["CodeMirror-linenumbers"]);else if(ey>-1&&!ex.lineNumbers){ex.gutters=ex.gutters.slice(0);ex.gutters.splice(ey,1)}}function dx(ex){var eD=ex.display,ey=ex.doc.height;var eA=ey+a8(eD);eD.sizer.style.minHeight=eD.heightForcer.style.top=eA+"px";eD.gutters.style.height=Math.max(eA,eD.scroller.clientHeight-aP)+"px";var eB=Math.max(eA,eD.scroller.scrollHeight);var eC=eD.scroller.scrollWidth>eD.scroller.clientWidth+1;var ez=eB>eD.scroller.clientHeight+1;if(ez){eD.scrollbarV.style.display="block";eD.scrollbarV.style.bottom=eC?i(eD.measure)+"px":"0";eD.scrollbarV.firstChild.style.height=Math.max(0,eB-eD.scroller.clientHeight+eD.scrollbarV.clientHeight)+"px"}else{eD.scrollbarV.style.display="";eD.scrollbarV.firstChild.style.height="0"}if(eC){eD.scrollbarH.style.display="block";eD.scrollbarH.style.right=ez?i(eD.measure)+"px":"0";eD.scrollbarH.firstChild.style.width=eD.scroller.scrollWidth-eD.scroller.clientWidth+eD.scrollbarH.clientWidth+"px"}else{eD.scrollbarH.style.display="";eD.scrollbarH.firstChild.style.width="0"}if(eC&&ez){eD.scrollbarFiller.style.display="block";eD.scrollbarFiller.style.height=eD.scrollbarFiller.style.width=i(eD.measure)+"px"}else eD.scrollbarFiller.style.display="";if(eC&&(ex.options.coverGutterNextToScrollbar&&ex.options.fixedGutter)){eD.gutterFiller.style.display="block";eD.gutterFiller.style.height=i(eD.measure)+"px";eD.gutterFiller.style.width=eD.gutters.offsetWidth+"px"}else eD.gutterFiller.style.display="";if(bU&&i(eD.measure)===0){eD.scrollbarV.style.minWidth=eD.scrollbarH.style.minHeight=cd?"18px":"12px";eD.scrollbarV.style.pointerEvents=eD.scrollbarH.style.pointerEvents="none"}}function bq(eC,eB,eA){var ez=eC.scroller.scrollTop,ex=eC.wrapper.clientHeight;if(typeof eA=="number")ez=eA;else if(eA){ez=eA.top;ex=eA.bottom-eA.top}ez=Math.floor(ez-dE(eC));var ey=Math.ceil(ez+ex);return{from:a6(eB,ez),to:a6(eB,ey)}}function dg(ex){var eD=ex.display;if(!eD.alignWidgets&&(!eD.gutters.firstChild||!ex.options.fixedGutter))return;var eA=cK(eD)-eD.scroller.scrollLeft+ex.doc.scrollLeft;var eC=eD.gutters.offsetWidth,ez=eA+"px";for(var eE=eD.lineDiv.firstChild;eE;eE=eE.nextSibling)if(eE.alignable)for(var eB=0,ey=eE.alignable;eB<ey.length;++eB)ey[eB].style.left=ez;if(ex.options.fixedGutter)eD.gutters.style.left=eA+eC+"px"}function cN(ex){if(!ex.options.lineNumbers)return false;var eC=ex.doc,ey=c4(ex.options,eC.first+eC.size-1),eB=ex.display;if(ey.length!=eB.lineNumChars){var eD=eB.measure.appendChild(ek("div",[ek("div",ey)],"CodeMirror-linenumber CodeMirror-gutter-elt"));var ez=eD.firstChild.offsetWidth,eA=eD.offsetWidth-ez;eB.lineGutter.style.width="";eB.lineNumInnerWidth=Math.max(ez,eB.lineGutter.offsetWidth-eA);eB.lineNumWidth=eB.lineNumInnerWidth+eA;eB.lineNumChars=eB.lineNumInnerWidth?ey.length:-1;eB.lineGutter.style.width=eB.lineNumWidth+"px";return true}return false}function c4(ex,ey){return String(ex.lineNumberFormatter(ey+ex.firstLineNumber))}function cK(ex){return an(ex.scroller).left-an(ex.sizer).left}function cC(eC,eB,eF,eG){var eE=eC.display.showingFrom,eD=eC.display.showingTo,eA;var ex=bq(eC.display,eC.doc,eF);for(var ez=true;;ez=false){var ey=eC.display.scroller.clientWidth;if(!ck(eC,eB,ex,eG))break;eA=true;eB=[];a3(eC);dx(eC);if(ez&&(eC.options.lineWrapping&&ey!=eC.display.scroller.clientWidth)){eG=true;continue}eG=false;if(eF)eF=Math.min(eC.display.scroller.scrollHeight-eC.display.scroller.clientHeight,typeof eF=="number"?eF:eF.top);ex=bq(eC.display,eC.doc,eF);if(ex.from>=eC.display.showingFrom&&ex.to<=eC.display.showingTo)break}if(eA){O(eC,"update",eC);if(eC.display.showingFrom!=eE||eC.display.showingTo!=eD)O(eC,"viewportChange",eC,eC.display.showingFrom,eC.display.showingTo)}return eA}function ck(eB,eP,ey,eN){var eH=eB.display,eQ=eB.doc;if(!eH.wrapper.offsetWidth){eH.showingFrom=eH.showingTo=eQ.first;eH.viewOffset=0;return}if(!eN&&(eP.length==0&&(ey.from>eH.showingFrom&&ey.to<eH.showingTo)))return;if(cN(eB))eP=[{from:eQ.first,to:eQ.first+eQ.size}];var eM=eH.sizer.style.marginLeft=eH.gutters.offsetWidth+"px";eH.scrollbarH.style.left=eB.options.fixedGutter?eM:"0";var ez=Infinity;if(eB.options.lineNumbers)for(var eI=0;eIex&&eH.showingTo-ex<20)ex=Math.min(eA,eH.showingTo);if(aD){eG=bd(u(eQ,dK(eQ,eG)));while(ex=eK[0].to)eK=[];else eK=dU(eK,eP);if(aD)for(var eI=0;eIeD.from)eD.to=eO;else{eK.splice(eI--,1);break}}}var eF=0;for(var eI=0;eIex)eD.to=ex;if(eD.from>=eD.to)eK.splice(eI--,1);else eF+=eD.to-eD.from}if(!eN&&(eF==ex-eG&&(eG==eH.showingFrom&&ex==eH.showingTo))){h(eB);return}eK.sort(function(eS,eR){return eS.from-eR.from});try{var eC=document.activeElement}catch(eJ){}if(eF<(ex-eG)*0.7)eH.lineDiv.style.display="none";bH(eB,eG,ex,eK,ez);eH.lineDiv.style.display="";if(eC&&(document.activeElement!=eC&&eC.offsetHeight))eC.focus;var eE=eG!=eH.showingFrom||(ex!=eH.showingTo||eH.lastSizeC!=eH.wrapper.clientHeight);if(eE){eH.lastSizeC=eH.wrapper.clientHeight;cV(eB,400)}eH.showingFrom=eG;eH.showingTo=ex;eH.gutters.style.height="";aF(eB);h(eB);return true}function aF(eF){var eC=eF.display;var ey=eC.lineDiv.offsetTop;for(var ex=eC.lineDiv.firstChild,eG;ex;ex=ex.nextSibling)if(ex.lineObj){if(bG){var eB=ex.offsetTop+ex.offsetHeight;eG=eB-ey;ey=eB}else{var eA=an(ex);eG=eA.bottom-eA.top}var eE=ex.lineObj.height-eG;if(eG<2)eG=aw(eC);if(eE>0.001||eE<-0.001){ep(ex.lineObj,eG);var eD=ex.lineObj.widgets;if(eD)for(var ez=0;ez=eC.to)ex.push(eC);else{if(eD.from>eC.from)ex.push({from:eC.from,to:eD.from});if(eD.to<eC.to)ex.push({from:eD.to+eF,to:eC.to+eF})}}eG=ex}return eG}function dH(ex){var eB=ex.display,eA={},ez={};for(var eC=eB.gutters.firstChild,ey=0;eC;eC=eC.nextSibling,++ey){eA[ex.options.gutters[ey]]=eC.offsetLeft;ez[ex.options.gutters[ey]]=eC.offsetWidth}return{fixedPos:cK(eB),gutterTotalWidth:eB.gutters.offsetWidth,gutterLeft:eA,gutterWidth:ez,wrapperWidth:eB.wrapper.clientWidth}}function bH(eG,eD,eE,eJ,ey){var eF=dH(eG);var eC=eG.display,eI=eG.options.lineNumbers;if(!eJ.length&&(!b9||!eG.display.currentWheelTarget))cL(eC.lineDiv);var ex=eC.lineDiv,eH=ex.firstChild;function eB(eL){var eK=eL.nextSibling;if(b9&&(br&&eG.display.currentWheelTarget==eL)){eL.style.display="none";eL.lineObj=null}else eL.parentNode.removeChild(eL);return eK}var ez=eJ.shift,eA=eD;eG.doc.iter(eD,eE,function(eT){if(ez&&ez.to==eA)ez=eJ.shift;if(d0(eG.doc,eT)){if(eT.height!=0)ep(eT,0);if(eT.widgets&&(eH&&eH.previousSibling))for(var eO=0;eOeA)){while(eH.lineObj!=eT)eH=eB(eH);if(eI&&(ey<=eA&&eH.lineNumber))l(eH.lineNumber,c4(eG.options,eA));eH=eH.nextSibling}else{if(eT.widgets)for(var eN=0,eS=eH,eP;eS&&eN<20;++eN,eS=eS.nextSibling)if(eS.lineObj==eT&&/div/i.test(eS.nodeName)){eP=eS;break}var eK=ai(eG,eT,eA,eF,eP);if(eK!=eP)ex.insertBefore(eK,eH);else{while(eH!=eP)eH=eB(eH);eH=eH.nextSibling}eK.lineObj=eT}++eA});while(eH)eH=eB(eH)}function ai(eE,eG,eH,eK,ez){var eD=dr(eE,eG),eQ=eD.pre;var eT=eG.gutterMarkers,eR=eE.display,eF;var ey=eD.bgClass?eD.bgClass+" "+(eG.bgClass||""):eG.bgClass;if(!eE.options.lineNumbers&&(!eT&&(!ey&&(!eG.wrapClass&&!eG.widgets))))return eQ;if(ez){ez.alignable=null;var eU=true,eC=0,eA=null;for(var eM=ez.firstChild,eL;eM;eM=eL){eL=eM.nextSibling;if(!/\bCodeMirror-linewidget\b/.test(eM.className))ez.removeChild(eM);else{for(var eS=0;eS<eG.widgets.length;++eS){var eB=eG.widgets[eS];if(eB.node==eM.firstChild){if(!eB.above&&!eA)eA=eM;a5(eB,eM,ez,eK);++eC;break}}if(eS==eG.widgets.length){eU=false;break}}}ez.insertBefore(eQ,eA);if(eU&&eC==eG.widgets.length){eF=ez;ez.className=eG.wrapClass||""}}if(!eF){eF=ek("div",null,eG.wrapClass,"position: relative");eF.appendChild(eQ)}if(ey)eF.insertBefore(ek("div",null,ey+" CodeMirror-linebackground"),eF.firstChild);if(eE.options.lineNumbers||eT){var eO=eF.insertBefore(ek("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(eE.options.fixedGutter?eK.fixedPos:-eK.gutterTotalWidth)+"px"),eQ);if(eE.options.fixedGutter)(eF.alignable||(eF.alignable=[])).push(eO);if(eE.options.lineNumbers&&(!eT||!eT["CodeMirror-linenumbers"]))eF.lineNumber=eO.appendChild(ek("div",c4(eE.options,eH),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+eK.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+eR.lineNumInnerWidth+"px"));if(eT)for(var eP=0;eP<eE.options.gutters.length;++eP){var eJ=eE.options.gutters[eP],eI=eT.hasOwnProperty(eJ)&&eT[eJ];if(eI)eO.appendChild(ek("div",[eI],"CodeMirror-gutter-elt","left: "+eK.gutterLeft[eJ]+"px; width: "+eK.gutterWidth[eJ]+"px"))}}if(bG)eF.style.zIndex=2;if(eG.widgets&&eF!=ez)for(var eS=0,ex=eG.widgets;eS<ex.length;++eS){var eB=ex[eS],eN=ek("div",[eB.node],"CodeMirror-linewidget");if(!eB.handleMouseEvents)eN.ignoreEvents=true;a5(eB,eN,eF,eK);if(eB.above)eF.insertBefore(eN,eE.options.lineNumbers&&eG.height!=0?eO:eQ);else eF.appendChild(eN);O(eB,"redraw")}return eF}function a5(eA,ez,ey,eB){if(eA.noHScroll){(ey.alignable||(ey.alignable=[])).push(ez);var ex=eB.wrapperWidth;ez.style.left=eB.fixedPos+"px";if(!eA.coverGutter){ex-=eB.gutterTotalWidth;ez.style.paddingLeft=eB.gutterTotalWidth+"px"}ez.style.width=ex+"px"}if(eA.coverGutter){ez.style.zIndex=5;ez.style.position="relative";if(!eA.noHScroll)ez.style.marginLeft=-eB.gutterTotalWidth+"px"}}function a3(ex){var eA=ex.display;var eB=d9(ex.doc.sel.from,ex.doc.sel.to);if(eB||ex.options.showCursorWhenSelecting)C(ex);else eA.cursor.style.display=eA.otherCursor.style.display="none";if(!eB)V(ex);else eA.selectionDiv.style.display="none";if(ex.options.moveInputWithCursor){var eC=cI(ex,ex.doc.sel.head,"div");var ey=an(eA.wrapper),ez=an(eA.lineDiv);eA.inputDiv.style.top=Math.max(0,Math.min(eA.wrapper.clientHeight-10,eC.top+ez.top-ey.top))+"px";eA.inputDiv.style.left=Math.max(0,Math.min(eA.wrapper.clientWidth-10,eC.left+ez.left-ey.left))+"px"}}function C(ex){var ey=ex.display,ez=cI(ex,ex.doc.sel.head,"div");ey.cursor.style.left=ez.left+"px";ey.cursor.style.top=ez.top+"px";ey.cursor.style.height=Math.max(0,ez.bottom-ez.top)*ex.options.cursorHeight+"px";ey.cursor.style.display="";if(ez.other){ey.otherCursor.style.display="";ey.otherCursor.style.left=ez.other.left+"px";ey.otherCursor.style.top=ez.other.top+"px";ey.otherCursor.style.height=(ez.other.bottom-ez.other.top)*0.85+"px"}else ey.otherCursor.style.display="none"}function V(eI){var eD=eI.display,eH=eI.doc,ex=eI.doc.sel;var eB=document.createDocumentFragment;var eG=eD.lineSpace.offsetWidth,ez=av(eI.display);function eK(eO,eN,eM,eL){if(eN<0)eN=0;eB.appendChild(ek("div",null,"CodeMirror-selected","position: absolute; left: "+eO+"px; top: "+eN+"px; width: "+(eM==null?eG-eO:eM)+"px; height: "+(eL-eN)+"px"))}function eF(eM,eO,eR){var eN=dK(eH,eM);var eP=eN.text.length;var eS,eL;function eQ(eU,eT){return b0(eI,K(eM,eU),"div",eN,eT)}cM(a(eN),eO||0,eR==null?eP:eR,function(e0,eZ,eT){var eW=eQ(e0,"left"),eX,eY,eV;if(e0==eZ){eX=eW;eY=eV=eW.left}else{eX=eQ(eZ-1,"right");if(eT=="rtl"){var eU=eW;eW=eX;eX=eU}eY=eW.left;eV=eX.right}if(eO==null&&e0==0)eY=ez;if(eX.top-eW.top>3){eK(eY,eW.top,null,eW.bottom);eY=ez;if(eW.bottomeL.bottom||eX.bottom==eL.bottom&&eX.right>eL.right))eL=eX;if(eY<ez+1)eY=ez;eK(eY,eX.top,eV-eY,eX.bottom)});return{start:eS,end:eL}}if(ex.from.line==ex.to.line)eF(ex.from.line,ex.from.ch,ex.to.ch);else{var eA=dK(eH,ex.from.line),ey=dK(eH,ex.to.line);var eC=u(eH,eA)==u(eH,ey);var eJ=eF(ex.from.line,ex.from.ch,eC?eA.text.length:null).end;var eE=eF(ex.to.line,eC?0:null,ex.to.ch).start;if(eC)if(eJ.top0)ez.blinker=setInterval(function{ez.cursor.style.visibility=ez.otherCursor.style.visibility=(ey=!ey)?"":"hidden"},ex.options.cursorBlinkRate)}function cV(ex,ey){if(ex.doc.mode.startState&&ex.doc.frontier=ex.display.showingTo)return;var ey=+new Date+ex.options.workTime;var ez=bp(eA.mode,cx(ex,eA.frontier));var eC=[],eB;eA.iter(eA.frontier,Math.min(eA.first+eA.size,ex.display.showingTo+500),function(eD){if(eA.frontier>=ex.display.showingFrom){var eF=eD.styles;eD.styles=d5(ex,eD,ez,true);var eG=!eF||eF.length!=eD.styles.length;for(var eE=0;!eG&&eEey){cV(ex,ex.options.workDelay);return true}});if(eC.length)ca(ex,function{for(var eD=0;eDez;--eG){if(eG<=eC.first)return eC.first;var eF=dK(eC,eG-1);if(eF.stateAfter&&(!eA||eG<=eC.frontier))return eG;var eE=bh(eF.text,null,eD.options.tabSize);if(eB==null||ey>eE){eB=eG-1;ey=eE}}return eB}function cx(ex,eD,ey){var eB=ex.doc,eA=ex.display;if(!eB.mode.startState)return true;var eC=bR(ex,eD,ey),ez=eC>eB.first&&dK(eB,eC-1).stateAfter;if(!ez)ez=bn(eB.mode);else ez=bp(eB.mode,ez);eB.iter(eC,eD,function(eE){cv(ex,eE.text,ez);var eF=eC==eD-1||(eC%5==0||eC>=eA.showingFrom&&eC<eA.showingTo);eE.stateAfter=eF?bp(eB.mode,ez):null;++eC});if(ey)eB.frontier=eC;return ez}function dE(ex){return ex.lineSpace.offsetTop}function a8(ex){return ex.mover.offsetHeight-ex.lineSpace.offsetHeight}function av(ey){var ex=bg(ey.measure,ek("pre",null,null,"text-align: left")).appendChild(ek("span","x"));return ex.offsetLeft}function cX(eE,eF,ey,eB,eC){var eA=-1;eB=eB||a9(eE,eF);if(eB.crude){var ez=eB.left+ey*eB.width;return{left:ez,right:ez+eB.width,top:eB.top,bottom:eB.bottom}}for(var eD=ey;;eD+=eA){var ex=eB[eD];if(ex)break;if(eA<0&&eD==0)eA=1}eC=eD>ey?"left":eDey?ex.left:ex.right,top:ex.top,bottom:ex.bottom}}function dC(ex,ey){var eA=ex.display.measureLineCache;for(var eB=0;eB<eA.length;++eB){var ez=eA[eB];if(ez.text==ey.text&&(ez.markedSpans==ey.markedSpans&&(ex.display.scroller.clientWidth==ez.width&&ez.classes==ey.textClass+"|"+ey.wrapClass)))return ez}}function ed(ex,ey){var ez=dC(ex,ey);if(ez)ez.text=ez.measure=ez.markedSpans=null}function a9(ex,ey){var eC=dC(ex,ey);if(eC)return eC.measure;var eB=cj(ex,ey);var eA=ex.display.measureLineCache;var ez={text:ey.text,width:ex.display.scroller.clientWidth,markedSpans:ey.markedSpans,measure:eB,classes:ey.textClass+"|"+ey.wrapClass};if(eA.length==16)eA[++ex.display.measureLineCachePos%16]=ez;else eA.push(ez);return eB}function cj(eE,eG){if(!eE.options.lineWrapping&&eG.text.length>=eE.options.crudeMeasuringFrom)return el(eE,eG);var eM=eE.display,eC=U(eG.text.length);var eJ=dr(eE,eG,eC,true).pre;if(cg&&(!bG&&(!eE.options.lineWrapping&&eJ.childNodes.length>100))){var ez=document.createDocumentFragment;var eH=10,eK=eJ.childNodes.length;for(var eO=0,eI=Math.ceil(eK/eH);eOeQ)eY=eQ;if(eW<0)eW=0;for(var eT=ex.length-2;eT>=0;eT-=2){var eV=ex[eT],eX=ex[eT+1];if(eV>eY||eX=eY||(eW<=eV&&eY>=eX||Math.min(eY,eX)-Math.max(eW,eV)>=eY-eW>>1)){ex[eT]=Math.min(eW,eV);ex[eT+1]=Math.max(eY,eX);break}}if(eT<0){eT=ex.length;ex.push(eW,eY)}return{left:eU.left-ey.left,right:eU.right-ey.left,top:eT,bottom:null}}function eS(eT){eT.bottom=ex[eT.top+1];eT.top=ex[eT.top]}for(var eO=0,eB;eO1){eA=eR[eO]=eP(eD[0]);eA.rightSide=eP(eD[eD.length-1])}}if(!eA)eA=eR[eO]=eP(an(eL));if(eB.measureRight)eA.right=an(eB.measureRight).left-ey.left;if(eB.leftSide)eA.leftSide=eP(an(eB.leftSide))}cL(eE.display.measure);for(var eO=0,eB;eO<eR.length;++eO)if(eB=eR[eO]){eS(eB);if(eB.leftSide)eS(eB.leftSide);if(eB.rightSide)eS(eB.rightSide)}return eR}function el(ex,ey){var eC=new eo(ey.text.slice(0,100),null);if(ey.textClass)eC.textClass=ey.textClass;var eA=cj(ex,eC);var eB=cX(ex,eC,0,eA,"left");var ez=cX(ex,eC,99,eA,"right");return{crude:true,top:eB.top,left:eB.left,bottom:eB.bottom,width:(ez.right-eB.left)/100}}function dh(ex,ez){var eE=false;if(ez.markedSpans)for(var eA=0;eA=ex.options.crudeMeasuringFrom)return cX(ex,ez,ez.text.length,eB&&eB.measure,"right").right;var eD=dr(ex,ez,null,true).pre;var ey=eD.appendChild(aT(ex.display.measure));bg(ex.display.measure,eD);return an(ey).right-an(ex.display.lineDiv).left}function T(ex){ex.display.measureLineCache.length=ex.display.measureLineCachePos=0;ex.display.cachedCharWidth=ex.display.cachedTextHeight=null;if(!ex.options.lineWrapping)ex.display.maxLineChanged=true;ex.display.lineNumChars=null}function bO{return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function bN{return window.pageYOffset||(document.documentElement||document.body).scrollTop}function dq(eD,eA,eC,ey){if(eA.widgets)for(var ez=0;ez<eA.widgets.length;++ez)if(eA.widgets[ez].above){var eF=b7(eA.widgets[ez]);eC.top+=eF;eC.bottom+=eF}if(ey=="line")return eC;if(!ey)ey="local";var eB=bc(eD,eA);if(ey=="local")eB+=dE(eD.display);else eB-=eD.display.viewOffset;if(ey=="page"||ey=="window"){var ex=an(eD.display.lineSpace);eB+=ex.top+(ey=="window"?0:bN);var eE=ex.left+(ey=="window"?0:bO);eC.left+=eE;eC.right+=eE}eC.top+=eB;eC.bottom+=eB;return eC}function et(ey,eB,ez){if(ez=="div")return eB;var eD=eB.left,eC=eB.top;if(ez=="page"){eD-=bO;eC-=bN}else if(ez=="local"||!ez){var eA=an(ey.display.sizer);eD+=eA.left;eC+=eA.top}var ex=an(ey.display.lineSpace);return{left:eD-ex.left,top:eC-ex.top}}function b0(ex,eB,eA,ez,ey){if(!ez)ez=dK(ex.doc,eB.line);return dq(ex,ez,cX(ex,ez,eB.ch,null,ey),eA)}function cI(eG,eF,ez,eE,eC){eE=eE||dK(eG.doc,eF.line);if(!eC)eC=a9(eG,eE);function eB(eK,eJ){var eI=cX(eG,eE,eK,eC,eJ?"right":"left");if(eJ)eI.left=eI.right;else eI.right=eI.left;return dq(eG,eE,eI,ez)}function eH(eL,eI){var eJ=eD[eI],eK=eJ.level%2;if(eL==cw(eJ)&&(eI&&eJ.level<eD[eI-1].level)){eJ=eD[--eI];eL=es(eJ)-(eJ.level%2?0:1);eK=true}else if(eL==es(eJ)&&(eI<eD.length-1&&eJ.level<eD[eI+1].level)){eJ=eD[++eI];eL=cw(eJ)-eJ.level%2;eK=false}if(eK&&(eL==eJ.to&&eL>eJ.from))return eB(eL-1);return eB(eL,eK)}var eD=a(eE),ex=eF.ch;if(!eD)return eB(ex);var ey=aj(eD,ex);var eA=eH(ex,ey);if(dA!=null)eA.other=eH(ex,dA);return eA}function ej(ex,ey,ez,eB){var eA=new K(ex,ey);eA.xRel=eB;if(ez)eA.outside=true;return eA}function ee(eE,eB,eA){var eD=eE.doc;eA+=eE.display.viewOffset;if(eA<0)return ej(eD.first,0,true,-1);var ey=a6(eD,eA),eF=eD.first+eD.size-1;if(ey>eF)return ej(eD.first+eD.size-1,dK(eD,eF).text.length,true,1);if(eB<0)eB=0;for{var ez=dK(eD,ey);var eG=b8(eE,ez,ey,eB,eA);var eC=c6(ez);var ex=eC&&eC.find;if(eC&&(eG.ch>ex.from.ch||eG.ch==ex.from.ch&&eG.xRel>0))ey=ex.to.line;else return eG}}function b8(eH,ez,eK,eJ,eI){var eG=eI-bc(eH,ez);var eD=false,eQ=2*eH.display.wrapper.clientWidth;var eP=a9(eH,ez);function eU(eW){var eX=cI(eH,K(eK,eW),"line",ez,eP);eD=true;if(eG>eX.bottom)return eX.left-eQ;else if(eG<eX.top)return eX.left+eQ;else eD=false;return eX.left}var eM=a(ez),eO=ez.text.length;var eR=bV(ez),eA=b5(ez);var eN=eU(eR),ex=eD,ey=eU(eA),eC=eD;if(eJ>ey)return ej(eK,eA,eC,1);for{if(eM?eA==eR||eA==q(ez,eR,1):eA-eR<=1){var eL=eJ<eN||eJ-eN<=ey-eJ?eR:eA;var eT=eJ-(eL==eR?eN:ey);while(dW(ez.text.charAt(eL)))++eL;var eF=ej(eK,eL,eL==eR?ex:eC,eT<0?-1:eT?1:0);return eF}var eE=Math.ceil(eO/2),eV=eR+eE;if(eM){eV=eR;for(var eS=0;eS<eE;++eS)eV=q(ez,eV,1)}var eB=eU(eV);if(eB>eJ){eA=eV;ey=eB;if(eC=eD)ey+=1E3;eO=eE}else{eR=eV;eN=eB;ex=eD;eO-=eE}}}var ak;function aw(ez){if(ez.cachedTextHeight!=null)return ez.cachedTextHeight;if(ak==null){ak=ek("pre");for(var ey=0;ey<49;++ey){ak.appendChild(document.createTextNode("x"));ak.appendChild(ek("br"))}ak.appendChild(document.createTextNode("x"))}bg(ez.measure,ak);var ex=ak.offsetHeight/50;if(ex>3)ez.cachedTextHeight=ex;cL(ez.measure);return ex||1}function cz(eA){if(eA.cachedCharWidth!=null)return eA.cachedCharWidth;var ex=ek("span","x");var ez=ek("pre",[ex]);bg(eA.measure,ez);var ey=ex.offsetWidth;if(ey>2)eA.cachedCharWidth=ey;return ey||10}var cP=0;function bZ(ex){ex.curOp={changes:[],forceUpdate:false,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:false,cursorActivity:false,updateMaxLine:false,updateScrollPos:false,id:++cP};if(!bM++)aU=[]}function W(eL){var eF=eL.curOp,eK=eL.doc,eG=eL.display;eL.curOp=null;if(eF.updateMaxLine)en(eL);if(eG.maxLineChanged&&(!eL.options.lineWrapping&&eG.maxLine)){var ey=dh(eL,eG.maxLine);eG.sizer.style.minWidth=Math.max(0,ey+3+aP)+"px";eG.maxLineChanged=false;var eI=Math.max(0,eG.sizer.offsetLeft+eG.sizer.offsetWidth-eG.scroller.clientWidth);if(eI<eK.scrollLeft&&!eF.updateScrollPos)a4(eL,Math.min(eG.scroller.scrollLeft,eI),true)}var ez,eD;if(eF.updateScrollPos)ez=eF.updateScrollPos;else if(eF.selectionChanged&&eG.scroller.clientHeight){var eJ=cI(eL,eK.sel.head);ez=A(eL,eJ.left,eJ.top,eJ.left,eJ.bottom)}if(eF.changes.length||(eF.forceUpdate||ez&&ez.scrollTop!=null)){eD=cC(eL,eF.changes,ez&&ez.scrollTop,eF.forceUpdate);if(eL.display.scroller.offsetHeight)eL.doc.scrollTop=eL.display.scroller.scrollTop}if(!eD&&eF.selectionChanged)a3(eL);if(eF.updateScrollPos){var eH=Math.max(0,Math.min(eG.scroller.scrollHeight-eG.scroller.clientHeight,ez.scrollTop));var eA=Math.max(0,Math.min(eG.scroller.scrollWidth-eG.scroller.clientWidth,ez.scrollLeft));eG.scroller.scrollTop=eG.scrollbarV.scrollTop=eK.scrollTop=eH;eG.scroller.scrollLeft=eG.scrollbarH.scrollLeft=eK.scrollLeft=eA;dg(eL);if(eF.scrollToPos)x(eL,ea(eL.doc,eF.scrollToPos.from),ea(eL.doc,eF.scrollToPos.to),eF.scrollToPos.margin)}else if(ez)ae(eL);if(eF.selectionChanged)k(eL);if(eL.state.focused&&eF.updateInput)dV(eL,eF.userSelChange);var eE=eF.maybeHiddenMarkers,ex=eF.maybeUnhiddenMarkers;if(eE)for(var eC=0;eC<eE.length;++eC)if(!eE[eC].lines.length)ah(eE[eC],"hide");if(ex)for(var eC=0;eC<ex.length;++eC)if(ex[eC].lines.length)ah(ex[eC],"unhide");var eB;if(!--bM){eB=aU;aU=null}if(eF.textChanged)ah(eL,"change",eL,eF.textChanged);if(eF.cursorActivity)ah(eL,"cursorActivity",eL);if(eB)for(var eC=0;eC<eB.length;++eC)eB[eC]}function ca(ex,ey){return function{var eA=ex||this,eB=!eA.curOp;if(eB)bZ(eA);try{var ez=ey.apply(eA,arguments)}finally{if(eB)W(eA)}return ez}}function d4(ex){return function{var ez=this.cm&&!this.cm.curOp,ey;if(ez)bZ(this.cm);try{ey=ex.apply(this,arguments)}finally{if(ez)W(this.cm)}return ey}}function b2(ey,eA){var ez=!ey.curOp,ex;if(ez)bZ(ey);try{ex=eA}finally{if(ez)W(ey)}return ex}function Q(ex,eA,ez,ey){if(eA==null)eA=ex.doc.first;if(ez==null)ez=ex.doc.first+ex.doc.size;ex.curOp.changes.push({from:eA,to:ez,diff:ey})}function aS(ex){if(ex.display.pollingFast)return;ex.display.poll.set(ex.options.pollInterval,function{bC(ex);if(ex.state.focused)aS(ex)})}function w(ex){var ey=false;ex.display.pollingFast=true;function ez{var eA=bC(ex);if(!eA&&!ey){ey=true;ex.display.poll.set(60,ez)}else{ex.display.pollingFast=false;aS(ex)}}ex.display.poll.set(20,ez)}function bC(eL){var eG=eL.display.input,eD=eL.display.prevInput,eK=eL.doc,ex=eK.sel;if(!eL.state.focused||(aY(eG)||(S(eL)||eL.options.disableInput)))return false;if(eL.state.pasteIncoming&&eL.state.fakedLastChar){eG.value=eG.value.substring(0,eG.value.length-1);eL.state.fakedLastChar=false}var eM=eG.value;if(eM==eD&&d9(ex.from,ex.to))return false;if(cB&&(!bF&&eL.display.inputHasSelection===eM)){dV(eL,true);return false}var ez=!eL.curOp;if(ez)bZ(eL);ex.shift=false;var eF=0,ey=Math.min(eD.length,eM.length);while(eF<ey&&eD.charCodeAt(eF)==eM.charCodeAt(eF))++eF;var eJ=ex.from,eI=ex.to;var eB=eM.slice(eF);if(eF<eD.length)eJ=K(eJ.line,eJ.ch-(eD.length-eF));else if(eL.state.overwrite&&(d9(eJ,eI)&&!eL.state.pasteIncoming))eI=K(eI.line,Math.min(dK(eK,eI.line).text.length,eI.ch+eB.length));var eE=eL.curOp.updateInput;var eH={from:eJ,to:eI,text:ay(eB),origin:eL.state.pasteIncoming?"paste":eL.state.cutIncoming?"cut":"+input"};aL(eL.doc,eH,"end");eL.curOp.updateInput=eE;O(eL,"inputRead",eL,eH);if(eB&&(!eL.state.pasteIncoming&&(eL.options.electricChars&&(eL.options.smartIndent&&ex.head.ch<100)))){var eA=eL.getModeAt(ex.head).electricChars;if(eA)for(var eC=0;eC<eA.length;eC++)if(eB.indexOf(eA.charAt(eC))>-1){N(eL,ex.head.line,"smart");break}}if(eM.length>1E3||eM.indexOf("\n")>-1)eG.value=eL.display.prevInput="";else eL.display.prevInput=eM;if(ez)W(eL);eL.state.pasteIncoming=eL.state.cutIncoming=false;return true}function dV(ex,ez){var ey,eA,eC=ex.doc;if(!d9(eC.sel.from,eC.sel.to)){ex.display.prevInput="";ey=cf&&(eC.sel.to.line-eC.sel.from.line>100||(eA=ex.getSelection).length>1E3);var eB=ey?"-":eA||ex.getSelection;ex.display.input.value=eB;if(ex.state.focused)cD(ex.display.input);if(cB&&!bF)ex.display.inputHasSelection=eB}else if(ez){ex.display.prevInput=ex.display.input.value="";if(cB&&!bF)ex.display.inputHasSelection=null}ex.display.inaccurateSelection=ey}function dc(ex){if(ex.options.readOnly!="nocursor"&&(!cW||document.activeElement!=ex.display.input))ex.display.input.focus}function S(ex){return ex.options.readOnly||ex.doc.cantEdit}function ef(ey){var eD=ey.display;bl(eD.scroller,"mousedown",ca(ey,c5));if(cg)bl(eD.scroller,"dblclick",ca(ey,function(eG){if(ar(ey,eG))return;var eH=bI(ey,eG);if(!eH||(j(ey,eG)||aG(ey.display,eG)))return;bW(eG);var eF=ab(dK(ey.doc,eH.line).text,eH);eh(ey.doc,eF.from,eF.to)}));else bl(eD.scroller,"dblclick",function(eF){ar(ey,eF)||bW(eF)});bl(eD.lineSpace,"selectstart",function(eF){if(!aG(eD,eF))bW(eF)});if(!bY)bl(eD.scroller,"contextmenu",function(eF){ad(ey,eF)});bl(eD.scroller,"scroll",function{if(eD.scroller.clientHeight){F(ey,eD.scroller.scrollTop);a4(ey,eD.scroller.scrollLeft,true);ah(ey,"scroll",ey)}});bl(eD.scrollbarV,"scroll",function{if(eD.scroller.clientHeight)F(ey,eD.scrollbarV.scrollTop)});bl(eD.scrollbarH,"scroll",function{if(eD.scroller.clientHeight)a4(ey,eD.scrollbarH.scrollLeft)});bl(eD.scroller,"mousewheel",function(eF){b(ey,eF)});bl(eD.scroller,"DOMMouseScroll",function(eF){b(ey,eF)});function eE{if(ey.state.focused)setTimeout(bP(dc,ey),0)}bl(eD.scrollbarH,"mousedown",eE);bl(eD.scrollbarV,"mousedown",eE);bl(eD.wrapper,"scroll",function{eD.wrapper.scrollTop=eD.wrapper.scrollLeft=0});var ex;function eB{if(ex==null)ex=setTimeout(function{ex=null;eD.cachedCharWidth=eD.cachedTextHeight=c7=null;T(ey);b2(ey,bP(Q,ey))},100)}bl(window,"resize",eB);function eA{for(var eF=eD.wrapper.parentNode;eF&&eF!=document.body;eF=eF.parentNode);if(eF)setTimeout(eA,5E3);else cU(window,"resize",eB)}setTimeout(eA,5E3);bl(eD.input,"keyup",ca(ey,aN));bl(eD.input,"input",function{if(cB&&(!bF&&ey.display.inputHasSelection))ey.display.inputHasSelection=null;w(ey)});bl(eD.input,"keydown",ca(ey,m));bl(eD.input,"keypress",ca(ey,bQ));bl(eD.input,"focus",bP(bT,ey));bl(eD.input,"blur",bP(au,ey));function ez(eF){if(ar(ey,eF)||ey.options.onDragEvent&&ey.options.onDragEvent(ey,Y(eF)))return;c3(eF)}if(ey.options.dragDrop){bl(eD.scroller,"dragstart",function(eF){I(ey,eF)});bl(eD.scroller,"dragenter",ez);bl(eD.scroller,"dragover",ez);bl(eD.scroller,"drop",ca(ey,aO))}bl(eD.scroller,"paste",function(eF){if(aG(eD,eF))return;dc(ey);w(ey)});bl(eD.input,"paste",function{if(b9&&(!ey.state.fakedLastChar&&!(new Date-ey.state.lastMiddleDown<200))){var eG=eD.input.selectionStart,eF=eD.input.selectionEnd;eD.input.value+="$";eD.input.selectionStart=eG;eD.input.selectionEnd=eF;ey.state.fakedLastChar=true}ey.state.pasteIncoming=true;w(ey)});function eC(eF){if(eD.inaccurateSelection){eD.prevInput="";eD.inaccurateSelection=false;eD.input.value=ey.getSelection;cD(eD.input)}if(eF.type=="cut")ey.state.cutIncoming=true}bl(eD.input,"cut",eC);bl(eD.input,"copy",eC);if(aH)bl(eD.sizer,"mouseup",function{if(document.activeElement==eD.input)eD.input.blur;dc(ey)})}function aG(ey,ex){for(var ez=D(ex);ez!=ey.wrapper;ez=ez.parentNode)if(!ez||(ez.ignoreEvents||ez.parentNode==ey.sizer&&ez!=ey.mover))return true}function bI(ey,eD,eA){var eC=ey.display;if(!eA){var eB=D(eD);if(eB==eC.scrollbarH||(eB==eC.scrollbarH.firstChild||(eB==eC.scrollbarV||(eB==eC.scrollbarV.firstChild||(eB==eC.scrollbarFiller||eB==eC.gutterFiller)))))return null}var ex,eE,ez=an(eC.lineSpace);try{ex=eD.clientX;eE=eD.clientY}catch(eD){return null}return ee(ey,ex-ez.left,eE-ez.top)}var co,ci;function c5(eP){if(ar(this,eP))return;var eA=this,eK=eA.display,eR=eA.doc,eI=eR.sel;eI.shift=eP.shiftKey;if(aG(eK,eP)){if(!b9){eK.scroller.draggable=false;setTimeout(function{eK.scroller.draggable=true},100)}return}if(j(eA,eP))return;var ez=bI(eA,eP);switch(ec(eP)){case 3:if(bY)ad.call(eA,eA,eP);return;case 2:if(b9)eA.state.lastMiddleDown=+new Date;if(ez)eh(eA.doc,ez);setTimeout(bP(dc,eA),20);bW(eP);return}if(!ez){if(D(eP)==eK.scroller)bW(eP);return}if(!eA.state.focused)bT(eA);var ex=+new Date,ey="single";if(ci&&(ci.time>ex-400&&d9(ci.pos,ez))){ey="triple";bW(eP);setTimeout(bP(dc,eA),20);aR(eA,ez.line)}else if(co&&(co.time>ex-400&&d9(co.pos,ez))){ey="double";ci={time:ex,pos:ez};bW(eP);var eM=ab(dK(eR,ez.line).text,ez);eh(eA.doc,eM.from,eM.to)}else co={time:ex,pos:ez};var eB=ez;if(eA.options.dragDrop&&(dn&&(!S(eA)&&(!d9(eI.from,eI.to)&&(!dL(ez,eI.from)&&(!dL(eI.to,ez)&&ey=="single")))))){var eL=ca(eA,function(eS){if(b9)eK.scroller.draggable=false;eA.state.draggingText=false;cU(document,"mouseup",eL);cU(eK.scroller,"drop",eL);if(Math.abs(eP.clientX-eS.clientX)+Math.abs(eP.clientY-eS.clientY)<10){bW(eS);eh(eA.doc,ez);dc(eA);if(cg&&!bF)setTimeout(function{document.body.focus;dc(eA)},20)}});if(b9)eK.scroller.draggable=true;eA.state.draggingText=eL;if(eK.scroller.dragDrop)eK.scroller.dragDrop;bl(document,"mouseup",eL);bl(eK.scroller,"drop",eL);return}bW(eP);if(ey=="single")eh(eA.doc,ea(eR,ez));var eQ=eI.from,eF=eI.to,eJ=ez;function eN(eT){if(d9(eJ,eT))return;eJ=eT;if(ey=="single"){eh(eA.doc,ea(eR,ez),eT);return}eQ=ea(eR,eQ);eF=ea(eR,eF);if(ey=="double"){var eS=ab(dK(eR,eT.line).text,eT);if(dL(eT,eQ))eh(eA.doc,eS.from,eF);else eh(eA.doc,eQ,eS.to)}else if(ey=="triple")if(dL(eT,eQ))eh(eA.doc,eF,ea(eR,K(eT.line,0)));else eh(eA.doc,eQ,ea(eR,K(eT.line+1,0)))}var eG=an(eK.wrapper);var eC=0;function eO(eU){var eS=++eC;var eW=bI(eA,eU,true);if(!eW)return;if(!d9(eW,eB)){if(!eA.state.focused)bT(eA);eB=eW;eN(eW);var eV=bq(eK,eR);if(eW.line>=eV.to||eW.line<eV.from)setTimeout(ca(eA,function{if(eC==eS)eO(eU)}),150)}else{var eT=eU.clientY<eG.top?-20:eU.clientY>eG.bottom?20:0;if(eT)setTimeout(ca(eA,function{if(eC!=eS)return;eK.scroller.scrollTop+=eT;eO(eU)}),50)}}function eE(eS){eC=Infinity;bW(eS);dc(eA);cU(document,"mousemove",eH);cU(document,"mouseup",eD)}var eH=ca(eA,function(eS){if(!cg&&!ec(eS))eE(eS);else eO(eS)});var eD=ca(eA,eE);bl(document,"mousemove",eH);bl(document,"mouseup",eD)}function ev(eI,eE,eG,eH,eA){try{var ey=eE.clientX,ex=eE.clientY}catch(eE){return false}if(ey>=Math.floor(an(eI.display.gutters).right))return false;if(eH)bW(eE);var eF=eI.display;var eD=an(eF.lineDiv);if(ex>eD.bottom||!dQ(eI,eG))return bb(eE);ex-=eD.top-eF.viewOffset;for(var eB=0;eB<eI.options.gutters.length;++eB){var eC=eF.gutters.childNodes[eB];if(eC&&an(eC).right>=ey){var eJ=a6(eI.doc,ex);var ez=eI.options.gutters[eB];eA(eI,eG,eI,eJ,ez,eE);return bb(eE)}}}function cl(ex,ey){if(!dQ(ex,"gutterContextMenu"))return false;return ev(ex,ey,"gutterContextMenu",false,ah)}function j(ex,ey){return ev(ex,ey,"gutterClick",true,O)}var P=0;function aO(eD){var eF=this;if(ar(eF,eD)||(aG(eF.display,eD)||eF.options.onDragEvent&&eF.options.onDragEvent(eF,Y(eD))))return;bW(eD);if(cB)P=+new Date;var eE=bI(eF,eD,true),ex=eD.dataTransfer.files;if(!eE||S(eF))return;if(ex&&(ex.length&&(window.FileReader&&window.File))){var ez=ex.length,eH=Array(ez),ey=0;var eA=function(eK,eJ){var eI=new FileReader;eI.onload=function{eH[eJ]=eI.result;if(++ey==ez){eE=ea(eF.doc,eE);aL(eF.doc,{from:eE,to:eE,text:ay(eH.join("\n")),origin:"paste"},"around")}};eI.readAsText(eK)};for(var eB=0;eB<ez;++eB)eA(ex[eB],eB)}else{if(eF.state.draggingText&&!(dL(eE,eF.doc.sel.from)||dL(eF.doc.sel.to,eE))){eF.state.draggingText(eD);setTimeout(bP(dc,eF),20);return}try{var eH=eD.dataTransfer.getData("Text");if(eH){var eG=eF.doc.sel.from,eC=eF.doc.sel.to;bi(eF.doc,eE,eE);if(eF.state.draggingText)az(eF.doc,"",eG,eC,"paste");eF.replaceSelection(eH,null,"paste");dc(eF)}}catch(eD){}}}function I(ey,eA){if(cB&&(!ey.state.draggingText||+new Date-P<100)){c3(eA);return}if(ar(ey,eA)||aG(ey.display,eA))return;var ex=ey.getSelection;eA.dataTransfer.setData("Text",ex);if(eA.dataTransfer.setDragImage&&!ag){var ez=ek("img",null,null,"position:fixed; left: 0; top: 0;");ez.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(d2){ez.width=ez.height=1;ey.display.wrapper.appendChild(ez);ez._top=ez.offsetTop}eA.dataTransfer.setDragImage(ez,0,0);if(d2)ez.parentNode.removeChild(ez)}}function F(ex,ey){if(Math.abs(ex.doc.scrollTop-ey)<2)return;ex.doc.scrollTop=ey;if(!bJ)cC(ex,[],ey);if(ex.display.scroller.scrollTop!=ey)ex.display.scroller.scrollTop=ey;if(ex.display.scrollbarV.scrollTop!=ey)ex.display.scrollbarV.scrollTop=ey;if(bJ)cC(ex,[]);cV(ex,100)}function a4(ex,ez,ey){if(ey?ez==ex.doc.scrollLeft:Math.abs(ex.doc.scrollLeft-ez)<2)return;ez=Math.min(ez,ex.display.scroller.scrollWidth-ex.display.scroller.clientWidth);ex.doc.scrollLeft=ez;dg(ex);if(ex.display.scroller.scrollLeft!=ez)ex.display.scroller.scrollLeft=ez;if(ex.display.scrollbarH.scrollLeft!=ez)ex.display.scrollbarH.scrollLeft=ez}var dR=0,bB=null;if(cg)bB=-0.53;else if(bJ)bB=15;else if(ch)bB=-0.7;else if(ag)bB=-1/3;function b(eD,ey){var eG=ey.wheelDeltaX,eF=ey.wheelDeltaY;if(eG==null&&(ey.detail&&ey.axis==ey.HORIZONTAL_AXIS))eG=ey.detail;if(eF==null&&(ey.detail&&ey.axis==ey.VERTICAL_AXIS))eF=ey.detail;else if(eF==null)eF=ey.wheelDelta;var eA=eD.display,eC=eA.scroller;if(!(eG&&eC.scrollWidth>eC.clientWidth||eF&&eC.scrollHeight>eC.clientHeight))return;if(eF&&(br&&b9))for(var eE=ey.target;eE!=eC;eE=eE.parentNode)if(eE.lineObj){eD.display.currentWheelTarget=eE;break}if(eG&&(!bJ&&(!d2&&bB!=null))){if(eF)F(eD,Math.max(0,Math.min(eC.scrollTop+eF*bB,eC.scrollHeight-eC.clientHeight)));a4(eD,Math.max(0,Math.min(eC.scrollLeft+eG*bB,eC.scrollWidth-eC.clientWidth)));bW(ey);eA.wheelStartX=null;return}if(eF&&bB!=null){var ex=eF*bB;var eB=eD.doc.scrollTop,ez=eB+eA.wrapper.clientHeight;if(ex<0)eB=Math.max(0,eB+ex-50);else ez=Math.min(eD.doc.height,ez+ex+50);cC(eD,[],{top:eB,bottom:ez})}if(dR<20)if(eA.wheelStartX==null){eA.wheelStartX=eC.scrollLeft;eA.wheelStartY=eC.scrollTop;eA.wheelDX=eG;eA.wheelDY=eF;setTimeout(function{if(eA.wheelStartX==null)return;var eH=eC.scrollLeft-eA.wheelStartX;var eJ=eC.scrollTop-eA.wheelStartY;var eI=eJ&&(eA.wheelDY&&eJ/eA.wheelDY)||eH&&(eA.wheelDX&&eH/eA.wheelDX);eA.wheelStartX=eA.wheelStartY=null;if(!eI)return;bB=(bB*dR+eI)/(dR+1);++dR},200)}else{eA.wheelDX+=eG;eA.wheelDY+=eF}}function eg(ey,eB,ex){if(typeof eB=="string"){eB=de[eB];if(!eB)return false}if(ey.display.pollingFast&&bC(ey))ey.display.pollingFast=false;var eC=ey.doc,eA=eC.sel.shift,ez=false;try{if(S(ey))ey.state.suppressEdits=true;if(ex)eC.sel.shift=false;ez=eB(ey)!=bw}finally{eC.sel.shift=eA;ey.state.suppressEdits=false}return ez}function cs(ex){var ey=ex.state.keyMaps.slice(0);if(ex.options.extraKeys)ey.push(ex.options.extraKeys);ey.push(ex.options.keyMap);return ey}var Z;function dO(ex,eD){var ey=ei(ex.options.keyMap),eB=ey.auto;clearTimeout(Z);if(eB&&!dd(eD))Z=setTimeout(function{if(ei(ex.options.keyMap)==ey){ex.options.keyMap=eB.call?eB.call(null,ex):eB;eu(ex)}},50);var eA=dX(eD,true),eC=false;if(!eA)return false;var ez=cs(ex);if(eD.shiftKey)eC=g("Shift-"+eA,ez,function(eE){return eg(ex,eE,true)})||g(eA,ez,function(eE){if(typeof eE=="string"?/^go[A-Z]/.test(eE):eE.motion)return eg(ex,eE)});else eC=g(eA,ez,function(eE){return eg(ex,eE)});if(eC){bW(eD);k(ex);if(bF){eD.oldKeyCode=eD.keyCode;eD.keyCode=0}O(ex,"keyHandled",ex,eA,eD)}return eC}function cY(ex,eA,ey){var ez=g("'"+ey+"'",cs(ex),function(eB){return eg(ex,eB,true)});if(ez){bW(eA);k(ex);O(ex,"keyHandled",ex,"'"+ey+"'",eA)}return ez}function aN(ey){var ex=this;if(ar(ex,ey)||ex.options.onKeyEvent&&ex.options.onKeyEvent(ex,Y(ey)))return;if(ey.keyCode==16)ex.doc.sel.shift=false}var cn=null;function m(eA){var ex=this;if(!ex.state.focused)bT(ex);if(ar(ex,eA)||ex.options.onKeyEvent&&ex.options.onKeyEvent(ex,Y(eA)))return;if(cg&&eA.keyCode==27)eA.returnValue=false;var ey=eA.keyCode;ex.doc.sel.shift=ey==16||eA.shiftKey;var ez=dO(ex,eA);if(d2){cn=ez?ey:null;if(!ez&&(ey==88&&(!cf&&(br?eA.metaKey:eA.ctrlKey))))ex.replaceSelection("")}}function bQ(eB){var ex=this;if(ar(ex,eB)||ex.options.onKeyEvent&&ex.options.onKeyEvent(ex,Y(eB)))return;var eA=eB.keyCode,ey=eB.charCode;if(d2&&eA==cn){cn=null;bW(eB);return}if((d2&&(!eB.which||eB.which<10)||aH)&&dO(ex,eB))return;var ez=String.fromCharCode(ey==null?eA:ey);if(cY(ex,eB,ez))return;if(cB&&!bF)ex.display.inputHasSelection=null;w(ex)}function bT(ex){if(ex.options.readOnly=="nocursor")return;if(!ex.state.focused){ah(ex,"focus",ex);ex.state.focused=true;if(ex.display.wrapper.className.search(/\bCodeMirror-focused\b/)==-1)ex.display.wrapper.className+=" CodeMirror-focused";if(!ex.curOp){dV(ex,true);if(b9)setTimeout(bP(dV,ex,true),0)}}aS(ex);k(ex)}function au(ex){if(ex.state.focused){ah(ex,"blur",ex);ex.state.focused=false;ex.display.wrapper.className=ex.display.wrapper.className.replace(" CodeMirror-focused","")}clearInterval(ex.display.blinker);setTimeout(function{if(!ex.state.focused)ex.doc.sel.shift=false},150)}var d6;function ad(eH,eC){if(ar(eH,eC,"contextmenu"))return;var eE=eH.display,ey=eH.doc.sel;if(aG(eE,eC)||cl(eH,eC))return;var eG=bI(eH,eC),ex=eE.scroller.scrollTop;if(!eG||d2)return;var eB=eH.options.resetSelectionOnContextMenu;if(eB&&(d9(ey.from,ey.to)||(dL(eG,ey.from)||!dL(eG,ey.to))))ca(eH,bi)(eH.doc,eG,eG);var eD=eE.input.style.cssText;eE.inputDiv.style.position="absolute";eE.input.style.cssText="position:fixed; width: 30px; height: 30px; top: "+(eC.clientY-5)+"px; left: "+(eC.clientX-5)+"px; z-index: 1000; background: transparent; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);";dc(eH);dV(eH,true);if(d9(ey.from,ey.to))eE.input.value=eE.prevInput=" ";function eA{if(eE.input.selectionStart!=null){var eI=eE.input.value="\u200b"+(d9(ey.from,ey.to)?"":eE.input.value);eE.prevInput="\u200b";eE.input.selectionStart=1;eE.input.selectionEnd=eI.length}}function eF{eE.inputDiv.style.position="relative";eE.input.style.cssText=eD;if(bF)eE.scrollbarV.scrollTop=eE.scroller.scrollTop=ex;aS(eH);if(eE.input.selectionStart!=null){if(!cg||bF)eA;clearTimeout(d6);var eI=0,eJ=function{if(eE.prevInput=="\u200b"&&eE.input.selectionStart==0)ca(eH,de.selectAll)(eH);else if(eI++<10)d6=setTimeout(eJ,500);else dV(eH)};d6=setTimeout(eJ,200)}}if(cg&&!bF)eA;if(bY){c3(eC);var ez=function{cU(window,"mouseup",ez);setTimeout(eF,20)};bl(window,"mouseup",ez)}else setTimeout(eF,50)}var b6=B.changeEnd=function(ex){if(!ex.text)return ex.to;return K(ex.from.line+ex.text.length-1,d8(ex.text).length+(ex.text.length==1?ex.from.ch:0))};function df(eB,eD,eC){if(!dL(eD.from,eC))return ea(eB,eC);var eA=eD.text.length-1-(eD.to.line-eD.from.line);if(eC.line>eD.to.line+eA){var ez=eC.line-eA,ey=eB.first+eB.size-1;if(ez>ey)return K(ey,dK(eB,ey).text.length);return dY(eC,dK(eB,ez).text.length)}if(eC.line==eD.to.line+eA)return dY(eC,d8(eD.text).length+(eD.text.length==1?eD.from.ch:0)+dK(eB,eD.to.line).text.length-eD.to.ch);var ex=eC.line-eD.from.line;return dY(eC,eD.text[ex].length+(ex?0:eD.from.ch))}function dP(ey,eB,ez){if(ez&&typeof ez=="object")return{anchor:df(ey,eB,ez.anchor),head:df(ey,eB,ez.head)};if(ez=="start")return{anchor:eB.from,head:eB.from};var ex=b6(eB);if(ez=="around")return{anchor:eB.from,head:ex};if(ez=="end")return{anchor:ex,head:ex};var eA=function(eE){if(dL(eE,eB.from))return eE;if(!dL(eB.to,eE))return ex;var eC=eE.line+eB.text.length-(eB.to.line-eB.from.line)-1,eD=eE.ch;if(eE.line==eB.to.line)eD+=ex.ch-eB.to.ch;return K(eC,eD)};return{anchor:eA(ey.sel.anchor),head:eA(ey.sel.head)}}function cH(ey,eA,ez){var ex={canceled:false,from:eA.from,to:eA.to,text:eA.text,origin:eA.origin,cancel:function{this.canceled=true}};if(ez)ex.update=function(eE,eD,eC,eB){if(eE)this.from=ea(ey,eE);if(eD)this.to=ea(ey,eD);if(eC)this.text=eC;if(eB!==undefined)this.origin=eB};ah(ey,"beforeChange",ey,ex);if(ey.cm)ah(ey.cm,"beforeChange",ey.cm,ex);if(ex.canceled)return null;return{from:ex.from,to:ex.to,text:ex.text,origin:ex.origin}}function aL(eA,eC,eB,ez){if(eA.cm){if(!eA.cm.curOp)return ca(eA.cm,aL)(eA,eC,eB,ez);if(eA.cm.state.suppressEdits)return}if(dQ(eA,"beforeChange")||eA.cm&&dQ(eA.cm,"beforeChange")){eC=cH(eA,eC,true);if(!eC)return}var ey=er&&(!ez&&bX(eA,eC.from,eC.to));if(ey){for(var ex=ey.length-1;ex>=1;--ex)ap(eA,{from:ey[ex].from,to:ey[ex].to,text:[""]});if(ey.length)ap(eA,{from:ey[0].from,to:ey[0].to,text:eC.text},eB)}else ap(eA,eC,eB)}function ap(ez,eB,eA){if(eB.text.length==1&&(eB.text[0]==""&&d9(eB.from,eB.to)))return;var ey=dP(ez,eB,eA);dj(ez,eB,ey,ez.cm?ez.cm.curOp.id:NaN);cT(ez,eB,ey,cZ(ez,eB));var ex=[];cO(ez,function(eD,eC){if(!eC&&cm(ex,eD.history)==-1){cA(eD.history,eB);ex.push(eD.history)}cT(eD,eB,null,cZ(eD,eB))})}function bt(eG,eD){if(eG.cm&&eG.cm.state.suppressEdits)return;var eC=eG.history;var ey=(eD=="undo"?eC.done:eC.undone).pop;if(!ey)return;var eE={changes:[],anchorBefore:ey.anchorAfter,headBefore:ey.headAfter,anchorAfter:ey.anchorBefore,headAfter:ey.headBefore,generation:eC.generation};(eD=="undo"?eC.undone:eC.done).push(eE);eC.generation=ey.generation||++eC.maxGeneration;var ez=dQ(eG,"beforeChange")||eG.cm&&dQ(eG.cm,"beforeChange");for(var eA=ey.changes.length-1;eA>=0;--eA){var eF=ey.changes[eA];eF.origin=eD;if(ez&&!cH(eG,eF,false)){(eD=="undo"?eC.done:eC.undone).length=0;return}eE.changes.push(ct(eG,eF));var ex=eA?dP(eG,eF,null):{anchor:ey.anchorBefore,head:ey.headBefore};cT(eG,eF,ex,cQ(eG,eF));var eB=[];cO(eG,function(eI,eH){if(!eH&&cm(eB,eI.history)==-1){cA(eI.history,eF);eB.push(eI.history)}cT(eI,eF,null,cQ(eI,eF))})}}function dS(ex,ez){function ey(eA){return K(eA.line+ez,eA.ch)}ex.first+=ez;if(ex.cm)Q(ex.cm,ex.first,ex.first,ez);ex.sel.head=ey(ex.sel.head);ex.sel.anchor=ey(ex.sel.anchor);ex.sel.from=ey(ex.sel.from);ex.sel.to=ey(ex.sel.to)}function cT(eB,eC,eA,ey){if(eB.cm&&!eB.cm.curOp)return ca(eB.cm,cT)(eB,eC,eA,ey);if(eC.to.line<eB.first){dS(eB,eC.text.length-1-(eC.to.line-eC.from.line));return}if(eC.from.line>eB.lastLine)return;if(eC.from.line<eB.first){var ex=eC.text.length-1-(eB.first-eC.from.line);dS(eB,ex);eC={from:K(eB.first,0),to:K(eC.to.line+ex,eC.to.ch),text:[d8(eC.text)],origin:eC.origin}}var ez=eB.lastLine;if(eC.to.line>ez)eC={from:eC.from,to:K(ez,dK(eB,ez).text.length),text:[eC.text[0]],origin:eC.origin};eC.removed=em(eB,eC.from,eC.to);if(!eA)eA=dP(eB,eC,null);if(eB.cm)al(eB.cm,eC,ey,eA);else d3(eB,eC,ey,eA)}function al(eH,eD,eA,ex){var eG=eH.doc,eC=eH.display,eE=eD.from,eF=eD.to;var ey=false,ez=eE.line;if(!eH.options.lineWrapping){ez=bd(u(eG,dK(eG,eE.line)));eG.iter(ez,eF.line+1,function(eK){if(eK==eC.maxLine){ey=true;return true}})}if(!dL(eG.sel.head,eD.from)&&!dL(eD.to,eG.sel.head))eH.curOp.cursorActivity=true;d3(eG,eD,eA,ex,aJ(eH));if(!eH.options.lineWrapping){eG.iter(ez,eE.line+eD.text.length,function(eL){var eK=c1(eG,eL);if(eK>eC.maxLineLength){eC.maxLine=eL;eC.maxLineLength=eK;eC.maxLineChanged=true;ey=false}});if(ey)eH.curOp.updateMaxLine=true}eG.frontier=Math.min(eG.frontier,eE.line);cV(eH,400);var eJ=eD.text.length-(eF.line-eE.line)-1;Q(eH,eE.line,eF.line+1,eJ);if(dQ(eH,"change")){var eB={from:eE,to:eF,text:eD.text,removed:eD.removed,origin:eD.origin};if(eH.curOp.textChanged){for(var eI=eH.curOp.textChanged;eI.next;eI=eI.next);eI.next=eB}else eH.curOp.textChanged=eB}}function az(eA,ez,eC,eB,ex){if(!eB)eB=eC;if(dL(eB,eC)){var ey=eB;eB=eC;eC=ey}if(typeof ez=="string")ez=ay(ez);aL(eA,{from:eC,to:eB,text:ez,origin:ex},null)}function K(ex,ey){if(!(this instanceof K))return new K(ex,ey);this.line=ex;this.ch=ey}B.Pos=K;function d9(ey,ex){return ey.line==ex.line&&ey.ch==ex.ch}function dL(ey,ex){return ey.line<ex.line||ey.line==ex.line&&ey.ch<ex.ch}function bA(ey,ex){return ey.line-ex.line||ey.ch-ex.ch}function bD(ex){return K(ex.line,ex.ch)}function cc(ex,ey){return Math.max(ex.first,Math.min(ey,ex.first+ex.size-1))}function ea(ey,ez){if(ez.line<ey.first)return K(ey.first,0);var ex=ey.first+ey.size-1;if(ez.line>ex)return K(ex,dK(ey,ex).text.length);return dY(ez,dK(ey,ez.line).text.length)}function dY(ez,ey){var ex=ez.ch;if(ex==null||ex>ey)return K(ez.line,ey);else if(ex<0)return K(ez.line,0);else return ez}function bu(ey,ex){return ex>=ey.first&&ex<ey.first+ey.size}function eh(eB,eC,ex,ey){if(eB.sel.shift||eB.sel.extend){var eA=eB.sel.anchor;if(ex){var ez=dL(eC,eA);if(ez!=dL(ex,eA)){eA=eC;eC=ex}else if(ez!=dL(eC,ex))eC=ex}bi(eB,eA,eC,ey)}else bi(eB,eC,ex||eC,ey);if(eB.cm)eB.cm.curOp.userSelChange=true}function c(eA,ex,ey){var ez={anchor:ex,head:ey};ah(eA,"beforeSelectionChange",eA,ez);if(eA.cm)ah(eA.cm,"beforeSelectionChange",eA.cm,ez);ez.anchor=ea(eA,ez.anchor);ez.head=ea(eA,ez.head);return ez}function bi(eE,eB,eC,ez,ey){if(!ey&&dQ(eE,"beforeSelectionChange")||eE.cm&&dQ(eE.cm,"beforeSelectionChange")){var eA=c(eE,eB,eC);eC=eA.head;eB=eA.anchor}var eD=eE.sel;eD.goalColumn=null;if(ez==null)ez=dL(eC,eD.head)?-1:1;if(ey||!d9(eB,eD.anchor))eB=bj(eE,eB,ez,ey!="push");if(ey||!d9(eC,eD.head))eC=bj(eE,eC,ez,ey!="push");if(d9(eD.anchor,eB)&&d9(eD.head,eC))return;eD.anchor=eB;eD.head=eC;var ex=dL(eC,eB);eD.from=ex?eC:eB;eD.to=ex?eB:eC;if(eE.cm)eE.cm.curOp.updateInput=eE.cm.curOp.selectionChanged=eE.cm.curOp.cursorActivity=true;O(eE,"cursorActivity",eE)}function c8(ex){bi(ex.doc,ex.doc.sel.from,ex.doc.sel.to,null,"push")}function bj(eG,eF,eC,eD){var eH=false,ez=eF;var eA=eC||1;eG.cantEdit=false;search:for{var eI=dK(eG,ez.line);if(eI.markedSpans)for(var eB=0;eB<eI.markedSpans.length;++eB){var ex=eI.markedSpans[eB],ey=ex.marker;if((ex.from==null||(ey.inclusiveLeft?ex.from<=ez.ch:ex.from<ez.ch))&&(ex.to==null||(ey.inclusiveRight?ex.to>=ez.ch:ex.to>ez.ch))){if(eD){ah(ey,"beforeCursorEnter");if(ey.explicitlyCleared)if(!eI.markedSpans)break;else{--eB;continue}}if(!ey.atomic)continue;var eE=ey.find[eA<0?"from":"to"];if(d9(eE,ez)){eE.ch+=eA;if(eE.ch<0)if(eE.line>eG.first)eE=ea(eG,K(eE.line-1));else eE=null;else if(eE.ch>eI.text.length)if(eE.line<eG.first+eG.size-1)eE=K(eE.line+1,0);else eE=null;if(!eE){if(eH){if(!eD)return bj(eG,eF,eC,true);eG.cantEdit=true;return K(eG.first,0)}eH=true;eE=eF;eA=-eA}}ez=eE;continue search}}return ez}}function ae(ey){var eB=x(ey,ey.doc.sel.head,null,ey.options.cursorScrollMargin);if(!ey.state.focused)return;var eC=ey.display,ez=an(eC.sizer),ex=null;if(eB.top+ez.top<0)ex=true;else if(eB.bottom+ez.top>(window.innerHeight||document.documentElement.clientHeight))ex=false;if(ex!=null&&!dZ){var eA=ek("div","\u200b",null,"position: absolute; top: "+(eB.top-eC.viewOffset)+"px; height: "+(eB.bottom-eB.top+aP)+"px; left: "+eB.left+"px; width: 2px;");ey.display.lineSpace.appendChild(eA);eA.scrollIntoView(ex);ey.display.lineSpace.removeChild(eA)}}function x(eG,eE,eB,eA){if(eA==null)eA=0;for{var eC=false,eF=cI(eG,eE);var ex=!eB||eB==eE?eF:cI(eG,eB);var ez=A(eG,Math.min(eF.left,ex.left),Math.min(eF.top,ex.top)-eA,Math.max(eF.left,ex.left),Math.max(eF.bottom,ex.bottom)+eA);var eD=eG.doc.scrollTop,ey=eG.doc.scrollLeft;if(ez.scrollTop!=null){F(eG,ez.scrollTop);if(Math.abs(eG.doc.scrollTop-eD)>1)eC=true}if(ez.scrollLeft!=null){a4(eG,ez.scrollLeft);if(Math.abs(eG.doc.scrollLeft-ey)>1)eC=true}if(!eC)return eF}}function z(ex,ez,eB,ey,eA){var eC=A(ex,ez,eB,ey,eA);if(eC.scrollTop!=null)F(ex,eC.scrollTop);if(eC.scrollLeft!=null)a4(ex,eC.scrollLeft)}function A(eD,eL,eA,eK,ez){var eI=eD.display,eH=aw(eD.display);if(eA<0)eA=0;var ey=eI.scroller.clientHeight-aP,eG=eI.scroller.scrollTop,eF={};var eN=eD.doc.height+a8(eI);var eO=eA<eH,eJ=ez>eN-eH;if(eA<eG)eF.scrollTop=eO?0:eA;else if(ez>eG+ey){var eE=Math.min(eA,(eJ?eN:ez)-ey);if(eE!=eG)eF.scrollTop=eE}var eC=eI.scroller.clientWidth-aP,ex=eI.scroller.scrollLeft;eL+=eI.gutters.offsetWidth;eK+=eI.gutters.offsetWidth;var eB=eI.gutters.offsetWidth;var eM=eL<eB+10;if(eL<ex+eB||eM){if(eM)eL=0;eF.scrollLeft=Math.max(0,eL-10-eB)}else if(eK>eC+ex-3)eF.scrollLeft=eK+10-eC;return eF}function y(ex,ez,ey){ex.curOp.updateScrollPos={scrollLeft:ez==null?ex.doc.scrollLeft:ez,scrollTop:ey==null?ex.doc.scrollTop:ey}}function b1(ey,eA,ez){var eB=ey.curOp.updateScrollPos||(ey.curOp.updateScrollPos={scrollLeft:ey.doc.scrollLeft,scrollTop:ey.doc.scrollTop});var ex=ey.display.scroller;eB.scrollTop=Math.max(0,Math.min(ex.scrollHeight-ex.clientHeight,eB.scrollTop+ez));eB.scrollLeft=Math.max(0,Math.min(ex.scrollWidth-ex.clientWidth,eB.scrollLeft+eA))}function N(eJ,eA,eI,ez){var eH=eJ.doc;if(eI==null)eI="add";if(eI=="smart")if(!eJ.doc.mode.indent)eI="prev";else var ey=cx(eJ,eA);var eD=eJ.options.tabSize;var eK=dK(eH,eA),eC=bh(eK.text,null,eD);var ex=eK.text.match(/^\s*/)[0],eF;if(!ez&&!/\S/.test(eK.text)){eF=0;eI="not"}else if(eI=="smart"){eF=eJ.doc.mode.indent(ey,eK.text.slice(ex.length),eK.text);if(eF==bw){if(!ez)return;eI="prev"}}if(eI=="prev")if(eA>eH.first)eF=bh(dK(eH,eA-1).text,null,eD);else eF=0;else if(eI=="add")eF=eC+eJ.options.indentUnit;else if(eI=="subtract")eF=eC-eJ.options.indentUnit;else if(typeof eI=="number")eF=eC+eI;eF=Math.max(0,eF);var eG="",eE=0;if(eJ.options.indentWithTabs)for(var eB=Math.floor(eF/eD);eB;--eB){eE+=eD;eG+="\t"}if(eE<eF)eG+=bK(eF-eE);if(eG!=ex)az(eJ.doc,eG,K(eA,0),K(eA,ex.length),"+input");else if(eH.sel.head.line==eA&&eH.sel.head.ch<ex.length)bi(eH,K(eA,ex.length),K(eA,ex.length),1);eK.stateAfter=null}function da(ex,ez,eC){var eB=ez,ey=ez,eA=ex.doc;if(typeof ez=="number")ey=dK(eA,cc(eA,ez));else eB=bd(ez);if(eB==null)return null;if(eC(ey,eB))Q(ex,eB,eB+1);else return null;return ey}function a0(eO,eA,eI,eH,eC){var eF=eA.line,eG=eA.ch,eN=eI;var ex=dK(eO,eF);var eL=true;function eM{var eP=eF+eI;if(eP<eO.first||eP>=eO.first+eO.size)return eL=false;eF=eP;return ex=dK(eO,eP)}function eK(eQ){var eP=(eC?q:R)(ex,eG,eI,true);if(eP==null)if(!eQ&&eM)if(eC)eG=(eI<0?b5:bV)(ex);else eG=eI<0?ex.text.length:0;else return eL=false;else eG=eP;return true}if(eH=="char")eK;else if(eH=="column")eK(true);else if(eH=="word"||eH=="group"){var eJ=null,eD=eH=="group";for(var eB=true;;eB=false){if(eI<0&&!eK(!eB))break;var ey=ex.text.charAt(eG)||"\n";var ez=bS(ey)?"w":!eD?null:/\s/.test(ey)?null:"p";if(eJ&&eJ!=ez){if(eI<0){eI=1;eK}break}if(ez)eJ=ez;if(eI>0&&!eK(!eB))break}}var eE=bj(eO,K(eF,eG),eN,true);if(!eL)eE.hitSide=true;return eE}function aW(eF,eA,ex,eE){var eD=eF.doc,eC=eA.left,eB;if(eE=="page"){var ez=Math.min(eF.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);eB=eA.top+ex*(ez-(ex<0?1.5:0.5)*aw(eF.display))}else if(eE=="line")eB=ex>0?eA.bottom+3:eA.top-3;for{var ey=ee(eF,eC,eB);if(!ey.outside)break;if(ex<0?eB<=0:eB>=eD.height){ey.hitSide=true;break}eB+=ex*5}return ey}function ab(eA,eC){var eB=eC.ch,ez=eC.ch;if(eA){if((eC.xRel<0||ez==eA.length)&&eB)--eB;else++ez;var ey=eA.charAt(eB);var ex=bS(ey)?bS:/\s/.test(ey)?function(eD){return/\s/.test(eD)}:function(eD){return!/\s/.test(eD)&&!bS(eD)};while(eB>0&&ex(eA.charAt(eB-1)))--eB;while(ez<eA.length&&ex(eA.charAt(ez)))++ez}return{from:K(eC.line,eB),to:K(eC.line,ez)}}function aR(ex,ey){eh(ex.doc,K(ey,0),ea(ex.doc,K(ey+1,0)))}B.prototype={constructor:B,focus:function{window.focus;dc(this);w(this)},setOption:function(ez,eA){var ey=this.options,ex=ey[ez];if(ey[ez]==eA&&ez!="mode")return;ey[ez]=eA;if(aK.hasOwnProperty(ez))ca(this,aK[ez])(this,eA,ex)},getOption:function(ex){return this.options[ex]},getDoc:function{return this.doc},addKeyMap:function(ey,ex){this.state.keyMaps[ex?"push":"unshift"](ey)},removeKeyMap:function(ey){var ez=this.state.keyMaps;for(var ex=0;ex<ez.length;++ex)if(ez[ex]==ey||typeof ez[ex]!="string"&&ez[ex].name==ey){ez.splice(ex,1);return true}},addOverlay:ca(null,function(ex,ey){var ez=ex.token?ex:B.getMode(this.options,ex);if(ez.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:ez,modeSpec:ex,opaque:ey&&ey.opaque});this.state.modeGen++;Q(this)}),removeOverlay:ca(null,function(ex){var ez=this.state.overlays;for(var ey=0;ey<ez.length;++ey){var eA=ez[ey].modeSpec;if(eA==ex||typeof ex=="string"&&eA.name==ex){ez.splice(ey,1);this.state.modeGen++;Q(this);return}}}),indentLine:ca(null,function(ez,ex,ey){if(typeof ex!="string"&&typeof ex!="number")if(ex==null)ex=this.options.smartIndent?"smart":"prev";else ex=ex?"add":"subtract";if(bu(this.doc,ez))N(this,ez,ex,ey)}),indentSelection:ca(null,function(ey){var ez=this.doc.sel;if(d9(ez.from,ez.to))return N(this,ez.from.line,ey,true);var eA=ez.to.line-(ez.to.ch?0:1);for(var ex=ez.from.line;ex<=eA;++ex)N(this,ex,ey)}),getTokenAt:function(eE,ey){var eB=this.doc;eE=ea(eB,eE);var eA=cx(this,eE.line,ey),eD=this.doc.mode;var ex=dK(eB,eE.line);var eC=new dt(ex.text,this.options.tabSize);while(eC.pos<eE.ch&&!eC.eol){eC.start=eC.pos;var ez=eD.token(eC,eA)}return{start:eC.start,end:eC.pos,string:eC.current,className:ez||null,type:ez||null,state:eA}},getTokenTypeAt:function(eC){eC=ea(this.doc,eC);var ez=ce(this,dK(this.doc,eC.line));var eA=0,eB=(ez.length-1)/2,ey=eC.ch;if(ey==0)return ez[2];for{var ex=eA+eB>>1;if((ex?ez[ex*2-1]:0)>=ey)eB=ex;else if(ez[ex*2+1]<ey)eA=ex+1;else return ez[ex*2+2]}},getModeAt:function(ey){var ex=this.doc.mode;if(!ex.innerMode)return ex;return B.innerMode(ex,this.getTokenAt(ey).state).mode},getHelper:function(ey,ex){return this.getHelpers(ey,ex)[0]},getHelpers:function(eE,ez){var eA=[];if(!dT.hasOwnProperty(ez))return dT;var ex=dT[ez],eD=this.getModeAt(eE);if(typeof eD[ez]=="string"){if(ex[eD[ez]])eA.push(ex[eD[ez]])}else if(eD[ez])for(var ey=0;ey<eD[ez].length;ey++){var eC=ex[eD[ez][ey]];if(eC)eA.push(eC)}else if(eD.helperType&&ex[eD.helperType])eA.push(ex[eD.helperType]);else if(ex[eD.name])eA.push(ex[eD.name]);for(var ey=0;ey<ex._global.length;ey++){var eB=ex._global[ey];if(eB.pred(eD,this)&&cm(eA,eB.val)==-1)eA.push(eB.val)}return eA},getStateAfter:function(ey,ex){var ez=this.doc;ey=cc(ez,ey==null?ez.first+ez.size-1:ey);return cx(this,ey+1,ex)},cursorCoords:function(eA,ey){var ez,ex=this.doc.sel;if(eA==null)ez=ex.head;else if(typeof eA=="object")ez=ea(this.doc,eA);else ez=eA?ex.from:ex.to;return cI(this,ez,ey||"page")},charCoords:function(ey,ex){return b0(this,ea(this.doc,ey),ex||"page")},coordsChar:function(ex,ey){ex=et(this,ex,ey||"page");return ee(this,ex.left,ex.top)},lineAtHeight:function(ex,ey){ex=et(this,{top:ex,left:0},ey||"page").top;return a6(this.doc,ex+this.display.viewOffset)},heightAtLine:function(ey,eB){var ex=false,eA=this.doc.first+this.doc.size-1;if(ey<this.doc.first)ey=this.doc.first;else if(ey>eA){ey=eA;ex=true}var ez=dK(this.doc,ey);return dq(this,dK(this.doc,ey),{top:0,left:0},eB||"page").top+(ex?ez.height:0)},defaultTextHeight:function{return aw(this.display)},defaultCharWidth:function{return cz(this.display)},setGutterMarker:ca(null,function(ex,ey,ez){return da(this,ex,function(eA){var eB=eA.gutterMarkers||(eA.gutterMarkers={});eB[ey]=ez;if(!ez&&du(eB))eA.gutterMarkers=null;return true})}),clearGutter:ca(null,function(ez){var ex=this,eA=ex.doc,ey=eA.first;eA.iter(function(eB){if(eB.gutterMarkers&&eB.gutterMarkers[ez]){eB.gutterMarkers[ez]=null;Q(ex,ey,ey+1);if(du(eB.gutterMarkers))eB.gutterMarkers=null}++ey})}),addLineClass:ca(null,function(ez,ey,ex){return da(this,ez,function(eA){var eB=ey=="text"?"textClass":ey=="background"?"bgClass":"wrapClass";if(!eA[eB])eA[eB]=ex;else if((new RegExp("(?:^|\\s)"+ex+"(?:$|\\s)")).test(eA[eB]))return false;else eA[eB]+=" "+ex;return true})}),removeLineClass:ca(null,function(ez,ey,ex){return da(this,ez,function(eB){var eE=ey=="text"?"textClass":ey=="background"?"bgClass":"wrapClass";var eD=eB[eE];if(!eD)return false;else if(ex==null)eB[eE]=null;else{var eC=eD.match(new RegExp("(?:^|\\s+)"+ex+"(?:$|\\s+)"));if(!eC)return false;var eA=eC.index+eC[0].length;eB[eE]=eD.slice(0,eC.index)+(!eC.index||eA==eD.length?"":" ")+eD.slice(eA)||null}return true})}),addLineWidget:ca(null,function(ez,ey,ex){return a7(this,ez,ey,ex)}),removeLineWidget:function(ex){ex.clear},lineInfo:function(ex){if(typeof ex=="number"){if(!bu(this.doc,ex))return null;var ey=ex;ex=dK(this.doc,ex);if(!ex)return null}else{var ey=bd(ex);if(ey==null)return null}return{line:ey,handle:ex,text:ex.text,gutterMarkers:ex.gutterMarkers,textClass:ex.textClass,bgClass:ex.bgClass,wrapClass:ex.wrapClass,widgets:ex.widgets}},getViewport:function{return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(eC,ez,eE,eA,eG){var eB=this.display;eC=cI(this,ea(this.doc,eC));var eD=eC.bottom,ey=eC.left;ez.style.position="absolute";eB.sizer.appendChild(ez);if(eA=="over")eD=eC.top;else if(eA=="above"||eA=="near"){var ex=Math.max(eB.wrapper.clientHeight,this.doc.height),eF=Math.max(eB.sizer.clientWidth,eB.lineSpace.clientWidth);if((eA=="above"||eC.bottom+ez.offsetHeight>ex)&&eC.top>ez.offsetHeight)eD=eC.top-ez.offsetHeight;else if(eC.bottom+ez.offsetHeight<=ex)eD=eC.bottom;if(ey+ez.offsetWidth>eF)ey=eF-ez.offsetWidth}ez.style.top=eD+"px";ez.style.left=ez.style.right="";if(eG=="right"){ey=eB.sizer.clientWidth-ez.offsetWidth;ez.style.right="0px"}else{if(eG=="left")ey=0;else if(eG=="middle")ey=(eB.sizer.clientWidth-ez.offsetWidth)/2;ez.style.left=ey+"px"}if(eE)z(this,ey,eD,ey+ez.offsetWidth,eD+ez.offsetHeight)},triggerOnKeyDown:ca(null,m),triggerOnKeyPress:ca(null,bQ),triggerOnKeyUp:ca(null,aN),execCommand:function(ex){if(de.hasOwnProperty(ex))return de[ex](this)},findPosH:function(eD,eA,eB,ey){var ex=1;if(eA<0){ex=-1;eA=-eA}for(var ez=0,eC=ea(this.doc,eD);ez<eA;++ez){eC=a0(this.doc,eC,ex,eB,ey);if(eC.hitSide)break}return eC},moveH:ca(null,function(ex,ey){var ez=this.doc.sel,eA;if(ez.shift||(ez.extend||d9(ez.from,ez.to)))eA=a0(this.doc,ez.head,ex,ey,this.options.rtlMoveVisually);else eA=ex<0?ez.from:ez.to;eh(this.doc,eA,eA,ex)}),deleteH:ca(null,function(ex,ey){var ez=this.doc.sel;if(!d9(ez.from,ez.to))az(this.doc,"",ez.from,ez.to,"+delete");else az(this.doc,"",ez.from,a0(this.doc,ez.head,ex,ey,false),"+delete");this.curOp.userSelChange=true}),findPosV:function(eC,ez,eD,eF){var ex=1,eB=eF;if(ez<0){ex=-1;ez=-ez}for(var ey=0,eE=ea(this.doc,eC);ey<ez;++ey){var eA=cI(this,eE,"div");if(eB==null)eB=eA.left;else eA.left=eB;eE=aW(this,eA,ex,eD);if(eE.hitSide)break}return eE},moveV:ca(null,function(ey,ez){var eA=this.doc.sel,eB,ex;if(eA.shift||(eA.extend||d9(eA.from,eA.to))){var eC=cI(this,eA.head,"div");if(eA.goalColumn!=null)eC.left=eA.goalColumn;eB=aW(this,eC,ey,ez);if(ez=="page")b1(this,0,b0(this,eB,"div").top-eC.top);ex=eC.left}else eB=ey<0?eA.from:eA.to;eh(this.doc,eB,eB,ey);if(ex!=null)eA.goalColumn=ex}),toggleOverwrite:function(ex){if(ex!=null&&ex==this.state.overwrite)return;if(this.state.overwrite=!this.state.overwrite)this.display.cursor.className+=" CodeMirror-overwrite";else this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite","")},hasFocus:function{return document.activeElement==this.display.input},scrollTo:ca(null,function(ex,ey){y(this,ex,ey)}),getScrollInfo:function{var ex=this.display.scroller,ey=aP;return{left:ex.scrollLeft,top:ex.scrollTop,height:ex.scrollHeight-ey,width:ex.scrollWidth-ey,clientHeight:ex.clientHeight-ey,clientWidth:ex.clientWidth-ey}},scrollIntoView:ca(null,function(ey,eA){if(ey==null)ey={from:this.doc.sel.head,to:null};else if(typeof ey=="number")ey={from:K(ey,0),to:null};else if(ey.from==null)ey={from:ey,to:null};if(!ey.to)ey.to=ey.from;if(!eA)eA=0;var ez=ey;if(ey.from.line!=null){this.curOp.scrollToPos={from:ey.from,to:ey.to,margin:eA};ez={from:cI(this,ey.from),to:cI(this,ey.to)}}var ex=A(this,Math.min(ez.from.left,ez.to.left),Math.min(ez.from.top,ez.to.top)-eA,Math.max(ez.from.right,ez.to.right),Math.max(ez.from.bottom,ez.to.bottom)+eA);y(this,ex.scrollLeft,ex.scrollTop)}),setSize:ca(null,function(ez,ex){function ey(eA){return typeof eA=="number"||/^\d+$/.test(String(eA))?eA+"px":eA}if(ez!=null)this.display.wrapper.style.width=ey(ez);if(ex!=null)this.display.wrapper.style.height=ey(ex);if(this.options.lineWrapping)this.display.measureLineCache.length=this.display.measureLineCachePos=0;this.curOp.forceUpdate=true;ah(this,"refresh",this)}),operation:function(ex){return b2(this,ex)},refresh:ca(null,function{var ex=this.display.cachedTextHeight;T(this);y(this,this.doc.scrollLeft,this.doc.scrollTop);Q(this);if(ex==null||Math.abs(ex-aw(this.display))>0.5)L(this);ah(this,"refresh",this)}),swapDoc:ca(null,function(ey){var ex=this.doc;ex.cm=null;cR(this,ey);T(this);dV(this,true);y(this,ey.scrollLeft,ey.scrollTop);O(this,"swapDoc",this,ex);return ex}),getInputField:function{return this.display.input},getWrapperElement:function{return this.display.wrapper},getScrollerElement:function{return this.display.scroller},getGutterElement:function{return this.display.gutters}};a1(B);var aK=B.optionHandlers={};var dB=B.defaults={};function o(ex,eA,ez,ey){B.defaults[ex]=eA;if(ez)aK[ex]=ey?function(eB,eD,eC){if(eC!=bx)ez(eB,eD,eC)}:ez}var bx=B.Init={toString:function{return"CodeMirror.Init"}};o("value","",function(ex,ey){ex.setValue(ey)},true);o("mode",null,function(ex,ey){ex.doc.modeOption=ey;aX(ex)},true);o("indentUnit",2,aX,true);o("indentWithTabs",false);o("smartIndent",true);o("tabSize",4,function(ex){c0(ex);T(ex);Q(ex)},true);o("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(ex,ey){ex.options.specialChars=new RegExp(ey.source+(ey.test("\t")?"":"|\t"),"g");ex.refresh},true);o("specialCharPlaceholder",dI,function(ex){ex.refresh},true);o("electricChars",true);o("rtlMoveVisually",!ao);o("wholeLineUpdateBefore",true);o("theme","default",function(ex){b3(ex);cu(ex)},true);o("keyMap","default",eu);o("extraKeys",null);o("onKeyEvent",null);o("onDragEvent",null);o("lineWrapping",false,dk,true);o("gutters",[],function(ex){bz(ex.options);cu(ex)},true);o("fixedGutter",true,function(ex,ey){ex.display.gutters.style.left=ey?cK(ex.display)+"px":"0";ex.refresh},true);o("coverGutterNextToScrollbar",false,dx,true);o("lineNumbers",false,function(ex){bz(ex.options);cu(ex)},true);o("firstLineNumber",1,cu,true);o("lineNumberFormatter",function(ex){return ex},cu,true);o("showCursorWhenSelecting",false,a3,true);o("resetSelectionOnContextMenu",true);o("readOnly",false,function(ex,ey){if(ey=="nocursor"){au(ex);ex.display.input.blur;ex.display.disabled=true}else{ex.display.disabled=false;if(!ey)dV(ex,true)}});o("disableInput",false,function(ex,ey){if(!ey)dV(ex,true)},true);o("dragDrop",true);o("cursorBlinkRate",530);o("cursorScrollMargin",0);o("cursorHeight",1);o("workTime",100);o("workDelay",100);o("flattenSpans",true,c0,true);o("addModeClass",false,c0,true);o("pollInterval",100);o("undoDepth",40,function(ex,ey){ex.doc.history.undoDepth=ey});o("historyEventDelay",500);o("viewportMargin",10,function(ex){ex.refresh},true);o("maxHighlightLength",1E4,c0,true);o("crudeMeasuringFrom",1E4);o("moveInputWithCursor",true,function(ex,ey){if(!ey)ex.display.inputDiv.style.top=ex.display.inputDiv.style.left=0});o("tabindex",null,function(ex,ey){ex.display.input.tabIndex=ey||""});o("autofocus",null);var cr=B.modes={},at=B.mimeModes={};B.defineMode=function(ex,ez){if(!B.defaults.mode&&ex!="null")B.defaults.mode=ex;if(arguments.length>2){ez.dependencies=[];for(var ey=2;ey<arguments.length;++ey)ez.dependencies.push(arguments[ey])}cr[ex]=ez};B.defineMIME=function(ey,ex){at[ey]=ex};B.resolveMode=function(ex){if(typeof ex=="string"&&at.hasOwnProperty(ex))ex=at[ex];else if(ex&&(typeof ex.name=="string"&&at.hasOwnProperty(ex.name))){var ey=at[ex.name];ex=bE(ey,ex);ex.name=ey.name}else if(typeof ex=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(ex))return B.resolveMode("application/xml");if(typeof ex=="string")return{name:ex};else return ex||{name:"null"}};B.getMode=function(ey,ex){var ex=B.resolveMode(ex);var eA=cr[ex.name];if(!eA)return B.getMode(ey,"text/plain");var eB=eA(ey,ex);if(cp.hasOwnProperty(ex.name)){var ez=cp[ex.name];for(var eC in ez){if(!ez.hasOwnProperty(eC))continue;if(eB.hasOwnProperty(eC))eB["_"+eC]=eB[eC];eB[eC]=ez[eC]}}eB.name=ex.name;if(ex.helperType)eB.helperType=ex.helperType;if(ex.modeProps)for(var eC in ex.modeProps)eB[eC]=ex.modeProps[eC];return eB};B.defineMode("null",function{return{token:function(ex){ex.skipToEnd}}});B.defineMIME("text/plain","null");var cp=B.modeExtensions={};B.extendMode=function(ez,ey){var ex=cp.hasOwnProperty(ez)?cp[ez]:cp[ez]={};am(ey,ex)};B.defineExtension=function(ex,ey){B.prototype[ex]=ey};B.defineDocExtension=function(ex,ey){aa.prototype[ex]=ey};B.defineOption=o;var aE=[];B.defineInitHook=function(ex){aE.push(ex)};var dT=B.helpers={};B.registerHelper=function(ey,ex,ez){if(!dT.hasOwnProperty(ey))dT[ey]=B[ey]={_global:[]};dT[ey][ex]=ez};B.registerGlobalHelper=function(ez,ey,ex,eA){B.registerHelper(ez,ey,eA);dT[ez]._global.push({pred:ex,val:eA})};B.isWordChar=bS;function bp(eA,ex){if(ex===true)return ex;if(eA.copyState)return eA.copyState(ex);var ez={};for(var eB in ex){var ey=ex[eB];if(ey instanceof Array)ey=ey.concat([]);ez[eB]=ey}return ez}B.copyState=bp;function bn(ez,ey,ex){return ez.startState?ez.startState(ey,ex):true}B.startState=bn;B.innerMode=function(ez,ex){while(ez.innerMode){var ey=ez.innerMode(ex);if(!ey||ey.mode==ez)break;ex=ey.state;ez=ey.mode}return ey||{mode:ez,state:ex}};var de=B.commands={selectAll:function(ex){ex.setSelection(K(ex.firstLine,0),K(ex.lastLine))},killLine:function(ex){var eA=ex.getCursor(true),ez=ex.getCursor(false),ey=!d9(eA,ez);if(!ey&&ex.getLine(eA.line).length==eA.ch)ex.replaceRange("",eA,K(eA.line+1,0),"+delete");else ex.replaceRange("",eA,ey?ez:K(eA.line),"+delete")},deleteLine:function(ex){var ey=ex.getCursor.line;ex.replaceRange("",K(ey,0),K(ey),"+delete")},delLineLeft:function(ex){var ey=ex.getCursor;ex.replaceRange("",K(ey.line,0),ey,"+delete")},undo:function(ex){ex.undo},redo:function(ex){ex.redo},goDocStart:function(ex){ex.extendSelection(K(ex.firstLine,0))},goDocEnd:function(ex){ex.extendSelection(K(ex.lastLine))},goLineStart:function(ex){ex.extendSelection(aZ(ex,ex.getCursor.line))},goLineStartSmart:function(ey){var eC=ey.getCursor,eD=aZ(ey,eC.line);var ez=ey.getLineHandle(eD.line);var ex=a(ez);if(!ex||ex[0].level==0){var eB=Math.max(0,ez.text.search(/\S/));var eA=eC.line==eD.line&&(eC.ch<=eB&&eC.ch);ey.extendSelection(K(eD.line,eA?0:eB))}else ey.extendSelection(eD)},goLineEnd:function(ex){ex.extendSelection(cF(ex,ex.getCursor.line))},goLineRight:function(ex){var ey=ex.charCoords(ex.getCursor,"div").top+5;ex.extendSelection(ex.coordsChar({left:ex.display.lineDiv.offsetWidth+100,top:ey},"div"))},goLineLeft:function(ex){var ey=ex.charCoords(ex.getCursor,"div").top+5;ex.extendSelection(ex.coordsChar({left:0,top:ey},"div"))},goLineUp:function(ex){ex.moveV(-1,"line")},goLineDown:function(ex){ex.moveV(1,"line")},goPageUp:function(ex){ex.moveV(-1,"page")},goPageDown:function(ex){ex.moveV(1,"page")},goCharLeft:function(ex){ex.moveH(-1,"char")},goCharRight:function(ex){ex.moveH(1,"char")},goColumnLeft:function(ex){ex.moveH(-1,"column")},goColumnRight:function(ex){ex.moveH(1,"column")},goWordLeft:function(ex){ex.moveH(-1,"word")},goGroupRight:function(ex){ex.moveH(1,"group")},goGroupLeft:function(ex){ex.moveH(-1,"group")},goWordRight:function(ex){ex.moveH(1,"word")},delCharBefore:function(ex){ex.deleteH(-1,"char")},delCharAfter:function(ex){ex.deleteH(1,"char")},delWordBefore:function(ex){ex.deleteH(-1,"word")},delWordAfter:function(ex){ex.deleteH(1,"word")},delGroupBefore:function(ex){ex.deleteH(-1,"group")},delGroupAfter:function(ex){ex.deleteH(1,"group")},indentAuto:function(ex){ex.indentSelection("smart")},indentMore:function(ex){ex.indentSelection("add")},indentLess:function(ex){ex.indentSelection("subtract")},insertTab:function(ex){ex.replaceSelection("\t","end","+input")},defaultTab:function(ex){if(ex.somethingSelected)ex.indentSelection("add");else ex.replaceSelection("\t","end","+input")},transposeChars:function(ex){var ez=ex.getCursor,ey=ex.getLine(ez.line);if(ez.ch>0&&ez.ch<ey.length-1)ex.replaceRange(ey.charAt(ez.ch)+ey.charAt(ez.ch-1),K(ez.line,ez.ch-1),K(ez.line,ez.ch+1))},newlineAndIndent:function(ex){ca(ex,function{ex.replaceSelection("\n","end","+input");ex.indentLine(ex.getCursor.line,null,true)})},toggleOverwrite:function(ex){ex.toggleOverwrite}};var dG=B.keyMap={};dG.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"};dG.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"};dG.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delLineLeft",fallthrough:["basic","emacsy"]};dG["default"]=br?dG.macDefault:dG.pcDefault;dG.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};function ei(ex){if(typeof ex=="string")return dG[ex];else return ex}function g(ey,eC,eA){function eB(eI){eI=ei(eI);var eG=eI[ey];if(eG===false)return"stop";if(eG!=null&&eA(eG))return true;if(eI.nofallthrough)return"stop";var eF=eI.fallthrough;if(eF==null)return false;if(Object.prototype.toString.call(eF)!="[object Array]")return eB(eF);for(var eE=0,eH=eF.length;eE<eH;++eE){var eD=eB(eF[eE]);if(eD)return eD}return false}for(var ez=0;ez<eC.length;++ez){var ex=eB(eC[ez]);if(ex)return ex!="stop"}}function dd(ey){var ex=dM[ey.keyCode];return ex=="Ctrl"||(ex=="Alt"||(ex=="Shift"||ex=="Mod"))}function dX(ey,ez){if(d2&&(ey.keyCode==34&&ey["char"]))return false;var ex=dM[ey.keyCode];if(ex==null||ey.altGraphKey)return false;if(ey.altKey)ex="Alt-"+ex;if(bf?ey.metaKey:ey.ctrlKey)ex="Ctrl-"+ex;if(bf?ey.ctrlKey:ey.metaKey)ex="Cmd-"+ex;if(!ez&&ey.shiftKey)ex="Shift-"+ex;return ex}B.lookupKey=g;B.isModifierKey=dd;B.keyName=dX;B.fromTextArea=function(eE,eF){if(!eF)eF={};eF.value=eE.value;if(!eF.tabindex&&eE.tabindex)eF.tabindex=eE.tabindex;if(!eF.placeholder&&eE.placeholder)eF.placeholder=eE.placeholder;if(eF.autofocus==null){var ex=document.body;try{ex=document.activeElement}catch(ez){}eF.autofocus=ex==eE||eE.getAttribute("autofocus")!=null&&ex==document.body}function eB{eE.value=eD.getValue}if(eE.form){bl(eE.form,"submit",eB);if(!eF.leaveSubmitMethodAlone){var ey=eE.form,eC=ey.submit;try{var eA=ey.submit=function{eB;ey.submit=eC;ey.submit;ey.submit=eA}}catch(ez){}}}eE.style.display="none";var eD=B(function(eG){eE.parentNode.insertBefore(eG,eE.nextSibling)},eF);eD.save=eB;eD.getTextArea=function{return eE};eD.toTextArea=function{eB;eE.parentNode.removeChild(eD.getWrapperElement);eE.style.display="";if(eE.form){cU(eE.form,"submit",eB);if(typeof eE.form.submit=="function")eE.form.submit=eC}};return eD};function dt(ex,ey){this.pos=this.start=0;this.string=ex;this.tabSize=ey||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0}dt.prototype={eol:function{return this.pos>=this.string.length},sol:function{return this.pos==this.lineStart},peek:function{return this.string.charAt(this.pos)||undefined},next:function{if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(ex){var ez=this.string.charAt(this.pos);if(typeof ex=="string")var ey=ez==ex;else var ey=ez&&(ex.test?ex.test(ez):ex(ez));if(ey){++this.pos;return ez}},eatWhile:function(ex){var ey=this.pos;while(this.eat(ex));return this.pos>ey},eatSpace:function{var ex=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>ex},skipToEnd:function{this.pos=this.string.length},skipTo:function(ex){var ey=this.string.indexOf(ex,this.pos);if(ey>-1){this.pos=ey;return true}},backUp:function(ex){this.pos-=ex},column:function{if(this.lastColumnPos<this.start){this.lastColumnValue=bh(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue-(this.lineStart?bh(this.string,this.lineStart,this.tabSize):0)},indentation:function{return bh(this.string,null,this.tabSize)-(this.lineStart?bh(this.string,this.lineStart,this.tabSize):0)},match:function(eB,ey,ex){if(typeof eB=="string"){var eC=function(eD){return ex?eD.toLowerCase:eD};var eA=this.string.substr(this.pos,eB.length);if(eC(eA)==eC(eB)){if(ey!==false)this.pos+=eB.length;return true}}else{var ez=this.string.slice(this.pos).match(eB);if(ez&&ez.index>0)return null;if(ez&&ey!==false)this.pos+=ez[0].length;return ez}},current:function{return this.string.slice(this.start,this.pos)},hideFirstChars:function(ey,ex){this.lineStart+=ey;try{return ex}finally{this.lineStart-=ey}}};B.StringStream=dt;function H(ey,ex){this.lines=[];this.type=ex;this.doc=ey}B.TextMarker=H;a1(H);H.prototype.clear=function{if(this.explicitlyCleared)return;var eE=this.doc.cm,ey=eE&&!eE.curOp;if(ey)bZ(eE);if(dQ(this,"clear")){var eF=this.find;if(eF)O(this,"clear",eF.from,eF.to)}var ez=null,eC=null;for(var eA=0;eA<this.lines.length;++eA){var eG=this.lines[eA];var eD=dF(eG.markedSpans,this);if(eD.to!=null)eC=bd(eG);eG.markedSpans=dl(eG.markedSpans,eD);if(eD.from!=null)ez=bd(eG);else if(this.collapsed&&(!d0(this.doc,eG)&&eE))ep(eG,aw(eE.display))}if(eE&&(this.collapsed&&!eE.options.lineWrapping))for(var eA=0;eA<this.lines.length;++eA){var ex=u(eE.doc,this.lines[eA]),eB=c1(eE.doc,ex);if(eB>eE.display.maxLineLength){eE.display.maxLine=ex;eE.display.maxLineLength=eB;eE.display.maxLineChanged=true}}if(ez!=null&&eE)Q(eE,ez,eC+1);this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(eE)c8(eE)}if(ey)W(eE)};H.prototype.find=function(eB){var eD,eC;for(var ey=0;ey<this.lines.length;++ey){var ex=this.lines[ey];var ez=dF(ex.markedSpans,this);if(ez.from!=null||ez.to!=null){var eA=bd(ex);if(ez.from!=null)eD=K(eA,ez.from);if(ez.to!=null)eC=K(eA,ez.to)}}if(this.type=="bookmark"&&!eB)return eD;return eD&&{from:eD,to:eC}};H.prototype.changed=function{var eA=this.find,ex=this.doc.cm;if(!eA||!ex)return;if(this.type!="bookmark")eA=eA.from;var ey=dK(this.doc,eA.line);ed(ex,ey);if(eA.line>=ex.display.showingFrom&&eA.line<ex.display.showingTo){for(var ez=ex.display.lineDiv.firstChild;ez;ez=ez.nextSibling)if(ez.lineObj==ey){if(ez.offsetHeight!=ey.height)ep(ey,ez.offsetHeight);break}b2(ex,function{ex.curOp.selectionChanged=ex.curOp.forceUpdate=ex.curOp.updateMaxLine=true})}};H.prototype.attachLine=function(ex){if(!this.lines.length&&this.doc.cm){var ey=this.doc.cm.curOp;if(!ey.maybeHiddenMarkers||cm(ey.maybeHiddenMarkers,this)==-1)(ey.maybeUnhiddenMarkers||(ey.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(ex)};H.prototype.detachLine=function(ex){this.lines.splice(cm(this.lines,ex),1);if(!this.lines.length&&this.doc.cm){var ey=this.doc.cm.curOp;(ey.maybeHiddenMarkers||(ey.maybeHiddenMarkers=[])).push(this)}};var aB=0;function di(eD,eB,eC,eF,eA){if(eF&&eF.shared)return G(eD,eB,eC,eF,eA);if(eD.cm&&!eD.cm.curOp)return ca(eD.cm,di)(eD,eB,eC,eF,eA);var ez=new H(eD,eA);if(eF)am(eF,ez);if(dL(eC,eB)||d9(eB,eC)&&ez.clearWhenEmpty!==false)return ez;if(ez.replacedWith){ez.collapsed=true;ez.replacedWith=ek("span",[ez.replacedWith],"CodeMirror-widget");if(!eF.handleMouseEvents)ez.replacedWith.ignoreEvents=true}if(ez.collapsed){if(v(eD,eB.line,eB,eC,ez)||eB.line!=eC.line&&v(eD,eC.line,eB,eC,ez))throw new Error("Inserting collapsed marker partially overlapping an existing one");aD=true}if(ez.addToHistory)dj(eD,{from:eB,to:eC,origin:"markText"},{head:eD.sel.head,anchor:eD.sel.anchor},NaN);var ey=eB.line,eE=eD.cm,ex;eD.iter(ey,eC.line+1,function(eG){if(eE&&(ez.collapsed&&(!eE.options.lineWrapping&&u(eD,eG)==eE.display.maxLine)))ex=true;var eH={from:null,to:null,marker:ez};if(ey==eB.line)eH.from=eB.ch;if(ey==eC.line)eH.to=eC.ch;if(ez.collapsed&&ey!=eB.line)ep(eG,0);by(eG,eH);++ey});if(ez.collapsed)eD.iter(eB.line,eC.line+1,function(eG){if(d0(eD,eG))ep(eG,0)});if(ez.clearOnEnter)bl(ez,"beforeCursorEnter",function{ez.clear});if(ez.readOnly){er=true;if(eD.history.done.length||eD.history.undone.length)eD.clearHistory}if(ez.collapsed){ez.id=++aB;ez.atomic=true}if(eE){if(ex)eE.curOp.updateMaxLine=true;if(ez.className||(ez.title||(ez.startStyle||(ez.endStyle||ez.collapsed))))Q(eE,eB.line,eC.line+1);if(ez.atomic)c8(eE)}return ez}function t(eA,ey){this.markers=eA;this.primary=ey;for(var ex=0,ez=this;ex<eA.length;++ex){eA[ex].parent=this;bl(eA[ex],"clear",function{ez.clear})}}B.SharedTextMarker=t;a1(t);t.prototype.clear=function{if(this.explicitlyCleared)return;this.explicitlyCleared=true;for(var ex=0;ex<this.markers.length;++ex)this.markers[ex].clear;O(this,"clear")};t.prototype.find=function{return this.primary.find};function G(eB,eE,eD,ex,ez){ex=am(ex);ex.shared=false;var eC=[di(eB,eE,eD,ex,ez)],ey=eC[0];var eA=ex.replacedWith;cO(eB,function(eG){if(eA)ex.replacedWith=eA.cloneNode(true);eC.push(di(eG,ea(eG,eE),ea(eG,eD),ex,ez));for(var eF=0;eF<eG.linked.length;++eF)if(eG.linked[eF].isParent)return;ey=d8(eC)});return new t(eC,ey)}function dF(ez,ex){if(ez)for(var ey=0;ey<ez.length;++ey){var eA=ez[ey];if(eA.marker==ex)return eA}}function dl(ey,ez){for(var eA,ex=0;ex<ey.length;++ex)if(ey[ex]!=ez)(eA||(eA=[])).push(ey[ex]);return eA}function by(ex,ey){ex.markedSpans=ex.markedSpans?ex.markedSpans.concat([ey]):[ey];ey.marker.attachLine(ex)}function aq(ey,ez,eD){if(ey)for(var eB=0,eE;eB<ey.length;++eB){var eF=ey[eB],eC=eF.marker;var ex=eF.from==null||(eC.inclusiveLeft?eF.from<=ez:eF.from<ez);if(ex||eF.from==ez&&(eC.type=="bookmark"&&(!eD||!eF.marker.insertLeft))){var eA=eF.to==null||(eC.inclusiveRight?eF.to>=ez:eF.to>ez);(eE||(eE=[])).push({from:eF.from,to:eA?null:eF.to,marker:eC})}}return eE}function af(ey,eA,eD){if(ey)for(var eB=0,eE;eB<ey.length;++eB){var eF=ey[eB],eC=eF.marker;var ez=eF.to==null||(eC.inclusiveRight?eF.to>=eA:eF.to>eA);if(ez||eF.from==eA&&(eC.type=="bookmark"&&(!eD||eF.marker.insertLeft))){var ex=eF.from==null||(eC.inclusiveLeft?eF.from<=eA:eF.from<eA);(eE||(eE=[])).push({from:ex?null:eF.from-eA,to:eF.to==null?null:eF.to-eA,marker:eC})}}return eE}function cZ(eJ,eG){var eF=bu(eJ,eG.from.line)&&dK(eJ,eG.from.line).markedSpans;var eM=bu(eJ,eG.to.line)&&dK(eJ,eG.to.line).markedSpans;if(!eF&&!eM)return null;var ey=eG.from.ch,eB=eG.to.ch,eE=d9(eG.from,eG.to);var eD=aq(eF,ey,eE);var eL=af(eM,eB,eE);var eK=eG.text.length==1,ez=d8(eG.text).length+(eK?ey:0);if(eD)for(var eA=0;eA<eD.length;++eA){var eI=eD[eA];if(eI.to==null){var eN=dF(eL,eI.marker);if(!eN)eI.to=ey;else if(eK)eI.to=eN.to==null?null:eN.to+ez}}if(eL)for(var eA=0;eA<eL.length;++eA){var eI=eL[eA];if(eI.to!=null)eI.to+=ez;if(eI.from==null){var eN=dF(eD,eI.marker);if(!eN){eI.from=ez;if(eK)(eD||(eD=[])).push(eI)}}else{eI.from+=ez;if(eK)(eD||(eD=[])).push(eI)}}if(eD)eD=n(eD);if(eL&&eL!=eD)eL=n(eL);var eC=[eD];if(!eK){var eH=eG.text.length-2,ex;if(eH>0&&eD)for(var eA=0;eA<eD.length;++eA)if(eD[eA].to==null)(ex||(ex=[])).push({from:null,to:null,marker:eD[eA].marker});for(var eA=0;eA<eH;++eA)eC.push(ex);eC.push(eL)}return eC}function n(ey){for(var ex=0;ex<ey.length;++ex){var ez=ey[ex];if(ez.from!=null&&(ez.from==ez.to&&ez.marker.clearWhenEmpty!==false))ey.splice(ex--,1)}if(!ey.length)return null;return ey}function cQ(eF,eD){var ex=bs(eF,eD);var eG=cZ(eF,eD);if(!ex)return eG;if(!eG)return ex;for(var eA=0;eA<ex.length;++eA){var eB=ex[eA],eC=eG[eA];if(eB&&eC)spans:for(var ez=0;ez<eC.length;++ez){var eE=eC[ez];for(var ey=0;ey<eB.length;++ey)if(eB[ey].marker==eE.marker)continue spans;eB.push(eE)}else if(eC)ex[eA]=eC}return ex}function bX(eH,eF,eG){var eA=null;eH.iter(eF.line,eG.line+1,function(eI){if(eI.markedSpans)for(var eJ=0;eJ<eI.markedSpans.length;++eJ){var eK=eI.markedSpans[eJ].marker;if(eK.readOnly&&(!eA||cm(eA,eK)==-1))(eA||(eA=[])).push(eK)}});if(!eA)return null;var eB=[{from:eF,to:eG}];for(var eC=0;eC<eA.length;++eC){var eD=eA[eC],ey=eD.find;for(var ez=0;ez<eB.length;++ez){var ex=eB[ez];if(dL(ex.to,ey.from)||dL(ey.to,ex.from))continue;var eE=[ez,1];if(dL(ex.from,ey.from)||!eD.inclusiveLeft&&d9(ex.from,ey.from))eE.push({from:ex.from,to:ey.from});if(dL(ey.to,ex.to)||!eD.inclusiveRight&&d9(ex.to,ey.to))eE.push({from:ey.to,to:ex.to});eB.splice.apply(eB,eE);ez+=eE.length-1}}return eB}function r(ex){return ex.inclusiveLeft?-1:0}function bk(ex){return ex.inclusiveRight?1:0}function cG(eA,ey){var eC=eA.lines.length-ey.lines.length;if(eC!=0)return eC;var ez=eA.find,eD=ey.find;var ex=bA(ez.from,eD.from)||r(eA)-r(ey);if(ex)return-ex;var eB=bA(ez.to,eD.to)||bk(eA)-bk(ey);if(eB)return eB;return ey.id-eA.id}function aC(ey,eC){var ex=aD&&ey.markedSpans,eB;if(ex)for(var eA,ez=0;ez<ex.length;++ez){eA=ex[ez];if(eA.marker.collapsed&&((eC?eA.from:eA.to)==null&&(!eB||cG(eB,eA.marker)<0)))eB=eA.marker}return eB}function dp(ex){return aC(ex,true)}function c6(ex){return aC(ex,false)}function v(eF,ez,eD,eE,eB){var eI=dK(eF,ez);var ex=aD&&eI.markedSpans;if(ex)for(var eA=0;eA<ex.length;++eA){var ey=ex[eA];if(!ey.marker.collapsed)continue;var eH=ey.marker.find(true);var eG=bA(eH.from,eD)||r(ey.marker)-r(eB);var eC=bA(eH.to,eE)||bk(ey.marker)-bk(eB);if(eG>=0&&eC<=0||eG<=0&&eC>=0)continue;if(eG<=0&&(bA(eH.to,eD)||bk(ey.marker)-r(eB))>0||eG>=0&&(bA(eH.from,eE)||r(ey.marker)-bk(eB))<0)return true}}function u(ez,ey){var ex;while(ex=dp(ey))ey=dK(ez,ex.find.from.line);return ey}function d0(eB,ey){var ex=aD&&ey.markedSpans;if(ex)for(var eA,ez=0;ez<ex.length;++ez){eA=ex[ez];if(!eA.marker.collapsed)continue;if(eA.from==null)return true;if(eA.marker.replacedWith)continue;if(eA.from==0&&(eA.marker.inclusiveLeft&&J(eB,ey,eA)))return true}}function J(eD,ey,eA){if(eA.to==null){var ex=eA.marker.find.to,eB=dK(eD,ex.line);return J(eD,eB,dF(eB.markedSpans,eA.marker))}if(eA.marker.inclusiveRight&&eA.to==ey.text.length)return true;for(var eC,ez=0;ez<ey.markedSpans.length;++ez){eC=ey.markedSpans[ez];if(eC.marker.collapsed&&(!eC.marker.replacedWith&&(eC.from==eA.to&&((eC.to==null||eC.to!=eA.from)&&((eC.marker.inclusiveLeft||eA.marker.inclusiveRight)&&J(eD,ey,eC))))))return true}}function eq(ex){var ez=ex.markedSpans;if(!ez)return;for(var ey=0;ey<ez.length;++ey)ez[ey].marker.detachLine(ex);ex.markedSpans=null}function cb(ex,ez){if(!ez)return;for(var ey=0;ey<ez.length;++ey)ez[ey].marker.attachLine(ex);ex.markedSpans=ez}var cy=B.LineWidget=function(ex,eA,ey){if(ey)for(var ez in ey)if(ey.hasOwnProperty(ez))this[ez]=ey[ez];this.cm=ex;this.node=eA};a1(cy);function E(ex){return function{var ez=!this.cm.curOp;if(ez)bZ(this.cm);try{var ey=ex.apply(this,arguments)}finally{if(ez)W(this.cm)}return ey}}cy.prototype.clear=E(function{var ey=this.line.widgets,eA=bd(this.line);if(eA==null||!ey)return;for(var ez=0;ez<ey.length;++ez)if(ey[ez]==this)ey.splice(ez--,1);if(!ey.length)this.line.widgets=null;var ex=bc(this.cm,this.line)<this.cm.doc.scrollTop;ep(this.line,Math.max(0,this.line.height-b7(this)));if(ex)b1(this.cm,0,-this.height);Q(this.cm,eA,eA+1)});cy.prototype.changed=E(function{var ex=this.height;this.height=null;var ey=b7(this)-ex;if(!ey)return;ep(this.line,this.line.height+ey);var ez=bd(this.line);Q(this.cm,ez,ez+1)});function b7(ex){if(ex.height!=null)return ex.height;if(!ex.node.parentNode||ex.node.parentNode.nodeType!=1)bg(ex.cm.display.measure,ek("div",[ex.node],null,"position: relative"));return ex.height=ex.node.offsetHeight}function a7(ex,eB,ez,ey){var eA=new cy(ex,ez,ey);if(eA.noHScroll)ex.display.alignWidgets=true;da(ex,eB,function(eD){var eE=eD.widgets||(eD.widgets=[]);if(eA.insertAt==null)eE.push(eA);else eE.splice(Math.min(eE.length-1,Math.max(0,eA.insertAt)),0,eA);eA.line=eD;if(!d0(ex.doc,eD)||eA.showIfHidden){var eC=bc(ex,eD)<ex.doc.scrollTop;ep(eD,eD.height+b7(eA));if(eC)b1(ex,0,eA.height)}return true});return eA}var eo=B.Line=function(ez,ey,ex){this.text=ez;cb(this,ey);this.height=ex?ex(this):1};a1(eo);eo.prototype.lineNo=function{return bd(this)};function c2(ey,eB,ez,ex){ey.text=eB;if(ey.stateAfter)ey.stateAfter=null;if(ey.styles)ey.styles=null;if(ey.order!=null)ey.order=null;eq(ey);cb(ey,ez);var eA=ex?ex(ey):1;if(eA!=ey.height)ep(ey,eA)}function a2(ex){ex.parent=null;eq(ex)}function s(eG,eI,eB,ey,eC,eA){var ez=eB.flattenSpans;if(ez==null)ez=eG.options.flattenSpans;var eE=0,eD=null;var eH=new dt(eI,eG.options.tabSize),ex;if(eI==""&&eB.blankLine)eB.blankLine(ey);while(!eH.eol){if(eH.pos>eG.options.maxHighlightLength){ez=false;if(eA)cv(eG,eI,ey,eH.pos);eH.pos=eI.length;ex=null}else ex=eB.token(eH,ey);if(eG.options.addModeClass){var eJ=B.innerMode(eB,ey).mode.name;if(eJ)ex="m-"+(ex?eJ+" "+ex:eJ)}if(!ez||eD!=ex){if(eE<eH.start)eC(eH.start,eD);eE=eH.start;eD=ex}eH.start=eH.pos}while(eE<eH.pos){var eF=Math.min(eH.pos,eE+5E4);eC(eF,eD);eE=eF}}function d5(eD,eF,ex,eA){var eE=[eD.state.modeGen];s(eD,eF.text,eD.doc.mode,ex,function(eG,eH){eE.push(eG,eH)},eA);for(var ey=0;ey<eD.state.overlays.length;++ey){var eB=eD.state.overlays[ey],eC=1,ez=0;s(eD,eF.text,eB.mode,true,function(eG,eI){var eK=eC;while(ez<eG){var eH=eE[eC];if(eH>eG)eE.splice(eC,1,eG,eE[eC+1],eH);eC+=2;ez=Math.min(eG,eH)}if(!eI)return;if(eB.opaque){eE.splice(eK,eC-eK,eG,eI);eC=eK+2}else for(eK<eC;eK+=2){var eJ=eE[eK+1];eE[eK+1]=eJ?eJ+" "+eI:eI}})}return eE}function ce(ex,ey){if(!ey.styles||ey.styles[0]!=ex.state.modeGen)ey.styles=d5(ex,ey,ey.stateAfter=cx(ex,bd(ey)));return ey.styles}function cv(ex,eC,ez,ey){var eB=ex.doc.mode;var eA=new dt(eC,ex.options.tabSize);eA.start=eA.pos=ey||0;if(eC==""&&eB.blankLine)eB.blankLine(ez);while(!eA.eol&&eA.pos<=ex.options.maxHighlightLength){eB.token(eA,ez);eA.start=eA.pos}}var cJ={},bo={};function dv(eA,ez){if(!eA)return null;for{var ey=eA.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!ey)break;eA=eA.slice(0,ey.index)+eA.slice(ey.index+ey[0].length);var eB=ey[1]?"bgClass":"textClass";if(ez[eB]==null)ez[eB]=ey[2];else if(!(new RegExp("(?:^|s)"+ey[2]+"(?:$|s)")).test(ez[eB]))ez[eB]+=" "+ey[2]}if(/^\s*$/.test(eA))return null;var ex=ez.cm.options.addModeClass?bo:cJ;return ex[eA]||(ex[eA]=eA.replace(/\S+/g,"cm-$&"))}function dr(eG,eK,ex,eJ){var eH,eL=eK,eC=true;while(eH=dp(eL))eL=dK(eG.doc,eH.find.from.line);var eD={pre:ek("pre"),col:0,pos:0,measure:null,measuredSomething:false,cm:eG,copyWidgets:eJ};do{if(eL.text)eC=false;eD.measure=eL==eK&&ex;eD.pos=0;eD.addToken=eD.measure?e:p;if((cg||b9)&&eG.getOption("lineWrapping"))eD.addToken=d7(eD.addToken);var eB=aV(eL,eD,ce(eG,eL));if(ex&&(eL==eK&&!eD.measuredSomething)){ex[0]=eD.pre.appendChild(aT(eG.display.measure));eD.measuredSomething=true}if(eB)eL=dK(eG.doc,eB.to.line)}while(eB);if(ex&&(!eD.measuredSomething&&!ex[0]))ex[0]=eD.pre.appendChild(eC?ek("span","\u00a0"):aT(eG.display.measure));if(!eD.pre.firstChild&&!d0(eG.doc,eK))eD.pre.appendChild(document.createTextNode("\u00a0"));var ey;if(ex&&(cB&&(ey=a(eL)))){var eA=ey.length-1;if(ey[eA].from==ey[eA].to)--eA;var eI=ey[eA],ez=ey[eA-1];if(eI.from+1==eI.to&&(ez&&eI.level<ez.level)){var eF=ex[eD.pos-1];if(eF)eF.parentNode.insertBefore(eF.measureRight=aT(eG.display.measure),eF.nextSibling)}}var eE=eD.textClass?eD.textClass+" "+(eK.textClass||""):eK.textClass;if(eE)eD.pre.className=eE;ah(eG,"renderLine",eG,eK,eD.pre);return eD}function dI(ey){var ex=ek("span","\u2022","cm-invalidchar");ex.title="\\u"+ey.charCodeAt(0).toString(16);return ex}function p(eB,eK,ex,eA,eL,eJ){if(!eK)return;var eF=eB.cm.options.specialChars;if(!eF.test(eK)){eB.col+=eK.length;var eE=document.createTextNode(eK)}else{var eE=document.createDocumentFragment,eH=0;while(true){eF.lastIndex=eH;var ey=eF.exec(eK);var eD=ey?ey.index-eH:eK.length-eH;if(eD){eE.appendChild(document.createTextNode(eK.slice(eH,eH+eD)));eB.col+=eD}if(!ey)break;eH+=eD+1;if(ey[0]=="\t"){var eC=eB.cm.options.tabSize,eG=eC-eB.col%eC;eE.appendChild(ek("span",bK(eG),"cm-tab"));eB.col+=eG}else{var ez=eB.cm.options.specialCharPlaceholder(ey[0]);eE.appendChild(ez);eB.col+=1}}}if(ex||(eA||(eL||eB.measure))){var eI=ex||"";if(eA)eI+=eA;if(eL)eI+=eL;var ez=ek("span",[eE],eI);if(eJ)ez.title=eJ;return eB.pre.appendChild(ez)}eB.pre.appendChild(eE)}function e(eE,eH,ey,eB,eI){var eD=eE.cm.options.lineWrapping;for(var eC=0;eC<eH.length;++eC){var ez=eC==0,eG=eC+1;while(eG<eH.length&&dW(eH.charAt(eG)))++eG;var ex=eH.slice(eC,eG);eC=eG-1;if(eC&&(eD&&bv(eH,eC)))eE.pre.appendChild(ek("wbr"));var eA=eE.measure[eE.pos];var eF=eE.measure[eE.pos]=p(eE,ex,ey,ez&&eB,eC==eH.length-1&&eI);if(eA)eF.leftSide=eA.leftSide||eA;if(cg&&(eD&&(ex==" "&&(eC&&(!/\s/.test(eH.charAt(eC-1))&&(eC<eH.length-1&&!/\s/.test(eH.charAt(eC+1))))))))eF.style.whiteSpace="normal";eE.pos+=ex.length}if(eH.length)eE.measuredSomething=true}function d7(ex){function ey(ez){var eA=" ";for(var eB=0;eB<ez.length-2;++eB)eA+=eB%2?" ":"\u00a0";eA+=" ";return eA}return function(eA,eE,eB,ez,eD,eC){return ex(eA,eE.replace(/ {3,}/g,ey),eB,ez,eD,eC)}}function M(ey,eB,ex,eA){var eC=!eA&&ex.replacedWith;if(eC){if(ey.copyWidgets)eC=eC.cloneNode(true);ey.pre.appendChild(eC);if(ey.measure){if(eB)ey.measure[ey.pos]=eC;else{var ez=aT(ey.cm.display.measure);if(ex.type=="bookmark"&&!ex.insertLeft)ey.measure[ey.pos]=ey.pre.appendChild(ez);else if(ey.measure[ey.pos])return;else ey.measure[ey.pos]=ey.pre.insertBefore(ez,eC)}ey.measuredSomething=true}}ey.pos+=eB}function aV(eG,eM,eF){var eC=eG.markedSpans,eE=eG.text,eK=0;if(!eC){for(var eP=1;eP<eF.length;eP+=2)eM.addToken(eM,eE.slice(eK,eK=eF[eP]),dv(eF[eP+1],eM));return}var eQ=eE.length,eB=0,eP=1,eI="",eR;var eT=0,ex,eS,eJ,eU,ez;for{if(eT==eB){ex=eS=eJ=eU="";ez=null;eT=Infinity;var eD=[];for(var eN=0;eN<eC.length;++eN){var eO=eC[eN],eL=eO.marker;if(eO.from<=eB&&(eO.to==null||eO.to>eB)){if(eO.to!=null&&eT>eO.to){eT=eO.to;eS=""}if(eL.className)ex+=" "+eL.className;if(eL.startStyle&&eO.from==eB)eJ+=" "+eL.startStyle;if(eL.endStyle&&eO.to==eT)eS+=" "+eL.endStyle;if(eL.title&&!eU)eU=eL.title;if(eL.collapsed&&(!ez||cG(ez.marker,eL)<0))ez=eO}else if(eO.from>eB&&eT>eO.from)eT=eO.from;if(eL.type=="bookmark"&&(eO.from==eB&&eL.replacedWith))eD.push(eL)}if(ez&&(ez.from||0)==eB){M(eM,(ez.to==null?eQ:ez.to)-eB,ez.marker,ez.from==null);if(ez.to==null)return ez.marker.find}if(!ez&&eD.length)for(var eN=0;eN<eD.length;++eN)M(eM,0,eD[eN])}if(eB>=eQ)break;var eH=Math.min(eQ,eT);while(true){if(eI){var ey=eB+eI.length;if(!ez){var eA=ey>eH?eI.slice(0,eH-eB):eI;eM.addToken(eM,eA,eR?eR+ex:ex,eJ,eB+eA.length==eT?eS:"",eU)}if(ey>=eH){eI=eI.slice(eH-eB);eB=eH;break}eB=ey;eJ=""}eI=eE.slice(eK,eK=eF[eP++]);eR=dv(eF[eP++],eM)}}}function d3(eO,eF,eB,eJ,eD){function eA(eP){return eB?eB[eP]:null}function eE(eP,eR,eQ){c2(eP,eR,eQ,eD);O(eP,"change",eP,eF)}var eK=eF.from,ey=eF.to,eH=eF.text;var eG=dK(eO,eK.line),ex=dK(eO,ey.line);var ez=d8(eH),eM=eA(eH.length-1),eI=ey.line-eK.line;if(eK.ch==0&&(ey.ch==0&&(ez==""&&(!eO.cm||eO.cm.options.wholeLineUpdateBefore)))){for(var eL=0,eN=eH.length-1,eC=[];eL<eN;++eL)eC.push(new eo(eH[eL],eA(eL),eD));eE(ex,ex.text,eM);if(eI)eO.remove(eK.line,eI);if(eC.length)eO.insert(eK.line,eC)}else if(eG==ex)if(eH.length==1)eE(eG,eG.text.slice(0,eK.ch)+ez+eG.text.slice(ey.ch),eM);else{for(var eC=[],eL=1,eN=eH.length-1;eL<eN;++eL)eC.push(new eo(eH[eL],eA(eL),eD));eC.push(new eo(ez+eG.text.slice(ey.ch),eM,eD));eE(eG,eG.text.slice(0,eK.ch)+eH[0],eA(0));eO.insert(eK.line+1,eC)}else if(eH.length==1){eE(eG,eG.text.slice(0,eK.ch)+eH[0]+ex.text.slice(ey.ch),eA(0));eO.remove(eK.line+1,eI)}else{eE(eG,eG.text.slice(0,eK.ch)+eH[0],eA(0));eE(ex,ez+ex.text.slice(ey.ch),eM);for(var eL=1,eN=eH.length-1,eC=[];eL<eN;++eL)eC.push(new eo(eH[eL],eA(eL),eD));if(eI>1)eO.remove(eK.line+1,eI-1);eO.insert(eK.line+1,eC)}O(eO,"change",eO,eF);bi(eO,eJ.anchor,eJ.head,null,true)}function dy(ey){this.lines=ey;this.parent=null;for(var ez=0,eA=ey.length,ex=0;ez<eA;++ez){ey[ez].parent=this;ex+=ey[ez].height}this.height=ex}dy.prototype={chunkSize:function{return this.lines.length},removeInner:function(ex,eB){for(var ez=ex,eA=ex+eB;ez<eA;++ez){var ey=this.lines[ez];this.height-=ey.height;a2(ey);O(ey,"delete")}this.lines.splice(ex,eB)},collapse:function(ex){ex.splice.apply(ex,[ex.length,0].concat(this.lines))},insertInner:function(ey,ez,ex){this.height+=ex;this.lines=this.lines.slice(0,ey).concat(ez).concat(this.lines.slice(ey));for(var eA=0,eB=ez.length;eA<eB;++eA)ez[eA].parent=this},iterN:function(ex,eA,ez){for(var ey=ex+eA;ex<ey;++ex)if(ez(this.lines[ex]))return true}};function d1(eA){this.children=eA;var ez=0,ex=0;for(var ey=0,eC=eA.length;ey<eC;++ey){var eB=eA[ey];ez+=eB.chunkSize;ex+=eB.height;eB.parent=this}this.size=ez;this.height=ex;this.parent=null}d1.prototype={chunkSize:function{return this.size},removeInner:function(ex,eE){this.size-=eE;for(var ez=0;ez<this.children.length;++ez){var eD=this.children[ez],eB=eD.chunkSize;if(ex<eB){var eA=Math.min(eE,eB-ex),eC=eD.height;eD.removeInner(ex,eA);this.height-=eC-eD.height;if(eB==eA){this.children.splice(ez--,1);eD.parent=null}if((eE-=eA)==0)break;ex=0}else ex-=eB}if(this.size-eE<25){var ey=[];this.collapse(ey);this.children=[new dy(ey)];this.children[0].parent=this}},collapse:function(ex){for(var ey=0,ez=this.children.length;ey<ez;++ey)this.children[ey].collapse(ex)},insertInner:function(ey,eF,eE){this.size+=eF.length;this.height+=eE;for(var ez=0,eB=this.children.length;ez<eB;++ez){var ex=this.children[ez],eC=ex.chunkSize;if(ey<=eC){ex.insertInner(ey,eF,eE);if(ex.lines&&ex.lines.length>50){while(ex.lines.length>50){var eA=ex.lines.splice(ex.lines.length-25,25);var eD=new dy(eA);ex.height-=eD.height;this.children.splice(ez+1,0,eD);eD.parent=this}this.maybeSpill}break}ey-=eC}},maybeSpill:function{if(this.children.length<=10)return;var eA=this;do{var ey=eA.children.splice(eA.children.length-5,5);var ez=new d1(ey);if(!eA.parent){var eB=new d1(eA.children);eB.parent=eA;eA.children=[eB,ez];eA=eB}else{eA.size-=ez.size;eA.height-=ez.height;var ex=cm(eA.parent.children,eA);eA.parent.children.splice(ex+1,0,ez)}ez.parent=eA.parent}while(eA.children.length>10);eA.parent.maybeSpill},iterN:function(ex,eE,eD){for(var ey=0,eB=this.children.length;ey<eB;++ey){var eC=this.children[ey],eA=eC.chunkSize;if(ex<eA){var ez=Math.min(eE,eA-ex);if(eC.iterN(ex,ez,eD))return true;if((eE-=ez)==0)break;ex=0}else ex-=eA}}};var bL=0;var aa=B.Doc=function(ez,ey,ex){if(!(this instanceof aa))return new aa(ez,ey,ex);if(ex==null)ex=0;d1.call(this,[new dy([new eo("",null)])]);this.first=ex;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.history=ac;this.cleanGeneration=1;this.frontier=ex;var eA=K(ex,0);this.sel={from:eA,to:eA,head:eA,anchor:eA,shift:false,extend:false,goalColumn:null};this.id=++bL;this.modeOption=ey;if(typeof ez=="string")ez=ay(ez);d3(this,{from:eA,to:eA,text:ez},null,{head:eA,anchor:eA})};aa.prototype=bE(d1.prototype,{constructor:aa,iter:function(ez,ey,ex){if(ex)this.iterN(ez-this.first,ey-ez,ex);else this.iterN(this.first,this.first+this.size,ez)},insert:function(ey,ez){var ex=0;for(var eA=0,eB=ez.length;eA<eB;++eA)ex+=ez[eA].height;this.insertInner(ey-this.first,ez,ex)},remove:function(ex,ey){this.removeInner(ex-this.first,ey)},getValue:function(ey){var ex=aA(this,this.first,this.first+this.size);if(ey===false)return ex;return ex.join(ey||"\n")},setValue:function(ey){var ez=K(this.first,0),ex=this.first+this.size-1;aL(this,{from:ez,to:K(ex,dK(this,ex).text.length),text:ay(ey),origin:"setValue"},{head:ez,anchor:ez},true)},replaceRange:function(ey,eA,ez,ex){eA=ea(this,eA);ez=ez?ea(this,ez):eA;az(this,ey,eA,ez,ex)},getRange:function(eA,ez,ey){var ex=em(this,ea(this,eA),ea(this,ez));if(ey===false)return ex;return ex.join(ey||"\n")},getLine:function(ey){var ex=this.getLineHandle(ey);return ex&&ex.text},setLine:function(ex,ey){if(bu(this,ex))az(this,ey,K(ex,0),ea(this,K(ex)))},removeLine:function(ex){if(ex)az(this,"",ea(this,K(ex-1)),ea(this,K(ex)));else az(this,"",K(0,0),ea(this,K(1,0)))},getLineHandle:function(ex){if(bu(this,ex))return dK(this,ex)},getLineNumber:function(ex){return bd(ex)},getLineHandleVisualStart:function(ex){if(typeof ex=="number")ex=dK(this,ex);return u(this,ex)},lineCount:function{return this.size},firstLine:function{return this.first},lastLine:function{return this.first+this.size-1},clipPos:function(ex){return ea(this,ex)},getCursor:function(ez){var ex=this.sel,ey;if(ez==null||ez=="head")ey=ex.head;else if(ez=="anchor")ey=ex.anchor;else if(ez=="end"||ez===false)ey=ex.to;else ey=ex.from;return bD(ey)},somethingSelected:function{return!d9(this.sel.head,this.sel.anchor)},setCursor:d4(function(ex,ey,eA){var ez=ea(this,typeof ex=="number"?K(ex,ey||0):ex);if(eA)eh(this,ez);else bi(this,ez,ez)}),setSelection:d4(function(ey,ez,ex){bi(this,ea(this,ey),ea(this,ez||ey),ex)}),extendSelection:d4(function(ez,ey,ex){eh(this,ea(this,ez),ey&&ea(this,ey),ex)}),getSelection:function(ex){return this.getRange(this.sel.from,this.sel.to,ex)},replaceSelection:function(ey,ez,ex){aL(this,{from:this.sel.from,to:this.sel.to,text:ay(ey),origin:ex},ez||"around")},undo:d4(function{bt(this,"undo")}),redo:d4(function{bt(this,"redo")}),setExtending:function(ex){this.sel.extend=ex},historySize:function{var ex=this.history;return{undo:ex.done.length,redo:ex.undone.length}},clearHistory:function{this.history=ac(this.history.maxGeneration)},markClean:function{this.cleanGeneration=this.changeGeneration(true)},changeGeneration:function(ex){if(ex)this.history.lastOp=this.history.lastOrigin=null;return this.history.generation},isClean:function(ex){return this.history.generation==(ex||this.cleanGeneration)},getHistory:function{return{done:be(this.history.done),undone:be(this.history.undone)}},setHistory:function(ey){var ex=this.history=ac(this.history.maxGeneration);ex.done=ey.done.slice(0);ex.undone=ey.undone.slice(0)},markText:function(ez,ey,ex){return di(this,ea(this,ez),ea(this,ey),ex,"range")},setBookmark:function(ez,ex){var ey={replacedWith:ex&&(ex.nodeType==null?ex.widget:ex),insertLeft:ex&&ex.insertLeft,clearWhenEmpty:false};ez=ea(this,ez);return di(this,ez,ez,ey,"bookmark")},findMarksAt:function(eB){eB=ea(this,eB);var eA=[],ey=dK(this,eB.line).markedSpans;if(ey)for(var ex=0;ex<ey.length;++ex){var ez=ey[ex];if((ez.from==null||ez.from<=eB.ch)&&(ez.to==null||ez.to>=eB.ch))eA.push(ez.marker.parent||ez.marker)}return eA},getAllMarks:function{var ex=[];this.iter(function(ez){var ey=ez.markedSpans;if(ey)for(var eA=0;eA<ey.length;++eA)if(ey[eA].from!=null)ex.push(ey[eA].marker)});return ex},posFromIndex:function(ey){var ex,ez=this.first;this.iter(function(eA){var eB=eA.text.length+1;if(eB>ey){ex=ey;return true}ey-=eB;++ez});return ea(this,K(ez,ex))},indexFromPos:function(ey){ey=ea(this,ey);var ex=ey.ch;if(ey.line<this.first||ey.ch<0)return 0;this.iter(this.first,ey.line,function(ez){ex+=ez.text.length+1});return ex},copy:function(ex){var ey=new aa(aA(this,this.first,this.first+this.size),this.modeOption,this.first);ey.scrollTop=this.scrollTop;ey.scrollLeft=this.scrollLeft;ey.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:false,goalColumn:this.sel.goalColumn};if(ex){ey.history.undoDepth=this.history.undoDepth;ey.setHistory(this.getHistory)}return ey},linkedDoc:function(ex){if(!ex)ex={};var eA=this.first,ez=this.first+this.size;if(ex.from!=null&&ex.from>eA)eA=ex.from;if(ex.to!=null&&ex.to<ez)ez=ex.to;var ey=new aa(aA(this,eA,ez),ex.mode||this.modeOption,eA);if(ex.sharedHist)ey.history=this.history;(this.linked||(this.linked=[])).push({doc:ey,sharedHist:ex.sharedHist});ey.linked=[{doc:this,isParent:true,sharedHist:ex.sharedHist}];return ey},unlinkDoc:function(ey){if(ey instanceof B)ey=ey.doc;if(this.linked)for(var ez=0;ez<this.linked.length;++ez){var eA=this.linked[ez];if(eA.doc!=ey)continue;this.linked.splice(ez,1);ey.unlinkDoc(this);break}if(ey.history==this.history){var ex=[ey.id];cO(ey,function(eB){ex.push(eB.id)},true);ey.history=ac;ey.history.done=be(this.history.done,ex);ey.history.undone=be(this.history.undone,ex)}},iterLinkedDocs:function(ex){cO(this,ex)},getMode:function{return this.mode},getEditor:function{return this.cm}});aa.prototype.eachLine=aa.prototype.iter;var d="iter insert remove copy getEditor".split(" ");for(var ba in aa.prototype)if(aa.prototype.hasOwnProperty(ba)&&cm(d,ba)<0)B.prototype[ba]=function(ex){return function{return ex.apply(this.doc,arguments)}}(aa.prototype[ba]);a1(aa);function cO(eA,ez,ey){function ex(eG,eE,eC){if(eG.linked)for(var eD=0;eD<eG.linked.length;++eD){var eB=eG.linked[eD];if(eB.doc==eE)continue;var eF=eC&&eB.sharedHist;if(ey&&!eF)continue;ez(eB.doc,eF);ex(eB.doc,eG,eF)}}ex(eA,null,true)}function cR(ex,ey){if(ey.cm)throw new Error("This document is already in use.");ex.doc=ey;ey.cm=ex;L(ex);aX(ex);if(!ex.options.lineWrapping)en(ex);ex.options.mode=ey.modeOption;Q(ex)}function dK(ex,eB){eB-=ex.first;while(!ex.lines)for(var ey=0;;++ey){var eA=ex.children[ey],ez=eA.chunkSize;if(eB<ez){ex=eA;break}eB-=ez}return ex.lines[eB]}function em(ez,eB,ex){var ey=[],eA=eB.line;ez.iter(eB.line,ex.line+1,function(eC){var eD=eC.text;if(eA==ex.line)eD=eD.slice(0,ex.ch);if(eA==eB.line)eD=eD.slice(eB.ch);ey.push(eD);++eA});return ey}function aA(ey,eA,ez){var ex=[];ey.iter(eA,ez,function(eB){ex.push(eB.text)});return ex}function ep(ey,ex){var ez=ex-ey.height;for(var eA=ey;eA;eA=eA.parent)eA.height+=ez}function bd(ex){if(ex.parent==null)return null;var eB=ex.parent,eA=cm(eB.lines,ex);for(var ey=eB.parent;ey;eB=ey,ey=ey.parent)for(var ez=0;;++ez){if(ey.children[ez]==eB)break;eA+=ey.children[ez].chunkSize}return eA+eB.first}function a6(eD,eB){var ez=eD.first;outer:do{for(var eA=0,eC=eD.children.length;eA<eC;++eA){var ey=eD.children[eA],ex=ey.height;if(eB<ex){eD=ey;continue outer}eB-=ex;ez+=ey.chunkSize}return ez}while(!eD.lines);for(var eA=0,eC=eD.lines.length;eA<eC;++eA){var eF=eD.lines[eA],eE=eF.height;if(eB<eE)break;eB-=eE}return ez+eA}function bc(ex,eA){eA=u(ex.doc,eA);var eC=0,ez=eA.parent;for(var eB=0;eB<ez.lines.length;++eB){var ey=ez.lines[eB];if(ey==eA)break;else eC+=ey.height}for(var eD=ez.parent;eD;ez=eD,eD=ez.parent)for(var eB=0;eB<eD.children.length;++eB){var eE=eD.children[eB];if(eE==ez)break;else eC+=eE.height}return eC}function a(ey){var ex=ey.order;if(ex==null)ex=ey.order=aM(ey.text);return ex}function ac(ex){return{done:[],undone:[],undoDepth:Infinity,lastTime:0,lastOp:null,lastOrigin:null,generation:ex||1,maxGeneration:ex||1}}function bm(ey,eC,eB,eA){var ex=eC["spans_"+ey.id],ez=0;ey.iter(Math.max(ey.first,eB),Math.min(ey.first+ey.size,eA),function(eD){if(eD.markedSpans)(ex||(ex=eC["spans_"+ey.id]={}))[ez]=eD.markedSpans;++ez})}function ct(ex,eA){var ez={line:eA.from.line,ch:eA.from.ch};var ey={from:ez,to:b6(eA),text:em(ex,eA.from,eA.to)};bm(ex,ey,eA.from.line,eA.to.line+1);cO(ex,function(eB){bm(eB,ey,eA.from.line,eA.to.line+1)},true);return ey}function dj(eC,eE,eB,ex){var eA=eC.history;eA.undone.length=0;var ez=+new Date,eD=d8(eA.done);if(eD&&(eA.lastOp==ex||eA.lastOrigin==eE.origin&&(eE.origin&&(eE.origin.charAt(0)=="+"&&(eC.cm&&eA.lastTime>ez-eC.cm.options.historyEventDelay)||eE.origin.charAt(0)=="*")))){var ey=d8(eD.changes);if(d9(eE.from,eE.to)&&d9(eE.from,ey.to))ey.to=b6(eE);else eD.changes.push(ct(eC,eE));eD.anchorAfter=eB.anchor;eD.headAfter=eB.head}else{eD={changes:[ct(eC,eE)],generation:eA.generation,anchorBefore:eC.sel.anchor,headBefore:eC.sel.head,anchorAfter:eB.anchor,headAfter:eB.head};eA.done.push(eD);while(eA.done.length>eA.undoDepth)eA.done.shift}eA.generation=++eA.maxGeneration;eA.lastTime=ez;eA.lastOp=ex;eA.lastOrigin=eE.origin;if(!ey)ah(eC,"historyAdded")}function aQ(ez){if(!ez)return null;for(var ey=0,ex;ey<ez.length;++ey)if(ez[ey].marker.explicitlyCleared){if(!ex)ex=ez.slice(0,ey)}else if(ex)ex.push(ez[ey]);return!ex?ez:ex.length?ex:null}function bs(eA,eB){var ez=eB["spans_"+eA.id];if(!ez)return null;for(var ey=0,ex=[];ey<eB.text.length;++ey)ex.push(aQ(ez[ey]));return ex}function be(eH,eA){for(var eD=0,ey=[];eD<eH.length;++eD){var ez=eH[eD],eF=ez.changes,eG=[];ey.push({changes:eG,anchorBefore:ez.anchorBefore,headBefore:ez.headBefore,anchorAfter:ez.anchorAfter,headAfter:ez.headAfter});for(var eC=0;eC<eF.length;++eC){var eE=eF[eC],eB;eG.push({from:eE.from,to:eE.to,text:eE.text});if(eA)for(var ex in eE)if(eB=ex.match(/^spans_(\d+)$/))if(cm(eA,Number(eB[1]))>-1){d8(eG)[ex]=eE[ex];delete eE[ex]}}}return ey}function dw(eA,ez,ey,ex){if(ey<eA.line)eA.line+=ex;else if(ez<eA.line){eA.line=ez;eA.ch=0}}function dN(eA,eC,eD,eE){for(var ez=0;ez<eA.length;++ez){var ex=eA[ez],eB=true;for(var ey=0;ey<ex.changes.length;++ey){var eF=ex.changes[ey];if(!ex.copied){eF.from=bD(eF.from);eF.to=bD(eF.to)}if(eD<eF.from.line){eF.from.line+=eE;eF.to.line+=eE}else if(eC<=eF.to.line){eB=false;break}}if(!ex.copied){ex.anchorBefore=bD(ex.anchorBefore);ex.headBefore=bD(ex.headBefore);ex.anchorAfter=bD(ex.anchorAfter);ex.readAfter=bD(ex.headAfter);ex.copied=true}if(!eB){eA.splice(0,ez+1);ez=0}else{dw(ex.anchorBefore);dw(ex.headBefore);dw(ex.anchorAfter);dw(ex.headAfter)}}}function cA(ey,eB){var eA=eB.from.line,ez=eB.to.line,ex=eB.text.length-(ez-eA)-1;dN(ey.done,eA,ez,ex);dN(ey.undone,eA,ez,ex)}function ds{c3(this)}function Y(ex){if(!ex.stop)ex.stop=ds;return ex}function bW(ex){if(ex.preventDefault)ex.preventDefault;else ex.returnValue=false}function cq(ex){if(ex.stopPropagation)ex.stopPropagation;else ex.cancelBubble=true}function bb(ex){return ex.defaultPrevented!=null?ex.defaultPrevented:ex.returnValue==false}function c3(ex){bW(ex);cq(ex)}B.e_stop=c3;B.e_preventDefault=bW;B.e_stopPropagation=cq;function D(ex){return ex.target||ex.srcElement}function ec(ey){var ex=ey.which;if(ex==null)if(ey.button&1)ex=1;else if(ey.button&2)ex=3;else if(ey.button&4)ex=2;if(br&&(ey.ctrlKey&&ex==1))ex=3;return ex}function bl(eA,ey,ez){if(eA.addEventListener)eA.addEventListener(ey,ez,false);else if(eA.attachEvent)eA.attachEvent("on"+ey,ez);else{var eB=eA._handlers||(eA._handlers={});var ex=eB[ey]||(eB[ey]=[]);ex.push(ez)}}function cU(eB,ez,eA){if(eB.removeEventListener)eB.removeEventListener(ez,eA,false);else if(eB.detachEvent)eB.detachEvent("on"+ez,eA);else{var ex=eB._handlers&&eB._handlers[ez];if(!ex)return;for(var ey=0;ey<ex.length;++ey)if(ex[ey]==eA){ex.splice(ey,1);break}}}function ah(eB,eA){var ex=eB._handlers&&eB._handlers[eA];if(!ex)return;var ey=Array.prototype.slice.call(arguments,2);for(var ez=0;ez<ex.length;++ez)ex[ez].apply(null,ey)}var aU,bM=0;function O(eC,eB){var ex=eC._handlers&&eC._handlers[eB];if(!ex)return;var ez=Array.prototype.slice.call(arguments,2);if(!aU){++bM;aU=[];setTimeout(db,0)}function ey(eD){return function{eD.apply(null,ez)}}for(var eA=0;eA<ex.length;++eA)aU.push(ey(ex[eA]))}function ar(ex,ez,ey){ah(ex,ey||ez.type,ex,ez);return bb(ez)||ez.codemirrorIgnore}function db{--bM;var ex=aU;aU=null;for(var ey=0;ey<ex.length;++ey)ex[ey]}function dQ(ez,ey){var ex=ez._handlers&&ez._handlers[ey];return ex&&ex.length>0}B.on=bl;B.off=cU;B.signal=ah;function a1(ex){ex.prototype.on=function(ey,ez){bl(this,ey,ez)};ex.prototype.off=function(ey,ez){cU(this,ey,ez)}}var aP=30;var bw=B.Pass={toString:function{return"CodeMirror.Pass"}};function ew{this.id=null}ew.prototype={set:function(ex,ey){clearTimeout(this.id);this.id=setTimeout(ey,ex)}};function bh(ez,ex,eB,eC,ey){if(ex==null){ex=ez.search(/[^\s\u00a0]/);if(ex==-1)ex=ez.length}for(var eA=eC||0,eD=ey||0;eA<ex;++eA)if(ez.charAt(eA)=="\t")eD+=eB-eD%eB;else++eD;return eD}B.countColumn=bh;var ax=[""];function bK(ex){while(ax.length<=ex)ax.push(d8(ax)+" ");return ax[ex]}function d8(ex){return ex[ex.length-1]}function cD(ey){if(dz){ey.selectionStart=0;ey.selectionEnd=ey.value.length}else try{ey.select}catch(ex){}}function cm(eA,ex){if(eA.indexOf)return eA.indexOf(ex);for(var ey=0,ez=eA.length;ey<ez;++ey)if(eA[ey]==ex)return ey;return-1}function bE(eA,ey){function ex{}ex.prototype=eA;var ez=new ex;if(ey)am(ey,ez);return ez}function am(ey,ex){if(!ex)ex={};for(var ez in ey)if(ey.hasOwnProperty(ez))ex[ez]=ey[ez];return ex}function U(ez){for(var ex=[],ey=0;ey<ez;++ey)ex.push(undefined);return ex}function bP(ey){var ex=Array.prototype.slice.call(arguments,1);return function{return ey.apply(null,ex)}}var aI=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function bS(ex){return/\w/.test(ex)||ex>"\u0080"&&(ex.toUpperCase!=ex.toLowerCase||aI.test(ex))}function du(ex){for(var ey in ex)if(ex.hasOwnProperty(ey)&&ex[ey])return false;return true}var dm=/[\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 dW(ex){return ex.charCodeAt(0)>=768&&dm.test(ex)}function ek(ex,eB,eA,ez){var eC=document.createElement(ex);if(eA)eC.className=eA;if(ez)eC.style.cssText=ez;if(typeof eB=="string")l(eC,eB);else if(eB)for(var ey=0;ey<eB.length;++ey)eC.appendChild(eB[ey]);return eC}function cL(ey){for(var ex=ey.childNodes.length;ex>0;--ex)ey.removeChild(ey.firstChild);return ey}function bg(ex,ey){return cL(ex).appendChild(ey)}function l(ex,ey){if(bF){ex.innerHTML="";ex.appendChild(document.createTextNode(ey))}else ex.textContent=ey}function an(ex){return ex.getBoundingClientRect}B.replaceGetRect=function(ex){an=ex};var dn=function{if(bF)return false;var ex=ek("div");return"draggable"in ex||"dragDrop"in ex};function bv{return false}if(bJ)bv=function(ey,ex){return ey.charCodeAt(ex-1)==36&&ey.charCodeAt(ex)==39};else if(ag&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent))bv=function(ey,ex){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(ey.slice(ex-1,ex+1))};else if(b9&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent))bv=function(ez,ex){var ey=ez.charCodeAt(ex-1);return ey>=8208&&ey<=8212};else if(b9)bv=function(ey,ex){if(ex>1&&ey.charCodeAt(ex-1)==45){if(/\w/.test(ey.charAt(ex-2))&&/[^\-?\.]/.test(ey.charAt(ex)))return true;if(ex>2&&(/[\d\.,]/.test(ey.charAt(ex-2))&&/[\d\.,]/.test(ey.charAt(ex))))return false}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|\u2026[\w~`@#$%\^&*(_=+{[><]/.test(ey.slice(ex-1,ex+1))};var c7;function i(ex){if(c7!=null)return c7;var ey=ek("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");bg(ex,ey);if(ey.offsetWidth)c7=ey.offsetHeight-ey.clientHeight;return c7||0}var eb;function aT(ex){if(eb==null){var ey=ek("span","\u200b");bg(ex,ek("span",[ey,document.createTextNode("x")]));if(ex.firstChild.offsetHeight!=0)eb=ey.offsetWidth<=1&&(ey.offsetHeight>2&&!bG)}if(eb)return ek("span","\u200b");else return ek("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px")}var ay="\n\nb".split(/\n/).length!=3?function(eC){var eD=0,ex=[],eB=eC.length;while(eD<=eB){var eA=eC.indexOf("\n",eD);if(eA==-1)eA=eC.length;var ez=eC.slice(eD,eC.charAt(eA-1)=="\r"?eA-1:eA);var ey=ez.indexOf("\r");if(ey!=-1){ex.push(ez.slice(0,ey));eD+=ey+1}else{ex.push(ez);eD=eA+1}}return ex}:function(ex){return ex.split(/\r\n?|\n/)};B.splitLines=ay;var aY=window.getSelection?function(ey){try{return ey.selectionStart!=ey.selectionEnd}catch(ex){return false}}:function(ez){try{var ex=ez.ownerDocument.selection.createRange}catch(ey){}if(!ex||ex.parentElement!=ez)return false;return ex.compareEndPoints("StartToEnd",ex)!=0};var cf=function{var ex=ek("div");if("oncopy"in ex)return true;ex.setAttribute("oncopy","return;");return typeof ex.oncopy=="function"};var dM={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};B.keyNames=dM;(function{for(var ex=0;ex<10;ex++)dM[ex+48]=dM[ex+96]=String(ex);for(var ex=65;ex<=90;ex++)dM[ex]=String.fromCharCode(ex);for(var ex=1;ex<=12;ex++)dM[ex+111]=dM[ex+63235]="F"+ex});function cM(ex,eD,eC,eB){if(!ex)return eB(eD,eC,"ltr");var eA=false;for(var ez=0;ez<ex.length;++ez){var ey=ex[ez];if(ey.from<eC&&ey.to>eD||eD==eC&&ey.to==eD){eB(Math.max(ey.from,eD),Math.min(ey.to,eC),ey.level==1?"rtl":"ltr");eA=true}}if(!eA)eB(eD,eC,"ltr")}function cw(ex){return ex.level%2?ex.to:ex.from}function es(ex){return ex.level%2?ex.from:ex.to}function bV(ey){var ex=a(ey);return ex?cw(ex[0]):0}function b5(ey){var ex=a(ey);if(!ex)return ey.text.length;return es(d8(ex))}function aZ(ey,eB){var ez=dK(ey.doc,eB);var eC=u(ey.doc,ez);if(eC!=ez)eB=bd(eC);var ex=a(eC);var eA=!ex?0:ex[0].level%2?b5(eC):bV(eC);return K(eB,eA)}function cF(ez,eC){var ey,eA;while(ey=c6(eA=dK(ez.doc,eC)))eC=ey.find.to.line;var ex=a(eA);var eB=!ex?eA.text.length:ex[0].level%2?bV(eA):b5(eA);return K(eC,eB)}function X(ey,ez,ex){var eA=ey[0].level;if(ez==eA)return true;if(ex==eA)return false;return ez<ex}var dA;function aj(ex,eB){dA=null;for(var ey=0,ez;ey<ex.length;++ey){var eA=ex[ey];if(eA.from<eB&&eA.to>eB)return ey;if(eA.from==eB||eA.to==eB)if(ez==null)ez=ey;else if(X(ex,eA.level,ex[ez].level)){if(eA.from!=eA.to)dA=ez;return ey}else{if(eA.from!=eA.to)dA=ey;return ez}}return ez}function dJ(ex,eA,ey,ez){if(!ez)return eA+ey;do eA+=ey;while(eA>0&&dW(ex.text.charAt(eA)));return eA}function q(ex,eE,ez,eA){var eB=a(ex);if(!eB)return R(ex,eE,ez,eA);var eD=aj(eB,eE),ey=eB[eD];var eC=dJ(ex,eE,ey.level%2?-ez:ez,eA);for{if(eC>ey.from&&eC<ey.to)return eC;if(eC==ey.from||eC==ey.to){if(aj(eB,eC)==eD)return eC;ey=eB[eD+=ez];return ez>0==ey.level%2?ey.to:ey.from}else{ey=eB[eD+=ez];if(!ey)return null;if(ez>0==ey.level%2)eC=dJ(ex,ey.to,-1,eA);else eC=dJ(ex,ey.from,1,eA)}}}function R(ex,eB,ey,ez){var eA=eB+ey;if(ez)while(eA>0&&dW(ex.text.charAt(eA)))eA+=ey;return eA<0||eA>ex.text.length?null:eA}var aM=function{var eD="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";var eB="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr";function eA(eG){if(eG<=255)return eD.charAt(eG);else if(1424<=eG&&eG<=1524)return"R";else if(1536<=eG&&eG<=1791)return eB.charAt(eG-1536);else if(1792<=eG&&eG<=2220)return"r";else return"L"}var ex=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var eF=/[stwN]/,ez=/[LRr]/,ey=/[Lb1n]/,eC=/[1n]/;var eE="L";return function(eQ){if(!ex.test(eQ))return false;var eW=eQ.length,eM=[];for(var eV=0,eI;eV<eW;++eV)eM.push(eI=eA(eQ.charCodeAt(eV)));for(var eV=0,eP=eE;eV<eW;++eV){var eI=eM[eV];if(eI=="m")eM[eV]=eP;else eP=eI}for(var eV=0,eG=eE;eV<eW;++eV){var eI=eM[eV];if(eI=="1"&&eG=="r")eM[eV]="n";else if(ez.test(eI)){eG=eI;if(eI=="r")eM[eV]="R"}}for(var eV=1,eP=eM[0];eV<eW-1;++eV){var eI=eM[eV];if(eI=="+"&&(eP=="1"&&eM[eV+1]=="1"))eM[eV]="1";else if(eI==","&&(eP==eM[eV+1]&&(eP=="1"||eP=="n")))eM[eV]=eP;eP=eI}for(var eV=0;eV<eW;++eV){var eI=eM[eV];if(eI==",")eM[eV]="N";else if(eI=="%"){for(var eJ=eV+1;eJ<eW&&eM[eJ]=="%";++eJ);var eX=eV&&eM[eV-1]=="!"||eJ<eW&&eM[eJ]=="1"?"1":"N";for(var eT=eV;eT<eJ;++eT)eM[eT]=eX;eV=eJ-1}}for(var eV=0,eG=eE;eV<eW;++eV){var eI=eM[eV];if(eG=="L"&&eI=="1")eM[eV]="L";else if(ez.test(eI))eG=eI}for(var eV=0;eV<eW;++eV)if(eF.test(eM[eV])){for(var eJ=eV+1;eJ<eW&&eF.test(eM[eJ]);++eJ);var eN=(eV?eM[eV-1]:eE)=="L";var eH=(eJ<eW?eM[eJ]:eE)=="L";var eX=eN||eH?"L":"R";for(var eT=eV;eT<eJ;++eT)eM[eT]=eX;eV=eJ-1}var eU=[],eR;for(var eV=0;eV<eW;)if(ey.test(eM[eV])){var eK=eV;for(++eV;eV<eW&&ey.test(eM[eV]);++eV);eU.push({from:eK,to:eV,level:0})}else{var eL=eV,eO=eU.length;for(++eV;eV<eW&&eM[eV]!="L";++eV);for(var eT=eL;eT<eV;)if(eC.test(eM[eT])){if(eL<eT)eU.splice(eO,0,{from:eL,to:eT,level:1});var eS=eT;for(++eT;eT<eV&&eC.test(eM[eT]);++eT);eU.splice(eO,0,{from:eS,to:eT,level:2});eL=eT}else++eT;if(eL<eV)eU.splice(eO,0,{from:eL,to:eV,level:1})}if(eU[0].level==1&&(eR=eQ.match(/^\s+/))){eU[0].from=eR[0].length;eU.unshift({from:0,to:eR[0].length,level:0})}if(d8(eU).level==1&&(eR=eQ.match(/\s+$/))){d8(eU).to-=eR[0].length;eU.push({from:eW-eR[0].length,to:eW,level:0})}if(eU[0].level!=d8(eU).level)eU.push({from:eW,to:eW,level:eU[0].level});return eU}};B.version="3.21.1";return B};