'use client';import { a as a$1 } from './chunk-F2KWYQOD.js';
import { a as a$2 } from './chunk-5RWCBY3V.js';
import { a as a$3 } from './chunk-KPJAFT2K.js';
import { a } from './chunk-CXK4UZYG.js';
import { TooltipGreyIcon } from '@onbeam/icons';
import { cx } from '@onbeam/styled-system/css';
import { forwardRef, useState } from 'react';
import { transactionSlippageSettings } from '@onbeam/styled-system/recipes';
import { parseFloatToInt, isDefined } from '@onbeam/utils';
import { jsxs, jsx } from 'react/jsx-runtime';

var o=(e=>(e[e.MIN=.1]="MIN",e[e.DEFAULT=.5]="DEFAULT",e[e.MAX=1]="MAX",e))(o||{});var y=Object.keys(o).filter(n=>Number.isNaN(Number(n))),i=2,m=10**i,g=n=>n.toFixed(i),c=n=>g(n/m);var I=forwardRef(({className:n,value:a$4,onChange:x,...e},b)=>{let[h,v]=useState(""),s=transactionSlippageSettings(),l=t=>{v(t);let p=parseFloatToInt(t,i);!isDefined(p)||p>=5e3||p<0||x(p);};return jsxs("div",{className:cx(s.slippage,n),children:[jsx(a,{ref:b,value:h,onChange:t=>l(t.currentTarget.value),onBlur:()=>l(c(a$4)),placeholder:c(a$4),inputMode:"numeric",size:"sm",rightAddon:"%",label:jsxs(a$1,{children:[jsx("span",{children:"slippage tolerance"}),jsx(a$2,{width:250,label:"your transaction will revert if the price change unfavorably by more than this percentage",children:jsx(TooltipGreyIcon,{height:16,width:16})})]}),...e}),jsx("div",{className:s.slippageButtonContainer,children:y.map(t=>jsxs(a$3,{type:"button",size:"sm",variant:a$4/m===o[t]?"primary":"secondary",className:s.slippageButton,onClick:()=>l(g(o[t])),children:[o[t],"%"]},t))})]})});I.displayName="TransactionSlippageSettings";

export { o as a, I as b };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-TUVSTJYJ.js.map