(this.webpackChunktocco_legacy_bundle=this.webpackChunktocco_legacy_bundle||[]).push([[78720],{78720(t,e,s){t=s.nmd(t),ace.define("ace/ext/elastic_tabstops_lite",["require","exports","module","ace/editor","ace/config"],(function(t,e,s){"use strict";var o=function(){function t(t){this.$editor=t;var e=this,s=[],o=!1;this.onAfterExec=function(){o=!1,e.processRows(s),s=[]},this.onExec=function(){o=!0},this.onChange=function(t){o&&(-1==s.indexOf(t.start.row)&&s.push(t.start.row),t.end.row!=t.start.row&&s.push(t.end.row))}}return t.prototype.processRows=function(t){this.$inChange=!0;for(var e=[],s=0,o=t.length;s<o;s++){var i=t[s];if(!(e.indexOf(i)>-1))for(var n=this.$findCellWidthsForBlock(i),r=this.$setBlockCellWidthsToMax(n.cellWidths),h=n.firstRow,a=0,c=r.length;a<c;a++){var l=r[a];e.push(h),this.$adjustRow(h,l),h++}}this.$inChange=!1},t.prototype.$findCellWidthsForBlock=function(t){for(var e,s=[],o=t;o>=0&&0!=(e=this.$cellWidthsForRow(o)).length;)s.unshift(e),o--;var i=o+1;o=t;for(var n=this.$editor.session.getLength();o<n-1&&(o++,0!=(e=this.$cellWidthsForRow(o)).length);)s.push(e);return{cellWidths:s,firstRow:i}},t.prototype.$cellWidthsForRow=function(t){for(var e=this.$selectionColumnsForRow(t),s=[-1].concat(this.$tabsForRow(t)),o=s.map((function(t){return 0})).slice(1),i=this.$editor.session.getLine(t),n=0,r=s.length-1;n<r;n++){var h=s[n]+1,a=s[n+1],c=this.$rightmostSelectionInCell(e,a),l=i.substring(h,a);o[n]=Math.max(l.replace(/\s+$/g,"").length,c-h)}return o},t.prototype.$selectionColumnsForRow=function(t){var e=[],s=this.$editor.getCursorPosition();return this.$editor.session.getSelection().isEmpty()&&t==s.row&&e.push(s.column),e},t.prototype.$setBlockCellWidthsToMax=function(t){for(var e,s,o,i=!0,n=this.$izip_longest(t),r=0,h=n.length;r<h;r++){var a=n[r];if(a.push){a.push(NaN);for(var c=0,l=a.length;c<l;c++){var u=a[c];if(i&&(e=c,o=0,i=!1),isNaN(u)){s=c;for(var p=e;p<s;p++)t[p][r]=o;i=!0}o=Math.max(o,u)}}else console.error(a)}return t},t.prototype.$rightmostSelectionInCell=function(t,e){var s=0;if(t.length){for(var o=[],i=0,n=t.length;i<n;i++)t[i]<=e?o.push(i):o.push(0);s=Math.max.apply(Math,o)}return s},t.prototype.$tabsForRow=function(t){for(var e,s=[],o=this.$editor.session.getLine(t),i=/\t/g;null!=(e=i.exec(o));)s.push(e.index);return s},t.prototype.$adjustRow=function(t,e){var s=this.$tabsForRow(t);if(0!=s.length)for(var o=0,i=-1,n=this.$izip(e,s),r=0,h=n.length;r<h;r++){var a=n[r][0],c=n[r][1],l=(i+=1+a)-(c+=o);if(0!=l){var u=this.$editor.session.getLine(t).substr(0,c),p=u.replace(/\s*$/g,""),f=u.length-p.length;l>0&&(this.$editor.session.getDocument().insertInLine({row:t,column:c+1},Array(l+1).join(" ")+"\t"),this.$editor.session.getDocument().removeInLine(t,c,c+1),o+=l),l<0&&f>=-l&&(this.$editor.session.getDocument().removeInLine(t,c+l,c),o+=l)}}},t.prototype.$izip_longest=function(t){if(!t[0])return[];for(var e=t[0].length,s=t.length,o=1;o<s;o++){var i=t[o].length;i>e&&(e=i)}for(var n=[],r=0;r<e;r++){var h=[];for(o=0;o<s;o++)""===t[o][r]?h.push(NaN):h.push(t[o][r]);n.push(h)}return n},t.prototype.$izip=function(t,e){for(var s=t.length>=e.length?e.length:t.length,o=[],i=0;i<s;i++){var n=[t[i],e[i]];o.push(n)}return o},t}();e.ElasticTabstopsLite=o;var i=t("../editor").Editor;t("../config").defineOptions(i.prototype,"editor",{useElasticTabstops:{set:function(t){t?(this.elasticTabstops||(this.elasticTabstops=new o(this)),this.commands.on("afterExec",this.elasticTabstops.onAfterExec),this.commands.on("exec",this.elasticTabstops.onExec),this.on("change",this.elasticTabstops.onChange)):this.elasticTabstops&&(this.commands.removeListener("afterExec",this.elasticTabstops.onAfterExec),this.commands.removeListener("exec",this.elasticTabstops.onExec),this.removeListener("change",this.elasticTabstops.onChange))}}})})),ace.require(["ace/ext/elastic_tabstops_lite"],(function(e){t&&(t.exports=e)}))}}]);