import{a as o,b as N}from"./chunk-NGFJDF4M.js";import{e as i,f as b,o as u,p as h}from"./chunk-DQXXLIFV.js";import{f as P}from"./chunk-5VMFMKJR.js";var D,T=P(()=>{"use strict";h();b();N();D=class y{static currency(t,r,n=o.sys?.defaultDecimalPlacesPrice||2){if(t===void 0&&(t=0),!i.isSet(r))return y.decimal(t,n);let e={style:"currency",currency:r,minimumFractionDigits:n??o.sys?.defaultDecimalPlacesPrice,maximumFractionDigits:n??o.sys?.defaultDecimalPlacesPrice};return new Intl.NumberFormat(o.locale,e).format(t)}static decimal(t,r=o.sys?.defaultDecimalPlacesPrice||2,n=o.formatting.numeral.decimalSeparator,e=o.formatting.numeral.thousandsSeparator){if(r===0)return i.isNaN(t)?"0":`${t}`;i.isString(t)&&t.indexOf(".")>-1&&t.indexOf(",")===-1&&(t=t.replaceAll(".",""));let s=i.numToStr(i.isNumber(t)?t:i.strToFloat(t));if(i.isEmpty(s)&&(s="0"),s.indexOf(".")===-1&&i.isSet(r)&&r>0)s+=".0";else if(r===0)return i.isNumber(t)?i.numToStr(t):i.numToStr(i.strToNum(t));let d=s.split(".");s[0]==="0"&&(d[0]="0");let m=i.zeroPad(d[1]||"",r);s=`${d[0]}.${m}`;let a=s.indexOf("."),l=a>-1?s.substring(0,a):s,g=a>-1?s.substring(a+1,a+1+(r||0)):"",c=l.startsWith("-"),p=(c?l.substring(1):l).replace(/\B(?=(\d{3})+(?!\d))/g,e);return r>0?`${c?"-":""}${p}${n}${g}`:`${c?"-":""}${p}`}static thousands(t,r=o.formatting.numeral.thousandsSeparator){let n=t.indexOf("-")===0,e=t.indexOf(".")>-1,s=e?t.indexOf("."):t.indexOf(",");e?r=",":!e&&r===","&&(r=".");let d=n?1:0,m=t.substring(d,s),a=d,l="";for(let f=0;f<m.length;f++){if(m[f]!=="0"){a=f;break}l+="0"}let g=a>0?a-1:0,c="";for(let f=m.length-1;f>=a;f--){let p=m[f],S=m.length-f+g;c=(S>a&&S<m.length&&S%3===0?r:"")+p+c}return(n?"-":"")+(c!="0"?l:"")+c+t.substring(s)}static toStringWithSeparators(t){return t==null||isNaN(t)?"0":t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,".")}static formatNumberToThousands(t,r=0,n=o.formatting.numeral.thousandsSeparator){if(t==null||t==="")return"0";let e=typeof t=="string"?parseFloat(t):t;return isNaN(e)?"0":e.toLocaleString(o.locale||"en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}static date(t,r=o.formatting.datetime.date,n="MMM d yyyy hh:mma"){return this.datetime(t,r,n)}static dateFromIso(t,r=o.formatting.datetime.date){if(!i.isSet(t)||i.isString(t)&&t.length===0)return"";let n=t instanceof Date?t.toISOString():i.collapseWhitespace(t),e=u.fromISO(n);return e.isValid?e.toFormat(r):(console.error("Invalid date format"),n)}static datetime(t,r,n="MMM d yyyy hh:mma"){if(i.notSet(t))return"";let e=u.fromFormat(i.collapseWhitespace(t),n);return e.isValid?e.toFormat(r):(console.error("Invalid date format"),t)}static formatAcKey(t){if(!i.isSet(t))return"";let r=2,n=4,e=7;if(t.length<13||t.includes("-"))return t;let s=o.sys,d=Math.min(s?.docKeyLenYear??r,r),m=Math.min(s?.docKeyLenDocType??n,n),a=Math.min(s?.docKeyLenNumber??e,e),l=t.substring(0,r).substring(0,d),g=t.substring(r,r+n).substring(0,m),c=t.substring(r+n,r+n+e).substring(e-a,e);return`${l}-${g}-${c}`}static parseDecimal(t,r=o.formatting.numeral.decimalSeparator,n=o.formatting.numeral.thousandsSeparator){if(typeof t=="number")return isNaN(t)?0:t;if(!t)return 0;let e=t.split(n).join("").replace(r,"."),s=parseFloat(e);return isNaN(s)?0:s}static toIsoDate(t){return u.fromJSDate(t).toISODate()??void 0}static daysBetween(t,r){return u.fromJSDate(r).diff(u.fromJSDate(t),"days").days}}});export{D as a,T as b};
