import { Directive, forwardRef } from '@angular/core';
import { DefaultValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import * as i0 from "@angular/core";
export class TrimDirective extends DefaultValueAccessor {
    _handleInput(value) {
        if (value != null) {
            this.onChange(value.trim());
        }
    }
}
TrimDirective.ɵfac = /*@__PURE__*/ function () { let ɵTrimDirective_BaseFactory; return function TrimDirective_Factory(t) { return (ɵTrimDirective_BaseFactory || (ɵTrimDirective_BaseFactory = i0.ɵɵgetInheritedFactory(TrimDirective)))(t || TrimDirective); }; }();
TrimDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: TrimDirective, selectors: [["input", "trim", ""], ["textarea", "trim", ""]], hostBindings: function TrimDirective_HostBindings(rf, ctx) { if (rf & 1) {
        i0.ɵɵlistener("input", function TrimDirective_input_HostBindingHandler($event) { return ctx._handleInput($event.target.value); })("blur", function TrimDirective_blur_HostBindingHandler() { return ctx.onTouched(); })("compositionstart", function TrimDirective_compositionstart_HostBindingHandler() { return ctx._compositionStart(); })("compositionend", function TrimDirective_compositionend_HostBindingHandler($event) { return ctx._compositionEnd($event.target.value); });
    } }, features: [i0.ɵɵProvidersFeature([
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => TrimDirective),
                multi: true,
            },
        ]), i0.ɵɵInheritDefinitionFeature] });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TrimDirective, [{
        type: Directive,
        args: [{
                // eslint-disable-next-line @angular-eslint/directive-selector
                selector: 'input[trim],textarea[trim]]',
                // eslint-disable-next-line @angular-eslint/no-host-metadata-property
                host: {
                    '(input)': '$any(this)._handleInput($event.target.value)',
                    '(blur)': 'onTouched()',
                    '(compositionstart)': '$any(this)._compositionStart()',
                    '(compositionend)': '$any(this)._compositionEnd($event.target.value)',
                },
                providers: [
                    {
                        provide: NG_VALUE_ACCESSOR,
                        useExisting: forwardRef(() => TrimDirective),
                        multi: true,
                    },
                ],
            }]
    }], null, null); })();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