-
Notifications
You must be signed in to change notification settings - Fork 0
/
f65a48b9-c17f53720034fc9d5f50.js.map
1 lines (1 loc) · 693 KB
/
f65a48b9-c17f53720034fc9d5f50.js.map
1
{"version":3,"sources":["webpack:///./node_modules/codemirror/lib/codemirror.js"],"names":["module","exports","userAgent","navigator","platform","gecko","test","ie_upto10","ie_11up","exec","edge","ie","ie_version","document","documentMode","webkit","qtwebkit","chrome","presto","safari","vendor","mac_geMountainLion","phantom","ios","android","mobile","mac","chromeOS","windows","presto_version","match","Number","flipCtrlCmd","captureRightClick","classTest","cls","RegExp","range","rmClass","node","current","className","after","slice","index","length","removeChildren","e","count","childNodes","removeChild","firstChild","removeChildrenAndAdd","parent","appendChild","elt","tag","content","style","createElement","cssText","createTextNode","i","eltP","setAttribute","contains","child","nodeType","parentNode","host","activeElt","activeElement","body","shadowRoot","addClass","joinClasses","a","b","as","split","createRange","start","end","endNode","r","setEnd","setStart","createTextRange","moveToElementText","collapse","moveEnd","moveStart","selectInput","select","bind","f","args","Array","prototype","call","arguments","apply","copyObj","obj","target","overwrite","prop","hasOwnProperty","countColumn","string","tabSize","startIndex","startValue","search","n","nextTab","indexOf","selectionStart","selectionEnd","value","_e","Delayed","this","id","time","handler","onTimeout","array","self","Date","setTimeout","set","ms","clearTimeout","Pass","toString","sel_dontScroll","scroll","sel_mouse","origin","sel_move","findColumn","goal","pos","col","skipped","Math","min","spaceStrs","spaceStr","push","lst","arr","map","out","nothing","createObj","base","props","inst","Object","create","nonASCIISingleCaseWordChar","isWordCharBasic","ch","toUpperCase","toLowerCase","isWordChar","helper","source","isEmpty","extendingChars","isExtendingChar","charCodeAt","skipExtendingChars","str","dir","charAt","findFirst","pred","from","to","midF","mid","ceil","floor","bidiOther","getBidiPartAt","order","sticky","found","cur","bidiOrdering","bidiRE","isNeutral","isStrong","countsAsLeft","countsAsNum","BidiSpan","level","direction","outerType","code","len","types","i$1","prev","type","i$2","type$1","i$3","prev$1","type$2","i$4","type$3","replace","j","i$5","cur$1","type$4","i$6","end$1","before","replace$1","j$1","m","i$7","at","isRTL","j$2","splice","nstart","unshift","reverse","getOrder","line","text","noHandlers","on","emitter","addEventListener","attachEvent","_handlers","concat","getHandlers","off","removeEventListener","detachEvent","signal","handlers","signalDOMEvent","cm","override","preventDefault","defaultPrevented","e_defaultPrevented","codemirrorIgnore","signalCursorActivity","cursorActivity","curOp","cursorActivityHandlers","hasHandler","eventMixin","ctor","e_preventDefault","returnValue","e_stopPropagation","stopPropagation","cancelBubble","e_stop","e_target","srcElement","e_button","which","button","ctrlKey","zwspSupported","badBidiRects","dragAndDrop","div","zeroWidthElement","measure","offsetHeight","offsetWidth","hasBadBidiRects","txt","r0","getBoundingClientRect","r1","left","right","splitLinesAuto","result","l","nl","rt","hasSelection","window","getSelection","te","ownerDocument","selection","parentElement","compareEndPoints","hasCopyEvent","oncopy","badZoomedRects","modes","mimeModes","defineMode","name","mode","dependencies","resolveMode","spec","getMode","options","mfactory","modeObj","modeExtensions","exts","helperType","modeProps","prop$1","extendMode","properties","copyState","state","nstate","val","innerMode","info","startState","a1","a2","StringStream","lineOracle","lastColumnPos","lastColumnValue","lineStart","getLine","doc","first","size","Error","chunk","lines","children","sz","chunkSize","getBetween","iter","getLines","updateLineHeight","height","diff","lineNo","no","_lineAtHeight","h","outer","lh","isLine","lineNumberFor","String","lineNumberFormatter","firstLineNumber","Pos","cmp","equalCursorPos","copyPos","x","maxPos","minPos","clipLine","max","_clipPos","last","linelen","clipToLen","clipPosArray","eol","sol","peek","undefined","next","eat","eatWhile","eatSpace","skipToEnd","skipTo","backUp","column","indentation","pattern","consume","caseInsensitive","cased","substr","hideFirstChars","inner","lookAhead","oracle","baseToken","SavedContext","Context","maxLookAhead","baseTokens","baseTokenPos","highlightLine","context","forceToEnd","st","modeGen","lineClasses","runMode","loop","o","overlay","overlays","i_end","opaque","styles","classes","bgClass","textClass","getLineStyles","updateFrontier","getContextBefore","resetState","maxHighlightLength","stateAfter","save","styleClasses","highlightFrontier","modeFrontier","precise","display","minindent","minline","lim","indented","findStartLine","saved","fromSaved","processLine","viewFrom","viewTo","nextLine","startAt","stream","callBlankLine","readToken","blankLine","token","copy","Token","takeToken","asArray","tokens","extractLineClasses","output","lineClass","flattenSpans","curStart","curStyle","addModeClass","mName","sawReadOnlySpans","sawCollapsedSpans","MarkedSpan","marker","getMarkedSpanFor","spans","span","removeMarkedSpan","stretchSpansOverChange","change","full","oldFirst","markedSpans","oldLast","startCh","endCh","isInsert","old","nw","inclusiveLeft","insertLeft","endsAfter","inclusiveRight","markedSpansBefore","startsBefore","markedSpansAfter","sameLine","offset","span$1","clearEmptySpans","newMarkers","gapMarkers","gap","clearWhenEmpty","detachMarkedSpans","detachLine","attachMarkedSpans","attachLine","extraLeft","extraRight","compareCollapsedMarkers","lenDiff","aPos","find","bPos","fromCmp","toCmp","collapsedSpanAtSide","sps","sp","collapsed","collapsedSpanAtStart","collapsedSpanAtEnd","collapsedSpanAround","conflictingCollapsedRange","visualLine","merged","visualLineNo","lineN","vis","visualLineEndNo","lastLine","lineIsHidden","widgetNode","lineIsHiddenInner","_heightAtLine","lineObj","p","lineLength","found$1","findMaxLine","d","maxLine","maxLineLength","maxLineChanged","Line","estimateHeight","cleanUpLine","styleToClassCache","styleToClassCacheWithMode","interpretTokenStyle","cache","buildLineContent","lineView","builder","pre","trailingSpace","splitSpaces","getOption","rest","addToken","buildToken","buildTokenBadBidi","insertLineContent","externalMeasured","maps","caches","lastChild","querySelector","defaultSpecialCharPlaceholder","title","startStyle","endStyle","css","attributes","displayText","trailingBefore","spaceBefore","special","specialChars","mustWrap","createDocumentFragment","lastIndex","txt$1","tabWidth","specialCharPlaceholder","fullStyle","attr","part","buildCollapsedSpan","ignoreWidget","widget","input","needsContentAttribute","setUneditable","allText","spanStyle","spanEndStyle","spanStartStyle","nextChange","Infinity","foundBookmarks","endStyles","upto","tokenText","LineView","visualLineContinued","hidden","buildViewArray","nextPos","view","operationGroup","orphanDelayedCallbacks","signalLater","list","delayedCallbacks","fireOrphanDelayed","delayed","updateLineForChanges","dims","changes","updateLineText","updateLineGutter","updateLineClasses","updateLineWidgets","ensureLineWrapped","replaceChild","zIndex","getLineContent","ext","built","background","wrap","insertBefore","updateLineBackground","wrapClass","gutter","gutterBackground","gutterClass","fixedGutter","fixedPos","gutterTotalWidth","markers","gutterMarkers","lineNumbers","wrap$1","gutterWrap","lineNumber","gutterLeft","lineNumInnerWidth","k","gutterSpecs","gutterWidth","alignable","isWidget","nextSibling","insertLineWidgets","buildLineElement","insertLineWidgetsFor","allowAbove","widgets","ws","handleMouseEvents","positionLineWidget","above","noHScroll","width","wrapperWidth","coverGutter","paddingLeft","position","marginLeft","widgetHeight","parentStyle","gutters","wrapper","clientWidth","eventInWidget","getAttribute","sizer","mover","paddingTop","lineSpace","offsetTop","paddingVert","paddingH","cachedPaddingH","getComputedStyle","currentStyle","data","parseInt","paddingRight","isNaN","scrollGap","nativeBarWidth","displayWidth","scroller","barWidth","displayHeight","clientHeight","barHeight","mapFromLineView","measureChar","bias","measureCharPrepared","prepareMeasureForLine","findViewForLine","findViewIndex","getDimensions","forceUpdate","lineMeasure","updateExternalMeasurement","rect","hasHeights","prepared","varHeight","key","wrapping","lineWrapping","curWidth","heights","rects","getClientRects","abs","bottom","top","ensureLineHeights","place","nodeAndOffsetInLineMap","coverStart","coverEnd","getUsefulRect","screen","logicalXDPI","deviceXDPI","normal","fromRange","hasBadZoomedRects","scaleX","scaleY","logicalYDPI","deviceYDPI","maybeUpdateRectForZooming","rSpan","charWidth","nullRect","rtop","rbot","bot","bogus","singleCursorHeightPerLine","rbottom","measureCharInner","measureText","mStart","mEnd","clearLineMeasurementCacheFor","clearLineMeasurementCache","externalMeasure","clearCaches","cachedCharWidth","cachedTextHeight","lineNumChars","pageScrollX","pageXOffset","documentElement","scrollLeft","pageScrollY","marginTop","pageYOffset","scrollTop","widgetTopHeight","intoCoordSystem","includeWidgets","yOff","viewOffset","lOff","xOff","fromCoordSystem","coords","localBox","lineSpaceBox","_charCoords","_cursorCoords","preparedMeasure","get","getBidi","partPos","invert","other","estimateCoords","PosWithInfo","outside","xRel","_coordsChar","y","coordsCharInner","rangeEnd","wrappedLineExtent","begin","wrappedLineExtentChar","boxIsAfter","box","ltr","coordsBidiPartWrapped","coordsBidiPart","baseX","chAround","boxAround","atLeft","atStart","_lineNo","ref","closestDist","endX","dist","textHeight","anchor","clientLeft","offsetLeft","compensateForHScroll","th","perLine","widgetsHeight","estimateLineHeights","est","estHeight","posFromMouse","liberal","forRect","space","clientX","clientY","colDiff","round","regChange","lendiff","updateLineNumbers","viewChanged","resetView","cut","viewCuttingPoint","cut$1","cutTop","cutBot","regLineChange","oldN","newN","countDirtyView","dirty","updateSelection","showSelection","prepareSelection","primary","curFragment","cursors","selFragment","sel","ranges","primIndex","empty","showCursorWhenSelecting","drawSelectionCursor","head","drawSelectionRange","cursor","cursorHeight","otherCursor","cmpCoords","fragment","padding","leftSide","rightSide","sizerWidth","docLTR","add","drawForLine","fromArg","toArg","lineLen","wrapX","side","extent","iterateBidiSections","fromPos","toPos","openStart","openEnd","openRight","topLeft","topRight","botLeft","botRight","sFrom","sTo","fromLine","toLine","singleVLine","leftEnd","rightStart","restartBlink","focused","clearInterval","blinker","cursorDiv","visibility","cursorBlinkRate","setInterval","ensureFocus","focus","onFocus","delayBlurEvent","delayingBlurEvent","onBlur","readOnly","selForContextMenu","reset","receivedFocus","shift","updateHeightsInViewport","prevBottom","lineDiv","updateWidgetHeight","chWidth","w","visibleLines","viewport","ensure","ensureFrom","ensureTo","calculateScrollPos","snapMargin","screentop","docBottom","atTop","atBottom","newTop","screenleft","screenw","tooWide","addToScrollTop","resolveScrollToPos","ensureCursorVisible","getCursor","scrollToPos","margin","cursorScrollMargin","scrollToCoords","scrollToCoordsRange","sPos","updateScrollTop","updateDisplaySimple","setScrollTop","startWorker","forceScroll","scrollHeight","scrollbars","setScrollLeft","isScroller","scrollWidth","alignHorizontally","measureForScrollbars","gutterW","docH","viewHeight","viewWidth","barLeft","docHeight","NativeScrollbars","vert","horiz","tabIndex","checkedZeroWidth","minHeight","minWidth","update","needsH","needsV","sWidth","totalHeight","totalWidth","zeroWidthHack","disableHoriz","enableZeroWidthBar","disableVert","pointerEvents","bar","delay","maybeDisable","elementFromPoint","clear","NullScrollbars","updateScrollbars","startWidth","startHeight","updateScrollbarsInner","sizes","paddingBottom","heightForcer","borderBottom","scrollbarFiller","coverGutterNextToScrollbar","gutterFiller","scrollbarModel","initScrollbars","scrollbarStyle","axis","nextOpId","_startOperation","op","updateInput","typing","changeObjs","cursorActivityCalled","selectionChanged","updateMaxLine","ops","ownsGroup","_endOperation","endCb","group","callbacks","fireCallbacksForOps","finishOperation","endOperation_R1","endOperation_W1","endOperation_R2","endOperation_W2","endOperation_finish","endOperations","scrollbarsClipped","marginBottom","borderRightWidth","maybeClipScrollbars","mustUpdate","DisplayUpdate","updatedDisplay","updateDisplayIfNeeded","barMeasure","adjustWidthTo","maxScrollLeft","preparedSelection","takeFocus","setDocumentHeight","postUpdateDisplay","wheelStartX","wheelStartY","doScroll","innerHeight","scrollNode","scrollIntoView","maybeScrollWindow","limit","changed","endCoords","scrollPos","startTop","startLeft","scrollPosIntoView","maybeHiddenMarkers","unhidden","maybeUnhiddenMarkers","finish","runInOp","operation","methodOp","docMethodOp","highlight","highlightWorker","workTime","changedLines","oldStyles","highlighted","oldCls","newCls","ischange","workDelay","force","visible","editorIsHidden","wrapperHeight","oldDisplayWidth","events","renderedView","maybeUpdateLineNumberWidth","viewportMargin","different","lastWrapHeight","lastWrapWidth","adjustView","toUpdate","selSnapshot","hasFocus","active","anchorNode","extend","anchorOffset","focusNode","focusOffset","selectionSnapshot","updateNumbersFrom","container","rm","currentWheelTarget","updateNumber","patchDisplay","snapshot","removeAllRanges","addRange","restoreSelection","selectionDiv","reportedViewFrom","reportedViewTo","updateGutterSpace","alignWidgets","comp","align","innerW","lineGutter","lineNumWidth","getGutters","sawLineNumbers","renderGutters","specs","gElt","updateGutters","Display","draggable","wheelDX","wheelDY","activeTouch","init","wheelSamples","wheelPixelsPerUnit","wheelEventDelta","dx","wheelDeltaX","dy","wheelDeltaY","detail","HORIZONTAL_AXIS","VERTICAL_AXIS","wheelDelta","wheelEventPixels","delta","onScrollWheel","canScrollX","canScrollY","pixels","movedX","movedY","sample","Selection","equals","here","there","deepCopy","Range","somethingSelected","normalizeSelection","mayTouch","selectionsMayTouch","prim","sort","inv","simpleSelection","changeEnd","adjustForChange","computeSelAfterChange","offsetPos","loadMode","modeOption","resetModeState","isWholeLineUpdate","wholeLineUpdateBefore","updateDoc","spansFor","updateLine","linesFor","firstLine","lastText","lastSpans","nlines","insert","remove","added","added$1","added$2","linkedDocs","sharedHistOnly","propagate","skip","sharedHist","linked","rel","shared","attachDoc","setDirectionClass","History","startGen","done","undone","undoDepth","lastModTime","lastSelTime","lastOp","lastSelOp","lastOrigin","lastSelOrigin","generation","maxGeneration","historyChangeFromChange","histChange","attachLocalSpans","clearSelectionEvents","pop","addChangeToHistory","selAfter","opId","hist","history","historyEventDelay","lastChangeEvent","pushSelectionToHistory","addSelectionToHistory","selectionEventCanBeMerged","clearRedo","dest","existing","removeClearedSpans","explicitlyCleared","mergeOldSpans","getOldSpans","stretched","oldCur","stretchCur","copyHistoryArray","newGroup","instantiateSel","event","newChanges","extendRange","posBefore","extendSelection","setSelection","extendSelections","heads","replaceOneSelection","setSimpleSelection","setSelectionReplaceHistory","setSelectionNoUndo","NaN","filterSelectionChange","setSelectionInner","skipAtomicInSelection","reCheckSelection","mayClear","newAnchor","skipAtomic","newHead","skipAtomicInner","oldPos","preventCursorLeft","selectLeft","preventCursorRight","selectRight","atomic","near","movePos","far","cantEdit","selectAll","filterChange","canceled","cancel","makeChange","ignoreReadOnly","suppressEdits","mark","parts","mk","newParts","dfrom","dto","removeReadOnlyRanges","makeChangeInner","makeChangeSingleDoc","rebased","rebaseHist","makeChangeFromHistory","allowSelectionOnly","suppress","antiChanges","filter","returned","v","shiftDoc","distance","removed","recomputeMaxLength","checkWidthStart","retreatFrontier","changesHandler","changeHandler","makeChangeSingleDocInEditor","_replaceRange","assign","splitLines","rebaseHistSelSingle","rebaseHistArray","sub","ok","copied","changeLine","handle","changeType","LeafChunk","BranchChunk","removeInner","insertInner","iterN","oldHeight","remaining","leaf","maybeSpill","me","sibling","myIndex","used","LineWidget","opt","adjustScrollWhenAboveVisible","this$1","oldH","nextMarkerId","TextMarker","_markText","cloneNode","isParent","SharedTextMarker","markTextShared","replacedWith","addToHistory","curLine","addMarkedSpan","clearOnEnter","clearHistory","withOp","visual","dHeight","findSharedMarkers","findMarks","clipPos","detachSharedMarkers","subMarker","nextDocId","Doc","lineSep","cleanGeneration","constructor","getValue","join","lineSeparator","setValue","replaceRange","getRange","getLineHandle","getLineNumber","getLineHandleVisualStart","lineCount","listSelections","setCursor","extendSelectionsBy","setSelections","addSelection","getSelections","replaceSelection","dup","replaceSelections","newSel","hint","oldPrev","newPrev","computeReplacedSel","undo","redo","undoSelection","redoSelection","setExtending","getExtending","historySize","markClean","changeGeneration","forceSplit","isClean","gen","getHistory","setHistory","histData","setGutterMarker","gutterID","clearGutter","lineInfo","addLineClass","where","removeLineClass","addLineWidget","insertAt","aboveVisible","removeLineWidget","markText","setBookmark","realOpts","findMarksAt","getAllMarks","posFromIndex","sepSize","indexFromPos","copyHistory","linkedDoc","mFrom","mTo","subMark","copySharedMarkers","unlinkDoc","CodeMirror","splitIds","iterLinkedDocs","getEditor","setDirection","eachLine","lastDrop","onDrop","clearDragCursor","files","dataTransfer","isReadOnly","FileReader","File","read","markAsReadAndPasteIfAllFilesAreRead","t","readTextFromFile","file","allowDropFileTypes","reader","onerror","onload","readAsText","draggingText","text$1","getData","selected","dragCursor","forEachCodeMirror","getElementsByClassName","byClass","editors","globalsRegistered","ensureGlobalHandlers","resizeTimer","onResize","setSize","keyNames","3","8","9","13","16","17","18","19","20","27","32","33","34","35","36","37","38","39","40","44","45","46","59","61","91","92","93","106","107","109","110","111","145","173","186","187","188","189","190","191","192","219","220","221","222","63232","63233","63234","63235","63272","63273","63275","63276","63277","63302","fromCharCode","keyMap","normalizeKeyName","alt","ctrl","cmd","mod","normalizeKeyMap","keymap","keyname","keys","lookupKey","getKeyMap","fallthrough","isModifierKey","keyCode","addModifierNames","noShift","altKey","metaKey","shiftKey","keyName","altGraphKey","deleteNearSelection","compute","kill","toKill","replaced","moveCharLogically","moveLogically","endOfLine","visually","prep","targetTop","basic","pcDefault","emacsy","macDefault","commands","singleSelection","killLine","deleteLine","delLineLeft","delWrappedLineLeft","charCoords","coordsChar","delWrappedLineRight","rightPos","goDocStart","goDocEnd","goLineStart","goLineStartSmart","lineStartSmart","goLineEnd","visualLineEnd","lineEnd","goLineRight","cursorCoords","goLineLeft","goLineLeftSmart","goLineUp","moveV","goLineDown","goPageUp","goPageDown","goCharLeft","moveH","goCharRight","goColumnLeft","goColumnRight","goWordLeft","goGroupRight","goGroupLeft","goWordRight","delCharBefore","deleteH","delCharAfter","delWordBefore","delWordAfter","delGroupBefore","delGroupAfter","indentAuto","indentSelection","indentMore","indentLess","insertTab","insertSoftTab","spaces","defaultTab","execCommand","transposeChars","newlineAndIndent","sels","indentLine","openLine","toggleOverwrite","firstNonWS","inWS","doHandleBinding","bound","dropShift","ensurePolled","prevShift","stopSeq","dispatchKey","seq","keySeq","dispatchKeyInner","keyMaps","extraKeys","lookupKeyForEditor","handleKeyBinding","motion","lastStoppedKey","onKeyDown","handled","up","showCrossHair","onKeyUp","onKeyPress","charCode","handleCharBinding","lastClick","lastDoubleClick","PastClick","onMouseDown","supportsTouch","clickInGutter","repeat","now","compare","clickRepeat","selectingText","handleMappedButton","contained","behavior","option","unit","addNew","moveOnDrag","configureMouse","dragDrop","moved","dragEnd","mouseMove","dragStart","e2","leftButtonStartDrag","ourRange","ourIndex","startSel","rangeForUnit","lastPos","extendTo","startCol","posCol","leftPos","oldRange","ranges$1","anchorLine","boundary","headIndex","usePart","bidiSimplify","editorSize","counter","move","buttons","curCount","leftButtonSelect","leftButtonDown","onContextMenu","findWordAt","gutterEvent","prevent","mX","mY","touches","lineBox","g","contextMenuInGutter","themeChanged","theme","Init","defaults","optionHandlers","dragDropChanged","funcs","dragFunctions","toggle","enter","over","leave","drop","wrappingChanged","inputStyles","inputStyle","pasteIncoming","cutIncoming","autofocus","word","getField","touchFinished","prevTouch","finishTouch","farAway","touch","radiusX","radiusY","isMouseLikeTouchEvent","pageX","pageY","frag","onDragOver","setData","effectAllowed","setDragImage","img","src","_top","onDragStart","inp","registerEventHandlers","finishInit","initHooks","textRendering","how","aggressive","indent","curSpace","curSpaceString","indentUnit","indentString","indentWithTabs","pos$1","defineInitHook","lastCopied","setLastCopied","newLastCopied","applyTextInput","inserted","deleted","recent","paste","textLines","multiPaste","pasteLinesPerSelection","lineWise","changeEvent","triggerElectric","handlePaste","pasted","clipboardData","disableInput","electricChars","smartIndent","getModeAt","electricInput","copyableRanges","lineRange","disableBrowserMagic","field","spellcheck","autocorrect","autocapitalize","hiddenTextarea","border","_findPosH","origDir","lineDir","moveOnce","boundToLine","bidi","mv","getWrappedLineExtent","moveInStorageOrder","searchInVisualLine","getRes","res","nextCh","moveVisually","sawType","getHelper","hitSide","_findPosV","pageSize","moveAmount","ContentEditableInput","lastAnchorNode","lastAnchorOffset","lastFocusNode","lastFocusOffset","polling","composing","gracePeriod","readDOMTimeout","posToDOM","badPos","bad","domToPos","lineNode","locateNodeInLineView","textNode","topNode","nodeValue","curNode","textContent","previousSibling","dist$1","onCopyCut","lineWiseCopyCut","clearData","kludge","hadFocus","showPrimarySelection","updateFromDOM","readFromDOMSoon","forceCompositionEnd","showMultipleSelections","curAnchor","curFocus","rng","rangeCount","getRangeAt","startGracePeriod","rememberSelection","selectionInEditor","commonAncestorContainer","blur","pollSelection","pollInterval","poll","scan","isInGutter","triggerOnKeyDown","pollContent","fromIndex","fromNode","toNode","toIndex","newText","closing","extraLinebreak","close","addText","walk","cmText","markerID","isBlock","nodeName","domTextBetween","oldText","cutFront","cutEnd","oldTop","maxCutFront","newBot","oldBot","maxCutEnd","chFrom","chTo","contentEditable","readOnlyChanged","resetPosition","TextareaInput","prevInput","pollingFast","createField","textarea","prepareCopyCut","fastPoll","dispatchEvent","Event","_display","moveInputWithCursor","headPos","wrapOff","lineOff","teTop","teLeft","drawn","contextMenuPending","slowPoll","missed","same","resetSelectionOnContextMenu","oldScrollY","oldCSS","oldWrapperCSS","wrapperBox","offsetParent","scrollY","scrollTo","rehide","detectingSelectAll","prepareSelectAllHack","mouseup","extval","disabled","deflt","notOnInit","defineOption","newBreaks","refresh","getInputField","detach","attach","integer","defineOptions","helpers","setOption","getDoc","addKeyMap","removeKeyMap","addOverlay","score","priority","insertSorted","modeSpec","removeOverlay","newRanges","getTokenAt","getLineTokens","getTokenTypeAt","getHelpers","help","_global","getStateAfter","lineAtHeight","heightAtLine","defaultTextHeight","defaultCharWidth","getViewport","addWidget","vspace","hspace","triggerOnKeyPress","triggerOnKeyUp","triggerOnMouseDown","findPosH","amount","rtlMoveVisually","findPosV","goalColumn","goals","startChar","check","getScrollInfo","scrollToRange","interpret","startOperation","endOperation","swapDoc","phrase","phraseText","phrases","getWrapperElement","getScrollerElement","getGutterElement","registerHelper","registerGlobalHelper","predicate","addEditorMethods","dontDelegate","method","defineMIME","mime","defineExtension","func","defineDocExtension","fromTextArea","tabindex","placeholder","realSubmit","form","leaveSubmitMethodAlone","submit","wrappedSubmit","getTextArea","toTextArea","cmpPos","addLegacyProps","version","factory"],"mappings":"gFAAA,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAER,EAAQ,QAUyDA,EAAOC,QAC/D,WACP,aAGA,IAAIC,EAAYC,UAAUD,UACtBE,EAAWD,UAAUC,SACrBC,EAAQ,aAAaC,KAAKJ,GAC1BK,EAAY,UAA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AAaA,GACxBmkC,EAAWrkC,UAAYA,GACvBqkC,EAAWoI,SAAWA,GACtBpI,EAAW+F,OAASA,GACpB/F,EAAWmH,QAAUA,GACrBnH,EAAW4G,cAAgBA,GAC3B5G,EAAWyG,UAAYA,GACvBzG,EAAWqG,gBAAkBA,GAC7BrG,EAAWhkC,aAAeA,GAC1BgkC,EAAWtF,iBAAmBA,GAC9BsF,EAAW1F,WAAaA,GACxB0F,EAAWhG,WAAaA,GACxBgG,EAAWvoC,iBAAmBA,GAC9BuoC,EAAWroC,kBAAoBA,GAC/BqoC,EAAWloC,OAASA,GACpBkoC,EAAWr0C,SAAWA,EACtBq0C,EAAW90C,SAAWA,EACtB80C,EAAWz2C,QAAUA,EACrBy2C,EAAWsC,SAAWA,GAyDxByhB,CAAe/jB,IACfA,GAAWgkB,QAAU,SACdhkB,GAxtcyEikB","file":"f65a48b9-c17f53720034fc9d5f50.js","sourcesContent":["require(\"core-js/modules/es6.array.filter\");\n\nrequire(\"core-js/modules/es6.array.sort\");\n\nrequire(\"core-js/modules/es6.string.anchor\");\n\nrequire(\"core-js/modules/es6.regexp.to-string\");\n\nrequire(\"core-js/modules/es6.date.to-string\");\n\nrequire(\"core-js/modules/es6.object.to-string\");\n\nrequire(\"core-js/modules/es6.array.map\");\n\nrequire(\"core-js/modules/es6.array.find\");\n\nrequire(\"core-js/modules/es6.regexp.replace\");\n\nrequire(\"core-js/modules/es6.function.name\");\n\nrequire(\"core-js/modules/es6.object.create\");\n\nrequire(\"core-js/modules/es6.array.index-of\");\n\nrequire(\"core-js/modules/es6.regexp.search\");\n\nrequire(\"core-js/modules/es6.regexp.split\");\n\nrequire(\"core-js/modules/es6.regexp.constructor\");\n\nrequire(\"core-js/modules/es6.number.constructor\");\n\nrequire(\"core-js/modules/es6.regexp.match\");\n\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n// This is CodeMirror (https://codemirror.net), a code editor\n// implemented in JavaScript on top of the browser's DOM.\n//\n// You can find some technical background for some of the code below\n// at http://marijnhaverbeke.nl/blog/#cm-internals .\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.CodeMirror = factory());\n})(this, function () {\n 'use strict'; // Kludges for bugs and behavior differences that can't be feature\n // detected are enabled based on userAgent etc sniffing.\n\n var userAgent = navigator.userAgent;\n var platform = navigator.platform;\n var gecko = /gecko\\/\\d/i.test(userAgent);\n var ie_upto10 = /MSIE \\d/.test(userAgent);\n var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(userAgent);\n var edge = /Edge\\/(\\d+)/.exec(userAgent);\n var ie = ie_upto10 || ie_11up || edge;\n var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);\n var webkit = !edge && /WebKit\\//.test(userAgent);\n var qtwebkit = webkit && /Qt\\/\\d+\\.\\d+/.test(userAgent);\n var chrome = !edge && /Chrome\\//.test(userAgent);\n var presto = /Opera\\//.test(userAgent);\n var safari = /Apple Computer/.test(navigator.vendor);\n var mac_geMountainLion = /Mac OS X 1\\d\\D([8-9]|\\d\\d)\\D/.test(userAgent);\n var phantom = /PhantomJS/.test(userAgent);\n var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\\/\\w+/.test(userAgent);\n var android = /Android/.test(userAgent); // This is woefully incomplete. Suggestions for alternative methods welcome.\n\n var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);\n var mac = ios || /Mac/.test(platform);\n var chromeOS = /\\bCrOS\\b/.test(userAgent);\n var windows = /win/i.test(platform);\n var presto_version = presto && userAgent.match(/Version\\/(\\d*\\.\\d*)/);\n\n if (presto_version) {\n presto_version = Number(presto_version[1]);\n }\n\n if (presto_version && presto_version >= 15) {\n presto = false;\n webkit = true;\n } // Some browsers use the wrong event properties to signal cmd/ctrl on OS X\n\n\n var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));\n var captureRightClick = gecko || ie && ie_version >= 9;\n\n function classTest(cls) {\n return new RegExp(\"(^|\\\\s)\" + cls + \"(?:$|\\\\s)\\\\s*\");\n }\n\n var rmClass = function rmClass(node, cls) {\n var current = node.className;\n var match = classTest(cls).exec(current);\n\n if (match) {\n var after = current.slice(match.index + match[0].length);\n node.className = current.slice(0, match.index) + (after ? match[1] + after : \"\");\n }\n };\n\n function removeChildren(e) {\n for (var count = e.childNodes.length; count > 0; --count) {\n e.removeChild(e.firstChild);\n }\n\n return e;\n }\n\n function removeChildrenAndAdd(parent, e) {\n return removeChildren(parent).appendChild(e);\n }\n\n function elt(tag, content, className, style) {\n var e = document.createElement(tag);\n\n if (className) {\n e.className = className;\n }\n\n if (style) {\n e.style.cssText = style;\n }\n\n if (typeof content == \"string\") {\n e.appendChild(document.createTextNode(content));\n } else if (content) {\n for (var i = 0; i < content.length; ++i) {\n e.appendChild(content[i]);\n }\n }\n\n return e;\n } // wrapper for elt, which removes the elt from the accessibility tree\n\n\n function eltP(tag, content, className, style) {\n var e = elt(tag, content, className, style);\n e.setAttribute(\"role\", \"presentation\");\n return e;\n }\n\n var range;\n\n if (document.createRange) {\n range = function range(node, start, end, endNode) {\n var r = document.createRange();\n r.setEnd(endNode || node, end);\n r.setStart(node, start);\n return r;\n };\n } else {\n range = function range(node, start, end) {\n var r = document.body.createTextRange();\n\n try {\n r.moveToElementText(node.parentNode);\n } catch (e) {\n return r;\n }\n\n r.collapse(true);\n r.moveEnd(\"character\", end);\n r.moveStart(\"character\", start);\n return r;\n };\n }\n\n function contains(parent, child) {\n if (child.nodeType == 3) // Android browser always returns false when child is a textnode\n {\n child = child.parentNode;\n }\n\n if (parent.contains) {\n return parent.contains(child);\n }\n\n do {\n if (child.nodeType == 11) {\n child = child.host;\n }\n\n if (child == parent) {\n return true;\n }\n } while (child = child.parentNode);\n }\n\n function activeElt() {\n // IE and Edge may throw an \"Unspecified Error\" when accessing document.activeElement.\n // IE < 10 will throw when accessed while the page is loading or in an iframe.\n // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.\n var activeElement;\n\n try {\n activeElement = document.activeElement;\n } catch (e) {\n activeElement = document.body || null;\n }\n\n while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement;\n }\n\n return activeElement;\n }\n\n function addClass(node, cls) {\n var current = node.className;\n\n if (!classTest(cls).test(current)) {\n node.className += (current ? \" \" : \"\") + cls;\n }\n }\n\n function joinClasses(a, b) {\n var as = a.split(\" \");\n\n for (var i = 0; i < as.length; i++) {\n if (as[i] && !classTest(as[i]).test(b)) {\n b += \" \" + as[i];\n }\n }\n\n return b;\n }\n\n var selectInput = function selectInput(node) {\n node.select();\n };\n\n if (ios) // Mobile Safari apparently has a bug where select() is broken.\n {\n selectInput = function selectInput(node) {\n node.selectionStart = 0;\n node.selectionEnd = node.value.length;\n };\n } else if (ie) // Suppress mysterious IE10 errors\n {\n selectInput = function selectInput(node) {\n try {\n node.select();\n } catch (_e) {}\n };\n }\n\n function bind(f) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function () {\n return f.apply(null, args);\n };\n }\n\n function copyObj(obj, target, overwrite) {\n if (!target) {\n target = {};\n }\n\n for (var prop in obj) {\n if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop))) {\n target[prop] = obj[prop];\n }\n }\n\n return target;\n } // Counts the column offset in a string, taking tabs into account.\n // Used mostly to find indentation.\n\n\n function countColumn(string, end, tabSize, startIndex, startValue) {\n if (end == null) {\n end = string.search(/[^\\s\\u00a0]/);\n\n if (end == -1) {\n end = string.length;\n }\n }\n\n for (var i = startIndex || 0, n = startValue || 0;;) {\n var nextTab = string.indexOf(\"\\t\", i);\n\n if (nextTab < 0 || nextTab >= end) {\n return n + (end - i);\n }\n\n n += nextTab - i;\n n += tabSize - n % tabSize;\n i = nextTab + 1;\n }\n }\n\n var Delayed = function Delayed() {\n this.id = null;\n this.f = null;\n this.time = 0;\n this.handler = bind(this.onTimeout, this);\n };\n\n Delayed.prototype.onTimeout = function (self) {\n self.id = 0;\n\n if (self.time <= +new Date()) {\n self.f();\n } else {\n setTimeout(self.handler, self.time - +new Date());\n }\n };\n\n Delayed.prototype.set = function (ms, f) {\n this.f = f;\n var time = +new Date() + ms;\n\n if (!this.id || time < this.time) {\n clearTimeout(this.id);\n this.id = setTimeout(this.handler, ms);\n this.time = time;\n }\n };\n\n function indexOf(array, elt) {\n for (var i = 0; i < array.length; ++i) {\n if (array[i] == elt) {\n return i;\n }\n }\n\n return -1;\n } // Number of pixels added to scroller and sizer to hide scrollbar\n\n\n var scrollerGap = 30; // Returned or thrown by various protocols to signal 'I'm not\n // handling this'.\n\n var Pass = {\n toString: function toString() {\n return \"CodeMirror.Pass\";\n }\n }; // Reused option objects for setSelection & friends\n\n var sel_dontScroll = {\n scroll: false\n },\n sel_mouse = {\n origin: \"*mouse\"\n },\n sel_move = {\n origin: \"+move\"\n }; // The inverse of countColumn -- find the offset that corresponds to\n // a particular column.\n\n function findColumn(string, goal, tabSize) {\n for (var pos = 0, col = 0;;) {\n var nextTab = string.indexOf(\"\\t\", pos);\n\n if (nextTab == -1) {\n nextTab = string.length;\n }\n\n var skipped = nextTab - pos;\n\n if (nextTab == string.length || col + skipped >= goal) {\n return pos + Math.min(skipped, goal - col);\n }\n\n col += nextTab - pos;\n col += tabSize - col % tabSize;\n pos = nextTab + 1;\n\n if (col >= goal) {\n return pos;\n }\n }\n }\n\n var spaceStrs = [\"\"];\n\n function spaceStr(n) {\n while (spaceStrs.length <= n) {\n spaceStrs.push(lst(spaceStrs) + \" \");\n }\n\n return spaceStrs[n];\n }\n\n function lst(arr) {\n return arr[arr.length - 1];\n }\n\n function map(array, f) {\n var out = [];\n\n for (var i = 0; i < array.length; i++) {\n out[i] = f(array[i], i);\n }\n\n return out;\n }\n\n function insertSorted(array, value, score) {\n var pos = 0,\n priority = score(value);\n\n while (pos < array.length && score(array[pos]) <= priority) {\n pos++;\n }\n\n array.splice(pos, 0, value);\n }\n\n function nothing() {}\n\n function createObj(base, props) {\n var inst;\n\n if (Object.create) {\n inst = Object.create(base);\n } else {\n nothing.prototype = base;\n inst = new nothing();\n }\n\n if (props) {\n copyObj(props, inst);\n }\n\n return inst;\n }\n\n var nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\n\n function isWordCharBasic(ch) {\n return /\\w/.test(ch) || ch > \"\\x80\" && (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));\n }\n\n function isWordChar(ch, helper) {\n if (!helper) {\n return isWordCharBasic(ch);\n }\n\n if (helper.source.indexOf(\"\\\\w\") > -1 && isWordCharBasic(ch)) {\n return true;\n }\n\n return helper.test(ch);\n }\n\n function isEmpty(obj) {\n for (var n in obj) {\n if (obj.hasOwnProperty(n) && obj[n]) {\n return false;\n }\n }\n\n return true;\n } // Extending unicode characters. A series of a non-extending char +\n // any number of extending chars is treated as a single unit as far\n // as editing and measuring is concerned. This is not fully correct,\n // since some scripts/fonts/browsers also treat other configurations\n // of code points as a group.\n\n\n var extendingChars = /[\\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]/;\n\n function isExtendingChar(ch) {\n return ch.charCodeAt(0) >= 768 && extendingChars.test(ch);\n } // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.\n\n\n function skipExtendingChars(str, pos, dir) {\n while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) {\n pos += dir;\n }\n\n return pos;\n } // Returns the value from the range [`from`; `to`] that satisfies\n // `pred` and is closest to `from`. Assumes that at least `to`\n // satisfies `pred`. Supports `from` being greater than `to`.\n\n\n function findFirst(pred, from, to) {\n // At any point we are certain `to` satisfies `pred`, don't know\n // whether `from` does.\n var dir = from > to ? -1 : 1;\n\n for (;;) {\n if (from == to) {\n return from;\n }\n\n var midF = (from + to) / 2,\n mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);\n\n if (mid == from) {\n return pred(mid) ? from : to;\n }\n\n if (pred(mid)) {\n to = mid;\n } else {\n from = mid + dir;\n }\n }\n } // BIDI HELPERS\n\n\n function iterateBidiSections(order, from, to, f) {\n if (!order) {\n return f(from, to, \"ltr\", 0);\n }\n\n var found = false;\n\n for (var i = 0; i < order.length; ++i) {\n var part = order[i];\n\n if (part.from < to && part.to > from || from == to && part.to == from) {\n f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? \"rtl\" : \"ltr\", i);\n found = true;\n }\n }\n\n if (!found) {\n f(from, to, \"ltr\");\n }\n }\n\n var bidiOther = null;\n\n function getBidiPartAt(order, ch, sticky) {\n var found;\n bidiOther = null;\n\n for (var i = 0; i < order.length; ++i) {\n var cur = order[i];\n\n if (cur.from < ch && cur.to > ch) {\n return i;\n }\n\n if (cur.to == ch) {\n if (cur.from != cur.to && sticky == \"before\") {\n found = i;\n } else {\n bidiOther = i;\n }\n }\n\n if (cur.from == ch) {\n if (cur.from != cur.to && sticky != \"before\") {\n found = i;\n } else {\n bidiOther = i;\n }\n }\n }\n\n return found != null ? found : bidiOther;\n } // Bidirectional ordering algorithm\n // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm\n // that this (partially) implements.\n // One-char codes used for character types:\n // L (L): Left-to-Right\n // R (R): Right-to-Left\n // r (AL): Right-to-Left Arabic\n // 1 (EN): European Number\n // + (ES): European Number Separator\n // % (ET): European Number Terminator\n // n (AN): Arabic Number\n // , (CS): Common Number Separator\n // m (NSM): Non-Spacing Mark\n // b (BN): Boundary Neutral\n // s (B): Paragraph Separator\n // t (S): Segment Separator\n // w (WS): Whitespace\n // N (ON): Other Neutrals\n // Returns null if characters are ordered as they appear\n // (left-to-right), or an array of sections ({from, to, level}\n // objects) in the order in which they occur visually.\n\n\n var bidiOrdering = function () {\n // Character types for codepoints 0 to 0xff\n var lowTypes = \"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN\"; // Character types for codepoints 0x600 to 0x6f9\n\n var arabicTypes = \"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111\";\n\n function charType(code) {\n if (code <= 0xf7) {\n return lowTypes.charAt(code);\n } else if (0x590 <= code && code <= 0x5f4) {\n return \"R\";\n } else if (0x600 <= code && code <= 0x6f9) {\n return arabicTypes.charAt(code - 0x600);\n } else if (0x6ee <= code && code <= 0x8ac) {\n return \"r\";\n } else if (0x2000 <= code && code <= 0x200b) {\n return \"w\";\n } else if (code == 0x200c) {\n return \"b\";\n } else {\n return \"L\";\n }\n }\n\n var bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n var isNeutral = /[stwN]/,\n isStrong = /[LRr]/,\n countsAsLeft = /[Lb1n]/,\n countsAsNum = /[1n]/;\n\n function BidiSpan(level, from, to) {\n this.level = level;\n this.from = from;\n this.to = to;\n }\n\n return function (str, direction) {\n var outerType = direction == \"ltr\" ? \"L\" : \"R\";\n\n if (str.length == 0 || direction == \"ltr\" && !bidiRE.test(str)) {\n return false;\n }\n\n var len = str.length,\n types = [];\n\n for (var i = 0; i < len; ++i) {\n types.push(charType(str.charCodeAt(i)));\n } // W1. Examine each non-spacing mark (NSM) in the level run, and\n // change the type of the NSM to the type of the previous\n // character. If the NSM is at the start of the level run, it will\n // get the type of sor.\n\n\n for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {\n var type = types[i$1];\n\n if (type == \"m\") {\n types[i$1] = prev;\n } else {\n prev = type;\n }\n } // W2. Search backwards from each instance of a European number\n // until the first strong type (R, L, AL, or sor) is found. If an\n // AL is found, change the type of the European number to Arabic\n // number.\n // W3. Change all ALs to R.\n\n\n for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {\n var type$1 = types[i$2];\n\n if (type$1 == \"1\" && cur == \"r\") {\n types[i$2] = \"n\";\n } else if (isStrong.test(type$1)) {\n cur = type$1;\n\n if (type$1 == \"r\") {\n types[i$2] = \"R\";\n }\n }\n } // W4. A single European separator between two European numbers\n // changes to a European number. A single common separator between\n // two numbers of the same type changes to that type.\n\n\n for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {\n var type$2 = types[i$3];\n\n if (type$2 == \"+\" && prev$1 == \"1\" && types[i$3 + 1] == \"1\") {\n types[i$3] = \"1\";\n } else if (type$2 == \",\" && prev$1 == types[i$3 + 1] && (prev$1 == \"1\" || prev$1 == \"n\")) {\n types[i$3] = prev$1;\n }\n\n prev$1 = type$2;\n } // W5. A sequence of European terminators adjacent to European\n // numbers changes to all European numbers.\n // W6. Otherwise, separators and terminators change to Other\n // Neutral.\n\n\n for (var i$4 = 0; i$4 < len; ++i$4) {\n var type$3 = types[i$4];\n\n if (type$3 == \",\") {\n types[i$4] = \"N\";\n } else if (type$3 == \"%\") {\n var end = void 0;\n\n for (end = i$4 + 1; end < len && types[end] == \"%\"; ++end) {}\n\n var replace = i$4 && types[i$4 - 1] == \"!\" || end < len && types[end] == \"1\" ? \"1\" : \"N\";\n\n for (var j = i$4; j < end; ++j) {\n types[j] = replace;\n }\n\n i$4 = end - 1;\n }\n } // W7. Search backwards from each instance of a European number\n // until the first strong type (R, L, or sor) is found. If an L is\n // found, then change the type of the European number to L.\n\n\n for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {\n var type$4 = types[i$5];\n\n if (cur$1 == \"L\" && type$4 == \"1\") {\n types[i$5] = \"L\";\n } else if (isStrong.test(type$4)) {\n cur$1 = type$4;\n }\n } // N1. A sequence of neutrals takes the direction of the\n // surrounding strong text if the text on both sides has the same\n // direction. European and Arabic numbers act as if they were R in\n // terms of their influence on neutrals. Start-of-level-run (sor)\n // and end-of-level-run (eor) are used at level run boundaries.\n // N2. Any remaining neutrals take the embedding direction.\n\n\n for (var i$6 = 0; i$6 < len; ++i$6) {\n if (isNeutral.test(types[i$6])) {\n var end$1 = void 0;\n\n for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}\n\n var before = (i$6 ? types[i$6 - 1] : outerType) == \"L\";\n var after = (end$1 < len ? types[end$1] : outerType) == \"L\";\n var replace$1 = before == after ? before ? \"L\" : \"R\" : outerType;\n\n for (var j$1 = i$6; j$1 < end$1; ++j$1) {\n types[j$1] = replace$1;\n }\n\n i$6 = end$1 - 1;\n }\n } // Here we depart from the documented algorithm, in order to avoid\n // building up an actual levels array. Since there are only three\n // levels (0, 1, 2) in an implementation that doesn't take\n // explicit embedding into account, we can build up the order on\n // the fly, without following the level-based algorithm.\n\n\n var order = [],\n m;\n\n for (var i$7 = 0; i$7 < len;) {\n if (countsAsLeft.test(types[i$7])) {\n var start = i$7;\n\n for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}\n\n order.push(new BidiSpan(0, start, i$7));\n } else {\n var pos = i$7,\n at = order.length,\n isRTL = direction == \"rtl\" ? 1 : 0;\n\n for (++i$7; i$7 < len && types[i$7] != \"L\"; ++i$7) {}\n\n for (var j$2 = pos; j$2 < i$7;) {\n if (countsAsNum.test(types[j$2])) {\n if (pos < j$2) {\n order.splice(at, 0, new BidiSpan(1, pos, j$2));\n at += isRTL;\n }\n\n var nstart = j$2;\n\n for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}\n\n order.splice(at, 0, new BidiSpan(2, nstart, j$2));\n at += isRTL;\n pos = j$2;\n } else {\n ++j$2;\n }\n }\n\n if (pos < i$7) {\n order.splice(at, 0, new BidiSpan(1, pos, i$7));\n }\n }\n }\n\n if (direction == \"ltr\") {\n if (order[0].level == 1 && (m = str.match(/^\\s+/))) {\n order[0].from = m[0].length;\n order.unshift(new BidiSpan(0, 0, m[0].length));\n }\n\n if (lst(order).level == 1 && (m = str.match(/\\s+$/))) {\n lst(order).to -= m[0].length;\n order.push(new BidiSpan(0, len - m[0].length, len));\n }\n }\n\n return direction == \"rtl\" ? order.reverse() : order;\n };\n }(); // Get the bidi ordering for the given line (and cache it). Returns\n // false for lines that are fully left-to-right, and an array of\n // BidiSpan objects otherwise.\n\n\n function getOrder(line, direction) {\n var order = line.order;\n\n if (order == null) {\n order = line.order = bidiOrdering(line.text, direction);\n }\n\n return order;\n } // EVENT HANDLING\n // Lightweight event framework. on/off also work on DOM nodes,\n // registering native DOM handlers.\n\n\n var noHandlers = [];\n\n var on = function on(emitter, type, f) {\n if (emitter.addEventListener) {\n emitter.addEventListener(type, f, false);\n } else if (emitter.attachEvent) {\n emitter.attachEvent(\"on\" + type, f);\n } else {\n var map = emitter._handlers || (emitter._handlers = {});\n map[type] = (map[type] || noHandlers).concat(f);\n }\n };\n\n function getHandlers(emitter, type) {\n return emitter._handlers && emitter._handlers[type] || noHandlers;\n }\n\n function off(emitter, type, f) {\n if (emitter.removeEventListener) {\n emitter.removeEventListener(type, f, false);\n } else if (emitter.detachEvent) {\n emitter.detachEvent(\"on\" + type, f);\n } else {\n var map = emitter._handlers,\n arr = map && map[type];\n\n if (arr) {\n var index = indexOf(arr, f);\n\n if (index > -1) {\n map[type] = arr.slice(0, index).concat(arr.slice(index + 1));\n }\n }\n }\n }\n\n function signal(emitter, type\n /*, values...*/\n ) {\n var handlers = getHandlers(emitter, type);\n\n if (!handlers.length) {\n return;\n }\n\n var args = Array.prototype.slice.call(arguments, 2);\n\n for (var i = 0; i < handlers.length; ++i) {\n handlers[i].apply(null, args);\n }\n } // The DOM events that CodeMirror handles can be overridden by\n // registering a (non-DOM) handler on the editor for the event name,\n // and preventDefault-ing the event in that handler.\n\n\n function signalDOMEvent(cm, e, override) {\n if (typeof e == \"string\") {\n e = {\n type: e,\n preventDefault: function preventDefault() {\n this.defaultPrevented = true;\n }\n };\n }\n\n signal(cm, override || e.type, cm, e);\n return e_defaultPrevented(e) || e.codemirrorIgnore;\n }\n\n function signalCursorActivity(cm) {\n var arr = cm._handlers && cm._handlers.cursorActivity;\n\n if (!arr) {\n return;\n }\n\n var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);\n\n for (var i = 0; i < arr.length; ++i) {\n if (indexOf(set, arr[i]) == -1) {\n set.push(arr[i]);\n }\n }\n }\n\n function hasHandler(emitter, type) {\n return getHandlers(emitter, type).length > 0;\n } // Add on and off methods to a constructor's prototype, to make\n // registering events on such objects more convenient.\n\n\n function eventMixin(ctor) {\n ctor.prototype.on = function (type, f) {\n on(this, type, f);\n };\n\n ctor.prototype.off = function (type, f) {\n off(this, type, f);\n };\n } // Due to the fact that we still support jurassic IE versions, some\n // compatibility wrappers are needed.\n\n\n function e_preventDefault(e) {\n if (e.preventDefault) {\n e.preventDefault();\n } else {\n e.returnValue = false;\n }\n }\n\n function e_stopPropagation(e) {\n if (e.stopPropagation) {\n e.stopPropagation();\n } else {\n e.cancelBubble = true;\n }\n }\n\n function e_defaultPrevented(e) {\n return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false;\n }\n\n function e_stop(e) {\n e_preventDefault(e);\n e_stopPropagation(e);\n }\n\n function e_target(e) {\n return e.target || e.srcElement;\n }\n\n function e_button(e) {\n var b = e.which;\n\n if (b == null) {\n if (e.button & 1) {\n b = 1;\n } else if (e.button & 2) {\n b = 3;\n } else if (e.button & 4) {\n b = 2;\n }\n }\n\n if (mac && e.ctrlKey && b == 1) {\n b = 3;\n }\n\n return b;\n } // Detect drag-and-drop\n\n\n var dragAndDrop = function () {\n // There is *some* kind of drag-and-drop support in IE6-8, but I\n // couldn't get it to work yet.\n if (ie && ie_version < 9) {\n return false;\n }\n\n var div = elt('div');\n return \"draggable\" in div || \"dragDrop\" in div;\n }();\n\n var zwspSupported;\n\n function zeroWidthElement(measure) {\n if (zwspSupported == null) {\n var test = elt(\"span\", \"\\u200B\");\n removeChildrenAndAdd(measure, elt(\"span\", [test, document.createTextNode(\"x\")]));\n\n if (measure.firstChild.offsetHeight != 0) {\n zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8);\n }\n }\n\n var node = zwspSupported ? elt(\"span\", \"\\u200B\") : elt(\"span\", \"\\xA0\", null, \"display: inline-block; width: 1px; margin-right: -1px\");\n node.setAttribute(\"cm-text\", \"\");\n return node;\n } // Feature-detect IE's crummy client rect reporting for bidi text\n\n\n var badBidiRects;\n\n function hasBadBidiRects(measure) {\n if (badBidiRects != null) {\n return badBidiRects;\n }\n\n var txt = removeChildrenAndAdd(measure, document.createTextNode(\"A\\u062EA\"));\n var r0 = range(txt, 0, 1).getBoundingClientRect();\n var r1 = range(txt, 1, 2).getBoundingClientRect();\n removeChildren(measure);\n\n if (!r0 || r0.left == r0.right) {\n return false;\n } // Safari returns null in some cases (#2780)\n\n\n return badBidiRects = r1.right - r0.right < 3;\n } // See if \"\".split is the broken IE version, if so, provide an\n // alternative way to split lines.\n\n\n var splitLinesAuto = \"\\n\\nb\".split(/\\n/).length != 3 ? function (string) {\n var pos = 0,\n result = [],\n l = string.length;\n\n while (pos <= l) {\n var nl = string.indexOf(\"\\n\", pos);\n\n if (nl == -1) {\n nl = string.length;\n }\n\n var line = string.slice(pos, string.charAt(nl - 1) == \"\\r\" ? nl - 1 : nl);\n var rt = line.indexOf(\"\\r\");\n\n if (rt != -1) {\n result.push(line.slice(0, rt));\n pos += rt + 1;\n } else {\n result.push(line);\n pos = nl + 1;\n }\n }\n\n return result;\n } : function (string) {\n return string.split(/\\r\\n?|\\n/);\n };\n var hasSelection = window.getSelection ? function (te) {\n try {\n return te.selectionStart != te.selectionEnd;\n } catch (e) {\n return false;\n }\n } : function (te) {\n var range;\n\n try {\n range = te.ownerDocument.selection.createRange();\n } catch (e) {}\n\n if (!range || range.parentElement() != te) {\n return false;\n }\n\n return range.compareEndPoints(\"StartToEnd\", range) != 0;\n };\n\n var hasCopyEvent = function () {\n var e = elt(\"div\");\n\n if (\"oncopy\" in e) {\n return true;\n }\n\n e.setAttribute(\"oncopy\", \"return;\");\n return typeof e.oncopy == \"function\";\n }();\n\n var badZoomedRects = null;\n\n function hasBadZoomedRects(measure) {\n if (badZoomedRects != null) {\n return badZoomedRects;\n }\n\n var node = removeChildrenAndAdd(measure, elt(\"span\", \"x\"));\n var normal = node.getBoundingClientRect();\n var fromRange = range(node, 0, 1).getBoundingClientRect();\n return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1;\n } // Known modes, by name and by MIME\n\n\n var modes = {},\n mimeModes = {}; // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n\n function defineMode(name, mode) {\n if (arguments.length > 2) {\n mode.dependencies = Array.prototype.slice.call(arguments, 2);\n }\n\n modes[name] = mode;\n }\n\n function defineMIME(mime, spec) {\n mimeModes[mime] = spec;\n } // Given a MIME type, a {name, ...options} config object, or a name\n // string, return a mode config object.\n\n\n function resolveMode(spec) {\n if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n spec = mimeModes[spec];\n } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n var found = mimeModes[spec.name];\n\n if (typeof found == \"string\") {\n found = {\n name: found\n };\n }\n\n spec = createObj(found, spec);\n spec.name = found.name;\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+xml$/.test(spec)) {\n return resolveMode(\"application/xml\");\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+json$/.test(spec)) {\n return resolveMode(\"application/json\");\n }\n\n if (typeof spec == \"string\") {\n return {\n name: spec\n };\n } else {\n return spec || {\n name: \"null\"\n };\n }\n } // Given a mode spec (anything that resolveMode accepts), find and\n // initialize an actual mode object.\n\n\n function getMode(options, spec) {\n spec = resolveMode(spec);\n var mfactory = modes[spec.name];\n\n if (!mfactory) {\n return getMode(options, \"text/plain\");\n }\n\n var modeObj = mfactory(options, spec);\n\n if (modeExtensions.hasOwnProperty(spec.name)) {\n var exts = modeExtensions[spec.name];\n\n for (var prop in exts) {\n if (!exts.hasOwnProperty(prop)) {\n continue;\n }\n\n if (modeObj.hasOwnProperty(prop)) {\n modeObj[\"_\" + prop] = modeObj[prop];\n }\n\n modeObj[prop] = exts[prop];\n }\n }\n\n modeObj.name = spec.name;\n\n if (spec.helperType) {\n modeObj.helperType = spec.helperType;\n }\n\n if (spec.modeProps) {\n for (var prop$1 in spec.modeProps) {\n modeObj[prop$1] = spec.modeProps[prop$1];\n }\n }\n\n return modeObj;\n } // This can be used to attach properties to mode objects from\n // outside the actual mode definition.\n\n\n var modeExtensions = {};\n\n function extendMode(mode, properties) {\n var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : modeExtensions[mode] = {};\n copyObj(properties, exts);\n }\n\n function copyState(mode, state) {\n if (state === true) {\n return state;\n }\n\n if (mode.copyState) {\n return mode.copyState(state);\n }\n\n var nstate = {};\n\n for (var n in state) {\n var val = state[n];\n\n if (val instanceof Array) {\n val = val.concat([]);\n }\n\n nstate[n] = val;\n }\n\n return nstate;\n } // Given a mode and a state (for that mode), find the inner mode and\n // state at the position that the state refers to.\n\n\n function innerMode(mode, state) {\n var info;\n\n while (mode.innerMode) {\n info = mode.innerMode(state);\n\n if (!info || info.mode == mode) {\n break;\n }\n\n state = info.state;\n mode = info.mode;\n }\n\n return info || {\n mode: mode,\n state: state\n };\n }\n\n function startState(mode, a1, a2) {\n return mode.startState ? mode.startState(a1, a2) : true;\n } // STRING STREAM\n // Fed to the mode parsers, provides helper functions to make\n // parsers more succinct.\n\n\n var StringStream = function StringStream(string, tabSize, lineOracle) {\n this.pos = this.start = 0;\n this.string = string;\n this.tabSize = tabSize || 8;\n this.lastColumnPos = this.lastColumnValue = 0;\n this.lineStart = 0;\n this.lineOracle = lineOracle;\n };\n\n StringStream.prototype.eol = function () {\n return this.pos >= this.string.length;\n };\n\n StringStream.prototype.sol = function () {\n return this.pos == this.lineStart;\n };\n\n StringStream.prototype.peek = function () {\n return this.string.charAt(this.pos) || undefined;\n };\n\n StringStream.prototype.next = function () {\n if (this.pos < this.string.length) {\n return this.string.charAt(this.pos++);\n }\n };\n\n StringStream.prototype.eat = function (match) {\n var ch = this.string.charAt(this.pos);\n var ok;\n\n if (typeof match == \"string\") {\n ok = ch == match;\n } else {\n ok = ch && (match.test ? match.test(ch) : match(ch));\n }\n\n if (ok) {\n ++this.pos;\n return ch;\n }\n };\n\n StringStream.prototype.eatWhile = function (match) {\n var start = this.pos;\n\n while (this.eat(match)) {}\n\n return this.pos > start;\n };\n\n StringStream.prototype.eatSpace = function () {\n var start = this.pos;\n\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) {\n ++this.pos;\n }\n\n return this.pos > start;\n };\n\n StringStream.prototype.skipToEnd = function () {\n this.pos = this.string.length;\n };\n\n StringStream.prototype.skipTo = function (ch) {\n var found = this.string.indexOf(ch, this.pos);\n\n if (found > -1) {\n this.pos = found;\n return true;\n }\n };\n\n StringStream.prototype.backUp = function (n) {\n this.pos -= n;\n };\n\n StringStream.prototype.column = function () {\n if (this.lastColumnPos < this.start) {\n this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);\n this.lastColumnPos = this.start;\n }\n\n return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);\n };\n\n StringStream.prototype.indentation = function () {\n return countColumn(this.string, null, this.tabSize) - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);\n };\n\n StringStream.prototype.match = function (pattern, consume, caseInsensitive) {\n if (typeof pattern == \"string\") {\n var cased = function cased(str) {\n return caseInsensitive ? str.toLowerCase() : str;\n };\n\n var substr = this.string.substr(this.pos, pattern.length);\n\n if (cased(substr) == cased(pattern)) {\n if (consume !== false) {\n this.pos += pattern.length;\n }\n\n return true;\n }\n } else {\n var match = this.string.slice(this.pos).match(pattern);\n\n if (match && match.index > 0) {\n return null;\n }\n\n if (match && consume !== false) {\n this.pos += match[0].length;\n }\n\n return match;\n }\n };\n\n StringStream.prototype.current = function () {\n return this.string.slice(this.start, this.pos);\n };\n\n StringStream.prototype.hideFirstChars = function (n, inner) {\n this.lineStart += n;\n\n try {\n return inner();\n } finally {\n this.lineStart -= n;\n }\n };\n\n StringStream.prototype.lookAhead = function (n) {\n var oracle = this.lineOracle;\n return oracle && oracle.lookAhead(n);\n };\n\n StringStream.prototype.baseToken = function () {\n var oracle = this.lineOracle;\n return oracle && oracle.baseToken(this.pos);\n }; // Find the line object corresponding to the given line number.\n\n\n function getLine(doc, n) {\n n -= doc.first;\n\n if (n < 0 || n >= doc.size) {\n throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\");\n }\n\n var chunk = doc;\n\n while (!chunk.lines) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i],\n sz = child.chunkSize();\n\n if (n < sz) {\n chunk = child;\n break;\n }\n\n n -= sz;\n }\n }\n\n return chunk.lines[n];\n } // Get the part of a document between two positions, as an array of\n // strings.\n\n\n function getBetween(doc, start, end) {\n var out = [],\n n = start.line;\n doc.iter(start.line, end.line + 1, function (line) {\n var text = line.text;\n\n if (n == end.line) {\n text = text.slice(0, end.ch);\n }\n\n if (n == start.line) {\n text = text.slice(start.ch);\n }\n\n out.push(text);\n ++n;\n });\n return out;\n } // Get the lines between from and to, as array of strings.\n\n\n function getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function (line) {\n out.push(line.text);\n }); // iter aborts when callback returns truthy value\n\n return out;\n } // Update the height of a line, propagating the height change\n // upwards to parent nodes.\n\n\n function updateLineHeight(line, height) {\n var diff = height - line.height;\n\n if (diff) {\n for (var n = line; n; n = n.parent) {\n n.height += diff;\n }\n }\n } // Given a line object, find its line number by walking up through\n // its parent links.\n\n\n function lineNo(line) {\n if (line.parent == null) {\n return null;\n }\n\n var cur = line.parent,\n no = indexOf(cur.lines, line);\n\n for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n for (var i = 0;; ++i) {\n if (chunk.children[i] == cur) {\n break;\n }\n\n no += chunk.children[i].chunkSize();\n }\n }\n\n return no + cur.first;\n } // Find the line at the given vertical position, using the height\n // information in the document tree.\n\n\n function _lineAtHeight(chunk, h) {\n var n = chunk.first;\n\n outer: do {\n for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {\n var child = chunk.children[i$1],\n ch = child.height;\n\n if (h < ch) {\n chunk = child;\n continue outer;\n }\n\n h -= ch;\n n += child.chunkSize();\n }\n\n return n;\n } while (!chunk.lines);\n\n var i = 0;\n\n for (; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i],\n lh = line.height;\n\n if (h < lh) {\n break;\n }\n\n h -= lh;\n }\n\n return n + i;\n }\n\n function isLine(doc, l) {\n return l >= doc.first && l < doc.first + doc.size;\n }\n\n function lineNumberFor(options, i) {\n return String(options.lineNumberFormatter(i + options.firstLineNumber));\n } // A Pos instance represents a position within the text.\n\n\n function Pos(line, ch, sticky) {\n if (sticky === void 0) sticky = null;\n\n if (!(this instanceof Pos)) {\n return new Pos(line, ch, sticky);\n }\n\n this.line = line;\n this.ch = ch;\n this.sticky = sticky;\n } // Compare two positions, return 0 if they are the same, a negative\n // number when a is less, and a positive number otherwise.\n\n\n function cmp(a, b) {\n return a.line - b.line || a.ch - b.ch;\n }\n\n function equalCursorPos(a, b) {\n return a.sticky == b.sticky && cmp(a, b) == 0;\n }\n\n function copyPos(x) {\n return Pos(x.line, x.ch);\n }\n\n function maxPos(a, b) {\n return cmp(a, b) < 0 ? b : a;\n }\n\n function minPos(a, b) {\n return cmp(a, b) < 0 ? a : b;\n } // Most of the external API clips given positions to make sure they\n // actually exist within the document.\n\n\n function clipLine(doc, n) {\n return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));\n }\n\n function _clipPos(doc, pos) {\n if (pos.line < doc.first) {\n return Pos(doc.first, 0);\n }\n\n var last = doc.first + doc.size - 1;\n\n if (pos.line > last) {\n return Pos(last, getLine(doc, last).text.length);\n }\n\n return clipToLen(pos, getLine(doc, pos.line).text.length);\n }\n\n function clipToLen(pos, linelen) {\n var ch = pos.ch;\n\n if (ch == null || ch > linelen) {\n return Pos(pos.line, linelen);\n } else if (ch < 0) {\n return Pos(pos.line, 0);\n } else {\n return pos;\n }\n }\n\n function clipPosArray(doc, array) {\n var out = [];\n\n for (var i = 0; i < array.length; i++) {\n out[i] = _clipPos(doc, array[i]);\n }\n\n return out;\n }\n\n var SavedContext = function SavedContext(state, lookAhead) {\n this.state = state;\n this.lookAhead = lookAhead;\n };\n\n var Context = function Context(doc, state, line, lookAhead) {\n this.state = state;\n this.doc = doc;\n this.line = line;\n this.maxLookAhead = lookAhead || 0;\n this.baseTokens = null;\n this.baseTokenPos = 1;\n };\n\n Context.prototype.lookAhead = function (n) {\n var line = this.doc.getLine(this.line + n);\n\n if (line != null && n > this.maxLookAhead) {\n this.maxLookAhead = n;\n }\n\n return line;\n };\n\n Context.prototype.baseToken = function (n) {\n if (!this.baseTokens) {\n return null;\n }\n\n while (this.baseTokens[this.baseTokenPos] <= n) {\n this.baseTokenPos += 2;\n }\n\n var type = this.baseTokens[this.baseTokenPos + 1];\n return {\n type: type && type.replace(/( |^)overlay .*/, \"\"),\n size: this.baseTokens[this.baseTokenPos] - n\n };\n };\n\n Context.prototype.nextLine = function () {\n this.line++;\n\n if (this.maxLookAhead > 0) {\n this.maxLookAhead--;\n }\n };\n\n Context.fromSaved = function (doc, saved, line) {\n if (saved instanceof SavedContext) {\n return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead);\n } else {\n return new Context(doc, copyState(doc.mode, saved), line);\n }\n };\n\n Context.prototype.save = function (copy) {\n var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;\n return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state;\n }; // Compute a style array (an array starting with a mode generation\n // -- for invalidation -- followed by pairs of end positions and\n // style strings), which is used to highlight the tokens on the\n // line.\n\n\n function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen],\n lineClasses = {}; // Compute the base array of styles\n\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) {\n return st.push(end, style);\n }, lineClasses, forceToEnd);\n var state = context.state; // Run overlays, adjust style array.\n\n var loop = function loop(o) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o],\n i = 1,\n at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i; // Ensure there's a token end at the current position, and that i points at it\n\n while (at < end) {\n var i_end = st[i];\n\n if (i_end > end) {\n st.splice(i, 1, end, st[i + 1], i_end);\n }\n\n i += 2;\n at = Math.min(end, i_end);\n }\n\n if (!style) {\n return;\n }\n\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start + 1];\n st[start + 1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) {\n loop(o);\n }\n\n return {\n styles: st,\n classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null\n };\n }\n\n function getLineStyles(cm, line, updateFrontier) {\n if (!line.styles || line.styles[0] != cm.state.modeGen) {\n var context = getContextBefore(cm, lineNo(line));\n var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);\n var result = highlightLine(cm, line, context);\n\n if (resetState) {\n context.state = resetState;\n }\n\n line.stateAfter = context.save(!resetState);\n line.styles = result.styles;\n\n if (result.classes) {\n line.styleClasses = result.classes;\n } else if (line.styleClasses) {\n line.styleClasses = null;\n }\n\n if (updateFrontier === cm.doc.highlightFrontier) {\n cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier);\n }\n }\n\n return line.styles;\n }\n\n function getContextBefore(cm, n, precise) {\n var doc = cm.doc,\n display = cm.display;\n\n if (!doc.mode.startState) {\n return new Context(doc, true, n);\n }\n\n var start = findStartLine(cm, n, precise);\n var saved = start > doc.first && getLine(doc, start - 1).stateAfter;\n var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);\n doc.iter(start, n, function (line) {\n processLine(cm, line.text, context);\n var pos = context.line;\n line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;\n context.nextLine();\n });\n\n if (precise) {\n doc.modeFrontier = context.line;\n }\n\n return context;\n } // Lightweight form of highlight -- proceed over this line and\n // update state, but don't save a style array. Used for lines that\n // aren't currently visible.\n\n\n function processLine(cm, text, context, startAt) {\n var mode = cm.doc.mode;\n var stream = new StringStream(text, cm.options.tabSize, context);\n stream.start = stream.pos = startAt || 0;\n\n if (text == \"\") {\n callBlankLine(mode, context.state);\n }\n\n while (!stream.eol()) {\n readToken(mode, stream, context.state);\n stream.start = stream.pos;\n }\n }\n\n function callBlankLine(mode, state) {\n if (mode.blankLine) {\n return mode.blankLine(state);\n }\n\n if (!mode.innerMode) {\n return;\n }\n\n var inner = innerMode(mode, state);\n\n if (inner.mode.blankLine) {\n return inner.mode.blankLine(inner.state);\n }\n }\n\n function readToken(mode, stream, state, inner) {\n for (var i = 0; i < 10; i++) {\n if (inner) {\n inner[0] = innerMode(mode, state).mode;\n }\n\n var style = mode.token(stream, state);\n\n if (stream.pos > stream.start) {\n return style;\n }\n }\n\n throw new Error(\"Mode \" + mode.name + \" failed to advance stream.\");\n }\n\n var Token = function Token(stream, type, state) {\n this.start = stream.start;\n this.end = stream.pos;\n this.string = stream.current();\n this.type = type || null;\n this.state = state;\n }; // Utility for getTokenAt and getLineTokens\n\n\n function takeToken(cm, pos, precise, asArray) {\n var doc = cm.doc,\n mode = doc.mode,\n style;\n pos = _clipPos(doc, pos);\n var line = getLine(doc, pos.line),\n context = getContextBefore(cm, pos.line, precise);\n var stream = new StringStream(line.text, cm.options.tabSize, context),\n tokens;\n\n if (asArray) {\n tokens = [];\n }\n\n while ((asArray || stream.pos < pos.ch) && !stream.eol()) {\n stream.start = stream.pos;\n style = readToken(mode, stream, context.state);\n\n if (asArray) {\n tokens.push(new Token(stream, style, copyState(doc.mode, context.state)));\n }\n }\n\n return asArray ? tokens : new Token(stream, style, context.state);\n }\n\n function extractLineClasses(type, output) {\n if (type) {\n for (;;) {\n var lineClass = type.match(/(?:^|\\s+)line-(background-)?(\\S+)/);\n\n if (!lineClass) {\n break;\n }\n\n type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);\n var prop = lineClass[1] ? \"bgClass\" : \"textClass\";\n\n if (output[prop] == null) {\n output[prop] = lineClass[2];\n } else if (!new RegExp(\"(?:^|\\s)\" + lineClass[2] + \"(?:$|\\s)\").test(output[prop])) {\n output[prop] += \" \" + lineClass[2];\n }\n }\n }\n\n return type;\n } // Run the given mode's parser over a line, calling f for each token.\n\n\n function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {\n var flattenSpans = mode.flattenSpans;\n\n if (flattenSpans == null) {\n flattenSpans = cm.options.flattenSpans;\n }\n\n var curStart = 0,\n curStyle = null;\n var stream = new StringStream(text, cm.options.tabSize, context),\n style;\n var inner = cm.options.addModeClass && [null];\n\n if (text == \"\") {\n extractLineClasses(callBlankLine(mode, context.state), lineClasses);\n }\n\n while (!stream.eol()) {\n if (stream.pos > cm.options.maxHighlightLength) {\n flattenSpans = false;\n\n if (forceToEnd) {\n processLine(cm, text, context, stream.pos);\n }\n\n stream.pos = text.length;\n style = null;\n } else {\n style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);\n }\n\n if (inner) {\n var mName = inner[0].name;\n\n if (mName) {\n style = \"m-\" + (style ? mName + \" \" + style : mName);\n }\n }\n\n if (!flattenSpans || curStyle != style) {\n while (curStart < stream.start) {\n curStart = Math.min(stream.start, curStart + 5000);\n f(curStart, curStyle);\n }\n\n curStyle = style;\n }\n\n stream.start = stream.pos;\n }\n\n while (curStart < stream.pos) {\n // Webkit seems to refuse to render text nodes longer than 57444\n // characters, and returns inaccurate measurements in nodes\n // starting around 5000 chars.\n var pos = Math.min(stream.pos, curStart + 5000);\n f(pos, curStyle);\n curStart = pos;\n }\n } // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n\n\n function findStartLine(cm, n, precise) {\n var minindent,\n minline,\n doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) {\n return doc.first;\n }\n\n var line = getLine(doc, search - 1),\n after = line.stateAfter;\n\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier)) {\n return search;\n }\n\n var indented = countColumn(line.text, null, cm.options.tabSize);\n\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n\n return minline;\n }\n\n function retreatFrontier(doc, n) {\n doc.modeFrontier = Math.min(doc.modeFrontier, n);\n\n if (doc.highlightFrontier < n - 10) {\n return;\n }\n\n var start = doc.first;\n\n for (var line = n - 1; line > start; line--) {\n var saved = getLine(doc, line).stateAfter; // change is on 3\n // state on line 1 looked ahead 2 -- so saw 3\n // test 1 + 2 < 3 should cover this\n\n if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {\n start = line + 1;\n break;\n }\n }\n\n doc.highlightFrontier = Math.min(doc.highlightFrontier, start);\n } // Optimize some code when these features are not used.\n\n\n var sawReadOnlySpans = false,\n sawCollapsedSpans = false;\n\n function seeReadOnlySpans() {\n sawReadOnlySpans = true;\n }\n\n function seeCollapsedSpans() {\n sawCollapsedSpans = true;\n } // TEXTMARKER SPANS\n\n\n function MarkedSpan(marker, from, to) {\n this.marker = marker;\n this.from = from;\n this.to = to;\n } // Search an array of spans for a span matching the given marker.\n\n\n function getMarkedSpanFor(spans, marker) {\n if (spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n\n if (span.marker == marker) {\n return span;\n }\n }\n }\n } // Remove a span from an array, returning undefined if no spans are\n // left (we don't store arrays for lines without spans).\n\n\n function removeMarkedSpan(spans, span) {\n var r;\n\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i] != span) {\n (r || (r = [])).push(spans[i]);\n }\n }\n\n return r;\n } // Add a span to a line.\n\n\n function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n } // Used for the algorithm that adjusts markers for a change in the\n // document. These functions cut an array of spans at a given\n // character position, returning an array of remaining chunks (or\n // undefined if nothing remains).\n\n\n function markedSpansBefore(old, startCh, isInsert) {\n var nw;\n\n if (old) {\n for (var i = 0; i < old.length; ++i) {\n var span = old[i],\n marker = span.marker;\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);\n\n if (startsBefore || span.from == startCh && marker.type == \"bookmark\" && (!isInsert || !span.marker.insertLeft)) {\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);\n (nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));\n }\n }\n }\n\n return nw;\n }\n\n function markedSpansAfter(old, endCh, isInsert) {\n var nw;\n\n if (old) {\n for (var i = 0; i < old.length; ++i) {\n var span = old[i],\n marker = span.marker;\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);\n\n if (endsAfter || span.from == endCh && marker.type == \"bookmark\" && (!isInsert || span.marker.insertLeft)) {\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);\n (nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh, span.to == null ? null : span.to - endCh));\n }\n }\n }\n\n return nw;\n } // Given a change object, compute the new set of marker spans that\n // cover the line in which the change took place. Removes spans\n // entirely within the change, reconnects spans belonging to the\n // same marker that appear on both sides of the change, and cuts off\n // spans partially within the change. Returns an array of span\n // arrays with one element for each line in (after) the change.\n\n\n function stretchSpansOverChange(doc, change) {\n if (change.full) {\n return null;\n }\n\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n\n if (!oldFirst && !oldLast) {\n return null;\n }\n\n var startCh = change.from.ch,\n endCh = change.to.ch,\n isInsert = cmp(change.from, change.to) == 0; // Get the spans that 'stick out' on both sides\n\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert); // Next, merge those two ends\n\n var sameLine = change.text.length == 1,\n offset = lst(change.text).length + (sameLine ? startCh : 0);\n\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n\n if (!found) {\n span.to = startCh;\n } else if (sameLine) {\n span.to = found.to == null ? null : found.to + offset;\n }\n }\n }\n }\n\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n\n if (span$1.to != null) {\n span$1.to += offset;\n }\n\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n\n if (!found$1) {\n span$1.from = offset;\n\n if (sameLine) {\n (first || (first = [])).push(span$1);\n }\n }\n } else {\n span$1.from += offset;\n\n if (sameLine) {\n (first || (first = [])).push(span$1);\n }\n }\n }\n } // Make sure we didn't create any zero-length spans\n\n\n if (first) {\n first = clearEmptySpans(first);\n }\n\n if (last && last != first) {\n last = clearEmptySpans(last);\n }\n\n var newMarkers = [first];\n\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2,\n gapMarkers;\n\n if (gap > 0 && first) {\n for (var i$2 = 0; i$2 < first.length; ++i$2) {\n if (first[i$2].to == null) {\n (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null));\n }\n }\n }\n\n for (var i$3 = 0; i$3 < gap; ++i$3) {\n newMarkers.push(gapMarkers);\n }\n\n newMarkers.push(last);\n }\n\n return newMarkers;\n } // Remove spans that are empty and don't have a clearWhenEmpty\n // option of false.\n\n\n function clearEmptySpans(spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n\n if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) {\n spans.splice(i--, 1);\n }\n }\n\n if (!spans.length) {\n return null;\n }\n\n return spans;\n } // Used to 'clip' out readOnly ranges when making a change.\n\n\n function removeReadOnlyRanges(doc, from, to) {\n var markers = null;\n doc.iter(from.line, to.line + 1, function (line) {\n if (line.markedSpans) {\n for (var i = 0; i < line.markedSpans.length; ++i) {\n var mark = line.markedSpans[i].marker;\n\n if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) {\n (markers || (markers = [])).push(mark);\n }\n }\n }\n });\n\n if (!markers) {\n return null;\n }\n\n var parts = [{\n from: from,\n to: to\n }];\n\n for (var i = 0; i < markers.length; ++i) {\n var mk = markers[i],\n m = mk.find(0);\n\n for (var j = 0; j < parts.length; ++j) {\n var p = parts[j];\n\n if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) {\n continue;\n }\n\n var newParts = [j, 1],\n dfrom = cmp(p.from, m.from),\n dto = cmp(p.to, m.to);\n\n if (dfrom < 0 || !mk.inclusiveLeft && !dfrom) {\n newParts.push({\n from: p.from,\n to: m.from\n });\n }\n\n if (dto > 0 || !mk.inclusiveRight && !dto) {\n newParts.push({\n from: m.to,\n to: p.to\n });\n }\n\n parts.splice.apply(parts, newParts);\n j += newParts.length - 3;\n }\n }\n\n return parts;\n } // Connect or disconnect spans from a line.\n\n\n function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n\n if (!spans) {\n return;\n }\n\n for (var i = 0; i < spans.length; ++i) {\n spans[i].marker.detachLine(line);\n }\n\n line.markedSpans = null;\n }\n\n function attachMarkedSpans(line, spans) {\n if (!spans) {\n return;\n }\n\n for (var i = 0; i < spans.length; ++i) {\n spans[i].marker.attachLine(line);\n }\n\n line.markedSpans = spans;\n } // Helpers used when computing which overlapping collapsed span\n // counts as the larger one.\n\n\n function extraLeft(marker) {\n return marker.inclusiveLeft ? -1 : 0;\n }\n\n function extraRight(marker) {\n return marker.inclusiveRight ? 1 : 0;\n } // Returns a number indicating which of two overlapping collapsed\n // spans is larger (and thus includes the other). Falls back to\n // comparing ids when the spans cover exactly the same range.\n\n\n function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n\n if (lenDiff != 0) {\n return lenDiff;\n }\n\n var aPos = a.find(),\n bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n\n if (fromCmp) {\n return -fromCmp;\n }\n\n var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);\n\n if (toCmp) {\n return toCmp;\n }\n\n return b.id - a.id;\n } // Find out whether a line ends or starts in a collapsed span. If\n // so, return the marker for that span.\n\n\n function collapsedSpanAtSide(line, start) {\n var sps = sawCollapsedSpans && line.markedSpans,\n found;\n\n if (sps) {\n for (var sp = void 0, i = 0; i < sps.length; ++i) {\n sp = sps[i];\n\n if (sp.marker.collapsed && (start ? sp.from : sp.to) == null && (!found || compareCollapsedMarkers(found, sp.marker) < 0)) {\n found = sp.marker;\n }\n }\n }\n\n return found;\n }\n\n function collapsedSpanAtStart(line) {\n return collapsedSpanAtSide(line, true);\n }\n\n function collapsedSpanAtEnd(line) {\n return collapsedSpanAtSide(line, false);\n }\n\n function collapsedSpanAround(line, ch) {\n var sps = sawCollapsedSpans && line.markedSpans,\n found;\n\n if (sps) {\n for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n\n if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) && (!found || compareCollapsedMarkers(found, sp.marker) < 0)) {\n found = sp.marker;\n }\n }\n }\n\n return found;\n } // Test whether there exists a collapsed span that partially\n // overlaps (covers the start or end, but not both) of a new span.\n // Such overlap is not allowed.\n\n\n function conflictingCollapsedRange(doc, lineNo, from, to, marker) {\n var line = getLine(doc, lineNo);\n var sps = sawCollapsedSpans && line.markedSpans;\n\n if (sps) {\n for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n\n if (!sp.marker.collapsed) {\n continue;\n }\n\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) {\n continue;\n }\n\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) || fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0)) {\n return true;\n }\n }\n }\n } // A visual line is a line as drawn on the screen. Folding, for\n // example, can cause multiple logical lines to appear on the same\n // visual line. This finds the start of the visual line that the\n // given line is part of (usually that is the line itself).\n\n\n function visualLine(line) {\n var merged;\n\n while (merged = collapsedSpanAtStart(line)) {\n line = merged.find(-1, true).line;\n }\n\n return line;\n }\n\n function visualLineEnd(line) {\n var merged;\n\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line;\n }\n\n return line;\n } // Returns an array of logical lines that continue the visual line\n // started by the argument, or undefined if there are no such lines.\n\n\n function visualLineContinued(line) {\n var merged, lines;\n\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line;\n (lines || (lines = [])).push(line);\n }\n\n return lines;\n } // Get the line number of the start of the visual line that the\n // given line number is part of.\n\n\n function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN),\n vis = visualLine(line);\n\n if (line == vis) {\n return lineN;\n }\n\n return lineNo(vis);\n } // Get the line number of the start of the next visual line after\n // the given line.\n\n\n function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) {\n return lineN;\n }\n\n var line = getLine(doc, lineN),\n merged;\n\n if (!lineIsHidden(doc, line)) {\n return lineN;\n }\n\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line;\n }\n\n return lineNo(line) + 1;\n } // Compute whether a line is hidden. Lines count as hidden when they\n // are part of a visual line that starts with another line, or when\n // they are entirely covered by collapsed, non-widget span.\n\n\n function lineIsHidden(doc, line) {\n var sps = sawCollapsedSpans && line.markedSpans;\n\n if (sps) {\n for (var sp = void 0, i = 0; i < sps.length; ++i) {\n sp = sps[i];\n\n if (!sp.marker.collapsed) {\n continue;\n }\n\n if (sp.from == null) {\n return true;\n }\n\n if (sp.marker.widgetNode) {\n continue;\n }\n\n if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) {\n return true;\n }\n }\n }\n }\n\n function lineIsHiddenInner(doc, line, span) {\n if (span.to == null) {\n var end = span.marker.find(1, true);\n return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker));\n }\n\n if (span.marker.inclusiveRight && span.to == line.text.length) {\n return true;\n }\n\n for (var sp = void 0, i = 0; i < line.markedSpans.length; ++i) {\n sp = line.markedSpans[i];\n\n if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to && (sp.to == null || sp.to != span.from) && (sp.marker.inclusiveLeft || span.marker.inclusiveRight) && lineIsHiddenInner(doc, line, sp)) {\n return true;\n }\n }\n } // Find the height above the given line.\n\n\n function _heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n var h = 0,\n chunk = lineObj.parent;\n\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n\n if (line == lineObj) {\n break;\n } else {\n h += line.height;\n }\n }\n\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n\n if (cur == chunk) {\n break;\n } else {\n h += cur.height;\n }\n }\n }\n\n return h;\n } // Compute the character length of a line, taking into account\n // collapsed ranges (see markText) that might hide parts, and join\n // other lines onto it.\n\n\n function lineLength(line) {\n if (line.height == 0) {\n return 0;\n }\n\n var len = line.text.length,\n merged,\n cur = line;\n\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n\n cur = line;\n\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n\n return len;\n } // Find the longest line in the document.\n\n\n function findMaxLine(cm) {\n var d = cm.display,\n doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n } // LINE DATA STRUCTURE\n // Line objects. These hold state related to a line, including\n // highlighting info (the styles array).\n\n\n var Line = function Line(text, markedSpans, estimateHeight) {\n this.text = text;\n attachMarkedSpans(this, markedSpans);\n this.height = estimateHeight ? estimateHeight(this) : 1;\n };\n\n Line.prototype.lineNo = function () {\n return lineNo(this);\n };\n\n eventMixin(Line); // Change the content (text, markers) of a line. Automatically\n // invalidates cached information and tries to re-estimate the\n // line's height.\n\n function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n\n if (line.stateAfter) {\n line.stateAfter = null;\n }\n\n if (line.styles) {\n line.styles = null;\n }\n\n if (line.order != null) {\n line.order = null;\n }\n\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n\n if (estHeight != line.height) {\n updateLineHeight(line, estHeight);\n }\n } // Detach a line from the document tree and its markers.\n\n\n function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n } // Convert a style as returned by a mode (either null, or a string\n // containing one or more styles) to a CSS style. This is cached,\n // and also looks for line-wide styles.\n\n\n var styleToClassCache = {},\n styleToClassCacheWithMode = {};\n\n function interpretTokenStyle(style, options) {\n if (!style || /^\\s*$/.test(style)) {\n return null;\n }\n\n var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;\n return cache[style] || (cache[style] = style.replace(/\\S+/g, \"cm-$&\"));\n } // Render the DOM representation of the text of a line. Also builds\n // up a 'line map', which points at the DOM nodes that represent\n // specific stretches of text, and is used by the measuring code.\n // The returned object contains the DOM node, this map, and\n // information about line-wide styles that were set by the mode.\n\n\n function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {\n pre: eltP(\"pre\", [content], \"CodeMirror-line\"),\n content: content,\n col: 0,\n pos: 0,\n cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")\n };\n lineView.measure = {}; // Iterate over the logical lines that make up this visual line.\n\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line,\n order = void 0;\n builder.pos = 0;\n builder.addToken = buildToken; // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction))) {\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n }\n\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n\n if (line.styleClasses) {\n if (line.styleClasses.bgClass) {\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n }\n\n if (line.styleClasses.textClass) {\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n } // Ensure at least a single node is present, for measuring.\n\n\n if (builder.map.length == 0) {\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n } // Store the map and a cache object for the current logical line\n\n\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n } // See issue #2901\n\n\n if (webkit) {\n var last = builder.content.lastChild;\n\n if (/\\bcm-tab\\b/.test(last.className) || last.querySelector && last.querySelector(\".cm-tab\")) {\n builder.content.className = \"cm-tab-wrap-hack\";\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n\n if (builder.pre.className) {\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n }\n\n return builder;\n }\n\n function defaultSpecialCharPlaceholder(ch) {\n var token = elt(\"span\", \"\\u2022\", \"cm-invalidchar\");\n token.title = \"\\\\u\" + ch.charCodeAt(0).toString(16);\n token.setAttribute(\"aria-label\", token.title);\n return token;\n } // Build up the DOM representation for a single token, and add it to\n // the line map. Takes care to render special characters separately.\n\n\n function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n if (!text) {\n return;\n }\n\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars,\n mustWrap = false;\n var content;\n\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n\n if (ie && ie_version < 9) {\n mustWrap = true;\n }\n\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n\n if (ie && ie_version < 9) {\n content.appendChild(elt(\"span\", [txt]));\n } else {\n content.appendChild(txt);\n }\n\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n\n if (!m) {\n break;\n }\n\n pos += skipped + 1;\n var txt$1 = void 0;\n\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize,\n tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240D\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n\n if (ie && ie_version < 9) {\n content.appendChild(elt(\"span\", [txt$1]));\n } else {\n content.appendChild(txt$1);\n }\n\n builder.col += 1;\n }\n\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n\n if (startStyle) {\n fullStyle += startStyle;\n }\n\n if (endStyle) {\n fullStyle += endStyle;\n }\n\n var token = elt(\"span\", [content], fullStyle, css);\n\n if (attributes) {\n for (var attr in attributes) {\n if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\") {\n token.setAttribute(attr, attributes[attr]);\n }\n }\n }\n\n return builder.content.appendChild(token);\n }\n\n builder.content.appendChild(content);\n } // Change some spaces to NBSP to prevent the browser from collapsing\n // trailing spaces at the end of a line when rendering text (issue #1362).\n\n\n function splitSpaces(text, trailingBefore) {\n if (text.length > 1 && !/ /.test(text)) {\n return text;\n }\n\n var spaceBefore = trailingBefore,\n result = \"\";\n\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i);\n\n if (ch == \" \" && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32)) {\n ch = \"\\xA0\";\n }\n\n result += ch;\n spaceBefore = ch == \" \";\n }\n\n return result;\n } // Work around nonsense dimensions being reported for stretches of\n // right-to-left text.\n\n\n function buildTokenBadBidi(inner, order) {\n return function (builder, text, style, startStyle, endStyle, css, attributes) {\n style = style ? style + \" cm-force-border\" : \"cm-force-border\";\n var start = builder.pos,\n end = start + text.length;\n\n for (;;) {\n // Find the part that overlaps with the start of this text\n var part = void 0;\n\n for (var i = 0; i < order.length; i++) {\n part = order[i];\n\n if (part.to > start && part.from <= start) {\n break;\n }\n }\n\n if (part.to >= end) {\n return inner(builder, text, style, startStyle, endStyle, css, attributes);\n }\n\n inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes);\n startStyle = null;\n text = text.slice(part.to - start);\n start = part.to;\n }\n };\n }\n\n function buildCollapsedSpan(builder, size, marker, ignoreWidget) {\n var widget = !ignoreWidget && marker.widgetNode;\n\n if (widget) {\n builder.map.push(builder.pos, builder.pos + size, widget);\n }\n\n if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {\n if (!widget) {\n widget = builder.content.appendChild(document.createElement(\"span\"));\n }\n\n widget.setAttribute(\"cm-marker\", marker.id);\n }\n\n if (widget) {\n builder.cm.display.input.setUneditable(widget);\n builder.content.appendChild(widget);\n }\n\n builder.pos += size;\n builder.trailingSpace = false;\n } // Outputs a number of spans to make up a line, taking highlighting\n // and marked text into account.\n\n\n function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans,\n allText = line.text,\n at = 0;\n\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1 += 2) {\n builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1 + 1], builder.cm.options));\n }\n\n return;\n }\n\n var len = allText.length,\n pos = 0,\n i = 1,\n text = \"\",\n style,\n css;\n var nextChange = 0,\n spanStyle,\n spanEndStyle,\n spanStartStyle,\n collapsed,\n attributes;\n\n for (;;) {\n if (nextChange == pos) {\n // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null;\n nextChange = Infinity;\n var foundBookmarks = [],\n endStyles = void 0;\n\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j],\n m = sp.marker;\n\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n\n if (m.className) {\n spanStyle += \" \" + m.className;\n }\n\n if (m.css) {\n css = (css ? css + \";\" : \"\") + m.css;\n }\n\n if (m.startStyle && sp.from == pos) {\n spanStartStyle += \" \" + m.startStyle;\n }\n\n if (m.endStyle && sp.to == nextChange) {\n (endStyles || (endStyles = [])).push(m.endStyle, sp.to);\n } // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n\n\n if (m.title) {\n (attributes || (attributes = {})).title = m.title;\n }\n\n if (m.attributes) {\n for (var attr in m.attributes) {\n (attributes || (attributes = {}))[attr] = m.attributes[attr];\n }\n }\n\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) {\n collapsed = sp;\n }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n\n if (endStyles) {\n for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2) {\n if (endStyles[j$1 + 1] == nextChange) {\n spanEndStyle += \" \" + endStyles[j$1];\n }\n }\n }\n\n if (!collapsed || collapsed.from == pos) {\n for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2) {\n buildCollapsedSpan(builder, 0, foundBookmarks[j$2]);\n }\n }\n\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, collapsed.marker, collapsed.from == null);\n\n if (collapsed.to == null) {\n return;\n }\n\n if (collapsed.to == pos) {\n collapsed = false;\n }\n }\n }\n\n if (pos >= len) {\n break;\n }\n\n var upto = Math.min(len, nextChange);\n\n while (true) {\n if (text) {\n var end = pos + text.length;\n\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n\n if (end >= upto) {\n text = text.slice(upto - pos);\n pos = upto;\n break;\n }\n\n pos = end;\n spanStartStyle = \"\";\n }\n\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n } // These objects are used to represent the visible (currently drawn)\n // part of the document. A LineView may correspond to multiple\n // logical lines, if those are connected by collapsed ranges.\n\n\n function LineView(doc, line, lineN) {\n // The starting line\n this.line = line; // Continuing lines, if any\n\n this.rest = visualLineContinued(line); // Number of logical lines in this visual line\n\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n } // Create a range of LineView objects for the given lines.\n\n\n function buildViewArray(cm, from, to) {\n var array = [],\n nextPos;\n\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n\n return array;\n }\n\n var operationGroup = null;\n\n function pushOperation(op) {\n if (operationGroup) {\n operationGroup.ops.push(op);\n } else {\n op.ownsGroup = operationGroup = {\n ops: [op],\n delayedCallbacks: []\n };\n }\n }\n\n function fireCallbacksForOps(group) {\n // Calls delayed callbacks and cursorActivity handlers until no\n // new ones appear\n var callbacks = group.delayedCallbacks,\n i = 0;\n\n do {\n for (; i < callbacks.length; i++) {\n callbacks[i].call(null);\n }\n\n for (var j = 0; j < group.ops.length; j++) {\n var op = group.ops[j];\n\n if (op.cursorActivityHandlers) {\n while (op.cursorActivityCalled < op.cursorActivityHandlers.length) {\n op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm);\n }\n }\n }\n } while (i < callbacks.length);\n }\n\n function finishOperation(op, endCb) {\n var group = op.ownsGroup;\n\n if (!group) {\n return;\n }\n\n try {\n fireCallbacksForOps(group);\n } finally {\n operationGroup = null;\n endCb(group);\n }\n }\n\n var orphanDelayedCallbacks = null; // Often, we want to signal events at a point where we are in the\n // middle of some work, but don't want the handler to start calling\n // other methods on the editor, which might be in an inconsistent\n // state or simply not expect any other events to happen.\n // signalLater looks whether there are any handlers, and schedules\n // them to be executed when the last operation ends, or, if no\n // operation is active, when a timeout fires.\n\n function signalLater(emitter, type\n /*, values...*/\n ) {\n var arr = getHandlers(emitter, type);\n\n if (!arr.length) {\n return;\n }\n\n var args = Array.prototype.slice.call(arguments, 2),\n list;\n\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n\n var loop = function loop(i) {\n list.push(function () {\n return arr[i].apply(null, args);\n });\n };\n\n for (var i = 0; i < arr.length; ++i) {\n loop(i);\n }\n }\n\n function fireOrphanDelayed() {\n var delayed = orphanDelayedCallbacks;\n orphanDelayedCallbacks = null;\n\n for (var i = 0; i < delayed.length; ++i) {\n delayed[i]();\n }\n } // When an aspect of a line changes, a string is added to\n // lineView.changes. This updates the relevant part of the line's\n // DOM structure.\n\n\n function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n\n if (type == \"text\") {\n updateLineText(cm, lineView);\n } else if (type == \"gutter\") {\n updateLineGutter(cm, lineView, lineN, dims);\n } else if (type == \"class\") {\n updateLineClasses(cm, lineView);\n } else if (type == \"widget\") {\n updateLineWidgets(cm, lineView, dims);\n }\n }\n\n lineView.changes = null;\n } // Lines with gutter elements, widgets or a background class need to\n // be wrapped, and have the extra elements added to the wrapper div\n\n\n function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n\n if (lineView.text.parentNode) {\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n }\n\n lineView.node.appendChild(lineView.text);\n\n if (ie && ie_version < 8) {\n lineView.node.style.zIndex = 2;\n }\n }\n\n return lineView.node;\n }\n\n function updateLineBackground(cm, lineView) {\n var cls = lineView.bgClass ? lineView.bgClass + \" \" + (lineView.line.bgClass || \"\") : lineView.line.bgClass;\n\n if (cls) {\n cls += \" CodeMirror-linebackground\";\n }\n\n if (lineView.background) {\n if (cls) {\n lineView.background.className = cls;\n } else {\n lineView.background.parentNode.removeChild(lineView.background);\n lineView.background = null;\n }\n } else if (cls) {\n var wrap = ensureLineWrapped(lineView);\n lineView.background = wrap.insertBefore(elt(\"div\", null, cls), wrap.firstChild);\n cm.display.input.setUneditable(lineView.background);\n }\n } // Wrapper around buildLineContent which will reuse the structure\n // in display.externalMeasured when possible.\n\n\n function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n\n return buildLineContent(cm, lineView);\n } // Redraw the line's text. Interacts with the background and text\n // classes because the mode may output tokens that influence these\n // classes.\n\n\n function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n\n if (lineView.text == lineView.node) {\n lineView.node = built.pre;\n }\n\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }\n\n function updateLineClasses(cm, lineView) {\n updateLineBackground(cm, lineView);\n\n if (lineView.line.wrapClass) {\n ensureLineWrapped(lineView).className = lineView.line.wrapClass;\n } else if (lineView.node != lineView.text) {\n lineView.node.className = \"\";\n }\n\n var textClass = lineView.textClass ? lineView.textClass + \" \" + (lineView.line.textClass || \"\") : lineView.line.textClass;\n lineView.text.className = textClass || \"\";\n }\n\n function updateLineGutter(cm, lineView, lineN, dims) {\n if (lineView.gutter) {\n lineView.node.removeChild(lineView.gutter);\n lineView.gutter = null;\n }\n\n if (lineView.gutterBackground) {\n lineView.node.removeChild(lineView.gutterBackground);\n lineView.gutterBackground = null;\n }\n\n if (lineView.line.gutterClass) {\n var wrap = ensureLineWrapped(lineView);\n lineView.gutterBackground = elt(\"div\", null, \"CodeMirror-gutter-background \" + lineView.line.gutterClass, \"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px; width: \" + dims.gutterTotalWidth + \"px\");\n cm.display.input.setUneditable(lineView.gutterBackground);\n wrap.insertBefore(lineView.gutterBackground, lineView.text);\n }\n\n var markers = lineView.line.gutterMarkers;\n\n if (cm.options.lineNumbers || markers) {\n var wrap$1 = ensureLineWrapped(lineView);\n var gutterWrap = lineView.gutter = elt(\"div\", null, \"CodeMirror-gutter-wrapper\", \"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px\");\n cm.display.input.setUneditable(gutterWrap);\n wrap$1.insertBefore(gutterWrap, lineView.text);\n\n if (lineView.line.gutterClass) {\n gutterWrap.className += \" \" + lineView.line.gutterClass;\n }\n\n if (cm.options.lineNumbers && (!markers || !markers[\"CodeMirror-linenumbers\"])) {\n lineView.lineNumber = gutterWrap.appendChild(elt(\"div\", lineNumberFor(cm.options, lineN), \"CodeMirror-linenumber CodeMirror-gutter-elt\", \"left: \" + dims.gutterLeft[\"CodeMirror-linenumbers\"] + \"px; width: \" + cm.display.lineNumInnerWidth + \"px\"));\n }\n\n if (markers) {\n for (var k = 0; k < cm.display.gutterSpecs.length; ++k) {\n var id = cm.display.gutterSpecs[k].className,\n found = markers.hasOwnProperty(id) && markers[id];\n\n if (found) {\n gutterWrap.appendChild(elt(\"div\", [found], \"CodeMirror-gutter-elt\", \"left: \" + dims.gutterLeft[id] + \"px; width: \" + dims.gutterWidth[id] + \"px\"));\n }\n }\n }\n }\n }\n\n function updateLineWidgets(cm, lineView, dims) {\n if (lineView.alignable) {\n lineView.alignable = null;\n }\n\n var isWidget = classTest(\"CodeMirror-linewidget\");\n\n for (var node = lineView.node.firstChild, next = void 0; node; node = next) {\n next = node.nextSibling;\n\n if (isWidget.test(node.className)) {\n lineView.node.removeChild(node);\n }\n }\n\n insertLineWidgets(cm, lineView, dims);\n } // Build a line's DOM representation from scratch\n\n\n function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n\n if (built.bgClass) {\n lineView.bgClass = built.bgClass;\n }\n\n if (built.textClass) {\n lineView.textClass = built.textClass;\n }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node;\n } // A lineView may contain multiple logical lines (when merged by\n // collapsed spans). The widgets for all of them need to be drawn.\n\n\n function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n\n if (lineView.rest) {\n for (var i = 0; i < lineView.rest.length; i++) {\n insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n }\n }\n }\n\n function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {\n if (!line.widgets) {\n return;\n }\n\n var wrap = ensureLineWrapped(lineView);\n\n for (var i = 0, ws = line.widgets; i < ws.length; ++i) {\n var widget = ws[i],\n node = elt(\"div\", [widget.node], \"CodeMirror-linewidget\" + (widget.className ? \" \" + widget.className : \"\"));\n\n if (!widget.handleMouseEvents) {\n node.setAttribute(\"cm-ignore-events\", \"true\");\n }\n\n positionLineWidget(widget, node, lineView, dims);\n cm.display.input.setUneditable(node);\n\n if (allowAbove && widget.above) {\n wrap.insertBefore(node, lineView.gutter || lineView.text);\n } else {\n wrap.appendChild(node);\n }\n\n signalLater(widget, \"redraw\");\n }\n }\n\n function positionLineWidget(widget, node, lineView, dims) {\n if (widget.noHScroll) {\n (lineView.alignable || (lineView.alignable = [])).push(node);\n var width = dims.wrapperWidth;\n node.style.left = dims.fixedPos + \"px\";\n\n if (!widget.coverGutter) {\n width -= dims.gutterTotalWidth;\n node.style.paddingLeft = dims.gutterTotalWidth + \"px\";\n }\n\n node.style.width = width + \"px\";\n }\n\n if (widget.coverGutter) {\n node.style.zIndex = 5;\n node.style.position = \"relative\";\n\n if (!widget.noHScroll) {\n node.style.marginLeft = -dims.gutterTotalWidth + \"px\";\n }\n }\n }\n\n function widgetHeight(widget) {\n if (widget.height != null) {\n return widget.height;\n }\n\n var cm = widget.doc.cm;\n\n if (!cm) {\n return 0;\n }\n\n if (!contains(document.body, widget.node)) {\n var parentStyle = \"position: relative;\";\n\n if (widget.coverGutter) {\n parentStyle += \"margin-left: -\" + cm.display.gutters.offsetWidth + \"px;\";\n }\n\n if (widget.noHScroll) {\n parentStyle += \"width: \" + cm.display.wrapper.clientWidth + \"px;\";\n }\n\n removeChildrenAndAdd(cm.display.measure, elt(\"div\", [widget.node], null, parentStyle));\n }\n\n return widget.height = widget.node.parentNode.offsetHeight;\n } // Return true when the given mouse event happened in a widget\n\n\n function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\" || n.parentNode == display.sizer && n != display.mover) {\n return true;\n }\n }\n } // POSITION MEASUREMENT\n\n\n function paddingTop(display) {\n return display.lineSpace.offsetTop;\n }\n\n function paddingVert(display) {\n return display.mover.offsetHeight - display.lineSpace.offsetHeight;\n }\n\n function paddingH(display) {\n if (display.cachedPaddingH) {\n return display.cachedPaddingH;\n }\n\n var e = removeChildrenAndAdd(display.measure, elt(\"pre\", \"x\", \"CodeMirror-line-like\"));\n var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;\n var data = {\n left: parseInt(style.paddingLeft),\n right: parseInt(style.paddingRight)\n };\n\n if (!isNaN(data.left) && !isNaN(data.right)) {\n display.cachedPaddingH = data;\n }\n\n return data;\n }\n\n function scrollGap(cm) {\n return scrollerGap - cm.display.nativeBarWidth;\n }\n\n function displayWidth(cm) {\n return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth;\n }\n\n function displayHeight(cm) {\n return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight;\n } // Ensure the lineView.wrapping.heights array is populated. This is\n // an array of bottom offsets for the lines that make up a drawn\n // line. When lineWrapping is on, there might be more than one\n // height.\n\n\n function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i],\n next = rects[i + 1];\n\n if (Math.abs(cur.bottom - next.bottom) > 2) {\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n }\n\n heights.push(rect.bottom - rect.top);\n }\n } // Find a line map (mapping character offsets to text nodes) and a\n // measurement cache for the given line number. (A line view might\n // contain multiple lines when collapsed ranges are present.)\n\n\n function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line) {\n return {\n map: lineView.measure.map,\n cache: lineView.measure.cache\n };\n }\n\n for (var i = 0; i < lineView.rest.length; i++) {\n if (lineView.rest[i] == line) {\n return {\n map: lineView.measure.maps[i],\n cache: lineView.measure.caches[i]\n };\n }\n }\n\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) {\n if (lineNo(lineView.rest[i$1]) > lineN) {\n return {\n map: lineView.measure.maps[i$1],\n cache: lineView.measure.caches[i$1],\n before: true\n };\n }\n }\n } // Render a line into the hidden node display.externalMeasured. Used\n // when measurement is needed for a line that's not in the viewport.\n\n\n function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n } // Get a {top, bottom, left, right} box (in line-local coordinates)\n // for a given character.\n\n\n function measureChar(cm, line, ch, bias) {\n return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias);\n } // Find a line view that corresponds to the given line number.\n\n\n function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) {\n return cm.display.view[findViewIndex(cm, lineN)];\n }\n\n var ext = cm.display.externalMeasured;\n\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) {\n return ext;\n }\n } // Measurement can be split in two steps, the set-up work that\n // applies to the whole line, and the measurement of the actual\n // character. Functions like coordsChar, that need to do a lot of\n // measurements in a row, can thus ensure that the set-up work is\n // only done once.\n\n\n function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n\n if (!view) {\n view = updateExternalMeasurement(cm, line);\n }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line,\n view: view,\n rect: null,\n map: info.map,\n cache: info.cache,\n before: info.before,\n hasHeights: false\n };\n } // Given a prepared measurement object, measures the position of an\n // actual character (or fetches it from the cache).\n\n\n function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) {\n ch = -1;\n }\n\n var key = ch + (bias || \"\"),\n found;\n\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect) {\n prepared.rect = prepared.view.text.getBoundingClientRect();\n }\n\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n\n found = measureCharInner(cm, prepared, ch, bias);\n\n if (!found.bogus) {\n prepared.cache[key] = found;\n }\n }\n\n return {\n left: found.left,\n right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom\n };\n }\n\n var nullRect = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n };\n\n function nodeAndOffsetInLineMap(map, ch, bias) {\n var node, start, end, collapse, mStart, mEnd; // First, search the line map for the text node corresponding to,\n // or closest to, the target character.\n\n for (var i = 0; i < map.length; i += 3) {\n mStart = map[i];\n mEnd = map[i + 1];\n\n if (ch < mStart) {\n start = 0;\n end = 1;\n collapse = \"left\";\n } else if (ch < mEnd) {\n start = ch - mStart;\n end = start + 1;\n } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {\n end = mEnd - mStart;\n start = end - 1;\n\n if (ch >= mEnd) {\n collapse = \"right\";\n }\n }\n\n if (start != null) {\n node = map[i + 2];\n\n if (mStart == mEnd && bias == (node.insertLeft ? \"left\" : \"right\")) {\n collapse = bias;\n }\n\n if (bias == \"left\" && start == 0) {\n while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {\n node = map[(i -= 3) + 2];\n collapse = \"left\";\n }\n }\n\n if (bias == \"right\" && start == mEnd - mStart) {\n while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {\n node = map[(i += 3) + 2];\n collapse = \"right\";\n }\n }\n\n break;\n }\n }\n\n return {\n node: node,\n start: start,\n end: end,\n collapse: collapse,\n coverStart: mStart,\n coverEnd: mEnd\n };\n }\n\n function getUsefulRect(rects, bias) {\n var rect = nullRect;\n\n if (bias == \"left\") {\n for (var i = 0; i < rects.length; i++) {\n if ((rect = rects[i]).left != rect.right) {\n break;\n }\n }\n } else {\n for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {\n if ((rect = rects[i$1]).left != rect.right) {\n break;\n }\n }\n }\n\n return rect;\n }\n\n function measureCharInner(cm, prepared, ch, bias) {\n var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);\n var node = place.node,\n start = place.start,\n end = place.end,\n collapse = place.collapse;\n var rect;\n\n if (node.nodeType == 3) {\n // If it is a text node, use a range to retrieve the coordinates.\n for (var i$1 = 0; i$1 < 4; i$1++) {\n // Retry a maximum of 4 times when nonsense rectangles are returned\n while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) {\n --start;\n }\n\n while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) {\n ++end;\n }\n\n if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) {\n rect = node.parentNode.getBoundingClientRect();\n } else {\n rect = getUsefulRect(range(node, start, end).getClientRects(), bias);\n }\n\n if (rect.left || rect.right || start == 0) {\n break;\n }\n\n end = start;\n start = start - 1;\n collapse = \"right\";\n }\n\n if (ie && ie_version < 11) {\n rect = maybeUpdateRectForZooming(cm.display.measure, rect);\n }\n } else {\n // If it is a widget, simply get the box for the whole widget.\n if (start > 0) {\n collapse = bias = \"right\";\n }\n\n var rects;\n\n if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1) {\n rect = rects[bias == \"right\" ? rects.length - 1 : 0];\n } else {\n rect = node.getBoundingClientRect();\n }\n }\n\n if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {\n var rSpan = node.parentNode.getClientRects()[0];\n\n if (rSpan) {\n rect = {\n left: rSpan.left,\n right: rSpan.left + charWidth(cm.display),\n top: rSpan.top,\n bottom: rSpan.bottom\n };\n } else {\n rect = nullRect;\n }\n }\n\n var rtop = rect.top - prepared.rect.top,\n rbot = rect.bottom - prepared.rect.top;\n var mid = (rtop + rbot) / 2;\n var heights = prepared.view.measure.heights;\n var i = 0;\n\n for (; i < heights.length - 1; i++) {\n if (mid < heights[i]) {\n break;\n }\n }\n\n var top = i ? heights[i - 1] : 0,\n bot = heights[i];\n var result = {\n left: (collapse == \"right\" ? rect.right : rect.left) - prepared.rect.left,\n right: (collapse == \"left\" ? rect.left : rect.right) - prepared.rect.left,\n top: top,\n bottom: bot\n };\n\n if (!rect.left && !rect.right) {\n result.bogus = true;\n }\n\n if (!cm.options.singleCursorHeightPerLine) {\n result.rtop = rtop;\n result.rbottom = rbot;\n }\n\n return result;\n } // Work around problem with bounding client rects on ranges being\n // returned incorrectly when zoomed on IE10 and below.\n\n\n function maybeUpdateRectForZooming(measure, rect) {\n if (!window.screen || screen.logicalXDPI == null || screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure)) {\n return rect;\n }\n\n var scaleX = screen.logicalXDPI / screen.deviceXDPI;\n var scaleY = screen.logicalYDPI / screen.deviceYDPI;\n return {\n left: rect.left * scaleX,\n right: rect.right * scaleX,\n top: rect.top * scaleY,\n bottom: rect.bottom * scaleY\n };\n }\n\n function clearLineMeasurementCacheFor(lineView) {\n if (lineView.measure) {\n lineView.measure.cache = {};\n lineView.measure.heights = null;\n\n if (lineView.rest) {\n for (var i = 0; i < lineView.rest.length; i++) {\n lineView.measure.caches[i] = {};\n }\n }\n }\n }\n\n function clearLineMeasurementCache(cm) {\n cm.display.externalMeasure = null;\n removeChildren(cm.display.lineMeasure);\n\n for (var i = 0; i < cm.display.view.length; i++) {\n clearLineMeasurementCacheFor(cm.display.view[i]);\n }\n }\n\n function clearCaches(cm) {\n clearLineMeasurementCache(cm);\n cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;\n\n if (!cm.options.lineWrapping) {\n cm.display.maxLineChanged = true;\n }\n\n cm.display.lineNumChars = null;\n }\n\n function pageScrollX() {\n // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206\n // which causes page_Offset and bounding client rects to use\n // different reference viewports and invalidate our calculations.\n if (chrome && android) {\n return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft));\n }\n\n return window.pageXOffset || (document.documentElement || document.body).scrollLeft;\n }\n\n function pageScrollY() {\n if (chrome && android) {\n return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop));\n }\n\n return window.pageYOffset || (document.documentElement || document.body).scrollTop;\n }\n\n function widgetTopHeight(lineObj) {\n var height = 0;\n\n if (lineObj.widgets) {\n for (var i = 0; i < lineObj.widgets.length; ++i) {\n if (lineObj.widgets[i].above) {\n height += widgetHeight(lineObj.widgets[i]);\n }\n }\n }\n\n return height;\n } // Converts a {top, bottom, left, right} box from line-local\n // coordinates into another coordinate system. Context may be one of\n // \"line\", \"div\" (display.lineDiv), \"local\"./null (editor), \"window\",\n // or \"page\".\n\n\n function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {\n if (!includeWidgets) {\n var height = widgetTopHeight(lineObj);\n rect.top += height;\n rect.bottom += height;\n }\n\n if (context == \"line\") {\n return rect;\n }\n\n if (!context) {\n context = \"local\";\n }\n\n var yOff = _heightAtLine(lineObj);\n\n if (context == \"local\") {\n yOff += paddingTop(cm.display);\n } else {\n yOff -= cm.display.viewOffset;\n }\n\n if (context == \"page\" || context == \"window\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff;\n rect.right += xOff;\n }\n\n rect.top += yOff;\n rect.bottom += yOff;\n return rect;\n } // Coverts a box from \"div\" coords to another coordinate system.\n // Context may be \"window\", \"page\", \"div\", or \"local\"./null.\n\n\n function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") {\n return coords;\n }\n\n var left = coords.left,\n top = coords.top; // First move into \"page\" coordinate system\n\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {\n left: left - lineSpaceBox.left,\n top: top - lineSpaceBox.top\n };\n }\n\n function _charCoords(cm, pos, context, lineObj, bias) {\n if (!lineObj) {\n lineObj = getLine(cm.doc, pos.line);\n }\n\n return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context);\n } // Returns a box for a given cursor position, which may have an\n // 'other' property containing the position of the secondary cursor\n // on a bidi boundary.\n // A cursor Pos(line, char, \"before\") is on the same visual line as `char - 1`\n // and after `char - 1` in writing order of `char - 1`\n // A cursor Pos(line, char, \"after\") is on the same visual line as `char`\n // and before `char` in writing order of `char`\n // Examples (upper-case letters are RTL, lower-case are LTR):\n // Pos(0, 1, ...)\n // before after\n // ab a|b a|b\n // aB a|B aB|\n // Ab |Ab A|b\n // AB B|A B|A\n // Every position after the last character on a line is considered to stick\n // to the last character on the line.\n\n\n function _cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n\n if (!preparedMeasure) {\n preparedMeasure = prepareMeasureForLine(cm, lineObj);\n }\n\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n\n if (right) {\n m.left = m.right;\n } else {\n m.right = m.left;\n }\n\n return intoCoordSystem(cm, lineObj, m, context);\n }\n\n var order = getOrder(lineObj, cm.doc.direction),\n ch = pos.ch,\n sticky = pos.sticky;\n\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n\n if (!order) {\n return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\");\n }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos],\n right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert);\n }\n\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n\n if (other != null) {\n val.other = getBidi(ch, other, sticky != \"before\");\n }\n\n return val;\n } // Used to cheaply estimate the coordinates for a position. Used for\n // intermediate scroll updates.\n\n\n function estimateCoords(cm, pos) {\n var left = 0;\n pos = _clipPos(cm.doc, pos);\n\n if (!cm.options.lineWrapping) {\n left = charWidth(cm.display) * pos.ch;\n }\n\n var lineObj = getLine(cm.doc, pos.line);\n var top = _heightAtLine(lineObj) + paddingTop(cm.display);\n return {\n left: left,\n right: left,\n top: top,\n bottom: top + lineObj.height\n };\n } // Positions returned by coordsChar contain some extra information.\n // xRel is the relative x position of the input coordinates compared\n // to the found position (so xRel > 0 means the coordinates are to\n // the right of the character position, for example). When outside\n // is true, that means the coordinates lie outside the line's\n // vertical range.\n\n\n function PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n\n if (outside) {\n pos.outside = outside;\n }\n\n return pos;\n } // Compute the character position closest to the given coordinates.\n // Input must be lineSpace-local (\"div\" coordinate system).\n\n\n function _coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n\n if (y < 0) {\n return PosWithInfo(doc.first, 0, null, -1, -1);\n }\n\n var lineN = _lineAtHeight(doc, y),\n last = doc.first + doc.size - 1;\n\n if (lineN > last) {\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1);\n }\n\n if (x < 0) {\n x = 0;\n }\n\n var lineObj = getLine(doc, lineN);\n\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n\n if (!collapsed) {\n return found;\n }\n\n var rangeEnd = collapsed.find(1);\n\n if (rangeEnd.line == lineN) {\n return rangeEnd;\n }\n\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }\n\n function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {\n y -= widgetTopHeight(lineObj);\n var end = lineObj.text.length;\n var begin = findFirst(function (ch) {\n return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y;\n }, end, 0);\n end = findFirst(function (ch) {\n return measureCharPrepared(cm, preparedMeasure, ch).top > y;\n }, begin, end);\n return {\n begin: begin,\n end: end\n };\n }\n\n function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {\n if (!preparedMeasure) {\n preparedMeasure = prepareMeasureForLine(cm, lineObj);\n }\n\n var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), \"line\").top;\n return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop);\n } // Returns true if the given side of a box is after the given\n // coordinates, in top-to-bottom, left-to-right order.\n\n\n function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x;\n }\n\n function coordsCharInner(cm, lineObj, lineNo, x, y) {\n // Move y into line-local coordinate space\n y -= _heightAtLine(lineObj);\n var preparedMeasure = prepareMeasureForLine(cm, lineObj); // When directly calling `measureCharPrepared`, we have to adjust\n // for the widgets at this line.\n\n var widgetHeight = widgetTopHeight(lineObj);\n var begin = 0,\n end = lineObj.text.length,\n ltr = true;\n var order = getOrder(lineObj, cm.doc.direction); // If the line isn't plain left-to-right text, first figure out\n // which bidi section the coordinates fall into.\n\n if (order) {\n var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)(cm, lineObj, lineNo, preparedMeasure, order, x, y);\n ltr = part.level != 1; // The awkward -1 offsets are needed because findFirst (called\n // on these below) will treat its first bound as inclusive,\n // second as exclusive, but we want to actually address the\n // characters in the part's range\n\n begin = ltr ? part.from : part.to - 1;\n end = ltr ? part.to : part.from - 1;\n } // A binary search to find the first character whose bounding box\n // starts after the coordinates. If we run across any whose box wrap\n // the coordinates, store that.\n\n\n var chAround = null,\n boxAround = null;\n var ch = findFirst(function (ch) {\n var box = measureCharPrepared(cm, preparedMeasure, ch);\n box.top += widgetHeight;\n box.bottom += widgetHeight;\n\n if (!boxIsAfter(box, x, y, false)) {\n return false;\n }\n\n if (box.top <= y && box.left <= x) {\n chAround = ch;\n boxAround = box;\n }\n\n return true;\n }, begin, end);\n var baseX,\n sticky,\n outside = false; // If a box around the coordinates was found, use that\n\n if (boxAround) {\n // Distinguish coordinates nearer to the left or right side of the box\n var atLeft = x - boxAround.left < boxAround.right - x,\n atStart = atLeft == ltr;\n ch = chAround + (atStart ? 0 : 1);\n sticky = atStart ? \"after\" : \"before\";\n baseX = atLeft ? boxAround.left : boxAround.right;\n } else {\n // (Adjust for extended bound, if necessary.)\n if (!ltr && (ch == end || ch == begin)) {\n ch++;\n } // To determine which side to associate with, get the box to the\n // left of the character and compare it's vertical position to the\n // coordinates\n\n\n sticky = ch == 0 ? \"after\" : ch == lineObj.text.length ? \"before\" : measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y == ltr ? \"after\" : \"before\"; // Now get accurate coordinates for this place, in order to get a\n // base X position\n\n var coords = _cursorCoords(cm, Pos(lineNo, ch, sticky), \"line\", lineObj, preparedMeasure);\n\n baseX = coords.left;\n outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;\n }\n\n ch = skipExtendingChars(lineObj.text, ch, 1);\n return PosWithInfo(lineNo, ch, sticky, outside, x - baseX);\n }\n\n function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {\n // Bidi parts are sorted left-to-right, and in a non-line-wrapping\n // situation, we can take this ordering to correspond to the visual\n // ordering. This finds the first part whose end is after the given\n // coordinates.\n var index = findFirst(function (i) {\n var part = order[i],\n ltr = part.level != 1;\n return boxIsAfter(_cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? \"before\" : \"after\"), \"line\", lineObj, preparedMeasure), x, y, true);\n }, 0, order.length - 1);\n var part = order[index]; // If this isn't the first part, the part's start is also after\n // the coordinates, and the coordinates aren't on the same line as\n // that start, move one part back.\n\n if (index > 0) {\n var ltr = part.level != 1;\n\n var start = _cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? \"after\" : \"before\"), \"line\", lineObj, preparedMeasure);\n\n if (boxIsAfter(start, x, y, true) && start.top > y) {\n part = order[index - 1];\n }\n }\n\n return part;\n }\n\n function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {\n // In a wrapped line, rtl text on wrapping boundaries can do things\n // that don't correspond to the ordering in our `order` array at\n // all, so a binary search doesn't work, and we want to return a\n // part that only spans one line so that the binary search in\n // coordsCharInner is safe. As such, we first find the extent of the\n // wrapped line, and then do a flat search in which we discard any\n // spans that aren't on the line.\n var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);\n var begin = ref.begin;\n var end = ref.end;\n\n if (/\\s/.test(lineObj.text.charAt(end - 1))) {\n end--;\n }\n\n var part = null,\n closestDist = null;\n\n for (var i = 0; i < order.length; i++) {\n var p = order[i];\n\n if (p.from >= end || p.to <= begin) {\n continue;\n }\n\n var ltr = p.level != 1;\n var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right; // Weigh against spans ending before this, so that they are only\n // picked if nothing ends after\n\n var dist = endX < x ? x - endX + 1e9 : endX - x;\n\n if (!part || closestDist > dist) {\n part = p;\n closestDist = dist;\n }\n }\n\n if (!part) {\n part = order[order.length - 1];\n } // Clip the part to the wrapped line.\n\n\n if (part.from < begin) {\n part = {\n from: begin,\n to: part.to,\n level: part.level\n };\n }\n\n if (part.to > end) {\n part = {\n from: part.from,\n to: end,\n level: part.level\n };\n }\n\n return part;\n }\n\n var measureText; // Compute the default text height.\n\n function textHeight(display) {\n if (display.cachedTextHeight != null) {\n return display.cachedTextHeight;\n }\n\n if (measureText == null) {\n measureText = elt(\"pre\", null, \"CodeMirror-line-like\"); // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n\n if (height > 3) {\n display.cachedTextHeight = height;\n }\n\n removeChildren(display.measure);\n return height || 1;\n } // Compute the default character width.\n\n\n function charWidth(display) {\n if (display.cachedCharWidth != null) {\n return display.cachedCharWidth;\n }\n\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(),\n width = (rect.right - rect.left) / 10;\n\n if (width > 2) {\n display.cachedCharWidth = width;\n }\n\n return width || 10;\n } // Do a bulk-read of the DOM positions and sizes needed to draw the\n // view, so that we don't interleave reading and writing to the DOM.\n\n\n function getDimensions(cm) {\n var d = cm.display,\n left = {},\n width = {};\n var gutterLeft = d.gutters.clientLeft;\n\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n\n return {\n fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth\n };\n } // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,\n // but using getBoundingClientRect to get a sub-pixel-accurate\n // result.\n\n\n function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n } // Returns a function that estimates the height of a line, to use as\n // first approximation until the line becomes visible (and is thus\n // properly measurable).\n\n\n function estimateHeight(cm) {\n var th = textHeight(cm.display),\n wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) {\n return 0;\n }\n\n var widgetsHeight = 0;\n\n if (line.widgets) {\n for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) {\n widgetsHeight += line.widgets[i].height;\n }\n }\n }\n\n if (wrapping) {\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n } else {\n return widgetsHeight + th;\n }\n };\n }\n\n function estimateLineHeights(cm) {\n var doc = cm.doc,\n est = estimateHeight(cm);\n doc.iter(function (line) {\n var estHeight = est(line);\n\n if (estHeight != line.height) {\n updateLineHeight(line, estHeight);\n }\n });\n } // Given a mouse event, find the corresponding position. If liberal\n // is false, it checks whether a gutter or scrollbar was clicked,\n // and returns null if it was. forRect is used by rectangular\n // selections, and tries to estimate a character position even for\n // coordinates beyond the right of the text.\n\n\n function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") {\n return null;\n }\n\n var x,\n y,\n space = display.lineSpace.getBoundingClientRect(); // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n\n try {\n x = e.clientX - space.left;\n y = e.clientY - space.top;\n } catch (e) {\n return null;\n }\n\n var coords = _coordsChar(cm, x, y),\n line;\n\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n\n return coords;\n } // Find the view element corresponding to a given line. Return null\n // when the line isn't visible.\n\n\n function findViewIndex(cm, n) {\n if (n >= cm.display.viewTo) {\n return null;\n }\n\n n -= cm.display.viewFrom;\n\n if (n < 0) {\n return null;\n }\n\n var view = cm.display.view;\n\n for (var i = 0; i < view.length; i++) {\n n -= view[i].size;\n\n if (n < 0) {\n return i;\n }\n }\n } // Updates the display.view data structure for a given change to the\n // document. From and to are in pre-change coordinates. Lendiff is\n // the amount of lines added or subtracted by the change. This is\n // used for changes that span multiple lines, or change the way\n // lines are divided into visual lines. regLineChange (below)\n // registers single-line changes.\n\n\n function regChange(cm, from, to, lendiff) {\n if (from == null) {\n from = cm.doc.first;\n }\n\n if (to == null) {\n to = cm.doc.first + cm.doc.size;\n }\n\n if (!lendiff) {\n lendiff = 0;\n }\n\n var display = cm.display;\n\n if (lendiff && to < display.viewTo && (display.updateLineNumbers == null || display.updateLineNumbers > from)) {\n display.updateLineNumbers = from;\n }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) {\n // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) {\n resetView(cm);\n }\n } else if (to <= display.viewFrom) {\n // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) {\n // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) {\n // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) {\n // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else {\n // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index).concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN)).concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n\n if (ext) {\n if (to < ext.lineN) {\n ext.lineN += lendiff;\n } else if (from < ext.lineN + ext.size) {\n display.externalMeasured = null;\n }\n }\n } // Register a change to a single line. Type must be one of \"text\",\n // \"gutter\", \"class\", \"widget\"\n\n\n function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display,\n ext = cm.display.externalMeasured;\n\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size) {\n display.externalMeasured = null;\n }\n\n if (line < display.viewFrom || line >= display.viewTo) {\n return;\n }\n\n var lineView = display.view[findViewIndex(cm, line)];\n\n if (lineView.node == null) {\n return;\n }\n\n var arr = lineView.changes || (lineView.changes = []);\n\n if (indexOf(arr, type) == -1) {\n arr.push(type);\n }\n } // Clear the view.\n\n\n function resetView(cm) {\n cm.display.viewFrom = cm.display.viewTo = cm.doc.first;\n cm.display.view = [];\n cm.display.viewOffset = 0;\n }\n\n function viewCuttingPoint(cm, oldN, newN, dir) {\n var index = findViewIndex(cm, oldN),\n diff,\n view = cm.display.view;\n\n if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size) {\n return {\n index: index,\n lineN: newN\n };\n }\n\n var n = cm.display.viewFrom;\n\n for (var i = 0; i < index; i++) {\n n += view[i].size;\n }\n\n if (n != oldN) {\n if (dir > 0) {\n if (index == view.length - 1) {\n return null;\n }\n\n diff = n + view[index].size - oldN;\n index++;\n } else {\n diff = n - oldN;\n }\n\n oldN += diff;\n newN += diff;\n }\n\n while (visualLineNo(cm.doc, newN) != newN) {\n if (index == (dir < 0 ? 0 : view.length - 1)) {\n return null;\n }\n\n newN += dir * view[index - (dir < 0 ? 1 : 0)].size;\n index += dir;\n }\n\n return {\n index: index,\n lineN: newN\n };\n } // Force the view to cover a given range, adding empty view element\n // or clipping off existing ones as needed.\n\n\n function adjustView(cm, from, to) {\n var display = cm.display,\n view = display.view;\n\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from) {\n display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n } else if (display.viewFrom < from) {\n display.view = display.view.slice(findViewIndex(cm, from));\n }\n\n display.viewFrom = from;\n\n if (display.viewTo < to) {\n display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n } else if (display.viewTo > to) {\n display.view = display.view.slice(0, findViewIndex(cm, to));\n }\n }\n\n display.viewTo = to;\n } // Count the number of lines in the view whose DOM representation is\n // out of date (or nonexistent).\n\n\n function countDirtyView(cm) {\n var view = cm.display.view,\n dirty = 0;\n\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n\n if (!lineView.hidden && (!lineView.node || lineView.changes)) {\n ++dirty;\n }\n }\n\n return dirty;\n }\n\n function updateSelection(cm) {\n cm.display.input.showSelection(cm.display.input.prepareSelection());\n }\n\n function prepareSelection(cm, primary) {\n if (primary === void 0) primary = true;\n var doc = cm.doc,\n result = {};\n var curFragment = result.cursors = document.createDocumentFragment();\n var selFragment = result.selection = document.createDocumentFragment();\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n if (!primary && i == doc.sel.primIndex) {\n continue;\n }\n\n var range = doc.sel.ranges[i];\n\n if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) {\n continue;\n }\n\n var collapsed = range.empty();\n\n if (collapsed || cm.options.showCursorWhenSelecting) {\n drawSelectionCursor(cm, range.head, curFragment);\n }\n\n if (!collapsed) {\n drawSelectionRange(cm, range, selFragment);\n }\n }\n\n return result;\n } // Draws a cursor for the given range\n\n\n function drawSelectionCursor(cm, head, output) {\n var pos = _cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\xA0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\xA0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }\n\n function cmpCoords(a, b) {\n return a.top - b.top || a.left - b.left;\n } // Draws the given range as a highlighted selection\n\n\n function drawSelectionRange(cm, range, output) {\n var display = cm.display,\n doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display),\n leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) {\n top = 0;\n }\n\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n\n function coords(ch, bias) {\n return _charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = dir == \"ltr\" == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop];\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n var openStart = fromArg == null && from == 0,\n openEnd = toArg == null && to == lineLen;\n var first = i == 0,\n last = !order || i == order.length - 1;\n\n if (toPos.top - fromPos.top <= 3) {\n // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else {\n // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n\n if (fromPos.bottom < toPos.top) {\n add(leftSide, fromPos.bottom, null, toPos.top);\n }\n\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) {\n start = fromPos;\n }\n\n if (cmpCoords(toPos, start) < 0) {\n start = toPos;\n }\n\n if (!end || cmpCoords(fromPos, end) < 0) {\n end = fromPos;\n }\n\n if (cmpCoords(toPos, end) < 0) {\n end = toPos;\n }\n });\n return {\n start: start,\n end: end\n };\n }\n\n var sFrom = range.from(),\n sTo = range.to();\n\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line),\n toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n\n if (leftEnd.bottom < rightStart.top) {\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n }\n\n output.appendChild(fragment);\n } // Cursor-blinking\n\n\n function restartBlink(cm) {\n if (!cm.state.focused) {\n return;\n }\n\n var display = cm.display;\n clearInterval(display.blinker);\n var on = true;\n display.cursorDiv.style.visibility = \"\";\n\n if (cm.options.cursorBlinkRate > 0) {\n display.blinker = setInterval(function () {\n return display.cursorDiv.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, cm.options.cursorBlinkRate);\n } else if (cm.options.cursorBlinkRate < 0) {\n display.cursorDiv.style.visibility = \"hidden\";\n }\n }\n\n function ensureFocus(cm) {\n if (!cm.state.focused) {\n cm.display.input.focus();\n onFocus(cm);\n }\n }\n\n function delayBlurEvent(cm) {\n cm.state.delayingBlurEvent = true;\n setTimeout(function () {\n if (cm.state.delayingBlurEvent) {\n cm.state.delayingBlurEvent = false;\n onBlur(cm);\n }\n }, 100);\n }\n\n function onFocus(cm, e) {\n if (cm.state.delayingBlurEvent) {\n cm.state.delayingBlurEvent = false;\n }\n\n if (cm.options.readOnly == \"nocursor\") {\n return;\n }\n\n if (!cm.state.focused) {\n signal(cm, \"focus\", cm, e);\n cm.state.focused = true;\n addClass(cm.display.wrapper, \"CodeMirror-focused\"); // This test prevents this from firing when a context\n // menu is closed (since the input reset would kill the\n // select-all detection hack)\n\n if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {\n cm.display.input.reset();\n\n if (webkit) {\n setTimeout(function () {\n return cm.display.input.reset(true);\n }, 20);\n } // Issue #1730\n\n }\n\n cm.display.input.receivedFocus();\n }\n\n restartBlink(cm);\n }\n\n function onBlur(cm, e) {\n if (cm.state.delayingBlurEvent) {\n return;\n }\n\n if (cm.state.focused) {\n signal(cm, \"blur\", cm, e);\n cm.state.focused = false;\n rmClass(cm.display.wrapper, \"CodeMirror-focused\");\n }\n\n clearInterval(cm.display.blinker);\n setTimeout(function () {\n if (!cm.state.focused) {\n cm.display.shift = false;\n }\n }, 150);\n } // Read the actual heights of the rendered lines, and update their\n // stored heights to match.\n\n\n function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i],\n wrapping = cm.options.lineWrapping;\n var height = void 0,\n width = 0;\n\n if (cur.hidden) {\n continue;\n }\n\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top; // Check that lines don't extend past the right of the current\n // editor width\n\n if (!wrapping && cur.text.firstChild) {\n width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1;\n }\n }\n\n var diff = cur.line.height - height;\n\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n\n if (cur.rest) {\n for (var j = 0; j < cur.rest.length; j++) {\n updateWidgetHeight(cur.rest[j]);\n }\n }\n }\n\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n } // Read and store the height of line widgets associated with the\n // given line.\n\n\n function updateWidgetHeight(line) {\n if (line.widgets) {\n for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i],\n parent = w.node.parentNode;\n\n if (parent) {\n w.height = parent.offsetHeight;\n }\n }\n }\n } // Compute the lines that are visible in a given viewport (defaults\n // the the current scroll position). viewport may contain top,\n // height, and ensure (see op.scrollToPos) properties.\n\n\n function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = _lineAtHeight(doc, top),\n to = _lineAtHeight(doc, bottom); // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n\n\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line,\n ensureTo = viewport.ensure.to.line;\n\n if (ensureFrom < from) {\n from = ensureFrom;\n to = _lineAtHeight(doc, _heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = _lineAtHeight(doc, _heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n\n return {\n from: from,\n to: Math.max(to, from + 1)\n };\n } // SCROLLING THINGS INTO VIEW\n // If an editor sits on the top or bottom of the window, partially\n // scrolled out of view, this ensures that the cursor is visible.\n\n\n function maybeScrollWindow(cm, rect) {\n if (signalDOMEvent(cm, \"scrollCursorIntoView\")) {\n return;\n }\n\n var display = cm.display,\n box = display.sizer.getBoundingClientRect(),\n doScroll = null;\n\n if (rect.top + box.top < 0) {\n doScroll = true;\n } else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) {\n doScroll = false;\n }\n\n if (doScroll != null && !phantom) {\n var scrollNode = elt(\"div\", \"\\u200B\", null, \"position: absolute;\\n top: \" + (rect.top - display.viewOffset - paddingTop(cm.display)) + \"px;\\n height: \" + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + \"px;\\n left: \" + rect.left + \"px; width: \" + Math.max(2, rect.right - rect.left) + \"px;\");\n cm.display.lineSpace.appendChild(scrollNode);\n scrollNode.scrollIntoView(doScroll);\n cm.display.lineSpace.removeChild(scrollNode);\n }\n } // Scroll a given position into view (immediately), verifying that\n // it actually became visible (as line heights are accurately\n // measured, the position of something may 'drift' during drawing).\n\n\n function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) {\n margin = 0;\n }\n\n var rect;\n\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n\n var coords = _cursorCoords(cm, pos);\n\n var endCoords = !end || end == pos ? coords : _cursorCoords(cm, end);\n rect = {\n left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin\n };\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop,\n startLeft = cm.doc.scrollLeft;\n\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) {\n changed = true;\n }\n }\n\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) {\n changed = true;\n }\n }\n\n if (!changed) {\n break;\n }\n }\n\n return rect;\n } // Scroll a given set of coordinates into view (immediately).\n\n\n function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n }\n\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n }\n } // Calculate a new scroll position needed to scroll the given\n // rectangle into view. Returns an object with scrollTop and\n // scrollLeft properties. When these are undefined, the\n // vertical/horizontal position does not need to be adjusted.\n\n\n function calculateScrollPos(cm, rect) {\n var display = cm.display,\n snapMargin = textHeight(cm.display);\n\n if (rect.top < 0) {\n rect.top = 0;\n }\n\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm),\n result = {};\n\n if (rect.bottom - rect.top > screen) {\n rect.bottom = rect.top + screen;\n }\n\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin,\n atBottom = rect.bottom > docBottom - snapMargin;\n\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n\n if (newTop != screentop) {\n result.scrollTop = newTop;\n }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n\n if (tooWide) {\n rect.right = rect.left + screenw;\n }\n\n if (rect.left < 10) {\n result.scrollLeft = 0;\n } else if (rect.left < screenleft) {\n result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10));\n } else if (rect.right > screenw + screenleft - 3) {\n result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw;\n }\n\n return result;\n } // Store a relative adjustment to the scroll position in the current\n // operation (to be applied when the operation finishes).\n\n\n function addToScrollTop(cm, top) {\n if (top == null) {\n return;\n }\n\n resolveScrollToPos(cm);\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n } // Make sure that at the end of the operation the current cursor is\n // shown.\n\n\n function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {\n from: cur,\n to: cur,\n margin: cm.options.cursorScrollMargin\n };\n }\n\n function scrollToCoords(cm, x, y) {\n if (x != null || y != null) {\n resolveScrollToPos(cm);\n }\n\n if (x != null) {\n cm.curOp.scrollLeft = x;\n }\n\n if (y != null) {\n cm.curOp.scrollTop = y;\n }\n }\n\n function scrollToRange(cm, range) {\n resolveScrollToPos(cm);\n cm.curOp.scrollToPos = range;\n } // When an operation has its scrollToPos property set, and another\n // scroll action is applied before the end of the operation, this\n // 'simulates' scrolling that position into view in a cheap way, so\n // that the effect of intermediate scroll commands is not ignored.\n\n\n function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from),\n to = estimateCoords(cm, range.to);\n scrollToCoordsRange(cm, from, to, range.margin);\n }\n }\n\n function scrollToCoordsRange(cm, from, to, margin) {\n var sPos = calculateScrollPos(cm, {\n left: Math.min(from.left, to.left),\n top: Math.min(from.top, to.top) - margin,\n right: Math.max(from.right, to.right),\n bottom: Math.max(from.bottom, to.bottom) + margin\n });\n scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);\n } // Sync the scrollable area and scrollbars, ensure the viewport\n // covers the visible area.\n\n\n function updateScrollTop(cm, val) {\n if (Math.abs(cm.doc.scrollTop - val) < 2) {\n return;\n }\n\n if (!gecko) {\n updateDisplaySimple(cm, {\n top: val\n });\n }\n\n setScrollTop(cm, val, true);\n\n if (gecko) {\n updateDisplaySimple(cm);\n }\n\n startWorker(cm, 100);\n }\n\n function setScrollTop(cm, val, forceScroll) {\n val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val));\n\n if (cm.display.scroller.scrollTop == val && !forceScroll) {\n return;\n }\n\n cm.doc.scrollTop = val;\n cm.display.scrollbars.setScrollTop(val);\n\n if (cm.display.scroller.scrollTop != val) {\n cm.display.scroller.scrollTop = val;\n }\n } // Sync scroller and scrollbar, ensure the gutter elements are\n // aligned.\n\n\n function setScrollLeft(cm, val, isScroller, forceScroll) {\n val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth));\n\n if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) {\n return;\n }\n\n cm.doc.scrollLeft = val;\n alignHorizontally(cm);\n\n if (cm.display.scroller.scrollLeft != val) {\n cm.display.scroller.scrollLeft = val;\n }\n\n cm.display.scrollbars.setScrollLeft(val);\n } // SCROLLBARS\n // Prepare DOM reads needed to update the scrollbars. Done in one\n // shot to minimize update/measure roundtrips.\n\n\n function measureForScrollbars(cm) {\n var d = cm.display,\n gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth,\n clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n };\n }\n\n var NativeScrollbars = function NativeScrollbars(place, scroll, cm) {\n this.cm = cm;\n var vert = this.vert = elt(\"div\", [elt(\"div\", null, null, \"min-width: 1px\")], \"CodeMirror-vscrollbar\");\n var horiz = this.horiz = elt(\"div\", [elt(\"div\", null, null, \"height: 100%; min-height: 1px\")], \"CodeMirror-hscrollbar\");\n vert.tabIndex = horiz.tabIndex = -1;\n place(vert);\n place(horiz);\n on(vert, \"scroll\", function () {\n if (vert.clientHeight) {\n scroll(vert.scrollTop, \"vertical\");\n }\n });\n on(horiz, \"scroll\", function () {\n if (horiz.clientWidth) {\n scroll(horiz.scrollLeft, \"horizontal\");\n }\n });\n this.checkedZeroWidth = false; // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).\n\n if (ie && ie_version < 8) {\n this.horiz.style.minHeight = this.vert.style.minWidth = \"18px\";\n }\n };\n\n NativeScrollbars.prototype.update = function (measure) {\n var needsH = measure.scrollWidth > measure.clientWidth + 1;\n var needsV = measure.scrollHeight > measure.clientHeight + 1;\n var sWidth = measure.nativeBarWidth;\n\n if (needsV) {\n this.vert.style.display = \"block\";\n this.vert.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n var totalHeight = measure.viewHeight - (needsH ? sWidth : 0); // A bug in IE8 can cause this value to be negative, so guard it.\n\n this.vert.firstChild.style.height = Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + \"px\";\n } else {\n this.vert.style.display = \"\";\n this.vert.firstChild.style.height = \"0\";\n }\n\n if (needsH) {\n this.horiz.style.display = \"block\";\n this.horiz.style.right = needsV ? sWidth + \"px\" : \"0\";\n this.horiz.style.left = measure.barLeft + \"px\";\n var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);\n this.horiz.firstChild.style.width = Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + \"px\";\n } else {\n this.horiz.style.display = \"\";\n this.horiz.firstChild.style.width = \"0\";\n }\n\n if (!this.checkedZeroWidth && measure.clientHeight > 0) {\n if (sWidth == 0) {\n this.zeroWidthHack();\n }\n\n this.checkedZeroWidth = true;\n }\n\n return {\n right: needsV ? sWidth : 0,\n bottom: needsH ? sWidth : 0\n };\n };\n\n NativeScrollbars.prototype.setScrollLeft = function (pos) {\n if (this.horiz.scrollLeft != pos) {\n this.horiz.scrollLeft = pos;\n }\n\n if (this.disableHoriz) {\n this.enableZeroWidthBar(this.horiz, this.disableHoriz, \"horiz\");\n }\n };\n\n NativeScrollbars.prototype.setScrollTop = function (pos) {\n if (this.vert.scrollTop != pos) {\n this.vert.scrollTop = pos;\n }\n\n if (this.disableVert) {\n this.enableZeroWidthBar(this.vert, this.disableVert, \"vert\");\n }\n };\n\n NativeScrollbars.prototype.zeroWidthHack = function () {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n this.horiz.style.height = this.vert.style.width = w;\n this.horiz.style.pointerEvents = this.vert.style.pointerEvents = \"none\";\n this.disableHoriz = new Delayed();\n this.disableVert = new Delayed();\n };\n\n NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {\n bar.style.pointerEvents = \"auto\";\n\n function maybeDisable() {\n // To find out whether the scrollbar is still visible, we\n // check whether the element under the pixel in the bottom\n // right corner of the scrollbar box is the scrollbar box\n // itself (when the bar is still visible) or its filler child\n // (when the bar is hidden). If it is still visible, we keep\n // it enabled, if it's hidden, we disable pointer events.\n var box = bar.getBoundingClientRect();\n var elt = type == \"vert\" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2) : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);\n\n if (elt != bar) {\n bar.style.pointerEvents = \"none\";\n } else {\n delay.set(1000, maybeDisable);\n }\n }\n\n delay.set(1000, maybeDisable);\n };\n\n NativeScrollbars.prototype.clear = function () {\n var parent = this.horiz.parentNode;\n parent.removeChild(this.horiz);\n parent.removeChild(this.vert);\n };\n\n var NullScrollbars = function NullScrollbars() {};\n\n NullScrollbars.prototype.update = function () {\n return {\n bottom: 0,\n right: 0\n };\n };\n\n NullScrollbars.prototype.setScrollLeft = function () {};\n\n NullScrollbars.prototype.setScrollTop = function () {};\n\n NullScrollbars.prototype.clear = function () {};\n\n function updateScrollbars(cm, measure) {\n if (!measure) {\n measure = measureForScrollbars(cm);\n }\n\n var startWidth = cm.display.barWidth,\n startHeight = cm.display.barHeight;\n updateScrollbarsInner(cm, measure);\n\n for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {\n if (startWidth != cm.display.barWidth && cm.options.lineWrapping) {\n updateHeightsInViewport(cm);\n }\n\n updateScrollbarsInner(cm, measureForScrollbars(cm));\n startWidth = cm.display.barWidth;\n startHeight = cm.display.barHeight;\n }\n } // Re-synchronize the fake scrollbars with the actual size of the\n // content.\n\n\n function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else {\n d.scrollbarFiller.style.display = \"\";\n }\n\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else {\n d.gutterFiller.style.display = \"\";\n }\n }\n\n var scrollbarModel = {\n \"native\": NativeScrollbars,\n \"null\": NullScrollbars\n };\n\n function initScrollbars(cm) {\n if (cm.display.scrollbars) {\n cm.display.scrollbars.clear();\n\n if (cm.display.scrollbars.addClass) {\n rmClass(cm.display.wrapper, cm.display.scrollbars.addClass);\n }\n }\n\n cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {\n cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller); // Prevent clicks in the scrollbars from killing focus\n\n on(node, \"mousedown\", function () {\n if (cm.state.focused) {\n setTimeout(function () {\n return cm.display.input.focus();\n }, 0);\n }\n });\n node.setAttribute(\"cm-not-content\", \"true\");\n }, function (pos, axis) {\n if (axis == \"horizontal\") {\n setScrollLeft(cm, pos);\n } else {\n updateScrollTop(cm, pos);\n }\n }, cm);\n\n if (cm.display.scrollbars.addClass) {\n addClass(cm.display.wrapper, cm.display.scrollbars.addClass);\n }\n } // Operations are used to wrap a series of changes to the editor\n // state in such a way that each change won't have to update the\n // cursor and display (which would be awkward, slow, and\n // error-prone). Instead, display updates are batched and then all\n // combined and executed at once.\n\n\n var nextOpId = 0; // Start a new operation.\n\n function _startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false,\n // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height,\n // Used to detect need to update scrollbar\n forceUpdate: false,\n // Used to force a redraw\n updateInput: 0,\n // Whether to reset the input textarea\n typing: false,\n // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null,\n // Accumulated changes, for firing change events\n cursorActivityHandlers: null,\n // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0,\n // Tracks which cursorActivity handlers have been called already\n selectionChanged: false,\n // Whether the selection needs to be redrawn\n updateMaxLine: false,\n // Set when the widest line needs to be determined anew\n scrollLeft: null,\n scrollTop: null,\n // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null,\n // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n\n };\n pushOperation(cm.curOp);\n } // Finish an operation, updating the display and signalling delayed events\n\n\n function _endOperation(cm) {\n var op = cm.curOp;\n\n if (op) {\n finishOperation(op, function (group) {\n for (var i = 0; i < group.ops.length; i++) {\n group.ops[i].cm.curOp = null;\n }\n\n endOperations(group);\n });\n }\n } // The DOM updates done when an operation finishes are batched so\n // that the minimum number of relayouts are required.\n\n\n function endOperations(group) {\n var ops = group.ops;\n\n for (var i = 0; i < ops.length; i++) // Read DOM\n {\n endOperation_R1(ops[i]);\n }\n\n for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)\n {\n endOperation_W1(ops[i$1]);\n }\n\n for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM\n {\n endOperation_R2(ops[i$2]);\n }\n\n for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)\n {\n endOperation_W2(ops[i$3]);\n }\n\n for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM\n {\n endOperation_finish(ops[i$4]);\n }\n }\n\n function endOperation_R1(op) {\n var cm = op.cm,\n display = cm.display;\n maybeClipScrollbars(cm);\n\n if (op.updateMaxLine) {\n findMaxLine(cm);\n }\n\n op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null || op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom || op.scrollToPos.to.line >= display.viewTo) || display.maxLineChanged && cm.options.lineWrapping;\n op.update = op.mustUpdate && new DisplayUpdate(cm, op.mustUpdate && {\n top: op.scrollTop,\n ensure: op.scrollToPos\n }, op.forceUpdate);\n }\n\n function endOperation_W1(op) {\n op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);\n }\n\n function endOperation_R2(op) {\n var cm = op.cm,\n display = cm.display;\n\n if (op.updatedDisplay) {\n updateHeightsInViewport(cm);\n }\n\n op.barMeasure = measureForScrollbars(cm); // If the max line changed since it was last measured, measure it,\n // and ensure the document's width matches it.\n // updateDisplay_W2 will use these properties to do the actual resizing\n\n if (display.maxLineChanged && !cm.options.lineWrapping) {\n op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;\n cm.display.sizerWidth = op.adjustWidthTo;\n op.barMeasure.scrollWidth = Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);\n op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));\n }\n\n if (op.updatedDisplay || op.selectionChanged) {\n op.preparedSelection = display.input.prepareSelection();\n }\n }\n\n function endOperation_W2(op) {\n var cm = op.cm;\n\n if (op.adjustWidthTo != null) {\n cm.display.sizer.style.minWidth = op.adjustWidthTo + \"px\";\n\n if (op.maxScrollLeft < cm.doc.scrollLeft) {\n setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true);\n }\n\n cm.display.maxLineChanged = false;\n }\n\n var takeFocus = op.focus && op.focus == activeElt();\n\n if (op.preparedSelection) {\n cm.display.input.showSelection(op.preparedSelection, takeFocus);\n }\n\n if (op.updatedDisplay || op.startHeight != cm.doc.height) {\n updateScrollbars(cm, op.barMeasure);\n }\n\n if (op.updatedDisplay) {\n setDocumentHeight(cm, op.barMeasure);\n }\n\n if (op.selectionChanged) {\n restartBlink(cm);\n }\n\n if (cm.state.focused && op.updateInput) {\n cm.display.input.reset(op.typing);\n }\n\n if (takeFocus) {\n ensureFocus(op.cm);\n }\n }\n\n function endOperation_finish(op) {\n var cm = op.cm,\n display = cm.display,\n doc = cm.doc;\n\n if (op.updatedDisplay) {\n postUpdateDisplay(cm, op.update);\n } // Abort mouse wheel delta measurement, when scrolling explicitly\n\n\n if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos)) {\n display.wheelStartX = display.wheelStartY = null;\n } // Propagate the scroll position to the actual DOM scroller\n\n\n if (op.scrollTop != null) {\n setScrollTop(cm, op.scrollTop, op.forceScroll);\n }\n\n if (op.scrollLeft != null) {\n setScrollLeft(cm, op.scrollLeft, true, true);\n } // If we need to scroll a specific position into view, do so.\n\n\n if (op.scrollToPos) {\n var rect = scrollPosIntoView(cm, _clipPos(doc, op.scrollToPos.from), _clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);\n maybeScrollWindow(cm, rect);\n } // Fire events for markers that are hidden/unidden by editing or\n // undoing\n\n\n var hidden = op.maybeHiddenMarkers,\n unhidden = op.maybeUnhiddenMarkers;\n\n if (hidden) {\n for (var i = 0; i < hidden.length; ++i) {\n if (!hidden[i].lines.length) {\n signal(hidden[i], \"hide\");\n }\n }\n }\n\n if (unhidden) {\n for (var i$1 = 0; i$1 < unhidden.length; ++i$1) {\n if (unhidden[i$1].lines.length) {\n signal(unhidden[i$1], \"unhide\");\n }\n }\n }\n\n if (display.wrapper.offsetHeight) {\n doc.scrollTop = cm.display.scroller.scrollTop;\n } // Fire change events, and delayed event handlers\n\n\n if (op.changeObjs) {\n signal(cm, \"changes\", cm, op.changeObjs);\n }\n\n if (op.update) {\n op.update.finish();\n }\n } // Run the given function in an operation\n\n\n function runInOp(cm, f) {\n if (cm.curOp) {\n return f();\n }\n\n _startOperation(cm);\n\n try {\n return f();\n } finally {\n _endOperation(cm);\n }\n } // Wraps a function in an operation. Returns the wrapped function.\n\n\n function operation(cm, f) {\n return function () {\n if (cm.curOp) {\n return f.apply(cm, arguments);\n }\n\n _startOperation(cm);\n\n try {\n return f.apply(cm, arguments);\n } finally {\n _endOperation(cm);\n }\n };\n } // Used to add methods to editor and doc instances, wrapping them in\n // operations.\n\n\n function methodOp(f) {\n return function () {\n if (this.curOp) {\n return f.apply(this, arguments);\n }\n\n _startOperation(this);\n\n try {\n return f.apply(this, arguments);\n } finally {\n _endOperation(this);\n }\n };\n }\n\n function docMethodOp(f) {\n return function () {\n var cm = this.cm;\n\n if (!cm || cm.curOp) {\n return f.apply(this, arguments);\n }\n\n _startOperation(cm);\n\n try {\n return f.apply(this, arguments);\n } finally {\n _endOperation(cm);\n }\n };\n } // HIGHLIGHT WORKER\n\n\n function startWorker(cm, time) {\n if (cm.doc.highlightFrontier < cm.display.viewTo) {\n cm.state.highlight.set(time, bind(highlightWorker, cm));\n }\n }\n\n function highlightWorker(cm) {\n var doc = cm.doc;\n\n if (doc.highlightFrontier >= cm.display.viewTo) {\n return;\n }\n\n var end = +new Date() + cm.options.workTime;\n var context = getContextBefore(cm, doc.highlightFrontier);\n var changedLines = [];\n doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {\n if (context.line >= cm.display.viewFrom) {\n // Visible\n var oldStyles = line.styles;\n var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;\n var highlighted = highlightLine(cm, line, context, true);\n\n if (resetState) {\n context.state = resetState;\n }\n\n line.styles = highlighted.styles;\n var oldCls = line.styleClasses,\n newCls = highlighted.classes;\n\n if (newCls) {\n line.styleClasses = newCls;\n } else if (oldCls) {\n line.styleClasses = null;\n }\n\n var ischange = !oldStyles || oldStyles.length != line.styles.length || oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);\n\n for (var i = 0; !ischange && i < oldStyles.length; ++i) {\n ischange = oldStyles[i] != line.styles[i];\n }\n\n if (ischange) {\n changedLines.push(context.line);\n }\n\n line.stateAfter = context.save();\n context.nextLine();\n } else {\n if (line.text.length <= cm.options.maxHighlightLength) {\n processLine(cm, line.text, context);\n }\n\n line.stateAfter = context.line % 5 == 0 ? context.save() : null;\n context.nextLine();\n }\n\n if (+new Date() > end) {\n startWorker(cm, cm.options.workDelay);\n return true;\n }\n });\n doc.highlightFrontier = context.line;\n doc.modeFrontier = Math.max(doc.modeFrontier, context.line);\n\n if (changedLines.length) {\n runInOp(cm, function () {\n for (var i = 0; i < changedLines.length; i++) {\n regLineChange(cm, changedLines[i], \"text\");\n }\n });\n }\n } // DISPLAY DRAWING\n\n\n var DisplayUpdate = function DisplayUpdate(cm, viewport, force) {\n var display = cm.display;\n this.viewport = viewport; // Store some values that we'll need later (but don't want to force a relayout for)\n\n this.visible = visibleLines(display, cm.doc, viewport);\n this.editorIsHidden = !display.wrapper.offsetWidth;\n this.wrapperHeight = display.wrapper.clientHeight;\n this.wrapperWidth = display.wrapper.clientWidth;\n this.oldDisplayWidth = displayWidth(cm);\n this.force = force;\n this.dims = getDimensions(cm);\n this.events = [];\n };\n\n DisplayUpdate.prototype.signal = function (emitter, type) {\n if (hasHandler(emitter, type)) {\n this.events.push(arguments);\n }\n };\n\n DisplayUpdate.prototype.finish = function () {\n for (var i = 0; i < this.events.length; i++) {\n signal.apply(null, this.events[i]);\n }\n };\n\n function maybeClipScrollbars(cm) {\n var display = cm.display;\n\n if (!display.scrollbarsClipped && display.scroller.offsetWidth) {\n display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;\n display.heightForcer.style.height = scrollGap(cm) + \"px\";\n display.sizer.style.marginBottom = -display.nativeBarWidth + \"px\";\n display.sizer.style.borderRightWidth = scrollGap(cm) + \"px\";\n display.scrollbarsClipped = true;\n }\n }\n\n function selectionSnapshot(cm) {\n if (cm.hasFocus()) {\n return null;\n }\n\n var active = activeElt();\n\n if (!active || !contains(cm.display.lineDiv, active)) {\n return null;\n }\n\n var result = {\n activeElt: active\n };\n\n if (window.getSelection) {\n var sel = window.getSelection();\n\n if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {\n result.anchorNode = sel.anchorNode;\n result.anchorOffset = sel.anchorOffset;\n result.focusNode = sel.focusNode;\n result.focusOffset = sel.focusOffset;\n }\n }\n\n return result;\n }\n\n function restoreSelection(snapshot) {\n if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) {\n return;\n }\n\n snapshot.activeElt.focus();\n\n if (snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {\n var sel = window.getSelection(),\n range = document.createRange();\n range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);\n range.collapse(false);\n sel.removeAllRanges();\n sel.addRange(range);\n sel.extend(snapshot.focusNode, snapshot.focusOffset);\n }\n } // Does the actual updating of the line display. Bails out\n // (returning false) when there is nothing to be done and forced is\n // false.\n\n\n function updateDisplayIfNeeded(cm, update) {\n var display = cm.display,\n doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n } // Bail out if the visible area is already rendered and nothing changed.\n\n\n if (!update.force && update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo && (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) && display.renderedView == display.view && countDirtyView(cm) == 0) {\n return false;\n }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n } // Compute a suitable new viewport (from & to)\n\n\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n\n if (display.viewFrom < from && from - display.viewFrom < 20) {\n from = Math.max(doc.first, display.viewFrom);\n }\n\n if (display.viewTo > to && display.viewTo - to < 20) {\n to = Math.min(end, display.viewTo);\n }\n\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo || display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n display.viewOffset = _heightAtLine(getLine(cm.doc, display.viewFrom)); // Position the mover div to align with the current scroll position\n\n cm.display.mover.style.top = display.viewOffset + \"px\";\n var toUpdate = countDirtyView(cm);\n\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view && (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) {\n return false;\n } // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n\n\n var selSnapshot = selectionSnapshot(cm);\n\n if (toUpdate > 4) {\n display.lineDiv.style.display = \"none\";\n }\n\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n\n if (toUpdate > 4) {\n display.lineDiv.style.display = \"\";\n }\n\n display.renderedView = display.view; // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n\n restoreSelection(selSnapshot); // Prevent selection and cursors from interfering with the scroll\n // width and height.\n\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n return true;\n }\n\n function postUpdateDisplay(cm, update) {\n var viewport = update.viewport;\n\n for (var first = true;; first = false) {\n if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {\n // Clip forced viewport to actual scrollable area.\n if (viewport && viewport.top != null) {\n viewport = {\n top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)\n };\n } // Updated line heights might result in the drawn area not\n // actually covering the viewport. Keep looping until it does.\n\n\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n\n if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo) {\n break;\n }\n } else if (first) {\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n }\n\n if (!updateDisplayIfNeeded(cm, update)) {\n break;\n }\n\n updateHeightsInViewport(cm);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.force = false;\n }\n\n update.signal(cm, \"update\", cm);\n\n if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {\n update.signal(cm, \"viewportChange\", cm, cm.display.viewFrom, cm.display.viewTo);\n cm.display.reportedViewFrom = cm.display.viewFrom;\n cm.display.reportedViewTo = cm.display.viewTo;\n }\n }\n\n function updateDisplaySimple(cm, viewport) {\n var update = new DisplayUpdate(cm, viewport);\n\n if (updateDisplayIfNeeded(cm, update)) {\n updateHeightsInViewport(cm);\n postUpdateDisplay(cm, update);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.finish();\n }\n } // Sync the actual display DOM structure with display.view, removing\n // nodes for lines that are no longer in view, and creating the ones\n // that are not there yet, and updating the ones that are out of\n // date.\n\n\n function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display,\n lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv,\n cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling; // Works around a throw-scroll bug in OS X Webkit\n\n if (webkit && mac && cm.display.currentWheelTarget == node) {\n node.style.display = \"none\";\n } else {\n node.parentNode.removeChild(node);\n }\n\n return next;\n }\n\n var view = display.view,\n lineN = display.viewFrom; // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) ;else if (!lineView.node || lineView.node.parentNode != container) {\n // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else {\n // Already drawn\n while (cur != lineView.node) {\n cur = rm(cur);\n }\n\n var updateNumber = lineNumbers && updateNumbersFrom != null && updateNumbersFrom <= lineN && lineView.lineNumber;\n\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) {\n updateNumber = false;\n }\n\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n\n while (cur) {\n cur = rm(cur);\n }\n }\n\n function updateGutterSpace(display) {\n var width = display.gutters.offsetWidth;\n display.sizer.style.marginLeft = width + \"px\";\n }\n\n function setDocumentHeight(cm, measure) {\n cm.display.sizer.style.minHeight = measure.docHeight + \"px\";\n cm.display.heightForcer.style.top = measure.docHeight + \"px\";\n cm.display.gutters.style.height = measure.docHeight + cm.display.barHeight + scrollGap(cm) + \"px\";\n } // Re-align line numbers and gutter marks to compensate for\n // horizontal scrolling.\n\n\n function alignHorizontally(cm) {\n var display = cm.display,\n view = display.view;\n\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) {\n return;\n }\n\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth,\n left = comp + \"px\";\n\n for (var i = 0; i < view.length; i++) {\n if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter) {\n view[i].gutter.style.left = left;\n }\n\n if (view[i].gutterBackground) {\n view[i].gutterBackground.style.left = left;\n }\n }\n\n var align = view[i].alignable;\n\n if (align) {\n for (var j = 0; j < align.length; j++) {\n align[j].style.left = left;\n }\n }\n }\n }\n\n if (cm.options.fixedGutter) {\n display.gutters.style.left = comp + gutterW + \"px\";\n }\n } // Used to ensure that the line number gutter is still the right\n // size for the current document size. Returns true when an update\n // is needed.\n\n\n function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) {\n return false;\n }\n\n var doc = cm.doc,\n last = lineNumberFor(cm.options, doc.first + doc.size - 1),\n display = cm.display;\n\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)], \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth,\n padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true;\n }\n\n return false;\n }\n\n function getGutters(gutters, lineNumbers) {\n var result = [],\n sawLineNumbers = false;\n\n for (var i = 0; i < gutters.length; i++) {\n var name = gutters[i],\n style = null;\n\n if (typeof name != \"string\") {\n style = name.style;\n name = name.className;\n }\n\n if (name == \"CodeMirror-linenumbers\") {\n if (!lineNumbers) {\n continue;\n } else {\n sawLineNumbers = true;\n }\n }\n\n result.push({\n className: name,\n style: style\n });\n }\n\n if (lineNumbers && !sawLineNumbers) {\n result.push({\n className: \"CodeMirror-linenumbers\",\n style: null\n });\n }\n\n return result;\n } // Rebuild the gutter elements, ensure the margin to the left of the\n // code matches their width.\n\n\n function renderGutters(display) {\n var gutters = display.gutters,\n specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n\n if (style) {\n gElt.style.cssText = style;\n }\n\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }\n\n function updateGutters(cm) {\n renderGutters(cm.display);\n regChange(cm);\n alignHorizontally(cm);\n } // The display handles the DOM integration, both for input reading\n // and content drawing. It holds references to DOM nodes and\n // display-related state.\n\n\n function Display(place, doc, input, options) {\n var d = this;\n this.input = input; // Covers bottom-right square when both scrollbars are present.\n\n d.scrollbarFiller = elt(\"div\", null, \"CodeMirror-scrollbar-filler\");\n d.scrollbarFiller.setAttribute(\"cm-not-content\", \"true\"); // Covers bottom of gutter when coverGutterNextToScrollbar is on\n // and h scrollbar is present.\n\n d.gutterFiller = elt(\"div\", null, \"CodeMirror-gutter-filler\");\n d.gutterFiller.setAttribute(\"cm-not-content\", \"true\"); // Will contain the actual code, positioned to cover the viewport.\n\n d.lineDiv = eltP(\"div\", null, \"CodeMirror-code\"); // Elements are added to these to represent selection and cursors.\n\n d.selectionDiv = elt(\"div\", null, null, \"position: relative; z-index: 1\");\n d.cursorDiv = elt(\"div\", null, \"CodeMirror-cursors\"); // A visibility: hidden element used to find the size of things.\n\n d.measure = elt(\"div\", null, \"CodeMirror-measure\"); // When lines outside of the viewport are measured, they are drawn in this.\n\n d.lineMeasure = elt(\"div\", null, \"CodeMirror-measure\"); // Wraps everything that needs to exist inside the vertically-padded coordinate system\n\n d.lineSpace = eltP(\"div\", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv], null, \"position: relative; outline: none\");\n var lines = eltP(\"div\", [d.lineSpace], \"CodeMirror-lines\"); // Moved around its parent to cover visible view.\n\n d.mover = elt(\"div\", [lines], null, \"position: relative\"); // Set to the height of the document, allowing scrolling.\n\n d.sizer = elt(\"div\", [d.mover], \"CodeMirror-sizer\");\n d.sizerWidth = null; // Behavior of elts with overflow: auto and padding is\n // inconsistent across browsers. This is used to ensure the\n // scrollable area is big enough.\n\n d.heightForcer = elt(\"div\", null, null, \"position: absolute; height: \" + scrollerGap + \"px; width: 1px;\"); // Will contain the gutters, if any.\n\n d.gutters = elt(\"div\", null, \"CodeMirror-gutters\");\n d.lineGutter = null; // Actual scrollable element.\n\n d.scroller = elt(\"div\", [d.sizer, d.heightForcer, d.gutters], \"CodeMirror-scroll\");\n d.scroller.setAttribute(\"tabIndex\", \"-1\"); // The element in which the editor lives.\n\n d.wrapper = elt(\"div\", [d.scrollbarFiller, d.gutterFiller, d.scroller], \"CodeMirror\"); // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)\n\n if (ie && ie_version < 8) {\n d.gutters.style.zIndex = -1;\n d.scroller.style.paddingRight = 0;\n }\n\n if (!webkit && !(gecko && mobile)) {\n d.scroller.draggable = true;\n }\n\n if (place) {\n if (place.appendChild) {\n place.appendChild(d.wrapper);\n } else {\n place(d.wrapper);\n }\n } // Current rendered range (may be bigger than the view window).\n\n\n d.viewFrom = d.viewTo = doc.first;\n d.reportedViewFrom = d.reportedViewTo = doc.first; // Information about the rendered lines.\n\n d.view = [];\n d.renderedView = null; // Holds info about a single rendered line when it was rendered\n // for measurement, while not in view.\n\n d.externalMeasured = null; // Empty space (in pixels) above the view\n\n d.viewOffset = 0;\n d.lastWrapHeight = d.lastWrapWidth = 0;\n d.updateLineNumbers = null;\n d.nativeBarWidth = d.barHeight = d.barWidth = 0;\n d.scrollbarsClipped = false; // Used to only resize the line number gutter when necessary (when\n // the amount of lines crosses a boundary that makes its width change)\n\n d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null; // Set to true when a non-horizontal-scrolling line widget is\n // added. As an optimization, line widget aligning is skipped when\n // this is false.\n\n d.alignWidgets = false;\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n\n d.maxLine = null;\n d.maxLineLength = 0;\n d.maxLineChanged = false; // Used for measuring wheel scrolling granularity\n\n d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null; // True when shift is held down.\n\n d.shift = false; // Used to track whether anything happened since the context menu\n // was opened.\n\n d.selForContextMenu = null;\n d.activeTouch = null;\n d.gutterSpecs = getGutters(options.gutters, options.lineNumbers);\n renderGutters(d);\n input.init(d);\n } // Since the delta values reported on mouse wheel events are\n // unstandardized between browsers and even browser versions, and\n // generally horribly unpredictable, this code starts by measuring\n // the scroll effect that the first few mouse wheel events have,\n // and, from that, detects the way it can convert deltas to pixel\n // offsets afterwards.\n //\n // The reason we want to know the amount a wheel event will scroll\n // is that it gives us a chance to update the display before the\n // actual scrolling happens, reducing flickering.\n\n\n var wheelSamples = 0,\n wheelPixelsPerUnit = null; // Fill in a browser-detected starting value on browsers where we\n // know one. These don't have to be accurate -- the result of them\n // being wrong would just be a slight flicker on the first wheel\n // scroll (if it is large enough).\n\n if (ie) {\n wheelPixelsPerUnit = -.53;\n } else if (gecko) {\n wheelPixelsPerUnit = 15;\n } else if (chrome) {\n wheelPixelsPerUnit = -.7;\n } else if (safari) {\n wheelPixelsPerUnit = -1 / 3;\n }\n\n function wheelEventDelta(e) {\n var dx = e.wheelDeltaX,\n dy = e.wheelDeltaY;\n\n if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) {\n dx = e.detail;\n }\n\n if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) {\n dy = e.detail;\n } else if (dy == null) {\n dy = e.wheelDelta;\n }\n\n return {\n x: dx,\n y: dy\n };\n }\n\n function wheelEventPixels(e) {\n var delta = wheelEventDelta(e);\n delta.x *= wheelPixelsPerUnit;\n delta.y *= wheelPixelsPerUnit;\n return delta;\n }\n\n function onScrollWheel(cm, e) {\n var delta = wheelEventDelta(e),\n dx = delta.x,\n dy = delta.y;\n var display = cm.display,\n scroll = display.scroller; // Quit if there's nothing to scroll here\n\n var canScrollX = scroll.scrollWidth > scroll.clientWidth;\n var canScrollY = scroll.scrollHeight > scroll.clientHeight;\n\n if (!(dx && canScrollX || dy && canScrollY)) {\n return;\n } // Webkit browsers on OS X abort momentum scrolls when the target\n // of the scroll event is removed from the scrollable element.\n // This hack (see related code in patchDisplay) makes sure the\n // element is kept around.\n\n\n if (dy && mac && webkit) {\n outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {\n for (var i = 0; i < view.length; i++) {\n if (view[i].node == cur) {\n cm.display.currentWheelTarget = cur;\n break outer;\n }\n }\n }\n } // On some browsers, horizontal scrolling will cause redraws to\n // happen before the gutter has been realigned, causing it to\n // wriggle around in a most unseemly way. When we have an\n // estimated pixels/delta value, we just handle horizontal\n // scrolling entirely here. It'll be slightly off from native, but\n // better than glitching out.\n\n\n if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {\n if (dy && canScrollY) {\n updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit));\n }\n\n setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit)); // Only prevent default scrolling if vertical scrolling is\n // actually possible. Otherwise, it causes vertical scroll\n // jitter on OSX trackpads when deltaX is small and deltaY\n // is large (issue #3579)\n\n if (!dy || dy && canScrollY) {\n e_preventDefault(e);\n }\n\n display.wheelStartX = null; // Abort measurement, if in progress\n\n return;\n } // 'Project' the visible viewport to cover the area that is being\n // scrolled into view (if we know enough to estimate it).\n\n\n if (dy && wheelPixelsPerUnit != null) {\n var pixels = dy * wheelPixelsPerUnit;\n var top = cm.doc.scrollTop,\n bot = top + display.wrapper.clientHeight;\n\n if (pixels < 0) {\n top = Math.max(0, top + pixels - 50);\n } else {\n bot = Math.min(cm.doc.height, bot + pixels + 50);\n }\n\n updateDisplaySimple(cm, {\n top: top,\n bottom: bot\n });\n }\n\n if (wheelSamples < 20) {\n if (display.wheelStartX == null) {\n display.wheelStartX = scroll.scrollLeft;\n display.wheelStartY = scroll.scrollTop;\n display.wheelDX = dx;\n display.wheelDY = dy;\n setTimeout(function () {\n if (display.wheelStartX == null) {\n return;\n }\n\n var movedX = scroll.scrollLeft - display.wheelStartX;\n var movedY = scroll.scrollTop - display.wheelStartY;\n var sample = movedY && display.wheelDY && movedY / display.wheelDY || movedX && display.wheelDX && movedX / display.wheelDX;\n display.wheelStartX = display.wheelStartY = null;\n\n if (!sample) {\n return;\n }\n\n wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);\n ++wheelSamples;\n }, 200);\n } else {\n display.wheelDX += dx;\n display.wheelDY += dy;\n }\n }\n } // Selection objects are immutable. A new one is created every time\n // the selection changes. A selection is one or more non-overlapping\n // (and non-touching) ranges, sorted, and an integer that indicates\n // which one is the primary selection (the one that's scrolled into\n // view, that getCursor returns, etc).\n\n\n var Selection = function Selection(ranges, primIndex) {\n this.ranges = ranges;\n this.primIndex = primIndex;\n };\n\n Selection.prototype.primary = function () {\n return this.ranges[this.primIndex];\n };\n\n Selection.prototype.equals = function (other) {\n if (other == this) {\n return true;\n }\n\n if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) {\n return false;\n }\n\n for (var i = 0; i < this.ranges.length; i++) {\n var here = this.ranges[i],\n there = other.ranges[i];\n\n if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) {\n return false;\n }\n }\n\n return true;\n };\n\n Selection.prototype.deepCopy = function () {\n var out = [];\n\n for (var i = 0; i < this.ranges.length; i++) {\n out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head));\n }\n\n return new Selection(out, this.primIndex);\n };\n\n Selection.prototype.somethingSelected = function () {\n for (var i = 0; i < this.ranges.length; i++) {\n if (!this.ranges[i].empty()) {\n return true;\n }\n }\n\n return false;\n };\n\n Selection.prototype.contains = function (pos, end) {\n if (!end) {\n end = pos;\n }\n\n for (var i = 0; i < this.ranges.length; i++) {\n var range = this.ranges[i];\n\n if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0) {\n return i;\n }\n }\n\n return -1;\n };\n\n var Range = function Range(anchor, head) {\n this.anchor = anchor;\n this.head = head;\n };\n\n Range.prototype.from = function () {\n return minPos(this.anchor, this.head);\n };\n\n Range.prototype.to = function () {\n return maxPos(this.anchor, this.head);\n };\n\n Range.prototype.empty = function () {\n return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch;\n }; // Take an unsorted, potentially overlapping set of ranges, and\n // build a selection out of it. 'Consumes' ranges array (modifying\n // it).\n\n\n function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) {\n return cmp(a.from(), b.from());\n });\n primIndex = indexOf(ranges, prim);\n\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i],\n prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()),\n to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n\n if (i <= primIndex) {\n --primIndex;\n }\n\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n\n return new Selection(ranges, primIndex);\n }\n\n function simpleSelection(anchor, head) {\n return new Selection([new Range(anchor, head || anchor)], 0);\n } // Compute the position of the end of a change (its 'to' property\n // refers to the pre-change end).\n\n\n function changeEnd(change) {\n if (!change.text) {\n return change.to;\n }\n\n return Pos(change.from.line + change.text.length - 1, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));\n } // Adjust a position to refer to the post-change position of the\n // same text, or the end of the change if the change covers it.\n\n\n function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) {\n return pos;\n }\n\n if (cmp(pos, change.to) <= 0) {\n return changeEnd(change);\n }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1,\n ch = pos.ch;\n\n if (pos.line == change.to.line) {\n ch += changeEnd(change).ch - change.to.ch;\n }\n\n return Pos(line, ch);\n }\n\n function computeSelAfterChange(doc, change) {\n var out = [];\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n out.push(new Range(adjustForChange(range.anchor, change), adjustForChange(range.head, change)));\n }\n\n return normalizeSelection(doc.cm, out, doc.sel.primIndex);\n }\n\n function offsetPos(pos, old, nw) {\n if (pos.line == old.line) {\n return Pos(nw.line, pos.ch - old.ch + nw.ch);\n } else {\n return Pos(nw.line + (pos.line - old.line), pos.ch);\n }\n } // Used by replaceSelections to allow moving the selection to the\n // start or around the replaced test. Hint may be \"start\" or \"around\".\n\n\n function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0),\n newPrev = oldPrev;\n\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n\n if (hint == \"around\") {\n var range = doc.sel.ranges[i],\n inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n\n return new Selection(out, doc.sel.primIndex);\n } // Used to get the editor into a consistent state again when options change.\n\n\n function loadMode(cm) {\n cm.doc.mode = getMode(cm.options, cm.doc.modeOption);\n resetModeState(cm);\n }\n\n function resetModeState(cm) {\n cm.doc.iter(function (line) {\n if (line.stateAfter) {\n line.stateAfter = null;\n }\n\n if (line.styles) {\n line.styles = null;\n }\n });\n cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;\n startWorker(cm, 100);\n cm.state.modeGen++;\n\n if (cm.curOp) {\n regChange(cm);\n }\n } // DOCUMENT DATA STRUCTURE\n // By default, updates that start and end at the beginning of a line\n // are treated specially, in order to make the association of line\n // widgets and marker elements with the text behave more intuitive.\n\n\n function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" && (!doc.cm || doc.cm.options.wholeLineUpdateBefore);\n } // Perform a change on the document data structure.\n\n\n function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {\n return markedSpans ? markedSpans[n] : null;\n }\n\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n\n function linesFor(start, end) {\n var result = [];\n\n for (var i = start; i < end; ++i) {\n result.push(new Line(text[i], spansFor(i), estimateHeight));\n }\n\n return result;\n }\n\n var from = change.from,\n to = change.to,\n text = change.text;\n var firstLine = getLine(doc, from.line),\n lastLine = getLine(doc, to.line);\n var lastText = lst(text),\n lastSpans = spansFor(text.length - 1),\n nlines = to.line - from.line; // Adjust the line structure\n\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n\n if (nlines) {\n doc.remove(from.line, nlines);\n }\n\n if (added.length) {\n doc.insert(from.line, added);\n }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n\n if (nlines > 1) {\n doc.remove(from.line + 1, nlines - 1);\n }\n\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n } // Call f for all linked documents.\n\n\n function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) {\n for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n\n if (rel.doc == skip) {\n continue;\n }\n\n var shared = sharedHist && rel.sharedHist;\n\n if (sharedHistOnly && !shared) {\n continue;\n }\n\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n }\n }\n }\n\n propagate(doc, null, true);\n } // Attach a document to an editor.\n\n\n function attachDoc(cm, doc) {\n if (doc.cm) {\n throw new Error(\"This document is already in use.\");\n }\n\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n\n if (!cm.options.lineWrapping) {\n findMaxLine(cm);\n }\n\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }\n\n function setDirectionClass(cm) {\n (cm.doc.direction == \"rtl\" ? addClass : rmClass)(cm.display.lineDiv, \"CodeMirror-rtl\");\n }\n\n function directionChanged(cm) {\n runInOp(cm, function () {\n setDirectionClass(cm);\n regChange(cm);\n });\n }\n\n function History(startGen) {\n // Arrays of change events and selections. Doing something adds an\n // event to done and clears undo. Undoing moves events from done\n // to undone, redoing moves them in the other direction.\n this.done = [];\n this.undone = [];\n this.undoDepth = Infinity; // Used to track when changes can be merged into a single undo\n // event\n\n this.lastModTime = this.lastSelTime = 0;\n this.lastOp = this.lastSelOp = null;\n this.lastOrigin = this.lastSelOrigin = null; // Used by the isClean() method\n\n this.generation = this.maxGeneration = startGen || 1;\n } // Create a history change event from an updateDoc-style change\n // object.\n\n\n function historyChangeFromChange(doc, change) {\n var histChange = {\n from: copyPos(change.from),\n to: changeEnd(change),\n text: getBetween(doc, change.from, change.to)\n };\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) {\n return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n }, true);\n return histChange;\n } // Pop all selection events off the end of a history array. Stop at\n // a change event.\n\n\n function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n\n if (last.ranges) {\n array.pop();\n } else {\n break;\n }\n }\n } // Find the top change event in the history. Pop off selection\n // events that are in the way.\n\n\n function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n } // Register a change in the history. Merges changes that are within\n // a single operation, or are close together with an origin that\n // allows merging (starting with \"+\") into a single event.\n\n\n function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date(),\n cur;\n var last;\n\n if ((hist.lastOp == opId || hist.lastOrigin == change.origin && change.origin && (change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500) || change.origin.charAt(0) == \"*\")) && (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n\n if (!before || !before.ranges) {\n pushSelectionToHistory(doc.sel, hist.done);\n }\n\n cur = {\n changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation\n };\n hist.done.push(cur);\n\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n\n if (!hist.done[0].ranges) {\n hist.done.shift();\n }\n }\n }\n\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) {\n signal(doc, \"historyAdded\");\n }\n }\n\n function selectionEventCanBeMerged(doc, origin, prev, sel) {\n var ch = origin.charAt(0);\n return ch == \"*\" || ch == \"+\" && prev.ranges.length == sel.ranges.length && prev.somethingSelected() == sel.somethingSelected() && new Date() - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500);\n } // Called whenever the selection changes, sets the new selection as\n // the pending selection in the history, and pushes the old pending\n // selection into the 'done' array when it was significantly\n // different (in number of selected ranges, emptiness, or time).\n\n\n function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history,\n origin = options && options.origin; // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n\n if (opId == hist.lastSelOp || origin && hist.lastSelOrigin == origin && (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin || selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))) {\n hist.done[hist.done.length - 1] = sel;\n } else {\n pushSelectionToHistory(sel, hist.done);\n }\n\n hist.lastSelTime = +new Date();\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n\n if (options && options.clearRedo !== false) {\n clearSelectionEvents(hist.undone);\n }\n }\n\n function pushSelectionToHistory(sel, dest) {\n var top = lst(dest);\n\n if (!(top && top.ranges && top.equals(sel))) {\n dest.push(sel);\n }\n } // Used to store marked span information in the history.\n\n\n function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id],\n n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans) {\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n }\n\n ++n;\n });\n } // When un/re-doing restores text containing marked spans, those\n // that have been explicitly cleared should not be restored.\n\n\n function removeClearedSpans(spans) {\n if (!spans) {\n return null;\n }\n\n var out;\n\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) {\n if (!out) {\n out = spans.slice(0, i);\n }\n } else if (out) {\n out.push(spans[i]);\n }\n }\n\n return !out ? spans : out.length ? out : null;\n } // Retrieve and filter the old marked spans stored in a change event.\n\n\n function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n\n if (!found) {\n return null;\n }\n\n var nw = [];\n\n for (var i = 0; i < change.text.length; ++i) {\n nw.push(removeClearedSpans(found[i]));\n }\n\n return nw;\n } // Used for un/re-doing changes from the history. Combines the\n // result of computing the existing spans with the set of spans that\n // existed in the history (so that deleting around a span and then\n // undoing brings back the span).\n\n\n function mergeOldSpans(doc, change) {\n var old = getOldSpans(doc, change);\n var stretched = stretchSpansOverChange(doc, change);\n\n if (!old) {\n return stretched;\n }\n\n if (!stretched) {\n return old;\n }\n\n for (var i = 0; i < old.length; ++i) {\n var oldCur = old[i],\n stretchCur = stretched[i];\n\n if (oldCur && stretchCur) {\n spans: for (var j = 0; j < stretchCur.length; ++j) {\n var span = stretchCur[j];\n\n for (var k = 0; k < oldCur.length; ++k) {\n if (oldCur[k].marker == span.marker) {\n continue spans;\n }\n }\n\n oldCur.push(span);\n }\n } else if (stretchCur) {\n old[i] = stretchCur;\n }\n }\n\n return old;\n } // Used both to provide a JSON-safe object in .getHistory, and, when\n // detaching a document, to split the history in two\n\n\n function copyHistoryArray(events, newGroup, instantiateSel) {\n var copy = [];\n\n for (var i = 0; i < events.length; ++i) {\n var event = events[i];\n\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue;\n }\n\n var changes = event.changes,\n newChanges = [];\n copy.push({\n changes: newChanges\n });\n\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j],\n m = void 0;\n newChanges.push({\n from: change.from,\n to: change.to,\n text: change.text\n });\n\n if (newGroup) {\n for (var prop in change) {\n if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n }\n }\n\n return copy;\n } // The 'scroll' parameter given to many of these indicated whether\n // the new cursor position should be scrolled into view after\n // modifying the selection.\n // If shift is held or the extend flag is set, extends a range to\n // include a given position (and optionally a second position).\n // Otherwise, simply returns the range between the given positions.\n // Used for cursor motion and such.\n\n\n function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n\n if (posBefore != cmp(other, anchor) < 0) {\n anchor = head;\n head = other;\n } else if (posBefore != cmp(head, other) < 0) {\n head = other;\n }\n }\n\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n } // Extend the primary selection range, discard the rest.\n\n\n function extendSelection(doc, head, other, options, extend) {\n if (extend == null) {\n extend = doc.cm && (doc.cm.display.shift || doc.extend);\n }\n\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n } // Extend all selections (pos is an array of selections with length\n // equal the number of selections)\n\n\n function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend);\n }\n\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n } // Updates a single range in the selection.\n\n\n function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n } // Reset the selection to a single range.\n\n\n function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n } // Give beforeSelectionChange handlers a change to influence a\n // selection update.\n\n\n function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function update(ranges) {\n this.ranges = [];\n\n for (var i = 0; i < ranges.length; i++) {\n this.ranges[i] = new Range(_clipPos(doc, ranges[i].anchor), _clipPos(doc, ranges[i].head));\n }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n\n if (doc.cm) {\n signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n }\n\n if (obj.ranges != sel.ranges) {\n return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1);\n } else {\n return sel;\n }\n }\n\n function setSelectionReplaceHistory(doc, sel, options) {\n var done = doc.history.done,\n last = lst(done);\n\n if (last && last.ranges) {\n done[done.length - 1] = sel;\n setSelectionNoUndo(doc, sel, options);\n } else {\n setSelection(doc, sel, options);\n }\n } // Set a new selection.\n\n\n function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n }\n\n function setSelectionNoUndo(doc, sel, options) {\n if (hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\")) {\n sel = filterSelectionChange(doc, sel, options);\n }\n\n var bias = options && options.bias || (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);\n setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));\n\n if (!(options && options.scroll === false) && doc.cm) {\n ensureCursorVisible(doc.cm);\n }\n }\n\n function setSelectionInner(doc, sel) {\n if (sel.equals(doc.sel)) {\n return;\n }\n\n doc.sel = sel;\n\n if (doc.cm) {\n doc.cm.curOp.updateInput = 1;\n doc.cm.curOp.selectionChanged = true;\n signalCursorActivity(doc.cm);\n }\n\n signalLater(doc, \"cursorActivity\", doc);\n } // Verify that the selection does not partially select any atomic\n // marked ranges.\n\n\n function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n } // Return a selection that does not partially select any atomic\n // ranges.\n\n\n function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) {\n out = sel.ranges.slice(0, i);\n }\n\n out[i] = new Range(newAnchor, newHead);\n }\n }\n\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel;\n }\n\n function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {\n var line = getLine(doc, pos.line);\n\n if (line.markedSpans) {\n for (var i = 0; i < line.markedSpans.length; ++i) {\n var sp = line.markedSpans[i],\n m = sp.marker; // Determine if we should prevent the cursor being placed to the left/right of an atomic marker\n // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it\n // is with selectLeft/Right\n\n var preventCursorLeft = \"selectLeft\" in m ? !m.selectLeft : m.inclusiveLeft;\n var preventCursorRight = \"selectRight\" in m ? !m.selectRight : m.inclusiveRight;\n\n if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) && (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {\n if (mayClear) {\n signal(m, \"beforeCursorEnter\");\n\n if (m.explicitlyCleared) {\n if (!line.markedSpans) {\n break;\n } else {\n --i;\n continue;\n }\n }\n }\n\n if (!m.atomic) {\n continue;\n }\n\n if (oldPos) {\n var near = m.find(dir < 0 ? 1 : -1),\n diff = void 0;\n\n if (dir < 0 ? preventCursorRight : preventCursorLeft) {\n near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null);\n }\n\n if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0)) {\n return skipAtomicInner(doc, near, pos, dir, mayClear);\n }\n }\n\n var far = m.find(dir < 0 ? -1 : 1);\n\n if (dir < 0 ? preventCursorLeft : preventCursorRight) {\n far = movePos(doc, far, dir, far.line == pos.line ? line : null);\n }\n\n return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null;\n }\n }\n }\n\n return pos;\n } // Ensure a given position is not inside an atomic range.\n\n\n function skipAtomic(doc, pos, oldPos, bias, mayClear) {\n var dir = bias || 1;\n var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) || !mayClear && skipAtomicInner(doc, pos, oldPos, dir, true) || skipAtomicInner(doc, pos, oldPos, -dir, mayClear) || !mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true);\n\n if (!found) {\n doc.cantEdit = true;\n return Pos(doc.first, 0);\n }\n\n return found;\n }\n\n function movePos(doc, pos, dir, line) {\n if (dir < 0 && pos.ch == 0) {\n if (pos.line > doc.first) {\n return _clipPos(doc, Pos(pos.line - 1));\n } else {\n return null;\n }\n } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {\n if (pos.line < doc.first + doc.size - 1) {\n return Pos(pos.line + 1, 0);\n } else {\n return null;\n }\n } else {\n return new Pos(pos.line, pos.ch + dir);\n }\n }\n\n function selectAll(cm) {\n cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);\n } // UPDATING\n // Allow \"beforeChange\" event handlers to influence a change\n\n\n function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function cancel() {\n return obj.canceled = true;\n }\n };\n\n if (update) {\n obj.update = function (from, to, text, origin) {\n if (from) {\n obj.from = _clipPos(doc, from);\n }\n\n if (to) {\n obj.to = _clipPos(doc, to);\n }\n\n if (text) {\n obj.text = text;\n }\n\n if (origin !== undefined) {\n obj.origin = origin;\n }\n };\n }\n\n signal(doc, \"beforeChange\", doc, obj);\n\n if (doc.cm) {\n signal(doc.cm, \"beforeChange\", doc.cm, obj);\n }\n\n if (obj.canceled) {\n if (doc.cm) {\n doc.cm.curOp.updateInput = 2;\n }\n\n return null;\n }\n\n return {\n from: obj.from,\n to: obj.to,\n text: obj.text,\n origin: obj.origin\n };\n } // Apply a change to a document, and add it to the document's\n // history, and propagating it to all linked documents.\n\n\n function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) {\n return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n }\n\n if (doc.cm.state.suppressEdits) {\n return;\n }\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n\n if (!change) {\n return;\n }\n } // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n\n\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n\n if (split) {\n for (var i = split.length - 1; i >= 0; --i) {\n makeChangeInner(doc, {\n from: split[i].from,\n to: split[i].to,\n text: i ? [\"\"] : change.text,\n origin: change.origin\n });\n }\n } else {\n makeChangeInner(doc, change);\n }\n }\n\n function makeChangeInner(doc, change) {\n if (change.text.length == 1 && change.text[0] == \"\" && cmp(change.from, change.to) == 0) {\n return;\n }\n\n var selAfter = computeSelAfterChange(doc, change);\n addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);\n makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));\n var rebased = [];\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n\n makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));\n });\n } // Revert a change stored in a document's history.\n\n\n function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n var suppress = doc.cm && doc.cm.state.suppressEdits;\n\n if (suppress && !allowSelectionOnly) {\n return;\n }\n\n var hist = doc.history,\n event,\n selAfter = doc.sel;\n var source = type == \"undo\" ? hist.done : hist.undone,\n dest = type == \"undo\" ? hist.undone : hist.done; // Verify that there is a useable event (so that ctrl-z won't\n // needlessly clear selection events)\n\n var i = 0;\n\n for (; i < source.length; i++) {\n event = source[i];\n\n if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges) {\n break;\n }\n }\n\n if (i == source.length) {\n return;\n }\n\n hist.lastOrigin = hist.lastSelOrigin = null;\n\n for (;;) {\n event = source.pop();\n\n if (event.ranges) {\n pushSelectionToHistory(event, dest);\n\n if (allowSelectionOnly && !event.equals(doc.sel)) {\n setSelection(doc, event, {\n clearRedo: false\n });\n return;\n }\n\n selAfter = event;\n } else if (suppress) {\n source.push(event);\n return;\n } else {\n break;\n }\n } // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n\n\n var antiChanges = [];\n pushSelectionToHistory(selAfter, dest);\n dest.push({\n changes: antiChanges,\n generation: hist.generation\n });\n hist.generation = event.generation || ++hist.maxGeneration;\n var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n var loop = function loop(i) {\n var change = event.changes[i];\n change.origin = type;\n\n if (filter && !filterChange(doc, change, false)) {\n source.length = 0;\n return {};\n }\n\n antiChanges.push(historyChangeFromChange(doc, change));\n var after = i ? computeSelAfterChange(doc, change) : lst(source);\n makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n\n if (!i && doc.cm) {\n doc.cm.scrollIntoView({\n from: change.from,\n to: changeEnd(change)\n });\n }\n\n var rebased = []; // Propagate to the linked documents\n\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n\n makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n });\n };\n\n for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\n var returned = loop(i$1);\n if (returned) return returned.v;\n }\n } // Sub-views need their line numbers shifted when text is added\n // above or below them in the parent document.\n\n\n function shiftDoc(doc, distance) {\n if (distance == 0) {\n return;\n }\n\n doc.first += distance;\n doc.sel = new Selection(map(doc.sel.ranges, function (range) {\n return new Range(Pos(range.anchor.line + distance, range.anchor.ch), Pos(range.head.line + distance, range.head.ch));\n }), doc.sel.primIndex);\n\n if (doc.cm) {\n regChange(doc.cm, doc.first, doc.first - distance, distance);\n\n for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++) {\n regLineChange(doc.cm, l, \"gutter\");\n }\n }\n } // More lower-level change function, handling only a single document\n // (not linked ones).\n\n\n function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp) {\n return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return;\n }\n\n if (change.from.line > doc.lastLine()) {\n return;\n } // Clip the change to the size of this doc\n\n\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {\n from: Pos(doc.first, 0),\n to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)],\n origin: change.origin\n };\n }\n\n var last = doc.lastLine();\n\n if (change.to.line > last) {\n change = {\n from: change.from,\n to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]],\n origin: change.origin\n };\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) {\n selAfter = computeSelAfterChange(doc, change);\n }\n\n if (doc.cm) {\n makeChangeSingleDocInEditor(doc.cm, change, spans);\n } else {\n updateDoc(doc, change, spans);\n }\n\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0))) {\n doc.cantEdit = false;\n }\n } // Handle the interaction of a change to a document with the editor\n // that this document is part of.\n\n\n function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc,\n display = cm.display,\n from = change.from,\n to = change.to;\n var recomputeMaxLength = false,\n checkWidthStart = from.line;\n\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true;\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1) {\n signalCursorActivity(cm);\n }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n\n if (recomputeMaxLength) {\n cm.curOp.updateMaxLine = true;\n }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n var lendiff = change.text.length - (to.line - from.line) - 1; // Remember that these lines changed, for updating the display\n\n if (change.full) {\n regChange(cm);\n } else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) {\n regLineChange(cm, from.line, \"text\");\n } else {\n regChange(cm, from.line, to.line + 1, lendiff);\n }\n\n var changesHandler = hasHandler(cm, \"changes\"),\n changeHandler = hasHandler(cm, \"change\");\n\n if (changeHandler || changesHandler) {\n var obj = {\n from: from,\n to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n\n if (changeHandler) {\n signalLater(cm, \"change\", cm, obj);\n }\n\n if (changesHandler) {\n (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n }\n }\n\n cm.display.selForContextMenu = null;\n }\n\n function _replaceRange(doc, code, from, to, origin) {\n var assign;\n\n if (!to) {\n to = from;\n }\n\n if (cmp(to, from) < 0) {\n assign = [to, from], from = assign[0], to = assign[1];\n }\n\n if (typeof code == \"string\") {\n code = doc.splitLines(code);\n }\n\n makeChange(doc, {\n from: from,\n to: to,\n text: code,\n origin: origin\n });\n } // Rebasing/resetting history to deal with externally-sourced changes\n\n\n function rebaseHistSelSingle(pos, from, to, diff) {\n if (to < pos.line) {\n pos.line += diff;\n } else if (from < pos.line) {\n pos.line = from;\n pos.ch = 0;\n }\n } // Tries to rebase an array of history events given a change in the\n // document. If the change touches the same lines as the event, the\n // event, and everything 'behind' it, is discarded. If the change is\n // before the event, the event's positions are updated. Uses a\n // copy-on-write scheme for the positions, to avoid having to\n // reallocate them all on every rebase, but also avoid problems with\n // shared position objects being unsafely updated.\n\n\n function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i],\n ok = true;\n\n if (sub.ranges) {\n if (!sub.copied) {\n sub = array[i] = sub.deepCopy();\n sub.copied = true;\n }\n\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n\n continue;\n }\n\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }\n\n function rebaseHist(hist, change) {\n var from = change.from.line,\n to = change.to.line,\n diff = change.text.length - (to - from) - 1;\n rebaseHistArray(hist.done, from, to, diff);\n rebaseHistArray(hist.undone, from, to, diff);\n } // Utility for applying a change to a line by handle or number,\n // returning the number and optionally registering the line as\n // changed.\n\n\n function changeLine(doc, handle, changeType, op) {\n var no = handle,\n line = handle;\n\n if (typeof handle == \"number\") {\n line = getLine(doc, clipLine(doc, handle));\n } else {\n no = lineNo(handle);\n }\n\n if (no == null) {\n return null;\n }\n\n if (op(line, no) && doc.cm) {\n regLineChange(doc.cm, no, changeType);\n }\n\n return line;\n } // The document is represented as a BTree consisting of leaves, with\n // chunk of lines in them, and branches, with up to ten leaves or\n // other branch nodes below them. The top node is always a branch\n // node, and is the document object itself (meaning it has\n // additional methods and properties).\n //\n // All nodes have parent links. The tree is used both to go from\n // line numbers to line objects, and to go from objects to numbers.\n // It also indexes by height, and is used to convert between height\n // and line object, and to find the total height of the document.\n //\n // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html\n\n\n function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n\n this.height = height;\n }\n\n LeafChunk.prototype = {\n chunkSize: function chunkSize() {\n return this.lines.length;\n },\n // Remove the n lines at offset 'at'.\n removeInner: function removeInner(at, n) {\n for (var i = at, e = at + n; i < e; ++i) {\n var line = this.lines[i];\n this.height -= line.height;\n cleanUpLine(line);\n signalLater(line, \"delete\");\n }\n\n this.lines.splice(at, n);\n },\n // Helper used to collapse a small branch into a single leaf.\n collapse: function collapse(lines) {\n lines.push.apply(lines, this.lines);\n },\n // Insert the given array of lines at offset 'at', count them as\n // having the given height.\n insertInner: function insertInner(at, lines, height) {\n this.height += height;\n this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));\n\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n }\n },\n // Used to iterate over a part of the tree.\n iterN: function iterN(at, n, op) {\n for (var e = at + n; at < e; ++at) {\n if (op(this.lines[at])) {\n return true;\n }\n }\n }\n };\n\n function BranchChunk(children) {\n this.children = children;\n var size = 0,\n height = 0;\n\n for (var i = 0; i < children.length; ++i) {\n var ch = children[i];\n size += ch.chunkSize();\n height += ch.height;\n ch.parent = this;\n }\n\n this.size = size;\n this.height = height;\n this.parent = null;\n }\n\n BranchChunk.prototype = {\n chunkSize: function chunkSize() {\n return this.size;\n },\n removeInner: function removeInner(at, n) {\n this.size -= n;\n\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i],\n sz = child.chunkSize();\n\n if (at < sz) {\n var rm = Math.min(n, sz - at),\n oldHeight = child.height;\n child.removeInner(at, rm);\n this.height -= oldHeight - child.height;\n\n if (sz == rm) {\n this.children.splice(i--, 1);\n child.parent = null;\n }\n\n if ((n -= rm) == 0) {\n break;\n }\n\n at = 0;\n } else {\n at -= sz;\n }\n } // If the result is smaller than 25 lines, ensure that it is a\n // single leaf node.\n\n\n if (this.size - n < 25 && (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {\n var lines = [];\n this.collapse(lines);\n this.children = [new LeafChunk(lines)];\n this.children[0].parent = this;\n }\n },\n collapse: function collapse(lines) {\n for (var i = 0; i < this.children.length; ++i) {\n this.children[i].collapse(lines);\n }\n },\n insertInner: function insertInner(at, lines, height) {\n this.size += lines.length;\n this.height += height;\n\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i],\n sz = child.chunkSize();\n\n if (at <= sz) {\n child.insertInner(at, lines, height);\n\n if (child.lines && child.lines.length > 50) {\n // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.\n // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.\n var remaining = child.lines.length % 25 + 25;\n\n for (var pos = remaining; pos < child.lines.length;) {\n var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));\n child.height -= leaf.height;\n this.children.splice(++i, 0, leaf);\n leaf.parent = this;\n }\n\n child.lines = child.lines.slice(0, remaining);\n this.maybeSpill();\n }\n\n break;\n }\n\n at -= sz;\n }\n },\n // When a node has grown, check whether it should be split.\n maybeSpill: function maybeSpill() {\n if (this.children.length <= 10) {\n return;\n }\n\n var me = this;\n\n do {\n var spilled = me.children.splice(me.children.length - 5, 5);\n var sibling = new BranchChunk(spilled);\n\n if (!me.parent) {\n // Become the parent node\n var copy = new BranchChunk(me.children);\n copy.parent = me;\n me.children = [copy, sibling];\n me = copy;\n } else {\n me.size -= sibling.size;\n me.height -= sibling.height;\n var myIndex = indexOf(me.parent.children, me);\n me.parent.children.splice(myIndex + 1, 0, sibling);\n }\n\n sibling.parent = me.parent;\n } while (me.children.length > 10);\n\n me.parent.maybeSpill();\n },\n iterN: function iterN(at, n, op) {\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i],\n sz = child.chunkSize();\n\n if (at < sz) {\n var used = Math.min(n, sz - at);\n\n if (child.iterN(at, used, op)) {\n return true;\n }\n\n if ((n -= used) == 0) {\n break;\n }\n\n at = 0;\n } else {\n at -= sz;\n }\n }\n }\n }; // Line widgets are block elements displayed above or below a line.\n\n var LineWidget = function LineWidget(doc, node, options) {\n if (options) {\n for (var opt in options) {\n if (options.hasOwnProperty(opt)) {\n this[opt] = options[opt];\n }\n }\n }\n\n this.doc = doc;\n this.node = node;\n };\n\n LineWidget.prototype.clear = function () {\n var cm = this.doc.cm,\n ws = this.line.widgets,\n line = this.line,\n no = lineNo(line);\n\n if (no == null || !ws) {\n return;\n }\n\n for (var i = 0; i < ws.length; ++i) {\n if (ws[i] == this) {\n ws.splice(i--, 1);\n }\n }\n\n if (!ws.length) {\n line.widgets = null;\n }\n\n var height = widgetHeight(this);\n updateLineHeight(line, Math.max(0, line.height - height));\n\n if (cm) {\n runInOp(cm, function () {\n adjustScrollWhenAboveVisible(cm, line, -height);\n regLineChange(cm, no, \"widget\");\n });\n signalLater(cm, \"lineWidgetCleared\", cm, this, no);\n }\n };\n\n LineWidget.prototype.changed = function () {\n var this$1 = this;\n var oldH = this.height,\n cm = this.doc.cm,\n line = this.line;\n this.height = null;\n var diff = widgetHeight(this) - oldH;\n\n if (!diff) {\n return;\n }\n\n if (!lineIsHidden(this.doc, line)) {\n updateLineHeight(line, line.height + diff);\n }\n\n if (cm) {\n runInOp(cm, function () {\n cm.curOp.forceUpdate = true;\n adjustScrollWhenAboveVisible(cm, line, diff);\n signalLater(cm, \"lineWidgetChanged\", cm, this$1, lineNo(line));\n });\n }\n };\n\n eventMixin(LineWidget);\n\n function adjustScrollWhenAboveVisible(cm, line, diff) {\n if (_heightAtLine(line) < (cm.curOp && cm.curOp.scrollTop || cm.doc.scrollTop)) {\n addToScrollTop(cm, diff);\n }\n }\n\n function addLineWidget(doc, handle, node, options) {\n var widget = new LineWidget(doc, node, options);\n var cm = doc.cm;\n\n if (cm && widget.noHScroll) {\n cm.display.alignWidgets = true;\n }\n\n changeLine(doc, handle, \"widget\", function (line) {\n var widgets = line.widgets || (line.widgets = []);\n\n if (widget.insertAt == null) {\n widgets.push(widget);\n } else {\n widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget);\n }\n\n widget.line = line;\n\n if (cm && !lineIsHidden(doc, line)) {\n var aboveVisible = _heightAtLine(line) < doc.scrollTop;\n updateLineHeight(line, line.height + widgetHeight(widget));\n\n if (aboveVisible) {\n addToScrollTop(cm, widget.height);\n }\n\n cm.curOp.forceUpdate = true;\n }\n\n return true;\n });\n\n if (cm) {\n signalLater(cm, \"lineWidgetAdded\", cm, widget, typeof handle == \"number\" ? handle : lineNo(handle));\n }\n\n return widget;\n } // TEXTMARKERS\n // Created with markText and setBookmark methods. A TextMarker is a\n // handle that can be used to clear or find a marked position in the\n // document. Line objects hold arrays (markedSpans) containing\n // {from, to, marker} object pointing to such marker objects, and\n // indicating that such a marker is present on that line. Multiple\n // lines may point to the same marker when it spans across lines.\n // The spans will have null for their from/to properties when the\n // marker continues beyond the start/end of the line. Markers have\n // links back to the lines they currently touch.\n // Collapsed markers have unique ids, in order to be able to order\n // them, which is needed for uniquely determining an outer marker\n // when they overlap (they may nest, but not partially overlap).\n\n\n var nextMarkerId = 0;\n\n var TextMarker = function TextMarker(doc, type) {\n this.lines = [];\n this.type = type;\n this.doc = doc;\n this.id = ++nextMarkerId;\n }; // Clear the marker.\n\n\n TextMarker.prototype.clear = function () {\n if (this.explicitlyCleared) {\n return;\n }\n\n var cm = this.doc.cm,\n withOp = cm && !cm.curOp;\n\n if (withOp) {\n _startOperation(cm);\n }\n\n if (hasHandler(this, \"clear\")) {\n var found = this.find();\n\n if (found) {\n signalLater(this, \"clear\", found.from, found.to);\n }\n }\n\n var min = null,\n max = null;\n\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n\n if (cm && !this.collapsed) {\n regLineChange(cm, lineNo(line), \"text\");\n } else if (cm) {\n if (span.to != null) {\n max = lineNo(line);\n }\n\n if (span.from != null) {\n min = lineNo(line);\n }\n }\n\n line.markedSpans = removeMarkedSpan(line.markedSpans, span);\n\n if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm) {\n updateLineHeight(line, textHeight(cm.display));\n }\n }\n\n if (cm && this.collapsed && !cm.options.lineWrapping) {\n for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {\n var visual = visualLine(this.lines[i$1]),\n len = lineLength(visual);\n\n if (len > cm.display.maxLineLength) {\n cm.display.maxLine = visual;\n cm.display.maxLineLength = len;\n cm.display.maxLineChanged = true;\n }\n }\n }\n\n if (min != null && cm && this.collapsed) {\n regChange(cm, min, max + 1);\n }\n\n this.lines.length = 0;\n this.explicitlyCleared = true;\n\n if (this.atomic && this.doc.cantEdit) {\n this.doc.cantEdit = false;\n\n if (cm) {\n reCheckSelection(cm.doc);\n }\n }\n\n if (cm) {\n signalLater(cm, \"markerCleared\", cm, this, min, max);\n }\n\n if (withOp) {\n _endOperation(cm);\n }\n\n if (this.parent) {\n this.parent.clear();\n }\n }; // Find the position of the marker in the document. Returns a {from,\n // to} object by default. Side can be passed to get a specific side\n // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the\n // Pos objects returned contain a line object, rather than a line\n // number (used to prevent looking up the same line twice).\n\n\n TextMarker.prototype.find = function (side, lineObj) {\n if (side == null && this.type == \"bookmark\") {\n side = 1;\n }\n\n var from, to;\n\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n\n if (span.from != null) {\n from = Pos(lineObj ? line : lineNo(line), span.from);\n\n if (side == -1) {\n return from;\n }\n }\n\n if (span.to != null) {\n to = Pos(lineObj ? line : lineNo(line), span.to);\n\n if (side == 1) {\n return to;\n }\n }\n }\n\n return from && {\n from: from,\n to: to\n };\n }; // Signals that the marker's widget changed, and surrounding layout\n // should be recomputed.\n\n\n TextMarker.prototype.changed = function () {\n var this$1 = this;\n var pos = this.find(-1, true),\n widget = this,\n cm = this.doc.cm;\n\n if (!pos || !cm) {\n return;\n }\n\n runInOp(cm, function () {\n var line = pos.line,\n lineN = lineNo(pos.line);\n var view = findViewForLine(cm, lineN);\n\n if (view) {\n clearLineMeasurementCacheFor(view);\n cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;\n }\n\n cm.curOp.updateMaxLine = true;\n\n if (!lineIsHidden(widget.doc, line) && widget.height != null) {\n var oldHeight = widget.height;\n widget.height = null;\n var dHeight = widgetHeight(widget) - oldHeight;\n\n if (dHeight) {\n updateLineHeight(line, line.height + dHeight);\n }\n }\n\n signalLater(cm, \"markerChanged\", cm, this$1);\n });\n };\n\n TextMarker.prototype.attachLine = function (line) {\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;\n\n if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1) {\n (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this);\n }\n }\n\n this.lines.push(line);\n };\n\n TextMarker.prototype.detachLine = function (line) {\n this.lines.splice(indexOf(this.lines, line), 1);\n\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;\n (op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);\n }\n };\n\n eventMixin(TextMarker); // Create a marker, wire it up to the right lines, and\n\n function _markText(doc, from, to, options, type) {\n // Shared markers (across linked documents) are handled separately\n // (markTextShared will call out to this again, once per\n // document).\n if (options && options.shared) {\n return markTextShared(doc, from, to, options, type);\n } // Ensure we are in an operation.\n\n\n if (doc.cm && !doc.cm.curOp) {\n return operation(doc.cm, _markText)(doc, from, to, options, type);\n }\n\n var marker = new TextMarker(doc, type),\n diff = cmp(from, to);\n\n if (options) {\n copyObj(options, marker, false);\n } // Don't connect empty markers unless clearWhenEmpty is false\n\n\n if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false) {\n return marker;\n }\n\n if (marker.replacedWith) {\n // Showing up as a widget implies collapsed (widget replaces text)\n marker.collapsed = true;\n marker.widgetNode = eltP(\"span\", [marker.replacedWith], \"CodeMirror-widget\");\n\n if (!options.handleMouseEvents) {\n marker.widgetNode.setAttribute(\"cm-ignore-events\", \"true\");\n }\n\n if (options.insertLeft) {\n marker.widgetNode.insertLeft = true;\n }\n }\n\n if (marker.collapsed) {\n if (conflictingCollapsedRange(doc, from.line, from, to, marker) || from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) {\n throw new Error(\"Inserting collapsed marker partially overlapping an existing one\");\n }\n\n seeCollapsedSpans();\n }\n\n if (marker.addToHistory) {\n addChangeToHistory(doc, {\n from: from,\n to: to,\n origin: \"markText\"\n }, doc.sel, NaN);\n }\n\n var curLine = from.line,\n cm = doc.cm,\n updateMaxLine;\n doc.iter(curLine, to.line + 1, function (line) {\n if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine) {\n updateMaxLine = true;\n }\n\n if (marker.collapsed && curLine != from.line) {\n updateLineHeight(line, 0);\n }\n\n addMarkedSpan(line, new MarkedSpan(marker, curLine == from.line ? from.ch : null, curLine == to.line ? to.ch : null));\n ++curLine;\n }); // lineIsHidden depends on the presence of the spans, so needs a second pass\n\n if (marker.collapsed) {\n doc.iter(from.line, to.line + 1, function (line) {\n if (lineIsHidden(doc, line)) {\n updateLineHeight(line, 0);\n }\n });\n }\n\n if (marker.clearOnEnter) {\n on(marker, \"beforeCursorEnter\", function () {\n return marker.clear();\n });\n }\n\n if (marker.readOnly) {\n seeReadOnlySpans();\n\n if (doc.history.done.length || doc.history.undone.length) {\n doc.clearHistory();\n }\n }\n\n if (marker.collapsed) {\n marker.id = ++nextMarkerId;\n marker.atomic = true;\n }\n\n if (cm) {\n // Sync editor state\n if (updateMaxLine) {\n cm.curOp.updateMaxLine = true;\n }\n\n if (marker.collapsed) {\n regChange(cm, from.line, to.line + 1);\n } else if (marker.className || marker.startStyle || marker.endStyle || marker.css || marker.attributes || marker.title) {\n for (var i = from.line; i <= to.line; i++) {\n regLineChange(cm, i, \"text\");\n }\n }\n\n if (marker.atomic) {\n reCheckSelection(cm.doc);\n }\n\n signalLater(cm, \"markerAdded\", cm, marker);\n }\n\n return marker;\n } // SHARED TEXTMARKERS\n // A shared marker spans multiple linked documents. It is\n // implemented as a meta-marker-object controlling multiple normal\n // markers.\n\n\n var SharedTextMarker = function SharedTextMarker(markers, primary) {\n this.markers = markers;\n this.primary = primary;\n\n for (var i = 0; i < markers.length; ++i) {\n markers[i].parent = this;\n }\n };\n\n SharedTextMarker.prototype.clear = function () {\n if (this.explicitlyCleared) {\n return;\n }\n\n this.explicitlyCleared = true;\n\n for (var i = 0; i < this.markers.length; ++i) {\n this.markers[i].clear();\n }\n\n signalLater(this, \"clear\");\n };\n\n SharedTextMarker.prototype.find = function (side, lineObj) {\n return this.primary.find(side, lineObj);\n };\n\n eventMixin(SharedTextMarker);\n\n function markTextShared(doc, from, to, options, type) {\n options = copyObj(options);\n options.shared = false;\n var markers = [_markText(doc, from, to, options, type)],\n primary = markers[0];\n var widget = options.widgetNode;\n linkedDocs(doc, function (doc) {\n if (widget) {\n options.widgetNode = widget.cloneNode(true);\n }\n\n markers.push(_markText(doc, _clipPos(doc, from), _clipPos(doc, to), options, type));\n\n for (var i = 0; i < doc.linked.length; ++i) {\n if (doc.linked[i].isParent) {\n return;\n }\n }\n\n primary = lst(markers);\n });\n return new SharedTextMarker(markers, primary);\n }\n\n function findSharedMarkers(doc) {\n return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) {\n return m.parent;\n });\n }\n\n function copySharedMarkers(doc, markers) {\n for (var i = 0; i < markers.length; i++) {\n var marker = markers[i],\n pos = marker.find();\n var mFrom = doc.clipPos(pos.from),\n mTo = doc.clipPos(pos.to);\n\n if (cmp(mFrom, mTo)) {\n var subMark = _markText(doc, mFrom, mTo, marker.primary, marker.primary.type);\n\n marker.markers.push(subMark);\n subMark.parent = marker;\n }\n }\n }\n\n function detachSharedMarkers(markers) {\n var loop = function loop(i) {\n var marker = markers[i],\n linked = [marker.primary.doc];\n linkedDocs(marker.primary.doc, function (d) {\n return linked.push(d);\n });\n\n for (var j = 0; j < marker.markers.length; j++) {\n var subMarker = marker.markers[j];\n\n if (indexOf(linked, subMarker.doc) == -1) {\n subMarker.parent = null;\n marker.markers.splice(j--, 1);\n }\n }\n };\n\n for (var i = 0; i < markers.length; i++) {\n loop(i);\n }\n }\n\n var nextDocId = 0;\n\n var Doc = function Doc(text, mode, firstLine, lineSep, direction) {\n if (!(this instanceof Doc)) {\n return new Doc(text, mode, firstLine, lineSep, direction);\n }\n\n if (firstLine == null) {\n firstLine = 0;\n }\n\n BranchChunk.call(this, [new LeafChunk([new Line(\"\", null)])]);\n this.first = firstLine;\n this.scrollTop = this.scrollLeft = 0;\n this.cantEdit = false;\n this.cleanGeneration = 1;\n this.modeFrontier = this.highlightFrontier = firstLine;\n var start = Pos(firstLine, 0);\n this.sel = simpleSelection(start);\n this.history = new History(null);\n this.id = ++nextDocId;\n this.modeOption = mode;\n this.lineSep = lineSep;\n this.direction = direction == \"rtl\" ? \"rtl\" : \"ltr\";\n this.extend = false;\n\n if (typeof text == \"string\") {\n text = this.splitLines(text);\n }\n\n updateDoc(this, {\n from: start,\n to: start,\n text: text\n });\n setSelection(this, simpleSelection(start), sel_dontScroll);\n };\n\n Doc.prototype = createObj(BranchChunk.prototype, {\n constructor: Doc,\n // Iterate over the document. Supports two forms -- with only one\n // argument, it calls that for each line in the document. With\n // three, it iterates over the range given by the first two (with\n // the second being non-inclusive).\n iter: function iter(from, to, op) {\n if (op) {\n this.iterN(from - this.first, to - from, op);\n } else {\n this.iterN(this.first, this.first + this.size, from);\n }\n },\n // Non-public interface for adding and removing lines.\n insert: function insert(at, lines) {\n var height = 0;\n\n for (var i = 0; i < lines.length; ++i) {\n height += lines[i].height;\n }\n\n this.insertInner(at - this.first, lines, height);\n },\n remove: function remove(at, n) {\n this.removeInner(at - this.first, n);\n },\n // From here, the methods are part of the public interface. Most\n // are also available from CodeMirror (editor) instances.\n getValue: function getValue(lineSep) {\n var lines = getLines(this, this.first, this.first + this.size);\n\n if (lineSep === false) {\n return lines;\n }\n\n return lines.join(lineSep || this.lineSeparator());\n },\n setValue: docMethodOp(function (code) {\n var top = Pos(this.first, 0),\n last = this.first + this.size - 1;\n makeChange(this, {\n from: top,\n to: Pos(last, getLine(this, last).text.length),\n text: this.splitLines(code),\n origin: \"setValue\",\n full: true\n }, true);\n\n if (this.cm) {\n scrollToCoords(this.cm, 0, 0);\n }\n\n setSelection(this, simpleSelection(top), sel_dontScroll);\n }),\n replaceRange: function replaceRange(code, from, to, origin) {\n from = _clipPos(this, from);\n to = to ? _clipPos(this, to) : from;\n\n _replaceRange(this, code, from, to, origin);\n },\n getRange: function getRange(from, to, lineSep) {\n var lines = getBetween(this, _clipPos(this, from), _clipPos(this, to));\n\n if (lineSep === false) {\n return lines;\n }\n\n return lines.join(lineSep || this.lineSeparator());\n },\n getLine: function getLine(line) {\n var l = this.getLineHandle(line);\n return l && l.text;\n },\n getLineHandle: function getLineHandle(line) {\n if (isLine(this, line)) {\n return getLine(this, line);\n }\n },\n getLineNumber: function getLineNumber(line) {\n return lineNo(line);\n },\n getLineHandleVisualStart: function getLineHandleVisualStart(line) {\n if (typeof line == \"number\") {\n line = getLine(this, line);\n }\n\n return visualLine(line);\n },\n lineCount: function lineCount() {\n return this.size;\n },\n firstLine: function firstLine() {\n return this.first;\n },\n lastLine: function lastLine() {\n return this.first + this.size - 1;\n },\n clipPos: function clipPos(pos) {\n return _clipPos(this, pos);\n },\n getCursor: function getCursor(start) {\n var range = this.sel.primary(),\n pos;\n\n if (start == null || start == \"head\") {\n pos = range.head;\n } else if (start == \"anchor\") {\n pos = range.anchor;\n } else if (start == \"end\" || start == \"to\" || start === false) {\n pos = range.to();\n } else {\n pos = range.from();\n }\n\n return pos;\n },\n listSelections: function listSelections() {\n return this.sel.ranges;\n },\n somethingSelected: function somethingSelected() {\n return this.sel.somethingSelected();\n },\n setCursor: docMethodOp(function (line, ch, options) {\n setSimpleSelection(this, _clipPos(this, typeof line == \"number\" ? Pos(line, ch || 0) : line), null, options);\n }),\n setSelection: docMethodOp(function (anchor, head, options) {\n setSimpleSelection(this, _clipPos(this, anchor), _clipPos(this, head || anchor), options);\n }),\n extendSelection: docMethodOp(function (head, other, options) {\n extendSelection(this, _clipPos(this, head), other && _clipPos(this, other), options);\n }),\n extendSelections: docMethodOp(function (heads, options) {\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n extendSelectionsBy: docMethodOp(function (f, options) {\n var heads = map(this.sel.ranges, f);\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n setSelections: docMethodOp(function (ranges, primary, options) {\n if (!ranges.length) {\n return;\n }\n\n var out = [];\n\n for (var i = 0; i < ranges.length; i++) {\n out[i] = new Range(_clipPos(this, ranges[i].anchor), _clipPos(this, ranges[i].head));\n }\n\n if (primary == null) {\n primary = Math.min(ranges.length - 1, this.sel.primIndex);\n }\n\n setSelection(this, normalizeSelection(this.cm, out, primary), options);\n }),\n addSelection: docMethodOp(function (anchor, head, options) {\n var ranges = this.sel.ranges.slice(0);\n ranges.push(new Range(_clipPos(this, anchor), _clipPos(this, head || anchor)));\n setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);\n }),\n getSelection: function getSelection(lineSep) {\n var ranges = this.sel.ranges,\n lines;\n\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n lines = lines ? lines.concat(sel) : sel;\n }\n\n if (lineSep === false) {\n return lines;\n } else {\n return lines.join(lineSep || this.lineSeparator());\n }\n },\n getSelections: function getSelections(lineSep) {\n var parts = [],\n ranges = this.sel.ranges;\n\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n\n if (lineSep !== false) {\n sel = sel.join(lineSep || this.lineSeparator());\n }\n\n parts[i] = sel;\n }\n\n return parts;\n },\n replaceSelection: function replaceSelection(code, collapse, origin) {\n var dup = [];\n\n for (var i = 0; i < this.sel.ranges.length; i++) {\n dup[i] = code;\n }\n\n this.replaceSelections(dup, collapse, origin || \"+input\");\n },\n replaceSelections: docMethodOp(function (code, collapse, origin) {\n var changes = [],\n sel = this.sel;\n\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n changes[i] = {\n from: range.from(),\n to: range.to(),\n text: this.splitLines(code[i]),\n origin: origin\n };\n }\n\n var newSel = collapse && collapse != \"end\" && computeReplacedSel(this, changes, collapse);\n\n for (var i$1 = changes.length - 1; i$1 >= 0; i$1--) {\n makeChange(this, changes[i$1]);\n }\n\n if (newSel) {\n setSelectionReplaceHistory(this, newSel);\n } else if (this.cm) {\n ensureCursorVisible(this.cm);\n }\n }),\n undo: docMethodOp(function () {\n makeChangeFromHistory(this, \"undo\");\n }),\n redo: docMethodOp(function () {\n makeChangeFromHistory(this, \"redo\");\n }),\n undoSelection: docMethodOp(function () {\n makeChangeFromHistory(this, \"undo\", true);\n }),\n redoSelection: docMethodOp(function () {\n makeChangeFromHistory(this, \"redo\", true);\n }),\n setExtending: function setExtending(val) {\n this.extend = val;\n },\n getExtending: function getExtending() {\n return this.extend;\n },\n historySize: function historySize() {\n var hist = this.history,\n done = 0,\n undone = 0;\n\n for (var i = 0; i < hist.done.length; i++) {\n if (!hist.done[i].ranges) {\n ++done;\n }\n }\n\n for (var i$1 = 0; i$1 < hist.undone.length; i$1++) {\n if (!hist.undone[i$1].ranges) {\n ++undone;\n }\n }\n\n return {\n undo: done,\n redo: undone\n };\n },\n clearHistory: function clearHistory() {\n var this$1 = this;\n this.history = new History(this.history.maxGeneration);\n linkedDocs(this, function (doc) {\n return doc.history = this$1.history;\n }, true);\n },\n markClean: function markClean() {\n this.cleanGeneration = this.changeGeneration(true);\n },\n changeGeneration: function changeGeneration(forceSplit) {\n if (forceSplit) {\n this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null;\n }\n\n return this.history.generation;\n },\n isClean: function isClean(gen) {\n return this.history.generation == (gen || this.cleanGeneration);\n },\n getHistory: function getHistory() {\n return {\n done: copyHistoryArray(this.history.done),\n undone: copyHistoryArray(this.history.undone)\n };\n },\n setHistory: function setHistory(histData) {\n var hist = this.history = new History(this.history.maxGeneration);\n hist.done = copyHistoryArray(histData.done.slice(0), null, true);\n hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);\n },\n setGutterMarker: docMethodOp(function (line, gutterID, value) {\n return changeLine(this, line, \"gutter\", function (line) {\n var markers = line.gutterMarkers || (line.gutterMarkers = {});\n markers[gutterID] = value;\n\n if (!value && isEmpty(markers)) {\n line.gutterMarkers = null;\n }\n\n return true;\n });\n }),\n clearGutter: docMethodOp(function (gutterID) {\n var this$1 = this;\n this.iter(function (line) {\n if (line.gutterMarkers && line.gutterMarkers[gutterID]) {\n changeLine(this$1, line, \"gutter\", function () {\n line.gutterMarkers[gutterID] = null;\n\n if (isEmpty(line.gutterMarkers)) {\n line.gutterMarkers = null;\n }\n\n return true;\n });\n }\n });\n }),\n lineInfo: function lineInfo(line) {\n var n;\n\n if (typeof line == \"number\") {\n if (!isLine(this, line)) {\n return null;\n }\n\n n = line;\n line = getLine(this, line);\n\n if (!line) {\n return null;\n }\n } else {\n n = lineNo(line);\n\n if (n == null) {\n return null;\n }\n }\n\n return {\n line: n,\n handle: line,\n text: line.text,\n gutterMarkers: line.gutterMarkers,\n textClass: line.textClass,\n bgClass: line.bgClass,\n wrapClass: line.wrapClass,\n widgets: line.widgets\n };\n },\n addLineClass: docMethodOp(function (handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function (line) {\n var prop = where == \"text\" ? \"textClass\" : where == \"background\" ? \"bgClass\" : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n\n if (!line[prop]) {\n line[prop] = cls;\n } else if (classTest(cls).test(line[prop])) {\n return false;\n } else {\n line[prop] += \" \" + cls;\n }\n\n return true;\n });\n }),\n removeLineClass: docMethodOp(function (handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function (line) {\n var prop = where == \"text\" ? \"textClass\" : where == \"background\" ? \"bgClass\" : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n var cur = line[prop];\n\n if (!cur) {\n return false;\n } else if (cls == null) {\n line[prop] = null;\n } else {\n var found = cur.match(classTest(cls));\n\n if (!found) {\n return false;\n }\n\n var end = found.index + found[0].length;\n line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? \"\" : \" \") + cur.slice(end) || null;\n }\n\n return true;\n });\n }),\n addLineWidget: docMethodOp(function (handle, node, options) {\n return addLineWidget(this, handle, node, options);\n }),\n removeLineWidget: function removeLineWidget(widget) {\n widget.clear();\n },\n markText: function markText(from, to, options) {\n return _markText(this, _clipPos(this, from), _clipPos(this, to), options, options && options.type || \"range\");\n },\n setBookmark: function setBookmark(pos, options) {\n var realOpts = {\n replacedWith: options && (options.nodeType == null ? options.widget : options),\n insertLeft: options && options.insertLeft,\n clearWhenEmpty: false,\n shared: options && options.shared,\n handleMouseEvents: options && options.handleMouseEvents\n };\n pos = _clipPos(this, pos);\n return _markText(this, pos, pos, realOpts, \"bookmark\");\n },\n findMarksAt: function findMarksAt(pos) {\n pos = _clipPos(this, pos);\n var markers = [],\n spans = getLine(this, pos.line).markedSpans;\n\n if (spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n\n if ((span.from == null || span.from <= pos.ch) && (span.to == null || span.to >= pos.ch)) {\n markers.push(span.marker.parent || span.marker);\n }\n }\n }\n\n return markers;\n },\n findMarks: function findMarks(from, to, filter) {\n from = _clipPos(this, from);\n to = _clipPos(this, to);\n var found = [],\n lineNo = from.line;\n this.iter(from.line, to.line + 1, function (line) {\n var spans = line.markedSpans;\n\n if (spans) {\n for (var i = 0; i < spans.length; i++) {\n var span = spans[i];\n\n if (!(span.to != null && lineNo == from.line && from.ch >= span.to || span.from == null && lineNo != from.line || span.from != null && lineNo == to.line && span.from >= to.ch) && (!filter || filter(span.marker))) {\n found.push(span.marker.parent || span.marker);\n }\n }\n }\n\n ++lineNo;\n });\n return found;\n },\n getAllMarks: function getAllMarks() {\n var markers = [];\n this.iter(function (line) {\n var sps = line.markedSpans;\n\n if (sps) {\n for (var i = 0; i < sps.length; ++i) {\n if (sps[i].from != null) {\n markers.push(sps[i].marker);\n }\n }\n }\n });\n return markers;\n },\n posFromIndex: function posFromIndex(off) {\n var ch,\n lineNo = this.first,\n sepSize = this.lineSeparator().length;\n this.iter(function (line) {\n var sz = line.text.length + sepSize;\n\n if (sz > off) {\n ch = off;\n return true;\n }\n\n off -= sz;\n ++lineNo;\n });\n return _clipPos(this, Pos(lineNo, ch));\n },\n indexFromPos: function indexFromPos(coords) {\n coords = _clipPos(this, coords);\n var index = coords.ch;\n\n if (coords.line < this.first || coords.ch < 0) {\n return 0;\n }\n\n var sepSize = this.lineSeparator().length;\n this.iter(this.first, coords.line, function (line) {\n // iter aborts when callback returns a truthy value\n index += line.text.length + sepSize;\n });\n return index;\n },\n copy: function copy(copyHistory) {\n var doc = new Doc(getLines(this, this.first, this.first + this.size), this.modeOption, this.first, this.lineSep, this.direction);\n doc.scrollTop = this.scrollTop;\n doc.scrollLeft = this.scrollLeft;\n doc.sel = this.sel;\n doc.extend = false;\n\n if (copyHistory) {\n doc.history.undoDepth = this.history.undoDepth;\n doc.setHistory(this.getHistory());\n }\n\n return doc;\n },\n linkedDoc: function linkedDoc(options) {\n if (!options) {\n options = {};\n }\n\n var from = this.first,\n to = this.first + this.size;\n\n if (options.from != null && options.from > from) {\n from = options.from;\n }\n\n if (options.to != null && options.to < to) {\n to = options.to;\n }\n\n var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);\n\n if (options.sharedHist) {\n copy.history = this.history;\n }\n\n (this.linked || (this.linked = [])).push({\n doc: copy,\n sharedHist: options.sharedHist\n });\n copy.linked = [{\n doc: this,\n isParent: true,\n sharedHist: options.sharedHist\n }];\n copySharedMarkers(copy, findSharedMarkers(this));\n return copy;\n },\n unlinkDoc: function unlinkDoc(other) {\n if (other instanceof CodeMirror) {\n other = other.doc;\n }\n\n if (this.linked) {\n for (var i = 0; i < this.linked.length; ++i) {\n var link = this.linked[i];\n\n if (link.doc != other) {\n continue;\n }\n\n this.linked.splice(i, 1);\n other.unlinkDoc(this);\n detachSharedMarkers(findSharedMarkers(this));\n break;\n }\n } // If the histories were shared, split them again\n\n\n if (other.history == this.history) {\n var splitIds = [other.id];\n linkedDocs(other, function (doc) {\n return splitIds.push(doc.id);\n }, true);\n other.history = new History(null);\n other.history.done = copyHistoryArray(this.history.done, splitIds);\n other.history.undone = copyHistoryArray(this.history.undone, splitIds);\n }\n },\n iterLinkedDocs: function iterLinkedDocs(f) {\n linkedDocs(this, f);\n },\n getMode: function getMode() {\n return this.mode;\n },\n getEditor: function getEditor() {\n return this.cm;\n },\n splitLines: function splitLines(str) {\n if (this.lineSep) {\n return str.split(this.lineSep);\n }\n\n return splitLinesAuto(str);\n },\n lineSeparator: function lineSeparator() {\n return this.lineSep || \"\\n\";\n },\n setDirection: docMethodOp(function (dir) {\n if (dir != \"rtl\") {\n dir = \"ltr\";\n }\n\n if (dir == this.direction) {\n return;\n }\n\n this.direction = dir;\n this.iter(function (line) {\n return line.order = null;\n });\n\n if (this.cm) {\n directionChanged(this.cm);\n }\n })\n }); // Public alias.\n\n Doc.prototype.eachLine = Doc.prototype.iter; // Kludge to work around strange IE behavior where it'll sometimes\n // re-fire a series of drag-related events right after the drop (#1551)\n\n var lastDrop = 0;\n\n function onDrop(e) {\n var cm = this;\n clearDragCursor(cm);\n\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) {\n return;\n }\n\n e_preventDefault(e);\n\n if (ie) {\n lastDrop = +new Date();\n }\n\n var pos = posFromMouse(cm, e, true),\n files = e.dataTransfer.files;\n\n if (!pos || cm.isReadOnly()) {\n return;\n } // Might be a file drop, in which case we simply extract the text\n // and insert it.\n\n\n if (files && files.length && window.FileReader && window.File) {\n var n = files.length,\n text = Array(n),\n read = 0;\n\n var markAsReadAndPasteIfAllFilesAreRead = function markAsReadAndPasteIfAllFilesAreRead() {\n if (++read == n) {\n operation(cm, function () {\n pos = _clipPos(cm.doc, pos);\n var change = {\n from: pos,\n to: pos,\n text: cm.doc.splitLines(text.filter(function (t) {\n return t != null;\n }).join(cm.doc.lineSeparator())),\n origin: \"paste\"\n };\n makeChange(cm.doc, change);\n setSelectionReplaceHistory(cm.doc, simpleSelection(_clipPos(cm.doc, pos), _clipPos(cm.doc, changeEnd(change))));\n })();\n }\n };\n\n var readTextFromFile = function readTextFromFile(file, i) {\n if (cm.options.allowDropFileTypes && indexOf(cm.options.allowDropFileTypes, file.type) == -1) {\n markAsReadAndPasteIfAllFilesAreRead();\n return;\n }\n\n var reader = new FileReader();\n\n reader.onerror = function () {\n return markAsReadAndPasteIfAllFilesAreRead();\n };\n\n reader.onload = function () {\n var content = reader.result;\n\n if (/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(content)) {\n markAsReadAndPasteIfAllFilesAreRead();\n return;\n }\n\n text[i] = content;\n markAsReadAndPasteIfAllFilesAreRead();\n };\n\n reader.readAsText(file);\n };\n\n for (var i = 0; i < files.length; i++) {\n readTextFromFile(files[i], i);\n }\n } else {\n // Normal drop\n // Don't do a replace if the drop happened inside of the selected text.\n if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {\n cm.state.draggingText(e); // Ensure the editor is re-focused\n\n setTimeout(function () {\n return cm.display.input.focus();\n }, 20);\n return;\n }\n\n try {\n var text$1 = e.dataTransfer.getData(\"Text\");\n\n if (text$1) {\n var selected;\n\n if (cm.state.draggingText && !cm.state.draggingText.copy) {\n selected = cm.listSelections();\n }\n\n setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));\n\n if (selected) {\n for (var i$1 = 0; i$1 < selected.length; ++i$1) {\n _replaceRange(cm.doc, \"\", selected[i$1].anchor, selected[i$1].head, \"drag\");\n }\n }\n\n cm.replaceSelection(text$1, \"around\", \"paste\");\n cm.display.input.focus();\n }\n } catch (e) {}\n }\n }\n\n function onDragStart(cm, e) {\n if (ie && (!cm.state.draggingText || +new Date() - lastDrop < 100)) {\n e_stop(e);\n return;\n }\n\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) {\n return;\n }\n\n e.dataTransfer.setData(\"Text\", cm.getSelection());\n e.dataTransfer.effectAllowed = \"copyMove\"; // Use dummy image instead of default browsers image.\n // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.\n\n if (e.dataTransfer.setDragImage && !safari) {\n var img = elt(\"img\", null, null, \"position: fixed; left: 0; top: 0;\");\n img.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";\n\n if (presto) {\n img.width = img.height = 1;\n cm.display.wrapper.appendChild(img); // Force a relayout, or Opera won't use our image for some obscure reason\n\n img._top = img.offsetTop;\n }\n\n e.dataTransfer.setDragImage(img, 0, 0);\n\n if (presto) {\n img.parentNode.removeChild(img);\n }\n }\n }\n\n function onDragOver(cm, e) {\n var pos = posFromMouse(cm, e);\n\n if (!pos) {\n return;\n }\n\n var frag = document.createDocumentFragment();\n drawSelectionCursor(cm, pos, frag);\n\n if (!cm.display.dragCursor) {\n cm.display.dragCursor = elt(\"div\", null, \"CodeMirror-cursors CodeMirror-dragcursors\");\n cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);\n }\n\n removeChildrenAndAdd(cm.display.dragCursor, frag);\n }\n\n function clearDragCursor(cm) {\n if (cm.display.dragCursor) {\n cm.display.lineSpace.removeChild(cm.display.dragCursor);\n cm.display.dragCursor = null;\n }\n } // These must be handled carefully, because naively registering a\n // handler for each editor will cause the editors to never be\n // garbage collected.\n\n\n function forEachCodeMirror(f) {\n if (!document.getElementsByClassName) {\n return;\n }\n\n var byClass = document.getElementsByClassName(\"CodeMirror\"),\n editors = [];\n\n for (var i = 0; i < byClass.length; i++) {\n var cm = byClass[i].CodeMirror;\n\n if (cm) {\n editors.push(cm);\n }\n }\n\n if (editors.length) {\n editors[0].operation(function () {\n for (var i = 0; i < editors.length; i++) {\n f(editors[i]);\n }\n });\n }\n }\n\n var globalsRegistered = false;\n\n function ensureGlobalHandlers() {\n if (globalsRegistered) {\n return;\n }\n\n registerGlobalHandlers();\n globalsRegistered = true;\n }\n\n function registerGlobalHandlers() {\n // When the window resizes, we need to refresh active editors.\n var resizeTimer;\n on(window, \"resize\", function () {\n if (resizeTimer == null) {\n resizeTimer = setTimeout(function () {\n resizeTimer = null;\n forEachCodeMirror(onResize);\n }, 100);\n }\n }); // When the window loses focus, we want to show the editor as blurred\n\n on(window, \"blur\", function () {\n return forEachCodeMirror(onBlur);\n });\n } // Called when the window resizes\n\n\n function onResize(cm) {\n var d = cm.display; // Might be a text scaling operation, clear size caches.\n\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n d.scrollbarsClipped = false;\n cm.setSize();\n }\n\n var keyNames = {\n 3: \"Pause\",\n 8: \"Backspace\",\n 9: \"Tab\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Ctrl\",\n 18: \"Alt\",\n 19: \"Pause\",\n 20: \"CapsLock\",\n 27: \"Esc\",\n 32: \"Space\",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"Left\",\n 38: \"Up\",\n 39: \"Right\",\n 40: \"Down\",\n 44: \"PrintScrn\",\n 45: \"Insert\",\n 46: \"Delete\",\n 59: \";\",\n 61: \"=\",\n 91: \"Mod\",\n 92: \"Mod\",\n 93: \"Mod\",\n 106: \"*\",\n 107: \"=\",\n 109: \"-\",\n 110: \".\",\n 111: \"/\",\n 145: \"ScrollLock\",\n 173: \"-\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\",\n 63232: \"Up\",\n 63233: \"Down\",\n 63234: \"Left\",\n 63235: \"Right\",\n 63272: \"Delete\",\n 63273: \"Home\",\n 63275: \"End\",\n 63276: \"PageUp\",\n 63277: \"PageDown\",\n 63302: \"Insert\"\n }; // Number keys\n\n for (var i = 0; i < 10; i++) {\n keyNames[i + 48] = keyNames[i + 96] = String(i);\n } // Alphabetic keys\n\n\n for (var i$1 = 65; i$1 <= 90; i$1++) {\n keyNames[i$1] = String.fromCharCode(i$1);\n } // Function keys\n\n\n for (var i$2 = 1; i$2 <= 12; i$2++) {\n keyNames[i$2 + 111] = keyNames[i$2 + 63235] = \"F\" + i$2;\n }\n\n var keyMap = {};\n keyMap.basic = {\n \"Left\": \"goCharLeft\",\n \"Right\": \"goCharRight\",\n \"Up\": \"goLineUp\",\n \"Down\": \"goLineDown\",\n \"End\": \"goLineEnd\",\n \"Home\": \"goLineStartSmart\",\n \"PageUp\": \"goPageUp\",\n \"PageDown\": \"goPageDown\",\n \"Delete\": \"delCharAfter\",\n \"Backspace\": \"delCharBefore\",\n \"Shift-Backspace\": \"delCharBefore\",\n \"Tab\": \"defaultTab\",\n \"Shift-Tab\": \"indentAuto\",\n \"Enter\": \"newlineAndIndent\",\n \"Insert\": \"toggleOverwrite\",\n \"Esc\": \"singleSelection\"\n }; // Note that the save and find-related commands aren't defined by\n // default. User code or addons can define them. Unknown commands\n // are simply ignored.\n\n keyMap.pcDefault = {\n \"Ctrl-A\": \"selectAll\",\n \"Ctrl-D\": \"deleteLine\",\n \"Ctrl-Z\": \"undo\",\n \"Shift-Ctrl-Z\": \"redo\",\n \"Ctrl-Y\": \"redo\",\n \"Ctrl-Home\": \"goDocStart\",\n \"Ctrl-End\": \"goDocEnd\",\n \"Ctrl-Up\": \"goLineUp\",\n \"Ctrl-Down\": \"goLineDown\",\n \"Ctrl-Left\": \"goGroupLeft\",\n \"Ctrl-Right\": \"goGroupRight\",\n \"Alt-Left\": \"goLineStart\",\n \"Alt-Right\": \"goLineEnd\",\n \"Ctrl-Backspace\": \"delGroupBefore\",\n \"Ctrl-Delete\": \"delGroupAfter\",\n \"Ctrl-S\": \"save\",\n \"Ctrl-F\": \"find\",\n \"Ctrl-G\": \"findNext\",\n \"Shift-Ctrl-G\": \"findPrev\",\n \"Shift-Ctrl-F\": \"replace\",\n \"Shift-Ctrl-R\": \"replaceAll\",\n \"Ctrl-[\": \"indentLess\",\n \"Ctrl-]\": \"indentMore\",\n \"Ctrl-U\": \"undoSelection\",\n \"Shift-Ctrl-U\": \"redoSelection\",\n \"Alt-U\": \"redoSelection\",\n \"fallthrough\": \"basic\"\n }; // Very basic readline/emacs-style bindings, which are standard on Mac.\n\n keyMap.emacsy = {\n \"Ctrl-F\": \"goCharRight\",\n \"Ctrl-B\": \"goCharLeft\",\n \"Ctrl-P\": \"goLineUp\",\n \"Ctrl-N\": \"goLineDown\",\n \"Alt-F\": \"goWordRight\",\n \"Alt-B\": \"goWordLeft\",\n \"Ctrl-A\": \"goLineStart\",\n \"Ctrl-E\": \"goLineEnd\",\n \"Ctrl-V\": \"goPageDown\",\n \"Shift-Ctrl-V\": \"goPageUp\",\n \"Ctrl-D\": \"delCharAfter\",\n \"Ctrl-H\": \"delCharBefore\",\n \"Alt-D\": \"delWordAfter\",\n \"Alt-Backspace\": \"delWordBefore\",\n \"Ctrl-K\": \"killLine\",\n \"Ctrl-T\": \"transposeChars\",\n \"Ctrl-O\": \"openLine\"\n };\n keyMap.macDefault = {\n \"Cmd-A\": \"selectAll\",\n \"Cmd-D\": \"deleteLine\",\n \"Cmd-Z\": \"undo\",\n \"Shift-Cmd-Z\": \"redo\",\n \"Cmd-Y\": \"redo\",\n \"Cmd-Home\": \"goDocStart\",\n \"Cmd-Up\": \"goDocStart\",\n \"Cmd-End\": \"goDocEnd\",\n \"Cmd-Down\": \"goDocEnd\",\n \"Alt-Left\": \"goGroupLeft\",\n \"Alt-Right\": \"goGroupRight\",\n \"Cmd-Left\": \"goLineLeft\",\n \"Cmd-Right\": \"goLineRight\",\n \"Alt-Backspace\": \"delGroupBefore\",\n \"Ctrl-Alt-Backspace\": \"delGroupAfter\",\n \"Alt-Delete\": \"delGroupAfter\",\n \"Cmd-S\": \"save\",\n \"Cmd-F\": \"find\",\n \"Cmd-G\": \"findNext\",\n \"Shift-Cmd-G\": \"findPrev\",\n \"Cmd-Alt-F\": \"replace\",\n \"Shift-Cmd-Alt-F\": \"replaceAll\",\n \"Cmd-[\": \"indentLess\",\n \"Cmd-]\": \"indentMore\",\n \"Cmd-Backspace\": \"delWrappedLineLeft\",\n \"Cmd-Delete\": \"delWrappedLineRight\",\n \"Cmd-U\": \"undoSelection\",\n \"Shift-Cmd-U\": \"redoSelection\",\n \"Ctrl-Up\": \"goDocStart\",\n \"Ctrl-Down\": \"goDocEnd\",\n \"fallthrough\": [\"basic\", \"emacsy\"]\n };\n keyMap[\"default\"] = mac ? keyMap.macDefault : keyMap.pcDefault; // KEYMAP DISPATCH\n\n function normalizeKeyName(name) {\n var parts = name.split(/-(?!$)/);\n name = parts[parts.length - 1];\n var alt, ctrl, shift, cmd;\n\n for (var i = 0; i < parts.length - 1; i++) {\n var mod = parts[i];\n\n if (/^(cmd|meta|m)$/i.test(mod)) {\n cmd = true;\n } else if (/^a(lt)?$/i.test(mod)) {\n alt = true;\n } else if (/^(c|ctrl|control)$/i.test(mod)) {\n ctrl = true;\n } else if (/^s(hift)?$/i.test(mod)) {\n shift = true;\n } else {\n throw new Error(\"Unrecognized modifier name: \" + mod);\n }\n }\n\n if (alt) {\n name = \"Alt-\" + name;\n }\n\n if (ctrl) {\n name = \"Ctrl-\" + name;\n }\n\n if (cmd) {\n name = \"Cmd-\" + name;\n }\n\n if (shift) {\n name = \"Shift-\" + name;\n }\n\n return name;\n } // This is a kludge to keep keymaps mostly working as raw objects\n // (backwards compatibility) while at the same time support features\n // like normalization and multi-stroke key bindings. It compiles a\n // new normalized keymap, and then updates the old object to reflect\n // this.\n\n\n function normalizeKeyMap(keymap) {\n var copy = {};\n\n for (var keyname in keymap) {\n if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) {\n continue;\n }\n\n if (value == \"...\") {\n delete keymap[keyname];\n continue;\n }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n\n for (var i = 0; i < keys.length; i++) {\n var val = void 0,\n name = void 0;\n\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n\n var prev = copy[name];\n\n if (!prev) {\n copy[name] = val;\n } else if (prev != val) {\n throw new Error(\"Inconsistent bindings for \" + name);\n }\n }\n\n delete keymap[keyname];\n }\n }\n\n for (var prop in copy) {\n keymap[prop] = copy[prop];\n }\n\n return keymap;\n }\n\n function lookupKey(key, map, handle, context) {\n map = getKeyMap(map);\n var found = map.call ? map.call(key, context) : map[key];\n\n if (found === false) {\n return \"nothing\";\n }\n\n if (found === \"...\") {\n return \"multi\";\n }\n\n if (found != null && handle(found)) {\n return \"handled\";\n }\n\n if (map.fallthrough) {\n if (Object.prototype.toString.call(map.fallthrough) != \"[object Array]\") {\n return lookupKey(key, map.fallthrough, handle, context);\n }\n\n for (var i = 0; i < map.fallthrough.length; i++) {\n var result = lookupKey(key, map.fallthrough[i], handle, context);\n\n if (result) {\n return result;\n }\n }\n }\n } // Modifier key presses don't count as 'real' key presses for the\n // purpose of keymap fallthrough.\n\n\n function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\";\n }\n\n function addModifierNames(name, event, noShift) {\n var base = name;\n\n if (event.altKey && base != \"Alt\") {\n name = \"Alt-\" + name;\n }\n\n if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") {\n name = \"Ctrl-\" + name;\n }\n\n if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Cmd\") {\n name = \"Cmd-\" + name;\n }\n\n if (!noShift && event.shiftKey && base != \"Shift\") {\n name = \"Shift-\" + name;\n }\n\n return name;\n } // Look up the name of a key as indicated by an event object.\n\n\n function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) {\n return false;\n }\n\n var name = keyNames[event.keyCode];\n\n if (name == null || event.altGraphKey) {\n return false;\n } // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n\n\n if (event.keyCode == 3 && event.code) {\n name = event.code;\n }\n\n return addModifierNames(name, event, noShift);\n }\n\n function getKeyMap(val) {\n return typeof val == \"string\" ? keyMap[val] : val;\n } // Helper for deleting text near the selection(s), used to implement\n // backspace, delete, and similar functionality.\n\n\n function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges,\n kill = []; // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break;\n }\n }\n\n kill.push(toKill);\n } // Next, remove those actual ranges.\n\n\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--) {\n _replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n }\n\n ensureCursorVisible(cm);\n });\n }\n\n function moveCharLogically(line, ch, dir) {\n var target = skipExtendingChars(line.text, ch + dir, dir);\n return target < 0 || target > line.text.length ? null : target;\n }\n\n function moveLogically(line, start, dir) {\n var ch = moveCharLogically(line, start.ch, dir);\n return ch == null ? null : new Pos(start.line, ch, dir < 0 ? \"after\" : \"before\");\n }\n\n function endOfLine(visually, cm, lineObj, lineNo, dir) {\n if (visually) {\n if (cm.doc.direction == \"rtl\") {\n dir = -dir;\n }\n\n var order = getOrder(lineObj, cm.doc.direction);\n\n if (order) {\n var part = dir < 0 ? lst(order) : order[0];\n var moveInStorageOrder = dir < 0 == (part.level == 1);\n var sticky = moveInStorageOrder ? \"after\" : \"before\";\n var ch; // With a wrapped rtl chunk (possibly spanning multiple bidi parts),\n // it could be that the last bidi part is not on the last visual line,\n // since visual lines contain content order-consecutive chunks.\n // Thus, in rtl, we are looking for the first (content-order) character\n // in the rtl chunk that is on the last line (that is, the same line\n // as the last (content-order) character).\n\n if (part.level > 0 || cm.doc.direction == \"rtl\") {\n var prep = prepareMeasureForLine(cm, lineObj);\n ch = dir < 0 ? lineObj.text.length - 1 : 0;\n var targetTop = measureCharPrepared(cm, prep, ch).top;\n ch = findFirst(function (ch) {\n return measureCharPrepared(cm, prep, ch).top == targetTop;\n }, dir < 0 == (part.level == 1) ? part.from : part.to - 1, ch);\n\n if (sticky == \"before\") {\n ch = moveCharLogically(lineObj, ch, 1);\n }\n } else {\n ch = dir < 0 ? part.to : part.from;\n }\n\n return new Pos(lineNo, ch, sticky);\n }\n }\n\n return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? \"before\" : \"after\");\n }\n\n function moveVisually(cm, line, start, dir) {\n var bidi = getOrder(line, cm.doc.direction);\n\n if (!bidi) {\n return moveLogically(line, start, dir);\n }\n\n if (start.ch >= line.text.length) {\n start.ch = line.text.length;\n start.sticky = \"before\";\n } else if (start.ch <= 0) {\n start.ch = 0;\n start.sticky = \"after\";\n }\n\n var partPos = getBidiPartAt(bidi, start.ch, start.sticky),\n part = bidi[partPos];\n\n if (cm.doc.direction == \"ltr\" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {\n // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,\n // nothing interesting happens.\n return moveLogically(line, start, dir);\n }\n\n var mv = function mv(pos, dir) {\n return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir);\n };\n\n var prep;\n\n var getWrappedLineExtent = function getWrappedLineExtent(ch) {\n if (!cm.options.lineWrapping) {\n return {\n begin: 0,\n end: line.text.length\n };\n }\n\n prep = prep || prepareMeasureForLine(cm, line);\n return wrappedLineExtentChar(cm, line, prep, ch);\n };\n\n var wrappedLineExtent = getWrappedLineExtent(start.sticky == \"before\" ? mv(start, -1) : start.ch);\n\n if (cm.doc.direction == \"rtl\" || part.level == 1) {\n var moveInStorageOrder = part.level == 1 == dir < 0;\n var ch = mv(start, moveInStorageOrder ? 1 : -1);\n\n if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {\n // Case 2: We move within an rtl part or in an rtl editor on the same visual line\n var sticky = moveInStorageOrder ? \"before\" : \"after\";\n return new Pos(start.line, ch, sticky);\n }\n } // Case 3: Could not move within this bidi part in this visual line, so leave\n // the current bidi part\n\n\n var searchInVisualLine = function searchInVisualLine(partPos, dir, wrappedLineExtent) {\n var getRes = function getRes(ch, moveInStorageOrder) {\n return moveInStorageOrder ? new Pos(start.line, mv(ch, 1), \"before\") : new Pos(start.line, ch, \"after\");\n };\n\n for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {\n var part = bidi[partPos];\n var moveInStorageOrder = dir > 0 == (part.level != 1);\n var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);\n\n if (part.from <= ch && ch < part.to) {\n return getRes(ch, moveInStorageOrder);\n }\n\n ch = moveInStorageOrder ? part.from : mv(part.to, -1);\n\n if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) {\n return getRes(ch, moveInStorageOrder);\n }\n }\n }; // Case 3a: Look for other bidi parts on the same visual line\n\n\n var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);\n\n if (res) {\n return res;\n } // Case 3b: Look for other bidi parts on the next visual line\n\n\n var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);\n\n if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {\n res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));\n\n if (res) {\n return res;\n }\n } // Case 4: Nowhere to move\n\n\n return null;\n } // Commands are parameter-less actions that can be performed on an\n // editor, mostly used for keybindings.\n\n\n var commands = {\n selectAll: selectAll,\n singleSelection: function singleSelection(cm) {\n return cm.setSelection(cm.getCursor(\"anchor\"), cm.getCursor(\"head\"), sel_dontScroll);\n },\n killLine: function killLine(cm) {\n return deleteNearSelection(cm, function (range) {\n if (range.empty()) {\n var len = getLine(cm.doc, range.head.line).text.length;\n\n if (range.head.ch == len && range.head.line < cm.lastLine()) {\n return {\n from: range.head,\n to: Pos(range.head.line + 1, 0)\n };\n } else {\n return {\n from: range.head,\n to: Pos(range.head.line, len)\n };\n }\n } else {\n return {\n from: range.from(),\n to: range.to()\n };\n }\n });\n },\n deleteLine: function deleteLine(cm) {\n return deleteNearSelection(cm, function (range) {\n return {\n from: Pos(range.from().line, 0),\n to: _clipPos(cm.doc, Pos(range.to().line + 1, 0))\n };\n });\n },\n delLineLeft: function delLineLeft(cm) {\n return deleteNearSelection(cm, function (range) {\n return {\n from: Pos(range.from().line, 0),\n to: range.from()\n };\n });\n },\n delWrappedLineLeft: function delWrappedLineLeft(cm) {\n return deleteNearSelection(cm, function (range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var leftPos = cm.coordsChar({\n left: 0,\n top: top\n }, \"div\");\n return {\n from: leftPos,\n to: range.from()\n };\n });\n },\n delWrappedLineRight: function delWrappedLineRight(cm) {\n return deleteNearSelection(cm, function (range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var rightPos = cm.coordsChar({\n left: cm.display.lineDiv.offsetWidth + 100,\n top: top\n }, \"div\");\n return {\n from: range.from(),\n to: rightPos\n };\n });\n },\n undo: function undo(cm) {\n return cm.undo();\n },\n redo: function redo(cm) {\n return cm.redo();\n },\n undoSelection: function undoSelection(cm) {\n return cm.undoSelection();\n },\n redoSelection: function redoSelection(cm) {\n return cm.redoSelection();\n },\n goDocStart: function goDocStart(cm) {\n return cm.extendSelection(Pos(cm.firstLine(), 0));\n },\n goDocEnd: function goDocEnd(cm) {\n return cm.extendSelection(Pos(cm.lastLine()));\n },\n goLineStart: function goLineStart(cm) {\n return cm.extendSelectionsBy(function (range) {\n return lineStart(cm, range.head.line);\n }, {\n origin: \"+move\",\n bias: 1\n });\n },\n goLineStartSmart: function goLineStartSmart(cm) {\n return cm.extendSelectionsBy(function (range) {\n return lineStartSmart(cm, range.head);\n }, {\n origin: \"+move\",\n bias: 1\n });\n },\n goLineEnd: function goLineEnd(cm) {\n return cm.extendSelectionsBy(function (range) {\n return lineEnd(cm, range.head.line);\n }, {\n origin: \"+move\",\n bias: -1\n });\n },\n goLineRight: function goLineRight(cm) {\n return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({\n left: cm.display.lineDiv.offsetWidth + 100,\n top: top\n }, \"div\");\n }, sel_move);\n },\n goLineLeft: function goLineLeft(cm) {\n return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({\n left: 0,\n top: top\n }, \"div\");\n }, sel_move);\n },\n goLineLeftSmart: function goLineLeftSmart(cm) {\n return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n var pos = cm.coordsChar({\n left: 0,\n top: top\n }, \"div\");\n\n if (pos.ch < cm.getLine(pos.line).search(/\\S/)) {\n return lineStartSmart(cm, range.head);\n }\n\n return pos;\n }, sel_move);\n },\n goLineUp: function goLineUp(cm) {\n return cm.moveV(-1, \"line\");\n },\n goLineDown: function goLineDown(cm) {\n return cm.moveV(1, \"line\");\n },\n goPageUp: function goPageUp(cm) {\n return cm.moveV(-1, \"page\");\n },\n goPageDown: function goPageDown(cm) {\n return cm.moveV(1, \"page\");\n },\n goCharLeft: function goCharLeft(cm) {\n return cm.moveH(-1, \"char\");\n },\n goCharRight: function goCharRight(cm) {\n return cm.moveH(1, \"char\");\n },\n goColumnLeft: function goColumnLeft(cm) {\n return cm.moveH(-1, \"column\");\n },\n goColumnRight: function goColumnRight(cm) {\n return cm.moveH(1, \"column\");\n },\n goWordLeft: function goWordLeft(cm) {\n return cm.moveH(-1, \"word\");\n },\n goGroupRight: function goGroupRight(cm) {\n return cm.moveH(1, \"group\");\n },\n goGroupLeft: function goGroupLeft(cm) {\n return cm.moveH(-1, \"group\");\n },\n goWordRight: function goWordRight(cm) {\n return cm.moveH(1, \"word\");\n },\n delCharBefore: function delCharBefore(cm) {\n return cm.deleteH(-1, \"char\");\n },\n delCharAfter: function delCharAfter(cm) {\n return cm.deleteH(1, \"char\");\n },\n delWordBefore: function delWordBefore(cm) {\n return cm.deleteH(-1, \"word\");\n },\n delWordAfter: function delWordAfter(cm) {\n return cm.deleteH(1, \"word\");\n },\n delGroupBefore: function delGroupBefore(cm) {\n return cm.deleteH(-1, \"group\");\n },\n delGroupAfter: function delGroupAfter(cm) {\n return cm.deleteH(1, \"group\");\n },\n indentAuto: function indentAuto(cm) {\n return cm.indentSelection(\"smart\");\n },\n indentMore: function indentMore(cm) {\n return cm.indentSelection(\"add\");\n },\n indentLess: function indentLess(cm) {\n return cm.indentSelection(\"subtract\");\n },\n insertTab: function insertTab(cm) {\n return cm.replaceSelection(\"\\t\");\n },\n insertSoftTab: function insertSoftTab(cm) {\n var spaces = [],\n ranges = cm.listSelections(),\n tabSize = cm.options.tabSize;\n\n for (var i = 0; i < ranges.length; i++) {\n var pos = ranges[i].from();\n var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);\n spaces.push(spaceStr(tabSize - col % tabSize));\n }\n\n cm.replaceSelections(spaces);\n },\n defaultTab: function defaultTab(cm) {\n if (cm.somethingSelected()) {\n cm.indentSelection(\"add\");\n } else {\n cm.execCommand(\"insertTab\");\n }\n },\n // Swap the two chars left and right of each selection's head.\n // Move cursor behind the two swapped characters afterwards.\n //\n // Doesn't consider line feeds a character.\n // Doesn't scan more than one line above to find a character.\n // Doesn't do anything on an empty line.\n // Doesn't do anything with non-empty selections.\n transposeChars: function transposeChars(cm) {\n return runInOp(cm, function () {\n var ranges = cm.listSelections(),\n newSel = [];\n\n for (var i = 0; i < ranges.length; i++) {\n if (!ranges[i].empty()) {\n continue;\n }\n\n var cur = ranges[i].head,\n line = getLine(cm.doc, cur.line).text;\n\n if (line) {\n if (cur.ch == line.length) {\n cur = new Pos(cur.line, cur.ch - 1);\n }\n\n if (cur.ch > 0) {\n cur = new Pos(cur.line, cur.ch + 1);\n cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2), Pos(cur.line, cur.ch - 2), cur, \"+transpose\");\n } else if (cur.line > cm.doc.first) {\n var prev = getLine(cm.doc, cur.line - 1).text;\n\n if (prev) {\n cur = new Pos(cur.line, 1);\n cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() + prev.charAt(prev.length - 1), Pos(cur.line - 1, prev.length - 1), cur, \"+transpose\");\n }\n }\n }\n\n newSel.push(new Range(cur, cur));\n }\n\n cm.setSelections(newSel);\n });\n },\n newlineAndIndent: function newlineAndIndent(cm) {\n return runInOp(cm, function () {\n var sels = cm.listSelections();\n\n for (var i = sels.length - 1; i >= 0; i--) {\n cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, \"+input\");\n }\n\n sels = cm.listSelections();\n\n for (var i$1 = 0; i$1 < sels.length; i$1++) {\n cm.indentLine(sels[i$1].from().line, null, true);\n }\n\n ensureCursorVisible(cm);\n });\n },\n openLine: function openLine(cm) {\n return cm.replaceSelection(\"\\n\", \"start\");\n },\n toggleOverwrite: function toggleOverwrite(cm) {\n return cm.toggleOverwrite();\n }\n };\n\n function lineStart(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLine(line);\n\n if (visual != line) {\n lineN = lineNo(visual);\n }\n\n return endOfLine(true, cm, visual, lineN, 1);\n }\n\n function lineEnd(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLineEnd(line);\n\n if (visual != line) {\n lineN = lineNo(visual);\n }\n\n return endOfLine(true, cm, line, lineN, -1);\n }\n\n function lineStartSmart(cm, pos) {\n var start = lineStart(cm, pos.line);\n var line = getLine(cm.doc, start.line);\n var order = getOrder(line, cm.doc.direction);\n\n if (!order || order[0].level == 0) {\n var firstNonWS = Math.max(start.ch, line.text.search(/\\S/));\n var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;\n return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky);\n }\n\n return start;\n } // Run a handler that was bound to a key.\n\n\n function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n\n if (!bound) {\n return false;\n }\n } // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n\n\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift,\n done = false;\n\n try {\n if (cm.isReadOnly()) {\n cm.state.suppressEdits = true;\n }\n\n if (dropShift) {\n cm.display.shift = false;\n }\n\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n\n return done;\n }\n\n function lookupKeyForEditor(cm, name, handle) {\n for (var i = 0; i < cm.state.keyMaps.length; i++) {\n var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);\n\n if (result) {\n return result;\n }\n }\n\n return cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm) || lookupKey(name, cm.options.keyMap, handle, cm);\n } // Note that, despite the name, this function is also used to check\n // for bound mouse clicks.\n\n\n var stopSeq = new Delayed();\n\n function dispatchKey(cm, name, e, handle) {\n var seq = cm.state.keySeq;\n\n if (seq) {\n if (isModifierKey(name)) {\n return \"handled\";\n }\n\n if (/\\'$/.test(name)) {\n cm.state.keySeq = null;\n } else {\n stopSeq.set(50, function () {\n if (cm.state.keySeq == seq) {\n cm.state.keySeq = null;\n cm.display.input.reset();\n }\n });\n }\n\n if (dispatchKeyInner(cm, seq + \" \" + name, e, handle)) {\n return true;\n }\n }\n\n return dispatchKeyInner(cm, name, e, handle);\n }\n\n function dispatchKeyInner(cm, name, e, handle) {\n var result = lookupKeyForEditor(cm, name, handle);\n\n if (result == \"multi\") {\n cm.state.keySeq = name;\n }\n\n if (result == \"handled\") {\n signalLater(cm, \"keyHandled\", cm, name, e);\n }\n\n if (result == \"handled\" || result == \"multi\") {\n e_preventDefault(e);\n restartBlink(cm);\n }\n\n return !!result;\n } // Handle a key from the keydown event.\n\n\n function handleKeyBinding(cm, e) {\n var name = keyName(e, true);\n\n if (!name) {\n return false;\n }\n\n if (e.shiftKey && !cm.state.keySeq) {\n // First try to resolve full name (including 'Shift-'). Failing\n // that, see if there is a cursor-motion command (starting with\n // 'go') bound to the keyname without 'Shift-'.\n return dispatchKey(cm, \"Shift-\" + name, e, function (b) {\n return doHandleBinding(cm, b, true);\n }) || dispatchKey(cm, name, e, function (b) {\n if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion) {\n return doHandleBinding(cm, b);\n }\n });\n } else {\n return dispatchKey(cm, name, e, function (b) {\n return doHandleBinding(cm, b);\n });\n }\n } // Handle a key from the keypress event\n\n\n function handleCharBinding(cm, e, ch) {\n return dispatchKey(cm, \"'\" + ch + \"'\", e, function (b) {\n return doHandleBinding(cm, b, true);\n });\n }\n\n var lastStoppedKey = null;\n\n function onKeyDown(e) {\n var cm = this;\n cm.curOp.focus = activeElt();\n\n if (signalDOMEvent(cm, e)) {\n return;\n } // IE does strange things with escape.\n\n\n if (ie && ie_version < 11 && e.keyCode == 27) {\n e.returnValue = false;\n }\n\n var code = e.keyCode;\n cm.display.shift = code == 16 || e.shiftKey;\n var handled = handleKeyBinding(cm, e);\n\n if (presto) {\n lastStoppedKey = handled ? code : null; // Opera has no cut event... we try to at least catch the key combo\n\n if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey)) {\n cm.replaceSelection(\"\", null, \"cut\");\n }\n }\n\n if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand) {\n document.execCommand(\"cut\");\n } // Turn mouse into crosshair when Alt is held on Mac.\n\n\n if (code == 18 && !/\\bCodeMirror-crosshair\\b/.test(cm.display.lineDiv.className)) {\n showCrossHair(cm);\n }\n }\n\n function showCrossHair(cm) {\n var lineDiv = cm.display.lineDiv;\n addClass(lineDiv, \"CodeMirror-crosshair\");\n\n function up(e) {\n if (e.keyCode == 18 || !e.altKey) {\n rmClass(lineDiv, \"CodeMirror-crosshair\");\n off(document, \"keyup\", up);\n off(document, \"mouseover\", up);\n }\n }\n\n on(document, \"keyup\", up);\n on(document, \"mouseover\", up);\n }\n\n function onKeyUp(e) {\n if (e.keyCode == 16) {\n this.doc.sel.shift = false;\n }\n\n signalDOMEvent(this, e);\n }\n\n function onKeyPress(e) {\n var cm = this;\n\n if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) {\n return;\n }\n\n var keyCode = e.keyCode,\n charCode = e.charCode;\n\n if (presto && keyCode == lastStoppedKey) {\n lastStoppedKey = null;\n e_preventDefault(e);\n return;\n }\n\n if (presto && (!e.which || e.which < 10) && handleKeyBinding(cm, e)) {\n return;\n }\n\n var ch = String.fromCharCode(charCode == null ? keyCode : charCode); // Some browsers fire keypress events for backspace\n\n if (ch == \"\\x08\") {\n return;\n }\n\n if (handleCharBinding(cm, e, ch)) {\n return;\n }\n\n cm.display.input.onKeyPress(e);\n }\n\n var DOUBLECLICK_DELAY = 400;\n\n var PastClick = function PastClick(time, pos, button) {\n this.time = time;\n this.pos = pos;\n this.button = button;\n };\n\n PastClick.prototype.compare = function (time, pos, button) {\n return this.time + DOUBLECLICK_DELAY > time && cmp(pos, this.pos) == 0 && button == this.button;\n };\n\n var lastClick, lastDoubleClick;\n\n function clickRepeat(pos, button) {\n var now = +new Date();\n\n if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {\n lastClick = lastDoubleClick = null;\n return \"triple\";\n } else if (lastClick && lastClick.compare(now, pos, button)) {\n lastDoubleClick = new PastClick(now, pos, button);\n lastClick = null;\n return \"double\";\n } else {\n lastClick = new PastClick(now, pos, button);\n lastDoubleClick = null;\n return \"single\";\n }\n } // A mouse down can be a single click, double click, triple click,\n // start of selection drag, start of text drag, new cursor\n // (ctrl-click), rectangle drag (alt-drag), or xwin\n // middle-click-paste. Or it might be a click on something we should\n // not interfere with, such as a scrollbar or widget.\n\n\n function onMouseDown(e) {\n var cm = this,\n display = cm.display;\n\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) {\n return;\n }\n\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () {\n return display.scroller.draggable = true;\n }, 100);\n }\n\n return;\n }\n\n if (clickInGutter(cm, e)) {\n return;\n }\n\n var pos = posFromMouse(cm, e),\n button = e_button(e),\n repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus(); // #3261: make sure, that we're not starting a second selection\n\n if (button == 1 && cm.state.selectingText) {\n cm.state.selectingText(e);\n }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) {\n return;\n }\n\n if (button == 1) {\n if (pos) {\n leftButtonDown(cm, pos, repeat, e);\n } else if (e_target(e) == display.scroller) {\n e_preventDefault(e);\n }\n } else if (button == 2) {\n if (pos) {\n extendSelection(cm.doc, pos);\n }\n\n setTimeout(function () {\n return display.input.focus();\n }, 20);\n } else if (button == 3) {\n if (captureRightClick) {\n cm.display.input.onContextMenu(e);\n } else {\n delayBlurEvent(cm);\n }\n }\n }\n\n function handleMappedButton(cm, button, pos, repeat, event) {\n var name = \"Click\";\n\n if (repeat == \"double\") {\n name = \"Double\" + name;\n } else if (repeat == \"triple\") {\n name = \"Triple\" + name;\n }\n\n name = (button == 1 ? \"Left\" : button == 2 ? \"Middle\" : \"Right\") + name;\n return dispatchKey(cm, addModifierNames(name, event), event, function (bound) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n }\n\n if (!bound) {\n return false;\n }\n\n var done = false;\n\n try {\n if (cm.isReadOnly()) {\n cm.state.suppressEdits = true;\n }\n\n done = bound(cm, pos) != Pass;\n } finally {\n cm.state.suppressEdits = false;\n }\n\n return done;\n });\n }\n\n function configureMouse(cm, repeat, event) {\n var option = cm.getOption(\"configureMouse\");\n var value = option ? option(cm, repeat, event) : {};\n\n if (value.unit == null) {\n var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;\n value.unit = rect ? \"rectangle\" : repeat == \"single\" ? \"char\" : repeat == \"double\" ? \"word\" : \"line\";\n }\n\n if (value.extend == null || cm.doc.extend) {\n value.extend = cm.doc.extend || event.shiftKey;\n }\n\n if (value.addNew == null) {\n value.addNew = mac ? event.metaKey : event.ctrlKey;\n }\n\n if (value.moveOnDrag == null) {\n value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey);\n }\n\n return value;\n }\n\n function leftButtonDown(cm, pos, repeat, event) {\n if (ie) {\n setTimeout(bind(ensureFocus, cm), 0);\n } else {\n cm.curOp.focus = activeElt();\n }\n\n var behavior = configureMouse(cm, repeat, event);\n var sel = cm.doc.sel,\n contained;\n\n if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() && repeat == \"single\" && (contained = sel.contains(pos)) > -1 && (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) && (cmp(contained.to(), pos) > 0 || pos.xRel < 0)) {\n leftButtonStartDrag(cm, event, pos, behavior);\n } else {\n leftButtonSelect(cm, event, pos, behavior);\n }\n } // Start a text drag. When it ends, see if any dragging actually\n // happen, and treat as a click if it didn't.\n\n\n function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display,\n moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) {\n display.scroller.draggable = false;\n }\n\n cm.state.draggingText = false;\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n\n if (!moved) {\n e_preventDefault(e);\n\n if (!behavior.addNew) {\n extendSelection(cm.doc, pos, null, null, behavior.extend);\n } // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n\n\n if (webkit || ie && ie_version == 9) {\n setTimeout(function () {\n display.wrapper.ownerDocument.body.focus();\n display.input.focus();\n }, 20);\n } else {\n display.input.focus();\n }\n }\n });\n\n var mouseMove = function mouseMove(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n\n var dragStart = function dragStart() {\n return moved = true;\n }; // Let the drag handler handle this.\n\n\n if (webkit) {\n display.scroller.draggable = true;\n }\n\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag; // IE's approach to draggable\n\n if (display.scroller.dragDrop) {\n display.scroller.dragDrop();\n }\n\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n delayBlurEvent(cm);\n setTimeout(function () {\n return display.input.focus();\n }, 20);\n }\n\n function rangeForUnit(cm, pos, unit) {\n if (unit == \"char\") {\n return new Range(pos, pos);\n }\n\n if (unit == \"word\") {\n return cm.findWordAt(pos);\n }\n\n if (unit == \"line\") {\n return new Range(Pos(pos.line, 0), _clipPos(cm.doc, Pos(pos.line + 1, 0)));\n }\n\n var result = unit(cm, pos);\n return new Range(result.from, result.to);\n } // Normal selection, as opposed to text dragging.\n\n\n function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display,\n doc = cm.doc;\n e_preventDefault(event);\n var ourRange,\n ourIndex,\n startSel = doc.sel,\n ranges = startSel.ranges;\n\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n\n if (ourIndex > -1) {\n ourRange = ranges[ourIndex];\n } else {\n ourRange = new Range(start, start);\n }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) {\n ourRange = new Range(start, start);\n }\n\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range = rangeForUnit(cm, start, behavior.unit);\n\n if (behavior.extend) {\n ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend);\n } else {\n ourRange = range;\n }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex), {\n scroll: false,\n origin: \"*mouse\"\n });\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0), {\n scroll: false,\n origin: \"*mouse\"\n });\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) {\n return;\n }\n\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [],\n tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol),\n right = Math.max(startCol, posCol);\n\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); line <= end; line++) {\n var text = getLine(doc, line).text,\n leftPos = findColumn(text, left, tabSize);\n\n if (left == right) {\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n } else if (text.length > leftPos) {\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n }\n\n if (!ranges.length) {\n ranges.push(new Range(start, start));\n }\n\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), {\n origin: \"*mouse\",\n scroll: false\n });\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor,\n head;\n\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(_clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect(); // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n\n if (!cur) {\n return;\n }\n\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n\n if (cur.line >= visible.to || cur.line < visible.from) {\n setTimeout(operation(cm, function () {\n if (counter == curCount) {\n extend(e);\n }\n }), 150);\n }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n\n if (outside) {\n setTimeout(operation(cm, function () {\n if (counter != curCount) {\n return;\n }\n\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity; // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) {\n done(e);\n } else {\n extend(e);\n }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n } // Used when mouse-selecting to adjust the anchor to the proper side\n // of a bidi jump depending on the visual position of the head.\n\n\n function bidiSimplify(cm, range) {\n var anchor = range.anchor;\n var head = range.head;\n var anchorLine = getLine(cm.doc, anchor.line);\n\n if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) {\n return range;\n }\n\n var order = getOrder(anchorLine);\n\n if (!order) {\n return range;\n }\n\n var index = getBidiPartAt(order, anchor.ch, anchor.sticky),\n part = order[index];\n\n if (part.from != anchor.ch && part.to != anchor.ch) {\n return range;\n }\n\n var boundary = index + (part.from == anchor.ch == (part.level != 1) ? 0 : 1);\n\n if (boundary == 0 || boundary == order.length) {\n return range;\n } // Compute the relative visual position of the head compared to the\n // anchor (<0 is to the left, >0 to the right)\n\n\n var leftSide;\n\n if (head.line != anchor.line) {\n leftSide = (head.line - anchor.line) * (cm.doc.direction == \"ltr\" ? 1 : -1) > 0;\n } else {\n var headIndex = getBidiPartAt(order, head.ch, head.sticky);\n var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);\n\n if (headIndex == boundary - 1 || headIndex == boundary) {\n leftSide = dir < 0;\n } else {\n leftSide = dir > 0;\n }\n }\n\n var usePart = order[boundary + (leftSide ? -1 : 0)];\n var from = leftSide == (usePart.level == 1);\n var ch = from ? usePart.from : usePart.to,\n sticky = from ? \"after\" : \"before\";\n return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head);\n } // Determines whether an event happened in the gutter, and fires the\n // handlers for the corresponding event.\n\n\n function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try {\n mX = e.clientX;\n mY = e.clientY;\n } catch (e) {\n return false;\n }\n }\n\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) {\n return false;\n }\n\n if (prevent) {\n e_preventDefault(e);\n }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) {\n return e_defaultPrevented(e);\n }\n\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = _lineAtHeight(cm.doc, mY);\n\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e);\n }\n }\n }\n\n function clickInGutter(cm, e) {\n return gutterEvent(cm, e, \"gutterClick\", true);\n } // CONTEXT MENU HANDLING\n // To make the context menu work, we need to briefly unhide the\n // textarea (making it as unobtrusive as possible) to let the\n // right-click take effect on it.\n\n\n function onContextMenu(cm, e) {\n if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) {\n return;\n }\n\n if (signalDOMEvent(cm, e, \"contextmenu\")) {\n return;\n }\n\n if (!captureRightClick) {\n cm.display.input.onContextMenu(e);\n }\n }\n\n function contextMenuInGutter(cm, e) {\n if (!hasHandler(cm, \"gutterContextMenu\")) {\n return false;\n }\n\n return gutterEvent(cm, e, \"gutterContextMenu\", false);\n }\n\n function themeChanged(cm) {\n cm.display.wrapper.className = cm.display.wrapper.className.replace(/\\s*cm-s-\\S+/g, \"\") + cm.options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n clearCaches(cm);\n }\n\n var Init = {\n toString: function toString() {\n return \"CodeMirror.Init\";\n }\n };\n var defaults = {};\n var optionHandlers = {};\n\n function defineOptions(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n function option(name, deflt, handle, notOnInit) {\n CodeMirror.defaults[name] = deflt;\n\n if (handle) {\n optionHandlers[name] = notOnInit ? function (cm, val, old) {\n if (old != Init) {\n handle(cm, val, old);\n }\n } : handle;\n }\n }\n\n CodeMirror.defineOption = option; // Passed to option handlers when there is no old value.\n\n CodeMirror.Init = Init; // These two are, on init, called from the constructor because they\n // have to be initialized before the editor can start at all.\n\n option(\"value\", \"\", function (cm, val) {\n return cm.setValue(val);\n }, true);\n option(\"mode\", null, function (cm, val) {\n cm.doc.modeOption = val;\n loadMode(cm);\n }, true);\n option(\"indentUnit\", 2, loadMode, true);\n option(\"indentWithTabs\", false);\n option(\"smartIndent\", true);\n option(\"tabSize\", 4, function (cm) {\n resetModeState(cm);\n clearCaches(cm);\n regChange(cm);\n }, true);\n option(\"lineSeparator\", null, function (cm, val) {\n cm.doc.lineSep = val;\n\n if (!val) {\n return;\n }\n\n var newBreaks = [],\n lineNo = cm.doc.first;\n cm.doc.iter(function (line) {\n for (var pos = 0;;) {\n var found = line.text.indexOf(val, pos);\n\n if (found == -1) {\n break;\n }\n\n pos = found + val.length;\n newBreaks.push(Pos(lineNo, found));\n }\n\n lineNo++;\n });\n\n for (var i = newBreaks.length - 1; i >= 0; i--) {\n _replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length));\n }\n });\n option(\"specialChars\", /[\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u061c\\u200b-\\u200f\\u2028\\u2029\\ufeff\\ufff9-\\ufffc]/g, function (cm, val, old) {\n cm.state.specialChars = new RegExp(val.source + (val.test(\"\\t\") ? \"\" : \"|\\t\"), \"g\");\n\n if (old != Init) {\n cm.refresh();\n }\n });\n option(\"specialCharPlaceholder\", defaultSpecialCharPlaceholder, function (cm) {\n return cm.refresh();\n }, true);\n option(\"electricChars\", true);\n option(\"inputStyle\", mobile ? \"contenteditable\" : \"textarea\", function () {\n throw new Error(\"inputStyle can not (yet) be changed in a running editor\"); // FIXME\n }, true);\n option(\"spellcheck\", false, function (cm, val) {\n return cm.getInputField().spellcheck = val;\n }, true);\n option(\"autocorrect\", false, function (cm, val) {\n return cm.getInputField().autocorrect = val;\n }, true);\n option(\"autocapitalize\", false, function (cm, val) {\n return cm.getInputField().autocapitalize = val;\n }, true);\n option(\"rtlMoveVisually\", !windows);\n option(\"wholeLineUpdateBefore\", true);\n option(\"theme\", \"default\", function (cm) {\n themeChanged(cm);\n updateGutters(cm);\n }, true);\n option(\"keyMap\", \"default\", function (cm, val, old) {\n var next = getKeyMap(val);\n var prev = old != Init && getKeyMap(old);\n\n if (prev && prev.detach) {\n prev.detach(cm, next);\n }\n\n if (next.attach) {\n next.attach(cm, prev || null);\n }\n });\n option(\"extraKeys\", null);\n option(\"configureMouse\", null);\n option(\"lineWrapping\", false, wrappingChanged, true);\n option(\"gutters\", [], function (cm, val) {\n cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers);\n updateGutters(cm);\n }, true);\n option(\"fixedGutter\", true, function (cm, val) {\n cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + \"px\" : \"0\";\n cm.refresh();\n }, true);\n option(\"coverGutterNextToScrollbar\", false, function (cm) {\n return updateScrollbars(cm);\n }, true);\n option(\"scrollbarStyle\", \"native\", function (cm) {\n initScrollbars(cm);\n updateScrollbars(cm);\n cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);\n cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);\n }, true);\n option(\"lineNumbers\", false, function (cm, val) {\n cm.display.gutterSpecs = getGutters(cm.options.gutters, val);\n updateGutters(cm);\n }, true);\n option(\"firstLineNumber\", 1, updateGutters, true);\n option(\"lineNumberFormatter\", function (integer) {\n return integer;\n }, updateGutters, true);\n option(\"showCursorWhenSelecting\", false, updateSelection, true);\n option(\"resetSelectionOnContextMenu\", true);\n option(\"lineWiseCopyCut\", true);\n option(\"pasteLinesPerSelection\", true);\n option(\"selectionsMayTouch\", false);\n option(\"readOnly\", false, function (cm, val) {\n if (val == \"nocursor\") {\n onBlur(cm);\n cm.display.input.blur();\n }\n\n cm.display.input.readOnlyChanged(val);\n });\n option(\"disableInput\", false, function (cm, val) {\n if (!val) {\n cm.display.input.reset();\n }\n }, true);\n option(\"dragDrop\", true, dragDropChanged);\n option(\"allowDropFileTypes\", null);\n option(\"cursorBlinkRate\", 530);\n option(\"cursorScrollMargin\", 0);\n option(\"cursorHeight\", 1, updateSelection, true);\n option(\"singleCursorHeightPerLine\", true, updateSelection, true);\n option(\"workTime\", 100);\n option(\"workDelay\", 100);\n option(\"flattenSpans\", true, resetModeState, true);\n option(\"addModeClass\", false, resetModeState, true);\n option(\"pollInterval\", 100);\n option(\"undoDepth\", 200, function (cm, val) {\n return cm.doc.history.undoDepth = val;\n });\n option(\"historyEventDelay\", 1250);\n option(\"viewportMargin\", 10, function (cm) {\n return cm.refresh();\n }, true);\n option(\"maxHighlightLength\", 10000, resetModeState, true);\n option(\"moveInputWithCursor\", true, function (cm, val) {\n if (!val) {\n cm.display.input.resetPosition();\n }\n });\n option(\"tabindex\", null, function (cm, val) {\n return cm.display.input.getField().tabIndex = val || \"\";\n });\n option(\"autofocus\", null);\n option(\"direction\", \"ltr\", function (cm, val) {\n return cm.doc.setDirection(val);\n }, true);\n option(\"phrases\", null);\n }\n\n function dragDropChanged(cm, value, old) {\n var wasOn = old && old != Init;\n\n if (!value != !wasOn) {\n var funcs = cm.display.dragFunctions;\n var toggle = value ? on : off;\n toggle(cm.display.scroller, \"dragstart\", funcs.start);\n toggle(cm.display.scroller, \"dragenter\", funcs.enter);\n toggle(cm.display.scroller, \"dragover\", funcs.over);\n toggle(cm.display.scroller, \"dragleave\", funcs.leave);\n toggle(cm.display.scroller, \"drop\", funcs.drop);\n }\n }\n\n function wrappingChanged(cm) {\n if (cm.options.lineWrapping) {\n addClass(cm.display.wrapper, \"CodeMirror-wrap\");\n cm.display.sizer.style.minWidth = \"\";\n cm.display.sizerWidth = null;\n } else {\n rmClass(cm.display.wrapper, \"CodeMirror-wrap\");\n findMaxLine(cm);\n }\n\n estimateLineHeights(cm);\n regChange(cm);\n clearCaches(cm);\n setTimeout(function () {\n return updateScrollbars(cm);\n }, 100);\n } // A CodeMirror instance represents an editor. This is the object\n // that user code is usually dealing with.\n\n\n function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) {\n return new CodeMirror(place, options);\n }\n\n this.options = options = options ? copyObj(options) : {}; // Determine effective options based on given values and defaults.\n\n copyObj(defaults, options, false);\n var doc = options.value;\n\n if (typeof doc == \"string\") {\n doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction);\n } else if (options.mode) {\n doc.modeOption = options.mode;\n }\n\n this.doc = doc;\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n\n if (options.lineWrapping) {\n this.display.wrapper.className += \" CodeMirror-wrap\";\n }\n\n initScrollbars(this);\n this.state = {\n keyMaps: [],\n // stores maps added by addKeyMap\n overlays: [],\n // highlighting overlays, as added by addOverlay\n modeGen: 0,\n // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false,\n // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1,\n cutIncoming: -1,\n // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(),\n // stores highlight worker timeout\n keySeq: null,\n // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) {\n display.input.focus();\n } // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n\n\n if (ie && ie_version < 11) {\n setTimeout(function () {\n return this$1.display.input.reset(true);\n }, 20);\n }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n _startOperation(this);\n\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if (options.autofocus && !mobile || this.hasFocus()) {\n setTimeout(bind(onFocus, this), 20);\n } else {\n onBlur(this);\n }\n\n for (var opt in optionHandlers) {\n if (optionHandlers.hasOwnProperty(opt)) {\n optionHandlers[opt](this, options[opt], Init);\n }\n }\n\n maybeUpdateLineNumberWidth(this);\n\n if (options.finishInit) {\n options.finishInit(this);\n }\n\n for (var i = 0; i < initHooks.length; ++i) {\n initHooks[i](this);\n }\n\n _endOperation(this); // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n\n\n if (webkit && options.lineWrapping && getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\") {\n display.lineDiv.style.textRendering = \"auto\";\n }\n } // The default configuration options.\n\n\n CodeMirror.defaults = defaults; // Functions to run when options are changed.\n\n CodeMirror.optionHandlers = optionHandlers; // Attach the necessary event handlers when initializing the editor\n\n function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown)); // Older IE's will not fire a second mousedown for a double click\n\n if (ie && ie_version < 11) {\n on(d.scroller, \"dblclick\", operation(cm, function (e) {\n if (signalDOMEvent(cm, e)) {\n return;\n }\n\n var pos = posFromMouse(cm, e);\n\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) {\n return;\n }\n\n e_preventDefault(e);\n var word = cm.findWordAt(pos);\n extendSelection(cm.doc, word.anchor, word.head);\n }));\n } else {\n on(d.scroller, \"dblclick\", function (e) {\n return signalDOMEvent(cm, e) || e_preventDefault(e);\n });\n } // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n\n\n on(d.scroller, \"contextmenu\", function (e) {\n return onContextMenu(cm, e);\n });\n on(d.input.getField(), \"contextmenu\", function (e) {\n if (!d.scroller.contains(e.target)) {\n onContextMenu(cm, e);\n }\n }); // Used to suppress mouse event handling when a touch happens\n\n var touchFinished,\n prevTouch = {\n end: 0\n };\n\n function finishTouch() {\n if (d.activeTouch) {\n touchFinished = setTimeout(function () {\n return d.activeTouch = null;\n }, 1000);\n prevTouch = d.activeTouch;\n prevTouch.end = +new Date();\n }\n }\n\n function isMouseLikeTouchEvent(e) {\n if (e.touches.length != 1) {\n return false;\n }\n\n var touch = e.touches[0];\n return touch.radiusX <= 1 && touch.radiusY <= 1;\n }\n\n function farAway(touch, other) {\n if (other.left == null) {\n return true;\n }\n\n var dx = other.left - touch.left,\n dy = other.top - touch.top;\n return dx * dx + dy * dy > 20 * 20;\n }\n\n on(d.scroller, \"touchstart\", function (e) {\n if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {\n d.input.ensurePolled();\n clearTimeout(touchFinished);\n var now = +new Date();\n d.activeTouch = {\n start: now,\n moved: false,\n prev: now - prevTouch.end <= 300 ? prevTouch : null\n };\n\n if (e.touches.length == 1) {\n d.activeTouch.left = e.touches[0].pageX;\n d.activeTouch.top = e.touches[0].pageY;\n }\n }\n });\n on(d.scroller, \"touchmove\", function () {\n if (d.activeTouch) {\n d.activeTouch.moved = true;\n }\n });\n on(d.scroller, \"touchend\", function (e) {\n var touch = d.activeTouch;\n\n if (touch && !eventInWidget(d, e) && touch.left != null && !touch.moved && new Date() - touch.start < 300) {\n var pos = cm.coordsChar(d.activeTouch, \"page\"),\n range;\n\n if (!touch.prev || farAway(touch, touch.prev)) // Single tap\n {\n range = new Range(pos, pos);\n } else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap\n {\n range = cm.findWordAt(pos);\n } else // Triple tap\n {\n range = new Range(Pos(pos.line, 0), _clipPos(cm.doc, Pos(pos.line + 1, 0)));\n }\n\n cm.setSelection(range.anchor, range.head);\n cm.focus();\n e_preventDefault(e);\n }\n\n finishTouch();\n });\n on(d.scroller, \"touchcancel\", finishTouch); // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n\n on(d.scroller, \"scroll\", function () {\n if (d.scroller.clientHeight) {\n updateScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n }); // Listen to wheel events in order to try and update the viewport on time.\n\n on(d.scroller, \"mousewheel\", function (e) {\n return onScrollWheel(cm, e);\n });\n on(d.scroller, \"DOMMouseScroll\", function (e) {\n return onScrollWheel(cm, e);\n }); // Prevent wrapper from ever scrolling\n\n on(d.wrapper, \"scroll\", function () {\n return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0;\n });\n d.dragFunctions = {\n enter: function enter(e) {\n if (!signalDOMEvent(cm, e)) {\n e_stop(e);\n }\n },\n over: function over(e) {\n if (!signalDOMEvent(cm, e)) {\n onDragOver(cm, e);\n e_stop(e);\n }\n },\n start: function start(e) {\n return onDragStart(cm, e);\n },\n drop: operation(cm, onDrop),\n leave: function leave(e) {\n if (!signalDOMEvent(cm, e)) {\n clearDragCursor(cm);\n }\n }\n };\n var inp = d.input.getField();\n on(inp, \"keyup\", function (e) {\n return onKeyUp.call(cm, e);\n });\n on(inp, \"keydown\", operation(cm, onKeyDown));\n on(inp, \"keypress\", operation(cm, onKeyPress));\n on(inp, \"focus\", function (e) {\n return onFocus(cm, e);\n });\n on(inp, \"blur\", function (e) {\n return onBlur(cm, e);\n });\n }\n\n var initHooks = [];\n\n CodeMirror.defineInitHook = function (f) {\n return initHooks.push(f);\n }; // Indent the given line. The how parameter can be \"smart\",\n // \"add\"/null, \"subtract\", or \"prev\". When aggressive is false\n // (typically set to true for forced single-line indents), empty\n // lines are not indented, and places where the mode returns Pass\n // are left alone.\n\n\n function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc,\n state;\n\n if (how == null) {\n how = \"add\";\n }\n\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) {\n how = \"prev\";\n } else {\n state = getContextBefore(cm, n).state;\n }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n),\n curSpace = countColumn(line.text, null, tabSize);\n\n if (line.stateAfter) {\n line.stateAfter = null;\n }\n\n var curSpaceString = line.text.match(/^\\s*/)[0],\n indentation;\n\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) {\n return;\n }\n\n how = \"prev\";\n }\n }\n\n if (how == \"prev\") {\n if (n > doc.first) {\n indentation = countColumn(getLine(doc, n - 1).text, null, tabSize);\n } else {\n indentation = 0;\n }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n\n indentation = Math.max(0, indentation);\n var indentString = \"\",\n pos = 0;\n\n if (cm.options.indentWithTabs) {\n for (var i = Math.floor(indentation / tabSize); i; --i) {\n pos += tabSize;\n indentString += \"\\t\";\n }\n }\n\n if (pos < indentation) {\n indentString += spaceStr(indentation - pos);\n }\n\n if (indentString != curSpaceString) {\n _replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n\n line.stateAfter = null;\n return true;\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break;\n }\n }\n }\n } // This will be set to a {lineWise: bool, text: [string]} object, so\n // that, when pasting, we know what kind of selections the copied\n // text was made out of.\n\n\n var lastCopied = null;\n\n function setLastCopied(newLastCopied) {\n lastCopied = newLastCopied;\n }\n\n function applyTextInput(cm, inserted, deleted, sel, origin) {\n var doc = cm.doc;\n cm.display.shift = false;\n\n if (!sel) {\n sel = doc.sel;\n }\n\n var recent = +new Date() - 200;\n var paste = origin == \"paste\" || cm.state.pasteIncoming > recent;\n var textLines = splitLinesAuto(inserted),\n multiPaste = null; // When pasting N lines into N selections, insert one line per selection\n\n if (paste && sel.ranges.length > 1) {\n if (lastCopied && lastCopied.text.join(\"\\n\") == inserted) {\n if (sel.ranges.length % lastCopied.text.length == 0) {\n multiPaste = [];\n\n for (var i = 0; i < lastCopied.text.length; i++) {\n multiPaste.push(doc.splitLines(lastCopied.text[i]));\n }\n }\n } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {\n multiPaste = map(textLines, function (l) {\n return [l];\n });\n }\n }\n\n var updateInput = cm.curOp.updateInput; // Normal behavior is to insert the new text into every selection\n\n for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {\n var range = sel.ranges[i$1];\n var from = range.from(),\n to = range.to();\n\n if (range.empty()) {\n if (deleted && deleted > 0) // Handle deletion\n {\n from = Pos(from.line, from.ch - deleted);\n } else if (cm.state.overwrite && !paste) // Handle overwrite\n {\n to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length));\n } else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join(\"\\n\") == inserted) {\n from = to = Pos(from.line, 0);\n }\n }\n\n var changeEvent = {\n from: from,\n to: to,\n text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,\n origin: origin || (paste ? \"paste\" : cm.state.cutIncoming > recent ? \"cut\" : \"+input\")\n };\n makeChange(cm.doc, changeEvent);\n signalLater(cm, \"inputRead\", cm, changeEvent);\n }\n\n if (inserted && !paste) {\n triggerElectric(cm, inserted);\n }\n\n ensureCursorVisible(cm);\n\n if (cm.curOp.updateInput < 2) {\n cm.curOp.updateInput = updateInput;\n }\n\n cm.curOp.typing = true;\n cm.state.pasteIncoming = cm.state.cutIncoming = -1;\n }\n\n function handlePaste(e, cm) {\n var pasted = e.clipboardData && e.clipboardData.getData(\"Text\");\n\n if (pasted) {\n e.preventDefault();\n\n if (!cm.isReadOnly() && !cm.options.disableInput) {\n runInOp(cm, function () {\n return applyTextInput(cm, pasted, 0, null, \"paste\");\n });\n }\n\n return true;\n }\n }\n\n function triggerElectric(cm, inserted) {\n // When an 'electric' character is inserted, immediately trigger a reindent\n if (!cm.options.electricChars || !cm.options.smartIndent) {\n return;\n }\n\n var sel = cm.doc.sel;\n\n for (var i = sel.ranges.length - 1; i >= 0; i--) {\n var range = sel.ranges[i];\n\n if (range.head.ch > 100 || i && sel.ranges[i - 1].head.line == range.head.line) {\n continue;\n }\n\n var mode = cm.getModeAt(range.head);\n var indented = false;\n\n if (mode.electricChars) {\n for (var j = 0; j < mode.electricChars.length; j++) {\n if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {\n indented = indentLine(cm, range.head.line, \"smart\");\n break;\n }\n }\n } else if (mode.electricInput) {\n if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch))) {\n indented = indentLine(cm, range.head.line, \"smart\");\n }\n }\n\n if (indented) {\n signalLater(cm, \"electricInput\", cm, range.head.line);\n }\n }\n }\n\n function copyableRanges(cm) {\n var text = [],\n ranges = [];\n\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {\n anchor: Pos(line, 0),\n head: Pos(line + 1, 0)\n };\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n\n return {\n text: text,\n ranges: ranges\n };\n }\n\n function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {\n field.setAttribute(\"autocorrect\", autocorrect ? \"\" : \"off\");\n field.setAttribute(\"autocapitalize\", autocapitalize ? \"\" : \"off\");\n field.setAttribute(\"spellcheck\", !!spellcheck);\n }\n\n function hiddenTextarea() {\n var te = elt(\"textarea\", null, null, \"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none\");\n var div = elt(\"div\", [te], null, \"overflow: hidden; position: relative; width: 3px; height: 0px;\"); // The textarea is kept positioned near the cursor to prevent the\n // fact that it'll be scrolled into view on input from scrolling\n // our fake cursor out of view. On webkit, when wrap=off, paste is\n // very slow. So make the area wide instead.\n\n if (webkit) {\n te.style.width = \"1000px\";\n } else {\n te.setAttribute(\"wrap\", \"off\");\n } // If border: 0; -- iOS fails to open keyboard (issue #1287)\n\n\n if (ios) {\n te.style.border = \"1px solid black\";\n }\n\n disableBrowserMagic(te);\n return div;\n } // The publicly visible API. Note that methodOp(f) means\n // 'wrap f in an operation, performed on its `this` parameter'.\n // This is not the complete set of editor methods. Most of the\n // methods defined on the Doc type are also injected into\n // CodeMirror.prototype, for backwards compatibility and\n // convenience.\n\n\n function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n var helpers = CodeMirror.helpers = {};\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function focus() {\n window.focus();\n this.display.input.focus();\n },\n setOption: function setOption(option, value) {\n var options = this.options,\n old = options[option];\n\n if (options[option] == value && option != \"mode\") {\n return;\n }\n\n options[option] = value;\n\n if (optionHandlers.hasOwnProperty(option)) {\n operation(this, optionHandlers[option])(this, value, old);\n }\n\n signal(this, \"optionChange\", this, option);\n },\n getOption: function getOption(option) {\n return this.options[option];\n },\n getDoc: function getDoc() {\n return this.doc;\n },\n addKeyMap: function addKeyMap(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function removeKeyMap(map) {\n var maps = this.state.keyMaps;\n\n for (var i = 0; i < maps.length; ++i) {\n if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true;\n }\n }\n },\n addOverlay: methodOp(function (spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n\n if (mode.startState) {\n throw new Error(\"Overlays may not be stateful.\");\n }\n\n insertSorted(this.state.overlays, {\n mode: mode,\n modeSpec: spec,\n opaque: options && options.opaque,\n priority: options && options.priority || 0\n }, function (overlay) {\n return overlay.priority;\n });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function (spec) {\n var overlays = this.state.overlays;\n\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return;\n }\n }\n }),\n indentLine: methodOp(function (n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) {\n dir = this.options.smartIndent ? \"smart\" : \"prev\";\n } else {\n dir = dir ? \"add\" : \"subtract\";\n }\n }\n\n if (isLine(this.doc, n)) {\n indentLine(this, n, dir, aggressive);\n }\n }),\n indentSelection: methodOp(function (how) {\n var ranges = this.doc.sel.ranges,\n end = -1;\n\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n\n if (!range.empty()) {\n var from = range.from(),\n to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n\n for (var j = start; j < end; ++j) {\n indentLine(this, j, how);\n }\n\n var newRanges = this.doc.sel.ranges;\n\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) {\n replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll);\n }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n\n if (i == this.doc.sel.primIndex) {\n ensureCursorVisible(this);\n }\n }\n }\n }),\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function getTokenAt(pos, precise) {\n return takeToken(this, pos, precise);\n },\n getLineTokens: function getLineTokens(line, precise) {\n return takeToken(this, Pos(line), precise, true);\n },\n getTokenTypeAt: function getTokenTypeAt(pos) {\n pos = _clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0,\n after = (styles.length - 1) / 2,\n ch = pos.ch;\n var type;\n\n if (ch == 0) {\n type = styles[2];\n } else {\n for (;;) {\n var mid = before + after >> 1;\n\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) {\n after = mid;\n } else if (styles[mid * 2 + 1] < ch) {\n before = mid + 1;\n } else {\n type = styles[mid * 2 + 2];\n break;\n }\n }\n }\n\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1);\n },\n getModeAt: function getModeAt(pos) {\n var mode = this.doc.mode;\n\n if (!mode.innerMode) {\n return mode;\n }\n\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode;\n },\n getHelper: function getHelper(pos, type) {\n return this.getHelpers(pos, type)[0];\n },\n getHelpers: function getHelpers(pos, type) {\n var found = [];\n\n if (!helpers.hasOwnProperty(type)) {\n return found;\n }\n\n var help = helpers[type],\n mode = this.getModeAt(pos);\n\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) {\n found.push(help[mode[type]]);\n }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n\n if (val) {\n found.push(val);\n }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1) {\n found.push(cur.val);\n }\n }\n\n return found;\n },\n getStateAfter: function getStateAfter(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1 : line);\n return getContextBefore(this, line + 1, precise).state;\n },\n cursorCoords: function cursorCoords(start, mode) {\n var pos,\n range = this.doc.sel.primary();\n\n if (start == null) {\n pos = range.head;\n } else if (typeof start == \"object\") {\n pos = _clipPos(this.doc, start);\n } else {\n pos = start ? range.from() : range.to();\n }\n\n return _cursorCoords(this, pos, mode || \"page\");\n },\n charCoords: function charCoords(pos, mode) {\n return _charCoords(this, _clipPos(this.doc, pos), mode || \"page\");\n },\n coordsChar: function coordsChar(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return _coordsChar(this, coords.left, coords.top);\n },\n lineAtHeight: function lineAtHeight(height, mode) {\n height = fromCoordSystem(this, {\n top: height,\n left: 0\n }, mode || \"page\").top;\n return _lineAtHeight(this.doc, height + this.display.viewOffset);\n },\n heightAtLine: function heightAtLine(line, mode, includeWidgets) {\n var end = false,\n lineObj;\n\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n\n if (line < this.doc.first) {\n line = this.doc.first;\n } else if (line > last) {\n line = last;\n end = true;\n }\n\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n\n return intoCoordSystem(this, lineObj, {\n top: 0,\n left: 0\n }, mode || \"page\", includeWidgets || end).top + (end ? this.doc.height - _heightAtLine(lineObj) : 0);\n },\n defaultTextHeight: function defaultTextHeight() {\n return textHeight(this.display);\n },\n defaultCharWidth: function defaultCharWidth() {\n return charWidth(this.display);\n },\n getViewport: function getViewport() {\n return {\n from: this.display.viewFrom,\n to: this.display.viewTo\n };\n },\n addWidget: function addWidget(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = _cursorCoords(this, _clipPos(this.doc, pos));\n var top = pos.bottom,\n left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth); // Default to positioning above (if specified and possible); otherwise default to positioning below\n\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) {\n top = pos.top - node.offsetHeight;\n } else if (pos.bottom + node.offsetHeight <= vspace) {\n top = pos.bottom;\n }\n\n if (left + node.offsetWidth > hspace) {\n left = hspace - node.offsetWidth;\n }\n }\n\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") {\n left = 0;\n } else if (horiz == \"middle\") {\n left = (display.sizer.clientWidth - node.offsetWidth) / 2;\n }\n\n node.style.left = left + \"px\";\n }\n\n if (scroll) {\n scrollIntoView(this, {\n left: left,\n top: top,\n right: left + node.offsetWidth,\n bottom: top + node.offsetHeight\n });\n }\n },\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n execCommand: function execCommand(cmd) {\n if (commands.hasOwnProperty(cmd)) {\n return commands[cmd].call(null, this);\n }\n },\n triggerElectric: methodOp(function (text) {\n triggerElectric(this, text);\n }),\n findPosH: function findPosH(from, amount, unit, visually) {\n var dir = 1;\n\n if (amount < 0) {\n dir = -1;\n amount = -amount;\n }\n\n var cur = _clipPos(this.doc, from);\n\n for (var i = 0; i < amount; ++i) {\n cur = _findPosH(this.doc, cur, dir, unit, visually);\n\n if (cur.hitSide) {\n break;\n }\n }\n\n return cur;\n },\n moveH: methodOp(function (dir, unit) {\n var this$1 = this;\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty()) {\n return _findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually);\n } else {\n return dir < 0 ? range.from() : range.to();\n }\n }, sel_move);\n }),\n deleteH: methodOp(function (dir, unit) {\n var sel = this.doc.sel,\n doc = this.doc;\n\n if (sel.somethingSelected()) {\n doc.replaceSelection(\"\", null, \"+delete\");\n } else {\n deleteNearSelection(this, function (range) {\n var other = _findPosH(doc, range.head, dir, unit, false);\n\n return dir < 0 ? {\n from: other,\n to: range.head\n } : {\n from: range.head,\n to: other\n };\n });\n }\n }),\n findPosV: function findPosV(from, amount, unit, goalColumn) {\n var dir = 1,\n x = goalColumn;\n\n if (amount < 0) {\n dir = -1;\n amount = -amount;\n }\n\n var cur = _clipPos(this.doc, from);\n\n for (var i = 0; i < amount; ++i) {\n var coords = _cursorCoords(this, cur, \"div\");\n\n if (x == null) {\n x = coords.left;\n } else {\n coords.left = x;\n }\n\n cur = _findPosV(this, coords, dir, unit);\n\n if (cur.hitSide) {\n break;\n }\n }\n\n return cur;\n },\n moveV: methodOp(function (dir, unit) {\n var this$1 = this;\n var doc = this.doc,\n goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse) {\n return dir < 0 ? range.from() : range.to();\n }\n\n var headPos = _cursorCoords(this$1, range.head, \"div\");\n\n if (range.goalColumn != null) {\n headPos.left = range.goalColumn;\n }\n\n goals.push(headPos.left);\n\n var pos = _findPosV(this$1, headPos, dir, unit);\n\n if (unit == \"page\" && range == doc.sel.primary()) {\n addToScrollTop(this$1, _charCoords(this$1, pos, \"div\").top - headPos.top);\n }\n\n return pos;\n }, sel_move);\n\n if (goals.length) {\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n doc.sel.ranges[i].goalColumn = goals[i];\n }\n }\n }),\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function findWordAt(pos) {\n var doc = this.doc,\n line = getLine(doc, pos.line).text;\n var start = pos.ch,\n end = pos.ch;\n\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n\n if ((pos.sticky == \"before\" || end == line.length) && start) {\n --start;\n } else {\n ++end;\n }\n\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper) ? function (ch) {\n return isWordChar(ch, helper);\n } : /\\s/.test(startChar) ? function (ch) {\n return /\\s/.test(ch);\n } : function (ch) {\n return !/\\s/.test(ch) && !isWordChar(ch);\n };\n\n while (start > 0 && check(line.charAt(start - 1))) {\n --start;\n }\n\n while (end < line.length && check(line.charAt(end))) {\n ++end;\n }\n }\n\n return new Range(Pos(pos.line, start), Pos(pos.line, end));\n },\n toggleOverwrite: function toggleOverwrite(value) {\n if (value != null && value == this.state.overwrite) {\n return;\n }\n\n if (this.state.overwrite = !this.state.overwrite) {\n addClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n } else {\n rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function hasFocus() {\n return this.display.input.getField() == activeElt();\n },\n isReadOnly: function isReadOnly() {\n return !!(this.options.readOnly || this.doc.cantEdit);\n },\n scrollTo: methodOp(function (x, y) {\n scrollToCoords(this, x, y);\n }),\n getScrollInfo: function getScrollInfo() {\n var scroller = this.display.scroller;\n return {\n left: scroller.scrollLeft,\n top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this),\n clientWidth: displayWidth(this)\n };\n },\n scrollIntoView: methodOp(function (range, margin) {\n if (range == null) {\n range = {\n from: this.doc.sel.primary().head,\n to: null\n };\n\n if (margin == null) {\n margin = this.options.cursorScrollMargin;\n }\n } else if (typeof range == \"number\") {\n range = {\n from: Pos(range, 0),\n to: null\n };\n } else if (range.from == null) {\n range = {\n from: range,\n to: null\n };\n }\n\n if (!range.to) {\n range.to = range.from;\n }\n\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n setSize: methodOp(function (width, height) {\n var this$1 = this;\n\n var interpret = function interpret(val) {\n return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val;\n };\n\n if (width != null) {\n this.display.wrapper.style.width = interpret(width);\n }\n\n if (height != null) {\n this.display.wrapper.style.height = interpret(height);\n }\n\n if (this.options.lineWrapping) {\n clearLineMeasurementCache(this);\n }\n\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) {\n for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].noHScroll) {\n regLineChange(this$1, lineNo, \"widget\");\n break;\n }\n }\n }\n\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n operation: function operation(f) {\n return runInOp(this, f);\n },\n startOperation: function startOperation() {\n return _startOperation(this);\n },\n endOperation: function endOperation() {\n return _endOperation(this);\n },\n refresh: methodOp(function () {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5) {\n estimateLineHeights(this);\n }\n\n signal(this, \"refresh\", this);\n }),\n swapDoc: methodOp(function (doc) {\n var old = this.doc;\n old.cm = null; // Cancel the current text selection if any (#5821)\n\n if (this.state.selectingText) {\n this.state.selectingText();\n }\n\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old;\n }),\n phrase: function phrase(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText;\n },\n getInputField: function getInputField() {\n return this.display.input.getField();\n },\n getWrapperElement: function getWrapperElement() {\n return this.display.wrapper;\n },\n getScrollerElement: function getScrollerElement() {\n return this.display.scroller;\n },\n getGutterElement: function getGutterElement() {\n return this.display.gutters;\n }\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function (type, name, value) {\n if (!helpers.hasOwnProperty(type)) {\n helpers[type] = CodeMirror[type] = {\n _global: []\n };\n }\n\n helpers[type][name] = value;\n };\n\n CodeMirror.registerGlobalHelper = function (type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n\n helpers[type]._global.push({\n pred: predicate,\n val: value\n });\n };\n } // Used for horizontal relative motion. Dir is -1 or 1 (left or\n // right), unit can be \"char\", \"column\" (like char, but doesn't\n // cross line boundaries), \"word\" (across next word), or \"group\" (to\n // the start of next group of word or non-word-non-whitespace\n // chars). The visually param controls whether, in right-to-left\n // text, direction 1 means to move towards the next index in the\n // string, or towards the character to the right of the current\n // position. The resulting position will have a hitSide=true\n // property if it reached the end of the document.\n\n\n function _findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n\n function findNextLine() {\n var l = pos.line + lineDir;\n\n if (l < doc.first || l >= doc.first + doc.size) {\n return false;\n }\n\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l);\n }\n\n function moveOnce(boundToLine) {\n var next;\n\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir);\n } else {\n return false;\n }\n } else {\n pos = next;\n }\n\n return true;\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null,\n group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) {\n break;\n }\n\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\" : group && cur == \"\\n\" ? \"n\" : !group || /\\s/.test(cur) ? null : \"p\";\n\n if (group && !first && !type) {\n type = \"s\";\n }\n\n if (sawType && sawType != type) {\n if (dir < 0) {\n dir = 1;\n moveOnce();\n pos.sticky = \"after\";\n }\n\n break;\n }\n\n if (type) {\n sawType = type;\n }\n\n if (dir > 0 && !moveOnce(!first)) {\n break;\n }\n }\n }\n\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n\n if (equalCursorPos(oldPos, result)) {\n result.hitSide = true;\n }\n\n return result;\n } // For relative vertical movement. Dir may be -1 or 1. Unit can be\n // \"page\" or \"line\". The resulting position will have a hitSide=true\n // property if it reached the end of the document.\n\n\n function _findPosV(cm, pos, dir, unit) {\n var doc = cm.doc,\n x = pos.left,\n y;\n\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n\n var target;\n\n for (;;) {\n target = _coordsChar(cm, x, y);\n\n if (!target.outside) {\n break;\n }\n\n if (dir < 0 ? y <= 0 : y >= doc.height) {\n target.hitSide = true;\n break;\n }\n\n y += dir * 5;\n }\n\n return target;\n } // CONTENTEDITABLE INPUT STYLE\n\n\n var ContentEditableInput = function ContentEditableInput(cm) {\n this.cm = cm;\n this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;\n this.polling = new Delayed();\n this.composing = null;\n this.gracePeriod = false;\n this.readDOMTimeout = null;\n };\n\n ContentEditableInput.prototype.init = function (display) {\n var this$1 = this;\n var input = this,\n cm = input.cm;\n var div = input.div = display.lineDiv;\n disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize);\n on(div, \"paste\", function (e) {\n if (signalDOMEvent(cm, e) || handlePaste(e, cm)) {\n return;\n } // IE doesn't fire input events, so we schedule a read for the pasted content in this way\n\n\n if (ie_version <= 11) {\n setTimeout(operation(cm, function () {\n return this$1.updateFromDOM();\n }), 20);\n }\n });\n on(div, \"compositionstart\", function (e) {\n this$1.composing = {\n data: e.data,\n done: false\n };\n });\n on(div, \"compositionupdate\", function (e) {\n if (!this$1.composing) {\n this$1.composing = {\n data: e.data,\n done: false\n };\n }\n });\n on(div, \"compositionend\", function (e) {\n if (this$1.composing) {\n if (e.data != this$1.composing.data) {\n this$1.readFromDOMSoon();\n }\n\n this$1.composing.done = true;\n }\n });\n on(div, \"touchstart\", function () {\n return input.forceCompositionEnd();\n });\n on(div, \"input\", function () {\n if (!this$1.composing) {\n this$1.readFromDOMSoon();\n }\n });\n\n function onCopyCut(e) {\n if (signalDOMEvent(cm, e)) {\n return;\n }\n\n if (cm.somethingSelected()) {\n setLastCopied({\n lineWise: false,\n text: cm.getSelections()\n });\n\n if (e.type == \"cut\") {\n cm.replaceSelection(\"\", null, \"cut\");\n }\n } else if (!cm.options.lineWiseCopyCut) {\n return;\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({\n lineWise: true,\n text: ranges.text\n });\n\n if (e.type == \"cut\") {\n cm.operation(function () {\n cm.setSelections(ranges.ranges, 0, sel_dontScroll);\n cm.replaceSelection(\"\", null, \"cut\");\n });\n }\n }\n\n if (e.clipboardData) {\n e.clipboardData.clearData();\n var content = lastCopied.text.join(\"\\n\"); // iOS exposes the clipboard API, but seems to discard content inserted into it\n\n e.clipboardData.setData(\"Text\", content);\n\n if (e.clipboardData.getData(\"Text\") == content) {\n e.preventDefault();\n return;\n }\n } // Old-fashioned briefly-focus-a-textarea hack\n\n\n var kludge = hiddenTextarea(),\n te = kludge.firstChild;\n cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);\n te.value = lastCopied.text.join(\"\\n\");\n var hadFocus = document.activeElement;\n selectInput(te);\n setTimeout(function () {\n cm.display.lineSpace.removeChild(kludge);\n hadFocus.focus();\n\n if (hadFocus == div) {\n input.showPrimarySelection();\n }\n }, 50);\n }\n\n on(div, \"copy\", onCopyCut);\n on(div, \"cut\", onCopyCut);\n };\n\n ContentEditableInput.prototype.prepareSelection = function () {\n var result = prepareSelection(this.cm, false);\n result.focus = document.activeElement == this.div;\n return result;\n };\n\n ContentEditableInput.prototype.showSelection = function (info, takeFocus) {\n if (!info || !this.cm.display.view.length) {\n return;\n }\n\n if (info.focus || takeFocus) {\n this.showPrimarySelection();\n }\n\n this.showMultipleSelections(info);\n };\n\n ContentEditableInput.prototype.getSelection = function () {\n return this.cm.display.wrapper.ownerDocument.getSelection();\n };\n\n ContentEditableInput.prototype.showPrimarySelection = function () {\n var sel = this.getSelection(),\n cm = this.cm,\n prim = cm.doc.sel.primary();\n var from = prim.from(),\n to = prim.to();\n\n if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {\n sel.removeAllRanges();\n return;\n }\n\n var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);\n\n if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad && cmp(minPos(curAnchor, curFocus), from) == 0 && cmp(maxPos(curAnchor, curFocus), to) == 0) {\n return;\n }\n\n var view = cm.display.view;\n var start = from.line >= cm.display.viewFrom && posToDOM(cm, from) || {\n node: view[0].measure.map[2],\n offset: 0\n };\n var end = to.line < cm.display.viewTo && posToDOM(cm, to);\n\n if (!end) {\n var measure = view[view.length - 1].measure;\n var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;\n end = {\n node: map[map.length - 1],\n offset: map[map.length - 2] - map[map.length - 3]\n };\n }\n\n if (!start || !end) {\n sel.removeAllRanges();\n return;\n }\n\n var old = sel.rangeCount && sel.getRangeAt(0),\n rng;\n\n try {\n rng = range(start.node, start.offset, end.offset, end.node);\n } catch (e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible\n\n\n if (rng) {\n if (!gecko && cm.state.focused) {\n sel.collapse(start.node, start.offset);\n\n if (!rng.collapsed) {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n } else {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n\n if (old && sel.anchorNode == null) {\n sel.addRange(old);\n } else if (gecko) {\n this.startGracePeriod();\n }\n }\n\n this.rememberSelection();\n };\n\n ContentEditableInput.prototype.startGracePeriod = function () {\n var this$1 = this;\n clearTimeout(this.gracePeriod);\n this.gracePeriod = setTimeout(function () {\n this$1.gracePeriod = false;\n\n if (this$1.selectionChanged()) {\n this$1.cm.operation(function () {\n return this$1.cm.curOp.selectionChanged = true;\n });\n }\n }, 20);\n };\n\n ContentEditableInput.prototype.showMultipleSelections = function (info) {\n removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);\n removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);\n };\n\n ContentEditableInput.prototype.rememberSelection = function () {\n var sel = this.getSelection();\n this.lastAnchorNode = sel.anchorNode;\n this.lastAnchorOffset = sel.anchorOffset;\n this.lastFocusNode = sel.focusNode;\n this.lastFocusOffset = sel.focusOffset;\n };\n\n ContentEditableInput.prototype.selectionInEditor = function () {\n var sel = this.getSelection();\n\n if (!sel.rangeCount) {\n return false;\n }\n\n var node = sel.getRangeAt(0).commonAncestorContainer;\n return contains(this.div, node);\n };\n\n ContentEditableInput.prototype.focus = function () {\n if (this.cm.options.readOnly != \"nocursor\") {\n if (!this.selectionInEditor() || document.activeElement != this.div) {\n this.showSelection(this.prepareSelection(), true);\n }\n\n this.div.focus();\n }\n };\n\n ContentEditableInput.prototype.blur = function () {\n this.div.blur();\n };\n\n ContentEditableInput.prototype.getField = function () {\n return this.div;\n };\n\n ContentEditableInput.prototype.supportsTouch = function () {\n return true;\n };\n\n ContentEditableInput.prototype.receivedFocus = function () {\n var input = this;\n\n if (this.selectionInEditor()) {\n this.pollSelection();\n } else {\n runInOp(this.cm, function () {\n return input.cm.curOp.selectionChanged = true;\n });\n }\n\n function poll() {\n if (input.cm.state.focused) {\n input.pollSelection();\n input.polling.set(input.cm.options.pollInterval, poll);\n }\n }\n\n this.polling.set(this.cm.options.pollInterval, poll);\n };\n\n ContentEditableInput.prototype.selectionChanged = function () {\n var sel = this.getSelection();\n return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset || sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset;\n };\n\n ContentEditableInput.prototype.pollSelection = function () {\n if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) {\n return;\n }\n\n var sel = this.getSelection(),\n cm = this.cm; // On Android Chrome (version 56, at least), backspacing into an\n // uneditable block element will put the cursor in that element,\n // and then, because it's not editable, hide the virtual keyboard.\n // Because Android doesn't allow us to actually detect backspace\n // presses in a sane way, this code checks for when that happens\n // and simulates a backspace press in this case.\n\n if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) {\n this.cm.triggerOnKeyDown({\n type: \"keydown\",\n keyCode: 8,\n preventDefault: Math.abs\n });\n this.blur();\n this.focus();\n return;\n }\n\n if (this.composing) {\n return;\n }\n\n this.rememberSelection();\n var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var head = domToPos(cm, sel.focusNode, sel.focusOffset);\n\n if (anchor && head) {\n runInOp(cm, function () {\n setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);\n\n if (anchor.bad || head.bad) {\n cm.curOp.selectionChanged = true;\n }\n });\n }\n };\n\n ContentEditableInput.prototype.pollContent = function () {\n if (this.readDOMTimeout != null) {\n clearTimeout(this.readDOMTimeout);\n this.readDOMTimeout = null;\n }\n\n var cm = this.cm,\n display = cm.display,\n sel = cm.doc.sel.primary();\n var from = sel.from(),\n to = sel.to();\n\n if (from.ch == 0 && from.line > cm.firstLine()) {\n from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length);\n }\n\n if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine()) {\n to = Pos(to.line + 1, 0);\n }\n\n if (from.line < display.viewFrom || to.line > display.viewTo - 1) {\n return false;\n }\n\n var fromIndex, fromLine, fromNode;\n\n if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {\n fromLine = lineNo(display.view[0].line);\n fromNode = display.view[0].node;\n } else {\n fromLine = lineNo(display.view[fromIndex].line);\n fromNode = display.view[fromIndex - 1].node.nextSibling;\n }\n\n var toIndex = findViewIndex(cm, to.line);\n var toLine, toNode;\n\n if (toIndex == display.view.length - 1) {\n toLine = display.viewTo - 1;\n toNode = display.lineDiv.lastChild;\n } else {\n toLine = lineNo(display.view[toIndex + 1].line) - 1;\n toNode = display.view[toIndex + 1].node.previousSibling;\n }\n\n if (!fromNode) {\n return false;\n }\n\n var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));\n var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));\n\n while (newText.length > 1 && oldText.length > 1) {\n if (lst(newText) == lst(oldText)) {\n newText.pop();\n oldText.pop();\n toLine--;\n } else if (newText[0] == oldText[0]) {\n newText.shift();\n oldText.shift();\n fromLine++;\n } else {\n break;\n }\n }\n\n var cutFront = 0,\n cutEnd = 0;\n var newTop = newText[0],\n oldTop = oldText[0],\n maxCutFront = Math.min(newTop.length, oldTop.length);\n\n while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront)) {\n ++cutFront;\n }\n\n var newBot = lst(newText),\n oldBot = lst(oldText);\n var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0), oldBot.length - (oldText.length == 1 ? cutFront : 0));\n\n while (cutEnd < maxCutEnd && newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {\n ++cutEnd;\n } // Try to move start of change to start of selection if ambiguous\n\n\n if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {\n while (cutFront && cutFront > from.ch && newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {\n cutFront--;\n cutEnd++;\n }\n }\n\n newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\\u200b+/, \"\");\n newText[0] = newText[0].slice(cutFront).replace(/\\u200b+$/, \"\");\n var chFrom = Pos(fromLine, cutFront);\n var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);\n\n if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {\n _replaceRange(cm.doc, newText, chFrom, chTo, \"+input\");\n\n return true;\n }\n };\n\n ContentEditableInput.prototype.ensurePolled = function () {\n this.forceCompositionEnd();\n };\n\n ContentEditableInput.prototype.reset = function () {\n this.forceCompositionEnd();\n };\n\n ContentEditableInput.prototype.forceCompositionEnd = function () {\n if (!this.composing) {\n return;\n }\n\n clearTimeout(this.readDOMTimeout);\n this.composing = null;\n this.updateFromDOM();\n this.div.blur();\n this.div.focus();\n };\n\n ContentEditableInput.prototype.readFromDOMSoon = function () {\n var this$1 = this;\n\n if (this.readDOMTimeout != null) {\n return;\n }\n\n this.readDOMTimeout = setTimeout(function () {\n this$1.readDOMTimeout = null;\n\n if (this$1.composing) {\n if (this$1.composing.done) {\n this$1.composing = null;\n } else {\n return;\n }\n }\n\n this$1.updateFromDOM();\n }, 80);\n };\n\n ContentEditableInput.prototype.updateFromDOM = function () {\n var this$1 = this;\n\n if (this.cm.isReadOnly() || !this.pollContent()) {\n runInOp(this.cm, function () {\n return regChange(this$1.cm);\n });\n }\n };\n\n ContentEditableInput.prototype.setUneditable = function (node) {\n node.contentEditable = \"false\";\n };\n\n ContentEditableInput.prototype.onKeyPress = function (e) {\n if (e.charCode == 0 || this.composing) {\n return;\n }\n\n e.preventDefault();\n\n if (!this.cm.isReadOnly()) {\n operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);\n }\n };\n\n ContentEditableInput.prototype.readOnlyChanged = function (val) {\n this.div.contentEditable = String(val != \"nocursor\");\n };\n\n ContentEditableInput.prototype.onContextMenu = function () {};\n\n ContentEditableInput.prototype.resetPosition = function () {};\n\n ContentEditableInput.prototype.needsContentAttribute = true;\n\n function posToDOM(cm, pos) {\n var view = findViewForLine(cm, pos.line);\n\n if (!view || view.hidden) {\n return null;\n }\n\n var line = getLine(cm.doc, pos.line);\n var info = mapFromLineView(view, line, pos.line);\n var order = getOrder(line, cm.doc.direction),\n side = \"left\";\n\n if (order) {\n var partPos = getBidiPartAt(order, pos.ch);\n side = partPos % 2 ? \"right\" : \"left\";\n }\n\n var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);\n result.offset = result.collapse == \"right\" ? result.end : result.start;\n return result;\n }\n\n function isInGutter(node) {\n for (var scan = node; scan; scan = scan.parentNode) {\n if (/CodeMirror-gutter-wrapper/.test(scan.className)) {\n return true;\n }\n }\n\n return false;\n }\n\n function badPos(pos, bad) {\n if (bad) {\n pos.bad = true;\n }\n\n return pos;\n }\n\n function domTextBetween(cm, from, to, fromLine, toLine) {\n var text = \"\",\n closing = false,\n lineSep = cm.doc.lineSeparator(),\n extraLinebreak = false;\n\n function recognizeMarker(id) {\n return function (marker) {\n return marker.id == id;\n };\n }\n\n function close() {\n if (closing) {\n text += lineSep;\n\n if (extraLinebreak) {\n text += lineSep;\n }\n\n closing = extraLinebreak = false;\n }\n }\n\n function addText(str) {\n if (str) {\n close();\n text += str;\n }\n }\n\n function walk(node) {\n if (node.nodeType == 1) {\n var cmText = node.getAttribute(\"cm-text\");\n\n if (cmText) {\n addText(cmText);\n return;\n }\n\n var markerID = node.getAttribute(\"cm-marker\"),\n range;\n\n if (markerID) {\n var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));\n\n if (found.length && (range = found[0].find(0))) {\n addText(getBetween(cm.doc, range.from, range.to).join(lineSep));\n }\n\n return;\n }\n\n if (node.getAttribute(\"contenteditable\") == \"false\") {\n return;\n }\n\n var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName);\n\n if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) {\n return;\n }\n\n if (isBlock) {\n close();\n }\n\n for (var i = 0; i < node.childNodes.length; i++) {\n walk(node.childNodes[i]);\n }\n\n if (/^(pre|p)$/i.test(node.nodeName)) {\n extraLinebreak = true;\n }\n\n if (isBlock) {\n closing = true;\n }\n } else if (node.nodeType == 3) {\n addText(node.nodeValue.replace(/\\u200b/g, \"\").replace(/\\u00a0/g, \" \"));\n }\n }\n\n for (;;) {\n walk(from);\n\n if (from == to) {\n break;\n }\n\n from = from.nextSibling;\n extraLinebreak = false;\n }\n\n return text;\n }\n\n function domToPos(cm, node, offset) {\n var lineNode;\n\n if (node == cm.display.lineDiv) {\n lineNode = cm.display.lineDiv.childNodes[offset];\n\n if (!lineNode) {\n return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true);\n }\n\n node = null;\n offset = 0;\n } else {\n for (lineNode = node;; lineNode = lineNode.parentNode) {\n if (!lineNode || lineNode == cm.display.lineDiv) {\n return null;\n }\n\n if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) {\n break;\n }\n }\n }\n\n for (var i = 0; i < cm.display.view.length; i++) {\n var lineView = cm.display.view[i];\n\n if (lineView.node == lineNode) {\n return locateNodeInLineView(lineView, node, offset);\n }\n }\n }\n\n function locateNodeInLineView(lineView, node, offset) {\n var wrapper = lineView.text.firstChild,\n bad = false;\n\n if (!node || !contains(wrapper, node)) {\n return badPos(Pos(lineNo(lineView.line), 0), true);\n }\n\n if (node == wrapper) {\n bad = true;\n node = wrapper.childNodes[offset];\n offset = 0;\n\n if (!node) {\n var line = lineView.rest ? lst(lineView.rest) : lineView.line;\n return badPos(Pos(lineNo(line), line.text.length), bad);\n }\n }\n\n var textNode = node.nodeType == 3 ? node : null,\n topNode = node;\n\n if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n textNode = node.firstChild;\n\n if (offset) {\n offset = textNode.nodeValue.length;\n }\n }\n\n while (topNode.parentNode != wrapper) {\n topNode = topNode.parentNode;\n }\n\n var measure = lineView.measure,\n maps = measure.maps;\n\n function find(textNode, topNode, offset) {\n for (var i = -1; i < (maps ? maps.length : 0); i++) {\n var map = i < 0 ? measure.map : maps[i];\n\n for (var j = 0; j < map.length; j += 3) {\n var curNode = map[j + 2];\n\n if (curNode == textNode || curNode == topNode) {\n var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);\n var ch = map[j] + offset;\n\n if (offset < 0 || curNode != textNode) {\n ch = map[j + (offset ? 1 : 0)];\n }\n\n return Pos(line, ch);\n }\n }\n }\n }\n\n var found = find(textNode, topNode, offset);\n\n if (found) {\n return badPos(found, bad);\n } // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems\n\n\n for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {\n found = find(after, after.firstChild, 0);\n\n if (found) {\n return badPos(Pos(found.line, found.ch - dist), bad);\n } else {\n dist += after.textContent.length;\n }\n }\n\n for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {\n found = find(before, before.firstChild, -1);\n\n if (found) {\n return badPos(Pos(found.line, found.ch + dist$1), bad);\n } else {\n dist$1 += before.textContent.length;\n }\n }\n } // TEXTAREA INPUT STYLE\n\n\n var TextareaInput = function TextareaInput(cm) {\n this.cm = cm; // See input.poll and input.reset\n\n this.prevInput = \"\"; // Flag that indicates whether we expect input to appear real soon\n // now (after some event like 'keypress' or 'input') and are\n // polling intensively.\n\n this.pollingFast = false; // Self-resetting timeout for the poller\n\n this.polling = new Delayed(); // Used to work around IE issue with selection being forgotten when focus moves away from textarea\n\n this.hasSelection = false;\n this.composing = null;\n };\n\n TextareaInput.prototype.init = function (display) {\n var this$1 = this;\n var input = this,\n cm = this.cm;\n this.createField(display);\n var te = this.textarea;\n display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild); // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)\n\n if (ios) {\n te.style.width = \"0px\";\n }\n\n on(te, \"input\", function () {\n if (ie && ie_version >= 9 && this$1.hasSelection) {\n this$1.hasSelection = null;\n }\n\n input.poll();\n });\n on(te, \"paste\", function (e) {\n if (signalDOMEvent(cm, e) || handlePaste(e, cm)) {\n return;\n }\n\n cm.state.pasteIncoming = +new Date();\n input.fastPoll();\n });\n\n function prepareCopyCut(e) {\n if (signalDOMEvent(cm, e)) {\n return;\n }\n\n if (cm.somethingSelected()) {\n setLastCopied({\n lineWise: false,\n text: cm.getSelections()\n });\n } else if (!cm.options.lineWiseCopyCut) {\n return;\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({\n lineWise: true,\n text: ranges.text\n });\n\n if (e.type == \"cut\") {\n cm.setSelections(ranges.ranges, null, sel_dontScroll);\n } else {\n input.prevInput = \"\";\n te.value = ranges.text.join(\"\\n\");\n selectInput(te);\n }\n }\n\n if (e.type == \"cut\") {\n cm.state.cutIncoming = +new Date();\n }\n }\n\n on(te, \"cut\", prepareCopyCut);\n on(te, \"copy\", prepareCopyCut);\n on(display.scroller, \"paste\", function (e) {\n if (eventInWidget(display, e) || signalDOMEvent(cm, e)) {\n return;\n }\n\n if (!te.dispatchEvent) {\n cm.state.pasteIncoming = +new Date();\n input.focus();\n return;\n } // Pass the `paste` event to the textarea so it's handled by its event listener.\n\n\n var event = new Event(\"paste\");\n event.clipboardData = e.clipboardData;\n te.dispatchEvent(event);\n }); // Prevent normal selection in the editor (we handle our own)\n\n on(display.lineSpace, \"selectstart\", function (e) {\n if (!eventInWidget(display, e)) {\n e_preventDefault(e);\n }\n });\n on(te, \"compositionstart\", function () {\n var start = cm.getCursor(\"from\");\n\n if (input.composing) {\n input.composing.range.clear();\n }\n\n input.composing = {\n start: start,\n range: cm.markText(start, cm.getCursor(\"to\"), {\n className: \"CodeMirror-composing\"\n })\n };\n });\n on(te, \"compositionend\", function () {\n if (input.composing) {\n input.poll();\n input.composing.range.clear();\n input.composing = null;\n }\n });\n };\n\n TextareaInput.prototype.createField = function (_display) {\n // Wraps and hides input textarea\n this.wrapper = hiddenTextarea(); // The semihidden textarea that is focused when the editor is\n // focused, and receives input.\n\n this.textarea = this.wrapper.firstChild;\n };\n\n TextareaInput.prototype.prepareSelection = function () {\n // Redraw the selection and/or cursor\n var cm = this.cm,\n display = cm.display,\n doc = cm.doc;\n var result = prepareSelection(cm); // Move the hidden textarea near the cursor to prevent scrolling artifacts\n\n if (cm.options.moveInputWithCursor) {\n var headPos = _cursorCoords(cm, doc.sel.primary().head, \"div\");\n\n var wrapOff = display.wrapper.getBoundingClientRect(),\n lineOff = display.lineDiv.getBoundingClientRect();\n result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10, headPos.top + lineOff.top - wrapOff.top));\n result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10, headPos.left + lineOff.left - wrapOff.left));\n }\n\n return result;\n };\n\n TextareaInput.prototype.showSelection = function (drawn) {\n var cm = this.cm,\n display = cm.display;\n removeChildrenAndAdd(display.cursorDiv, drawn.cursors);\n removeChildrenAndAdd(display.selectionDiv, drawn.selection);\n\n if (drawn.teTop != null) {\n this.wrapper.style.top = drawn.teTop + \"px\";\n this.wrapper.style.left = drawn.teLeft + \"px\";\n }\n }; // Reset the input to correspond to the selection (or to be empty,\n // when not typing and nothing is selected)\n\n\n TextareaInput.prototype.reset = function (typing) {\n if (this.contextMenuPending || this.composing) {\n return;\n }\n\n var cm = this.cm;\n\n if (cm.somethingSelected()) {\n this.prevInput = \"\";\n var content = cm.getSelection();\n this.textarea.value = content;\n\n if (cm.state.focused) {\n selectInput(this.textarea);\n }\n\n if (ie && ie_version >= 9) {\n this.hasSelection = content;\n }\n } else if (!typing) {\n this.prevInput = this.textarea.value = \"\";\n\n if (ie && ie_version >= 9) {\n this.hasSelection = null;\n }\n }\n };\n\n TextareaInput.prototype.getField = function () {\n return this.textarea;\n };\n\n TextareaInput.prototype.supportsTouch = function () {\n return false;\n };\n\n TextareaInput.prototype.focus = function () {\n if (this.cm.options.readOnly != \"nocursor\" && (!mobile || activeElt() != this.textarea)) {\n try {\n this.textarea.focus();\n } catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM\n\n }\n };\n\n TextareaInput.prototype.blur = function () {\n this.textarea.blur();\n };\n\n TextareaInput.prototype.resetPosition = function () {\n this.wrapper.style.top = this.wrapper.style.left = 0;\n };\n\n TextareaInput.prototype.receivedFocus = function () {\n this.slowPoll();\n }; // Poll for input changes, using the normal rate of polling. This\n // runs as long as the editor is focused.\n\n\n TextareaInput.prototype.slowPoll = function () {\n var this$1 = this;\n\n if (this.pollingFast) {\n return;\n }\n\n this.polling.set(this.cm.options.pollInterval, function () {\n this$1.poll();\n\n if (this$1.cm.state.focused) {\n this$1.slowPoll();\n }\n });\n }; // When an event has just come in that is likely to add or change\n // something in the input textarea, we poll faster, to ensure that\n // the change appears on the screen quickly.\n\n\n TextareaInput.prototype.fastPoll = function () {\n var missed = false,\n input = this;\n input.pollingFast = true;\n\n function p() {\n var changed = input.poll();\n\n if (!changed && !missed) {\n missed = true;\n input.polling.set(60, p);\n } else {\n input.pollingFast = false;\n input.slowPoll();\n }\n }\n\n input.polling.set(20, p);\n }; // Read input from the textarea, and update the document to match.\n // When something is selected, it is present in the textarea, and\n // selected (unless it is huge, in which case a placeholder is\n // used). When nothing is selected, the cursor sits after previously\n // seen text (can be empty), which is stored in prevInput (we must\n // not reset the textarea when typing, because that breaks IME).\n\n\n TextareaInput.prototype.poll = function () {\n var this$1 = this;\n var cm = this.cm,\n input = this.textarea,\n prevInput = this.prevInput; // Since this is called a *lot*, try to bail out as cheaply as\n // possible when it is clear that nothing happened. hasSelection\n // will be the case when there is a lot of text in the textarea,\n // in which case reading its value would be expensive.\n\n if (this.contextMenuPending || !cm.state.focused || hasSelection(input) && !prevInput && !this.composing || cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq) {\n return false;\n }\n\n var text = input.value; // If nothing changed, bail.\n\n if (text == prevInput && !cm.somethingSelected()) {\n return false;\n } // Work around nonsensical selection resetting in IE9/10, and\n // inexplicable appearance of private area unicode characters on\n // some key combos in Mac (#2689).\n\n\n if (ie && ie_version >= 9 && this.hasSelection === text || mac && /[\\uf700-\\uf7ff]/.test(text)) {\n cm.display.input.reset();\n return false;\n }\n\n if (cm.doc.sel == cm.display.selForContextMenu) {\n var first = text.charCodeAt(0);\n\n if (first == 0x200b && !prevInput) {\n prevInput = \"\\u200B\";\n }\n\n if (first == 0x21da) {\n this.reset();\n return this.cm.execCommand(\"undo\");\n }\n } // Find the part of the input that is actually new\n\n\n var same = 0,\n l = Math.min(prevInput.length, text.length);\n\n while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) {\n ++same;\n }\n\n runInOp(cm, function () {\n applyTextInput(cm, text.slice(same), prevInput.length - same, null, this$1.composing ? \"*compose\" : null); // Don't leave long text in the textarea, since it makes further polling slow\n\n if (text.length > 1000 || text.indexOf(\"\\n\") > -1) {\n input.value = this$1.prevInput = \"\";\n } else {\n this$1.prevInput = text;\n }\n\n if (this$1.composing) {\n this$1.composing.range.clear();\n this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor(\"to\"), {\n className: \"CodeMirror-composing\"\n });\n }\n });\n return true;\n };\n\n TextareaInput.prototype.ensurePolled = function () {\n if (this.pollingFast && this.poll()) {\n this.pollingFast = false;\n }\n };\n\n TextareaInput.prototype.onKeyPress = function () {\n if (ie && ie_version >= 9) {\n this.hasSelection = null;\n }\n\n this.fastPoll();\n };\n\n TextareaInput.prototype.onContextMenu = function (e) {\n var input = this,\n cm = input.cm,\n display = cm.display,\n te = input.textarea;\n\n if (input.contextMenuPending) {\n input.contextMenuPending();\n }\n\n var pos = posFromMouse(cm, e),\n scrollPos = display.scroller.scrollTop;\n\n if (!pos || presto) {\n return;\n } // Opera is difficult.\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n\n\n var reset = cm.options.resetSelectionOnContextMenu;\n\n if (reset && cm.doc.sel.contains(pos) == -1) {\n operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);\n }\n\n var oldCSS = te.style.cssText,\n oldWrapperCSS = input.wrapper.style.cssText;\n var wrapperBox = input.wrapper.offsetParent.getBoundingClientRect();\n input.wrapper.style.cssText = \"position: static\";\n te.style.cssText = \"position: absolute; width: 30px; height: 30px;\\n top: \" + (e.clientY - wrapperBox.top - 5) + \"px; left: \" + (e.clientX - wrapperBox.left - 5) + \"px;\\n z-index: 1000; background: \" + (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") + \";\\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n var oldScrollY;\n\n if (webkit) {\n oldScrollY = window.scrollY;\n } // Work around Chrome issue (#2712)\n\n\n display.input.focus();\n\n if (webkit) {\n window.scrollTo(null, oldScrollY);\n }\n\n display.input.reset(); // Adds \"Select all\" to context menu in FF\n\n if (!cm.somethingSelected()) {\n te.value = input.prevInput = \" \";\n }\n\n input.contextMenuPending = rehide;\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll); // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n\n function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200B\" + (selected ? te.value : \"\");\n te.value = \"\\u21DA\"; // Used to catch context-menu undo\n\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200B\";\n te.selectionStart = 1;\n te.selectionEnd = extval.length; // Re-set this, in case some other handler touched the\n // selection in the meantime.\n\n display.selForContextMenu = cm.doc.sel;\n }\n }\n\n function rehide() {\n if (input.contextMenuPending != rehide) {\n return;\n }\n\n input.contextMenuPending = false;\n input.wrapper.style.cssText = oldWrapperCSS;\n te.style.cssText = oldCSS;\n\n if (ie && ie_version < 9) {\n display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);\n } // Try to detect the user choosing select-all\n\n\n if (te.selectionStart != null) {\n if (!ie || ie && ie_version < 9) {\n prepareSelectAllHack();\n }\n\n var i = 0,\n poll = function poll() {\n if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 && te.selectionEnd > 0 && input.prevInput == \"\\u200B\") {\n operation(cm, selectAll)(cm);\n } else if (i++ < 10) {\n display.detectingSelectAll = setTimeout(poll, 500);\n } else {\n display.selForContextMenu = null;\n display.input.reset();\n }\n };\n\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) {\n prepareSelectAllHack();\n }\n\n if (captureRightClick) {\n e_stop(e);\n\n var mouseup = function mouseup() {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n };\n\n TextareaInput.prototype.readOnlyChanged = function (val) {\n if (!val) {\n this.reset();\n }\n\n this.textarea.disabled = val == \"nocursor\";\n };\n\n TextareaInput.prototype.setUneditable = function () {};\n\n TextareaInput.prototype.needsContentAttribute = false;\n\n function fromTextArea(textarea, options) {\n options = options ? copyObj(options) : {};\n options.value = textarea.value;\n\n if (!options.tabindex && textarea.tabIndex) {\n options.tabindex = textarea.tabIndex;\n }\n\n if (!options.placeholder && textarea.placeholder) {\n options.placeholder = textarea.placeholder;\n } // Set autofocus to true if this textarea is focused, or if it has\n // autofocus and no other element is focused.\n\n\n if (options.autofocus == null) {\n var hasFocus = activeElt();\n options.autofocus = hasFocus == textarea || textarea.getAttribute(\"autofocus\") != null && hasFocus == document.body;\n }\n\n function save() {\n textarea.value = cm.getValue();\n }\n\n var realSubmit;\n\n if (textarea.form) {\n on(textarea.form, \"submit\", save); // Deplorable hack to make the submit method do the right thing.\n\n if (!options.leaveSubmitMethodAlone) {\n var form = textarea.form;\n realSubmit = form.submit;\n\n try {\n var wrappedSubmit = form.submit = function () {\n save();\n form.submit = realSubmit;\n form.submit();\n form.submit = wrappedSubmit;\n };\n } catch (e) {}\n }\n }\n\n options.finishInit = function (cm) {\n cm.save = save;\n\n cm.getTextArea = function () {\n return textarea;\n };\n\n cm.toTextArea = function () {\n cm.toTextArea = isNaN; // Prevent this from being ran twice\n\n save();\n textarea.parentNode.removeChild(cm.getWrapperElement());\n textarea.style.display = \"\";\n\n if (textarea.form) {\n off(textarea.form, \"submit\", save);\n\n if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == \"function\") {\n textarea.form.submit = realSubmit;\n }\n }\n };\n };\n\n textarea.style.display = \"none\";\n var cm = CodeMirror(function (node) {\n return textarea.parentNode.insertBefore(node, textarea.nextSibling);\n }, options);\n return cm;\n }\n\n function addLegacyProps(CodeMirror) {\n CodeMirror.off = off;\n CodeMirror.on = on;\n CodeMirror.wheelEventPixels = wheelEventPixels;\n CodeMirror.Doc = Doc;\n CodeMirror.splitLines = splitLinesAuto;\n CodeMirror.countColumn = countColumn;\n CodeMirror.findColumn = findColumn;\n CodeMirror.isWordChar = isWordCharBasic;\n CodeMirror.Pass = Pass;\n CodeMirror.signal = signal;\n CodeMirror.Line = Line;\n CodeMirror.changeEnd = changeEnd;\n CodeMirror.scrollbarModel = scrollbarModel;\n CodeMirror.Pos = Pos;\n CodeMirror.cmpPos = cmp;\n CodeMirror.modes = modes;\n CodeMirror.mimeModes = mimeModes;\n CodeMirror.resolveMode = resolveMode;\n CodeMirror.getMode = getMode;\n CodeMirror.modeExtensions = modeExtensions;\n CodeMirror.extendMode = extendMode;\n CodeMirror.copyState = copyState;\n CodeMirror.startState = startState;\n CodeMirror.innerMode = innerMode;\n CodeMirror.commands = commands;\n CodeMirror.keyMap = keyMap;\n CodeMirror.keyName = keyName;\n CodeMirror.isModifierKey = isModifierKey;\n CodeMirror.lookupKey = lookupKey;\n CodeMirror.normalizeKeyMap = normalizeKeyMap;\n CodeMirror.StringStream = StringStream;\n CodeMirror.SharedTextMarker = SharedTextMarker;\n CodeMirror.TextMarker = TextMarker;\n CodeMirror.LineWidget = LineWidget;\n CodeMirror.e_preventDefault = e_preventDefault;\n CodeMirror.e_stopPropagation = e_stopPropagation;\n CodeMirror.e_stop = e_stop;\n CodeMirror.addClass = addClass;\n CodeMirror.contains = contains;\n CodeMirror.rmClass = rmClass;\n CodeMirror.keyNames = keyNames;\n } // EDITOR CONSTRUCTOR\n\n\n defineOptions(CodeMirror);\n addEditorMethods(CodeMirror); // Set up methods on CodeMirror's prototype to redirect to the editor's document.\n\n var dontDelegate = \"iter insert remove copy getEditor constructor\".split(\" \");\n\n for (var prop in Doc.prototype) {\n if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0) {\n CodeMirror.prototype[prop] = function (method) {\n return function () {\n return method.apply(this.doc, arguments);\n };\n }(Doc.prototype[prop]);\n }\n }\n\n eventMixin(Doc);\n CodeMirror.inputStyles = {\n \"textarea\": TextareaInput,\n \"contenteditable\": ContentEditableInput\n }; // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n\n CodeMirror.defineMode = function (name\n /*, mode, …*/\n ) {\n if (!CodeMirror.defaults.mode && name != \"null\") {\n CodeMirror.defaults.mode = name;\n }\n\n defineMode.apply(this, arguments);\n };\n\n CodeMirror.defineMIME = defineMIME; // Minimal default mode.\n\n CodeMirror.defineMode(\"null\", function () {\n return {\n token: function token(stream) {\n return stream.skipToEnd();\n }\n };\n });\n CodeMirror.defineMIME(\"text/plain\", \"null\"); // EXTENSIONS\n\n CodeMirror.defineExtension = function (name, func) {\n CodeMirror.prototype[name] = func;\n };\n\n CodeMirror.defineDocExtension = function (name, func) {\n Doc.prototype[name] = func;\n };\n\n CodeMirror.fromTextArea = fromTextArea;\n addLegacyProps(CodeMirror);\n CodeMirror.version = \"5.52.2\";\n return CodeMirror;\n});"],"sourceRoot":""}