import{u as V,s as x,c as w,j as g}from"./index-DlcHsm52.js";import{s as F}from"./ErpApp-7VdZNpBd.js";/*!
 * currency.js - v2.0.4
 * http://scurker.github.io/currency.js
 *
 * Copyright (c) 2021 Jason Wilson
 * Released under MIT license
 */var O={symbol:"$",separator:",",decimal:".",errorOnInvalid:!1,precision:2,pattern:"!#",negativePattern:"-!#",format:S,fromCents:!1},v=function(r){return Math.round(r)},a=function(r){return Math.pow(10,r)},C=function(r,n){return v(r/n)*n},M=/(\d)(?=(\d{3})+\b)/g,R=/(\d)(?=(\d\d)+\d\b)/g;function l(e,r){var n=this;if(!(n instanceof l))return new l(e,r);var i=Object.assign({},O,r),s=a(i.precision),p=h(e,i);n.intValue=p,n.value=p/s,i.increment=i.increment||1/s,i.useVedic?i.groups=R:i.groups=M,this.s=i,this.p=s}function h(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=0,s=r.decimal,p=r.errorOnInvalid,t=r.precision,c=r.fromCents,u=a(t),d=typeof e=="number",o=e instanceof l;if(o&&c)return e.intValue;if(d||o)i=o?e.value:e;else if(typeof e=="string"){var b=new RegExp("[^-\\d"+s+"]","g"),f=new RegExp("\\"+s,"g");i=e.replace(/\((.*)\)/,"-$1").replace(b,"").replace(f,"."),i=i||0}else{if(p)throw Error("Invalid Input");i=0}return c||(i*=u,i=i.toFixed(4)),n?v(i):i}function S(e,r){var n=r.pattern,i=r.negativePattern,s=r.symbol,p=r.separator,t=r.decimal,c=r.groups,u=(""+e).replace(/^-/,"").split("."),d=u[0],o=u[1];return(e.value>=0?n:i).replace("!",s).replace("#",d.replace(c,"$1"+p)+(o?t+o:""))}l.prototype={add:function(r){var n=this.intValue,i=this.s,s=this.p;return l((n+=h(r,i))/(i.fromCents?1:s),i)},subtract:function(r){var n=this.intValue,i=this.s,s=this.p;return l((n-=h(r,i))/(i.fromCents?1:s),i)},multiply:function(r){var n=this.intValue,i=this.s;return l((n*=r)/(i.fromCents?1:a(i.precision)),i)},divide:function(r){var n=this.intValue,i=this.s;return l(n/=h(r,i,!1),i)},distribute:function(r){for(var n=this.intValue,i=this.p,s=this.s,p=[],t=Math[n>=0?"floor":"ceil"](n/r),c=Math.abs(n-t*r),u=s.fromCents?1:i;r!==0;r--){var d=l(t/u,s);c-- >0&&(d=d[n>=0?"add":"subtract"](1/u)),p.push(d)}return p},dollars:function(){return~~this.value},cents:function(){var r=this.intValue,n=this.p;return~~(r%n)},format:function(r){var n=this.s;return typeof r=="function"?r(this,n):n.format(this,Object.assign({},n,r))},toString:function(){var r=this.intValue,n=this.p,i=this.s;return C(r/n,i.increment).toFixed(i.precision)},toJSON:function(){return this.value}};const j=()=>{var t;const e=V(F),r=e||((t=x.get("settings"))==null?void 0:t.money_format_settings)||w;function n({amount:c,currency_code:u=r==null?void 0:r.currency_code}){return l(c).dollars()>0||!(r!=null&&r.zero_format)?l(c,{separator:r==null?void 0:r.thousand_sep,decimal:r==null?void 0:r.decimal_sep,symbol:"",precision:r==null?void 0:r.cent_precision}).format():0+l(c,{separator:r==null?void 0:r.thousand_sep,decimal:r==null?void 0:r.decimal_sep,symbol:"",precision:r==null?void 0:r.cent_precision}).format()}function i({amount:c=0,currency_code:u=r==null?void 0:r.currency_code}){return(r==null?void 0:r.currency_position)==="before"?(r==null?void 0:r.currency_symbol)+" "+n({amount:c,currency_code:u}):n({amount:c,currency_code:u})+" "+(r==null?void 0:r.currency_symbol)}function s({amount:c=0,currency_code:u=r==null?void 0:r.currency_code}){return n({amount:c,currency_code:u})}function p({amount:c=0,currency_code:u=r==null?void 0:r.currency_code}){return{props:{style:{textAlign:"right",whiteSpace:"nowrap",direction:"ltr"}},children:g.jsx(g.Fragment,{children:(r==null?void 0:r.currency_position)==="before"?(r==null?void 0:r.currency_symbol)+" "+n({amount:c,currency_code:u}):n({amount:c,currency_code:u})+" "+(r==null?void 0:r.currency_symbol)})}}return{moneyRowFormatter:p,moneyFormatter:i,amountFormatter:s,currency_symbol:r==null?void 0:r.currency_symbol,currency_code:r==null?void 0:r.currency_code,currency_position:r==null?void 0:r.currency_position,decimal_sep:r==null?void 0:r.decimal_sep,thousand_sep:r==null?void 0:r.thousand_sep,cent_precision:r==null?void 0:r.cent_precision,zero_format:r==null?void 0:r.zero_format}};export{j as u};
