class VRToastStore {
    toasts = $state([]);
    nextId = 0;
    add(message, variant = 'info', duration = 3000) {
        const id = this.nextId++;
        this.toasts.push({
            id,
            message,
            variant,
            createdAt: Date.now(),
            duration,
        });
        setTimeout(() => this.remove(id), duration);
        return id;
    }
    remove(id) {
        this.toasts = this.toasts.filter((t) => t.id !== id);
    }
    success(message, duration) {
        return this.add(message, 'success', duration);
    }
    danger(message, duration) {
        return this.add(message, 'danger', duration);
    }
    warning(message, duration) {
        return this.add(message, 'warning', duration);
    }
    info(message, duration) {
        return this.add(message, 'info', duration);
    }
}
export const xrToast = new VRToastStore();
