import {
    j as e,
    r as x
} from "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f6.js";
import {
    ak as y,
    am as k,
    al as C,
    U as E,
    bb as P,
    V as u
} from "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f611.js";
import {
    a as f,
    m as A
} from "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f622.js";
import {
    a5 as g
} from "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f623.js";
import {
    W as b,
    V as S
} from "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f619.js";
import {
    u as h
} from "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f620.js";
import {
    o as T
} from "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f666.js";
import {
    c as _
} from "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f659.js";
import {
    u as O
} from "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f646.js";
import {
    a as j
} from "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f6107.js";
import "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f69.js";
import "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f66.js";
import "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f68.js";
import "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f67.js";
import "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f610.js";
import "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f645.js";
import "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f647.js";
import "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f64.js";
import "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f63.js";
import "./v_7_4_3_4_e110faba-0ecf-462e-819c-68342bb684f62.js";
const p = {
    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 N({
    nt: a
}) {
    const {
        language: i
    } = h(), {
        notify_views: o,
        setViews: n
    } = f(O(c => ({
        notify_views: c.notify.views,
        setViews: c.setViews
    }))), r = p[a.type] || p.INFO, m = !o.includes(a.id), t = c => {
        c.stopPropagation(), c.preventDefault(), a.redirect == "EXTERNAL" ? window.open(a.link, "_blank") : (n("modal", a.id), T(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: c => {
            c.stopPropagation(), c.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(y, {
                    className: `h-5 w-5 ${r.text}`,
                    strokeWidth: 1.5
                }), a.type === "ALERT" && e.jsx(k, {
                    className: `h-5 w-5 ${r.text}`,
                    strokeWidth: 1.5
                }), a.type === "PROMOTION" && e.jsx(C, {
                    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: E.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 : i.cliqueAqui
                    }), e.jsx(_, {
                        className: "h-4 w-4 flex-shrink-0 transition-transform group-hover/btn:translate-x-0.5",
                        strokeWidth: 1
                    })]
                })]
            })]
        })]
    }, a.id)
}

function F() {
    const a = f(o => o.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(o => e.jsx(N, {
            nt: o
        }, o.id))
    })
}

function M() {
    const {
        notifications: a,
        setNotifications: i
    } = g(), o = A(s => s.getCaixaDeEntrada), n = s => {
        const l = [...a];
        for (let d = 0; d < l.length; d++) l[d].id === s && (l[d].read = !0);
        i(l)
    }, r = (s, l) => {
        s.stopPropagation();
        const v = [...a].filter(w => w.id !== l);
        i(v)
    }, 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(j, {
                    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: o().map(s => s.viewer ? e.jsx(N, {
                nt: s
            }) : s.timeOut ? t(s) : null)
        })
    })
}

function R() {
    const {
        notifications: a,
        setNotifications: i
    } = g(), o = (t, c) => {
        t.stopPropagation();
        const l = [...a].filter(d => d.id !== c);
        i(l)
    }, 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 => o(s, t.id),
            children: e.jsx(j, {
                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: i
    } = h(), o = {
      pt: [
    "Correção da exibição dos cards no CRM",
    "Correção de Envios De Mensagens",

],
en: [
    "Fix for CRM card display",
    "Fix for flow control block",
    "Fix for copying transcribed audio"
],
es: [
    "Corrección de la visualización de tarjetas en el CRM",
    "Corrección del bloque de control de flujo",
    "Corrección al copiar audio transcrito"
]

    };
    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, " ", S.version]
            }), e.jsx("div", {
                className: "pt-2",
                children: e.jsx("ul", {
                    style: {
                        listStyle: "inside"
                    },
                    children: o[i].map((r, m) => e.jsx("li", {
                        className: "marker:text-[var(--primaria)] text-sm",
                        children: r
                    }, m))
                })
            })]
        })
    })
}

function te() {
    const [a, i] = x.useState("Entrada"), [o, n] = x.useState(e.jsx(e.Fragment, {})), {
        language: r
    } = h();
    x.useEffect(() => {
        switch (a) {
            case "Comunicado":
                n(e.jsx(F, {}));
                break;
            case "Atualizacao":
                n(e.jsx(z, {}));
                break;
            case "Pendentes":
                n(e.jsx(R, {}));
                break;
            case "Entrada":
            default:
                n(e.jsx(M, {}));
                break
        }
    }, [a]);
    const m = 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: "Inbox"
                }), e.jsx("input", {
                    id: "Entrada",
                    type: "checkbox",
                    checked: a === "Entrada",
                    onChange: () => i("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: () => i("Comunicado"),
                    className: "hidden"
                })]
            }), e.jsxs("label", {
                className: "tab " + (a === "Atualizacao" ? "tab-active !border-[var(--primaria)]" : ""),
                htmlFor: "Atualizacao",
                children: [e.jsx("span", {
                    children: r.atualizacoes
                }), e.jsx("input", {
                    id: "Atualizacao",
                    type: "checkbox",
                    checked: a === "Atualizacao",
                    onChange: () => i("Atualizacao"),
                    className: "hidden"
                })]
            }), 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: () => i("Pendentes"),
                    className: "hidden"
                })]
            })]
        })
    });
    return e.jsxs("div", {
        children: [e.jsx(u, {
            children: r.notifications
        }), e.jsxs("div", {
            className: "px-2 pt-2",
            children: [m, o]
        })]
    })
}
export {
    te as
    default
};