// #region Imports
import { directive } from 'lit/directive.js';
import { DateFormatter } from '../../../Intl/Formatters/DateFormatter';
import { DirectiveBase } from '../Abstracts/DirectiveBase';
// #endregion
/**
 * @private
 */
class DateFormatDirective extends DirectiveBase {
    // #region Fields
    _date;
    _format;
    _locale;
    _lastValue;
    // #endregion
    // #region Methods
    render(date, format, locale = 'en-US') {
        if (this._date === date && this._format === format && this._locale === locale && this._lastValue) {
            return this._lastValue;
        }
        this._date = date;
        this._format = format;
        this._locale = locale;
        this._lastValue = DateFormatter.format(date, format, locale);
        return this._lastValue;
    }
    update(_part, [date, format, locale = 'en-US']) {
        return this.render(date, format, locale);
    }
}
/**
 * The `dateFormat` directive formats a date according to the specified format and locale.
 *
 * @public
 * @param date - The date to format.
 * @param format - The format string.
 * @param locale - The locale to use for formatting (default is 'en-US').
 * @returns A formatted date string.
 */
export const dateFormat = directive(DateFormatDirective);
//# sourceMappingURL=DateFormatDirective.js.map