import{f as c}from"./0.CMTQMBFK.js";const m=(e,{commas_every:s,with_line_breaks:_})=>{if(!e)return"";let n="";e.length;const t=e.length-1;for(let i=0;i<=t;i++){let r=i+1;n=n+e[i],r%s===0&&i!==0&&i!==t&&(n=n+",")}return n},y=(e,{commas_every:s,line_break_every:_,with_line_breaks:n})=>{let t="",i=e.length;const r=0;for(let o=i-1;o>=r;o--){let l=i-o;t=e[o]+t,n==="yes"?n==="yes"&&l%25===0&&o!==0?t=`
`+t:l%s===0&&o!==0&&o!==r&&(t=" "+t):l%s===0&&o!==0&&o!==r&&(t=","+t)}return t},g=(e,s={})=>{const _=s.with_line_breaks||"no",n=s.commas_every||5,t=s.line_break_every||25;let i="no",r="";if(typeof e=="number"||typeof e=="bigint"){if(r=e.toString(),r.toLowerCase().indexOf("e")>=0)return r}else if(typeof e=="string")r=e;else throw new Error(`Type "${typeof e}" of digit "${e}" was not prepared for.`);r[0]==="-"&&(r=r.substring(1),i="yes");let[o,l]=r.toString().split("."),a=y(o,{commas_every:n,with_line_breaks:_,line_break_every:t}),f=m(l,{commas_every:n,with_line_breaks:_}),p=i==="yes"?"-":"";return f===""?p+a:`${p}${a}.${f}`},w=(e,s={})=>{const _=c().freight.commas_every;return s.commas_every=_,g(e,s)};export{w as p};
//# sourceMappingURL=parse_with_commas.HTzZ05Il.js.map
