import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{Jt as r,dn as i,on as a,va as o,ya as s}from"./paths-Ci1iwL5Y.js";import{o as c,s as l}from"./log-DSV4Ht5l.js";import{n as u,t as d}from"./browser-Bt-ckCaU.js";import{r as f,t as p}from"./login-C1uE6Pg9.js";async function m(e,t){try{if(i()){let t=r(),n=!1;if(t?.subscriptionType&&t?.rateLimitTier)n=t.subscriptionType===`max`&&t.rateLimitTier===`default_claude_max_20x`;else if(t?.accessToken){let e=await o(t.accessToken);n=e?.organization?.organization_type===`claude_max`&&e?.organization?.rate_limit_tier===`default_claude_max_20x`}if(n)return setTimeout(e,0,`You are already on the highest Max subscription plan. For additional usage, run /login to switch to an API usage-billed account.`),null}return await u(`https://claude.ai/upgrade/max`),(0,h.jsx)(p,{startingMessage:`Starting new login following /upgrade. Exit with Ctrl-C to use existing account.`,onDone:n=>{t.onChangeAPIKey(),e(n?`Login successful`:`Login interrupted`)}})}catch(t){l(t),setTimeout(e,0,`Failed to open browser. Please visit https://claude.ai/upgrade/max to upgrade.`)}return null}var h,g=e((()=>{t(),s(),a(),d(),c(),f(),h=n()}));export{g as n,m as t};