1import{u as F,r as m,a1 as q,e as P,j as e,U as o,a5 as M,a6 as D,a4 as E,M as L,a2 as U}from"./index-BvUn3Htv.js";import{u as A,S as R,a as T}from"./SavedContactControls-BnewQcBV.js";import{M as z}from"./map-pin-CaYq1xzL.js";import{A as S}from"./arrow-right-esN1xLuo.js";function Q(){const a=A(),g=new URLSearchParams(F()),u=g.get("vehicle"),i=g.get("intent"),l=Number(g.get("amount")),p=i==="test-drive"||i==="financing"||i==="trade-in"||i==="purchase"||i==="general"?i:u?"test-drive":"general",f=p==="financing"&&Number.isSafeInteger(l)&&l>0&&l<=1e6?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(l):null,C=p==="financing"?`I have a question about financing${f?` for approximately ${f}`:""}. Please contact me to discuss options.`:u?"I am interested in scheduling a test drive or inquiry about the vehicle I selected.":"",[k,j]=m.useState(!1),[N,y]=m.useState(""),[t,w]=m.useState({}),x=m.useRef(null),h=q(),b=P(),c=s=>w(r=>{if(!r[s])return r;const d={...r};return delete d[s],d}),[n,v]=m.useState({firstName:"",lastName:"",email:"",phone:"",topic:p,message:C}),I=async s=>{if(s.preventDefault(),!h.isPending){y("");try{const r=await a.prepare();if(x.current??=crypto.randomUUID(),!(await h.mutateAsync({data:{...n,firstName:a.data.firstName,lastName:a.data.lastName,phone:a.data.phone,email:a.signedIn?a.email:n.email,contactDetails:a.contactDetails,...b.data,submissionId:x.current,...u?{vehicleId:u}:{},...n.topic==="financing"&&f?{financingAmount:l}:{}}}))?.received)throw new Error("Lead not received");await a.afterSubmit(r),x.current=null,j(!0)}catch{y("Your message could not be received. Please try again or email [email protected] directly.")}}};return e.jsx("div",{className:"pt-24 pb-20 bg-background min-h-screen",children:e.jsxs("div",{className:"container mx-auto px-6 md:px-12 max-w-6xl",children:[e.jsx(R,{model:a}),e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h1",{className:"text-4xl md:text-5xl font-bold tracking-tight mb-4",children:"Connect with us."}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"Inquiries, test drives, or general questionsâour team is ready."})]}),e.jsxs("div",{className:"grid lg:grid-cols-[1fr_1.5fr] gap-16 lg:gap-24",children:[e.jsxs("div",{className:"space-y-12",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-xl font-bold mb-6",children:"Showroom Location"}),e.jsxs("div",{className:"flex items-start gap-4 text-muted-foreground mb-4",children:[e.jsx(z,{className:"w-6 h-6 shrink-0 text-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground text-lg",children:"Teslot Showroom"}),e.jsx("p",{children:o.street}),e.jsx("p",{children:o.cityStateZip})]})]}),e.jsx("div",{className:"mt-6 overflow-hidden rounded-xl border",children:e.jsx("iframe",{title:"Map of Teslot showroom in Costa Mesa",src:M,className:"h-56 w-full",loading:"lazy",referrerPolicy:"no-referrer-when-downgrade"})}),e.jsxs("a",{href:D,target:"_blank",rel:"noopener noreferrer",className:"mt-3 inline-flex items-center gap-1 text-sm font-semibold text-primary hover:underline",children:["Get directions ",e.jsx("span",{className:"sr-only",children:"(opens in a new tab)"}),e.jsx(S,{className:"h-4 w-4","aria-hidden":"true"})]})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-xl font-bold mb-6",children:"Contact Details"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("a",{href:o.phoneHref,className:"flex items-center gap-4 text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(E,{className:"w-5 h-5 shrink-0"}),e.jsx("span",{className:"font-medium",children:o.phoneDisplay})]}),e.jsxs("a",{href:"mailto:[email protected]",className:"flex items-center gap-4 text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(L,{className:"w-5 h-5 shrink-0"}),e.jsx("span",{className:"font-medium",children:"[email protected]"})]})]})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-xl font-bold mb-6",children:"Hours of Operation"}),e.jsxs("div",{className:"space-y-3 text-muted-foreground font-mono text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:o.hours.mondayFriday.label}),e.jsx("span",{className:"text-foreground",children:o.hours.mondayFriday.display})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:o.hours.saturdaySun
1day.label}),e.jsx("span",{className:"text-foreground",children:o.hours.saturdaySunday.display})]})]})]})]}),e.jsx("div",{className:"bg-secondary/30 rounded-3xl p-8 md:p-12 border",children:k?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center py-12 animate-in fade-in zoom-in-95 duration-500",children:[e.jsx("div",{className:"w-20 h-20 bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400 rounded-full flex items-center justify-center mb-6",children:e.jsx(U,{className:"w-10 h-10"})}),e.jsx("h3",{className:"text-3xl font-bold mb-4",children:"Message Received"}),e.jsxs("p",{className:"text-muted-foreground mb-8",children:["Thank you, ",a.data.firstName,". Our team received your inquiry and will follow up."]}),e.jsx("button",{onClick:()=>{x.current=null,j(!1)},className:"px-8 py-3 bg-secondary text-foreground font-medium rounded-full hover:bg-secondary/80 transition-colors",children:"Send another message"})]}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-2xl font-bold mb-8",children:"Send a Message"}),e.jsxs("form",{className:"space-y-6",onSubmit:I,onInvalidCapture:s=>{const r=s.target;r.id&&w(d=>({...d,[r.id]:r.validationMessage}))},children:[b.fields,N&&e.jsx("p",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive",children:N}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"contact-first-name",className:"block text-sm font-medium mb-2",children:"First Name"}),e.jsx("input",{id:"contact-first-name",type:"text",autoComplete:"given-name","aria-invalid":!!t["contact-first-name"],"aria-describedby":t["contact-first-name"]?"contact-first-name-error":void 0,required:!0,maxLength:80,className:"w-full px-4 py-3 bg-background border rounded-lg focus:ring-2 focus:ring-foreground outline-none transition-all",value:a.data.firstName,onChange:s=>{c("contact-first-name"),a.update("firstName",s.target.value)}}),t["contact-first-name"]&&e.jsx("p",{id:"contact-first-name-error",role:"alert","aria-live":"assertive",className:"mt-1 text-sm text-destructive",children:t["contact-first-name"]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"contact-last-name",className:"block text-sm font-medium mb-2",children:"Last Name"}),e.jsx("input",{id:"contact-last-name",type:"text",autoComplete:"family-name","aria-invalid":!!t["contact-last-name"],"aria-describedby":t["contact-last-name"]?"contact-last-name-error":void 0,required:!0,maxLength:80,className:"w-full px-4 py-3 bg-background border rounded-lg focus:ring-2 focus:ring-foreground outline-none transition-all",value:a.data.lastName,onChange:s=>{c("contact-last-name"),a.update("lastName",s.target.value)}}),t["contact-last-name"]&&e.jsx("p",{id:"contact-last-name-error",role:"alert","aria-live":"assertive",className:"mt-1 text-sm text-destructive",children:t["contact-last-name"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"contact-email",className:"block text-sm font-medium mb-2",children:"Email Address"}),e.jsx("input",{id:"contact-email",type:"email",autoComplete:"email","aria-invalid":!!t["contact-email"],"aria-describedby":t["contact-email"]?"contact-email-error":void 0,required:!0,maxLength:254,className:"w-full px-4 py-3 bg-background border rounded-lg focus:ring-2 focus:ring-foreground outline-none transition-all",value:a.signedIn?a.email:n.email,readOnly:a.signedIn,onChange:s=>{c("contact-email"),v({...n,email:s.target.value})}}),t["contact-email"]&&e.jsx("p",{id:"contact-email-error",role:"alert","aria-live":"assertive",className:"mt-1 text-sm text-destructive",children:t["contact-email"]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"contact-phone",className:"block text-sm font-medium mb-2",children:"Phone Number"}),e.jsx("input",{id:"contact-phone",type:"tel",autoComplete:"tel","aria-invalid":!!t["contact-phone"],"aria-describedby":t["contact-phone"]?"contact-phone-error":void 0,maxLength:30,className:"w-full px-4 py-3 bg-background border rounded-lg focus:ring-2 focus:ring-foreground outline-none transition-all",value:a.data.phone,onChange:s=>{c("contact-phone"),a.update("phone",s.target.value)}}),t["contact-phone"]&&e.jsx("p",{id:"contact-phone-error",role:"alert","aria-live":"assertive",className:"mt-1 text-sm text-destructive",children:t["contact-phone"]})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"contact-topic",className:"block text-sm font-medium mb-2",children:"Topic"}),e.jsxs("select",{id:"contact-topic","aria-invalid":!!t["contact-topic"],"aria-describedby":t["contact-topic"]?"contact-topic-error":void 0,className:"w-full px-4 py-3 bg-background border rounded-lg focus:ring-2 focus:ring-foreground outline-none transition-all appearance-none",value:n.topic,onChange:s=>{c("contact-topic"),v({...n,topic:s.target.value})},children:[e.jsx("option",{value:"general",children:"General Inquiry"}),e.jsx("option",{value:"test-drive",children:"Schedule a Test Drive"}),e.jsx("option",{value:"financing",children:"Financing Question"}),e.jsx("option",{value:"trade-in",children:"Trade-In Question"}),e.jsx("option",{value:"purchase",children:"Start Purchase"}),e.jsx("option",{value:"complaint",children:"Concern or Complaint"})]}),t["contact-topic"]&&e.jsx("p",{id:"contact-topic-error",role:"alert","aria-live":"assertive",className:"mt-1 text-sm text-destructive",children:t["contact-topic"]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"contact-message",className:"block text-sm font-medium mb-2",children:"Message"}),e.jsx("textarea",{id:"contact-message","aria-invalid":!!t["contact-message"],"aria-describedby":t["contact-message"]?"contact-message-error":void 0,rows:5,required:!0,maxLength:5e3,className:"w-full px-4 py-3 bg-background border rounded-lg focus:ring-2 focus:ring-foreground outline-none transition-all resize-none",value:n.message,onChange:s=>{c("contact-message"),v({...n,message:s.target.value})}}),t["contact-message"]&&e.jsx("p",{id:"contact-message-error",role:"alert","aria-live":"assertive",className:"mt-1 text-sm text-destructive",children:t["contact-message"]})]}),e.jsx(T,{model:a}),b.turnstile,e.jsxs("button",{type:"submit",disabled:h.isPending,className:"w-full py-4 bg-foreground text-background font-bold rounded-xl hover:bg-foreground
1/90 transition-transform active:scale-95 flex items-center justify-center gap-2 mt-4",children:[h.isPending?"Sendingâ¦":"Send Inquiry"," ",e.jsx(S,{className:"w-4 h-4"})]})]})]})})]})]})})}export{Q as Contact};
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.