(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{22363:function(e,s,a){Promise.resolve().then(a.bind(a,50341))},50341:function(e,s,a){"use strict";a.r(s),a.d(s,{default:function(){return sg}});var t=a(57437),n=a(2265),l=a(41312),i=a(61994),r=a(53335);function c(...e){return(0,r.m6)((0,i.W)(e))}let d=l.fC,m=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)(l.aV,{ref:a,className:c("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...s}));m.displayName=l.aV.displayName;let o=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)(l.xz,{ref:a,className:c("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...s}));o.displayName=l.xz.displayName;let x=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)(l.VY,{ref:a,className:c("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...s}));x.displayName=l.VY.displayName;let h=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)("div",{ref:a,className:c("rounded-lg border bg-card text-card-foreground shadow-sm",e),...s}));h.displayName="Card";let u=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)("div",{ref:a,className:c("flex flex-col space-y-1.5 p-6",e),...s}));u.displayName="CardHeader";let p=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)("h3",{ref:a,className:c("text-2xl font-semibold leading-none tracking-tight",e),...s}));p.displayName="CardTitle",n.forwardRef(({className:e,...s},a)=>(0,t.jsx)("p",{ref:a,className:c("text-sm text-muted-foreground",e),...s})).displayName="CardDescription";let j=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)("div",{ref:a,className:c("p-6 pt-0",e),...s}));j.displayName="CardContent",n.forwardRef(({className:e,...s},a)=>(0,t.jsx)("div",{ref:a,className:c("flex items-center p-6 pt-0",e),...s})).displayName="CardFooter";var g=a(37053),v=a(77712);let f=(0,v.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),y=n.forwardRef(({className:e,variant:s,size:a,asChild:n=!1,...l},i)=>{let r=n?g.g7:"button";return(0,t.jsx)(r,{className:c(f({variant:s,size:a,className:e})),ref:i,...l})});y.displayName="Button";let N=n.forwardRef(({className:e,type:s,...a},n)=>(0,t.jsx)("input",{type:s,className:c("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...a}));N.displayName="Input";var b=a(6394);let _=(0,v.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),w=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)(b.f,{ref:a,className:c(_(),e),...s}));w.displayName=b.f.displayName;var C=a(60141),F=a(40875),k=a(22135),M=a(30401);let Z=C.fC;C.ZA;let A=C.B4,S=n.forwardRef(({className:e,children:s,...a},n)=>(0,t.jsxs)(C.xz,{ref:n,className:c("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...a,children:[s,(0,t.jsx)(C.JO,{asChild:!0,children:(0,t.jsx)(F.Z,{className:"h-4 w-4 opacity-50"})})]}));S.displayName=C.xz.displayName;let $=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)(C.u_,{ref:a,className:c("flex cursor-default items-center justify-center py-1",e),...s,children:(0,t.jsx)(k.Z,{className:"h-4 w-4"})}));$.displayName=C.u_.displayName;let D=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)(C.$G,{ref:a,className:c("flex cursor-default items-center justify-center py-1",e),...s,children:(0,t.jsx)(F.Z,{className:"h-4 w-4"})}));D.displayName=C.$G.displayName;let G=n.forwardRef(({className:e,children:s,position:a="popper",...n},l)=>(0,t.jsx)(C.h_,{children:(0,t.jsxs)(C.VY,{ref:l,className:c("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...n,children:[(0,t.jsx)($,{}),(0,t.jsx)(C.l_,{className:c("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),(0,t.jsx)(D,{})]})}));G.displayName=C.VY.displayName,n.forwardRef(({className:e,...s},a)=>(0,t.jsx)(C.__,{ref:a,className:c("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...s})).displayName=C.__.displayName;let I=n.forwardRef(({className:e,children:s,...a},n)=>(0,t.jsxs)(C.ck,{ref:n,className:c("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(C.wU,{children:(0,t.jsx)(M.Z,{className:"h-4 w-4"})})}),(0,t.jsx)(C.eT,{children:s})]}));I.displayName=C.ck.displayName,n.forwardRef(({className:e,...s},a)=>(0,t.jsx)(C.Z0,{ref:a,className:c("-mx-1 my-1 h-px bg-muted",e),...s})).displayName=C.Z0.displayName;let P=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)("textarea",{className:c("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...s}));P.displayName="Textarea";var R=a(13134);let T=R.fC,E=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)(R.ck,{ref:a,className:c("border-b",e),...s}));E.displayName="AccordionItem";let z=n.forwardRef(({className:e,children:s,...a},n)=>(0,t.jsx)(R.h4,{className:"flex",children:(0,t.jsxs)(R.xz,{ref:n,className:c("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...a,children:[s,(0,t.jsx)(F.Z,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));z.displayName=R.xz.displayName;let O=n.forwardRef(({className:e,children:s,...a},n)=>(0,t.jsx)(R.VY,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...a,children:(0,t.jsx)("div",{className:c("pb-4 pt-0",e),children:s})}));O.displayName=R.VY.displayName;let B=(0,v.j)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function V({className:e,variant:s,...a}){return(0,t.jsx)("div",{className:c(B({variant:s}),e),...a})}var L=a(95252),H=a(18930),K=a(14938),U=a(99397),Q=a(49232),Y=a(70525),W=a(76865),q=a(16275),X=a(40370),J=a(98420),ee=a(96215),es=a(58896),ea=a(3085),et=a(53752),en=a(51487),el=a(565);function ei({receipt:e,onUpdate:s,onRemove:a}){return(0,t.jsx)(h,{className:"mb-4",children:(0,t.jsxs)(j,{className:"p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`ls-name-${e.id}`,children:"Name"}),(0,t.jsx)(N,{id:`ls-name-${e.id}`,value:e.name,onChange:e=>s({name:e.target.value}),placeholder:"Bonus, Gift, etc"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`ls-amount-${e.id}`,children:"Amount ($)"}),(0,t.jsx)(N,{id:`ls-amount-${e.id}`,type:"number",value:e.amount,onChange:e=>s({amount:parseFloat(e.target.value)||0}),placeholder:"0"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{children:"Date (YYYY-MM)"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(N,{type:"number",value:e.date.year,onChange:a=>s({date:{...e.date,year:parseInt(a.target.value)}}),className:"w-24",placeholder:"Year"}),(0,t.jsx)(N,{type:"number",value:e.date.month,onChange:a=>s({date:{...e.date,month:parseInt(a.target.value)}}),className:"w-20",placeholder:"Mo"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`ls-source-${e.id}`,children:"Source"}),(0,t.jsx)(N,{id:`ls-source-${e.id}`,value:e.source||"",onChange:e=>s({source:e.target.value}),placeholder:"Employer, IRS, etc"})]})]}),(0,t.jsx)("div",{className:"flex justify-end mt-4",children:(0,t.jsxs)(y,{variant:"destructive",size:"sm",onClick:a,children:[(0,t.jsx)(H.Z,{className:"h-4 w-4 mr-2"})," Remove"]})})]})})}function er({category:e,onUpdate:s,onRemove:a}){return(0,t.jsx)(h,{className:"mb-4",children:(0,t.jsx)(j,{className:"p-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`expense-name-${e.id}`,children:"Category Name"}),(0,t.jsx)(N,{id:`expense-name-${e.id}`,value:e.name,onChange:e=>s({name:e.target.value}),placeholder:"Expense category"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`expense-amount-${e.id}`,children:"Monthly Amount"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`expense-amount-${e.id}`,type:"number",value:e.base_amount,onChange:e=>s({base_amount:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`expense-type-${e.id}`,children:"Type"}),(0,t.jsxs)(Z,{value:e.type,onValueChange:e=>s({type:e}),children:[(0,t.jsx)(S,{children:(0,t.jsx)(A,{})}),(0,t.jsxs)(G,{children:[(0,t.jsx)(I,{value:"fixed",children:"Fixed"}),(0,t.jsx)(I,{value:"variable",children:"Variable"}),(0,t.jsx)(I,{value:"discretionary",children:"Discretionary"})]})]})]}),(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsxs)(y,{variant:"destructive",size:"sm",onClick:a,className:"w-full",children:[(0,t.jsx)(H.Z,{className:"h-4 w-4 mr-2"}),"Remove"]})})]})})})}function ec({source:e,onUpdate:s,onRemove:a}){let n=a=>{let t=a*(1-(e.tax_rate||25)/100);s({gross_amount:a,net_amount:t,base_amount:t})},l=a=>{s({gross_amount:a/(1-(e.tax_rate||25)/100),net_amount:a,base_amount:a})},i=a=>{let t=(e.gross_amount||0)*(1-a/100);s({tax_rate:a,net_amount:t,base_amount:t})};return(0,t.jsx)(h,{className:"mb-4",children:(0,t.jsx)(j,{className:"p-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-6 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`income-name-${e.id}`,children:"Name"}),(0,t.jsx)(N,{id:`income-name-${e.id}`,value:e.name,onChange:e=>s({name:e.target.value}),placeholder:"Income source name"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`income-gross-${e.id}`,children:"Monthly Gross"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`income-gross-${e.id}`,type:"number",value:e.gross_amount||0,onChange:e=>n(parseFloat(e.target.value)||0),className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`income-tax-rate-${e.id}`,children:"Tax Rate (%)"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(N,{id:`income-tax-rate-${e.id}`,type:"number",step:"0.1",value:e.tax_rate||25,onChange:e=>i(parseFloat(e.target.value)||25),placeholder:"25.0"}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 mt-1",children:["Tax: ",(0,el.xG)((e.gross_amount||0)*((e.tax_rate||25)/100))]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`income-net-${e.id}`,children:"Monthly Net"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`income-net-${e.id}`,type:"number",value:e.net_amount||0,onChange:e=>l(parseFloat(e.target.value)||0),className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`income-type-${e.id}`,children:"Type"}),(0,t.jsxs)(Z,{value:e.type,onValueChange:e=>s({type:e}),children:[(0,t.jsx)(S,{children:(0,t.jsx)(A,{})}),(0,t.jsxs)(G,{children:[(0,t.jsx)(I,{value:"salary",children:"Salary"}),(0,t.jsx)(I,{value:"business",children:"Business"}),(0,t.jsx)(I,{value:"investment",children:"Investment"}),(0,t.jsx)(I,{value:"bonus",children:"Bonus"}),(0,t.jsx)(I,{value:"other",children:"Other"})]})]})]}),(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsxs)(y,{variant:"destructive",size:"sm",onClick:a,className:"w-full",children:[(0,t.jsx)(H.Z,{className:"h-4 w-4 mr-2"}),"Remove"]})})]})})})}function ed({housing:e,cash:s,onUpdateHousing:a,onUpdateCash:n}){return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsxs)(p,{className:"flex items-center",children:[(0,t.jsx)(K.Z,{className:"h-5 w-5 mr-2"}),"Home Purchase Details"]})}),(0,t.jsx)(j,{className:"space-y-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"home-price",children:"Home Price"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:"home-price",type:"number",value:e.home_price,onChange:e=>a({home_price:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"400000"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"down-percent",children:"Down Payment (%)"}),(0,t.jsx)(N,{id:"down-percent",type:"number",step:"0.1",value:e.down_pct,onChange:e=>a({down_pct:parseFloat(e.target.value)||0}),placeholder:"20"}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 mt-1",children:["Amount: ",(0,el.xG)((e.home_price||0)*(e.down_pct||0)/100)]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"interest-rate",children:"Interest Rate (%)"}),(0,t.jsx)(N,{id:"interest-rate",type:"number",step:"0.01",value:e.interest_rate,onChange:e=>a({interest_rate:parseFloat(e.target.value)||0}),placeholder:"6.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"loan-term",children:"Loan Term (Years)"}),(0,t.jsx)(N,{id:"loan-term",type:"number",value:e.loan_term,onChange:e=>a({loan_term:parseFloat(e.target.value)||30}),placeholder:"30"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"property-tax",children:"Property Tax Rate (%)"}),(0,t.jsx)(N,{id:"property-tax",type:"number",step:"0.01",value:e.property_tax_rate,onChange:e=>a({property_tax_rate:parseFloat(e.target.value)||0}),placeholder:"1.2"}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 mt-1",children:["Monthly: ",(0,el.xG)((e.home_price||0)*(e.property_tax_rate||0)/100/12)]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"insurance",children:"Insurance (Monthly)"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:"insurance",type:"number",value:e.insurance_monthly,onChange:e=>a({insurance_monthly:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"150"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"pmi-rate",children:"PMI Rate (%)"}),(0,t.jsx)(N,{id:"pmi-rate",type:"number",step:"0.01",value:e.pmi_rate,onChange:e=>a({pmi_rate:parseFloat(e.target.value)||0}),placeholder:"0.5"}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 mt-1",children:["Monthly: ",(0,el.xG)((e.home_price||0)*(1-(e.down_pct||20)/100)*(e.pmi_rate||0)/100/12)]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"hoa",children:"HOA (Monthly)"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:"hoa",type:"number",value:e.hoa_monthly,onChange:e=>a({hoa_monthly:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"50"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"maintenance",children:"Maintenance (%/year)"}),(0,t.jsx)(N,{id:"maintenance",type:"number",step:"0.1",value:e.maintenance_pct,onChange:e=>a({maintenance_pct:parseFloat(e.target.value)||0}),placeholder:"1.0"}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 mt-1",children:["Monthly: ",(0,el.xG)((e.home_price||0)*(e.maintenance_pct||0)/100/12)]})]})]})})]}),(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsxs)(p,{className:"flex items-center",children:[(0,t.jsx)(L.Z,{className:"h-5 w-5 mr-2"}),"Cash & Closing Costs"]})}),(0,t.jsx)(j,{className:"space-y-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"initial-cash",children:"Initial Cash Available"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:"initial-cash",type:"number",value:s.initial_cash,onChange:e=>n({initial_cash:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"100000"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"current-rent",children:"Current Rent"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:"current-rent",type:"number",value:s.current_rent,onChange:e=>n({current_rent:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"2000"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"closing-cost-price",children:"Closing Costs (% of Price)"}),(0,t.jsx)(N,{id:"closing-cost-price",type:"number",step:"0.1",value:s.closing_cost_pct_price,onChange:e=>n({closing_cost_pct_price:parseFloat(e.target.value)||0}),placeholder:"2.5"}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 mt-1",children:["Amount: ",(0,el.xG)((e.home_price||0)*(s.closing_cost_pct_price||0)/100)]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"closing-cost-loan",children:"Closing Costs (% of Loan)"}),(0,t.jsx)(N,{id:"closing-cost-loan",type:"number",step:"0.1",value:s.closing_cost_pct_loan,onChange:e=>n({closing_cost_pct_loan:parseFloat(e.target.value)||0}),placeholder:"1.0"}),(0,t.jsxs)("div",{className:"text-xs text-gray-500 mt-1",children:["Amount: ",(0,el.xG)((e.home_price||0)*(1-(e.down_pct||20)/100)*(s.closing_cost_pct_loan||0)/100)]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"escrow-months",children:"Escrow Months"}),(0,t.jsx)(N,{id:"escrow-months",type:"number",value:s.escrow_months,onChange:e=>n({escrow_months:parseFloat(e.target.value)||0}),placeholder:"3"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"emergency-months",children:"Emergency Fund (Months)"}),(0,t.jsx)(N,{id:"emergency-months",type:"number",value:s.emergency_fund_months,onChange:e=>n({emergency_fund_months:parseFloat(e.target.value)||6}),placeholder:"6"})]})]})})]})]})}function em({investment:e,onUpdate:s,onRemove:a}){let n=(a,t)=>{let n=[...e.ticker_symbols||[]];n[a]={...n[a],...t},s({ticker_symbols:n})},l=a=>{let t=[...e.ticker_symbols||[]];t.splice(a,1),s({ticker_symbols:t})},i=(a,t)=>{let n=[...e.precious_metals||[]],l={...n[a],...t};l.total_value=l.ounces_owned*l.current_price_per_ounce,n[a]=l,s({precious_metals:n})},r=a=>{let t=[...e.precious_metals||[]];t.splice(a,1),s({precious_metals:t})};return(0,t.jsx)(h,{className:"mb-4",children:(0,t.jsxs)(j,{className:"p-4",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`investment-name-${e.id}`,children:"Investment Name"}),(0,t.jsx)(N,{id:`investment-name-${e.id}`,value:e.name,onChange:e=>s({name:e.target.value}),placeholder:"Investment account name"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`investment-type-${e.id}`,children:"Account Type"}),(0,t.jsxs)(Z,{value:e.type,onValueChange:e=>s({type:e}),children:[(0,t.jsx)(S,{children:(0,t.jsx)(A,{})}),(0,t.jsxs)(G,{children:[(0,t.jsx)(I,{value:"401k",children:"401(k)"}),(0,t.jsx)(I,{value:"ira",children:"Traditional IRA"}),(0,t.jsx)(I,{value:"roth_ira",children:"Roth IRA"}),(0,t.jsx)(I,{value:"stocks",children:"Stock Portfolio"}),(0,t.jsx)(I,{value:"bonds",children:"Bonds"}),(0,t.jsx)(I,{value:"savings",children:"High-Yield Savings"}),(0,t.jsx)(I,{value:"precious_metals",children:"Precious Metals"}),(0,t.jsx)(I,{value:"other",children:"Other"})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`investment-value-${e.id}`,children:"Current Value"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`investment-value-${e.id}`,type:"number",value:e.current_value,onChange:e=>s({current_value:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`investment-contribution-${e.id}`,children:"Monthly Contribution"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`investment-contribution-${e.id}`,type:"number",value:e.monthly_contribution,onChange:e=>s({monthly_contribution:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0"})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:["401k"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`investment-match-${e.id}`,children:"Employer Match"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`investment-match-${e.id}`,type:"number",value:e.employer_match||0,onChange:e=>s({employer_match:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`investment-return-${e.id}`,children:"Annual Return Rate (%)"}),(0,t.jsx)(N,{id:`investment-return-${e.id}`,type:"number",step:"0.1",value:e.annual_return_rate,onChange:e=>s({annual_return_rate:parseFloat(e.target.value)||0}),placeholder:"7.0"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`investment-risk-${e.id}`,children:"Risk Level"}),(0,t.jsxs)(Z,{value:e.risk_level,onValueChange:e=>s({risk_level:e}),children:[(0,t.jsx)(S,{children:(0,t.jsx)(A,{})}),(0,t.jsxs)(G,{children:[(0,t.jsx)(I,{value:"low",children:"Low Risk"}),(0,t.jsx)(I,{value:"medium",children:"Medium Risk"}),(0,t.jsx)(I,{value:"high",children:"High Risk"})]})]})]})]}),"stocks"===e.type&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)(w,{className:"text-base font-semibold",children:"Stock Holdings"}),(0,t.jsxs)(y,{size:"sm",onClick:()=>{let a=e.ticker_symbols||[];if(a.length>=10){alert("Maximum 10 ticker symbols allowed per investment");return}s({ticker_symbols:[...a,{symbol:"",current_price:0,shares_owned:0,last_updated:{year:new Date().getFullYear(),month:new Date().getMonth()+1}}]})},disabled:(e.ticker_symbols?.length||0)>=10,children:[(0,t.jsx)(U.Z,{className:"h-4 w-4 mr-2"}),"Add Stock"]})]}),e.ticker_symbols?.map((e,s)=>t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4 p-4 border rounded-lg",children:[t.jsxs("div",{children:[t.jsx(w,{children:"Ticker Symbol"}),t.jsx(N,{value:e.symbol,onChange:e=>n(s,{symbol:e.target.value.toUpperCase()}),placeholder:"AAPL"})]}),t.jsxs("div",{children:[t.jsx(w,{children:"Current Price"}),t.jsxs("div",{className:"relative",children:[t.jsx(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx(N,{type:"number",step:"0.01",value:e.current_price,onChange:e=>n(s,{current_price:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0.00"})]})]}),t.jsxs("div",{children:[t.jsx(w,{children:"Shares Owned"}),t.jsx(N,{type:"number",value:e.shares_owned||0,onChange:e=>n(s,{shares_owned:parseFloat(e.target.value)||0}),placeholder:"0"})]}),t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"text-sm",children:[t.jsx(w,{children:"Total Value"}),t.jsx("div",{className:"font-semibold text-green-600",children:el.xG((e.shares_owned||0)*e.current_price)})]})}),t.jsx("div",{className:"flex items-end",children:t.jsx(y,{variant:"destructive",size:"sm",onClick:()=>l(s),children:t.jsx(H.Z,{className:"h-4 w-4"})})})]},s))]}),"precious_metals"===e.type&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)(w,{className:"text-base font-semibold",children:"Precious Metals Holdings"}),(0,t.jsxs)(y,{size:"sm",onClick:()=>{let a=e.precious_metals||[];if(a.length>=5){alert("Maximum 5 precious metals allowed per investment");return}s({precious_metals:[...a,{id:`metal_${Date.now()}`,type:"gold",ounces_owned:0,current_price_per_ounce:0,total_value:0,last_updated:{year:new Date().getFullYear(),month:new Date().getMonth()+1}}]})},disabled:(e.precious_metals?.length||0)>=5,children:[(0,t.jsx)(Q.Z,{className:"h-4 w-4 mr-2"}),"Add Metal"]})]}),e.precious_metals?.map((e,s)=>t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-6 gap-4 p-4 border rounded-lg",children:[t.jsxs("div",{children:[t.jsx(w,{children:"Metal Type"}),t.jsxs(Z,{value:e.type,onValueChange:e=>i(s,{type:e}),children:[t.jsx(S,{children:t.jsx(A,{})}),t.jsxs(G,{children:[t.jsx(I,{value:"gold",children:"Gold"}),t.jsx(I,{value:"silver",children:"Silver"}),t.jsx(I,{value:"platinum",children:"Platinum"}),t.jsx(I,{value:"palladium",children:"Palladium"})]})]})]}),t.jsxs("div",{children:[t.jsx(w,{children:"Ounces Owned"}),t.jsx(N,{type:"number",step:"0.1",value:e.ounces_owned,onChange:e=>i(s,{ounces_owned:parseFloat(e.target.value)||0}),placeholder:"0.0"})]}),t.jsxs("div",{children:[t.jsx(w,{children:"Price per Ounce"}),t.jsxs("div",{className:"relative",children:[t.jsx(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx(N,{type:"number",step:"0.01",value:e.current_price_per_ounce,onChange:e=>i(s,{current_price_per_ounce:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0.00"})]})]}),t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"text-sm",children:[t.jsx(w,{children:"Total Value"}),t.jsx("div",{className:"font-semibold text-yellow-600",children:el.xG(e.total_value)})]})}),t.jsx("div",{className:"flex items-end",children:t.jsx(y,{variant:"destructive",size:"sm",onClick:()=>r(s),children:t.jsx(H.Z,{className:"h-4 w-4"})})})]},s))]})]}),(0,t.jsx)("div",{className:"flex justify-end mt-6",children:(0,t.jsxs)(y,{variant:"destructive",size:"sm",onClick:a,children:[(0,t.jsx)(H.Z,{className:"h-4 w-4 mr-2"}),"Remove Investment"]})})]})})}function eo({asset:e,onUpdate:s,onRemove:a}){return(0,t.jsx)(h,{className:"mb-4",children:(0,t.jsxs)(j,{className:"p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`asset-name-${e.id}`,children:"Asset Name"}),(0,t.jsx)(N,{id:`asset-name-${e.id}`,value:e.name,onChange:e=>s({name:e.target.value}),placeholder:"Asset name"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`asset-type-${e.id}`,children:"Asset Type"}),(0,t.jsxs)(Z,{value:e.type,onValueChange:e=>s({type:e}),children:[(0,t.jsx)(S,{children:(0,t.jsx)(A,{})}),(0,t.jsxs)(G,{children:[(0,t.jsx)(I,{value:"home",children:"Home"}),(0,t.jsx)(I,{value:"vehicle",children:"Vehicle"}),(0,t.jsx)(I,{value:"real_estate",children:"Real Estate"}),(0,t.jsx)(I,{value:"collectible",children:"Collectible"}),(0,t.jsx)(I,{value:"other",children:"Other"})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`asset-value-${e.id}`,children:"Current Value"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`asset-value-${e.id}`,type:"number",value:e.current_value,onChange:e=>s({current_value:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`asset-purchase-price-${e.id}`,children:"Purchase Price"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`asset-purchase-price-${e.id}`,type:"number",value:e.purchase_price||0,onChange:e=>s({purchase_price:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0"})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`asset-appreciation-${e.id}`,children:"Appreciation Rate (%/year)"}),(0,t.jsx)(N,{id:`asset-appreciation-${e.id}`,type:"number",step:"0.1",value:e.appreciation_rate||0,onChange:e=>s({appreciation_rate:parseFloat(e.target.value)||0}),placeholder:"3.0"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`asset-monthly-payment-${e.id}`,children:"Monthly Payment (if financed)"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`asset-monthly-payment-${e.id}`,type:"number",value:e.monthly_payment||0,onChange:e=>s({monthly_payment:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`asset-loan-balance-${e.id}`,children:"Loan Balance"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`asset-loan-balance-${e.id}`,type:"number",value:e.loan_balance||0,onChange:e=>s({loan_balance:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0"})]})]})]}),(0,t.jsx)("div",{className:"flex justify-end mt-4",children:(0,t.jsxs)(y,{variant:"destructive",size:"sm",onClick:a,children:[(0,t.jsx)(H.Z,{className:"h-4 w-4 mr-2"}),"Remove Asset"]})})]})})}function ex({expense:e,onUpdate:s,onRemove:a}){return(0,t.jsx)(h,{className:"mb-4",children:(0,t.jsxs)(j,{className:"p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`lump-name-${e.id}`,children:"Expense Name"}),(0,t.jsx)(N,{id:`lump-name-${e.id}`,value:e.name,onChange:e=>s({name:e.target.value}),placeholder:"Expense name"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`lump-amount-${e.id}`,children:"Amount"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`lump-amount-${e.id}`,type:"number",value:e.amount,onChange:e=>s({amount:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`lump-date-${e.id}`,children:"Date"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,t.jsx)(N,{type:"number",value:e.date.month,onChange:a=>s({date:{...e.date,month:parseInt(a.target.value)||1}}),placeholder:"Month",min:"1",max:"12"}),(0,t.jsx)(N,{type:"number",value:e.date.year,onChange:a=>s({date:{...e.date,year:parseInt(a.target.value)||2025}}),placeholder:"Year",min:"2024",max:"2030"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`lump-category-${e.id}`,children:"Category"}),(0,t.jsxs)(Z,{value:e.category,onValueChange:e=>s({category:e}),children:[(0,t.jsx)(S,{children:(0,t.jsx)(A,{})}),(0,t.jsxs)(G,{children:[(0,t.jsx)(I,{value:"vacation",children:"Vacation"}),(0,t.jsx)(I,{value:"home_improvement",children:"Home Improvement"}),(0,t.jsx)(I,{value:"medical",children:"Medical"}),(0,t.jsx)(I,{value:"education",children:"Education"}),(0,t.jsx)(I,{value:"emergency",children:"Emergency"}),(0,t.jsx)(I,{value:"other",children:"Other"})]})]})]}),(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsxs)(y,{variant:"destructive",size:"sm",onClick:a,className:"w-full",children:[(0,t.jsx)(H.Z,{className:"h-4 w-4 mr-2"}),"Remove"]})})]}),e.description&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)(w,{htmlFor:`lump-description-${e.id}`,children:"Description"}),(0,t.jsx)(P,{id:`lump-description-${e.id}`,value:e.description||"",onChange:e=>s({description:e.target.value}),placeholder:"Optional description",rows:2})]})]})})}function eh({housingData:e,cashData:s,projections:a}){let n=a?.[0];if(!n)return(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsxs)(p,{className:"flex items-center text-lg",children:[(0,t.jsx)(Y.Z,{className:"h-5 w-5 mr-2"}),"Affordability Analysis"]})}),(0,t.jsx)(j,{children:(0,t.jsx)("div",{className:"text-center text-gray-500 py-4",children:"No projection data available. Please ensure you have configured income and expenses."})})]});let l=e.home_price*(e.down_pct/100),i=e.home_price*(s.closing_cost_pct_price/100),r=(0,el.xZ)(e,s),c=s.current_rent,d=r.total-c,m=(r.tax+r.insurance+r.hoa)*s.escrow_months,o=l+i+m,x=s.initial_cash,g=x-o,v=r.total/n.gross_income*100,f=(r.total+n.debt_payments)/n.gross_income*100,y=g>=0&&v<=28&&f<=36;return(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsxs)(p,{className:"flex items-center text-lg",children:[(0,t.jsx)(Y.Z,{className:"h-5 w-5 mr-2"}),"Affordability Analysis"]})}),(0,t.jsxs)(j,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-medium text-sm",children:"Cash Requirements"}),(0,t.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("span",{children:["Down Payment (",e.down_pct,"%):"]}),(0,t.jsx)("span",{children:(0,el.xG)(l)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Closing Costs:"}),(0,t.jsx)("span",{children:(0,el.xG)(i)})]}),(0,t.jsxs)("div",{className:"flex justify-between font-medium border-t pt-1",children:[(0,t.jsx)("span",{children:"Total Cash to Close:"}),(0,t.jsx)("span",{children:(0,el.xG)(o)})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-medium text-sm",children:"Cash Position"}),(0,t.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Initial Cash:"}),(0,t.jsx)("span",{children:(0,el.xG)(x)})]}),(0,t.jsxs)("div",{className:"flex justify-between text-gray-600",children:[(0,t.jsx)("span",{className:"ml-2",children:"- Down Payment:"}),(0,t.jsxs)("span",{children:["-",(0,el.xG)(l)]})]}),(0,t.jsxs)("div",{className:"flex justify-between text-gray-600",children:[(0,t.jsx)("span",{className:"ml-2",children:"- Closing Costs:"}),(0,t.jsxs)("span",{children:["-",(0,el.xG)(i)]})]}),(0,t.jsxs)("div",{className:"flex justify-between text-gray-600",children:[(0,t.jsxs)("span",{className:"ml-2",children:["- Escrow (",s.escrow_months," months):"]}),(0,t.jsxs)("span",{children:["-",(0,el.xG)(m)]})]}),(0,t.jsxs)("div",{className:"flex justify-between border-t pt-1 font-medium",children:[(0,t.jsx)("span",{children:"Cash After Purchase:"}),(0,t.jsx)("span",{className:g>=0?"text-green-600":"text-red-600",children:(0,el.xG)(g)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Emergency Fund:"}),(0,t.jsxs)("span",{children:[n.total_expenses>0?(g/n.total_expenses).toFixed(1):"0.0"," months"]})]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-medium text-sm",children:"Monthly Payment Impact"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Current Rent:"}),(0,t.jsx)("span",{children:(0,el.xG)(c)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"New Housing Payment:"}),(0,t.jsx)("span",{children:(0,el.xG)(r.total)})]}),(0,t.jsxs)("div",{className:"flex justify-between font-medium border-t pt-1",children:[(0,t.jsx)("span",{children:"Net Change:"}),(0,t.jsxs)("span",{className:d>=0?"text-red-600":"text-green-600",children:[d>=0?"+":"",(0,el.xG)(d)]})]})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Principal & Interest:"}),(0,t.jsx)("span",{children:(0,el.xG)(r.pi)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Taxes & Insurance:"}),(0,t.jsx)("span",{children:(0,el.xG)(r.tax+r.insurance+r.pmi)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"HOA & Maintenance:"}),(0,t.jsx)("span",{children:(0,el.xG)(r.hoa+r.maintenance)})]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-medium text-sm",children:"Debt-to-Income Ratios"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,t.jsx)("span",{children:"Front-end DTI:"}),(0,t.jsxs)(V,{variant:v<=28?"default":"destructive",className:"text-xs",children:[v.toFixed(1),"%"]})]}),(0,t.jsx)("div",{className:"text-xs text-gray-600",children:"Housing payment only (target: ≤28%)"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,t.jsx)("span",{children:"Back-end DTI:"}),(0,t.jsxs)(V,{variant:f<=36?"default":"destructive",className:"text-xs",children:[f.toFixed(1),"%"]})]}),(0,t.jsx)("div",{className:"text-xs text-gray-600",children:"All debt payments (target: ≤36%)"})]})]})]}),(0,t.jsxs)("div",{className:"mt-6 p-4 rounded-lg border",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-2",children:[y?(0,t.jsx)(M.Z,{className:"h-5 w-5 text-green-600"}):(0,t.jsx)(W.Z,{className:"h-5 w-5 text-red-600"}),(0,t.jsx)("span",{className:`font-medium ${y?"text-green-600":"text-red-600"}`,children:y?"Purchase Recommended":"Purchase Not Recommended"})]}),(0,t.jsx)("div",{className:"text-sm text-gray-600",children:y?"All financial metrics meet recommended guidelines for home purchase.":"Some financial metrics exceed recommended guidelines. Consider adjusting parameters."})]})]})]})}function eu({defaultTab:e="income"}){let{state:s,updateFinancialData:a,dispatch:l,autoSave:i,projections:r}=(0,et.O)(),[c,g]=(0,n.useState)(e);if(!s.current_config)return(0,t.jsx)("div",{children:"Loading..."});let v=s.current_config.data,f=e=>{a(e),i()},b=(e,s)=>{f({income_sources:v.income_sources.map(a=>a.id===e?{...a,...s}:a)})},_=(e,s)=>{f({expense_categories:v.expense_categories.map(a=>a.id===e?{...a,...s}:a)})},C=e=>{l({type:"REMOVE_INCOME_SOURCE",payload:e})},F=e=>{l({type:"REMOVE_EXPENSE_CATEGORY",payload:e})},k=(e,s)=>{f({investment_accounts:v.investment_accounts.map(a=>a.id===e?{...a,...s}:a)})},M=e=>{l({type:"REMOVE_INVESTMENT_ACCOUNT",payload:e})},Z=(e,s)=>{f({assets:v.assets.map(a=>a.id===e?{...a,...s}:a)})},A=e=>{l({type:"REMOVE_ASSET",payload:e})},S=(e,s)=>{let a=v.payment_matrix.lump_sum_expenses.map(a=>a.id===e?{...a,...s}:a);f({payment_matrix:{...v.payment_matrix,lump_sum_expenses:a}})},$=e=>{let s=v.payment_matrix.lump_sum_expenses.filter(s=>s.id!==e);f({payment_matrix:{...v.payment_matrix,lump_sum_expenses:s}})},D=(e,s)=>{let a=v.payment_matrix.lump_sum_receipts.map(a=>a.id===e?{...a,...s}:a);f({payment_matrix:{...v.payment_matrix,lump_sum_receipts:a}})},G=e=>{let s=v.payment_matrix.lump_sum_receipts.filter(s=>s.id!==e);f({payment_matrix:{...v.payment_matrix,lump_sum_receipts:s}})};return(0,t.jsx)("div",{className:"max-w-7xl mx-auto p-6",children:(0,t.jsxs)(d,{value:c,onValueChange:g,className:"space-y-6",children:[(0,t.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg p-2 mb-6 shadow-sm overflow-x-auto",children:(0,t.jsxs)(m,{className:"flex w-max min-w-full h-auto p-0 bg-transparent gap-1",children:[(0,t.jsxs)(o,{value:"income",className:"flex items-center",children:[(0,t.jsx)(Y.Z,{className:"h-4 w-4 mr-2"}),"Income"]}),(0,t.jsxs)(o,{value:"expenses",className:"flex items-center",children:[(0,t.jsx)(q.Z,{className:"h-4 w-4 mr-2"}),"Expenses"]}),(0,t.jsxs)(o,{value:"housing",className:"flex items-center",children:[(0,t.jsx)(K.Z,{className:"h-4 w-4 mr-2"}),"Housing"]}),(0,t.jsxs)(o,{value:"investments",className:"flex items-center",children:[(0,t.jsx)(X.Z,{className:"h-4 w-4 mr-2"}),"Investments"]}),(0,t.jsxs)(o,{value:"assets",className:"flex items-center",children:[(0,t.jsx)(J.Z,{className:"h-4 w-4 mr-2"}),"Assets"]}),(0,t.jsxs)(o,{value:"projections",className:"flex items-center",children:[(0,t.jsx)(ee.Z,{className:"h-4 w-4 mr-2"}),"Projections"]}),(0,t.jsxs)(o,{value:"regression",className:"flex items-center",children:[(0,t.jsx)(es.Z,{className:"h-4 w-4 mr-2"}),"Regression"]})]})}),(0,t.jsxs)(x,{value:"income",id:"income",className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:"Income Sources"}),(0,t.jsxs)("p",{className:"text-gray-600",children:["Manage your income streams (",v.income_sources.length,"/20)"]})]}),(0,t.jsxs)(y,{onClick:()=>{if(v.income_sources.length>=20){alert("Maximum 20 income sources allowed");return}l({type:"ADD_INCOME_SOURCE",payload:(0,en.JV)()})},disabled:v.income_sources.length>=20,children:[(0,t.jsx)(U.Z,{className:"h-4 w-4 mr-2"}),"Add Income Source"]})]}),v.income_sources.map(e=>(0,t.jsx)(ec,{source:e,onUpdate:s=>b(e.id,s),onRemove:()=>C(e.id)},e.id)),(0,t.jsxs)("div",{className:"mt-8 flex justify-between items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:"Lump Sum Income"}),(0,t.jsxs)("p",{className:"text-gray-600",children:["Record one-time income like bonuses, refunds, etc (",v.payment_matrix?.lump_sum_receipts?.length||0,"/50)"]})]}),(0,t.jsxs)(y,{onClick:()=>{if(!v.payment_matrix?.lump_sum_receipts){f({payment_matrix:{...v.payment_matrix,lump_sum_receipts:[]}});return}if(v.payment_matrix?.lump_sum_receipts?.length>=50){alert("Maximum 50 lump sum receipts allowed");return}let e={id:`lump_inc_${Date.now()}_${Math.random().toString(36).substr(2,5)}`,name:"",amount:0,date:{year:new Date().getFullYear(),month:new Date().getMonth()+1},source:""};f({payment_matrix:{...v.payment_matrix,lump_sum_receipts:[...v.payment_matrix.lump_sum_receipts,e]}})},disabled:v.payment_matrix?.lump_sum_receipts?.length>=50,children:[(0,t.jsx)(U.Z,{className:"h-4 w-4 mr-2"}),"Add Lump Sum Income"]})]}),v.payment_matrix?.lump_sum_receipts?.map(e=>t.jsx(ei,{receipt:e,onUpdate:s=>D(e.id,s),onRemove:()=>G(e.id)},e.id))]}),(0,t.jsxs)(x,{value:"expenses",id:"expenses",className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:"Expense Categories"}),(0,t.jsxs)("p",{className:"text-gray-600",children:["Track your monthly expenses (",v.expense_categories.length,"/20)"]})]}),(0,t.jsxs)(y,{onClick:()=>{if(v.expense_categories.length>=20){alert("Maximum 20 expense categories allowed");return}l({type:"ADD_EXPENSE_CATEGORY",payload:(0,en.mE)()})},disabled:v.expense_categories.length>=20,children:[(0,t.jsx)(U.Z,{className:"h-4 w-4 mr-2"}),"Add Expense Category"]})]}),v.expense_categories.map(e=>(0,t.jsx)(er,{category:e,onUpdate:s=>_(e.id,s),onRemove:()=>F(e.id)},e.id)),(0,t.jsxs)("div",{className:"mt-8 flex justify-between items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:"Lump Sum Expenses"}),(0,t.jsxs)("p",{className:"text-gray-600",children:["Plan for one-time expenses like vacations, home repairs, and emergencies (",v.payment_matrix?.lump_sum_expenses?.length||0,"/50)"]})]}),(0,t.jsxs)(y,{onClick:()=>{let e={id:`lump_${Date.now()}_${Math.random().toString(36).substr(2,5)}`,name:"",amount:0,date:{year:new Date().getFullYear(),month:new Date().getMonth()+1},category:"other",description:""},s=v.payment_matrix?.lump_sum_expenses??[];if(s.length>=50){alert("Maximum 50 lump sum expenses allowed");return}f({payment_matrix:{...v.payment_matrix,lump_sum_expenses:[...s,e]}})},disabled:v.payment_matrix?.lump_sum_expenses?.length>=50,children:[(0,t.jsx)(U.Z,{className:"h-4 w-4 mr-2"}),"Add Lump Sum Expense"]})]}),v.payment_matrix?.lump_sum_expenses?.map(e=>t.jsx(ex,{expense:e,onUpdate:s=>S(e.id,s),onRemove:()=>$(e.id)},e.id))]}),(0,t.jsxs)(x,{value:"housing",id:"housing",className:"space-y-6",children:[(0,t.jsx)(ed,{housing:v.housing,cash:v.cash,onUpdateHousing:e=>f({housing:{...v.housing,...e}}),onUpdateCash:e=>f({cash:{...v.cash,...e}})}),(0,t.jsx)(eh,{housingData:v.housing,cashData:v.cash,projections:r})]}),(0,t.jsxs)(x,{value:"investments",id:"investments",className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:"Investment Accounts"}),(0,t.jsxs)("p",{className:"text-gray-600",children:["Track your investments, 401k, stocks, and precious metals (",v.investment_accounts.length,"/20)"]})]}),(0,t.jsxs)(y,{onClick:()=>{if(v.investment_accounts.length>=20){alert("Maximum 20 investment accounts allowed");return}l({type:"ADD_INVESTMENT_ACCOUNT",payload:(0,en.rm)()})},disabled:v.investment_accounts.length>=20,children:[(0,t.jsx)(U.Z,{className:"h-4 w-4 mr-2"}),"Add Investment Account"]})]}),v.investment_accounts.map(e=>(0,t.jsx)(em,{investment:e,onUpdate:s=>k(e.id,s),onRemove:()=>M(e.id)},e.id))]}),(0,t.jsxs)(x,{value:"assets",id:"assets",className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:"Assets"}),(0,t.jsxs)("p",{className:"text-gray-600",children:["Track your physical assets like vehicles, real estate, and collectibles (",v.assets.length,"/20)"]})]}),(0,t.jsxs)(y,{onClick:()=>{if(v.assets.length>=20){alert("Maximum 20 assets allowed");return}l({type:"ADD_ASSET",payload:(0,en.ng)()})},disabled:v.assets.length>=20,children:[(0,t.jsx)(U.Z,{className:"h-4 w-4 mr-2"}),"Add Asset"]})]}),v.assets.map(e=>(0,t.jsx)(eo,{asset:e,onUpdate:s=>Z(e.id,s),onRemove:()=>A(e.id)},e.id))]}),(0,t.jsx)(x,{value:"projections",id:"projections",className:"space-y-6",children:(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsxs)(p,{className:"flex items-center",children:[(0,t.jsx)(ee.Z,{className:"h-5 w-5 mr-2"}),"Quarterly Income & Expense Projections"]})}),(0,t.jsx)(j,{className:"space-y-6",children:(0,t.jsxs)(T,{type:"single",collapsible:!0,className:"w-full",children:[(0,t.jsxs)(E,{value:"income-projections",children:[(0,t.jsx)(z,{children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(Y.Z,{className:"h-4 w-4 mr-2"}),"Quarterly Income Projections"]})}),(0,t.jsx)(O,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Set different income amounts for each quarter to account for raises, bonuses, or seasonal changes."}),v.income_sources.map(e=>(0,t.jsxs)(h,{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsx)(w,{className:"font-semibold",children:e.name||"Unnamed Income Source"}),(0,t.jsxs)(V,{variant:"outline",children:["Base: ",(0,el.xG)(e.base_amount),"/month"]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{children:"Q1 Monthly Amount"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{type:"number",value:e.schedule_changes?.find(e=>e.date.month<=3)?.amount||e.base_amount,onChange:s=>{let a=parseFloat(s.target.value)||0,t=(e.schedule_changes||[]).filter(e=>e.date.month>3||e.date.month<1);a!==e.base_amount&&t.push({date:{year:2025,month:1},amount:a,description:"Q1 adjustment"}),b(e.id,{schedule_changes:t})},className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{children:"Q2 Monthly Amount"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{type:"number",value:e.schedule_changes?.find(e=>e.date.month>=4&&e.date.month<=6)?.amount||e.base_amount,onChange:s=>{let a=parseFloat(s.target.value)||0,t=(e.schedule_changes||[]).filter(e=>e.date.month<4||e.date.month>6);a!==e.base_amount&&t.push({date:{year:2025,month:4},amount:a,description:"Q2 adjustment"}),b(e.id,{schedule_changes:t})},className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{children:"Q3 Monthly Amount"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{type:"number",value:e.schedule_changes?.find(e=>e.date.month>=7&&e.date.month<=9)?.amount||e.base_amount,onChange:s=>{let a=parseFloat(s.target.value)||0,t=(e.schedule_changes||[]).filter(e=>e.date.month<7||e.date.month>9);a!==e.base_amount&&t.push({date:{year:2025,month:7},amount:a,description:"Q3 adjustment"}),b(e.id,{schedule_changes:t})},className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{children:"Q4 Monthly Amount"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{type:"number",value:e.schedule_changes?.find(e=>e.date.month>=10&&e.date.month<=12)?.amount||e.base_amount,onChange:s=>{let a=parseFloat(s.target.value)||0,t=(e.schedule_changes||[]).filter(e=>e.date.month<10);a!==e.base_amount&&t.push({date:{year:2025,month:10},amount:a,description:"Q4 adjustment"}),b(e.id,{schedule_changes:t})},className:"pl-10",placeholder:"0"})]})]})]})]},e.id))]})})]}),(0,t.jsxs)(E,{value:"expense-projections",children:[(0,t.jsx)(z,{children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(ea.Z,{className:"h-4 w-4 mr-2"}),"Quarterly Expense Projections"]})}),(0,t.jsx)(O,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Adjust expense amounts for each quarter to account for seasonal changes, utility fluctuations, etc."}),v.expense_categories.map(e=>(0,t.jsxs)(h,{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsx)(w,{className:"font-semibold",children:e.name||"Unnamed"}),(0,t.jsxs)(V,{variant:"outline",children:["Base: ",(0,el.xG)(e.base_amount),"/month"]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{children:"Q1 Monthly Amount"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{type:"number",value:e.schedule_changes?.find(e=>e.date.month<=3)?.amount||e.base_amount,onChange:s=>{let a=parseFloat(s.target.value)||0,t=(e.schedule_changes||[]).filter(e=>e.date.month>3||e.date.month<1);a!==e.base_amount&&t.push({date:{year:2025,month:1},amount:a,description:"Q1 adjustment"}),_(e.id,{schedule_changes:t})},className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{children:"Q2 Monthly Amount"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{type:"number",value:e.schedule_changes?.find(e=>e.date.month>=4&&e.date.month<=6)?.amount||e.base_amount,onChange:s=>{let a=parseFloat(s.target.value)||0,t=(e.schedule_changes||[]).filter(e=>e.date.month<4||e.date.month>6);a!==e.base_amount&&t.push({date:{year:2025,month:4},amount:a,description:"Q2 adjustment"}),_(e.id,{schedule_changes:t})},className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{children:"Q3 Monthly Amount"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{type:"number",value:e.schedule_changes?.find(e=>e.date.month>=7&&e.date.month<=9)?.amount||e.base_amount,onChange:s=>{let a=parseFloat(s.target.value)||0,t=(e.schedule_changes||[]).filter(e=>e.date.month<7||e.date.month>9);a!==e.base_amount&&t.push({date:{year:2025,month:7},amount:a,description:"Q3 adjustment"}),_(e.id,{schedule_changes:t})},className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{children:"Q4 Monthly Amount"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{type:"number",value:e.schedule_changes?.find(e=>e.date.month>=10&&e.date.month<=12)?.amount||e.base_amount,onChange:s=>{let a=parseFloat(s.target.value)||0,t=(e.schedule_changes||[]).filter(e=>e.date.month<10);a!==e.base_amount&&t.push({date:{year:2025,month:10},amount:a,description:"Q4 adjustment"}),_(e.id,{schedule_changes:t})},className:"pl-10",placeholder:"0"})]})]})]})]},e.id))]})})]})]})})]})}),(0,t.jsx)(x,{value:"regression",id:"regression",className:"space-y-6",children:(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsxs)(p,{className:"flex items-center",children:[(0,t.jsx)(es.Z,{className:"h-5 w-5 mr-2"}),"Budget vs Actual Analysis"]})}),(0,t.jsxs)(j,{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsx)(p,{className:"text-base",children:"Previous Month - Income"})}),(0,t.jsx)(j,{className:"space-y-4",children:v.income_sources.map(e=>(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4 items-center",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:e.name||"Unnamed"}),(0,t.jsxs)("div",{className:"text-sm text-gray-600",children:["Planned: ",(0,el.xG)(e.base_amount)]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(w,{className:"sr-only",children:["Actual Amount for ",e.name]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{type:"number",placeholder:"Actual",className:"pl-10"})]})]})]},e.id))})]}),(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsx)(p,{className:"text-base",children:"Previous Month - Expenses"})}),(0,t.jsx)(j,{className:"space-y-4",children:v.expense_categories.map(e=>(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4 items-center",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:e.name||"Unnamed"}),(0,t.jsxs)("div",{className:"text-sm text-gray-600",children:["Planned: ",(0,el.xG)(e.base_amount)]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(w,{className:"sr-only",children:["Actual Amount for ",e.name]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{type:"number",placeholder:"Actual",className:"pl-10"})]})]})]},e.id))})]})]}),(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsx)(p,{className:"text-base",children:"Variance Analysis Summary"})}),(0,t.jsxs)(j,{children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{className:"text-center p-4 bg-blue-50 rounded-lg",children:[(0,t.jsx)("div",{className:"text-2xl font-bold text-blue-600",children:"$0"}),(0,t.jsx)("div",{className:"text-sm text-blue-600",children:"Income Variance"})]}),(0,t.jsxs)("div",{className:"text-center p-4 bg-red-50 rounded-lg",children:[(0,t.jsx)("div",{className:"text-2xl font-bold text-red-600",children:"$0"}),(0,t.jsx)("div",{className:"text-sm text-red-600",children:"Expense Variance"})]}),(0,t.jsxs)("div",{className:"text-center p-4 bg-green-50 rounded-lg",children:[(0,t.jsx)("div",{className:"text-2xl font-bold text-green-600",children:"$0"}),(0,t.jsx)("div",{className:"text-sm text-green-600",children:"Net Variance"})]})]}),(0,t.jsxs)("div",{className:"mt-6",children:[(0,t.jsx)(w,{children:"Notes & Insights"}),(0,t.jsx)(P,{placeholder:"Add notes about budget performance, lessons learned, or adjustments needed...",rows:4,className:"mt-2"})]})]})]})]})]})})]})})}var ep=a(92451),ej=a(31047),eg=a(10407),ev=a(88226);let ef=({selectedMonth:e=0})=>{let{kpis:s,state:a,projections:l}=(0,et.O)();if(!s||!l||0===l.length)return null;let i=l[e]||l[0],r=l[e+1]||l[e],c=(e,s)=>.01>Math.abs(e-s)?"neutral":s>e?"up":"down",d={monthly_gross_income:i.gross_income||s.monthly_gross_income,monthly_net_income:i.net_income||s.monthly_net_income,total_gross_income:12*(i.gross_income||0),total_net_income:12*(i.net_income||0),lump_sum_receipts:i.lump_sum_receipts||0,monthly_housing_payment:i.housing_payment||s.monthly_housing_payment,housing_payment_type:i.housing_payment_type||s.housing_payment_type,housing_payment_ratio:(i.housing_payment||0)/(i.gross_income||1),cash_to_close:a.current_config?.data?.home_purchase_month===e+1?s.cash_to_close:0,total_debt:i.total_debt_balance||s.total_debt,monthly_minimum_payment:(i.required_debt_payments??i.debt_payments)||s.monthly_minimum_payment,monthly_interest:i.monthly_interest||s.monthly_interest,debt_to_income_ratio:i.total_debt_balance/(12*i.gross_income)||s.debt_to_income_ratio,monthly_debt_payments:(i.required_debt_payments??i.debt_payments)||s.monthly_debt_payments,monthly_other_expenses:i.total_expenses-(i.housing_payment||0)-((i.required_debt_payments??i.debt_payments)||0)||s.monthly_other_expenses,total_monthly_expenses:(i.housing_payment||0)+((i.required_debt_payments??i.debt_payments)||0)+(i.total_expenses-(i.housing_payment||0)-((i.required_debt_payments??i.debt_payments)||0)),investment_contributions:i.investment_contributions||s.investment_contributions,monthly_surplus:i.surplus||s.monthly_surplus,nominal_surplus:i.nominal_surplus||s.nominal_surplus,cash_after_close:i.cash_balance||s.cash_after_close,total_investments:i.total_investment_value||s.total_investments,emergency_fund_months:i.emergency_fund_months||s.emergency_fund_months,net_worth:(i.cash_balance||0)+(i.total_investment_value||0)-(i.total_debt_balance||0)},m=n.useMemo(()=>{if("number"==typeof i.back_end_dti)return i.back_end_dti;let e=i.required_debt_payments??i.debt_payments??0;return(e+(i.housing_payment||0))/(i.gross_income||1)*100},[i,a.current_config?.data?.payment_matrix,e]),o=n.useMemo(()=>{let s=a.current_config?.data?.payment_matrix;return s&&s.payments?Object.values(s.payments).reduce((s,a)=>s+(Array.isArray(a)&&a[e]||0),0):0},[a.current_config?.data?.payment_matrix]),x=n.useMemo(()=>e+1>=(a.current_config?.data?.home_purchase_month??1/0)?"PITI":"Rent",[e,a.current_config?.data?.home_purchase_month]);return(0,t.jsxs)("div",{className:"px-4 mt-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3 lg:gap-4",children:[(0,t.jsxs)("div",{className:"bg-blue-50 rounded-lg p-2 lg:p-3 border border-blue-200",children:[(0,t.jsxs)("h3",{className:"text-xs lg:text-sm font-semibold text-blue-800 mb-2 lg:mb-3 flex items-center",children:[(0,t.jsx)(L.Z,{className:"h-3 w-3 lg:h-4 lg:w-4 mr-1 lg:mr-2"}),"Income"]}),(0,t.jsxs)("div",{className:"space-y-1 lg:space-y-2",children:[(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-blue-600",children:"Annual Gross"}),(0,t.jsx)("span",{className:"text-sm font-medium text-blue-900",children:(0,el.xG)(d.total_gross_income)})]}),(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-blue-600",children:"Annual Net"}),(0,t.jsx)("span",{className:"text-sm font-medium text-blue-900",children:(0,el.xG)(d.total_net_income)})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-blue-600",children:"Monthly Gross"}),(0,t.jsx)("span",{className:"text-xs lg:text-sm font-medium text-blue-900",children:(0,el.xG)(d.monthly_gross_income)})]}),(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-blue-600",children:"Other Monthly Income"}),(0,t.jsx)("span",{className:"text-sm font-medium text-blue-900",children:(0,el.xG)(d.lump_sum_receipts)})]}),(0,t.jsx)("div",{className:"border-t border-blue-200 pt-1 lg:pt-2 mt-1 lg:mt-2",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs lg:text-sm font-semibold text-blue-800",children:"Monthly Net"}),(0,t.jsx)("span",{className:"text-sm lg:text-base font-bold text-blue-900",children:(0,el.xG)(d.monthly_net_income)})]})})]})]}),(0,t.jsxs)("div",{className:"bg-orange-50 rounded-lg p-2 lg:p-3 border border-orange-200",children:[(0,t.jsxs)("h3",{className:"text-xs lg:text-sm font-semibold text-orange-800 mb-2 lg:mb-3 flex items-center",children:[(0,t.jsx)(q.Z,{className:"h-3 w-3 lg:h-4 lg:w-4 mr-1 lg:mr-2"}),"Expenses"]}),(0,t.jsxs)("div",{className:"space-y-1 lg:space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-orange-600",children:"Housing"}),(0,t.jsx)("span",{className:"text-xs lg:text-sm font-medium text-orange-900",children:(0,el.xG)(d.monthly_housing_payment)})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-orange-600",children:"Debt Payments"}),(0,t.jsx)("span",{className:"text-xs lg:text-sm font-medium text-orange-900",children:(0,el.xG)(d.monthly_debt_payments)})]}),(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-orange-600",children:"Other Expenses"}),(0,t.jsx)("span",{className:"text-sm font-medium text-orange-900",children:(0,el.xG)(d.monthly_other_expenses)})]}),(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-orange-600",children:"Monthly Investment Total"}),(0,t.jsx)("span",{className:"text-sm font-medium text-orange-900",children:(0,el.xG)(d.investment_contributions)})]}),(0,t.jsx)("div",{className:"border-t border-orange-200 pt-1 lg:pt-2 mt-1 lg:mt-2",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs lg:text-sm font-semibold text-orange-800",children:"Total Monthly"}),(0,t.jsx)("span",{className:"text-sm lg:text-base font-bold text-orange-900",children:(0,el.xG)(d.total_monthly_expenses)})]})})]})]}),(0,t.jsxs)("div",{className:"bg-blue-50 rounded-lg p-2 lg:p-3 border border-blue-200",children:[(0,t.jsxs)("h3",{className:"text-xs lg:text-sm font-semibold text-blue-800 mb-2 lg:mb-3 flex items-center",children:[(0,t.jsx)(K.Z,{className:"h-3 w-3 lg:h-4 lg:w-4 mr-1 lg:mr-2"}),"Housing"]}),(0,t.jsxs)("div",{className:"space-y-1 lg:space-y-2",children:[(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-blue-600",children:"Purchase Price"}),(0,t.jsx)("span",{className:"text-sm font-medium text-blue-900",children:(0,el.xG)(a.current_config?.data?.housing?.home_price||0)})]}),(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-blue-600",children:"Interest Rate"}),(0,t.jsx)("span",{className:"text-sm font-medium text-blue-900",children:(0,el.rl)(a.current_config?.data?.housing?.interest_rate||0,2)})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-blue-600",children:"Cash to Close"}),(0,t.jsx)("span",{className:"text-xs lg:text-sm font-medium text-blue-900",children:(0,el.xG)(s.cash_to_close)})]}),(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-blue-600",children:"Housing to Income"}),(0,t.jsx)("span",{className:"text-sm font-medium text-blue-900",children:(0,el.rl)(s.housing_payment_ratio)})]}),(0,t.jsx)("div",{className:"border-t border-blue-200 pt-1 lg:pt-2 mt-1 lg:mt-2",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("span",{className:"text-xs lg:text-sm font-semibold text-blue-800",children:["Monthly ",x]}),(0,t.jsx)("span",{className:"text-sm lg:text-base font-bold text-blue-900",children:(0,el.xG)(d.monthly_housing_payment)})]})})]})]}),(0,t.jsxs)("div",{className:"bg-red-50 rounded-lg p-2 lg:p-3 border border-red-200",children:[(0,t.jsxs)("h3",{className:"text-xs lg:text-sm font-semibold text-red-800 mb-2 lg:mb-3 flex items-center",children:[(0,t.jsx)(ev.Z,{className:"h-3 w-3 lg:h-4 lg:w-4 mr-1 lg:mr-2"}),"Debt"]}),(0,t.jsxs)("div",{className:"space-y-1 lg:space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-red-600",children:"Total Balance"}),(0,t.jsx)("span",{className:"text-xs lg:text-sm font-medium text-red-900",children:(0,el.xG)(d.total_debt)})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-red-600",children:"DTI Ratio"}),(0,t.jsx)("span",{className:`text-xs lg:text-sm font-medium ${(0,el.zd)(m,"dti")}`,children:(0,el.rl)(m,1)})]}),(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-red-600",children:"Monthly Interest"}),(0,t.jsx)("span",{className:"text-sm font-medium text-red-900",children:(0,el.xG)(d.monthly_interest)})]}),(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-red-600",children:"Monthly Overage"}),(0,t.jsx)("span",{className:"text-sm font-medium text-red-900",children:(0,el.xG)(o)})]}),(0,t.jsx)("div",{className:"border-t border-red-200 pt-1 lg:pt-2 mt-1 lg:mt-2",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs lg:text-sm font-semibold text-red-800",children:"Monthly Payment"}),(0,t.jsx)("span",{className:"text-sm lg:text-base font-bold text-red-900",children:(0,el.xG)(d.monthly_minimum_payment)})]})})]})]}),(0,t.jsxs)("div",{className:"bg-green-50 rounded-lg p-2 lg:p-3 border border-green-200",children:[(0,t.jsxs)("h3",{className:"text-xs lg:text-sm font-semibold text-green-800 mb-2 lg:mb-3 flex items-center",children:[(0,t.jsx)(Y.Z,{className:"h-3 w-3 lg:h-4 lg:w-4 mr-1 lg:mr-2"}),"Surplus"]}),(0,t.jsxs)("div",{className:"space-y-1 lg:space-y-2",children:[(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-green-600",children:"Cash After Close"}),(0,t.jsx)("span",{className:`text-sm font-medium ${d.cash_after_close<0?"text-red-600":"text-green-900"}`,children:(0,el.xG)(d.cash_after_close)})]}),(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-green-600",children:"Nominal Surplus"}),(0,t.jsx)("span",{className:`text-sm font-medium ${d.nominal_surplus<0?"text-red-600":"text-green-900"}`,children:(0,el.xG)(d.nominal_surplus)})]}),(0,t.jsxs)("div",{className:"hidden lg:flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-green-600",children:"Investment Balance"}),(0,t.jsx)("span",{className:"text-sm font-medium text-green-900",children:(0,el.xG)(d.total_investments)})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs text-green-600",children:"Emergency Fund"}),(0,t.jsxs)("span",{className:`text-xs lg:text-sm font-medium flex items-center ${d.emergency_fund_months<3?"text-red-600":"text-green-900"}`,children:[d.emergency_fund_months.toFixed(1)," mo","up"===c(d.emergency_fund_months,r.emergency_fund_months||d.emergency_fund_months)&&(0,t.jsx)(Y.Z,{className:"ml-1 h-3 w-3 text-green-500"}),"down"===c(d.emergency_fund_months,r.emergency_fund_months||d.emergency_fund_months)&&(0,t.jsx)(ea.Z,{className:"ml-1 h-3 w-3 text-red-500"})]})]}),(0,t.jsx)("div",{className:"border-t border-green-200 pt-1 lg:pt-2 mt-1 lg:mt-2",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs lg:text-sm font-semibold text-green-800",children:"Monthly Surplus"}),(0,t.jsxs)("span",{className:`text-sm lg:text-base font-bold flex items-center ${d.monthly_surplus<0?"text-red-600":"text-green-900"}`,children:[(0,el.xG)(d.monthly_surplus),"up"===c(d.monthly_surplus,r.surplus||d.monthly_surplus)&&(0,t.jsx)(Y.Z,{className:"ml-1 h-3 w-3 text-green-500"}),"down"===c(d.monthly_surplus,r.surplus||d.monthly_surplus)&&(0,t.jsx)(ea.Z,{className:"ml-1 h-3 w-3 text-red-500"})]})]})})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 lg:gap-2 mt-3 lg:mt-4",children:[(0,t.jsx)(V,{variant:d.monthly_surplus>0?"default":"destructive",className:"text-xs px-2 py-1",children:d.monthly_surplus>0?"Positive Cash Flow":"Negative Cash Flow"}),(0,t.jsx)(V,{variant:m<36?"default":"destructive",className:"text-xs px-2 py-1",children:m<36?"Healthy DTI":"High DTI Risk"}),(0,t.jsx)(V,{variant:d.emergency_fund_months>=3?"default":"destructive",className:"text-xs px-2 py-1",children:d.emergency_fund_months>=3?"Emergency Fund Adequate":"Emergency Fund Low"}),(0,t.jsx)(V,{variant:d.net_worth>=0?"default":"destructive",className:"text-xs px-2 py-1",children:d.net_worth>=0?"Positive Net Worth":"Negative Net Worth"}),a.current_config?.data?.home_purchase_month===e+1&&(0,t.jsx)(V,{variant:"outline",className:"text-xs px-2 py-1 border-blue-500 text-blue-700",children:"Home Purchase Month"})]})]})};function ey({activeTab:e,onTabChange:s}){return(0,t.jsxs)(m,{className:"max-w-7xl mx-auto px-4 inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground space-x-1",children:[(0,t.jsx)(o,{value:"overview",children:"Overview"}),(0,t.jsx)(o,{value:"charts",children:"Analytics"}),(0,t.jsx)(o,{value:"income",children:"Income"}),(0,t.jsx)(o,{value:"expenses",children:"Expenses"}),(0,t.jsx)(o,{value:"housing",children:"Housing"}),(0,t.jsx)(o,{value:"debt",children:"Debt Strategy"}),(0,t.jsx)(o,{value:"investments",children:"Investments"}),(0,t.jsx)(o,{value:"assets",children:"Assets"}),(0,t.jsx)(o,{value:"projections",children:"Projections"}),(0,t.jsx)(o,{value:"regression",children:"Regression"}),(0,t.jsx)(o,{value:"config",children:"Configuration"})]})}function eN({activeTab:e,onTabChange:s,subNavItems:a}){let l=e=>{let s=new Date,a=new Date(s);return a.setMonth(s.getMonth()+e-1),a.toLocaleDateString("en-US",{month:"short",year:"numeric"})},{state:i,dispatch:r,kpis:c,projections:d}=(0,et.O)(),[m,o]=n.useState(!1),[x,h]=n.useState(0);return(n.useMemo(()=>{let e=i.current_config?.data?.payment_matrix;return e&&e.payments?Object.values(e.payments).reduce((e,s)=>e+(Array.isArray(s)&&s[0]||0),0):0},[i.current_config?.data?.payment_matrix]),c&&i.current_config)?(d?.[0],d?.[1],(0,t.jsx)("div",{className:"sticky top-0 z-40 bg-white border-b border-gray-200 shadow-sm",children:(0,t.jsxs)("div",{className:"max-w-7xl mx-auto px-4 py-4",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-xl lg:text-2xl font-bold text-gray-900",children:i.current_config.name}),(0,t.jsx)("p",{className:"text-sm lg:text-base text-gray-600",children:i.current_config.description})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("div",{className:"hidden lg:flex items-center bg-white rounded-lg border border-gray-200 shadow-sm",children:[(0,t.jsx)(y,{variant:"ghost",size:"sm",disabled:0===x,onClick:()=>h(Math.max(0,x-1)),className:"px-2",children:(0,t.jsx)(ep.Z,{className:"h-4 w-4"})}),(0,t.jsxs)("div",{className:"flex items-center px-2",children:[(0,t.jsx)(ej.Z,{className:"h-4 w-4 text-blue-600 mr-1"}),(0,t.jsxs)("span",{className:"text-sm font-medium",children:["Month ",d[x]?.month||1,": ",l(d[x]?.month||1)]})]}),(0,t.jsx)(y,{variant:"ghost",size:"sm",disabled:x>=d.length-1,onClick:()=>h(Math.min(d.length-1,x+1)),className:"px-2",children:(0,t.jsx)(eg.Z,{className:"h-4 w-4"})})]}),(0,t.jsxs)(y,{variant:"ghost",size:"sm",className:"lg:hidden",onClick:()=>o(!m),children:[m?(0,t.jsx)(F.Z,{className:"h-4 w-4"}):(0,t.jsx)(k.Z,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"ml-1 text-xs",children:"KPIs"})]})]})]}),(0,t.jsxs)("div",{className:"flex lg:hidden items-center justify-center my-3 bg-white rounded-lg border border-gray-200 shadow-sm",children:[(0,t.jsx)(y,{variant:"ghost",size:"sm",disabled:0===x,onClick:()=>h(Math.max(0,x-1)),className:"px-2",children:(0,t.jsx)(ep.Z,{className:"h-4 w-4"})}),(0,t.jsxs)("div",{className:"flex items-center px-2",children:[(0,t.jsx)(ej.Z,{className:"h-4 w-4 text-blue-600 mr-1"}),(0,t.jsxs)("span",{className:"text-sm font-medium",children:["Month ",d[x]?.month||1,": ",l(d[x]?.month||1)]})]}),(0,t.jsx)(y,{variant:"ghost",size:"sm",disabled:x>=d.length-1,onClick:()=>h(Math.min(d.length-1,x+1)),className:"px-2",children:(0,t.jsx)(eg.Z,{className:"h-4 w-4"})})]})]}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)(ey,{activeTab:e,onTabChange:s})}),(0,t.jsx)("div",{className:`transition-all duration-300 overflow-hidden ${m?"max-h-0 lg:max-h-none":"max-h-none"}`,children:(0,t.jsx)(ef,{selectedMonth:x})})]})})):(0,t.jsx)("div",{className:"p-6 bg-gray-50",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto",children:(0,t.jsxs)("div",{className:"animate-pulse",children:[(0,t.jsx)("div",{className:"h-8 bg-gray-200 rounded mb-4"}),(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[...Array(8)].map((e,s)=>(0,t.jsx)("div",{className:"h-20 bg-gray-200 rounded"},s))})]})})})}var eb=a(47625),e_=a(5481),ew=a(97059),eC=a(62994),eF=a(8147),ek=a(22190),eM=a(23263),eZ=a(54061),eA=a(21156),eS=a(31699),e$=a(75169),eD=a(3574),eG=a(20407),eI=a(77031),eP=a(81596);function eR({title:e,icon:s,children:a,description:n,badge:l}){return(0,t.jsxs)(h,{className:"h-full",children:[(0,t.jsxs)(u,{className:"pb-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[s,(0,t.jsx)(p,{className:"text-lg",children:e})]}),l]}),n&&(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:n})]}),(0,t.jsx)(j,{className:"pt-2",children:(0,t.jsx)("div",{className:"h-80",children:a})})]})}function eT({active:e,payload:s,label:a,formatValue:n=el.xG}){return e&&s&&s.length?(0,t.jsxs)("div",{className:"bg-white p-3 border border-gray-200 rounded-lg shadow-md",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-gray-900 mb-1",children:a}),s.map((e,s)=>(0,t.jsxs)("p",{className:"text-sm",style:{color:e.color},children:[e.name,": ",n(e.value)]},s))]}):null}function eE({projections:e}){if(!e||!Array.isArray(e)||0===e.length)return(0,t.jsx)(eR,{title:"Debt Paydown Timeline",icon:(0,t.jsx)(ev.Z,{className:"h-5 w-5 text-red-600"}),description:"Track your debt reduction progress over 24 months",children:(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-gray-500",children:"No debt data available"})});let s=e.map(e=>({month:`M${e?.month||0}`,debt_balance:e?.total_debt_balance||0,debt_payments:e?.debt_payments||0}));e[0]?.total_debt_balance,e[e.length-1]?.total_debt_balance;let a=e.findIndex(e=>0>=(e?.total_debt_balance||0))+1||e.length;return(0,t.jsx)(eR,{title:"Debt Paydown Timeline",icon:(0,t.jsx)(ev.Z,{className:"h-5 w-5 text-red-600"}),description:"Track your debt reduction progress over 24 months",badge:(0,t.jsx)(V,{variant:"outline",className:"text-xs",children:a<25?`Paid off in ${a}mo`:"24+ months"}),children:(0,t.jsx)(eb.h,{width:"100%",height:"100%",children:(0,t.jsxs)(e_.T,{data:s,children:[(0,t.jsx)(ew.K,{dataKey:"month",tick:{fontSize:10},tickLine:!1,interval:"preserveStartEnd"}),(0,t.jsx)(eC.B,{tick:{fontSize:10},tickLine:!1,label:{value:"Debt Balance",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fontSize:11}}}),(0,t.jsx)(eF.u,{content:(0,t.jsx)(eT,{})}),(0,t.jsx)(ek.D,{verticalAlign:"top",wrapperStyle:{fontSize:11}}),(0,t.jsx)(eM.u,{type:"monotone",dataKey:"debt_balance",stroke:"#FF9898",fill:"#FF9898",fillOpacity:.3,name:"Debt Balance"}),(0,t.jsx)(eZ.x,{type:"monotone",dataKey:"debt_payments",stroke:"#FF9149",strokeWidth:2,name:"Monthly Payments"})]})})})}function ez({projections:e}){if(!e||!Array.isArray(e)||0===e.length)return(0,t.jsx)(eR,{title:"Cash Flow Projections",icon:(0,t.jsx)(L.Z,{className:"h-5 w-5 text-green-600"}),description:"Monthly surplus and cash balance over time",children:(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-gray-500",children:"No cash flow data available"})});let s=e.map(e=>({month:`M${e?.month||0}`,surplus:e?.surplus||0,cash_balance:e?.cash_balance||0,debt_balance:e?.total_debt_balance||0,is_post_purchase:e?.is_post_purchase||!1})),a=e.reduce((e,s)=>e+(s?.surplus||0),0)/e.length,n=(e[e.length-1]?.surplus||0)>(e[0]?.surplus||0)?"up":"down";return(0,t.jsx)(eR,{title:"Cash Flow Projections",icon:(0,t.jsx)(L.Z,{className:"h-5 w-5 text-green-600"}),description:"Monthly surplus and cash balance over time",badge:(0,t.jsxs)("div",{className:"flex items-center space-x-1",children:["up"===n?(0,t.jsx)(Y.Z,{className:"h-3 w-3 text-green-500"}):(0,t.jsx)(ea.Z,{className:"h-3 w-3 text-red-500"}),(0,t.jsxs)("span",{className:"text-xs text-gray-600",children:["Avg: ",(0,el.xG)(a),"/mo"]})]}),children:(0,t.jsx)(eb.h,{width:"100%",height:"100%",children:(0,t.jsxs)(eA.w,{data:s,children:[(0,t.jsx)(ew.K,{dataKey:"month",tick:{fontSize:10},tickLine:!1,interval:"preserveStartEnd"}),(0,t.jsx)(eC.B,{tick:{fontSize:10},tickLine:!1,label:{value:"Amount",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fontSize:11}}}),(0,t.jsx)(eF.u,{content:(0,t.jsx)(eT,{})}),(0,t.jsx)(ek.D,{verticalAlign:"top",wrapperStyle:{fontSize:11}}),(0,t.jsx)(eS.$,{dataKey:"surplus",fill:"#60B5FF",name:"Monthly Surplus"}),(0,t.jsx)(eZ.x,{type:"monotone",dataKey:"cash_balance",stroke:"#FF90BB",strokeWidth:2,name:"Cash Balance"}),(0,t.jsx)(eZ.x,{type:"monotone",dataKey:"debt_balance",stroke:"#FF9898",strokeWidth:2,name:"Debt Balance"})]})})})}function eO({projections:e}){let{state:s}=(0,et.O)(),a=e.map(e=>{let a=e.is_post_purchase&&s.current_config?.data.housing.home_price||0,t=e.cash_balance+a-e.total_debt_balance;return{month:`M${e.month}`,net_worth:t,assets:e.cash_balance+a,liabilities:e.total_debt_balance,home_purchase:e.is_post_purchase}}),n=(a[a.length-1]?.net_worth||0)-(a[0]?.net_worth||0);return(0,t.jsx)(eR,{title:"Net Worth Growth",icon:(0,t.jsx)(Y.Z,{className:"h-5 w-5 text-blue-600"}),description:"Track your wealth building progress",badge:(0,t.jsxs)(V,{variant:n>0?"default":"destructive",className:"text-xs",children:[n>0?"+":"",(0,el.xG)(n)]}),children:(0,t.jsx)(eb.h,{width:"100%",height:"100%",children:(0,t.jsxs)(e_.T,{data:a,children:[(0,t.jsx)(ew.K,{dataKey:"month",tick:{fontSize:10},tickLine:!1,interval:"preserveStartEnd"}),(0,t.jsx)(eC.B,{tick:{fontSize:10},tickLine:!1,label:{value:"Net Worth",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fontSize:11}}}),(0,t.jsx)(eF.u,{content:(0,t.jsx)(eT,{})}),(0,t.jsx)(ek.D,{verticalAlign:"top",wrapperStyle:{fontSize:11}}),(0,t.jsx)(eM.u,{type:"monotone",dataKey:"assets",stackId:"1",stroke:"#80D8C3",fill:"#80D8C3",fillOpacity:.6,name:"Assets"}),(0,t.jsx)(eM.u,{type:"monotone",dataKey:"liabilities",stackId:"2",stroke:"#FF9898",fill:"#FF9898",fillOpacity:.6,name:"Liabilities"}),(0,t.jsx)(eZ.x,{type:"monotone",dataKey:"net_worth",stroke:"#60B5FF",strokeWidth:3,name:"Net Worth"})]})})})}function eB({data:e}){let{state:s}=(0,et.O)();if(!s.current_config)return null;let a=(s.current_config?.data?.income_sources||[]).reduce((e,s)=>e+(s?.base_amount||0),0),n=(s.current_config?.data?.expense_categories||[]).reduce((e,s)=>e+(s?.base_amount||0),0),l=(s.current_config?.data?.debt_accounts||[]).reduce((e,s)=>e+(s?.min_payment||0),0),i=[{name:"Savings/Surplus",value:Math.max(0,a-n-l),color:"#80D8C3"},{name:"Expenses",value:n,color:"#FF9149"},{name:"Debt Payments",value:l,color:"#FF9898"}].filter(e=>e.value>0);return(0,t.jsx)(eR,{title:"Income Allocation",icon:(0,t.jsx)(X.Z,{className:"h-5 w-5 text-purple-600"}),description:"How your monthly income is allocated",badge:(0,t.jsxs)(V,{variant:"outline",className:"text-xs",children:["Savings Rate: ",((a-n-l)/a*100).toFixed(1),"%"]}),children:(0,t.jsx)(eb.h,{width:"100%",height:"100%",children:(0,t.jsxs)(e$.u,{children:[(0,t.jsx)(eD.b,{data:i,cx:"50%",cy:"50%",outerRadius:100,dataKey:"value",label:({name:e,percent:s})=>`${e} ${(100*s).toFixed(0)}%`,children:i.map((e,s)=>(0,t.jsx)(eG.b,{fill:e.color},`cell-${s}`))}),(0,t.jsx)(eF.u,{content:(0,t.jsx)(eT,{})})]})})})}function eV({projections:e}){let s=e.map(e=>({month:`M${e.month}`,dti_ratio:e.debt_to_income_ratio,front_end_dti:e.housing_payment/e.gross_income*100,is_post_purchase:e.is_post_purchase})),a=s[0]?.dti_ratio||0;return s[s.length-1]?.dti_ratio,(0,t.jsx)(eR,{title:"Debt-to-Income Trends",icon:(0,t.jsx)(ee.Z,{className:"h-5 w-5 text-orange-600"}),description:"Track DTI ratio improvement over time",badge:(0,t.jsx)("div",{className:"flex items-center space-x-1",children:(0,t.jsxs)(V,{variant:a<36?"default":"destructive",className:"text-xs",children:["Current: ",a.toFixed(1),"%"]})}),children:(0,t.jsx)(eb.h,{width:"100%",height:"100%",children:(0,t.jsxs)(eA.w,{data:s,children:[(0,t.jsx)(ew.K,{dataKey:"month",tick:{fontSize:10},tickLine:!1,interval:"preserveStartEnd"}),(0,t.jsx)(eC.B,{tick:{fontSize:10},tickLine:!1,domain:[0,50],label:{value:"DTI Ratio (%)",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fontSize:11}}}),(0,t.jsx)(eF.u,{content:(0,t.jsx)(eT,{formatValue:e=>`${e.toFixed(1)}%`})}),(0,t.jsx)(ek.D,{verticalAlign:"top",wrapperStyle:{fontSize:11}}),(0,t.jsx)(eZ.x,{type:"monotone",dataKey:()=>28,stroke:"#10B981",strokeDasharray:"5 5",strokeWidth:1,name:"Good DTI (28%)",connectNulls:!1}),(0,t.jsx)(eZ.x,{type:"monotone",dataKey:()=>36,stroke:"#F59E0B",strokeDasharray:"5 5",strokeWidth:1,name:"Max DTI (36%)",connectNulls:!1}),(0,t.jsx)(eZ.x,{type:"monotone",dataKey:"dti_ratio",stroke:"#FF9149",strokeWidth:2,name:"Back-end DTI"}),(0,t.jsx)(eZ.x,{type:"monotone",dataKey:"front_end_dti",stroke:"#FF90BB",strokeWidth:2,name:"Front-end DTI"})]})})})}function eL({projections:e}){if(!e||0===e.length)return null;let s=e.map(e=>({month:`M${e.month}`,cash:e.cash_balance||0,maintenance_fund:e.cash_flow_breakdown?.monthly_maintenance_aggregate||0,investments:e.total_investment_value||0}));return(0,t.jsx)(eR,{title:"Cash & Investment Accounts",icon:(0,t.jsx)(L.Z,{className:"h-5 w-5 text-green-600"}),description:"Cash balance, maintenance fund and investments over time",children:(0,t.jsx)(eb.h,{width:"100%",height:"100%",children:(0,t.jsxs)(e_.T,{data:s,stackOffset:"expand",children:[(0,t.jsx)(ew.K,{dataKey:"month",tick:{fontSize:10},tickLine:!1,interval:"preserveStartEnd"}),(0,t.jsx)(eC.B,{tick:{fontSize:10},tickLine:!1,label:{value:"Share",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fontSize:11}},tickFormatter:e=>`${(100*e).toFixed(0)}%`}),(0,t.jsx)(eF.u,{content:(0,t.jsx)(eT,{formatValue:el.xG})}),(0,t.jsx)(ek.D,{verticalAlign:"top",wrapperStyle:{fontSize:11}}),(0,t.jsx)(eM.u,{type:"monotone",dataKey:"cash",stackId:"1",stroke:"#FF90BB",fill:"#FF90BB",name:"Cash"}),(0,t.jsx)(eM.u,{type:"monotone",dataKey:"maintenance_fund",stackId:"1",stroke:"#FF9149",fill:"#FF9149",name:"Maintenance Fund"}),(0,t.jsx)(eM.u,{type:"monotone",dataKey:"investments",stackId:"1",stroke:"#80D8C3",fill:"#80D8C3",name:"Investments"})]})})})}function eH(){let{projections:e,state:s}=(0,et.O)();return s.current_config&&0!==e.length?(0,t.jsx)("div",{className:"max-w-7xl mx-auto p-6",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,t.jsx)(eL,{projections:e}),(0,t.jsx)(eE,{projections:e}),(0,t.jsx)(ez,{projections:e}),(0,t.jsx)(eO,{projections:e}),(0,t.jsx)(eB,{data:s.chart_data.income_allocation}),(0,t.jsx)(eV,{projections:e}),(0,t.jsx)(eR,{title:"Monthly Budget Overview",icon:(0,t.jsx)(eP.Z,{className:"h-5 w-5 text-blue-600"}),description:"Income vs expenses by month",children:(0,t.jsx)(eb.h,{width:"100%",height:"100%",children:(0,t.jsxs)(eI.v,{data:e.map(e=>({month:`M${e.month}`,income:e.net_income,expenses:e.total_expenses+e.housing_payment+e.debt_payments,surplus:e.surplus})),children:[(0,t.jsx)(ew.K,{dataKey:"month",tick:{fontSize:10},tickLine:!1,interval:"preserveStartEnd"}),(0,t.jsx)(eC.B,{tick:{fontSize:10},tickLine:!1,label:{value:"Amount",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fontSize:11}}}),(0,t.jsx)(eF.u,{content:(0,t.jsx)(eT,{})}),(0,t.jsx)(ek.D,{verticalAlign:"top",wrapperStyle:{fontSize:11}}),(0,t.jsx)(eS.$,{dataKey:"income",fill:"#80D8C3",name:"Net Income"}),(0,t.jsx)(eS.$,{dataKey:"expenses",fill:"#FF9149",name:"Total Expenses"}),(0,t.jsx)(eS.$,{dataKey:"surplus",fill:"#60B5FF",name:"Surplus"})]})})})]})}):(0,t.jsx)("div",{className:"max-w-7xl mx-auto p-6",children:(0,t.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[...Array(6)].map((e,s)=>(0,t.jsx)(h,{className:"h-96",children:(0,t.jsx)(j,{className:"p-6 flex items-center justify-center",children:(0,t.jsx)("div",{className:"animate-pulse text-gray-500",children:"Loading chart data..."})})},s))})})}var eK=a(38846);let eU=n.forwardRef(({className:e,...s},a)=>(0,t.jsxs)(eK.fC,{ref:a,className:c("relative flex w-full touch-none select-none items-center",e),...s,children:[(0,t.jsx)(eK.fQ,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:(0,t.jsx)(eK.e6,{className:"absolute h-full bg-primary"})}),(0,t.jsx)(eK.bU,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));function eQ({month:e,isSelected:s,isPurchaseMonth:a,isBeforePurchase:n,cashBalance:l,surplus:i,onClick:r}){return(0,t.jsx)(h,{className:`cursor-pointer transition-all ${a?"border-blue-500 bg-blue-50":s?"border-blue-300 bg-blue-25":l<0?"border-red-300 bg-red-50":i<0?"border-yellow-300 bg-yellow-50":"border-gray-200 bg-white hover:border-gray-300"}`,onClick:r,children:(0,t.jsxs)(j,{className:"p-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a?(0,t.jsx)(K.Z,{className:"h-4 w-4 text-blue-600"}):l<0?(0,t.jsx)(W.Z,{className:"h-4 w-4 text-red-600"}):i>=0?(0,t.jsx)(M.Z,{className:"h-4 w-4 text-green-600"}):(0,t.jsx)(W.Z,{className:"h-4 w-4 text-yellow-600"}),(0,t.jsxs)("span",{className:"font-medium text-sm",children:["Month ",e]})]}),(0,t.jsxs)(V,{variant:"outline",className:"text-xs",children:["Q",Math.ceil(e/3)]})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"text-xs text-gray-600",children:["Cash: ",(0,el.xG)(l)]}),(0,t.jsxs)("div",{className:`text-xs ${i>=0?"text-green-600":"text-red-600"}`,children:[i>=0?"+":"",(0,el.xG)(i)]})]}),a&&(0,t.jsx)(V,{className:"w-full mt-2 text-xs bg-blue-600",children:"Purchase Month"})]})})}function eY({selectedMonth:e,projections:s,housingData:a,cashData:n}){let l=s[e-1];if(!l)return null;let i=a.home_price*(a.down_pct/100),r=a.home_price*(n.closing_cost_pct_price/100),c=(0,el.xZ)(a,n),d=n.current_rent,m=c.total-d,o=(c.tax+c.insurance+c.hoa)*n.escrow_months,x=i+r+o,g=l.is_post_purchase?l.cash_balance+x:l.cash_balance,v=g-x,f=l.maintenance_fund_balance||0,y=l.net_invested_assets||0,N=c.total/l.gross_income*100,b=(c.total+l.debt_payments)/l.gross_income*100,_=v>=0&&N<=28&&b<=36;return(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsxs)(p,{className:"flex items-center text-lg",children:[(0,t.jsx)(Y.Z,{className:"h-5 w-5 mr-2"}),"Affordability Analysis - Month ",e]})}),(0,t.jsxs)(j,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-medium text-sm",children:"Liquid & Funds"}),(0,t.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Cash Balance:"}),(0,t.jsx)("span",{children:(0,el.xG)(l.cash_balance)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Maintenance Fund:"}),(0,t.jsx)("span",{children:(0,el.xG)(f)})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-medium text-sm",children:"Invested / Assets"}),(0,t.jsx)("div",{className:"space-y-1 text-sm",children:(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Net Invested Assets:"}),(0,t.jsx)("span",{children:(0,el.xG)(y)})]})})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-medium text-sm",children:"Cash Requirements"}),(0,t.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("span",{children:["Down Payment (",a.down_pct,"%):"]}),(0,t.jsx)("span",{children:(0,el.xG)(i)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Closing Costs:"}),(0,t.jsx)("span",{children:(0,el.xG)(r)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("span",{children:["Escrow (",n.escrow_months," months):"]}),(0,t.jsx)("span",{children:(0,el.xG)(o)})]}),(0,t.jsxs)("div",{className:"flex justify-between font-medium border-t pt-1",children:[(0,t.jsx)("span",{children:"Total Cash to Close:"}),(0,t.jsx)("span",{children:(0,el.xG)(x)})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-medium text-sm",children:"Cash Position"}),(0,t.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Initial Cash:"}),(0,t.jsx)("span",{children:(0,el.xG)(g)})]}),(0,t.jsxs)("div",{className:"flex justify-between text-gray-600",children:[(0,t.jsx)("span",{className:"ml-2",children:"- Total Cash to Close:"}),(0,t.jsxs)("span",{children:["-",(0,el.xG)(x)]})]}),(0,t.jsxs)("div",{className:"flex justify-between border-t pt-1 font-medium",children:[(0,t.jsx)("span",{children:"Cash After Purchase:"}),(0,t.jsx)("span",{className:v>=0?"text-green-600":"text-red-600",children:(0,el.xG)(v)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Emergency Fund:"}),(0,t.jsxs)("span",{children:[l.total_expenses>0?(v/l.total_expenses).toFixed(1):"0.0"," months"]})]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-medium text-sm",children:"Monthly Payment Impact"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Current Rent:"}),(0,t.jsx)("span",{children:(0,el.xG)(d)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"New Housing Payment:"}),(0,t.jsx)("span",{children:(0,el.xG)(c.total)})]}),(0,t.jsxs)("div",{className:"flex justify-between font-medium border-t pt-1",children:[(0,t.jsx)("span",{children:"Net Change:"}),(0,t.jsxs)("span",{className:m>=0?"text-red-600":"text-green-600",children:[m>=0?"+":"",(0,el.xG)(m)]})]})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Principal & Interest:"}),(0,t.jsx)("span",{children:(0,el.xG)(c.pi)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"Taxes & Insurance:"}),(0,t.jsx)("span",{children:(0,el.xG)(c.tax+c.insurance+c.pmi)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"HOA & Maintenance:"}),(0,t.jsx)("span",{children:(0,el.xG)(c.hoa+c.maintenance)})]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-medium text-sm",children:"Debt-to-Income Ratios"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,t.jsx)("span",{children:"Front-end DTI:"}),(0,t.jsxs)(V,{variant:N<=28?"default":"destructive",className:"text-xs",children:[N.toFixed(1),"%"]})]}),(0,t.jsx)("div",{className:"text-xs text-gray-600",children:"Housing payment only (target: ≤28%)"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,t.jsx)("span",{children:"Back-end DTI:"}),(0,t.jsxs)(V,{variant:b<=36?"default":"destructive",className:"text-xs",children:[b.toFixed(1),"%"]})]}),(0,t.jsx)("div",{className:"text-xs text-gray-600",children:"All debt payments (target: ≤36%)"})]})]})]}),(0,t.jsxs)("div",{className:"mt-6 p-4 rounded-lg border",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-2",children:[_?(0,t.jsx)(M.Z,{className:"h-5 w-5 text-green-600"}):(0,t.jsx)(W.Z,{className:"h-5 w-5 text-red-600"}),(0,t.jsx)("span",{className:`font-medium ${_?"text-green-600":"text-red-600"}`,children:_?"Purchase Recommended":"Purchase Not Recommended"})]}),(0,t.jsx)("div",{className:"text-sm text-gray-600",children:_?"All financial metrics meet recommended guidelines for home purchase.":"Some financial metrics exceed recommended guidelines. Consider waiting or adjusting parameters."})]})]})]})}function eW(){let{state:e,updateFinancialData:s,projections:a}=(0,et.O)(),[l,i]=(0,n.useState)(1);if(!e.current_config||0===a.length)return(0,t.jsx)("div",{className:"max-w-7xl mx-auto p-6",children:(0,t.jsx)(h,{children:(0,t.jsx)(j,{className:"p-6 flex items-center justify-center",children:(0,t.jsx)("div",{className:"animate-pulse text-gray-500",children:"Loading timeline data..."})})})});let r=e.current_config.data.home_purchase_month,c=e=>{i(e)},d=e=>{s({home_purchase_month:e})};return(0,t.jsxs)("div",{className:"max-w-7xl mx-auto p-6 space-y-6",children:[(0,t.jsxs)(h,{children:[(0,t.jsxs)(u,{children:[(0,t.jsxs)(p,{className:"flex items-center text-xl",children:[(0,t.jsx)(ej.Z,{className:"h-6 w-6 mr-2"}),"Home Purchase Timeline"]}),(0,t.jsx)("p",{className:"text-gray-600",children:"Plan when to purchase your home based on cash flow and affordability"})]}),(0,t.jsx)(j,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsx)(w,{className:"text-sm font-medium",children:"Purchase Month"}),(0,t.jsxs)(V,{variant:"outline",children:["Month ",r," (Q",Math.ceil(r/3),")"]})]}),(0,t.jsx)(eU,{value:[r],onValueChange:e=>{let s=e[0];d(s),i(s)},max:24,min:1,step:1,className:"w-full"}),(0,t.jsxs)("div",{className:"flex justify-between text-xs text-gray-500 mt-1",children:[(0,t.jsx)("span",{children:"Month 1"}),(0,t.jsx)("span",{children:"Month 24"})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-4 text-sm",children:[(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"font-medium",children:"Current Setting"}),(0,t.jsxs)("div",{className:"text-gray-600",children:["Month ",r]})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"font-medium",children:"Home Price"}),(0,t.jsx)("div",{className:"text-gray-600",children:(0,el.xG)(e.current_config.data.housing.home_price)})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"font-medium",children:"Down Payment"}),(0,t.jsxs)("div",{className:"text-gray-600",children:[e.current_config.data.housing.down_pct,"%"]})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"font-medium",children:"Monthly Rent"}),(0,t.jsx)("div",{className:"text-gray-600",children:(0,el.xG)(e.current_config.data.cash.current_rent)})]})]})]})})]}),(0,t.jsxs)(h,{children:[(0,t.jsxs)(u,{children:[(0,t.jsx)(p,{children:"24-Month Cash Flow Timeline"}),(0,t.jsx)("p",{className:"text-gray-600",children:"Click on any month to see detailed affordability analysis"})]}),(0,t.jsxs)(j,{children:[(0,t.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8 gap-3",children:a.map(e=>(0,t.jsx)(eQ,{month:e.month,isSelected:l===e.month,isPurchaseMonth:r===e.month,isBeforePurchase:e.monthc(e.month)},e.month))}),(0,t.jsxs)("div",{className:"mt-4 flex flex-wrap gap-4 text-xs",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,t.jsx)(K.Z,{className:"h-3 w-3 text-blue-600"}),(0,t.jsx)("span",{children:"Purchase Month"})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,t.jsx)(M.Z,{className:"h-3 w-3 text-green-600"}),(0,t.jsx)("span",{children:"Positive Cash Flow"})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,t.jsx)(W.Z,{className:"h-3 w-3 text-yellow-600"}),(0,t.jsx)("span",{children:"Negative Cash Flow"})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,t.jsx)(W.Z,{className:"h-3 w-3 text-red-600"}),(0,t.jsx)("span",{children:"Insufficient Cash"})]})]})]})]}),(0,t.jsx)(eY,{selectedMonth:l,projections:a,housingData:e.current_config.data.housing,cashData:e.current_config.data.cash})]})}eU.displayName=eK.fC.displayName;var eq=a(11239),eX=a(73618);function eJ({debtId:e,debtName:s,currentBalance:a,minPayment:l,apr:i,extraPayments:r,onUpdatePayments:c}){let[d,m]=(0,n.useState)(0),[o,x]=(0,n.useState)(1),[g,v]=(0,n.useState)(24),f=()=>{let e=a,s=0;for(let a=0;a<360&&!(e<=0);a++){let t=Math.min(l+(r[a]||0)-i/100*e/12,e);if(e-=t,s++,a>=r.length&&e>0){let a=i/100/12;s+=Math.ceil(Math.log(1+e*a/l)/Math.log(1+a));break}}return s},b=(0,el.m)([{id:e,balance:a,min_payment:l,apr:i}],{[e]:r},f())[e]||[],_=(e,s)=>{let a=[...r];a[e]=s,c(a)},C=f(),F=(()=>{let e=a,s=0;for(let a=0;a<360&&e>0;a++){let t=l+(r[a]||0),n=i/100*e/12,c=Math.min(t-n,e);s+=n,e-=c}let t=a,n=0;for(let e=0;e<360&&t>0;e++){let e=i/100*t/12,s=Math.min(l-e,t);n+=e,t-=s}return n-s})(),k=r.reduce((e,s)=>e+s,0);return(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsxs)("div",{className:"flex justify-between items-start",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(p,{className:"flex items-center text-lg",children:[(0,t.jsx)(ev.Z,{className:"h-5 w-5 mr-2"}),s]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4 mt-2 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Balance:"}),(0,t.jsx)("div",{className:"font-medium",children:(0,el.xG)(a)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Min Payment:"}),(0,t.jsx)("div",{className:"font-medium",children:(0,el.xG)(l)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-gray-600",children:"APR:"}),(0,t.jsxs)("div",{className:"font-medium",children:[i.toFixed(2),"%"]})]})]})]}),(0,t.jsxs)("div",{className:"text-right space-y-1",children:[(0,t.jsxs)(V,{variant:"outline",className:"text-xs",children:[(0,t.jsx)(es.Z,{className:"h-3 w-3 mr-1"}),C," months"]}),(0,t.jsxs)(V,{variant:"default",className:"text-xs",children:[(0,t.jsx)(ea.Z,{className:"h-3 w-3 mr-1"}),"Save ",(0,el.xG)(F)]})]})]})}),(0,t.jsxs)(j,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"p-4 bg-gray-50 rounded-lg space-y-3",children:[(0,t.jsxs)("h4",{className:"font-medium text-sm flex items-center",children:[(0,t.jsx)(eq.Z,{className:"h-4 w-4 mr-2"}),"Apply Bulk Extra Payment"]}),(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`bulk-${e}`,className:"text-xs",children:"Amount"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 h-3 w-3 text-gray-400"}),(0,t.jsx)(N,{id:`bulk-${e}`,type:"number",value:d,onChange:e=>m(parseFloat(e.target.value)||0),className:"pl-7 text-xs",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`start-${e}`,className:"text-xs",children:"Start Month"}),(0,t.jsx)(N,{id:`start-${e}`,type:"number",min:"1",max:"24",value:o,onChange:e=>x(parseInt(e.target.value)||1),className:"text-xs"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`end-${e}`,className:"text-xs",children:"End Month"}),(0,t.jsx)(N,{id:`end-${e}`,type:"number",min:"1",max:"24",value:g,onChange:e=>v(parseInt(e.target.value)||24),className:"text-xs"})]}),(0,t.jsxs)("div",{className:"flex items-end space-x-1",children:[(0,t.jsx)(y,{size:"sm",onClick:()=>{if(d<=0||o<1||g>24||o>g)return;let e=[...r];for(let s=o-1;s{c(Array(24).fill(0))},className:"text-xs",children:"Clear"})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-medium text-sm mb-2",children:"Monthly Extra Payments"}),(0,t.jsx)("div",{className:"grid grid-cols-6 md:grid-cols-8 lg:grid-cols-12 gap-2",children:r.slice(0,24).map((e,s)=>(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(w,{className:"text-xs text-center block",children:["M",s+1]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-1 top-1/2 transform -translate-y-1/2 h-2 w-2 text-gray-400"}),(0,t.jsx)(N,{type:"number",value:e||"",onChange:e=>_(s,parseFloat(e.target.value)||0),className:"pl-4 text-xs h-8",placeholder:"0"})]})]},s))})]}),(0,t.jsx)(T,{type:"single",collapsible:!0,className:"w-full",children:(0,t.jsxs)(E,{value:"schedule",children:[(0,t.jsx)(z,{className:"text-sm font-medium",children:"Amortization Schedule"}),(0,t.jsx)(O,{children:(0,t.jsx)("div",{className:"overflow-x-auto max-h-64 overflow-y-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-xs text-left",children:[(0,t.jsx)("thead",{className:"sticky top-0 bg-gray-100",children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:"px-2 py-1",children:"M#"}),(0,t.jsx)("th",{className:"px-2 py-1",children:"Payment"}),(0,t.jsx)("th",{className:"px-2 py-1",children:"Principal"}),(0,t.jsx)("th",{className:"px-2 py-1",children:"Interest"}),(0,t.jsx)("th",{className:"px-2 py-1",children:"Balance"})]})}),(0,t.jsx)("tbody",{children:b.map((e,s)=>(0,t.jsxs)("tr",{className:s%2?"bg-white":"bg-gray-50",children:[(0,t.jsx)("td",{className:"px-2 py-1",children:s+1}),(0,t.jsx)("td",{className:"px-2 py-1",children:(0,el.xG)(e.payment)}),(0,t.jsx)("td",{className:"px-2 py-1",children:(0,el.xG)(e.principal)}),(0,t.jsx)("td",{className:"px-2 py-1",children:(0,el.xG)(e.interest)}),(0,t.jsx)("td",{className:"px-2 py-1",children:(0,el.xG)(e.balance)})]},s))})]})})})]})}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 pt-2 border-t",children:[(0,t.jsxs)("div",{className:"text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Total Extra Payments:"}),(0,t.jsx)("div",{className:"font-medium text-blue-600",children:(0,el.xG)(k)})]}),(0,t.jsxs)("div",{className:"text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Interest Saved:"}),(0,t.jsx)("div",{className:"font-medium text-green-600",children:(0,el.xG)(F)})]})]})]})]})}function e0({receipts:e,onUpdateReceipts:s}){let a=(a,t)=>{let n=[...e];n[a]=t,s(n)},n=e.reduce((e,s)=>e+s,0);return(0,t.jsxs)(h,{children:[(0,t.jsxs)(u,{children:[(0,t.jsxs)(p,{className:"flex items-center",children:[(0,t.jsx)(U.Z,{className:"h-5 w-5 mr-2"}),"Lump Sum Receipts"]}),(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Plan for bonuses, tax refunds, or other one-time income"})]}),(0,t.jsxs)(j,{className:"space-y-4",children:[(0,t.jsx)("div",{className:"grid grid-cols-6 md:grid-cols-8 lg:grid-cols-12 gap-2",children:e.slice(0,24).map((e,s)=>(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(w,{className:"text-xs text-center block",children:["M",s+1]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-1 top-1/2 transform -translate-y-1/2 h-2 w-2 text-gray-400"}),(0,t.jsx)(N,{type:"number",value:e||"",onChange:e=>a(s,parseFloat(e.target.value)||0),className:"pl-4 text-xs h-8",placeholder:"0"})]})]},s))}),(0,t.jsx)("div",{className:"pt-2 border-t",children:(0,t.jsxs)("div",{className:"text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Total Expected Receipts:"}),(0,t.jsx)("div",{className:"font-medium text-green-600",children:(0,el.xG)(n)})]})})]})]})}function e1({schedule:e}){return e&&0!==e.length?(0,t.jsx)("div",{className:"overflow-x-auto mt-3",children:(0,t.jsxs)("table",{className:"min-w-full text-xs text-left border",children:[(0,t.jsx)("thead",{className:"bg-gray-100",children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:"px-2 py-1 border",children:"Mo"}),(0,t.jsx)("th",{className:"px-2 py-1 border",children:"Pmt"}),(0,t.jsx)("th",{className:"px-2 py-1 border",children:"Prin"}),(0,t.jsx)("th",{className:"px-2 py-1 border",children:"Int"}),(0,t.jsx)("th",{className:"px-2 py-1 border",children:"Cum Prin"}),(0,t.jsx)("th",{className:"px-2 py-1 border",children:"Cum Int"}),(0,t.jsx)("th",{className:"px-2 py-1 border",children:"Balance"})]})}),(0,t.jsx)("tbody",{children:e.map(e=>(0,t.jsxs)("tr",{className:"odd:bg-white even:bg-gray-50",children:[(0,t.jsx)("td",{className:"px-2 py-1 border text-center",children:e.month+1}),(0,t.jsx)("td",{className:"px-2 py-1 border",children:(0,el.xG)(Number.isFinite(e.payment)?e.payment:0)}),(0,t.jsx)("td",{className:"px-2 py-1 border",children:(0,el.xG)(Number.isFinite(e.principal)?e.principal:0)}),(0,t.jsx)("td",{className:"px-2 py-1 border",children:(0,el.xG)(Number.isFinite(e.interest)?e.interest:0)}),(0,t.jsx)("td",{className:"px-2 py-1 border",children:(0,el.xG)(Number.isFinite(e.cumulative_principal)?e.cumulative_principal:0)}),(0,t.jsx)("td",{className:"px-2 py-1 border",children:(0,el.xG)(Number.isFinite(e.cumulative_interest)?e.cumulative_interest:0)}),(0,t.jsx)("td",{className:"px-2 py-1 border",children:(0,el.xG)(Number.isFinite(e.balance)?e.balance:0)})]},e.month))})]})}):null}function e2({debts:e,paymentMatrix:s}){let a=(0,el.m)(e,s.payments,24),n=e.map(e=>{let s=a[e.id]||[],t=s[s.length-1]?.balance||e.balance,n=e.balance-t,l=s.findIndex(e=>e.balance<=0)+1||null;return{...e,finalBalance:t,totalPaid:n,payoffMonth:l,reduction:n/e.balance*100}}),l=n.reduce((e,s)=>e+s.totalPaid,0),i=n.reduce((e,s)=>e+s.finalBalance,0);return(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsxs)(p,{className:"flex items-center",children:[(0,t.jsx)(eX.Z,{className:"h-5 w-5 mr-2"}),"24-Month Debt Payoff Summary"]})}),(0,t.jsx)(j,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4 p-4 bg-gray-50 rounded-lg",children:[(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-sm text-gray-600",children:"Total Debt Paid"}),(0,t.jsx)("div",{className:"text-lg font-bold text-green-600",children:(0,el.xG)(l)})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-sm text-gray-600",children:"Remaining Debt"}),(0,t.jsx)("div",{className:"text-lg font-bold text-red-600",children:(0,el.xG)(i)})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-sm text-gray-600",children:"Reduction Rate"}),(0,t.jsxs)("div",{className:"text-lg font-bold text-blue-600",children:[(l/(l+i)*100).toFixed(1),"%"]})]})]}),(0,t.jsx)("div",{className:"space-y-3",children:n.map(e=>(0,t.jsxs)("div",{className:"p-3 border rounded-lg",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsx)("span",{className:"font-medium",children:e.name}),(0,t.jsxs)("div",{className:"flex space-x-2",children:[e.payoffMonth&&(0,t.jsxs)(V,{variant:"default",className:"text-xs",children:["Paid off M",e.payoffMonth]}),(0,t.jsxs)(V,{variant:"outline",className:"text-xs",children:[e.reduction.toFixed(1),"% paid"]})]})]}),(0,t.jsxs)("details",{className:"mt-2",children:[(0,t.jsx)("summary",{className:"cursor-pointer text-sm text-blue-600 hover:underline select-none",children:"Amortization Schedule"}),(0,t.jsx)(e1,{schedule:a[e.id]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Original:"}),(0,t.jsx)("div",{children:(0,el.xG)(e.balance)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Paid:"}),(0,t.jsx)("div",{className:"text-green-600",children:(0,el.xG)(e.totalPaid)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Remaining:"}),(0,t.jsx)("div",{className:"text-red-600",children:(0,el.xG)(e.finalBalance)})]})]}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,t.jsx)("div",{className:"bg-green-600 h-2 rounded-full transition-all duration-300",style:{width:`${e.reduction}%`}})})})]},e.id))})]})})]})}function e4(){let{state:e,updateFinancialData:s}=(0,et.O)();if(!e.current_config)return(0,t.jsx)("div",{children:"Loading..."});let a=e.current_config.data,n=(e,t)=>{s({payment_matrix:{...a.payment_matrix,payments:{...a.payment_matrix.payments,[e]:t}}})};return(0,t.jsxs)("div",{className:"max-w-7xl mx-auto p-6",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold mb-2",children:"Strategic Payment Matrix"}),(0,t.jsx)("p",{className:"text-gray-600",children:"Optimize your debt paydown strategy with extra payments and plan for lump sum income"})]}),(0,t.jsxs)(d,{defaultValue:"debts",className:"space-y-6",children:[(0,t.jsxs)(m,{children:[(0,t.jsx)(o,{value:"debts",children:"Debt Strategy"}),(0,t.jsx)(o,{value:"receipts",children:"Lump Sum Income"})]}),(0,t.jsxs)(x,{value:"debts",className:"space-y-6",children:[a.debt_accounts.map(e=>(0,t.jsx)(eJ,{debtId:e.id,debtName:e.name,currentBalance:e.balance,minPayment:e.min_payment,apr:e.apr,extraPayments:a.payment_matrix.payments[e.id]||Array(24).fill(0),onUpdatePayments:s=>n(e.id,s)},e.id)),(0,t.jsx)(e2,{debts:a.debt_accounts,paymentMatrix:a.payment_matrix})]}),(0,t.jsx)(x,{value:"receipts",children:(0,t.jsx)(e0,{receipts:a.payment_matrix.receipts,onUpdateReceipts:e=>{s({payment_matrix:{...a.payment_matrix,receipts:e}})}})})]})]})}function e6({debt:e,onUpdate:s,onRemove:a}){return(0,t.jsx)(h,{className:"mb-4",children:(0,t.jsxs)(j,{className:"p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`debt-name-${e.id}`,children:"Debt Name"}),(0,t.jsx)(N,{id:`debt-name-${e.id}`,value:e.name,onChange:e=>s({name:e.target.value}),placeholder:"Debt name"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`debt-balance-${e.id}`,children:"Current Balance"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`debt-balance-${e.id}`,type:"number",value:e.balance,onChange:e=>s({balance:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`debt-min-${e.id}`,children:"Minimum Payment"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(L.Z,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)(N,{id:`debt-min-${e.id}`,type:"number",value:e.min_payment,onChange:e=>s({min_payment:parseFloat(e.target.value)||0}),className:"pl-10",placeholder:"0"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`debt-apr-${e.id}`,children:"APR (%)"}),(0,t.jsx)(N,{id:`debt-apr-${e.id}`,type:"number",value:e.apr,onChange:e=>s({apr:parseFloat(e.target.value)||0}),placeholder:"0"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:`debt-category-${e.id}`,children:"Category"}),(0,t.jsxs)(Z,{value:e.type,onValueChange:e=>s({type:e}),children:[(0,t.jsx)(S,{id:`debt-category-${e.id}`,className:"w-full",children:(0,t.jsx)(A,{placeholder:"Select"})}),(0,t.jsxs)(G,{children:[(0,t.jsx)(I,{value:"mortgage",children:"Mortgage"}),(0,t.jsx)(I,{value:"student_loan",children:"Student Loan"}),(0,t.jsx)(I,{value:"credit_card",children:"Credit Card"}),(0,t.jsx)(I,{value:"car_payment",children:"Car Payment"}),(0,t.jsx)(I,{value:"other",children:"Other"})]})]})]})]}),(0,t.jsx)("div",{className:"flex justify-end mt-4",children:(0,t.jsxs)(y,{variant:"destructive",size:"sm",onClick:a,children:[(0,t.jsx)(H.Z,{className:"h-4 w-4 mr-2"}),"Remove Debt"]})})]})})}function e3(){let{state:e,dispatch:s,updateFinancialData:a}=(0,et.O)();if(!e.current_config)return null;let n=e.current_config.data,l=(e,s)=>{a({debt_accounts:n.debt_accounts.map(a=>a.id===e?{...a,...s}:a)})},i=e=>{s({type:"REMOVE_DEBT_ACCOUNT",payload:e})},r=n.debt_accounts.reduce((e,s)=>e+s.balance,0);return(0,t.jsxs)("div",{className:"space-y-6 mb-10",children:[(0,t.jsxs)(h,{children:[(0,t.jsx)(u,{children:(0,t.jsxs)(p,{className:"flex items-center text-lg",children:[(0,t.jsx)(ea.Z,{className:"h-5 w-5 mr-2"})," Debt Accounts"]})}),(0,t.jsx)(j,{children:(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsxs)("p",{className:"text-gray-600 text-sm",children:["Total Debt: ",(0,el.xG)(r)]}),(0,t.jsxs)(y,{size:"sm",onClick:()=>{if(n.debt_accounts.length>=20){alert("Maximum 20 debt accounts allowed");return}s({type:"ADD_DEBT_ACCOUNT",payload:(0,en.WS)()})},disabled:n.debt_accounts.length>=20,children:[(0,t.jsx)(U.Z,{className:"h-4 w-4 mr-2"})," Add Debt Account"]})]})})]}),n.debt_accounts.map(e=>(0,t.jsx)(e6,{debt:e,onUpdate:s=>l(e.id,s),onRemove:()=>i(e.id)},e.id))]})}var e5=a(49027),e9=a(32489);let e8=e5.fC;e5.xz;let e7=e5.h_;e5.x8;let se=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)(e5.aV,{ref:a,className:c("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...s}));se.displayName=e5.aV.displayName;let ss=n.forwardRef(({className:e,children:s,...a},n)=>(0,t.jsxs)(e7,{children:[(0,t.jsx)(se,{}),(0,t.jsxs)(e5.VY,{ref:n,className:c("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:rounded-lg",e),...a,children:[s,(0,t.jsxs)(e5.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,t.jsx)(e9.Z,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));ss.displayName=e5.VY.displayName;let sa=({className:e,...s})=>(0,t.jsx)("div",{className:c("flex flex-col space-y-1.5 text-center sm:text-left",e),...s});sa.displayName="DialogHeader";let st=({className:e,...s})=>(0,t.jsx)("div",{className:c("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...s});st.displayName="DialogFooter";let sn=n.forwardRef(({className:e,...s},a)=>(0,t.jsx)(e5.Dx,{ref:a,className:c("text-lg font-semibold leading-none tracking-tight",e),...s}));sn.displayName=e5.Dx.displayName,n.forwardRef(({className:e,...s},a)=>(0,t.jsx)(e5.dk,{ref:a,className:c("text-sm text-muted-foreground",e),...s})).displayName=e5.dk.displayName;var sl=a(78867),si=a(92735),sr=a(98728),sc=a(83229),sd=a(69076),sm=a(17689),so=a(48736),sx=a(7795);function sh({config:e,isCurrent:s,onLoad:a,onDelete:n,onDownload:l,onDuplicate:i}){let r=e.data.income_sources.reduce((e,s)=>e+s.base_amount,0),c=e.data.debt_accounts.reduce((e,s)=>e+s.balance,0),d=e.data.housing.home_price;return(0,t.jsx)(h,{className:`${s?"border-blue-500 bg-blue-50":""}`,children:(0,t.jsxs)(j,{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h4",{className:"font-medium flex items-center",children:[e.name,s&&(0,t.jsx)(V,{className:"ml-2 text-xs bg-blue-600",children:"Current"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:e.description})]}),(0,t.jsxs)("div",{className:"flex space-x-1",children:[(0,t.jsx)(y,{size:"sm",variant:"outline",onClick:i,className:"text-xs px-2",children:(0,t.jsx)(sl.Z,{className:"h-3 w-3"})}),(0,t.jsx)(y,{size:"sm",variant:"outline",onClick:l,className:"text-xs px-2",children:(0,t.jsx)(si.Z,{className:"h-3 w-3"})}),!s&&(0,t.jsx)(y,{size:"sm",variant:"destructive",onClick:n,className:"text-xs px-2",children:(0,t.jsx)(H.Z,{className:"h-3 w-3"})})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-3 text-xs mb-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Income:"}),(0,t.jsxs)("div",{className:"font-medium",children:[(0,el.xG)(r),"/mo"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Total Debt:"}),(0,t.jsx)("div",{className:"font-medium",children:(0,el.xG)(c)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-gray-600",children:"Home Price:"}),(0,t.jsx)("div",{className:"font-medium",children:(0,el.xG)(d)})]})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center text-xs text-gray-500",children:[(0,t.jsxs)("span",{children:["Purchase Month: ",e.data.home_purchase_month]}),(0,t.jsxs)("span",{children:["Modified: ",new Date(e.last_modified).toLocaleDateString()]})]}),!s&&(0,t.jsx)(y,{size:"sm",onClick:a,className:"w-full mt-3",children:"Load Configuration"})]})})}function su({open:e,onOpenChange:s,onCreateConfig:a}){let[l,i]=(0,n.useState)(""),[r,c]=(0,n.useState)("");return(0,t.jsx)(e8,{open:e,onOpenChange:s,children:(0,t.jsxs)(ss,{children:[(0,t.jsx)(sa,{children:(0,t.jsx)(sn,{children:"Create New Configuration"})}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"config-name",children:"Configuration Name"}),(0,t.jsx)(N,{id:"config-name",value:l,onChange:e=>i(e.target.value),placeholder:"Enter configuration name"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"config-description",children:"Description"}),(0,t.jsx)(P,{id:"config-description",value:r,onChange:e=>c(e.target.value),placeholder:"Describe this financial scenario",rows:3})]})]}),(0,t.jsxs)(st,{children:[(0,t.jsx)(y,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),(0,t.jsx)(y,{onClick:()=>{l.trim()&&(a(l.trim(),r.trim()),i(""),c(""),s(!1))},disabled:!l.trim(),children:"Create Configuration"})]})]})})}function sp({open:e,onOpenChange:s,currentConfig:a,onSaveConfig:l}){let[i,r]=(0,n.useState)(""),[c,d]=(0,n.useState)("");return n.useEffect(()=>{a&&(r(a.name),d(a.description))},[a]),(0,t.jsx)(e8,{open:e,onOpenChange:s,children:(0,t.jsxs)(ss,{children:[(0,t.jsx)(sa,{children:(0,t.jsx)(sn,{children:"Save Configuration"})}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"save-name",children:"Configuration Name"}),(0,t.jsx)(N,{id:"save-name",value:i,onChange:e=>r(e.target.value),placeholder:"Enter configuration name"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(w,{htmlFor:"save-description",children:"Description"}),(0,t.jsx)(P,{id:"save-description",value:c,onChange:e=>d(e.target.value),placeholder:"Describe this financial scenario",rows:3})]})]}),(0,t.jsxs)(st,{children:[(0,t.jsx)(y,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),(0,t.jsx)(y,{onClick:()=>{i.trim()&&(l(i.trim(),c.trim()),s(!1))},disabled:!i.trim(),children:"Save Configuration"})]})]})})}function sj(){let{state:e,createNewConfig:s,loadConfig:a,saveCurrentConfig:l}=(0,et.O)(),[i,r]=(0,n.useState)(!1),[c,d]=(0,n.useState)(!1),[m,o]=(0,n.useState)(!1),[x,g]=(0,n.useState)(null),v=(0,n.useRef)(null),f=(0,n.useRef)(null),N=(e,s)=>{g({type:e,text:s}),setTimeout(()=>g(null),3e3)},b=e=>{try{a(e),N("success",`Loaded "${e.name}" configuration`)}catch(e){N("error","Failed to load configuration")}},_=e=>{if(window.confirm("Are you sure you want to delete this configuration?"))try{(0,sx.Xc)(e),N("success","Configuration deleted successfully"),window.location.reload()}catch(e){N("error","Failed to delete configuration")}},w=e=>{try{(0,sx.Es)(e),N("success","Configuration downloaded successfully")}catch(e){N("error","Failed to download configuration")}},C=e=>{try{let s=(0,sx.eD)(`${e.name} (Copy)`,`Copy of ${e.description}`,e.data);a(s),N("success","Configuration duplicated successfully")}catch(e){N("error","Failed to duplicate configuration")}},F=async e=>{let s=e.target.files?.[0];if(s){o(!0);try{let e=await (0,sx.Rh)(s);a(e),l(),N("success","Configuration uploaded successfully")}catch(e){N("error","Failed to upload configuration")}finally{o(!1),v.current&&(v.current.value="")}}},k=async e=>{let s=e.target.files?.[0];if(s){o(!0);try{let e=await (0,sx.nM)(s);N("success",`Imported ${e.length} configurations successfully`),window.location.reload()}catch(e){N("error","Failed to import configurations")}finally{o(!1),f.current&&(f.current.value="")}}};return(0,t.jsxs)("div",{className:"max-w-7xl mx-auto p-6",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h2",{className:"text-2xl font-bold flex items-center",children:[(0,t.jsx)(sr.Z,{className:"h-6 w-6 mr-2"}),"Configuration Manager"]}),(0,t.jsx)("p",{className:"text-gray-600",children:"Manage your financial scenarios and settings"})]}),(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsxs)(y,{onClick:()=>r(!0),className:"flex items-center",children:[(0,t.jsx)(U.Z,{className:"h-4 w-4 mr-2"}),"New Config"]}),(0,t.jsxs)(y,{variant:"outline",onClick:()=>d(!0),disabled:!e.current_config,children:[(0,t.jsx)(sc.Z,{className:"h-4 w-4 mr-2"}),"Save Current"]}),(0,t.jsxs)(y,{variant:"outline",onClick:()=>{try{localStorage.removeItem("home_budget_current_config"),localStorage.removeItem("home_budget_saved_configs");let e=(0,sx.eD)("Default Configuration","Reset to default values");a(e),l(),N("success","Configuration reset to defaults"),setTimeout(()=>window.location.reload(),500)}catch(e){N("error","Failed to reset configuration")}},disabled:m||!e.current_config,children:[(0,t.jsx)(sd.Z,{className:"h-4 w-4 mr-2"}),"Reset Default"]}),(0,t.jsxs)(y,{variant:"outline",onClick:()=>v.current?.click(),disabled:m,children:[(0,t.jsx)(sm.Z,{className:"h-4 w-4 mr-2"}),"Upload"]}),(0,t.jsxs)(y,{variant:"outline",onClick:()=>{try{(0,sx.em)(),N("success","All configurations exported successfully")}catch(e){N("error","Failed to export configurations")}},children:[(0,t.jsx)(si.Z,{className:"h-4 w-4 mr-2"}),"Export All"]}),(0,t.jsxs)(y,{variant:"outline",onClick:()=>f.current?.click(),disabled:m,children:[(0,t.jsx)(so.Z,{className:"h-4 w-4 mr-2"}),"Import Backup"]})]})]}),x&&(0,t.jsxs)("div",{className:`p-3 rounded-lg mb-4 flex items-center ${"success"===x.type?"bg-green-50 text-green-800 border border-green-200":"bg-red-50 text-red-800 border border-red-200"}`,children:["success"===x.type?(0,t.jsx)(M.Z,{className:"h-4 w-4 mr-2"}):(0,t.jsx)(W.Z,{className:"h-4 w-4 mr-2"}),x.text]})]}),e.current_config&&(0,t.jsxs)(h,{className:"mb-6",children:[(0,t.jsx)(u,{children:(0,t.jsxs)(p,{className:"flex items-center text-lg",children:[(0,t.jsx)(ej.Z,{className:"h-5 w-5 mr-2"}),"Current Configuration"]})}),(0,t.jsxs)(j,{children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"Name:"}),(0,t.jsx)("div",{className:"font-medium",children:e.current_config.name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"Income Sources:"}),(0,t.jsx)("div",{className:"font-medium",children:e.current_config.data.income_sources.length})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"Debt Accounts:"}),(0,t.jsx)("div",{className:"font-medium",children:e.current_config.data.debt_accounts.length})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"Purchase Month:"}),(0,t.jsxs)("div",{className:"font-medium",children:["Month ",e.current_config.data.home_purchase_month]})]})]}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"Description:"}),(0,t.jsx)("p",{className:"text-sm mt-1",children:e.current_config.description})]})]})]}),(0,t.jsxs)(h,{children:[(0,t.jsxs)(u,{children:[(0,t.jsx)(p,{children:"Saved Configurations"}),(0,t.jsxs)("p",{className:"text-sm text-gray-600",children:[e.saved_configs.length," configuration(s) saved"]})]}),(0,t.jsx)(j,{children:0===e.saved_configs.length?(0,t.jsxs)("div",{className:"text-center py-8 text-gray-500",children:[(0,t.jsx)(sr.Z,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),(0,t.jsx)("p",{children:"No saved configurations found"}),(0,t.jsx)("p",{className:"text-sm",children:"Create your first configuration to get started"})]}):(0,t.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:e.saved_configs.map(s=>(0,t.jsx)(sh,{config:s,isCurrent:e.current_config?.id===s.id,onLoad:()=>b(s),onDelete:()=>_(s.id),onDownload:()=>w(s),onDuplicate:()=>C(s)},s.id))})})]}),(0,t.jsx)("input",{type:"file",ref:v,onChange:F,accept:".json",style:{display:"none"}}),(0,t.jsx)("input",{type:"file",ref:f,onChange:k,accept:".json",style:{display:"none"}}),(0,t.jsx)(su,{open:i,onOpenChange:r,onCreateConfig:(e,a)=>{try{s(e,a),N("success","New configuration created successfully")}catch(e){N("error","Failed to create configuration")}}}),(0,t.jsx)(sp,{open:c,onOpenChange:d,currentConfig:e.current_config,onSaveConfig:(s,t)=>{if(e.current_config)try{let n={...e.current_config,name:s,description:t,last_modified:new Date().toISOString()};a(n),l(),N("success","Configuration saved successfully")}catch(e){N("error","Failed to save configuration")}}})]})}function sg(){let[e,s]=(0,n.useState)("overview"),{projections:a}=(0,et.O)(),l="financial"===e?[{value:"income",label:"Income"},{value:"investments",label:"Investments"},{value:"assets",label:"Assets"},{value:"lump-sum",label:"Lump Sum"},{value:"projections",label:"Projections"},{value:"regression",label:"Regression"}]:void 0;return(0,t.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,t.jsxs)(d,{value:e,onValueChange:s,className:"w-full",children:[(0,t.jsx)(eN,{activeTab:e,onTabChange:s,subNavItems:l}),(0,t.jsxs)("div",{className:"min-h-[calc(100vh-200px)] pt-6",children:[(0,t.jsx)(x,{value:"overview",className:"mt-0 pt-4",children:(0,t.jsx)("div",{className:"space-y-8 py-8",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4",children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("h3",{className:"text-xl font-semibold text-gray-900",children:"24 Month Cash Flow Timeline"}),(0,t.jsx)("div",{className:"h-96",children:(0,t.jsx)(ez,{projections:a})})]})})})}),(0,t.jsx)(x,{value:"income",className:"mt-0 pt-4",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4",children:(0,t.jsx)(eu,{defaultTab:"income"})})}),(0,t.jsx)(x,{value:"expenses",className:"mt-0 pt-4",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4",children:(0,t.jsx)(eu,{defaultTab:"expenses"})})}),(0,t.jsx)(x,{value:"investments",className:"mt-0 pt-4",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4",children:(0,t.jsx)(eu,{defaultTab:"investments"})})}),(0,t.jsx)(x,{value:"assets",className:"mt-0 pt-4",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4",children:(0,t.jsx)(eu,{defaultTab:"assets"})})}),(0,t.jsx)(x,{value:"lump-sum",className:"mt-0 pt-4",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4",children:(0,t.jsx)(eu,{defaultTab:"lump-sum"})})}),(0,t.jsx)(x,{value:"projections",className:"mt-0 pt-4",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4",children:(0,t.jsx)(eu,{defaultTab:"projections"})})}),(0,t.jsx)(x,{value:"regression",className:"mt-0 pt-4",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4",children:(0,t.jsx)(eu,{defaultTab:"regression"})})}),(0,t.jsx)(x,{value:"housing",className:"mt-0 pt-4",children:(0,t.jsxs)("div",{className:"max-w-7xl mx-auto px-4",children:[(0,t.jsx)(eu,{defaultTab:"housing"}),(0,t.jsxs)("div",{className:"mt-8",children:[(0,t.jsx)("h3",{className:"text-xl font-semibold text-gray-900 mb-6",children:"Home Purchase Planning"}),(0,t.jsx)(eW,{})]})]})}),(0,t.jsx)(x,{value:"debt",className:"mt-0 pt-4",children:(0,t.jsxs)("div",{className:"max-w-7xl mx-auto px-4",children:[(0,t.jsx)(e3,{}),(0,t.jsx)(e4,{})]})}),(0,t.jsx)(x,{value:"charts",className:"mt-0 pt-4",children:(0,t.jsx)("div",{className:"space-y-8 py-8",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4",children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("h3",{className:"text-xl font-semibold text-gray-900",children:"Financial Analytics"}),(0,t.jsx)(eH,{}),(0,t.jsxs)("div",{className:"mt-8",children:[(0,t.jsx)("h3",{className:"text-xl font-semibold text-gray-900 mb-6",children:"Home Purchase Planning"}),(0,t.jsx)(eW,{})]})]})})})}),(0,t.jsx)(x,{value:"config",className:"mt-0 pt-4",children:(0,t.jsx)(sj,{})})]})]}),(0,t.jsx)("footer",{className:"bg-gray-900 text-white py-8 mt-12",children:(0,t.jsxs)("div",{className:"max-w-7xl mx-auto px-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h4",{className:"font-semibold mb-3 flex items-center",children:[(0,t.jsx)(K.Z,{className:"h-5 w-5 mr-2"}),"Home Budget Planner"]}),(0,t.jsx)("p",{className:"text-gray-400 text-sm",children:"Comprehensive financial planning tool for smart home purchases and debt management."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-3",children:"Features"}),(0,t.jsxs)("ul",{className:"space-y-1 text-sm text-gray-400",children:[(0,t.jsx)("li",{children:"24-month financial projections"}),(0,t.jsx)("li",{children:"Strategic debt paydown planning"}),(0,t.jsx)("li",{children:"Home affordability analysis"}),(0,t.jsx)("li",{children:"Interactive timeline planning"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-3",children:"Quick Actions"}),(0,t.jsxs)("ul",{className:"space-y-1 text-sm text-gray-400",children:[(0,t.jsx)("li",{children:"Save configurations locally"}),(0,t.jsx)("li",{children:"Export financial plans"}),(0,t.jsx)("li",{children:"Import scenarios"}),(0,t.jsx)("li",{children:"Real-time calculations"})]})]})]}),(0,t.jsx)("div",{className:"border-t border-gray-800 mt-8 pt-8 text-center text-sm text-gray-400",children:(0,t.jsx)("p",{children:" 2025 Home Budget Planner. Built with modern financial planning tools."})})]})})]})}}},function(e){e.O(0,[242,752,971,117,744],function(){return e(e.s=22363)}),_N_E=e.O()}]);