import * as i0 from '@angular/core';
import { inject, Injectable, NgModule } from '@angular/core';
import { PreviewService, NavigatorNode, gettext, hookRoute, ViewContext, hookNavigator, hookPreview } from '@c8y/ngx-components';
import { map, first } from 'rxjs';

class DatapointExplorerNavigationFactory {
    constructor() {
        this.betaPreviewService = inject(PreviewService);
    }
    get() {
        return this.betaPreviewService.getState$('ui.datapoint-explorer.v2').pipe(map(state => {
            if (state) {
                return [
                    new NavigatorNode({
                        label: gettext('Data explorer'),
                        featureId: 'dataPointExplorer',
                        path: 'datapointexplorer-v2',
                        icon: 'c8y-data-explorer',
                        routerLinkExact: false
                    })
                ];
            }
            return [];
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatapointExplorerNavigationFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatapointExplorerNavigationFactory }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatapointExplorerNavigationFactory, decorators: [{
            type: Injectable
        }] });

function canActivateDatapointExplorer() {
    const betaPreviewService = inject(PreviewService);
    return betaPreviewService.getState$('ui.datapoint-explorer.v2').pipe(first());
}
class DatapointExplorerModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatapointExplorerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: DatapointExplorerModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatapointExplorerModule, providers: [
            hookRoute([
                {
                    path: 'datapointexplorer-v2',
                    loadComponent: () => import('@c8y/ngx-components/datapoint-explorer/view').then(m => m.DatapointExplorerComponent),
                    canActivate: [canActivateDatapointExplorer]
                },
                {
                    context: ViewContext.Group,
                    path: 'data_explorer-v2',
                    priority: 800,
                    icon: 'c8y-data-explorer',
                    label: gettext('Data Explorer'),
                    loadComponent: () => import('@c8y/ngx-components/datapoint-explorer/view').then(m => m.DatapointExplorerComponent),
                    featureId: 'dataExplorer',
                    canActivate: [canActivateDatapointExplorer]
                },
                {
                    context: ViewContext.Device,
                    path: 'data_explorer-v2',
                    priority: 800,
                    icon: 'c8y-data-explorer',
                    label: gettext('Data Explorer'),
                    loadComponent: () => import('@c8y/ngx-components/datapoint-explorer/view').then(m => m.DatapointExplorerComponent),
                    featureId: 'dataExplorer',
                    canActivate: [canActivateDatapointExplorer]
                }
            ]),
            hookNavigator(DatapointExplorerNavigationFactory),
            hookPreview({
                key: 'ui.datapoint-explorer.v2',
                label: 'Data point explorer',
                description: () => import('@c8y/style/markdown-files/datapoint-explorer-preview.md').then(m => m.default),
                settings: {
                    reload: true
                }
            })
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatapointExplorerModule, decorators: [{
            type: NgModule,
            args: [{
                    providers: [
                        hookRoute([
                            {
                                path: 'datapointexplorer-v2',
                                loadComponent: () => import('@c8y/ngx-components/datapoint-explorer/view').then(m => m.DatapointExplorerComponent),
                                canActivate: [canActivateDatapointExplorer]
                            },
                            {
                                context: ViewContext.Group,
                                path: 'data_explorer-v2',
                                priority: 800,
                                icon: 'c8y-data-explorer',
                                label: gettext('Data Explorer'),
                                loadComponent: () => import('@c8y/ngx-components/datapoint-explorer/view').then(m => m.DatapointExplorerComponent),
                                featureId: 'dataExplorer',
                                canActivate: [canActivateDatapointExplorer]
                            },
                            {
                                context: ViewContext.Device,
                                path: 'data_explorer-v2',
                                priority: 800,
                                icon: 'c8y-data-explorer',
                                label: gettext('Data Explorer'),
                                loadComponent: () => import('@c8y/ngx-components/datapoint-explorer/view').then(m => m.DatapointExplorerComponent),
                                featureId: 'dataExplorer',
                                canActivate: [canActivateDatapointExplorer]
                            }
                        ]),
                        hookNavigator(DatapointExplorerNavigationFactory),
                        hookPreview({
                            key: 'ui.datapoint-explorer.v2',
                            label: 'Data point explorer',
                            description: () => import('@c8y/style/markdown-files/datapoint-explorer-preview.md').then(m => m.default),
                            settings: {
                                reload: true
                            }
                        })
                    ]
                }]
        }] });

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

export { DatapointExplorerModule };
//# sourceMappingURL=c8y-ngx-components-datapoint-explorer.mjs.map
