// #region Imports
import { ElementValidatorBase } from './Abstracts/ElementValidatorBase';
import { equalsToValidator, isEqualsToValue as _isEqualsToValue } from './EqualsToElementValidatorFn';
/**
 * @public
 */
export class EqualsToElementValidator extends ElementValidatorBase {
    // #region Fields
    _other;
    // #endregion
    // #region Ctor
    constructor(host, other, messageResolver) {
        super(host, messageResolver ?? ((_params) => 'The value is not equal to the other element\'s value.'));
        this._other = other;
    }
    // #endregion
    // #region Properties
    get attributes() {
        return ['value'];
    }
    // #endregion
    // #region Methods
    validate() {
        const otherElement = typeof this._other === 'function' ? this._other() : this._other;
        const errors = equalsToValidator(this.host, otherElement);
        return this.getMessage(errors);
    }
}
(function (EqualsToElementValidator) {
    EqualsToElementValidator.isEqualsToValue = _isEqualsToValue;
})(EqualsToElementValidator || (EqualsToElementValidator = {}));
/**
 * A factory function for the {@link EqualsToElementValidator}.
 *
 * @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 equalsToElementValidator(other, messageResolver) {
    const fn = ([host]) => {
        const validator = new EqualsToElementValidator(host, other, messageResolver);
        return validator;
    };
    return fn;
}
//# sourceMappingURL=EqualsToElementValidator.js.map