PageSourceSearch

https://fedeesp.org.br/assets/DocumentManager-Dl5PqGSd.js

js fedeesp.org.br collected 2026-10-04 07:48:31 UTC 26,342 bytes, 1 lines download raw bytes

1import{b as g,j as e,B as le,t as D,d as Se}from"./index-BbKxumrM.js";import{r as n}from"./react-vendor-DT1_wbt4.js";import{D as E,A as M}from"./documentCategories-BUHFW6EC.js";import{d as y,b8 as re,aO as G,F as X,X as A,ai as H,b7 as Pe,b9 as ke,a as ze,ap as Fe,e as $e,b6 as Ee}from"./ui-vendor-BfDHuItz.js";import"./firebase-vendor-CSkRnVBi.js";const qe=()=>{const[W,oe]=n.useState([]),[ne,ie]=n.useState([]),[T,Z]=n.useState(!1),[u,J]=n.useState(null),[K,ce]=n.useState(""),[S,L]=n.useState("single"),[f,B]=n.useState([]),[j,q]=n.useState([]),b=n.useRef(null),[a,x]=n.useState({title:"",description:"",category:"Geral",scope:"global",competitionSlug:"",status:"published",statusPrestacao:"Projeto em execução"}),[d,h]=n.useState([]),[Q,de]=n.useState("transparency"),[P,k]=n.useState("Geral"),[V,me]=n.useState(""),[I,xe]=n.useState(""),[Y,ee]=n.useState(0),z=n.useRef(null);n.useEffect(()=>{F()},[]);const F=async()=>{try{const[t,s]=await Promise.all([g.getDocuments(),g.getCompetitions()]);oe(t),ie(s)}catch(t){console.error(t)}},ue=async t=>{await Se("Tem certeza?")&&(await g.deleteDocument(t),F())},v=t=>{x({...a,[t.target.name]:t.target.value})},pe=t=>{const s=Array.from(t.target.files||[]);if(s.length>0&&(B(l=>[...l,...s]),!a.title)){const l=s[0].name.replace(/\.[^/.]+$/,"");x(r=>({...r,title:l}))}b.current&&(b.current.value="")},ge=t=>{B(s=>s.filter((l,r)=>r!==t))},he=t=>{q(s=>s.filter((l,r)=>r!==t))},be=t=>{x({title:t.title,description:t.description||"",category:t.category||"Geral",scope:t.scope,competitionSlug:t.competitionSlug||"",status:t.status,date:t.date,statusPrestacao:t.statusPrestacao});const s=[];t.files&&t.files.length>0?s.push(...t.files):t.url&&s.push({url:t.url,downloadName:t.downloadName,size:t.size,type:t.type}),q(s),J(t.id),L("single"),window.scrollTo({top:0,behavior:"smooth"})},$=()=>{J(null),x({title:"",description:"",category:"Geral",scope:"global",competitionSlug:"",status:"published",statusPrestacao:void 0}),B([]),q([]),b.current&&(b.current.value="")},ye=async t=>{var s;if(t.preventDefault(),!a.title){alert("Informe um título.");return}if(f.length===0&&j.length===0){alert("Precisa ter pelo menos um arquivo.");return}if(!a.category||a.category==="custom"){alert("Informe uma categoria válida.");return}Z(!0);try{const l=[...j];for(const i of f){const p=((s=i.name.split(".").pop())==null?void 0:s.toLowerCase())||"file",N=(a.title||"doc").replace(/[^a-zA-Z0-9_\-]/g,"_"),se=`documents/${Date.now()}_${N}_${Math.random().toString(36).substring(7)}.${p}`,w=i.name,O=await g.uploadFile(i,se,w);l.push({url:O,downloadName:w,type:p.toUpperCase(),size:`${(i.size/(1024*1024)).toFixed(2)} MB`})}const r=E.find(i=>i.label.includes("Financeiro")),m=(r==null?void 0:r.categories)||[],o=a.scope==="transparency"||m.includes(a.category||""),c={...a,category:(a.category||"Geral").trim(),files:l,date:a.date||new Date().toLocaleDateString("pt-BR"),statusPrestacao:o?a.statusPrestacao||"Projeto em execução":void 0};u?(await g.saveDocument({id:u,...c}),D.success("Documento atualizado com sucesso!")):(await g.saveDocument(c),D.success("Documento publicado com sucesso!")),$(),F()}catch(l){D.error("Erro ao salvar: "+l.message)}finally{Z(!1)}},fe=t=>{const l=Array.from(t.target.files||[]).map(r=>({id:`${Date.now()}_${Math.random()}`,file:r,title:r.name.replace(/\.[^/.]+$/,""),downloadName:r.name,description:"",status:"pending"}));h(r=>[...r,...l]),z.current&&(z.current.value="")},R=(t,s,l)=>{h(r=>r.map(m=>m.id===t?{...m,[s]:l}:m))},je=t=>{h(s=>s.filter(l=>l.id!==t))},ve=async()=>{var r,m;const t=d.filter(o=>o.status==="pending");if(!t.length){alert("Nenhum arquivo para publicar.");return}const s=P==="custom"?V:P;if(!s){alert("Informe uma categoria.");return}ee(0);let l=0;for(const o of t){h(c=>c.map(i=>i.id===o.id?{...i,status:"uploading"}:i));try{const c=((r=o.file.name.split(".").pop())==null?void 0:r.toLowerCase())||"file",i=o.title.replace(/[^a-zA-Z0-9_\-]/g,"_"),p=`documents/${Date.now()}_${i}.${c}`,N=((m=o.downloadName)==null?void 0:m.trim())||o.file.name,w=o.file.name.includes(".")&&!N.toLowerCase().endsWith(`.${c}`)?`${N}.${c}`:N,O=await g.uploadFile(o.file,p,w),Ce=`${(o.file.size/(1024*1024)).toFixed(2)} MB`;let ae=new Date().toLocaleDateString("pt-BR");
1if(I){const[U,C,De]=I.split("-");ae=`${De}/${C}/${U}`}await g.saveDocument({title:o.title,description:o.description,downloadName:w,url:O,date:ae,size:Ce,type:c.toUpperCase(),category:(s||"Geral").trim(),scope:Q,status:"published"}),h(U=>U.map(C=>C.id===o.id?{...C,status:"done"}:C))}catch(c){h(i=>i.map(p=>p.id===o.id?{...p,status:"error",error:c.message}:p))}l++,ee(Math.round(l/t.length*100))}F()},Ne=()=>h(t=>t.filter(s=>s.status!=="done")),_=E.find(t=>t.label.includes("Financeiro")),we=(_==null?void 0:_.categories)||[],te=a.scope==="transparency"||we.includes(a.category||"");return e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-6",children:"Gerenciar Documentos"}),e.jsxs("div",{className:"flex gap-2 mb-6",children:[e.jsxs("button",{onClick:()=>{L("single"),$()},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-semibold border transition-colors ${S==="single"?"bg-blue-600 text-white border-blue-600":"bg-white text-gray-600 border-gray-300 hover:bg-gray-50"}`,children:[e.jsx(y,{size:16})," Publicar Documento"]}),e.jsxs("button",{onClick:()=>{L("batch"),$()},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-semibold border transition-colors ${S==="batch"?"bg-purple-600 text-white border-purple-600":"bg-white text-gray-600 border-gray-300 hover:bg-gray-50"}`,children:[e.jsx(re,{size:16})," Upload em Lote"]})]}),S==="single"&&e.jsxs("div",{className:`p-6 rounded-lg shadow-sm border mb-8 transition-colors ${u?"bg-yellow-50 border-yellow-200":"bg-white border-gray-200"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-bold flex items-center gap-2",children:u?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"text-yellow-600"})," Editando Documento"]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{size:20})," Publicar Novo Documento"]})}),u&&e.jsx("button",{onClick:$,className:"text-xs font-bold text-red-600 hover:underline",children:"CANCELAR EDIÇÃO"})]}),e.jsxs("form",{onSubmit:ye,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 items-end",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Título do Documento"}),e.jsx("input",{type:"text",name:"title",value:a.title,onChange:v,className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-white text-gray-900",placeholder:"Ex: Regulamento Geral 2024",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Categoria"}),e.jsxs("select",{name:"category",value:a.category?[...M,"Geral"].includes(a.category)?a.category:"custom":"Geral",onChange:t=>{const s=t.target.value;let l=a.scope;["Prestação de Contas","Balanço Financeiro","Edital de Convocação","TJD","Convênios","Acordo Cooperação Técnica - ACT","Emendas Parlamentares","Programa de Apoio as Federações"].includes(s)?l="transparency":["Estatuto Social","Atas e Assembleias","Código de Ética","Código de Conduta / Ética","Regimentos Internos","Políticas Institucionais","Portaria Fedeesp","Portaria CBDE","Portaria (Outras)","Resoluções"].includes(s)&&(l="governance"),x({...a,category:s==="custom"?"":s,scope:l})},className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-white text-gray-900 text-sm",children:[e.jsx("option",{value:"Geral",children:"Geral (Padrão)"}),E.map(t=>e.jsx("optgroup",{label:t.label,children:t.categories.map(s=>e.jsx("option",{value:s,children:s},s))},t.label)),e.jsx("option",{value:"custom",children:a.category&&![...M,"Geral"].includes(a.category)?`Atual: ${a.category}`:"+ Digitar Nova Categoria..."})]}),(a.category===""||!!a.category&&![...M,"Geral"].includes(a.category))&&e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"block text-[11px] font-bold text-blue-600 mt-2 mb-1",children:"Nome da nova categoria"}),e.jsx("input",{type:"text",value:a.category,onChange:t=>x({...a,category:t.target.value}),placeholder:"Ex.: Organograma",className:"w-full px-3 py-2 border border-blue-300 rounded-md bg-blue-50 text-gray-900 text-sm focus:ring-2 focus:ring-blue-500 outline-none",autoFocus:!0})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Data de Referência (Opcional)"}),e.jsx("input",{type:"date",name:"customDate",value:(()=>
1{if(!a.date||!a.date.includes("/"))return"";const[t,s,l]=a.date.split("/");return`${l}-${s.padStart(2,"0")}-${t.padStart(2,"0")}`})(),onChange:t=>{if(!t.target.value){x({...a,date:""});return}const[s,l,r]=t.target.value.split("-");x({...a,date:`${r}/${l}/${s}`})},className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-white text-gray-900 text-sm"}),e.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",children:["Data de exibição: ",e.jsx("span",{className:"font-semibold",children:a.date||"Hoje (automático)"})]})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["Descrição / Observações ",e.jsx("span",{className:"text-gray-400 font-normal",children:"(opcional)"})]}),e.jsx("textarea",{name:"description",value:a.description||"",onChange:v,rows:10,className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-white text-gray-900 text-sm resize-y focus:ring-2 focus:ring-blue-500 outline-none",placeholder:"Descreva o conteúdo deste documento, exercício fiscal, aprovação em assembleia, observações relevantes..."})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 items-end",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Escopo de Publicação"}),e.jsxs("select",{name:"scope",value:a.scope,onChange:t=>{const s=t.target.value;let l=a.category;s==="transparency"&&(l==="Geral"||!l)?l="Prestação de Contas":s==="governance"&&(l==="Geral"||!l)?l="Estatuto Social":s==="global"&&!l&&(l="Geral"),x({...a,scope:s,category:l})},className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-white text-gray-900 text-sm font-bold",children:[e.jsx("option",{value:"global",children:"Portal Geral (Docs Comuns)"}),e.jsx("option",{value:"transparency",children:"Portal da Transparência"}),e.jsx("option",{value:"governance",children:"Canais de Governança"}),e.jsx("option",{value:"competition",children:"Hotsite de Competição"})]})]}),a.scope==="competition"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Selecione a Competição"}),e.jsxs("select",{name:"competitionSlug",value:a.competitionSlug,onChange:v,className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-white text-gray-900 text-sm",required:!0,children:[e.jsx("option",{value:"",children:"Selecione..."}),ne.map(t=>e.jsx("option",{value:t.slug,children:t.name},t.slug))]})]}),te&&e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Classificação / Status (Opcional)"}),e.jsxs("select",{name:"statusPrestacao",value:a.statusPrestacao||"Projeto em execução",onChange:v,className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-white text-gray-900 text-sm font-bold text-blue-700 bg-blue-50 border-blue-200",children:[e.jsx("option",{value:"Projeto em execução",children:"Projeto em execução"}),e.jsx("option",{value:"Prestação de contas em elaboração",children:"Prestação de contas em elaboração"}),e.jsx("option",{value:"Prestação de contas em análise",children:"Prestação de contas em análise"}),e.jsx("option",{value:"Prestação de contas aprovada",children:"Prestação de contas aprovada"})]})]}),e.jsxs("div",{className:te?"hidden":"",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Nome p/ Download"}),e.jsx("input",{type:"text",name:"downloadName",value:a.downloadName||"",onChange:v,className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-white text-gray-900 text-sm",placeholder:"Ex: Balanco_Financeiro_2024.pdf"}),e.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"Legado: Nome exibido no d/l"})]}),e.jsxs("div",{className:"lg:col-span-4",children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Arquivos Anexos (PDF, DOCX, XLSX, etc) - ",e.jsx("span",{className:"text-gray-400 font-normal",children:"Múltiplos permitidos"})]}),j.length>0&&e.jsxs("div",{className:"mb-2 space-y-2",children:[e.jsx("p",{className:"text-xs font-semibold text-gray-500",children:"Arquivos Salvos:"}),j.map((t,s)=>e.jsxs("div",{className:"flex items-center justify-between p-2 border border-gray-200 bg-gray-50 rounded-md",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-700 overflow-hidden",children:[e.jsx(X,{size:16,className:"text-blue-500 flex-shrink-0"}),e.jsx("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"truncate hover:underline",title:t.downloadName||t.url,children:t.downloadName||"Arquivo sem nome"}),t.size&&e.jsxs("span",{className:"text-xs text-gray-400 ml-2",children:["(",t.size,")"]})]}),e.jsx("button",{type:"button",onClick:()=>he(s),className:"text-gray-400 hover:text-red-600 transition-colors p-1",title:"Remover",children:e.jsx(A,{size:16})})]},s))]}),f.length>0&&e.jsxs("div",{className:"mb-2 space-y-2",children:[e.jsx("p",{className:"text-xs font-semibold text-green-600",children:"Novos Arquivos para Upload:"}),f.map((t,s)=>e.jsxs("div",{className:"flex items-center justify-between p-2 border border-green-200 bg-green-50 rounded-md",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-700 overflow-hidden",children:[e.jsx(y,{size:16,className:"text-green-500 flex-shrink-0"}),e.jsx("span",{className:"truncate",title:t.name,children:t.name}),e.jsxs("span",{className:"text-xs text-gray-400 ml-2",children:["(",(t.size/(1024*1024)).toFixed(2)," MB)"]})]}),e.jsx("button",{type:"button",onClick:()=>ge(s),className:"text-gray-400 hover:text-red-600 transition-colors p-1",title:"Remover",children:e.jsx(A,{size:16})})]},s))]}),e.jsx("input",{type:"file",ref:b,onChange:pe,className:"hidden",multiple:!0}),e.jsxs("button",{type:"button",onClick:()=>{var t;return(t=b.current)==null?void 0:t.click()},className:"w-full border-2 border-dashed rounded-md px-3 py-4 text-sm flex flex-col items-center justify-center gap-2 transition-colors border-gray-300 hover:bg-gray-50 text-gray-600 mt-2",children:[e.jsx(G,{size:20,className:"text-gray-400"}),e.jsx("span",{children:"Clique aqui para adicionar novos arquivos"})]})]}),e.jsx("div",{className:"lg:col-span-4 mt-2",children:e.jsxs(le,{type:"submit",fullWidth:!0,disabled:T||f.length===0&&j.length===0,className:`gap-2 ${u?"bg-yellow-600 hover:bg-yellow-700":""}`,children:[T?e.jsx(H,{size:16,className:"animate-spin"}):u?e.jsx(Pe,{size:16}):e.jsx(G,{size:16}),T?"Salvando...":u?"Salvar":"Publicar"]})})]})]})]}),S==="batch"&&e.jsxs("div",{className:"bg-white border border-purple-200 rounded-lg shadow-sm p-6 mb-8",children:[e.jsxs("h2",{className:"text-lg font-bold flex items-center gap-2 mb-4 text-purple-700",children:[e.jsx(re,{size:20})," Upload em Lote"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Escopo (todos os arquivos)"}),e.jsxs("select",{value:Q,onChange:t=>{const s=t.target.value;de(s),k(s==="transparency"?"Prestação de Contas":s==="governance"?"Estatuto Social":"Geral")},className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-white text-gray-900 text-sm font-bold",children:[e.jsx("option",{value:"global",children:"Portal Geral"}),e.jsx("option",{value:"transparency",children:"Portal da Transparência"}),e.jsx("option",{value:"governance",children:"Canais de Governança"}),e.jsx("option",{value:"competition",children:"Hotsite de Competição"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Categoria (todos os arquivos)"}),e.jsxs("select",{value:P,onChange:t=>k(t.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-white text-gray-900 text-sm",children:[e.jsx("option",{value:"Geral",children:"Geral"}),E.map(t=>e.jsx("optgroup",{label:t.label,children:t.categories.map(s=>e.jsx("option",{value:s,children:s},s))},t.label)),e.jsx("option",{value:"custom",children:"+ Digitar Nova Categoria..."})]}),P==="custom"&&e.jsx("input",{type:"text",value:V,onChange:t=>me(t.target.value),placeholder:"Digite o nome da categoria...",className:"w-full mt-2 px-3 py-2 border border-purple-300 rounded-md bg-purple-50 text-gray-900 text-sm focus:ring-2 focus:ring-purple-500 outline-none",autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Data de Referência (todos)"}),e.jsx("input",{type:"date",value:I,onChange:t=>xe(t.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-white text-gray-900 text-sm"})]})]}),e.jsxs("div",{onClick:()=>{var t;return(t=z.current)==null?void 0:t.click()},className:"border-2 border-dashed border-purple-300 rounded-lg p-8 flex flex-col items-center justify-center gap-2 cursor-pointer hover:bg-purple-50 transition-colors mb-4",children:[e.jsx(ke,{size:32,className:"text-purple-400"}),e.jsx("p",{className:"text-sm font-medium text-purple-600",children:"Clique para selecionar múltiplos arquivos"}),e.jsx("p",{className:"text-xs text-gray-400",children:"PDF, DOCX, XLSX — sem limite de quantidade"}),e.jsx("input",{type:"file",ref:z,multiple:!0,onChange:fe,className:"hidden"})]}),d.length>0&&e.jsx("div",{className:"space-y-3 mb-6",children:d.map(t=>e.jsxs("div",{className:`border rounded-lg p-4 transition-colors ${t.status==="done"?"border-green-300 bg-green-50":t.status==="error"?"border-red-300 bg-red-50":t.status==="uploading"?"border-blue-300 bg-blue-50":"border-gray-200 bg-white"}`,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"mt-1 flex-shrink-0",children:[t.status==="done"&&e.jsx(ze,{size:18,className:"text-green-500"}),t.status==="error"&&e.jsx(A,{size:18,className:"text-red-500"}),t.status==="uploading"&&e.jsx(H,{size:18,className:"text-blue-500 animate-spin"}),t.status==="pending"&&e.jsx(y,{size:18,className:"text-gray-400"})]}),e.jsxs("div",{className:"flex-1 grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Título do Documento"}),e.jsx("input",{type:"text",value:t.title,disabled:t.status!=="pending",onCh
1ange:s=>R(t.id,"title",s.target.value),className:"w-full px-2 py-1.5 border border-gray-300 rounded text-sm bg-white disabled:bg-gray-50 disabled:text-gray-400"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Nome p/ Download"}),e.jsx("input",{type:"text",value:t.downloadName,disabled:t.status!=="pending",onChange:s=>R(t.id,"downloadName",s.target.value),className:"w-full px-2 py-1.5 border border-gray-300 rounded text-sm bg-white disabled:bg-gray-50 disabled:text-gray-400",placeholder:t.file.name})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1",children:"Descrição (opcional)"}),e.jsx("textarea",{value:t.description,disabled:t.status!=="pending",onChange:s=>R(t.id,"description",s.target.value),rows:10,className:"w-full px-2 py-1.5 border border-gray-300 rounded text-sm bg-white resize-y disabled:bg-gray-50 disabled:text-gray-400",placeholder:"Observações sobre este documento..."})]})]}),t.status==="pending"&&e.jsx("button",{onClick:()=>je(t.id),className:"flex-shrink-0 text-gray-400 hover:text-red-500 transition-colors mt-1",children:e.jsx(A,{size:18})})]}),t.status==="error"&&e.jsxs("p",{className:"text-xs text-red-600 mt-2 ml-7",children:["Erro: ",t.error]}),t.status==="done"&&e.jsx("p",{className:"text-xs text-green-600 mt-2 ml-7 font-medium",children:"✓ Publicado com sucesso"})]},t.id))}),d.some(t=>t.status!=="pending")&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between text-xs text-gray-500 mb-1",children:[e.jsxs("span",{children:[d.filter(t=>t.status==="done").length," de ",d.length," concluídos"]}),e.jsxs("span",{children:[Y,"%"]})]}),e.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:e.jsx("div",{className:"bg-purple-600 h-2 rounded-full transition-all duration-300",style:{width:`${Y}%`}})})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[d.some(t=>t.status==="done")&&e.jsx("button",{onClick:Ne,className:"px-4 py-2 text-sm text-gray-600 border border-gray-300 rounded-lg hover:bg-gray-50",children:"Limpar concluídos"}),e.jsxs(le,{onClick:ve,disabled:!d.some(t=>t.status==="pending")||d.some(t=>t.status==="uploading"),className:"gap-2 bg-purple-600 hover:bg-purple-700",children:[d.some(t=>t.status==="uploading")?e.jsx(H,{size:16,className:"animate-spin"}):e.jsx(G,{size:16}),"Publicar ",d.filter(t=>t.status==="pending").length>0?`${d.filter(t=>t.status==="pending").length} arquivo(s)`:"Todos"]})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 bg-gray-50/30",children:e.jsxs("div",{className:"relative max-w-md",children:[e.jsx("span",{className:"absolute inset-y-0 left-0 pl-3 flex items-center text-gray-400",children:e.jsx(Fe,{size:18})}),e.jsx("input",{type:"text",placeholder:"Buscar documentos por título...",value:K,onChange:t=>ce(t.target.value),className:"block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg leading-5 bg-white placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Documento"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Localização"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Data"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase",children:"Ações"})]})}),e.jsxs("tbody",{className:"bg-white divide-y divide-gray-200",children:[W.filter(t=>t.status!=="archived").filter(t=>(t.title||"").toLowerCase().includes(K.toLowerCase())).sort((t,s)=>{const l=r=>{if(!r)return 0;const m=r.split("/");if(m.length===3){const[o,c,i]=m;return new Date(`${i}-${c}-${o}`).getTime()}return new Date(r).getTime()||0};return l(s.date)-l(t.date)}).map(t=>e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsxs("td",{className:"px-6 py-4",children:[e.jsxs("div",{className:"flex items-start mb-2",children:[e.jsx(y,{className:"text-blue-500 mr-3 flex-shrink-0",size:20}),e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"text-sm font-bold text-gray-800",children:t.title}),t.downloadName&&e.jsx("span",{className:"text-[10px] text-gray-400 font-medium block mt-0.5",children:t.downloadName}),t.statusPrestacao&&e.jsx("div",{className:"text-xs font-semibold text-blue-600 my-0.5",children:t.statusPrestacao}),t.description&&e.jsx("div",{className:"text-xs text-gray-400 mt-1 max-w-md line-clamp-[10] whitespace-pre-wrap",children:t.description})]})]}),e.jsx("div",{className:"pl-8 space-y-1",children:t.files&&t.files.length>0?t.files.map((s,l)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(X,{size:14,className:"text-gray-400"}),e.jsx("a",{href:s.url,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline truncate max-w-[200px]",title:s.downloadName||s.url,children:s.downloadName||"Arquivo sem nome"}),e.jsxs("span",{className:"text-gray-400 ml-1",children:["(",s.type," • ",s.size,")"]})]},l)):t.url?e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(X,{size:14,className:"text-gray-400"}),e.jsx("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline truncate max-w-[200px]",title:t.downloadName||t.url,children:t.downloadName||"Arquivo de legado"}),e.jsxs("span",{className:"text-gray-400 ml-1",children:["(",t.type," • ",t.size,")"]})]}):null})]}),e.jsx("td",{className:"px-6 py-4 text-sm text-gray-500",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-bold text-gray-700 text-xs uppercase",children:t.scope==="global"?"Portal Geral"
1:t.scope==="transparency"?"Transparência":t.scope==="governance"?"Governança":"Hotsite"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:t.scope==="competition"?t.competitionSlug:t.category})]})}),e.jsx("td",{className:"px-6 py-4 text-sm text-gray-500",children:t.date||"-"}),e.jsxs("td",{className:"px-6 py-4 text-right flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{const s=t.files&&t.files.length>0?t.files[0].url:t.url;s?(navigator.clipboard.writeText(s),D.success("Link copiado para a área de transferência!")):D.error("Nenhum link disponível para copiar.")},className:"text-gray-500 hover:text-gray-800 p-1",title:"Copiar Link do 1º Arquivo",children:e.jsx($e,{size:18})}),e.jsx("button",{onClick:()=>be(t),className:"text-yellow-600 hover:text-yellow-800 p-1",title:"Editar",children:e.jsx(y,{size:18})}),e.jsx("button",{onClick:()=>ue(t.id),className:"text-red-600 hover:text-red-900 p-1",title:"Excluir",children:e.jsx(Ee,{size:18})})]})]},t.id)),W.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"p-8 text-center text-gray-500 italic",children:"Nenhum documento publicado."})})]})]})})]})]})};export{qe 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.