1import{r as y,j as e}from"./vendor-three-BGGFfWe7.js";import{aS as N,bO as D,a9 as w,cb as W,b4 as Y,b1 as q,cS as X,ap as J,dR as Z,bL as z,dS as K,dT as Q,o as ee,a as re,a_ as se,dU as ae,aa as ne,ab as oe,dV as te,dW as ie,dX as le,ak as V,bK as ce,af as I,ag as E,ah as $,ai as L,aj as j,ae as O,G as M,bf as de,av as me,e as xe,x as be,dY as ue,bd as ge,P as pe,Y as ve,_ as B}from"./index-zO3nSPIa.js";import{M as he}from"./ModuleMaintenanceMenu-DvPNyEFR.js";import{M as fe}from"./ModuleOverflowMenu-DhU6xnTp.js";import{I as je}from"./IconAction-CtDSjV4y.js";import{M as Ne}from"./ModulePrimaryAction-BzuwY5Qn.js";import{C as k,G as ye}from"./GovBrFileDropzone-Ds6UK-Gw.js";import{M as we}from"./Module360Links-B6HWa-Yl.js";import Ce from"./EntityDrivePanel-CE_Yiudf.js";import{c as U}from"./index-A7ElDbZk.js";import"./ModuleHealthIndicator-EOEiSLvQ.js";import"./wrench-yB4fLxQH.js";import"./arrow-up-right-CKrhNrVj.js";function _e({metrics:s={},loading:r=!1,error:n=!1,canDiagnostics:c=!1,filter:i,setFilter:l,onRefresh:m,onNew:x,hideIdentity:b=!1}){const u=(n?1:0)+Number(s.urgentes||0)+Number(s.review||0),p=n?"error":u>0?"attention":r?"unknown":"healthy",d=y.useMemo(()=>[n?"A fila de pendências não pôde ser carregada.":null,s.urgentes>0?`${s.urgentes} pendência(s) urgente(s).`:null,s.review>0?`${s.review} resposta(s) aguardam conferência humana.`:null,!n&&!s.urgentes&&!s.review?"Nenhuma ocorrência operacional detectada.":null].filter(Boolean),[n,s.urgentes,s.review]),v=y.useMemo(()=>["# Diagnóstico de Pendências","",`Total: ${s.total||0}`,`Abertas: ${s.abertas||0}`,`ConcluÃdas: ${s.concluidas||0}`,`Urgentes: ${s.urgentes||0}`,`Aguardando conferência: ${s.review||0}`,"","## Resumo",...d.map(t=>`- ${t}`)].join(` 2`),[s,d]),h=[{icon:N,label:"Abertas",value:s.abertas||0,active:i==="abertas",onClick:()=>l(i==="abertas"?"todas":"abertas")},{icon:k,label:"Em conferência",value:s.review||0,active:i==="revisao",onClick:()=>l(i==="revisao"?"todas":"revisao")},{icon:D,label:"Urgentes",value:s.urgentes||0,active:i==="urgentes",onClick:()=>l(i==="urgentes"?"todas":"urgentes")},{icon:w,label:"ConcluÃdas",value:s.concluidas||0,active:i==="concluidas",onClick:()=>l(i==="concluidas"?"todas":"concluidas")}],a=u>0?{type:"warning",title:`${u} ocorrência(s)`,message:d.join(" · ")}:null;return e.jsxs(e.Fragment,{children:[e.jsx("header",{className:"hm-module-header govbr-surface",style:{background:"hsl(var(--govbr-surface))",borderRadius:"var(--govbr-radius-lg)"},children:e.jsxs("div",{className:"hm-module-header__row",children:[!b&&e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("h1",{className:"hm-module-header__title flex items-center gap-2 font-display text-govbr-on-surface",children:[e.jsx(W,{className:"h-5 w-5 shrink-0 text-govbr-primary"}),"Pendências"]}),e.jsx("p",{className:"hm-module-header__description mt-0.5 text-xs text-govbr-on-surface/60",children:"Solicitações e entregas dos clientes"})]}),e.jsxs("div",{className:"hm-module-header__actions",children:[e.jsx(he,{moduleName:"Pendências",status:p,count:u,summary:d,report:v,filename:"diagnostico-pendencias.md",canInspect:c}),e.jsx(je,{icon:Y,label:"Atualizar",onClick:m,disabled:r}),e.jsx(fe,{label:"Mais opções",items:[{id:"review",label:"Em conferência",icon:k,onSelect:()=>l("revisao")},{id:"urgent",label:"Urgentes",icon:D,onSelect:()=>l("urgentes")},{id:"completed",label:"ConcluÃdas",icon:w,onSelect:()=>l("concluidas")}]}),e.jsx(Ne,{label:"Nova pendência",onClick:x})]})]})}),e.jsx("div",{className:"hm-standard-shell__metrics",children:e.jsx("div",{className:"hm-metric-grid","data-cols":"4",children:h.map((t,g)=>{const f=t.icon;return e.jsxs("button",{type:"button",onClick:t.onClick,className:`govbr-stat text-left transition govbr-focus ${t.active?"ring-2 ring-govbr-primary/40":"hover:border-govbr-primary/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{className:"h-4 w-4 shrink-0 text-govbr-on-surface/50"}),e.jsx("span",{className:"govbr-stat__label",children:t.label})]}),e.jsx("span",{className:"govbr-stat__value",children:t.value})]},g)})})}),a&&e.jsx("div",{className:"hm-standard-shell__banner",children:e.jsxs("div",{className:"flex items-start gap-2.5 rounded-govbr-md border border-govbr
2-warning/30 bg-govbr-warning-container p-govbr-sm text-sm text-govbr-warning-foreground",children:[e.jsx(D,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-semibold",children:a.title}),e.jsx("p",{className:"mt-0.5 text-xs opacity-80",children:a.message})]})]})})]})}function G(s){var n;const r=s.bilateral;return(r==null?void 0:r.responsibility)==="office"&&((n=r==null?void 0:r.operational)!=null&&n.office_escalation)?1:(r==null?void 0:r.responsibility)==="office"?2:(r==null?void 0:r.responsibility)==="client"?3:9}const ke={document:z,information:Z,form:N,acceptance:w,consent:J,signature:X,action:q,profile:N,other:N};function Pe({item:s}){var n;const r=s.bilateral;return(r==null?void 0:r.responsibility)==="office"&&((n=r==null?void 0:r.operational)!=null&&n.office_escalation)?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-govbr-error-container px-2 py-0.5 text-[10px] font-semibold text-govbr-error",children:[e.jsx(q,{className:"h-3 w-3"})," Escalada"]}):(r==null?void 0:r.responsibility)==="office"?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-govbr-warning-container px-2 py-0.5 text-[10px] font-semibold text-govbr-warning-foreground",children:[e.jsx(k,{className:"h-3 w-3"})," Escritório"]}):(r==null?void 0:r.responsibility)==="client"?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-govbr-surface-muted px-2 py-0.5 text-[10px] font-medium text-govbr-on-surface/60",children:[e.jsx(ee,{className:"h-3 w-3"})," Cliente"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-govbr-success-container px-2 py-0.5 text-[10px] font-medium text-govbr-success",children:[e.jsx(w,{className:"h-3 w-3"})," ConcluÃda"]})}function Ae({item:s,onOpen:r}){var m,x,b;const n=((m=s.bilateral)==null?void 0:m.responsibility)==="none",c=ke[String(s.kind||"").toLowerCase()]||N,l=!!((b=(x=s.bilateral)==null?void 0:x.operational)!=null&&b.overdue)&&!n?"text-govbr-error":"text-govbr-on-surface/55";return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>r(s),className:"govbr-focus flex w-full items-center gap-3 border-b border-govbr-outline/20 px-3 py-3 text-left transition hover:bg-govbr-surface-muted sm:px-4",children:[e.jsx("div",{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-govbr-md ${n?"bg-govbr-success-container text-govbr-success":"bg-govbr-surface-muted text-govbr-primary"}`,children:e.jsx(c,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:`truncate text-sm font-semibold ${n?"text-govbr-on-surface/50 line-through":"text-govbr-on-surface"}`,children:s.title||"Pendência"}),e.jsxs("p",{className:"mt-0.5 truncate text-[11px] text-govbr-on-surface/55",children:[s.client_name||"â"," · ",K(s.kind)]})]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[e.jsx(Pe,{item:s}),s.due_at&&e.jsx("span",{className:`text-[10px] ${l}`,children:Q(s.due_at)})]})]})})}function Se({items:s=[],onOpen:r,emptyLabel:n="Nenhuma pendência exige ação agora."}){const c=y.useMemo(()=>[...s].sort((i,l)=>G(i)-G(l)),[s]);return c.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 rounded-govbr-md border border-dashed border-govbr-outline/40 bg-govbr-surface px-6 py-12 text-center",children:[e.jsx(w,{className:"h-7 w-7 text-govbr-success"}),e.jsx("p",{className:"text-sm font-medium text-govbr-on-surface",children:"Tudo em dia"}),e.jsx("p",{className:"text-xs text-govbr-on-surface/55",children:n})]}):e.jsx("ul",{className:"overflow-hidden rounded-govbr-md border border-govbr-outline/30 bg-govbr-surface",children:c.map(i=>e.jsx(Ae,{item:i,onOpen:r},i.id))})}function De({vm:s}){var R,T;re();const{selected:r,eventsQuery:n,responseDocumentsQuery:c,attachmentDocumentsQuery:i,responseDocumentIds:l,responseDocuments:m,attachmentDocumentIds:x,attachmentDocuments:b,currentResponseIds:u,availableActions:p,transitionMutation:d,transitionError:v,responseEvidenceBlocked:h,documentDownloadBusy:a,documentDownloadError:t,runTransition:g,downloadResponseDocument:f,openLinkedResource:C,editPending:P,deletePending:_}=s;if(!r)return null;const A=[r.client_id?{kind:"client",label:"Cliente",href:`${U("Clientes")}?resourceType=Client&resourceId=${encodeURIComponent(r.client_id)}`}:null,r.case_id?{kind:"case",label:"Caso",href:`${U("Casos")}?resourceType=Case&resourceId=${encodeURIComponent(r.case_id)}`}:null,r.process_id?{kind:"process",label:"Processo",href:se({id:r.process_id,process_number:r.process_number||r.processo_numero})}
2:null].filter(Boolean),H=new Set(["request_changes","approve","complete"]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(we,{links:A,label:"Relacionamentos desta pendência"}),e.jsxs("section",{className:"govbr-surface p-govbr-md",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"govbr-stat__label",children:"Pendência do cliente"}),e.jsx("h2",{className:"mt-1 text-lg font-semibold text-govbr-on-surface",children:r.title||"Pendência"})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx("span",{className:"govbr-primary-badge",children:ae(r.status)}),e.jsx("button",{type:"button",onClick:()=>P({title:window.prompt("Novo tÃtulo:",r.title||"")}),disabled:d.isPending,className:"govbr-focus inline-flex h-8 w-8 items-center justify-center rounded-govbr-sm border border-govbr-outline/40 text-govbr-on-surface/60 hover:bg-govbr-surface-muted hover:text-govbr-primary","aria-label":"Editar pendência",children:e.jsx(ne,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:_,disabled:d.isPending,className:"govbr-focus inline-flex h-8 w-8 items-center justify-center rounded-govbr-sm border border-govbr-error/30 text-govbr-error hover:bg-govbr-error-container","aria-label":"Excluir pendência",children:e.jsx(oe,{className:"h-3.5 w-3.5"})})]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"govbr-stat__label",children:"Tipo"}),e.jsx("p",{className:"mt-1 text-sm text-govbr-on-surface",children:K(r.category||r.kind)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"govbr-stat__label",children:"Prioridade"}),e.jsx("p",{className:"mt-1 text-sm text-govbr-on-surface",children:te(r.priority)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"govbr-stat__label",children:"Prazo"}),e.jsx("p",{className:"mt-1 text-sm text-govbr-on-surface",children:Q(r.due_date||r.due_at)})]})]}),r.description&&e.jsxs("div",{className:"mt-4 border-t border-govbr-outline/30 pt-4",children:[e.jsx("p",{className:"govbr-stat__label",children:"Instruções"}),e.jsx("p",{className:"mt-2 whitespace-pre-wrap text-sm leading-6 text-govbr-on-surface/70",children:r.description})]})]}),e.jsxs("section",{className:"govbr-surface p-govbr-md",children:[e.jsx("p",{className:"govbr-stat__label",children:"Documentos da solicitação"}),x.length===0?e.jsx("p",{className:"mt-3 text-xs text-govbr-on-surface/50",children:"Nenhum documento anexado."}):e.jsxs("div",{className:"mt-3 space-y-2",children:[i.isError&&e.jsx("p",{className:"rounded-govbr-md border border-govbr-warning/30 bg-govbr-warning-container p-govbr-sm text-xs text-govbr-warning-foreground",children:"Os metadados não puderam ser carregados. Os IDs canônicos continuam disponÃveis."}),b.map(o=>e.jsxs("div",{className:"flex flex-col gap-2 rounded-govbr-md border border-govbr-outline/30 bg-govbr-surface-muted p-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-xs font-medium text-govbr-on-surface",children:o.title||o.id}),e.jsx("p",{className:"mt-1 text-[10px] text-govbr-on-surface/50",children:i.isLoading?"Carregandoâ¦":o.mime_type||o.mimeType||"Documento"})]}),e.jsx("button",{type:"button",onClick:()=>C("Document",o.id,r.process_id||null),className:"govbr-focus rounded-govbr-sm border border-govbr-primary/40 bg-govbr-primary-container px-3 py-2 text-[10px] font-medium text-govbr-primary",children:"Abrir no Repositório"})]},o.id))]})]}),e.jsx(Ce,{entityType:"pendência",entityId:r==null?void 0:r.id,searchQuery:r==null?void 0:r.title,folderName:r!=null&&r.title?`Pendência â ${r.title}`:void 0,clientEmail:r==null?void 0:r.client_email}),e.jsxs("section",{className:"govbr-surface p-govbr-md",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"govbr-stat__label",children:"Histórico"}),e.jsx("p",{className:"mt-1 text-xs text-govbr-on-surface/50",children:"Acontecimentos registrados para esta solicitação."})]}),n.isError&&e.jsx("button",{type:"button",onClick:()=>n.refetch(),className:"govbr-focus rounded-govbr-sm border border-govbr
2-outline/40 px-3 py-1.5 text-[10px] text-govbr-on-surface/70",children:"Tentar novamente"})]}),n.isLoading?e.jsx("p",{className:"mt-3 text-xs text-govbr-on-surface/50",children:"Carregando históricoâ¦"}):n.isError?e.jsx("p",{className:"mt-3 rounded-govbr-md border border-govbr-warning/30 bg-govbr-warning-container p-3 text-xs text-govbr-warning-foreground",children:"O histórico está temporariamente indisponÃvel."}):(((R=n.data)==null?void 0:R.items)||[]).length===0?e.jsx("p",{className:"mt-3 text-xs text-govbr-on-surface/50",children:"Ainda não há acontecimentos registrados."}):e.jsx("ol",{className:"mt-4 space-y-3",children:(((T=n.data)==null?void 0:T.items)||[]).map(o=>e.jsxs("li",{className:"relative border-l-2 border-govbr-primary/30 pl-4",children:[e.jsx("span",{className:"absolute -left-[5px] top-1.5 h-2 w-2 rounded-full bg-govbr-primary"}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs font-semibold text-govbr-on-surface",children:ie(o.event_type)}),e.jsx("time",{className:"text-[10px] text-govbr-on-surface/50",children:le(o.occurred_at)})]}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-govbr-on-surface/60",children:o.summary||"Evento registrado"})]},o.id))})]}),e.jsxs("section",{className:"govbr-surface p-govbr-md",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"govbr-stat__label",children:"Resposta do cliente"}),e.jsx("p",{className:"mt-1 text-xs text-govbr-on-surface/50",children:"Confira a versão enviada antes de decidir. Ao iniciar a conferência, os documentos canônicos entram no dossiê/Malote e na inteligência documental automaticamente â sem nova inclusão manual."})]}),e.jsxs("span",{className:"govbr-primary-badge",children:["Revisão ",Number(r.response_revision||0)]})]}),r.response_text?e.jsx("div",{className:"mt-3 rounded-govbr-md bg-govbr-surface-muted p-3",children:e.jsx("p",{className:"whitespace-pre-wrap text-sm leading-6 text-govbr-on-surface",children:r.response_text})}):e.jsx("p",{className:"mt-3 text-xs text-govbr-on-surface/50",children:"Nenhuma resposta textual nesta revisão."}),r.correction_reason&&e.jsxs("div",{className:"mt-3 rounded-govbr-md border border-govbr-warning/30 bg-govbr-warning-container p-3",children:[e.jsx("p",{className:"govbr-stat__label text-govbr-warning-foreground",children:"Correção solicitada"}),e.jsx("p",{className:"mt-1 whitespace-pre-wrap text-xs leading-5 text-govbr-warning-foreground",children:r.correction_reason})]}),e.jsxs("div",{className:"mt-3",children:[e.jsx("p",{className:"govbr-stat__label",children:"Documentos enviados"}),l.length===0?e.jsx("p",{className:"mt-2 text-xs text-govbr-on-surface/50",children:"Nenhum documento enviado."}):c.isLoading?e.jsx("p",{className:"mt-2 text-xs text-govbr-on-surface/50",children:"Carregando documentosâ¦"}):c.isError?e.jsx("div",{className:"mt-2 rounded-govbr-md border border-govbr-error/30 bg-govbr-error-container p-3 text-xs text-govbr-error",children:"Não foi possÃvel carregar os documentos. Decisões finais permanecem bloqueadas."}):e.jsx("div",{className:"mt-2 space-y-2",children:m.map(o=>{const S=u.has(String((o==null?void 0:o.id)||""));return e.jsxs("div",{className:"flex flex-col gap-2 rounded-govbr-md border border-govbr-outline/30 bg-govbr-surface-muted p-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-xs font-medium text-govbr-on-surface",children:o.title||o.id}),e.jsxs("p",{className:"mt-1 text-[10px] text-govbr-on-surface/50",children:[S?"Revisão atual":"Revisão anterior",o.version?` · v${o.version}`:""]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:()=>C("Document",o.id,r.process_id||null),className:"govbr-focus rounded-govbr-sm border border-govbr-primary/40 bg-govbr-primary-container px-3 py-2 text-[10px] font-medium text-govbr-primary",children:"Abrir"}),e.jsxs("button",{type:"button",onClick:()=>f(o),disabled:!!a,className:"govbr-focus inline-flex items-center gap-1.5 rounded-govbr-sm border border-govbr
2-outline/40 bg-govbr-surface px-3 py-2 text-[10px] text-govbr-on-surface/70 disabled:opacity-40",children:[a===o.id?e.jsx(V,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(ce,{className:"h-3.5 w-3.5"}),"Baixar"]})]})]},o.id)})})]}),t&&e.jsx("p",{className:"mt-3 rounded-govbr-md border border-govbr-error/30 bg-govbr-error-container p-3 text-xs text-govbr-error",children:t})]}),v&&e.jsx("p",{className:"rounded-govbr-md border border-govbr-error/30 bg-govbr-error-container p-3 text-xs text-govbr-error",children:v}),p.length>0&&e.jsxs("section",{className:"govbr-surface p-govbr-md",children:[e.jsx("p",{className:"govbr-stat__label",children:"Ações"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-govbr-on-surface/50",children:"Aprovação, correção e conclusão são revalidadas no momento da decisão. Se a evidência não carregar, a decisão permanece bloqueada."}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:p.map(([o,S])=>{const F=d.isPending||H.has(o)&&h;return e.jsx("button",{type:"button",onClick:()=>g(o),disabled:F,className:`govbr-focus rounded-govbr-sm border px-3 py-2 text-xs font-medium disabled:opacity-40 ${o==="cancel"?"border-govbr-error/30 bg-govbr-error-container text-govbr-error":"border-govbr-primary/40 bg-govbr-primary-container text-govbr-primary"}`,children:d.isPending?"Processandoâ¦":S},o)})})]})]})}const Ie=[["document","Documentos"],["information","Informações"],["form","Formulários"],["acceptance","Aceites"],["consent","Consentimentos"],["signature","Assinaturas"],["action","Ações"],["profile","Cadastros"],["other","Outros"]];function Ee({form:s,setForm:r,clients:n=[],clientsLoading:c=!1,clientsError:i=!1,onSave:l,saving:m=!1,error:x=null}){var h;const[b,u]=y.useState([]),p=s.client_id&&((h=s.title)==null?void 0:h.trim())&&!m&&!i,d=y.useMemo(()=>({title:s.title,instructions:s.instructions,kind:s.kind,priority:s.priority}),[s]),v=a=>{r({...s,title:a.title||s.title,instructions:a.description||s.instructions,priority:a.priority||s.priority})};return e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs leading-5 text-govbr-on-surface/70",children:"Crie uma solicitação vinculada a um cliente. Regras de acesso, transições e segurança são validadas automaticamente."}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-govbr-on-surface",children:"Cliente"}),e.jsxs(I,{value:s.client_id||"",onValueChange:a=>r(t=>({...t,client_id:a})),disabled:c||i,children:[e.jsx(E,{className:"h-10",children:e.jsx($,{placeholder:"Selecione um cliente"})}),e.jsx(L,{children:n.map(a=>e.jsx(j,{value:a.id,children:a.name||a.nome||a.id},a.id))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-govbr-on-surface",children:"TÃtulo"}),e.jsx(O,{value:s.title||"",onChange:a=>r(t=>({...t,title:a.target.value})),className:"h-10",placeholder:"Ex: Enviar RG e comprovante"})]})]}),e.jsxs(M,{title:"Tipo e prioridade",icon:de,defaultOpen:!1,children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-govbr-on-surface",children:"Tipo"}),e.jsxs(I,{value:s.kind||"document",onValueChange:a=>r(t=>({...t,kind:a})),children:[e.jsx(E,{className:"h-10",children:e.jsx($,{})}),e.jsx(L,{children:Ie.map(([a,t])=>e.jsx(j,{value:a,children:t},a))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-govbr-on-surface",children:"Prioridade"}),e.jsxs(I,{value:s.priority||"normal",onValueChange:a=>r(t=>({...t,priority:a})),children:[e.jsx(E,{className:"h-10",children:e.jsx($,{})}),e.jsxs(L,{children:[e.jsx(j,{value:"low",children:"Baixa"}),e.jsx(j,{value:"normal",children:"Normal"}),e.jsx(j,{value:"high",children:"Alta"}),e.jsx(j,{value:"urgent",children:"Urgente"})]})]})]})]}),e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-govbr-on-surface",children:"Prazo"}),e.jsx(O,{type:"date",value:s.due_at||"",onChange:a=>r(t=>({...t,due_at:a.target.value})),className:"h-10"})]})]}),e.jsxs(M,{title:"Instruções",icon:z,defaultOpen:!1,children:[e.jsx(me,{context:d,onApply:v,promptPrefix:"Você é um assistente jurÃdico. Crie uma pendência em português.",label:"Assistente de pendência"}),e.jsx("textarea",{value:s.instructions||"",onChange:a=>r(t=>({...t,instructions:a.target.value})),rows:4,placeholder:"Descreva o que o cliente deve enviar ou fazerâ¦",className:"mt-2 w-full resize-none rounded-govbr-md border border-govbr
2-outline bg-card p-govbr-sm text-sm text-govbr-on-surface outline-none focus:border-govbr-primary"})]}),e.jsx(M,{title:"Documentos",icon:k,defaultOpen:!1,badge:b.length||void 0,children:e.jsx(ye,{onFilesChange:u,label:"Anexos da solicitação",hint:"Modelos, formulários, exemplos",accept:".pdf,.png,.jpg,.jpeg,.doc,.docx"})}),i&&e.jsx("p",{className:"rounded-govbr-md border border-govbr-error/30 bg-govbr-error-container p-govbr-sm text-xs text-govbr-error",children:"Não foi possÃvel carregar os clientes. A criação permanece bloqueada."}),x&&e.jsx("p",{className:"rounded-govbr-md border border-govbr-error/30 bg-govbr-error-container p-govbr-sm text-xs text-govbr-error",children:x}),e.jsx("div",{className:"flex justify-end border-t border-govbr-outline/30 pt-govbr-sm",children:e.jsx("button",{type:"button",onClick:l,disabled:!p,className:"rounded-govbr-md bg-govbr-primary px-govbr-lg py-2.5 text-xs font-semibold text-govbr-on-primary disabled:opacity-40 hover:bg-govbr-primary/90",children:m?"Criandoâ¦":"Criar e solicitar"})})]})}function Ve(){const{user:s}=xe(),r=be("pendings"),n=ue(),{query:c,exactQuery:i,clientsQuery:l,createMutation:m,filtro:x,setFiltro:b,showCreate:u,setShowCreate:p,createError:d,setCreateError:v,form:h,setForm:a,filtrados:t,metrics:g,selected:f,openPending:C,closeSelected:P,refresh:_}=n,A=ge(s,pe.PROCESS_DIAGNOSTICS);return e.jsxs("div",{className:"w-full space-y-4 sm:space-y-5",children:[e.jsx("div",{className:"px-1.5 pt-1.5",children:e.jsx(ve,{eyebrow:r.eyebrow,title:g.urgentes>0?`${g.urgentes} exigem ação`:"Pendências",description:r.description,summary:`${g.abertas||0} abertas · ${g.review||0} para conferir · ${g.urgentes||0} urgentes`,imageKey:r.moduleKey,portal:"lawyer",minHeight:"min-h-[120px] sm:min-h-[140px]"})}),e.jsx(_e,{hideIdentity:!0,metrics:g,loading:c.isLoading||c.isFetching,error:c.isError,canDiagnostics:A,filter:x,setFilter:b,onRefresh:_,onNew:()=>{v(""),p(!0)}}),c.isLoading?e.jsxs("section",{className:"rounded-govbr-md border border-govbr-outline/30 bg-govbr-surface p-12 text-center",children:[e.jsx(V,{className:"mx-auto h-7 w-7 animate-spin text-govbr-primary"}),e.jsx("p",{className:"mt-3 text-xs text-govbr-on-surface/55",children:"Carregando pendênciasâ¦"})]}):c.isError?e.jsxs("section",{className:"rounded-govbr-md border border-govbr-error/30 bg-govbr-error-container p-5 text-sm text-govbr-error",children:[e.jsx("p",{children:"Não foi possÃvel carregar as pendências."}),e.jsx("button",{type:"button",onClick:_,className:"mt-3 rounded-govbr-md border border-govbr-error/30 bg-govbr-surface px-3 py-2 text-xs font-medium",children:"Tentar novamente"})]}):e.jsx(Se,{items:t,onOpen:C}),i.isLoading&&e.jsx("div",{className:"rounded-govbr-md border border-govbr-outline/30 bg-govbr-surface p-4 text-sm text-govbr-on-surface/55",children:"Abrindo pendênciaâ¦"}),i.isError&&e.jsx("div",{className:"rounded-govbr-md border border-govbr-warning/30 bg-govbr-warning-container p-4 text-sm text-govbr-warning-foreground",children:"Não foi possÃvel abrir esta pendência pelo ID canônico."}),e.jsx(B,{open:u,onClose:()=>p(!1),title:"Nova pendência",maxWidth:"820px",children:e.jsx(Ee,{form:h,setForm:a,clients:l.data||[],clientsLoading:l.isLoading,clientsError:l.isError,onSave:()=>m.mutate(),saving:m.isPending,error:d})}),e.jsx(B,{open:!!f,onClose:P,title:`Pendência · ${(f==null?void 0:f.title)||"Solicitação"}`,maxWidth:"820px",children:e.jsx(De,{vm:n})})]})}export{Ve 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.