import{__exports as e}from"../../../../_virtual/utils.mjs";import{__require as r}from"../../../slice-ansi/index.mjs";import{__require as t}from"../../../string-width/index.mjs";import{__require as o}from"../../../strip-ansi/index.mjs";import{__require as n}from"./getBorderCharacters.mjs";var a;function l(){if(a)return e;a=1;var l=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.isCellInRange=e.areCellEqual=e.calculateRangeCoordinate=e.flatten=e.extractTruncates=e.sumArray=e.sequence=e.distributeUnevenly=e.countSpaceSequence=e.groupBySizes=e.makeBorderConfig=e.splitAnsi=e.normalizeString=void 0;const i=l(r()),u=l(t()),s=l(o()),c=n();e.normalizeString=e=>e.replace(/\r\n/g,"\n");e.splitAnsi=e=>{const r=(0,s.default)(e).split("\n").map(u.default),t=[];let o=0;return r.forEach(r=>{t.push(0===r?"":(0,i.default)(e,o,o+r)),o+=r+1}),t};e.makeBorderConfig=e=>({...(0,c.getBorderCharacters)("honeywell"),...e});e.groupBySizes=(e,r)=>{let t=0;return r.map(r=>{const o=e.slice(t,t+r);return t+=r,o})};e.countSpaceSequence=e=>{var r,t;return null!==(t=null===(r=e.match(/\s+/g))||void 0===r?void 0:r.length)&&void 0!==t?t:0};e.distributeUnevenly=(e,r)=>Array.from({length:r}).fill(Math.floor(e/r)).map((t,o)=>t+(o<e%r?1:0));e.sequence=(e,r)=>Array.from({length:r-e+1},(r,t)=>t+e);e.sumArray=e=>e.reduce((e,r)=>e+r,0);e.extractTruncates=e=>e.columns.map(({truncate:e})=>e);e.flatten=e=>[].concat(...e);e.calculateRangeCoordinate=e=>{const{row:r,col:t,colSpan:o=1,rowSpan:n=1}=e;return{bottomRight:{col:t+o-1,row:r+n-1},topLeft:{col:t,row:r}}};e.areCellEqual=(e,r)=>e.row===r.row&&e.col===r.col;return e.isCellInRange=(e,{topLeft:r,bottomRight:t})=>r.row<=e.row&&e.row<=t.row&&r.col<=e.col&&e.col<=t.col,e}export{l as __require};