import{j as e}from"./ui-vendor-4PEuZeLa.js";import{u as a}from"./useQuery-B4H78kLp.js";import{B as s,t as o,s as i,S as t,H as r}from"./index-DC4rLu7_.js";import{H as n}from"./Header-DAAc8EnU.js";import{F as c}from"./Footer-Bl3jo1Hs.js";import{S as l}from"./SEOHead-DetuBT9o.js";import{p as d,T as m}from"./city-slug-parser-Cs62ZEwO.js";import{r as u,h}from"./react-vendor-SJkaNtXX.js";import{I as p}from"./input-DV0retKJ.js";import{L as v}from"./label-DQXHisk6.js";import{T as x}from"./textarea-CWP2YVAx.js";import{f,v as g,a as j,b}from"./validators-B6ObMgjW.js";import{K as y,L as N,g as w,S,k as _}from"./icons-BXTKTZdO.js";import{A,a as C,b as q,c as k}from"./accordion-CHNbBYy_.js";import"./supabase-vendor-CdxEYpYJ.js";import"./logo-oficial-BW9aD_Pb.js";import"./alert-LV4gZCPU.js";function $({citySlug:a,cityName:t,state:r,pickupLocation:n}){const[c,l]=u.useState(!1),[d,m]=u.useState({nome:"",email:"",telefone:"",vehicleInfo:"",observations:""});return e.jsxs("form",{onSubmit:async e=>{var s,c;e.preventDefault();const u=g(d.nome);if(!u.valid)return void o({title:"Erro no nome",description:u.message,variant:"destructive"});const h=j(d.email);if(!h.valid)return void o({title:"Erro no e-mail",description:h.message,variant:"destructive"});const p=b(d.telefone);if(!p.valid)return void o({title:"Erro no telefone",description:p.message,variant:"destructive"});if(!n)return void o({title:"Localização não selecionada",description:"Por favor, selecione sua localização no mapa acima.",variant:"destructive"});l(!0);let v=null,x=null,f=null;try{const{error:e}=await i.from("locksmith_requests").insert({city_slug:a,city_name:t,state:r,client_name:d.nome,client_email:d.email,client_phone:d.telefone,pickup_address:n.address,latitude:n.latitude,longitude:n.longitude,vehicle_info:d.vehicleInfo||null,observations:d.observations||null,status:"novo"});try{const e=await i.functions.invoke("call-locksmith-quotation",{body:{name:d.nome,email:d.email,phone:d.telefone,lat:n.latitude,lng:n.longitude,address:n.address,vehicleInfo:d.vehicleInfo,serviceType:"abertura_veiculo"}});e.error?f=e.error.message||"Erro ao chamar API de chaveiro":(v=(null==(s=e.data)?void 0:s.quotation_id)||null,x=(null==(c=e.data)?void 0:c.conversation_id)||null,(v||x)&&await i.from("locksmith_requests").update({external_quotation_id:v,external_conversation_id:x}).eq("client_email",d.email).eq("client_phone",d.telefone).order("created_at",{ascending:!1}).limit(1))}catch(y){f=y.message||"Erro de comunicação com API"}f&&await i.from("locksmith_requests").update({status:"pendente_externo",observations:`${d.observations||""}\n\n[ERRO API EXTERNA]: ${f}`.trim()}).eq("client_email",d.email).eq("client_phone",d.telefone).order("created_at",{ascending:!1}).limit(1),o({title:"Solicitação recebida com sucesso!",description:f?"Recebemos sua solicitação e nossa equipe entrará em contato em instantes.":"Você receberá uma mensagem no WhatsApp com um chaveiro disponível."}),m({nome:"",email:"",telefone:"",vehicleInfo:"",observations:""})}catch(N){o({title:"Erro ao enviar solicitação",description:N.message||"Tente novamente mais tarde.",variant:"destructive"})}finally{l(!1)}},className:"space-y-6 bg-card p-6 rounded-lg border border-border",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-6 w-6 text-primary"}),e.jsx("h3",{className:"text-2xl font-bold",children:"Solicite um Chaveiro"})]}),e.jsx("p",{className:"text-muted-foreground",children:"Trancou a chave no carro? Preencha os dados e receba atendimento imediato"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"nome",children:"Nome *"}),e.jsx(p,{id:"nome",name:"nome",placeholder:"Seu nome",value:d.nome,onChange:e=>m({...d,nome:e.target.value}),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"email",children:"E-mail *"}),e.jsx(p,{id:"email",name:"email",type:"email",placeholder:"seu@email.com",value:d.email,onChange:e=>m({...d,email:e.target.value}),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"telefone",children:"Telefone *"}),e.jsx(p,{id:"telefone",name:"telefone",type:"tel",placeholder:"(00) 00000-0000",value:d.telefone,onChange:e=>m({...d,telefone:e.target.value}),onBlur:e=>m({...d,telefone:f(e.target.value)}),required:!0})]}),n&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:"Localização do veículo"}),e.jsx("div",{className:"p-3 bg-muted rounded-md text-sm",children:n.address})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"vehicleInfo",children:"Informações do veículo (opcional)"}),e.jsx(p,{id:"vehicleInfo",placeholder:"Ex: Gol Prata 2020, Placa ABC-1234",value:d.vehicleInfo,onChange:e=>m({...d,vehicleInfo:e.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Modelo, cor e placa ajudam o chaveiro a localizar seu veículo"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"observations",children:"Observações (opcional)"}),e.jsx(x,{id:"observations",placeholder:"Informações adicionais sobre a situação",value:d.observations,onChange:e=>m({...d,observations:e.target.value}),rows:3})]})]}),e.jsx(s,{type:"submit",className:"w-full",size:"lg",disabled:c,children:c?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):"Chamar Chaveiro Agora"}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Ao enviar, você concorda com nossa política de privacidade"})]})}function E(){const{citySlug:s}=h(),[o,p]=u.useState("client"),[v,x]=u.useState(),f=d(s||""),{data:g,isLoading:j}=a({queryKey:["locksmith-city-page",s],queryFn:async()=>{const{data:e,error:a}=await i.from("locksmith_city_pages").select("*").eq("slug",s).eq("is_active",!0).maybeSingle();if(a)throw a;return e}});u.useEffect(()=>{(null==g?void 0:g.id)&&i.from("locksmith_city_pages").update({view_count:(g.view_count||0)+1}).eq("id",g.id).then(()=>{})},[null==g?void 0:g.id]);const b=(null==g?void 0:g.city_name)||f.cityName,N=(null==g?void 0:g.state_abbreviation)||f.stateAbbreviation,E=(null==g?void 0:g.state)||f.state,L=(null==g?void 0:g.hero_title)||`Chaveiro Automotivo 24h em ${b}`,I=(null==g?void 0:g.hero_subtitle)||`Serviço de chaveiro automotivo 24h em ${b} - ${N}. Abertura de veículos, cópia de chaves e suporte emergencial.`,O=(null==g?void 0:g.meta_title)||`Chaveiro em ${b} - ${N} | Atendimento 24h`,P=`Precisa de chaveiro automotivo em ${b}? Atendimento 24h para abertura de veículos, cópia de chaves e fechaduras. Ligue: 0800-111-8686.`,T=`/chaveiro/${s||""}`;if(j)return e.jsxs("div",{className:"min-h-screen",children:[e.jsx(l,{title:O,description:P,canonical:T}),e.jsx(n,{viewMode:o,onViewModeChange:p,showViewModeToggle:!1}),e.jsxs("div",{className:"container mx-auto px-4 py-16",children:[e.jsx(t,{className:"h-12 w-3/4 mb-4"}),e.jsx(t,{className:"h-6 w-1/2 mb-8"}),e.jsx(t,{className:"h-96 w-full"})]})]});const z={"@context":"https://schema.org","@type":"LocalBusiness",name:`Chaveiro Automotivo 24h em ${b}`,description:P,url:`https://semprecomigo.com.br/chaveiro/${s}`,telephone:"0800-111-8686",address:{"@type":"PostalAddress",addressLocality:b,addressRegion:N,addressCountry:"BR"},areaServed:{"@type":"City",name:b},parentOrganization:{"@type":"Organization",name:"Sempre Comigo"},openingHoursSpecification:{"@type":"OpeningHoursSpecification",dayOfWeek:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],opens:"00:00",closes:"23:59"}},H={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:"https://semprecomigo.com.br"},{"@type":"ListItem",position:2,name:"Chaveiro",item:"https://semprecomigo.com.br/assistencia-24h"},{"@type":"ListItem",position:3,name:b,item:`https://semprecomigo.com.br/chaveiro/${s}`}]};return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(l,{title:O,description:P,canonical:T,keywords:`chaveiro ${b.toLowerCase()}, chaveiros em ${b.toLowerCase()}, chaveiro automotivo ${b.toLowerCase()}, chaveiro 24h ${b.toLowerCase()}, chaveiro veicular, abertura de veículo ${N}, chaveiro mais próximo`}),e.jsxs(r,{children:[e.jsx("script",{type:"application/ld+json",children:JSON.stringify(z)}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify(H)})]}),e.jsx(n,{viewMode:o,onViewModeChange:p,showViewModeToggle:!1}),e.jsxs("section",{className:"relative h-[50vh] min-h-[400px] overflow-hidden bg-gradient-to-br from-primary via-primary/90 to-primary/70",children:[e.jsx("div",{className:"absolute inset-0 bg-black/30"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-white px-4 max-w-4xl",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 bg-white/20 rounded-full mb-6",children:e.jsx(y,{className:"h-10 w-10 text-white"})}),e.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-4",children:L}),e.jsx("p",{className:"text-xl md:text-2xl mb-8",children:I}),e.jsx("a",{href:"#formulario",className:"inline-block",children:e.jsx("button",{className:"bg-white hover:bg-white/90 text-primary px-8 py-4 rounded-lg text-lg font-semibold transition-colors",children:"Chamar Chaveiro Agora"})})]})})]}),e.jsx("section",{className:"py-16 bg-muted/30",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(w,{className:"h-8 w-8 text-primary flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-lg mb-2",children:"Atendimento 24h"}),e.jsx("p",{className:"text-muted-foreground",children:"Estamos disponíveis todos os dias, a qualquer hora"})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(S,{className:"h-8 w-8 text-primary flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-lg mb-2",children:"Abertura Sem Danos"}),e.jsx("p",{className:"text-muted-foreground",children:"Técnicas profissionais que preservam seu veículo"})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(_,{className:"h-8 w-8 text-primary flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-lg mb-2",children:"Profissionais Especializados"}),e.jsx("p",{className:"text-muted-foreground",children:"Equipe treinada em abertura de veículos de todas as marcas"})]})]})]})})}),e.jsx("section",{id:"formulario",className:"py-16",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-start",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Onde está seu veículo?"}),e.jsx("p",{className:"text-muted-foreground",children:"Detectamos automaticamente sua localização para enviar o chaveiro mais próximo"})]}),e.jsx(m,{onLocationSelect:x})]}),e.jsx("div",{className:"lg:sticky lg:top-4",children:e.jsx($,{citySlug:s,cityName:b,state:E,pickupLocation:v})})]})})}),e.jsxs("section",{className:"py-12 bg-muted/20",children:[e.jsx(r,{children:e.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"FAQPage",mainEntity:[{"@type":"Question",name:`Quanto custa um chaveiro automotivo em ${b}?`,acceptedAnswer:{"@type":"Answer",text:`O preço do chaveiro em ${b} varia conforme o tipo de veículo, complexidade da fechadura e horário do atendimento. Ligue para 0800 111 8686 para cotação imediata.`}},{"@type":"Question",name:`O chaveiro em ${b} funciona 24 horas?`,acceptedAnswer:{"@type":"Answer",text:`Sim. Nosso chaveiro automotivo em ${b} atende 24 horas por dia, 7 dias por semana, incluindo feriados.`}},{"@type":"Question",name:"O chaveiro abre o veículo sem danificar a fechadura?",acceptedAnswer:{"@type":"Answer",text:`Sim. Em ${b} usamos técnicas profissionais de abertura que preservam a fechadura e a porta do veículo. Trabalhamos com todas as marcas.`}},{"@type":"Question",name:`Atendem a região metropolitana de ${b}?`,acceptedAnswer:{"@type":"Answer",text:`Sim. Cobrimos ${b} e toda a região metropolitana. Confirme a área exata pelo 0800 111 8686 antes de acionar o serviço.`}},{"@type":"Question",name:`Quais formas de pagamento aceitam para chaveiro em ${b}?`,acceptedAnswer:{"@type":"Answer",text:`Em ${b} aceitamos PIX, cartão de crédito, débito e dinheiro. Clientes com plano Sempre Comigo já têm o serviço incluído na mensalidade.`}},{"@type":"Question",name:`O chaveiro em ${b} faz cópia de chave codificada?`,acceptedAnswer:{"@type":"Answer",text:`Sim. Em ${b} fazemos cópia de chave simples, chave canivete e chave com transponder (codificada). Para chaves presence (smart key), confirme a marca e modelo do veículo no acionamento.`}}]})})}),e.jsxs("div",{className:"container mx-auto px-4 max-w-3xl",children:[e.jsxs("h2",{className:"text-2xl md:text-3xl font-bold text-center mb-8 text-foreground",children:["Perguntas Frequentes - Chaveiro em ",b]}),e.jsxs(A,{type:"single",collapsible:!0,className:"space-y-3",children:[e.jsxs(C,{value:"faq-0",className:"bg-background rounded-lg border px-6",children:[e.jsxs(q,{className:"text-left font-semibold text-foreground hover:no-underline",children:["Quanto custa um chaveiro automotivo em ",b,"?"]}),e.jsxs(k,{className:"text-muted-foreground",style:{lineHeight:1.6},children:["O preço do chaveiro em ",b," varia conforme o tipo de veículo, complexidade da fechadura e horário do atendimento. Para cotação imediata, ligue ",e.jsx("strong",{children:"0800 111 8686"})," ou preencha o formulário acima."]})]}),e.jsxs(C,{value:"faq-1",className:"bg-background rounded-lg border px-6",children:[e.jsxs(q,{className:"text-left font-semibold text-foreground hover:no-underline",children:["O chaveiro em ",b," funciona 24 horas?"]}),e.jsxs(k,{className:"text-muted-foreground",style:{lineHeight:1.6},children:["Sim. Nosso chaveiro automotivo em ",b," atende 24 horas por dia, 7 dias por semana, incluindo feriados."]})]}),e.jsxs(C,{value:"faq-2",className:"bg-background rounded-lg border px-6",children:[e.jsx(q,{className:"text-left font-semibold text-foreground hover:no-underline",children:"O chaveiro abre o veículo sem danificar a fechadura?"}),e.jsxs(k,{className:"text-muted-foreground",style:{lineHeight:1.6},children:["Sim. Em ",b," usamos técnicas profissionais de abertura que preservam a fechadura e a porta do veículo. Trabalhamos com todas as marcas."]})]}),e.jsxs(C,{value:"faq-3",className:"bg-background rounded-lg border px-6",children:[e.jsxs(q,{className:"text-left font-semibold text-foreground hover:no-underline",children:["Atendem a região metropolitana de ",b,"?"]}),e.jsxs(k,{className:"text-muted-foreground",style:{lineHeight:1.6},children:["Sim. Cobrimos ",b," e toda a região metropolitana. Confirme a área exata pelo ",e.jsx("strong",{children:"0800 111 8686"})," antes de acionar o serviço."]})]}),e.jsxs(C,{value:"faq-4",className:"bg-background rounded-lg border px-6",children:[e.jsxs(q,{className:"text-left font-semibold text-foreground hover:no-underline",children:["Quais formas de pagamento aceitam para chaveiro em ",b,"?"]}),e.jsxs(k,{className:"text-muted-foreground",style:{lineHeight:1.6},children:["Em ",b," aceitamos PIX, cartão de crédito, débito e dinheiro. Clientes com plano Sempre Comigo já têm o serviço incluído na mensalidade."]})]}),e.jsxs(C,{value:"faq-5",className:"bg-background rounded-lg border px-6",children:[e.jsxs(q,{className:"text-left font-semibold text-foreground hover:no-underline",children:["O chaveiro em ",b," faz cópia de chave codificada?"]}),e.jsxs(k,{className:"text-muted-foreground",style:{lineHeight:1.6},children:["Sim. Em ",b," fazemos cópia de chave simples, chave canivete e chave com transponder (codificada). Para chaves presence (smart key), confirme a marca e modelo do veículo no acionamento."]})]})]})]})]}),e.jsx(c,{})]})}export{E as default};