import { j as e } from "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb1165.js";
import { r as x } from "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb116.js";
import { a9 as k, ab as C, aa as E, aY as P, o as u } from "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb1167.js";
import { a as f, h as S } from "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb11622.js";
import { G as g } from "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb11623.js";
import { W as b, V as j } from "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb1162.js";
import { u as p, U as _ } from "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb1164.js";
import { o as A } from "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb11667.js";
import { c as T } from "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb11660.js";
import { u as F } from "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb11647.js";
import { a as N } from "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb116110.js";
import "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb1166.js";
import "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb1168.js";
import "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb11646.js";
import "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb1163.js";
import "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb11648.js";
import "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb11611.js";
import "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb1169.js";
import "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb11610.js";
import "./v_7_4_3_28_345c6a4a-aab6-4ec9-a0c6-3718e7fdb11620.js";

const h = { INFO: { text: "text-blue-600", border: "border-blue-500/15" }, ALERT: { text: "text-amber-600", border: "border-amber-500/15" }, PROMOTION: { text: "text-emerald-600", border: "border-emerald-500/15" } };

function v({ nt: a }) {
  const { language: o } = p(), { notify_views: i, setViews: n } = f(F(l => ({ notify_views: l.notify.views, setViews: l.setViews }))), r = h[a.type] || h.INFO, m = !i.includes(a.id), t = l => { l.stopPropagation(), l.preventDefault(), a.redirect == "EXTERNAL" ? window.open(a.link, "_blank") : (n("modal", a.id), A(a.whatsapp, a.menssage)) };
  return e.jsxs("div", {
    className: `group relative p-4 rounded-lg border cursor-pointer border-gray-200/60 dark:border-gray-700/60 bg-gray-200 dark:bg-neutral-800 hover:border-gray-300 dark:hover:border-gray-600 hover:shadow-md dark:hover:shadow-lg dark:hover:shadow-black/20 ${r.border}`,
    onClick: l => { l.stopPropagation(), l.preventDefault(), n("notify", a.id) },
    children: [m && e.jsx("div", { className: "absolute -top-2 -left-2 w-3 h-3 rounded-full bg-[var(--primaria)] animate-pulse shadow-lg shadow-[var(--primaria)]/50" }), e.jsxs("div", {
      className: "flex gap-3",
      children: [e.jsxs("div", {
        className: "flex-shrink-0 p-2.5 rounded-lg",
        children: [a.type === "INFO" && e.jsx(k, { className: `h-5 w-5 ${r.text}`, strokeWidth: 1.5 }), a.type === "ALERT" && e.jsx(C, { className: `h-5 w-5 ${r.text}`, strokeWidth: 1.5 }), a.type === "PROMOTION" && e.jsx(E, { className: `h-5 w-5 ${r.text}`, strokeWidth: 1.5 })]
      }), e.jsxs("div", {
        className: "flex-1 min-w-0",
        children: [e.jsxs("div", { className: "flex items-start justify-between gap-2 mb-2", children: [e.jsx("h2", { className: "text-sm font-semibold text-gray-900 dark:text-white leading-tight", children: a.title }), e.jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400 flex-shrink-0 font-medium whitespace-nowrap ml-2", children: _.MillisToFormattedDate(a.data) })] }), e.jsx("div", { className: "mb-3", children: e.jsx("p", { className: `text-sm text-gray-600 dark:text-gray-300 leading-relaxed [&_strong]:text-gray-900 [&_strong]:dark:text-gray-100 [&_strong]:font-semibold [&_strong.italic]:italic`, style: { wordBreak: "break-word" }, dangerouslySetInnerHTML: { __html: a.statement.replace(/\_(.*?)\_/g, '<strong class="italic">$1</strong>').replace(/\*(.*?)\*/g, "<strong>$1</strong>").replace(/\n/g, "<br>") } }) }), a.link && e.jsxs("button", { onClick: t, className: "inline-flex items-center gap-2 text-sm font-medium text-[var(--primaria)] group/btn", children: [e.jsx("span", { children: a.btnName.length !== 0 ? a.btnName : o.cliqueAqui }), e.jsx(T, { className: "h-4 w-4 flex-shrink-0 transition-transform group-hover/btn:translate-x-0.5", strokeWidth: 1 })] })]
      })]
    })]
  }, a.id)
}
function O() { const a = f(i => i.notify.notify); return e.jsx("div", { className: "grid gap-2 p-4 overflow-y-auto overflow-x-hidden", style: { maxHeight: "calc(100vh - 90px)" }, children: a.map(i => e.jsx(v, { nt: i }, i.id)) }) }
function M() {
  const { notifications: a, setNotifications: o } = g(), i = S(s => s.getCaixaDeEntrada), n = s => { const c = [...a]; for (let d = 0; d < c.length; d++) c[d].id === s && (c[d].read = !0); o(c) }, r = (s, c) => { s.stopPropagation(); const w = [...a].filter(y => y.id !== c); o(w) }, m = s => { b.Chat("openChatBottom", s.user_id) }, t = s => e.jsxs("div", {
    className: "flex justify-start hoverShadown cursor-pointer p-2 border border-base-200 rounded-lg w-full", onClick: () => m(s), style: { borderStyle: "outset" }, children: [!s.read && e.jsx("span", { className: "flex items-center pr-1", children: e.jsx(P, { className: "w-2 h-2 text-[var(--primaria)]" }) }), e.jsxs("div", {
      className: "flex flex-col gap-2", onClick: () => s.read ? null : n(s.id), children: [e.jsx("span", { className: "notifyMaxSpace w-[250px]", children: s.title }), e.jsxs("span", { className: "text-xs", children: [s.date, " at ", s.time] })]
    }), e.jsx("div", { className: "flex justify-end items-center w-full", onClick: d => r(d, s.id), children: e.jsx("span", { className: "pulse", children: e.jsx(N, { className: "w-5 h-5" }) }) })]
  });
  return e.jsx("div", { className: "overflow-auto", style: { maxHeight: "calc(100vh - 90px)" }, children: e.jsx("div", { className: "grid gap-2 pt-2", children: i().map(s => s.viewer ? e.jsx(v, { nt: s }) : s.timeOut ? t(s) : null) }) })
}
function R() {
  const { notifications: a, setNotifications: o } = g(), i = (t, l) => { t.stopPropagation(); const c = [...a].filter(d => d.id !== l); o(c) }, n = t => { b.Chat("openChatBottom", t.user_id) }, r = t => e.jsxs("div", {
    className: "flex justify-between hoverShadown cursor-pointer p-2 border border-base-200 rounded-lg", style: { borderStyle: "outset" }, onClick: () => n(t), children: [e.jsxs("div", {
      className: "flex flex-col gap-2", children: [e.jsx("span", { className: "notifyMaxSpace w-[250px]", children: t.title }), e.jsxs("span", { className: "text-[12px]", children: [t.date, " at ", t.time] })]
    }), e.jsx("div", { className: "flex justify-center items-center pulse", onClick: s => i(s, t.id), children: e.jsx(N, { className: "w-5 h-5" }) })]
  });
  return e.jsx("div", { className: "overflow-auto", style: { maxHeight: "calc(100vh - 180px)" }, children: e.jsx("div", { className: "grid gap-2 pt-2", children: a.slice().reverse().map(t => t.timeOut ? null : r(t)) }) })
}
function z() {
  const { language: a, idioma: o } = p(), i = { pt: ["Fluxos & Autoatendimento: Resolvido erro que impedia o acionamento por mensagens.", "Correção da funcionalidade de mencionar todos em grupos", "Correção do filtro de chats personalizados"], en: ["Workflows & Self-Service: Fixed error that prevented triggering by messages.", "Correction of the mention all in groups functionality", "Correction of the personalized chats filter"], es: ["Flujos & Autoasistencia: Se ha corregido un error que impedía el accionamiento por mensagens.", "Corrección de la funcionalidade de mencionar a todos em grupos", "Corrección del filtro de chats personalizados"] };
  return e.jsx("div", {
    className: "grid gap-2 p-2 overflow-auto", style: { maxHeight: "calc(100vh - 180px)" }, children: e.jsxs("div", {
      className: "border border-base200 p-2 rounded-lg w-full", style: { borderStyle: "outset" }, children: [e.jsxs(u, { children: [a.atualizacao, " ", j.version] }), e.jsx("div", { className: "pt-2", children: e.jsx("ul", { style: { listStyle: "inside" }, children: i[o].map((r, m) => e.jsx("li", { className: "marker:text-[var(--primaria)] text-sm", children: r }, m)) }) })]
    })
  })
}
function te() {
  const [a, o] = x.useState("Entrada"), [i, n] = x.useState(e.jsx(e.Fragment, {})), { language: r } = p();
  x.useEffect(() => { switch (a) { case "Comunicado": n(e.jsx(O, {})); break; case "Atualizacao": n(e.jsx(z, {})); break; case "Pendentes": n(e.jsx(R, {})); break; default: n(e.jsx(M, {})); break } }, [a]);
  const m = () => { window.open("https://zapx.digitalavance.com.br/atualizacao.php", "_blank") };
  const t = e.jsx("header", {
    children: e.jsxs("div", {
      className: "tabs tabs-bordered",
      children: [
        e.jsxs("label", { className: "tab " + (a === "Entrada" ? "tab-active !border-[var(--primaria)]" : ""), htmlFor: "Entrada", children: [e.jsx("span", { children: "Entrada" }), e.jsx("input", { id: "Entrada", type: "checkbox", checked: a === "Entrada", onChange: () => o("Entrada"), className: "hidden" })] }),
        e.jsxs("label", { className: "tab " + (a === "Comunicado" ? "tab-active !border-[var(--primaria)]" : ""), htmlFor: "Comunicado", children: [e.jsx("span", { children: r.comunicado }), e.jsx("input", { id: "Comunicado", type: "checkbox", checked: a === "Comunicado", onChange: () => o("Comunicado"), className: "hidden" })] }),
        e.jsx("label", { className: "tab " + (a === "Atualizacao" ? "tab-active !border-[var(--primaria)]" : ""), htmlFor: "Atualizacao", onClick: m, children: e.jsx("span", { children: r.atualizacoes }) }),
        e.jsxs("label", { className: "tab " + (a === "Pendentes" ? "tab-active !border-[var(--primaria)]" : ""), htmlFor: "Pendentes", children: [e.jsx("span", { children: r.notificacoesPendentes }), e.jsx("input", { id: "Pendentes", type: "checkbox", checked: a === "Pendentes", onChange: () => o("Pendentes"), className: "hidden" })] })
      ]
    })
  });
  return e.jsxs("div", { children: [e.jsx(u, { children: r.notifications }), e.jsxs("div", { className: "px-2 pt-2", children: [t, i] })] })
}
export { te as default };