import * as i0 from '@angular/core';
import { Injectable, NgModule } from '@angular/core';
import * as i1 from 'ng-devui/window-ref';
import { WindowRefModule } from 'ng-devui/window-ref';

class OverlayContainerRef {
    constructor(_appRef, documentRef, _injector) {
        this._appRef = _appRef;
        this.documentRef = documentRef;
        this._injector = _injector;
    }
    insert(viewRef) {
        this._appRef.attachView(viewRef);
        this.documentRef.body.appendChild(viewRef.rootNodes[0]);
        return viewRef;
    }
    remove(viewRef) {
        viewRef.destroy();
    }
    createEmbeddedView(templateRef, context) {
        const viewRef = templateRef.createEmbeddedView(context || {});
        return this.insert(viewRef);
    }
    createComponent(componentFactory, injector, projectableNodes) {
        const componentRef = componentFactory.create(injector || this._injector, projectableNodes);
        this.insert(componentRef.hostView);
        return componentRef;
    }
}
OverlayContainerRef.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: OverlayContainerRef, deps: [{ token: i0.ApplicationRef }, { token: i1.DocumentRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
OverlayContainerRef.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: OverlayContainerRef });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: OverlayContainerRef, decorators: [{
            type: Injectable
        }], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: i1.DocumentRef }, { type: i0.Injector }]; } });

class OverlayContainerModule {
}
OverlayContainerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: OverlayContainerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
OverlayContainerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: OverlayContainerModule, imports: [WindowRefModule] });
OverlayContainerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: OverlayContainerModule, providers: [
        OverlayContainerRef,
    ], imports: [WindowRefModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: OverlayContainerModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [WindowRefModule],
                    exports: [],
                    declarations: [],
                    providers: [
                        OverlayContainerRef,
                    ],
                }]
        }] });

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

export { OverlayContainerModule, OverlayContainerRef };
//# sourceMappingURL=ng-devui-overlay-container.mjs.map
