import { IndexableObject, NzSafeAny } from 'ng-zorro-antd/core/types';
import * as i0 from '@angular/core';
import { InjectionToken, Type, EnvironmentProviders } from '@angular/core';
import { Subject, Observable } from 'rxjs';
import { Locale } from 'date-fns';

/**
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */

/** Type for week day index (0 = Sunday, 1 = Monday, etc.) */
type WeekDayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;
/** Configuration for date-related features. */
interface NzDateConfig {
    /** Customize the first day of a week. */
    firstDayOfWeek?: WeekDayIndex;
}
/** Injection token for date configuration. */
declare const NZ_DATE_CONFIG: InjectionToken<NzDateConfig>;
/** Injection token for the date locale used by the configured date adapter. */
declare const NZ_DATE_LOCALE: InjectionToken<unknown>;
/** Default date configuration. */
declare const NZ_DATE_CONFIG_DEFAULT: NzDateConfig;
/** Merges user config with default config. */
declare function mergeDateConfig(config: NzDateConfig | null): NzDateConfig;

/**
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */

/**
 * @deprecated Will be removed in v23.
 */
type CandyDateMode = 'decade' | 'year' | 'quarter' | 'month' | 'day' | 'hour' | 'minute' | 'second';
/**
 * @deprecated Use `NzDateAdapter` directly instead. Will be removed in v23.
 */
type NormalizedMode = 'decade' | 'year' | 'month';
/**
 * @deprecated Use `Date` and `NzDateAdapter` directly instead. Will be removed in v23.
 */
type CandyDateType = CandyDate | Date | null | undefined;
/**
 * @deprecated Use `Date | null` directly instead. Will be removed in v23.
 */
type SingleValue = CandyDate | null;
/**
 * @deprecated Use `Date | null` or `(Date | null)[]` directly instead. Will be removed in v23.
 */
type CompatibleValue = SingleValue | SingleValue[];
/**
 * @deprecated Will be removed in v23.
 */
declare function wrongSortOrder(rangeValue: SingleValue[]): boolean;
/**
 * @deprecated Use `NzDateAdapter` directly instead. Will be removed in v23.
 */
declare function normalizeRangeValue(value: SingleValue[], hasTimePicker: boolean, type?: NormalizedMode, activePart?: 'left' | 'right'): CandyDate[];
/**
 * @deprecated Use `Date` cloning directly instead. Will be removed in v23.
 */
declare function cloneDate(value: CompatibleValue): CompatibleValue;
/**
 * Wrapping kind APIs for date operating and unify
 * NOTE: every new API return new CandyDate object without side effects to the former Date object
 * NOTE: most APIs are based on local time other than customized locale id (this needs tobe support in future)
 * TODO: support format() against to angular's core API
 *
 * @deprecated Use `NzDateAdapter` directly instead. Will be removed in v23.
 */
declare class CandyDate implements IndexableObject {
    nativeDate: Date;
    constructor(date?: Date | string | number);
    calendarStart(options?: {
        weekStartsOn: WeekDayIndex | undefined;
    }): CandyDate;
    getYear(): number;
    getMonth(): number;
    getDay(): number;
    getTime(): number;
    getDate(): number;
    getHours(): number;
    getMinutes(): number;
    getSeconds(): number;
    getMilliseconds(): number;
    clone(): CandyDate;
    setHms(hour: number, minute: number, second: number): CandyDate;
    setYear(year: number): CandyDate;
    addYears(amount: number): CandyDate;
    setMonth(month: number): CandyDate;
    addMonths(amount: number): CandyDate;
    setDay(day: number, options?: {
        weekStartsOn: WeekDayIndex;
    }): CandyDate;
    setDate(amount: number): CandyDate;
    getQuarter(): number;
    setQuarter(quarter: number): CandyDate;
    addDays(amount: number): CandyDate;
    add(amount: number, mode: NormalizedMode): CandyDate;
    isSame(date: CandyDateType, grain?: CandyDateMode): boolean;
    isSameYear(date: CandyDateType): boolean;
    isSameQuarter(date: CandyDateType): boolean;
    isSameMonth(date: CandyDateType): boolean;
    isSameDay(date: CandyDateType): boolean;
    isSameHour(date: CandyDateType): boolean;
    isSameMinute(date: CandyDateType): boolean;
    isSameSecond(date: CandyDateType): boolean;
    isBefore(date: CandyDateType, grain?: CandyDateMode): boolean;
    isBeforeYear(date: CandyDateType): boolean;
    isBeforeQuarter(date: CandyDateType): boolean;
    isBeforeMonth(date: CandyDateType): boolean;
    isBeforeDay(date: CandyDateType): boolean;
    isToday(): boolean;
    isValid(): boolean;
    isFirstDayOfMonth(): boolean;
    isLastDayOfMonth(): boolean;
    private toNativeDate;
}

