import{o as e}from"./rolldown-runtime-iuO8RvI4.js";import{Gl as a,Yl as t}from"./shared-0-C4kdVF7Y.js";import{Mi as s,ki as r}from"./vendor-frame-CwiylG4Y.js";import{Am as i,Bf as n,Hn as d,lt as l,zf as o}from"./shared-1-3-6x7RKF.js";import{nn as c,rn as u}from"./vendor-all-2-BJdkbLSj.js";import{Qi as m,xr as x}from"./shared-4-6CEyRAHb.js";import{ft as p,ut as g}from"./shared-3-D-Ux4aGn.js";import{hi as f}from"./shared-2-CMUBhYOn.js";var h=e(s()),j=r();function b({onNext:e,currentLimit:s,isPending:r=!1,isSetupFlow:b=!1,isPureUsageBased:v=!1,contractCapCents:y,hideDescription:M=!1}){const S=u(),N=t(),C=a(),B=m(),w=f("admin_usage_cobalt"),{data:P}=g(),{data:Y}=p(),{data:k}=l({billingInterval:d.YEARLY},{enabled:N}),D=P?.currency||Y?.currency||k?.currency||"USD",[L,U]=(0,h.useState)("number"==typeof s?s/100:2e3),[F,H]=(0,h.useState)(null),O=w?y:void 0,z=void 0!==O&&Math.round(100*L)>O,G={target:C?S.formatMessage({defaultMessage:"your org",id:"jKcFzGm1P7"}):S.formatMessage({defaultMessage:"you",id:"Jjrc4PBO4e"})};return(0,j.jsxs)("div",{className:"flex flex-col gap-6",children:[!M&&(0,j.jsx)("p",{className:"text-text-100 text-sm",children:v?(0,j.jsx)(c,{defaultMessage:"You can set a maximum amount {target} can spend on Claude usage per month.",id:"BaR20Zn7Oq",values:G}):B?(0,j.jsx)(c,{defaultMessage:"You can set a maximum amount {target} can spend on extra usage per month.",id:"52LXG0+owQ",values:G}):(0,j.jsx)(c,{defaultMessage:"Set a monthly limit for how much {target} can spend on usage credits.",id:"HBcJPD/Lqp",values:G})}),(0,j.jsxs)("div",{children:[(0,j.jsx)("input",{type:"text",className:"w-full px-3 py-2 bg-bg-000 border border-border-300 rounded-lg text-text-100 focus:outline-none focus:ring-2 focus:ring-bg-500 focus:border-text-000",value:(I=L,x(100*I,D,{preferWholeNumber:!0,locale:"en-US"})),onChange:e=>{const a=(e=>{const a=parseFloat(e.replace(/[^0-9.]/g,""));return isNaN(a)?0:a})(e.target.value);U(a)}}),(0,j.jsx)("p",{className:"text-xs mt-3 "+(0===L?"text-danger-000":"text-text-300"),children:0===L?(0,j.jsx)(c,{defaultMessage:"Setting a limit to $0 effectively disables additional spend",id:"B19r4H7Udc"}):(0,j.jsx)(c,{defaultMessage:"This spend limit goes into effect immediately",id:"OFSQyzI9+b"})}),void 0!==O&&(0,j.jsx)("p",{id:"contract-cap-helper",className:"text-xs mt-2 "+(z?"text-danger-000":"text-text-300"),children:(0,j.jsx)(i,{id:"1h4io5p",dangerouslyVisiblePublicValues:{cap:x(O,D,{preferWholeNumber:!0,locale:"en-US"})}})})]}),(0,j.jsxs)(n,{children:[void 0===O?(0,j.jsx)(o,{variant:"secondary",onClick:()=>{H("unlimited"),e("unlimited")},loading:r&&"unlimited"===F,disabled:r,children:b?(0,j.jsx)(c,{defaultMessage:"Skip",id:"/4tOwTiCH6"}):(0,j.jsx)(c,{defaultMessage:"Set to unlimited",id:"nDe1hLMIrc"})}):null,(0,j.jsx)(o,{variant:"primary",onClick:()=>{H("limit"),e(L)},loading:r&&"limit"===F,disabled:L<0||r||z,"aria-describedby":z?"contract-cap-helper":void 0,children:(0,j.jsx)(c,{defaultMessage:"Set spend limit",id:"v3CYBVarjD"})})]})]});var I}export{b as t};