import type { Component, ComputedRef, Ref } from "vue";
import { DeferredPromise, Publisher } from "@byloth/core";
import type { MaybePromise, Timeout } from "@byloth/core";
import type { Duration } from "../types/index.js";
import type { ActionCallback } from "../types/action/index.js";
import type { AlertOptions } from "../types/alert/index.js";
import Action from "./action.js";
import Alert from "./alert.js";
export type ContextResult<R> = Action<R> | ActionCallback<R | undefined> | MaybePromise<R | undefined>;
interface ContextEventMap {
    opening: () => void;
    opened: () => void;
    closing: () => void;
    closed: () => void;
}
export default class Context<T = void, P extends Record<string, unknown> = never> extends DeferredPromise<T> {
    protected _duration: Duration;
    protected _timeoutId?: Timeout;
    protected _publisher: Publisher<ContextEventMap>;
    protected readonly _isOpen: Ref<boolean>;
    readonly alert: Alert<T, P>;
    readonly isOpen: ComputedRef<boolean>;
    readonly component?: Component;
    constructor(options: AlertOptions<T, P>, duration: number | Duration);
    open(): Promise<void>;
    onOpening(subscriber: () => void): void;
    onOpened(subscriber: () => void): void;
    onClosing(subscriber: () => void): void;
    onClosed(subscriber: () => void): void;
}
export {};
