import { a as useState } from './useLoading-D4zrSa2m.mjs'; let _counter = 0; function useToast() { const toasts = useState("app:toasts", () => []); function toast(msg, type = "info", duration = 3e3) { const id = ++_counter; toasts.value.push({ id, type, msg }); if (duration > 0) { setTimeout(() => { toasts.value = toasts.value.filter((t) => t.id !== id); }, duration); } } return { toasts, toast, success: (msg, duration) => toast(msg, "success", duration), error: (msg, duration) => toast(msg, "error", duration), info: (msg, duration) => toast(msg, "info", duration), warn: (msg, duration) => toast(msg, "warning", duration) }; } export { useToast as u }; //# sourceMappingURL=useToast-CS21XT61.mjs.map