import * as i0 from '@angular/core';
import { forwardRef, Component, ChangeDetectionStrategy, Input } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TopFilterTriggerComponent } from '@ironsource/fusion-ui/components/top-filter-trigger/v3';
import * as i2 from '@ironsource/fusion-ui/components/dropdown-dual-multi-select';
import { DropdownDualMultiSelectModule } from '@ironsource/fusion-ui/components/dropdown-dual-multi-select';
import * as i1 from '@angular/forms';
import { FormControl, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

class TopFilterIncludeExcludeComponent {
    constructor() {
        this.loading = false;
        this.required = false;
        this.items = [];
        /** @internal */
        this.formControlIncludeExclude = new FormControl();
        this.onDestroy$ = new Subject();
        /** @internal */
        this.propagateChange = (_) => { };
        /** @internal */
        this.propagateTouched = () => { };
    }
    ngOnInit() {
        this.formControlIncludeExclude.valueChanges.pipe(takeUntil(this.onDestroy$)).subscribe(value => {
            this.propagateChange([...value]);
        });
    }
    ngOnDestroy() {
        this.onDestroy$.next();
        this.onDestroy$.complete();
    }
    /** @internal */
    writeValue(value) {
        this.formControlIncludeExclude.setValue(value ?? [], { emitEvent: false });
    }
    /** @internal */
    registerOnChange(fn) {
        this.propagateChange = fn;
    }
    /** @internal */
    registerOnTouched(fn) {
        this.propagateTouched = fn;
    }
    static { this.ɵfac = function TopFilterIncludeExcludeComponent_Factory(t) { return new (t || TopFilterIncludeExcludeComponent)(); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TopFilterIncludeExcludeComponent, selectors: [["fusion-top-filter-include-exclude"]], inputs: { placeholder: "placeholder", helper: "helper", error: "error", loading: "loading", required: "required", title: "title", items: "items" }, standalone: true, features: [i0.ɵɵProvidersFeature([
                {
                    provide: NG_VALUE_ACCESSOR,
                    useExisting: forwardRef(() => TopFilterIncludeExcludeComponent),
                    multi: true
                }
            ]), i0.ɵɵStandaloneFeature], decls: 3, vars: 8, consts: [[3, "placeholder", "helper", "error", "required", "loading"], [1, "filter-element"], [3, "title", "formControl", "items"]], template: function TopFilterIncludeExcludeComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "fusion-top-filter-trigger", 0)(1, "div", 1);
            i0.ɵɵelement(2, "fusion-dropdown-dual-multi-select", 2);
            i0.ɵɵelementEnd()();
        } if (rf & 2) {
            i0.ɵɵproperty("placeholder", ctx.placeholder)("helper", ctx.helper)("error", ctx.error)("required", ctx.required)("loading", ctx.loading);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("title", ctx.title)("formControl", ctx.formControlIncludeExclude)("items", ctx.items);
        } }, dependencies: [CommonModule, ReactiveFormsModule, i1.NgControlStatus, i1.FormControlDirective, TopFilterTriggerComponent, DropdownDualMultiSelectModule, i2.DropdownDualMultiSelectComponent], encapsulation: 2, changeDetection: 0 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TopFilterIncludeExcludeComponent, [{
        type: Component,
        args: [{ selector: 'fusion-top-filter-include-exclude', standalone: true, imports: [CommonModule, ReactiveFormsModule, TopFilterTriggerComponent, DropdownDualMultiSelectModule], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
                    {
                        provide: NG_VALUE_ACCESSOR,
                        useExisting: forwardRef(() => TopFilterIncludeExcludeComponent),
                        multi: true
                    }
                ], template: "<fusion-top-filter-trigger\n    [placeholder]=\"placeholder\"\n    [helper]=\"helper\"\n    [error]=\"error\"\n    [required]=\"required\"\n    [loading]=\"loading\"\n>\n    <div class=\"filter-element\">\n        <fusion-dropdown-dual-multi-select\n            [title]=\"title\"\n            [formControl]=\"formControlIncludeExclude\"\n            [items]=\"items\"\n        ></fusion-dropdown-dual-multi-select>\n    </div>\n</fusion-top-filter-trigger>\n" }]
    }], () => [], { placeholder: [{
            type: Input
        }], helper: [{
            type: Input
        }], error: [{
            type: Input
        }], loading: [{
            type: Input
        }], required: [{
            type: Input
        }], title: [{
            type: Input
        }], items: [{
            type: Input
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TopFilterIncludeExcludeComponent, { className: "TopFilterIncludeExcludeComponent", filePath: "v3/top-filter-include-exclude.component.ts", lineNumber: 24 }); })();

/**
 * Generated bundle index. Do not edit.
 */

export { TopFilterIncludeExcludeComponent };
//# sourceMappingURL=ironsource-fusion-ui-components-top-filter-include-exclude.mjs.map
