1import{r as x,j as e,L as X}from"./index-jmvXcevr.js";import{D as z,e as W}from"./ApplicationRoot-y5t5-Gv9.js";import{t as k}from"./phone-Gu3xayRM.js";import{Q as G,a as J}from"./quotexContact-DEcSzb1M.js";import{u as K}from"./usePublicAgency-CFd6Y_Hn.js";import{u as V}from"./useCustomer-tuMR238I.js";import{s as Z}from"./websiteApi-BY9tLgkb.js";import{A as ee}from"./arrow-left-BQI3gnRe.js";import{P as h}from"./phone-C7_hGS3m.js";import{M as v}from"./mail-CG1awQjK.js";import{M as $}from"./map-pin-Bh1mzHW7.js";import{S as L}from"./send-DA8-C6mv.js";import"./createLucideIcon-DuUBINCz.js";import"./agencyPublicProfile-Co75I0Ak.js";function fe(){const[w,Y]=x.useState(!1),[n,y]=x.useState(!1),[i,p]=x.useState(""),[l,S]=x.useState(""),s=K(),d=V(),t=s&&(d==null?void 0:d.tenantId)===s.id?d:null,F=z()==="agencyApp",c=t!=null&&t.assignedAgentId?W.users.get(t.assignedAgentId):void 0,a=(c==null?void 0:c.tenantId)===(s==null?void 0:s.id)?c:void 0,r=(s==null?void 0:s.phone)??G,m=a==null?void 0:a.phone,E=k(m??r),C=k(m),o=k(r),D=(a==null?void 0:a.name)??"Your assigned agent",u=(a==null?void 0:a.businessEmail)??(a==null?void 0:a.email)??(s==null?void 0:s.contactEmail),A=u?`mailto:${u}`:void 0,f=(s==null?void 0:s.contactEmail)??J,j=(s==null?void 0:s.address)??"Agency address on file",P=`mailto:${f}`,H=`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(j)}`;async function T(q){var I,M,_;if(q.preventDefault(),n)return;if(!s){p("This agency's contact form is currently unavailable. Please contact the agency directly.");return}y(!0),p(""),S("");const g=new FormData(q.currentTarget),Q=String(g.get("message")??"").trim(),N=(I=t==null?void 0:t.name)==null?void 0:I.trim(),b=(M=t==null?void 0:t.email)==null?void 0:M.trim(),U=(_=t==null?void 0:t.phone)==null?void 0:_.trim(),B=String(g.get("name")??"").trim(),R=String(g.get("email")??"").trim(),O=await Z({agencyId:s==null?void 0:s.id,source:"contact",name:B||N,email:R||b,phone:U,message:[s!=null&&s.name?`Agency: ${s.name}`:"",N?`Client: ${N}`:"",b?`Client email: ${b}`:"",Q].filter(Boolean).join(` 2 3`)});if(y(!1),!O.ok){S(O.fallback.href),p("Automatic delivery is temporarily unavailable. Open your email app to send the message.");return}Y(!0)}return F?e.jsxs("section",{className:"flex h-full min-h-0 flex-col gap-4 overflow-hidden bg-gradient-to-b from-[#fbf7ee] via-white to-white px-5 py-5",children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[e.jsx(X,{to:"/","aria-label":"Back to app home",className:"grid h-10 w-10 shrink-0 place-items-center rounded-full border border-ink-200 bg-white text-ink-900 shadow-sm",children:e.jsx(ee,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-[0.22em] text-gold-700",children:"Client mobile app"}),e.jsx("h1",{className:"font-display text-3xl leading-none text-ink-900",children:"Contact us"})]})]}),e.jsxs("div",{className:"shrink-0 rounded-3xl border border-gold-200 bg-gold-50/70 p-5 shadow-luxe",children:[e.jsx("div",{className:"text-[11px] font-bold uppercase tracking-[0.18em] text-gold-800",children:"Your personal agent"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-ink-900",children:D}),e.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[E&&e.jsxs("a",{href:E,className:"btn-primary min-h-[50px] rounded-2xl px-3 text-sm",children:[e.jsx(h,{className:"h-4 w-4"})," Call"]}),A&&u&&e.jsxs("a",{href:A,className:"flex min-h-[50px] items-center justify-center gap-2 rounded-2xl border border-ink-200 bg-white px-3 text-sm font-semibold text-ink-900 shadow-sm",children:[e.jsx(v,{className:"h-4 w-4"})," Email"]})]})]}),e.jsxs("div",{className:"shrink-0 rounded-3xl border border-ink-100 bg-white p-5 text-sm shadow-luxe",children:[e.jsx("div",{className:"text-[11px] font-bold uppercase tracking-[0.18em] text-gold-800",children:"Agency contact"}),e.jsx("div",{className:"mt-2 truncate text-lg font-semibold text-ink-900",children:(s==null?void 0:s.name)??"Your agency"}),e.jsxs("div",{className:"mt-3 grid gap-2",children:[o&&e.jsxs("a",{href:o,className:"flex min-h-[52px] items-center gap-3 rounded-2xl border border-ink-100 bg-ink-50 px-3 py-2 text-left text-ink-900 shadow-sm",children:[e.jsx(h,{className:"h-4 w-4 shrink-0 text-gold-600"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-ink-500",children:"Agency phone"}),e.jsx("div",{className:"truncate text-sm font-semibold",children:r})]})]}),e.jsxs("a",{href:P,className:"flex min-h-[52px] items-center gap-3 rounded-2xl border border-ink-100 bg-ink-50 px-3 py-2 text-left text-ink-900 shadow-sm",children:[e.jsx(v,{className:"h-4 w-4 shrink-0 text-gold-600"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-ink-500",children:"Agency email"}),e.jsx("div",{className:"truncate text-sm font-semibold",children:f})]})]}),e.jsxs("a",{href:H,target:"_blank",rel:"noopener noreferrer",className:"flex min-h-[52px] items-center gap-3 rounded-2xl border border-ink-100 bg-ink-50 px-3 py-2 text-left text-ink-900 shadow-sm",children:[e.jsx($,{className:"h-4 w-4 shrink-0 text-gold-600"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-ink-500",children:"Address"}),e.jsx("div",{className:"truncate text-sm font-semibold",children:j})]})]})]})]}),e.jsx("div",{className:"shrink-0",children:e.jsxs("div",{className:"rounded-3xl border border-ink-100 bg-white p-5 shadow-luxe",children:[e.jsx("div",{className:"text-[11px] font-bold uppercase tracking-[0.18em] text-ink-500",children:"Secure message"}),w?e.jsx("div",{className:"mt-2 rounded-2xl bg-emerald-50 px-4 py-2.5 text-sm font-semibold text-emerald-800",children:"Message sent to the agency portal."}):e.jsxs("form",{className:"mt-2.5 space-y-2.5",onSubmit:T,children:[e.jsx("textarea",{name:"message",className:"input min-h-[104px] resize-none rounded-2xl text-sm",placeholder:"Type your message...",required:!0}),i&&e.jsxs("div",{className:"rounded-2xl border border-red-200 bg-red-50 px-3 py-2 text-xs leading-relaxed text-red-800",children:[e.jsx("div",{children:i}),l&&e.jsx("a",{href:l,className:"mt-1.5 inline-flex font-semibold underline",children:"Open email app"})]}),e.jsxs("button",{type:"submit",className:"btn-gold min-h-[50px] w-full rounded-2xl",disabled:n,children:[e.jsx(L,{className:"h-4 w-4"})," ",n?"Sending...":"Send"]})]})]})})]}):e.jsxs("section",{className:"max-w-5xl mx-auto px-6 py-16 grid md:grid-cols-5 ga
3p-10",children:[e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("h1",{className:"font-display text-4xl",children:"Contact us"}),e.jsx("p",{className:"mt-3 text-ink-600 leading-relaxed",children:"For private client inquiries, policy questions, or quote support."}),e.jsxs("ul",{className:"mt-8 space-y-4 text-sm",children:[e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx(v,{className:"h-4 w-4 mt-0.5 text-gold-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-ink-500 text-xs uppercase tracking-wider",children:"Email"}),e.jsx("a",{className:"text-ink-900 underline-offset-4 hover:underline",href:P,children:f})]})]}),C&&m&&e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx(h,{className:"h-4 w-4 mt-0.5 text-gold-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-ink-500 text-xs uppercase tracking-wider",children:"Agent phone"}),e.jsx("a",{className:"text-ink-900 underline-offset-4 hover:underline",href:C,children:m})]})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx(h,{className:"h-4 w-4 mt-0.5 text-gold-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-ink-500 text-xs uppercase tracking-wider",children:"Agency phone"}),o?e.jsx("a",{className:"text-ink-900 underline-offset-4 hover:underline",href:o,children:r}):e.jsx("div",{className:"text-ink-900",children:r})]})]}),e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx($,{className:"h-4 w-4 mt-0.5 text-gold-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-ink-500 text-xs uppercase tracking-wider",children:"Address"}),e.jsx("a",{className:"text-ink-900 underline-offset-4 hover:underline",href:H,target:"_blank",rel:"noopener noreferrer",children:j})]})]})]})]}),e.jsx("div",{className:"md:col-span-3",children:e.jsx("div",{className:"card !p-6",children:w?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"font-display text-xl text-ink-900",children:"Thank you - message recorded"}),e.jsx("p",{className:"mt-2 text-sm text-ink-600",children:"Your message has been routed to the agency workspace."})]}):e.jsx(e.Fragment,{children:e.jsxs("form",{className:"space-y-3",onSubmit:T,children:[e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Name"}),e.jsx("input",{name:"name",className:"input",placeholder:"Your name",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Email"}),e.jsx("input",{name:"email",type:"email",className:"input",placeholder:"[email protected]",required:!0})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"How can we help?"}),e.jsx("textarea",{name:"message",className:"input min-h-[120px]",required:!0})]}),i&&e.jsxs("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800",children:[e.jsx("div",{children:i}),l&&e.jsx("a",{href:l,className:"mt-2 inline-flex font-semibold underline",children:"Open email app"})]}),e.jsxs("button",{type:"submit",className:"btn-primary",disabled:n,children:[e.jsx(L,{className:"h-4 w-4"})," ",n?"Sending...":"Send message"]})]})})})})]})}export{fe as ContactPage};
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.