// #region Imports
import { ElementValueAccessorBase } from '../../../../../Forms/Accessors/Abstracts/ElementValueAccessorBase';
// #endregion
/**
 * The `ScrubSliderElementValueAccessor` class.
 *
 * @public
 */
export class ScrubSliderElementValueAccessor extends ElementValueAccessorBase {
    // #region Methods
    /**
     * @public
     */
    hostConnected() {
        this.host.on('input', (e) => this.value = e.target.value);
        this.host.on('change', (e) => this.value = e.target.value);
        this.host.on('blur', () => this.onTouched());
        // Sync the initial host value without triggering onChange, because
        // the host element may already have a value before the accessor is connected.
        this.writeValue(this.host.value);
    }
    /**
     * @public
     * @override
     */
    writeValue(value) {
        super.writeValue(value);
        this.host.value = value ?? 0;
    }
    /**
     * @public
     * @override
     */
    resetValue() {
        super.resetValue();
    }
}
/**
 * @public
 */
export const scrubSliderElementValueAccessor = (host) => {
    return new ScrubSliderElementValueAccessor(host);
};
//# sourceMappingURL=ScrubSliderElementValueAccessor.js.map