'use client';import { a as a$1 } from './chunk-F2KWYQOD.js';
import { a as a$2 } from './chunk-O5727WE6.js';
import { a as a$3 } from './chunk-UPX6JFOI.js';
import { a } from './chunk-UKJSEI2I.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:b,...e},x)=>{let[h,v]=useState(""),s=transactionSlippageSettings(),l=(t,L)=>{v(t);let p=parseFloatToInt(t,i);!isDefined(p)||p>=5e3||p<0||b(p,!!L);};return jsxs("div",{className:cx(s.slippage,n),children:[jsx(a,{ref:x,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 changes 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]),!0),children:[o[t],"%"]},t))})]})});I.displayName="TransactionSlippageSettings";

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