1import{d as F,r as w,j as e,N as B}from"./vendor-react-DfYGAhtm.js";import{e as T,m as g,g as z}from"./index-DsBgCU7r.js";import{S as H,a as E}from"./SavingsCoverageModal-D0pExffH.js";import{S as N,h as n,e as l,d as y,s as M,c as R}from"./SavingsCardShell-BXwb2Evc.js";import{b as q,g as A,f as L}from"./savingsProjection-Bn8kpypl.js";import{l as W,g as I,a as O}from"./savingsFlow-Crd0jwFD.js";import{a as b,F as m,T as s,H as C,S as _}from"./vendor-ui-DA_r9yXk.js";import{S as v}from"./routes-BR5I3bEX.js";import"./vendor-forms-BP-7CbAP.js";import{f as k}from"./vendor-state-BsBVN-fX.js";import{b as P}from"./savingsBudget-ALoZ0Gim.js";import{u as G}from"./useSavingsBudgetInput-C4H5nWfy.js";import"./LinkPaymentMethodOption-CuZHpNDU.js";import"./vendor-icons-1odZwi-b.js";import"./Modal-DS-VW05m.js";import"./checkoutSessionStore-BRM5sYZN.js";import"./dateOfBirth-BQh2Bcet.js";const V=async({premium:t,frequency:a})=>{const{data:r}=await T.get("/api/v1/life-policy/provider/plans",{params:{type:N,premium:t,frequency:a}});if(!r.success)throw new Error(r.message||"Failed to load savings plans");return r},$=({premium:t,frequency:a})=>{const r=t!=null&&Number.isFinite(t)&&t>0&&!!a,{data:o,isPending:i,isError:p,error:c}=k({queryKey:["savings","provider-plans",t,a],queryFn:()=>V({premium:t,frequency:a}),enabled:r});return{plans:o?.data,isLoading:r&&i,isError:p,error:c}},U=()=>{const t=F(),[a,r]=w.useState(null),o=G(),{plans:i,isLoading:p,isError:c}=$({premium:o?.amount,frequency:o?.frequency});if(!o)return{status:"redirect"};const u=W(i,o.frequency),d=x=>{t({pathname:`/${v.Plan}`,search:P(o)},{state:{plan:x}})},f=()=>t({pathname:`/${v.Projection}`,search:P(o)}),h=x=>{r(null),d(x)};return{status:"ready",budget:o,plans:u,isLoading:p,isError:c,emptyMessage:I(c,o.frequency),coveragePlan:a,openCoverage:r,closeCoverage:()=>r(null),selectPlan:d,selectFromCoverage:h,goToProjection:f}},S=({label:t,value:a})=>e.jsxs(C,{gap:"6px",bg:"white",border:"1px solid",borderColor:n.toggleBorder,borderRadius:"full",px:"12px",py:"6.5px",children:[e.jsx(s,{fontFamily:l,fontSize:"11px",fontWeight:"medium",lineHeight:"16.5px",textTransform:"uppercase",color:g.text.tertiary,whiteSpace:"nowrap",children:t}),e.jsx(s,{fontFamily:l,fontSize:"11px",fontWeight:"bold",lineHeight:"16.5px",color:n.orangeMain,whiteSpace:"nowrap",children:a})]}),D=({plan:t,budget:a,onSelect:r,onViewCoverage:o})=>{const i=q(t,a),p=A(t,a.frequency);return e.jsxs(b,{bg:n.planCardBg,border:"1px solid",borderColor:n.planCardBorder,borderRadius:"24px",p:"21px",filter:"drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.02))",children:[e.jsxs(m,{align:"flex-start",justify:"space-between",gap:"12px",children:[e.jsxs(s,{fontFamily:l,fontSize:"12px",fontWeight:"semibold",lineHeight:"18px",color:g.text.tertiary,children:["Powered by ",t.underwriter]}),o&&e.jsx(H,{onClick:()=>o(t)})]}),e.jsx(s,{pt:"8px",fontFamily:y,fontWeight:"700",fontSize:"24px",lineHeight:"36px",color:g.text.tertiary,children:t.name}),e.jsxs(C,{gap:"8px",pt:"12px",wrap:"wrap",children:[i&&e.jsx(S,{label:"Projected payout",value:`Up to ${i}`}),e.jsx(S,{label:"Est. return",value:O(t,null)}),e.jsx(S,{label:"Term",value:t.durationLabel})]}),e.jsxs(m,{align:"flex-end",justify:"space-between",gap:"16px",mt:"16px",pt:"17px",borderTop:"1px solid",borderColor:n.tileBorder,children:[e.jsxs(b,{children:[e.jsx(s,{fontFamily:l,fontSize:"13px",fontWeight:"medium",lineHeight:"19.5px",color:n.muted,children:"Savings"}),e.jsx(s,{pt:"4px",fontFamily:y,fontWeight:"700",fontSize:"22px",lineHeight:"22px",color:n.orangeMain,children:L(p)}),e.jsx(s,{pt:"4px",fontFamily:l,fontSize:"10px",lineHeight:"15px",color:n.muted,children:M(a.frequency)})]}),e.jsx(z,{buttonType:"primary",type:"button",text:"Select This Plan",size:"lg",h:"48px",borderRadius:"full",px:"32.5px",fontFamily:l,fontSize:"14px",fontWeight:"medium",letterSpacing:"-0.9px",onClick:()=>r(t)})]})]})},ge=()=>{const t=U();if(t.status==="redirect")return e.jsx(B,{to:`/${v.Budget}`,replace:!0});const{budget:a,plans:r,isLoading:o,isError:i,emptyMessage:p,coveragePlan:c,openCoverage:u,closeCoverage:d,selectPlan:f,selectFromCoverage:h,goToProjection:x}=t;return e.jsxs(R,{onBack:x,children:[e.jsx(E,{open:!!c,onClose:d,plan:c,frequency:a.frequency,onSelect:h}),e.jsxs(s,{as:"h1",fontFamily:y,fontWeight:"700",fontSize:{base:"26px",md:"32px"},lineHeight:"40px",letterSpacing:"-0.5px",color:g.text.tertiary,children:["Select a"," ",e.jsx(s,{as:"span",color:n.orangeMain,children:"plan"})]}),e.jsx(s,{pt:"8px",pb:"24px",fontFamily:l,fontSize:"15px",lineHeight:"24.375px",color:g.text.tertiary,children:"Choose the cover that fits your situation. Start simple you can always do more later."}),o?e.jsx(m,{minH:"200px",align:"center",justify:"center",children:e.jsx(_,{size:"lg",color:n.orangeMain})}):r.length===0?e.jsx(s,{py:"32px",textAlign:"center",fontFamily:l,fontSize:"14px",lineHeight:"21px",color:i?g.orange[500]:n.muted,children:p}):e.jsx(m,{direction:"column",gap:"16px",children:r.map(j=>e.jsx(D,{plan:j,budget:a,onSelect:f,onViewCoverage:u},j.id))})]})};export{ge as default};
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.