import {
    j as e,
    r as p
} from "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a71.js";
import {
    X as y,
    Y as k,
    Z as C,
    U as E,
    b8 as P,
    Q as h
} from "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7111.js";
import {
    c as M
} from "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7145.js";
import {
    u as f
} from "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7128.js";
import {
    r as b,
    p as S
} from "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7124.js";
import {
    W as g,
    V as _
} from "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7119.js";
import {
    u
} from "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7120.js";
import {
    a as A
} from "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7159.js";
import {
    a as j
} from "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a71107.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a719.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a716.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a718.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a717.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7122.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7110.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7146.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a71104.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a71124.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7129.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7138.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a71105.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a71106.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7137.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a714.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a713.js";
import "./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a712.js";

function N({
    nt: a
}) {
    const {
        setNotificacoes_boxVisible: s,
        isBoxVisible: i
    } = b(), {
        language: l
    } = u(), o = n => {
        n.stopPropagation(), n.preventDefault(), window.open(a.link, "_blank")
    };
    return e.jsxs("div", {
        className: "group relative border border-gray-200 dark:border-neutral-700 bg-white dark:bg-neutral-800 p-4 sm:p-5 rounded-xl w-full cursor-pointer transition-all duration-200 hover:border-gray-300 dark:hover:border-neutral-600 hover:shadow-sm dark:hover:shadow-neutral-900/50",
        onClick: n => {
            n.stopPropagation(), n.preventDefault(), s(a.id)
        },
        children: [e.jsxs("div", {
            className: "flex justify-between items-start gap-3 mb-3",
            children: [e.jsxs("div", {
                className: "flex items-center gap-2",
                children: [!i(a.id) && e.jsx("div", {
                    className: "flex items-center justify-center w-2 h-2 rounded-full bg-[var(--primaria)] animate-pulse"
                }), a.type === "INFO" && e.jsx("div", {
                    className: "flex items-center justify-center w-9 h-9 rounded-lg bg-blue-50 dark:bg-blue-900/30",
                    children: e.jsx(y, {
                        className: "h-5 w-5 text-blue-600 dark:text-blue-400"
                    })
                }), a.type === "ALERT" && e.jsx("div", {
                    className: "flex items-center justify-center w-9 h-9 rounded-lg bg-red-50 dark:bg-red-900/30",
                    children: e.jsx(k, {
                        className: "h-5 w-5 text-red-600 dark:text-red-400"
                    })
                }), a.type === "PROMOTION" && e.jsx("div", {
                    className: "flex items-center justify-center w-9 h-9 rounded-lg bg-yellow-50 dark:bg-yellow-900/30",
                    children: e.jsx(C, {
                        className: "h-5 w-5 text-yellow-600 dark:text-yellow-400"
                    })
                })]
            }), e.jsx("span", {
                className: "text-xs text-gray-500 dark:text-gray-300 whitespace-nowrap flex-shrink-0 font-medium",
                children: E.MillisToFormattedDate(a.data)
            })]
        }), e.jsx("h2", {
            className: "text-base sm:text-lg flex justify-center font-semibold text-gray-900 dark:text-white mb-3 break-words leading-snug",
            children: a.title
        }), e.jsx("div", {
            className: "pb-2",
            children: e.jsx("p", {
                className: `text-sm sm:text-base text-gray-600 dark:text-gray-200 leading-relaxed break-words 
          [&_strong]:text-gray-800 [&_strong]:dark:text-white
          [&_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.jsx("div", {
            className: "flex justify-start mt-4 pt-3 border-t border-gray-100 dark:border-neutral-700",
            children: e.jsx("span", {
                onClick: o,
                children: e.jsxs("a", {
                    className: "inline-flex items-center gap-1.5 text-sm font-medium text-[var(--primaria)] hover:opacity-80 transition-all group-hover:gap-2",
                    target: "_blank",
                    children: [e.jsx("span", {
                        className: "break-words",
                        children: a.btnName.length !== 0 ? a.btnName : l.cliqueAqui
                    }), e.jsx(A, {
                        strokeWidth: 2.5,
                        className: "h-4 w-4 flex-shrink-0"
                    })]
                })
            })
        })]
    }, a.id)
}

function T() {
    const {
        renderNotificacoes_box: a
    } = b();
    return e.jsx("div", {
        className: "grid gap-3 p-3 sm:p-4 overflow-y-auto overflow-x-hidden",
        style: {
            maxHeight: "calc(100vh - 90px)"
        },
        children: a().map(i => e.jsx(N, {
            nt: i
        }, i.id))
    })
}

function z() {
    const {
        notifications: a,
        setNotifications: s
    } = f(), {
        getCaixaDeEntrada: i
    } = M(), {
        open: l
    } = S(), o = t => {
        const c = [...a];
        for (let d = 0; d < c.length; d++) c[d].id === t && (c[d].read = !0);
        s(c)
    }, n = (t, c) => {
        t.stopPropagation();
        const v = [...a].filter(w => w.id !== c);
        s(v)
    }, r = t => {
        g.Chat("openChatBottom", t.user_id)
    }, m = t => e.jsxs("div", {
        className: "flex justify-start hoverShadown cursor-pointer p-2 border border-base-200 rounded-lg w-full",
        onClick: () => r(t),
        style: {
            borderStyle: "outset"
        },
        children: [!t.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: () => t.read ? null : o(t.id),
            children: [e.jsx("span", {
                className: "notifyMaxSpace w-[250px]",
                children: t.title
            }), e.jsxs("span", {
                className: "text-xs",
                children: [t.date, " at ", t.time]
            })]
        }), e.jsx("div", {
            className: "flex justify-end items-center w-full",
            onClick: d => n(d, t.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: i().map(t => t.viewer ? e.jsx(N, {
                nt: t
            }) : t.timeOut ? m(t) : null)
        })
    })
}

function D() {
    const {
        notifications: a,
        setNotifications: s
    } = f(), i = (r, m) => {
        r.stopPropagation();
        const t = [...a].filter(c => c.id !== m);
        s(t)
    }, l = r => {
        g.Chat("openChatBottom", r.user_id)
    }, o = r => e.jsxs("div", {
        className: "flex justify-between hoverShadown cursor-pointer p-2 border border-base-200 rounded-lg",
        style: {
            borderStyle: "outset"
        },
        onClick: () => l(r),
        children: [e.jsxs("div", {
            className: "flex flex-col gap-2",
            children: [e.jsx("span", {
                className: "notifyMaxSpace w-[250px]",
                children: r.title
            }), e.jsxs("span", {
                className: "text-[12px]",
                children: [r.date, " at ", r.time]
            })]
        }), e.jsx("div", {
            className: "flex justify-center items-center pulse",
            onClick: x => i(x, r.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(r => r.timeOut ? null : o(r))
        })
    })
}

function F() {
    const {
        language: a,
        idioma: s
    } = u(), i = {
        pt: ["Correção nos envios de mensagens", "Correção de bugs", "Estamos trabalhando continuamente para oferecer a melhor experiência para você 🚀"],
        en: ["Correction in the movement of labels in the CRM", "Correction in responding to messages with the active signature"],
        es: ["Corrección en la movimentación de etiquetas en el CRM", "Corrección al responder mensajes con la firma activa"]
    };
    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(h, {
                children: [a.atualizacao, " ", _.version]
            }), e.jsx("div", {
                className: "pt-2",
                children: e.jsx("ul", {
                    style: {
                        listStyle: "inside"
                    },
                    children: i[s].map((o, n) => e.jsx("li", {
                        className: "marker:text-[var(--primaria)] text-sm",
                        children: o
                    }, n))
                })
            })]
        })
    })
}

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