var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Component, ComponentFactoryResolver, Input, ViewChild } from "@angular/core";
import { CustomDirective } from "./custom.directive";
import { CustomContainerPageElement } from "./custom-container-page-element";
var CustomContainerComponent = /** @class */ (function () {
    function CustomContainerComponent(componentFactoryResolver) {
        this.componentFactoryResolver = componentFactoryResolver;
    }
    CustomContainerComponent.prototype.ngOnInit = function () {
        this.loadComponent();
    };
    CustomContainerComponent.prototype.loadComponent = function () {
        var componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.pageElement.typeClass);
        var viewContainerRef = this.customDirective.viewContainerRef;
        viewContainerRef.clear();
        var componentRef = viewContainerRef.createComponent(componentFactory);
        componentRef.instance.pageElement = this.pageElement;
    };
    __decorate([
        Input(),
        __metadata("design:type", CustomContainerPageElement)
    ], CustomContainerComponent.prototype, "pageElement", void 0);
    __decorate([
        ViewChild(CustomDirective, { static: true }),
        __metadata("design:type", CustomDirective)
    ], CustomContainerComponent.prototype, "customDirective", void 0);
    CustomContainerComponent = __decorate([
        Component({
            selector: "path-custom-container-component",
            template: "\n        <ng-template path-custom-directive></ng-template>"
        }),
        __metadata("design:paramtypes", [ComponentFactoryResolver])
    ], CustomContainerComponent);
    return CustomContainerComponent;
}());
export { CustomContainerComponent };
var CustomPageElement = /** @class */ (function () {
    function CustomPageElement() {
    }
    Object.defineProperty(CustomPageElement.prototype, "pageElement", {
        get: function () {
            return this._pageElement;
        },
        set: function (value) {
            this._pageElement = value;
        },
        enumerable: false,
        configurable: true
    });
    return CustomPageElement;
}());
export { CustomPageElement };
//# sourceMappingURL=custom-container.component.js.map