import{n as e}from"./rolldown-runtime-BG2f4sTM.js";import{Fy as t,Iy as n}from"./app-initial-BHB6SClA.js";import{n as r,t as i}from"./format-currency-Wwdloj8u.js";function a({intl:e,creditQuantity:t,pricingInfo:n}){return Number.isFinite(t)?i({intl:e,amount:t*n.amountPerCredit,currencyCode:n.currencyCode,currencyFractionDigits:n.minorUnitExponent}):null}function o({intl:e,creditQuantity:t,pricingInfo:n}){let r=u({intl:e,amount:t*n.amountPerCredit,pricingInfo:n});return r==null?null:r.filter(e=>e.type!==`currency`).map(e=>e.value).join(``).trim()}function s({intl:e,pricingInfo:t}){return u({intl:e,amount:0,pricingInfo:t})?.find(e=>e.type===`currency`)?.value??null}function c({intl:e,creditQuantity:t,pricingInfo:n}){if(!Number.isFinite(t))return null;let r=t*n.amountPerCredit;return i({intl:e,amount:r,currencyCode:n.currencyCode,currencyFractionDigits:Number.isInteger(r)?0:n.minorUnitExponent})}function l({intl:e,creditBalance:t,rechargeTarget:r,pricingInfo:i}){let o=Number.parseInt(n(r),10);if(!Number.isFinite(o))return null;let s=Math.max(0,Math.floor(Number(t??0))),c=Math.max(0,o-s);return c===0?null:a({intl:e,creditQuantity:c,pricingInfo:i})}function u({intl:e,amount:t,pricingInfo:n}){return Number.isFinite(t)?e.formatters.getNumberFormat(e.locale,{style:`currency`,currency:n.currencyCode,minimumFractionDigits:n.minorUnitExponent??void 0,maximumFractionDigits:n.minorUnitExponent??void 0}).formatToParts(t):null}var d=e((()=>{r(),t()}));export{d as a,l as i,o as n,c as r,s as t};
//# sourceMappingURL=credit-reload-dialog-formatting-BdjV6GUQ.js.map