/**
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */
declare const timeUnits: Array<[string, number]>;

/**
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */

/**
 * Injection token for providing a custom NzDateAdapter implementation.
 */
declare const NZ_DATE_ADAPTER: InjectionToken<Type<NzDateAdapter<unknown, unknown>>>;
/** Configuration for a date adapter provider. */
interface NzDateAdapterConfig<TLocale = unknown> extends NzDateConfig {
    /** Locale value used by the configured date adapter. */
    locale?: TLocale;
}
/**
 * Provides a custom NzDateAdapter implementation.
 * Use this when you want to provide your own adapter implementation.
 *
 * @param adapterClass The adapter class to use (must extend NzDateAdapter)
 * @param config Optional configuration for the adapter
 * @returns EnvironmentProviders for the adapter
 *
 * @example
 * ```typescript
 * export const appConfig: ApplicationConfig = {
 *   providers: [provideNzDateAdapter(JalaliDateAdapter, { locale: faIR, firstDayOfWeek: 6 })]
 * };
 * ```
 */
declare function provideNzDateAdapter<TDate, TLocale, TAdapter extends NzDateAdapter<TDate, TLocale>>(adapterClass: Type<TAdapter>, config?: NzDateAdapterConfig<TLocale>): EnvironmentProviders;
/**
 * NzDateAdapter is the abstraction boundary between ng-zorro-antd and any date library.
 *
 * CONTRACT FOR SUBCLASS AUTHORS:
 *
 * - You MUST implement all abstract methods.
 * - You MAY override derived methods for efficiency.
 * - You MAY override optional methods to opt into features.
 *
 * @see https://github.com/angular/components/blob/main/src/material/core/datetime/date-adapter.ts
 */
declare abstract class NzDateAdapter<TDate, TLocale = unknown> {
    /** The current locale. */
    protected locale: TLocale;
    protected readonly _localeChanges: Subject<void>;
    /** Stream that emits when the locale changes. */
    readonly localeChanges: Observable<void>;
    /** Gets today's date. */
    abstract today(): TDate;
    /** Gets a date instance representing the given year, month, and day. */
    abstract createDate(year: number, month: number, date: number): TDate;
    /** Clones the given date. */
    abstract clone(date: TDate): TDate;
    /** Gets the year component of the given date. */
    abstract getYear(date: TDate): number;
    /** Gets the month component of the given date (0-indexed, 0 = January). */
    abstract getMonth(date: TDate): number;
    /** Gets the date of the month component of the given date (1-indexed). */
    abstract getDate(date: TDate): number;
    /** Gets the day of the week component of the given date (0-indexed, 0 = Sunday). */
    abstract getDayOfWeek(date: TDate): number;
    /** Gets the number of days in the month of the given date. */
    abstract getNumDaysInMonth(date: TDate): number;
    /** Gets the name of the month for the given date. */
    abstract getYearName(date: TDate): string;
    /** Gets a list of month names for the given style. */
    abstract getMonthNames(style: 'long' | 'short' | 'narrow'): string[];
    /** Gets a list of date names (e.g. '1', '2', ... '31'). */
    abstract getDateNames(): string[];
    /** Gets a list of day of the week names for the given style. */
    abstract getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[];
    /** Gets the first day of the week (0 = Sunday, 1 = Monday, etc.). */
    abstract getFirstDayOfWeek(): number;
    /** Adds the specified number of years to the given date. */
    abstract addCalendarYears(date: TDate, years: number): TDate;
    /** Adds the specified number of months to the given date. */
    abstract addCalendarMonths(date: TDate, months: number): TDate;
    /** Adds the specified number of days to the given date. */
    abstract addCalendarDays(date: TDate, days: number): TDate;
    /** Formats a date as a string according to the given display format. */
    abstract format(date: TDate, displayFormat: NzSafeAny): string;
    /** Parses a value into a date. */
    abstract parse(value: NzSafeAny, parseFormat: NzSafeAny): TDate | null;
    /** Checks whether the given object is a date instance. */
    abstract isDateInstance(obj: NzSafeAny): boolean;
    /** Checks whether the given date is valid. */
    abstract isValid(date: TDate): boolean;
    /** Gets a date instance representing an invalid date. */
    abstract invalid(): TDate;
    /** Gets the quarter component of the given date (1-4). */
    abstract getQuarter(date: TDate): number;
    /** Sets the quarter of the given date. */
    abstract setQuarter(date: TDate, quarter: number): TDate;
    /** Gets the start of the quarter for the given date. */
    abstract startOfQuarter(date: TDate): TDate;
    /** Gets the ISO week number for the given date. */
    abstract getISOWeek(date: TDate): number;
    /** Sets the year of the given date. */
    abstract setYear(date: TDate, year: number): TDate;
    /** Sets the month of the given date (0-indexed). */
    abstract setMonth(date: TDate, month: number): TDate;
    /** Sets the day of the month of the given date (1-indexed). */
    abstract setDate(date: TDate, day: number): TDate;
    /** Sets the locale used for formatting and parsing. */
    setLocale(locale: TLocale): void;
    /**
     * Attempts to deserialize a value to a valid date object.
     * Accepts ISO 8601 strings, Date objects, or null/undefined.
     */
    deserialize(value: NzSafeAny): TDate | null;
    /** Gets a valid date object if possible, otherwise returns null. */
    getValidDateOrNull(obj: unknown): TDate | null;
    /** Compares two dates, returning a number indicating their relative order. */
    compareDate(first: TDate, second: TDate): number;
    /** Checks whether two dates represent the same calendar day. */
    sameDate(first: TDate | null, second: TDate | null): boolean;
    /** Clamps a date between min and max bounds. */
    clampDate(date: TDate, min?: TDate | null, max?: TDate | null): TDate;
    /** Gets the calendar's start of month (first day at midnight). */
    calendarStartOfMonth(date: TDate): TDate;
    /** Gets the calendar's start of week. */
    calendarStartOfWeek(date: TDate): TDate;
    /** Checks whether the given date is the first day of its month. */
    isFirstDayOfMonth(date: TDate): boolean;
    /** Checks whether the given date is the last day of its month. */
    isLastDayOfMonth(date: TDate): boolean;
    /** Checks whether the given date is today. */
    isToday(date: TDate): boolean;
    /** Sets the time on the given date. */
    setTime(_date: TDate, _hours: number, _minutes: number, _seconds: number): TDate;
    /** Gets the hours component of the given date. */
    getHours(_date: TDate): number;
    /** Gets the minutes component of the given date. */
    getMinutes(_date: TDate): number;
    /** Gets the seconds component of the given date. */
    getSeconds(_date: TDate): number;
    /** Parses a time value into a date. */
    parseTime(_value: NzSafeAny, _parseFormat?: NzSafeAny): TDate | null;
    /** Adds the specified number of seconds to the given date. */
    addSeconds(_date: TDate, _amount: number): TDate;
    /** Compares two times, returning a number indicating their relative order. */
    compareTime(first: TDate, second: TDate): number;
    /** Checks whether two dates represent the same time (same hour, minute, second). */
    sameTime(first: TDate | null, second: TDate | null): boolean;
    /** Gets the milliseconds component of the given date. */
    getMilliseconds(_date: TDate): number;
    /** Gets the timestamp (milliseconds since epoch) of the given date. */
    getTime(_date: TDate): number;
    /** Gets the calendar system identifier for the given date. */
    getCalendarId(_date: TDate): string;
    /** Gets the timezone offset for the given date. */
    getTimezoneOffset(_date: TDate): number;
    /**
     * @deprecated Use `addCalendarYears` instead. Will be removed in v23.
     */
    addYears(date: TDate, amount: number): TDate;
    /**
     * @deprecated Use `addCalendarMonths` instead. Will be removed in v23.
     */
    addMonths(date: TDate, amount: number): TDate;
    /**
     * @deprecated Use `addCalendarDays` instead. Will be removed in v23.
     */
    addDays(date: TDate, amount: number): TDate;
    /**
     * @deprecated Use `getNumDaysInMonth` instead. Will be removed in v23.
     */
    getDaysInMonth(date: TDate): number;
    /**
     * @deprecated Use `getDayOfWeek` instead. Will be removed in v23.
     */
    getDay(date: TDate): number;
}

/**
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */

/** Configuration for date-fns date adapter. */
interface NzDateFnsAdapterConfig extends NzDateAdapterConfig<Locale> {
    /** Locale object from date-fns. */
    locale?: Locale;
}
/**
 * Date adapter for date-fns.
 *
 * To use this adapter, add `provideNzDateFnsAdapter()` to your application providers.
 *
 * @note Requires date-fns as a peer dependency.
 */
declare class DateFnsDateAdapter extends NzDateAdapter<Date, Locale> {
    private readonly dateLocale;
    private readonly dateConfig;
    constructor();
    today(): Date;
    createDate(year: number, month: number, date: number): Date;
    clone(date: Date): Date;
    getYear(date: Date): number;
    getMonth(date: Date): number;
    getDate(date: Date): number;
    getDayOfWeek(date: Date): number;
    getNumDaysInMonth(date: Date): number;
    getYearName(date: Date): string;
    getMonthNames(style: 'long' | 'short' | 'narrow'): string[];
    getDateNames(): string[];
    getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[];
    getFirstDayOfWeek(): number;
    addCalendarYears(date: Date, years: number): Date;
    addCalendarMonths(date: Date, months: number): Date;
    addCalendarDays(date: Date, days: number): Date;
    format(date: Date, displayFormat: NzSafeAny): string;
    parse(value: NzSafeAny, parseFormat: NzSafeAny): Date | null;
    isDateInstance(obj: NzSafeAny): boolean;
    isValid(date: Date): boolean;
    invalid(): Date;
    getQuarter(date: Date): number;
    setQuarter(date: Date, quarter: number): Date;
    startOfQuarter(date: Date): Date;
    getISOWeek(date: Date): number;
    setYear(date: Date, year: number): Date;
    setMonth(date: Date, month: number): Date;
    setDate(date: Date, day: number): Date;
    setTime(date: Date, hours: number, minutes: number, seconds: number): Date;
    getHours(date: Date): number;
    getMinutes(date: Date): number;
    getSeconds(date: Date): number;
    parseTime(value: NzSafeAny, parseFormat?: NzSafeAny): Date | null;
    addSeconds(date: Date, amount: number): Date;
    getMilliseconds(date: Date): number;
    getTime(date: Date): number;
    isFirstDayOfMonth(date: Date): boolean;
    isLastDayOfMonth(date: Date): boolean;
    isToday(date: Date): boolean;
    calendarStartOfMonth(date: Date): Date;
    calendarStartOfWeek(date: Date): Date;
    static ɵfac: i0.ɵɵFactoryDeclaration<DateFnsDateAdapter, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<DateFnsDateAdapter>;
}
/**
 * Provides the DateFnsDateAdapter as the NzDateAdapter implementation.
 * DateFnsDateAdapter uses date-fns library for date operations.
 *
 * @param config Optional configuration for the adapter
 * @returns EnvironmentProviders for the DateFnsDateAdapter
 *
 * @example
 * ```typescript
 * export const appConfig: ApplicationConfig = {
 *   providers: [provideNzDateFnsAdapter({ locale: enUS, firstDayOfWeek: 1 })]
 * };
 * ```
 *
 * @note Requires date-fns as a peer dependency.
 */
declare function provideNzDateFnsAdapter(config?: NzDateFnsAdapterConfig): EnvironmentProviders;

/**
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */

/** Configuration for native date adapter. */
interface NzNativeDateAdapterConfig extends NzDateAdapterConfig<string> {
    /** Locale string used by Intl.DateTimeFormat. */
    locale?: string;
}
/**
 * Date adapter using native Date and Intl.DateTimeFormat.
 * Fully aligned with Angular Material's NativeDateAdapter implementation.
 */
