PageSourceSearch

https://jao.delivery/assets/licenciamento.validarcidade-BxjkpA3p.js

js jao.delivery collected 2026-10-02 00:37:05 UTC 12,429 bytes, 1 lines download raw bytes

1import{r as o,d as H,j as e,H as I,L as _,e as Q,b as S,A as C,h as U,s as P,m as A}from"./index-Dv3pIz31.js";import{s as T}from"./meetime.functions-CIIZIgU6.js";import{m as G,v as D}from"./whatsapp-CXtauyUl.js";import{u as K,s as L,f as O,c as J}from"./use-atende-blocklist-DidS2AUv.js";import{A as X}from"./arrow-left-CJC0iaV5.js";import{S as Y}from"./search-DRhkPZy3.js";import{M as Z}from"./map-pin-CK_cqkUH.js";import{L as ee}from"./lock-kwHU2oXf.js";import"./createServerFn-BFRxaOh-.js";function ge(){o.useEffect(()=>{H()},[]);const[s,l]=o.useState("search"),[r,d]=o.useState(""),[t,n]=o.useState(null),[p,u]=o.useState(!1),[y,N]=o.useState(0),[i,x]=o.useState(null),[h,a]=o.useState(""),[f,k]=o.useState(""),[$,j]=o.useState(null),[re,ne]=o.useState(0),[ie,le]=o.useState({}),R=K(),q=o.useMemo(()=>t?[]:L(r,8),[r,t]);function B(m){n(m),d(`${m.nome}/${m.uf}`),u(!1)}function W(m){m.preventDefault();let c=t;if(!c){const g=L(r,1);if(g.length===1)c=g[0];else{const v=O(r);v?.exact&&(c=v.city)}if(!c){j("Selecione sua cidade na lista de sugestões para continuar");return}n(c),d(`${c.nome}/${c.uf}`)}j(null),l("loading");const b=c;setTimeout(()=>{const g=J(`${b.nome}/${b.uf}`,R);x(g),l("contact")},1600)}async function z(m){if(m.preventDefault(),j(null),h.trim().length<2)return j("Informe seu nome completo");const c=D(f);if(!c.ok)return j(c.reason);l("submitting"),await F(),l("result")}async function F(m,c){if(!i||!t)return;const b=D(f);if(!b.ok)return;const g=i.city?`${i.city.nome}/${i.city.uf}`:`${t.nome}/${t.uf}`;try{const{data:v}
1=await P.from("licenciamento_partial").upsert({whatsapp:b.normalized,nome:h.trim()||null,cidade:g,uf:i.city?.uf??t.uf??null,populacao:i.city?.pop??t.pop??null,last_step:"validarcidade",source_path:typeof window<"u"?window.location.pathname:"/licenciamento/validarcidade",...A()},{onConflict:"whatsapp"}).select("id").single();if(i.available){const w=A();T({data:{lead_id:v?.id??null,lead_table:"licenciamento_partial",nome:h.trim(),whatsapp:b.normalized,email:null,cidade:g,uf:i.city?.uf??t.uf??null,populacao:i.city?.pop??t.pop??null,origem:"licenciamento_validarcidade",source_path:typeof window<"u"?window.location.pathname:"/licenciamento/validarcidade",utm_source:w.utm_source,utm_medium:w.utm_medium,utm_campaign:w.utm_campaign,utm_content:w.utm_content,utm_term:w.utm_term,referrer:w.referrer}}).catch(V=>console.error("[meetime] validarcidade",V))}}catch{}}return e.jsxs("div",{className:"min-h-screen bg-[oklch(0.14_0.03_150)] text-white flex flex-col",children:[e.jsx(I,{hideDownload:!0}),e.jsxs("main",{className:"flex-1 relative overflow-hidden px-4 pt-24 sm:pt-28 pb-24 sm:pb-32 flex items-center min-h-[calc(100vh-4rem)] sm:min-h-[calc(100vh-5rem)]",children:[e.jsx("div",{className:"pointer-events-none absolute -top-32 -right-32 h-72 w-72 sm:h-[28rem] sm:w-[28rem] rounded-full bg-primary/15 blur-3xl"}),e.jsx("div",{className:"pointer-events-none absolute -bottom-32 -left-32 h-72 w-72 sm:h-[28rem] sm:w-[28rem] rounded-full bg-primary/15 blur-3xl"}),e.jsxs("div",{className:"relative w-full max-w-3xl mx-auto py-8 sm:py-16",children:[e.jsxs(_,{to:"/licenciamento",className:"inline-flex items-center gap-2 text-sm font-bold text-white/80 hover:text-white transition mb-10 sm:mb-12",children:[e.jsx(X,{className:"h-4 w-4"})," Voltar"]}),s==="search"&&e.jsx(te,{query:r,setQuery:m=>{d(m),n(null),N(0)},focused:p,setFocused:u,suggestions:q,highlight:y,setHighlight:N,pickCity:B,onSubmit:W,error:$,selected:t}),s==="loading"&&e.jsx(M,{label:"Quase lá…"}),s==="contact"&&e.jsx(se,{nome:h,setNome:a,whatsapp:f,setWhatsapp:m=>k(G(m)),error:$,onSubmit:z}),(s==="questions"||s==="submitting")&&s==="submitting"&&e.jsx(M,{label:"Verificando disponibilidade…"}),s==="result"&&i&&e.jsx(ae,{result:i,fallback:t?`${t.nome}/${t.uf}`:r,nome:h,whatsapp:f,citySlug:t?.slug??i.city?.slug})]})]})]})}function te(s){const{query:l,setQuery:r,focused:d,setFocused:t,suggestions:n,highlight:p,setHighlight:u,pickCity:y,onSubmit:N,error:i,selected:x}=s,h=a=>new Intl.NumberFormat("pt-BR").format(a)+" hab.";return e.jsxs("div",{className:"animate-in fade-in duration-500",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full bg-primary/15 border border-primary/40 px-4 py-2 text-xs sm:text-sm font-bold text-primary mb-6",children:[e.jsx(Q,{className:"h-4 w-4"}),"Agende sua reunião"]}),e.jsxs("h1",{className:"text-4xl sm:text-6xl lg:text-7xl font-black leading-[1.05] tracking-tight",children:["Sua cidade ainda está ",e.jsx("span",{className:"text-primary",children:"disponível"}),"?"]}),e.jsxs("p",{className:"mt-5 text-base sm:text-lg text-white/70 max-w-xl leading-relaxed",children:["Digite o nome da sua cidade e ",e.jsx("strong",{children:"selecione na lista"})," para validarmos a população oficial do IBGE."]}),e.jsxs("form",{onSubmit:N,className:"mt-8 flex flex-col sm:flex-row gap-3 relative",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Y,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-muted-foreground pointer-events-none"}),e.jsx("input",{type:"text",value:l,onChange:a=>r(a.target.value),onFocus:()=>t(!0),onBlur:()=>setTimeout(()=>t(!1),150),onKeyDown:a=>{n.length!==0&&(a.key==="ArrowDown"?(a.preventDefault(),u(Math.min(p+1,n.length-1))):a.key==="ArrowUp"?(a.preventDefault(),u(Math.max(p-1,0))):a.key==="Enter"&&d&&(a.preventDefault(),y(n[p])))},placeholder:"Digite o nome da sua cidade...",className:`w-full h-14 sm:h-16 pl-12 pr-12 rounded-2xl bg-white text-foreground text-base sm:text-lg placeholder:text-muted-foreground focus:outline-none focus:ring-4 focus:ring-primary/40 box-border ${x?"ring-4 ring-primary/40":""}`,autoComplete:"off"}),x&&e.jsx(S,{className:"absolute right-4 top-1/2 -translate-y-1/2 h-5 w-5 text-primary pointer-events-none"}),d&&n.length>0&&e.jsx("ul",{className:"absolute left-0 right-0 top-full mt-2 bg-white text-foreground rounded-2xl shadow-2xl overflow-hidden z-20 max-h-80 overflow-y-auto",children:n.map((a,f)=>e.jsxs("li",{onMouseDown:k=>{k.preventDefault(),y(a)},onMouseEnter:()=>u(f),className:`px-4 py-3 text-sm cursor-pointer flex items-center justify-between gap-3 border-b border-border last:border-0 ${f===p?"bg-muted":""}`,children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(Z,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsxs("span",{className:"font-semibold truncate",children:[a.nome,e.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","/ ",a.uf]})]})]}),e.jsx("span",{className:"text-[11px] font-bold tracking-wide text-muted-foreground bg-muted/60 rounded-full px-2.5 py-1 shrink-0",children:h(a.pop)})]},a.slug))})]}),e.jsxs("button",{type:"submit",disabled:!x&&l.trim().length<2,className:"h-14 sm:h-16 px-7 rounded-2xl bg-primary text-primary-foreground font-bold text-base sm:text-lg flex items-center justify-center gap-2 hover:brightness-110 transition shadow-lg disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:brightness-100",children:["Verificar agora ",e.jsx(C,{className:"h-5 w-5"})]})]}),x&&e.jsxs("p",{className:"mt-3 text-xs sm:text-sm text-primary font-semibold flex items-center gap-1.5",children:[e.jsx(S,{className:"h-4 w-4"}),x.nome,"/",x.uf," • ",h(x.pop)," (IBGE)"]}),i&&e.jsx("p",{className:"mt-3 text-sm text-destructive",children:i}),e.jsx("p",{className:"mt-4 text-xs sm:text-sm text-white/50",children:"Comece a digitar e selecione sua cidade na lista. Modelo voltado para cidades de 20 a 230 mil habitantes."})]})}function M({label:s}){return e.jsxs("div",{className:"min-h-[60vh] flex flex-col items-center justify-center animate-in fade-in duration-500",children:[e.jsx(U,{className:"h-14 w-14 text-primary animate-spin"}),e.jsx("p",{className:"mt-6 text-xl sm:text-2xl font-bold text-white",children:s}),e.jsx("div",{className:"mt-6 h-1 w-48 rounded-full bg-white/10 overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary animate-pulse w-2/3"})})]})}function se(s){const{nome:l,setNome:r,whatsapp:d,setWhatsapp:t,error:n,onSubmit:p}=s;return e.jsxs("form",{onSubmit:p,className:"mx-auto max-w-xl rounded-3xl border border-primary/40 bg-[oklch(0.2_0.05_150)]/70 backdrop-blur p-6 sm:p-8 shadow-2xl animate-in fade-in zoom-in-95 duration-500",children:[e.jsx("h2",{className:"text-2xl sm:text-3xl font-black text-white",children:"Estamos quase concluindo!"}),e.jsx("p",{className:"mt-2 text-sm sm:text-base text-white/70",children:"Antes de revelar o resultado, deixe seu contato:"}),e.jsxs("div",{className:"mt-6 space-y-5",children:[e.jsx(E,{label:"Nome e Sobrenome",children:e.jsx("input",{type:"text",value:l,onCh
1ange:u=>r(u.target.value),placeholder:"Ex.: Maria Silva",maxLength:80,autoComplete:"name",className:"w-full h-12 px-4 rounded-2xl bg-white text-foreground text-base placeholder:text-muted-foreground focus:outline-none focus:ring-4 focus:ring-primary/40 box-border"})}),e.jsx(E,{label:"Melhor número para contato (WhatsApp)",children:e.jsx("input",{type:"tel",inputMode:"numeric",value:d,onChange:u=>t(u.target.value),placeholder:"(11) 99999-9999",maxLength:20,autoComplete:"tel",className:"w-full h-12 px-4 rounded-2xl bg-white text-foreground text-base placeholder:text-muted-foreground focus:outline-none focus:ring-4 focus:ring-primary/40 box-border"})})]}),n&&e.jsx("p",{className:"mt-3 text-sm text-destructive",children:n}),e.jsxs("button",{type:"submit",className:"mt-6 w-full h-14 rounded-2xl bg-primary text-primary-foreground font-bold text-base sm:text-lg flex items-center justify-center gap-2 hover:brightness-110 transition shadow-lg disabled:opacity-60",children:["Avançar ",e.jsx(C,{className:"h-5 w-5"})]}),e.jsxs("p",{className:"mt-4 text-xs text-white/60 text-center flex items-center justify-center gap-1.5",children:[e.jsx(ee,{className:"h-3.5 w-3.5"}),"Seus dados estão seguros e serão usados apenas para contato."]})]})}function E({label:s,children:l}){return e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-sm font-bold text-white mb-2",children:s}),l]})}function ae({result:s,fallback:l,nome:r,whatsapp:d,citySlug:t}){const n=s.city?`${s.city.nome}/${s.city.uf}`:l;return s.available?e.jsxs("div",{className:"mx-auto max-w-xl rounded-3xl border border-primary/40 bg-[oklch(0.2_0.05_150)]/70 backdrop-blur p-8 text-center shadow-2xl animate-in fade-in zoom-in-95 duration-500",children:[e.jsx("div",{className:"mx-auto h-16 w-16 rounded-full bg-primary/20 flex items-center justify-center",children:e.jsx(S,{className:"h-9 w-9 text-primary"})}),e.jsxs("h2",{className:"mt-5 text-3xl sm:text-4xl font-black text-white",children:["Boa notícia, ",r.split(" ")[0],"!"]}),e.jsxs("p",{className:"mt-3 text-base sm:text-lg text-white/80",children:["O negócio ainda está disponível para"," ",e.jsx("span",{className:"font-bold text-primary",children:n}),"."]}),e.jsx("p",{className:"mt-2 text-sm text-white/60",children:"Clique para continuar o seu cadastro de interesse."}),e.jsxs(_,{to:"/licenciamento/candidatura",search:{w:d,n:r,cs:t},className:"mt-6 inline-flex w-full sm:w-auto items-center justify-center gap-2 h-14 px-8 rounded-2xl bg-primary text-primary-foreground font-bold text-base hover:brightness-110 transition shadow-lg",children:["Tenho interesse ",e.jsx(C,{className:"h-5 w-5"})]})]}):e.jsxs("div",{className:"mx-auto max-w-xl rounded-3xl border border-primary/30 bg-[oklch(0.2_0.05_150)]/70 backdrop-blur p-8 text-center shadow-2xl animate-in fade-in zoom-in-95 duration-500",children:[e.jsx("div",{className:"mx-auto h-16 w-16 rounded-full bg-primary/20 flex items-center justify-center",children:e.jsx(S,{className:"h-9 w-9 text-primary"})}),e.jsxs("h2",{className:"mt-5 text-3xl sm:text-4xl font-black text-white",children:["Recebemos seu interesse",r?`, ${r.split(" ")[0]}`:"","!"]}),e.jsxs("p",{className:"mt-3 text-base sm:text-lg text-white/80",children:["Registramos seu cadastro para"," ",e.jsx("span",{className:"font-bold text-primary",children:n}),"."]}),e.jsx("p",{className:"mt-3 text-sm text-white/70",children:"Assim que houver disponibilidade ou novidades para a sua região, nosso time entrará em contato pelo WhatsApp informado."}),e.jsx("div",{className:"mt-6",children:e.jsx(_,{to:"/",className:"inline-flex items-center justify-center gap-2 h-12 px-6 rounded-2xl border border-white/20 text-white font-bold text-sm hover:bg-white/5 transition",children:"Voltar ao site"})})]})}export{ge as component};

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.