ace.define("ace/ext/hardwrap",["require","exports","module","ace/range","ace/editor","ace/config"],(function(e,t,n){"use strict";function r(e,t){function n(e,t,n){if(!(e.length<t)){var r=e.slice(0,t),a=e.slice(t),o=/^(?:(\s+)|(\S+)(\s+))/.exec(a),s=/(?:(\s+)|(\s+)(\S+))$/.exec(r),i=0,l=0;return s&&!s[2]&&(i=t-s[1].length,l=t),o&&!o[2]&&(i||(i=t),l=t+o[1].length),i?{start:i,end:l}:s&&s[2]&&s.index>n?{start:s.index,end:s.index+s[2].length}:o&&o[2]?{start:i=t+o[2].length,end:i+o[3].length}:void 0}}for(var r=t.column||e.getOption("printMarginColumn"),a=0!=t.allowMerge,s=Math.min(t.startRow,t.endRow),i=Math.max(t.startRow,t.endRow),l=e.session;s<=i;){var c=l.getLine(s);if(c.length>r){if(f=n(c,r,5)){var d=/^\s*/.exec(c)[0];l.replace(new o(s,f.start,s,f.end),"\n"+d)}i++}else if(a&&/\S/.test(c)&&s!=i){var g=l.getLine(s+1);if(g&&/\S/.test(g)){var f,h=c.replace(/\s+$/,""),u=g.replace(/^\s+/,""),p=h+" "+u;if((f=n(p,r,5))&&f.start>h.length||p.length<r){var m=new o(s,h.length,s+1,g.length-u.length);l.replace(m," "),s--,i--}else h.length<c.length&&l.remove(new o(s,h.length,s,c.length))}}s++}}function a(e){if("insertstring"==e.command.name&&/\S/.test(e.args)){var t=e.editor,n=t.selection.cursor;if(n.column<=t.renderer.$printMarginColumn)return;var a=t.session.$undoManager.$lastDelta;r(t,{startRow:n.row,endRow:n.row,allowMerge:!1}),a!=t.session.$undoManager.$lastDelta&&t.session.markUndoGroup()}}var o=e("../range").Range,s=e("../editor").Editor;e("../config").defineOptions(s.prototype,"editor",{hardWrap:{set:function(e){e?this.commands.on("afterExec",a):this.commands.off("afterExec",a)},value:!1}}),t.hardWrap=r})),ace.require(["ace/ext/hardwrap"],(function(e){"object"==typeof module&&"object"==typeof exports&&module&&(module.exports=e)}));