import{__exports as r}from"../../../../_virtual/createStream.mjs";import{__require as t}from"./alignTableData.mjs";import{__require as e}from"./calculateRowHeights.mjs";import{__require as a}from"./drawBorder.mjs";import{__require as o}from"./drawRow.mjs";import{__require as i}from"./makeStreamConfig.mjs";import{__require as m}from"./mapDataUsingRowHeights.mjs";import{__require as s}from"./padTableData.mjs";import{__require as n}from"./stringifyTableData.mjs";import{__require as u}from"./truncateTableData.mjs";import{__require as c}from"./utils.mjs";var l;function d(){if(l)return r;l=1,Object.defineProperty(r,"__esModule",{value:!0}),r.createStream=void 0;const d=t(),_=e(),p=a(),w=o(),f=i(),g=m(),j=s(),q=n(),b=u(),h=c(),D=(r,t)=>{let e=(0,q.stringifyTableData)(r);e=(0,b.truncateTableData)(e,(0,h.extractTruncates)(t));const a=(0,_.calculateRowHeights)(e,t);return e=(0,g.mapDataUsingRowHeights)(e,a,t),e=(0,d.alignTableData)(e,t),e=(0,j.padTableData)(e,t),e};return r.createStream=r=>{const t=(0,f.makeStreamConfig)(r),e=Object.values(t.columns).map(r=>r.width+r.paddingLeft+r.paddingRight);let a=!0;return{write:r=>{if(r.length!==t.columnCount)throw new Error("Row cell count does not match the config.columnCount.");a?(a=!1,((r,t,e)=>{const a=D([r],e).map(r=>(0,w.drawRow)(r,e)).join("");let o;o="",o+=(0,p.drawBorderTop)(t,e),o+=a,o+=(0,p.drawBorderBottom)(t,e),o=o.trimEnd(),process.stdout.write(o)})(r,e,t)):((r,t,e)=>{const a=D([r],e).map(r=>(0,w.drawRow)(r,e)).join("");let o="";const i=(0,p.drawBorderBottom)(t,e);"\n"!==i&&(o="\r[K"),o+=(0,p.drawBorderJoin)(t,e),o+=a,o+=i,o=o.trimEnd(),process.stdout.write(o)})(r,e,t)}}},r}export{d as __require};