web-interface.assets.bfaea4527da3bca61fb24aac3e553ac2.js Maven / Gradle / Ivy
(()=>{var en=(I,G)=>()=>(G||I((G={exports:{}}).exports,G),G.exports);var tn=en((tr,ze)=>{ace.define("ace/ext/hardwrap",["require","exports","module","ace/range","ace/editor","ace/config"],function(I,G,rr){"use strict";var Ke=I("../range").Range;function J(oe,F){for(var z=F.column||oe.getOption("printMarginColumn"),Le=F.allowMerge!=!1,U=Math.min(F.startRow,F.endRow),Se=Math.max(F.startRow,F.endRow),ye=oe.session;U<=Se;){var ae=ye.getLine(U);if(ae.length>z){var pe=fe(ae,z,5);if(pe){var v=/^\s*/.exec(ae)[0];ye.replace(new Ke(U,pe.start,U,pe.end),`
`+v)}Se++}else if(Le&&/\S/.test(ae)&&U!=Se){var X=ye.getLine(U+1);if(X&&/\S/.test(X)){var O=ae.replace(/\s+$/,""),_e=X.replace(/^\s+/,""),g=O+" "+_e,pe=fe(g,z,5);if(pe&&pe.start>O.length||g.lengthNe)return{start:$.index,end:$.index+$[2].length};if(te&&te[2])return Y=ee+te[2].length,{start:Y,end:Y+te[3].length}}}}function Pe(oe){if(oe.command.name=="insertstring"&&/\S/.test(oe.args)){var F=oe.editor,z=F.selection.cursor;if(z.column<=F.renderer.$printMarginColumn)return;var Le=F.session.$undoManager.$lastDelta;J(F,{startRow:z.row,endRow:z.row,allowMerge:!1}),Le!=F.session.$undoManager.$lastDelta&&F.session.markUndoGroup()}}var Me=I("../editor").Editor;I("../config").defineOptions(Me.prototype,"editor",{hardWrap:{set:function(oe){oe?this.commands.on("afterExec",Pe):this.commands.off("afterExec",Pe)},value:!1}}),G.hardWrap=J});ace.define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/dom","ace/lib/oop","ace/lib/keys","ace/lib/event","ace/search","ace/lib/useragent","ace/search_highlight","ace/commands/multi_select_commands","ace/mode/text","ace/ext/hardwrap","ace/multi_select"],function(I,G,rr){"use strict";function Ke(){var e="";function t(o){return typeof o!="object"?o+"":"line"in o?o.line+":"+o.ch:"anchor"in o?t(o.anchor)+"->"+t(o.head):Array.isArray(o)?"["+o.map(function(a){return t(a)})+"]":JSON.stringify(o)}for(var r=0;r0){u.row+=a,u.column+=u.row==o.row?l:0;continue}!n&&c<=0&&(u.row=i.row,u.column=i.column,c===0&&(u.bias=1))}}};var e=function(r,n,i,o){this.cm=r,this.id=n,this.row=i,this.column=o,r.marks[this.id]=this};e.prototype.clear=function(){delete this.cm.marks[this.id]},e.prototype.find=function(){return O(this)},this.setBookmark=function(r,n){var i=new e(this,this.$uid++,r.line,r.ch);return(!n||!n.insertLeft)&&(i.$insertRight=!0),this.marks[i.id]=i,i},this.moveH=function(r,n){if(n=="char"){var i=this.ace.selection;i.clearSelection(),i.moveCursorBy(0,r)}},this.findPosV=function(r,n,i,o){if(i=="page"){var a=this.ace.renderer,l=a.layerConfig;n=n*Math.floor(l.height/l.lineHeight),i="line"}if(i=="line"){var s=this.ace.session.documentToScreenPosition(r.line,r.ch);o!=null&&(s.column=o),s.row+=n,s.row=Math.min(Math.max(0,s.row),this.ace.session.getScreenLength()-1);var u=this.ace.session.screenToDocumentPosition(s.row,s.column);return O(u)}else debugger},this.charCoords=function(r,n){if(n=="div"||!n){var i=this.ace.session.documentToScreenPosition(r.line,r.ch);return{left:i.column,top:i.row}}if(n=="local"){var o=this.ace.renderer,i=this.ace.session.documentToScreenPosition(r.line,r.ch),a=o.layerConfig.lineHeight,l=o.layerConfig.characterWidth,s=a*i.row;return{left:i.column*l,top:s,bottom:s+a}}},this.coordsChar=function(r,n){var i=this.ace.renderer;if(n=="local"){var o=Math.max(0,Math.floor(r.top/i.lineHeight)),a=Math.max(0,Math.floor(r.left/i.characterWidth)),l=i.session.screenToDocumentPosition(o,a);return O(l)}else if(n=="div")throw"not implemented"},this.getSearchCursor=function(r,n,i){var o=!1,a=!1;r instanceof RegExp&&!r.global&&(o=!r.ignoreCase,r=r.source,a=!0),r=="\\n"&&(r=`
`,a=!1);var l=new Le;n.ch==null&&(n.ch=Number.MAX_VALUE);var s={row:n.line,column:n.ch},u=this,f=null;return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(c){l.setOptions({needle:r,caseSensitive:o,wrap:!1,backwards:c,regExp:a,start:f||s});var d=l.find(u.ace.session);return f=d,f&&[!f.isEmpty()]},from:function(){return f&&O(f.start)},to:function(){return f&&O(f.end)},replace:function(c){f&&(f.end=u.ace.session.doc.replace(f,c))}}},this.scrollTo=function(r,n){var i=this.ace.renderer,o=i.layerConfig,a=o.maxHeight;a-=(i.$size.scrollerHeight-i.lineHeight)*i.$scrollPastEnd,n!=null&&this.ace.session.setScrollTop(Math.max(0,Math.min(n,a))),r!=null&&this.ace.session.setScrollLeft(Math.max(0,Math.min(r,o.width)))},this.scrollInfo=function(){return 0},this.scrollIntoView=function(r,n){if(r){var i=this.ace.renderer,o={top:0,bottom:n};i.scrollCursorIntoView(X(r),i.lineHeight*2/i.$size.scrollerHeight,o)}},this.getLine=function(r){return this.ace.session.getLine(r)},this.getRange=function(r,n){return this.ace.session.getTextRange(new J(r.line,r.ch,n.line,n.ch))},this.replaceRange=function(r,n,i){i||(i=n);var o=new J(n.line,n.ch,i.line,i.ch);return this.ace.session.$clipRangeToDocument(o),this.ace.session.replace(o,r)},this.replaceSelection=this.replaceSelections=function(r){var n=this.ace.selection;if(this.ace.inVirtualSelectionMode){this.ace.session.replace(n.getRange(),r[0]||"");return}n.inVirtualSelectionMode=!0;var i=n.rangeList.ranges;i.length||(i=[this.ace.multiSelect.getRange()]);for(var o=i.length;o--;)this.ace.session.replace(i[o],r[o]||"");n.inVirtualSelectionMode=!1},this.getSelection=function(){return this.ace.getSelectedText()},this.getSelections=function(){return this.listSelections().map(function(r){return this.getRange(r.anchor,r.head)},this)},this.getInputField=function(){return this.ace.textInput.getElement()},this.getWrapperElement=function(){return this.ace.container};var t={indentWithTabs:"useSoftTabs",indentUnit:"tabSize",tabSize:"tabSize",firstLineNumber:"firstLineNumber",readOnly:"readOnly"};this.setOption=function(r,n){switch(this.state[r]=n,r){case"indentWithTabs":r=t[r],n=!n;break;case"keyMap":this.state.$keyMap=n;return;default:r=t[r]}r&&this.ace.setOption(r,n)},this.getOption=function(r){var n,i=t[r];switch(i&&(n=this.ace.getOption(i)),r){case"indentWithTabs":return r=t[r],!n;case"keyMap":return this.state.$keyMap||"vim"}return i?n:this.state[r]},this.toggleOverwrite=function(r){return this.state.overwrite=r,this.ace.setOverwrite(r)},this.addOverlay=function(r){if(!this.$searchHighlight||!this.$searchHighlight.session){var n=new Se(null,"ace_highlight-marker","text"),i=this.ace.session.addDynamicMarker(n);n.id=i.id,n.session=this.ace.session,n.destroy=function(a){n.session.off("change",n.updateOnChange),n.session.off("changeEditor",n.destroy),n.session.removeMarker(n.id),n.session=null},n.updateOnChange=function(a){var l=a.start.row;l==a.end.row?n.cache[l]=void 0:n.cache.splice(l,n.cache.length)},n.session.on("changeEditor",n.destroy),n.session.on("change",n.updateOnChange)}var o=new RegExp(r.query.source,"gmi");this.$searchHighlight=r.highlight=n,this.$searchHighlight.setRegexp(o),this.ace.renderer.updateBackMarkers()},this.removeOverlay=function(r){this.$searchHighlight&&this.$searchHighlight.session&&this.$searchHighlight.destroy()},this.getScrollInfo=function(){var r=this.ace.renderer,n=r.layerConfig;return{left:r.scrollLeft,top:r.scrollTop,height:n.maxHeight,width:n.width,clientHeight:n.height,clientWidth:n.width}},this.getValue=function(){return this.ace.getValue()},this.setValue=function(r){return this.ace.setValue(r,-1)},this.getTokenTypeAt=function(r){var n=this.ace.session.getTokenAt(r.line,r.ch);return n&&/comment|string/.test(n.type)?"string":""},this.findMatchingBracket=function(r){var n=this.ace.session.findMatchingBracket(X(r));return{to:n&&O(n)}},this.findMatchingTag=function(r){var n=this.ace.session.getMatchingTags(X(r));if(n)return{open:{from:O(n.openTag.start),to:O(n.openTag.end)},close:{from:O(n.closeTag.start),to:O(n.closeTag.end)}}},this.indentLine=function(r,n){n===!0?this.ace.session.indentRows(r,r," "):n===!1&&this.ace.session.outdentRows(new J(r,0,r,0))},this.indexFromPos=function(r){return this.ace.session.doc.positionToIndex(X(r))},this.posFromIndex=function(r){return O(this.ace.session.doc.indexToPosition(r))},this.focus=function(r){return this.ace.textInput.focus()},this.blur=function(r){return this.ace.blur()},this.defaultTextHeight=function(r){return this.ace.renderer.layerConfig.lineHeight},this.scanForBracket=function(r,n,i,o){var a=o.bracketRegex.source,l=/paren|text|operator|tag/;if(n==1)var s=this.ace.session.$findClosingBracket(a.slice(1,2),X(r),l);else var s=this.ace.session.$findOpeningBracket(a.slice(-2,-1),{row:r.line,column:r.ch+1},l);return s&&{pos:O(s)}},this.refresh=function(){return this.ace.resize(!0)},this.getMode=function(){return{name:this.getOption("mode")}},this.execCommand=function(r){if(v.commands.hasOwnProperty(r))return v.commands[r](this);if(r=="indentAuto")return this.ace.execCommand("autoindent");console.log(r+" is not implemented")},this.getLineNumber=function(r){return r.row},this.getLineHandle=function(r){return{text:this.ace.session.getLine(r),row:r}}}).call(v.prototype);function X(e){return{row:e.line,column:e.ch}}function O(e){return new g(e.row,e.column)}var _e=v.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};_e.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.post},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){throw"not implemented"},indentation:function(){throw"not implemented"},match:function(e,t,r){if(typeof e=="string"){var n=function(a){return r?a.toLowerCase():a},i=this.string.substr(this.pos,e.length);if(n(i)==n(e))return t!==!1&&(this.pos+=e.length),!0}else{var o=this.string.slice(this.pos).match(e);return o&&o.index>0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}},v.defineExtension=function(e,t){v.prototype[e]=t},Me.importCssString(`.normal-mode .ace_cursor{
border: none;
background-color: rgba(255,0,0,0.5);
}
.normal-mode .ace_hidden-cursors .ace_cursor{
background-color: transparent;
border: 1px solid red;
opacity: 0.7
}
.ace_dialog {
position: absolute;
left: 0; right: 0;
background: inherit;
z-index: 15;
padding: .1em .8em;
overflow: hidden;
color: inherit;
}
.ace_dialog-top {
border-bottom: 1px solid #444;
top: 0;
}
.ace_dialog-bottom {
border-top: 1px solid #444;
bottom: 0;
}
.ace_dialog input {
border: none;
outline: none;
background: transparent;
width: 20em;
color: inherit;
font-family: monospace;
}`,"vimMode",!1),function(){function e(r,n,i){var o=r.ace.container,a;return a=o.appendChild(document.createElement("div")),i?a.className="ace_dialog ace_dialog-bottom":a.className="ace_dialog ace_dialog-top",typeof n=="string"?a.innerHTML=n:a.appendChild(n),a}function t(r,n){r.state.currentNotificationClose&&r.state.currentNotificationClose(),r.state.currentNotificationClose=n}v.defineExtension("openDialog",function(r,n,i){if(this.virtualSelectionMode())return;i||(i={}),t(this,null);var o=e(this,r,i.bottom),a=!1,l=this;this.state.dialog=o;function s(c){if(typeof c=="string")u.value=c;else{if(a||c&&c.type=="blur"&&document.activeElement===u)return;l.state.dialog==o&&(l.state.dialog=null,l.focus()),a=!0,o.remove(),i.onClose&&i.onClose(o);var d=l;d.state.vim&&(d.state.vim.status=null,d.ace._signal("changeStatus"),d.ace.renderer.$loop.schedule(d.ace.renderer.CHANGE_CURSOR))}}var u=o.getElementsByTagName("input")[0],f;return u?(i.value&&(u.value=i.value,i.selectValueOnOpen!==!1&&u.select()),i.onInput&&v.on(u,"input",function(c){i.onInput(c,u.value,s)}),i.onKeyUp&&v.on(u,"keyup",function(c){i.onKeyUp(c,u.value,s)}),v.on(u,"keydown",function(c){i&&i.onKeyDown&&i.onKeyDown(c,u.value,s)||(c.keyCode==13&&n(u.value),(c.keyCode==27||i.closeOnEnter!==!1&&c.keyCode==13)&&(v.e_stop(c),s()))}),i.closeOnBlur!==!1&&v.on(u,"blur",s),u.focus()):(f=o.getElementsByTagName("button")[0])&&(v.on(f,"click",function(){s(),l.focus()}),i.closeOnBlur!==!1&&v.on(f,"blur",s),f.focus()),s}),v.defineExtension("openNotification",function(r,n){if(this.virtualSelectionMode())return;t(this,s);var i=e(this,r,n&&n.bottom),o=!1,a,l=n&&typeof n.duration<"u"?n.duration:5e3;function s(){o||(o=!0,clearTimeout(a),i.remove())}return v.on(i,"click",function(u){v.e_preventDefault(u),s()}),l&&(a=setTimeout(s,l)),s})}();var g=v.Pos;function Qe(e,t){var r=e.state.vim;if(!r||r.insertMode)return t.head;var n=r.sel.head;if(!n)return t.head;if(!(r.visualBlock&&t.head.line!=n.line))return t.from()==t.anchor&&!t.empty()&&t.head.line==n.line&&t.head.ch!=n.ch?new g(t.head.line,t.head.ch-1):t.head}function fe(e,t,r){if(t.line===r.line&&t.ch>=r.ch-1){var n=e.getLine(t.line),i=n.charCodeAt(t.ch);55296<=i&&i<=55551&&(r.ch+=1)}return{start:t,end:r}}var L=[{keys:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"g",type:"keyToKey",toKeys:"gk"},{keys:"g",type:"keyToKey",toKeys:"gj"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",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:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"",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:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",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:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{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",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",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:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",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:"",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"idle",context:"normal"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",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:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",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",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",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:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',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",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",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"}],ee=L.length,Ne=[{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"}];function He(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),v.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",Qt),$e(e),v.on(e.getInputField(),"paste",dt(e))}function De(e){e.setOption("disableInput",!1),e.off("cursorActivity",Qt),v.off(e.getInputField(),"paste",dt(e)),e.state.vim=null,Je&&clearTimeout(Je)}function te(e,t){this==v.keyMap.vim&&(e.options.$customCursor=null,v.rmClass(e.getWrapperElement(),"cm-fat-cursor")),(!t||t.attach!=$)&&De(e)}function $(e,t){this==v.keyMap.vim&&(e.curOp&&(e.curOp.selectionChanged=!0),e.options.$customCursor=Qe,v.addClass(e.getWrapperElement(),"cm-fat-cursor")),(!t||t.attach!=$)&&He(e)}v.defineOption("vimMode",!1,function(e,t,r){t&&e.getOption("keyMap")!="vim"?e.setOption("keyMap","vim"):!t&&r!=v.Init&&/^vim/.test(e.getOption("keyMap"))&&e.setOption("keyMap","default")});function Y(e,t){if(t){if(this[e])return this[e];var r=nr(e);if(!r)return!1;var n=D.findKey(t,r);return typeof n=="function"&&v.signal(t,"vim-keypress",r),n}}var xe={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A",CapsLock:""},ht={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"};function nr(e){if(e.charAt(0)=="'")return e.charAt(1);var t=e.split(/-(?!$)/),r=t[t.length-1];if(t.length==1&&t[0].length==1)return!1;if(t.length==2&&t[0]=="Shift"&&r.length==1)return!1;for(var n=!1,i=0;i"):!1}function dt(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(P(e.getCursor(),0,1)),we.enterInsertMode(e,{},t))}),t.onPasteFn}var ir=/[\d]/,Fe=[v.isWordChar,function(e){return e&&!v.isWordChar(e)&&!/\s/.test(e)}],Ge=[function(e){return/\S/.test(e)}];function Xe(e,t){for(var r=[],n=e;n"]),yt=[].concat(pt,vt,gt,["-",'"',".",":","_","/","+"]),Ye;try{Ye=new RegExp("^[\\p{Lu}]$","u")}catch{Ye=/^[A-Z]$/}function Ze(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function qe(e){return/^[a-z]$/.test(e)}function ar(e){return"()[]{}".indexOf(e)!=-1}function sr(e){return ir.test(e)}function Te(e){return Ye.test(e)}function Q(e){return/^\s*$/.test(e)}function be(e){return".?!".indexOf(e)!=-1}function et(e,t){for(var r=0;rr?t=r:t0?1:-1,d,p=s.getCursor();do if(t+=c,f=i[(e+t)%e],f&&(d=f.find())&&!Z(p,d))break;while(tn)}return f}function l(s,u){var f=t,c=a(s,u);return t=f,c&&c.find()}return{cachedCursor:void 0,add:o,find:l,move:a}},Ct=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};function wt(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=Ct()}wt.prototype={exitMacroRecordMode:function(){var e=w.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var r=w.registerController.getRegister(t);if(r){if(r.clear(),this.latestRegister=t,e.openDialog){var n=ge("span",{class:"cm-vim-message"},"recording @"+t);this.onRecordingDone=e.openDialog(n,null,{bottom:!0})}this.isRecording=!0}}};function $e(e){return e.state.vim||(e.state.vim={inputState:new Ve,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),e.state.vim}var w;function kt(){w={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:lr(),macroModeState:new wt,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new mt({}),searchHistoryController:new rt,exCommandHistoryController:new rt};for(var e in ce){var t=ce[e];t.value=t.defaultValue}}var Re,D={enterVimMode:He,leaveVimMode:De,buildKeyMap:function(){},getRegisterController:function(){return w.registerController},resetVimGlobalState_:kt,getVimGlobalState_:function(){return w},maybeInitVimState_:$e,suppressErrorLogging:!1,InsertModeKey:lt,map:function(e,t,r){le.map(e,t,r)},unmap:function(e,t){return le.unmap(e,t)},noremap:function(e,t,r){function n(d){return d?[d]:["normal","insert","visual"]}for(var i=n(r),o=L.length,a=ee,l=o-a;l=0;i--){var o=n[i];if(e!==o.context)if(o.context)this._mapCommand(o);else{var a=["normal","insert","visual"];for(var l in a)if(a[l]!==e){var s={};for(var u in o)s[u]=o[u];s.context=a[l],this._mapCommand(s)}}}},setOption:tt,getOption:Ce,defineOption:Oe,defineEx:function(e,t,r){if(!t)t=e;else if(e.indexOf(t)!==0)throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered');jt[e]=r,le.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);if(typeof n=="function")return n()},multiSelectHandleKey:er,findKey:function(e,t,r){var n=$e(e);function i(){var f=w.macroModeState;if(f.isRecording){if(t=="q")return f.exitMacroRecordMode(),V(e),!0;r!="mapping"&&Qr(f,t)}}function o(){if(t==""){if(n.visualMode)ne(e);else if(n.insertMode)Ie(e);else return;return V(e),!0}}function a(f){for(var c;f;)c=/<\w+-.+?>|<\w+>|./.exec(f),t=c[0],f=f.substring(c.index+t.length),D.handleKey(e,t,"mapping")}function l(){if(o())return!0;for(var f=n.inputState.keyBuffer=n.inputState.keyBuffer+t,c=t.length==1,d=ve.matchCommand(f,L,n.inputState,"insert");f.length>1&&d.type!="full";){var f=n.inputState.keyBuffer=f.slice(1),p=ve.matchCommand(f,L,n.inputState,"insert");p.type!="none"&&(d=p)}if(d.type=="none")return V(e),!1;if(d.type=="partial")return Re&&window.clearTimeout(Re),Re=window.setTimeout(function(){n.insertMode&&n.inputState.keyBuffer&&V(e)},Ce("insertModeEscKeysTimeout")),!c;if(Re&&window.clearTimeout(Re),c){for(var h=e.listSelections(),C=0;C0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(""),10))),e};function V(e,t){e.state.vim.inputState=new Ve,v.signal(e,"vim-command-done",t)}function re(e,t,r){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!r}re.prototype={setText:function(e,t,r){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!r},pushText:function(e,t){t&&(this.linewise||this.keyBuffer.push(`
`),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(Ct(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}};function ur(e,t){var r=w.registerController.registers;if(!e||e.length!=1)throw Error("Register name must be 1 character");r[e]=t,yt.push(e)}function mt(e){this.registers=e,this.unnamedRegister=e['"']=new re,e["."]=new re,e[":"]=new re,e["/"]=new re,e["+"]=new re}mt.prototype={pushText:function(e,t,r,n,i){if(e!=="_"){n&&r.charAt(r.length-1)!==`
`&&(r+=`
`);var o=this.isValidRegister(e)?this.getRegister(e):null;if(!o){switch(t){case"yank":this.registers[0]=new re(r,n,i);break;case"delete":case"change":r.indexOf(`
`)==-1?this.registers["-"]=new re(r,n):(this.shiftNumericRegisters_(),this.registers[1]=new re(r,n));break}this.unnamedRegister.setText(r,n,i);return}var a=Te(e);a?o.pushText(r,n):o.setText(r,n,i),e==="+"&&typeof navigator<"u"&&typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText=="function"&&navigator.clipboard.writeText(r),this.unnamedRegister.setText(o.toString(),n)}},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new re),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&et(e,yt)},shiftNumericRegisters_:function(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(""+(e-1))}};function rt(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}rt.prototype={nextMatch:function(e,t){var r=this.historyBuffer,n=t?-1:1;this.initialPrefix===null&&(this.initialPrefix=e);for(var i=this.iterator+n;t?i>=0:i=r.length)return this.iterator=r.length,this.initialPrefix;if(i<0)return e},pushInput:function(e){var t=this.historyBuffer.indexOf(e);t>-1&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var ve={matchCommand:function(e,t,r,n){var i=dr(e,t,n,r);if(!i.full&&!i.partial)return{type:"none"};if(!i.full&&i.partial)return{type:"partial"};for(var o,a=0;a"){var s=vr(e);if(!s||s.length>1)return{type:"clear"};r.selectedCharacter=s}return{type:"full",command:o}},processCommand:function(e,t,r){switch(t.inputState.repeatOverride=r.repeatOverride,r.type){case"motion":this.processMotion(e,t,r);break;case"operator":this.processOperator(e,t,r);break;case"operatorMotion":this.processOperatorMotion(e,t,r);break;case"action":this.processAction(e,t,r);break;case"search":this.processSearch(e,t,r);break;case"ex":case"keyToEx":this.processEx(e,t,r);break;default:break}},processMotion:function(e,t,r){t.inputState.motion=r.motion,t.inputState.motionArgs=We(r.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,r){var n=t.inputState;if(n.operator)if(n.operator==r.operator){n.motion="expandToLine",n.motionArgs={linewise:!0},this.evalInput(e,t);return}else V(e);n.operator=r.operator,n.operatorArgs=We(r.operatorArgs),r.keys.length>1&&(n.operatorShortcut=r.keys),r.exitVisualBlock&&(t.visualBlock=!1,Ae(e)),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,r){var n=t.visualMode,i=We(r.operatorMotionArgs);i&&n&&i.visualLine&&(t.visualLine=!0),this.processOperator(e,t,r),n||this.processMotion(e,t,r)},processAction:function(e,t,r){var n=t.inputState,i=n.getRepeat(),o=!!i,a=We(r.actionArgs)||{};n.selectedCharacter&&(a.selectedCharacter=n.selectedCharacter),r.operator&&this.processOperator(e,t,r),r.motion&&this.processMotion(e,t,r),(r.motion||r.operator)&&this.evalInput(e,t),a.repeat=i||1,a.repeatIsExplicit=o,a.registerName=n.registerName,V(e),t.lastMotion=null,r.isEdit&&this.recordLastEdit(t,n,r),we[r.action](e,a,t)},processSearch:function(e,t,r){if(!e.getSearchCursor)return;var n=r.searchArgs.forward,i=r.searchArgs.wholeWordOnly;ie(e).setReversed(!n);var o=n?"/":"?",a=ie(e).getQuery(),l=e.getScrollInfo();function s(y,k,m){w.searchHistoryController.pushInput(y),w.searchHistoryController.reset();try{Ee(e,y,k,m)}catch{A(e,"Invalid regex: "+y),V(e);return}ve.processMotion(e,t,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:r.searchArgs.toJumplist}})}function u(y){s(y,!0,!0);var k=w.macroModeState;k.isRecording&&Xr(k,y)}function f(y,k,m){var M=v.keyName(y),x,B;M=="Up"||M=="Down"?(x=M=="Up",B=y.target?y.target.selectionEnd:0,k=w.searchHistoryController.nextMatch(k,x)||"",m(k),B&&y.target&&(y.target.selectionEnd=y.target.selectionStart=Math.min(B,y.target.value.length))):M!="Left"&&M!="Right"&&M!="Ctrl"&&M!="Alt"&&M!="Shift"&&w.searchHistoryController.reset();var E;try{E=Ee(e,k,!0,!0)}catch{}E?e.scrollIntoView($t(e,!n,E),30):(at(e),e.scrollTo(l.left,l.top))}function c(y,k,m){var M=v.keyName(y);M=="Esc"||M=="Ctrl-C"||M=="Ctrl-["||M=="Backspace"&&k==""?(w.searchHistoryController.pushInput(k),w.searchHistoryController.reset(),Ee(e,a),at(e),e.scrollTo(l.left,l.top),v.e_stop(y),V(e),m(),e.focus()):M=="Up"||M=="Down"?v.e_stop(y):M=="Ctrl-U"&&(v.e_stop(y),m(""))}switch(r.searchArgs.querySrc){case"prompt":var d=w.macroModeState;if(d.isPlaying){var C=d.replaySearchQueries.shift();s(C,!0,!1)}else je(e,{onClose:u,prefix:o,desc:"(JavaScript regexp)",onKeyUp:f,onKeyDown:c});break;case"wordUnderCursor":var p=Ue(e,!1,!0,!1,!0),h=!0;if(p||(p=Ue(e,!1,!0,!1,!1),h=!1),!p)return;var C=e.getLine(p.start.line).substring(p.start.ch,p.end.ch);h&&i?C="\\b"+C+"\\b":C=gr(C),w.jumpList.cachedCursor=e.getCursor(),e.setCursor(p.start),s(C,!0,!1);break}},processEx:function(e,t,r){function n(o){w.exCommandHistoryController.pushInput(o),w.exCommandHistoryController.reset(),le.processCommand(e,o),e.state.vim&&V(e)}function i(o,a,l){var s=v.keyName(o),u,f;(s=="Esc"||s=="Ctrl-C"||s=="Ctrl-["||s=="Backspace"&&a=="")&&(w.exCommandHistoryController.pushInput(a),w.exCommandHistoryController.reset(),v.e_stop(o),V(e),l(),e.focus()),s=="Up"||s=="Down"?(v.e_stop(o),u=s=="Up",f=o.target?o.target.selectionEnd:0,a=w.exCommandHistoryController.nextMatch(a,u)||"",l(a),f&&o.target&&(o.target.selectionEnd=o.target.selectionStart=Math.min(f,o.target.value.length))):s=="Ctrl-U"?(v.e_stop(o),l("")):s!="Left"&&s!="Right"&&s!="Ctrl"&&s!="Alt"&&s!="Shift"&&w.exCommandHistoryController.reset()}r.type=="keyToEx"?le.processCommand(e,r.exArgs.input):t.visualMode?je(e,{onClose:n,prefix:":",value:"'<,'>",onKeyDown:i,selectValueOnOpen:!1}):je(e,{onClose:n,prefix:":",onKeyDown:i})},evalInput:function(e,t){var r=t.inputState,n=r.motion,i=r.motionArgs||{},o=r.operator,a=r.operatorArgs||{},l=r.registerName,s=t.sel,u=T(t.visualMode?W(e,s.head):e.getCursor("head")),f=T(t.visualMode?W(e,s.anchor):e.getCursor("anchor")),c=T(u),d=T(f),p,h,C;if(o&&this.recordLastEdit(t,r),r.repeatOverride!==void 0?C=r.repeatOverride:C=r.getRepeat(),C>0&&i.explicitRepeat?i.repeatIsExplicit=!0:(i.noRepeat||!i.explicitRepeat&&C===0)&&(C=1,i.repeatIsExplicit=!1),r.selectedCharacter&&(i.selectedCharacter=a.selectedCharacter=r.selectedCharacter),i.repeat=C,V(e),n){var y=he[n](e,u,i,t,r);if(t.lastMotion=he[n],!y)return;if(i.toJumplist){!o&&e.ace.curOp!=null&&(e.ace.curOp.command.scrollIntoView="center-animate");var k=w.jumpList,m=k.cachedCursor;m?(Ot(e,m,y),delete k.cachedCursor):Ot(e,u,y)}y instanceof Array?(h=y[0],p=y[1]):p=y,p||(p=T(u)),t.visualMode?(t.visualBlock&&p.ch===1/0||(p=W(e,p,c)),h&&(h=W(e,h)),h=h||d,s.anchor=h,s.head=p,Ae(e),de(e,t,"<",R(h,p)?h:p),de(e,t,">",R(h,p)?p:h)):o||(e.ace.curOp&&(e.ace.curOp.vimDialogScroll="center-animate"),p=W(e,p,c),e.setCursor(p.line,p.ch))}if(o){if(a.lastSel){h=d;var M=a.lastSel,x=Math.abs(M.head.line-M.anchor.line),B=Math.abs(M.head.ch-M.anchor.ch);M.visualLine?p=new g(d.line+x,d.ch):M.visualBlock?p=new g(d.line+x,d.ch+B):M.head.line==M.anchor.line?p=new g(d.line,d.ch+B):p=new g(d.line+x,d.ch),t.visualMode=!0,t.visualLine=M.visualLine,t.visualBlock=M.visualBlock,s=t.sel={anchor:h,head:p},Ae(e)}else t.visualMode&&(a.lastSel={anchor:T(s.anchor),head:T(s.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var E,N,b,S,H;if(t.visualMode){E=q(s.head,s.anchor),N=ke(s.head,s.anchor),b=t.visualLine||a.linewise,S=t.visualBlock?"block":b?"line":"char";var j=fe(e,E,N);if(H=it(e,{anchor:j.start,head:j.end},S),b){var K=H.ranges;if(S=="block")for(var ue=0;ueu&&i.line==u)return It(e,t,r,n,!0);var f=e.ace.session.getFoldLine(l);return f&&(r.forward?l>f.start.row&&(l=f.end.row+1):l=f.start.row),r.toFirstChar&&(o=se(e.getLine(l)),n.lastHPos=o),n.lastHSPos=e.charCoords(new g(l,o),"div").left,new g(l,o)},moveByDisplayLines:function(e,t,r,n){var i=t;switch(n.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:n.lastHSPos=e.charCoords(i,"div").left}var o=r.repeat,a=e.findPosV(i,r.forward?o:-o,"line",n.lastHSPos);if(a.hitSide)if(r.forward)var l=e.charCoords(a,"div"),s={top:l.top+8,left:n.lastHSPos},a=e.coordsChar(s,"div");else{var u=e.charCoords(new g(e.firstLine(),0),"div");u.left=n.lastHSPos,a=e.coordsChar(u,"div")}return n.lastHPos=a.ch,a},moveByPage:function(e,t,r){var n=t,i=r.repeat;return e.findPosV(n,r.forward?i:-i,"page")},moveByParagraph:function(e,t,r){var n=r.forward?1:-1;return Bt(e,t,r.repeat,n)},moveBySentence:function(e,t,r){var n=r.forward?1:-1;return Er(e,t,r.repeat,n)},moveByScroll:function(e,t,r,n){var i=e.getScrollInfo(),o=null,a=r.repeat;a||(a=i.clientHeight/(2*e.defaultTextHeight()));var l=e.charCoords(t,"local");if(r.repeat=a,o=he.moveByDisplayLines(e,t,r,n),!o)return null;var s=e.charCoords(o,"local");return e.scrollTo(null,i.top+s.top-l.top),o},moveByWords:function(e,t,r){return Tr(e,t,r.repeat,!!r.forward,!!r.wordEnd,!!r.bigWord)},moveTillCharacter:function(e,t,r){var n=r.repeat,i=ot(e,n,r.forward,r.selectedCharacter),o=r.forward?-1:1;return Rt(o,r),i?(i.ch+=o,i):null},moveToCharacter:function(e,t,r){var n=r.repeat;return Rt(0,r),ot(e,n,r.forward,r.selectedCharacter)||t},moveToSymbol:function(e,t,r){var n=r.repeat;return Ar(e,n,r.forward,r.selectedCharacter)||t},moveToColumn:function(e,t,r,n){var i=r.repeat;return n.lastHPos=i-1,n.lastHSPos=e.charCoords(t,"div").left,Or(e,i)},moveToEol:function(e,t,r,n){return It(e,t,r,n,!1)},moveToFirstNonWhiteSpaceCharacter:function(e,t){var r=t;return new g(r.line,se(e.getLine(r.line)))},moveToMatchedSymbol:function(e,t){for(var r=t,n=r.line,i=r.ch,o=e.getLine(n),a;i]/.test(o[i])?/[(){}[\]<>]/:/[(){}[\]]/,u=e.findMatchingBracket(new g(n,i+1),{bracketRegex:s});return u.to}else return r},moveToStartOfLine:function(e,t){return new g(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,r){var n=r.forward?e.lastLine():e.firstLine();return r.repeatIsExplicit&&(n=r.repeat-e.getOption("firstLineNumber")),new g(n,se(e.getLine(n)))},moveToStartOfDisplayLine:function(e){return e.execCommand("goLineLeft"),e.getCursor()},moveToEndOfDisplayLine:function(e){e.execCommand("goLineRight");var t=e.getCursor();return t.sticky=="before"&&t.ch--,t},textObjectManipulation:function(e,t,r,n){var i={"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"},o={"'":!0,'"':!0,"`":!0},a=r.selectedCharacter;a=="b"?a="(":a=="B"&&(a="{");var l=!r.textObjectInner,s;if(i[a])s=Ir(e,t,a,l);else if(o[a])s=Br(e,t,a,l);else if(a==="W")s=Ue(e,l,!0,!0);else if(a==="w")s=Ue(e,l,!0,!1);else if(a==="p")if(s=Bt(e,t,r.repeat,0,l),r.linewise=!0,n.visualMode)n.visualLine||(n.visualLine=!0);else{var u=n.inputState.operatorArgs;u&&(u.linewise=!0),s.end.line--}else if(a==="t")s=xr(e,t,l);else if(a==="s"){var f=e.getLine(t.line);t.ch>0&&be(f[t.ch])&&(t.ch-=1);var c=Kt(e,t,r.repeat,1,l),d=Kt(e,t,r.repeat,-1,l);Q(e.getLine(d.line)[d.ch])&&Q(e.getLine(c.line)[c.ch-1])&&(d={line:d.line,ch:d.ch+1}),s={start:d,end:c}}else return null;return e.state.vim.visualMode?kr(e,s.start,s.end):[s.start,s.end]},repeatLastCharacterSearch:function(e,t,r){var n=w.lastCharacterSearch,i=r.repeat,o=r.forward===n.forward,a=(n.increment?1:0)*(o?-1:1);e.moveH(-a,"char"),r.inclusive=!!o;var l=ot(e,i,o,n.selectedCharacter);return l?(l.ch+=a,l):(e.moveH(a,"char"),t)}};function fr(e,t){he[e]=t}function Mt(e,t){for(var r=[],n=0;ne.lastLine()&&t.linewise&&!c?e.replaceRange("",f,l):e.replaceRange("",a,l),t.linewise&&(c||(e.setCursor(f),v.commands.newlineAndIndent(e)),a.ch=Number.MAX_VALUE),n=a}w.registerController.pushText(t.registerName,"change",i,t.linewise,r.length>1),we.enterInsertMode(e,{head:n},e.state.vim)},delete:function(e,t,r){var n,i,o=e.state.vim;if(o.visualBlock){i=e.getSelection();var s=Mt("",r.length);e.replaceSelections(s),n=q(r[0].head,r[0].anchor)}else{var a=r[0].anchor,l=r[0].head;t.linewise&&l.line!=e.firstLine()&&a.line==e.lastLine()&&a.line==l.line-1&&(a.line==e.firstLine()?a.ch=0:a=new g(a.line-1,_(e,a.line-1))),i=e.getRange(a,l),e.replaceRange("",a,l),n=a,t.linewise&&(n=he.moveToFirstNonWhiteSpaceCharacter(e,a))}return w.registerController.pushText(t.registerName,"delete",i,t.linewise,o.visualBlock),W(e,n)},indent:function(e,t,r){var n=e.state.vim;if(e.indentMore)for(var i=n.visualMode?t.repeat:1,o=0;o1&&e.setSelection(r[0].anchor,r[r.length-1].head),e.execCommand("indentAuto"),he.moveToFirstNonWhiteSpaceCharacter(e,r[0].anchor)},changeCase:function(e,t,r,n,i){for(var o=e.getSelections(),a=[],l=t.toLower,s=0;su.top?(s.line+=(l-u.top)/i,s.line=Math.ceil(s.line),e.setCursor(s),u=e.charCoords(s,"local"),e.scrollTo(null,u.top)):e.scrollTo(null,l);else{var f=l+e.getScrollInfo().clientHeight;f=i.anchor.line?o=P(i.head,0,1):o=new g(i.anchor.line,0)}else if(n=="inplace"){if(r.visualMode)return}else n=="lastEdit"&&(o=Wt(e)||o);e.setOption("disableInput",!1),t&&t.replace?(e.toggleOverwrite(!0),e.setOption("keyMap","vim-replace"),v.signal(e,"vim-mode-change",{mode:"replace"})):(e.toggleOverwrite(!1),e.setOption("keyMap","vim-insert"),v.signal(e,"vim-mode-change",{mode:"insert"})),w.macroModeState.isPlaying||(e.on("change",zt),v.on(e.getInputField(),"keydown",Xt)),r.visualMode&&ne(e),Lt(e,o,a)}},toggleVisualMode:function(e,t,r){var n=t.repeat,i=e.getCursor(),o;if(r.visualMode)r.visualLine^t.linewise||r.visualBlock^t.blockwise?(r.visualLine=!!t.linewise,r.visualBlock=!!t.blockwise,v.signal(e,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""}),Ae(e)):ne(e);else{r.visualMode=!0,r.visualLine=!!t.linewise,r.visualBlock=!!t.blockwise,o=W(e,new g(i.line,i.ch+n-1));var a=fe(e,i,o);r.sel={anchor:a.start,head:a.end},v.signal(e,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""}),Ae(e),de(e,r,"<",q(i,o)),de(e,r,">",ke(i,o))}},reselectLastSelection:function(e,t,r){var n=r.lastSelection;if(r.visualMode&&Tt(e,r),n){var i=n.anchorMark.find(),o=n.headMark.find();if(!i||!o)return;r.sel={anchor:i,head:o},r.visualMode=!0,r.visualLine=n.visualLine,r.visualBlock=n.visualBlock,Ae(e),de(e,r,"<",q(i,o)),de(e,r,">",ke(i,o)),v.signal(e,"vim-mode-change",{mode:"visual",subMode:r.visualLine?"linewise":r.visualBlock?"blockwise":""})}},joinLines:function(e,t,r){var n,i;if(r.visualMode){if(n=e.getCursor("anchor"),i=e.getCursor("head"),R(i,n)){var o=i;i=n,n=o}i.ch=_(e,i.line)-1}else{var a=Math.max(t.repeat,2);n=e.getCursor(),i=W(e,new g(n.line+a-1,1/0))}for(var l=0,s=n.line;s1)var n=Array(t.repeat+1).join(n);var p=i.linewise,h=i.blockwise;if(h){n=n.split(`
`),p&&n.pop();for(var C=0;Ce.lastLine()&&e.replaceRange(`
`,new g(S,0));var H=_(e,S);Hs.length&&(o=s.length),a=new g(i.line,o)}var u=fe(e,i,a);if(i=u.start,a=u.end,n==`
`)r.visualMode||e.replaceRange("",i,a),(v.commands.newlineAndIndentContinueComment||v.commands.newlineAndIndent)(e);else{var f=e.getRange(i,a);if(f=f.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,n),f=f.replace(/[^\n]/g,n),r.visualBlock){var c=new Array(e.getOption("tabSize")+1).join(" ");f=e.getSelection(),f=f.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,n),f=f.replace(/\t/g,c).replace(/[^\n]/g,n).split(`
`),e.replaceSelections(f)}else e.replaceRange(f,i,a);r.visualMode?(i=R(l[0].anchor,l[0].head)?l[0].anchor:l[0].head,e.setCursor(i),ne(e,!1)):e.setCursor(P(a,0,-1))}},incrementNumberToken:function(e,t){for(var r=e.getCursor(),n=e.getLine(r.line),i=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi,o,a,l,s;(o=i.exec(n))!==null&&(a=o.index,l=a+o[0].length,!(r.chs&&(f=-1),s+=f,s>l&&(s-=2)}return new g(o,s)}function We(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function P(e,t,r){return typeof t=="object"&&(r=t.ch,t=t.line),new g(e.line+t,e.ch+r)}function dr(e,t,r,n){for(var i,o=[],a=[],l=0;l"){var r=t.length-11,n=e.slice(0,r),i=t.slice(0,r);return n==i&&e.length>r?"full":i.indexOf(n)==0?"partial":!1}else return e==t?"full":t.indexOf(e)==0?"partial":!1}function vr(e){var t=/^.*(<[^>]+>)$/.exec(e),r=t?t[1]:e.slice(-1);if(r.length>1)switch(r){case"":r=`
`;break;case"":r=" ";break;default:r="";break}return r}function xt(e,t,r){return function(){for(var n=0;n2&&(t=q.apply(void 0,Array.prototype.slice.call(arguments,1))),R(e,t)?e:t}function ke(e,t){return arguments.length>2&&(t=ke.apply(void 0,Array.prototype.slice.call(arguments,1))),R(e,t)?t:e}function bt(e,t,r){var n=R(e,t),i=R(t,r);return n&&i}function _(e,t){return e.getLine(t).length}function nt(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function gr(e){return e.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function yr(e,t,r){var n=_(e,t),i=new Array(r-n+1).join(" ");e.setCursor(new g(t,n)),e.replaceRange(i,e.getCursor())}function At(e,t){var r=[],n=e.listSelections(),i=T(e.clipPos(t)),o=!Z(t,i),a=e.getCursor("head"),l=Cr(n,a),s=Z(n[l].head,n[l].anchor),u=n.length-1,f=u-l>l?u:0,c=n[f].anchor,d=Math.min(c.line,i.line),p=Math.max(c.line,i.line),h=c.ch,C=i.ch,y=n[f].head.ch-h,k=C-h;y>0&&k<=0?(h++,o||C--):y<0&&k>=0?(h--,s||C++):y<0&&k==-1&&(h--,C++);for(var m=d;m<=p;m++){var M={anchor:new g(m,h),head:new g(m,C)};r.push(M)}return e.setSelections(r),t.ch=C,c.ch=h,c}function Lt(e,t,r){for(var n=[],i=0;is&&(i.line=s),i.ch=_(e,i.line)}return{ranges:[{anchor:o,head:i}],primary:0}}else if(r=="block"){var u=Math.min(o.line,i.line),f=o.ch,c=Math.max(o.line,i.line),d=i.ch;f0&&o&&Q(o);o=i.pop())r.line--,r.ch=0;o?(r.line--,r.ch=_(e,r.line)):r.ch=0}}function Sr(e,t,r){t.ch=0,r.ch=0,r.line++}function se(e){if(!e)return 0;var t=e.search(/\S/);return t==-1?e.length:t}function Ue(e,t,r,n,i){for(var o=mr(e),a=e.getLine(o.line),l=o.ch,s=i?Fe[0]:Ge[0];!s(a.charAt(l));)if(l++,l>=a.length)return null;n?s=Ge[0]:(s=Fe[0],s(a.charAt(l))||(s=Fe[1]));for(var u=l,f=l;s(a.charAt(u))&&u=0;)f--;if(f++,t){for(var c=u;/\s/.test(a.charAt(u))&&u0;)f--;f||(f=d)}}return{start:new g(o.line,f),end:new g(o.line,u)}}function xr(e,t,r){var n=t;if(!v.findMatchingTag||!v.findEnclosingTag)return{start:n,end:n};var i=v.findMatchingTag(e,t)||v.findEnclosingTag(e,t);return!i||!i.open||!i.close?{start:n,end:n}:r?{start:i.open.from,end:i.close.to}:{start:i.open.to,end:i.close.from}}function Ot(e,t,r){Z(t,r)||w.jumpList.add(e,t,r)}function Rt(e,t){w.lastCharacterSearch.increment=e,w.lastCharacterSearch.forward=t.forward,w.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var br={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},Et={bracket:{isComplete:function(e){if(e.nextCh===e.symb){if(e.depth++,e.depth>=1)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?"]":"[")===e.symb?"{":"}"},isComplete:function(e){return e.index===0&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t=e.lastCh==="*"&&e.nextCh==="/";return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb=e.symb==="m"?"{":"}",e.reverseSymb=e.symb==="{"?"}":"{"},isComplete:function(e){return e.nextCh===e.symb}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if(e.nextCh==="#"){var t=e.lineText.match(/^#(\w+)/)[1];if(t==="endif"){if(e.forward&&e.depth===0)return!0;e.depth++}else if(t==="if"){if(!e.forward&&e.depth===0)return!0;e.depth--}if(t==="else"&&e.depth===0)return!0}return!1}}};function Ar(e,t,r,n){var i=T(e.getCursor()),o=r?1:-1,a=r?e.lineCount():-1,l=i.ch,s=i.line,u=e.getLine(s),f={lineText:u,nextCh:u.charAt(l),lastCh:null,index:l,symb:n,reverseSymb:(r?{")":"(","}":"{"}:{"(":")","{":"}"})[n],forward:r,depth:0,curMoveThrough:!1},c=br[n];if(!c)return i;var d=Et[c].init,p=Et[c].isComplete;for(d&&d(f);s!==a&&t;){if(f.index+=o,f.nextCh=f.lineText.charAt(f.index),!f.nextCh){if(s+=o,f.lineText=e.getLine(s)||"",o>0)f.index=0;else{var h=f.lineText.length;f.index=h>0?h-1:0}f.nextCh=f.lineText.charAt(f.index)}p(f)&&(i.line=s,i.ch=f.index,t--)}return f.nextCh||f.curMoveThrough?new g(s,f.index):i}function Lr(e,t,r,n,i){var o=t.line,a=t.ch,l=e.getLine(o),s=r?1:-1,u=n?Ge:Fe;if(i&&l==""){if(o+=s,l=e.getLine(o),!Ze(e,o))return null;a=r?0:l.length}for(;;){if(i&&l=="")return{from:0,to:0,line:o};for(var f=s>0?l.length:-1,c=f,d=f;a!=f;){for(var p=!1,h=0;h0?0:l.length}}function Tr(e,t,r,n,i,o){var a=T(t),l=[];(n&&!i||!n&&i)&&r++;for(var s=!(n&&i),u=0;u0?1:-1;var m=e.ace.session.getFoldLine(k);m&&k+n>m.start.row&&k+n0?m.end.row:m.start.row)-k)}if(n){for(;a<=f&&f<=l&&r>0;)p(f),d(f,n)&&r--,f+=n;return new g(f,0)}var h=e.state.vim;if(h.visualLine&&d(o,1,!0)){var C=h.sel.anchor;d(C.line,-1,!0)&&(!i||C.line!=o)&&(o+=1)}var y=c(o);for(f=o;f<=l&&r;f++)d(f,1,!0)&&(!i||c(f)!=y)&&r--;for(u=new g(f,0),f>l&&!y?y=!0:i=!1,f=o;f>a&&!((!i||c(f)==y||f==o)&&d(f,-1,!0));f--);return s=new g(f,0),{start:s,end:u}}function Kt(e,t,r,n,i){function o(u){u.pos+u.dir<0||u.pos+u.dir>=u.line.length?u.line=null:u.pos+=u.dir}function a(u,f,c,d){var p=u.getLine(f),h={line:p,ln:f,pos:c,dir:d};if(h.line==="")return{ln:h.ln,pos:h.pos};var C=h.pos;for(o(h);h.line!==null;){if(C=h.pos,be(h.line[h.pos]))if(i){for(o(h);h.line!==null&&Q(h.line[h.pos]);)C=h.pos,o(h);return{ln:h.ln,pos:C+1}}else return{ln:h.ln,pos:h.pos+1};o(h)}return{ln:h.ln,pos:C+1}}function l(u,f,c,d){var p=u.getLine(f),h={line:p,ln:f,pos:c,dir:d};if(h.line==="")return{ln:h.ln,pos:h.pos};var C=h.pos;for(o(h);h.line!==null;){if(!Q(h.line[h.pos])&&!be(h.line[h.pos]))C=h.pos;else if(be(h.line[h.pos]))return i?Q(h.line[h.pos+1])?{ln:h.ln,pos:h.pos+1}:{ln:h.ln,pos:C}:{ln:h.ln,pos:C};o(h)}return h.line=p,i&&Q(h.line[h.pos])?{ln:h.ln,pos:h.pos}:{ln:h.ln,pos:C}}for(var s={ln:t.line,pos:t.ch};r>0;)n<0?s=l(e,s.ln,s.pos,n):s=a(e,s.ln,s.pos,n),r--;return new g(s.ln,s.pos)}function Er(e,t,r,n){function i(s,u){if(u.pos+u.dir<0||u.pos+u.dir>=u.line.length){if(u.ln+=u.dir,!Ze(s,u.ln)){u.line=null,u.ln=null,u.pos=null;return}u.line=s.getLine(u.ln),u.pos=u.dir>0?0:u.line.length-1}else u.pos+=u.dir}function o(s,u,f,c){var y=s.getLine(u),d=y==="",p={line:y,ln:u,pos:f,dir:c},h={ln:p.ln,pos:p.pos},C=p.line==="";for(i(s,p);p.line!==null;){if(h.ln=p.ln,h.pos=p.pos,p.line===""&&!C)return{ln:p.ln,pos:p.pos};if(d&&p.line!==""&&!Q(p.line[p.pos]))return{ln:p.ln,pos:p.pos};be(p.line[p.pos])&&!d&&(p.pos===p.line.length-1||Q(p.line[p.pos+1]))&&(d=!0),i(s,p)}var y=s.getLine(h.ln);h.pos=0;for(var k=y.length-1;k>=0;--k)if(!Q(y[k])){h.pos=k;break}return h}function a(s,u,f,c){var C=s.getLine(u),d={line:C,ln:u,pos:f,dir:c},p={ln:d.ln,pos:null},h=d.line==="";for(i(s,d);d.line!==null;){if(d.line===""&&!h)return p.pos!==null?p:{ln:d.ln,pos:d.pos};if(be(d.line[d.pos])&&p.pos!==null&&!(d.ln===p.ln&&d.pos+1===p.pos))return p;d.line!==""&&!Q(d.line[d.pos])&&(h=!1,p={ln:d.ln,pos:d.pos}),i(s,d)}var C=s.getLine(p.ln);p.pos=0;for(var y=0;y0;)n<0?l=a(e,l.ln,l.pos,n):l=o(e,l.ln,l.pos,n),r--;return new g(l.ln,l.pos)}function Ir(e,t,r,n){var i=t,o,a,l={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[r],s={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[r],u=e.getLine(i.line).charAt(i.ch),f=u===s?1:0;if(o=e.scanForBracket(new g(i.line,i.ch+f),-1,void 0,{bracketRegex:l}),a=e.scanForBracket(new g(i.line,i.ch+f),1,void 0,{bracketRegex:l}),!o||!a)return{start:i,end:i};if(o=o.pos,a=a.pos,o.line==a.line&&o.ch>a.ch||o.line>a.line){var c=o;o=a,a=c}return n?a.ch+=1:o.ch+=1,{start:o,end:a}}function Br(e,t,r,n){var i=T(t),o=e.getLine(i.line),a=o.split(""),l,s,u,f,c=a.indexOf(r);if(i.ch-1&&!l;u--)a[u]==r&&(l=u+1);if(l&&!s)for(u=l,f=a.length;u=t&&e<=r:e==t}function st(e){var t=e.ace.renderer;return{top:t.getFirstFullyVisibleRow(),bottom:t.getLastFullyVisibleRow()}}function Vt(e,t,r){if(r=="'"||r=="`")return w.jumpList.find(e,-1)||new g(0,0);if(r==".")return Wt(e);var n=t.marks[r];return n&&n.find()}function Wt(e){var t=e.ace.session.$undoManager;if(t&&t.$lastDelta)return O(t.$lastDelta.end)}var Ut=function(){this.buildCommandMap_()};Ut.prototype={processCommand:function(e,t,r){var n=this;e.operation(function(){e.curOp.isVimOp=!0,n._processCommand(e,t,r)})},_processCommand:function(e,t,r){var n=e.state.vim,i=w.registerController.getRegister(":"),o=i.toString();n.visualMode&&ne(e);var a=new v.StringStream(t);i.setText(t);var l=r||{};l.input=t;try{this.parseInput_(e,a,l)}catch(c){throw A(e,c.toString()),c}var s,u;if(!l.commandName)l.line!==void 0&&(u="move");else if(s=this.matchCommand_(l.commandName),s){if(u=s.name,s.excludeFromCommandHistory&&i.setText(o),this.parseCommandArgs_(a,l,s),s.type=="exToKey"){for(var f=0;f@~])/);return n?r.commandName=n[1]:r.commandName=t.match(/.*/)[0],r},parseLineSpec_:function(e,t){var r=t.match(/^(\d+)/);if(r)return parseInt(r[1],10)-1;switch(t.next()){case".":return this.parseLineSpecOffset_(t,e.getCursor().line);case"$":return this.parseLineSpecOffset_(t,e.lastLine());case"'":var n=t.next(),i=Vt(e,e.state.vim,n);if(!i)throw new Error("Mark not set");return this.parseLineSpecOffset_(t,i.line);case"-":case"+":return t.backUp(1),this.parseLineSpecOffset_(t,e.getCursor().line);default:t.backUp(1);return}},parseLineSpecOffset_:function(e,t){var r=e.match(/^([+-])?(\d+)/);if(r){var n=parseInt(r[2],10);r[1]=="-"?t-=n:t+=n}return t},parseCommandArgs_:function(e,t,r){if(!e.eol()){t.argString=e.match(/.*/)[0];var n=r.argDelimiter||/\s+/,i=nt(t.argString).split(n);i.length&&i[0]&&(t.args=i)}},matchCommand_:function(e){for(var t=e.length;t>0;t--){var r=e.substring(0,t);if(this.commandMap_[r]){var n=this.commandMap_[r];if(n.name.indexOf(e)===0)return n}}return null},buildCommandMap_:function(){this.commandMap_={};for(var e=0;e1)return"Invalid arguments";o=H&&"decimal"||j&&"hex"||K&&"octal"}S[2]&&(a=new RegExp(S[2].substr(1,S[2].length-2),n?"i":""))}}var s=l();if(s){A(e,s+": "+t.argString);return}var u=t.line||e.firstLine(),f=t.lineEnd||t.line||e.lastLine();if(u==f)return;var c=new g(u,0),d=new g(f,_(e,f)),p=e.getRange(c,d).split(`
`),h=a||(o=="decimal"?/(-?)([\d]+)/:o=="hex"?/(-?)(?:0x)?([0-9a-f]+)/i:o=="octal"?/([0-7]+)/:null),C=o=="decimal"?10:o=="hex"?16:o=="octal"?8:null,y=[],k=[];if(o||a)for(var m=0;m=u){A(e,"Invalid argument: "+t.argString.substring(i));return}for(var f=0;f<=u-s;f++){var c=String.fromCharCode(s+f);delete r.marks[c]}}else{A(e,"Invalid argument: "+a+"-");return}}else delete r.marks[o]}}},le=new Ut;function jr(e,t,r,n,i,o,a,l,s){e.state.vim.exMode=!0;var u=!1,f,c,d;function p(){e.operation(function(){for(;!u;)h(),y();k()})}function h(){var M=e.getRange(o.from(),o.to()),x=M.replace(a,l),B=o.to().line;o.replace(x),c=o.to().line,i+=c-B,d=c1&&(Yt(e,t,t.insertModeRepeat-1,!0),t.lastEditInputState.repeatOverride=t.insertModeRepeat),delete t.insertModeRepeat,t.insertMode=!1,e.setCursor(e.getCursor().line,e.getCursor().ch-1),e.setOption("keyMap","vim"),e.setOption("disableInput",!0),e.toggleOverwrite(!1),n.setText(o.changes.join("")),v.signal(e,"vim-mode-change",{mode:"normal"}),r.isRecording&&Gr(r)}function Jt(e){L.unshift(e)}function Jr(e,t,r,n,i){var o={keys:e,type:t};o[t]=r,o[t+"Args"]=n;for(var a in i)o[a]=i[a];Jt(o)}Oe("insertModeEscKeysTimeout",200,"number"),v.keyMap["vim-insert"]={fallthrough:["default"],attach:$,detach:te,call:Y},v.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:$,detach:te,call:Y};function zr(e,t,r,n){var i=w.registerController.getRegister(n);if(n==":"){i.keyBuffer[0]&&le.processCommand(e,i.keyBuffer[0]),r.isPlaying=!1;return}var o=i.keyBuffer,a=0;r.isPlaying=!0,r.replaySearchQueries=i.searchQueries.slice(0);for(var l=0;l|<\w+>|./.exec(s),f=u[0],s=s.substring(u.index+f.length),D.handleKey(e,f,"macro"),t.insertMode){var c=i.insertModeChanges[a++].changes;w.macroModeState.lastInsertModeChanges.changes=c,Zt(e,c,1),Ie(e)}r.isPlaying=!1}function Qr(e,t){if(!e.isPlaying){var r=e.latestRegister,n=w.registerController.getRegister(r);n&&n.pushText(t)}}function Gr(e){if(!e.isPlaying){var t=e.latestRegister,r=w.registerController.getRegister(t);r&&r.pushInsertModeChanges&&r.pushInsertModeChanges(e.lastInsertModeChanges)}}function Xr(e,t){if(!e.isPlaying){var r=e.latestRegister,n=w.registerController.getRegister(r);n&&n.pushSearchQuery&&n.pushSearchQuery(t)}}function zt(e,t){var r=w.macroModeState,n=r.lastInsertModeChanges;if(!r.isPlaying)for(;t;){if(n.expectCursorActivityForChange=!0,n.ignoreCount>1)n.ignoreCount--;else if(t.origin=="+input"||t.origin=="paste"||t.origin===void 0){var i=e.listSelections().length;i>1&&(n.ignoreCount=i);var o=t.text.join(`
`);n.maybeReset&&(n.changes=[],n.maybeReset=!1),o&&(e.state.overwrite&&!/\n/.test(o)?n.changes.push([o]):n.changes.push(o))}t=t.next}}function Qt(e){var t=e.state.vim;if(t.insertMode){var r=w.macroModeState;if(r.isPlaying)return;var n=r.lastInsertModeChanges;n.expectCursorActivityForChange?n.expectCursorActivityForChange=!1:n.maybeReset=!0}else e.curOp.isVimOp||Gt(e,t)}function Gt(e,t,r){var n=e.getCursor("anchor"),i=e.getCursor("head");if(t.visualMode&&!e.somethingSelected()?ne(e,!1):!t.visualMode&&!t.insertMode&&e.somethingSelected()&&(t.visualMode=!0,t.visualLine=!1,v.signal(e,"vim-mode-change",{mode:"visual"})),t.visualMode){var o=R(i,n)?0:-1,a=R(i,n)?-1:0;i=P(i,0,o),n=P(n,0,a),t.sel={anchor:n,head:i},de(e,t,"<",q(i,n)),de(e,t,">",ke(i,n))}else!t.insertMode&&!r&&(t.lastHPos=e.getCursor().ch)}function lt(e){this.keyName=e}function Xt(e){var t=w.macroModeState,r=t.lastInsertModeChanges,n=v.keyName(e);if(!n)return;function i(){return r.maybeReset&&(r.changes=[],r.maybeReset=!1),r.changes.push(new lt(n)),!0}(n.indexOf("Delete")!=-1||n.indexOf("Backspace")!=-1)&&v.lookupKey(n,"vim-insert",i)}function Yt(e,t,r,n){var i=w.macroModeState;i.isPlaying=!0;var o=!!t.lastEditActionCommand,a=t.inputState;function l(){o?ve.processAction(e,t,t.lastEditActionCommand):ve.evalInput(e,t)}function s(f){if(i.lastInsertModeChanges.changes.length>0){f=t.lastEditActionCommand?f:1;var c=i.lastInsertModeChanges;Zt(e,c.changes,f)}}if(t.inputState=t.lastEditInputState,o&&t.lastEditActionCommand.interlaceInsertRepeat)for(var u=0;u1&&t[0]=="n"&&(t=t.replace("numpad","")),t=Yr[t]||t;var n="";return r.ctrlKey&&(n+="C-"),r.altKey&&(n+="A-"),(n||t.length>1)&&r.shiftKey&&(n+="S-"),n+=t,n.length>1&&(n="<"+n+">"),n}var qt=D.handleKey.bind(D);D.handleKey=function(e,t,r){return e.operation(function(){return qt(e,t,r)},!0)};function ut(e){var t=new e.constructor;return Object.keys(e).forEach(function(r){var n=e[r];Array.isArray(n)?n=n.slice():n&&typeof n=="object"&&n.constructor!=Object&&(n=ut(n)),t[r]=n}),e.sel&&(t.sel={head:e.sel.head&&T(e.sel.head),anchor:e.sel.anchor&&T(e.sel.anchor)}),t}function er(e,t,r){var n=!1,i=D.maybeInitVimState_(e),o=i.visualBlock||i.wasInVisualBlock,a=e.ace.inMultiSelectMode;if(i.wasInVisualBlock&&!a?i.wasInVisualBlock=!1:a&&i.visualBlock&&(i.wasInVisualBlock=!0),t==""&&!i.insertMode&&!i.visualMode&&a)e.ace.exitMultiSelectMode();else if(o||!a||e.ace.inVirtualSelectionMode)n=D.handleKey(e,t,r);else{var l=ut(i);e.operation(function(){e.ace.forEachSelection(function(){var s=e.ace.selection;e.state.vim.lastHPos=s.$desiredColumn==null?s.lead.column:s.$desiredColumn;var u=e.getCursor("head"),f=e.getCursor("anchor"),c=R(u,f)?0:-1,d=R(u,f)?-1:0;u=P(u,0,c),f=P(f,0,d),e.state.vim.sel.head=u,e.state.vim.sel.anchor=f,n=qt(e,t,r),s.$desiredColumn=e.state.vim.lastHPos==-1?null:e.state.vim.lastHPos,e.virtualSelectionMode()&&(e.state.vim=ut(l))}),e.curOp.cursorActivity&&!n&&(e.curOp.cursorActivity=!1)},!0)}return n&&!i.visualMode&&!i.insert&&i.visualMode!=e.somethingSelected()&&Gt(e,i,!0),n}G.CodeMirror=v;var me=D.maybeInitVimState_;G.handler={$id:"ace/keyboard/vim",drawCursor:function(e,t,r,n,i){var o=this.state.vim||{},a=r.characterWidth,l=r.lineHeight,s=t.top,u=t.left;if(!o.insertMode){var f=n.cursor?J.comparePoints(n.cursor,n.start)<=0:i.selection.isBackwards()||i.selection.isEmpty();!f&&u>a&&(u-=a)}!o.insertMode&&o.status&&(l=l/2,s+=l),Me.translate(e,u,s),Me.setStyle(e.style,"width",a+"px"),Me.setStyle(e.style,"height",l+"px")},$getDirectionForHighlight:function(e){var t=e.state.cm,r=me(t);if(!r.insertMode)return e.session.selection.isBackwards()||e.session.selection.isEmpty()},handleKeyboard:function(e,t,r,n,i){var o=e.editor,a=o.state.cm,l=me(a);if(n!=-1){if(l.insertMode||(t==-1?(r.charCodeAt(0)>255&&e.inputKey&&(r=e.inputKey,r&&e.inputHash==4&&(r=r.toUpperCase())),e.inputChar=r):t==4||t==0?e.inputKey==r&&e.inputHash==t&&e.inputChar?(r=e.inputChar,t=-1):(e.inputChar=null,e.inputKey=r,e.inputHash=t):e.inputChar=e.inputKey=null),a.state.overwrite&&l.insertMode&&r=="backspace"&&t==0)return{command:"gotoleft"};if(r=="c"&&t==1&&!U.isMac&&o.getCopyText())return o.once("copy",function(){l.insertMode?o.selection.clearSelection():a.operation(function(){ne(a)})}),{command:"null",passEvent:!0};if(r=="esc"&&!l.insertMode&&!l.visualMode&&!a.ace.inMultiSelectMode){var s=ie(a),u=s.getOverlay();u&&a.removeOverlay(u)}if(t==-1||t&1||t===0&&r.length>1){var f=l.insertMode,c=Zr(t,r,i||{});l.status==null&&(l.status="");var d=er(a,c,"user");return l=me(a),d&&l.status!=null?l.status+=c:l.status==null&&(l.status=""),a._signal("changeStatus"),!d&&(t!=-1||f)?void 0:{command:"null",passEvent:!d}}}},attach:function(e){e.state||(e.state={});var t=new v(e);e.state.cm=t,e.$vimModeHandler=this,v.keyMap.vim.attach(t),me(t).status=null,t.on("vim-command-done",function(){t.virtualSelectionMode()||(me(t).status=null,t.ace._signal("changeStatus"),t.ace.session.markUndoGroup())}),t.on("changeStatus",function(){t.ace.renderer.updateCursor(),t.ace._signal("changeStatus")}),t.on("vim-mode-change",function(){t.virtualSelectionMode()||(r(),t._signal("changeStatus"))});function r(){var n=me(t).insertMode;t.ace.renderer.setStyle("normal-mode",!n),e.textInput.setCommandMode(!n),e.renderer.$keepTextAreaAtCursor=n,e.renderer.$blockCursor=!n}r(),e.renderer.$cursorLayer.drawCursor=this.drawCursor.bind(t)},detach:function(e){var t=e.state.cm;v.keyMap.vim.detach(t),t.destroy(),e.state.cm=null,e.$vimModeHandler=null,e.renderer.$cursorLayer.drawCursor=null,e.renderer.setStyle("normal-mode",!1),e.textInput.setCommandMode(!1),e.renderer.$keepTextAreaAtCursor=!0},getStatusText:function(e){var t=e.state.cm,r=me(t);if(r.insertMode)return"INSERT";var n="";return r.visualMode&&(n+="VISUAL",r.visualLine&&(n+=" LINE"),r.visualBlock&&(n+=" BLOCK")),r.status&&(n+=(n?" ":"")+r.status),n}},D.defineOption({name:"wrap",set:function(e,t){t&&t.ace.setOption("wrap",e)},type:"boolean"},!1),D.defineEx("write","w",function(){console.log(":write is not implemented")}),L.push({keys:"zc",type:"action",action:"fold",actionArgs:{open:!1}},{keys:"zC",type:"action",action:"fold",actionArgs:{open:!1,all:!0}},{keys:"zo",type:"action",action:"fold",actionArgs:{open:!0}},{keys:"zO",type:"action",action:"fold",actionArgs:{open:!0,all:!0}},{keys:"za",type:"action",action:"fold",actionArgs:{toggle:!0}},{keys:"zA",type:"action",action:"fold",actionArgs:{toggle:!0,all:!0}},{keys:"zf",type:"action",action:"fold",actionArgs:{open:!0,all:!0}},{keys:"zd",type:"action",action:"fold",actionArgs:{open:!0,all:!0}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"addCursorAbove"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"addCursorBelow"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"addCursorAboveSkipCurrent"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"addCursorBelowSkipCurrent"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"selectMoreBefore"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"selectMoreAfter"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"selectNextBefore"}},{keys:"",type:"action",action:"aceCommand",actionArgs:{name:"selectNextAfter"}}),L.push({keys:"gq",type:"operator",operator:"hardWrap"}),D.defineOperator("hardWrap",function(e,t,r,n,i){var o=r[0].anchor.line,a=r[0].head.line;return t.linewise&&a--,pe(e.ace,{startRow:o,endRow:a}),g(a,0)}),Oe("textwidth",void 0,"number",["tw"],function(e,t){if(t!==void 0)if(e===void 0){var r=t.ace.getOption("printMarginColumn");return r}else{var n=Math.round(e);n>1&&t.ace.setOption("printMarginColumn",n)}}),we.aceCommand=function(e,t,r){e.vimCmd=t,e.ace.inVirtualSelectionMode?e.ace.on("beforeEndOperation",ft):ft(null,e.ace)};function ft(e,t){t.off("beforeEndOperation",ft);var r=t.state.cm.vimCmd;r&&t.execCommand(r.exec?r:r.name,r.args),t.curOp=t.prevOp}we.fold=function(e,t,r){e.ace.execCommand(["toggleFoldWidget","toggleFoldWidget","foldOther","unfoldall"][(t.all?2:0)+(t.open?1:0)])},G.handler.defaultKeymap=L,G.handler.actions=we,G.Vim=D});(function(){ace.require(["ace/keyboard/vim"],function(I){typeof ze=="object"&&typeof tr=="object"&&ze&&(ze.exports=I)})})()});tn();})();
//# sourceMappingURL=bfaea4527da3bca61fb24aac3e553ac2.js.map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy