import * as _angular_core from '@angular/core';
import { Signal, OnInit, ElementRef } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { ZPopoverControl } from '@shival99/z-ui/components/z-popover';
import { ZSelectOption } from '@shival99/z-ui/components/z-select';
import { ZEvent } from '@shival99/z-ui/utils';
import { ClassValue } from 'clsx';
import * as class_variance_authority_types from 'class-variance-authority/types';

interface ZCalendarDay {
    date: Date;
    day: number;
    isCurrentMonth: boolean;
    isToday: boolean;
    isDisabled: boolean;
    isSelected: boolean;
    isInRange: boolean;
    isRangeStart: boolean;
    isRangeEnd: boolean;
    isHovered: boolean;
}
interface ZDateRange {
    start: Date | null;
    end: Date | null;
}
type ZCalendarMode = 'single' | 'range' | 'time' | 'month' | 'year' | 'quarter';
type ZCalendarValueType = 'date' | 'iso' | 'string';
type ZCalendarView = 'day' | 'month' | 'year' | 'quarter';
type ZCalendarSize = 'sm' | 'default' | 'lg';
interface ZQuickSelectPreset {
    key: string;
    label: string;
    getValue: () => ZDateRange | Date | null;
}
interface ZCalendarControl {
    /** Trigger validation and return true if valid */
    valid: () => boolean;
    /**
     * Trigger validation and return true if has error.
     * @deprecated Use `valid()` for boolean form-submit checks.
     */
    validate: () => boolean;
    /** Reset component to initial state */
    reset: () => void;
    /** Focus the calendar trigger */
    focus: () => void;
    /** Blur the calendar trigger */
    blur: () => void;
    /** Open the calendar popup */
    open: () => void;
    /** Close the calendar popup */
    close: () => void;
    /** Clear the selected value */
    clear: () => void;
    /** Set custom error message (useful for server-side validation). Pass null to clear. */
    setErrorMessage: (message: string | null) => void;
    /** Signal indicating if component has validation error */
    hasError: Signal<boolean>;
    /** Signal indicating if popup is open */
    isOpen: Signal<boolean>;
    /** Signal with current value */
    value: Signal<ZCalendarValue>;
    /** Signal with current error message */
    errorMessage: Signal<string>;
}
type ZCalendarValue = Date | ZDateRange | string | null;
interface ZCalendarValidator {
    error: string;
    message: string;
    validate: (value: ZCalendarValue) => boolean;
}
interface ZEndTimeContext {
    isSameDay: boolean;
    startHour: number;
    startMinute: number;
    startSecond: number;
    endHour: number;
    endMinute: number;
    timeFormat: '12h' | '24h';
    startPeriod: 'AM' | 'PM';
    endPeriod: 'AM' | 'PM';
}
interface ZMonthDisabledContext {
    currentYear: number;
    endYear: number;
    endMonthIndex: number;
    isRangeMode: boolean;
    disabledDateFn: ((date: Date) => boolean) | null;
}
interface ZEndMonthDisabledContext {
    startYear: number;
    startMonthIndex: number;
    endYear: number;
    isRangeMode: boolean;
    disabledDateFn: ((date: Date) => boolean) | null;
}
interface ZYearDisabledContext {
    endYear: number;
    startMonthIndex: number;
    endMonthIndex: number;
    isRangeMode: boolean;
    disabledDateFn: ((date: Date) => boolean) | null;
}
interface ZEndYearDisabledContext {
    startYear: number;
    startMonthIndex: number;
    endMonthIndex: number;
    isRangeMode: boolean;
    disabledDateFn: ((date: Date) => boolean) | null;
}
interface ZCalendarTimeConfig {
    hour: number;
    minute: number;
    second: number;
}
type ZCalendarDefaultTime = 'current' | 'start' | 'end' | ZCalendarTimeConfig;
interface ZCalendarRangeDefaultTime {
    start?: ZCalendarDefaultTime;
    end?: ZCalendarDefaultTime;
}

