import{o as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./figures-gfT9mM8P.js";import{B as r,Rn as i,b as a,t as o,x as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{Fv as l,Lv as u,Pv as d,cC as f,lC as p,zv as m}from"./loadAgentsDir-C_wFhytF.js";t();var h=e(i(),1);o(),p(),l();var g=c(),_=[`◐`,`◓`,`◑`,`◒`],v=[{key:`validating`,label:`Validating session`},{key:`fetching_logs`,label:`Fetching session logs`},{key:`fetching_branch`,label:`Getting branch info`},{key:`checking_out`,label:`Checking out branch`}];function y({currentStep:e,sessionId:t}){let[i,o]=r(100),c=Math.floor(o/100)%_.length,l=v.findIndex(t=>t.key===e);return(0,g.jsxs)(s,{ref:i,flexDirection:`column`,paddingX:1,paddingY:1,children:[(0,g.jsx)(s,{marginBottom:1,children:(0,g.jsxs)(a,{bold:!0,color:`claude`,children:[_[c],` Teleporting session…`]})}),t&&(0,g.jsx)(s,{marginBottom:1,children:(0,g.jsx)(a,{dimColor:!0,children:t})}),(0,g.jsx)(s,{flexDirection:`column`,marginLeft:2,children:v.map((e,t)=>{let r=t<l,i=t===l,o=t>l,u,d;return r?(u=n.tick,d=`green`):i?(u=_[c],d=`claude`):(u=n.circle,d=void 0),(0,g.jsxs)(s,{flexDirection:`row`,children:[(0,g.jsx)(s,{width:2,children:(0,g.jsx)(a,{color:d,dimColor:o,children:u})}),(0,g.jsx)(a,{dimColor:o,bold:i,children:e.label})]},e.key)})})]})}async function b(e,t){let n=()=>{};function r(){let[e,r]=(0,h.useState)(`validating`);return n=r,(0,g.jsx)(y,{currentStep:e,sessionId:t})}e.render((0,g.jsx)(f,{children:(0,g.jsx)(r,{})}));let i=await m(t,n);n(`checking_out`);let{branchName:a,branchError:o}=await d(i.branch);return{messages:u(i.log,o),branchName:a}}export{b as teleportWithProgress};