import * as i0 from '@angular/core';
import { Component, ViewContainerRef, inject, Directive, HostBinding, Input, NgModule } from '@angular/core';
import * as i1 from '@ironsource/fusion-ui/components/loader-inline/v2';
import { LoaderInlineModule } from '@ironsource/fusion-ui/components/loader-inline/v2';
import { CommonModule } from '@angular/common';

class DropdownLoaderComponent {
    static { this.ɵfac = function DropdownLoaderComponent_Factory(t) { return new (t || DropdownLoaderComponent)(); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DropdownLoaderComponent, selectors: [["fusion-dropdown-loader"]], decls: 2, vars: 1, consts: [[3, "status"]], template: function DropdownLoaderComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵtext(0, "Loading...");
            i0.ɵɵelement(1, "fusion-loader-inline", 0);
        } if (rf & 2) {
            i0.ɵɵadvance();
            i0.ɵɵproperty("status", true);
        } }, dependencies: [i1.LoaderInlineComponent], styles: ["[_nghost-%COMP%]{cursor:default;color:var(--fu-light-900, #7b838c);padding:5px 10px;background:#fff;position:relative;display:block}[_nghost-%COMP%]   fusion-loader-inline[_ngcontent-%COMP%]{position:absolute;right:13px;top:4px}"] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DropdownLoaderComponent, [{
        type: Component,
        args: [{ selector: 'fusion-dropdown-loader', template: "Loading...<fusion-loader-inline [status]=\"true\"></fusion-loader-inline>\n", styles: [":host{cursor:default;color:var(--fu-light-900, #7b838c);padding:5px 10px;background:#fff;position:relative;display:block}:host fusion-loader-inline{position:absolute;right:13px;top:4px}\n"] }]
    }], null, null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(DropdownLoaderComponent, { className: "DropdownLoaderComponent", filePath: "dropdown-loader.component.ts", lineNumber: 8 }); })();

class DropdownLoaderDirective {
    constructor(renderer) {
        this.renderer = renderer;
        this.isOptionHidden = false;
        this.viewContainerRef = inject(ViewContainerRef);
    }
    ngOnChanges() {
        this.isOptionHidden = !this.fusionDropdownLoader;
        this.loadContent();
    }
    loadContent() {
        if (!this.isOptionHidden) {
            this.viewContainerRef.clear();
            this.loaderComponentRef = this.viewContainerRef.createComponent(DropdownLoaderComponent);
            const loaderViewRef = this.loaderComponentRef.hostView;
            this.renderer.appendChild(this.viewContainerRef.element.nativeElement, loaderViewRef.rootNodes[0]);
        }
        else {
            this.viewContainerRef.clear();
        }
    }
    static { this.ɵfac = function DropdownLoaderDirective_Factory(t) { return new (t || DropdownLoaderDirective)(i0.ɵɵdirectiveInject(i0.Renderer2)); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: DropdownLoaderDirective, selectors: [["", "fusionDropdownLoader", ""]], hostVars: 2, hostBindings: function DropdownLoaderDirective_HostBindings(rf, ctx) { if (rf & 2) {
            i0.ɵɵclassProp("is-hidden", ctx.isOptionHidden);
        } }, inputs: { fusionDropdownLoader: "fusionDropdownLoader" }, features: [i0.ɵɵNgOnChangesFeature] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DropdownLoaderDirective, [{
        type: Directive,
        args: [{
                selector: '[fusionDropdownLoader]'
            }]
    }], () => [{ type: i0.Renderer2 }], { isOptionHidden: [{
            type: HostBinding,
            args: ['class.is-hidden']
        }], fusionDropdownLoader: [{
            type: Input
        }] }); })();

class DropdownLoaderModule {
    static { this.ɵfac = function DropdownLoaderModule_Factory(t) { return new (t || DropdownLoaderModule)(); }; }
    static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: DropdownLoaderModule }); }
    static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule, LoaderInlineModule, LoaderInlineModule] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DropdownLoaderModule, [{
        type: NgModule,
        args: [{
                declarations: [DropdownLoaderDirective, DropdownLoaderComponent],
                exports: [DropdownLoaderDirective, LoaderInlineModule],
                imports: [CommonModule, LoaderInlineModule]
            }]
    }], null, null); })();
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(DropdownLoaderModule, { declarations: [DropdownLoaderDirective, DropdownLoaderComponent], imports: [CommonModule, LoaderInlineModule], exports: [DropdownLoaderDirective, LoaderInlineModule] }); })();

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

export { DropdownLoaderComponent, DropdownLoaderDirective, DropdownLoaderModule };
//# sourceMappingURL=ironsource-fusion-ui-components-dropdown-loader-v2.mjs.map