declare class ZCalendarComponent implements OnInit, ControlValueAccessor {
    readonly class: _angular_core.InputSignal<ClassValue>;
    readonly zMode: _angular_core.InputSignal<ZCalendarMode>;
    readonly zSize: _angular_core.InputSignal<ZCalendarSize>;
    readonly zLabel: _angular_core.InputSignal<string>;
    readonly zLabelClass: _angular_core.InputSignal<string>;
    readonly zPlaceholder: _angular_core.InputSignal<string | null>;
    readonly zRequired: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zDisabled: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zReadonly: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zShowTime: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zTimeFormat: _angular_core.InputSignal<"12h" | "24h">;
    readonly zShowHour: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zShowMinute: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zShowSecond: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zQuickSelect: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zAllowEdit: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zShortTime: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zAllowClear: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zFormat: _angular_core.InputSignal<string>;
    readonly zMinDate: _angular_core.InputSignal<Date | null>;
    readonly zMaxDate: _angular_core.InputSignal<Date | null>;
    readonly zValueType: _angular_core.InputSignal<ZCalendarValueType>;
    readonly zValidators: _angular_core.InputSignal<ZCalendarValidator[]>;
    readonly zShowOk: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zOkText: _angular_core.InputSignal<string | null>;
    readonly zShowCancel: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zCancelText: _angular_core.InputSignal<string | null>;
    readonly zDisabledDate: _angular_core.InputSignal<((date: Date) => boolean) | null>;
    readonly zScrollClose: _angular_core.InputSignalWithTransform<boolean, string | boolean>;
    readonly zDefaultTime: _angular_core.InputSignal<ZCalendarDefaultTime | null>;
    readonly zRangeDefaultTime: _angular_core.InputSignal<ZCalendarRangeDefaultTime | null>;
    readonly zControl: _angular_core.OutputEmitterRef<ZCalendarControl>;
    readonly zChange: _angular_core.OutputEmitterRef<ZCalendarValue>;
    readonly zOnBlur: _angular_core.OutputEmitterRef<FocusEvent>;
    readonly zOnFocus: _angular_core.OutputEmitterRef<FocusEvent>;
    readonly zEvent: _angular_core.OutputEmitterRef<ZEvent>;
    protected readonly triggerRef: _angular_core.Signal<ElementRef<HTMLDivElement> | undefined>;
    protected readonly inputRef: _angular_core.Signal<ElementRef<HTMLInputElement> | undefined>;
    protected readonly pickerId: string;
    protected readonly weekdayNames: _angular_core.Signal<string[]>;
    protected readonly monthNames: _angular_core.Signal<string[]>;
    protected readonly quickSelectPresets: ZQuickSelectPreset[];
    protected readonly hourOptions: _angular_core.Signal<number[]>;
    protected readonly minuteOptions: number[];
    protected readonly secondOptions: number[];
    protected readonly formattedHour: _angular_core.Signal<string>;
    protected readonly formattedMinute: _angular_core.Signal<string>;
    protected readonly formattedSecond: _angular_core.Signal<string>;
    protected readonly displayHour: _angular_core.Signal<number>;
    protected readonly displayHourEnd: _angular_core.Signal<number>;
    private readonly _popoverControl;
    private readonly _selectedDate;
    private readonly _rangeStart;
    private readonly _rangeEnd;
    private readonly _currentMonth;
    private readonly _endMonth;
    private readonly _hourEnd;
    private readonly _minuteEnd;
    private readonly _secondEnd;
    private readonly _periodEnd;
    private readonly _disabled;
    private readonly _formControl;
    private readonly _formStateVersion;
    private readonly _customError;
    private readonly _backupSelectedDate;
    private readonly _backupRangeStart;
    private readonly _backupRangeEnd;
    private readonly _backupActivePresetKey;
    private readonly _backupShortDisplayPresetKey;
    private readonly _appliedViaOk;
    private readonly _hasTypedDraft;
    private readonly _skipBlurHandler;
    private readonly _injector;
    private readonly _destroyRef;
    private readonly _zTranslate;
    protected readonly zLocale: _angular_core.Signal<string>;
    private _onChange;
    private _onTouched;
    private _ngControl;
    private readonly _isNgModel;
    protected readonly isOpen: _angular_core.Signal<boolean>;
    protected readonly hoveredDate: _angular_core.WritableSignal<Date | null>;
    protected readonly currentView: _angular_core.WritableSignal<ZCalendarView>;
    protected readonly endView: _angular_core.WritableSignal<ZCalendarView>;
    protected readonly hour: _angular_core.WritableSignal<number>;
    protected readonly minute: _angular_core.WritableSignal<number>;
    protected readonly second: _angular_core.WritableSignal<number>;
    protected readonly period: _angular_core.WritableSignal<"AM" | "PM">;
    protected readonly inputDisplayValue: _angular_core.WritableSignal<string>;
    protected readonly isInputFocused: _angular_core.WritableSignal<boolean>;
    protected readonly activePresetKey: _angular_core.WritableSignal<string | null>;
    protected readonly shortDisplayPresetKey: _angular_core.WritableSignal<string | null>;
    protected readonly quickSelectOptions: _angular_core.Signal<ZSelectOption<string>[]>;
    protected readonly rangeShortDisplayValue: _angular_core.Signal<string>;
    protected readonly uiState: _angular_core.WritableSignal<{
        hasViewChanged: boolean;
        hasEndViewChanged: boolean;
        timeDropdownOpen: boolean;
        timeDropdownEndOpen: boolean;
        isFocused: boolean;
        touched: boolean;
        dirty: boolean;
    }>;
    protected readonly quarterNames: string[];
    protected readonly todayQuarterIndex: _angular_core.Signal<number>;
    protected readonly selectedQuarterIndex: _angular_core.Signal<number>;
    protected readonly isSameDayRange: _angular_core.Signal<boolean>;
    protected readonly isDisabled: _angular_core.Signal<boolean>;
    protected readonly isRangeMode: _angular_core.Signal<boolean>;
    protected readonly canApply: _angular_core.Signal<boolean>;
    protected readonly showOkButton: _angular_core.Signal<boolean>;
    protected readonly showCancelButton: _angular_core.Signal<boolean>;
    protected readonly isTimeMode: _angular_core.Signal<boolean>;
    protected readonly isMonthMode: _angular_core.Signal<boolean>;
    protected readonly isYearMode: _angular_core.Signal<boolean>;
    protected readonly isQuarterMode: _angular_core.Signal<boolean>;
    protected readonly todayButtonText: _angular_core.Signal<string>;
    protected readonly currentMonth: _angular_core.Signal<Date>;
    protected readonly currentYear: _angular_core.Signal<number>;
    protected readonly currentMonthIndex: _angular_core.Signal<number>;
    protected readonly todayMonthIndex: _angular_core.Signal<number>;
    protected readonly todayYear: _angular_core.Signal<number>;
    protected readonly selectedMonthIndex: _angular_core.Signal<number>;
    protected readonly selectedYear: _angular_core.Signal<number>;
    protected readonly endTimeContext: _angular_core.Signal<ZEndTimeContext>;
    protected readonly startMonthDisabledContext: _angular_core.Signal<ZMonthDisabledContext>;
    protected readonly endMonthDisabledContext: _angular_core.Signal<ZEndMonthDisabledContext>;
    protected readonly startYearDisabledContext: _angular_core.Signal<ZYearDisabledContext>;
    protected readonly endYearDisabledContext: _angular_core.Signal<ZEndYearDisabledContext>;
    protected readonly currentMonthName: _angular_core.Signal<string>;
    protected readonly yearRange: _angular_core.Signal<number[]>;
    protected readonly yearRangeSmall: _angular_core.Signal<number[]>;
    protected readonly calendarDays: _angular_core.Signal<ZCalendarDay[][]>;
    protected readonly endMonth: _angular_core.Signal<Date>;
    protected readonly endMonthName: _angular_core.Signal<string>;
    protected readonly endMonthYear: _angular_core.Signal<number>;
    protected readonly calendarDaysEnd: _angular_core.Signal<ZCalendarDay[][]>;
    protected readonly formattedHourEnd: _angular_core.Signal<string>;
    protected readonly formattedMinuteEnd: _angular_core.Signal<string>;
    protected readonly formattedSecondEnd: _angular_core.Signal<string>;
    protected readonly minuteEnd: _angular_core.Signal<number>;
    protected readonly secondEnd: _angular_core.Signal<number>;
    protected readonly periodEnd: _angular_core.Signal<"AM" | "PM">;
    protected readonly endYearRange: _angular_core.Signal<number[]>;
    protected readonly canNavigateStartNext: _angular_core.Signal<boolean>;
    protected readonly canNavigateEndPrev: _angular_core.Signal<boolean>;
    protected readonly displayValue: _angular_core.Signal<string>;
    private _formatDisplayValue;
    private readonly _inputDisplayStart;
    private readonly _inputDisplayEnd;
    protected readonly inputDisplayStart: _angular_core.Signal<string>;
    protected readonly inputDisplayEnd: _angular_core.Signal<string>;
    protected readonly displayValueStart: _angular_core.Signal<string>;
    protected readonly displayValueEnd: _angular_core.Signal<string>;
    protected readonly effectivePlaceholder: _angular_core.Signal<string>;
    private _getDisplayFormatStart;
    private _getDisplayFormatEnd;
    protected readonly showClearButton: _angular_core.Signal<boolean>;
    protected readonly hasValue: _angular_core.Signal<boolean>;
    protected readonly currentStatus: _angular_core.Signal<"default" | "disabled" | "readonly" | "open" | "error">;
    protected readonly triggerClasses: _angular_core.Signal<string>;
    private readonly _shouldShowValidation;
    protected readonly hasError: _angular_core.Signal<boolean>;
    protected readonly errorMessage: _angular_core.Signal<string>;
    constructor();
    ngOnInit(): void;
    writeValue(value: ZCalendarValue): void;
    registerOnChange(fn: (value: ZCalendarValue) => void): void;
    registerOnTouched(fn: () => void): void;
    setDisabledState(isDisabled: boolean): void;
    open(): void;
    close(): void;
    toggle(): void;
    clear(): void;
    focus(): void;
    blur(): void;
    reset(): void;
    /** @deprecated Use `valid()` for boolean form-submit checks. */
    validate(): boolean;
    valid(): boolean;
    setErrorMessage(message: string | null): void;
    protected onPopoverShow(): void;
    private _initializeTimeIfNeeded;
    private _syncEndTimeSignals;
    private _resetCalendarsToDefault;
    private _backupIfNeeded;
    protected onPopoverHide(): void;
    private _restoreFromBackup;
    protected onPopoverControl(control: ZPopoverControl): void;
    protected onTriggerKeydown(event: KeyboardEvent): void;
    protected onInputChange(event: Event): void;
    private _getExpectedFormatLength;
    private _preserveInputSelection;
    protected onStartInputChange(event: Event): void;
    protected onEndInputChange(event: Event): void;
    protected onStartInputEnter(event: Event): void;
    protected onEndInputEnter(event: Event): void;
    protected onInputFocus(_event: FocusEvent): void;
    protected onInputBlur(event: FocusEvent): void;
    protected onInputEnter(event: Event): void;
    protected onCalendarKeydown(event: KeyboardEvent): void;
    protected onDayClick(day: ZCalendarDay): void;
    protected onDayHover(day: ZCalendarDay): void;
    protected onDayLeave(): void;
    protected onMonthClick(monthIndex: number): void;
    protected onYearClick(year: number): void;
    protected onQuarterClick(quarterIndex: number): void;
    protected onMonthSelect(monthIndex: number): void;
    protected onQuickSelect(preset: ZQuickSelectPreset): void;
    protected onQuickSelectKeyChange(key: string | null): void;
    protected onTodayClick(): void;
    protected onClear(event: MouseEvent): void;
    protected onCancelClick(): void;
    protected onOkClick(): void;
    protected navigatePrevious(): void;
    protected navigateNext(): void;
    protected navigatePreviousFast(): void;
    protected navigateNextFast(): void;
    protected setView(view: ZCalendarView): void;
    protected setEndView(view: ZCalendarView): void;
    protected onEndMonthClick(monthIndex: number): void;
    protected onEndYearClick(year: number): void;
    protected onHourInput(event: Event): void;
    protected onMinuteInput(event: Event): void;
    protected onSecondInput(event: Event): void;
    protected onTimeBlur(event: Event): void;
    protected navigateEndPrevious(): void;
    protected navigateEndNext(): void;
    protected navigateEndPreviousFast(): void;
    protected navigateEndNextFast(): void;
    protected onHourEndInput(event: Event): void;
    protected onMinuteEndInput(event: Event): void;
    protected onSecondEndInput(event: Event): void;
    protected onTimeBlurEnd(event: Event): void;
    protected togglePeriodEnd(): void;
    private _updateEndTimeToDate;
    private _resolveDefaultTime;
    private _resolveRangeStartTime;
    private _resolveRangeEndTime;
    private _handleSingleSelection;
    private _handleRangeSelection;
    private _updateTimeToDate;
    private _detectMatchingPreset;
    private _updateRangeInputDisplay;
    private _isQuickSelectPresetDisabled;
    private _applyValue;
    private _confirmTypedValue;
    private _getEmitValue;
    private _getValidationErrors;
    private _navigateByArrowKey;
    private _syncTimeSignals;
    private _getParseFormat;
    private _buildTimeFormat;
    private _updateInputDisplay;
    private _clearDateValues;
    protected onInputEscape(event: Event): void;
    protected onStartInputEscape(event: Event): void;
    protected onEndInputEscape(event: Event): void;
    private _cancelAndRestore;
    private _updateAllInputDisplays;
    private _emitControl;
    protected togglePeriod(): void;
    protected incrementHour(): void;
    protected decrementHour(): void;
    protected incrementMinute(): void;
    protected decrementMinute(): void;
    protected incrementSecond(): void;
    protected decrementSecond(): void;
    protected incrementHourEnd(): void;
    protected decrementHourEnd(): void;
    protected incrementMinuteEnd(): void;
    protected decrementMinuteEnd(): void;
    protected incrementSecondEnd(): void;
    protected decrementSecondEnd(): void;
    private _getNextHour;
    private _getPreviousHour;
    protected openTimeDropdown(event: MouseEvent): void;
    protected closeTimeDropdown(): void;
    protected openTimeDropdownEnd(event: MouseEvent): void;
    protected closeTimeDropdownEnd(): void;
    protected onTimeDropdownShow(): void;
    protected onTimeDropdownEndShow(): void;
    private _scrollToTimeDropdown;
    private _updateInputDisplayAfterTimeChange;
    protected onPeriodChange(event: Event): void;
    protected selectHour(hour: number, shouldScroll?: boolean): void;
    protected selectMinute(minute: number, shouldScroll?: boolean): void;
    protected selectSecond(second: number, shouldScroll?: boolean): void;
    protected selectPeriod(period: 'AM' | 'PM'): void;
    protected selectHourEnd(hour: number, shouldScroll?: boolean): void;
    protected selectMinuteEnd(minute: number, shouldScroll?: boolean): void;
    protected selectSecondEnd(second: number, shouldScroll?: boolean): void;
    protected selectPeriodEnd(period: 'AM' | 'PM'): void;
    protected scrollToSelectedTime(container: HTMLElement | null, value: number, itemHeight?: number): void;
    private _scrollToTimeValue;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZCalendarComponent, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<ZCalendarComponent, "z-calendar", ["zCalendar"], { "class": { "alias": "class"; "required": false; "isSignal": true; }; "zMode": { "alias": "zMode"; "required": false; "isSignal": true; }; "zSize": { "alias": "zSize"; "required": false; "isSignal": true; }; "zLabel": { "alias": "zLabel"; "required": false; "isSignal": true; }; "zLabelClass": { "alias": "zLabelClass"; "required": false; "isSignal": true; }; "zPlaceholder": { "alias": "zPlaceholder"; "required": false; "isSignal": true; }; "zRequired": { "alias": "zRequired"; "required": false; "isSignal": true; }; "zDisabled": { "alias": "zDisabled"; "required": false; "isSignal": true; }; "zReadonly": { "alias": "zReadonly"; "required": false; "isSignal": true; }; "zShowTime": { "alias": "zShowTime"; "required": false; "isSignal": true; }; "zTimeFormat": { "alias": "zTimeFormat"; "required": false; "isSignal": true; }; "zShowHour": { "alias": "zShowHour"; "required": false; "isSignal": true; }; "zShowMinute": { "alias": "zShowMinute"; "required": false; "isSignal": true; }; "zShowSecond": { "alias": "zShowSecond"; "required": false; "isSignal": true; }; "zQuickSelect": { "alias": "zQuickSelect"; "required": false; "isSignal": true; }; "zAllowEdit": { "alias": "zAllowEdit"; "required": false; "isSignal": true; }; "zShortTime": { "alias": "zShortTime"; "required": false; "isSignal": true; }; "zAllowClear": { "alias": "zAllowClear"; "required": false; "isSignal": true; }; "zFormat": { "alias": "zFormat"; "required": false; "isSignal": true; }; "zMinDate": { "alias": "zMinDate"; "required": false; "isSignal": true; }; "zMaxDate": { "alias": "zMaxDate"; "required": false; "isSignal": true; }; "zValueType": { "alias": "zValueType"; "required": false; "isSignal": true; }; "zValidators": { "alias": "zValidators"; "required": false; "isSignal": true; }; "zShowOk": { "alias": "zShowOk"; "required": false; "isSignal": true; }; "zOkText": { "alias": "zOkText"; "required": false; "isSignal": true; }; "zShowCancel": { "alias": "zShowCancel"; "required": false; "isSignal": true; }; "zCancelText": { "alias": "zCancelText"; "required": false; "isSignal": true; }; "zDisabledDate": { "alias": "zDisabledDate"; "required": false; "isSignal": true; }; "zScrollClose": { "alias": "zScrollClose"; "required": false; "isSignal": true; }; "zDefaultTime": { "alias": "zDefaultTime"; "required": false; "isSignal": true; }; "zRangeDefaultTime": { "alias": "zRangeDefaultTime"; "required": false; "isSignal": true; }; }, { "zControl": "zControl"; "zChange": "zChange"; "zOnBlur": "zOnBlur"; "zOnFocus": "zOnFocus"; "zEvent": "zEvent"; }, never, never, true, never>;
}

