import{ey as h,u as o,j as r,c2 as i,a0 as d,c_ as l,dX as x}from"./bundle.CHKSNOJF.js";function y(e,c,t){if(e==null||c==null)return 1;const a=t?.currencies.find(u=>u.id===e),n=t?.currencies.find(u=>u.id===c),s=t?.currencies.find(u=>u.id==="1");return a==s?n.exchange_rate:n==s?1/(a?.exchange_rate??1):n.exchange_rate*(1/a.exchange_rate)}function m(e){const{data:c}=h(),[t]=o(),a=n=>e.onChange(y(e.currencyId,n,c),n);return r.jsxs(r.Fragment,{children:[r.jsx(i,{leftSide:t("currency"),children:r.jsx(d,{value:e.exchangeCurrencyId,onChange:a,dismissable:!0})}),r.jsx(i,{leftSide:t("exchange_rate"),children:r.jsx(l,{value:e.exchangeRate||"",onValueChange:n=>e.onExchangeRateChange(parseFloat(n)),disablePrecision:!0})}),r.jsx(i,{leftSide:t("converted_amount"),children:r.jsx(l,{value:e.amount*parseFloat(e.exchangeRate)||"",onValueChange:n=>e.onExchangeRateChange(parseFloat(n)/e.amount),disablePrecision:!0})})]})}function C(){const[e]=o();let c={};return c=Object.entries(x).reduce((a,[n,s])=>(a[n]=e(s),a),{}),Object.entries(c).sort((a,n)=>a[1].localeCompare(n[1]))}export{m as C,C as u};