declare class NativeDateAdapter extends NzDateAdapter<Date, string> {
    private readonly dateLocale;
    private readonly dateConfig;
    constructor();
    getYear(date: Date): number;
    getMonth(date: Date): number;
    getDate(date: Date): number;
    getDayOfWeek(date: Date): number;
    getMonthNames(style: 'long' | 'short' | 'narrow'): string[];
    getDateNames(): string[];
    getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[];
    getYearName(date: Date): string;
    getFirstDayOfWeek(): number;
    getNumDaysInMonth(date: Date): number;
    clone(date: Date): Date;
    createDate(year: number, month: number, date: number): Date;
    today(): Date;
    parse(value: NzSafeAny, parseFormat: NzSafeAny): Date | null;
    format(date: Date, displayFormat: NzSafeAny): string;
    addCalendarYears(date: Date, years: number): Date;
    addCalendarMonths(date: Date, months: number): Date;
    addCalendarDays(date: Date, days: number): Date;
    deserialize(value: NzSafeAny): Date | null;
    isDateInstance(obj: NzSafeAny): boolean;
    isValid(date: Date): boolean;
    invalid(): Date;
    getQuarter(date: Date): number;
    setQuarter(date: Date, quarter: number): Date;
    startOfQuarter(date: Date): Date;
    getISOWeek(date: Date): number;
    setYear(date: Date, year: number): Date;
    setMonth(date: Date, month: number): Date;
    setDate(date: Date, day: number): Date;
    setTime(target: Date, hours: number, minutes: number, seconds: number): Date;
    getHours(date: Date): number;
    getMinutes(date: Date): number;
    getSeconds(date: Date): number;
    parseTime(userValue: NzSafeAny, parseFormat?: NzSafeAny): Date | null;
    addSeconds(date: Date, amount: number): Date;
    getMilliseconds(date: Date): number;
    getTime(date: Date): number;
    getCalendarId(_date: Date): string;
    isFirstDayOfMonth(date: Date): boolean;
    isLastDayOfMonth(date: Date): boolean;
    isToday(date: Date): boolean;
    calendarStartOfMonth(date: Date): Date;
    calendarStartOfWeek(date: Date): Date;
    /**
     * Creates a date allowing for month/date overflow (e.g., Jan 32 becomes Feb 1).
     * This is how Material handles date creation internally.
     */
    private _createDateWithOverflow;
    /** Pads a number to two digits for ISO formatting. */
    private _2digit;
    /**
     * Formats a date using Intl.DateTimeFormat while avoiding DST issues.
     * Uses UTC internally to ensure consistent formatting across timezones.
     */
    private _format;
    /**
     * Parses time strings in various formats (10:30, 10:30:45, 10:30 AM, etc.)
     * Returns null if the string cannot be parsed.
     */
    private _parseTimeString;
    /**
     * Parses the date-fns-style token subset used by NG-ZORRO default formats.
     * This intentionally stays small; complex calendar parsing belongs in custom adapters.
     */
    private parseByToken;
    private createDateOrInvalid;
    private escapeRegex;
    /**
     * Formats a date using date-fns-style token strings.
     * This is a NG-ZORRO extension for compatibility with existing formats.
     */
    private formatByToken;
    static ɵfac: i0.ɵɵFactoryDeclaration<NativeDateAdapter, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<NativeDateAdapter>;
}
/**
 * Provides the NativeDateAdapter as the NzDateAdapter implementation.
 * NativeDateAdapter uses native Date and Intl.DateTimeFormat.
 *
 * @param config Optional configuration for the adapter
 * @returns EnvironmentProviders for the NativeDateAdapter
 *
 * @example
 * ```typescript
 * export const appConfig: ApplicationConfig = {
 *   providers: [provideNzNativeDateAdapter({ locale: 'en-US', firstDayOfWeek: 0 })]
 * };
 * ```
 */
declare function provideNzNativeDateAdapter(config?: NzNativeDateAdapterConfig): EnvironmentProviders;

/**
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */
interface TimeResult {
    hour: number | null;
    minute: number | null;
    second: number | null;
    period: number | null;
}
declare class NgTimeParser {
    private format;
    private localeId;
    regex: RegExp;
    matchMap: Record<string, null | number>;
    constructor(format: string, localeId: string);
    toDate(str: string): Date;
    getTimeResult(str: string): TimeResult | null;
    genRegexp(): void;
}

export { CandyDate, DateFnsDateAdapter, NZ_DATE_ADAPTER, NZ_DATE_CONFIG, NZ_DATE_CONFIG_DEFAULT, NZ_DATE_LOCALE, NativeDateAdapter, NzDateAdapter, cloneDate, mergeDateConfig, normalizeRangeValue, provideNzDateAdapter, provideNzDateFnsAdapter, provideNzNativeDateAdapter, timeUnits, wrongSortOrder, NgTimeParser as ɵNgTimeParser };
export type { CandyDateMode, CandyDateType, CompatibleValue, NormalizedMode, NzDateAdapterConfig, NzDateConfig, NzDateFnsAdapterConfig, NzNativeDateAdapterConfig, SingleValue, WeekDayIndex, TimeResult as ɵTimeResult };
