define("ace/ext/whitespace",["require","exports","module","ace/lib/lang"],function(e,n,t){"use strict";var m=e("../lib/lang");n.$detectIndentation=function(e,t){for(var r=[],n=[],o=0,i=0,s=Math.min(e.length,1e3),c=0;c<s;c++){var a=e[c];if(/^\s*[^*+\-\s]/.test(a))for(var g,l,i="\t"==a[0]?(o++,-Number.MAX_VALUE):((g=a.match(/^ */)[0].length)&&"\t"!=a[g]&&(!(0<(l=g-i))||i%l||g%l||(n[l]=(n[l]||0)+1),r[g]=(r[g]||0)+1),g);c<s&&"\\"==a[a.length-1];)a=e[c++]}for(var u,h=n.reduce(function(e,t){return e+t},0),f={score:0,length:0},d=0,c=1;c<12;c++){var m=function(e){for(var t=0,n=e;n<r.length;n+=e)t+=r[n]||0;return t}(c);1==c?(d=m,m=r[1]?.9:.8,r.length||(m=0)):m/=d,n[c]&&(m+=n[c]/h),m>f.score&&(f={score:m,length:c})}return f.score&&1.4<f.score&&(u=f.length),d+1<o?{ch:"\t",length:u=1==u||d<o/4||f.score<1.8?void 0:u}:o+1<d?{ch:" ",length:u}:void 0},n.detectIndentation=function(e){var t=e.getLines(0,1e3),t=n.$detectIndentation(t)||{};return t.ch&&e.setUseSoftTabs(" "==t.ch),t.length&&e.setTabSize(t.length),t},n.trimTrailingSpace=function(e,t){var n=e.getDocument(),r=n.getAllLines(),o=t&&t.trimEmpty?-1:0,i=[],s=-1;t&&t.keepCursorPosition&&(e.selection.rangeCount?e.selection.rangeList.ranges.forEach(function(e,t,n){t=n[t+1];t&&t.cursor.row==e.cursor.row||i.push(e.cursor)}):i.push(e.selection.getCursor()),s=0);for(var c=i[s]&&i[s].row,a=0,g=r.length;a<g;a++){var l=r[a],u=l.search(/\s+$/);a==c&&(u<i[s].column&&o<u&&(u=i[s].column),c=i[++s]?i[s].row:-1),o<u&&n.removeInLine(a,u,l.length)}},n.convertIndentation=function(e,t,n){var r=e.getTabString()[0],o=e.getTabSize();n=n||o;for(var i="\t"==(t=t||r)?t:m.stringRepeat(t,n),s=e.doc,c=s.getAllLines(),a={},g={},l=0,u=c.length;l<u;l++){var h,f,d=c[l].match(/^\s*/)[0];d&&(h=(f=e.$getStringScreenWidth(d)[0])%o,f=a[f=Math.floor(f/o)]||(a[f]=m.stringRepeat(i,f)),(f+=g[h]||(g[h]=m.stringRepeat(" ",h)))!=d&&(s.removeInLine(l,0,d.length),s.insertInLine({row:l,column:0},f)))}e.setTabSize(n),e.setUseSoftTabs(" "==t)},n.$parseStringArg=function(e){var t={};/t/.test(e)?t.ch="\t":/s/.test(e)&&(t.ch=" ");e=e.match(/\d+/);return e&&(t.length=parseInt(e[0],10)),t},n.$parseArg=function(e){return e?"string"==typeof e?n.$parseStringArg(e):"string"==typeof e.text?n.$parseStringArg(e.text):e:{}},n.commands=[{name:"detectIndentation",exec:function(e){n.detectIndentation(e.session)}},{name:"trimTrailingSpace",exec:function(e,t){n.trimTrailingSpace(e.session,t)}},{name:"convertIndentation",exec:function(e,t){t=n.$parseArg(t);n.convertIndentation(e.session,t.ch,t.length)}},{name:"setIndentation",exec:function(e,t){t=n.$parseArg(t);t.length&&e.session.setTabSize(t.length),t.ch&&e.session.setUseSoftTabs(" "==t.ch)}}]}),window.require(["ace/ext/whitespace"],function(e){"object"==typeof module&&"object"==typeof exports&&module&&(module.exports=e)});