import{o as t}from"./devlop-Cl3hj7Sz.js";import{m as e}from"./markdown-table-qiBROtQo.js";import{h as n}from"./mdast-util-to-markdown-CTgpsuc0.js";function a(){return{enter:{table:r,tableData:c,tableHeader:c,tableRow:i},exit:{codeText:s,table:l,tableData:o,tableHeader:o,tableRow:o}}}function r(t){const e=t._align;this.enter({type:"table",align:e.map(function(t){return"none"===t?null:t}),children:[]},t),this.data.inTable=!0}function l(t){this.exit(t),this.data.inTable=void 0}function i(t){this.enter({type:"tableRow",children:[]},t)}function o(t){this.exit(t)}function c(t){this.enter({type:"tableCell",children:[]},t)}function s(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,u));const a=this.stack[this.stack.length-1];t("inlineCode"===a.type),a.value=n,this.exit(e)}function u(t,e){return"|"===e?e:t}function h(t){const a=t||{},r=a.tableCellPadding,l=a.tablePipeAlign,i=a.stringLength,o=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(t,e,a){let r=n.inlineCode(t,e,a);a.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&"));return r},table:function(t,e,n,a){return s(function(t,e,n){const a=t.children;let r=-1;const l=[],i=e.enter("table");for(;++r<a.length;)l[r]=u(a[r],e,n);return i(),l}(t,n,a),t.align)},tableCell:c,tableRow:function(t,e,n,a){const r=s([u(t,n,a)]);return r.slice(0,r.indexOf("\n"))}}};function c(t,e,n,a){const r=n.enter("tableCell"),l=n.enter("phrasing"),i=n.containerPhrasing(t,{...a,before:o,after:o});return l(),r(),i}function s(t,n){return e(t,{align:n,alignDelimiters:l,padding:r,stringLength:i})}function u(t,e,n){const a=t.children;let r=-1;const l=[],i=e.enter("tableRow");for(;++r<a.length;)l[r]=c(a[r],0,e,n);return i(),l}}export{h as a,a as g};
