(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/platform-browser-dynamic'), require('tslib'), require('@angular/platform-browser'), require('@angular/common'), require('@angular/router'), require('@angular/common/http'), require('@angular/forms'), require('ngx-bootstrap/typeahead'), require('ngx-bootstrap/timepicker'), require('ngx-bootstrap/progressbar'), require('ngx-bootstrap/pagination'), require('ngx-bootstrap/modal'), require('ngx-bootstrap/tooltip'), require('ngx-bootstrap/datepicker'), require('ngx-bootstrap/dropdown'), require('ngx-bootstrap/popover'), require('ng-circle-progress'), require('ngx-toastr'), require('ngx-bootstrap/carousel'), require('@wm/core'), require('@wm/components/basic'), require('@wm/components/basic/progress'), require('@wm/components/basic/rich-text-editor'), require('@wm/components/basic/search'), require('@wm/components/basic/tree'), require('@wm/components/input'), require('@wm/components/input/calendar'), require('@wm/components/input/chips'), require('@wm/components/input/color-picker'), require('@wm/components/input/currency'), require('@wm/components/input/epoch'), require('@wm/components/input/file-upload'), require('@wm/components/input/rating'), require('@wm/components/input/slider'), require('@wm/mobile/runtime/dynamic'), require('@wm/components/data/card'), require('@wm/components/data/form'), require('@wm/components/data/list'), require('@wm/components/data/live-table'), require('@wm/components/data/pagination'), require('@wm/components/data/table'), require('@wm/components/chart'), require('@wm/components/containers/accordion'), require('@wm/components/containers/linear-layout'), require('@wm/components/containers/layout-grid'), require('@wm/components/containers/panel'), require('@wm/components/containers/tabs'), require('@wm/components/containers/tile'), require('@wm/components/containers/wizard'), require('@wm/components/dialogs/alert-dialog'), require('@wm/components/dialogs/iframe-dialog'), require('@wm/components/dialogs/login-dialog'), require('@wm/components/dialogs/partial-dialog'), require('@wm/components/navigation/breadcrumb'), require('@wm/components/navigation/menu'), require('@wm/components/navigation/navbar'), require('@wm/components/navigation/popover'), require('@wm/components/advanced/carousel'), require('@wm/components/advanced/login'), require('@wm/components/advanced/marquee'), require('@wm/components/page'), require('@wm/components/page/footer'), require('@wm/components/page/header'), require('@wm/components/page/left-panel'), require('@wm/components/page/right-panel'), require('@wm/components/page/top-nav'), require('@wm/components/prefab'), require('@wm/runtime/base'), require('@wm/variables'), require('@wm/security'), require('@wm/transpiler'), require('lodash-es'), require('@angular/platform-browser/animations')) :
    typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/platform-browser-dynamic', 'tslib', '@angular/platform-browser', '@angular/common', '@angular/router', '@angular/common/http', '@angular/forms', 'ngx-bootstrap/typeahead', 'ngx-bootstrap/timepicker', 'ngx-bootstrap/progressbar', 'ngx-bootstrap/pagination', 'ngx-bootstrap/modal', 'ngx-bootstrap/tooltip', 'ngx-bootstrap/datepicker', 'ngx-bootstrap/dropdown', 'ngx-bootstrap/popover', 'ng-circle-progress', 'ngx-toastr', 'ngx-bootstrap/carousel', '@wm/core', '@wm/components/basic', '@wm/components/basic/progress', '@wm/components/basic/rich-text-editor', '@wm/components/basic/search', '@wm/components/basic/tree', '@wm/components/input', '@wm/components/input/calendar', '@wm/components/input/chips', '@wm/components/input/color-picker', '@wm/components/input/currency', '@wm/components/input/epoch', '@wm/components/input/file-upload', '@wm/components/input/rating', '@wm/components/input/slider', '@wm/mobile/runtime/dynamic', '@wm/components/data/card', '@wm/components/data/form', '@wm/components/data/list', '@wm/components/data/live-table', '@wm/components/data/pagination', '@wm/components/data/table', '@wm/components/chart', '@wm/components/containers/accordion', '@wm/components/containers/linear-layout', '@wm/components/containers/layout-grid', '@wm/components/containers/panel', '@wm/components/containers/tabs', '@wm/components/containers/tile', '@wm/components/containers/wizard', '@wm/components/dialogs/alert-dialog', '@wm/components/dialogs/iframe-dialog', '@wm/components/dialogs/login-dialog', '@wm/components/dialogs/partial-dialog', '@wm/components/navigation/breadcrumb', '@wm/components/navigation/menu', '@wm/components/navigation/navbar', '@wm/components/navigation/popover', '@wm/components/advanced/carousel', '@wm/components/advanced/login', '@wm/components/advanced/marquee', '@wm/components/page', '@wm/components/page/footer', '@wm/components/page/header', '@wm/components/page/left-panel', '@wm/components/page/right-panel', '@wm/components/page/top-nav', '@wm/components/prefab', '@wm/runtime/base', '@wm/variables', '@wm/security', '@wm/transpiler', 'lodash-es', '@angular/platform-browser/animations'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.runtime = global.wm.runtime || {}, global.wm.runtime.dynamic = {}), global.ng.core, global.ng.platformBrowserDynamic, global.tslib, global.ng.platformBrowser, global.ng.common, global.ng.router, global.ng.common.http, global.ng.forms, global.typeahead, global.timepicker, global.progressbar, global.pagination, global.modal, global.tooltip, global.datepicker, global.dropdown, global.popover, global.ngCircleProgress, global.ngxToastr, global.carousel, global.wm.core, global.wm.components.basic, global.wm.components.basic.progress, global.wm.components.basic.richtexteditor, global.wm.components.basic.search, global.wm.components.basic.tree, global.wm.components.input, global.wm.components.input.calendar, global.wm.components.input.chips, global.wm.components.input.colorpicker, global.wm.components.input.currency, global.wm.components.input.epoch, global.wm.components.input.fileupload, global.wm.components.input.rating, global.wm.components.input.slider, global.wm.mobile.runtime.dynamic, global.wm.components.data.card, global.wm.components.data.form, global.wm.components.data.list, global.wm.components.data.livetable, global.wm.components.data.pagination, global.wm.components.data.table, global.wm.components.chart, global.wm.components.containers.accordion, global.wm.components.containers.linearlayout, global.wm.components.containers.layoutgrid, global.wm.components.containers.panel, global.wm.components.containers.tabs, global.wm.components.containers.tile, global.wm.components.containers.wizard, global.wm.components.dialogs.alertdialog, global.wm.components.dialogs.iframedialog, global.wm.components.dialogs.logindialog, global.wm.components.dialogs.partialdialog, global.wm.components.navigation.breadcrumb, global.wm.components.navigation.menu, global.wm.components.navigation.navbar, global.wm.components.navigation.popover, global.wm.components.advanced.carousel, global.wm.components.advanced.login, global.wm.components.advanced.marquee, global.wm.components.page, global.wm.components.page.footer, global.wm.components.page.header, global.wm.components.page.leftpanel, global.wm.components.page.rightpanel, global.wm.components.page.topnav, global.wm.components.prefab, global.wm.runtime.base, global.wm.variables, global.wm.security, global.wm.transpiler, global._, global.ng.platformBrowser.animations));
})(this, (function (exports, i0, platformBrowserDynamic, tslib, platformBrowser, common, i1, i1$1, forms, typeahead, timepicker, progressbar, pagination, modal, tooltip, datepicker, dropdown, popover, ngCircleProgress, ngxToastr, carousel, i5, basic, progress, richTextEditor, search, tree, input, calendar, chips, colorPicker, currency, epoch, fileUpload, rating, slider, dynamic, card, form, list, liveTable, pagination$1, table, chart, accordion, linearLayout, layoutGrid, panel, tabs, tile, wizard, alertDialog, iframeDialog, loginDialog, partialDialog, breadcrumb, menu, navbar, popover$1, carousel$1, login, marquee, page, footer, header, leftPanel, rightPanel, topNav, prefab, i4, i2, i3, transpiler, lodashEs, animations) { 'use strict';

    function _interopNamespaceDefault(e) {
        var n = Object.create(null);
        if (e) {
            Object.keys(e).forEach(function (k) {
                if (k !== 'default') {
                    var d = Object.getOwnPropertyDescriptor(e, k);
                    Object.defineProperty(n, k, d.get ? d : {
                        enumerable: true,
                        get: function () { return e[k]; }
                    });
                }
            });
        }
        n.default = e;
        return Object.freeze(n);
    }

    var i0__namespace = /*#__PURE__*/_interopNamespaceDefault(i0);
    var i1__namespace = /*#__PURE__*/_interopNamespaceDefault(i1);
    var i1$1__namespace = /*#__PURE__*/_interopNamespaceDefault(i1$1);
    var i5__namespace = /*#__PURE__*/_interopNamespaceDefault(i5);
    var i4__namespace = /*#__PURE__*/_interopNamespaceDefault(i4);
    var i2__namespace = /*#__PURE__*/_interopNamespaceDefault(i2);
    var i3__namespace = /*#__PURE__*/_interopNamespaceDefault(i3);

    class PageWrapperComponent {
        constructor(injector, route, vcRef, appRef, metadataService, securityService, appManager, app, ngZone, elRef, spinnerService, componentRefProvider, router) {
            this.injector = injector;
            this.route = route;
            this.vcRef = vcRef;
            this.appRef = appRef;
            this.metadataService = metadataService;
            this.securityService = securityService;
            this.appManager = appManager;
            this.app = app;
            this.ngZone = ngZone;
            this.elRef = elRef;
            this.spinnerService = spinnerService;
            this.componentRefProvider = componentRefProvider;
            this.router = router;
        }
        getTargetNode() {
            return this.elRef.nativeElement;
        }
        resetViewContainer() {
            this.vcRef.clear();
            const $target = this.getTargetNode();
            $target.innerHTML = '';
        }
        renderPage(pageName) {
            const $target = this.getTargetNode();
            this.appManager.loadAppVariables()
                .then(async () => {
                const pageComponentFactoryRef = await this.componentRefProvider.getComponentFactoryRef(pageName, i4.ComponentType.PAGE);
                if (pageComponentFactoryRef) {
                    const componentRef = this.vcRef.createComponent(pageComponentFactoryRef, 0, this.injector);
                    this.instance = componentRef.instance;
                    $target.appendChild(componentRef.location.nativeElement);
                }
                else {
                    i4.BasePageComponent.clear();
                }
                if (this.vcRef.length > 1) {
                    this.vcRef.remove(1);
                }
            });
        }
        renderPrefabPreviewPage() {
            this.router.navigate(['prefab-preview']);
        }
        loadPage(pageName) {
            this.ngZone.run(() => {
                if (pageName) {
                    this.renderPage(pageName);
                }
            });
        }
        ngOnInit() {
            if (this.app.isPrefabType) {
                // there is only one route
                this.renderPrefabPreviewPage();
            }
            else {
                $(this.getTargetNode()).find('>div').first().remove();
                this.subscription = this.route.params.subscribe(({ pageName }) => {
                    this.loadPage(pageName);
                });
            }
        }
        ngOnDestroy() {
            this.vcRef.clear();
            if (this.subscription) {
                this.subscription.unsubscribe();
            }
        }
        ngOnAttach() {
            this.getTargetNode().appendChild(this.instance.$page[0]);
            this.instance.ngOnAttach();
        }
        ngOnDetach() {
            this.instance.ngOnDetach();
        }
        static { this.ɵfac = function PageWrapperComponent_Factory(t) { return new (t || PageWrapperComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.Injector), i0__namespace.ɵɵdirectiveInject(i1__namespace.ActivatedRoute), i0__namespace.ɵɵdirectiveInject(i0__namespace.ViewContainerRef), i0__namespace.ɵɵdirectiveInject(i0__namespace.ApplicationRef), i0__namespace.ɵɵdirectiveInject(i2__namespace.MetadataService), i0__namespace.ɵɵdirectiveInject(i3__namespace.SecurityService), i0__namespace.ɵɵdirectiveInject(i4__namespace.AppManagerService), i0__namespace.ɵɵdirectiveInject(i5__namespace.App), i0__namespace.ɵɵdirectiveInject(i0__namespace.NgZone), i0__namespace.ɵɵdirectiveInject(i0__namespace.ElementRef), i0__namespace.ɵɵdirectiveInject(i5__namespace.AbstractSpinnerService), i0__namespace.ɵɵdirectiveInject(i4__namespace.ComponentRefProvider), i0__namespace.ɵɵdirectiveInject(i1__namespace.Router)); }; }
        static { this.ɵcmp = /*@__PURE__*/ i0__namespace.ɵɵdefineComponent({ type: PageWrapperComponent, selectors: [["app-page-outlet"]], decls: 1, vars: 0, template: function PageWrapperComponent_Template(rf, ctx) { if (rf & 1) {
                i0__namespace.ɵɵelement(0, "div");
            } }, encapsulation: 2 }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(PageWrapperComponent, [{
            type: i0.Component,
            args: [{
                    selector: 'app-page-outlet',
                    template: '<div></div>'
                }]
        }], () => [{ type: i0__namespace.Injector }, { type: i1__namespace.ActivatedRoute }, { type: i0__namespace.ViewContainerRef }, { type: i0__namespace.ApplicationRef }, { type: i2__namespace.MetadataService }, { type: i3__namespace.SecurityService }, { type: i4__namespace.AppManagerService }, { type: i5__namespace.App }, { type: i0__namespace.NgZone }, { type: i0__namespace.ElementRef }, { type: i5__namespace.AbstractSpinnerService }, { type: i4__namespace.ComponentRefProvider }, { type: i1__namespace.Router }], null); })();
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassDebugInfo(PageWrapperComponent, { className: "PageWrapperComponent", filePath: "app/components/page-wrapper.component.ts", lineNumber: 25 }); })();

    const appDependenciesResolve = {
        securityConfig: i4.SecurityConfigResolve,
        metadata: i4.MetadataResolve,
        appMetaConfig: i4.AppExtensionJSResolve
    };
    const routes = [
        {
            path: '',
            pathMatch: 'full',
            resolve: appDependenciesResolve,
            component: i4.EmptyPageComponent
        },
        {
            path: 'prefab-preview',
            pathMatch: 'full',
            resolve: appDependenciesResolve,
            component: i4.PrefabPreviewComponent
        },
        {
            path: ':pageName',
            pathMatch: 'full',
            resolve: appDependenciesResolve,
            component: PageWrapperComponent,
            canDeactivate: [i4.CanDeactivatePageGuard]
        }
    ];

    class AppJSProviderService extends i4.AppJSProvider {
        constructor($http) {
            super();
            this.$http = $http;
        }
        getAppScriptFn() {
            return this.$http.get('./app.js', { responseType: 'text' })
                .toPromise()
                .then(script => new Function('App', 'Utils', 'Injector', script));
        }
        static { this.ɵfac = function AppJSProviderService_Factory(t) { return new (t || AppJSProviderService)(i0__namespace.ɵɵinject(i1$1__namespace.HttpClient)); }; }
        static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: AppJSProviderService, factory: AppJSProviderService.ɵfac, providedIn: 'root' }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(AppJSProviderService, [{
            type: i0.Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], () => [{ type: i1$1__namespace.HttpClient }], null); })();

    const cache$1 = new Map();
    class AppResourceManagerService {
        get(url, useCache) {
            const cachedResponse = cache$1.get(url);
            if (cachedResponse) {
                return Promise.resolve(cachedResponse);
            }
            return this.$http.get(url).then(response => {
                if (useCache) {
                    cache$1.set(url, response);
                }
                return response;
            });
        }
        clearCache() {
            cache$1.clear();
        }
        constructor($http) {
            this.$http = $http;
        }
        static { this.ɵfac = function AppResourceManagerService_Factory(t) { return new (t || AppResourceManagerService)(i0__namespace.ɵɵinject(i5__namespace.AbstractHttpService)); }; }
        static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: AppResourceManagerService, factory: AppResourceManagerService.ɵfac }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(AppResourceManagerService, [{
            type: i0.Injectable
        }], () => [{ type: i5__namespace.AbstractHttpService }], null); })();

    class AppVariablesProviderService extends i4.AppVariablesProvider {
        constructor(resourceManager) {
            super();
            this.resourceManager = resourceManager;
        }
        async getAppVariables() {
            return this.resourceManager.get('./app.variables.json');
        }
        static { this.ɵfac = function AppVariablesProviderService_Factory(t) { return new (t || AppVariablesProviderService)(i0__namespace.ɵɵinject(AppResourceManagerService)); }; }
        static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: AppVariablesProviderService, factory: AppVariablesProviderService.ɵfac, providedIn: 'root' }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(AppVariablesProviderService, [{
            type: i0.Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], () => [{ type: AppResourceManagerService }], null); })();

    class AppExtensionProviderService extends i4.AppExtensionProvider {
        // With renderer create element, added onloaded callback the append to the body
        loadFormatterConfigScript(callback) {
            try {
                i5.appendScriptToHead(callback);
            }
            catch (e) {
                console.warn('Error while loading the formatters.js file');
            }
        }
        static { this.ɵfac = /*@__PURE__*/ (() => { let ɵAppExtensionProviderService_BaseFactory; return function AppExtensionProviderService_Factory(t) { return (ɵAppExtensionProviderService_BaseFactory || (ɵAppExtensionProviderService_BaseFactory = i0__namespace.ɵɵgetInheritedFactory(AppExtensionProviderService)))(t || AppExtensionProviderService); }; })(); }
        static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: AppExtensionProviderService, factory: AppExtensionProviderService.ɵfac, providedIn: 'root' }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(AppExtensionProviderService, [{
            type: i0.Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], null, null); })();

    const fragmentCache = new Map();
    window.resourceCache = fragmentCache;
    const componentFactoryRefCache = new Map();
    componentFactoryRefCache.set(i4.ComponentType.PAGE, new Map());
    componentFactoryRefCache.set(i4.ComponentType.PARTIAL, new Map());
    componentFactoryRefCache.set(i4.ComponentType.PREFAB, new Map());
    const _decodeURIComponent = (str) => decodeURIComponent(str.replace(/\+/g, ' '));
    const getFragmentUrl = (fragmentName, type, options) => {
        if (type === i4.ComponentType.PAGE || type === i4.ComponentType.PARTIAL) {
            return options && options.prefab ? i4.getPrefabPartialJsonUrl(options.prefab, fragmentName) : `./pages/${fragmentName}/page.min.json`;
        }
        else if (type === i4.ComponentType.PREFAB) {
            return i4.getPrefabMinJsonUrl(fragmentName);
        }
    };
    const scriptCache = new Map();
    const execScript = (script, identifier, ctx, instance, app, utils) => {
        let fn = scriptCache.get(identifier);
        // Fix for [WMS-21196]: Incorrect script is being assigned,  when 2 prefabs have same partial name (i.e. same identifier).
        if ((ctx === 'Partial' && !lodashEs.isUndefined(instance.Prefab)) || !fn) {
            fn = new Function(ctx, 'App', 'Utils', script);
            scriptCache.set(identifier, fn);
        }
        fn(instance, app, utils);
    };
    class BaseDynamicComponent {
        init() { }
    }
    const getDynamicModule = (componentRef) => {
        return i0.NgModule({
            declarations: [componentRef],
            imports: [
                i4.RuntimeBaseModule,
            ],
            schemas: [i0.CUSTOM_ELEMENTS_SCHEMA, i0.NO_ERRORS_SCHEMA]
        })(class DynamicModule {
        });
    };
    const getDynamicComponent = (componentName, type, template, css, script, variables) => {
        const componentDef = {
            template,
            styles: [css],
            encapsulation: i0.ViewEncapsulation.None
        };
        let BaseClass = BaseDynamicComponent;
        let selector = '';
        let context = '';
        switch (type) {
            case i4.ComponentType.PAGE:
                BaseClass = i4.BasePageComponent;
                selector = `app-page-${componentName}`;
                context = 'Page';
                break;
            case i4.ComponentType.PARTIAL:
                BaseClass = i4.BasePartialComponent;
                selector = `app-partial-${componentName}`;
                context = 'Partial';
                break;
            case i4.ComponentType.PREFAB:
                BaseClass = i4.BasePrefabComponent;
                selector = `app-prefab-${componentName}`;
                context = 'Prefab';
                break;
        }
        let DynamicComponent = class DynamicComponent extends BaseClass {
            constructor(injector) {
                super();
                this.injector = injector;
                this.isDynamicComponent = true;
                this.injector = injector;
                switch (type) {
                    case i4.ComponentType.PAGE:
                        this.pageName = componentName;
                        break;
                    case i4.ComponentType.PARTIAL:
                        this.partialName = componentName;
                        break;
                    case i4.ComponentType.PREFAB:
                        this.prefabName = componentName;
                        break;
                }
                super.init();
            }
            evalUserScript(instance, appContext, utils) {
                execScript(script, selector, context, instance, appContext, utils);
            }
            getVariables() {
                return JSON.parse(variables);
            }
            // in preview mode, there will be no function registered. functions will be generated dynamically through $parseEvent and $parseExpr
            getExpressions() {
                return {};
            }
        };
        DynamicComponent = tslib.__decorate([
            tslib.__param(0, i0.Inject(i0.Injector)),
            tslib.__metadata("design:paramtypes", [i0.Injector])
        ], DynamicComponent);
        const component = i0.Component({
            ...componentDef,
            selector,
            providers: [
                {
                    provide: i5.UserDefinedExecutionContext,
                    useExisting: DynamicComponent
                }
            ]
        })(DynamicComponent);
        return component;
    };
    class ComponentRefProviderService extends i4.ComponentRefProvider {
        loadResourcesOfFragment(componentName, componentType, options) {
            const url = getFragmentUrl(componentName, componentType, options);
            const resource = fragmentCache.get(url);
            if (resource) {
                return Promise.resolve(resource);
            }
            return this.resouceMngr.get(url, true)
                .then(({ markup, script, styles, variables }) => {
                const response = {
                    markup: transpiler.transpile(_decodeURIComponent(markup)).markup,
                    script: _decodeURIComponent(script),
                    styles: transpiler.scopeComponentStyles(componentName, componentType, _decodeURIComponent(styles)),
                    variables: i5.getValidJSON(_decodeURIComponent(variables))
                };
                fragmentCache.set(url, response);
                return response;
            }, e => {
                const status = e.details.status;
                const errorMsgMap = {
                    404: this.app.appLocale.MESSAGE_PAGE_NOT_FOUND || 'The page you are trying to reach is not available',
                    403: this.app.appLocale.LABEL_ACCESS_DENIED || 'Access Denied'
                };
                return Promise.reject(errorMsgMap[status]);
            });
        }
        constructor(resouceMngr, app, appManager, compiler) {
            super();
            this.resouceMngr = resouceMngr;
            this.app = app;
            this.appManager = appManager;
            this.compiler = compiler;
        }
        async getComponentFactoryRef(componentName, componentType, options) {
            // check in the cache.
            const componentFactoryMap = componentFactoryRefCache.get(componentType);
            let componentFactoryRef;
            if (componentFactoryMap) {
                const updatedComponentName = (options && options['prefab']) ? options['prefab'] + componentName : componentName;
                componentFactoryRef = componentFactoryMap.get(updatedComponentName);
                if (componentFactoryRef) {
                    return componentFactoryRef;
                }
            }
            return this.loadResourcesOfFragment(componentName, componentType, options)
                .then(({ markup, script, styles, variables }) => {
                const componentDef = getDynamicComponent(componentName, componentType, markup, styles, script, JSON.stringify(variables));
                const moduleDef = getDynamicModule(componentDef);
                componentFactoryRef = this.compiler
                    .compileModuleAndAllComponentsSync(moduleDef)
                    .componentFactories
                    .filter(factory => // @ts-ignore
                 factory.componentType === componentDef)[0];
                const updatedComponentName = (options && options['prefab']) ? options['prefab'] + componentName : componentName;
                componentFactoryRefCache.get(componentType).set(updatedComponentName, componentFactoryRef);
                return componentFactoryRef;
            }, (err) => {
                if (err) {
                    const msg = "Error while loading page";
                    // console the error for easy debugging
                    console.log(msg, err);
                    this.appManager.notifyApp(lodashEs.isString(err) ? err : msg + ', check browser console for error details', 'error');
                }
            });
        }
        // clears the cache map
        clearComponentFactoryRefCache() {
            this.resouceMngr.clearCache();
            fragmentCache.clear();
            componentFactoryRefCache.forEach(map => {
                map.clear();
            });
        }
        static { this.ɵfac = function ComponentRefProviderService_Factory(t) { return new (t || ComponentRefProviderService)(i0__namespace.ɵɵinject(AppResourceManagerService), i0__namespace.ɵɵinject(i5__namespace.App), i0__namespace.ɵɵinject(i4__namespace.AppManagerService), i0__namespace.ɵɵinject(i0__namespace.Compiler)); }; }
        static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: ComponentRefProviderService, factory: ComponentRefProviderService.ɵfac }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(ComponentRefProviderService, [{
            type: i0.Injectable
        }], () => [{ type: AppResourceManagerService }, { type: i5__namespace.App }, { type: i4__namespace.AppManagerService }, { type: i0__namespace.Compiler }], null); })();

    const cache = new Map();
    class PrefabConfigProviderService extends i4.PrefabConfigProvider {
        constructor(resourceMngr) {
            super();
            this.resourceMngr = resourceMngr;
        }
        getConfig(prefabName) {
            const config = cache.get(prefabName);
            if (config) {
                return Promise.resolve(config);
            }
            return this.resourceMngr.get(i4.getPrefabConfigUrl(prefabName))
                .then(_config => {
                cache.set(prefabName, _config);
                return _config;
            });
        }
        static { this.ɵfac = function PrefabConfigProviderService_Factory(t) { return new (t || PrefabConfigProviderService)(i0__namespace.ɵɵinject(AppResourceManagerService)); }; }
        static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: PrefabConfigProviderService, factory: PrefabConfigProviderService.ɵfac }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(PrefabConfigProviderService, [{
            type: i0.Injectable
        }], () => [{ type: AppResourceManagerService }], null); })();

    const routerModule = i1.RouterModule.forRoot(routes, { useHash: true, scrollPositionRestoration: 'top' });
    const toastrModule = ngxToastr.ToastNoAnimationModule.forRoot({ maxOpened: 1, autoDismiss: true });
    // In angular 15, xsrf headerName should not be null. Angular 15 is not using default header value like it used to send in calls
    // for angular 12 if the headerName is null . The user has to take care of not sending null values. Then ng 15 uses default value for headerName
    let xsrfHeaderName = i5.getWmProjectProperties().xsrf_header_name;
    let xsrfOptions = {
        cookieName: 'wm_xsrf_token'
    };
    if (xsrfHeaderName) {
        xsrfOptions['headerName'] = xsrfHeaderName;
    }
    const httpClientXsrfModule = i1$1.HttpClientXsrfModule.withOptions(xsrfOptions);
    const modalModule = modal.ModalModule.forRoot();
    const bsDatePickerModule = datepicker.BsDatepickerModule.forRoot();
    const timepickerModule = timepicker.TimepickerModule.forRoot();
    const bsDropdownModule = dropdown.BsDropdownModule.forRoot();
    const paginationModule = pagination.PaginationModule.forRoot();
    const typeaheadModule = typeahead.TypeaheadModule.forRoot();
    const progressbarModule = progressbar.ProgressbarModule.forRoot();
    const carouselModule = carousel.CarouselModule.forRoot();
    const popoverModule = popover.PopoverModule.forRoot();
    const ngCircleProgressModule = ngCircleProgress.NgCircleProgressModule.forRoot({});
    const tooltipModule = tooltip.TooltipModule.forRoot();
    const componentsModule = [
        // NGX Bootstrap
        datepicker.BsDatepickerModule,
        timepicker.TimepickerModule,
        dropdown.BsDropdownModule,
        pagination.PaginationModule,
        typeahead.TypeaheadModule,
        progressbar.ProgressbarModule,
        carousel.CarouselModule,
        popover.PopoverModule,
        ngCircleProgress.NgCircleProgressModule,
        tooltip.TooltipModule,
        // Basic widgets
        basic.BasicModule,
        progress.ProgressModule,
        richTextEditor.RichTextEditorModule,
        search.SearchModule,
        tree.TreeModule,
        // Input
        calendar.CalendarModule,
        chips.ChipsModule,
        colorPicker.ColorPickerModule,
        currency.CurrencyModule,
        epoch.EpochModule,
        fileUpload.FileUploadModule,
        input.InputModule,
        rating.RatingModule,
        slider.SliderModule,
        // Data
        card.CardModule,
        form.FormModule,
        list.ListModule,
        liveTable.LiveTableModule,
        pagination$1.PaginationModule,
        table.TableModule,
        // chart
        chart.ChartModule,
        // container modules
        accordion.AccordionModule,
        linearLayout.LinearLayoutModule,
        layoutGrid.LayoutGridModule,
        panel.PanelModule,
        tabs.TabsModule,
        tile.TileModule,
        wizard.WizardModule,
        // dialogs
        alertDialog.AlertDialogModule,
        iframeDialog.IframeDialogModule,
        loginDialog.LoginDialogModule,
        partialDialog.PartialDialogModule,
        // navigation
        breadcrumb.BreadcrumbModule,
        menu.MenuModule,
        navbar.NavbarModule,
        popover$1.PopoverModule,
        // Advanced
        carousel$1.CarouselModule,
        login.LoginModule,
        marquee.MarqueeModule,
        page.PageModule,
        footer.FooterModule,
        header.HeaderModule,
        leftPanel.LeftPanelModule,
        rightPanel.RightPanelModule,
        topNav.TopNavModule,
        prefab.PrefabModule
    ];
    i4.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS.push(...componentsModule);
    i4.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS.push(...dynamic.MOBILE_COMPONENT_MODULES_FOR_ROOT);
    i4.REQUIRED_MODULES_FOR_DYNAMIC_COMPONENTS.push(forms.FormsModule, forms.ReactiveFormsModule);
    exports.AppModule = class AppModule {
        constructor(app, inj, componentRefProvider) {
            this.app = app;
            this.inj = inj;
            this.componentRefProvider = componentRefProvider;
            if (window['cordova']) {
                // clear the cached urls on logout, to load the Login Page and not the Main Page as app reload(window.location.reload) is not invoked in mobile
                this.app.subscribe('userLoggedOut', this.componentRefProvider.clearComponentFactoryRefCache.bind(this.componentRefProvider));
            }
        }
    };
    exports.AppModule = tslib.__decorate([
        i0.NgModule({
            declarations: [
                PageWrapperComponent
            ],
            imports: [
                platformBrowser.BrowserModule,
                animations.BrowserAnimationsModule,
                common.CommonModule,
                i1.RouterModule,
                i1$1.HttpClientModule,
                modalModule,
                bsDatePickerModule,
                timepickerModule,
                bsDropdownModule,
                paginationModule,
                typeaheadModule,
                tooltipModule,
                progressbarModule,
                carouselModule,
                popoverModule,
                ngCircleProgressModule,
                routerModule,
                toastrModule,
                httpClientXsrfModule,
                dynamic.MobileRuntimeDynamicModule,
                i4.WM_MODULES_FOR_ROOT
            ],
            providers: [
                AppResourceManagerService,
                { provide: i4.AppJSProvider, useClass: AppJSProviderService },
                { provide: i4.AppVariablesProvider, useClass: AppVariablesProviderService },
                { provide: i4.AppExtensionProvider, useClass: AppExtensionProviderService },
                { provide: i4.ComponentRefProvider, useClass: ComponentRefProviderService },
                { provide: i5.PartialRefProvider, useClass: ComponentRefProviderService },
                { provide: i4.PrefabConfigProvider, useClass: PrefabConfigProviderService },
                { provide: i1.RouteReuseStrategy, useClass: i4.WmRouteReuseStrategy }
            ],
            bootstrap: [i4.AppComponent]
        }),
        tslib.__metadata("design:paramtypes", [i5.App, i0.Injector, i4.ComponentRefProvider])
    ], exports.AppModule);

    const DEBUG_MODE = 'debugMode';
    if (sessionStorage.getItem(DEBUG_MODE) !== 'true') {
        i0.enableProdMode();
    }
    console.time('bootstrap');
    document.addEventListener('DOMContentLoaded', () => {
        new Promise(resolve => {
            if (window['cordova']) {
                document.addEventListener('deviceready', resolve);
            }
            else {
                resolve();
            }
        }).then(() => platformBrowserDynamic.platformBrowserDynamic().bootstrapModule(exports.AppModule))
            .then((appModuleRef) => {
            const applicationRef = appModuleRef.injector.get(i0.ApplicationRef);
            window.addEventListener('unload', () => {
                applicationRef.components.map(c => c && c.destroy());
            });
            console.timeEnd('bootstrap');
        }, err => console.log(err));
    });
    window.debugMode = function (on) {
        if (lodashEs.isEmpty(on)) {
            on = true;
        }
        const value = on ? 'true' : 'false';
        if (sessionStorage.getItem(DEBUG_MODE) !== value) {
            sessionStorage.setItem(DEBUG_MODE, value);
            window.location.reload();
        }
    };

    exports.AppExtensionProviderService = AppExtensionProviderService;
    exports.AppJSProviderService = AppJSProviderService;
    exports.AppResourceManagerService = AppResourceManagerService;
    exports.AppVariablesProviderService = AppVariablesProviderService;
    exports.ComponentRefProviderService = ComponentRefProviderService;
    exports.PageWrapperComponent = PageWrapperComponent;
    exports.PrefabConfigProviderService = PrefabConfigProviderService;
    exports.bsDatePickerModule = bsDatePickerModule;
    exports.bsDropdownModule = bsDropdownModule;
    exports.carouselModule = carouselModule;
    exports.httpClientXsrfModule = httpClientXsrfModule;
    exports.modalModule = modalModule;
    exports.ngCircleProgressModule = ngCircleProgressModule;
    exports.paginationModule = paginationModule;
    exports.popoverModule = popoverModule;
    exports.progressbarModule = progressbarModule;
    exports.routerModule = routerModule;
    exports.timepickerModule = timepickerModule;
    exports.toastrModule = toastrModule;
    exports.tooltipModule = tooltipModule;
    exports.typeaheadModule = typeaheadModule;

}));
