1import{j as e}from"./ui-DI1BxUsa.js";import{c as Ye,a6 as ge,b as Ze,a7 as ga,a8 as ba,a9 as ya,aa as ja,ab as Ve,ac as Be,ad as F,ae as va,e as wa,f as H,af as Na,ag as Aa,ah as pe,ai as ka,u as p,aj as Ca,ak as Y,al as Ee,am as re,an as Re,q as he,C as fe,ao as Ia,B as Se,L as ie,ap as Le,U as Ma,z as Ea,aq as Ge,H as ze,I as De,ar as Te,as as Ue,r as Ra,w as Fe,x as Qe,at as Pe,m as Sa,o as La,au as Ga,av as za,aw as Da,ax as Ta,ay as Ua,az as Fa,aA as Qa,aB as Pa,aC as qa,aD as Oa,G as Wa,aE as Ka}from"./index-Bv772IAP.js";import{r as n,L as Z}from"./react-CeLB8I7F.js";import{K as Ha}from"./key-round-C_wnofO2.js";import{r as Ya,d as Za}from"./groupMemberCountsCache-Ci5xKuMJ.js";import{b as Va}from"./gerarClientesPostDescription-CcxiZXBC.js";import{A as qe,m as G}from"./motion-Cu2dBjqg.js";import{A as Ba}from"./arrow-left-CnXh77pc.js";import{M as Oe}from"./map-pin-DWer4oJv.js";import"./charts-DeYXs29A.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const We=Ye("ChartNoAxesColumn",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Xa=Ye("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]),Ke={[ga]:{label:"Venda",shortLabel:"Venda",icon:ba},[ya]:{label:"Aluguel",shortLabel:"Aluguel",icon:Ha},[ge]:{label:"Indefinido",shortLabel:"â",icon:ja}},Ja={[Ve]:{label:"Baixo padrão",shortLabel:"Baixo",icon:We},[Be]:{label:"Médio padrão",shortLabel:"Médio",icon:We},[F]:{label:"Alto padrão",shortLabel:"Alto",icon:Xa}};function He({meta:t,size:r}){const l=t.icon;return e.jsxs("span",{title:t.label,className:Ze("inline-flex items-center gap-1.5 rounded-md border border-slate-200 bg-slate-100/80 font-medium text-slate-600",r==="sm"?"px-2 py-1 text-xs":"px-2.5 py-1 text-sm"),children:[e.jsx(l,{className:r==="sm"?"h-3.5 w-3.5 shrink-0":"h-4 w-4 shrink-0"}),r==="sm"?t.shortLabel:t.label]})}function _a({listingKind:t,standardTier:r,size:l="md",className:f}){const c=(t==null?void 0:t.trim().toLowerCase())||ge,w=Ke[c]??Ke[ge],A=r?Ja[r]:null;return e.jsxs("div",{className:Ze("flex flex-wrap gap-1",f),children:[e.jsx(He,{meta:w,size:l}),A&&e.jsx(He,{meta:A,size:l})]})}function $a(t){let r=2166136261;const l=String(t);for(let c=0;c<l.length;c++)r^=l.charCodeAt(c),r=Math.imul(r,16777619);return 500+Math.abs(r)%2501}const Xe="limpeza_lembrete_v1",et=7*24*60*60*1e3;function at(){if(typeof window>"u")return!1;const t=Number(localStorage.getItem(Xe));return t?Date.now()-t>=et:!0}function tt(){typeof window>"u"||localStorage.setItem(Xe,String(Date.now()))}const st="/assets/maisdetalhes-CTG_W2L4.png",rt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWMAAABSCAYAAACBk7VdAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAA2rSURBVHhe7d17dBTlGQbwZ3HNZuPmtrltSLMQJai1VRaotFCgzeGixCBgjlq1oZRL0F6g5Visxfa0pWi1EVG520OxLEUbQdtGi1Baw6lHVFhtpbEkEAgNmSTsbi7LTjZsMv2D3enOJNBksiGT5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FYINCOpuYWtLb60BYIIBjs0PziiIgGmsFggNF4DWJNJsTHW5CUmNBtCIdpzbuohzER0XCmNVI1r6YgIqLoYRgTEekAw5iISAcYxkREOsAwJiLSAYYxEZEOMIyJiHSAYUxEpAMMYyIiHWAYExHpAMOYiEgHGMZERDrAMCYi0oH/AtszbZu1aqaRAAAAAElFTkSuQmCC",it={all:["niches"]},ot={all:["properties"]},oe=3,V=3,nt="https://images.unsplash.com/photo-1600566753190-17f0baa2a6c3?w=400&h=300&fit=crop",lt=[{tier:"alto",title:"Alto padrão",subtitle:"Máximo 1 imóvel de alto padrão por execução."},{tier:"medio",title:"Médio padrão",subtitle:null},{tier:"baixo",title:"Baixo padrão",subtitle:null},{tier:"indef",title:"Sem faixa definida",subtitle:"Contam para o limite de 3, sem ocupar vagas de alto/médio/baixo."}
11],ct={alto:{bar:"bg-amber-400",badge:"bg-amber-100 text-amber-800 border border-amber-200/80",label:"Alto"},medio:{bar:"bg-sky-400",badge:"bg-sky-100 text-sky-800 border border-sky-200/80",label:"Médio"},baixo:{bar:"bg-emerald-400",badge:"bg-emerald-100 text-emerald-800 border border-emerald-200/80",label:"Baixo"},indef:{bar:"bg-slate-300",badge:"bg-slate-100 text-slate-600 border border-slate-200/80",label:"Indefinido"}};function dt(t){return{id:t.id,title:t.title,price:Ra(t.price),image:t.imageUrls[0]??nt,listingKind:t.listingKind,standardTier:t.standardTier}}function mt(t){const r=(t??"").trim().toLowerCase();return r===F?"alto":r===Be?"medio":r===Ve?"baixo":"indef"}function ne(t){return t.trim().toLowerCase()}function ut(t){try{return new Intl.DateTimeFormat("pt-BR",{dateStyle:"short",timeStyle:"short",timeZone:"America/Sao_Paulo"}).format(new Date(t))}catch{return""}}function xt(t){return Math.max(1,Math.ceil((t-Date.now())/36e5))}function pt(t){const r=t.trim();if(!r)return"";try{const l=new URL(r),f=l.pathname.replace(/\/+$/,"").toLowerCase();return`${l.hostname.replace(/^www\./,"")}${f}`}catch{return r.toLowerCase().replace(/\/+$/,"")}}function ht(t,r){const l=new Set,f=[],c=[];let w=0;for(const A of t)if(r.has(A.id))for(const B of A.groups){const I=(B.url||"").trim();if(!I){w+=1;continue}const z=pt(I);if(!z||l.has(z))continue;l.add(z),f.push(I);const X=(B.name||"").trim();X&&c.push({url:I,name:X})}return{urls:f,skippedWithoutUrl:w,groupLabels:c}}function ft(t){const r=Ya();let l=0;for(const f of t){const c=Za(f),w=r==null?void 0:r.byGroupId[c];typeof w=="number"&&w>=0?l+=w:l+=$a(f)}return l}function gt(t,r){var c;const l=((c=t.descriptionGenerated)==null?void 0:c.trim())||t.description.trim()||t.title.trim()||t.title,f=Va(l,r,{corretorCode:t.corretorCode,price:t.price});return{title:t.title.trim()||"Imóvel",price:Wa(t.price),description:f,imageUrls:t.imageUrls.slice(0,Ka)}}const Mt=()=>{var Ae,ke,Ce;const[t,r]=n.useState(1),[l,f]=n.useState(new Set),[c,w]=n.useState(new Set),A=!0,[B,I]=n.useState(!1),[z,X]=n.useState(!1),[J,Je]=n.useState(null),[_e,be]=n.useState(!0),[$e,le]=n.useState(!1),[ea,_]=n.useState(!1),[ye,ce]=n.useState(null),[,aa]=n.useState(0);n.useEffect(()=>{const a=window.setInterval(()=>aa(s=>s+1),36e5);return()=>window.clearInterval(a)},[]),n.useEffect(()=>{at()&&(tt(),_(!0))},[]),n.useEffect(()=>{let a=!1;return be(!0),va().then(({eligible:s,location:o})=>{a||(typeof s=="boolean"&&ce(!s),Je(o),be(!1))}),()=>{a=!0}},[]);const Q=n.useRef(null),M=n.useRef(null),$=n.useRef(!1),x=wa(),P=H({queryKey:Fe,queryFn:Qe,staleTime:3e4}),je=H({queryKey:Y,queryFn:Pe,staleTime:15e3}),{isGerarClientesRunning:de,setGerarClientesRunning:ee}=Na(),j=B||de;n.useEffect(()=>{de&&r(2)},[de]);const D=H({queryKey:it.all,queryFn:Sa}),q=H({queryKey:ot.all,queryFn:La}),ve=H({queryKey:re,queryFn:Ga,staleTime:15e3}),h=n.useMemo(()=>{var a;return((a=q.data)==null?void 0:a.items)??[]},[q.data]),O=n.useMemo(()=>{const a=new Map,s=Date.now();for(const o of ve.data??[]){const i=ne(o.imovelId),m=o.availableAtUtc,k=m.endsWith("Z")||/[+-]\d{2}:\d{2}$/.test(m)?m:`${m}Z`,N=Date.parse(k);!Number.isNaN(N)&&N>s&&a.set(i,N)}return a},[ve.data]),ta=n.useMemo(()=>{const a=Date.now();return h.filter(s=>{const o=O.get(ne(s.id));return o===void 0||o<=a}).length},[h,O]),sa=n.useMemo(()=>{var o;const a=h.map(dt),s=new Map([["alto",[]],["medio",[]],["baixo",[]],["indef",[]]]);for(const i of a){const m=mt(i.standardTier);(o=s.get(m))==null||o.push(i)}return s},[h]),ra=n.useMemo(()=>{for(const a of c){const s=h.find(o=>o.id===a);if(((s==null?void 0:s.standardTier)??"").trim().toLowerCase()===F)return!0}return!1},[c,h]),ia=n.useCallback(a=>{f(s=>{const o=new Set(s);return o.has(a)?o.delete(a):o.size<oe&&o.add(a),o})},[]),oa=n.useCallback(a=>{const s=ne(a);w(o=>{var v;const i=new Set(o);if(i.has(a))return i.delete(a),i;const m=O.get(s);if(m!==void 0&&m>Date.now()||i.size>=V)return i;const k=h.find(g=>g.id===a);return!k||(((v=k.standardTier)==null?void 0:v.trim().toLowerCase())??"")===F&&[...i].some(b=>{const C=h.find(K=>K.id===b);return((C==null?void 0:C.standardTier)??"").trim().toLowerCase()===F})||i.add(a),i})},[h,O]),W=l.size>0,ae=c.size>=1,na=W&&ae,T=je.data,te=je.isSuccess&&T!==null&&T!==void 0&&T.remaining<=0,la=na&&!j&&!te,E=n.useCallback(async a=>{try{await Aa(a),await x.invalidateQueries({queryKey:pe})}catch(s){console.warn("[GerarClientes] linha de atividade não gravada:",s)}},[x]),ca=n.useCallback(async()=>{Q.current&&(Q.current.abort(),Q.current=null);const a=M.current;M.current=null,$.current=!1;try{await ka()}catch(s){console.warn("Erro ao cancelar automação na extensão:",s)}I(!1),ee(!1),p.info("Automação cancelada pelo utilizador."),a?(await Ca(a),x.invalidateQueries({queryKey:pe}),x.invalidateQueries({queryKey:Y}),x.invalidateQueries({queryKey:Ee}),x.invalidateQueries({queryKey:re})):E("Automação de publicação cancelada.")},[E,x,ee]),da=async()=>{var s,o,i,m,k,N,v;if(!la||$.current)return;$.current=!0,I(!0),ee(!0);const a=new AbortController;Q.current=a,M.current=null;try{const{eligible:g}=await za();if(g===!1){ce(!0),p.error("Sua conta do Facebook é uma Página e não pode publicar no Marketplace. Troque para uma conta pessoal ou profissional.",{duration:7e3});return}ce(g===!0?!1:null);let b;try{b=await x.fetchQuery({queryKey:Y,queryFn:Pe})}catch{p.error("Não foi possÃvel verificar sua cota diária. Tente novamente.");return}if(!b||b.remaining<=0){p.error((b==null?void 0:b.dailyLimit)!=null?`Limite de hoje: no máximo ${b.dailyLimit}
11 minerações. Amanhã tem mais!`:"Você já usou sua cota de minerações de hoje. Amanhã tem mais!");return}if(!Da()){p.error("Configure VITE_EXTENSION_ID no front-end e recarregue a página.");return}if(a.signal.aborted)return;const C=await Ta();if(!C.authenticated){p.error(C.error||"Faça login no Facebook e tente novamente.");return}const K=((s=D.data)==null?void 0:s.items)??[],{urls:R,skippedWithoutUrl:Ie,groupLabels:xa}=ht(K,l);if(R.length===0){p.error("Nenhum grupo com URL nos nichos selecionados. Edite os nichos em Grupos e Nichos."),Ie>0&&p.message(`${Ie} grupo(s) cadastrado(s) sem URL foram ignorados.`);return}let y;try{y=await x.fetchQuery({queryKey:Fe,queryFn:Qe})}catch{y=P.data}const pa=h,U=[],ue=[];for(const d of c){const L=pa.find(xe=>xe.id===d);L&&(U.push(gt(L,y)),ue.push(d))}if(U.length===0){p.error("Não foi possÃvel montar as publicações dos imóveis selecionados.");return}const ha=ft(R);let se;try{se=(await Ua({nicheIds:Array.from(l),imovelIds:Array.from(c),groupUrls:R,estimatedReachTotal:ha,publishToMarketplace:A})).id,M.current=se}catch(d){const L=d&&typeof d=="object"&&"status"in d?d.status:void 0;L===429?p.error(d instanceof Error?d.message:"Limite diário de automações atingido."):L===400?p.error(d instanceof Error?d.message:"Seleção de imóveis inválida."):p.error("Não foi possÃvel iniciar a automação. Verifique sua conexão e tente novamente.");return}x.invalidateQueries({queryKey:Y}),x.invalidateQueries({queryKey:re}),await E(`Automação de publicação iniciada (${U.length} imóvel(is), ${R.length} grupo(s)).`),(o=y==null?void 0:y.phone)!=null&&o.trim()&&await E("WhatsApp incorporado nos anúncios, clientes podem entrar em contato direto com você, além do Messenger.");{const d=[];(i=y==null?void 0:y.creci)!=null&&i.trim()&&d.push("CRECI"),(m=y==null?void 0:y.instagram)!=null&&m.trim()&&d.push("Instagram"),d.length>0&&await E(`${d.join(" e ")} ${d.length>1?"foram incorporados":"foi incorporado"} ao anúncio, seu perfil profissional está visÃvel para os compradores.`)}if(await E(`Motor MDL distribuindo ${U.length} imóvel${U.length>1?"is":""} para ${R.length} grupo${R.length>1?"s":""}...`),a.signal.aborted)return;Fa();const S=await Qa({groupUrls:R,posts:U,groupLabels:xa,publishToMarketplace:A,onProgress:d=>{a.signal.aborted||E(d)}});if(M.current===se){M.current=null;const d=S.ok,L=S.ok?((k=S.data)==null?void 0:k.successCount)??0:0,xe=(((N=S.data)==null?void 0:N.results)??[]).flatMap(u=>{if(!u.marketplaceUrl||u.postIndex==null)return[];const Me=ue[u.postIndex];return Me?[{imovelId:Me,url:u.marketplaceUrl}]:[]}),fa=(((v=S.data)==null?void 0:v.results)??[]).flatMap(u=>u.postIndex==null?[]:[{postIndex:u.postIndex,imovelId:ue[u.postIndex],postTitle:u.postTitle,ok:u.ok||u.marketplacePublished===!0,failedStep:u.failedStep,error:u.error,steps:u.steps,tabLoadTimedOut:u.tabLoadTimedOut,urlMissReason:u.urlMissReason,pageUrl:u.pageUrl,navigationFailed:u.navigationFailed}]);Pa(se,{publishedPropertyCount:L,extensionCompleted:d,publishToMarketplace:A,marketplaceLinks:xe,jobDiagnostics:fa})}if(await x.invalidateQueries({queryKey:qa}),await x.invalidateQueries({queryKey:pe}),await x.invalidateQueries({queryKey:Oa}),!S.ok){p.error(S.error||"A extensão não concluiu a automação.");return}}catch(g){p.error(g instanceof Error?g.message:"Erro inesperado ao falar com a extensão.")}finally{Q.current=null,M.current=null,$.current=!1,I(!1),ee(!1),x.invalidateQueries({queryKey:Y}),x.invalidateQueries({queryKey:Ee}),x.invalidateQueries({queryKey:re})}},ma=()=>{if(!j){if(!W){p.info("Selecione ao menos 1 nicho com grupo e URL.");return}if(te){const a=(T==null?void 0:T.dailyLimit)??null;p.error(a!==null?`Você já usou suas ${a} minerações de hoje. Até amanhã â ou dá uma olhada no painel.`:"Você já usou suas minerações de hoje. Até amanhã â ou dá uma olhada no painel.");return}da()}},ua=D.isLoading,me=q.isLoading,we=D.isError?D.error.message:null,Ne=q.isError?q.error.message:null;return P.data&&!P.data.isAdmin&&P.data.hasValidSubscription&&!P.data.isProfileComplete?e.jsx("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-16",children:e.jsxs("div",{className:"rounded-3xl border border-slate-200/90 glass-surface p-8 sm:p-10 text-center space-y-5 shadow-sm",children:[e.jsx("div",{className:"inline-flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:e.jsx(Re,{className:"h-7 w-7","aria-hidden":!0})}),e.jsx("h1",{className:"font-display text-2xl sm:text-3xl text-foreground",children:"Complete seu perfil"}),e.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed max-w-md mx-auto",children:["Para usar a geração de clientes, informe o"," ",e.jsx("span",{className:"font-medium text-foreground",children:"WhatsApp"})," ","com DDD na página de perfil (campo obrigatório). CRECI, Instagram e site são opcionais."]}),e.jsx(he,{type:"button",className:"rounded-xl",size:"lg",asChild:!0,children:e.jsx(Z,{to:"/perfil",children:"Ir para o perfil"})})]})}):e.jsxs("div",{className:"max-w-[90rem] mx-auto px-4 sm:px-6 py-10 pb-16 relative",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"font-display text-3xl sm:text-4xl text-foreground tracking-tight",children:"Publicação Automática"}),e.jsxs("div",{className:"mt-5 flex items-center gap-0 max-w-xs",children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("div",{className:`flex h-8 w-8 items-center justify-center rounded-full text-sm font-bold transition-colors ${t===1?"bg-primary text-primary-foreground":"bg-emerald-500 text-white"}`,children:t>1?e.jsx(fe,{className:"h-4 w-4",strokeWidth:3}):"1"}),e.jsx("span",{className:`text-sm font-semibold transition-colors ${t===1?"text-foreground":"text-muted-foreground"}`,children:"Imóveis"})]}),e.jsx("div",{className:"mx-3 flex-1 h-px bg-slate-200 min-w-[2rem]"}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("div",{className:`flex h-8 w-8 items-center justify-center rounded-full text-sm font-bold transition-colors ${t===2?"bg-primary text-primary-foreground":"bg-slate-200 text-slate-500"}`,children:"2"}),e.jsx("span",{className:`text-sm font-semibold transition-colors ${t===2?"text-foreground":"text-muted-foreground"}`,children:"Nichos"})]})]})]}),e.jsxs("div",{className:"mb-6 flex items-start gap-3 rounded-2xl border border-primary/20 bg-gradient-to-r from-primary/10 to-amber-50/60 px-4 py-3.5",children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary mt-0.5",children:e.jsx(Ia,{className:"h-4 w-4",strokeWidth:2.25})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-bold text-foreground leading-snug",children:"Quanto mais você gera, mais clientes aparecem"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 leading-relaxed",children:["Gere ao menos ",e.jsx("span",{className:"font-semibold text-foreground",children:"2 vezes por dia"})," e mantenha pelo menos"," ",e.jsx("span",{className:"font-semibold text-foreground",children:"9 imóveis cadastrados"})," para maximizar seu alcance no Marketplace.",h.length<3&&e.jsxs("span",{className:"ml-1 text-primary font-semibold",children:["Você tem ",h.length," imóvel",h.length!==1?"is":""," â"," ",e.jsx(Z,{to:"/imoveis",className:"underline underline-offset-2 hover:text-primary/80 transition-colors",children:"cadastre mais agora"}),"."]})]})]})]}),e.jsx(qe,{mode:"wait",initial:!1,children:t===1?e.jsxs(G.div,{className:"w-full",initial:{opacity:0,x:-28}
11,animate:{opacity:1,x:0},exit:{opacity:0,x:-28},transition:{duration:.2,ease:"easeOut"},children:[e.jsxs("section",{id:"gerar-etapa-imoveis",className:"rounded-3xl border border-slate-200/90 glass-surface p-6 sm:p-8 flex flex-col min-h-[280px] w-full lg:min-w-[900px]",children:[e.jsxs("div",{"data-tour":"publicar-automatico",className:"flex items-start gap-3 mb-5",children:[e.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-primary text-primary-foreground text-sm font-bold shadow-sm",children:"1"}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-wrap items-start justify-between gap-x-4 gap-y-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"font-display text-xl text-foreground",children:"Selecione os imóveis"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Selecione de 1 a ",V," imóveis."," ",c.size,"/",V," ","selecionados"]}),e.jsxs("ul",{className:"mt-3 text-xs text-muted-foreground space-y-1 list-disc pl-5 max-w-2xl",children:[e.jsxs("li",{children:["Máximo de"," ",e.jsx("span",{className:"font-medium text-foreground/90",children:"1 imóvel de alto padrão"})," ","por geração."]}),e.jsx("li",{children:"Imóveis usados com sucesso ficam bloqueados para uso por 48h."})]})]}),!me&&ta===0?e.jsxs(Z,{to:"/imoveis",className:"shrink-0 flex items-start gap-2.5 rounded-xl border border-amber-300/70 bg-amber-50/80 px-3.5 py-2.5 hover:bg-amber-50 hover:border-amber-400/80 transition-colors group",children:[e.jsx(Se,{className:"w-4 h-4 shrink-0 text-amber-600 mt-0.5","aria-hidden":!0}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-xs font-semibold text-amber-900 leading-snug",children:"Nenhum imóvel disponÃvel"}),e.jsx("span",{className:"block text-[11px] text-amber-700/80 leading-snug mt-0.5",children:"Cadastre pelo menos 1 imóvel para gerar. Clique aqui."})]})]}):null]})]}),Ne?e.jsx("p",{className:"text-sm text-destructive",children:Ne}):me?e.jsxs("div",{className:"flex flex-1 items-center justify-center gap-2 py-16 text-muted-foreground",children:[e.jsx(ie,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{className:"text-sm",children:"Carregando imóveis..."})]}):h.length===0?e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[e.jsx(Se,{className:"w-10 h-10 opacity-40 mb-3"}),e.jsx("p",{className:"text-sm",children:"Nenhum imóvel cadastrado."}),e.jsx("p",{className:"text-xs mt-1",children:"Cadastre imóveis em Meus Imóveis."})]}):e.jsx("div",{className:"flex flex-col gap-10 pt-2",children:lt.map(a=>{const s=sa.get(a.tier)??[];if(s.length===0)return null;const o=ct[a.tier];return e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:`h-8 w-1 rounded-full shrink-0 ${o.bar}`}),e.jsx("h3",{className:"text-base font-bold text-foreground tracking-tight",children:a.title}),e.jsxs("span",{className:`text-[11px] font-semibold px-2 py-0.5 rounded-full shrink-0 ${o.badge}`,children:[s.length," ",s.length!==1?"imóveis":"imóvel"]})]}),a.subtitle&&e.jsx("p",{className:"text-xs text-muted-foreground mb-4 max-w-2xl -mt-1 pl-4",children:a.subtitle}),e.jsx("ul",{className:"m-0 list-none p-0 mt-4 grid grid-cols-[repeat(auto-fill,minmax(min(100%,15.5rem),1fr))] gap-3 sm:gap-4 content-start",children:s.map(i=>{const m=c.has(i.id),k=(i.standardTier??"").trim().toLowerCase(),N=c.size>=V&&!m,v=O.get(ne(i.id)),g=v!==void 0&&v>Date.now(),b=k===F&&ra&&!m,C=N||g||b,K=g?`Em cooldown até ${ut(v)}`:b?"Já existe um imóvel de alto padrão nesta combinação":N?`Limite de ${V} imóveis`:void 0;return e.jsx("li",{className:"min-w-0",children:e.jsxs("button",{type:"button",title:K,disabled:C,onClick:()=>oa(i.id),className:`w-full h-full text-left rounded-2xl border overflow-hidden transition-all flex flex-col ${m?"border-primary/50 bg-primary/8 ring-1 ring-primary/20":"border-slate-200/80 glass-surface-subtle hover:border-slate-300/90"} ${C?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[e.jsx("div",{className:"relative aspect-[4/3] w-full overflow-hidden bg-slate-100 border-b border-slate-200/70",children:e.jsx("img",{src:i.image,alt:"",className:"h-full w-full object-cover"})}),e.jsxs("div",{className:"p-3 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex gap-2 items-start",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"font-display text-sm text-foreground line-clamp-2 text-left block",children:i.title}),e.jsx("span",{className:"text-xs font-semibold text-primary tabular-nums mt-1 block",children:i.price})]}),e.jsx("span",{className:"mt-0.5 shrink-0 flex h-5 w-5 items-center justify-center rounded-md border border-primary/40 data-[sel=true]:bg-primary data-[sel=true]:text-primary-foreground","data-sel":m,"aria-hidden":!0,
11children:m?e.jsx(fe,{className:"w-3.5 h-3.5",strokeWidth:3}):null})]}),e.jsx(_a,{listingKind:i.listingKind,standardTier:i.standardTier,size:"sm"}),g&&v?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-[12px] font-semibold text-amber-700 ring-1 ring-amber-300/60",children:["â± DisponÃvel novamente em ",xt(v),"h"]}):null]})]})},i.id)})})]},a.tier)})})]}),e.jsxs("div",{className:"mt-6 max-w-3xl mx-auto w-full space-y-3",children:[!ae&&!me&&h.length>0&&e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Selecione ao menos 1 imóvel para continuar."}),e.jsx(G.button,{type:"button",disabled:!ae,onClick:()=>r(2),className:`relative w-full overflow-hidden rounded-2xl py-4 px-6 text-base font-semibold bg-primary text-primary-foreground shadow-[0_6px_28px_-6px_hsl(24_100%_40%/0.55)] transition-opacity ${ae?"hover:opacity-95":"opacity-45 cursor-not-allowed"}`,children:e.jsxs("span",{className:"flex items-center justify-center gap-2.5",children:["Próximo passo â Selecionar nichos",e.jsx(Le,{className:"w-5 h-5 shrink-0"})]})})]})]},"step1"):e.jsxs(G.div,{className:"w-full",initial:{opacity:0,x:28},animate:{opacity:1,x:0},exit:{opacity:0,x:28},transition:{duration:.2,ease:"easeOut"},children:[e.jsxs("button",{type:"button",onClick:()=>r(1),disabled:j,className:"mb-6 flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(Ba,{className:"w-4 h-4 shrink-0"}),"Voltar para imóveis",c.size>0&&e.jsxs("span",{className:"ml-1 rounded-full bg-primary/10 px-1.5 py-0.5 text-[11px] font-semibold text-primary tabular-nums",children:[c.size," selecionado",c.size!==1?"s":""]})]}),e.jsxs("section",{id:"gerar-etapa-nichos",className:"rounded-3xl border border-slate-200/90 glass-surface p-6 sm:p-8 flex flex-col min-h-[280px] w-full lg:min-w-[900px]",children:[e.jsxs("div",{className:"flex items-start gap-3 mb-5",children:[e.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-primary text-primary-foreground text-sm font-bold shadow-sm",children:"2"}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-display text-xl text-foreground",children:"Selecione os nichos"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Até ",oe," nichos ·"," ",l.size,"/",oe," ","selecionados"]})]})]}),we?e.jsx("p",{className:"text-sm text-destructive",children:we}):ua?e.jsxs("div",{className:"flex flex-1 items-center justify-center gap-2 py-16 text-muted-foreground",children:[e.jsx(ie,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{className:"text-sm",children:"Carregando nichos..."})]}):(ke=(Ae=D.data)==null?void 0:Ae.items)!=null&&ke.length?e.jsx("ul",{className:"m-0 list-none p-0 grid grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4 content-start",children:(((Ce=D.data)==null?void 0:Ce.items)??[]).map(a=>{const s=l.has(a.id),o=l.size>=oe&&!s;return e.jsx("li",{className:"min-w-0",children:e.jsxs("button",{type:"button",disabled:o,onClick:()=>ia(a.id),className:`w-full h-full min-h-[7.5rem] text-left rounded-2xl border px-4 py-3.5 transition-all flex gap-3 items-start ${s?"border-primary/50 bg-primary/8 ring-1 ring-primary/20":"border-slate-200/80 glass-surface-subtle hover:border-slate-300/90"} ${o?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[e.jsx("span",{className:"mt-0.5 shrink-0 flex h-5 w-5 items-center justify-center rounded-md border border-primary/40 data-[sel=true]:bg-primary data-[sel=true]:text-primary-foreground","data-sel":s,children:s?e.jsx(fe,{className:"w-3.5 h-3.5",strokeWidth:3}):null}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"font-display text-base text-foreground block",children:a.title}),e.jsx("span",{className:"text-sm text-muted-foreground mt-1 line-clamp-3 block",children:a.description}),e.jsxs("span",{className:"text-xs font-medium text-primary/90 mt-2 inline-block tabular-nums",children:[a.groups.length," ",a.groups.length===1?"grupo":"grupos"]})]})]})},a.id)})}):e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[e.jsx(Ma,{className:"w-10 h-10 opacity-40 mb-3"}),e.jsx("p",{className:"text-sm",children:"Nenhum nicho cadastrado."}),e.jsx("p",{className:"text-xs mt-1",children:"Cadastre nichos em Grupos e Nichos."})]})]}),e.jsxs("div",{id:"gerar-acao-final",className:"mt-6 sm:mt-8 max-w-3xl mx-auto w-full space-y-3 scroll-mt-24",children:[!j&&e.jsxs("div",{className:"rounded-xl border border-primary/25 bg-primary/5 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1.5",children:[e.jsxs("div",{className:"flex items-start gap-1.5 min-w-0",children:[e.jsx(Oe,{className:"w-3.5 h-3.5 shrink-0 text-primary mt-0.5"}),J?e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-base font-bold text-primary leading-tight",children:J}
11),e.jsx("p",{className:"text-xs font-medium text-foreground/70 leading-snug",children:"essa é a sua localização no Marketplace"})]}):e.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Confirme sua localização no Marketplace"})]}),e.jsxs("button",{type:"button",onClick:()=>le(!0),className:"shrink-0 flex items-center gap-1 text-xs text-primary hover:underline",children:[e.jsx(Ea,{className:"w-3.5 h-3.5 shrink-0"}),"Como verificar?"]})]}),e.jsx("div",{className:"mb-3",children:_e?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"w-3 h-3 animate-spin text-primary shrink-0"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Buscando sua localização..."})]}):J?e.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["Seus imóveis serão publicados nessa cidade. Confirme antes de gerar ou"," ",e.jsx("a",{href:"https://www.facebook.com/marketplace/create/item",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"troque a localização"}),"."]}):e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Os imóveis serão publicados na cidade configurada no Marketplace. Verifique antes de gerar."})}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2.5",children:[e.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:z,onChange:a=>X(a.target.checked),className:"h-5 w-5 rounded border-slate-400 accent-primary cursor-pointer shrink-0"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"Minha localização está correta"})]}),!J&&e.jsxs("a",{href:"https://www.facebook.com/marketplace/create/item",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-white px-3 py-2 text-xs font-medium text-foreground hover:bg-slate-50 hover:border-slate-300 transition-colors",children:[e.jsx(Ge,{className:"w-3.5 h-3.5 shrink-0 text-primary"}),"Ver localização no Facebook"]})]})]}),e.jsx(ze,{open:$e,onOpenChange:le,children:e.jsxs(De,{className:"sm:max-w-md",children:[e.jsx(Te,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx(Oe,{className:"w-4 h-4 text-primary shrink-0"}),"Como verificar sua localização"]})}),e.jsx("div",{className:"space-y-3",children:[{n:1,title:'Clique em "Abrir Marketplace agora"',body:"O Facebook abrirá a tela de criar um novo anúncio no Marketplace.",img:void 0},{n:2,title:'Role a página e clique em "Mais detalhes"',body:"Esse item fica logo abaixo dos campos obrigatórios (TÃtulo, Preço, Categoria, Condição). Clique na seta para expandir.",img:st},{n:3,title:'Veja o campo "Localização"',body:'Ele aparece dentro de "Mais detalhes". Mostra a cidade atual. Para alterar, clique no campo e digite a cidade correta.',img:rt},{n:4,title:"Volte aqui e confirme",body:'Após verificar, marque a caixa "Minha localização está correta" e clique em Publicar automaticamente.',img:void 0}].map(a=>e.jsxs("div",{className:"flex gap-3",children:[e.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-xs font-bold mt-0.5",children:a.n}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground leading-snug",children:a.title}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:a.body}),a.img&&e.jsx("img",{src:a.img,alt:a.title,className:"mt-2 w-full rounded-lg border border-slate-200 object-contain"})]})]},a.n))}),e.jsxs("a",{href:"https://www.facebook.com/marketplace/create/item",target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex w-full items-center justify-center gap-2 rounded-xl bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground hover:bg-primary/90 transition-colors",onClick:()=>le(!1),children:[e.jsx(Ge,{className:"w-4 h-4 shrink-0"}),"Abrir Marketplace agora"]})]})}),e.jsx(ze,{open:ea,onOpenChange:_,children:e.jsxs(De,{className:"sm:max-w-md",children:[e.jsx(Te,{children:e.jsx(Ue,{children:"Limpeza Recomendada ð§¹"})}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Para evitar duplicidade e manter a alta performance no Facebook, lembre-se de excluir anúncios antigos ou com baixo desempenho antes de tentar uma nova postagem do mesmo imóvel. Recomendamos fazer isso a cada 7 dias."}),e.jsxs("div",{className:"mt-2 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[e.jsx(he,{variant:"ghost",onClick:()=>_(!1),children:"Agora não"}),e.jsx(he,{asChild:!0,onClick:()=>_(!1),children:e.jsx(Z,{to:"/limpeza",children:"Como fazer limpeza"})})]})]})}),ye&&e.jsxs("div",{className:"flex gap-3 rounded-xl border border-amber-200/80 bg-amber-50/80 px-4 py-3 text-sm",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-amber-500",children:"â "}),e.jsxs("p",{className:"text-amber-900 leading-relaxed",children:[e.jsx("span",{className:"font-semibold",children:"Conta de Página detectada."}
11)," ","O Facebook não permite publicações no Marketplace por Páginas. Troque para uma conta pessoal ou profissional no Facebook antes de gerar."]})]}),W?null:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Selecione ao menos 1 nicho para gerar."}),e.jsx(G.button,{type:"button",disabled:j||te||!z||!!ye,onClick:ma,className:`relative w-full overflow-hidden rounded-2xl py-4 px-6 text-base font-semibold bg-primary text-primary-foreground shadow-[0_6px_28px_-6px_hsl(24_100%_40%/0.55)] transition-opacity disabled:opacity-45 disabled:cursor-not-allowed ${W&&!j&&!te?"hover:opacity-95":""} ${!W&&!j?"opacity-45 cursor-not-allowed":""}`,animate:j?{boxShadow:["0 6px 28px -6px hsl(24 100% 40% / 0.55)","0 8px 36px -4px hsl(24 100% 45% / 0.45)","0 6px 28px -6px hsl(24 100% 40% / 0.55)"]}:{},transition:j?{duration:1.25,repeat:1/0,ease:"easeInOut"}:{},children:e.jsx(qe,{mode:"wait",children:j?e.jsxs(G.span,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},className:"flex items-center justify-center gap-2.5",children:[e.jsx(ie,{className:"w-5 h-5 animate-spin shrink-0"}),"Gerando clientes..."]},"loading"):e.jsxs(G.span,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},className:"flex items-center justify-center gap-2.5",children:[e.jsx(G.span,{className:"inline-flex rounded-lg bg-primary-foreground/15 p-1.5 ring-1 ring-primary-foreground/25",animate:{scale:[1,1.06,1],opacity:[.92,1,.92]},transition:{duration:2.2,repeat:1/0,ease:"easeInOut"},"aria-hidden":!0,children:e.jsx(Re,{className:"w-5 h-5 shrink-0 drop-shadow-[0_0_8px_rgba(255,255,255,0.35)]"})}),"Publicar automaticamente"]},"idle")})}),j&&e.jsxs("div",{className:"flex flex-col items-center gap-3 w-full max-w-lg mx-auto px-1",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row-reverse w-full gap-3 sm:items-stretch",children:[e.jsx("button",{type:"button",onClick:ca,className:"sm:max-w-[13rem] rounded-xl border border-destructive/25 bg-white/80 px-5 py-2.5 text-sm font-medium text-destructive/85 shadow-sm hover:bg-destructive/5 hover:border-destructive/40 hover:text-destructive transition-colors",children:"Cancelar automação"}),e.jsxs(Z,{to:"/painel",className:"flex-1 inline-flex items-center justify-center gap-2 rounded-xl border border-primary bg-primary px-5 py-3 text-sm font-bold text-primary-foreground shadow-[0_10px_28px_-10px_hsl(var(--primary)/0.75)] hover:bg-primary/95 hover:shadow-[0_14px_34px_-12px_hsl(var(--primary)/0.85)] transition-all text-center",children:["Acompanhar em tempo real",e.jsx(Le,{className:"w-4 h-4 shrink-0 opacity-90","aria-hidden":!0})]})]}),e.jsx("p",{className:"text-center text-sm text-muted-foreground leading-relaxed",children:"As métricas e a atividade do painel atualizam enquanto a automação roda."})]})]})]},"step2")})]})};export{Mt as default};
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.