import * as _angular_core from '@angular/core';
import { OnDestroy, TemplateRef, InjectionToken, EnvironmentProviders } from '@angular/core';

type CountdownFormatFn = (opt: CountdownFormatFnOption) => string;
interface CountdownFormatFnOption {
    date: number;
    formatStr: string;
    timezone?: string;
}
declare enum CountdownStatus {
    ing = 0,
    pause = 1,
    stop = 2,
    done = 3
}
interface CountdownConfig {
    /**
     * Start the counter on demand, must call `begin()` to starting, Default: `false`
     */
    demand?: boolean;
    /**
     * Calculate the remaining time based on the server, e.g: `10`,`5.5`, (Unit: seconds)
     */
    leftTime?: number;
    /**
     * Refers to counting down from local time to end time (Unit: Milliseconds second UNIX timestamp)
     */
    stopTime?: number;
    /**
     * Formats a date value, pls refer to [Accepted patterns](https://angular.io/api/common/DatePipe#usage-notes), Default: `HH:mm:ss`
     */
    format?: string;
    /**
     * Beautify text, generally used to convert formatted time text into HTML
     */
    prettyText?: (text: string) => string;
    /**
     * Should be trigger type `notify` event on the x second. When values is `0` will be trigger every time.
     */
    notify?: number[] | number;
    /**
     * Default based on the implementation of `formatDate` in `@angular/common`
     *
     * You can changed to other libs, e.g: [date-fns](https://date-fns.org/v2.0.1/docs/format)
     */
    formatDate?: CountdownFormatFn;
    /**
     * A timezone offset (such as '+0430'), or a standard UTC/GMT.
     * When not supplied, uses the end-user's local system timezone, Default: `+0000`
     */
    timezone?: string;
}
type CountdownEventAction = 'start' | 'stop' | 'restart' | 'pause' | 'resume' | 'notify' | 'done';
interface CountdownEvent {
    action: CountdownEventAction;
    status: CountdownStatus;
    left: number;
    text: string;
}
interface CountdownItem {
    text?: string;
    value?: number;
}

declare class CountdownComponent implements OnDestroy {
    private readonly locale;
    private readonly timer;
    private readonly defCog;
    private frequency;
    private readonly _notify;
    private status;
    private isDestroy;
    private _config?;
    private left;
    readonly i: _angular_core.WritableSignal<CountdownItem>;
    readonly config: _angular_core.InputSignalWithTransform<CountdownConfig, CountdownConfig>;
    readonly render: _angular_core.InputSignal<TemplateRef<{
        $implicit: CountdownItem;
    }> | undefined>;
    readonly event: _angular_core.OutputEmitterRef<CountdownEvent>;
    constructor();
    /**
     * Start countdown, you must manually call when `demand: false`
     */
    begin(): void;
    /**
     * Restart countdown
     */
    restart(): void;
    /**
     * Stop countdown, must call `restart` when stopped, it's different from pause, unable to recover
     */
    stop(): void;
    /**
     * Pause countdown, you can use `resume` to recover again
     */
    pause(): void;
    /**
     * Resume countdown
     */
    resume(): void;
    private callEvent;
    private init;
    private destroy;
    /**
     * 更新时钟
     */
    private reflow;
    /**
     * 获取倒计时剩余帧数
     */
    private getLeft;
    ngOnDestroy(): void;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<CountdownComponent, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<CountdownComponent, "countdown", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; "render": { "alias": "render"; "required": false; "isSignal": true; }; }, { "event": "event"; }, never, never, true, never>;
}

declare class CountdownTimer {
    private fns;
    private commands;
    private nextTime;
    private ing;
    start(): void;
    private process;
    add(fn: () => void, frequency: number): this;
    remove(fn: () => void): this;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<CountdownTimer, never>;
    static ɵprov: _angular_core.ɵɵInjectableDeclaration<CountdownTimer>;
}

declare const COUNTDOWN_CONFIG: InjectionToken<CountdownConfig>;
declare function provideCountdown(config?: CountdownConfig): EnvironmentProviders;

export { COUNTDOWN_CONFIG, CountdownComponent, CountdownStatus, CountdownTimer, provideCountdown };
export type { CountdownConfig, CountdownEvent, CountdownEventAction, CountdownFormatFn, CountdownFormatFnOption, CountdownItem };
