/*!
 * KoliBri - The accessible HTML-Standard
 */
import { g as watchString, e as watchBoolean } from './common-DEEjER7G.js';
import { v as validateAutoComplete } from './auto-complete-CrQJr3SH.js';
import { a as validateHasCounter, v as validateMaxLengthBehavior, b as validateMaxLength } from './max-length-behavior-426q5CU6.js';
import { v as validatePlaceholder } from './placeholder-CSgrK1Zh.js';
import { v as validateReadOnly } from './read-only-DyuIPHMt.js';
import { v as validateRequired } from './required-DAsW5lI1.js';
import { v as validateVariantClassName } from './variant-class-name-CkfE8oGZ.js';
import { I as InputIconController } from './controller-icon-ClFIXmW5.js';

const validatePattern = (component, value, options = {}) => {
    watchString(component, '_pattern', value, options);
};

const validateVisibilityToggle = (component, value, hooks) => {
    watchBoolean(component, '_visibilityToggle', value, hooks);
};

class InputPasswordController extends InputIconController {
    constructor(component, name, host) {
        super(component, name, host);
        this.afterSyncCharCounter = () => {
            if (typeof this.component._value === 'string') {
                this.component.state._currentLength = this.component._value.length;
                this.updateCurrentLengthDebounced(this.component._value.length);
            }
        };
        this.component = component;
    }
    validateAutoComplete(value) {
        validateAutoComplete(this.component, value);
    }
    validateHasCounter(value) {
        validateHasCounter(this.component, value);
    }
    validateMaxLengthBehavior(value) {
        validateMaxLengthBehavior(this.component, value);
    }
    validateMaxLength(value) {
        validateMaxLength(this.component, value, {
            hooks: { afterPatch: this.afterSyncCharCounter },
        });
    }
    validatePattern(value) {
        validatePattern(this.component, value);
    }
    validatePlaceholder(value) {
        validatePlaceholder(this.component, value);
    }
    validateReadOnly(value) {
        validateReadOnly(this.component, value);
    }
    validateRequired(value) {
        validateRequired(this.component, value);
    }
    validateValue(value) {
        watchString(this.component, '_value', value, {
            hooks: {
                afterPatch: this.afterSyncCharCounter,
            },
        });
        this.setFormAssociatedValue(this.component.state._value);
    }
    validateVariant(value) {
        validateVariantClassName(this.component, value);
    }
    validateVisibilityToggle(value) {
        validateVisibilityToggle(this.component, value);
    }
    componentWillLoad() {
        super.componentWillLoad();
        this.validateAutoComplete(this.component._autoComplete);
        this.validateHasCounter(this.component._hasCounter);
        this.validateMaxLengthBehavior(this.component._maxLengthBehavior);
        this.validateMaxLength(this.component._maxLength);
        this.validatePattern(this.component._pattern);
        this.validatePlaceholder(this.component._placeholder);
        this.validateReadOnly(this.component._readOnly);
        this.validateRequired(this.component._required);
        this.validateValue(this.component._value);
        this.validateVariant(this.component._variant);
        this.validateVisibilityToggle(this.component._visibilityToggle);
    }
}

export { InputPasswordController as I };
//# sourceMappingURL=controller-eoW_d0fK.js.map

//# sourceMappingURL=controller-eoW_d0fK.js.map