"use strict";var r=require("./i18n-CP31jeWH.js"),t=require("./kd/i18nService.js"),n=require("./intlFormat-Bs-dlvDH.js");const e="currency",i="percent",c="symbol",u="name",a=/0+$/;function o(r){return parseInt(r,10)}function m(r,t){!function(r,t){const n=function(r){return r.split(";")[0].split(".")[1]||""}(r),e=n.replace(/[^0]/g,"").length,i=n.replace(/[^0#]/g,"").length,c=o(t.minimumFractionDigits),u=o(t.maximumFractionDigits);isFinite(t.minimumFractionDigits)||(t.minimumFractionDigits=Math.min(e,isNaN(u)?e:u)),(!isFinite(t.maximumFractionDigits)||u<c)&&(t.maximumFractionDigits=Math.max(i,isNaN(c)?i:c))}(r,t);const n=function(r){const{minimumFractionDigits:t,maximumFractionDigits:n}=r;return`.${"0".repeat(t)}${"#".repeat(n-t)}`}(t);return s(r,n)}function s(r,t){if(!t)return r;if(r.indexOf(";")>0){const[n,e]=r.split(";");return`${s(n,t)};${s(e,t)}`}if(r.indexOf(".")>0)return r.replace(/\.(0|#)*/,t);const n=Math.max(r.lastIndexOf("0"),r.lastIndexOf("#"))+1;return[r.slice(0,n),t,r.slice(n)].join("")}function l(n){const i=n.currencyDisplay||c;return i===c||i===u?function(n,i){const c={style:e,currency:n,minimumFractionDigits:0};return c.currencyDisplay=i,t.getNumberFormat(r.locale,c).format(2).replace(/2/g,"")}(n.currency,i):n.currency}const{numberFormat:f,percentFormat:p,currencyFormat:g}=r.number,y=t=>{const n=(r=>r.style===e?g:r.style===i?p:f)(t);let c=m(n,t);return c=function(r,t){const{minimumIntegerDigits:n}=t,e=function(r){const t=r.match(/,[#0]*\./);return t?t[0].length-2:0}(r);return n?n<=e?r.replace(/,[#0]*\./,`,${"#".repeat(e-n)}${"0".repeat(n)}.`):r.replace(/[#0]*\./,`${"0".repeat(n-e)},${"0".repeat(e)}.`):r}(c,t),(t=>!t.currency||r.currency===t.currency)(t)||(c=function(r,t,n){const e=String.fromCharCode(164);return n.currencyDisplay===u?r.replace(e,"")+t:r.replace(e,t)}(c,l(t),t)),c};exports.numberFormat=function(e){const i={currency:e.currency||r.currency},c=Object.assign({},e,i);return{format:e=>{const i=n.isAuraL10NAvailable&&e&&function(r){const t=r.toString(),[n,e]=t.split(".");return n.length+(e?e.replace(a,"").length:0)>=15}(e),u=i?function(r){const t=y(r);return{format:r=>n.getNumberFormat(t).format(r)}}(c):t.getNumberFormat(r.locale,c);return u.format(e)}}};
