text: 'use strict';var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(m,u,x){m instanceof String&&(m=String(m));for(var B=m.length,q=0;q<B;q++){var I=m[q];if(u.call(x,I,q,m))return{i:q,v:I}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;
  $jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(m,u,x){if(m==Array.prototype||m==Object.prototype)return m;m[u]=x.value;return m};$jscomp.getGlobal=function(m){m=["object"==typeof globalThis&&globalThis,m,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var u=0;u<m.length;++u){var x=m[u];if(x&&x.Math==Math)return x}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
  $jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(m,u){var x=$jscomp.propertyToPolyfillSymbol[u];if(null==x)return m[u];x=m[x];return void 0!==x?x:m[u]};
  $jscomp.polyfill=function(m,u,x,B){u&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(m,u,x,B):$jscomp.polyfillUnisolated(m,u,x,B))};$jscomp.polyfillUnisolated=function(m,u,x,B){x=$jscomp.global;m=m.split(".");for(B=0;B<m.length-1;B++){var q=m[B];if(!(q in x))return;x=x[q]}m=m[m.length-1];B=x[m];u=u(B);u!=B&&null!=u&&$jscomp.defineProperty(x,m,{configurable:!0,writable:!0,value:u})};
  $jscomp.polyfillIsolated=function(m,u,x,B){var q=m.split(".");m=1===q.length;B=q[0];B=!m&&B in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var I=0;I<q.length-1;I++){var Q=q[I];if(!(Q in B))return;B=B[Q]}q=q[q.length-1];x=$jscomp.IS_SYMBOL_NATIVE&&"es6"===x?B[q]:null;u=u(x);null!=u&&(m?$jscomp.defineProperty($jscomp.polyfills,q,{configurable:!0,writable:!0,value:u}):u!==x&&(void 0===$jscomp.propertyToPolyfillSymbol[q]&&(x=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[q]=$jscomp.IS_SYMBOL_NATIVE?
  $jscomp.global.Symbol(q):$jscomp.POLYFILL_PREFIX+x+"$"+q),$jscomp.defineProperty(B,$jscomp.propertyToPolyfillSymbol[q],{configurable:!0,writable:!0,value:u})))};$jscomp.polyfill("Array.prototype.find",function(m){return m?m:function(u,x){return $jscomp.findInternal(this,u,x).v}},"es6","es3");$jscomp.arrayIteratorImpl=function(m){var u=0;return function(){return u<m.length?{done:!1,value:m[u++]}:{done:!0}}};$jscomp.arrayIterator=function(m){return{next:$jscomp.arrayIteratorImpl(m)}};
  $jscomp.initSymbol=function(){};$jscomp.polyfill("Symbol",function(m){if(m)return m;var u=function(I,Q){this.$jscomp$symbol$id_=I;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:Q})};u.prototype.toString=function(){return this.$jscomp$symbol$id_};var x="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",B=0,q=function(I){if(this instanceof q)throw new TypeError("Symbol is not a constructor");return new u(x+(I||"")+"_"+B++,I)};return q},"es6","es3");
  $jscomp.polyfill("Symbol.iterator",function(m){if(m)return m;m=Symbol("Symbol.iterator");for(var u="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),x=0;x<u.length;x++){var B=$jscomp.global[u[x]];"function"===typeof B&&"function"!=typeof B.prototype[m]&&$jscomp.defineProperty(B.prototype,m,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}})}return m},"es6",
  "es3");$jscomp.iteratorPrototype=function(m){m={next:m};m[Symbol.iterator]=function(){return this};return m};$jscomp.iteratorFromArray=function(m,u){m instanceof String&&(m+="");var x=0,B=!1,q={next:function(){if(!B&&x<m.length){var I=x++;return{value:u(I,m[I]),done:!1}}B=!0;return{done:!0,value:void 0}}};q[Symbol.iterator]=function(){return q};return q};$jscomp.polyfill("Array.prototype.keys",function(m){return m?m:function(){return $jscomp.iteratorFromArray(this,function(u){return u})}},"es6","es3");
  $jscomp.checkStringArgs=function(m,u,x){if(null==m)throw new TypeError("The 'this' value for String.prototype."+x+" must not be null or undefined");if(u instanceof RegExp)throw new TypeError("First argument to String.prototype."+x+" must not be a regular expression");return m+""};
  $jscomp.polyfill("String.prototype.repeat",function(m){return m?m:function(u){var x=$jscomp.checkStringArgs(this,null,"repeat");if(0>u||1342177279<u)throw new RangeError("Invalid count value");u|=0;for(var B="";u;)if(u&1&&(B+=x),u>>>=1)x+=x;return B}},"es6","es3");
  (function(m){"object"==typeof exports&&"object"==typeof module?m(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/dialog/dialog"),require("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],m):m(CodeMirror)})(function(m){var u=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",
  type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"<Del>",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",
  toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",
  type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,
  toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",
  motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,
  bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",
  motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",
  motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",
  type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},
  {keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",
  motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,
  toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",
  type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",
  motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",
  type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",
  operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},
  {keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",
  type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},
  context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",
  type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<character>",
  type:"action",action:"replayMacro"},{keys:"q<character>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",
  operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<character>",type:"action",action:"setMark"},{keys:'"<character>',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},
  {keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",
  action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},
  {keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],x=
  u.length,B=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",
  shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"global",shortName:"g"}],q=m.Pos;m.Vim=function(){function I(a,b){this==m.keyMap.vim&&(m.rmClass(a.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==a.getOption("inputStyle")&&null!=document.body.style.caretColor&&(Ha(a),a.off("cursorActivity",ta),a.state.fatCursorMarks=null,a.getInputField().style.caretColor=""));b&&b.attach==Q||(a.setOption("disableInput",!1),a.off("cursorActivity",
  Ia),m.off(a.getInputField(),"paste",Ja(a)),a.state.vim=null)}function Q(a,b){this==m.keyMap.vim&&(m.addClass(a.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==a.getOption("inputStyle")&&null!=document.body.style.caretColor&&(a.state.fatCursorMarks=[],ta(a),a.on("cursorActivity",ta),a.getInputField().style.caretColor="transparent"));b&&b.attach==Q||(a.setOption("disableInput",!0),a.setOption("showCursorWhenSelecting",!1),m.signal(a,"vim-mode-change",{mode:"normal"}),a.on("cursorActivity",Ia),
  la(a),m.on(a.getInputField(),"paste",Ja(a)))}function ta(a){if(a.state.fatCursorMarks){Ha(a);for(var b=a.listSelections(),c=[],d=0;d<b.length;d++){var f=b[d];if(f.empty()){var e=a.getLine(f.anchor.line).length;f.anchor.ch<e?c.push(a.markText(f.anchor,q(f.anchor.line,f.anchor.ch+1),{className:"cm-fat-cursor-mark"})):c.push(a.markText(q(f.anchor.line,e-1),q(f.anchor.line,e),{className:"cm-fat-cursor-mark"}))}}a.state.fatCursorMarks=c}}function Ha(a){if(a=a.state.fatCursorMarks)for(var b=0;b<a.length;b++)a[b].clear()}
  function ua(a,b){if(b){if(this[a])return this[a];a=xb(a);if(!a)return!1;var c=m.Vim.findKey(b,a);"function"==typeof c&&m.signal(b,"vim-keypress",a);return c}}function xb(a){if("'"==a.charAt(0))return a.charAt(1);a=a.split(/-(?!$)/);var b=a[a.length-1];if(1==a.length&&1==a[0].length||2==a.length&&"Shift"==a[0]&&1==b.length)return!1;for(var c=!1,d=0;d<a.length;d++){var f=a[d];f in Ka?a[d]=Ka[f]:c=!0;f in La&&(a[d]=La[f])}if(!c)return!1;fa.test(b)&&(a[a.length-1]=b.toLowerCase());return"<"+a.join("-")+
  ">"}function Ja(a){var b=a.state.vim;b.onPasteFn||(b.onPasteFn=function(){b.insertMode||(a.setCursor(K(a.getCursor(),0,1)),ma.enterInsertMode(a,{},b))});return b.onPasteFn}function va(a,b){for(var c=[],d=a;d<a+b;d++)c.push(String.fromCharCode(d));return c}function wa(a,b){return b>=a.firstLine()&&b<=a.lastLine()}function ba(a){return/^\s*$/.test(a)}function xa(a,b){for(var c=0;c<b.length;c++)if(b[c]==a)return!0;return!1}function na(a,b,c,d,f){if(void 0===b&&!f)throw Error("defaultValue is required unless callback is provided");
  c||(c="string");W[a]={type:c,defaultValue:b,callback:f};if(d)for(c=0;c<d.length;c++)W[d[c]]=W[a];b&&ya(a,b)}function ya(a,b,c,d){var f=W[a];d=d||{};d=d.scope;if(!f)return Error("Unknown option: "+a);if("boolean"==f.type){if(b&&!0!==b)return Error("Invalid argument: "+a+"="+b);!1!==b&&(b=!0)}f.callback?("local"!==d&&f.callback(b,void 0),"global"!==d&&c&&f.callback(b,c)):("local"!==d&&(f.value="boolean"==f.type?!!b:b),"global"!==d&&c&&(c.state.vim.options[a]={value:b}))}function ca(a,b,c){var d=W[a];
  c=c||{};c=c.scope;if(!d)return Error("Unknown option: "+a);if(d.callback){a=b&&d.callback(void 0,b);if("global"!==c&&void 0!==a)return a;if("local"!==c)return d.callback()}else return a="global"!==c&&b&&b.state.vim.options[a],(a||"local"!==c&&d||{}).value}function Ma(){this.latestRegister=void 0;this.isRecording=this.isPlaying=!1;this.replaySearchQueries=[];this.onRecordingDone=void 0;this.lastInsertModeChanges=Na()}function la(a){a.state.vim||(a.state.vim={inputState:new oa,lastEditInputState:void 0,
  lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}});return a.state.vim}function Oa(){v={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:yb(),macroModeState:new Ma,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new Pa({}),searchHistoryController:new za,
  exCommandHistoryController:new za};for(var a in W){var b=W[a];b.value=b.defaultValue}}function oa(){this.prefixRepeat=[];this.motionRepeat=[];this.motionArgs=this.motion=this.operatorArgs=this.operator=null;this.keyBuffer=[];this.registerName=null}function N(a,b){a.state.vim.inputState=new oa;m.signal(a,"vim-command-done",b)}function R(a,b,c){this.clear();this.keyBuffer=[a||""];this.insertModeChanges=[];this.searchQueries=[];this.linewise=!!b;this.blockwise=!!c}function Pa(a){this.registers=a;this.unnamedRegister=
  a['"']=new R;a["."]=new R;a[":"]=new R;a["/"]=new R}function za(){this.historyBuffer=[];this.iterator=0;this.initialPrefix=null}function Qa(a,b){for(var c=[],d=0;d<b;d++)c.push(a);return c}function M(a,b){var c=a.state.vim,d=c.insertMode||c.visualMode;c=Math.min(Math.max(a.firstLine(),b.line),a.lastLine());a=H(a,c)-1+!!d;return q(c,Math.min(Math.max(0,b.ch),a))}function pa(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function K(a,b,c){"object"===typeof b&&(c=b.ch,b=b.line);return q(a.line+
  b,a.ch+c)}function Ra(a,b,c){return function(){for(var d=0;d<c;d++)b(a)}}function F(a){return q(a.line,a.ch)}function O(a,b){return a.ch==b.ch&&a.line==b.line}function G(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch?!0:!1}function P(a,b){2<arguments.length&&(b=P.apply(void 0,Array.prototype.slice.call(arguments,1)));return G(a,b)?a:b}function da(a,b){2<arguments.length&&(b=da.apply(void 0,Array.prototype.slice.call(arguments,1)));return G(a,b)?b:a}function Sa(a,b,c){a=G(a,b);b=G(b,c);return a&&
  b}function H(a,b){return a.getLine(b).length}function Aa(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function zb(a,b,c){var d=H(a,b);c=Array(c-d+1).join(" ");a.setCursor(q(b,d));a.replaceRange(c,a.getCursor())}function Ta(a,b){var c=[],d=a.listSelections(),f=F(a.clipPos(b)),e=!O(b,f),h;a:{var k=a.getCursor("head");for(h=0;h<d.length;h++){var g=O(d[h].anchor,k),l=O(d[h].head,k);if(g||l)break a}h=-1}k=O(d[h].head,d[h].anchor);g=d.length-1;var p=g-h>h?g:0;h=d[p].anchor;var n=Math.min(h.line,
  f.line);g=Math.max(h.line,f.line);l=h.ch;f=f.ch;d=d[p].head.ch-l;p=f-l;0<d&&0>=p?(l++,e||f--):0>d&&0<=p?(l--,k||f++):0>d&&-1==p&&(l--,f++);for(e=n;e<=g;e++)d={anchor:new q(e,l),head:new q(e,f)},c.push(d);a.setSelections(c);b.ch=f;h.ch=l;return h}function Ua(a,b,c){for(var d=[],f=0;f<c;f++){var e=K(b,f,0);d.push({anchor:e,head:e})}a.setSelections(d,0)}function Ab(a,b){var c=b.lastSelection,d=function(){var e=a.listSelections(),h=e[0];e=e[e.length-1];h=G(h.anchor,h.head)?h.anchor:h.head;e=G(e.anchor,
  e.head)?e.head:e.anchor;return[h,e]},f=function(){var e=a.getCursor(),h=a.getCursor(),k=c.visualBlock;if(k){h=q(e.line+k.height,e.ch+k.width);k=[];for(var g=e.line;g<h.line;g++){var l=q(g,e.ch),p=q(g,h.ch);k.push({anchor:l,head:p})}a.setSelections(k)}else g=c.anchorMark.find(),l=c.headMark.find(),k=l.line-g.line,g=l.ch-g.ch,h={line:h.line+k,ch:k?h.ch:g+h.ch},c.visualLine&&(e=q(e.line,0),h=q(h.line,H(a,h.line))),a.setSelection(e,h);return[e,h]};return b.visualMode?d():f()}function Va(a,b){var c=b.sel.anchor,
  d=b.sel.head;b.lastPastedText&&(d=a.posFromIndex(a.indexFromPos(c)+b.lastPastedText.length),b.lastPastedText=null);b.lastSelection={anchorMark:a.setBookmark(c),headMark:a.setBookmark(d),anchor:F(c),head:F(d),visualMode:b.visualMode,visualLine:b.visualLine,visualBlock:b.visualBlock}}function ha(a,b,c){var d=a.state.vim;b=b||d.sel;c=c||d.visualLine?"line":d.visualBlock?"block":"char";b=Ba(a,b,c);a.setSelections(b.ranges,b.primary);Wa(a)}function Ba(a,b,c,d){var f=F(b.head),e=F(b.anchor);if("char"==
  c)return f=d||G(b.head,b.anchor)?0:1,e=G(b.head,b.anchor)?1:0,f=K(b.head,0,f),e=K(b.anchor,0,e),{ranges:[{anchor:e,head:f}],primary:0};if("line"==c)return G(b.head,b.anchor)?(f.ch=0,e.ch=H(a,e.line)):(e.ch=0,b=a.lastLine(),f.line>b&&(f.line=b),f.ch=H(a,f.line)),{ranges:[{anchor:e,head:f}],primary:0};if("block"==c){b=Math.min(e.line,f.line);a=Math.min(e.ch,f.ch);c=Math.max(e.ch,f.ch)+1;e=Math.max(e.line,f.line)-b+1;f=f.line==b?0:e-1;d=[];for(var h=0;h<e;h++)d.push({anchor:q(b+h,a),head:q(b+h,c)});
  return{ranges:d,primary:f}}}function S(a,b){var c=a.state.vim;!1!==b&&a.setCursor(M(a,c.sel.head));Va(a,c);c.visualMode=!1;c.visualLine=!1;c.visualBlock=!1;c.insertMode||m.signal(a,"vim-mode-change",{mode:"normal"});Xa(c)}function T(a){if(!a)return 0;var b=a.search(/\S/);return-1==b?a.length:b}function qa(a,b,c,d,f){c=a.getCursor("head");1==a.getSelection().length&&(c=P(c,a.getCursor("anchor")));a=a.getLine(c.line);var e=c.ch;for(f=f?ra[0]:Ca[0];!f(a.charAt(e));)if(e++,e>=a.length)return null;d?f=
  Ca[0]:(f=ra[0],f(a.charAt(e))||(f=ra[1]));for(d=e;f(a.charAt(d))&&d<a.length;)d++;for(;f(a.charAt(e))&&0<=e;)e--;e++;if(b){for(b=d;/\s/.test(a.charAt(d))&&d<a.length;)d++;if(b==d){for(b=e;/\s/.test(a.charAt(e-1))&&0<e;)e--;e||(e=b)}}return{start:q(c.line,e),end:q(c.line,d)}}function Ya(a,b){v.lastCharacterSearch.increment=a;v.lastCharacterSearch.forward=b.forward;v.lastCharacterSearch.selectedCharacter=b.selectedCharacter}function Za(a,b,c,d,f){b=q(b.line+c.repeat-1,Infinity);c=a.clipPos(b);c.ch--;
  f||(d.lastHPos=Infinity,d.lastHSPos=a.charCoords(c,"div").left);return b}function Da(a,b,c,d){for(var f=a.getCursor(),e=f.ch,h,k=0;k<b;k++){h=a.getLine(f.line);var g=d;h=c?h.indexOf(g,e+1):h.lastIndexOf(g,e-1);if(-1==h)return null;e=h}return q(a.getCursor().line,h)}function X(a,b,c,d){xa(c,Bb)&&(b.marks[c]&&b.marks[c].clear(),b.marks[c]=a.setBookmark(d))}function $a(a,b,c,d,f){function e(l,p,n){return n?!a.getLine(l)!=!a.getLine(l+p):!!a.getLine(l)&&!a.getLine(l+p)}b=b.line;var h=a.firstLine(),k=
  a.lastLine(),g=b;if(d){for(;h<=g&&g<=k&&0<c;)e(g,d)&&c--,g+=d;return new q(g,0)}g=a.state.vim;g.visualLine&&e(b,1,!0)&&(g=g.sel.anchor,e(g.line,-1,!0)&&(f&&g.line==b||(b+=1)));d=!a.getLine(b);for(g=b;g<=k&&c;g++)e(g,1,!0)&&(f&&!a.getLine(g)==d||c--);c=new q(g,0);g>k&&!d?d=!0:f=!1;for(g=b;g>h&&(f&&!a.getLine(g)!=d&&g!=b||!e(g,-1,!0));g--);return{start:new q(g,0),end:c}}function Cb(a,b,c,d){function f(k,g){0>g.pos+g.dir||g.pos+g.dir>=g.line.length?(g.ln+=g.dir,wa(k,g.ln)?(g.line=k.getLine(g.ln),g.pos=
  0<g.dir?0:g.line.length-1):(g.line=null,g.ln=null,g.pos=null)):g.pos+=g.dir}function e(k,g,l,p){var n=k.getLine(g),t=""===n;n={line:n,ln:g,pos:l,dir:p};g={ln:n.ln,pos:n.pos};l=""===n.line;for(f(k,n);null!==n.line;){g.ln=n.ln;g.pos=n.pos;if(""!==n.line||l){if(t&&""!==n.line&&!ba(n.line[n.pos]))return{ln:n.ln,pos:n.pos};-1==".?!".indexOf(n.line[n.pos])||t||n.pos!==n.line.length-1&&!ba(n.line[n.pos+1])||(t=!0)}else return{ln:n.ln,pos:n.pos};f(k,n)}n=k.getLine(g.ln);g.pos=0;for(k=n.length-1;0<=k;--k)if(!ba(n[k])){g.pos=
  k;break}return g}function h(k,g,l,p){var n=k.getLine(g);n={line:n,ln:g,pos:l,dir:p};g={ln:n.ln,pos:null};l=""===n.line;for(f(k,n);null!==n.line;){if(""!==n.line||l){if(-1!=".?!".indexOf(n.line[n.pos])&&null!==g.pos&&(n.ln!==g.ln||n.pos+1!==g.pos))return g;""===n.line||ba(n.line[n.pos])||(l=!1,g={ln:n.ln,pos:n.pos})}else return null!==g.pos?g:{ln:n.ln,pos:n.pos};f(k,n)}n=k.getLine(g.ln);for(k=g.pos=0;k<n.length;++k)if(!ba(n[k])){g.pos=k;break}return g}for(b={ln:b.line,pos:b.ch};0<c;)b=0>d?h(a,b.ln,
  b.pos,d):e(a,b.ln,b.pos,d),c--;return q(b.ln,b.pos)}function ab(){}function U(a){a=a.state.vim;return a.searchState_||(a.searchState_=new ab)}function bb(a,b){b=cb(a,b)||[];if(!b.length)return[];var c=[];if(0===b[0]){for(var d=0;d<b.length;d++)"number"==typeof b[d]&&c.push(a.substring(b[d]+1,b[d+1]));return c}}function cb(a,b){b||(b="/");for(var c=!1,d=[],f=0;f<a.length;f++){var e=a.charAt(f);c||e!=b||d.push(f);c=!c&&"\\"==e}return d}function Z(a){"string"===typeof a&&(a=document.createElement(a));
  for(var b,c=1;c<arguments.length;c++)if(b=arguments[c])if("object"!==typeof b&&(b=document.createTextNode(b)),b.nodeType)a.appendChild(b);else for(var d in b)Object.prototype.hasOwnProperty.call(b,d)&&("$"===d[0]?a.style[d.slice(1)]=b[d]:a.setAttribute(d,b[d]));return a}function E(a,b){b=Z("pre",{$color:"red"},b);a.openNotification?a.openNotification(b,{bottom:!0,duration:5E3}):alert(b.innerText)}function sa(a,b){var c=(b.prefix||"")+" "+(b.desc||"");var d=b.prefix;var f=b.desc;d=Z(document.createDocumentFragment(),
  Z("span",{$fontFamily:"monospace",$whiteSpace:"pre"},d,Z("input",{type:"text",autocorrect:"off",autocapitalize:"off",spellcheck:"false"})),f&&Z("span",{$color:"#888"},f));if(a.openDialog)a.openDialog(d,b.onClose,{onKeyDown:b.onKeyDown,onKeyUp:b.onKeyUp,bottom:!0,selectValueOnOpen:!1,value:b.value});else b.onClose(prompt(c,""))}function ia(a,b,c,d){if(b){var f=U(a);c=!!c;d=!!d;v.registerController.getRegister("/").setText(b);if(b instanceof RegExp)var e=b;else{var h=cb(b,"/");if(h.length){var k=b.substring(0,
  h[0]);e=-1!=b.substring(h[0]).indexOf("i")}else k=b;if(k){if(!ca("pcre")){b=k;h=!1;k=[];for(var g=-1;g<b.length;g++){var l=b.charAt(g)||"",p=b.charAt(g+1)||"",n=p&&-1!="|(){".indexOf(p);h?("\\"===l&&n||k.push(l),h=!1):"\\"===l?(h=!0,p&&-1!="}".indexOf(p)&&(n=!0),n&&"\\"!==p||k.push(l)):(k.push(l),n&&"\\"!==p&&k.push("\\"))}k=k.join("")}d&&(c=/^[^A-Z]*$/.test(k));e=new RegExp(k,c||e?"i":void 0)}else e=null}if(e){db(a,e);a:if(a=f.getQuery(),e instanceof RegExp&&a instanceof RegExp){c=["global","multiline",
  "ignoreCase","source"];for(d=0;d<c.length;d++)if(b=c[d],e[b]!==a[b]){a=!1;break a}a=!0}else a=!1;if(a)return e;f.setQuery(e);return e}}}function Db(a){if("^"==a.source.charAt(0))var b=!0;return{token:function(c){if(b&&!c.sol())c.skipToEnd();else{var d=c.match(a,!1);if(d){if(0==d[0].length)return c.next(),"searching";if(!c.sol()&&(c.backUp(1),!a.exec(c.next()+d[0])))return c.next(),null;c.match(a);return"searching"}for(;!c.eol()&&(c.next(),!c.match(a,!1)););}},query:a}}function db(a,b){clearTimeout(eb);
  eb=setTimeout(function(){var c=U(a),d=c.getOverlay();d&&b==d.query||(d&&a.removeOverlay(d),d=Db(b),a.addOverlay(d),a.showMatchesOnScrollbar&&(c.getScrollbarAnnotate()&&c.getScrollbarAnnotate().clear(),c.setScrollbarAnnotate(a.showMatchesOnScrollbar(b))),c.setOverlay(d))},50)}function fb(a,b,c,d){void 0===d&&(d=1);return a.operation(function(){for(var f=a.getCursor(),e=a.getSearchCursor(c,f),h=0;h<d;h++){var k=e.find(b);0==h&&k&&O(e.from(),f)&&(k=e.find(b));if(!k&&(e=a.getSearchCursor(c,b?q(a.lastLine()):
  q(a.firstLine(),0)),!e.find(b)))return}return e.from()})}function Eb(a,b,c,d,f){void 0===d&&(d=1);return a.operation(function(){var e=a.getCursor(),h=a.getSearchCursor(c,e),k=h.find(!b);!f.visualMode&&k&&O(h.from(),e)&&h.find(!b);for(e=0;e<d;e++)if(k=h.find(b),!k&&(h=a.getSearchCursor(c,b?q(a.lastLine()):q(a.firstLine(),0)),!h.find(b)))return;return[h.from(),h.to()]})}function Ea(a){var b=U(a);a.removeOverlay(U(a).getOverlay());b.setOverlay(null);b.getScrollbarAnnotate()&&(b.getScrollbarAnnotate().clear(),
  b.setScrollbarAnnotate(null))}function Fb(a,b,c){"number"!=typeof a&&(a=a.line);return b instanceof Array?xa(a,b):"number"==typeof c?a>=b&&a<=c:a==b}function Fa(a){var b=a.getScrollInfo(),c=a.coordsChar({left:0,top:6+b.top},"local");a=a.coordsChar({left:0,top:b.clientHeight-10+b.top},"local");return{top:c.line,bottom:a.line}}function gb(a,b,c){return"'"==c||"`"==c?v.jumpList.find(a,-1)||q(0,0):"."==c?hb(a):(a=b.marks[c])&&a.find()}function hb(a){a=a.doc.history.done;for(var b=a.length;b--;)if(a[b].changes)return F(a[b].changes[0].to)}
  function Gb(a,b,c,d,f,e,h,k,g){function l(){a.operation(function(){for(;!w;)p(),n();t()})}function p(){var y=a.getRange(e.from(),e.to()).replace(h,k),L=e.to().line;e.replace(y);z=e.to().line;f+=z-L;A=z<L}function n(){for(;e.findNext()&&Fb(e.from(),d,f);)if(c||e.from().line!=z||A){a.scrollIntoView(e.from(),30);a.setSelection(e.from(),e.to());r=e.from();w=!1;return}w=!0}function t(y){y&&y();a.focus();r&&(a.setCursor(r),y=a.state.vim,y.exMode=!1,y.lastHPos=y.lastHSPos=r.ch);g&&g()}a.state.vim.exMode=
  !0;var w=!1,r,z,A;n();w?E(a,"No matches for "+h.source):b?sa(a,{prefix:Z("span","replace with ",Z("strong",k)," (y/n/a/q/l)"),onKeyDown:function(y,L,C){m.e_stop(y);switch(m.keyName(y)){case "Y":p();n();break;case "N":n();break;case "A":y=g;g=void 0;a.operation(l);g=y;break;case "L":p();case "Q":case "Esc":case "Ctrl-C":case "Ctrl-[":t(C)}w&&t(C);return!0}}):(l(),g&&g())}function ja(a){var b=a.state.vim,c=v.macroModeState,d=v.registerController.getRegister("."),f=c.isPlaying,e=c.lastInsertModeChanges;
  f||(a.off("change",ib),m.off(a.getInputField(),"keydown",jb));!f&&1<b.insertModeRepeat&&(kb(a,b,b.insertModeRepeat-1,!0),b.lastEditInputState.repeatOverride=b.insertModeRepeat);delete b.insertModeRepeat;b.insertMode=!1;a.setCursor(a.getCursor().line,a.getCursor().ch-1);a.setOption("keyMap","vim");a.setOption("disableInput",!0);a.toggleOverwrite(!1);d.setText(e.changes.join(""));m.signal(a,"vim-mode-change",{mode:"normal"});c.isRecording&&(c.isPlaying||(a=v.registerController.getRegister(c.latestRegister))&&
  a.pushInsertModeChanges&&a.pushInsertModeChanges(c.lastInsertModeChanges))}function lb(a){u.unshift(a)}function ib(a,b){var c=v.macroModeState,d=c.lastInsertModeChanges;if(!c.isPlaying)for(;b;){d.expectCursorActivityForChange=!0;if(1<d.ignoreCount)d.ignoreCount--;else if("+input"==b.origin||"paste"==b.origin||void 0===b.origin)c=a.listSelections().length,1<c&&(d.ignoreCount=c),c=b.text.join("\n"),d.maybeReset&&(d.changes=[],d.maybeReset=!1),c&&(a.state.overwrite&&!/\n/.test(c)?d.changes.push([c]):
  d.changes.push(c));b=b.next}}function Ia(a){var b=a.state.vim;if(b.insertMode){var c=v.macroModeState;if(c.isPlaying)return;c=c.lastInsertModeChanges;c.expectCursorActivityForChange?c.expectCursorActivityForChange=!1:c.maybeReset=!0}else if(!a.curOp.isVimOp){c=a.getCursor("anchor");var d=a.getCursor("head");b.visualMode&&!a.somethingSelected()?S(a,!1):b.visualMode||b.insertMode||!a.somethingSelected()||(b.visualMode=!0,b.visualLine=!1,m.signal(a,"vim-mode-change",{mode:"visual"}));if(b.visualMode){var f=
  G(d,c)?0:-1,e=G(d,c)?-1:0;d=K(d,0,f);c=K(c,0,e);b.sel={anchor:c,head:d};X(a,b,"<",P(d,c));X(a,b,">",da(d,c))}else b.insertMode||(b.lastHPos=a.getCursor().ch)}b.visualMode&&Wa(a)}function Wa(a){var b=a.state.vim,c=M(a,F(b.sel.head)),d=K(c,0,1);Xa(b);c.ch==a.getLine(c.line).length?(d=Z("span",{"class":"cm-animate-fat-cursor"},"\u00a0"),b.fakeCursorBookmark=a.setBookmark(c,{widget:d})):b.fakeCursor=a.markText(c,d,{className:"cm-animate-fat-cursor"})}function Xa(a){a.fakeCursor&&(a.fakeCursor.clear(),
  a.fakeCursor=null);a.fakeCursorBookmark&&(a.fakeCursorBookmark.clear(),a.fakeCursorBookmark=null)}function Ga(a){this.keyName=a}function jb(a){function b(){c.maybeReset&&(c.changes=[],c.maybeReset=!1);c.changes.push(new Ga(d));return!0}var c=v.macroModeState.lastInsertModeChanges,d=m.keyName(a);d&&(-1==d.indexOf("Delete")&&-1==d.indexOf("Backspace")||m.lookupKey(d,"vim-insert",b))}function kb(a,b,c,d){function f(){k?aa.processAction(a,b,b.lastEditActionCommand):aa.evalInput(a,b)}function e(p){0<h.lastInsertModeChanges.changes.length&&
  (p=b.lastEditActionCommand?p:1,mb(a,h.lastInsertModeChanges.changes,p))}var h=v.macroModeState;h.isPlaying=!0;var k=!!b.lastEditActionCommand,g=b.inputState;b.inputState=b.lastEditInputState;if(k&&b.lastEditActionCommand.interlaceInsertRepeat)for(var l=0;l<c;l++)f(),e(1);else d||f(),e(c);b.inputState=g;b.insertMode&&!d&&ja(a);h.isPlaying=!1}function mb(a,b,c){function d(n){if("string"==typeof n)m.commands[n](a);else n(a);return!0}var f=a.getCursor("head"),e=v.macroModeState.lastInsertModeChanges.visualBlock;
  e&&(Ua(a,f,e+1),c=a.listSelections().length,a.setCursor(f));for(var h=0;h<c;h++){e&&a.setCursor(K(f,h,0));for(var k=0;k<b.length;k++){var g=b[k];if(g instanceof Ga)m.lookupKey(g.keyName,"vim-insert",d);else if("string"==typeof g){var l=a.getCursor();a.replaceRange(g,l,l)}else{l=a.getCursor();var p=K(l,0,g[0].length);a.replaceRange(g[0],l,p)}}}e&&a.setCursor(K(f,0,1))}m.defineOption("vimMode",!1,function(a,b,c){b&&"vim"!=a.getOption("keyMap")?a.setOption("keyMap","vim"):!b&&c!=m.Init&&/^vim/.test(a.getOption("keyMap"))&&
  a.setOption("keyMap","default")});var Ka={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A",CapsLock:""},La={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"},Hb=/[\d]/,ra=[m.isWordChar,function(a){return a&&!m.isWordChar(a)&&!/\s/.test(a)}],Ca=[function(a){return/\S/.test(a)}],nb=va(65,26),ob=va(97,26),pb=va(48,10),Bb=[].concat(nb,ob,pb,["<",">"]),qb=[].concat(nb,ob,pb,'-".:_/'.split(""));try{var fa=RegExp("^[\\p{Lu}]$","u")}catch(a){fa=/^[A-Z]$/}var W={};na("filetype",void 0,"string",["ft"],function(a,
  b){if(void 0!==b){if(void 0===a)return a=b.getOption("mode"),"null"==a?"":a;b.setOption("mode",""==a?"null":a)}});var yb=function(){function a(e,h){b+=h;b>c?b=c:b<d&&(b=d);var k=f[(100+b)%100];if(k&&!k.find()){h=0<h?1:-1;var g;e=e.getCursor();do if(b+=h,(k=f[(100+b)%100])&&(g=k.find())&&!O(e,g))break;while(b<c&&b>d)}return k}var b=-1,c=0,d=0,f=Array(100);return{cachedCursor:void 0,add:function(e,h,k){function g(p){var n=++b%100,t=f[n];t&&t.clear();f[n]=e.setBookmark(p)}var l=f[b%100];l?(l=l.find())&&
  !O(l,h)&&g(h):g(h);g(k);c=b;d=b-100+1;0>d&&(d=0)},find:function(e,h){var k=b;e=a(e,h);b=k;return e&&e.find()},move:a}},Na=function(a){return a?{changes:a.changes,expectCursorActivityForChange:a.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};Ma.prototype={exitMacroRecordMode:function(){var a=v.macroModeState;if(a.onRecordingDone)a.onRecordingDone();a.onRecordingDone=void 0;a.isRecording=!1},enterMacroRecordMode:function(a,b){var c=v.registerController.getRegister(b);
  c&&(c.clear(),this.latestRegister=b,a.openDialog&&(this.onRecordingDone=a.openDialog(document.createTextNode("(recording)["+b+"]"),null,{bottom:!0})),this.isRecording=!0)}};var v,ka,Ib={buildKeyMap:function(){},getRegisterController:function(){return v.registerController},resetVimGlobalState_:Oa,getVimGlobalState_:function(){return v},maybeInitVimState_:la,suppressErrorLogging:!1,InsertModeKey:Ga,map:function(a,b,c){V.map(a,b,c)},unmap:function(a,b){V.unmap(a,b)},noremap:function(a,b,c){function d(n){return n?
  [n]:["normal","insert","visual"]}for(var f=d(c),e=u.length,h=e-x;h<e&&f.length;h++){var k=u[h];if(!(k.keys!=b||c&&k.context&&k.context!==c)&&"ex"!==k.type.substr(0,2)&&"key"!==k.type.substr(0,3)){var g={},l;for(l in k)g[l]=k[l];g.keys=a;c&&!g.context&&(g.context=c);this._mapCommand(g);var p=d(k.context);f=f.filter(function(n){return-1===p.indexOf(n)})}}},mapclear:function(a){var b=u.length,c=u.slice(0,b-x);u=u.slice(b-x);if(a)for(b=c.length-1;0<=b;b--){var d=c[b];if(a!==d.context)if(d.context)this._mapCommand(d);
  else{var f=["normal","insert","visual"],e;for(e in f)if(f[e]!==a){var h={},k;for(k in d)h[k]=d[k];h.context=f[e];this._mapCommand(h)}}}},setOption:ya,getOption:ca,defineOption:na,defineEx:function(a,b,c){if(!b)b=a;else if(0!==a.indexOf(b))throw Error('(Vim.defineEx) "'+b+'" is not a prefix of "'+a+'", command not registered');rb[a]=c;V.commandMap_[b]={name:a,shortName:b,type:"api"}},handleKey:function(a,b,c){a=this.findKey(a,b,c);if("function"===typeof a)return a()},findKey:function(a,b,c){function d(){if("<Esc>"==
  b)return N(a),h.visualMode?S(a):h.insertMode&&ja(a),!0}function f(){if(d())return!0;for(var g=h.inputState.keyBuffer+=b,l=1==b.length,p=aa.matchCommand(g,u,h.inputState,"insert");1<g.length&&"full"!=p.type;){g=h.inputState.keyBuffer=g.slice(1);var n=aa.matchCommand(g,u,h.inputState,"insert");"none"!=n.type&&(p=n)}if("none"==p.type)return N(a),!1;if("partial"==p.type)return ka&&window.clearTimeout(ka),ka=window.setTimeout(function(){h.insertMode&&h.inputState.keyBuffer&&N(a)},ca("insertModeEscKeysTimeout")),
  !l;ka&&window.clearTimeout(ka);if(l){l=a.listSelections();for(n=0;n<l.length;n++){var t=l[n].head;a.replaceRange("",K(t,0,-(g.length-1)),t,"+input")}v.macroModeState.lastInsertModeChanges.changes.pop()}N(a);return p.command}function e(){a:{var g=v.macroModeState;if(g.isRecording){if("q"==b){g.exitMacroRecordMode();N(a);var l=!0;break a}"mapping"!=c&&(l=b,g.isPlaying||(g=v.registerController.getRegister(g.latestRegister))&&g.pushText(l))}l=void 0}if(l||d())return!0;l=h.inputState.keyBuffer+=b;if(/^[1-9]\d*$/.test(l))return!0;
  g=/^(\d*)(.*)$/.exec(l);if(!g)return N(a),!1;var p=h.visualMode?"visual":"normal";g=g[2]||g[1];h.inputState.operatorShortcut&&h.inputState.operatorShortcut.slice(-1)==g&&(g=h.inputState.operatorShortcut);p=aa.matchCommand(g,u,h.inputState,p);if("none"==p.type)return N(a),!1;if("partial"==p.type)return!0;h.inputState.keyBuffer="";g=/^(\d*)(.*)$/.exec(l);g[1]&&"0"!=g[1]&&h.inputState.pushRepeatDigit(g[1]);return p.command}var h=la(a);var k=h.insertMode?f():e();return!1===k?h.insertMode||1!==b.length?
  void 0:function(){return!0}:!0===k?function(){return!0}:function(){return a.operation(function(){a.curOp.isVimOp=!0;try{if("keyToKey"==k.type)for(var g=k.toKeys,l;g;)l=/<\w+-.+?>|<\w+>|./.exec(g),b=l[0],g=g.substring(l.index+b.length),m.Vim.handleKey(a,b,"mapping");else aa.processCommand(a,h,k)}catch(p){throw a.state.vim=void 0,la(a),m.Vim.suppressErrorLogging||console.log(p),p;}return!0})}},handleEx:function(a,b){V.processCommand(a,b)},defineMotion:function(a,b){Y[a]=b},defineAction:function(a,b){ma[a]=
  b},defineOperator:function(a,b){sb[a]=b},mapCommand:function(a,b,c,d,f){a={keys:a,type:b};a[b]=c;a[b+"Args"]=d;for(var e in f)a[e]=f[e];lb(a)},_mapCommand:lb,defineRegister:function(a,b){var c=v.registerController.registers;if(!a||1!=a.length)throw Error("Register name must be 1 character");if(c[a])throw Error("Register already defined "+a);c[a]=b;qb.push(a)},exitVisualMode:S,exitInsertMode:ja};oa.prototype.pushRepeatDigit=function(a){this.operator?this.motionRepeat=this.motionRepeat.concat(a):this.prefixRepeat=
  this.prefixRepeat.concat(a)};oa.prototype.getRepeat=function(){var a=0;if(0<this.prefixRepeat.length||0<this.motionRepeat.length)a=1,0<this.prefixRepeat.length&&(a*=parseInt(this.prefixRepeat.join(""),10)),0<this.motionRepeat.length&&(a*=parseInt(this.motionRepeat.join(""),10));return a};R.prototype={setText:function(a,b,c){this.keyBuffer=[a||""];this.linewise=!!b;this.blockwise=!!c},pushText:function(a,b){b&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0);this.keyBuffer.push(a)},pushInsertModeChanges:function(a){this.insertModeChanges.push(Na(a))},
  pushSearchQuery:function(a){this.searchQueries.push(a)},clear:function(){this.keyBuffer=[];this.insertModeChanges=[];this.searchQueries=[];this.linewise=!1},toString:function(){return this.keyBuffer.join("")}};Pa.prototype={pushText:function(a,b,c,d,f){if("_"!==a){d&&"\n"!==c.charAt(c.length-1)&&(c+="\n");var e=this.isValidRegister(a)?this.getRegister(a):null;if(e)fa.test(a)?e.pushText(c,d):e.setText(c,d,f),this.unnamedRegister.setText(e.toString(),d);else{switch(b){case "yank":this.registers["0"]=
  new R(c,d,f);break;case "delete":case "change":-1==c.indexOf("\n")?this.registers["-"]=new R(c,d):(this.shiftNumericRegisters_(),this.registers["1"]=new R(c,d))}this.unnamedRegister.setText(c,d,f)}}},getRegister:function(a){if(!this.isValidRegister(a))return this.unnamedRegister;a=a.toLowerCase();this.registers[a]||(this.registers[a]=new R);return this.registers[a]},isValidRegister:function(a){return a&&xa(a,qb)},shiftNumericRegisters_:function(){for(var a=9;2<=a;a--)this.registers[a]=this.getRegister(""+
  (a-1))}};za.prototype={nextMatch:function(a,b){var c=this.historyBuffer,d=b?-1:1;null===this.initialPrefix&&(this.initialPrefix=a);for(var f=this.iterator+d;b?0<=f:f<c.length;f+=d)for(var e=c[f],h=0;h<=e.length;h++)if(this.initialPrefix==e.substring(0,h))return this.iterator=f,e;if(f>=c.length)return this.iterator=c.length,this.initialPrefix;if(0>f)return a},pushInput:function(a){var b=this.historyBuffer.indexOf(a);-1<b&&this.historyBuffer.splice(b,1);a.length&&this.historyBuffer.push(a)},reset:function(){this.initialPrefix=
  null;this.iterator=this.historyBuffer.length}};var aa={matchCommand:function(a,b,c,d){var f=[];var e=[];for(var h=0;h<b.length;h++){var k=b[h],g;if(g=!("insert"==d&&"insert"!=k.context||k.context&&k.context!=d||c.operator&&"action"==k.type)){var l=a;var p=k.keys;if("<character>"==p.slice(-11)){g=p.length-11;var n=l.slice(0,g);p=p.slice(0,g);l=n==p&&l.length>g?"full":0==p.indexOf(n)?"partial":!1}else l=l==p?"full":0==p.indexOf(l)?"partial":!1;g=l}g&&("partial"==l&&f.push(k),"full"==l&&e.push(k))}b=
  f.length&&f;e=e.length&&e;if(!e&&!b)return{type:"none"};if(!e&&b)return{type:"partial"};var t;for(b=0;b<e.length;b++)d=e[b],t||(t=d);if("<character>"==t.keys.slice(-11)){a=(e=/^.*(<[^>]+>)$/.exec(a))?e[1]:a.slice(-1);if(1<a.length)switch(a){case "<CR>":a="\n";break;case "<Space>":a=" ";break;default:a=""}if(!a)return{type:"none"};c.selectedCharacter=a}return{type:"full",command:t}},processCommand:function(a,b,c){b.inputState.repeatOverride=c.repeatOverride;switch(c.type){case "motion":this.processMotion(a,
  b,c);break;case "operator":this.processOperator(a,b,c);break;case "operatorMotion":this.processOperatorMotion(a,b,c);break;case "action":this.processAction(a,b,c);break;case "search":this.processSearch(a,b,c);break;case "ex":case "keyToEx":this.processEx(a,b,c)}},processMotion:function(a,b,c){b.inputState.motion=c.motion;b.inputState.motionArgs=pa(c.motionArgs);this.evalInput(a,b)},processOperator:function(a,b,c){var d=b.inputState;if(d.operator){if(d.operator==c.operator){d.motion="expandToLine";
  d.motionArgs={linewise:!0};this.evalInput(a,b);return}N(a)}d.operator=c.operator;d.operatorArgs=pa(c.operatorArgs);1<c.keys.length&&(d.operatorShortcut=c.keys);c.exitVisualBlock&&(b.visualBlock=!1,ha(a));b.visualMode&&this.evalInput(a,b)},processOperatorMotion:function(a,b,c){var d=b.visualMode,f=pa(c.operatorMotionArgs);f&&d&&f.visualLine&&(b.visualLine=!0);this.processOperator(a,b,c);d||this.processMotion(a,b,c)},processAction:function(a,b,c){var d=b.inputState,f=d.getRepeat(),e=!!f,h=pa(c.actionArgs)||
  {};d.selectedCharacter&&(h.selectedCharacter=d.selectedCharacter);c.operator&&this.processOperator(a,b,c);c.motion&&this.processMotion(a,b,c);(c.motion||c.operator)&&this.evalInput(a,b);h.repeat=f||1;h.repeatIsExplicit=e;h.registerName=d.registerName;N(a);b.lastMotion=null;c.isEdit&&this.recordLastEdit(b,d,c);ma[c.action](a,h,b)},processSearch:function(a,b,c){function d(r,z,A){v.searchHistoryController.pushInput(r);v.searchHistoryController.reset();try{ia(a,r,z,A)}catch(y){E(a,"Invalid regex: "+r);
  N(a);return}aa.processMotion(a,b,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:c.searchArgs.toJumplist}})}function f(r){a.scrollTo(n.left,n.top);d(r,!0,!0);var z=v.macroModeState;z.isRecording&&(z.isPlaying||(z=v.registerController.getRegister(z.latestRegister))&&z.pushSearchQuery&&z.pushSearchQuery(r))}function e(r,z,A){var y=m.keyName(r);if("Up"==y||"Down"==y){var L=r.target?r.target.selectionEnd:0;z=v.searchHistoryController.nextMatch(z,"Up"==y?!0:!1)||"";A(z);L&&r.target&&
  (r.target.selectionEnd=r.target.selectionStart=Math.min(L,r.target.value.length))}else"Left"!=y&&"Right"!=y&&"Ctrl"!=y&&"Alt"!=y&&"Shift"!=y&&v.searchHistoryController.reset();try{var C=ia(a,z,!0,!0)}catch(D){}C?a.scrollIntoView(fb(a,!k,C),30):(Ea(a),a.scrollTo(n.left,n.top))}function h(r,z,A){var y=m.keyName(r);"Esc"==y||"Ctrl-C"==y||"Ctrl-["==y||"Backspace"==y&&""==z?(v.searchHistoryController.pushInput(z),v.searchHistoryController.reset(),ia(a,p),Ea(a),a.scrollTo(n.left,n.top),m.e_stop(r),N(a),
  A(),a.focus()):"Up"==y||"Down"==y?m.e_stop(r):"Ctrl-U"==y&&(m.e_stop(r),A(""))}if(a.getSearchCursor){var k=c.searchArgs.forward,g=c.searchArgs.wholeWordOnly;U(a).setReversed(!k);var l=k?"/":"?",p=U(a).getQuery(),n=a.getScrollInfo();switch(c.searchArgs.querySrc){case "prompt":g=v.macroModeState;g.isPlaying?(l=g.replaySearchQueries.shift(),d(l,!0,!1)):sa(a,{onClose:f,prefix:l,desc:"(JavaScript regexp)",onKeyUp:e,onKeyDown:h});break;case "wordUnderCursor":var t=qa(a,!1,!0,!1,!0),w=!0;t||(t=qa(a,!1,!0,
  !1,!1),w=!1);t&&(l=a.getLine(t.start.line).substring(t.start.ch,t.end.ch),l=w&&g?"\\b"+l+"\\b":l.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),v.jumpList.cachedCursor=a.getCursor(),a.setCursor(t.start),d(l,!0,!1))}}},processEx:function(a,b,c){function d(e){v.exCommandHistoryController.pushInput(e);v.exCommandHistoryController.reset();V.processCommand(a,e)}function f(e,h,k){var g=m.keyName(e);if("Esc"==g||"Ctrl-C"==g||"Ctrl-["==g||"Backspace"==g&&""==h)v.exCommandHistoryController.pushInput(h),v.exCommandHistoryController.reset(),
  m.e_stop(e),N(a),k(),a.focus();if("Up"==g||"Down"==g){m.e_stop(e);var l=e.target?e.target.selectionEnd:0;h=v.exCommandHistoryController.nextMatch(h,"Up"==g?!0:!1)||"";k(h);l&&e.target&&(e.target.selectionEnd=e.target.selectionStart=Math.min(l,e.target.value.length))}else"Ctrl-U"==g?(m.e_stop(e),k("")):"Left"!=g&&"Right"!=g&&"Ctrl"!=g&&"Alt"!=g&&"Shift"!=g&&v.exCommandHistoryController.reset()}"keyToEx"==c.type?V.processCommand(a,c.exArgs.input):b.visualMode?sa(a,{onClose:d,prefix:":",value:"'<,'>",
  onKeyDown:f,selectValueOnOpen:!1}):sa(a,{onClose:d,prefix:":",onKeyDown:f})},evalInput:function(a,b){var c=b.inputState,d=c.motion,f=c.motionArgs||{},e=c.operator,h=c.operatorArgs||{},k=c.registerName,g=b.sel,l=F(b.visualMode?M(a,g.head):a.getCursor("head")),p=F(b.visualMode?M(a,g.anchor):a.getCursor("anchor")),n=F(l);p=F(p);e&&this.recordLastEdit(b,c);var t=void 0!==c.repeatOverride?c.repeatOverride:c.getRepeat();if(0<t&&f.explicitRepeat)f.repeatIsExplicit=!0;else if(f.noRepeat||!f.explicitRepeat&&
  0===t)t=1,f.repeatIsExplicit=!1;c.selectedCharacter&&(f.selectedCharacter=h.selectedCharacter=c.selectedCharacter);f.repeat=t;N(a);if(d){var w=Y[d](a,l,f,b,c);b.lastMotion=Y[d];if(!w)return;f.toJumplist&&(d=v.jumpList,(c=d.cachedCursor)?(O(c,w)||v.jumpList.add(a,c,w),delete d.cachedCursor):O(l,w)||v.jumpList.add(a,l,w));if(w instanceof Array){var r=w[0];w=w[1]}w||(w=F(l));b.visualMode?(b.visualBlock&&Infinity===w.ch||(w=M(a,w)),r&&(r=M(a,r)),r=r||p,g.anchor=r,g.head=w,ha(a),X(a,b,"<",G(r,w)?r:w),
  X(a,b,">",G(r,w)?w:r)):e||(w=M(a,w),a.setCursor(w.line,w.ch))}if(e){h.lastSel?(r=p,g=h.lastSel,w=Math.abs(g.head.line-g.anchor.line),l=Math.abs(g.head.ch-g.anchor.ch),w=g.visualLine?q(p.line+w,p.ch):g.visualBlock?q(p.line+w,p.ch+l):g.head.line==g.anchor.line?q(p.line,p.ch+l):q(p.line+w,p.ch),b.visualMode=!0,b.visualLine=g.visualLine,b.visualBlock=g.visualBlock,g=b.sel={anchor:r,head:w},ha(a)):b.visualMode&&(h.lastSel={anchor:F(g.anchor),head:F(g.head),visualBlock:b.visualBlock,visualLine:b.visualLine});
  if(b.visualMode){if(r=P(g.head,g.anchor),g=da(g.head,g.anchor),n=b.visualLine||h.linewise,f=b.visualBlock?"block":n?"line":"char",r=Ba(a,{anchor:r,head:g},f),n)if(g=r.ranges,"block"==f)for(f=0;f<g.length;f++)g[f].head.ch=H(a,g[f].head.line);else"line"==f&&(g[0].head=q(g[0].head.line+1,0))}else{r=F(r||p);g=F(w||n);G(g,r)&&(n=r,r=g,g=n);if(n=f.linewise||h.linewise)l=g,r.ch=0,l.ch=0,l.line++;else if(f.forward&&(l=g,d=a.getRange(r,l),/\n\s*$/.test(d))){d=d.split("\n");d.pop();for(c=d.pop();0<d.length&&
  c&&ba(c);c=d.pop())l.line--,l.ch=0;c?(l.line--,l.ch=H(a,l.line)):l.ch=0}r=Ba(a,{anchor:r,head:g},"char",!f.inclusive||n)}a.setSelections(r.ranges,r.primary);b.lastMotion=null;h.repeat=t;h.registerName=k;h.linewise=n;e=sb[e](a,h,r.ranges,p,w);b.visualMode&&S(a,null!=e);e&&a.setCursor(e)}},recordLastEdit:function(a,b,c){var d=v.macroModeState;d.isPlaying||(a.lastEditInputState=b,a.lastEditActionCommand=c,d.lastInsertModeChanges.changes=[],d.lastInsertModeChanges.expectCursorActivityForChange=!1,d.lastInsertModeChanges.visualBlock=
  a.visualBlock?a.sel.head.line-a.sel.anchor.line:0)}},Y={moveToTopLine:function(a,b,c){b=Fa(a).top+c.repeat-1;return q(b,T(a.getLine(b)))},moveToMiddleLine:function(a){var b=Fa(a);b=Math.floor(.5*(b.top+b.bottom));return q(b,T(a.getLine(b)))},moveToBottomLine:function(a,b,c){b=Fa(a).bottom-c.repeat+1;return q(b,T(a.getLine(b)))},expandToLine:function(a,b,c){return q(b.line+c.repeat-1,Infinity)},findNext:function(a,b,c){b=U(a);var d=b.getQuery();if(d){var f=!c.forward;f=b.isReversed()?!f:f;db(a,d);
  return fb(a,f,d,c.repeat)}},findAndSelectNextInclusive:function(a,b,c,d,f){b=U(a);var e=b.getQuery();if(e){var h=!c.forward;h=b.isReversed()?!h:h;if(e=Eb(a,h,e,c.repeat,d)){if(f.operator)return e;f=e[0];e=q(e[1].line,e[1].ch-1);if(d.visualMode){if(d.visualLine||d.visualBlock)d.visualLine=!1,d.visualBlock=!1,m.signal(a,"vim-mode-change",{mode:"visual",subMode:""});if(a=d.sel.anchor)return b.isReversed()?c.forward?[a,f]:[a,e]:c.forward?[a,e]:[a,f]}else d.visualMode=!0,d.visualLine=!1,d.visualBlock=
  !1,m.signal(a,"vim-mode-change",{mode:"visual",subMode:""});return h?[e,f]:[f,e]}}},goToMark:function(a,b,c,d){return(b=gb(a,d,c.selectedCharacter))?c.linewise?{line:b.line,ch:T(a.getLine(b.line))}:b:null},moveToOtherHighlightedEnd:function(a,b,c,d){return d.visualBlock&&c.sameLine?(b=d.sel,[M(a,q(b.anchor.line,b.head.ch)),M(a,q(b.head.line,b.anchor.ch))]):[d.sel.head,d.sel.anchor]},jumpToMark:function(a,b,c,d){for(var f=0;f<c.repeat;f++){var e=b,h;for(h in d.marks)if(/^[a-z]$/.test(h)){var k=d.marks[h].find();
  if(c.forward?!G(k,e):!G(e,k))if(!c.linewise||k.line!=e.line){var g=O(e,b),l=c.forward?Sa(e,k,b):Sa(b,k,e);if(g||l)b=k}}}c.linewise&&(b=q(b.line,T(a.getLine(b.line))));return b},moveByCharacters:function(a,b,c){a=c.repeat;return q(b.line,c.forward?b.ch+a:b.ch-a)},moveByLines:function(a,b,c,d){var f=b.ch;switch(d.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:f=d.lastHPos;break;default:d.lastHPos=f}var e=c.repeat+(c.repeatOffset||
  0),h=c.forward?b.line+e:b.line-e,k=a.firstLine(),g=a.lastLine();e=a.findPosV(b,c.forward?e:-e,"line",d.lastHSPos);if(c.forward?e.line>h:e.line<h)h=e.line,f=e.ch;if(h<k&&b.line==k)return this.moveToStartOfLine(a,b,c,d);if(h>g&&b.line==g)return Za(a,b,c,d,!0);c.toFirstChar&&(f=T(a.getLine(h)),d.lastHPos=f);d.lastHSPos=a.charCoords(q(h,f),"div").left;return q(h,f)},moveByDisplayLines:function(a,b,c,d){switch(d.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;
  default:d.lastHSPos=a.charCoords(b,"div").left}var f=c.repeat;b=a.findPosV(b,c.forward?f:-f,"line",d.lastHSPos);b.hitSide&&(c.forward?(c={top:a.charCoords(b,"div").top+8,left:d.lastHSPos},b=a.coordsChar(c,"div")):(c=a.charCoords(q(a.firstLine(),0),"div"),c.left=d.lastHSPos,b=a.coordsChar(c,"div")));d.lastHPos=b.ch;return b},moveByPage:function(a,b,c){var d=c.repeat;return a.findPosV(b,c.forward?d:-d,"page")},moveByParagraph:function(a,b,c){return $a(a,b,c.repeat,c.forward?1:-1)},moveBySentence:function(a,
  b,c){return Cb(a,b,c.repeat,c.forward?1:-1)},moveByScroll:function(a,b,c,d){var f=a.getScrollInfo(),e=c.repeat;e||(e=f.clientHeight/(2*a.defaultTextHeight()));var h=a.charCoords(b,"local");c.repeat=e;b=Y.moveByDisplayLines(a,b,c,d);if(!b)return null;c=a.charCoords(b,"local");a.scrollTo(null,f.top+c.top-h.top);return b},moveByWords:function(a,b,c){var d=b,f=c.repeat;b=!!c.forward;var e=!!c.wordEnd,h=!!c.bigWord;c=F(d);var k=[];(b&&!e||!b&&e)&&f++;for(var g=!(b&&e),l=0;l<f;l++){b:{var p=a;var n=b,t=
  h,w=g,r=d.line,z=d.ch,A=p.getLine(r),y=n?1:-1;t=t?Ca:ra;if(w&&""==A){r+=y;A=p.getLine(r);if(!wa(p,r)){p=null;break b}z=n?0:A.length}for(;;){if(w&&""==A){p={from:0,to:0,line:r};break b}n=0<y?A.length:-1;for(var L,C;z!=n;){for(var D=!1,J=0;J<t.length&&!D;++J)if(t[J](A.charAt(z))){for(L=z;z!=n&&t[J](A.charAt(z));)z+=y;C=z;D=L!=C;if(L!=d.ch||r!=d.line||C!=L+y){p={from:Math.min(L,C+1),to:Math.max(L,C),line:r};break b}}D||(z+=y)}r+=y;if(!wa(p,r)){p=null;break b}A=p.getLine(r);z=0<y?0:A.length}}if(!p){h=
  H(a,a.lastLine());k.push(b?{line:a.lastLine(),from:h,to:h}:{line:0,from:0,to:0});break}k.push(p);d=q(p.line,b?p.to-1:p.from)}a=k.length!=f;f=k[0];h=k.pop();b&&!e?(a||f.from==c.ch&&f.line==c.line||(h=k.pop()),b=q(h.line,h.from)):b&&e?b=q(h.line,h.to-1):!b&&e?(a||f.to==c.ch&&f.line==c.line||(h=k.pop()),b=q(h.line,h.to)):b=q(h.line,h.from);return b},moveTillCharacter:function(a,b,c){a=Da(a,c.repeat,c.forward,c.selectedCharacter);b=c.forward?-1:1;Ya(b,c);if(!a)return null;a.ch+=b;return a},moveToCharacter:function(a,
  b,c){var d=c.repeat;Ya(0,c);return Da(a,d,c.forward,c.selectedCharacter)||b},moveToSymbol:function(a,b,c){var d=c.repeat,f=c.forward,e=c.selectedCharacter;c=F(a.getCursor());var h=f?1:-1,k=f?a.lineCount():-1,g=c.ch,l=c.line,p=a.getLine(l);f={lineText:p,nextCh:p.charAt(g),lastCh:null,index:g,symb:e,reverseSymb:(f?{")":"(","}":"{"}:{"(":")","{":"}"})[e],forward:f,depth:0,curMoveThrough:!1};if(g=Jb[e]){e=tb[g].init;g=tb[g].isComplete;for(e&&e(f);l!==k&&d;)f.index+=h,f.nextCh=f.lineText.charAt(f.index),
  f.nextCh||(l+=h,f.lineText=a.getLine(l)||"",0<h?f.index=0:(e=f.lineText.length,f.index=0<e?e-1:0),f.nextCh=f.lineText.charAt(f.index)),g(f)&&(c.line=l,c.ch=f.index,d--);a=f.nextCh||f.curMoveThrough?q(l,f.index):c}else a=c;return a||b},moveToColumn:function(a,b,c,d){c=c.repeat;d.lastHPos=c-1;d.lastHSPos=a.charCoords(b,"div").left;b=a.getCursor().line;return M(a,q(b,c-1))},moveToEol:function(a,b,c,d){return Za(a,b,c,d,!1)},moveToFirstNonWhiteSpaceCharacter:function(a,b){return q(b.line,T(a.getLine(b.line)))},
  moveToMatchedSymbol:function(a,b){for(var c=b.line,d=b.ch,f=a.getLine(c),e;d<f.length&&(!(e=f.charAt(d))||-1=="()[]{}".indexOf(e)||(e=a.getTokenTypeAt(q(c,d+1)),"string"===e||"comment"===e));d++);return d<f.length?(b="<"===d||">"===d?/[(){}[\]<>]/:/[(){}[\]]/,a.findMatchingBracket(q(c,d),{bracketRegex:b}).to):b},moveToStartOfLine:function(a,b){return q(b.line,0)},moveToLineOrEdgeOfDocument:function(a,b,c){b=c.forward?a.lastLine():a.firstLine();c.repeatIsExplicit&&(b=c.repeat-a.getOption("firstLineNumber"));
  return q(b,T(a.getLine(b)))},textObjectManipulation:function(a,b,c,d){var f={"'":!0,'"':!0,"`":!0},e=c.selectedCharacter;"b"==e?e="(":"B"==e&&(e="{");var h=!c.textObjectInner;if({"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"}[e]){var k={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[e];var g={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[e];c=a.getLine(b.line).charAt(b.ch)===g?1:0;g=a.scanForBracket(q(b.line,b.ch+c),
  -1,void 0,{bracketRegex:k});k=a.scanForBracket(q(b.line,b.ch+c),1,void 0,{bracketRegex:k});if(g&&k){g=g.pos;k=k.pos;if(g.line==k.line&&g.ch>k.ch||g.line>k.line)b=g,g=k,k=b;h?k.ch+=1:g.ch+=1;b={start:g,end:k}}else b={start:b,end:b}}else if(f[e]){c=e;b=F(b);d=a.getLine(b.line).split("");e=d.indexOf(c);b.ch<e?b.ch=e:e<b.ch&&d[b.ch]==c&&(k=b.ch,--b.ch);if(d[b.ch]!=c||k)for(e=b.ch;-1<e&&!g;e--)d[e]==c&&(g=e+1);else g=b.ch+1;if(g&&!k)for(e=g,f=d.length;e<f&&!k;e++)d[e]==c&&(k=e);g&&k?(h&&(--g,++k),b={start:q(b.line,
  g),end:q(b.line,k)}):b={start:b,end:b}}else if("W"===e)b=qa(a,h,!0,!0);else if("w"===e)b=qa(a,h,!0,!1);else if("p"===e)if(b=$a(a,b,c.repeat,0,h),c.linewise=!0,d.visualMode)d.visualLine||(d.visualLine=!0);else{if(h=d.inputState.operatorArgs)h.linewise=!0;b.end.line--}else if("t"===e)b=m.findMatchingTag&&m.findEnclosingTag?(g=m.findMatchingTag(a,b)||m.findEnclosingTag(a,b))&&g.open&&g.close?h?{start:g.open.from,end:g.close.to}:{start:g.open.to,end:g.close.from}:{start:b,end:b}:{start:b,end:b};else return null;
  return a.state.vim.visualMode?(h=b.start,b=b.end,k=a.state.vim.sel,g=k.head,k=k.anchor,G(b,h)&&(c=b,b=h,h=c),G(g,k)?(g=P(h,g),k=da(k,b)):(k=P(h,k),g=da(g,b),g=K(g,0,-1),-1==g.ch&&g.line!=a.firstLine()&&(g=q(g.line-1,H(a,g.line-1)))),[k,g]):[b.start,b.end]},repeatLastCharacterSearch:function(a,b,c){var d=v.lastCharacterSearch,f=c.repeat,e=c.forward===d.forward,h=(d.increment?1:0)*(e?-1:1);a.moveH(-h,"char");c.inclusive=e?!0:!1;c=Da(a,f,e,d.selectedCharacter);if(!c)return a.moveH(h,"char"),b;c.ch+=
  h;return c}},sb={change:function(a,b,c){var d=a.state.vim;var f=c[0].anchor;var e=c[0].head;if(d.visualMode)if(b.fullLine){e.ch=Number.MAX_VALUE;e.line--;a.setSelection(f,e);var h=a.getSelection();a.replaceSelection("")}else h=a.getSelection(),f=Qa("",c.length),a.replaceSelections(f),f=P(c[0].head,c[0].anchor);else{h=a.getRange(f,e);d=d.lastEditInputState||{};if("moveByWords"==d.motion&&!ba(h)){var k=/\s+$/.exec(h);k&&d.motionArgs&&d.motionArgs.forward&&(e=K(e,0,-k[0].length),h=h.slice(0,-k[0].length))}d=
  new q(f.line-1,Number.MAX_VALUE);k=a.firstLine()==a.lastLine();e.line>a.lastLine()&&b.linewise&&!k?a.replaceRange("",d,e):a.replaceRange("",f,e);b.linewise&&(k||(a.setCursor(d),m.commands.newlineAndIndent(a)),f.ch=Number.MAX_VALUE)}v.registerController.pushText(b.registerName,"change",h,b.linewise,1<c.length);ma.enterInsertMode(a,{head:f},a.state.vim)},"delete":function(a,b,c){var d=a.state.vim;if(d.visualBlock){var f=a.getSelection();var e=Qa("",c.length);a.replaceSelections(e);c=c[0].anchor}else e=
  c[0].anchor,c=c[0].head,b.linewise&&c.line!=a.firstLine()&&e.line==a.lastLine()&&e.line==c.line-1&&(e.line==a.firstLine()?e.ch=0:e=q(e.line-1,H(a,e.line-1))),f=a.getRange(e,c),a.replaceRange("",e,c),c=e,b.linewise&&(c=Y.moveToFirstNonWhiteSpaceCharacter(a,e));v.registerController.pushText(b.registerName,"delete",f,b.linewise,d.visualBlock);return M(a,c)},indent:function(a,b,c){var d=a.state.vim,f=c[0].anchor.line,e=d.visualBlock?c[c.length-1].anchor.line:c[0].head.line;d=d.visualMode?b.repeat:1;for(b.linewise&&
  e--;f<=e;f++)for(var h=0;h<d;h++)a.indentLine(f,b.indentRight);return Y.moveToFirstNonWhiteSpaceCharacter(a,c[0].anchor)},indentAuto:function(a,b,c){a.execCommand("indentAuto");return Y.moveToFirstNonWhiteSpaceCharacter(a,c[0].anchor)},changeCase:function(a,b,c,d,f){for(var e=a.getSelections(),h=[],k=b.toLower,g=0;g<e.length;g++){var l=e[g],p="";if(!0===k)p=l.toLowerCase();else if(!1===k)p=l.toUpperCase();else for(var n=0;n<l.length;n++){var t=l.charAt(n);p+=fa.test(t)?t.toLowerCase():t.toUpperCase()}h.push(p)}a.replaceSelections(h);
  return b.shouldMoveCursor?f:!a.state.vim.visualMode&&b.linewise&&c[0].anchor.line+1==c[0].head.line?Y.moveToFirstNonWhiteSpaceCharacter(a,d):b.linewise?d:P(c[0].anchor,c[0].head)},yank:function(a,b,c,d){var f=a.state.vim;a=a.getSelection();c=f.visualMode?P(f.sel.anchor,f.sel.head,c[0].head,c[0].anchor):d;v.registerController.pushText(b.registerName,"yank",a,b.linewise,f.visualBlock);return c}},ma={jumpListWalk:function(a,b,c){c.visualMode||(c=b.repeat,b=(b=(b=v.jumpList.move(a,b.forward?c:-c))?b.find():
  void 0)?b:a.getCursor(),a.setCursor(b))},scroll:function(a,b,c){if(!c.visualMode){var d=b.repeat||1;c=a.defaultTextHeight();var f=a.getScrollInfo().top;d*=c;f=b.forward?f+d:f-d;d=F(a.getCursor());var e=a.charCoords(d,"local");b.forward?f>e.top?(d.line+=(f-e.top)/c,d.line=Math.ceil(d.line),a.setCursor(d),e=a.charCoords(d,"local"),a.scrollTo(null,e.top)):a.scrollTo(null,f):(b=f+a.getScrollInfo().clientHeight,b<e.bottom?(d.line-=(e.bottom-b)/c,d.line=Math.floor(d.line),a.setCursor(d),e=a.charCoords(d,
  "local"),a.scrollTo(null,e.bottom-a.getScrollInfo().clientHeight)):a.scrollTo(null,f))}},scrollToCursor:function(a,b){var c=a.getCursor().line,d=a.charCoords(q(c,0),"local");c=a.getScrollInfo().clientHeight;var f=d.top;d=d.bottom-f;switch(b.position){case "center":f=f-c/2+d;break;case "bottom":f=f-c+d}a.scrollTo(null,f)},replayMacro:function(a,b,c){var d=b.selectedCharacter;b=b.repeat;var f=v.macroModeState;for("@"==d?d=f.latestRegister:f.latestRegister=d;b--;){var e=a,h=c,k=f,g=d,l=v.registerController.getRegister(g);
  if(":"==g)l.keyBuffer[0]&&V.processCommand(e,l.keyBuffer[0]);else{g=l.keyBuffer;var p=0;k.isPlaying=!0;k.replaySearchQueries=l.searchQueries.slice(0);for(var n=0;n<g.length;n++)for(var t=g[n],w,r;t;)w=/<\w+-.+?>|<\w+>|./.exec(t),r=w[0],t=t.substring(w.index+r.length),m.Vim.handleKey(e,r,"macro"),h.insertMode&&(w=l.insertModeChanges[p++].changes,v.macroModeState.lastInsertModeChanges.changes=w,mb(e,w,1),ja(e))}k.isPlaying=!1}},enterMacroRecordMode:function(a,b){var c=v.macroModeState;b=b.selectedCharacter;
  v.registerController.isValidRegister(b)&&c.enterMacroRecordMode(a,b)},toggleOverwrite:function(a){a.state.overwrite?(a.toggleOverwrite(!1),a.setOption("keyMap","vim-insert"),m.signal(a,"vim-mode-change",{mode:"insert"})):(a.toggleOverwrite(!0),a.setOption("keyMap","vim-replace"),m.signal(a,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(a,b,c){if(!a.getOption("readOnly")){c.insertMode=!0;c.insertModeRepeat=b&&b.repeat||1;var d=b?b.insertAt:null,f=c.sel,e=b.head||a.getCursor("head"),
  h=a.listSelections().length;if("eol"==d)e=q(e.line,H(a,e.line));else if("bol"==d)e=q(e.line,0);else if("charAfter"==d)e=K(e,0,1);else if("firstNonBlank"==d)e=Y.moveToFirstNonWhiteSpaceCharacter(a,e);else if("startOfSelectedArea"==d){if(!c.visualMode)return;c.visualBlock?(e=q(Math.min(f.head.line,f.anchor.line),Math.min(f.head.ch,f.anchor.ch)),h=Math.abs(f.head.line-f.anchor.line)+1):e=f.head.line<f.anchor.line?f.head:q(f.anchor.line,0)}else if("endOfSelectedArea"==d){if(!c.visualMode)return;c.visualBlock?
  (e=q(Math.min(f.head.line,f.anchor.line),Math.max(f.head.ch+1,f.anchor.ch)),h=Math.abs(f.head.line-f.anchor.line)+1):e=f.head.line>=f.anchor.line?K(f.head,0,1):q(f.anchor.line,0)}else if("inplace"==d){if(c.visualMode)return}else"lastEdit"==d&&(e=hb(a)||e);a.setOption("disableInput",!1);b&&b.replace?(a.toggleOverwrite(!0),a.setOption("keyMap","vim-replace"),m.signal(a,"vim-mode-change",{mode:"replace"})):(a.toggleOverwrite(!1),a.setOption("keyMap","vim-insert"),m.signal(a,"vim-mode-change",{mode:"insert"}));
  v.macroModeState.isPlaying||(a.on("change",ib),m.on(a.getInputField(),"keydown",jb));c.visualMode&&S(a);Ua(a,e,h)}},toggleVisualMode:function(a,b,c){var d=b.repeat,f=a.getCursor();c.visualMode?c.visualLine^b.linewise||c.visualBlock^b.blockwise?(c.visualLine=!!b.linewise,c.visualBlock=!!b.blockwise,m.signal(a,"vim-mode-change",{mode:"visual",subMode:c.visualLine?"linewise":c.visualBlock?"blockwise":""}),ha(a)):S(a):(c.visualMode=!0,c.visualLine=!!b.linewise,c.visualBlock=!!b.blockwise,b=M(a,q(f.line,
  f.ch+d-1)),c.sel={anchor:f,head:b},m.signal(a,"vim-mode-change",{mode:"visual",subMode:c.visualLine?"linewise":c.visualBlock?"blockwise":""}),ha(a),X(a,c,"<",P(f,b)),X(a,c,">",da(f,b)))},reselectLastSelection:function(a,b,c){b=c.lastSelection;c.visualMode&&Va(a,c);if(b){var d=b.anchorMark.find(),f=b.headMark.find();d&&f&&(c.sel={anchor:d,head:f},c.visualMode=!0,c.visualLine=b.visualLine,c.visualBlock=b.visualBlock,ha(a),X(a,c,"<",P(d,f)),X(a,c,">",da(d,f)),m.signal(a,"vim-mode-change",{mode:"visual",
  subMode:c.visualLine?"linewise":c.visualBlock?"blockwise":""}))}},joinLines:function(a,b,c){if(c.visualMode){var d=a.getCursor("anchor");var f=a.getCursor("head");if(G(f,d)){var e=f;f=d;d=e}f.ch=H(a,f.line)-1}else f=Math.max(b.repeat,2),d=a.getCursor(),f=M(a,q(d.line+f-1,Infinity));for(var h=0,k=d.line;k<f.line;k++){h=H(a,d.line);e=q(d.line+1,H(a,d.line+1));var g=a.getRange(d,e);g=b.keepSpaces?g.replace(/\n\r?/g,""):g.replace(/\n\s*/g," ");a.replaceRange(g,d,e)}b=q(d.line,h);c.visualMode&&S(a,!1);
  a.setCursor(b)},newLineAndEnterInsertMode:function(a,b,c){c.insertMode=!0;var d=F(a.getCursor());d.line!==a.firstLine()||b.after?(d.line=b.after?d.line:d.line-1,d.ch=H(a,d.line),a.setCursor(d),(m.commands.newlineAndIndentContinueComment||m.commands.newlineAndIndent)(a)):(a.replaceRange("\n",q(a.firstLine(),0)),a.setCursor(a.firstLine(),0));this.enterInsertMode(a,{repeat:b.repeat},c)},paste:function(a,b,c){var d=F(a.getCursor()),f=v.registerController.getRegister(b.registerName),e=f.toString();if(e){if(b.matchIndent){var h=
  a.getOption("tabSize"),k=function(r){var z=r.split("\t").length-1;r=r.split(" ").length-1;return z*h+1*r},g=a.getLine(a.getCursor().line),l=k(g.match(/^\s*/)[0]);g=e.replace(/\n$/,"");var p=e!==g,n=k(e.match(/^\s*/)[0]);e=g.replace(/^\s*/gm,function(r){r=l+(k(r)-n);return 0>r?"":a.getOption("indentWithTabs")?Array(Math.floor(r/h)+1).join("\t"):Array(r+1).join(" ")});e+=p?"\n":""}1<b.repeat&&(e=Array(b.repeat+1).join(e));g=f.linewise;if(f=f.blockwise){e=e.split("\n");g&&e.pop();for(p=0;p<e.length;p++)e[p]=
  ""==e[p]?" ":e[p];d.ch+=b.after?1:0;d.ch=Math.min(H(a,d.line),d.ch)}else g?c.visualMode?e=c.visualLine?e.slice(0,-1):"\n"+e.slice(0,e.length-1)+"\n":b.after?(e="\n"+e.slice(0,e.length-1),d.ch=H(a,d.line)):d.ch=0:d.ch+=b.after?1:0;var t;if(c.visualMode){c.lastPastedText=e;b=Ab(a,c);d=b[0];b=b[1];p=a.getSelection();var w=a.listSelections();w=Array(w.length).join("1").split("1");c.lastSelection&&(t=c.lastSelection.headMark.find());v.registerController.unnamedRegister.setText(p);f?(a.replaceSelections(w),
  b=q(d.line+e.length-1,d.ch),a.setCursor(d),Ta(a,b),a.replaceSelections(e),e=d):c.visualBlock?(a.replaceSelections(w),a.setCursor(d),a.replaceRange(e,d,d),e=d):(a.replaceRange(e,d,b),e=a.posFromIndex(a.indexFromPos(d)+e.length-1));t&&(c.lastSelection.headMark=a.setBookmark(t));g&&(e.ch=0)}else if(f){a.setCursor(d);for(p=0;p<e.length;p++)t=d.line+p,t>a.lastLine()&&a.replaceRange("\n",q(t,0)),H(a,t)<d.ch&&zb(a,t,d.ch);a.setCursor(d);Ta(a,q(d.line+e.length-1,d.ch));a.replaceSelections(e);e=d}else a.replaceRange(e,
  d),g&&b.after?e=q(d.line+1,T(a.getLine(d.line+1))):g&&!b.after?e=q(d.line,T(a.getLine(d.line))):!g&&b.after?(t=a.indexFromPos(d),e=a.posFromIndex(t+e.length-1)):(t=a.indexFromPos(d),e=a.posFromIndex(t+e.length));c.visualMode&&S(a,!1);a.setCursor(e)}},undo:function(a,b){a.operation(function(){Ra(a,m.commands.undo,b.repeat)();a.setCursor(a.getCursor("anchor"))})},redo:function(a,b){Ra(a,m.commands.redo,b.repeat)()},setRegister:function(a,b,c){c.inputState.registerName=b.selectedCharacter},setMark:function(a,
  b,c){X(a,c,b.selectedCharacter,a.getCursor())},replace:function(a,b,c){var d=b.selectedCharacter,f=a.getCursor(),e=a.listSelections();if(c.visualMode){f=a.getCursor("start");var h=a.getCursor("end")}else h=a.getLine(f.line),b=f.ch+b.repeat,b>h.length&&(b=h.length),h=q(f.line,b);"\n"==d?(c.visualMode||a.replaceRange("",f,h),(m.commands.newlineAndIndentContinueComment||m.commands.newlineAndIndent)(a)):(b=a.getRange(f,h),b=b.replace(/[^\n]/g,d),c.visualBlock?(f=Array(a.getOption("tabSize")+1).join(" "),
  b=a.getSelection(),b=b.replace(/\t/g,f).replace(/[^\n]/g,d).split("\n"),a.replaceSelections(b)):a.replaceRange(b,f,h),c.visualMode?(f=G(e[0].anchor,e[0].head)?e[0].anchor:e[0].head,a.setCursor(f),S(a,!1)):a.setCursor(K(h,0,-1)))},incrementNumberToken:function(a,b){for(var c=a.getCursor(),d=a.getLine(c.line),f=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi,e,h,k;null!==(e=f.exec(d))&&!(h=e.index,k=h+e[0].length,c.ch<k););if((b.backtrack||!(k<=c.ch))&&e){d=e[2]||e[4];f=e[3]||e[5];var g=b.increase?1:-1,l={"0b":2,
  0:8,"":10,"0x":16}[d.toLowerCase()];b=(parseInt(e[1]+f,l)+g*b.repeat).toString(l);e=d?Array(f.length-b.length+1+e[1].length).join("0"):"";b="-"===b.charAt(0)?"-"+d+e+b.substr(1):d+e+b;e=q(c.line,h);k=q(c.line,k);a.replaceRange(b,e,k);a.setCursor(q(c.line,h+b.length-1))}},repeatLastEdit:function(a,b,c){if(c.lastEditInputState){var d=b.repeat;d&&b.repeatIsExplicit?c.lastEditInputState.repeatOverride=d:d=c.lastEditInputState.repeatOverride||d;kb(a,c,d,!1)}},indent:function(a,b){a.indentLine(a.getCursor().line,
  b.indentRight)},exitInsertMode:ja},Jb={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},tb={bracket:{isComplete:function(a){if(a.nextCh===a.symb){if(a.depth++,1<=a.depth)return!0}else a.nextCh===a.reverseSymb&&a.depth--;return!1}},section:{init:function(a){a.curMoveThrough=!0;a.symb=(a.forward?"]":"[")===a.symb?"{":"}"},isComplete:function(a){return 0===a.index&&a.nextCh===a.symb}},comment:{isComplete:function(a){var b=
  "*"===a.lastCh&&"/"===a.nextCh;a.lastCh=a.nextCh;return b}},method:{init:function(a){a.symb="m"===a.symb?"{":"}";a.reverseSymb="{"===a.symb?"}":"{"},isComplete:function(a){return a.nextCh===a.symb?!0:!1}},preprocess:{init:function(a){a.index=0},isComplete:function(a){if("#"===a.nextCh){var b=a.lineText.match(/^#(\w+)/)[1];if("endif"===b){if(a.forward&&0===a.depth)return!0;a.depth++}else if("if"===b){if(!a.forward&&0===a.depth)return!0;a.depth--}if("else"===b&&0===a.depth)return!0}return!1}}};na("pcre",
  !0,"boolean");ab.prototype={getQuery:function(){return v.query},setQuery:function(a){v.query=a},getOverlay:function(){return this.searchOverlay},setOverlay:function(a){this.searchOverlay=a},isReversed:function(){return v.isReversed},setReversed:function(a){v.isReversed=a},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(a){this.annotate=a}};var ub={"\\n":"\n","\\r":"\r","\\t":"\t"},vb={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t","\\&":"&"},eb=0,wb=function(){this.buildCommandMap_()};
  wb.prototype={processCommand:function(a,b,c){var d=this;a.operation(function(){a.curOp.isVimOp=!0;d._processCommand(a,b,c)})},_processCommand:function(a,b,c){var d=a.state.vim,f=v.registerController.getRegister(":"),e=f.toString();d.visualMode&&S(a);d=new m.StringStream(b);f.setText(b);c=c||{};c.input=b;try{this.parseInput_(a,d,c)}catch(g){throw E(a,g.toString()),g;}var h;if(c.commandName){if(h=this.matchCommand_(c.commandName)){var k=h.name;h.excludeFromCommandHistory&&f.setText(e);this.parseCommandArgs_(d,
  c,h);if("exToKey"==h.type){for(b=0;b<h.toKeys.length;b++)m.Vim.handleKey(a,h.toKeys[b],"mapping");return}if("exToEx"==h.type){this.processCommand(a,h.toInput);return}}}else void 0!==c.line&&(k="move");if(k)try{rb[k](a,c),h&&h.possiblyAsync||!c.callback||c.callback()}catch(g){throw E(a,g.toString()),g;}else E(a,'Not an editor command ":'+b+'"')},parseInput_:function(a,b,c){b.eatWhile(":");b.eat("%")?(c.line=a.firstLine(),c.lineEnd=a.lastLine()):(c.line=this.parseLineSpec_(a,b),void 0!==c.line&&b.eat(",")&&
  (c.lineEnd=this.parseLineSpec_(a,b)));a=b.match(/^(\w+|!!|@@|[!#&*<=>@~])/);c.commandName=a?a[1]:b.match(/.*/)[0];return c},parseLineSpec_:function(a,b){var c=b.match(/^(\d+)/);if(c)return parseInt(c[1],10)-1;switch(b.next()){case ".":return this.parseLineSpecOffset_(b,a.getCursor().line);case "$":return this.parseLineSpecOffset_(b,a.lastLine());case "'":c=b.next();a=gb(a,a.state.vim,c);if(!a)throw Error("Mark not set");return this.parseLineSpecOffset_(b,a.line);case "-":case "+":return b.backUp(1),
  this.parseLineSpecOffset_(b,a.getCursor().line);default:b.backUp(1)}},parseLineSpecOffset_:function(a,b){if(a=a.match(/^([+-])?(\d+)/)){var c=parseInt(a[2],10);b="-"==a[1]?b-c:b+c}return b},parseCommandArgs_:function(a,b,c){a.eol()||(b.argString=a.match(/.*/)[0],a=c.argDelimiter||/\s+/,a=Aa(b.argString).split(a),a.length&&a[0]&&(b.args=a))},matchCommand_:function(a){for(var b=a.length;0<b;b--){var c=a.substring(0,b);if(this.commandMap_[c]&&(c=this.commandMap_[c],0===c.name.indexOf(a)))return c}return null},
  buildCommandMap_:function(){this.commandMap_={};for(var a=0;a<B.length;a++){var b=B[a];this.commandMap_[b.shortName||b.name]=b}},map:function(a,b,c){if(":"!=a&&":"==a.charAt(0)){if(c)throw Error("Mode not supported for ex mappings");c=a.substring(1);":"!=b&&":"==b.charAt(0)?this.commandMap_[c]={name:c,type:"exToEx",toInput:b.substring(1),user:!0}:this.commandMap_[c]={name:c,type:"exToKey",toKeys:b,user:!0}}else b=":"!=b&&":"==b.charAt(0)?{keys:a,type:"keyToEx",exArgs:{input:b.substring(1)}}:{keys:a,
  type:"keyToKey",toKeys:b},c&&(b.context=c),u.unshift(b)},unmap:function(a,b){if(":"!=a&&":"==a.charAt(0)){if(b)throw Error("Mode not supported for ex mappings");a=a.substring(1);if(this.commandMap_[a]&&this.commandMap_[a].user){delete this.commandMap_[a];return}}else for(var c=0;c<u.length;c++)if(a==u[c].keys&&u[c].context===b){u.splice(c,1);return}throw Error("No such mapping.");}};var rb={colorscheme:function(a,b){!b.args||1>b.args.length?E(a,a.getOption("theme")):a.setOption("theme",b.args[0])},
  map:function(a,b,c){var d=b.args;!d||2>d.length?a&&E(a,"Invalid mapping: "+b.input):V.map(d[0],d[1],c)},imap:function(a,b){this.map(a,b,"insert")},nmap:function(a,b){this.map(a,b,"normal")},vmap:function(a,b){this.map(a,b,"visual")},unmap:function(a,b,c){var d=b.args;!d||1>d.length?a&&E(a,"No such mapping: "+b.input):V.unmap(d[0],c)},move:function(a,b){aa.processCommand(a,a.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:b.line+
  1})},set:function(a,b){var c=b.args,d=b.setCfg||{};if(!c||1>c.length)a&&E(a,"Invalid mapping: "+b.input);else{var f=c[0].split("=");c=f[0];f=f[1];var e=!1;if("?"==c.charAt(c.length-1)){if(f)throw Error("Trailing characters: "+b.argString);c=c.substring(0,c.length-1);e=!0}void 0===f&&"no"==c.substring(0,2)&&(c=c.substring(2),f=!1);(b=W[c]&&"boolean"==W[c].type)&&void 0==f&&(f=!0);!b&&void 0===f||e?(d=ca(c,a,d),d instanceof Error?E(a,d.message):!0===d||!1===d?E(a," "+(d?"":"no")+c):E(a,"  "+c+"="+d)):
  (d=ya(c,f,a,d),d instanceof Error&&E(a,d.message))}},setlocal:function(a,b){b.setCfg={scope:"local"};this.set(a,b)},setglobal:function(a,b){b.setCfg={scope:"global"};this.set(a,b)},registers:function(a,b){var c=b.args;b=v.registerController.registers;var d="----------Registers----------\n\n";if(c){c=c.join("");for(var f=0;f<c.length;f++)if(h=c.charAt(f),v.registerController.isValidRegister(h)){var e=b[h]||new R;d+='"'+h+"    "+e.toString()+"\n"}}else for(var h in b)c=b[h].toString(),c.length&&(d+=
  '"'+h+"    "+c+"\n");E(a,d)},sort:function(a,b){function c(C,D){if(f){var J=C;C=D;D=J}e&&(C=C.toLowerCase(),D=D.toLowerCase());J=k&&t.exec(C);var ea=k&&t.exec(D);if(!J)return C<D?-1:1;J=parseInt((J[1]+J[2]).toLowerCase(),w);ea=parseInt((ea[1]+ea[2]).toLowerCase(),w);return J-ea}function d(C,D){if(f){var J=C;C=D;D=J}e&&(C[0]=C[0].toLowerCase(),D[0]=D[0].toLowerCase());return C[0]<D[0]?-1:1}var f,e,h,k,g,l=function(){if(b.argString){var C=new m.StringStream(b.argString);C.eat("!")&&(f=!0);if(!C.eol()){if(!C.eatSpace())return"Invalid arguments";
  var D=C.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!D&&!C.eol())return"Invalid arguments";if(D[1]){e=-1!=D[1].indexOf("i");h=-1!=D[1].indexOf("u");C=-1!=D[1].indexOf("d")||-1!=D[1].indexOf("n")&&1;var J=-1!=D[1].indexOf("x")&&1,ea=-1!=D[1].indexOf("o")&&1;if(1<C+J+ea)return"Invalid arguments";k=C&&"decimal"||J&&"hex"||ea&&"octal"}D[2]&&(g=new RegExp(D[2].substr(1,D[2].length-2),e?"i":""))}}}();if(l)E(a,l+": "+b.argString);else{l=b.line||a.firstLine();var p=b.lineEnd||b.line||a.lastLine();if(l!=p){l=
  q(l,0);p=q(p,H(a,p));var n=a.getRange(l,p).split("\n"),t=g?g:"decimal"==k?/(-?)([\d]+)/:"hex"==k?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==k?/([0-7]+)/:null,w="decimal"==k?10:"hex"==k?16:"octal"==k?8:null,r=[],z=[];if(k||g)for(var A=0;A<n.length;A++){var y=g?n[A].match(g):null;y&&""!=y[0]?r.push(y):!g&&t.exec(n[A])?r.push(n[A]):z.push(n[A])}else z=n;r.sort(g?d:c);if(g)for(A=0;A<r.length;A++)r[A]=r[A].input;else k||z.sort(c);n=f?r.concat(z):z.concat(r);if(h)for(r=n,n=[],A=0;A<r.length;A++){r[A]!=L&&n.push(r[A]);
  var L=r[A]}a.replaceRange(n.join("\n"),l,p)}}},vglobal:function(a,b){this.global(a,b)},global:function(a,b){var c=b.argString;if(c){var d="v"===b.commandName[0],f=void 0!==b.line?b.line:a.firstLine();b=b.lineEnd||b.line||a.lastLine();var e=bb(c,"/");if(e.length){c=e[0];var h=e.slice(1,e.length).join("/")}if(c)try{ia(a,c,!0,!0)}catch(p){E(a,"Invalid regex: "+c);return}c=U(a).getQuery();for(var k=[];f<=b;f++)e=a.getLineHandle(f),c.test(e.text)!==d&&k.push(h?e:e.text);if(h){var g=0,l=function(){if(g<
  k.length){var p=k[g++];p=a.getLineNumber(p);null==p?l():V.processCommand(a,p+1+h,{callback:l})}};l()}else E(a,k.join("\n"))}else E(a,"Regular Expression missing from global")},substitute:function(a,b){if(!a.getSearchCursor)throw Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var c=b.argString,d=c?bb(c,c[0]):[],f="",e,h=!1,k=!1;if(d.length){var g=d[0];ca("pcre")&&""!==g&&(g=(new RegExp(g)).source);f=d[1];/(^|[^\\])(\\\\)*\$$/.test(g)&&(g=
  g.slice(0,-1)+"\\n",f=(f||"")+"\n");if(void 0!==f){if(ca("pcre")){f=f.replace(/([^\\])&/g,"$1$$&");f=new m.StringStream(f);for(e=[];!f.eol();){for(;f.peek()&&"\\"!=f.peek();)e.push(f.next());c=!1;for(var l in vb)if(f.match(l,!0)){c=!0;e.push(vb[l]);break}c||e.push(f.next())}f=e.join("")}else{l=!1;e=[];for(c=-1;c<f.length;c++){var p=f.charAt(c)||"",n=f.charAt(c+1)||"";ub[p+n]?(e.push(ub[p+n]),c++):l?(e.push(p),l=!1):"\\"===p?(l=!0,Hb.test(n)||"$"===n?e.push("$"):"/"!==n&&"\\"!==n&&e.push("\\")):("$"===
  p&&e.push("$"),e.push(p),"/"===n&&e.push("\\"))}f=e.join("")}v.lastSubstituteReplacePart=f}e=d[2]?d[2].split(" "):[]}else if(c&&c.length){E(a,"Substitutions should be of the form :s/pattern/replace/");return}if(e){d=e[0];var t=parseInt(e[1]);d&&(-1!=d.indexOf("c")&&(h=!0),-1!=d.indexOf("g")&&(k=!0),g=ca("pcre")?g+"/"+d:g.replace(/\//g,"\\/")+"/"+d)}if(g)try{ia(a,g,!0,!0)}catch(w){E(a,"Invalid regex: "+g);return}f=f||v.lastSubstituteReplacePart;void 0===f?E(a,"No previous substitute regular expression"):
  (g=U(a).getQuery(),d=void 0!==b.line?b.line:a.getCursor().line,l=b.lineEnd||d,d==a.firstLine()&&l==a.lastLine()&&(l=Infinity),t&&(d=l,l=d+t-1),t=M(a,q(d,0)),t=a.getSearchCursor(g,t),Gb(a,h,k,d,l,t,g,f,b.callback))},redo:m.commands.redo,undo:m.commands.undo,write:function(a){m.commands.save?m.commands.save(a):a.save&&a.save()},nohlsearch:function(a){Ea(a)},yank:function(a){var b=F(a.getCursor()).line;a=a.getLine(b);v.registerController.pushText("0","yank",a,!0,!0)},delmarks:function(a,b){if(b.argString&&
  Aa(b.argString))for(var c=a.state.vim,d=new m.StringStream(Aa(b.argString));!d.eol();){d.eatSpace();var f=d.pos;if(!d.match(/[a-zA-Z]/,!1)){E(a,"Invalid argument: "+b.argString.substring(f));break}var e=d.next();if(d.match("-",!0)){if(!d.match(/[a-zA-Z]/,!1)){E(a,"Invalid argument: "+b.argString.substring(f));break}var h=d.next();if(/^[a-z]$/.test(e)&&/^[a-z]$/.test(h)||fa.test(e)&&fa.test(h)){e=e.charCodeAt(0);h=h.charCodeAt(0);if(e>=h){E(a,"Invalid argument: "+b.argString.substring(f));break}for(f=
  0;f<=h-e;f++){var k=String.fromCharCode(e+f);delete c.marks[k]}}else{E(a,"Invalid argument: "+e+"-");break}}else delete c.marks[e]}else E(a,"Argument required")}},V=new wb;m.keyMap.vim={attach:Q,detach:I,call:ua};na("insertModeEscKeysTimeout",200,"number");m.keyMap["vim-insert"]={fallthrough:["default"],attach:Q,detach:I,call:ua};m.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:Q,detach:I,call:ua};Oa();return Ib}()});
  