import type { IPortalElementProps } from '../../Primitives/Portal/IPortalElementProps';
import type { PortalProjectionElement } from '../../Primitives/Portal/PortalProjectionElement';
import { DrawerElement } from './DrawerElement';
import type { IDrawerElementProps } from './IDrawerElementProps';
import { DrawerPosition } from '../../../Types/DrawerPosition';
import type { IOverlayElement } from '../Abstracts/OverlayElement';
import { type IDrawerServiceConfig, type IDrawerBehavior } from './IDrawerServiceConfig';
/**
 * CSS class name applied to drawers that are stacked (have another drawer on top).
 *
 * @public
 */
export declare const DRAWER_STACKED_CLASS = "stacked";
/**
 * Function type for resolving drawer results.
 *
 * @public
 */
export type DrawerResolveFunction = (result: unknown) => void;
/**
 * Represents the `IDrawerRef` interface.
 *
 * @public
 */
export interface IDrawerRef {
    readonly drawerId: string;
    readonly drawerElement: DrawerElement;
    readonly portalProjectionElement: PortalProjectionElement;
    readonly wrapperElement: HTMLElement;
    readonly stackLevel: number;
    readonly computedWidth: string;
    readonly options?: IDrawerOptions;
    resolve?: DrawerResolveFunction;
}
/**
 * Interface for Drawer options.
 *
 * @public
 */
export interface IDrawerOptions extends Omit<Partial<IDrawerElementProps>, 'position'>, Partial<IPortalElementProps> {
    /**
     * The position of the drawer.
     * Supports 'auto' to automatically use the same position as the last opened drawer.
     * Falls back to default position if no drawer is currently open.
     */
    position?: DrawerPosition | 'auto';
    /**
     * Whether to close the drawer when navigating away.
     */
    navigateToClose?: boolean;
    /**
     * Enable stack mode for this drawer.
     * When enabled, the drawer width will be calculated based on its position in the stack.
     */
    enableStack?: boolean;
    /**
     * Override the base width for this specific drawer in the stack.
     * If not provided, uses the service's stack configuration.
     */
    stackBaseWidth?: string;
}
/**
 * Service for managing the display and behavior of drawer elements.
 * Provides methods to open and close drawer elements within a portal structure.
 * Supports extensible behavior pattern for customizing drawer interactions.
 *
 * @example
 * ```typescript
 * // Configure service globally before use
 * DrawerService.configure({
 *     behaviors: [withDrawerStackBehavior({ baseWidth: '80%' })],
 *     closeOnNavigation: true
 * });
 *
 * // Use the singleton instance
 * const result = await DrawerService.instance.open('myDrawer', MyDrawerWrapper, options);
 * ```
 *
 * @public
 */
export declare class DrawerService {
    private static _instance;
    private static _config;
    private static _isConfigured;
    private readonly _drawerRefMap;
    private readonly _drawerStack;
    private readonly _behaviors;
    private _portalElement?;
    /**
     * Constructs a new instance of the `DrawerService` class.
     * Use {@link DrawerService.instance} to access the singleton instance.
     *
     * @private
     */
    private constructor();
    /**
     * Returns the singleton instance of the DrawerService.
     * Creates the instance on first access using the current configuration.
     *
     * @public
     * @readonly
     */
    static get instance(): DrawerService;
    /**
     * Returns the current number of open drawers in the stack.
     *
     * @public
     * @readonly
     */
    get stackSize(): number;
    /**
     * Returns an array of all drawer references in stack order (oldest first).
     *
     * @public
     * @readonly
     */
    get stack(): ReadonlyArray<IDrawerRef>;
    /**
     * Returns the registered behaviors for this service instance.
     *
     * @public
     * @readonly
     */
    get behaviors(): ReadonlyArray<IDrawerBehavior>;
    /**
     * Configures the drawer service globally.
     * Must be called before accessing the singleton instance.
     *
     * @public
     * @static
     * @param config - Configuration options for the drawer service.
     * @returns The DrawerService class for chaining.
     * @throws Error if called after the instance has already been created.
     *
     * @example
     * ```typescript
     * DrawerService.configure({
     *     behaviors: [withDrawerStackBehavior({ baseWidth: '80%' })],
     *     closeOnNavigation: true
     * });
     * ```
     */
    static configure(config: Partial<IDrawerServiceConfig>): typeof DrawerService;
    /**
     * Opens a custom wrapper component containing a drawer within a portal.
     *
     * @public
     * @template T - Type of the wrapper component extending HTMLElement.
     * @template TData - Type of data provided to the wrapper component.
     * @template TResult - Expected return type of the resolved drawer result.
     * @param drawerId - Unique identifier for the drawer instance.
     * @param wrapperClass - Class of the wrapper component containing the drawer.
     * @param options - Properties for portal and drawer.
     * @param data - Optional data passed to the wrapper component.
     * @returns A promise resolving with the drawer result.
     */
    open<T extends HTMLElement, TData, TResult>(drawerId: string, wrapperClass: new (args?: TData) => T, options?: IDrawerOptions, data?: TData): Promise<TResult>;
    /**
     * Closes the drawer in the wrapper component and optionally removes the wrapper from the DOM.
     *
     * @public
     * @template TResult - Type of result returned when the drawer is closed.
     * @param {string} drawerId - Unique identifier for the drawer instance.
     * @param {TResult} [result] - Optional result returned when closing the drawer.
     * @returns {Promise<void>} A promise resolving once the drawer is fully closed.
     */
    close<TResult>(drawerId: string, result?: TResult): Promise<void>;
    /**
     * Closes the topmost drawer in the stack.
     *
     * @public
     * @template TResult - Type of result returned when the drawer is closed.
     * @param {TResult} [result] - Optional result returned when closing the drawer.
     * @returns {Promise<void>} A promise resolving once the drawer is fully closed.
     */
    closeTop<TResult>(result?: TResult): Promise<void>;
    /**
     * Closes all open drawers in the stack, from top to bottom.
     *
     * @public
     * @returns {Promise<void>} A promise resolving once all drawers are closed.
     */
    closeAll(): Promise<void>;
    /**
     * Returns the drawer element with the specified ID if it exists.
     * For example, all drawer elements will be automatically registered (by id) when its available in the DOM.
     * With this method, you can get the drawer element by its ID and call its methods directly.
     *
     * @public
     */
    tryGet(drawerId: string): IOverlayElement | undefined;
    /**
     * Creates a new drawer reference.
     *
     * @private
     */
    private createDrawerRef;
    /**
     * Extends the drawer component by placing it within a portal structure.
     *
     * @private
     * @param portalProps - Properties to set on the portal.
     * @param element - The element to place within the portal.
     * @returns The created PortalElement containing the drawer.
     */
    private extendToPortal;
    /**
     * Resolves the drawer position, handling 'auto' by returning the last drawer's position.
     *
     * @private
     * @param requestedPosition - The requested position, which may be 'auto'.
     * @returns The resolved position ('left', 'right', 'top', or 'bottom').
     */
    private resolvePosition;
}
//# sourceMappingURL=DrawerService.d.ts.map