// #region Imports
import { ElementValidatorBase } from './Abstracts/ElementValidatorBase';
import { isEmailValue as _isEmailValue, emailValidator } from './EmailElementValidatorFn';
/**
 * @public
 */
export class EmailElementValidator extends ElementValidatorBase {
    // #region Ctor
    constructor(host, messageResolver) {
        super(host, messageResolver ?? ((_params) => 'The value is not a valid email address.'));
    }
    // #endregion
    // #region Properties
    get attributes() {
        return ['value'];
    }
    // #endregion
    // #region Methods
    validate() {
        const errors = emailValidator(this.host);
        return this.getMessage(errors);
    }
}
(function (EmailElementValidator) {
    EmailElementValidator.isEmailValue = _isEmailValue;
})(EmailElementValidator || (EmailElementValidator = {}));
/**
 * A factory function for the {@link EmailElementValidator}.
 *
 * @public
 * @param resolver - A *optional* message resolver to get the error message that will be displayed. When not provided, a default message will be used.
 */
export function emailElementValidator(messageResolver) {
    return (host) => {
        return new EmailElementValidator(host, messageResolver);
    };
}
//# sourceMappingURL=EmailElementValidator.js.map