import{j as e,r as i}from"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f.js";import{u as x}from"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f20.js";import{u as v}from"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f26.js";import{n as f}from"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f23.js";import{_ as g,H as w,D as m,U as p}from"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f11.js";import{S as N}from"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f224.js";import{b as _}from"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f60.js";import{b}from"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f146.js";import{b as R}from"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f153.js";import"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f8.js";import"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f19.js";import"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f7.js";import"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f4.js";import"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f3.js";import"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f2.js";import"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f10.js";import"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f6.js";import"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f9.js";import"./v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f106.js";const y=i.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_3_6_3dde09db-99f5-4187-8a7e-903456f0360f223.js")),[]));function E({rel:s}){return e.jsx(i.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(y,{rel:s})})}const k=s=>s.filter(o=>o.status==="Enviado"),D=s=>s.filter(o=>o.status==="Erro"),S=({rel:s,setShowRel:o})=>{const{language:t}=x(),l=e.jsx("div",{className:"flex justify-center overflow-auto",style:{height:"calc(100vh - 130px)"},children:e.jsx("div",{className:"overflow-x-auto pt-3 max-w-[1000px] w-full",children:e.jsxs("table",{className:"table text-center",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t.id}),e.jsx("th",{children:t.nome}),e.jsx("th",{children:t.numero}),e.jsx("th",{children:t.status})]})}),e.jsx("tbody",{children:s.send.slice().reverse().map((a,d)=>e.jsxs("tr",{children:[e.jsx("td",{children:a.id}),e.jsx("td",{children:e.jsx("span",{className:"text-min w-[95px] block m-auto",children:a.nome})}),e.jsx("td",{children:e.jsx("span",{className:"text-min w-[95px] block m-auto",children:a.phone})}),e.jsx("td",{children:e.jsx(N,{type:a.status})})]},d))})]})})});return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"p-4",style:{height:"calc(100vh - 75px)"},children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsxs(m,{children:[t.envio_realizado," ",p.MillisToFormattedDate(s.id)]}),e.jsx("span",{className:"pulse cursor-pointer lg:tooltip lg:tooltip-right","data-tip":t.voltar,onClick:()=>o({active:!1,rel:[]}),children:e.jsx(R,{className:"w-6 h-6 text-[var(--primaria)]",strokeWidth:1})})]}),l]})})};function Q(){const{open:s}=f(),{relatorio:o}=v(),{language:t}=x(),l=i.useRef([]),[c,a]=i.useState({active:!1,rel:[]}),d=r=>{a({active:!0,rel:r})},j=(r,n)=>{const h={current:n};s(e.jsx(E,{rel:r}),{placement:"bottom"},h.current,10)},u=e.jsxs(e.Fragment,{children:[e.jsx(w,{children:t.desc_relatorio}),e.jsxs("div",{className:"p-4",style:{height:"calc(100vh - 75px)"},children:[e.jsxs(m,{children:[t.ultimos_envios_1," ",o.length," ",t.ultimos_envios_2]}),e.jsx("div",{className:"overflow-x-auto mt-4",style:{maxHeight:"calc(100vh - 135px)"},children:e.jsxs("table",{className:"table text-center",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t.data}),e.jsx("th",{children:t.cts_disparados}),e.jsx("th",{children:t.enviados}),e.jsx("th",{children:t.erro_enviar}),e.jsx("th",{children:t.acao})]})}),e.jsx("tbody",{children:o.map((r,n)=>e.jsxs("tr",{className:"hover:bg-base-300 cursor-pointer",children:[e.jsx("td",{className:"rounded-l-lg",children:p.MillisToFormattedDate(parseInt(r.id))}),e.jsx("td",{children:r.send.length}),e.jsx("td",{children:k(r.send).length}),e.jsx("td",{children:D(r.send).length}),e.jsx("td",{className:"rounded-r-lg",children:e.jsxs("div",{className:"flex gap-3 items-center justify-center",children:[e.jsx("span",{className:"pulse cursor-pointer",onClick:()=>d(r),children:e.jsx(_,{className:"h-5 w-5 text-[var(--icon)]"})}),e.jsx("span",{ref:h=>{l.current[n]=h},className:"pulse cursor-pointer",onClick:()=>j(r,l.current[n]),children:e.jsx(b,{className:"h-5 w-5 text-[var(--icon)]"})})]})})]},n))})]})})]})]});return c.active?e.jsx(S,{rel:c.rel,setShowRel:a}):u}export{Q as default};
