import * as i0 from '@angular/core';
import { EventEmitter, Directive, Input, Output } from '@angular/core';
import { isNullOrUndefined } from '@ironsource/fusion-ui/utils';
import * as i1 from '@ironsource/fusion-ui/components/dropdown/service';

class DropdownOptionsListBaseComponent {
    constructor(dropdownService) {
        this.dropdownService = dropdownService;
        this.isMultiRawDisplay = false;
        this.changeSelected = new EventEmitter();
    }
    isSelected(option) {
        return (this.selected &&
            this.selected.length > 0 &&
            this.selected.some(item => {
                if (!isNullOrUndefined(option.id) && !isNullOrUndefined(item.id)) {
                    return item.id === option.id;
                }
                else {
                    return item === option;
                }
            }));
    }
    getOptionClasses(option) {
        return {
            [option.class]: option.class,
            'is-selected': this.isSelected(option),
            'is-disabled': option.isDisabled,
            'is-with-second-line': option.subText
        };
    }
    onChangeSelected(option, $event) {
        this.changeSelected.emit({ option, $event });
    }
    static { this.ɵfac = function DropdownOptionsListBaseComponent_Factory(t) { return new (t || DropdownOptionsListBaseComponent)(i0.ɵɵdirectiveInject(i1.DropdownService)); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: DropdownOptionsListBaseComponent, inputs: { displayedOptions: "displayedOptions", isMultiRawDisplay: "isMultiRawDisplay", mappingOptions: "mappingOptions", selected: "selected", lastSearchValue: "lastSearchValue", optionRightHoverText: "optionRightHoverText", optionCloseIcon: "optionCloseIcon" }, outputs: { changeSelected: "changeSelected" } }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DropdownOptionsListBaseComponent, [{
        type: Directive
    }], () => [{ type: i1.DropdownService }], { displayedOptions: [{
            type: Input
        }], isMultiRawDisplay: [{
            type: Input
        }], mappingOptions: [{
            type: Input
        }], selected: [{
            type: Input
        }], lastSearchValue: [{
            type: Input
        }], optionRightHoverText: [{
            type: Input
        }], optionCloseIcon: [{
            type: Input
        }], changeSelected: [{
            type: Output
        }] }); })();

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

export { DropdownOptionsListBaseComponent };
//# sourceMappingURL=ironsource-fusion-ui-components-dropdown-options-list-common-base.mjs.map
