PageSourceSearch

https://homelover.ai/assets/GeneralRateAlertDialog-Dpr68Fzx.js

js homelover.ai collected 2026-10-05 14:36:59 UTC 27,279 bytes, 1 lines download raw bytes

1import{ab as d,q as it,r as n,j as e,az as Ie,aA as Ee,k as O,aB as Le,aC as Be,a2 as R,aD as qe,A as ct,m as E,H as V,a as x,a6 as W,a9 as g,a1 as dt,a8 as L,I as Ue,Y as oe,ag as ie,ad as C,aF as mt,aj as De,ak as ze,al as Ye,am as $e,an as b,_ as c}from"./index-Dt9APr6E.js";import{u as ut}from"./usePubRecMortgage-D9uKm7r8.js";import{u as xt}from"./usePropertyAnalysis-DJeAyIcs.js";import{m as pt}from"./mortgageSource-Dr8clos8.js";import{T as ht}from"./trending-up-Bs3cDfGz.js";import{I as gt}from"./info-Bm8pQPYU.js";import{P as ft}from"./pencil-CF0ki14m.js";import{U as yt}from"./upload-CW7OZtfE.js";async function jt(N,f,m){if(!N||!(f!=null&&f.trim()))return;const B=new Date().toISOString(),{data:v}=await d.from("property_overrides").select("id, mortgage_overrides").eq("user_id",N).eq("address",f).eq("is_owner",!0).maybeSingle(),p={...(v==null?void 0:v.mortgage_overrides)??{},...m.balance?{balance:Math.round(m.balance)}:{},...m.rate?{rate:m.rate}:{},...m.payment?{payment:Math.round(m.payment)}:{},...m.lender?{lender:m.lender}:{},...m.balance?{balanceSource:m.source}:{},...m.rate?{rateSource:m.source}:{}};v!=null&&v.id?await d.from("property_overrides").update({mortgage_overrides:p,balance_snapshot_date:B}).eq("id",v.id):await d.from("property_overrides").insert({user_id:N,address:f,is_owner:!0,mortgage_overrides:p,balance_snapshot_date:B})}function vt({open:N,onOpenChange:f,variant:m="modal"}){const B=m==="panel",v=it(),[p,y]=n.useState("purpose"),[H,ce]=n.useState(null),[u,k]=n.useState(""),[J,Ge]=n.useState([]),{data:K,loading:Q,fetchMortgage:Me}=ut(),{data:X,loading:Z,fetchPropertyData:Oe}=xt(),[h,q]=n.useState({balance:null,payment:null,rate:null,loanTerm:null}),[Ve,F]=n.useState(!1),[de,me]=n.useState(""),[ue,xe]=n.useState(""),[pe,he]=n.useState(""),[ge,fe]=n.useState("360"),[A,ye]=n.useState(""),[w,ee]=n.useState("savings"),[te,je]=n.useState(""),[ve,ae]=n.useState(null),U=n.useRef(null),[be,Ne]=n.useState(!1),[re,we]=n.useState(""),[se,Se]=n.useState(""),[ne,_e]=n.useState(""),[Ae,Ce]=n.useState(""),[le,Pe]=n.useState(""),[S,Re]=n.useState(null),[D,z]=n.useState(!1);n.useEffect(()=>{d.auth.getSession().then(({data:{session:a}})=>{var r;Re(((r=a==null?void 0:a.user)==null?void 0:r.id)??null)});const{data:{subscription:t}}=d.auth.onAuthStateChange((a,r)=>{var l;Re(((l=r==null?void 0:r.user)==null?void 0:l.id)??null)});return()=>t.unsubscribe()},[]),n.useEffect(()=>{N||(y("purpose"),ce(null),k(""),we(""),Se(""),_e(""),Ce(""),Pe(""),q({balance:null,payment:null,rate:null,loanTerm:null}),ye(""),je(""),ee("savings"),ae(null),F(!1))},[N]),n.useEffect(()=>{if(!N)return;let t=!0;return(async()=>{const{data:{user:a}}=await d.auth.getUser();if(!a)return;const{data:r}=await d.from("owned_homes").select("address").eq("user_id",a.id).limit(20);if(!t||!r)return;const l=Array.from(new Set(r.map(s=>s.address).filter(Boolean)));Ge(l),l.length===1&&k(s=>s||l[0])})(),()=>{t=!1}},[N]);const ke=t=>{ce(t),y(t==="refinance"?"refinance-address":"general-form")},Y=t=>t.toLowerCase().replace(/[^a-z0-9]/g,""),We=async t=>{const{data:{user:a}}=await d.auth.getUser();if(!a)return;const[r,l]=await Promise.all([d.from("owned_homes").select("address, mortgage_balance, interest_rate, balance_source, rate_source").eq("user_id",a.id).limit(20),d.from("property_overrides").select("address, is_owner, mortgage_overrides").eq("user_id",a.id).limit(30)]),s=(r.data??[]).find(_=>Y(_.address??"")===Y(t)),i=(l.data??[]).find(_=>_.is_owner&&Y(_.address??"")===Y(t)),o=(i==null?void 0:i.mortgage_overrides)??{},j=Number(o.balance)||Number(s==null?void 0:s.mortgage_balance)||null,P=Number(o.rate)||Number(s==null?void 0:s.interest_rate)||null,M=Number(o.payment)||null,ot=o.balanceSource||((s==null?void 0:s.balance_source)??null);(j||P||M)&&(q(_=>({balance:j??_.balance,payment:M??_.payment,rate:P??_.rate,loanTerm:_.loanTerm})),ae(ot??"user"))},He=async()=>{if(!u.trim()){c({title:"Please enter your property address",variant:"destructive"});return}await Promise.all([Me(u),Oe(u),We(u)]),y("refinance-mortgage")},Je=()=>{f(!1),v(`/analyze?address=${encodeURIComponent(u)}&owner=true`)},T=t=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t),I=t=>{const a=t.replace(/[^0-9]/g,"");if(!a)return"";const r=parseInt(a,10);return new Intl.NumberFormat("en-US").format(r)},$=t=>{const a=t.replace(/[^0-9.]/g,""),r=parseFloat(a);return isNaN(r)?null:r},G=()=>{var j;const t=(j=K==null?void 0:K.mortgages)==null?void 0:j.find(P=>P.position===1),a=X==null?void 0:X.mortgage,r=(t==null?void 0:t.balance)||(a==null?void 0:a.balance)||0,l=(t==null?void 0:t.monthlyPayment)||(a==null?void 0:a.monthlyPayment)||0,s=(t==null?void 0:t.rate)||(a==null?void 0:a.interestRate)||null,i=(t==null?void 0:t.lender)||(a==null?void 0:a.lender)||null,o=(t==null?void 0:t.loanType)||(a==null?void 0:a.loanType)||null;return{balance:h.balance??r,payment:h.payment??l,rate:h.rate??s,lender:i,loanType:o,hasData:r>0||l>0}},Fe=(t=!1)=>{const a=G(),r={address:u,targetRate:t&&w==="rate"&&A?parseFloat(A):null,savingsAmount:t&&w==="savings"?$(te):null,alertMode:w,currentRate:a.rate,balance:a.balance,payment:a.payment,lender:a.lender,mortgageOverrides:h};localStorage.setItem("pendingRateAlert",JSON.stringify(r))},Ke=()=>{var a;if(!S){Fe(!1),y("auth-required");return}const t=G();me(t.balance?Math.round(t.balance).toString():""),xe(t.payment?Math.round(t.payment).toString():""),he(t.rate?t.rate.toString():""),fe(((a=h.loanTerm)==null?void 0:a.toString())||"360"),F(!0)},Qe=()=>{const t=$(de),a=$(ue),r=parseFloat(pe),l=parseInt(ge),s=t!==null&&t>0?t:h.balance,i=a!==null&&a>
10?a:h.payment,o=!isNaN(r)&&r>0&&r<30?r:h.rate;q({balance:s,payment:i,rate:o,loanTerm:isNaN(l)?h.loanTerm:l}),ae("user"),S&&u.trim()&&(async()=>{try{(s||o)&&await d.from("owned_homes").update({...s?{mortgage_balance:Math.round(s),balance_source:"user",balance_linked_at:new Date().toISOString()}:{},...o?{interest_rate:o,rate_source:"user"}:{}}).eq("user_id",S).eq("address",u),await jt(S,u,{balance:s,rate:o,payment:i,source:"user"})}catch(j){console.error("Could not sync mortgage edit",j)}})(),F(!1)},Xe=async(t,a)=>{const r=G(),{error:l}=await d.from("saved_properties").insert({user_id:t,address:u,notes:`Rate alert property. Current rate: ${r.rate}%, Balance: ${r.balance?T(r.balance):"N/A"}`});if(l&&console.error("Error saving property:",l),a!=null&&a.targetRate||a!=null&&a.savingsAmount){const{error:s}=await d.from("rate_alerts").insert({user_id:t,address:u,alert_type:a.savingsAmount?"savings":"rate",target_rate:a.targetRate??null,savings_amount:a.savingsAmount??null,points_option:"without",closing_costs:"borrower",is_active:!0,set_by_user_id:t,set_by_role:"client"});if(s)throw s}return{success:!0}},Ze=async t=>{var r;const a=(r=t.target.files)==null?void 0:r[0];if(a){if(a.type!=="application/pdf"){c({title:"Invalid file type",description:"Please upload a PDF mortgage statement.",variant:"destructive"});return}Ne(!0);try{const l=await a.arrayBuffer(),s=btoa(new Uint8Array(l).reduce((P,M)=>P+String.fromCharCode(M),"")),{data:i,error:o}=await d.functions.invoke("parse-mortgage-statement",{body:{pdfContent:s,mimeType:a.type}});if(o||!(i!=null&&i.success))throw new Error((i==null?void 0:i.error)||(o==null?void 0:o.message)||"Failed to parse statement");const j=i.data;q({balance:j.principalBalance??h.balance,payment:j.monthlyPayment??h.payment,rate:j.interestRate??h.rate,loanTerm:h.loanTerm}),c({title:"Statement processed",description:"Mortgage data extracted successfully."})}catch(l){console.error("Error processing statement:",l),c({title:"Processing failed",description:"Unable to extract data from the statement.",variant:"destructive"})}finally{Ne(!1),U.current&&(U.current.value="")}}},et=async()=>{const t=$(te),a=parseFloat(A);if(w==="savings"){if(!t||t<=0){c({title:"Please enter a monthly savings amount",variant:"destructive"});return}}else{if(!A){c({title:"Please enter your target rate",variant:"destructive"});return}if(isNaN(a)||a<=0||a>20){c({title:"Please enter a valid target rate",variant:"destructive"});return}}if(!S){Fe(!0),y("auth-required");return}z(!0);try{await Xe(S,w==="savings"?{savingsAmount:t}:{targetRate:a}),c({title:"Rate Alert Set!",description:(w==="savings"?`We'll notify you when a refinance could save you ${T(t)} or more a month. `:`We'll notify you when rates drop to ${a}% or below. `)+"It's saved under Rate alerts in your saved work, and your loan officer can see it."}),f(!1)}catch(r){console.error("Error saving rate alert:",r),c({title:"Failed to save alert",description:r.message||"Please try again.",variant:"destructive"})}finally{z(!1)}},tt=async()=>{if(!re){c({title:"Please select a loan type",variant:"destructive"});return}if(!se||!ne){c({title:"Please enter sales price and loan amount",variant:"destructive"});return}if(!Ae){c({title:"Please select a loan program",variant:"destructive"});return}if(!le){c({title:"Please enter your desired rate",variant:"destructive"});return}if(!S){y("auth-required");return}z(!0);try{const{error:t}=await d.from("rate_alerts").insert({user_id:S,address:`General Alert - ${re}`,alert_type:"rate",target_rate:parseFloat(le),points_option:"without",closing_costs:"borrower",is_active:!0,set_by_user_id:S,set_by_role:"client"});if(t)throw t;c({title:"Rate Alert Set!",description:"Saved under Rate alerts in your saved work — your loan officer can see it too."}),f(!1)}catch(t){console.error("Error saving rate alert:",t),c({title:"Failed to save alert",description:t.message||"Please try again.",variant:"destructive"})}finally{z(!1)}},Te=()=>{localStorage.setItem("authRedirect",window.location.pathname),f(!1),v("/auth")},at=()=>e.jsxs(E.div,{initial:{opacity:0,x:20}
1,animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[e.jsx("div",{className:"text-center mb-6",children:e.jsx("p",{className:"text-muted-foreground",children:"What type of rate alert would you like to set up?"})}),e.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[e.jsxs("button",{onClick:()=>ke("refinance"),className:"flex items-start gap-4 p-4 rounded-xl border-2 border-muted hover:border-primary bg-card hover:bg-primary/5 transition-all text-left group",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary/10 flex items-center justify-center flex-shrink-0 group-hover:bg-primary/20 transition-colors",children:e.jsx(V,{className:"w-6 h-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Refinance Rate Alert"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"For homeowners looking to refinance. We'll analyze your current mortgage and alert you to savings opportunities."})]})]}),e.jsxs("button",{onClick:()=>ke("general"),className:"flex items-start gap-4 p-4 rounded-xl border-2 border-muted hover:border-primary bg-card hover:bg-primary/5 transition-all text-left group",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-secondary/10 flex items-center justify-center flex-shrink-0 group-hover:bg-secondary/20 transition-colors",children:e.jsx(ht,{className:"w-6 h-6 text-secondary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"General Rate Alert"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Monitor rates for a future purchase or general market tracking. Set your target rate and we'll notify you."})]})]})]})]}),rt=()=>e.jsxs(E.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[e.jsxs(x,{variant:"ghost",size:"sm",className:"mb-2 -ml-2",onClick:()=>y("purpose"),children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),"Back"]}),e.jsxs("div",{className:"space-y-4",children:[J.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Choose one of your homes"}),e.jsx("div",{className:"space-y-2",children:J.map(t=>e.jsxs("button",{type:"button",onClick:()=>k(t),className:O("w-full text-left px-4 py-3 rounded-lg border transition-colors flex items-center gap-3",u===t?"border-primary bg-primary/5":"border-border hover:border-primary/40"),children:[e.jsx(V,{className:"w-4 h-4 text-primary flex-shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:t})]},t))})]}),J.length===0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Enter your property address"}),e.jsx(dt,{value:u,onChange:k,onSelect:t=>k(t),placeholder:"Enter your address..."})]}),e.jsxs("div",{className:"flex gap-3 p-3 rounded-lg bg-primary/5 border border-primary/20",children:[e.jsx(gt,{className:"w-5 h-5 text-primary flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"We'll use this address to pull your property data and current mortgage information for accurate rate monitoring."})]}),e.jsx(x,{className:"w-full",onClick:He,disabled:Q||Z,children:Q||Z?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-4 h-4 mr-2 animate-spin"}),"Fetching mortgage data..."]}):e.jsxs(e.Fragment,{children:["Continue",e.jsx(Ue,{className:"w-4 h-4 ml-2"})]})})]})]}),st=()=>{const t=G(),a=Q||Z;return e.jsxs(E.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-4",children:[e.jsxs(x,{variant:"ghost",size:"sm",className:"-ml-2",onClick:()=>y("refinance-address"),children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),"Back"]}),a?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(L,{className:"w-8 h-8 animate-spin text-primary"})}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"p-3 rounded-xl bg-muted/50 border border-border",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(V,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:u}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Your property"})]})]})}),e.jsxs("div",{className:"p-4 rounded-xl bg-card border border-border space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"font-semibold text-foreground",children:"Current Mortgage"}),e.jsxs(x,{variant:"outline",size:"sm",onClick:Ke,className:"h-7 text-xs",children:[e.jsx(ft,{className:"w-3 h-3 mr-1"}),"Edit"]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Balance"}),e.jsx("p",{className:"text-lg font-bold text-foreground",children:t.balance?T(t.balance):"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Payment"}),e.jsx("p",{className:"text-lg font-bold text-foreground",children:t.payment?T(t.payment):"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Rate"}),e.jsx("p",{className:"text-lg font-bold text-foreground",children:t.rate?`${t.rate}%`:"N/A"})]})]}),t.lender&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Lender: ",t.lender]}),ve&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Source: ",pt(ve)]})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-secondary/5 border border-secondary/20 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4 text-secondary"}),e.jsx("h4",{className:"font-semibold text-foreground",children:"Set Rate Alert"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>ee("savings"),className:O("flex items-center justify-center gap-2 rounded-lg border px-3 py-2 text-sm font-medium transition-colors",w==="savings"?"border-primary bg-primary/5 text-foreground":"border-border text-muted-foreground hover:border-primary/40"),children:[e.jsx(oe,{className:"w-4 h-4"}),"Monthly savings"]}),e.jsxs("button",{type:"button",onClick:()=>ee("rate"),className:O("flex items-center justify-center gap-2 rounded-lg border px-3 py-2 text-sm font-medium transition-colors",w==="rate"?"border-primary bg-primary/5 text-foreground":"border-border text-muted-foreground hover:border-primary/40"),children:[e.jsx(ie,{className:"w-4 h-4"}),"Interest rate"]})]}),w==="savings"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{className:"text-sm",children:"Alert me when I could save at least:"}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),e.jsx(C,{type:"text",placeholder:"250",value:I(te),onChange:r=>je(r.target.value.replace(/[^0-9]/g,"")),className:"pl-7 pr-14"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-muted-foreground",children:"/mo"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"We compare today's rates against your current payment and tell you when the monthly savings reach your number."})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{className:"text-sm",children:"Alert me when rates drop to:"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"relative flex-1",children:[e.jsx(C,{type:"number",step:"0.125",placeholder:"Enter target rate",value:A,onChange:r=>ye(r.target.value),className:"pr-8"}),e.jsx(ie,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"})]})}),t.rate&&A&&parseFloat(A)<t.rate&&e.jsxs("p",{className:"text-xs text-secondary",children:["Potential savings: ~",T(Math.round((t.rate-parseFloat(A))/100*(t.balance||0)/12)),"/mo"]})]}),e.jsx(x,{className:"w-full bg-primary hover:bg-primary/90 text-primary-foreground",onClick:et,disabled:D,children:D?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-4 h-4 mr-2 animate-spin"}),"Setting Alert..."]}
1):e.jsxs(e.Fragment,{children:["Set Rate Alert",e.jsx(R,{className:"w-4 h-4 ml-2"})]})})]}),e.jsx("div",{className:"text-center",children:e.jsx("button",{onClick:Je,className:"text-xs text-muted-foreground hover:text-foreground transition-colors underline",children:"View full property analysis →"})})]}),e.jsx(Ie,{open:Ve,onOpenChange:F,children:e.jsxs(Ee,{className:"sm:max-w-md",children:[e.jsxs(Le,{children:[e.jsx(Be,{children:"Edit Mortgage Details"}),e.jsx(qe,{children:"Update your mortgage details for accurate rate comparisons."})]}),e.jsxs("div",{className:"space-y-4 py-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{className:"text-sm",children:"Remaining Balance"}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),e.jsx(C,{type:"text",value:I(de),onChange:r=>me(r.target.value.replace(/[^0-9]/g,"")),className:"pl-7",placeholder:"500,000"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{className:"text-sm",children:"Interest Rate"}),e.jsxs("div",{className:"relative",children:[e.jsx(C,{type:"number",step:"0.01",min:"0",max:"30",value:pe,onChange:r=>he(r.target.value),className:"pr-7",placeholder:"5.25"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{className:"text-sm",children:"Monthly Payment (P&I)"}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),e.jsx(C,{type:"text",value:I(ue),onChange:r=>xe(r.target.value.replace(/[^0-9]/g,"")),className:"pl-7",placeholder:"2,500"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{className:"text-sm",children:"Loan Term"}),e.jsxs("select",{value:ge,onChange:r=>fe(r.target.value),className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",children:[e.jsx("option",{value:"360",children:"30 Years"}),e.jsx("option",{value:"240",children:"20 Years"}),e.jsx("option",{value:"180",children:"15 Years"}),e.jsx("option",{value:"120",children:"10 Years"})]})]}),e.jsxs("div",{className:"pt-2 border-t border-border",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Or upload your statement for automatic extraction:"}),e.jsx("input",{ref:U,type:"file",accept:".pdf",onChange:Ze,className:"hidden"}),e.jsx(x,{variant:"outline",size:"sm",onClick:()=>{var r;return(r=U.current)==null?void 0:r.click()},disabled:be,className:"w-full",children:be?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-4 h-4 mr-2 animate-spin"}),"Processing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(yt,{className:"w-4 h-4 mr-2"}),"Upload PDF Statement"]})})]})]}),e.jsxs(mt,{children:[e.jsx(x,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),e.jsx(x,{onClick:Qe,children:"Save Changes"})]})]})})]})},nt=()=>e.jsxs(E.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-5",children:[e.jsxs(x,{variant:"ghost",size:"sm",className:"mb-2 -ml-2",onClick:()=>y("purpose"),children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),"Back"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Loan Type"}),e.jsxs(De,{value:re,onValueChange:we,children:[e.jsx(ze,{children:e.jsx(Ye,{placeholder:"Select loan type"})}),e.jsxs($e,{children:[e.jsx(b,{value:"purchase",children:"Purchase"}),e.jsx(b,{value:"refinance",children:"Refinance"}),e.jsx(b,{value:"cash-out",children:"Cash-Out Refinance"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Sales Price / Property Value"}),e.jsxs("div",{className:"relative",children:[e.jsx(oe,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(C,{type:"text",inputMode:"numeric",placeholder:"Enter property value",value:se?I(se):"",onChange:t=>Se(t.target.value.replace(/[^0-9]/g,"")),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Loan Amount"}),e.jsxs("div",{className:"relative",children:[e.jsx(oe,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(C,{type:"text",inputMode:"numeric",placeholder:"Enter loan amount",value:ne?I(ne):"",onCh
1ange:t=>_e(t.target.value.replace(/[^0-9]/g,"")),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Loan Program"}),e.jsxs(De,{value:Ae,onValueChange:Ce,children:[e.jsx(ze,{children:e.jsx(Ye,{placeholder:"Select loan program"})}),e.jsxs($e,{children:[e.jsx(b,{value:"conventional-30",children:"Conventional 30-Year Fixed"}),e.jsx(b,{value:"conventional-15",children:"Conventional 15-Year Fixed"}),e.jsx(b,{value:"fha-30",children:"FHA 30-Year Fixed"}),e.jsx(b,{value:"va-30",children:"VA 30-Year Fixed"}),e.jsx(b,{value:"arm-7",children:"7/1 ARM"}),e.jsx(b,{value:"arm-5",children:"5/1 ARM"}),e.jsx(b,{value:"jumbo-30",children:"Jumbo 30-Year Fixed"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Desired Rate"}),e.jsxs("div",{className:"relative",children:[e.jsx(C,{type:"number",step:"0.125",placeholder:"Enter target rate",value:le,onChange:t=>Pe(t.target.value),className:"pr-9"}),e.jsx(ie,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"We'll notify you when rates drop to or below this rate."})]}),e.jsx(x,{className:"w-full",onClick:tt,disabled:D,children:D?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-4 h-4 mr-2 animate-spin"}),"Setting Alert..."]}
1):e.jsxs(e.Fragment,{children:["Set Rate Alert",e.jsx(R,{className:"w-4 h-4 ml-2"})]})})]})]}),lt=()=>{const t=localStorage.getItem("pendingRateAlert"),a=t?JSON.parse(t).targetRate:!1;return e.jsxs(E.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[e.jsxs(x,{variant:"ghost",size:"sm",className:"mb-2 -ml-2",onClick:()=>y(H==="refinance"?"refinance-mortgage":"general-form"),children:[e.jsx(W,{className:"w-4 h-4 mr-1"}),"Back"]}),e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mx-auto",children:e.jsx(R,{className:"w-8 h-8 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:"Account Required"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:H==="refinance"?"To save this property to your dashboard and set up rate alerts, please create a free account or sign in.":"To save your rate alert and receive notifications, please create a free account or sign in."})]}),H==="refinance"&&e.jsxs("div",{className:"p-3 rounded-lg bg-muted/50 border border-border text-left space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-foreground",children:"After signing in, we'll:"}),e.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"w-3 h-3 text-primary"}),"Save this property to your dashboard"]}),a&&e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-3 h-3 text-secondary"}),"Set up your rate alert"]})]})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsxs(x,{className:"w-full",onClick:Te,children:["Create Free Account",e.jsx(Ue,{className:"w-4 h-4 ml-2"})]}),e.jsx(x,{variant:"outline",className:"w-full",onClick:Te,children:"Sign In"}),e.jsx(x,{variant:"ghost",className:"w-full text-muted-foreground",onClick:()=>f(!1),children:"Maybe Later"})]})]})]})};return e.jsx(Ie,{open:N,onOpenChange:f,children:e.jsxs(Ee,{className:O("overflow-y-auto",B?["max-w-xl w-full sm:max-w-xl h-screen max-h-screen top-0 right-0 left-auto bottom-0","translate-x-0 translate-y-0 rounded-none sm:rounded-none border-l border-y-0 border-r-0","max-sm:left-auto max-sm:right-0","grid-rows-[auto_1fr] content-start items-start","duration-300","data-[state=open]:zoom-in-100 data-[state=closed]:zoom-out-100","data-[state=open]:slide-in-from-top-0 data-[state=closed]:slide-out-to-top-0","data-[state=open]:slide-in-from-left-0 data-[state=closed]:slide-out-to-left-0","data-[state=open]:slide-in-from-right-full data-[state=closed]:slide-out-to-right-full"].join(" "):"sm:max-w-md max-h-[90vh]"),children:[e.jsxs(Le,{children:[e.jsxs(Be,{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-5 h-5 text-primary"}),"Rate Alert"]}),e.jsxs(qe,{children:[p==="purpose"&&"Get notified when mortgage rates match your criteria.",p==="refinance-address"&&"Enter your property address to get started.",p==="refinance-mortgage"&&"Review your current mortgage details.",p==="general-form"&&"Tell us about your loan preferences.",p==="auth-required"&&"Create an account to save your alert."]})]}),e.jsxs(ct,{mode:"wait",children:[p==="purpose"&&at(),p==="refinance-address"&&rt(),p==="refinance-mortgage"&&st(),p==="general-form"&&nt(),p==="auth-required"&&lt()]})]})})}const Rt=Object.freeze(Object.defineProperty({__proto__:null,GeneralRateAlertDialog:vt},Symbol.toStringTag,{value:"Module"}));export{vt as G,Rt as a,jt as m};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.