1import{r as y,j as e,d as Q,u as U,p as G}from"./vendor-react-DfYGAhtm.js";import{f as O,u as V}from"./vendor-state-BsBVN-fX.js";import{m as p,g as I,e as $,t as z,bi as Y}from"./index-DsBgCU7r.js";import{S as K}from"./StepPageLayout-DdZUweau.js";import{g as J}from"./errors-BYKXB8DF.js";import{u as X,g as Z,m as ee}from"./mapHealthQuote-Dd5YesTp.js";import{a as w,P as n,H as te}from"./HealthFormShell-BdiFYoa2.js";import{I as oe,a as ie}from"./IndividualPlanTierCard-CLUUibjp.js";import{bD as re,A as ae}from"./vendor-icons-1odZwi-b.js";import{M}from"./Modal-DS-VW05m.js";import{u as ne,m as se}from"./mapHealthHospital-CkG_RL7N.js";import{a as c,T as o,F as u,S as N,H as D,v as R,G as le,i as de,w as pe}from"./vendor-ui-DA_r9yXk.js";import{a as ce}from"./currency-tq8RhIEU.js";import"./LinkPaymentMethodOption-CuZHpNDU.js";import{I as xe,c as me}from"./individualHealthConstants-DtbURbNc.js";import{H as he}from"./routes-Dr23NpA-.js";import"./vendor-forms-BP-7CbAP.js";import"./underwriterLogoDisplay-B0FBG3Nn.js";import"./UnderwriterPlanLogo-CdMcnE2i.js";const ue=({open:t,onClose:i,planName:r,planTypeId:l,stateCode:a})=>{const{hospitals:d,isLoading:f,isError:S,refetch:v}=ne({...l?{typeId:l}:{},...a?{stateCode:a}:{},enabled:t}),x=y.useMemo(()=>d.map(se),[d]),h=!!l&&!!a;return e.jsx(M,{open:t,onClose:i,size:"md",maxW:"520px",mobileBottomSheet:!0,bodyPadded:!1,contentProps:{borderRadius:{base:"24px 24px 0 0",md:"24px"}},children:e.jsxs(c,{fontFamily:w.bodyFont,children:[e.jsxs(c,{px:{base:5,md:6},pt:{base:5,md:6},pe:"56px",children:[e.jsx(o,{fontFamily:"heading",fontSize:"20px",lineHeight:"1.2",fontWeight:"semibold",letterSpacing:"-0.4px",color:p.text.primary,children:"Hospital Network"}),e.jsxs(o,{fontSize:"13px",lineHeight:"20px",color:n.priceCaption,mt:"2px",children:["Covered hospitals on ",r??"this plan"]})]}),!h&&e.jsx(o,{px:{base:5,md:6},mt:4,fontSize:"13px",color:n.priceCaption,children:"Location details are needed to load hospitals for this plan."}),h&&f&&e.jsx(u,{justify:"center",py:12,children:e.jsx(N,{size:"md",color:p.orange[500]})}),h&&S&&!f&&e.jsxs(u,{direction:"column",align:"center",gap:3,px:{base:5,md:6},py:10,children:[e.jsx(o,{fontSize:"13px",color:p.error[600],textAlign:"center",children:"We couldn't load hospitals right now. Please try again."}),e.jsx(I,{type:"button",buttonType:"outline",text:"Retry",size:"sm",onClick:()=>v()})]}),h&&!f&&!S&&e.jsxs(e.Fragment,{children:[e.jsxs(o,{px:{base:5,md:6},mt:4,fontSize:"12px",fontWeight:"medium",color:n.priceCaption,children:[x.length," hospital",x.length===1?"":"s"," in your area"]}),e.jsx(c,{px:{base:5,md:6},pt:"10px",pb:{base:5,md:6},maxH:{base:"52dvh",md:"360px"},overflowY:"auto",children:x.length===0?e.jsx(o,{fontSize:"13px",color:n.priceCaption,py:6,textAlign:"center",children:"No hospitals found for this location yet."}):e.jsx(u,{direction:"column",gap:"10px",children:x.map(b=>e.jsxs(c,{p:"14px",borderRadius:"14px",bg:n.benefitsBg,border:"1px solid",borderColor:n.benefitsBorder,children:[e.jsx(o,{fontSize:"14px",lineHeight:"20px",fontWeight:"semibold",color:p.text.label,children:b.name}),e.jsxs(D,{gap:"6px",mt:"4px",align:"flex-start",children:[e.jsx(R,{as:re,boxSize:"14px",mt:"2px",flexShrink:0,color:n.priceCaption}),e.jsx(o,{fontSize:"12px",lineHeight:"18px",color:n.priceCaption,children:b.address})]})]},b.id))})})]})]})})},ge=({open:t,onClose:i,plan:r,onSelectPlan:l})=>r?e.jsx(M,{open:t,onClose:i,size:"lg",maxW:"640px",mobileBottomSheet:!0,bodyPadded:!1,contentProps:{borderRadius:{base:"24px 24px 0 0",md:"24px"}},children:e.jsxs(c,{fontFamily:w.bodyFont,children:[e.jsxs(c,{px:{base:5,md:6},pt:{base:5,md:6},pe:"56px",children:[e.jsx(o,{fontFamily:"heading",fontSize:"20px",lineHeight:"1.2",fontWeight:"semibold",letterSpacing:"-0.4px",color:p.text.primary,children:"What's Covered"}),e.jsxs(o,{fontSize:"13px",lineHeight:"20px",color:n.priceCaption,mt:"2px",children:[r.name," Plan Benefits"]})]}),e.jsx(c,{px:{base:5,md:6},pt:5,maxH:{base:"52dvh",md:"none"},overflowY:{base:"auto",md:"visible"},children:e.jsx(le,{templateColumns:{base:"1fr",sm:"1fr 1fr"},gap:"12px",children:r.coverageDetails.map(a=>e.jsxs(u,{gap:"10px",align:"flex-start",p:"14px",borderRadius:"14px",bg:n.benefitsBg,border:"1px solid",borderColor:n.benefitsBorder,children:[e.jsx(u,{boxSize:"18px",mt:"1px",flexShrink:0,align:"center",justify:"center",borderRadius:"full",bg:n.coveredText,children:e.jsx(R,{as:ae,boxSize:"12px",color:"white"})}),e.jsxs(c,{children:[e.jsx(o,{fontSize:"14px",lineHeight:"20px",fontWeight:"semibold",color:p.text.label,children:a.label}),e.jsx(o,{fontSize:"12px",lineHeight:"18px",color:n.priceCaption,mt:"2px",children:a.description})]})]},a.id))})}),e.jsxs(D,{justify:"space-between",align:"center",gap:3,flexWrap:"wrap",mt:5,px:{base:5,md:6},pt:4,pb:{base:5,md:6},borderTop:"1px solid",borderColor:n.border,children:[e.jsxs(c,{children:[e.jsx(o,{fontSize:"12.5px",lineHeight:"1.45",fontWeight:"medium",color:n.priceCaption,children:"From"}),e.jsxs(o,{fontSize:"18px",lineHeight:"1.45",fontWeight:"bold",letterSpacing:"-0.16px",color:p.orange[500],children:[ce(r.annualPremium),"/yr"]}),e.jsx(o,{fontSize:"9px",lineHeight:"1.45",fontWeight:"medium",color:n.priceCaption,children:"Annual Premium"})]}
1),e.jsx(I,{type:"button",buttonType:"primary",text:"Select This Plan",size:"md",h:"51px",px:"32px",fontSize:"13px",boxShadow:n.buttonShadow,onClick:l})]})]})}):null,fe=async t=>{const{data:i}=await $.get(`/api/v1/health-policy/${t}/provider/plans`);if(!i.success)throw new Error(i.message||"Failed to load provider plans");return i.data},be=t=>{const{data:i,isPending:r,isError:l,error:a,refetch:d}=O({queryKey:["health","policy",t,"provider-plans"],queryFn:()=>fe(t),enabled:!!t,staleTime:3e5});return{plans:i??[],isLoading:!!t&&r,isError:l,error:a,refetch:d}},je=t=>{const i=t.find(r=>r.toLowerCase()!=="health");if(i)return i.charAt(0).toUpperCase()+i.slice(1)},E=t=>{const i=Object.entries(t.coverageDetails).map(([r,l])=>({id:r.toLowerCase().replace(/\s+/g,"-"),label:r,description:l.map(a=>a.description).join(" · ")||l.map(a=>a.name).join(", ")}));return{id:t.id,name:t.name,annualPremium:Number(t.fixedPremium)||0,networkSummary:t.bestFor??void 0,badge:je(t.tags),benefits:[],coverageDetails:i}},ke=()=>{const t=Q(),i=U(),[r]=G(),l=V(),a=i.state,d=r.get("policyId")??a?.policyId??void 0,f=r.get("stateCode")??a?.stateCode??void 0,S=r.get("planTypeId")??a?.planTypeId??void 0,{plans:v,isLoading:x,isError:h,refetch:b}=be(d),{generateIndividualHealthQuote:k,isLoading:F}=X(),[L,H]=y.useState(null),[j,P]=y.useState(null),[C,T]=y.useState(null),B=y.useMemo(()=>v.map(s=>({apiPlan:s,definition:E(s)})),[v]),q=j?E(j):null,A=s=>{!d||F||(H(s.id),k({policyId:d,payload:{productId:s.id,paymentFrequency:"ANNUAL"}},{onSuccess:m=>{if(!m.success){H(null),z.error(m.message||"Failed to create a quote. Please try again.");return}const g=m.data,W=Z(g);if(!W){H(null),z.error("Quote was created but no quote reference was returned. Please try again.");return}const _=ee(g,s.id);l(Y({planId:s.id,providerName:g.underwriter,providerLogo:null,selectedPlan:_,quoteId:W,quote:g})),t({pathname:`/${he.IndividualReview}`,search:`?${new URLSearchParams({policyId:g.policyId||d,planId:s.id}).toString()}`},{state:{quote:g,planId:s.id}})},onError:m=>{H(null),z.error(J(m)??"Failed to create a quote. Please try again.")}}))};return e.jsxs(K,{items:[],contentMaxW:"888px",mobileContentOnly:!0,children:[e.jsxs(te,{px:{base:4,md:10,lg:"48px"},py:{base:6,md:12,lg:"74px"},children:[e.jsx(oe,{steps:me,activeStep:xe.SelectPlan,mb:{base:8,md:"67px"}}),e.jsxs(c,{fontFamily:w.bodyFont,children:[e.jsx(de,{fontSize:{base:"26px",md:"34px"},fontWeight:"semibold",lineHeight:"1.15",letterSpacing:"-1.43px",color:p.orange[500],children:"Choose your level of cover"}),e.jsx(o,{fontSize:{base:"15px",md:"17px"},lineHeight:"24.74px",color:p.text.primary,mt:"8px",children:"Pick the plan that meets your needs"}),x&&e.jsx(u,{justify:"center",py:16,children:e.jsx(N,{size:"lg",color:p.orange[500]})}),!d&&!x&&e.jsx(o,{fontSize:"14px",color:p.text.secondary,mt:{base:8,md:"49px"},children:"Start from the coverage details step to load available plans."}),h&&!x&&d&&e.jsxs(u,{direction:"column",align:"center",gap:4,py:12,children:[e.jsx(o,{fontSize:"14px",color:p.error[600],textAlign:"center",children:"We couldn't load plans right now. Please try again."}),e.jsx(I,{type:"button",buttonType:"outline",text:"Retry",size:"md",onClick:()=>b()})]}),!x&&!h&&d&&e.jsx(pe,{columns:{base:1,md:2},gap:"26px",mt:{base:8,md:"49px"},children:B.map(({apiPlan:s,definition:m})=>e.jsx(ie,{plan:m,hmoName:s.underwriter.name,isSelecting:L===s.id,isDisabled:F&&L!==s.id,onSelectPlan:()=>A(s),onViewCoverage:()=>P(s),onViewHospitals:()=>T(m)},s.id))})]})]}),e.jsx(ge,{open:!!j,onClose:()=>P(null),plan:q,onSelectPlan:()=>{j&&A(j),P(null)}}),e.jsx(ue,{open:!!C,onClose:()=>T(null),planName:C?`${C.name} Plan`:void 0,planTypeId:S,stateCode:f})]})};export{ke 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.