// #region Imports
import { ElementValidatorBase } from './Abstracts/ElementValidatorBase';
import { patternValidator } from './PatternElementValidatorFn';
/**
 * @public
 */
export class PatternElementValidator extends ElementValidatorBase {
    // #region Ctor
    constructor(host, messageResolver) {
        super(host, messageResolver ?? ((_params) => 'The value does not match the pattern.'));
    }
    // #endregion
    // #region Properties
    get attributes() {
        return ['pattern', 'value'];
    }
    // #endregion
    // #region Methods
    validate() {
        const errors = patternValidator(this.host);
        return this.getMessage(errors);
    }
}
/**
 * A factory function for the `PatternElementValidator`.
 *
 * @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 patternElementValidator(messageResolver) {
    return (host) => {
        return new PatternElementValidator(host, messageResolver);
    };
}
//# sourceMappingURL=PatternElementValidator.js.map