import{supportBigInt as u}from"./supportUtil.mjs";function o(r){let t=r.trim(),e=t.startsWith("-");e&&(t=t.slice(1)),t=t.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),t.startsWith(".")&&(t=`0${t}`);const i=t||"0",n=i.split("."),s=n[0]||"0",c=n[1]||"0";s==="0"&&c==="0"&&(e=!1);const l=e?"-":"";return{negative:e,negativeStr:l,trimStr:i,integerStr:s,decimalStr:c,fullStr:`${l}${i}`}}function f(r){const t=String(r);return!Number.isNaN(Number(t))&&t.includes("e")}function N(r){const t=String(r);if(f(r)){let e=Number(t.slice(t.indexOf("e-")+2));const i=t.match(/\.(\d+)/);return i?.[1]&&(e+=i[1].length),e}return t.includes(".")&&S(t)?t.length-t.indexOf(".")-1:0}function g(r){let t=String(r);if(f(r)){if(r>Number.MAX_SAFE_INTEGER)return String(u()?BigInt(r).toString():Number.MAX_SAFE_INTEGER);if(r<Number.MIN_SAFE_INTEGER)return String(u()?BigInt(r).toString():Number.MIN_SAFE_INTEGER);t=r.toFixed(N(t))}return o(t).fullStr}function S(r){return typeof r=="number"?!Number.isNaN(r):r?/^\s*-?\d+(\.\d+)?\s*$/.test(r)||/^\s*-?\d+\.\s*$/.test(r)||/^\s*-?\.\d+\s*$/.test(r):!1}export{N as getNumberPrecision,f as isE,g as num2str,o as trimNumber,S as validateNumber};