declare const zCalendarVariants: (props?: ({
    zSize?: "sm" | "default" | "lg" | null | undefined;
    zStatus?: "default" | "disabled" | "open" | "error" | "readonly" | null | undefined;
} & class_variance_authority_types.ClassProp) | undefined) => string;
declare const zCalendarDayVariants: (props?: ({
    state?: "default" | "today" | "selected" | "inRange" | "rangeStart" | "rangeEnd" | "rangeSingle" | "disabled" | "otherMonth" | "hovered" | null | undefined;
} & class_variance_authority_types.ClassProp) | undefined) => string;
declare const zCalendarMonthVariants: (props?: ({
    state?: "default" | "selected" | "disabled" | "current" | null | undefined;
} & class_variance_authority_types.ClassProp) | undefined) => string;
declare const zCalendarYearVariants: (props?: ({
    state?: "default" | "selected" | "disabled" | "current" | null | undefined;
} & class_variance_authority_types.ClassProp) | undefined) => string;

export { ZCalendarComponent, zCalendarDayVariants, zCalendarMonthVariants, zCalendarVariants, zCalendarYearVariants };
export type { ZCalendarControl, ZCalendarDefaultTime, ZCalendarMode, ZCalendarRangeDefaultTime, ZCalendarSize, ZCalendarTimeConfig, ZCalendarValidator, ZCalendarValue, ZCalendarValueType, ZCalendarView, ZDateRange };
