PageSourceSearch

https://allstaradvisors.ai/assets/RetirementCalculatorsPage-Be6zca6e.js

js allstaradvisors.ai collected 2026-10-05 13:55:01 UTC 11,602 bytes, 1 lines download raw bytes

1import{u as K,r,j as a}from"./vendor-react-DL1ATZgj.js";import{u as _}from"./vendor-query-C11xQHO0.js";import{J as w}from"./vendor-utils-CKG6n7M2.js";import{a as Q,O as Y,M as S,i as A,s as V}from"./index-BZi1svY4.js";import{O as q}from"./ObsidianSelect-BaPp_wol.js";import{S as X}from"./StatusPill-BHG_6PU0.js";import{R as Z}from"./RetirementPageHeader-Bf7GDUvk.js";import{d as ee}from"./scenarioActions-BWeWSC01.js";import{b as ae,r as te,E as se,t as ie,W as ne,A as le,a as oe,I as re,l as ce}from"./whatIfSignals-D2JmM0-A.js";import{bo as de,bp as me,r as pe,ai as ue,a6 as xe,u as he,bq as be,w as z,a5 as fe,ay as ge,br as ve,bd as je,bs as Ie,bt as ye}from"./vendor-icons-D3hnpUoP.js";import"./vendor-ui-qAC6ZjNC.js";import"./vendor-supabase-CVBsuquN.js";import"./index-BCaLenm-.js";import"./vendor-pdf-DtdnXsY-.js";import"./scenarioReconcile-D2EshTbr.js";import"./ObsidianModal-D1HZiZHA.js";import"./repeater-CsqPtLdH.js";import"./ssFeasibility-CLjkCAj0.js";import"./allocationTruth-XBwso2TL.js";import"./swagVolatilityCompass-CK6oIFb5.js";import"./whatIfImpact-B-Yr6BVX.js";import"./projectionEngine-nPCV2Cgy.js";import"./constraintOrchestrator-DdADCDv8.js";import"./eligibleTaxScans-C0Ulyhnw.js";import"./taxAnalysisStatus-yfniXxTi.js";import"./taxRules-DY0EMy5t.js";import"./irmaa2026-CaAsi564.js";import"./rules-CI3fx6C5.js";import"./fica-BZHm2HAl.js";import"./whatIfComparisonPdf-D_sOJpZP.js";const L=[{calcId:"amortization",desc:"Model a mortgage / loan payment and its drag on cash flow.",icon:de,title:"Amortization"},{calcId:"rmd",desc:"Project required minimum distributions through life expectancy.",icon:me,title:"RMD schedule"},{calcId:"pension-max",desc:"Single-life vs joint-survivor pension election.",icon:pe,title:"Pension max"},{calcId:"tax-deferral",desc:"Tax-deferred vs annually-taxed growth comparison.",icon:ue,title:"Tax deferral"}],Ne=[{calcId:"loan-payoff",desc:"Extra-payment scenarios and the time + interest saved by paying down faster.",icon:fe,title:"Loan payoff"},{calcId:"sequence-of-returns",desc:"Same average return, two orderings — why early bear markets do lasting damage.",icon:ge,title:"Sequence of returns"},{calcId:"roth-vs-ira",desc:"Roth vs Traditional contribution given the bracket now vs in retirement.",icon:ve,title:"Roth vs Traditional"},{calcId:"roth-cash-out",desc:"Convert now vs leave for heirs — tax cost today vs the heir’s 10-year tax.",icon:je,title:"Roth cash-out"},{calcId:"purpose-of-money",desc:"Allocate the portfolio by goal — income, protection, growth, legacy.",icon:Ie,title:"Purpose of money"},{calcId:"sale-vs-crut",desc:"Outright sale vs charitable remainder unitrust on an appreciated asset.",icon:ye,title:"Sale vs CRUT"}];function E({icon:f,title:g,desc:o,badge:c,cta:n,disabled:d,onClick:m}){const h=f;return a.jsxs("button",{type:"button",disabled:d===!0,onClick:m,className:["group flex h-full w-full flex-col items-start gap-3 rounded-[18px] border bg-obsidian-surface p-4 text-left transition-colors",d===!0?"cursor-not-allowed border-obsidian-line opacity-60":"border-obsidian-line hover:border-champagne/40"].join(" "),children:[a.jsxs("div",{className:"flex w-full items-start justify-between gap-2",children:[a.jsx("span",{className:"grid h-[32px] w-[32px] place-items-center rounded-lg text-champagne",style:{background:"rgb(var(--champ) / 0.10)",border:"1px solid rgb(var(--champ) / 0.26)"},children:a.jsx(h,{size:15,strokeWidth:1.8})}),c!==void 0&&a.jsx(X,{tone:c.tone,children:c.label})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"m-0 text-[13.5px] font-semibold text-obsidian-ink",children:g}),a.jsx("p",{className:"m-0 mt-0.5 text-[11.5px] leading-snug text-obsidian-ink-3",children:o})]}),a.jsx("span",{className:"mt-auto text-[11.5px] text-champagne",children:n})]})}function aa(){const f=K(),{orgId:g}=Q(),[o,c]=r.useState(""),[n,d]=r.useState(""),[m,h]=r.useState(null),[v,j]=r.useState(null),[D,k]=r.useState(!1),[I,R]=r.useState(null),[C,B]=r.useState(null),{data:y=[]}=_({queryKey:["whatif-all-scenarios"],queryFn:async()=>{const{data:e}=await V.from("retirement_scenarios").select("id, name, client_id, client_name").eq("is_archived",!1).order("created_at",{ascending:!1});return e??[]}}),p=r.useMemo(()=>{const e=new Map;for(const s of y)e.has(s.client_id)||e.set(s.client_id,s.client_name??"Client");return[...e.entries()].map(([s,t])=>({id:s,name:t}))},[y]),u=r.useMemo(()=>y.filter(e=>e.client_id===o),[y,o]);r.useEffect(()=>
1{if(p.length!==0){if(o===""){c(p[0].id);return}u.length>0&&!u.some(e=>e.id===n)&&d(u[0].id)}},[p,o,u,n]);const{data:$}=_({enabled:n!=="",queryKey:["whatif-signals",n],queryFn:()=>ce(n)}),i=$??se,M=ae(i),W=te(i),P=p.find(e=>e.id===o)?.name??null,x=u.find(e=>e.id===n)?.name??"base plan",l=n!=="",F=(i.traditionalIra??0)+(i.taxableAccounts??0)+(i.rothIra??0),H=(i.retirementExpenses??0)||(i.annualExpenses??0),U=F>0||H>0,G={age:i.age??void 0,iraBalance:i.traditionalIra??void 0,mortgageBalance:i.mortgageBalance??void 0,pensionMonthly:i.pensionAmount!==null?Math.round(i.pensionAmount/12):void 0,taxableBalance:i.taxableAccounts??void 0},O=async(e,s,t)=>{if(g===null){w.error("Organization not loaded.");return}if(n===""||o===""){w.error("Pick a client and base plan first.");return}B(s);try{const b=await ee(n,{clientName:P,householdId:o,name:e,orgId:g,...t?.assetsOverrides!==void 0?{assetsOverrides:t.assetsOverrides}:{},...t?.incomeOverrides!==void 0?{incomeOverrides:t.incomeOverrides}:{},...t?.addAnnualExpense!==void 0?{addAnnualExpense:t.addAnnualExpense}:{},...t?.annualExpenses!==void 0?{annualExpenses:t.annualExpenses}:{},...t?.retireAge!==void 0?{retireAge:t.retireAge}:{},...t?.roadmapOverrides!==void 0?{roadmapOverrides:t.roadmapOverrides}:{}});w.success(`Created "${e}".`),t!==void 0&&Object.keys(t).length>0?R({whatIfId:b,whatIfName:e}):f(`/retirement-roadmap/${b}`)}catch(b){w.error(b instanceof Error?b.message:"Could not create plan.")}finally{B(null)}},J=ie([...M.map(e=>({id:e.id,tier:e.tier})),...L.map(e=>({id:e.calcId,tier:W[e.calcId].tier}))],3),T=(e,s)=>{const t=J.has(e)?"recommended":s==="recommended"?"relevant":s;return t==="recommended"?{label:"Recommended",tone:"champagne"}:t==="relevant"?{label:"Relevant",tone:"neutral"}:void 0},N=p.length===0;return a.jsxs(Y,{children:[a.jsx(Z,{icon:xe,title:"What-If Scenarios",subtitle:"Build a what-if from any client plan, or run a standalone calculator. Each scenario copies the plan, flexes one assumption, and runs the real engines."}),a.jsxs(S,{padded:!1,children:[a.jsx("div",{className:"border-b border-obsidian-line px-5 py-3",children:a.jsx(A,{children:"Base plan for what-if scenarios"})}),N?a.jsxs("div",{className:"flex flex-col items-center gap-2 px-5 py-8 text-center",children:[a.jsx(he,{size:20,className:"text-obsidian-ink-4"}),a.jsx("p",{className:"m-0 text-[13px] text-obsidian-ink-2",children:"No saved plans yet"}),a.jsx("p",{className:"m-0 max-w-sm text-[12px] text-obsidian-ink-3",children:"Create a scenario for a client first — what-if scenarios copy from it. Standalone calculators below work without one."})]}):a.jsxs("div",{className:"grid grid-cols-1 gap-4 p-5 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"mb-1.5 text-[12.5px] font-medium text-obsidian-ink-2",children:"Client"}),a.jsx(q,{className:"w-full",options:p.map(e=>({label:e.name,value:e.id})),value:o,onChange:e=>{c(e),d("")}})]}),a.jsxs("div",{children:[a.jsx("div",{className:"mb-1.5 text-[12.5px] font-medium text-obsidian-ink-2",children:"Base plan"}),a.jsx(q,{className:"w-full",options:u.map(e=>({label:e.name,value:e.id})),value:n,onChange:e=>{d(e)}})]})]})]}),!N&&a.jsx(S,{children:a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg text-champagne",style:{background:"rgb(var(--champ) / 0.10)",border:"1px solid rgb(var(--champ) / 0.26)"},children:a.jsx(be,{size:17,strokeWidth:1.8})}),a.jsxs("div",{children:[a.jsx("h3",{className:"m-0 text-[14px] font-semibold text-obsidian-ink",children:"Describe a scenario in plain English"}),a.jsx("p",{className:"m-0 mt-0.5 max-w-[560px] text-[12px] text-obsidian-ink-3",children:"Combine several changes at once — “retire at 62, claim Social Security at 70, convert $50k to Roth, spend 10% less.” We map it to the engines and build one what-if."})]})]}),a.jsxs("button",{type:"button",disabled:!l,onClick:()=>{k(!0)},className:"inline-flex shrink-0 items-center gap-2 rounded-lg px-4 py-2 text-[12.5px] font-semibold text-[rgb(var(--champ-ink))] disabled:opacity-50",style:{background:"linear-gradient(135deg, rgb(var(--champ-light)) 0%, rgb(var(--champ)) 45%, rgb(var(--champ-dark)) 100%)",cursor:l?"pointer":"not-allowed"},children:[a.jsx(z,{size:14})," ",l?"Open AI builder":"Select a client first"]})]})}),a.jsxs(S,{padded:!1,className:"overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-obsidian-line px-5 py-3",children:[a.jsx(A,{children:"What-if scenarios"}),l&&a.jsxs("span",{className:"text-[11px] text-obsidian-ink-4",children:["copies ",a.jsx("span",{className:"text-obsidian-ink-2",children:x})]})]}),!l&&!N&&a.jsx("div",{className:"border-b border-obsidian-line bg-obsidian-surface-2/40 px-5 py-2.5 text-[12px] text-obsidian-ink-3",children:"Pick a client and base plan above to enable these — each builds a real modified copy of the plan."}),a.jsxs("div",{className:"grid grid-cols-1 gap-3 p-5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:[M.map(e=>{const s=e.requiresData===!0&&l&&!U,t=!l||s;
1return a.jsx(E,{icon:e.icon,title:e.title,desc:e.desc,badge:l?T(e.id,e.tier):void 0,cta:l?s?"Add plan data first":"Customize →":"Select a client",disabled:t,onClick:()=>{h(e)}},e.id)}),L.map(e=>a.jsx(E,{icon:e.icon,title:e.title,desc:e.desc,badge:l?T(e.calcId,W[e.calcId].tier):void 0,cta:l?"Run & build →":"Select a client",disabled:!l,onClick:()=>{j({buildable:!0,id:e.calcId,title:e.title})}},e.calcId))]})]}),a.jsxs(S,{padded:!1,className:"overflow-hidden",children:[a.jsx("div",{className:"border-b border-obsidian-line px-5 py-3",children:a.jsx(A,{children:"Standalone calculators"})}),a.jsx("div",{className:"grid grid-cols-1 gap-3 p-5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:Ne.map(e=>a.jsx(E,{icon:e.icon,title:e.title,desc:e.desc,cta:"Open →",onClick:()=>{j({buildable:!1,id:e.calcId,title:e.title})}},e.calcId))})]}),I!==null&&a.jsx(ne,{baseId:n,baseName:x,whatIfId:I.whatIfId,whatIfName:I.whatIfName,clientName:P??"Client",onOpenPlan:()=>{f(`/retirement-roadmap/${I.whatIfId}`)},onClose:()=>{R(null)}}),D&&a.jsx(le,{sig:i,baseName:x,building:C==="ai",onClose:()=>{k(!1)},onBuild:(e,s)=>{O(e,"ai",s).then(()=>{k(!1)})}}),m!==null&&a.jsx(oe,{lever:m,baseName:x,building:C===`lever-${m.id}`,onClose:()=>{h(null)},onBuild:(e,s)=>{O(e,`lever-${m.id}`,s).then(()=>{h(null)})}}),v!==null&&a.jsx(re,{calcId:v.id,baseName:x,prefill:G,building:C==="calc",onClose:()=>{j(null)},...v.buildable&&l?{onBuildScenario:e=>{O(`${v.title} — ${x}`,"calc",e).then(()=>{j(null)})}}:{}}),!N&&a.jsxs("p",{className:"px-1 text-[11px] text-obsidian-ink-4",children:[a.jsx(z,{size:11,className:"mb-0.5 mr-1 inline text-champagne"}),"Want to combine several changes at once (retire later ",a.jsx("span",{className:"text-obsidian-ink-3",children:"and"})," claim SS at 70 ",a.jsx("span",{className:"text-obsidian-ink-3",children:"and"})," convert to Roth)? The client What-If tab adds plan comparison + a value-of-advice PDF."]})]})}export{aa 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.