text: /**
   * skylark-ace - A version of ace v1.4.3 that ported to running on skylarkjs.
   * @author Hudaokeji Co.,Ltd
   * @version v0.9.0
   * @link www.skylarkjs.org
   * @license MIT
   */
  define(function(require,exports,module){"use strict";var e=require("./lib/oop"),t=require("./range").Range,i=require("./search").Search,n=require("./search_highlight").SearchHighlight,s=require("./commands/incremental_search_commands"),r=s.IncrementalSearchKeyboardHandler;function o(){this.$options={wrap:!1,skipCurrent:!1},this.$keyboardHandler=new r(this)}function a(e){return e instanceof RegExp}function h(e){var t=String(e),i=t.indexOf("/"),n=t.lastIndexOf("/");return{expression:t.slice(i+1,n),flags:t.slice(n+1)}}function c(e,t){try{return new RegExp(e,t)}catch(t){return e}}function d(e){return c(e.expression,e.flags)}e.inherits(o,i),function(){this.activate=function(e,t){this.$editor=e,this.$startPos=this.$currentPos=e.getCursorPosition(),this.$options.needle="",this.$options.backwards=t,e.keyBinding.addKeyboardHandler(this.$keyboardHandler),this.$originalEditorOnPaste=e.onPaste,e.onPaste=this.onPaste.bind(this),this.$mousedownHandler=e.addEventListener("mousedown",this.onMouseDown.bind(this)),this.selectionFix(e),this.statusMessage(!0)},this.deactivate=function(e){this.cancelSearch(e);var t=this.$editor;t.keyBinding.removeKeyboardHandler(this.$keyboardHandler),this.$mousedownHandler&&(t.removeEventListener("mousedown",this.$mousedownHandler),delete this.$mousedownHandler),t.onPaste=this.$originalEditorOnPaste,this.message("")},this.selectionFix=function(e){e.selection.isEmpty()&&!e.session.$emacsMark&&e.clearSelection()},this.highlight=function(e){var t=this.$editor.session;(t.$isearchHighlight=t.$isearchHighlight||t.addDynamicMarker(new n(null,"ace_isearch-result","text"))).setRegexp(e),t._emit("changeBackMarker")},this.cancelSearch=function(e){var i=this.$editor;return this.$prevNeedle=this.$options.needle,this.$options.needle="",e?(i.moveCursorToPosition(this.$startPos),this.$currentPos=this.$startPos):i.pushEmacsMark&&i.pushEmacsMark(this.$startPos,!1),this.highlight(null),t.fromPoints(this.$currentPos,this.$currentPos)},this.highlightAndFindWithNeedle=function(e,i){if(!this.$editor)return null;var n=this.$options;if(i&&(n.needle=i.call(this,n.needle||"")||""),0===n.needle.length)return this.statusMessage(!0),this.cancelSearch(!0);n.start=this.$currentPos;var s=this.$editor.session,r=this.find(s),o=this.$editor.emacsMark?!!this.$editor.emacsMark():!this.$editor.selection.isEmpty();return r&&(n.backwards&&(r=t.fromPoints(r.end,r.start)),this.$editor.selection.setRange(t.fromPoints(o?this.$startPos:r.end,r.end)),e&&(this.$currentPos=r.end),this.highlight(n.re)),this.statusMessage(r),r},this.addString=function(e){return this.highlightAndFindWithNeedle(!1,function(t){if(!a(t))return t+e;var i=h(t);return i.expression+=e,d(i)})},this.removeChar=function(e){return this.highlightAndFindWithNeedle(!1,function(e){if(!a(e))return e.substring(0,e.length-1);var t=h(e);return t.expression=t.expression.substring(0,t.expression.length-1),d(t)})},this.next=function(e){return e=e||{},this.$options.backwards=!!e.backwards,this.$currentPos=this.$editor.getCursorPosition(),this.highlightAndFindWithNeedle(!0,function(t){return e.useCurrentOrPrevSearch&&0===t.length?this.$prevNeedle||"":t})},this.onMouseDown=function(e){return this.deactivate(),!0},this.onPaste=function(e){this.addString(e)},this.convertNeedleToRegExp=function(){return this.highlightAndFindWithNeedle(!1,function(e){return a(e)?e:c(e,"ig")})},this.convertNeedleToString=function(){return this.highlightAndFindWithNeedle(!1,function(e){return a(e)?h(e).expression:e})},this.statusMessage=function(e){var t=this.$options,i="";i+=t.backwards?"reverse-":"",i+="isearch: "+t.needle,i+=e?"":" (not found)",this.message(i)},this.message=function(e){this.$editor.showCommandLine?(this.$editor.showCommandLine(e),this.$editor.focus()):console.log(e)}}.call(o.prototype),exports.IncrementalSearch=o;var u=require("./lib/dom");u.importCssString&&u.importCssString(".ace_marker-layer .ace_isearch-result {  position: absolute;  z-index: 6;  box-sizing: border-box;}div.ace_isearch-result {  border-radius: 4px;  background-color: rgba(255, 200, 0, 0.5);  box-shadow: 0 0 4px rgb(255, 200, 0);}.ace_dark div.ace_isearch-result {  background-color: rgb(100, 110, 160);  box-shadow: 0 0 4px rgb(80, 90, 140);}","incremental-search-highlighting");var l=require("./commands/command_manager");(function(){this.setupIncrementalSearch=function(e,t){if(this.usesIncrementalSearch!=t){this.usesIncrementalSearch=t;var i=s.iSearchStartCommands;this[t?"addCommands":"removeCommands"](i)}}}).call(l.CommandManager.prototype);var g=require("./editor").Editor;require("./config").defineOptions(g.prototype,"editor",{useIncrementalSearch:{set:function(e){this.keyBinding.$handlers.forEach(function(t){t.setupIncrementalSearch&&t.setupIncrementalSearch(this,e)}),this._emit("incrementalSearchSettingChanged",{isEnabled:e})}}})});
  //# sourceMappingURL=sourcemaps/incremental_search.js.map
  