import{o as e,r as a}from"./rolldown-runtime-iuO8RvI4.js";import{bi as s}from"./shared-0-C4kdVF7Y.js";import{Mi as n,ki as t}from"./vendor-frame-CwiylG4Y.js";import{Mh as o,ln as l,vt as r}from"./shared-1-3-6x7RKF.js";import{nn as i,rn as u}from"./vendor-all-2-BJdkbLSj.js";import{F as c}from"./vendor-all-3-CWo5e8Lw.js";import{ts as d}from"./shared-5-UQAFGbWu.js";import{I as p}from"./shared-13-Uoqh3mCb.js";import{i as m}from"./c8903df54-sb4CSrQG.js";var f=a({UnpauseModal:()=>x}),y=e(n()),h=t();function x({isOpen:e,onClose:a,onSuccess:n}){const t=u(),f=s(),{addError:x}=o(),{data:g}=r(),_=g?.manual_pause_scheduled_at&&c.fromSeconds(g.manual_pause_scheduled_at)<=c.now()&&g?.payment_paused_until&&c.fromSeconds(g.payment_paused_until)>c.now(),b=_?"active":"scheduled",w=(0,y.useRef)(!1);(0,y.useEffect)(()=>{e?g&&!w.current&&(w.current=!0,f.track({event_key:"claudeai.subscription.unpause_modal.shown",phase:b})):w.current=!1},[e,g,f,b]);const{mutate:j,isPending:v}=l({onSuccess:async e=>{await f.track({event_key:e.success?"claudeai.subscription.unpause_modal.succeeded":"claudeai.subscription.unpause_modal.failed",phase:b}),n?.(),a(),_&&window.location.reload()},onError:e=>{f.track({event_key:"claudeai.subscription.unpause_modal.failed",phase:b}),x(e.message||"Failed to unpause subscription",{error:e,errorContext:{tags:{source:"subscription_unpause"}}})}}),M=(g?.manual_pause_scheduled_at?c.fromSeconds(g?.manual_pause_scheduled_at):null)?.toLocaleString(c.DATE_FULL)??t.formatMessage({defaultMessage:"your next billing date",id:"WChm1quNOX"}),k=g?.currency||"USD",D=m(k),F=g?.price?new Intl.NumberFormat(t.locale,{style:"currency",currency:k,minimumFractionDigits:D,maximumFractionDigits:D}).format(g.price/10**D):null,L=g?.plan_type?.toLowerCase().includes("max")?"Max":"Pro";return(0,h.jsx)(p,{isOpen:e,onClose:a,title:_?t.formatMessage({defaultMessage:"Resume plan",id:"NhThVFviNF"}):t.formatMessage({defaultMessage:"Cancel pause",id:"IYjbDFq1xb"}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(d,{variant:"secondary",onClick:a,disabled:v,children:(0,h.jsx)(i,{defaultMessage:"Go back",id:"orvpWhO3rI"})}),(0,h.jsx)(d,{variant:"primary",onClick:()=>{f.track({event_key:"claudeai.subscription.unpause_modal.confirm_clicked",phase:b}),j()},busy:v,children:_?(0,h.jsx)(i,{defaultMessage:"Resume plan",id:"NhThVFviNF"}):(0,h.jsx)(i,{defaultMessage:"Cancel Pause",id:"8eC982dSuo"})})]}),children:(0,h.jsx)("p",{className:"text-text-200",children:_?F?(0,h.jsx)(i,{defaultMessage:"Resume your {planType} plan. You will be charged {price}, plus applicable taxes, today and your next billing cycle will be one month from now on {nextDate}.",id:"UW54ayq6qb",values:{planType:L,price:F,nextDate:c.now().plus({months:1}).toLocaleString(c.DATE_FULL)}}):(0,h.jsx)(i,{defaultMessage:"Resume your {planType} plan. You will be charged at your current rate today and your next billing cycle will be one month from now on {nextDate}.",id:"pUtlFVPzbw",values:{planType:L,nextDate:c.now().plus({months:1}).toLocaleString(c.DATE_FULL)}}):F?(0,h.jsx)(i,{defaultMessage:"If you cancel this upcoming pause, your next billing cycle will continue as normal. Your plan will renew and you will be automatically charged {price}, plus applicable taxes, on {nextDate}.",id:"pjnvRZt8LA",values:{price:F,nextDate:M}}):(0,h.jsx)(i,{defaultMessage:"If you cancel this upcoming pause, your next billing cycle will continue as normal. Your plan will renew at your current rate on {nextDate}.",id:"zQovHKXzcp",values:{nextDate:M}})})})}export{f as n,x as t};