1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},a=(new e.Error).stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="8b65245c-220f-42f0-bd5a-59b78d0dfc29",e._sentryDebugIdIdentifier="sentry-dbid-8b65245c-220f-42f0-bd5a-59b78d0dfc29")}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3059],{83059:function(e,a,t){t.r(a),t.d(a,{default:function(){return z}});var r=t(57437),n=t(48059),s=t.n(n),l=t(2265),i=t(21513),o=t(4935),d=t(82891),c=t(54662),u=t(89733),m=t(4919),x=t(49354),h=t(43765),y=t(6540),g=t(13231),p=t(22468),f=t(76780),b=t(3274),v=t(95137),k=t(33907),j=t(24241),w=t(64042);let _=[{value:"exams_over",label:"I've finished my exams for now"},{value:"too_expensive",label:"It's too expensive"},{value:"not_using",label:"I'm not using it enough"},{value:"missing_features",label:"It's missing something I need"},{value:"switched_service",label:"I found another tool"},{value:"technical",label:"Technical problems"},{value:"other",label:"Other"}];function N(e,a){return null==e?"":"".concat(function(e){switch((e||"gbp").toLowerCase()){case"gbp":return"\xa3";case"usd":return"$";case"eur":return"â¬";default:return""}}(a)).concat((e/100).toFixed(2))}function C(e){return e?new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}):""}function D(e){let a=new Date;if("exams_over"===e){let e=new Date(a.getFullYear(),8,1);return e.getTime()<=a.getTime()+6048e5&&e.setFullYear(e.getFullYear()+1),e}let t=new Date(a);return t.setMonth(t.getMonth()+1),t}function S(e,a){return!a&&("exams_over"===e||"not_using"===e)}function z(e){let{open:a,onClose:t,onSubscriptionChanged:n}=e,{user:N,getIdToken:z}=(0,o.a)(),{subscriptionStatus:O}=(0,d.m)(),Z=!!(null==O?void 0:O.subscription_paused_until)&&new Date(O.subscription_paused_until).getTime()>Date.now(),[F,I]=(0,l.useState)("intercept"),[W,E]=(0,l.useState)(null),[B,M]=(0,l.useState)(""),[R,J]=(0,l.useState)(null),[L,V]=(0,l.useState)(null),[G,A]=(0,l.useState)(null),[U,H]=(0,l.useState)(!1),[$,K]=(0,l.useState)(null),[Q,X]=(0,l.useState)(null),[ee,ea]=(0,l.useState)(null),[et,er]=(0,l.useState)(1),en="https://gradewise-92e95bd706b5.herokuapp.com",es=(0,l.useCallback)(async()=>{try{var e,a,t,r;let n=await z();if(!n)return;let s=await fetch("".concat(en,"/analytics/overall"),{headers:{Authorization:"Bearer ".concat(n)}});if(!s.ok)return;let l=await s.json(),i=l&&l.data||l||{};J({total_questions_attempted:null!==(e=i.total_questions_attempted)&&void 0!==e?e:0,current_streak:null!==(a=i.current_streak)&&void 0!==a?a:0,topics_attempted:null!==(r=null!==(t=i.topics_attempted)&&void 0!==t?t:i.subjects_attempted)&&void 0!==r?r:0})}catch(e){console.error("Progress fetch failed",e)}},[en,z]),el=(0,l.useCallback)(async()=>{if(N)try{let e=await fetch("".concat(en,"/api/preview-annual-upgrade"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:N.id})}),a=await e.json().catch(()=>({}));if(e.ok)V(a),A(null);else{let t=(null==a?void 0:a.detail)||(null==a?void 0:a.error)||"HTTP ".concat(e.status);console.error("Preview annual upgrade failed:",e.status,a),A(t)}}catch(e){console.error("Preview fetch network error",e),A("network_error")}},[en,N]);(0,l.useEffect)(()=>{a&&(I("intercept"),E(null),M(""),K(null),V(null),A(null),X(null),ea(null),er(1),es(),el())},[a,es,el]);let ei=(0,l.useCallback)(e=>{N&&(W||B.trim())&&fetch("".concat(en,"/api/log-cancel-flow-feedback"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:N.id,reason:W,feedback:B.trim()||void 0,outcome:e})}).catch(e=>console.error("log_cancel_flow_feedback failed",e))},[en,N,W,B]);async function eo(){if(N){ei("switched_to_annual"),H(!0),K(null);try{let e=await fetch("".concat(en,"/api/upgrade-to-annual"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:N.id})}),a=await e.json();if(!e.ok){"card_declined"===a.error?K("We couldn't charge your card. Update it in 'Manage payment & invoices' and try again."):"no_payment_method"===a.error?K(a.message||"We couldn't find a card on file. Add one via 'Manage payment & invoices' and try again."):K(a.message||a.error||"Something went wrong. Please try again.");return}X(a.current_period_end),I("upgrade_success"),null==n||n()}catch(e){K("Network error. Please try again.")}finally{H(!1)}}}async function ed(){if(N){ei("took_pause"),H(!0),K(null);try{let e=D(W),a=await fetch("".concat(en,"/api/pause-subscription"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:N.id,resume_date:e.toISOString(),reason:W})}),t=await a.json();if(!a.ok){K(t.error||"Something went wrong. Please try again.");return}ea(t.resumes_at),I("pause_success"),null==n||n()}catch(e){K("Network error. Please try again.")}finally{H(!1)}}}async function ec(){if(N){ei("cancelled"),H(!0),K(null);try{let e=await fetch("".concat(en,"/api/cancel-subscription"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:N.id,reason:W,feedback:B.trim()||void 0})}),a=await e.json();if(!e.ok){K(a.error||"Something went wrong. Please try again.");return}X(a.ends_at),I("cancel_success"),null==n||n()}catch(e){K("Network error. Please try again.")}finally{H(!1)}}}return(0,r.jsx)(c.Vq,{open:a,onOpenChange:e=>!e&&!U&&t(),children:(0,r.jsxs)(c.cZ,{className:"sm:max-w-lg p-0 overflow-hidden gap-0",children:[(0,r.jsx)("div",{className:"h-[3px] w-full bg-gradient-to-r from-purple-600 via-purple-500 to-blue-500"}),(0,r.jsxs)("div",{className:"p-6 sm:p-7",children:["intercept"===F&&(0,r.jsxs)(i.E.div,{initial:{opacity:0,y:8}
1,animate:{opacity:1,y:0},transition:{duration:.25},className:"space-y-5",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-2xl sm:text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100 leading-tight",children:"Before you goâ¦"}),(0,r.jsx)("p",{className:"mt-1.5 text-sm text-gray-600 dark:text-gray-400",children:"You've made real progress on GradeWise."})]}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-3 py-1",children:[(0,r.jsx)(q,{icon:(0,r.jsx)(h.Z,{className:"h-3.5 w-3.5"}),value:null==R?void 0:R.current_streak,label:"Day streak"}),(0,r.jsx)(q,{icon:(0,r.jsx)(y.Z,{className:"h-3.5 w-3.5"}),value:null==R?void 0:R.topics_attempted,label:"Topics"}),(0,r.jsx)(q,{icon:(0,r.jsx)(g.Z,{className:"h-3.5 w-3.5"}),value:null==R?void 0:R.total_questions_attempted,label:"Questions"})]}),(0,r.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400 leading-relaxed border-t pt-4",children:"Your progress, predicted grades and saved questions stay with your account either way."}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 pt-1",children:[(0,r.jsx)(u.z,{onClick:t,className:"w-full bg-[#6D28D9] hover:bg-[#4C1D95] text-white rounded-xl py-5 font-semibold shadow-sm",children:"Stay on GradeWise"}),(0,r.jsx)(u.z,{variant:"ghost",onClick:()=>I("reason"),className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300",children:"Continue cancelling"})]})]},"intercept"),"reason"===F&&(0,r.jsxs)(i.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.25},className:"space-y-5",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-2xl sm:text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100 leading-tight",children:"What's making you cancel?"}),(0,r.jsx)("p",{className:"mt-1.5 text-sm text-gray-600 dark:text-gray-400",children:"Pick the closest reason â we'll show you the best option."})]}),(0,r.jsx)("div",{className:"space-y-2",children:_.map(e=>{let a=W===e.value;return(0,r.jsx)("button",{type:"button",onClick:()=>E(e.value),className:(0,x.cn)("w-full text-left rounded-xl px-4 py-3.5 transition-all duration-150",a?"border-2 border-[#6D28D9] bg-purple-50/60 dark:bg-purple-950/30 ring-2 ring-[#6D28D9]/20 shadow-sm":"border border-gray-200 dark:border-zinc-700 hover:border-purple-300 dark:border-purple-500/40 hover:bg-gray-50 dark:hover:bg-zinc-800"),children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:(0,x.cn)("h-5 w-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",a?"border-[#6D28D9] bg-[#6D28D9]":"border-gray-300 dark:border-zinc-600 bg-white dark:bg-zinc-800"),children:a&&(0,r.jsx)(p.Z,{className:"h-3 w-3 text-white",strokeWidth:3.5})}),(0,r.jsx)("span",{className:(0,x.cn)("font-medium text-sm",a?"text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"),children:e.label})]})},e.value)})}),(0,r.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,r.jsx)(u.z,{onClick:t,variant:"ghost",className:"flex-1 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300",children:"Never mind"}),(0,r.jsx)(u.z,{onClick:()=>{let e="exams_over"===W||"not_using"===W||"missing_features"===W||"technical"===W;"already_annual"!==G||e?I("offer"):I("confirm")},disabled:!W,className:"flex-1 bg-[#6D28D9] hover:bg-[#4C1D95] text-white rounded-xl py-5 font-semibold disabled:opacity-50 shadow-sm",children:"Continue"})]})]},"reason"),"offer"===F&&(0,r.jsx)(P,{reason:W,round:et,alreadyPaused:Z,preview:L,previewError:G,feedback:B,setFeedback:M,submitting:U,error:$,onShowAnnualPreview:()=>{ei("clicked_annual"),K(null),I("annual_preview")},onTakePause:ed,onContinueCancel:()=>{let e="already_annual"===G;if(1===et&&S(W,Z)&&!e){ei("declined_pause"),er(2);return}ei("continued_cancel"),I("confirm")},onBack:()=>{if(et>1){er(et-1);return}I("reason")}}),"annual_preview"===F&&(0,r.jsx)(T,{preview:L,submitting:U,error:$,onConfirm:eo,onBack:()=>{K(null),I("offer")}}),"confirm"===F&&(0,r.jsxs)(i.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.25},className:"space-y-5",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-2xl sm:text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100 leading-tight",children:"Cancel subscription?"}),(0,r.jsx)("p",{className:"mt-1.5 text-sm text-gray-600 dark:text-gray-400",children:"You'll keep full access until your current billing period ends. Your data stays with us so you can come back any time."})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{htmlFor:"cancel-comment",className:"block text-sm font-medium text-gray-900 dark:text-gray-100",children:"Why are you cancelling?"}),(0,r.jsx)(m.g,{id:"cancel-comment",value:B,onChange:e=>M(e.target.value),placeholder:"Tell us what made you cancel â it genuinely helps us improve.",rows:3,className:"rounded-xl resize-none",autoFocus:!0})]}),$&&(0,r.jsxs)("div",{className:"flex items-start gap-2 rounded-xl bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-500/30 p-3 text-sm text-red-700 dark:text-red-400",children:[(0,r.jsx)(f.Z,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),(0,r.jsx)("span",{children:$})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 pt-1",children:[(0,r.jsx)(u.z,{onClick:t,disabled:U,className:"w-full bg-[#6D28D9] hover:bg-[#4C1D95] text-white rounded-xl py-5 font-semibold shadow-sm",children:"Don't cancel â keep my subscription"}),(0,r.jsxs)(u.z,{variant:"outline",onClick:ec,disabled:U||B.trim().length<2,className:"rounded-xl border-red-200 dark:border-red-500/30 text-red-700 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950/30 hover:text-red-800 dark:text-red-300 hover:border-red-300 dark:border-red-500/40 disabled:opacity-50",children:[U&&(0,r.jsx)(b.Z,{className:"h-4 w-4 mr-1.5 animate-spin"}),"Yes, cancel my subscription"]}),(0,r.jsx)("div",{className:"flex justify-center pt-1",children:(0,r.jsxs)(u.z,{variant:"ghost",size:"sm",onClick:()=>I("offer"),disabled:U,className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 text-xs",children:[(0,r.jsx)(v.Z,{className:"h-3.5 w-3.5 mr-1"}),"Back to offers"]})})]})]},"confirm"),"upgrade_success"===F&&(0,r.jsx)(Y,{accent:"purple",icon:(0,r.jsx)(k.Z,{className:"h-7 w-7"}),title:"You're on annual!",body:"We've charged your card on file. Your next renewal is ".concat(C(Q),"."),onClose:t}),"pause_success"===F&&(0,r.jsx)(Y,{accent:"blue",icon:(0,r.jsx)(j.Z,{className:"h-7 w-7"}),title:"Paused",body:"We'll resume your subscription on ".concat(C(ee),". All your progress is saved."),onClose:t}),"cancel_success"===F&&(0,r.jsx)(Y,{accent:"gray",icon:(0,r.jsx)(w.Z,{className:"h-7 w-7"}),title:"Cancelled",body:Q?"You'll keep access until ".concat(C(Q),". Your data stays with us if you change your mind."):"You'll keep access until your current billing period ends. Your data stays with us if you change your mind.",onClose:t})]}),("upgrade_success"===F||"pause_success"===F||"cancel_success"===F)&&(0,r.jsx)(s(),{id:"e683c2969a8e42a2",children:"[data-radix-dialog-close]{dis
1play:none}"})]})})}function q(e){let{icon:a,value:t,label:n}=e,s=void 0===t;return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center text-center",children:[(0,r.jsx)("div",{className:"text-purple-600 dark:text-purple-400 mb-1.5",children:a}),(0,r.jsx)("div",{className:"text-2xl sm:text-3xl font-bold tracking-tight text-gray-900 dark:text-gray-100 tabular-nums leading-none",children:s?(0,r.jsx)("span",{className:"text-gray-300 dark:text-gray-600",children:"â"}):t}),(0,r.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-gray-500 dark:text-gray-400 mt-1.5",children:n})]})}function Y(e){let{icon:a,title:t,body:n,onClose:s,accent:l="purple"}=e,o={purple:{bg:"bg-purple-100 dark:bg-purple-500/15",text:"text-purple-600 dark:text-purple-400",btn:"bg-[#6D28D9] hover:bg-[#4C1D95]"},blue:{bg:"bg-blue-100 dark:bg-blue-500/15",text:"text-blue-600 dark:text-blue-400",btn:"bg-[#6D28D9] hover:bg-[#4C1D95]"},gray:{bg:"bg-gray-100 dark:bg-zinc-700",text:"text-gray-500 dark:text-gray-400",btn:"bg-gray-900 dark:bg-gray-100 hover:bg-gray-800 dark:hover:bg-white"}}[l];return(0,r.jsxs)(i.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.3},className:"flex flex-col items-center text-center py-4 space-y-4",children:[(0,r.jsx)("div",{className:(0,x.cn)("rounded-full p-3.5",o.bg,o.text),children:a}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-2xl font-semibold tracking-tight text-gray-900 dark:text-gray-100",children:t}),(0,r.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-400 max-w-sm mt-1.5 leading-relaxed",children:n})]}),(0,r.jsx)(u.z,{onClick:s,className:(0,x.cn)("rounded-xl py-5 px-8 font-semibold text-white shadow-sm mt-2",o.btn),children:"Done"})]})}function P(e){var a;let{reason:t,round:n,alreadyPaused:s,preview:l,previewError:o,feedback:d,setFeedback:c,submitting:x,error:h,onShowAnnualPreview:y,onTakePause:g,onContinueCancel:p,onBack:j}=e,w=s?{primary:"annual",secondary:null}:"exams_over"===t||"not_using"===t?n>=2?{primary:"annual",secondary:null}:{primary:"pause",secondary:null}:{primary:"annual",secondary:null},_=D(t).toLocaleDateString("en-GB",{day:"numeric",month:"long"}),C=(null==l?void 0:l.you_save)?N(l.you_save,l.currency):"";(null==l?void 0:l.amount_due_today)&&N(l.amount_due_today,l.currency);let z=(null==l?void 0:l.annual_monthly_equiv)?N(l.annual_monthly_equiv,l.currency):(null==l?void 0:l.annual_price)?N(Math.round(l.annual_price/12),l.currency):"",q=(null==l?void 0:l.current_monthly_equiv)?N(l.current_monthly_equiv,l.currency):"",Y=!!(null==l?void 0:l.current_monthly_equiv)&&!!(null==l?void 0:l.annual_monthly_equiv)&&l.annual_monthly_equiv<l.current_monthly_equiv,P=Y&&(null==l?void 0:l.current_monthly_equiv)?Math.round((l.current_monthly_equiv-(null!==(a=l.annual_monthly_equiv)&&void 0!==a?a:0))/l.current_monthly_equiv*100):0,T="already_annual"===o,O="",Z=null;n>=2?Y?(O="One more option â ".concat(z,"/month instead of ").concat(q,"."),Z=(0,r.jsxs)(r.Fragment,{children:["If a pause isn't right, lock in ",P,"% off for a year."]})):(O=(null==l?void 0:l.you_save)?"One more option â save ".concat(C," with annual."):"One more option â switch to annual.",Z=(0,r.jsx)(r.Fragment,{children:"If a pause isn't right, our yearly plan is the next best deal."})):"exams_over"===t?(O="Done with exams? Pause until ".concat(_,"."),Z=(0,r.jsx)(r.Fragment,{children:"We'll freeze your billing and keep every topic you've mastered. When revision starts again, you pick up where you left off â no setup, no re-paying upfront."})):"not_using"===t?(O="Take a break â pause for a month.",Z=(0,r.jsxs)(r.Fragment,{children:["Freeze your billing for 30 days. Your progress stays. Resume any time before"," ",_,"."]})):"missing_features"===t?(O="Sorry we missed the mark",Z=(0,r.jsx)(r.Fragment,{children:"What feature were you looking for? We read every reply and prioritise based on this."})):"technical"===t?(O="Let us help fix it",Z=(0,r.jsxs)(r.Fragment,{children:["Email"," ",(0,r.jsx)("a",{className:"underline",href:"mailto:[email protected]",children:"[email protected]"})," ","and we'll sort it out â usually within a day. Your account stays active."]})):T?"too_expensive"===t?(O="Sorry â we donât have a cheaper plan.",Z=(0,r.jsx)(r.Fragment,{children:"You're already on our best deal (annual). If price is a blocker, you can cancel below."})):(O="Youâre already on our best plan.",Z=(0,r.jsx)(r.Fragment,{children:"Cancel below if you still want to leave."})):(O=Y?"".concat(z,"/month instead of ").concat(q,"."):(null==l?void 0:l.you_save)?"Save ".concat(C," with annual"):"Switch to annual & pay less",Z=(0,r.jsx)(r.Fragment,{children:"You won't see this deal again."}));let F="annual"===w.primary;return(0,r.jsxs)(i.E.div,{initial:{opacity:0,y:8}
1,animate:{opacity:1,y:0},transition:{duration:.25},className:"space-y-5",children:[F&&l&&!T&&(0,r.jsxs)("div",{className:"inline-flex items-center gap-1.5 rounded-full bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-500/30 px-3 py-1 text-[11px] font-bold uppercase tracking-[0.08em] text-amber-900 dark:text-amber-300",children:[(0,r.jsx)(k.Z,{className:"h-3 w-3"}),"Limited offer \xb7 Ends ","June 15"]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-2xl sm:text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100 leading-tight",children:O}),Z&&(0,r.jsx)("p",{className:"mt-1.5 text-sm text-gray-600 dark:text-gray-400 leading-relaxed",children:Z})]}),"missing_features"===t&&(0,r.jsx)(m.g,{value:d,onChange:e=>c(e.target.value),placeholder:"What were you hoping for?",rows:3,className:"rounded-xl resize-none"}),h&&(0,r.jsxs)("div",{className:"flex items-start gap-2 rounded-xl bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-500/30 p-3 text-sm text-red-700 dark:text-red-400",children:[(0,r.jsx)(f.Z,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),(0,r.jsx)("span",{children:h})]}),("annual"===w.primary||"annual"===w.secondary)&&!l&&o&&!T&&(0,r.jsxs)("div",{className:"rounded-xl border border-amber-200 dark:border-amber-500/30 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm",children:[(0,r.jsx)("div",{className:"font-semibold text-amber-900 dark:text-amber-300",children:"Couldn't load pricing"}),(0,r.jsx)("div",{className:"text-amber-800 dark:text-amber-300/90 mt-0.5",children:"No active subscription found"===o?"No active subscription found on your account.":"".concat(o,". Refresh and try again.")})]}),F&&l&&z&&!T&&(0,r.jsxs)("div",{className:"relative rounded-2xl border-2 border-purple-200 dark:border-purple-500/30 bg-gradient-to-br from-purple-50 via-white to-blue-50 px-5 py-7 shadow-sm text-center",children:[(Y||l.you_save)&&(0,r.jsx)("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2 inline-flex items-center gap-1.5 rounded-full bg-green-600 px-3 py-1 text-[11px] font-bold uppercase tracking-[0.08em] text-white shadow-sm whitespace-nowrap",children:Y?"".concat(P,"% off"):"Save ".concat(C)}),(0,r.jsxs)("div",{className:"flex items-baseline justify-center gap-2",children:[(0,r.jsx)("span",{className:"text-5xl font-bold tracking-tight text-gray-900 dark:text-gray-100 tabular-nums leading-none",children:z}),(0,r.jsx)("span",{className:"text-base text-gray-500 dark:text-gray-400 font-medium",children:"/month"})]}),Y&&q&&(0,r.jsxs)("div",{className:"mt-1.5 text-sm text-gray-400 dark:text-gray-500 line-through tabular-nums",children:[q,"/month"]}),l.annual_price&&(0,r.jsxs)("div",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400",children:["Billed yearly at ",N(l.annual_price,l.currency)," \xb7 cancel any time"]})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 pt-1",children:["pause"===w.primary&&(0,r.jsxs)(u.z,{onClick:g,disabled:x,className:"w-full bg-[#6D28D9] hover:bg-[#4C1D95] text-white rounded-xl py-5 font-semibold shadow-sm",children:[x&&(0,r.jsx)(b.Z,{className:"h-4 w-4 mr-1.5 animate-spin"}),"Pause until ",_]}),"annual"===w.primary&&!T&&(0,r.jsx)(u.z,{onClick:y,disabled:x||!l,className:"w-full bg-[#6D28D9] hover:bg-[#4C1D95] text-white rounded-xl py-5 font-semibold shadow-sm disabled:opacity-50",children:Y&&z?"Claim offer \xb7 ".concat(z,"/month"):(null==l?void 0:l.you_save)?"Switch to annual â save ".concat(C):"Switch to annual"}),"annual"===w.secondary&&!T&&(0,r.jsx)(u.z,{onClick:y,variant:"outline",disabled:x||!l,className:"w-full rounded-xl border-2 border-[#6D28D9]/30 text-[#6D28D9] hover:bg-purple-50 dark:hover:bg-purple-950/30 hover:border-[#6D28D9]/60 font-semibold py-5",children:Y&&z?"Or get ".concat(z,"/month â save ").concat(C):(null==l?void 0:l.you_save)?"Or switch to annual â save ".concat(C):"Or switch to annual"}),"pause"===w.secondary&&(0,r.jsx)(u.z,{onClick:g,variant:"outline",disabled:x,className:"w-full rounded-xl border-2 font-semibold py-5",children:"Or pause for a month"}),T&&"pause"!==w.primary&&(0,r.jsx)(u.z,{onClick:p,disabled:x,className:"w-full bg-gray-900 dark:bg-zinc-700 hover:bg-gray-800 dark:hover:bg-zinc-600 text-white rounded-xl py-5 font-semibold shadow-sm",children:"missing_features"===t?"Send feedback & cancel":"Continue cancellation"}),(0,r.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,r.jsxs)(u.z,{variant:"ghost",size:"sm",onClick:j,disabled:x,className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 text-xs",children:[(0,r.jsx)(v.Z,{className:"h-3.5 w-3.5 mr-1"}),"Back"]}),!(T&&"pause"!==w.primary)&&(0,r.jsx)(u.z,{variant:"ghost",size:"sm",onClick:p,disabled:x,className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 text-xs",children:"pause"===w.primary&&S(t,s)?"No, continue cancelling":"No thanks, cancel my subscription"})]})]})]},"offer")}function T(e){let{preview:a,submitting:t,error:n,onConfirm:s,onBack:l}=e;if(!a)return(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)(b.Z,{className:"h-6 w-6 animate-spin text-gray-400 dark:text-gray-500"})});let o=a.you_save?N(a.you_save,a.currency):"",d=N(a.amount_due_today,a.currency),c=a.annual_monthly_equiv?N(a.annual_monthly_equiv,a.currency):a.annual_price?N(Math.round(a.annual_price/12),a.currency):"",m=a.current_monthly_equiv?N(a.current_monthly_equiv,a.currency):"",x=!!a.current_monthly_equiv&&!!a.annual_monthly_equiv&&a.annual_monthly_equiv<a.current_monthly_equiv,h=a.next_annual_renewal?new Date(a.next_annual_renewal).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}):"",y=a.payment_method_brand&&a.payment_method_last4?"".concat(a.payment_method_brand[0].toUpperCase()).concat(a.payment_method_brand.slice(1)," â¢â¢â¢â¢ ").concat(a.payment_method_last4):"card on file";return(0,r.jsxs)(i.E.div,{initial:{opacity:0,y:8}
1,animate:{opacity:1,y:0},transition:{duration:.25},className:"space-y-5",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-2xl sm:text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100 leading-tight",children:"Confirm switch to annual"}),(0,r.jsx)("p",{className:"mt-1.5 text-sm text-gray-600 dark:text-gray-400",children:"We'll charge your card on file now. Your subscription will renew once a year after that."})]}),(0,r.jsxs)("div",{className:"rounded-2xl border bg-gradient-to-br from-purple-50 via-white to-blue-50 p-5 space-y-4",children:[c&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em] text-gray-500 dark:text-gray-400 mb-1",children:"Your new monthly cost"}),(0,r.jsxs)("div",{className:"flex items-baseline gap-2.5 flex-wrap",children:[(0,r.jsx)("span",{className:"text-4xl font-bold tracking-tight text-gray-900 dark:text-gray-100 tabular-nums leading-none",children:c}),(0,r.jsx)("span",{className:"text-sm text-gray-500 dark:text-gray-400 font-medium",children:"/month"}),x&&m&&(0,r.jsxs)("span",{className:"text-base text-gray-400 dark:text-gray-500 line-through tabular-nums font-medium",children:[m,"/mo"]})]})]}),(0,r.jsxs)("div",{className:"space-y-2 text-sm border-t border-purple-100 dark:border-purple-500/20 pt-3.5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"Charged today"}),(0,r.jsx)("span",{className:"text-gray-900 dark:text-gray-100 font-semibold tabular-nums",children:d})]}),a.you_save?(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"You save vs. monthly"}),(0,r.jsx)("span",{className:"font-semibold text-green-700 dark:text-green-400 tabular-nums",children:o})]}):null,h&&(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"Next renewal"}),(0,r.jsx)("span",{className:"text-gray-900 dark:text-gray-100",children:h})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-purple-100 dark:border-purple-500/20",children:[(0,r.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"Payment"}),(0,r.jsx)("span",{className:"text-gray-900 dark:text-gray-100 font-medium",children:y})]})]})]}),n&&(0,r.jsxs)("div",{className:"flex items-start gap-2 rounded-xl bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-500/30 p-3 text-sm text-red-700 dark:text-red-400",children:[(0,r.jsx)(f.Z,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),(0,r.jsx)("span",{children:n})]}),(0,r.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400 leading-relaxed",children:"Unused time on your current plan is credited automatically. You can still cancel any time from this page."}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 pt-1",children:[(0,r.jsxs)(u.z,{onClick:s,disabled:t,className:"w-full bg-[#6D28D9] hover:bg-[#4C1D95] text-white rounded-xl py-5 font-semibold shadow-sm",children:[t&&(0,r.jsx)(b.Z,{className:"h-4 w-4 mr-1.5 animate-spin"}),"Confirm and pay ",d]}),(0,r.jsxs)(u.z,{variant:"ghost",onClick:l,disabled:t,className:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300",children:[(0,r.jsx)(v.Z,{className:"h-4 w-4 mr-1.5"}),"Back"]})]})]},"annual_preview")}},54662:function(e,a,t){t.d(a,{$N:function(){return h},Vq:function(){return o},cN:function(){return x},cZ:function(){return u},fK:function(){return m}});var r=t(57437),n=t(2265),s=t(13304),l=t(4867),i=t(49354);let o=s.fC;s.xz;let d=s.h_;s.x8;let c=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,r.jsx)(s.aV,{ref:a,className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n})});c.displayName=s.aV.displayName;let u=n.forwardRef((e,a)=>{let{className:t,children:n,...o}=e;return(0,r.jsxs)(d,{children:[(0,r.jsx)(c,{}),(0,r.jsxs)(s.VY,{ref:a,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
1nded-lg",t),...o,children:[n,(0,r.jsxs)(s.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,r.jsx)(l.Pxu,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});u.displayName=s.VY.displayName;let m=e=>{let{className:a,...t}=e;return(0,r.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-1.5 text-center sm:text-left",a),...t})};m.displayName="DialogHeader";let x=e=>{let{className:a,...t}=e;return(0,r.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...t})};x.displayName="DialogFooter";let h=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,r.jsx)(s.Dx,{ref:a,className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight",t),...n})});h.displayName=s.Dx.displayName,n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,r.jsx)(s.dk,{ref:a,className:(0,i.cn)("text-sm text-muted-foreground",t),...n})}).displayName=s.dk.displayName},4919:function(e,a,t){t.d(a,{g:function(){return l}});var r=t(57437),n=t(2265),s=t(49354);let l=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,r.jsx)("textarea",{className:(0,s.cn)("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...n})});l.displayName="Textarea"}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.