System.register(["lodash", "@stratusjs/runtime/stratus", "@angular/common/http", "@angular/core", "@angular/forms", "@angular/material/core", "@angular/platform-browser", "@angular/platform-browser/animations", "./material", "@angular/flex-layout", "./base/base.component", "./confirm-dialog/confirm-dialog.component", "./editor/editor.component", "./media-selector/media-selector.component", "./selector/selector.component", "./tree/tree.component", "./tree/tree-dialog.component", "./tree/tree-node.component", "../../map/src/map.module", "../../stripe/src/stripe.module", "angular-froala-wysiwyg", "./editor/citation-dialog.component", "./editor/code-view-dialog.component", "./editor/media-dialog.component", "./editor/link-dialog.component"], function (exports_1, context_1) {
    "use strict";
    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);
    };
    var lodash_1, stratus_1, http_1, core_1, forms_1, core_2, platform_browser_1, animations_1, material_1, flex_layout_1, base_component_1, confirm_dialog_component_1, editor_component_1, media_selector_component_1, selector_component_1, tree_component_1, tree_dialog_component_1, tree_node_component_1, map_module_1, stripe_module_1, angular_froala_wysiwyg_1, citation_dialog_component_1, code_view_dialog_component_1, media_dialog_component_1, link_dialog_component_1, ngModuleImports, ngDeclarations, ngEntryComponents, appModuleComponents, stratusPackages, AppModule;
    var __moduleName = context_1 && context_1.id;
    return {
        setters: [
            function (lodash_1_1) {
                lodash_1 = lodash_1_1;
            },
            function (stratus_1_1) {
                stratus_1 = stratus_1_1;
            },
            function (http_1_1) {
                http_1 = http_1_1;
            },
            function (core_1_1) {
                core_1 = core_1_1;
            },
            function (forms_1_1) {
                forms_1 = forms_1_1;
            },
            function (core_2_1) {
                core_2 = core_2_1;
            },
            function (platform_browser_1_1) {
                platform_browser_1 = platform_browser_1_1;
            },
            function (animations_1_1) {
                animations_1 = animations_1_1;
            },
            function (material_1_1) {
                material_1 = material_1_1;
            },
            function (flex_layout_1_1) {
                flex_layout_1 = flex_layout_1_1;
            },
            function (base_component_1_1) {
                base_component_1 = base_component_1_1;
            },
            function (confirm_dialog_component_1_1) {
                confirm_dialog_component_1 = confirm_dialog_component_1_1;
            },
            function (editor_component_1_1) {
                editor_component_1 = editor_component_1_1;
            },
            function (media_selector_component_1_1) {
                media_selector_component_1 = media_selector_component_1_1;
            },
            function (selector_component_1_1) {
                selector_component_1 = selector_component_1_1;
            },
            function (tree_component_1_1) {
                tree_component_1 = tree_component_1_1;
            },
            function (tree_dialog_component_1_1) {
                tree_dialog_component_1 = tree_dialog_component_1_1;
            },
            function (tree_node_component_1_1) {
                tree_node_component_1 = tree_node_component_1_1;
            },
            function (map_module_1_1) {
                map_module_1 = map_module_1_1;
            },
            function (stripe_module_1_1) {
                stripe_module_1 = stripe_module_1_1;
            },
            function (angular_froala_wysiwyg_1_1) {
                angular_froala_wysiwyg_1 = angular_froala_wysiwyg_1_1;
            },
            function (citation_dialog_component_1_1) {
                citation_dialog_component_1 = citation_dialog_component_1_1;
            },
            function (code_view_dialog_component_1_1) {
                code_view_dialog_component_1 = code_view_dialog_component_1_1;
            },
            function (media_dialog_component_1_1) {
                media_dialog_component_1 = media_dialog_component_1_1;
            },
            function (link_dialog_component_1_1) {
                link_dialog_component_1 = link_dialog_component_1_1;
            }
        ],
        execute: function () {
            ngModuleImports = [
                platform_browser_1.BrowserModule,
                animations_1.BrowserAnimationsModule,
                flex_layout_1.FlexLayoutModule,
                forms_1.FormsModule,
                angular_froala_wysiwyg_1.FroalaEditorModule.forRoot(),
                angular_froala_wysiwyg_1.FroalaViewModule.forRoot(),
                http_1.HttpClientModule,
                material_1.MaterialModules,
                core_2.MatNativeDateModule,
                forms_1.ReactiveFormsModule,
            ];
            ngDeclarations = [
                base_component_1.BaseComponent,
                citation_dialog_component_1.CitationDialogComponent,
                code_view_dialog_component_1.CodeViewDialogComponent,
                confirm_dialog_component_1.ConfirmDialogComponent,
                editor_component_1.EditorComponent,
                link_dialog_component_1.LinkDialogComponent,
                media_dialog_component_1.MediaDialogComponent,
                media_selector_component_1.MediaSelectorComponent,
                selector_component_1.SelectorComponent,
                tree_component_1.TreeComponent,
                tree_dialog_component_1.TreeDialogComponent,
                tree_node_component_1.TreeNodeComponent,
            ];
            ngEntryComponents = [
                base_component_1.BaseComponent,
                citation_dialog_component_1.CitationDialogComponent,
                code_view_dialog_component_1.CodeViewDialogComponent,
                confirm_dialog_component_1.ConfirmDialogComponent,
                editor_component_1.EditorComponent,
                link_dialog_component_1.LinkDialogComponent,
                media_dialog_component_1.MediaDialogComponent,
                media_selector_component_1.MediaSelectorComponent,
                selector_component_1.SelectorComponent,
                tree_component_1.TreeComponent,
                tree_dialog_component_1.TreeDialogComponent,
                tree_node_component_1.TreeNodeComponent,
            ];
            appModuleComponents = {
                'sa-base': base_component_1.BaseComponent,
                'sa-editor': editor_component_1.EditorComponent,
                'sa-media-selector': media_selector_component_1.MediaSelectorComponent,
                'sa-selector': selector_component_1.SelectorComponent,
                'sa-tree': tree_component_1.TreeComponent
            };
            stratusPackages = [
                map_module_1.MapPackage,
                stripe_module_1.StripePackage
            ];
            stratusPackages.forEach((stratusPackage) => {
                ngModuleImports.push(stratusPackage.stratusModule);
                if (stratusPackage.hasOwnProperty('stratusComponents')) {
                    lodash_1.extend(appModuleComponents, stratusPackage.stratusComponents);
                }
            });
            AppModule = class AppModule {
                constructor() {
                    this.initialTimeout = 1000;
                    this.instances = {};
                    this.modules = appModuleComponents;
                    stratus_1.Stratus.Instances[lodash_1.uniqueId('sa_app_module_')] = this;
                }
                ngDoBootstrap(appRef) {
                    this.detectBoot(appRef);
                }
                exponentialTimeout(limit) {
                    if (lodash_1.isNumber(limit) && limit < this.initialTimeout) {
                        return limit;
                    }
                    const currentTimeout = this.initialTimeout;
                    this.initialTimeout = this.initialTimeout * 1.01;
                    return currentTimeout;
                }
                detectBoot(appRef) {
                    lodash_1.forEach(this.modules, (module, selector) => {
                        const elements = document.getElementsByTagName(selector);
                        if (!elements || !elements.length) {
                            return;
                        }
                        lodash_1.forEach(elements, (node) => {
                            if (node.hasAttribute('ng-version')) {
                                return;
                            }
                            appRef.bootstrap(module, node);
                        });
                    });
                    setTimeout(() => {
                        this.detectBoot(appRef);
                    }, this.exponentialTimeout(4000));
                }
            };
            AppModule = __decorate([
                core_1.NgModule({
                    imports: ngModuleImports,
                    entryComponents: ngEntryComponents,
                    declarations: ngDeclarations,
                    providers: [
                        { provide: Window, useValue: window }
                    ]
                }),
                __metadata("design:paramtypes", [])
            ], AppModule);
            exports_1("AppModule", AppModule);
        }
    };
});

//# sourceMappingURL=app.module.js.map
