import type { CSSResult, PropertyValueMap } from 'lit';
import { Component } from '../../models';
import { AriaLive } from './screenreaderannouncer.types';
/**
 * `mdc-screenreaderannouncer` can be used to announce messages with the screen reader.
 *
 * To make an announcement set `announcement` attribute on the `mdc-screenreaderannouncer` element.
 *
 * Consumers can also use the public `announce` function to trigger announcements programmatically
 * by passing an options object where `announcement` is required and all other fields are optional.
 *
 * **Internal logic**
 *
 * When the screenreader announcer is connected to the DOM, if the `identity` attribute is not
 * provided, it is set to `mdc-screenreaderannouncer-identity` and a `<div>` element with this id is created
 * in the DOM. If the `identity` attribute is provided, the identity element is used and no new element
 * is created in the DOM.
 *
 * If you provide a custom `identity`, you must ensure that the element exists and is visually hidden.
 *
 * Example CSS:
 *
 * ```css
 * #your-custom-announcer-id {
 *   clip: rect(0 0 0 0);
 *   clip-path: inset(50%);
 *   height: 1px;
 *   overflow: hidden;
 *   position: absolute;
 *   white-space: nowrap;
 *   width: 1px;
 * }
 * ```
 *
 * When the `announcement` attribute is set, the screenreader announcer will create a `<div>` element with
 * `aria-live` attribute set to the value of `data-aria-live` attribute and append it to the `identity` element.
 * After delay of `delay` milliseconds, a `<p>` element with the announcement text is appended to the `<div>` element.
 *
 * The announcement `<div>` element is removed from the DOM after `timeout` milliseconds.
 *
 * When the screen announcer component is disconnected from the DOM, all the timeouts are cleared and
 * all the announcement elements added are removed from the DOM and timeouts cleared.
 *
 * **Note**
 * 1. The default delay of 150 miliseconds is used as we dynamically generate the
 * aria-live region in the DOM and add the announcement text to it.
 * 2. If multiple `mdc-screenreaderannouncer` instances use the same `identity`, `data-aria-live`
 * for that identity is effectively determined by the first instance that creates announcements for it.
 * Changing `data-aria-live` in later instances for the same identity will not update already-created
 * live-region containers.
 * 3. If no `identity` is provided, all the screen reader components will create and use only one
 * `<div>` element with id `mdc-screenreaderannouncer-identity` in the DOM.
 *
 * Reference: https://patrickhlauke.github.io/aria/tests/live-regions/
 *
 * @tagname mdc-screenreaderannouncer
 */
declare class ScreenreaderAnnouncer extends Component {
    /**
     * The announcement attribute is a string that is used to announce messages to the screen reader.
     * The announcement is made when the announcement attribute is set to a non-empty string.
     *
     * @default ''
     */
    announcement?: string;
    /**
     * The id of the element in the light dom, to which announcement elements will be appended.
     *
     * If id is not provided, it will be set to `mdc-screenreaderannouncer-identity` and
     * a div element with this id will be created in the light dom.
     */
    identity: string;
    /**
     * Aria live value for announcement.
     *
     * For a shared `identity`, this value should be treated as immutable after initial usage.
     * The first `mdc-screenreaderannouncer` instance that creates announcements for that
     * identity determines the `aria-live` value for the created live-region containers.
     *
     * @default 'polite'
     */
    dataAriaLive: AriaLive;
    /**
     * Milliseconds to wait before adding the announcement to the identiy region in
     * DOM, which will announce the message to the screen reader.
     *
     * @default 150
     */
    delay: number;
    /**
     * Milliseconds to wait after which the announcement element will be removed from
     * identity region in DOM, causing the screen reader to not announcing the message.
     * @default 20_000
     */
    timeout: number;
    /**
     * The debounce time delay in milliseconds for announcements.
     *
     * @default 500
     */
    debounceTime: number;
    /**
     * Whether this instance currently holds a ref for its identity.
     * @internal
     */
    private hasIdentityRef;
    /**
     * Array to store timeOutIds for clearing timeouts later.
     * @internal
     */
    private timeOutIds;
    /**
     * Array to store the ids of the announcement elements.
     * @internal
     */
    private ariaLiveAnnouncementIds;
    /** @internal */
    private debouncedAnnounce?;
    /**
     * Announces the given announcement to the screen reader.
     *
     * A div element with aria-live attribute set to the given ariaLive value is created
     * and a p element with the announcement text is appended to it.
     *
     * The div element is appended to the element in the DOM identified with id as
     * identity attribute.
     *
     * @param options - Announcement configuration object with the following fields:
     *   - `announcement` (required): The announcement to be made.
     *   - `delay` (optional): The delay in milliseconds before announcing the message.
     *   - `timeout` (optional): The timeout in milliseconds before removing the announcement.
     *   - `ariaLive` (optional): The aria live value for the announcement.
     */
    announce({ announcement, delay, timeout, ariaLive, }: {
        announcement: string;
        delay?: number;
        timeout?: number;
        ariaLive?: AriaLive;
    }): void;
    /**
     * Clears all timeouts and removes all announcements from the screen reader.
     */
    private clearTimeOutsAndAnnouncements;
    /**
     * Gets an element by ID, searching in both light DOM and modal dialog shadow root.
     * @internal
     */
    private getElementByIdAcrossShadowRoot;
    /**
     * Creates a div element with id as identity attribute in the DOM.
     *
     * If the identity attribute is not provided, it is set internally to
     * `mdc-screenreaderannouncer-identity`.
     */
    private createAnnouncementAriaLiveRegion;
    /**
     * Finds the closest modal dialog ancestor, traversing through shadow DOM boundaries.
     * @internal
     */
    private findModalAncestor;
    /**
     * Creates a single debounced function that will read the latest this.announcement when executed.
     *
     * This function is used to debounce the announcement so that it will only be made after
     * this.debounceTime milliseconds have passed since the last time this.announcement was updated.
     */
    private setupDebouncedAnnounce;
    /**
     * Increments the refcount for the current identity.
     */
    private acquireIdentityRef;
    /**
     * Decrements the refcount for the current identity.
     * When the count reaches zero the live-region DOM node is removed.
     */
    private releaseIdentityRef;
    connectedCallback(): void;
    disconnectedCallback(): void;
    protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
    static styles: Array<CSSResult>;
}
export default ScreenreaderAnnouncer;
