1/*! For license information please see 3232.bb869319.chunk.js.LICENSE.txt */ 2"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[3232],{737:(e,t,a)=>{a.d(t,{A:()=>s});const s=(0,a(77784).A)("cloud-upload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]])},9463:(e,t,a)=>{a.d(t,{A:()=>s});const s=(0,a(77784).A)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},9855:(e,t,a)=>{a.d(t,{A:()=>s});const s=(0,a(77784).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},13232:(e,t,a)=>{a.r(t),a.d(t,{default:()=>N});var s=a(89379),r=a(65043),l=a(33005),n=a(50516),d=a(41680),i=a(737),c=a(39292),o=a(82054);const x=(0,a(77784).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);var m=a(9855),p=a(9463),h=a(38326),u=a(95242),y=a(40614),g=a(78012),b=a(23768),j=a(22768),f=a(70579);const v=10;function N(){const[e,t]=(0,r.useState)([]),[a,N]=(0,r.useState)(!0),[A,k]=(0,r.useState)(!1),[w,C]=(0,r.useState)(""),[M,z]=(0,r.useState)(""),[S,E]=(0,r.useState)(null),[T,q]=(0,r.useState)(null),[L,O]=(0,r.useState)(""),[_,J]=(0,r.useState)(1),H=async()=>{N(!0);try{const e=await(0,j.getPublicOntologyTerms)();t(e.data)}catch(e){console.error("Erro ao buscar termos",e),b.Ay.error("Erro ao sincronizar os termos.")}finally{N(!1)}};(0,r.useEffect)(()=>{H()},[]);const D=e.filter(e=>e.name.toLowerCase().includes(L.toLowerCase())||e.legal_reference.toLowerCase().includes(L.toLowerCase())),V=Math.ceil(D.length/v),I=D.slice((_-1)*v,_*v),P=e=>{e>=1&&e<=V&&J(e)};return(0,f.jsxs)("div",{className:"p-4 md:p-6 space-y-6 relative",children:[(0,f.jsxs)("div",{className:"flex items-center justify-between border-b pb-4",children:[(0,f.jsxs)("h1",{className:"text-2xl font-bold text-gray-800 flex items-center gap-2",children:[(0,f.jsx)(l.A,{className:"text-sky-600"})," Motor GEO (Inje\xe7\xe3o Direta)"]}),(0,f.jsxs)("div",{className:"flex gap-2",children:[(0,f.jsxs)("button",{onClick:H,className:"btn-secondary flex items-center gap-2",children:[(0,f.jsx)(n.A,{size:16})," Atualizar"]}),(0,f.jsxs)("button",{onClick:async()=>{try{await(0,j.generateOntologySitemap)(),b.Ay.success("Sitemap sendo gerado em background! Atualize a p\xe1gina do XML em alguns segundos.")}catch(e){b.Ay.error("Erro ao gerar sitemap est\xe1tico.")}},className:"btn-secondary flex items-center gap-2 bg-purple-50 text-purple-700 hover:bg-purple-100 border-purple-200 font-medium",children:[(0,f.jsx)(d.A,{size:16})," Gerar Sitemap XML"]})]})]}),(0,f.jsxs)("div",{className:"bg-white p-5 rounded-lg shadow-sm border-t-4 border-green-600",children:[(0,f.jsxs)("h2",{className:"text-lg font-semibold mb-2 flex items-center gap-2",children:[(0,f.jsx)(i.A,{size:20})," Publica\xe7\xe3o R\xe1pida"]}),(0,f.jsx)("p",{className:"text-sm text-gray-500 mb-4",children:"Cole o JSON gerado pela IA. O sistema cuidar\xe1 da convers\xe3o em .jsonld est\xe1tico."}),(0,f.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),k(!0);try{const e=JSON.parse(M.trim()),t={terms:e.terms||[],relations:e.relations||[],legal_reference:w};await(0,j.publishOntologyDirect)(t),b.Ay.success("Sucesso! Entidades injetadas no Knowledge Graph."),C(""),z(""),H()}catch(t){t instanceof SyntaxError?b.Ay.error("Erro de formata\xe7\xe3o no JSON. Verifique se copiou corretamente."):b.Ay.error("Erro ao publicar no servidor.")}finally{k(!1)}},className:"space-y-4",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-sm font-bold text-gray-700",children:"Refer\xeancia Legal"}),(0,f.jsx)("input",{value:w,onChange:e=>C(e.target.value),required:!0,className:"input mt-1",placeholder:"Ex: STJ RHC 200979"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-sm font-bold text-gray-700",children:"Output JSON"}),(0,f.jsx)("textarea",{value:M,onChange:e=>z(e.target.value),required:!0,rows:"4",className:"input mt-1 font-mono text-xs bg-gray-50",placeholder:'{"terms": [...], "relations": [...]}'})]}),(0,f.jsx)("div",{className:"flex justify-end",children:(0,f.jsx)("button",{type:"submit",disabled:A,className:"btn-primary bg-green-600 hover:bg-green-700 py-1.5 px-4 text-sm",children:A?"Injetando...":"Salvar e Publicar"})})]})]}),(0,f.jsxs)("div",{className:"bg-white p-4 rounded-lg shadow-sm border border-gray-200 flex items-center",children:[(0,f.jsx)(c.A,{className:"text-gray-400 mr-3"}),(0,f.jsx)("input",{type:"text",placeholder:"Pesquisar na base por termo ou refer\xeancia...",className:"w-full outline-none text-gray-700 bg-transparent",value:L,onChange:e=>{O(e.target.value),J(1)}})]}),(0,f.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden",children:[(0,f.jsxs)("div",{className:"px-4 py-3 border-b bg-gray-50 flex items-center gap-2",children:[(0,f.jsx)(o.A,{className:"text-green-600",size:18}),(0,f.jsx)("h3",{className:"font-bold text-gray-700 text-sm",children:"Termos Ativos no Conhecimento da IA"})]}),(0,f.jsx)("div",{className:"overflow-x-auto",children:(0,f.jsxs)("table",{className:"min-w-full divide-y divide-gray-200",children:[(0,f.jsx)("thead",{className:"bg-white",children:(0,f.jsxs)("tr",{children:[(0,f.jsx)("th",{className:"px-4 py-2 text-left text-xs font-bold text-gray-500 uppercase",children:"Termo"}),(0,f.jsx)("th",{className:"px-4 py-2 text-left text-xs font-bold text-gray-500 uppercase",children:"Tipo"}),(0,f.jsx)("th",{className:"px-4 py-2 text-left text-xs font-bold text-gray-500 uppercase",children:"Fundamenta\xe7\xe3o"}),(0,f.jsx)("th",{className:"px-4 py-2 text-right text-xs font-bold text-gray-500 uppercase w-24",children:"A\xe7\xe3o"})]})}),(0,f.jsxs)("tbody",{className:"bg-white divide-y divide-gray-100",children:[a?(0,f.jsx)("tr",{children:(0,f.jsx)("td",{colSpan:"4",className:"text-center py-4 text-sm",children:"Carregando..."})}):I.map(e=>(0,f.jsxs)("tr",{className:"hover:bg-gray-50 transition-colors",children:[(0,f.jsx)("td",{className:"px-4 py-2 text-sm font-bold text-sky-700 align-middle",children:e.name}),(0,f.jsx)("td",{className:"px-4 py-2 whitespace-nowrap text-xs text-gray-500 align-middle",children:(0,f.jsx)("span",{className:"bg-gray-100 px-2 py-0.5 rounded font-medium",children:e.entity_type})}),(0,f.jsx)("td",{className:"px-4 py-2 text-xs text-gray-500 align-middle",children:(0,f.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,f.jsx)(d.A,{size:12}),(0,f.jsx)("span",{className:"truncate max-w-[200px]",title:e.legal_reference,children:e.legal_reference}),e.court&&(0,f.jsx)("span",{className:"ml-1 bg-purple-100 text-purple-700 px-1.5 py-0.5 rounded text-[10px] font-bold",title:"Possui Grafo Jurisprudencial",children:e.court})]})}),(0,f.jsx)("td",{className:"px-4 py-2 whitespace-nowrap text-right al
2ign-middle",children:(0,f.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,f.jsx)("button",{onClick:()=>E(e),className:"text-sky-600 hover:bg-sky-50 p-1.5 rounded transition-colors",title:"Editar",children:(0,f.jsx)(x,{size:16})}),(0,f.jsx)("button",{onClick:()=>q(e),className:"text-red-500 hover:bg-red-50 p-1.5 rounded transition-colors",title:"Excluir",children:(0,f.jsx)(m.A,{size:16})})]})})]},e.id)),0===I.length&&!a&&(0,f.jsx)("tr",{children:(0,f.jsx)("td",{colSpan:"4",className:"text-center py-6 text-gray-500 text-sm",children:"Nenhum resultado encontrado."})})]})]})}),V>1&&(0,f.jsx)("div",{className:"bg-gray-50 px-4 py-3 border-t border-gray-200 flex items-center justify-between sm:px-6",children:(0,f.jsxs)("div",{className:"hidden sm:flex-1 sm:flex sm:items-center sm:justify-between",children:[(0,f.jsx)("div",{children:(0,f.jsxs)("p",{className:"text-sm text-gray-700",children:["Mostrando ",(0,f.jsx)("span",{className:"font-medium",children:(_-1)*v+1})," a ",(0,f.jsx)("span",{className:"font-medium",children:Math.min(_*v,D.length)})," de ",(0,f.jsx)("span",{className:"font-medium",children:D.length})," termos"]})}),(0,f.jsx)("div",{children:(0,f.jsxs)("nav",{className:"relative z-0 inline-flex rounded-md shadow-sm -space-x-px","aria-label":"Pagination",children:[(0,f.jsx)("button",{onClick:()=>P(_-1),disabled:1===_,className:"relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:opacity-50",children:(0,f.jsx)(p.A,{size:16})}),(()=>{const e=[];let t=Math.max(1,_-2),a=Math.min(V,t+5-1);a-t+1<5&&(t=Math.max(1,a-5+1));for(let s=t;s<=a;s++)e.push((0,f.jsx)("button",{onClick:()=>P(s),className:"px-3 py-1 text-sm rounded mx-1 ".concat(s===_?"bg-sky-600 text-white font-bold":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:s},s));return e})(),(0,f.jsx)("button",{onClick:()=>P(_+1),disabled:_===V,className:"relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:opacity-50",children:(0,f.jsx)(h.A,{size:16})})]})})]})})]}),T&&(0,f.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4 backdrop-blur-sm",children:(0,f.jsxs)("div",{className:"bg-white rounded-lg shadow-2xl w-full max-w-sm overflow-hidden animate-fade-in-down",children:[(0,f.jsxs)("div",{className:"px-6 py-5 flex flex-col items-center text-center",children:[(0,f.jsx)("div",{className:"w-12 h-12 rounded-full bg-red-100 flex items-center justify-center mb-4",children:(0,f.jsx)(u.A,{className:"text-red-600",size:24})}),(0,f.jsx)("h3",{className:"font-bold text-lg text-gray-900 mb-2",children:"Confirmar Exclus\xe3o"}),(0,f.jsxs)("p",{className:"text-sm text-gray-500 mb-1",children:["Tem certeza que deseja excluir a entidade ",(0,f.jsxs)("strong",{children:['"',T.name,'"']}),"?"]}),(0,f.jsx)("p",{className:"text-xs text-red-500 font-medium",children:"Esta a\xe7\xe3o apagar\xe1 o arquivo .jsonld da IA permanentemente."})]}),(0,f.jsxs)("div",{className:"bg-gray-50 px-6 py-4 flex items-center justify-end gap-3 border-t",children:[(0,f.jsx)("button",{type:"button",onClick:()=>q(null),className:"btn-secondary text-sm py-2",children:"Cancelar"}),(0,f.jsx)("button",{type:"button",onClick:async()=>{if(T)try{await(0,j.deleteOntologyTerm)(T.id),b.Ay.success("Termo removido com sucesso."),q(null),H()}catch(e){b.Ay.error("Erro ao excluir termo.")}},className:"btn-primary bg-red-600 hover:bg-red-700 border-transparent text-sm py-2",children:"Excluir Entidade"})]})]})}),S&&(0,f.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4 backdrop-blur-sm",children:(0,f.jsxs)("div",{className:"bg-white rounded-lg shadow-2xl w-full max-w-2xl overflow-hidden max-h-[90vh] flex flex-col",children:[(0,f.jsxs)("div",{className:"px-6 py-4 border-b flex justify-between items-center bg-gray-50",children:[(0,f.jsx)("h3",{className:"font-bold text-lg text-gray-800",children:"Editar Entidade"}),(0,f.jsx)("button",{onClick:()=>E(null),className:"text-gray-400 hover:text-gray-800 transition-colors",children:(0,f.jsx)(y.A,{size:20})})]}),(0,f.jsx)("div",{className:"overflow-y-auto p-6",children:(0,f.jsxs)("form",{id:"edit-term-form",onSubmit:async e=>{e.preventDefault();try{await(0,j.updateOntologyTerm)(S.id,S),b.Ay.success("Termo atualizado com sucesso!"),E(null),H()}catch(t){b.Ay.error("Erro ao atualizar termo.")}},className:"space-y-4",children:[(0,f.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-sm font-bold text-gray-700",children:"Nome do Termo"}),(0,f.jsx)("input",{value:S.name||"",onChange:e=>E((0,s.A)((0,s.A)({},S),{},{name:e.target.value})),className:"input mt-1",required:!0})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-sm font-bold text-gray-700",children:"Tipo de Entidade"}),(0,f.jsx)("input",{value:S.entity_type||"",onChange:e=>E((0,s.A)((0,s.A)({},S),{},{entity_type:e.target.value})),className:"input mt-1",required:!0})]})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-sm font-bold text-gray-700",children:"Defini\xe7\xe3o T\xe9cnica"}),(0,f.jsx)("textarea",{value:S.definition||"",onChange:e=>E((0,s.A)((0,s.A)({},S),{},{definition:e.target.value})),rows:"4",className:"input mt-1 text-sm",required:!0})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-sm font-bold text-gray-700",children:"Fundamenta\xe7\xe3o Legal B\xe1sica"}),(0,f.jsx)("input",{value:S.legal_reference||"",onChange:e=>E((0,s.A)((0,s.A)({},S),{},{legal_reference:e.target.value})),className:"input mt-1 text-sm",required:!0})]}),(0,f.jsxs)("div",{className:"pt-4 mt-6 border-t border-gray-200",children:[(0,f.jsxs)("h4",{className:"text-sm font-bold text-purple-800 mb-3 flex items-center gap-2",children:[(0,f.jsx)(g.A,{size:16})," Grafo Jurisprudencial (Opcional)"]}),(0,f.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-700",children:"Tribunal (Ex: STJ, STF)"}),(0,f.jsx)("input",{value:S.court||"",onChange:e=>E((0,s.A)((0,s.A)({},S),{},{court:e.target.value})),className:"input mt-1 bg-purple-50",placeholder:"Deixe em branco se n\xe3o houver"})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-700",children:"Data do Julgado"}),(0,f.jsx)("input",{type:"date",value:S.judgment_date||"",onChange:e=>E((0,s.A)((0,s.A)({},S),{},{judgment_date:e.target.value})),className:"input mt-1 bg-purple-50"})]})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("label",{className:"block text-xs font-bold text-gray-700",children:"URL do Inteiro Teor"}),(0,f.jsx)("input",{type:"url",value:S.judgment_url||"",onChange:e=>E((0,s.A)((0,s.A)({},S),{},{judgment_url:e.target.value})),className:"input mt-1 text-sm bg-purple-50",placeholder:"https://processo.stj.jus.br/..."})]})]})]})}),(0,f.jsxs)("div",{className:"px-6 py-4 border-t bg-gray-50 flex justify-end gap-3 shrink-0",children:[(0,f.jsx)("button",{type:"button",onClick:()=>E(null),className:"btn-secondary py-1.5 text-sm",children:"Cancelar"}),(0,f.jsx)("button",{type:"submit",form:"edit-term-form",className:"btn-primary py-1.5 text-sm",children:"Salvar e Atualizar"})]})]})})]})}},33005:(e,t,a)=>{a.d(t,{A:()=>s});const s=(0,a(77784).A)("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},39292:(e,t,a)=>{a.d(t,{A:()=>s});const s=(0,a(77784).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},40614:(e,t,a)=>{a.d(t,{A:()=>s});const s=(0,a(77784).A)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}
2],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},41680:(e,t,a)=>{a.d(t,{A:()=>s});const s=(0,a(77784).A)("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},50516:(e,t,a)=>{a.d(t,{A:()=>s});const s=(0,a(77784).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},82054:(e,t,a)=>{a.d(t,{A:()=>s});const s=(0,a(77784).A)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},95242:(e,t,a)=>{a.d(t,{A:()=>s});const s=(0,a(77784).A)("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]])}}]); 3//# sourceMappingURL=3232.bb869319.chunk.js.map
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.