1import{j as e,c as D,F as I,E as R,D as z,d as G,G as E,A as H}from"./index-BzhlEb2N.js";import{r as l,L as p}from"./vendor-react-CpRvMXaC.js";import{e as U}from"./eventoService-D-mTHYLr.js";import{S as M}from"./SubpageHero-BiCXn71M.js";import{e as f}from"./textUtils-C9r3Zn1m.js";import{g}from"./eventoAutoria-Di3KTHLE.js";import{o as j}from"./resolverLocalEscolhido-DW_m2PcE.js";import{F as S}from"./ClockIcon-Kl7pZviT.js";import"./vendor-pdf-De61ZhIs.js";import"./vendor-ui-5rZvml82.js";import"./vendor-editor-DoAMYjM7.js";function $(r){return r?new Date(r).toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric"}):""}function F(r){return r?String(r).slice(0,5):"Sem horário"}function _(r){return r!=null&&r.imagem_url?r.imagem_url:r!=null&&r.imagem?String(r.imagem).startsWith("http")?r.imagem:`${H.STORAGE_URL}/${r.imagem}`:null}function se(){const[r,w]=l.useState([]),[m,b]=l.useState(!0),[x,N]=l.useState(null),[n,h]=l.useState(""),[c,y]=l.useState("todos"),[o,v]=l.useState("proximos"),[u,C]=l.useState("cards");l.useEffect(()=>{async function s(){try{b(!0),N(null);const t=await U.listarPublicados(1e3,{periodo:o});w(Array.isArray(t)?t:[])}catch(t){N("Erro ao carregar eventos."),console.error("Erro ao carregar eventos:",t)}finally{b(!1)}}s()},[o]);const P=l.useMemo(()=>r.filter(s=>{const t=g(s),a=n.trim().toLowerCase(),i=f(s.descricao).toLowerCase(),L=j(s).toLowerCase(),A=t.nomeParceiro.toLowerCase(),B=!a||String(s.titulo||"").toLowerCase().includes(a)||i.includes(a)||L.includes(a)||A.includes(a),T=c==="todos"||t.key===c;return B&&T}),[r,n,c]),d=l.useMemo(()=>[...P].sort((s,t)=>{const a=new Date(`${(s==null?void 0:s.data_inicio)||""}T${(s==null?void 0:s.hora_inicio)||"00:00"}`),i=new Date(`${(t==null?void 0:t.data_inicio)||""}T${(t==null?void 0:t.hora_inicio)||"00:00"}`);return o==="anteriores"?i-a:a-i}),[P,o]),k=(s,t,a,i)=>s.link_inscricao?e.jsx("button",{type:"button",onClick:()=>window.open(s.link_inscricao,"_blank","noopener,noreferrer"),className:t,style:a,children:i},s.id):s.slug?e.jsx(p,{to:`/eventos/${s.slug}`,className:t,style:a,children:i},s.id):e.jsx("div",{className:t,style:a,children:i},s.id);return e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-gray-50 to-white",children:[e.jsxs(M,{paddingClass:"py-16 md:py-20",children:[e.jsx("nav",{className:"mb-6","aria-label":"Breadcrumb",children:e.jsxs("ol",{className:"flex items-center gap-2 text-sm text-white/80",children:[e.jsx("li",{children:e.jsx(p,{to:"/",className:"hover:text-white transition-colors",children:"Home"})}),e.jsx("li",{children:"/"}),e.jsx("li",{className:"text-white font-semibold",children:"Eventos"})]})}),e.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-3 leading-tight text-white",children:"Eventos"}),e.jsx("p",{className:"text-xl text-white/90 max-w-4xl",children:"Explore os eventos do CRP-PR e de parceiros com filtros e visualização em cards ou lista."})]}),e.jsx("section",{className:"py-12 md:py-16",children:e.jsx("div",{className:"container mx-auto px-6",children:e.jsxs("div",{className:"max-w-7xl mx-auto grid grid-cols-1 lg:grid-cols-[25%_75%] gap-8 items-start",children:[e.jsxs("div",{className:"lg:sticky lg:top-6 flex flex-col gap-5",children:[e.jsxs("aside",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-5 flex flex-col gap-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold text-titulos mb-1",children:"Filtros"}),e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:"Pesquise por tÃtulo, local ou nome do parceiro."}),e.jsxs("div",{className:"relative",children:[e.jsx(D,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{type:"text",value:n,onChange:s=>h(s.target.value),placeholder:"Buscar evento...",className:"w-full pl-9 pr-8 py-2 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),n&&e.jsx("button",{type:"button",onClick:()=>h(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:e.jsx(I,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"PerÃodo"}),e.jsx("div",{className:"flex flex-col gap-2",children:[{valor:"proximos",label:"Próximos eventos"},{valor:"anteriores",label:"Eventos anteriores"}].map(({valor:s,label:t})=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[e.jsx("input",{type:"radio",name:"filtroPeriodo",value:s,checked:o===s,onChange:()=>v(s),className:"accent-primary-600"}),e.jsx("span",{className:"text-sm text-gray-700",children:t})]},s))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Autoria"}),e.jsx("div",{className:"flex flex-col gap-2",children:[{valor:"todos",label:"Todas"},{valor:"crp",label:"CRP-PR"},{valor:"parceiro",label:"Parceiro"}].map(({valor:s,label:t})=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[e.jsx("input",{type:"radio",name:"filtroAutoria",value:s,checked:c===s,onChange:()=>y(s),className:"accent-primary-600"}),e.jsx("span",{className:"text-sm text-gray-700",children:t})]},s))})]}),(n||c!=="todos"||o!=="proximos")&&e.jsx("button",{type:"button",onClick:()=>{h(""),y("todos"),v("proximos")},className:"text-xs text-primary-600 hover:text-primary-800 font-medium text-left",children:"Limpar filtros"})]}),e.jsxs("div",{className:"rounded-xl bg-[#0B2D2B] p-5 shadow-sm",children:[e.jsx("p",{className:"text-sm font-semibold leading-6 text-white",children:"Para ver mais programações do CRP-PR, clique abaixo."}),e.jsxs(p,{to:"/calendario-geral",className:"mt-4 inline-flex w-full items-center justify-center gap-2 rounded-lg bg-white px-4 py-3 text-sm font-semibold text-[#0B2D2B] transition-colors hover:bg-emerald-50",children:[e.jsx(R,{className:"h-5 w-5"}),"Calendário Geral"]})]})]}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-start md:justify-between gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-titulos mb-2",children:"Listagem de eventos"}),e.jsxs("p",{className:"text-sm text-gray-600",children:[d.length," ",o==="anteriores"?"evento(s) anterior(es) encontrado(s).":"próximo(s) evento(s) encontrado(s)."]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mt-3",children:[e.jsx("span",{className:"inline-flex items-center px-2.5 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:"CRP-PR"}),e.jsx("span",{className:"inline-flex items-center px-2.5 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:"Parceiro"})]})]}),e.jsxs("div",{className:"inline-flex items-center rounded-lg border border-gray-200 bg-gray-50 p-1",children:[e.jsxs("button",{type:"button",onClick:()=>C("cards"),className:`inline-flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-md transition-colors ${u==="cards"?"bg-white text-primary-700 shadow-sm":"text-gray-600 hover:text-gray-800"}`,children:[e.jsx(z,{className:"h-4 w-4"}),"Cards"]}),e.jsxs("button",{type:"button",onClick:()=>C("lista"),className:`inline-flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-md transition-colors ${u==="lista"?"bg-white text-primary-700 shadow-sm":"text-gray-600 hover:text-gray-800"}`,children:[e.jsx(G,{className:"h-4 w-4"}),"Lista"]})]})]}),m&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"}),e.jsx("p",{className:"mt-4 text-sm text-gray-600",children:"Carregando eventos..."})]}),!m&&x&&e.jsx("div",{className:"text-center py-10 bg-red-50 border border-red-200 rounded-lg",children:e.jsx("p",{className:"text-sm text-red-700",children:x})}),!m&&!x&&d.length===0&&e.jsx("div",{className:"text-center py-12 text-gray-500",children:n||c!=="todos"?"Nenhum evento encontrado para os filtros aplicad
1os.":o==="anteriores"?"Nenhum evento anterior disponÃvel no momento.":"Nenhum próximo evento disponÃvel no momento."}),!m&&!x&&d.length>0&&(u==="cards"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 2xl:grid-cols-3 gap-4",children:d.map(s=>{const t=g(s),a=_(s),i=j(s);return k(s,"block w-full text-left border rounded-xl overflow-hidden shadow-sm transition-all hover:brightness-110 hover:shadow-md",{backgroundColor:t.color,borderColor:t.color},e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-40 overflow-hidden bg-white/10",children:a?e.jsx("img",{src:a,alt:s.titulo,className:"w-full h-full object-cover",loading:"lazy"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/80",children:"Sem imagem"})}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[e.jsx("h3",{className:"text-base font-semibold text-white line-clamp-2",children:s.titulo}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium shrink-0 ${t.badgeClass}`,children:t.label})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-white/90",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(R,{className:"h-4 w-4 text-white"}),e.jsx("span",{children:$(s.data_inicio||s.data)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(S,{className:"h-4 w-4 text-white"}),e.jsx("span",{children:F(s.hora_inicio)})]}),i&&e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(E,{className:"h-4 w-4 text-white"}),e.jsx("span",{className:"line-clamp-1",children:i})]})]}),t.isParceiro&&t.nomeParceiro&&e.jsxs("p",{className:"mt-3 text-xs font-medium text-white/90 line-clamp-1",children:["Parceiro: ",t.nomeParceiro]}),s.descricao&&e.jsx("p",{className:"mt-3 text-sm text-white/90 line-clamp-2",children:f(s.descricao)})]})]}))})}):e.jsx("div",{className:"space-y-4",children:d.map(s=>{const t=g(s),a=_(s),i=j(s);return k(s,"block w-full text-left border rounded-xl shadow-sm transition-all hover:brightness-110 hover:shadow-md",{backgroundColor:t.color,borderColor:t.color},e.jsxs("div",{className:"flex flex-col md:flex-row gap-4 p-4",children:[e.jsx("div",{className:"w-full md:w-40 h-28 rounded-lg overflow-hidden shrink-0 bg-white/10",children:a?e.jsx("img",{src:a,alt:s.titulo,className:"w-full h-full object-cover",loading:"lazy"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/80",children:"Sem imagem"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-2 mb-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${t.badgeClass}`,children:t.label}),t.isParceiro&&t.nomeParceiro&&e.jsx("span",{className:"text-xs text-white/85",children:t.nomeParceiro})]}),e.jsx("h3",{className:"text-lg font-semibold text-white",children:s.titulo})]}),e.jsx("div",{className:"text-sm font-medium text-white/90",children:$(s.data_inicio||s.data)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-white/90",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(S,{className:"h-4 w-4 text-white"}),e.jsx("span",{children:F(s.hora_inicio)})]}),i&&e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(E,{className:"h-4 w-4 text-white"}),e.jsx("span",{className:"line-clamp-1",children:i})]})]}),s.descricao&&e.jsx("p",{className:"mt-3 text-sm text-white/90 line-clamp-2",children:f(s.descricao)})]})]}))})}))]})]})})})]})}export{se 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.